Is there a calculator with LaTeX-syntax?

WolframAlpha can take input in TeX form.

http://blog.wolframalpha.com/2010/09/30/talk-to-wolframalpha-in-tex/


The LaTeXCalc project is designed to do just that. It will read a TeX file and do the computations. For more information check out the home page at http://latexcalc.sourceforge.net/


The calc package allows you to do some calculations in source, but only within commands like \setcounter and \addtolength. As far as I can tell, this is not what you want.

If you already use sage, then the sagetex package is pretty awesome (if not, it's overkill). It allows you get nicely formatted output from input like this:

The square of
$\begin{pmatrix}
1 & 2 \\
3 & 4
\end{pmatrix}$
is \sage{matrix([[1, 2], [3,4]])^2}.

The prime factorization of the current page number is \sage{factor(\thepage)}