Page 1 sur 1
Publié : lun. août 21, 2017 12:46 am
the function 'solve' fails to find the solution (x=4/3,y=sqrt(2/3),u1=sqrt(2/3),u2=0,u3=0) to the following system of equations:
y-u1+u2=0, x-2*y*u1+u3=0, u1*(2-x-y^2)=0, u2*x=0, u3*y=0.
When I enter
Code : Tout sélectionner
I get only the solution [0,-u2,0,u2,0]. Assuming
the function 'solve' fails to find any solution. As the above system is quite easy to solve, I think it may be a bug.
Publié : lun. août 21, 2017 7:50 am
I checked, it's a limitation of the solve algorithm if the number of solutions is infinite, you get only generic solutions. Here after computing the Groebner basis in lex order, the first equation solved is -u2*u3=0 with respect to u3, and the solver returns 0 (u2 is considered generic, the special case u2=0 is unfortunately ignored).
Publié : mar. août 22, 2017 1:59 pm
I have improved the solve postprocessing algorithm, it will now return [[0,0,0,0,0],[2*(1/3*sqrt(6))^2,1/3*sqrt(6),1/3*sqrt(6),0,0],[2*(-1/3*sqrt(6))^2,-1/3*sqrt(6),-1/3*sqrt(6),0,0],[0,-u2,0,u2,0],[-u3,0,0,0,u3]]
Publié : mar. août 22, 2017 3:15 pm
That's it. I was solving some problems using Karush-Kuhn-Tucker conditions and I noticed that 'solve' failed to find solution in some quite simple cases. The above system is one example. I believe this fix covers for that.
Publié : jeu. sept. 07, 2017 6:56 am
There is a bug in function 'solve'. When I enter
'solve' returns [-pi/2,pi/2]. But not only these points are excluded from domain of x, but the expression 1/(1+tan(x)^2) can't vanish because it's undefined for x=k*pi/2, where k is integer.
Publié : jeu. sept. 07, 2017 8:36 am
There is indeed a missing check for excluded values that I'm fixing now.
If the assume inequations are large, solve will still return -pi/2 and pi/2 because trigonometric equations are sometimes rewritten in terms of half tangent and it's too difficult to track. It's not wrong if you consider limits