On Aug 5, 9:29 pm, Vinzent Steinberg
<[email protected]> wrote:
> On Aug 2, 12:14 am, smichr <[email protected]> wrote:
>
> > >>> num,den = (1/(.001+a)**3-6/(.9-a)**3).as_numer_denom()
> > >>> nsolve(num,a,.3) # no need for sympy now
>
> Maybe solve()/nsolve() should do this for you. What do you think?
>
> Vinzent
I was thinking the same thing, but you would have to watch out that
you didn't introduce spurious roots: e.g.
>>> (x/(x-1)).diff(x)
-1/(1 - x) - x/(1 - x)**2
>>> n,d=_.as_numer_denom();n/d
(-x*(1 - x) - (1 - x)**2)/(1 - x)**3
Unless we cancel out the common factors (something that isn't working
in general yet but will hopefully work with the new polys module) we
will get a root of x=1. I was also wondering if the routine shouldn't
try to solve the expression symbolically to see if it's possible
before trying to solve it numerically...or should sympy just trust the
user and not waste the time checking symbolic solutions if a numeric
solution has been requested?
/c
/c
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---