Equation 9-2. Expected utility maximizing problem
Putting in all numerical assumptions, we get the problem in Equation 9-3. Note that we
also change to the minimization of the negative expected utility.
Equation 9-3. Expected utility maximizing problem
To solve this problem, we use the scipy.optimize.minimize function. This function
takes as input — in addition to the function to be minimized — equations and inequalities
(as a list of dict objects) as well as boundaries for the parameters (as a tuple of tuple
objects).
[ 34 ]
We can translate the problem from Equation 9-3 into the following code:
In [ 65 ]: # function to be minimized
from math import sqrt