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
LambertW displaying in jupyter lab #21812
Labels
Easy to Fix
This is a good issue for new contributors. Feel free to work on this if no one else has already.
printing.latex
Comments
This can be fixed with something like: diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py
index debc81ca8d..5bf0cff782 100644
--- a/sympy/printing/latex.py
+++ b/sympy/printing/latex.py
@@ -2422,11 +2422,15 @@ def _print_DMF(self, p):
def _print_Object(self, object):
return self._print(Symbol(object.name))
- def _print_LambertW(self, expr):
+ def _print_LambertW(self, expr, exp=None):
+ arg0 = self._print(expr.args[0])
+ exp = r'^{%s}' % (exp,) if exp is not None else ''
if len(expr.args) == 1:
- return r"W\left(%s\right)" % self._print(expr.args[0])
- return r"W_{%s}\left(%s\right)" % \
- (self._print(expr.args[1]), self._print(expr.args[0]))
+ result = r"W%s\left(%s\right)" % (exp, arg0)
+ else:
+ arg1 = self._print(expr.args[1])
+ result = r"W_{%s}%s\left(%s\right)" % (exp, arg0, arg1)
+ return result
def _print_Morphism(self, morphism):
domain = self._print(morphism.domain) |
oscarbenjamin
added
printing.latex
Easy to Fix
This is a good issue for new contributors. Feel free to work on this if no one else has already.
labels
Aug 2, 2021
skirpichev
added a commit
to skirpichev/diofant
that referenced
this issue
Aug 3, 2021
Hi Can I get to solve this problem I am a new contributor. Can you guide me for the same. |
This was referenced Aug 3, 2021
I have made the changes suggested by @oscarbenjamin. Is there anything else that needs to be done? |
Hello @oscarbenjamin could you please review my PR - #21849 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Easy to Fix
This is a good issue for new contributors. Feel free to work on this if no one else has already.
printing.latex
When using JupyterLab and trying to raise LambertW function to some power (for example multiplying with itself) then it raises error when trying to display it. Same thing happens if I use sp.Pow() method as well.
For example sp.Pow(sp.LambertW(2), 2) causes the error as well.
The text was updated successfully, but these errors were encountered: