Runge-Kutta method: Difference between revisions

Line 1,121:
<syntaxhighlight lang="Excel">PRINT "RungaKutta4λ(D)"</syntaxhighlight>
Worksheet formula to manage looping
 
=LET(
T₊, SEQUENCE(11, 1, 0, 1),
Line 1,132 ⟶ 1,133:
 
Lambda function passed to RK4 to evaluate derivatives
 
Dλ(y,t)
= LAMBDA(y,t, t * SQRT(y))
 
Curried Lambda function with derivative function and y, t as parameters
RungaKutta4λ(Dλ)
= LAMBDA(D,
LAMBDA(yᵣ, tᵣ,
Line 1,151 ⟶ 1,153:
 
Lambda function returning the exact solution
f(t)
= LAMBDA(t, (1 / 16) * (t ^ 2 + 4) ^ 2 )
 
Line 1,157 ⟶ 1,159:
Time Calculated Exact Rel Error
0.00 1.000000 1.000000 0.00E+00
1.00 1.562500 1.562500 9.33E-08
2.00 3.999999 4.000000 2.30E-07
3.00 10.562497 10.562500 2.75E-07
4.00 24.999994 25.000000 2.49E-07
5.00 52.562489 52.562500 2.06E-07
6.00 99.999983 100.000000 1.66E-07
7.00 175.562476 175.562500 1.34E-07
8.00 288.999968 289.000000 1.09E-07
9.00 451.562459 451.562500 9.02E-08
10.00 675.999949 676.000000 7.54E-08
 
4

edits