Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Runge-Kutta-method/FutureBasic/runge-kutta-method.basic
Normal file
26
Task/Runge-Kutta-method/FutureBasic/runge-kutta-method.basic
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
window 1
|
||||
|
||||
def fn dydx( x as double, y as double ) as double = x * sqr(y)
|
||||
def fn exactY( x as long ) as double = ( x ^2 + 4 ) ^2 / 16
|
||||
|
||||
long i
|
||||
double h, k1, k2, k3, k4, x, y, result
|
||||
|
||||
h = 0.1
|
||||
y = 1
|
||||
for i = 0 to 100
|
||||
x = i * h
|
||||
if x == int(x)
|
||||
result = fn exactY( x )
|
||||
print "y("; mid$( str$(x), 2, len$(str$(x) )); ") = "; y, "Error = "; result - y
|
||||
end if
|
||||
|
||||
k1 = h * fn dydx( x, y )
|
||||
k2 = h * fn dydx( x + h / 2, y + k1 / 2 )
|
||||
k3 = h * fn dydx( x + h / 2, y + k2 / 2 )
|
||||
k4 = h * fn dydx( x + h, y + k3 )
|
||||
|
||||
y = y + 1 / 6 * ( k1 + 2 * k2 + 2 * k3 + k4 )
|
||||
next
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue