-- This program uses Euler's algorithm to solve the simultaneous -- ordinary differential equations for the sine and cosine. The -- interval of integration is from zero to one. local s=0 -- sine starts at zero local c=1 -- cosine starts at one local n=1e9 -- 1e9 steps local h=1/n -- size of one step local sNew -- a temporary location local cNew -- another temporary location for j=1,n do sNew=s+c*h cNew=c-s*h s=sNew c=cNew end print( s,c )