0

I am looking for a function which solves trigonometric equation on a given segment.

I've tried fsolve from scipy, but as I understood, there is not such option, just only the initial approximation point.

Does python have such a library method anywhere? Also I've looked at sympy, but did not find any appropriate solutions there.

erip
  • 16,374
  • 11
  • 66
  • 121
Roman Dosaev
  • 53
  • 2
  • 7
  • Possible duplicate: http://stackoverflow.com/questions/30378861/scipy-non-linear-equations-system-with-linear-constraints-beginner – kennytm Apr 14 '17 at 20:12
  • Possible duplicate of [Find a root of a function in a given range](https://stackoverflow.com/questions/43271440/find-a-root-of-a-function-in-a-given-range) – Cleb Sep 23 '18 at 18:55

1 Answers1

0

For a single scalar equation, use brentq

In [1]: from scipy.optimize import brentq

In [2]: import numpy as np

In [3]: brentq(np.sin, np.pi+1, 2*np.pi+1)
Out[3]: 6.28318530718002

For systems of equations, use least_squares to minimize the sum of squares of left hand sides of the equations.

ev-br
  • 24,968
  • 9
  • 65
  • 78