Skip to content

Updated test_gruntz.py #2656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions integration_tests/test_gruntz.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from lpython import S
from sympy import Symbol, log, E, Pow
from sympy import Symbol, log, E, Pow, exp

def mmrv(e: S, x: S) -> list[S]:
empty_list : list[S] = []
Expand All @@ -13,22 +13,29 @@ def mmrv(e: S, x: S) -> list[S]:
list2: list[S] = mmrv(arg0, x)
return list2
elif e.func == Pow:
if e.args[0] != E:
e1: S = S(1)
base: S = e.args[0]
exponent: S = e.args[1]
one: S = S(1)
if base != E:
newe_exponent: S = S(1)
newe: S = e
while newe.func == Pow:
b1: S = newe.args[0]
e1 = e1 * newe.args[1]
newe = b1
if b1 == S(1):
newe_base: S = newe.args[0]
newe_args1: S = newe.args[1]
newe_exponent = newe_exponent * newe_args1
newe = newe_base
if newe_base == one:
return empty_list
if not e1.has(x):
list3: list[S] = mmrv(b1, x)
if not newe_exponent.has(x):
list3: list[S] = mmrv(newe_base, x)
return list3
else:
# TODO as noted in #2526
pass
else:
if exponent.func == log:
list4: list[S] = mmrv(exponent.args[0], x)
return list4
# TODO
pass
else:
Expand Down Expand Up @@ -63,4 +70,11 @@ def test_mrv():
assert ele3 == x
assert len(ans4) == 1

# Case 5
ans5: list[S] = mmrv(exp(log(x)), x)
ele4: S = ans5[0]
print(ele4)
assert ele4 == x
assert len(ans5) == 1

test_mrv()