6

Many times when I am using a symbolic computation tool (like Maple), I want to take the calculation/ and or the results and have them formatted into LaTex.

Is there a specific piece of software that does symbolic computing (Maple, MatLab, Mathematica...) and also allows you to quickly copy your work and paste it as math mode Latex or export a clean LaTex file?

For example I have used the export as latex option in the past for Maple, but it includes a lot of code just to display other elements of the worksheet that I am not interested in. Ideally I would like to avoid reformatting the equations I have written as much as possible.

(Note I have tried MathSage\SageTex and everything it offers but the combination of bugs and limited support outside of Linux makes it a problem to use).

7

2 Answers 2

4

In Mathematica, you can use TeXForm:

In[1]:= TrigExpand[Sin[5 x]] // TeXForm

Out[1]//TeXForm=
\sin ^5(x)+5 \sin (x) \cos ^4(x)-10 \sin ^3(x) \cos ^2(x)

You can also right click and select Copy As -> LaTeX

enter image description here

2

As mentioned in a comment, sympy might be an option, see e.g. the docs: http://docs.sympy.org/dev/modules/printing.html#sympy.printing.latex.latex.

It is a Python package, and part of the SciPy stack. Hence it is also available in Sage MathCloud, and probably the desktop version of Sage Math.

An example from a terminal session:

In [1]: import sympy as sp
   ...: from sympy.printing import latex as spl

In [2]: x = sp.symbols('x')

In [3]: f = (1/sp.cos(x))

In [4]: print(spl(f.series(x,0,6)))
1 + \frac{x^{2}}{2} + \frac{5 x^{4}}{24} + \mathcal{O}\left(x^{6}\right)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .