Euler method: Difference between revisions

Content added Content deleted
m (→‎version 2: changed a comment, changed or added whitespace, used a more idiomatic method for setting the numeric digits.)
m (→‎version 2: changed expression.)
Line 2,621: Line 2,621:
<br>It also shows the percentage difference (analytic vs. Euler's method) for each calculation.
<br>It also shows the percentage difference (analytic vs. Euler's method) for each calculation.
<lang rexx>/*REXX pgm solves example of Newton's cooling law via Euler's method (diff. step sizes).*/
<lang rexx>/*REXX pgm solves example of Newton's cooling law via Euler's method (diff. step sizes).*/
numeric digits length( e() - length(.) /*use the number of decimal digits in E*/
numeric digits length( e() ) - length(.) /*use the number of decimal digits in E*/
parse arg Ti Tr cc tt ss /*obtain optional arguments from the CL*/
parse arg Ti Tr cc tt ss /*obtain optional arguments from the CL*/
if Ti='' | Ti="," then Ti= 100 /*given? Default: initial temp in ºC.*/
if Ti='' | Ti="," then Ti= 100 /*given? Default: initial temp in ºC.*/