Thanks very much for the example. I wasn't aware of the removeO() method. 

On Tuesday, August 18, 2020 at 5:21:04 PM UTC-4 [email protected] wrote:

> If I understand the references correctly, you'd want to replace
> instances of a and b in the expression with b/a, replace that with a
> single variable like x, then do a series expansion and remove higher
> order x terms. There isn't anything in SymPy that automates this in
> one step but you can get a lot of it automatically with subs() and
> series(). The hard part is that in some of the examples you may have
> to perform this on subexpressions rather than the whole expression.
>
> For example, one of the examples you linked to is 1/(b*(b + a)) =
> 1/(b*a) if a >> b.
>
> >>> expr = 1/(b*(a + b))
> >>> # Set x = b/a
> >>> expr.subs(a, b/x).cancel()
> x/(b**2*x + b**2)
> >>> # Expand as a series up to O(x**2)
> >>> expr.subs(a, b/x).cancel().series(x, n=2)
> x/b**2 + O(x**2)
> >>> # Remove the O() term and substitute back
> >>> expr.subs(a, b/x).cancel().series(x, n=2).removeO().subs(x, b/a)
> 1/(a*b)
>
> Aaron Meurer
>
> On Sat, Aug 15, 2020 at 2:07 PM Ben <[email protected]> wrote:
> >
> > Hello,
> >
> > I'm attempting to translate Latex into SymPy and am seeking guidance on 
> how to handle the notation of "much greater than."
> >
> > For example, "a + b = c" is replaced by "a = c" under the condition "b 
> << a". How would that be represented in Sympy?
> >
> > I like the explanation of ">>" provided in this StackOverflow answer, so 
> there is some deeper meaning to the notation. However, that doesn't 
> indicate what the appropriate representation in SymPy would be.
> >
> > For comparison with other Computer Algebra Systems, I'm not able to find 
> the concept in Sage documentation. I did find this post on Mathematica.
> >
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "sympy" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to [email protected].
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/446b0334-0fc0-48ad-802a-3ac7e3225667n%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/db34ee08-0bb2-4e7a-a658-5a079d16c88bn%40googlegroups.com.

Reply via email to