Anonymous user
Numerical integration/Gauss-Legendre Quadrature: Difference between revisions
Numerical integration/Gauss-Legendre Quadrature (view source)
Revision as of 00:18, 1 November 2013
, 10 years ago→version 2: aligned subroutine headers with subroutine code. -- ~~~~
(→version 2: simplied the COSine subroutine. -- ~~~~) |
m (→version 2: aligned subroutine headers with subroutine code. -- ~~~~) |
||
Line 1,279:
say '... and took' format(time('e'),,2) "seconds,"
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────COS
/*──────────────────────────────────E
e: return 2.7182818284590452353602874713526624977572470936999595749669676277240766303535
/*──────────────────────────────────EXP
exp: procedure; parse arg x; ix=x%1; if abs(x-ix)>.5 then ix=ix+sign(x); x=x-ix
z=1; _=1; w=z; do j=1; _=_*x/j; z=(z+_)/1; if z==w then leave; w=z; end
if z\==0 then z=z*e()**ix; return z
/*──────────────────────────────────PI
pi: return 3.1415926535897932384626433832795028841971693993751058209749445923078164062862
/*──────────────────────────────────R2R subroutine──────────────────────*/
|