FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[WIP] Added support for addressing more exp cases by anutosh491 · Pull Request #2685 · lcompilers/lpython · GitHub

Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
32 changes: 30 additions & 2 deletions integration_tests/test_gruntz.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL