Looking at your last 2 questions I think you're somewhat in a XY problem.
Write about what you want to typeset, instead of what you want to compute (which you will probably typeset the result anyway.) or restrict the answerer to use a particular programming language.
Consider this question How to add, subtract, multiply, and divide in plain TeX? for example.
In this case, in a similar manner you could write something like the following (I think. My English is not that good)
Currently, I have the following code
\documentclass ...
\begin{document}
...
\def\theequation{sin(x)}
\def\startpoint{1}
which typesets the following
[insert an image here] (recommended!)
It takes 5 iterations for Newton's method to find the root of \theequation\ starting from \startpoint.
Sometimes I have to change the equation sin(x)
or the starting point 1
, and currently I use the following Python/Lua/whatever code
import sympy
sympy.solve(...)
to compute the number of iterations needed (e.g. 5 in this case), and edit the TeX file accordingly.
This is error-prone, how can I improve the process?
The advantages:
- It's very clear it's a question about TeX and typesetting
- It does not restrict answerers from using any particular programming language. They could use expl3 (difficult), Lua, Python, etc.
- They already get an example Python code. So even if they don't know Python they can just show you how to integrate Python into TeX.
Here the assumptions is that you already know how to
- compute the value (not necessarily in TeX)
- typeset the result manually, once you're given the result
If either of the above are not satisfied, first ask a question on how to do that.
Side note, you can optionally "nicely" ask users to keep using Python code because e.g. you're familiar with Python and can easily modify the code later. They aren't required to do that however.