| |
|
|
p.specht
| The Interpolation through Tschebyschow-Polynomen draw itself by a very günstigen, gleichmäßigen Fehlerverlauf from. moreover are as Interpolationsstellen The suitable verschobenen Nullstellen one Tschebyschow-Polynoms suitable Grades To use. the first the both nachstehenden programs allows The Berechnung the Polynom-Koeffizienten appropriate to wählenden Grades.
"Fein-Tuning": if one whom values-Gültigkeitsbereich retrenching can, genügen Tschebyschow-Polynome geringeren Grades, also faster To to charge are. the second the nachstehenden programs allows so a strain-reduction.
Window Style 24:Font 2:Set("decimals",5)
Window Title "ChebySer: Tschebyschowpolynomkoeffizienten for different Grade (Formeloptimierung)"
' fountain: https://jean-pierre.moreau.pagesperso-orange.fr/Basic/chebyser_bas.txt
' Transponiert to XProfan 11.2a (D) demonstration by P.woodpecker, Vienna/Austria
' No warranty whatsoever! No however geartete Gewähr!
'****************************************************
'* Program to demonstrate Chebyser subroutine *
'* ------------------------------------------------ *
'* Reference: BASIC Scientific Subroutines, Vol. II *
'* by F.R. Ruckdeschel, BYTE/McGRAWW-HILL, 1981 [1].*
'* ------------------------------------------------ *
'* SAMPLE RUN: *
'* *
'* Chebyshev polynomial coefficients for degree 2 *
'* A( 0) = -1 *
'* A( 1) = 0 *
'* A( 2) = 2 *
'* *
'* Chebyshev polynomial coefficients for degree 3 *
'* A( 0) = 0 *
'* A( 1) = -3 *
'* A( 2) = 0 *
'* A( 3) = 4 *
'* *
'* Chebyshev polynomial coefficients for degree 4 *
'* A( 0) = 1 *
'* A( 1) = 0 *
'* A( 2) = -8 *
'* A( 3) = 0 *
'* A( 4) = 8 *
'* *
'* Chebyshev polynomial coefficients for degree 5 *
'* A( 0) = 0 *
'* A( 1) = 5 *
'* A( 2) = 0 *
'* A( 3) = -20 *
'* A( 4) = 0 *
'* A( 5) = 16 *
'* *
'* Chebyshev polynomial coefficients for degree 6 *
'* A( 0) = -1 *
'* A( 1) = 0 *
'* A( 2) = 18 *
'* A( 3) = 0 *
'* A( 4) = -48 *
'* A( 5) = 0 *
'* A( 6) = 32 *
'* *
'* Chebyshev polynomial coefficients for degree 7 *
'* A( 0) = 0 *
'* A( 1) = -7 *
'* A( 2) = 0 *
'* A( 3) = 56 *
'* A( 4) = 0 *
'* A( 5) = -112 *
'* A( 6) = 0 *
'* A( 7) = 64 *
'* *
'* Chebyshev polynomial coefficients for degree 8 *
'* A( 0) = 1 *
'* A( 1) = 0 *
'* A( 2) = -32 *
'* A( 3) = 0 *
'* A( 4) = 160 *
'* A( 5) = 0 *
'* A( 6) = -256 *
'* A( 7) = 0 *
'* A( 8) = 128 *
'* *
'* Chebyshev polynomial coefficients for degree 9 *
'* A( 0) = 0 *
'* A( 1) = 9 *
'* A( 2) = 0 *
'* A( 3) = -120 *
'* A( 4) = 0 *
'* A( 5) = 432 *
'* A( 6) = 0 *
'* A( 7) = -576 *
'* A( 8) = 0 *
'* A( 9) = 256 *
'* *
'* Chebyshev polynomial coefficients for degree 10 *
'* A( 0) = -1 *
'* A( 1) = 0 *
'* A( 2) = 50 *
'* A( 3) = 0 *
'* A( 4) = -400 *
'* A( 5) = 0 *
'* A( 6) = 1120 *
'* A( 7) = 0 *
'* A( 8) = -1280 *
'* A( 9) = 0 *
'* A( 10) = 512 *
'* *
'****************************************************
'DEFINT I-n
'DEFDBL A-H, O-Z
Declare i&,n&,j&
CLS
PRINT
Declare B![10,10]
WhileLoop 2,10:n&=&Loop
s1000' Proc-appeal
PRINT " Tschebyschowpolynom-Koeffizienten for Polynomgrad ";n&
Print
WhileLoop 0,n&:i&=&Loop
PRINT " A(";i&; ") = ";B![n&,i&]
EndWhile
Print : Case n&<10:WaitInput
EndWhile
PRINT
END
Proc s1000
'********************************************************
'* Chebyshev series coefficients evaluation subroutine *
'* ---------------------------------------------------- *
'* The order of the polynomial is n. The coefficients *
'* are returned in the aray B(i,j), i is the degree of *
'* the polynomial, j is the coefficient order. *
'********************************************************
'Establish t0 and t1 coefficients
B![0,0]=1:B![1,0]=0:B![1,1]=1
'Return if order is less than two
Case n&<2:Return
WhileLoop 2,n&:i&=&Loop
WhileLoop i&:j&=&Loop
'Basic recursion relation
B![i&,j&]=2*B![i&-1,j&-1]-B![i&-2,j&]
EndWhile
B![i&,0]= -1*B![i&-2, 0]
EndWhile
ENDPROC
'End of file Chebyser.prf
Second Program:
Window Style 24:Font 2:Set("decimals",17)
Window Title "ChebeCon: Vereinfachung of Approximationspolynomen to Tschebyschow"
' fountain: https://jean-pierre.moreau.pagesperso-orange.fr/Basic/chebecon_bas.txt
' transponiert to XProfan 11.2a (D) demonstration 2016-12 by P.woodpecker, Vienna/Austria
' No warranty whatsoever! without jegliche Gewähr!
'*****************************************************
'* Program to demonstrate Chebyshev economization *
'* ------------------------------------------------- *
'* Reference: BASIC Scientific Subroutines, Vol. II *
'* by F.R. Ruckdeschel, BYTE/McGRAWW-HILL, 1981 [1]. *
'* ------------------------------------------------- *
'* SAMPLE RUN: *
'* What is the degree of the input polynomial: ? 15 *
'* *
'* What is the degree of the desired economized *
'* polynomial: ? 9 *
'* *
'* What is the brat of the input polynomial: ? 1.57 *
'* *
'* Input the coefficients: *
'* C( 0) = ? 0 *
'* C( 1) = ? 1 *
'* C( 2) = ? 0 *
'* C( 3) = ? -.166666666 *
'* C( 4) = ? 0 *
'* C( 5) = ? .00833333333 *
'* C( 6) = ? 0 *
'* C( 7) = ? -.0001984127 *
'* C( 8) = ? 0 *
'* C( 9) = ? .000002755732 *
'* C( 10) = ? 0 *
'* C( 11) = ? -.000000025052109 *
'* C( 12) = ? 0 *
'* C( 13) = ? .00000000016059045 *
'* C( 14) = ? 0 *
'* C( 15) = ? -.00000000000076471635 *
'* *
'* The Chebyshev series coefficients are: *
'* *
'* A( 0) = 0.0000000000 *
'* A( 1) = 1.1334708982 *
'* A( 2) = 0.0000000000 *
'* A( 3) = -0.1378841454 *
'* A( 4) = 0.0000000000 *
'* A( 5) = 0.0044798168 *
'* A( 6) = 0.0000000000 *
'* A( 7) = -0.0000674667 *
'* A( 8) = 0.0000000000 *
'* A( 9) = 0.0000005865 *
'* A(10) = 0.0000000000 *
'* A(11) = -0.0000000033 *
'* A(12) = 0.0000000000 *
'* A(13) = 0.0000000000 *
'* A(14) = 0.0000000000 *
'* A(15) = 0.0000000000 *
'* *
'* The economized polynomial coefficients are: *
'* *
'* C( 0) = 0.0000000000 *
'* C( 1) = 0.9999999767 *
'* C( 2) = 0.0000000000 *
'* C( 3) = -1.6666647620 *
'* C( 4) = 0.0000000000 *
'* C( 5) = 0.0083329009 *
'* C( 6) = 0.0000000000 *
'* C( 7) = -0.0001980098 *
'* C( 8) = 0.0000000000 *
'* C( 9) = 0.0000025907 *
'* *
'*****************************************************
'DEFINT I-n
'DEFDBL A-H, O-Z
DecLARE m&,m1&,x0!,i&,j&,cc$
Declare b!,n&,L&
CLS
Print
Print " Please whom strain the Original-Polynoms prompt: ", :Input m&
PRINT
Print " Please whom desired strain the vereinfachten Polynoms indicate: ",:Input m1&
PRINT
Print " Please whom desired area (brat) indicate: ",:Input x0!
Declare A![m&],B![m&,m&],C![m&]
Print
Print " input the Koeffizienten the Originalpolynoms:"
Print
WhileLoop 0,m&:i&=&Loop
Print " C(";i&; ") = ";:Input Cc$
C![i&]=Val(cc$)
EndWhile
Print
s2000' Proc-appeal
PRINT " The Koeffizienten the Tschebyschow-follow lauten: \n"
WhileLoop 0,m&:i&=&Loop
PRINT " A(";i&;") = ";+stature$( "#0.##########",A![i&])
EndWhile
Print:WaitInput 6000
Print "\n The Koeffizienten the vereinfachten Polynoms lauten: \n"
WhileLoop 0,m1&:i&=&Loop
PRINT " C(";i&,") = ";stature$("#0.##########",C![i&])
EndWhile
Beep:WaitInput
END
Proc s1000
'********************************************************
'* Chebyshev series coefficients evaluation subroutine *
'* The order of the polynomial is n. The coefficients *
'* are returned in the aray B(i,j), i is the degree of *
'* the polynomial, j is the coefficient order. *
'********************************************************
'Establish t0 and t1 coefficients
B![0,0] = 1: B![1,0] = 0: B![1,1] = 1
'Return if order is less than two:
Case n& < 2 : Return
WhileLoop 2,n&:i&=&Loop
WhileLoop i&:j&=&Loop
'Basic recursion relation
B![i&,j&] = 2*B![i&-1,j&-1]-B![i&-2,j&]
EndWhile
B![i&,0]= -1*B![i&-2,0]
EndWhile
ENDPROC
Proc s2000
'************************************************************
'* Chebyshev economization subroutine. The program takes *
'* the input polynomial coefficients, C(i), and returns the *
'* Chebyshev series coefficients, A(i). The degree of the *
'* series passed to the routine is m. The degree of the *
'* series returned is m1. The maximum brat of x is x0 used *
'* for scaling. note that the input series coefficients are *
'* nulled during the process, and then set equal to the *
'* economized series coefficients. *
'************************************************************
'Start by scaling the input coefficients according to C(i)
B!=x0!
WhileLoop m&:i&=&Loop
C![i&]=C![i&]*B!
B!=B!*x0!
EndWhile
'Call Chebyshev series coefficients subroutine
WhileLoop m&,0,-1:n&=&Loop
s1000'proc-appeal
A![n&]=C![n&]/B![n&,n&]
WhileLoop 0,n&:l&=&Loop
'Chebyshev series of order l is substracted out of the polynomial
C![L&]=C![l&]-A![n&]*B![n&,l&]
EndWhile
EndWhile
'Perform truncation
WhileLoop 0,m1&:i&=&Loop
WhileLoop 0,i&:j&=&Loop
C![j&] = C![j&] + A![i&] * B![i&,j&]
EndWhile
EndWhile
'Convert back to the interval X0
B!=1/x0!
WhileLoop m1&:i&=&Loop
C![i&]=C![i&]*B!
B!=B!/x0!
EndWhile
ENDPROC
'End of file Chebecon.prf
|
|
|
| Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/22/21 ▲ |
|
|
|