Re: Complex Ratio Polynomial Fit
- To: mathgroup at smc.vnet.net
- Subject: [mg17256] Re: Complex Ratio Polynomial Fit
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 30 Apr 1999 02:34:42 -0400
- Organization: Universitaet Leipzig
- References: <7g0s0f$du4@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Colin, Pade[] uses an analytic algorithm to construct a rational approximation form a Taylor series expansion of order K. The Taylor expansion of the rational approximation has the same first coefficients as the Taylor series as the Taylor series of the original. The basic usage is to inlude the asymptotic behaviour of the function into the approximation. AFAIK the only rational approximation that can be obtained from discrete data are Thiele's interpolation formula (25.2.50 in Abramowitz Stegun). But this is an interpolation and not a approximation and the resulting function satisfy the interpolation condition y[i]=f[x[i]]. I attach my Thiele.m package that will calculate a Thiele interpolation. Hope that helps Jens Colin L C Fu wrote: > > Hiya, > > I was told that the add-on packages in Mathematica are useful to solve > more complicated > and particular problems. Thanks! > > I tried to use Calculus'Pade' and Statistic'Nonlinear' to solve my > initial problem. i am nearly there. The problems that I have when I > used > 1) Caluculus'Pade' is that the input has to be a function instead of > data points. > > 2) Statistic'Nonlinear' is that I wouldnt be able to fit complex ratio > polynomial in the form of (a1*x^n + a2*x^(n-1) + ... + I * (b1*x^m + > ... ) )/(c1*x^n + c2*x^(n-1)) > > Please advise > > Regards > Colin filename="Thiele.m" (* Evaluation of a Thiele continued fraction for the data {x1,x2,..} and {y1,y2,..}. Author: J.-P. Kuska Last change: 10/14/93 *) BeginPackage["Thiele`"] Thiele::usage="Thiele[{x1,x2,..},{y1,y2,..},x] calculates a continued fraction due to Thiele, given the data {x1,x2..} (containing the x-values) and {y1,y2,..} (containing the y-values) Thiele calculates the resulting approximation f(x). The Pattern Thiele[{{xi,yi}..},x] is also supported." Begin["`Private`"] Thiele[l:{{_,_}..},arg_]:= Module[{ data=Transpose[l],x,y}, x=data[[1]]; y=data[[2]]; Thiele[x,y,arg] ] Thiele[x_List,y_List,arg_]:= Module[{n=Length[x],i,j,p,a}, For[i=1,i<=n, i++, p[0,i]=y[[i]]]; For[i=1,i<n, i++, p[1,i]=(x[[i]]-x[[i+1]])/(p[0,i]-p[0,i+1])]; For[i=2, i<n, i++, For[j=1, j<=n-i, j++, p[i,j]=(x[[j]]-x[[j+i]])/(p[i-1,j]-p[i-1,j+1])+p[i-2,j+1] ]; ]; a=0; Do[a=(arg-x[[i]])/(p[i,1]-p[i-2,1]+a), {i,n-1,2,-1}]; Return[y[[1]]+(arg-x[[1]])/(p[1,1]+a)] ] /; Length[x]==Length[y] End[ ] EndPackage[ ] Null