Luận án Các định lý thuận và đảo của xấp xỉ Padé

CÁC ĐỊNH LÝ THUẬN VÀ ĐẢO CỦA XẤP XỈ PADÉ NGUYỄN VIỆT DŨNG Trang nhan đề Mục lục Chương1: Xấp xỉ padé. Chương2: Các bài toán thuận và đảo. Chương3: Phần chứng minh. Chương4: Phụ lục. Tài liệu tham khảo

pdf25 trang | Chia sẻ: maiphuongtl | Lượt xem: 1918 | Lượt tải: 0download
Bạn đang xem trước 20 trang tài liệu Luận án Các định lý thuận và đảo của xấp xỉ Padé, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
CHUaNG IV: PHU LUC. . -> #THIS IS PROGRAMUSED TO CALCULATE A KIND OF RATIONAL APPROXIMATION - CLASSICAL PADE APPROXIMATION OF A H(O) FUNCTION (MORE DETAILS AND MORE EXPLAINS) PadeApproximant := proc(f,m,n,value) option operator; local taylorArray,i,coefficients,seqCoeffsTaylor,seqMatrix1, seqMatrix2,j,k,t,distanceMN, padeMatrix, detPadeMatrix,rightOfSystem,Q,P, sQ, setRootQ1,setRootQ, sP, setRootP, a, b, c ,r, temp,fQ,t1,t2 ; print('THIS IS A PROGRAMUSED TO CALCULATE CLASSICAL PADE APPROXIMANT OF AFUNCTION') ; printf (' \n\n') ; printf('\tThe function f(z) is:',f); print(f) ; #EXPAND TAYLOR OF F(Z) taylorArray := taylor(f, z =0, n+m+1); printf('\tThe Taylor expand of f(z) is: '); print (taylorArray) ; for i from 0 to n+m do coefficients[i] := coeff(taylorArray,z,i) ; od; #SEQUENCEOF COEFFICIENTS seqCoeffsTaylor:= seq(coefficients[i],i=O..m+n); printf('\tSo that the cofficients(from 0 to %d) of Taylor expand of f(z) is: ',m+n) ; print (seqCoeffsTaylor) ; temp := 0; for i from 1 to n+m+1do temp:=temp + seqCoeffsTaylor[i]*zA(i-1); od; distanceMN:= m-n; if (distanceMN -1 > 0) then for j from (1 - distanceMN) coefficients[j] := 0; by 1 to -1 do cd; fi; #CALCULATE COEFFICIENTS TO ESTABLISH MATRIX for t from 0 by 1 to m-1 do seqMatrix1[t] := seq(coefficients[k],k = I-distanceMN+t. .n+t); Page 1 od; seqMatrix2 := [seq(seqMatrix1[t],t = 0..m-1)]; printf('\tThis is sequence of numbers to form matrix for system of equations: '); print (seqMatrix2) ; nops(seqMatrix2) ; #MATRIX OF COFFICIENTS padeMatrix := linalg[matrix] (m,m,seqMatrix2); printf('\tSo that the matrix formed is: '); print (padeMatrix) ; with (linalg) ; detPadeMatrix := det(padeMatrix) ; #RIGHT SIDE OF SYSTEM OF EQUATIONS rightOfSystem := vector([seq(-1*coefficients[1],1=n+1. .n+m)]); print('The right of system of linear equation is: '); print (rightOfSystem) ; sQ := linsolve(padeMatrix, rightOfSystem); setRootQ1[m+1] := 1; for i from 1 to m do setRootQ1[i] := sQ[i]; od; for i from 1 to m+1 do setRootQ[i] := setRootQ1[m+2-i]; od; #COEFFICIENTS OF Q(Z) POLYNOMIAL setRootQ :=[seq(setRootQ[i],i=1. .m+1)]; printf('\tSet of coeffs of Q: '); print (setRootQ) ; Q :=0; #ESTABLISH Q(Z) for i from 1 to m+1 do Q := Q + setRootQ[i]*zA(i-1); od; printf('\tPolynomial print(Q) ; #CALCULATE f(Z) .Q(Z) fQ:=expand(temp*Q) ; Q(z):'); for i from 0 to n do sP[i] := coeff(fQ, z,i); od; #ONLYGET N+1 FIRST COEFFICIENrS OF sP setRootP := [seq(sP[i],i=O..n)]; printf('\tSet of coeffs of p:'); page 2 print (setRootP) ; printf('\tPolynomial P(z) :'); P:=o; #ESTABLISH P (Z) for i from 1 to n+l do P := P + setRootP[i] * zA(i-l); od; print(P) ; printf('\tPade approximant of f with order (%d,%d) is: ',m,n); print(P/Q) ; tl:=evalf(normal(subs(z=value,f») ; t2:=evalf(subs(z=value,P/Q» ; printf('The value of f(z) at %.8f is: %.8f\n', value,tl); printf('The value of (p/Q) (z) at %.8f is %.8f\n', value,t2); printf('The error of approximants: %.8f', abs(tl-t2»; end; PadeApproximant:=proc(f,m,n, value) localtaylorArray,i, coefficients,seqCoeffsTaylor,seqMatrix1,seqMatrix2,j,k, t,distanceMN, padeMatrix,detPadeMatrix,rightOfSystem,Q, P, sQ, setRootQ1,setRootQ,sF, setRootP,a, b, c,r, temp,fQ,t1,t2; optionoperator; print('THIS IS A PROGRAM USED TO CALCULATE CLASSICAL PADE APPROXIMA\ NT OF AFUNCTION'); printf('Inln'); printf('ItThefunctionf(z) is:" f); print(f); taylorArray:=taylor(f,z =0,n +m+ 1); printf('ItTheTaylorexpandoff(z) is: '); print(taylorArray); for i from 0 to n +mdo coefficients[i] :=coeff(taylorArray,z, i) od; seqCoeffsTaylor:=seq(coefficients[i], i =0 .. n +m); printf('ItSothatthecofficients(from0to%d)ofTaylorexpandoff(z) is: " n +m); print(seqCoeffsTaylor); temp:=0; for i ton +m+1dotemp:=temp+seqCoeffsTaylor[i]*zJ\(i- 1)od; distanceMN:=m- n; if 0<distanceMN- 1thenforj from1- distanceMNto-1docoefficients[j]:=0odfi; fortfrom0tom- 1do page 3 seqMatrixl[t] :=seq(coefficients[k],k=1- distanceMN+t .. n+t) od; seqMatrix2:=[seq(seqMatrixl[t],t=O.. m-l)]; printf('ItThisis sequenceof numberstoform matrixfor systemof equations:'); print(seqMatrix2); nops(seqMatrix2); padeMatrix:=linalg[matrix](m,m,seqMatrix2); printf('ItSothatthematrixformedis: '); print(padeMatrix); withelinalg); detPadeMatrix:=det(padeMatrix); rightOjSystem:=vector([seq(-coefficients[I], 1=n+1.. n+m)]); print('Therightof systemof linearequationis: '); print(rightOjSystem); sQ :=linsolve(padeMatrix,rightOjSystem); setRootQl[m+1] :=1; for ito m dosetRootQl[i] :=sQ[i] od; for i tom+1dosetRootQ[i]:=setRootQl[m+2- i] od; setRootQ:=[seq(setRootQ[i],i =1.. m +1)]; printf('ItSetofcoeffsofQ: '); print(setRootQ); Q '=0'. , fori tom+1doQ :=Q+setRootQ[i]*zl\(i- 1)od; printf('ItPolynomialQ(z):'); print(Q) ; fQ :=expand(temp*Q); for i from0ton dosP[i] :=coeff(jQ,z, i) od; setRootP:=[seq(sP[i],i =0.. n)]; printf('ItSetofcoeffsofP: '); print(setRootP); printf('ItPolynomialP(z):'); P :=0; fori ton+1doP :=P +setRootP[i]*zl\(i- 1)od; print(P) ; printf('ItPadeapproximantoffwithorder(%d,%d)is: " m,n); print(P/ Q); t1:=evalf(normal(subs(z=value,!))); t2:=evalf(subs(z=value,P / Q)); printf('Thevalueoff(z)at%.8fis:%.8f\n" value,t1); Page 4 printf('Thevalueof (P/Q)(z)at %.8f is %.8f\n" value,t2); print£\:'Theerrorofapproximants:%.8f, abs(t1- t2)) -end j> #USEMY FUNCTION TO DO SOME TEST ON SOME BASIC l EXPONENTIAL, SIN, POWER, RATIONAL FUNCTIONS. >#THE FISRT FUNCTION IS EXPONENTIAL FUNCTION FUNCTION SUCH AS: PadeApproximant(exp(z) ,3,2,1); print('--------------------------------------------------------- - ') ; PadeApproximant(exp(z) ,3,3,1); THISIS A PROGRAM USED TO CALCULATE CLASSICAL PADE APPROXIMANT OF AA UNCTION The function f(z) is: z e The Taylor expand of f(z) is: 1 2 1 3 1 4 1 5 6 1 + z +- z +- z + - z + - z + O(z )2 6 24 120 So that the cofficients(from 0 to 5) of Taylor expand of f(z) 1 1 1 1 11---- , , 2' 6' 24' 120 This is sequence of numbers to form matrix for system of equations: is: [ 1 11111 ] 11-1----- , , 2' '2'6'2' 6'24 So that the matrix formed is: 1 1 1 2 1 6 1 24 1 1 2 1 6 1 2 Warning, new definition for norm Warning, new definition for trace Therightof systemof linearequationis: [ -1 -1 -1 :6' 24' 120 Set of coeffs of Q: [ -3 3 -1 ]1, 5' 20' 60 . Polynomial Q (z) : 3 3 2 1 3l--z+-z --z 5 20 60 Page 5 I Set of coeffs of P: [ 2 1 ] 1 -- , 5'20 Polynomial P (z) : 2 1 21+-z+-z 5 20 Pade approximant of f with order (3,2) is: The value of The value of The error of 2 1 2 1 +-z+-z 5 20 3 3 2 1 3l--z+-z --z 5 20 60 f(z) at 1.00000000 is: 2.71828182 (P/Q) (z) at 1.00000000is 2.71875000 approximants: .00046817 ---------------------------------------------------------- THISIS A PROGRAM USED TO CALCULATE CLASSICAL PADE APPROXIMANT OF AF\ UNCTION The function f(z) is: ze The Taylor expand of f(z) is: 1 2 1 3 1 4 1 5 1 6 7 1 + z + - z + - z + - z + - z + - z + D( z ) 2 6 24 120 720 So that the cofficients(from 0 to 6) of Taylor expand of f(z) is: 1 1 1 1 1 11----- , '2'6'24' 120' 720 This is sequence of numbers to form matrix for system [ 11111111 ]1, 2' 6' 2' 6' 24' 6' 24' 120 So that the matrix formed is: of equations: Therightof systemof linearequationis: [ -1 -1 -1 ]24' 120'720 Set of coeffs of Q: [ -1 1 -1 ]1, 2' 10' 120 Polynomial Q(z): Page 6 1 1 1 - - 2 6 1 1 1- - - 2 6 24 1 1 1- - - 6 24 120 1 1 2 1 31--z+-z --z 2 10 120 Set of coeffs of P: [ 1 1 1 ]1, 2' 10' 120 I Polynomial P (z) : 1 1 2 1 31+-z+-z +-z 2 10 120 Fade approximant of f with order (3,3) is: 1 1 2 1 31+-z+-z +-z 2 10 120 1 1 2 1 31--z+-z --z 2 10 120 The value of f(z) at 1.00000000 is: 2.71828182 The value of (P/Q) (z) at 1.00000000 is 2.71830985 The error of approximants: .00002803 > #THE SECOND FUNCTION IS SIN FUNCTION PadeApproximant(sin(z) ,1,5,evalf(Pi/4»; PadeApproximant(sin(z) ,3,3,evalf(Pi/4»; THISIS A PROGRAM USED TO CALCULATE CLASSICAL PADE APPROXIMANT OF AF\ UNCTION The function f(z) is: sin(z) The Taylor expand of f(z) is: 1 3 1 5 7 Z - - z +- z + O( z ) 6 120 So that the cofficients(from 0 to 6) of Taylor expand of f(z) is: -1 1 0,1,0,-,0, -,0 6 120 II This is sequence of numbers to form matrix for system of equations: [1~0] So that the matrix formed is: [ 1~0 ] The right of system of linear equation is: [0] Set of coeffs of Q: [ 1, 0] . Polynomial Q(z): 1 Set of coeffs of P: page 7 [-1 1 ] 0,1,0,-,0,- 6 120 Polynomial P(z): 1 3 1 5 Z--Z +-Z 6 120 Fade approximant of f with order (1,5) is: The value of The value of The error of 1 3 1 5Z--Z +-z 6 120 f (z) at .78539816 is: .70710678 (p/Q) (z) at .78539816 is .70714304 approximants: .00003626 THISIS A PROGRAM USED TO CALCULATE CLASSICAL PADE APPROXIMANT OF AF\ UNCTION The function f(z) is: sineZ) The Taylor expand of f(z) is: 1 3 1 5 7 Z - - Z +- Z + O( Z )6 120 So that the cofficients(from 0 to 6) of Taylor expand of f(z) lS: -1 1 0,1,0,-,0, -,0 6 120 This is sequence of numbers to form matrix for system of equations: [ -1 -1 -1 1 ] 10-0-0-0- "6"6"6"120 So that the matrix formed is: Therightofsystemof linearequationis: [ -1 ] 0 -0 , 120' Set of coeffs of Q: [ 1,O'2~'O] Polynomial Q (z) : 1 2 1 +-Z' 20 Set of coeffs of P: [ 0, 1, 0, ~~] page 8 -1 1 0 - 6 -1 0 - 0 6 -1 1- 0 - 6 120 Polynomial P(z): 7 3z--z 60 Fade approximant of f with order (3,3) is: 7 3z--z 60 1 21+-z 20 The value of f(z) at .78539816 is: .70710678 The value of (p/Q) (z) at .78539816 is .70706853 The error of approximants: .00003824 > #THE THIRD FUNCTION IS POWER FUNCTION PadeApproximant(sqrt(l+z) ,1,1,1); print(' jjjj------------------------------- --') ; PadeApproximant(sqrt(l+z) ,3,3,1); THIS IS A PROGRAM USED TO CALCULATE CLASSICAL PADE APPROXIMANT OF AA UNCTION The function f(z) is: ,JI;; The Taylor expand of f(z) is: 1 1 2 1 3 5 4 5 1 + - z - - z + - z - - z + D( z )2 8 16 128 So that the cofficients(from 0 to 2) of Taylor expand of f(z) is: 1 -1 1 -- , 2' 8 This is sequence of numbers to form matrix for system of equations: [;] So that the matrix formed is: [ 1 2 ] Set of coeffs of Q: The right of system of linear equation is: [t [ 1, ~] Polynomial Q (z) : I Set of coeffs of P: '1 1 +-z 4 page 9 Polynomial P(z): [ 1,~] 3 1+-z 4 Pade approximant of f with order (1,1) is: 3 1 +-z 4 1 1+-z 4 f(z) at 1.00000000 is: 1.41421356 (p/Q) (z) at 1.00000000 is 1.40000000 approximants: .01421356 The value of The value of The error of ////--------------------------------- THISISA PROGRAMUSEDTOCALCULATECLASSICALPADEAPPROXIMANTOFAF\ UNCTION The function f(z) is: [1;; The Taylor expand of f(z) is: 1 1 2 1 3 5 4 7 5 21 6 33 7 429 8 9 1 +-z--z +-z --z +-z --z +-z --z +O(z) 2 8 16 128 256 1024 2048 32768 So that the cofficients(from 0 to 6) of Taylor expandof f(z) is: 1 -1 1 -5 7 -21 1------ , 2' 8' 16'128'256'1024 This is sequence of numbers to form matrix for system of equations: [ 1 -1 1 -1 1 -5 1 -5 7 ]2' 8' 16' 8' 16'128'16'128'256 So that the matrix formed is: 1 2 -1 8 1 16 -1 8 1 16 -5 128 1 16 -5 128 7 256 Therightof systemof linearequationis: [ 5 -7 21 ]128'256'1024 Set of coeffs of Q: Polynomial Q(z): [ 5} 1 ]1,4'8'64 page10 5 3 2 1 31+-z+-z +-z 4 8 64 Set of coeffs of P: [ 7 7 7 ]1, 4' 8' 64 Polynomial P(z): 7 7 2 7 31+-z+-z +-z 4 8 64 Fade approximant of f with order (3,3) is: 7 7 2 7 31+-z+-z +-z 4 8 64 5 3 2 1 31+-z+-z +-z 4 8 64 The value of f(z) at 1.00000000 is: 1.41421356 The value of (p/Q) (z) at 1. 00000000 is 1. 41420118 The error of approximants: .00001237 > #THE FOURTH FUNCTION IS RATIONAL FUNCTION PadeApproximant((z+1)/(zA2+1) ,1,1,0.5); print(' ////------------------------------- --') ; PadeApproximant((z+1)/(zA2+1) ,2,1,0.5); THISIS A PROGRAM USED TO CALCULA TE CLASSICAL PADE APPROXIMANT OF AF\ UNCTION The function f(z) is: l+z i+ 1 The Taylor expand of f(z) is: 2 3 1 + z - z + O(Z ) So that the cofficients(from 0 to 2) of Taylor expand of f(z) is: 1, 1, -1 This is sequence of numbers to form matrix for system of equations: [ 1] So that the matrix formed is: [ 1] The right of system of linear equation is: I I Set of coeffs of Q: II [ 1] [ 1, 1] Polynomial Q (z) : 1+z I Set of coeffs of P: [ 1, 2] Polynomial P (z) : 1+2z Page 11 1+2z 1+z z z ////--------------------------------- THISIS A PROGRAM USED TO CALCULATE CLASSICAL PADE APPROXIMANT OF API UNCTION T z l+z l+ 1 2 3 4 1+z - z - z +O(z ) 3 1,1,-1,-1 [1,1,1,-1] [~ -~] Theright(ifsystemof linearequationis: [ 1,1] [1, 0, 1] () l+ 1 [ 1, 1] () l+z Pa ea 1'0imantoff ithorer IS: l+z l+ 1 ( ) 0000000 120000000 ( )() 0000000 120000000 0 00000000 #THIS IS PROGRAMUSE CLASSICAL PADE APPROXIMATION TO DO APPROXIMATE CALCULATION FOR SOME SPECIAL QUANTITIES (e & Pi, ONLY GET RESULT NOT EXPLAIN OBVIOU$LY!) PadeApproximantTB := proc(f,m,n) option operator; local taylorArray,i,coefficients,seqCoeffsTaylor,seqMatrix1, seqMatrix2,j,k,t,distanceMN, padeMatrix, detPadeMatrix,rightOfSystem,Q,P, sQ, setRootQ1,setRootQ, sP, Page12 setRootP, a, b, c ,r, temp,fQ, last; taylorArray := taylor(f, z =0, n+m+1); for i from 0 to n+m do coefficients[i] := coeff(taylorArray,z,i); od; seqCoeffsTaylor:= seq(coefficients[i],i=O..m+n); temp := 0; for i from 1 to n+m+1do temp:=temp + seqCoeffsTaylor[i]*zA(i-1); od; distanceMN:= m-n; if (distanceMN -1 > 0) then for j from (1 - distanceMN) coefficients[j] := 0; by 1 to -1 do od; fi; for t from 0 by 1 to m-1 do seqMatrix1[t] := seq(coefficients[k],k = 1-distanceMN+t. .n+t); od; seqMatrix2 := [seq(seqMatrix1[t],t = O..m-1)]; nops(seqMatrix2) ; padeMatrix := linalg[matrix] (m,m,seqMatrix2); with (linalg) ; detPadeMatrix := det(padeMatrix) ; rightOfSystem := vector([seq(-1*coefficients[1],1=n+1..n+m)]); sQ := linsolve(padeMatrix, rightOfSystem); setRootQ1[m+1] := 1; for i from 1 to m do setRootQ1[i] := sQ[i]; od; for i from 1 to m+1 do setRootQ[i] := setRootQ1[m+2-i]; od; setRootQ :=[seq(setRootQ[i],i=1..m+1)]; Q :=0; for i from 1 to m+1do Q := Q + setRootQ[i]*zA(i-1); od; fQ:=expand(temp*Q) ; for i from 0 to n do sp [i ] : = coeff (fQ, z, i) ; od; setRootP := [seq(sP[i],i=O..n)]; P:=O; Page 13 for i from 1 to n+1 do p := P + setRootP[i] * zA(i-1}; od; p/Q; end; PadeApproximantTB:=proc(f,m,n) localtaylorArray,i coefficients,eqCoeffsTaylor,seqMatrixl,seqMatrix2,j,k,t,distanceMN, padeMatrix,detPadeMatrix,rightOfSystem,Q,P, sQ,setRootQl,setRootQ,sF,setRootP,a,b, c,r, temp,jQ,last; optionoperator; taylorArray:=taylor(f,z=0,n+m+1); for i from0ton +mdocoefficients[i]:=coeff(taylorArrcry,z, i) od; seqCoeffsTaylor:=seq(coefficients[i],i =0" n+m); temp:=0; for i ton +m+1dotemp:=temp+seqCoeffsTcrylor[i ]*zt\(i-I) od; distanceMN:=m- n; if 0 <distanceMN- 1thenforj from1- distanceMNto-1docoefficientsU]:=0odfi; fortfrom0tom- 1do seqMatrixl[t]:=seq(coefficients[k],= I-distanceMN+t.. n+t) od; seqMatrix2:=[seq(seqMatrixl[t],t=0..m- 1)]; nops(seqMatrix2); padeMatrix:=linalg[matrix](m,m,seqMatrix2); withelinalg); detPadeMatrix:=det(padeMatrix); rightOfSystem:=vector([seq(-coefficients[I],1=n+1..n+m)]); sQ :=linsolve(padeMatrix,ightOfSystem); setRootQl[m+1] :=1; for i tomdosetRootQl[i]:=sQ[i] od; fori tom+1dosetRootQ[i]:=setRootQl[m+2- i] od; setRootQ:=[seq(setRootQ[i],i =1.. m+1)]; Q :=0; fori tom+1doQ :=Q+setRootQ[i]*zt\(i- 1)od; fQ :=expand(temp*Q); for i from0ton dosP[i] :=coeff(fQ,z,i) od; setRootP:=[seq(sP[i], i =0.. n)]; P :=0; for i ton +1doP :=P +setRootP[i]*zt\(i- 1)od; P/Q page14 c end > printf('TEST FOR USING PADE APPROXIMANT TO CALCULATE NUMBER E (%.10f)\n' ,evalf(exp(l»); printf('Order\t\t\t\tApproximant\t\t\t\t\t\t\t for i from 1 to 6 do printf(' (%d,%d)\t\t\t\t%.10f\t\t\t\t\t%.10f',i,i,evalf(subs(z=1, PadeApproximantTB(exp(z) ,i,i,l») ,evalf(subs(z=l,PadeApproximant TB (exp ( z) , i , i , 1) ) - exp ( 1) ) ) ; printf ( '\n' ) ; print(PadeApproximantTB(exp(z),i,i,l» ; oct; TEST FOR USING PADE APPROXIMANTTO CALCULATENUMBERE (2.7182818280) Order Approximant Error (1,1) 3.0000000000 .2817181720 1 1 2 1 31+-z+-z +-z 2 10 120 1 1 2 1 3l--z+-z --z 2 10 120 -.0000001100 1321314 1+-z+-z +-z +-z 2 28 84 1680 1321314 l--z+-z --z +-z 2 28 84 1680 .0000000010 1 1 2 1 3 1 4 1 51+-z+-z +-z +-z +-z 2 9 72 1008 30240 1 1 2 1 3 1 4 1 5l--z+-z --z +-z --z 2 9 72 1008 30240 2.7182818280 0.0000000000 152131415 16 1+-z+-z +-z +-z + :--z + z 2 44 66 792 15840 665280 152131415 16 l--z+-z --z +-z --z + z 2 44 66 792 15840 665280 I> printf('TEST FOR USING PADE APPROXIMANT TO CALCULATE Page 15 (2,2) 2.7142857140 (3,3) 2.7183098590 (4,4) 2.7182817180 (5,5) 2.7182818290 (6,6) Error\n') ; 1 1+-z 2 1 l--z 2 -.0039961140 1 1 21+-z+-z 2 12 1 1 2l--z+-z 2 12 .0000280310 NUMBER Pi (%.10f)\n',evalf(arctan(1)*4» ; printf('Order\t\t\t\tApproximant\t\t\t\t\t\t\t for i from 1 to 5 do printf(' (%d,%d)\t\t\t\t%.10f\t\t\t\t\t%.10f',i,i,evalf(subs(z=1, PadeApproximantTB(arctan(z) ,i,i»)*4,evalf(subs(z=1,PadeApproxim antTB(arctan(z) ,i,i» -arctan(1» *4); printf ( '\n' ) ; print(PadeApproximantTB(arctan(z) ,i,i»; oct; TEST FOR USING PADE APPROXIMANTTO CALCULATENUMBERPi (3.1415926540) Order Approximant Error (1,1) 4.0000000000 .8584073460 Error\n') ; (2,2) 3.0000000000 z -.1415926540 z 1 21+-z 3 (3,3) 3.1666666670 .0250740128 (4,4) 3.1372549020 4 3z+-z 15 3 21+-z 5 -.0043377520 11 3z+-z 21 (5,5) 3.1423423420 6 2 3 41+-z +-z 7 35 .0007496884 7 3 64 5z+-z +-z 9 945 10 2 5 41+-z +-z 9 21 '> #Integral FUNCTION Integral:=proc(f,omega) option operator; local setRootOmega, i, total Integral, temp; readlib(residue) ; setRootOmega1 := {solve(omega)}; for i from 1 to nops(setRootOmega1) do setRootOmega[i] :=evalf(setRootOmega1[i]); oct; totalIntegral:= 0; temp := f/omega; for i from 1 to nops(setRootOmega1) do totalIntegral:=totalIntegral + 2*Pi*I*residue(temp, page 16 z=setRootOmega[i]) ; od; normal (evalf(totalIntegral» ; #totalIntegral; end; Warning, 'setRootOmegal' is implicitly declared local Integral:=proc(f,co) localsetRootOmega,i, totalIntegral,temp,setRootOmegal; optionoperator; readlib(residue); setRootOmegal:={solve(co)}; for i tonops(setRootOmegal)dosetRootOmega[i] :=evalf(setRootOmegal[i] ) od; totalIntegral:=0; temp:=i/ co; for i tonops(setRootOmegal)do totalIntegral:=totalIntegral+2*I*rc*residue(t mp,z=setRootOmega[i]) od; normal(evalf(totalIntegral)) Lend r> #PadeApproximant FUNCTION PadeApproximantK := proc(f,m,n,omega,value) option operator; local seqIntegral,i,t, seqMatrix1, seqMatrix2, padeMatrix, Q,k, setRootQ1, setRootQ, sQ, rightOfSystem, setRootP, setRootP1, P, t1, t2 ; print('THIS IS A PROGRAMUSED TO CALCULATE CLASSICAL PADE APPROXIMANT OF AFUNCTION'); printf('\n\n') ; printf('\tThe function f(z) is:',f); print(f) ; seqIntegral := [seq(evalf(Integral(f*zAi, omega», i=O..2*m-1)]; print (seqIntegral) ; for t from 1 to m do seqMatrix1[t] := seq(seqIntegral[k+t] ,k = 1. .m); od; seqMatrix2 := [seq(seqMatrix1[t],t = 1..m)]; printf('\tThis is sequence of numbers to form of equations: '); print (seqMatrix2) ; matrix for system Page17 nops(seqMatrix2) ; padeMatrix := linalg[matrix] (m,m,seqMatrix2); printf('\tSo that the matrix formed is: '); print (padeMatrix) ; with (linalg) ; rightOfSystem := vector([seq(-1*seqlntegral[1],1=1..m)]); printf('The right of system of linear equation is: '); print (rightOfSystem) ; sQ := linsolve(padeMatrix, rightOfSystem); for i from 1 to nops(sQ) do print(whattype(sQ[i]» ; cd; print (sQ) ; setRootQ1[0] :=1; for i from 1 to m do setRootQ1[i] := sQ[i]; cd; setRootQ :=[seq(setRootQ1[i],i=0..m)]; printf('\tSet of coeffs of Q: '); print (setRootQ) ; Q :=0; for i from 1 to m+1 do Q := Q + setRootQ[i]*zA(i-1); cd; printf('\tPolynomial Q(z) :'); print(Q) ; setRootP1 := [seq(Integral(Q*f*zAi,omega) ,i=m..m+n)]; print(setRootP1); setRootP:=[seq(setRootP1[n+2-i]/(2*Pi*I) ,i=1. .n+1)]; printf('\tSet of coeffs of P: '); print (setRootP) ; P :=0; for i from 1 to n+1 do P := P + setRootP[i]*zA(i-1); cd; printf('\tPolynomial P(z) :'); print(P) ; printf('\tPade approximant of print(normal(evalf(P/Q») ; f with order (%d,%d) is: ',m,n); t1:=evalf(subs(z=value,f» ; t2:=evalf(subs(z=value,P/Q» ; printf('The value of f(z) at %f is: %f \n',value,t1); printf('The value of P(z)/Q(z) at %f is: %a \n',value,t2); printf('The error of approximants: %.8f', abs(t1-t2»; end; Page 18 PadeApproximantK:=proc(f,m,n,0),value) localseqIntegral,i, t,seqMatrix1,seqMatrix2,padeMatrix,Q,k,setRootQ1,setRootQ,sQ, rightOfSystem,setRootP,setRootP1,P, t1,t2; optionoperator; print('THISIS A PROGRAMUSEDTOCALCULATECLASSICBLPADEAPPROXIMA\ NT OFAFUNCTION'); printf('Inln'); printf('liThefunctionf(z) is:',f); print(f); seqIntegral:=[seq(evalf(Integral(f*zl\i,0)), i =0" 2*m- 1)]; print(seqIntegral); for t to m doseqMatrix1[t] :=seq(seqIntegral[k +t], k = 1 .. m) od; seqMatrix2:=[seq(seqMatrix1[t],= 1.. m)]; printtr:'ItThisissequenceofnumberstoformmatrixfor systemofequations:'); print(seqMatrix2); nops(seqMatrix2); padeMatrix:=linalg[matrix](m,m,seqMatrix2); printf('ItSothatthematrixformedis: '); print(padeMatrix); withelinalg); rightOfSystem:=vector([seq(-seqIntegral[I], 1=1" m)]); printf('Therightofsystemoflinearequationis: '); print(rightOfSystem); sQ :=linsolve(padeMatrix,rightOfSystem); for i tonops(sQ) doprint(whattype(sQ[i] )) od; print(sQ); setRootQ1[0]:=1; for i tomdosetRootQ1[i]:=sQ[i] od; setRootQ:=[seq(setRootQ1[i],=0.. m)]; printf('ItSetofcoeffsofQ: '); print(setRootQ); Q '=0', , for i tom+1doQ :=Q +setRootQ[i]*zl\(i- 1)od; printtr:'ItPolynomialQ(z):'); print(Q); setRootP1:=[seq(Integral(Q*f*zl\i,0),i =m'" n+m)]; print(setRootP1); setRootP:=[seq(- 1/ 2*I*setRootPl[n +2- i] / n, i =1..n+1)]; printf('ItSetofcoeffsofP: '); page19 print(setRootP); P :=0; fori ton+1doP :=P +setRootP[i]*zJ\(i- 1)od; printf('ItPolynomialP(z):'); print(P); print£{'ItPadeapproximantoffwithorder(%d,%d)is: " m,n); print(normal(evalf(P / Q) )); t1:=evalf(subs(z=value,f)); t2:=evalf(subs(z=value,P / Q)); printf('Thevalueoff(z)at%fis: %fIn" value,t1); printf('ThevalueofP(z)/Q(z)at %fis: %a In" value,t2); i printf('Theerrorofapproximants:%.8j', abs(tl - t2)) lend r> PadeApproximantK(exp(z+l) ,2,1,zA4-l,O); #IN CASE THE OMEGA FUNCTION: zAn. WE HAVE THE CLASSICAL PADE APPROXIMANT ION PadeApproximantK(exp(z) ,1,2,zA4,1); THISISA PROGRAMUSEDTOCALCULATECLASSICALPADEAPPROXIMANTOFAF\ UNCTION The function f(z) is: e(z+l) [2.8499672801,8.563460414I, 17.22184443I, 17.79153661I] II This is sequence of numbers to form matrix for system of equations: [8.563460414I, 17.22184443I, 17.22184443I, 17.79153661I] SO that the matrix formed is: [ 8.563460414I 17.22184443I ]17.22184443I 17.79153661I II The right of system of linear equation is: [-2.849967280I, -8.563460414I] float [-.6709426697,.1681366781] Set of coeffs of Q: [1, -.6709426697,.1681366781] Polynomial Q(z): 1- .6709426697z+.1681366781 i [5.7639273881,17.319203731] Set of coeffs of P: [ 8.659~OI865.2.881:63694] Polynomial P(z): Page 20 8.659601865 z + 2.881963694- n n Fade approximant of f with order (2,1) is: The value of The value of The error of 2.756436883+.9173575352z 1. - .6709426697Z +.1681366781i f(z) at 0 is: 2.718281 P(z)/Q(z) at 0 is: 2.756436883 approximants: .03815505 THISISA PROGRAMUSEDTOCALCULATECLASSICALPADEAPPROXIMANTOFAA UNCTION The function f(z) is: ze [1.0471975511,3.1415926541] This is sequence of numbers to form matrix for system of equations: [3.1415926541] So that the matrix formed is: [3.1415926541] The right of system of linear equation is: [ -1.0471975511] float [ -.3333333332] Set of coeffs of Q: [1, -.3333333332] Polynomial Q(z): 1- .3333333332 Z Set of coeffs of [1.0471975521,4.1887902071,6.2831853081] P: [ 3.141592654,2.094395104,.5235987760 ]n n n I PolynomialP(z): . 3.141592654 z i I +2.094395104- +.5235987760-n n n Fade approximant of f with order (1,2) is: .9999999999+ .6666666670Z + .1666666668i -1. +.3333333332Z The value of f(z) at 1 is: 2.718281 The value of P(z)/Q(z) at 1 is: 2.750000000 The error of approximants: .03171817 ] > PadeApproximantK(sqrt(z+2) ,1,2,ZA4-1,-1); PadeApproximantK(sqrt(z+2) ,2,1,ZA4-1,-1); PadeApproximantK(sqrt(z+2) ,1,2,ZA4-1,O); I PadeApproximantK(sqrt(z+2) ,2,1,ZA4-1,O); I I THISISA PROGRAMUSEDTOCALCULATECLASSICALPADEAPPROXIMANTOFAA page 21 UNCTION The function f(z) is: 0 [.0705747922 I, -.280611096 I] This is sequence of numbers to form matrix for system of equations: [ -.280611096 I] So that the matrix formed is: [-.2806110961] The right of system of linear equation is: [ -.0705747922 I] float [ .2515039256] Set of coeffs of Q: [1, .2515039256] Polynomial Q (z) : 1 + .2515039256 z [.280049163 I, 4.458461306 I, 8.881351683 I] Set of coeffs of P: [ 4.440675842, 2.229230653, .1400245815 ]n n n Polynomial P(z): 4.440675842 z i + 2.229230653 - + .1400245815 - n n n Pade approximant of f with order (1,2) is: 1.413511021 + .7095861552 z +.04457120859 i 1. + .2515039256 z The value of f(z) at -1 is: 1 The value of P(z)/Q(z) at -1 is: 1.000000001 The error of approximants: .00000000 THISISA PROGRAMUSEDTOCALCULATECLASSICALPADEAPPROXIMANTOFAA UNCTION The function f(z) is: 0 [.0705747922I, -.2806110961,2.229230648I, 8.863601844I] This is sequence of numbers to form matrix for system of equations: [-.2806110961,2.2292306481,2.2292306481,8.863601844I] SO that the matrix formed is: [ -.280611096I 2.229230648I ]2.229230648I 8.863601844I The right of system of linear equation is: [ -.0705747922I, .280611096I] float Page 22 j;~m2 [.07057479221,-.2806110961,2.2292306481,8.863601844I] This is sequence of numbers to form matrix for system of equations: [-.280611096I, 2.229230648I, 2.229230648I, 8.863601844I] So tho. the matr orIn.ed is: [ -.280611096I 2.229230648I J2.229230648I 8.863601844I i The r'i of system of linear equation is: [-.0705747922I, .280611096I] float [.1677812797,-.01053883924] Set 0 coeffs of Q: [1, .1677812797,-.01053883924] Pol Q (z) : 1+.1677812797z - .01053883924i [3.715633335I, 8.878400291I] Set of coeffs of P: [ 4.439~OO146, L857~16668] Polynomial P(z): 4.439200146 z +1.857816668- TC TC Pade approximant of f with order (2,1) is: 1.413041293+.5913614120z -1. - .1677812797z+ .01053883924i The value of f(z) at -1 is: 1 'I'he value of P(z)!Q(z) at -1 is: .9999999999 The error of approximants: .00000000 THIS IS A PROGRAl'vfUSED TO CALCULATE CLASSICAL PADE APPROXLvfANTOF AFU\ NCTION The function f(z) is: ~z+2 [.0705747922I, -.280611096I] This is sequence of numbers to form matrix for system of [-.280611096I] So that the matrix formed is: The r: [-.280611096I] t of system of linear equation is: [-.0705747922I] float [.2515039256] Set of coeffs of Q: [1,.2515039256] Q (z) : Page 23 1+.2515039256z [.2800491631,4.4584613061,8.8813516831] Set of coeffs of [ 4.440675842,.229230653,.1400245815]n n n p (z) : 4.440675842 z i +2.229230653-+ .1400245815- n n n Pade approximant of f with order (1,2) is: 1.413511021+.7095861552z +.04457120859 1.+.2515039256z The value of f(z) at 0 is: 1.414213 The value of P(z) (z) at 0 is: 1.413511021 The error of' armrox!mants: . 0 70254 I TIlLS'IS A PROGRAA1USED TO CALCULATE CLASSICAL PADE APPROXlJ\;fANTOF AFU\ NCTION The Yunction f(z) is: ~z+2 [.07057479221,-.280611096!,2.229230648!, 8.8636018441] This is sequence of numbers to form matrix for system of eQuations: [-.2806110961,2.2292306481,2.229230648J, 8.8636018441] So that the matrix Yorrned is: [ -.28061109612.229230648! J2.22923064818.8636018441 The right of system of linear equaLian is: [-.0705747922J, .280611096!] float [.1677812797,-'(H053883924] Set of caeffs of Q: [1, .1677812797,-.01053883924] Pol"rnamial Q (z) : 1+.1677812797z - .01053883924i [3.715633335J, 8.878400291!] Set of coeffs of P: [ 4.439~OOI46,1.857:16668] Pol 2 (z) : 4.439200146+1.857816668~n Pade approximant of f with order (2,1) is: 1.413041293+.5913614120z -1. - .1677812797z + .01053883924i The value of f(z) at 0 is: 1.414213 i The value of 2(z)/Q(z) at 0 is: 1.413041293 Page 24

Các file đính kèm theo tài liệu này:

  • pdf5.pdf
  • pdf0.pdf
  • pdf1.pdf
  • pdf2.pdf
  • pdf3.pdf
  • pdf4.pdf
  • pdf6.pdf