We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 7 months ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(15)
WolframAlpha 可以接受 TeX 形式的输入。
http://blog.wolframalpha.com/2010/09/30/talk -to-wolframalpha-in-tex/
WolframAlpha can take input in TeX form.
http://blog.wolframalpha.com/2010/09/30/talk-to-wolframalpha-in-tex/
LaTeXCalc 项目就是为了实现这一目标而设计的。 它将读取 TeX 文件并进行计算。 有关更多信息,请查看主页 http://latexcalc.sourceforge.net/
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/
calc 包 允许您在源代码中进行一些计算,但仅限于
\ setcounter
和\addtolength
。 据我所知,这不是你想要的。如果您已经使用sage,那么sagetex 包非常棒(如果没有,那就太过分了)。 它允许您从输入中获得格式良好的输出,如下所示:
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:
正如 Andy 所说,答案是是有一个计算器可以理解大多数 Latex 公式:Emacs。
尝试以下步骤(假设普通 emacs):
因此,使用上面给出的公式中的点:
$\frac{154,7}{25} - (289 - \frac{1337}{42})$
按
Cx * d
来复制下面一行中的公式并进入calc-embedded
模式,该模式应该已经为您激活了 calc 的乳胶变体。 您的缓冲区现在看起来像这样:请注意,分数已经尽可能地转换了。 再次执行相同操作 (
Cx * d
) 并按cf
将小数转换为浮点数,会产生以下缓冲区:我使用了
Cx * d
code> 复制公式,然后进入嵌入模式以获得中间值,但是还有Cx * e
可以避免重复,只需进入当前公式的嵌入模式。如果您有兴趣,您应该真正查看 Emacs Calc 的信息页面 -嵌入模式。 一般来说,Gnu Emaca Calculator 的帮助以及很棒的交互式教程。
As Andy says, the answer is yes there is a calculator that can understand most latex formulas: Emacs.
Try the following steps (assuming vanilla emacs):
So with point in the formula you gave above:
$\frac{154,7}{25} - (289 - \frac{1337}{42})$
press
C-x * d
to duplicate the formula in the line below and entercalc-embedded
mode which should already have activated a latex variant of calc for you. Your buffer now looks like this:Note that the fraction as already been transformed as far as possible. Doing the same again (
C-x * d
) and pressingc f
to convert the fractional into a floating point number yields the following buffer:I used
C-x * d
to duplicate the formula and then enter embedded mode in order to have the intermediate values, however there is alsoC-x * e
which avoids the duplication and simply enters embedded mode for the current formula.If you are interested you should really have a look at the info page for Emacs Calc - Embedded Mode. And in general the help for the Gnu Emaca Calculator together with the awesome interactive tutorial.
我的计算器可以做到这一点。 要获得格式化输出,请双击结果公式并按 ctrl+c 进行复制。
它也可以做相当高级的事情(微分,简单的积分(而不是那么简单的积分)......)。
https://calculator-algebra.org/
计算示例:
https://calculator-algebra.org:8166/#%7B %22当前页%22%3A%22计算器%22%2C%22计算器输入%22%3A%22%5C%5Cfrac%7B1%2B2%7D%7B3%7D%3B%20d%2Fdx(arctan%20(2x%2B3)) %22%2C%22监控%22%3A%22true%22%7D
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/
A sample computation:
https://calculator-algebra.org:8166/#%7B%22currentPage%22%3A%22calculator%22%2C%22calculatorInput%22%3A%22%5C%5Cfrac%7B1%2B2%7D%7B3%7D%3B%20d%2Fdx(arctan%20(2x%2B3))%22%2C%22monitoring%22%3A%22true%22%7D
您可以在(主要是 TeX,带有一些 R)文件上运行名为 Sweave 的 R 函数,该文件可以用 Tex 中的结果替换 R 表达式。
可以在此处找到教程:http://www.scribd.com/doc/6451985/Learning-to-Sweave-in-APA-Style
You can run an R function called Sweave on a (mostly TeX with some R) file that can replace R expressions with their results in Tex.
A tutorial can be found here: http://www.scribd.com/doc/6451985/Learning-to-Sweave-in-APA-Style
有一种方法可以做你想做的事,只是不完全按照你描述的那样。
您可以使用 fp 包 (\usepackage[options]{fp}) 浮点包将执行您想要的任何操作; 解方程、加除法等等。 不幸的是它不会读取 LaTeX 数学,你必须做一些不同的事情,文档非常差,所以我将在这里举一个例子。
例如,如果您想做 (2x3)/5,您可以输入:
FP 命令始终是可见的,只有 FPprint 打印与其关联的结果,这样您的文档就不会混乱,FP 命令可以放置在您希望的任何位置(不是动词) ) 只要它们位于关联的 FPprint 之前。
There is a way to do what you want just not quite how you describe.
You can use the fp package (\usepackage[options]{fp}) the floating point package will do anything you want; solving equations, adding dividing and many more. Unfortunately it will not read the LaTeX math you instead have to do something a little different, the documentation is very poor so I'll give an example here.
for instance if you want to do (2x3)/5 you would type:
the FP commands are always ibvisible, only FPprint prints the result associated with it so your documents will not be messy, FP commands can be placed wherever you wish (not verb) as long as they are before the associated FPprint.
没有,因为这通常是不可能的。
LaTeX 数学模式标记是表示性标记,在某些情况下它无法提供足够的信息来计算表达式。
这是创建 MathML 内容标记的原因之一,也是在 Mathematica 中使用 MathML 的原因之一。 MathML 实际上是两种语言合二为一:
要完成您所追求的目标,您必须拥有具有组合演示和内容标记的 MathML(请参阅 MathML 规范)。
在我看来,最好的选择是使用 MathML(即使它很冗长)并在必要时转换为 LaTeX。 也就是说,我也最喜欢 LaTeX 语法,也许我们需要的是 MathML 的紧凑语法(类似于 RelaxNG 紧凑语法)。
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:
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).
您可以将其粘贴到 symbolab 中,作为奖励,它有免费的分步解决方案。 另外,由于 symbolab 使用 mathquill,它会立即格式化您的乳胶。
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.
考虑到 LaTeX 本身是一种图灵完备的标记语言,我强烈怀疑您是否可以构建类似这样的不直接构建到 LaTeX 中的东西。 此外,LaTeX 数学 matkup 本身几乎没有语义意义,它只是描述视觉外观。
话虽如此,您可能可以将一些东西组合在一起,识别 LaTeX 数学标记的不可编程子集,并以相同的方式输出结果。 如果您感兴趣的只是分数和整数的简单算术(不过要小心小数,因为它们在德语文本中可能显示为
3{,}141...
:))别太难了。 但一旦你从积分、矩阵等开始,我担心 LaTeX 缺乏表达能力来准确描述你的意图。 毕竟,它是一个文档准备系统,因此不太适合作为计算机代数系统的输入。旁注:您可以切换到 Word,它在当前版本中具有一种数学标记语言,该语言与 LaTeX 非常类似(现在它甚至支持 LaTeX 标记),但仍然对 Google 友好,以便更简单条款:
使用免费的 Microsoft Math 插件,您甚至可以让 Word 就地计算表达式:
Considering that LaTeX itself is a Turing-complete markup language I strongly doubt you can build something like this that isn't built directly into LaTeX. Furthermore, LaTeX math matkup itself has next to no semantic meaning, it merely describes the visual appearance.
That being said, you can probably hack together something which recognizes a non-programmable subset of LaTeX math markup and spits out the result in the same way. If all you're interested in is simple arithmetics with fractions and integers (careful with decimal fractions, though, as they may appear as
3{,}141...
in German texts :)) this shouldn't be too hard. But once you start with integrals, matrices, etc. I fear that LaTeX lacks expressiveness to accurately describe your intentions. It is a document preparation system, after all and thus not very suitable as input for computer algebra systems.Side note: You can switch to Word which has—in its current version—a math markup language which is sufficiently LaTeX-like (by now it even supports LaTeX markup) and yet still Google-friendly for simpler terms:
With the free Microsoft Math add-in you can even let Word calculate expressions in-place:
为了在 LaTeX 本身中执行数学运算,您还可以查看 pgfmath 包,它比 calc 包更强大、更方便。 您可以从 TikZ 和 PGF 软件包手册的第六部分了解如何使用它,您可以在这里找到它(当前版本 2.10):http://mirror.unl.edu/ctan/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf
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
Emacs calc-mode 接受乳胶输入。 我每天都用它。 按“d”,然后按“L”进入乳胶输入模式。 按“'”打开一个提示,您可以在其中粘贴文本。
任何说不可能的人都是错误的。
Emacs calc-mode accepts latex-input. I use it daily. Press "d", followed by "L" to enter latex input mode. Press "'" to open a prompt where you can paste your tex.
Anyone saing it is not possible is wrong.
IIRC Mathematica 可以做到。
IIRC Mathematica can do it.
你是对的。 LaTeX 本身并没有提供足够的信息来进行任何计算。而且,它并不代表任何进行计算的信息。 但是没有人阻止以 LaTeX 格式编写包含此类信息的文本。
这是一条困难的道路,因为您需要构建一个规则系统,叠加在 Latex 格式的文本内容需要包含哪些内容,以便您的解释器可以识别。 然后说服用户有必要学习等等等等......
创建逻辑直观的数学表达式计算器的最简单方法。 并且该表达式已经可以转换为latex。 和你说的差不多。 这是在我指出的程序中实现的。 AnEasyCalc 允许您在任何文本编辑器中键入平面文本时键入表达式。 然后它自己检查、计算并生成 LateX 字符串。 它的工作非常简单和快速。 只要尝试一下,您就会看到这一点。
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.
latex2sympy2 Python 库可以解析 LaTeX 数学表达式。
此 Python 3 代码将
9
The latex2sympy2 Python library can parse LaTeX math expressions.
This Python 3 code evaluates
9????/ln(12)+22
(in its LaTeX from above) to 33.37842899841745.The snippet above only handles basic algebraic simplification (math expressions without variables). Since the library converts LaTeX math to SymPy objects, the above code can easily be tweaked and extended to handle much more complicated LaTeX math (including solving derivatives, integrals, etc...).
The latex2sympy2 library can be installed via the pip command:
pip install --user latex2sympy2