On Mon, 24 May 2010 16:47:04 +0800, Leo Butler <l.butler at ed.ac.uk> wrote:
>
>
> On Mon, 24 May 2010, James Limbouris wrote:
>
> < On Mon, 24 May 2010 15:28:23 +0800, Leo Butler <l.butler at ed.ac.uk> wrote:
> < >
>< Here is a example from the problem I'm currently working on. I apologize for
> < the length
> < of the function, but it is difficult to imagine a simple one that will fail to
> < evaluate.
> <
> < f(nr, ni) :=
> < %i*((((%e^(-12.56637061435917*ni)*(-0.23518915858261*(nr^6-15*ni^2*nr^4+15*ni^4*nr^2-ni^6)-0.86386844040539*(6*ni*nr^5-20*ni^3*nr^3+6*ni^5*nr)-2.217486114751758*
> < < snip >
> < 1.841137478185708*(4*ni*nr^3-4*ni^3*nr)+64.83122366729704*(nr^3-3*ni^2*nr)+1.615197025742226*(3*ni*nr^2-ni^3)+72.8605673885606*(nr^2-ni^2)+13.8755315023416*ni*nr+
> < 42.81053745639266*nr+6.616193944347959*ni+10.26849837929581)^(2))^(2))
> <
> < For the gory details see the attached .wxm file. Essentially, it is a nasty
> < long mixture of polynomials, rationals and exponentials.
> < I do not suspect it of being too numerically ill-conditioned to evaluate, and
> < either of the following:
> <
> < f(2, 1);
> < f(nr, ni), nr=2, ni=1, numer, keepfloat;
> <
> < will return a complex number instantly. Now lets try to get the modulus of
> < this complex number:
> <
> < abs(f(2, 1))
> < abs(f(2, 1)), numer;
> < abs(f(nr, ni)), nr=2, ni=1, numer;
> <
> < all return instantly, while abs(f(nr, ni)) crashes with an out of memory
> < error, after several minutes.
> < Now the problem is,
> <
> < wxplot3d(f(nr, ni), [nr, 1, 2], [ni, 1, 2])
> <
> < will produce a plot, but
> <
> < wxplot3d(abs(f(nr, ni)), [nr, 1, 2], [ni, 1, 2]), numer;
> <
> < or
> <
> < wxplot3d('abs(f(nr, ni)), [nr, 1, 2], [ni, 1, 2]), numer;
> <
>
> Does
>
> plot3d(lambda([nr,ni], abs(f(nr, ni))), [nr, 1, 2], [ni, 1, 2]);
>
> work for you? I think the point is that you want to avoid any
> simplification until you've actually substituted in values
> for your arguments. Using a lambda function ought to do the
> trick (on v5.21.1 at least).
>
> Leo
>
On my machine I get:
Maxima encountered a Lisp error:
Error in LET* [or a callee]: The storage for LONG-FLOAT is exhausted.
Currently, 8027 pages are allocated.
Use ALLOCATE to expand the space.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
after about 2 minutes, with wxMaxima 0.8.5 and Maxima 5.21.1.
The machine has a good deal of RAM, so I'm assuming that's not a problem.
I also tried the same lambda line with abs and f quoted, but no luck yet.
James