From: Mario R. R. <rio...@us...> - 2008-11-19 17:57:58
|
Update of /cvsroot/maxima/maxima/share/numeric In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv4181/share/numeric Modified Files: interpol.mac rtest_interpol.mac Log Message: Removing calls to rat and expand in lagrange and ratinterpol, as dicussed in the mailing list Index: interpol.mac =================================================================== RCS file: /cvsroot/maxima/maxima/share/numeric/interpol.mac,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- interpol.mac 4 Jul 2008 17:55:23 -0000 1.5 +++ interpol.mac 19 Nov 2008 17:57:51 -0000 1.6 @@ -25,7 +25,6 @@ to contact me at mario @@@ edu DOT xunta DOT es -www.biomates.net */ @@ -80,7 +79,7 @@ /* point_size = 3, */ /* points(p)) $ */ lagrange(tab,[select]) := block([n,sum:0,prod,options, defaults,ratprint:false], - tab: rat(interpol_check_input(tab,"lagrange")), + tab: interpol_check_input(tab,"lagrange"), options: ['varname], defaults: ['x], for i in select do( @@ -97,7 +96,7 @@ for k:1 thru n do if k#i then prod: prod * (defaults[1]-tab[k][1]) / (tab[i][1]-tab[k][1]), sum: sum + prod * tab[i][2] ), - expand(sum) )$ + sum )$ @@ -289,8 +288,8 @@ /* 'varname='x: the name of the independent variable */ /* 'denterm=1 : value for q_0 in the denominator */ /* Sample session: */ -/* load(interpol); */ -/* load(draw)$; */ +/* load(interpol)$ */ +/* load(draw)$ */ /* p: [[7.2, 2.5], [8.5, 2.1], [1.6, 5.1], [3.4, 2.4], [6.7, 7.9]]$ */ /* for k:0 thru length(p)-1 do */ /* draw2d(explicit(ratinterpol(p,k),x,0,9), */ @@ -300,7 +299,7 @@ /* yrange=[0,10])$ */ ratinterpol(tab,r,[select]) := block([n,m,coef,indep,pq,p,q,options,defaults,ratprint:false], - tab: rat(interpol_check_input(tab,"ratinterpol")), + tab: interpol_check_input(tab,"ratinterpol"), options: ['varname, 'denterm], defaults: ['x, 1], for i in select do( Index: rtest_interpol.mac =================================================================== RCS file: /cvsroot/maxima/maxima/share/numeric/rtest_interpol.mac,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- rtest_interpol.mac 4 Jul 2008 18:11:52 -0000 1.2 +++ rtest_interpol.mac 19 Nov 2008 17:57:51 -0000 1.3 @@ -12,21 +12,29 @@ /* Lagrange interpolation */ lagrange(dat1); -80*%pi*x^6/2516703+25417809756117728*x^6/3364668634157308863 --1294*%pi*x^5/2516703-1050168467878124044*x^5/5607781056928848105 -+10445*%pi*x^4/5033406+24505062080112140839*x^4/16823343170786544315 -+6637*%pi*x^3/10066812-31565086605309146429*x^3/11215562113857696210 --14123*%pi*x^2/1677802-3429135865963840231*x^2/502189348381687890 -+20331*%pi*x/3355604+58308893514755834747*x/5607781056928848105 --1053*%pi/1677802-23414553873524556/124617356820641069; +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); --12659*x^5/3810240+308933*x^4/3810240-461809*x^3/1270080 --12536357*x^2/3810240+49237291*x/1905120-24805/756; +(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); -149*z^6/1200-973*z^5/400+369*z^4/20-16523*z^3/240+160231*z^2/1200 --77953*z/600+571/10; +.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) +-(2-z)*(z-7)*(z-6)*(z-5)*(z-4)*(z-3)/90; /* Linear interpolation */ @@ -113,21 +121,18 @@ /* Rational interpolation */ ratinterpol(float(dat1),4); -(70307025975843200*x^4/2560603444425904491 --366516351066952280*x^3/853534481475301497 -+9744574046287884191*x^2/5121206888851808982 --2195146312737884927*x/1707068962950602994 -+95217868391884247/94837164608366833) -/(289270700577459043*x^2/1707068962950602994 --77470520750101481*x/74220389693504478+1); +(.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); -(38471*t^5/300720-692581*t^4/300720+1525837*t^3/100240 --13508819*t^2/300720+8456297*t/150360-30997/1790)/(1-149*t/1253); +(.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, |