On Tue, 30 Nov 2021 at 02:37, Jeremy Monat <[email protected]> wrote:
>
> Improve the tutorial solvers page's order by first explaining how to solve 
> equations and inequalities, particularly explaining the strengths of 
> different solvers, when to use each, and giving examples of each (as 
> suggested by Oscar)

The number one question that comes up on StackOverflow over and over
again is basically "solve doesn't work for my transcendental equation"
to which the answer is "use nsolve" e.g.:
https://stackoverflow.com/questions/70157801/using-sympy-to-solve-equation/70158503?noredirect=1#comment124022352_70158503

The docs should make it clear that:

1. Closed form solutions to equations are only available in simple
cases or otherwise when you are lucky in some way. This is firstly a
mathematical limitation rather than a limitation of SymPy itself.
2. The nsolve function can find numeric solutions using either bisect
or something like the Newton method if the equation has no symbolic
parameters.
3. For polynomial equations without symbolic parameters the nroots
function can find all roots numerically.
4. Otherwise for arbitrary nonlinear equations with symbolic
parameters the problem as posed may be impossible.

> Add an example to solveset() on how to solve a set of equations or 
> inequalities in a single variable (if it does--the documentation is ambiguous 
> on whether this is even possible)
> Add an example to solve() on how to solve a set of equations or inequalities, 
> in a single variable, then in multiple variables (if possible)


The solveset function is for univariate equations and inequalities.
For a system of equations you should use solve, linsolve or
nonlinsolve. There isn't a solver for systems of inequalities (yet):
https://github.com/sympy/sympy/pull/22389
https://github.com/sympy/sympy/pull/21687

> Add a guide on how to programmatically parse solved equations and 
> inequalities (atoms, canonical, etc.)
> Add a guide on how to programmatically parse expressions (args, other?)

Yes, this is a good idea. There should be something that discusses the
different options here. For solve it is best to use dict=True if you
want to programmatically parse the results. For solveset it is
difficult to do anything with the output but there is a function
solvify that tries to make the output more like solve:
https://docs.sympy.org/latest/modules/solvers/solveset.html#sympy.solvers.solveset.solvify

> At the top of each of the low-level solvers pages, put a note that you 
> probably want to use a high-level solver instead--I reached the inequalities 
> solvers page via a web search, and thought I had to use it instead of solve
> Use simpler math for examples, or at least the first example for a function. 
> For example, that page on solving inequalities has as its first example the 
> following. I didn't know what the Poly function was (plus I couldn't find 
> documentation for it), so I couldn't understand the solver.
>
> solve_rational_inequalities([[ ((Poly(-x + 1), Poly(1, x)), '>='),
> ((Poly(-x + 1), Poly(1, x)), '<=')]])
> {1}
>
> The overall theme of 1-3 is "here's how to do things using easy-to-understand 
> math" so maybe they'd be best in the tutorial rather than as reference pages.

These all seem like good ideas.

Oscar

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxR8kwkdeezusWthsp%2BQWeYpGUMG539pCsuVK9iKOCEUAQ%40mail.gmail.com.

Reply via email to