On Sep 23, 2009, at 6:11 PM, rjf wrote:

> If you want to look at possible definitions of solve that have been
> refined more recently than Maxima's solve, you can look at
> Mathematica's
> Solve, NSolve, RSolve, Reduce, and maybe some others like Eliminate.
>
> Maxima's solve dates to 1971, but there is also linsolve, algsys,
> realroots, and some other programs that you can probably find in the
> documentation ... roots, newton... and there may also be numerical
> rootfinders in the Fortran library.  The decision as to whether
> to_poly_solve does the job for you  (apparently not, at least at the
> moment) or not, is only one aspect.
>
> I am pleased that you consider, at least as an option, augmenting
> Maxima by loading in programs into Maxima written in the Maxima
> language (to_poly_solve).  Maybe someone would define what you want
> Sage's "solve" to do in all cases, and feed the disambiguation
> information to a short Maxima program that then calls solve,
> to_poly_solve, roots, etc etc as
> necessary.  You might even find that your short program would be
> useful to people directly using Maxima.
>
> There is, in my experience, a gap between people who think that all
> roots of a polynomial can be found [by complex rootfinders] and those
> people who want exact algebraic expressions.  Or those who want
> rational isolating intervals for each real root, computed by Sturm
> sequences.
>
> And then there are the people who need to represent infinite sets like
> the roots of sin(x)=0.
>
> The gap between these groups is kind of cognitive.  Like "what do you
> mean you can't find the roots of a quintic because it is unsolvable??
> It has 5 roots!"

Yep, we support various root numerical root finders, linear solvers,  
grobner bases, and symbolic solvers (via Maxima--you're right, we  
should look into exposing and using the various package here). The  
non-symbolic ones are typically orders of magnitude faster, if you're  
in that special case. This is one area where the idea of a domain  
like Sage has is useful.

sage: x = ZZ['x'].gen()
sage: f = x^6 - 2*x^5 - x^2 + x + 2

sage: f.roots(QQ)
[(2, 1)]

sage: f.roots(QQbar)  # these are exact
[(1.167303978261419?, 1), (2, 1), (-0.7648844336005847? -  
0.3524715460317263?*I, 1), (-0.7648844336005847? + 0.3524715460317263? 
*I, 1), (0.1812324444698754? - 1.083954101317711?*I, 1),  
(0.1812324444698754? + 1.083954101317711?*I, 1)]

sage: f.roots(RR)
[(1.16730397826142, 1), (2.00000000000000, 1)]

sage: f.roots(RealField(500))
[(1.16730397826141868425604589985484218072056037152548903914008244927565 
190342952705318068520504972867289535916899524104793645129596750871791336 
957872256,  1),
   
(2.000000000000000000000000000000000000000000000000000000000000000000000 
000000000000000000000000000000000000000000000000000000000000000000000000 
00000000,  1)]

sage: f.roots(CDF)
[(1.16730397826, 1), (2.0, 1), (-0.764884433601 - 0.352471546032*I,  
1), (-0.764884433601 + 0.352471546032*I, 1), (0.18123244447 -  
1.08395410132*I, 1), (0.18123244447 + 1.08395410132*I, 1)]

sage: f.roots(GF(17))
[(8, 1), (6, 1), (2, 1)]

sage: sage: f.roots(Qp(17, 5))
[(8 + 17 + 2*17^2 + 17^3 + 11*17^4 + O(17^5), 1),
  (6 + 17 + 8*17^2 + 14*17^3 + 7*17^4 + O(17^5), 1),
  (2 + O(17^5), 1)]


Alternatively,

sage: x = RR['x'].gen()
sage: f = x^6 - 2*x^5 - x^2 + x + 2
sage: parent(f)
Univariate Polynomial Ring in x over Real Field with 53 bits of  
precision
sage: f.roots()
[(1.16730397826142, 1), (2.00000000000000, 1)]

etc.

- Robert

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to