I am using gekko to (try) to solve a system of equations. I run into an issue as a type of term in my equations is m.asin(q1.T@q2)/m.sqrt(1-(q1.T@q2)**2)
, where q1
and q2
are unit vectors in R3. When they are the same direction, the numerator and denominator become zero. When I have solved this system with fsolve
I have used an if
-statement to return 0 if q1.T@q2 == 1
, as such that there is never an issue. As I understand here if
-statements are bad, as we need the differential of the equations. I looked into m.if3
a bit, and tried that, but that doesn't help. For instance, it introduces slack variables, causing the degrees of freedom to become negative, and the system does not solve.
Any ideas how to overcome a 0 over 0 problem with gekko?