Jacques Gélinas on Sun, 07 Apr 2019 16:39:56 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: "pari-users@pari.math.u-bordeaux.fr" <pari-users@pari.math.u-bordeaux.fr>
- Subject: Re: Padé approximants?
- From: Jacques Gélinas <jacquesg00@hotmail.com>
- Date: Sun, 7 Apr 2019 14:39:52 +0000
- Accept-language: fr-CA, en-US
- Delivery-date: Sun, 07 Apr 2019 16:39:56 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=14ip9WPq1kUNwB+IKvABc5ryKHhfErSs4tYyo3SmWYI=; b=uTsLKshuNvPEF55hzuGt+2EldLHS11NOr6v1PAdGT1aoAmZxkIAStAU+Jmt/ZUXKJqXuWBBkcVxHbG1yVbls/P2KDoNuWcW1fv0uTK2X92GZXM4OabdHk0U6/XLv7euCQjY8Vnzu4DGAAhDD/SKtl+l692dGTjWITrHisXIvQO8DsyJ2T/erI2jJHUqkKzCJAuimm0f+CCtig3gJxy3UKmqvFWWh9sbLo2q4TMYQiOVDoT8ZCvS35F3QAIdIwFQ4wQ8GXsmNfQCGiHfUi/rmSFQ3GMJMvvIcipAWJ6DTOTjkAKJj0bbHUMi+jpD07QT3gGZxzBhoCkOasfzfk/BrHg==
- In-reply-to: <CABcj=tmUx5MadzryURxMTw3amN0FwSV5hw1bi=EMGoe-dfT2fw@mail.gmail.com>
- References: <CABcj=tmUx5MadzryURxMTw3amN0FwSV5hw1bi=EMGoe-dfT2fw@mail.gmail.com>
- Thread-index: AQHU7T/0r4rv305kO0qLbq73iHILraYww8so
- Thread-topic: Padé approximants?
This is what I have; your formulas can vary (:-)
/* Padé approximation http://mathworld.wolfram.com/PadeApproximant.html
f(x) = sum(j=0,oo,aj*x^j) ~=~ [L/M] P(x)/Q(x)
= sum(j=0,L,pj*x^j)/sum(j=0,M,qj*x^j), q0=1
p0 = a0
p1 = a1+a0*q1
pL = aL+a(L-1)*q1...+a0*qL
0 = a(L+1)+aL*q1+...+a(L-M+1)*qM
0 = a(L+M)+a(L+M-1)*q1...+a(L-M+1)*qM
*/
f(x) = exp(x);
ak(k) = if(k>=0,Vec(f(x))[k+1]);
P(L,M) = matdet(matrix(M+1,M+1,k,j,\
if(k<=M, ak(L-M+k+j-1),\
sum(i=M+1-j,L,ak(i+j-M-1)*x^i)) ));
Q(L,M) = matdet(matrix(M+1,M+1,k,j,\
if(k<=M, ak(L-M+k+j-1), x^(M+1-j)) ));
ckpade()={[
P(0,0)==1, Q(0,0)==1,
P(1,0)==1+x, Q(1,0)==1,
P(0,1)==1, Q(0,1)==1-x,
-P(0,2)==1, -Q(0,2)==1-x+x^2/2!,
-P(0,3)==1, -Q(0,3)==1-x+x^2/2!-x^3/3!,
P(0,4)==1, Q(0,4)==1-x+x^2/2!-x^3/3!+x^4/4!,
P(1,1)==1+x/2, Q(1,1)==1-x/2
]};
ckpade()