Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
37
Task/Runge-Kutta-method/Excel/runge-kutta-method.excel
Normal file
37
Task/Runge-Kutta-method/Excel/runge-kutta-method.excel
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
//Worksheet formula to manage looping
|
||||
|
||||
=LET(
|
||||
T₊, SEQUENCE(11, 1, 0, 1),
|
||||
T, DROP(T₊, -1),
|
||||
τ, SEQUENCE(1 / δt, 1, 0, δt),
|
||||
calculated, SCAN(1, T, LAMBDA(y₀, t, REDUCE(y₀, t + τ, RungaKutta4λ(Dλ)))),
|
||||
calcs, VSTACK(1, calculated),
|
||||
exact, f(T₊),
|
||||
HSTACK(T₊, calcs, exact, (exact - calcs) / exact)
|
||||
)
|
||||
|
||||
//Lambda function passed to RungaKutta4λ to evaluate derivatives
|
||||
|
||||
Dλ(y,t)
|
||||
= LAMBDA(y,t, t * SQRT(y))
|
||||
|
||||
//Curried Lambda function with derivative function D and y, t as parameters
|
||||
|
||||
RungaKutta4λ(Dλ)
|
||||
= LAMBDA(D,
|
||||
LAMBDA(yᵣ, tᵣ,
|
||||
LET(
|
||||
δy₁, δt * D(yᵣ, tᵣ),
|
||||
δy₂, δt * D(yᵣ + δy₁ / 2, tᵣ + δt / 2),
|
||||
δy₃, δt * D(yᵣ + δy₂ / 2, tᵣ + δt / 2),
|
||||
δy₄, δt * D(yᵣ + δy₃, tᵣ + δt),
|
||||
yᵣ₊₁, yᵣ + (δy₁ + 2 * δy₂ + 2 * δy₃ + δy₄) / 6,
|
||||
yᵣ₊₁
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
//Lambda function returning the exact solution
|
||||
|
||||
f(t)
|
||||
= LAMBDA(t, (1/16) * (t^2 + 4)^2 )
|
||||
Loading…
Add table
Add a link
Reference in a new issue