Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 1431 by smichr: ratsimp improvement
http://code.google.com/p/sympy/issues/detail?id=1431

A recent post about simplifications made me wonder if something might be
done to make ratsimp a little better at simlification. Here's an example

>>> eq=(F1 + Gc*x1 + Gc*xd + k*x1)/(Gc + k)

Subtracting x1 and simplifying should show that some terms disappear,

>>> eq-x1
-x1 + (F1 + Gc*x1 + Gc*xd + k*x1)/(Gc + k)
>>> ratsimp(_)
(F1 + Gc*x1 + Gc*xd + k*x1 - x1*(Gc + k))/(Gc + k)


Exapanding the numerator can show that the terms get knocked out, but if
something like the definition below could get automatically added to
ratsimp, that might be desirable.

>>> def as_fraction(eq):

...     n,d=eq.as_numer_denom()
...     q,r=div(n,d,Symbols(eq))
...     return (q*d+r)/d
...
>>> as_fraction(eq-x1)
(F1 + Gc*xd)/(Gc + k)


This, btw, is the result that Maxima gives when ratsimp'lifying this
expression. How that is implemented. Implementing it as above is
destructive to existing structure. Given a/b-c it would perhaps be better
to look through the terms of a for a term that would give b*c and eliminate
it there without having to expand everything in a.

/c

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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-issues?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to