Jump to content

Numerical integration/Gauss-Legendre Quadrature: Difference between revisions

m
→‎version 2: streamlined the COS subroutine. -- ~~~~
m (→‎version 2: changed the uppercase E to lowercase e in exponentiated numbers for better readability. -- ~~~~)
m (→‎version 2: streamlined the COS subroutine. -- ~~~~)
Line 1,281:
/*──────────────────────────────────COS subroutine──────────────────────*/
cos: procedure; arg x; x=r2r(x); a=abs(x); numeric fuzz min(9,digits()-9)
if a=pi() then return -1; if a=pi()/2 | a=2*pi() then return 0
if a=pi()/3 then return .5; if a=2*pi()/3 then return -.5
return .sinCos(1,1,-1)
.sinCos: parse arg z 1 p,_,i; x=x*x
Cookies help us deliver our services. By using our services, you agree to our use of cookies.