Skip to content

Commit

Permalink
+1
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Mar 3, 2023
1 parent 983faf8 commit c15da5e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions diofant/calculus/order.py
Expand Up @@ -114,22 +114,18 @@ def __new__(cls, expr, var=None, point=0, **kwargs):

expr = expr.subs(s)

if expr.is_Add:
from ..core import expand_multinomial
expr = expand_multinomial(expr)

if s:
new_var = tuple(rs)[0]
x = tuple(rs)[0]
else:
new_var = var
x = var

if expr.is_Add:
lst = expr.extract_leading_order([new_var])
lst = expr.extract_leading_order([x])
expr = Add(*[f.expr for (e, f) in lst])

elif expr:
expr = expr.as_leading_term(new_var)
expr = expr.as_independent(new_var, as_Add=False)[1]
expr = expr.as_leading_term(x)
_, expr = expr.as_independent(x, as_Add=False)

expr = expand_power_base(expr)
expr = expand_log(expr)
Expand All @@ -139,7 +135,6 @@ def __new__(cls, expr, var=None, point=0, **kwargs):
# combine some power exponents (only "on top" of the
# expression tree for f(x)), e.g.:
# x**p * (-x)**q -> x**(p+q) for real p, q.
x = new_var
margs = list(Mul.make_args(expr.as_independent(x, as_Add=False)[1]))

for i, t in enumerate(margs):
Expand Down

0 comments on commit c15da5e

Please sign in to comment.