Render.ru

# Анимация с помощью дифференциального уравнения

#### Шербек

##### Пользователь сайта
дифференциальные уравнения решаются с помощью MAXScript. Метод Рунге-Кутта. помочь установить функцию

Y=Y+X
Вот script
x=0;
y=1;
h=0.1 as float;
for i=1 to 40 do(
k1=h*(x+y) as float;
k2=h*(x+y+0.5*h+0.5*k1) as float;
k3=h*(x+y+0.5*h+0.5*k2) as float;
k4=h*(x+y+h+k3) as float;
dy=(k1+2*k2+2*k3+k4)/6 as float;
x=x+h as float;
y=y+dy as float;
at time i animate on(
a.pos=[i,y,0]))

видео в етот script
http://mytube.uz/tracks/397923.htm

ето функци не работает
function F x y = x+y as float
function k1 x y = F(x y) as float
function k2 x y h = F(x+h/2 y+h/2*k1(x y)) as float
function k3 x y h = F(x+h/2 y+h/2*k2(x y h)) as float
function k4 x y h = F(x+h/2 y+h/2*k3(x y h)) as float
x=0;
y=0;
h=0.1 as float;
for i=1 to 100 do(
x=x+h as float;
y=y+h*(k1+2*k2+2*k3+k4)/6 as float;

#### igorznag

##### Мастер
ето функци не работает
Можно так:
Код:
``````function F x y = x+y as float
function k1 x y = F x y as float
function k2 x y h = F (x+h/2) (y+h/2*k1 x y) as float
function k3 x y h = F (x+h/2) (y+h/2*k2 x y h) as float
function k4 x y h = F (x+h/2) (y+h/2*k3 x y h) as float
x=0;
y=0;
h=0.1 as float;
for i=1 to 100 do(
x=x+h as float;
y=y+h*(k1 x y+2*k2 x y h+2*k3 x y h+k4 x y h)/6 as float;
)``````
Или так:
Код:
``````function F x y = x+y as float
function u x y h=
(
k1 = F x y as float
k2 = F (x+h/2) (y+h/2*k1) as float
k3 = F (x+h/2) (y+h/2*k2) as float
k4 = F (x+h/2) (y+h/2*k3) as float
h*(k1+2*k2+2*k3+k4)/6 as float
)
x=0;
y=0;
h=0.1 as float;
for i=1 to 100 do(
x=x+h as float;
y=y+u x y h as float;