Yes, but you will usually get a more accurate numeric answer for a cubic if
you use realroots rather than float/rectform/solve (and faster, if that
matters), which is subject to all sorts of rounding/cancellation errors.
Heck, even evaluating the quadratic formula accurately is not trivial....
(see ftp://reports.stanford.edu/pub/cstr/reports/cs/tr/66/40/CS-TR-66-40.pdfandhttp://www.cs.berkeley.edu/~wkahan/Qdrtcs.pdf)
Getting a symbolic answer and substituting numbers is an excellent solution
in many cases -- e.g. when calculating an integral which has a closed form
-- but for solving polynomials, using the numerical method directly is
generally better (though factoring over the rationals first is a good idea).
-s
On Sun, Oct 13, 2013 at 2:51 PM, John Lapeyre <lapeyre.math122a at gmail.com>wrote:
> You can do this:
>
> (%i2) float(rectform(solve(((40-3*x)*(20-2*x)*x)/2-500)));
> (%o2) [x = 2.220446049250313e-15 %i + 6.234149131052292,
> x = 1.740696735598142 - 1.332267629550188e-15 %i,
> x = 15.3584874666829 - 4.440892098500626e-16 %i]
>
> Sometimes you have to reverse the order of calling
> float() and rectform().
>
> I modified float and wrote chop(), so you can do this:
>
> (%i4) chop(float(solve(((40-3*x)*(20-2*x)*x)/2-500)));
> (%o4) [x = 6.234149131052293, x = 1.740696735598141, x = 15.3584874666829]
>
> --John
>
>
> On 10/13/2013 03:19 PM, Joerg Rauh wrote:
> > ("5.28.0-2","2012-08-27 23:16:48","i686-pc-mingw32","GNU Common Lisp
> (GCL)","GCL 2.6.8")
> >
> > Dear Maxima Supporter,
> > out of wxMaxima 12.04.0 I had Maxima solve for x:
> > ((40-3*x)*(20-2*x)*x)/2-500
> > Here are the results:
> >
> [x=(-(sqrt(3)*%i)/2-1/2)*((250*sqrt(101)*%i)/3^(7/2)+25750/729)^(1/3)+(1300*((sqrt(3)*%i)/2-1/2))/(81*((250*sqrt(101)*%i)/3^(7/2)+25750/729)^(1/3))+70/9,
> >
> x=((sqrt(3)*%i)/2-1/2)*((250*sqrt(101)*%i)/3^(7/2)+25750/729)^(1/3)+(1300*(-(sqrt(3)*%i)/2-1/2))/(81*((250*sqrt(101)*%i)/3^(7/2)+25750/729)^(1/3))+70/9,
> >
> x=((250*sqrt(101)*%i)/3^(7/2)+25750/729)^(1/3)+1300/(81*((250*sqrt(101)*%i)/3^(7/2)+25750/729)^(1/3))
> >
> > It missed the real results: x=1.7407 and x=6.23415, which I found here:
> >
> http://www.wolframalpha.com/input/?i=solve%28%28%2840-3*x%29%2F2%29*%2820-2*x%29*x-500%2Cx%29
> >
> > Is there anything I can do differently to make it find the real
> solutions?
> > Thank you and kind regards
> >
> > Joerg
> >
> >
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>