I am novice to Mathematica. I want to convert Mathematica code from my textbook to Java or Python to trace coding.
1 Answer
I am not exactly sure what you mean by "trace coding", but in general, the Mathematica evalution methods are very complicated, and could be documented better. Again, in general, in any computer language, I suggest breaking code into smaller pieces and placing frequent output statements to see what the results of evaluations are. There is a Trace[]
command but it produces volumnious and confusing output. Most Mathematica commands are higher level than those in other languages that you mentioned. Depending on the particular Mathematica code, if it is simple enough, it may be possible to "transliterate" it into another langauges. In any case, you need to read the documentation for the Mathematica commands you will be using. The FullForm[]
and TreeForm[]
commands will help you to see what the Mathematics expressions you are using really look like.
-
2$\begingroup$ There is also actually a debugger inside the notebook. I remember reading a post here where one person actually managed to figure how to use i! I never figured how to use the Mathematica debugger myself, but in theory it is supposed to be an actual working debugger. For debugging I use Print statements and use a global flag to turn them off and on as needed. $\endgroup$– NasserCommented Jan 16, 2019 at 16:25
DSolve[]
to Java? Or how will you convertIntegrate
orSimplify
and the thousands of commands in Mathematica to Java? If the code contains no calls to Mathematica special build-in commands such as the above, but contains only basic commands, such asTable
,Print
,If
etc..., then it can be possible to convert manually. $\endgroup$