Is there a calculator with LaTeX-syntax?

前端 未结 17 1969
北海茫月
北海茫月 2020-12-12 17: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

相关标签:
17条回答
  • 2020-12-12 17:48

    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)}
    
    0 讨论(0)
  • 2020-12-12 17:50

    IIRC Mathematica can do it.

    0 讨论(0)
  • 2020-12-12 17:55

    My calculator can do that. To get the formatted output, double-click the result formula and press ctrl+c to copy it.

    It can do fairly advanced stuff too (differentiation, easy integrals (and not that easy ones)...).

    https://calculator-algebra.org/cgi-bin/calculator?request=calculator&mainInput=%5cfrac%7b1%2b2%7d%7b3%7d%3b%0ad%2fdx%28arctan%20%282x%2b3%29%29

    0 讨论(0)
  • 2020-12-12 17: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

    0 讨论(0)
  • 2020-12-12 17:56

    WolframAlpha can take input in TeX form.

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

    0 讨论(0)
  • 2020-12-12 17:56

    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.

    You are right. LaTeX as it is does not provide enough info to make any calculations.Moreover, it does not represent any information to do it. But nobody prevents to wright in LaTeX format a text that contains such an information. It is a difficult path, because you need to build a system of rules superimposed on what content ofthe text in Latex format needs to contain that it would be recognizable by your interpreter. And then convince the user that it is necessary to learn, etc. etc... The easiest way to create a logical and intuitive calculator of mathematical expressions. And the expression is already possible to convert latex. It's almost like what you said. This is implemented in the program which I have pointed to. AnEasyCalc allows to type an expression as you type the plane text in any text editor. It checks, calculates and generate LateX string by its own then. Its very easy and rapid work. Just try and you will see that.

    0 讨论(0)
提交回复
热议问题