Chebyshev coefficients: Difference between revisions
Content added Content deleted
(Added Wren) |
m (→{{header|REXX}}: elided an extra ), add PRE HTML tags for 2nd output.) |
||
Line 1,213: | Line 1,213: | ||
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 |
do k=2 by 2 until p=z; p=z; _= -_ * q/(k*k - k); z= z+_; end; return z |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
pi: pi=3.1415926535897932384626433832795028841971693993751058209749445923078164;return pi |
pi: pi=3.1415926535897932384626433832795028841971693993751058209749445923078164;return pi |
||
Line 1,231: | Line 1,231: | ||
</pre> |
</pre> |
||
{{out|output|text= when using the following input of: <tt> , , 20 </tt>}} |
{{out|output|text= when using the following input of: <tt> , , 20 </tt>}} |
||
<pre> |
|||
0 Chebyshev coefficient is: 1.647169475390313686961473816799 |
0 Chebyshev coefficient is: 1.647169475390313686961473816799 |
||
1 Chebyshev coefficient is: -0.232299371615171942121038341150 |
1 Chebyshev coefficient is: -0.232299371615171942121038341150 |
||
Line 1,249: | Line 1,250: | ||
16 Chebyshev coefficient is: 1.945994872442404773393679283660E-23 |
16 Chebyshev coefficient is: 1.945994872442404773393679283660E-23 |
||
17 Chebyshev coefficient is: -1.563704507245591241161562138364E-25 |
17 Chebyshev coefficient is: -1.563704507245591241161562138364E-25 |
||
</pre> |
|||
18 Chebyshev coefficient is: -3.976201538410589537318561880598E-27 |
18 Chebyshev coefficient is: -3.976201538410589537318561880598E-27 |
||
19 Chebyshev coefficient is: 2.859065292763079576513213370136E-29 |
19 Chebyshev coefficient is: 2.859065292763079576513213370136E-29 |