# Revision history [back]

In turns out that these equation systems can be solved more quickly in SR than in the relevant polynomial ring over QQ:

sage: reset()
sage: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:R1.<a1,b1,b2,c1,c2> = QQ[]
:S2=[5*(9 + 2*a1^2 - b2),
:    5*(-324 + 4*a1*b1 + b2^2 - c2),
:    10*(729 + 2*a1 + b1^2 + 243*b2 - 9*b2^2 + 2*a1*c1 + b2*c2),
:    5*(6561 + 4*b1 - 2916*b2 + 4*b1*c1 + 486*c2 - 36*b2*c2 + c2^2),
:    2*(-59048 + 10*c1 + 5*c1^2 - 7290*c2 - 45*c2^2)+1889566]
:J2=R1.ideal(*S2)
:J2.dimension()
:
:--
0
sage: %time Sol2=J2.variety()
CPU times: user 1min 2s, sys: 67.9 ms, total: 1min 3s
Wall time: 1min 3s
sage: Sol2
[{c2: -243, c1: 0, b2: 9, b1: 0, a1: 0},
{c2: -243, c1: -2, b2: 9, b1: 0, a1: 0}]


So far, so good. Solving in SR is faster but find more "rational" solutions :

sage: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:# Conversion to SR
:SV=list(map(lambda u:var(repr(u).upper()),R1.gens()))
:D1=dict(zip(R1.gens(),SV))
:
:--
sage: %time Sol2Rat=[v  for v in solve(list(map(lambda u:u.subs(D1), S2)), SV, s
....: olution_dict=True) if all([v[u] in QQ for u in v.keys()])]
CPU times: user 4.95 s, sys: 40.2 ms, total: 4.99 s
Wall time: 4.22 s
sage: Sol2Rat
[{A1: 0.003086423021009911,
B1: -5.88025749412356e-08,
B2: 9.00001905233677,
C1: -1.0,
C2: -242.9996569468267},
{A1: -0.003086423021009911,
B1: 5.88025749412356e-08,
B2: 9.00001905233677,
C1: -1.0,
C2: -242.9996569468267},
{A1: 6.593646591661152,
B1: -405.391447368421,
B2: 95.95235186316432,
C1: 5160.704545454545,
C2: -1809.177777777778},
{A1: -6.590559824368825,
B1: 404.8549618320611,
B2: 95.87096774193549,
C1: -5152.047619047619,
C2: -1805.641304347826},
{A1: -6.593646591661152,
B1: 405.391447368421,
B2: 95.95235186316432,
C1: -5162.704545454545,
C2: -1809.177777777778},
{A1: 6.590559824368825,
B1: -404.8549618320611,
B2: 95.87096774193549,
C1: 5150.047619047619,
C2: -1805.641304347826},
{A1: 0, B1: 0, B2: 9, C1: 0, C2: -243},
{A1: 0, B1: 0, B2: 9, C1: -2, C2: -243}]
sage: len(Sol2Rat)
8


That makes me question the validity of the test of rationality v[u] in QQ. Advice ?