There is no function to find all 3 solutions. It would be good to have one. In general it can be hard even to know how many solutions there are from a pure numerical algorithm but I think that something based on interval-Newton would be useful:
https://en.wikipedia.org/wiki/Newton%27s_method#Interval_Newton's_method https://en.wikipedia.org/wiki/Interval_arithmetic#Interval_Newton_method On Sat, 21 Dec 2019 at 08:17, Philipp Gressly Freimann <[email protected]> wrote: > > Hello > > Well, thanks a lot. Works great. I did not know the "nsolve" command. > > If I am right, there is no command to find all three solutions? > > φ > > Am Freitag, 20. Dezember 2019 11:48:03 UTC+1 schrieb Oscar: >> >> You can use nsolve to find numerical solutions: >> ``` >> In [10]: nsolve(Eq(sin(x), 0.5*x + 0.2), x, 0) >> Out[10]: 0.425436108484597 >> ``` >> This will find one root at a time starting from an initial guess (I've >> used zero). >> >> Initial guesses -1 and +1 give two other roots. >> ``` >> In [11]: nsolve(Eq(sin(x), 0.5*x + 0.2), x, -1) >> Out[11]: -2.11307244875263 >> >> In [12]: nsolve(Eq(sin(x), 0.5*x + 0.2), x, +1) >> Out[12]: 1.59919364642736 >> ``` >> >> You can get more precise solutions using prec: >> ``` >> In [15]: nsolve(Eq(sin(x), 0.5*x + 0.2), x, 0, prec=50) >> Out[15]: 0.42543610848459725447179186114511470949330179080539 >> ``` >> >> -- >> Oscar >> >> On Fri, 20 Dec 2019 at 10:26, Philipp Gressly Freimann >> <[email protected]> wrote: >> > >> > Hello >> > >> > I want to solve the following equation numerically between -PI and PI: >> > >> > sin(x) = 0.5x + 0.2 >> > >> > [which is similar to sin(x) - 0.5x - 0.2 = 0] >> > >> > The graph shows me three solutions. Is there a possibility to solve this >> > equation numerically using sympy? >> > >> > Thanks in advance >> > >> > φ >> > >> > -- >> > 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/abc402b1-ac1a-4508-95a8-c13a48483654%40googlegroups.com. > > -- > 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/711fb61d-5b02-4776-a93e-7cd72dec93c5%40googlegroups.com. -- 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/CAHVvXxQdJAEh6z4AbMuN69O575t-%2Btr5K_44P4Re2gKOkFkfTw%40mail.gmail.com.
