Skip to content
Draft
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: 30 additions & 2 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, exp
from sympy import Symbol, log, E, Pow, exp, oo

def mmrv(e: S, x: S) -> list[S]:
empty_list : list[S] = []
Expand Down Expand Up @@ -36,11 +36,39 @@ def mmrv(e: S, x: S) -> list[S]:
if exponent.func == log:
list4: list[S] = mmrv(exponent.args[0], x)
return list4
# TODO
li: S = limitinf(exponent, x)
if is_infinite(li):
# TODO
pass
else:
list5: list[S] = mmrv(exponent, x)
return list5
pass
else:
raise

def is_infinite(e: S) -> bool:
if e == oo:
return True
if e == S(-1) * oo:
return True
return False

def limitinf(e: S, x: S) -> S:
if e == x:
return oo
elif e == S(-1) * x:
return S(-1) * oo
elif e.func == Pow:
exponent: S = e.args[1]
# assuming all exponents are integers to start with
if exponent > S(0):
return oo
else:
return S(0)
else:
raise Exception("Not implemented yet.")

def test_mrv():
# Case 1
x: S = Symbol("x")
Expand Down