I am having trouble understanding how to add inequality equation to fsolve function.
for example:
This are the packages:
import numpy as np
from scipy.optimize import fsolve
These is the equations I want to use:
x1 >= 0.4 and x1 <= 0.7
x2 >= 0.2 and x2 <= 0.4
5x2**2 + 2x1**3 = 2
and this is the function I am trying to create:
myFunc(z):
x1 = z[0]
x2 = z[1]
F = np.empty((3))
F[0] = x1 >= 0.4 and x1 <= 0.7 # <-- This is the first equation
F[1] = x2 >= 0.2 and x2 <= 0.4 # <-- this is the second equation
F[2] = 5x2**2 + 2x1**3 = 2 # <-- this is the third equation
return F
and then we call the fsolve:
zGuess = np.array([0.3,0.3])
z = fsolve(myFunction,zGuess)
print(z)
Any ideas on how to set inequality equations?