Hello all, and sorry if this question is a beginner’s one.
I do some symbolic computation in a code block using Sympy. And then I output the LateX version of the formula.
I’d like Datalore to display this in Latex. How do I give Datalore a hint about how to interpret the result ?
from sympy import symbols, Function, latex
x, a = symbols(‘x a’)
u = symbols(‘u’, cls=Function)
f = a**(u(x))
In fact, this is a very good question! We do not support LaTeX formulas in the output for code blocks, so I’ll file a feature request and post updates here.
Thanks. It could indeed be useful to nicely show steps in a symbolic computation sequence
Any update on this? I would very much like to be able to use Latex outputs. Thanks!
For me it work.
You just have to disable the “Reactive Mode”, it make sympy bug.
Hmm… It seems as though your output is still unicode rather than LaTeX. LaTeX has a serif font and a slightly different look. If you do a matrix you’ll notice how the brackets (in unicode) look like L’s instead of
[ (LaTex brackets).
I’ve turned off Reactive Mode though, which did help a bit with performance. Also, (and this might be the bug you’ve mentioned), I haven’t been able to output equations by simply writing the variable name in a separate line.
I could also be completely wrong about what I’ve stated here. I’ve recently switched to Kaggle Kernels because of sympy’s inability to use LaTeX, but I would love to come back if it can be showed to display LaTeX Matrices and larger equations.
Thanks for bringing this topic up, we’ve added support for LaTeX outputs that use IPython.display.Math:
So now plain LaTeX is supported in addition to built-in sympy objects already mentioned by @Spationaute
LaTeX outputs are not supported in Datalore View yet, we’ll add it in a few days
Thanks again to everyone involved!
ah I see, I need to use
latex. Thank you!
One extra thing, is it possible to expand the width of the code area in Datalore to the full width of the screen? When I’m working with larger matrices, they overflow off screen and it’s a little annoying to constantly scroll back and fourth to read it.
In fact you don’t, just don’t call
sympy.init_printing and sympy objects will be represented with latex.
It’s not possible at the moment but we’re working on adding custom user settings and it will be there.
Thank you for the feedback!
Interesting… because that’s exactly what I have done, use
init_printing, and I either get unicode output or no output at all (the issue I highlighted in my second to last post). Math and latex works though for some reason, so I know my browser can support LaTeX.
Thanks for your help though!