KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Assume the following function: f(x) = x * cos(x-4) With x = [-2.5, 2.5] this function crosses 0 at f(0) = 0 and f(-0.71238898) = 0 . This was determined with the following code: import math from scipy.optimize import fsolve def func(x): return x*math.cos(x-4) x0 = fsolve(func, 0.0) # returns [0.] x0 = fsolve(func, -0.75) # returns [-0.71238898] What is the proper way to use fzero (or any other Python root finder) to find both roots in one call? Is there a different scipy function that does this? fzero reference
Tags (comma-separated)
Save Edits
Cancel