Is there a calculator with LaTeX-syntax?

2019-01-21 09:00发布

When I write math in LaTeX I often need to perform simple arithmetic on numbers in my LaTeX source, like 515.1544 + 454 = ???.

I usually copy-paste the LaTeX code into Google to get the result, but I still have to manually change the syntax, e.g.

\frac{154,7}{25} - (289 - \frac{1337}{42})

must be changed to

154,7/25 - (289 - 1337/42)

It seems trivial to write a program to do this for the most commonly used operations. Is there a calculator which understand this syntax?

EDIT: I know that doing this perfectly is impossible (because of the halting problem). Doing it for the simple cases I need is trivial. \frac, \cdot, \sqrt and a few other tags would do the trick. The program could just return an error for cases it does not understand.

17条回答
放荡不羁爱自由
2楼-- · 2019-01-21 09:54

You could just paste it into symbolab which as a bonus has free step by step solutions. Also since symbolab uses mathquill it instantly formats your latex.

查看更多
迷人小祖宗
3楼-- · 2019-01-21 09:54

There is none, because it is generally not possible.

LaTeX math mode markup is presentational markup and there are cases in which it does not provide enough information to calculate the expression.

That was one of the reasons MathML content markup was created and also why MathML is used in Mathematica. MathML actually is sort of two languages in one:

  • presentation markup
  • content markup

To accomplish what you are after you'll have to have MathML with comibned presentation and content markup (see MathML spec).

In my opinion your best bet is to use MathML (even if it is verbose) and convert to LaTeX when necessary. That said, I also like LaTeX syntax best and maybe what we need is a compact syntax for MathML (something similar in spirit to RelaxNG compact syntax).

查看更多
狗以群分
4楼-- · 2019-01-21 09:55

For performing the math within your LaTeX itself, you might also look into the pgfmath package, which is more powerful and convenient than the calc package. You can find out how to use it from Part VI of The TikZ and PGF Packages Manual, which you can find here (version 2.10 currently): http://mirror.unl.edu/ctan/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf

查看更多
时光不老,我们不散
5楼-- · 2019-01-21 09:56

IIRC Mathematica can do it.

查看更多
仙女界的扛把子
6楼-- · 2019-01-21 09:58

<> try the AnEasyCalc program. It allows to get the latex formula very easy: http://steamandwater.od.ua/AnEasyCalc/ :)

查看更多
登录 后发表回答