Feature request



That worked!  Diff(f(rat(x),rat(y), y) in seconds.  I just don't have a clue about Maxima.  I don't care anymore about the order of the formula output, I am suppressing it with $.  I just want to go back to the application, which was to find a series solution to the x^4 Quantum Mechanical potential. 

Here is what worked in about 4 seconds.

f(x,y):=
block
(
    c[-2]:0,c[-1]:0,c[0]:1,c[1]:0,
    for i: 2 thru 500 do (c[i]:(2*c[i-2]-y*3*c[i-4])/i),
    p:c[0],
    for i: 1 thru 500 do (p:p+c[i]*x^i),
    p
)$

expr:diff(f(rat(x),rat(y)),y)$

bfloat((f(rat(1), rat(2.0001))-f(rat(1), rat(2)))/.0001);
-4.54926427472924b-1

bfloat(ev(expr, x=rat(1),y=rat(2)));
-4.548979947844751b-1
Rich 



------------Original Message------------
From: "Stavros Macrakis" <macrakis at alum.mit.edu>
To: "Richard Hennessy" <rvh2007 at comcast.net>
Cc: "Harald Geyer" <harald at lefant.net>, "Maxima List" <maxima at math.utexas.edu>
Date: Mon, Apr-21-2008 1:44 PM
Subject: Re: [Maxima] Feature request
On Mon, Apr 21, 2008 at 12:58 PM, Richard Hennessy <rvh2007 at comcast.net> wrote:

I wanted something like this so thanks.  The only thing is the degree of the polynomials.  I used the quadratic case as an example but really the reason I asked about this is that I have a power series in x and y and I needed to keep a lot of terms for accuracy.  In one case to get sufficient accuracy I used 500 terms.


For speed of calculation of your f(x,y), you should surely be using the canonical rational expression (CRE) representation, either as general rational functions (rat) or as truncated power series (taylor).  Your calculations will be radically faster because intermediate results will be kept in canonical form.

Try f(rat(x),rat(y)), for example.

After you are done with the calculation, you can choose to display in a variety of ways.  The standard way of displaying CREs is as a polynomial of polynomials, e.g. (y^2+1)*x^2 + (y^3+y)*x + y - 3, but using the flags psexpand and ratexpand you can display other forms.

          -s