4

I want to transform latex codes into wolfram on android,but I have no idea of how to do it, could anybody here to help me?

Lakeofsigh
  • 41
  • 1
  • 3
  • 1
    I'm guessing you are talking about wolfram alpha, not mathematica. I added the alpha tag, please clarify and delete the mathematica tag if this is the case. (alpha seems to take latex directly, so maybe I'm wrong.. ) – agentp Mar 27 '15 at 14:55
  • Indeed,alpha can calc the latex codes directly,but i am looking for something which can teanslate latex codes into formula that can be understood by a software which has the same syntax like alpha. – Lakeofsigh Mar 28 '15 at 06:37

1 Answers1

4

Use ToExpression

expr = ToExpression["y=\\sin(x)+\\cos(x)", TeXForm]

Mathematica graphics

Now you can use expr inside the notebook

expr /. x -> Pi

Mathematica graphics

Another example

 expr = ToExpression["\\int_a^b \\sin (x) \, dx", TeXForm]

Mathematica graphics

But notice that Mathematica evaluated the TeXForm to Integrate but went ahead and also evaluated the integral.

Nasser
  • 12,849
  • 6
  • 52
  • 104
  • 1
    i think you can add `Hold` as a third arg to prevent the evaluation – agentp Mar 26 '15 at 11:26
  • I appreciate that you answered,but it seems to be my fault not to express the problem clearly.I'm looking for some way to transform the latex type formula into wolfram type formula,I'm not going to evaluate the formula with wolfram.But thank you anyway,and apology for my mistake and poor english. – Lakeofsigh Mar 27 '15 at 08:03
  • 1
    Are you wanting to do the conversion without using mathematica?? Please edit your question to clarify. Provide example input and expected output.. – agentp Mar 27 '15 at 13:35
  • Yes I am trying to use a individual program to finish the job, which is tramsform the latex style codes into wolfram aplha style one. – Lakeofsigh Mar 27 '15 at 16:12