Jump to content

Chebyshev coefficients: Difference between revisions

(Undo revision 265292 Hey whitespace hero, look 👓 good what actual is happening. Maybe (hopefully) you learn something.)
Line 663:
1.000 0.54030231 0.54030231 4.5e-13
</pre>
 
=={{header|Microsoft Small Basic}}==
{{trans|Perl}}
<lang smallbasic>' N Chebyshev coefficients for the range 0 to 1 - 18/07/2018
pi=Math.pi
a=0
b=1
n=10
For i=0 To n-1
coef[i]=Math.cos(Math.cos(pi/n*(i+1/2))*(b-a)/2+(b+a)/2)
EndFor
For i=0 To n-1
w=0
For j=0 To n-1
w=w+coef[j]*Math.cos(pi/n*i*(j+1/2))
EndFor
cheby[i]=w*2/n
t=" "
If cheby[i]<=0 Then
t=""
EndIf
TextWindow.WriteLine(i+" : "+t+cheby[i])
EndFor</lang>
{{out}}
<pre>
0 : 1,6471694753903136
1 : -0,2322993716151700684187787635
2 : -0,0537151146220494010749946688
3 : 0,0024582352669837594966069584
4 : 0,0002821190574317389206759282
5 : -0,0000077222291539069653168878
6 : -0,0000005898556481086082412444
7 : 0,0000000115214300591398939205
8 : 0,0000000006596278553822696656
9 : -0,0000000000100189955816952521
</pre>
 
 
=={{header|Perl}}==
1,392

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.