Skip to content

Instantly share code, notes, and snippets.

@ketch
Last active May 17, 2022 07:04
Show Gist options
  • Select an option

  • Save ketch/e0f0c028e08dbe39e7cecb03ff4d2748 to your computer and use it in GitHub Desktop.

Select an option

Save ketch/e0f0c028e08dbe39e7cecb03ff4d2748 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In this notebook we use `bseries.jl` to investigate error expansions for RK methods applied to specific problems."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"# Load the packages we will use. These must first be installed using: import Pkg; Pkg.add(\"package_name\")\n",
"using BSeries\n",
"using Latexify\n",
"using RootedTrees\n",
"using Symbolics\n",
"import SymPy; sp=SymPy;"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First we specify the Butcher coefficients of the RK method. This can include symbolic expressions and parameterized families of methods."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$F_{f}\\mathopen{}\\left( \\varnothing \\right)\\mathclose{} + h F_{f}\\mathopen{}\\left( \\rootedtree[] \\right)\\mathclose{} + \\frac{h^{2}}{2} F_{f}\\mathopen{}\\left( \\rootedtree[[]] \\right)\\mathclose{} + \\frac{h^{3}}{8 \\alpha} F_{f}\\mathopen{}\\left( \\rootedtree[[][]] \\right)\\mathclose{}$"
],
"text/plain": [
"L\"$F_{f}\\mathopen{}\\left( \\varnothing \\right)\\mathclose{} + h F_{f}\\mathopen{}\\left( \\rootedtree[] \\right)\\mathclose{} + \\frac{h^{2}}{2} F_{f}\\mathopen{}\\left( \\rootedtree[[]] \\right)\\mathclose{} + \\frac{h^{3}}{8 \\alpha} F_{f}\\mathopen{}\\left( \\rootedtree[[][]] \\right)\\mathclose{}$\""
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"α = sp.symbols(\"α\", real=true)\n",
"A = [0 0; 1/(2*α) 0]; b = [1-α, α]; c = [0, 1/(2*α)]\n",
"coeffs = bseries(A,b,c,3)\n",
"latexify(coeffs, cdot=false)"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$F_{f}\\mathopen{}\\left( \\varnothing \\right)\\mathclose{} + h F_{f}\\mathopen{}\\left( \\rootedtree[] \\right)\\mathclose{} + \\frac{1}{2} h^{2} F_{f}\\mathopen{}\\left( \\rootedtree[[]] \\right)\\mathclose{} + \\frac{1}{6} h^{3} F_{f}\\mathopen{}\\left( \\rootedtree[[[]]] \\right)\\mathclose{} + \\frac{1}{6} h^{3} F_{f}\\mathopen{}\\left( \\rootedtree[[][]] \\right)\\mathclose{} + \\frac{1}{24} h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[[[]]]] \\right)\\mathclose{} + \\frac{1}{24} h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[[][]]] \\right)\\mathclose{} + \\frac{1}{8} h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[[]][]] \\right)\\mathclose{} + \\frac{1}{24} h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[][][]] \\right)\\mathclose{} + \\frac{1}{48} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[[]]]]] \\right)\\mathclose{} + \\frac{1}{48} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[][]]]] \\right)\\mathclose{} + \\frac{1}{16} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[]][]]] \\right)\\mathclose{} + \\frac{-21246894637}{49670350848} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[]]][]] \\right)\\mathclose{} + \\frac{1}{48} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[][][]]] \\right)\\mathclose{} + \\frac{-722476128287}{1390769823744} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[][]][]] \\right)\\mathclose{} + \\frac{1970748171909370823}{42730909364772720000} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[]][[]]] \\right)\\mathclose{} + \\frac{3898363669}{40242182400} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[]][][]] \\right)\\mathclose{} + \\frac{1}{48} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[][][][]] \\right)\\mathclose{}$"
],
"text/plain": [
"L\"$F_{f}\\mathopen{}\\left( \\varnothing \\right)\\mathclose{} + h F_{f}\\mathopen{}\\left( \\rootedtree[] \\right)\\mathclose{} + \\frac{1}{2} h^{2} F_{f}\\mathopen{}\\left( \\rootedtree[[]] \\right)\\mathclose{} + \\frac{1}{6} h^{3} F_{f}\\mathopen{}\\left( \\rootedtree[[[]]] \\right)\\mathclose{} + \\frac{1}{6} h^{3} F_{f}\\mathopen{}\\left( \\rootedtree[[][]] \\right)\\mathclose{} + \\frac{1}{24} h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[[[]]]] \\right)\\mathclose{} + \\frac{1}{24} h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[[][]]] \\right)\\mathclose{} + \\frac{1}{8} h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[[]][]] \\right)\\mathclose{} + \\frac{1}{24} h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[][][]] \\right)\\mathclose{} + \\frac{1}{48} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[[]]]]] \\right)\\mathclose{} + \\frac{1}{48} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[][]]]] \\right)\\mathclose{} + \\frac{1}{16} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[]][]]] \\right)\\mathclose{} + \\frac{-21246894637}{49670350848} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[]]][]] \\right)\\mathclose{} + \\frac{1}{48} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[][][]]] \\right)\\mathclose{} + \\frac{-722476128287}{1390769823744} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[][]][]] \\right)\\mathclose{} + \\frac{1970748171909370823}{42730909364772720000} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[]][[]]] \\right)\\mathclose{} + \\frac{3898363669}{40242182400} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[]][][]] \\right)\\mathclose{} + \\frac{1}{48} h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[][][][]] \\right)\\mathclose{}$\""
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"A = Rational{Int128}[0 0 0 0 0 0 0 0;(-1//6) (1//2) 0 0 0 0 0 0;(-1//10) (1//10) (1//2) 0 0 0 0 0;(-21463//39375) (21017//26250) (-5//9) (1//2) 0 0 0 0;(-59588//54675) (118717//36450) (-4375//2187) 0 (1//2) 0 0 0;(-19993033//9443328) (28508695//3147776) (-13577105//2360832) (-4090625//3147776) (1136025//3147776) (1//2) 0 0;(367020141781//199294617600) (814214904871//22143846400) (-29834937659//1992946176) (-1983358776875//87689631744) (-6702625935//885753856) (688576//109395) (1//2) 0;(1081252805//134140608) (2639189439//74522560) (33646441//4191894) (-7873511875//210792384) (-504040617//14904512) (2110843561//115277085) (13//7) (1//2)];\n",
"b = Rational{Int128}[(1081252805//134140608),(2639189439//74522560),(33646441//4191894),(-7873511875//210792384),(-504040617//14904512),(2110843561//115277085),(13//7),(1//2)];\n",
"c = Rational{Int128}[0,(1//3),(1//2),(1//5),(2//3),(3//4),(1//4),1];\n",
"\n",
"coeffs = bseries(A,b,c,5)\n",
"latexify(coeffs, cdot=false)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Since $f$ has not been specified, the elementary differentials are indicated by the corresponding rooted tree. The rooted trees are printed as nested lists, essentially in the form used in Butcher's book. We can also print out the B-series coefficients this way:"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"TruncatedBSeries{RootedTree{Int64, Vector{Int64}}, Rational{Int128}} with 18 entries:\n",
" RootedTree{Int64}: Int64[] => 1//1\n",
" RootedTree{Int64}: [1] => 1//1\n",
" RootedTree{Int64}: [1, 2] => 1//2\n",
" RootedTree{Int64}: [1, 2, 3] => 1//6\n",
" RootedTree{Int64}: [1, 2, 2] => 1//3\n",
" RootedTree{Int64}: [1, 2, 3, 4] => 1//24\n",
" RootedTree{Int64}: [1, 2, 3, 3] => 1//12\n",
" RootedTree{Int64}: [1, 2, 3, 2] => 1//8\n",
" RootedTree{Int64}: [1, 2, 2, 2] => 1//4\n",
" RootedTree{Int64}: [1, 2, 3, 4, 5] => 1//48\n",
" RootedTree{Int64}: [1, 2, 3, 4, 4] => 1//24\n",
" RootedTree{Int64}: [1, 2, 3, 4, 3] => 1//16\n",
" RootedTree{Int64}: [1, 2, 3, 4, 2] => -21246894637//49670350848\n",
" RootedTree{Int64}: [1, 2, 3, 3, 3] => 1//8\n",
" RootedTree{Int64}: [1, 2, 3, 3, 2] => -722476128287//695384911872\n",
" RootedTree{Int64}: [1, 2, 3, 2, 3] => 1970748171909370823//213654546823863600…\n",
" RootedTree{Int64}: [1, 2, 3, 2, 2] => 3898363669//20121091200\n",
" RootedTree{Int64}: [1, 2, 2, 2, 2] => 1//2"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"coeffs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In this form, the rooted trees are printed as level sets. The corresponding coefficients are on the right. We can also get the B-series of the exact solution:"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"TruncatedBSeries{RootedTree{Int64, Vector{Int64}}, Rational{Int128}} with 18 entries:\n",
" RootedTree{Int64}: Int64[] => 1//1\n",
" RootedTree{Int64}: [1] => 1//1\n",
" RootedTree{Int64}: [1, 2] => 1//2\n",
" RootedTree{Int64}: [1, 2, 3] => 1//6\n",
" RootedTree{Int64}: [1, 2, 2] => 1//3\n",
" RootedTree{Int64}: [1, 2, 3, 4] => 1//24\n",
" RootedTree{Int64}: [1, 2, 3, 3] => 1//12\n",
" RootedTree{Int64}: [1, 2, 3, 2] => 1//8\n",
" RootedTree{Int64}: [1, 2, 2, 2] => 1//4\n",
" RootedTree{Int64}: [1, 2, 3, 4, 5] => 1//120\n",
" RootedTree{Int64}: [1, 2, 3, 4, 4] => 1//60\n",
" RootedTree{Int64}: [1, 2, 3, 4, 3] => 1//40\n",
" RootedTree{Int64}: [1, 2, 3, 4, 2] => 1//30\n",
" RootedTree{Int64}: [1, 2, 3, 3, 3] => 1//20\n",
" RootedTree{Int64}: [1, 2, 3, 3, 2] => 1//15\n",
" RootedTree{Int64}: [1, 2, 3, 2, 3] => 1//20\n",
" RootedTree{Int64}: [1, 2, 3, 2, 2] => 1//10\n",
" RootedTree{Int64}: [1, 2, 2, 2, 2] => 1//5"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"coeffs_ex = ExactSolution(coeffs)"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$F_{f}\\mathopen{}\\left( \\varnothing \\right)\\mathclose{} + h F_{f}\\mathopen{}\\left( \\rootedtree[] \\right)\\mathclose{} + 0.5 h^{2} F_{f}\\mathopen{}\\left( \\rootedtree[[]] \\right)\\mathclose{} + 0.16666666666666666 h^{3} F_{f}\\mathopen{}\\left( \\rootedtree[[[]]] \\right)\\mathclose{} + 0.16666666666666666 h^{3} F_{f}\\mathopen{}\\left( \\rootedtree[[][]] \\right)\\mathclose{} + 0.041666666666666664 h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[[[]]]] \\right)\\mathclose{} + 0.041666666666666664 h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[[][]]] \\right)\\mathclose{} + 0.125 h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[[]][]] \\right)\\mathclose{} + 0.041666666666666664 h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[][][]] \\right)\\mathclose{} + 0.008333333333333333 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[[]]]]] \\right)\\mathclose{} + 0.008333333333333333 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[][]]]] \\right)\\mathclose{} + 0.025 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[]][]]] \\right)\\mathclose{} + 0.03333333333333333 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[]]][]] \\right)\\mathclose{} + 0.008333333333333333 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[][][]]] \\right)\\mathclose{} + 0.03333333333333333 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[][]][]] \\right)\\mathclose{} + 0.025 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[]][[]]] \\right)\\mathclose{} + 0.05 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[]][][]] \\right)\\mathclose{} + 0.008333333333333333 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[][][][]] \\right)\\mathclose{}$"
],
"text/plain": [
"L\"$F_{f}\\mathopen{}\\left( \\varnothing \\right)\\mathclose{} + h F_{f}\\mathopen{}\\left( \\rootedtree[] \\right)\\mathclose{} + 0.5 h^{2} F_{f}\\mathopen{}\\left( \\rootedtree[[]] \\right)\\mathclose{} + 0.16666666666666666 h^{3} F_{f}\\mathopen{}\\left( \\rootedtree[[[]]] \\right)\\mathclose{} + 0.16666666666666666 h^{3} F_{f}\\mathopen{}\\left( \\rootedtree[[][]] \\right)\\mathclose{} + 0.041666666666666664 h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[[[]]]] \\right)\\mathclose{} + 0.041666666666666664 h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[[][]]] \\right)\\mathclose{} + 0.125 h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[[]][]] \\right)\\mathclose{} + 0.041666666666666664 h^{4} F_{f}\\mathopen{}\\left( \\rootedtree[[][][]] \\right)\\mathclose{} + 0.008333333333333333 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[[]]]]] \\right)\\mathclose{} + 0.008333333333333333 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[][]]]] \\right)\\mathclose{} + 0.025 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[]][]]] \\right)\\mathclose{} + 0.03333333333333333 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[[]]][]] \\right)\\mathclose{} + 0.008333333333333333 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[][][]]] \\right)\\mathclose{} + 0.03333333333333333 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[][]][]] \\right)\\mathclose{} + 0.025 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[]][[]]] \\right)\\mathclose{} + 0.05 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[[]][][]] \\right)\\mathclose{} + 0.008333333333333333 h^{5} F_{f}\\mathopen{}\\left( \\rootedtree[[][][][]] \\right)\\mathclose{}$\""
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"latexify(coeffs_ex,cdot=false)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Next we define our ODE. For a non-autonomous ODE, it's most convenient to just add $t$ as an additional variable. That makes the code below look a bit funny."
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"f (generic function with 1 method)"
]
},
"execution_count": 65,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@variables λ\n",
"function f(du, u, params, t)\n",
" uu, tt = u\n",
" du[1] = λ*(uu-sin(tt)) + sqrt(1-uu^2); du[2] = 1\n",
" return nothing\n",
"end"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Then we define a symbolic RHS:"
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {},
"outputs": [],
"source": [
"@variables Δt\n",
"u_sym = @variables u, t\n",
"f_sym = similar(u_sym); f(f_sym, u_sym, nothing, nothing)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Finally, we get the B-Series for our RK method applied to our ODE:"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\begin{equation}\n",
"\\left[\n",
"\\begin{array}{c}\n",
"1.0 + {\\Delta}t \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) + \\frac{1}{48} {\\Delta}t^{5} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{4} \\left( - \\frac{3}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{18 u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} - \\frac{15 u^{4}}{\\left( \\sqrt{1 - u^{2}} \\right)^{7}} \\right) - \\lambda \\sin\\left( t \\right) \\right) + \\frac{1}{24} {\\Delta}t^{4} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{3} \\left( - \\frac{3 u}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{3 u^{3}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} \\right) + \\lambda \\cos\\left( t \\right) \\right) + \\frac{1}{6} {\\Delta}t^{3} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\lambda \\sin\\left( t \\right) \\right) + \\frac{1}{2} {\\Delta}t^{2} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) + \\frac{1}{48} {\\Delta}t^{5} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{3} \\left( - \\frac{3 u}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{3 u^{3}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} \\right) + \\lambda \\cos\\left( t \\right) \\right) + \\frac{1}{48} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right)^{2} {\\Delta}t^{5} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\lambda \\sin\\left( t \\right) \\right) + \\frac{1}{6} {\\Delta}t^{3} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) + \\frac{1}{48} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right)^{3} {\\Delta}t^{5} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) + \\frac{1970748171909370823}{42730909364772720000} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right)^{2} {\\Delta}t^{5} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\frac{1}{24} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right)^{2} {\\Delta}t^{4} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) + \\frac{1}{24} {\\Delta}t^{4} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\lambda \\sin\\left( t \\right) \\right) - \\frac{722476128287}{1390769823744} {\\Delta}t^{5} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\lambda \\sin\\left( t \\right) \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\frac{3898363669}{40242182400} \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} {\\Delta}t^{5} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) \\left( - \\frac{3 u}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{3 u^{3}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} \\right) + \\frac{1}{8} {\\Delta}t^{4} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) - \\frac{18142497709}{49670350848} {\\Delta}t^{5} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) \\\\\n",
"1.0 + {\\Delta}t \\\\\n",
"\\end{array}\n",
"\\right]\n",
"\\end{equation}\n"
],
"text/plain": [
"2-element Vector{Num}:\n",
" 1.0 + Δt*(λ*(u - sin(t)) + sqrt(1 - (u^2))) + (1//48)*(Δt^5)*(((-3//1)*(sqrt(1 - (u^2))^-3) - (18//1)*(u^2)*(sqrt(1 - (u^2))^-5) - (15//1)*(u^4)*(sqrt(1 - (u^2))^-7))*((λ*(u - sin(t)) + sqrt(1 - (u^2)))^4) - λ*sin(t)) + (1//24)*(Δt^4)*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^3)*((-3//1)*u*(sqrt(1 - (u^2))^-3) - (3//1)*(u^3)*(sqrt(1 - (u^2))^-5)) + λ*cos(t)) + (1//6)*(Δt^3)*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + λ*sin(t)) + (1//2)*(Δt^2)*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t)) + (1//48)*(Δt^5)*(λ - u*(sqrt(1 - (u^2))^-1))*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^3)*((-3//1)*u*(sqrt(1 - (u^2))^-3) - (3//1)*(u^3)*(sqrt(1 - (u^2))^-5)) + λ*cos(t)) + (1//48)*(Δt^5)*((λ - u*(sqrt(1 - (u^2))^-1))^2)*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + λ*sin(t)) + (1//6)*(Δt^3)*(λ - u*(sqrt(1 - (u^2))^-1))*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t)) + (1//48)*(Δt^5)*((λ - u*(sqrt(1 - (u^2))^-1))^3)*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t)) + (1970748171909370823//42730909364772720000)*(Δt^5)*(((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + (1//24)*(Δt^4)*((λ - u*(sqrt(1 - (u^2))^-1))^2)*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t)) + (1//24)*(Δt^4)*(λ - u*(sqrt(1 - (u^2))^-1))*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + λ*sin(t)) + (3898363669//40242182400)*(Δt^5)*((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t))*((-3//1)*u*(sqrt(1 - (u^2))^-3) - (3//1)*(u^3)*(sqrt(1 - (u^2))^-5)) + (1//8)*(Δt^4)*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t))*(λ*(u - sin(t)) + sqrt(1 - (u^2)))*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) - (722476128287//1390769823744)*(Δt^5)*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + λ*sin(t))*(λ*(u - sin(t)) + sqrt(1 - (u^2)))*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) - (18142497709//49670350848)*(Δt^5)*(λ - u*(sqrt(1 - (u^2))^-1))*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t))*(λ*(u - sin(t)) + sqrt(1 - (u^2)))*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3))\n",
" 1.0 + Δt"
]
},
"execution_count": 67,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"evaluate(f_sym,u_sym,Δt,coeffs)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Here's the B-Series for the exact solution of the same ODE:"
]
},
{
"cell_type": "code",
"execution_count": 70,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\begin{equation}\n",
"1.0 + {\\Delta}t \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) + \\frac{1}{120} {\\Delta}t^{5} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{4} \\left( - \\frac{3}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{18 u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} - \\frac{15 u^{4}}{\\left( \\sqrt{1 - u^{2}} \\right)^{7}} \\right) - \\lambda \\sin\\left( t \\right) \\right) + \\frac{1}{24} {\\Delta}t^{4} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{3} \\left( - \\frac{3 u}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{3 u^{3}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} \\right) + \\lambda \\cos\\left( t \\right) \\right) + \\frac{1}{6} {\\Delta}t^{3} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\lambda \\sin\\left( t \\right) \\right) + \\frac{1}{2} {\\Delta}t^{2} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) + \\frac{1}{120} {\\Delta}t^{5} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{3} \\left( - \\frac{3 u}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{3 u^{3}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} \\right) + \\lambda \\cos\\left( t \\right) \\right) + \\frac{1}{120} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right)^{2} {\\Delta}t^{5} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\lambda \\sin\\left( t \\right) \\right) + \\frac{1}{6} {\\Delta}t^{3} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) + \\frac{1}{120} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right)^{3} {\\Delta}t^{5} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) + \\frac{1}{40} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right)^{2} {\\Delta}t^{5} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\frac{1}{24} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right)^{2} {\\Delta}t^{4} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) + \\frac{1}{24} {\\Delta}t^{4} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\lambda \\sin\\left( t \\right) \\right) + \\frac{1}{30} {\\Delta}t^{5} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\lambda \\sin\\left( t \\right) \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\frac{1}{20} \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} {\\Delta}t^{5} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) \\left( - \\frac{3 u}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{3 u^{3}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} \\right) + \\frac{1}{8} {\\Delta}t^{4} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\frac{7}{120} {\\Delta}t^{5} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right)\n",
"\\end{equation}\n"
],
"text/plain": [
"1.0 + Δt*(λ*(u - sin(t)) + sqrt(1 - (u^2))) + (1//120)*(Δt^5)*(((-3//1)*(sqrt(1 - (u^2))^-3) - (18//1)*(u^2)*(sqrt(1 - (u^2))^-5) - (15//1)*(u^4)*(sqrt(1 - (u^2))^-7))*((λ*(u - sin(t)) + sqrt(1 - (u^2)))^4) - λ*sin(t)) + (1//24)*(Δt^4)*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^3)*((-3//1)*u*(sqrt(1 - (u^2))^-3) - (3//1)*(u^3)*(sqrt(1 - (u^2))^-5)) + λ*cos(t)) + (1//6)*(Δt^3)*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + λ*sin(t)) + (1//2)*(Δt^2)*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t)) + (1//120)*(Δt^5)*(λ - u*(sqrt(1 - (u^2))^-1))*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^3)*((-3//1)*u*(sqrt(1 - (u^2))^-3) - (3//1)*(u^3)*(sqrt(1 - (u^2))^-5)) + λ*cos(t)) + (1//120)*(Δt^5)*((λ - u*(sqrt(1 - (u^2))^-1))^2)*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + λ*sin(t)) + (1//6)*(Δt^3)*(λ - u*(sqrt(1 - (u^2))^-1))*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t)) + (1//120)*(Δt^5)*((λ - u*(sqrt(1 - (u^2))^-1))^3)*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t)) + (1//40)*(Δt^5)*(((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + (1//24)*(Δt^4)*((λ - u*(sqrt(1 - (u^2))^-1))^2)*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t)) + (1//24)*(Δt^4)*(λ - u*(sqrt(1 - (u^2))^-1))*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + λ*sin(t)) + (1//30)*(Δt^5)*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + λ*sin(t))*(λ*(u - sin(t)) + sqrt(1 - (u^2)))*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + (1//20)*(Δt^5)*((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t))*((-3//1)*u*(sqrt(1 - (u^2))^-3) - (3//1)*(u^3)*(sqrt(1 - (u^2))^-5)) + (1//8)*(Δt^4)*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t))*(λ*(u - sin(t)) + sqrt(1 - (u^2)))*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + (7//120)*(Δt^5)*(λ - u*(sqrt(1 - (u^2))^-1))*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t))*(λ*(u - sin(t)) + sqrt(1 - (u^2)))*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3))"
]
},
"execution_count": 70,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"evaluate(f_sym,u_sym,Δt,coeffs_ex)[1]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"And their difference, which is the local error:"
]
},
{
"cell_type": "code",
"execution_count": 71,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\begin{equation}\n",
"\\frac{1}{80} {\\Delta}t^{5} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{4} \\left( - \\frac{3}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{18 u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} - \\frac{15 u^{4}}{\\left( \\sqrt{1 - u^{2}} \\right)^{7}} \\right) - \\lambda \\sin\\left( t \\right) \\right) + \\frac{1}{80} {\\Delta}t^{5} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{3} \\left( - \\frac{3 u}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{3 u^{3}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} \\right) + \\lambda \\cos\\left( t \\right) \\right) + \\frac{1}{80} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right)^{2} {\\Delta}t^{5} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\lambda \\sin\\left( t \\right) \\right) + \\frac{1}{80} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right)^{3} {\\Delta}t^{5} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) + \\frac{902475437790052823}{42730909364772720000} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right)^{2} {\\Delta}t^{5} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) - \\frac{3844175612059}{6953849118720} {\\Delta}t^{5} \\left( \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\lambda \\sin\\left( t \\right) \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right) + \\frac{1886254549}{40242182400} \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right)^{2} {\\Delta}t^{5} \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) \\left( - \\frac{3 u}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{3 u^{3}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} \\right) - \\frac{105199674209}{248351754240} {\\Delta}t^{5} \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\left( \\lambda - \\frac{u}{\\sqrt{1 - u^{2}}} \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) - \\lambda \\cos\\left( t \\right) \\right) \\left( \\lambda \\left( u - \\sin\\left( t \\right) \\right) + \\sqrt{1 - u^{2}} \\right) \\left( - \\frac{1}{\\sqrt{1 - u^{2}}} - \\frac{u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} \\right)\n",
"\\end{equation}\n"
],
"text/plain": [
"(1//80)*(Δt^5)*(((-3//1)*(sqrt(1 - (u^2))^-3) - (18//1)*(u^2)*(sqrt(1 - (u^2))^-5) - (15//1)*(u^4)*(sqrt(1 - (u^2))^-7))*((λ*(u - sin(t)) + sqrt(1 - (u^2)))^4) - λ*sin(t)) + (1//80)*(Δt^5)*(λ - u*(sqrt(1 - (u^2))^-1))*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^3)*((-3//1)*u*(sqrt(1 - (u^2))^-3) - (3//1)*(u^3)*(sqrt(1 - (u^2))^-5)) + λ*cos(t)) + (1//80)*(Δt^5)*((λ - u*(sqrt(1 - (u^2))^-1))^2)*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + λ*sin(t)) + (1//80)*(Δt^5)*((λ - u*(sqrt(1 - (u^2))^-1))^3)*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t)) + (902475437790052823//42730909364772720000)*(Δt^5)*(((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + (1886254549//40242182400)*(Δt^5)*((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t))*((-3//1)*u*(sqrt(1 - (u^2))^-3) - (3//1)*(u^3)*(sqrt(1 - (u^2))^-5)) - (3844175612059//6953849118720)*(Δt^5)*(((λ*(u - sin(t)) + sqrt(1 - (u^2)))^2)*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) + λ*sin(t))*(λ*(u - sin(t)) + sqrt(1 - (u^2)))*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3)) - (105199674209//248351754240)*(Δt^5)*(λ - u*(sqrt(1 - (u^2))^-1))*((λ - u*(sqrt(1 - (u^2))^-1))*(λ*(u - sin(t)) + sqrt(1 - (u^2))) - λ*cos(t))*(λ*(u - sin(t)) + sqrt(1 - (u^2)))*(-(sqrt(1 - (u^2))^-1) - (u^2)*(sqrt(1 - (u^2))^-3))"
]
},
"execution_count": 71,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expr = simplify(evaluate(f_sym,u_sym,Δt,coeffs)-evaluate(f_sym,u_sym,Δt,coeffs_ex))[1]"
]
},
{
"cell_type": "code",
"execution_count": 75,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"\\begin{equation}\n",
" - \\frac{4104944954011}{6953849118720} {\\Delta}t^{5} \\sqrt{1 - u^{2}} + \\frac{1}{80} \\lambda^{5} {\\Delta}t^{5} u - \\frac{1}{80} \\lambda^{4} {\\Delta}t^{5} \\cos\\left( t \\right) - \\frac{\\frac{347561176905793161587}{455796366557575680000} {\\Delta}t^{5} u^{2}}{\\sqrt{1 - u^{2}}} - \\frac{756545264265589533617}{2051083649509090560000} \\lambda^{2} {\\Delta}t^{5} \\cos\\left( t \\right) + \\frac{799864085279512069121}{2051083649509090560000} \\lambda^{2} {\\Delta}t^{5} \\sqrt{1 - u^{2}} + \\frac{1}{80} \\lambda^{4} {\\Delta}t^{5} \\sqrt{1 - u^{2}} + \\frac{816642835103}{347692455936} {\\Delta}t^{5} \\lambda \\sin\\left( t \\right) - \\frac{22697279517272288488543}{8204334598036362240000} {\\Delta}t^{5} u \\lambda - \\frac{\\frac{1310424677163482540441}{8204334598036362240000} {\\Delta}t^{5} u^{4}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} + \\frac{748586994041784805121}{1025541824754545280000} \\lambda^{3} {\\Delta}t^{5} u - \\frac{787044812470080253121}{1025541824754545280000} \\lambda^{3} {\\Delta}t^{5} \\sin\\left( t \\right) - \\frac{1}{80} \\lambda^{5} {\\Delta}t^{5} \\sin\\left( t \\right) + \\frac{\\frac{697309902804057541121}{2051083649509090560000} \\lambda^{4} {\\Delta}t^{5} u^{2}}{\\sqrt{1 - u^{2}}} - \\frac{\\frac{22661669112359}{5794874265600} {\\Delta}t^{5} u^{3} \\lambda}{\\left( \\sqrt{1 - u^{2}} \\right)^{2}} - \\frac{\\frac{40407626982119}{34769245593600} \\lambda^{3} {\\Delta}t^{5} u^{3}}{\\left( \\sqrt{1 - u^{2}} \\right)^{2}} - \\frac{\\frac{902475437790052823}{42730909364772720000} \\cos^{2}\\left( t \\right) \\lambda^{2} {\\Delta}t^{5}}{\\sqrt{1 - u^{2}}} - \\frac{\\frac{3}{80} \\sin^{4}\\left( t \\right) \\lambda^{4} {\\Delta}t^{5}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{\\frac{15252787472548361518291}{8204334598036362240000} \\lambda^{2} {\\Delta}t^{5} u^{6}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} - \\frac{\\frac{4296068000362398790603}{1367389099672727040000} \\lambda^{3} {\\Delta}t^{5} u^{5}}{\\left( \\sqrt{1 - u^{2}} \\right)^{4}} - \\frac{\\frac{5407445509}{13414060800} \\lambda^{4} {\\Delta}t^{5} u^{6}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} - \\frac{\\frac{3202156720624217158603}{911592733115151360000} \\lambda^{2} {\\Delta}t^{5} u^{2}}{\\sqrt{1 - u^{2}}} + \\frac{\\frac{799864085279512069121}{2051083649509090560000} \\sin^{2}\\left( t \\right) \\lambda^{4} {\\Delta}t^{5}}{\\sqrt{1 - u^{2}}} - \\frac{\\frac{4235329624987}{1738462279680} \\sin^{2}\\left( t \\right) \\lambda^{2} {\\Delta}t^{5}}{\\sqrt{1 - u^{2}}} - \\frac{\\frac{39104793754727}{34769245593600} \\lambda^{3} {\\Delta}t^{5} u^{7}}{\\left( \\sqrt{1 - u^{2}} \\right)^{6}} + \\frac{\\frac{4887252979867}{6953849118720} \\sin^{3}\\left( t \\right) \\lambda^{3} {\\Delta}t^{5}}{\\left( \\sqrt{1 - u^{2}} \\right)^{2}} - \\frac{\\frac{8049532687339818250367}{1367389099672727040000} \\lambda^{2} {\\Delta}t^{5} u^{4}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{\\frac{8874151474691222873807}{8204334598036362240000} {\\Delta}t^{5} u^{5} \\lambda}{\\left( \\sqrt{1 - u^{2}} \\right)^{4}} + \\frac{\\frac{357614120019468965321}{2051083649509090560000} \\lambda^{4} {\\Delta}t^{5} u^{4}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{\\frac{3}{16} \\lambda^{4} {\\Delta}t^{5} u^{8}}{\\left( \\sqrt{1 - u^{2}} \\right)^{7}} - \\frac{\\frac{902475437790052823}{42730909364772720000} \\cos^{2}\\left( t \\right) \\lambda^{2} {\\Delta}t^{5} u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} + \\frac{\\frac{1359021192978175789217}{2051083649509090560000} \\lambda^{2} {\\Delta}t^{5} u^{4} \\cos\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{4}} - \\frac{\\frac{35240601866062448046791}{8204334598036362240000} \\sin^{2}\\left( t \\right) \\lambda^{2} {\\Delta}t^{5} u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{\\frac{27881687380184066068859}{4102167299018181120000} \\sin^{2}\\left( t \\right) \\lambda^{3} {\\Delta}t^{5} u^{3}}{\\left( \\sqrt{1 - u^{2}} \\right)^{4}} - \\frac{\\frac{705268173027862269617}{2051083649509090560000} \\lambda^{3} {\\Delta}t^{5} u \\cos\\left( t \\right)}{\\sqrt{1 - u^{2}}} - \\frac{\\frac{9}{40} \\sin^{4}\\left( t \\right) \\lambda^{4} {\\Delta}t^{5} u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} - \\frac{\\frac{757632721070389930279}{2051083649509090560000} \\sin^{2}\\left( t \\right) \\lambda^{4} {\\Delta}t^{5} u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} + \\frac{\\frac{39104793754727}{34769245593600} \\sin^{3}\\left( t \\right) \\lambda^{3} {\\Delta}t^{5} u^{4}}{\\left( \\sqrt{1 - u^{2}} \\right)^{6}} - \\frac{\\frac{15252787472548361518291}{8204334598036362240000} \\sin^{2}\\left( t \\right) \\lambda^{2} {\\Delta}t^{5} u^{4}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} + \\frac{\\frac{1886254549}{13414060800} \\lambda^{3} {\\Delta}t^{5} u^{5} \\cos\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} - \\frac{\\frac{493765118337591853817}{2051083649509090560000} \\lambda^{3} {\\Delta}t^{5} u^{3} \\cos\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} + \\frac{\\frac{39104793754727}{11589748531200} \\lambda^{3} {\\Delta}t^{5} u^{6} \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{6}} + \\frac{\\frac{4401390949}{13414060800} \\sin^{3}\\left( t \\right) \\lambda^{4} {\\Delta}t^{5} u}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} + \\frac{\\frac{3}{4} \\lambda^{4} {\\Delta}t^{5} u^{7} \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{7}} + \\frac{\\frac{9483916379434497096769}{2734778199345454080000} {\\Delta}t^{5} u^{2} \\lambda \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{2}} + \\frac{\\frac{31849941369899514148543}{8204334598036362240000} \\lambda^{3} {\\Delta}t^{5} u^{2} \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{2}} - \\frac{\\frac{8425609189}{4471353600} \\sin^{2}\\left( t \\right) \\lambda^{4} {\\Delta}t^{5} u^{4}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} + \\frac{\\frac{14461936549}{13414060800} \\sin^{3}\\left( t \\right) \\lambda^{4} {\\Delta}t^{5} u^{3}}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} - \\frac{\\frac{3}{16} \\sin^{4}\\left( t \\right) \\lambda^{4} {\\Delta}t^{5} u^{4}}{\\left( \\sqrt{1 - u^{2}} \\right)^{7}} + \\frac{\\frac{3}{4} \\sin^{3}\\left( t \\right) \\lambda^{4} {\\Delta}t^{5} u^{5}}{\\left( \\sqrt{1 - u^{2}} \\right)^{7}} + \\frac{\\frac{17472299316717302448137}{2734778199345454080000} \\lambda^{2} {\\Delta}t^{5} u \\sin\\left( t \\right)}{\\sqrt{1 - u^{2}}} + \\frac{\\frac{1096241047050178109417}{2051083649509090560000} {\\Delta}t^{5} u^{3} \\lambda \\cos\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} + \\frac{\\frac{1634740909}{6707030400} \\lambda^{2} {\\Delta}t^{5} u^{2} \\cos\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{2}} + \\frac{\\frac{15252787472548361518291}{4102167299018181120000} \\lambda^{2} {\\Delta}t^{5} u^{5} \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} + \\frac{\\frac{31770529327031}{17384622796800} \\sin^{3}\\left( t \\right) \\lambda^{3} {\\Delta}t^{5} u^{2}}{\\left( \\sqrt{1 - u^{2}} \\right)^{4}} - \\frac{\\frac{28081254523910814822943}{8204334598036362240000} \\sin^{2}\\left( t \\right) \\lambda^{3} {\\Delta}t^{5} u}{\\left( \\sqrt{1 - u^{2}} \\right)^{2}} + \\frac{\\frac{33273149691722827592143}{4102167299018181120000} \\lambda^{3} {\\Delta}t^{5} u^{4} \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{4}} - \\frac{\\frac{98031318961151965421}{1025541824754545280000} \\lambda^{4} {\\Delta}t^{5} u^{3} \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} + \\frac{\\frac{1044963955812450845417}{2051083649509090560000} {\\Delta}t^{5} u \\lambda \\cos\\left( t \\right)}{\\sqrt{1 - u^{2}}} + \\frac{\\frac{8874151474691222873807}{8204334598036362240000} {\\Delta}t^{5} u^{4} \\lambda \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{4}} + \\frac{\\frac{83537797990101357548993}{8204334598036362240000} \\lambda^{2} {\\Delta}t^{5} u^{3} \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} + \\frac{\\frac{782183809884453165617}{2051083649509090560000} \\lambda^{3} {\\Delta}t^{5} \\cos\\left( t \\right) \\sin\\left( t \\right)}{\\sqrt{1 - u^{2}}} - \\frac{\\frac{748586994041784805121}{1025541824754545280000} \\lambda^{4} {\\Delta}t^{5} u \\sin\\left( t \\right)}{\\sqrt{1 - u^{2}}} + \\frac{\\frac{6413500069}{4471353600} \\lambda^{4} {\\Delta}t^{5} u^{5} \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} - \\frac{\\frac{39104793754727}{11589748531200} \\sin^{2}\\left( t \\right) \\lambda^{3} {\\Delta}t^{5} u^{5}}{\\left( \\sqrt{1 - u^{2}} \\right)^{6}} - \\frac{\\frac{9}{8} \\sin^{2}\\left( t \\right) \\lambda^{4} {\\Delta}t^{5} u^{6}}{\\left( \\sqrt{1 - u^{2}} \\right)^{7}} + \\frac{\\frac{12079201575925326001}{120651979382887680000} \\lambda^{3} {\\Delta}t^{5} u^{2} \\cos\\left( t \\right) \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} - \\frac{\\frac{1359021192978175789217}{2051083649509090560000} \\lambda^{2} {\\Delta}t^{5} u \\cos\\left( t \\right) \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{2}} - \\frac{\\frac{1359021192978175789217}{2051083649509090560000} \\lambda^{2} {\\Delta}t^{5} u^{3} \\cos\\left( t \\right) \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{4}} + \\frac{\\frac{1886254549}{13414060800} \\sin^{2}\\left( t \\right) \\lambda^{3} {\\Delta}t^{5} u \\cos\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{3}} + \\frac{\\frac{1886254549}{13414060800} \\sin^{2}\\left( t \\right) \\lambda^{3} {\\Delta}t^{5} u^{3} \\cos\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}} - \\frac{\\frac{1886254549}{6707030400} \\lambda^{3} {\\Delta}t^{5} u^{4} \\cos\\left( t \\right) \\sin\\left( t \\right)}{\\left( \\sqrt{1 - u^{2}} \\right)^{5}}\n",
"\\end{equation}\n"
],
"text/plain": [
"(1//80)*u*(Δt^5)*(λ^5) + (799864085279512069121//2051083649509090560000)*(Δt^5)*(λ^2)*sqrt(1 - (u^2)) + (1//80)*(Δt^5)*(λ^4)*sqrt(1 - (u^2)) + (816642835103//347692455936)*λ*(Δt^5)*sin(t) + (748586994041784805121//1025541824754545280000)*u*(Δt^5)*(λ^3) + (697309902804057541121//2051083649509090560000)*(u^2)*(Δt^5)*(λ^4)*(sqrt(1 - (u^2))^-1) + (799864085279512069121//2051083649509090560000)*(Δt^5)*(λ^4)*(sin(t)^2)*(sqrt(1 - (u^2))^-1) + (4887252979867//6953849118720)*(Δt^5)*(λ^3)*(sin(t)^3)*(sqrt(1 - (u^2))^-2) + (357614120019468965321//2051083649509090560000)*(u^4)*(Δt^5)*(λ^4)*(sqrt(1 - (u^2))^-3) + (1359021192978175789217//2051083649509090560000)*(u^4)*(Δt^5)*(λ^2)*(sqrt(1 - (u^2))^-4)*cos(t) + (39104793754727//34769245593600)*(u^4)*(Δt^5)*(λ^3)*(sin(t)^3)*(sqrt(1 - (u^2))^-6) + (1886254549//13414060800)*(u^5)*(Δt^5)*(λ^3)*(sqrt(1 - (u^2))^-5)*cos(t) + (39104793754727//11589748531200)*(u^6)*(Δt^5)*(λ^3)*(sqrt(1 - (u^2))^-6)*sin(t) + (4401390949//13414060800)*u*(Δt^5)*(λ^4)*(sin(t)^3)*(sqrt(1 - (u^2))^-3) + (3//4)*(u^7)*(Δt^5)*(λ^4)*(sqrt(1 - (u^2))^-7)*sin(t) + (9483916379434497096769//2734778199345454080000)*λ*(u^2)*(Δt^5)*(sqrt(1 - (u^2))^-2)*sin(t) + (31849941369899514148543//8204334598036362240000)*(u^2)*(Δt^5)*(λ^3)*(sqrt(1 - (u^2))^-2)*sin(t) + (14461936549//13414060800)*(u^3)*(Δt^5)*(λ^4)*(sin(t)^3)*(sqrt(1 - (u^2))^-5) + (3//4)*(u^5)*(Δt^5)*(λ^4)*(sin(t)^3)*(sqrt(1 - (u^2))^-7) + (17472299316717302448137//2734778199345454080000)*u*(Δt^5)*(λ^2)*(sqrt(1 - (u^2))^-1)*sin(t) + (1096241047050178109417//2051083649509090560000)*λ*(u^3)*(Δt^5)*(sqrt(1 - (u^2))^-3)*cos(t) + (1634740909//6707030400)*(u^2)*(Δt^5)*(λ^2)*(sqrt(1 - (u^2))^-2)*cos(t) + (15252787472548361518291//4102167299018181120000)*(u^5)*(Δt^5)*(λ^2)*(sqrt(1 - (u^2))^-5)*sin(t) + (31770529327031//17384622796800)*(u^2)*(Δt^5)*(λ^3)*(sin(t)^3)*(sqrt(1 - (u^2))^-4) + (33273149691722827592143//4102167299018181120000)*(u^4)*(Δt^5)*(λ^3)*(sqrt(1 - (u^2))^-4)*sin(t) + (1044963955812450845417//2051083649509090560000)*u*λ*(Δt^5)*(sqrt(1 - (u^2))^-1)*cos(t) + (8874151474691222873807//8204334598036362240000)*λ*(u^4)*(Δt^5)*(sqrt(1 - (u^2))^-4)*sin(t) + (83537797990101357548993//8204334598036362240000)*(u^3)*(Δt^5)*(λ^2)*(sqrt(1 - (u^2))^-3)*sin(t) + (782183809884453165617//2051083649509090560000)*(Δt^5)*(λ^3)*(sqrt(1 - (u^2))^-1)*cos(t)*sin(t) + (6413500069//4471353600)*(u^5)*(Δt^5)*(λ^4)*(sqrt(1 - (u^2))^-5)*sin(t) + (12079201575925326001//120651979382887680000)*(u^2)*(Δt^5)*(λ^3)*(sqrt(1 - (u^2))^-3)*cos(t)*sin(t) + (1886254549//13414060800)*u*(Δt^5)*(λ^3)*(sin(t)^2)*(sqrt(1 - (u^2))^-3)*cos(t) + (1886254549//13414060800)*(u^3)*(Δt^5)*(λ^3)*(sin(t)^2)*(sqrt(1 - (u^2))^-5)*cos(t) - (4104944954011//6953849118720)*(Δt^5)*sqrt(1 - (u^2)) - (1//80)*(Δt^5)*(λ^4)*cos(t) - (347561176905793161587//455796366557575680000)*(u^2)*(Δt^5)*(sqrt(1 - (u^2))^-1) - (756545264265589533617//2051083649509090560000)*(Δt^5)*(λ^2)*cos(t) - (22697279517272288488543//8204334598036362240000)*u*λ*(Δt^5) - (1310424677163482540441//8204334598036362240000)*(u^4)*(Δt^5)*(sqrt(1 - (u^2))^-3) - (787044812470080253121//1025541824754545280000)*(Δt^5)*(λ^3)*sin(t) - (1//80)*(Δt^5)*(λ^5)*sin(t) - (22661669112359//5794874265600)*λ*(u^3)*(Δt^5)*(sqrt(1 - (u^2))^-2) - (40407626982119//34769245593600)*(u^3)*(Δt^5)*(λ^3)*(sqrt(1 - (u^2))^-2) - (902475437790052823//42730909364772720000)*(Δt^5)*(λ^2)*(cos(t)^2)*(sqrt(1 - (u^2))^-1) - (3//80)*(Δt^5)*(λ^4)*(sin(t)^4)*(sqrt(1 - (u^2))^-3) - (15252787472548361518291//8204334598036362240000)*(u^6)*(Δt^5)*(λ^2)*(sqrt(1 - (u^2))^-5) - (4296068000362398790603//1367389099672727040000)*(u^5)*(Δt^5)*(λ^3)*(sqrt(1 - (u^2))^-4) - (5407445509//13414060800)*(u^6)*(Δt^5)*(λ^4)*(sqrt(1 - (u^2))^-5) - (3202156720624217158603//911592733115151360000)*(u^2)*(Δt^5)*(λ^2)*(sqrt(1 - (u^2))^-1) - (4235329624987//1738462279680)*(Δt^5)*(λ^2)*(sin(t)^2)*(sqrt(1 - (u^2))^-1) - (39104793754727//34769245593600)*(u^7)*(Δt^5)*(λ^3)*(sqrt(1 - (u^2))^-6) - (8049532687339818250367//1367389099672727040000)*(u^4)*(Δt^5)*(λ^2)*(sqrt(1 - (u^2))^-3) - (8874151474691222873807//8204334598036362240000)*λ*(u^5)*(Δt^5)*(sqrt(1 - (u^2))^-4) - (3//16)*(u^8)*(Δt^5)*(λ^4)*(sqrt(1 - (u^2))^-7) - (902475437790052823//42730909364772720000)*(u^2)*(Δt^5)*(λ^2)*(cos(t)^2)*(sqrt(1 - (u^2))^-3) - (35240601866062448046791//8204334598036362240000)*(u^2)*(Δt^5)*(λ^2)*(sin(t)^2)*(sqrt(1 - (u^2))^-3) - (27881687380184066068859//4102167299018181120000)*(u^3)*(Δt^5)*(λ^3)*(sin(t)^2)*(sqrt(1 - (u^2))^-4) - (705268173027862269617//2051083649509090560000)*u*(Δt^5)*(λ^3)*(sqrt(1 - (u^2))^-1)*cos(t) - (9//40)*(u^2)*(Δt^5)*(λ^4)*(sin(t)^4)*(sqrt(1 - (u^2))^-5) - (757632721070389930279//2051083649509090560000)*(u^2)*(Δt^5)*(λ^4)*(sin(t)^2)*(sqrt(1 - (u^2))^-3) - (15252787472548361518291//8204334598036362240000)*(u^4)*(Δt^5)*(λ^2)*(sin(t)^2)*(sqrt(1 - (u^2))^-5) - (493765118337591853817//2051083649509090560000)*(u^3)*(Δt^5)*(λ^3)*(sqrt(1 - (u^2))^-3)*cos(t) - (8425609189//4471353600)*(u^4)*(Δt^5)*(λ^4)*(sin(t)^2)*(sqrt(1 - (u^2))^-5) - (3//16)*(u^4)*(Δt^5)*(λ^4)*(sin(t)^4)*(sqrt(1 - (u^2))^-7) - (28081254523910814822943//8204334598036362240000)*u*(Δt^5)*(λ^3)*(sin(t)^2)*(sqrt(1 - (u^2))^-2) - (98031318961151965421//1025541824754545280000)*(u^3)*(Δt^5)*(λ^4)*(sqrt(1 - (u^2))^-3)*sin(t) - (748586994041784805121//1025541824754545280000)*u*(Δt^5)*(λ^4)*(sqrt(1 - (u^2))^-1)*sin(t) - (39104793754727//11589748531200)*(u^5)*(Δt^5)*(λ^3)*(sin(t)^2)*(sqrt(1 - (u^2))^-6) - (9//8)*(u^6)*(Δt^5)*(λ^4)*(sin(t)^2)*(sqrt(1 - (u^2))^-7) - (1359021192978175789217//2051083649509090560000)*u*(Δt^5)*(λ^2)*(sqrt(1 - (u^2))^-2)*cos(t)*sin(t) - (1359021192978175789217//2051083649509090560000)*(u^3)*(Δt^5)*(λ^2)*(sqrt(1 - (u^2))^-4)*cos(t)*sin(t) - (1886254549//6707030400)*(u^4)*(Δt^5)*(λ^3)*(sqrt(1 - (u^2))^-5)*cos(t)*sin(t)"
]
},
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expand(expr)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.6.3",
"language": "julia",
"name": "julia-1.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.6.3"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment