2

My lately asked question (deleted by me) about solving a problem using Newton's Method has been voted for close since it allegedly was not related to the site.

Therefore, can't I ask to solve any math problem using pgf or expl3, for example?

I have already seen many answers about using those as programming tools to solve similar problems but I would like to make sure that such a question is valid to ask or not.

1
  • 1
    Unrelated, but as someone who knows both expl3 and other programming languages, I recommend you to just use something-else instead.
    – user202729
    Jun 5 at 14:07

2 Answers 2

4

Note that most people can not follow the link you gave, you need to be you, or have a high enough rep to see deleted posts.

A question about programming in LaTeX would be clearly on topic, but the way you worded that question, it read as a math/programming question about Netwon's method that had been accidentally posted to this site insead of stackoverflow, and collected close votes for that reason. See the comments from daleif under the question

Wrong site? How is this related to latex and friends?

If it had been worded to make it clear that you had a specific known algorithm but were asking how to program that in tex,then the outcome might have been different.

As always, a complete small test latex example showing how far you had got and showing what tex issue you had faced trying to program that would have improved the question and made the intent clearer.

2
  • Thanks for explaining. Is it ok to write a pseudocode of how it should work since I am unable to propose an approach?
    – Diaa
    Jun 5 at 11:00
  • 1
    @Diaa I can't say what people who voted to close would do, I did not vote here, it was already deleted before I saw it. But in gneral it's always best to try somehing and if you get an error ask why the try is wrong, so you should always have an example tex document. It is same as "draw a picture for me" questions, the advice is not to do that, but sometimes people feel generous and answer them anyway. Jun 5 at 11:10
4

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.

2
  • Another side note, if you can't get a Python code in the first place, ask that on StackOverflow -- but they have very, very strict quality control there.
    – user202729
    Jun 5 at 14:29
  • And there are lots of tolerance for users-who-don't-want-to-learn-programming here, but up to some point the questions will just get unanswered instead.
    – user202729
    Jun 5 at 14:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .