Numerical integration/Gauss-Legendre Quadrature: Difference between revisions

m
→‎version 2: removed timing statements, they weren't meant to be included; I don't feel that exact timings should be used for comparisons; relative timings are ok. -- ~~~~
m (REXX made V2 timing work and added it to output. Also add timing to V1)
m (→‎version 2: removed timing statements, they weren't meant to be included; I don't feel that exact timings should be used for comparisons; relative timings are ok. -- ~~~~)
Line 1,236:
Note that the function values for   '''pi'''   and   '''e'''   should have more precision than the number of digits specified.
<lang rexx>/*REXX pgm does numerical integration using Gauss-Legendre Quadrature.*/
Call time 'R'
digs=40; d2=digs*2
numeric digits digs; tiny='1e-'d2; pi=pi(); a=-3; b=3; bma=b-a; bpa=b+a
Line 1,282 ⟶ 1,281:
 
say sep; say left('',4) true " {exact}"
say '... and took' format(time('e'),,2) "seconds"
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────COS subroutine───────────────────────────────*/
Line 1,324 ⟶ 1,322:
──── ─────────────────────────────────────────── ────────────
20.035749854819803797949187238931656120356208246365726928811306502092785210360717 {exact}
</pre>
... and took 1.33 seconds</pre>
 
=={{header|Tcl}}==