1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
(kill (all),
load (interpol),
save_tolerance : float_approx_equal_tolerance,
float_approx_equal_tolerance : 1e-8,
dat1: matrix([6.5,3],[1.8,-8],[9,2],[-2,4],[1/8,1],[9/12,3],[10,%pi]),
dat2: [[2,4],[7,1],[-7,2/7],[5,9],[8,4/9],[9,4]],
dat3: [8,5.9,4.1,8.6,9.7,3,99.8],
0);
0;
/* Lagrange interpolation */
lagrange(dat1);
3.178762054958412E-5*%pi*(x-9)*(x-6.5)*(x-1.8)*(x-3/4)*(x-1/8)*(x+2)
-1.3795660402574614E-4*(x-10)*(x-6.5)*(x-1.8)*(x-3/4)*(x-1/8)*(x+2)
+2.3412532015037063E-4*(x-10)*(x-9)*(x-1.8)*(x-3/4)*(x-1/8)*(x+2)
+.004313780800478495*(x-10)*(x-9)*(x-6.5)*(x-3/4)*(x-1/8)*(x+2)
+.003788399045316041*(x-10)*(x-9)*(x-6.5)*(x-1.8)*(x-1/8)*(x+2)
-8.045639731099019E-4*(x-10)*(x-9)*(x-6.5)*(x-1.8)*(x-3/4)*(x+2)
+1.605431979101289E-4*(x-10)*(x-9)*(x-6.5)*(x-1.8)*(x-3/4)*(x-1/8);
lagrange(dat2);
''((x-8)*(x-7)*(x-5)*(x-2)*(x+7)/224-2*(x-9)*(x-7)*(x-5)*(x-2)*(x+7)/1215
+(x-9)*(x-8)*(x-5)*(x-2)*(x+7)/280
+(x-9)*(x-8)*(x-7)*(x-2)*(x+7)/-96
+2*(x-9)*(x-8)*(x-7)*(x-5)*(x+7)/2835
+(x-9)*(x-8)*(x-7)*(x-5)*(x-2)/-1270080);
lagrange(dat3, varname=z);
''(.1386111111111111*(z-6)*(z-5)*(z-4)*(z-3)*(z-2)*(z-1)
-(z-7)*(z-5)*(z-4)*(z-3)*(z-2)*(z-1)/40
+.2020833333333333*(z-7)*(z-6)*(z-4)*(z-3)*(z-2)*(z-1)
-.2388888888888889*(z-7)*(z-6)*(z-5)*(z-3)*(z-2)*(z-1)
+.08541666666666665*(z-7)*(z-6)*(z-5)*(z-4)*(z-2)*(z-1)
-.04916666666666667*(z-7)*(z-6)*(z-5)*(z-4)*(z-3)*(z-1)
-(z-2)*(z-7)*(z-6)*(z-5)*(z-4)*(z-3)/-90);
/* Linear interpolation */
linearinterpol(dat1);
(20/17-24*x/17)*charfun2(x,minf,1/8)
+(%pi*x-2*x-9*%pi+20)*charfun2(x,9,inf)+(5.6-0.4*x)*charfun2(x,6.5,9)
+(2.340425531914894*x-12.21276595744681)*charfun2(x,1.8,6.5)
+(10.85714285714286-10.47619047619048*x)*charfun2(x,3/4,1.8)
+(16*x/5+3/5)*charfun2(x,1/8,3/4);
linearinterpol(dat2);
(26*x/63+200/63)*charfun2(x,minf,2)+(32*x/9-28)*charfun2(x,8,inf)
+(44/9-5*x/9)*charfun2(x,7,8)+(29-4*x)*charfun2(x,5,7)
+(5*x/3+2/3)*charfun2(x,2,5);
linearinterpol(dat3,varname=w);
(10.1-2.1*w)*charfun2(w,minf,2)+(96.8*w-577.8000000000001)
*charfun2(w,6,inf)+(43.2-6.7*w)*charfun2(w,5,6)
+(1.1*w+4.200000000000001)*charfun2(w,4,5)
+(4.5*w-9.4)*charfun2(w,3,4)+(9.500000000000002-1.800000000000001*w)
*charfun2(w,2,3);
/* Cubic splines interpolation */
cspline(dat1);
(2.233410484248884E-4*%pi*x^3+0.658739927100864*x^3
+0.00134004629054933*%pi*x^2+3.952439562605184*x^2
+.001671568159305024*%pi*x+3.518491936013175*x
-2.3032045618816613E-4*%pi+.4971450384125281)
*charfun2(x,minf,1/8)
+(-0.153921193200841*%pi*x^3-.06508981912631977*x^3
+4.61763579602523*%pi*x^2+1.952694573789593*x^2
-45.02243676705146*%pi*x-21.46185591876961*x+143.3819812688326*%pi
+84.43892093505657)*charfun2(x,9,inf)
+(.07396021366527837*%pi*x^3+.3549365250720062*x^3
-1.535162189359993*%pi*x^2-9.388016719565206*x^2
+10.35274510141554*%pi*x+80.60454572142358*x-22.74356433656842*%pi
-221.760283985523)*charfun2(x,6.5,9)
+(-0.00936633903933342*%pi*x^3-.5795316182501081*x^3
+.08970558837993714*%pi*x^2+8.834112075216023*x^2
-.2088954538939998*%pi*x-37.83929144465441*x
+.1399901999355959*%pi+34.86802987431265)
*charfun2(x,1.8,6.5)
+(0.0163989810743406*%pi*x^3+6.51539068532972*x^3
-.04942714023390259*%pi*x^2-29.47846836411505*x^2
+.04154345761091165*%pi*x+31.12335334614151*x
-.01027314696735098*%pi-6.509557000164901)
*charfun2(x,3/4,1.8)
+(-.007441723733517281*%pi*x^3-10.14309672394197*x^3
+.004214445583777643*%pi*x^2+8.003128306746245*x^2
+.001312268247651485*%pi*x+3.012155842995544*x
-2.153496265359353E-4*%pi+0.518242375621596)
*charfun2(x,1/8,3/4);
cspline(dat2,d1=2,varname=r);
(635237*r^3/13492332+436937*r^2/1124361+333821*r/642492
+6946987/6746166)*charfun2(r,minf,2)
+(-71261*r^3/83286+213783*r^2/9254-941613*r/4627+2720884/4627)
*charfun2(r,8,inf)
+(13907*r^3/83286-39995*r^2/27762-14209*r/1983+383564/5949)
*charfun2(r,7,8)
+(81073*r^3/111048-491039*r^2/37016+1199465*r/15864-680383/5288)
*charfun2(r,5,7)
+(-165773*r^3/499716+110833*r^2/41643-670655*r/166572+1014497/249858)
*charfun2(r,2,5);
cspline(dat3,d1=8/5,dn=1/3,varname=k);
(2.410085470085469*k^3-13.34034188034188*k^2+21.05042735042734*k
-2.120170940170938)*charfun2(k,minf,2)
+(-119.4588034188034*k^3+2292.709401709402*k^2-14537.15418803419*k
+30491.48820512821)*charfun2(k,6,inf)
+(61.94307692307693*k^3-972.5244444444445*k^2+5054.24888888889*k
-8691.31794871795)*charfun2(k,5,6)
+(-17.01350427350427*k^3+211.8242735042735*k^2-867.4947008547009*k
+1178.254700854701)*charfun2(k,4,5)
+(1.710940170940171*k^3-12.86905982905983*k^2+31.27863247863247*k
-20.10974358974358)*charfun2(k,3,4)
+(.4697435897435902*k^3-1.698290598290602*k^2-2.233675213675204*k
+13.4025641025641)*charfun2(k,2,3);
/* Rational interpolation */
ratinterpol(float(dat1),4);
(.02745720979594878*x^4-.4294101281462928*x^3+1.902788592042915*x^2
-1.285915425782587*x+1.004014288946226)
/(.1694546071655347*x^2-1.043790271992503*x+1);
ratinterpol(dat2,3,varname=t);
(6519*t^3/925960-45257*t^2/925960-199571*t/462980+9826/3307)
/(19843*t^2/925960-274651*t/925960+1);
ratinterpol(dat3,5,varname=t);
(.1279296355413674*t^5-2.30307595105081*t^4+15.22183758978451*t^3
-44.92158486299545*t^2+56.24033652567172*t
-17.31675977653632)/(1-.1189146049481245*t);
(float_approx_equal_tolerance : save_tolerance,
0);
0;
|