Chebyshev coefficients: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: changed whitespace, changed a variable name.) |
|||
Line 1,139: | Line 1,139: | ||
if b=='' | b=="," then b= 1 /*B " " " " " */ |
if b=='' | b=="," then b= 1 /*B " " " " " */ |
||
if N=='' | N=="," then N= 10 /*N " " " " " */ |
if N=='' | N=="," then N= 10 /*N " " " " " */ |
||
fac= 2 / N; |
fac= 2 / N; pin= pi / N /*calculate a couple handy─dandy values*/ |
||
Dma= (b-a) / 2 /*calculate one─half of the difference.*/ |
Dma= (b-a) / 2 /*calculate one─half of the difference.*/ |
||
Dpa= (b+a) / 2 /* " " " " sum. */ |
Dpa= (b+a) / 2 /* " " " " sum. */ |
||
Line 1,159: | Line 1,159: | ||
if a=pi then return -1; if a=pi*.5 | a=pi*2 then return 0; pit= pi/3; z= 1 |
if a=pi then return -1; if a=pi*.5 | a=pi*2 then return 0; pit= pi/3; z= 1 |
||
if a=pit then return .5; if a=pit*2 then return -.5; q= x*x; _= 1 |
if a=pit then return .5; if a=pit*2 then return -.5; q= x*x; _= 1 |
||
do k=2 by 2 until p=z; p=z; _= -_ * q/(k*k - k)); z= z+_; end; return z |
|||
return z |
|||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
pi: pi=3.1415926535897932384626433832795028841971693993751058209749445923078164;return pi |
pi: pi=3.1415926535897932384626433832795028841971693993751058209749445923078164;return pi |