On May 18, 2:26 pm, Fabian Pedregosa <fab...@fseoane.net> wrote:
> Ondrej Certik wrote:
[...]
> > So here are some particular examples using sympy syntax:
>
> >>>> solve(Eq(x**2, 1), x)
> > [{x: 1}, {x: -1}]
>
> don't see the benefit over [1,-1]. It is clear that it is relative to x
> since you passed that argument to solve. Plus, it would make it harder
> to iterate over the solutions.
>
> In my oppinion it adds an unnecessary layer of complexity, but I'd love
> to see some examples where this results code shorted/more readable.

I think it is only necessary for multidimensional equations involving
several variables.

>
> > More tricky is if solve() can't do it, either because sympy can't do
> > it, or because it's algebraically not possible. Mathematica returns an
> > instance of a Solve() class (talking in sympy language) Like:
>
> >>>> solve(Eq(sin(x)+x, 0), x)
> > Solve(Eq(sin(x)+x), x)
>
> Seems to me a good idea
>
> > and it also prints bunch of warnings (that can be suppressed), like:
>
> > Solve::tdep: The equations appear to involve the variables to be solved for 
> > in
> >     an essentially non-algebraic way.
>
> > But both me and Aaron like what Maple is doing:
>
> >>>> solve(Eq(sin(x)+x, 0), x)
> > [RootOf(Eq(sin(x)+x), x, 1)]
>
> > At least sometimes you know the number of roots (one in the case
> > above), so that's why the "1" above. I am not sure currently if even
> > the number of roots is unknown. Then I think it should return:
>
> >>>> solve(Eq(sin(x)+x, 0), x)
> > RootsOf(Eq(sin(x)+x), x)
>
> > which could behave like a dictionary. These RootOf and RootsOf classes
> > can have some features, e.g. sometimes you know how to do some
> > operation on the root (like squaring it), even without having an
> > explicit formula for it.

I really like RootOf(), it allows mixing algebraic and numerical
solutions, like

>>> solve((cos(x)+x)*x, x)
[RootOf(cos(x)+x,x), 0]
>>> _.evalf()
[-0.7390851332151542, 0]

It would be also more consistent with integrate() which returns an
Integral() instead of raising a NotImplementedError.

I'd be glad to have this in sympy! It would be much easier to fall
back to numerical methods.

Vinzent
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to