Skip to content

Commit ede2497

Browse files
committed
upds
1 parent 3399aca commit ede2497

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/functions/ode38.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# f(dx, t, x)
2-
function ode38(f, x0, tspan; nSteps=100)
1+
# f!(dx, t, x)
2+
function ode38(f!, x0, tspan; nSteps=100)
33
# 3/8 Runge-Kutta Method
44
# http://www.mymathlib.com/diffeq/runge-kutta/runge_kutta_3_8.html
55
x = copy(x0)
@@ -8,10 +8,10 @@ function ode38(f, x0, tspan; nSteps=100)
88
K1 = similar(x); K2 = similar(x)
99
K3 = similar(x); K4 = similar(x)
1010
for _ in 1:nSteps
11-
f(K1, t, x)
12-
f(K2, t + 1/3*h, x + h*K1/3)
13-
f(K3, t + 2/3*h, x + h*(-K1/3 + K2))
14-
f(K4, t + h, x + h*(K1 - K2 + K3))
11+
f!(K1, t, x)
12+
f!(K2, t + 1/3*h, x + h*K1/3)
13+
f!(K3, t + 2/3*h, x + h*(-K1/3 + K2))
14+
f!(K4, t + h, x + h*(K1 - K2 + K3))
1515
t += h
1616
x += h*(K1 + 3K2 + 3K3 + K4)/8
1717
end

0 commit comments

Comments
 (0)