P. 733, line 19: Difference between revisions
From Bill Goodwine's Wiki
Jump to navigationJump to search
Created page with "The program should be: <nowiki> program systemeuler c This is a sample FORTRAN program that solves the differential c equation c c x' = y, y' = (1 - x^2)y - x..." |
No edit summary |
||
Line 30: | Line 30: | ||
end | end | ||
</nowiki> | </nowiki> | ||
[[Engineering Differential Equations: Theory and Applications, Springer 2010#Errata|Return to errata.]] |
Latest revision as of 22:49, 3 November 2011
The program should be:
program systemeuler c This is a sample FORTRAN program that solves the differential c equation c c x' = y, y' = (1 - x^2)y - x c x(0) = 0.02, y(0) = 0.0 c c using Euler's method. double precision x(2),t,dt double precision copy(2) open(unit=13,file="systemfortran.d") dt = 0.001 x(1) = 0.02 x(2) = 0.0 do 10 t = 0, 20, dt write(13,*) t,x(1),x(2) copy(1) = x(1) copy(2) = x(2) x(1) = x(1) + (copy(2))*dt x(2) = x(2) + ((1.0 - copy(1)**2)*copy(2) - copy(1))*dt 10 continue stop end