Maxima asks about sign of integration(!) variable
- Subject: Maxima asks about sign of integration(!) variable
- From: John Lapeyre
- Date: Thu, 26 Sep 2013 01:44:03 +0200
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
-- John
> >
> > I'd still prefer that integrate(expr,x,-8,512) gave the answer
98739/8 (as Macsyma does) because that answer is more consistent with
the assumptions made by other Maxima functions:
> >
> > float(integrate(expr,x,-8,0)+integrate(expr,x,0,512)) --> 12342.375
> >
> > quad_qags(expr,x,-8,512) --->
[12342.37489449745,1.0455241317686159e-4,819,0]
> >
> > romberg(expr,x,-8,512) ---> 12342.59046046695
> >
> > subst(x=-8,expr) ---> 257/32
> >
> > plot2d(expr,[x,-8,512])
> >
> > Regards,
> > Jaime
> >
> > On 25-09-2013 22:45, John Lapeyre wrote:
> >> On 09/25/2013 09:26 PM, Richard Fateman wrote:
> >>
> >> > In Mathematica, the answer came out
> >> > 3/16 (65697 + 127 I Sqrt[3])
> >> > or 12318.2 + 41.2445 I
> >> >
> >> > Doing NIntegrate in Mathematica provided
> >> >
> >> > 12318.1 + 41.2326 I
> >> >
> >>
> >> My nintegrate function, which calls quadpack, seems to agree more
> >> with Mathematica's exact answer than it's numerical answer. I've
> >> seen that more than once.
> >>
> >> (%i5) nintegrate(sqrt(1+(4*x^(1/3)-1/16*x^((-1)/3))^2),[x,-8,512]);
> >>
> >> (%o5)
[41.24445772554166*%i+12318.18747666083,1.5204793641032666e-5,2268,
> >> "no problems"]
> >
>