Convex optimization is a field of mathematical optimization that studies the problem of minimizing convex functions over convex sets.
Convex optimization has applications in a wide range of disciplines, such as automatic control systems, estimation and signal processing, communications and networks, electronic circuit design, data analysis and modeling, finance, statistics, etc.
With recent advancements in computing and optimization algorithms, convex programming is nearly as straightforward as linear programming.
In finance and economics, convex optimization plays an important role. Examples are the calibration of option pricing models to market data or the optimization of an agent’s utility.
Previously, we wrote about Monte Carlo Simulation and if you haven’t read yet, we strongly suggest you do so.
In today’s finance with Python article, we are going to show you how to optimize a function using Global and Local optimization.
Convex optimization functions using Python programming language
Above is our starting example. This example is inspired by the book Python for Finance: Analyze Big Financial Data:
We modified it and translated it to Python 3, since it is written in Python 2, and the code was not quite working, so we’ve had to fix tons of stuff, but what you see here works 100%.
The result of the code above is in Figure 1.
From Figure 1 we can see that the function already has multiple local minima, but the global minima cannot be confirmed from the visualization we’ve got.
Local Optimization
This is the code we’ve implemented to find the local minimum on the whole of the interval, which is the lowest minimum of them all.
Conclusion
Convex optimization is very important to be understood by every engineer since it’s a base for some more complicated and effective optimization problems. It has a lot of algorithms that you might find helpful so you can search for them and try to implement them.
We are advocates for FREE education for everyone. If you like that idea check out our articles about:
- FREE Computer Science Curriculum From The Best Universities and Companies In The World
- How To Become a Certified Data Scientist at Harvard University for FREE
- How to Gain a Computer Science Education from MIT University for FREE
- Top 10 Best FREE Artificial Intelligence Courses from Harvard, MIT, and Stanford
- Top 10 Best Artificial Intelligence YouTube Channels in 2020
Like with every post we do, we encourage you to continue learning, trying and creating.