On Dec 11, 2007 7:06 PM, Kirill Smelkov <[EMAIL PROTECTED]> wrote: > > Suresh, > > On Tue, Dec 11, 2007 at 09:47:58AM -0800, Suresh Jeevanandam wrote: > > > > Dear all, > > > > Let's say I have an expression: > > 1/(a+b) > > > > I want to be able to simplify this to 1/a if we know that a is much, > > much greater than b. Is there a way to achieve this already in sympy. > > If not, I think this would be a nice feature for engineering people > > who would always be making some approximations and get intuitions from > > the simplified expressions :) > > An example related to your question: > > In [2]: e = 1/(x+y) > > In [3]: e > Out[3]: > 1 > ----- > x + y > > In [4]: e.series(y, 1) > Out[4]: > 1 > - + O(y) > x > > > You can do it more carefully: > > if y << x <==> t = y/x << 1, so > > In [5]: t = Symbol('t') > > In [6]: et = e.subs(y, t*x) > > In [7]: et > Out[7]: > 1 > ------- > x + t*x > > In [8]: ets = et.series(t, 1) > > In [9]: ets > Out[9]: > 1 > - + O(t) > x > > In [10]: ets.subs(t, y/x) > Out[10]: > 1 > - + O(y/x, x, y) > x > > > Is that what you need?
Thanks Kirill, yes, that's the way to do it. And then, when assumptions are implemented, we could just call a simple function to simplify: > 1 > - + O(y/x, x, y) > x to > 1 > - > x Ondrej --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---