Subject: Maxima asks about sign of integration(!) variable
From: John Lapeyre
Date: Thu, 26 Sep 2013 15:05:38 +0200
I see something similar to what RJF saw with Mathematica:
----
Intel(R) Xeon(R) CPU E31245 @ 3.30GHz
Mathematica 8.0 for Linux x86 (64-bit)
Copyright 1988-2011 Wolfram Research, Inc.
In[1]:= expr = Sqrt[1+(4*x^(1/3)-1/(16*x^(1/3)))^2];
In[2]:= Timing[Integrate[expr,{x,-8,0}]]
3 (129 + (127 I) Sqrt[3])
Out[2]= {50.8352, -------------------------}
16
---
In Maxima:
(%i1) cpow(x,n):=cabs(x)^n*exp(%i*carg(x)*n)$
(%i2) expr2 : sqrt((4*cpow(x,1/3)-1/(16*cpow(x,1/3)))^2+1)$
(%i3) rectform(integrate(expr2,x,-8,0));
Evaluation took 0.0700 seconds (0.0640 elapsed) using 6.432 MB.
(%o3) 127*3^(3/2)*%i/16+387/16
Unfortunately, I still get this:
(%i14) rectform(integrate(expr2,x,-8,512));
(%o14) 97965/8
(at least there are no questions)
The following gives me the answer I want.
(%i18) rectform( integrate(expr2,x,-8,0) + integrate(expr2,x,0,512));
Evaluation took 0.0800 seconds (0.0870 elapsed) using 8.183 MB.
(%o18) 127*3^(3/2)*%i/16+197091/16
Mathematica can do the last example directly, and now it
takes only about 1s instead of 50s.
On 09/26/2013 09:19 AM, Jaime Villate wrote:
> On 26-09-2013 00:44, John Lapeyre wrote:
> > On 09/26/2013 01:33 AM, Richard Fateman wrote:
> > > On 9/25/2013 4:11 PM, Jaime Villate wrote:
> > >> expr : sqrt(1+(4*x^(1/3)-1/16*x^((-1)/3))^2)$
> > >
> > > Mathematica, evaluating expr at -2.0
> > > gives 2.54465 + 4.32153 i
> > >
> > > Maxima gives 5.0892904824535
> >
> > (%i64) float(realpart(expr)),x=-2,numer;
> > (%o64) 2.544645241226752
> > (%i65) float(realpart(expr)),x=-2;
> > (%o65) 5.0892904824535
> > (%i66) float(imagpart(expr)),x=-2;
> > (%o66) 0.0
> > (%i67) float(imagpart(expr)),x=-2,numer;
> > (%o67) 4.321534242730678
> That's one of the problems of ev(...); one can never tell in which
order the evaluation is being made. It is more clear what's going to
happen when you use subst.
> float(subst(x=-2,expr))
>
> Regards,
> Jaime
>