Пример #1
0
try:
    _st_.inline(_sage_const_24, tableNewton)
except:
    _st_.goboom(_sage_const_383)
try:
    _st_.inline(_sage_const_25,
                latex(round(Lagrange_1(_sage_const_1p15), _sage_const_3)))
except:
    _st_.goboom(_sage_const_385)
_st_.blockbegin()
try:
    from sage.calculus.desolvers import desolve_rk4
    t, y = var('t y')
    zk_rk4 = desolve_rk4(
        y / t - _sage_const_1,
        y,
        ics=[_sage_const_1, _sage_const_1],
        end_points=_sage_const_1p21,
        step=_sage_const_0p1)  # nếu dùng đúng 1.2 thì nó lại bỏ số đó ra
    tk_rk4 = [i for i, j in zk_rk4]
    yk_rk4 = [j for i, j in zk_rk4]
    # Tạo table trong Latex
    tableRK4 = r"\begin{tabular}{l|c|l}"
    tableRK4 += r"$k$ & $t_k$ & $y_k$ \\ \hline"
    for i in range(_sage_const_3):
        tableRK4 += latex(i) + r"&" + latex(round(
            tk_rk4[i], _sage_const_1)) + r"&" + latex(
                round(yk_rk4[i], _sage_const_4)) + r"\\"
    tableRK4 += r"\end{tabular}"
except:
    _st_.goboom(_sage_const_412)
_st_.blockend()
Пример #2
0
 _st_.inline(_sage_const_15 , latex(Lagrange_1.expand()))
except:
 _st_.goboom(_sage_const_400 )
try:
 _st_.inline(_sage_const_16 , tableNewton)
except:
 _st_.goboom(_sage_const_404 )
try:
 _st_.inline(_sage_const_17 , latex(round(Lagrange_1(_sage_const_0p5 ),_sage_const_3 )))
except:
 _st_.goboom(_sage_const_406 )
_st_.blockbegin()
try:
  from sage.calculus.desolvers import desolve_rk4
  t,y=var('t y')
  zk_rk4=desolve_rk4(t+y,y,ics=[_sage_const_0 ,_sage_const_1 ],end_points=_sage_const_0p41 ,step=_sage_const_0p2 ) # dùng đúng số 0.4 cũng được, nhưng có lúc nó lại bỏ số cuối ra
  tk_rk4=[i for i,j in zk_rk4]
  yk_rk4=[j for i,j in zk_rk4]
  # Tạo table trong Latex
  tableRK4=r"\begin{tabular}{l|c|l}"
  tableRK4+=r"$k$ & $t_k$ & $y_k$ \\ \hline"
  for i in range(_sage_const_3 ):
    tableRK4+=latex(i) + r"&" + latex(round(tk_rk4[i],_sage_const_1 )) + r"&" + latex(round(yk_rk4[i],_sage_const_4 )) + r"\\"
  tableRK4+=r"\end{tabular}"
except:
 _st_.goboom(_sage_const_441 )
_st_.blockend()
try:
 _st_.inline(_sage_const_18 , tableRK4)
except:
 _st_.goboom(_sage_const_443 )
 _st_.inline(_sage_const_15 , latex(Lagrange_1.expand()))
except:
 _st_.goboom(_sage_const_366 )
try:
 _st_.inline(_sage_const_16 , tableNewton)
except:
 _st_.goboom(_sage_const_370 )
try:
 _st_.inline(_sage_const_17 , latex(round(Lagrange_1(_sage_const_0p5 ),_sage_const_3 )))
except:
 _st_.goboom(_sage_const_372 )
_st_.blockbegin()
try:
  from sage.calculus.desolvers import desolve_rk4
  t,y=var('t y')
  zk_rk4=desolve_rk4(t+y,y,ics=[_sage_const_0 ,_sage_const_1 ],end_points=_sage_const_0p41 ,step=_sage_const_0p2 ) # dùng đúng số 0.4 cũng được, nhưng có lúc nó lại bỏ số cuối ra
  tk_rk4=[i for i,j in zk_rk4]
  yk_rk4=[j for i,j in zk_rk4]
  # Tạo table trong Latex
  tableRK4=r"\begin{tabular}{l|c|l}"
  tableRK4+=r"$k$ & $t_k$ & $y_k$ \\ \hline"
  for i in range(_sage_const_3 ):
    tableRK4+=latex(i) + r"&" + latex(round(tk_rk4[i],_sage_const_1 )) + r"&" + latex(round(yk_rk4[i],_sage_const_4 )) + r"\\"
  tableRK4+=r"\end{tabular}"
except:
 _st_.goboom(_sage_const_399 )
_st_.blockend()
try:
 _st_.inline(_sage_const_18 , tableRK4)
except:
 _st_.goboom(_sage_const_401 )
    _st_.goboom(_sage_const_428)
try:
    _st_.inline(_sage_const_24, tableNewton)
except:
    _st_.goboom(_sage_const_432)
try:
    _st_.inline(_sage_const_25, latex(round(Lagrange_1(_sage_const_1p15), _sage_const_3)))
except:
    _st_.goboom(_sage_const_434)
_st_.blockbegin()
try:
    from sage.calculus.desolvers import desolve_rk4

    t, y = var("t y")
    zk_rk4 = desolve_rk4(
        y / t - _sage_const_1, y, ics=[_sage_const_1, _sage_const_1], end_points=_sage_const_1p21, step=_sage_const_0p1
    )  # nếu dùng đúng 1.2 thì nó lại bỏ số đó ra
    tk_rk4 = [i for i, j in zk_rk4]
    yk_rk4 = [j for i, j in zk_rk4]
    # Tạo table trong Latex
    tableRK4 = r"\begin{tabular}{l|c|l}"
    tableRK4 += r"$k$ & $t_k$ & $y_k$ \\ \hline"
    for i in range(_sage_const_3):
        tableRK4 += (
            latex(i)
            + r"&"
            + latex(round(tk_rk4[i], _sage_const_1))
            + r"&"
            + latex(round(yk_rk4[i], _sage_const_4))
            + r"\\"
        )