Skip to content
Advertisement

How to find the global minima from a matplotlib graph?

JavaScript

I have two arrays x and y. Here I’ve plotted them using Matplotlib and found the global minima using this simple logic. Here is the output that I’m getting:

Output

After that I’ve smoothen the graph BSpline

JavaScript

Output

Now my position of the global minima has changed and that simple logic will not work here. I want to know how I can find the global minima from a graph in this case

Advertisement

Answer

Use numpy.argmin on power_smooth:

JavaScript

Output:

enter image description here

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement