! PROGRAM Euler_method_to_solve_dv/dt=_(g-λv)_with_v(0)=0
real::t,v,g,lambda
f(t,v)=g-lambda*v
open(1,file="euler.out")
lambda=1
g=9.8
t=0;v=0;h=0.5
1 write(1,*)t,v
v=v+h*f(t,v)
t=t+h
if(t<=15) goto 1
end
real::t,v,g,lambda
f(t,v)=g-lambda*v
open(1,file="euler.out")
lambda=1
g=9.8
t=0;v=0;h=0.5
1 write(1,*)t,v
v=v+h*f(t,v)
t=t+h
if(t<=15) goto 1
end
Comments
Post a Comment