# How to perform calculations(Not just display) [closed]

I have almost zero knowledge of TEX.
I want an easy way to take common algorithms and use them to calculate values.
This would ideally be done in the browser, but if not appropriate I could run on a server and connect through a web API.
I have found that Wikipedia offers many algorithms with markup written in TEX-like code.
Searching about this returns a variety of different posts that seem unrelated and are difficult for someone with little knowledge to understand.

If, for example I take the algorithm from Wikipedia with code below, how could I calculate the answer of Cx with required parameters?

https://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon

C_{\mathrm {x} }={\frac {1}{6A}}\sum _{i=0}^{n-1}(x_{i}+x_{i+1})(x_{i}\
y_{i+1}-x_{i+1}\ y_{i})

• Sorry, but TeX is not the tool you are looking for. – Johannes_B Apr 26 '18 at 5:09
• @Johannes_B Thanks. TeX may not be the tool I am looking for, but the source is TeX so it is what I had to start searching from. I am assuming that because such an important site like Wikipedia uses it for its algorithms, that there would be a good chance this has already been solved by somebody. – Damien Golding Apr 26 '18 at 5:11
• TeX is purely used to make the equations look good. There are no calculations. – Johannes_B Apr 26 '18 at 5:12
• This seems to be off topic for the site for two reasons: TeX code on web pages is not actual LaTeX but an approximation called MathJax (or similar). Secondly, the rendering of equations has very little to do with implementing the equation in code (which would certainly not be TeX code.) – Alan Munn Apr 26 '18 at 5:14
• It's not exactly MathJax, but something similar (definitely not a full TeX system), see en.wikipedia.org/wiki/Help:Displaying_a_formula (and the extension site). Why should there be no way to convert it to another language? It's just very difficult, because the syntax does contain stylistic commands apart from operators etc, which have no influence on the computation result. But you could try to find or implement a converter. – TeXnician Apr 26 '18 at 5:29

• I realize now that my well-intentioned comments have been utterly worthless to you; I've deleted them all. To address your latest comments directly: TeX's and LaTeX's math-typesetting directives -- such as \int, \sum, \frac and \prod -- were designed to handle typesetting jobs. They were never meant to do anything else, such as constitute the basis for performing actual calculations. I don't understand why you insist on thîs not being the case. – Mico Apr 26 '18 at 13:12