nonlinear equation system

162 views
Skip to first unread message

Scott Wilson

unread,
Feb 27, 2022, 4:09:00 PM2/27/22
to sage-support
Hello, I am new to sage math and tried to get the solution to the following nonlinear equation system. Sage has been working on this since yesterday and I am wondering how long I should typically wait. All comments are appreciated. Thanks in advance.

var('A B E F I J R T')

eq1 = A*E-B^2-B*F+E^2==1
eq4 = A*I-B*J+I^2+R^2==-1/2
eq5 = A*R-B*T+2*R*I==0
eq6 = B*I-E*J+I*J+R*T==0
eq8 = -B*R+E*T-R*J-I*T==0
eq9 = E*I-F*J+J^2+T^2==1/2
eq11 = -E*R+F*T-2*T*J==0
eq12 = I^2-R^2-J^2+T^2==-1

solve([eq1,eq4,eq5,eq6,eq8,eq9,eq11,eq12],A,B,E,F,I,J,R,T)

Dima Pasechnik

unread,
Feb 27, 2022, 6:07:35 PM2/27/22
to sage-support
One should not use a generic solver for polynomial equations.
One can set this up easily:

sage: P.<A, B, E, F, I, J, R, T>=QQ[]
sage: eq1 = A*E-B^2-B*F+E^2-1
....: eq4 = A*I-B*J+I^2+R^2+1/2
....: eq5 = A*R-B*T+2*R*I
....: eq6 = B*I-E*J+I*J+R*T
....: eq8 = -B*R+E*T-R*J-I*T
....: eq9 = E*I-F*J+J^2+T^2-1/2
....: eq11 = -E*R+F*T-2*T*J
....: eq12 = I^2-R^2-J^2+T^2+1
sage: sy=P.ideal(eq1,eq4,eq5,eq6,eq8,eq9,eq11,eq12)

and see that this ideal contains 1, i.e. your system has no solutions,
even no complex solutions, assuming I didn't make an error while
converting:

sage: sy.groebner_basis()
[1]


HTH,
Dima

> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/47695a04-777d-4fbb-af5d-7371db01a31an%40googlegroups.com.

cyrille....@univ-orleans.fr

unread,
Feb 28, 2022, 2:24:25 AM2/28/22
to sage-s...@googlegroups.com
I am not a mathematician but what seems obvious is that you have 8 equations with 8 variables. You could conjecture there is at least a real solution even if there could be 8. But, your system is highly nonlinear. So you can not expect a solution by quadrature. You must try to solve you system numerically.


----- Mail d’origine -----
De: Scott Wilson <scott....@octoengineering.ca>
À: sage-support <sage-s...@googlegroups.com>
Envoyé: Sun, 27 Feb 2022 20:40:43 +0100 (CET)
Objet: [sage-support] nonlinear equation system

Dima Pasechnik

unread,
Feb 28, 2022, 4:59:58 AM2/28/22
to sage-support
On Mon, Feb 28, 2022 at 7:24 AM cyrille....@univ-orleans.fr
<cyrille....@univ-orleans.fr> wrote:
>
> I am not a mathematician but what seems obvious is that you have 8 equations with 8 variables. You could conjecture there is at least a real solution even if there could be 8. But, your system is highly nonlinear.

Generically, one might expect up to 2^8 solutions here (8 variables, 8
equations of degree 2).
This is called Bezout theorem.
No guarantee that any solution is real, though.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/599338425.36980299.1646033057570.JavaMail.zimbra%40univ-orleans.fr.

Scott Wilson

unread,
Mar 1, 2022, 12:23:19 PM3/1/22
to sage-support
Thanks all. I believe Dima is correct. These are inconsistent.

Emmanuel Charpentier

unread,
Mar 3, 2022, 9:01:46 AM3/3/22
to sage-support

FWIW, executing :

reset()
# Don't scratch Sage's predefined identifiers, for sanity's sake...
Vars= var('A B EE F II J RR T') 
eq1 = A*EE-B^2-B*F+EE^2==1 
eq4 = A*II-B*J+II^2+RR^2==-1/2 
eq5 = A*RR-B*T+2*RR*II==0 
eq6 = B*II-EE*J+II*J+RR*T==0 
eq8 = -B*RR+EE*T-RR*J-II*T==0 
eq9 = EE*II-F*J+J^2+T^2==1/2 
eq11 = -EE*RR+F*T-2*T*J==0 
eq12 = II^2-RR^2-J^2+T^2==-1
Sys = [eq1,eq4,eq5,eq6,eq8,eq9,eq11,eq12]
# Build an equivalent polynomial system
# Ring
R1 = PolynomialRing(QQbar, len(Vars), "u")
R1.inject_variables()
# Conversion dictionary
D = dict(zip(Vars, R1.gens()))
# Polynomial system
PSys = [R1((u.lhs()-u.rhs()).subs(D)) for u in Sys]
# Try to solve
J1 = R1.ideal(PSys)
# Check
print(J1.dimension())

prints

Defining u0, u1, u2, u3, u4, u5, u6, u7
-1

According to J1.dimension? : If the ideal is the total ring, the dimension is -1 by convention.

No bloody solution…

Emmanuel Charpentier

unread,
Mar 3, 2022, 9:09:27 AM3/3/22
to sage-support

And, BTW :

sage: mathematica("Sys = {%s}"%", ".join([u._mathematica_init_() for u in Sys]))
{-B^2 + A*EE + EE^2 - B*F == 1, A*II + II^2 - B*J + RR^2 == -1/2, 
 A*RR + 2*II*RR - B*T == 0, B*II - EE*J + II*J + RR*T == 0, 
 -(B*RR) - J*RR + EE*T - II*T == 0, EE*II - F*J + J^2 + T^2 == 1/2, 
 -(EE*RR) + F*T - 2*J*T == 0, II^2 - J^2 - RR^2 + T^2 == -1}
sage: mathematica("Vars = {%s}"%", ".join([u._mathematica_init_() for u in Vars]))
{A, B, EE, F, II, J, RR, T}
sage: mathematica("Reduce[Sys, Vars]")
False

HTH,

Emmanuel Charpentier

unread,
Mar 3, 2022, 9:13:11 AM3/3/22
to sage-support
Or (unexpectedly much simpler) :

```
sage: mathematica.Reduce(Sys, Vars)
False
```
Reply all
Reply to author
Forward
0 new messages