# Revision history [back]

Alternative :let's be lazy and let Sage solve it for you :

var('f, q, r, h, i, g')
e1 = -(4*f^2*q + 5*f^2*r - 4*q^2 + 5*f*r - 3*q*r) == 0
e2 = -1/5*(20*f^2*h*q + 20*f^2*i*q + 40*f*g*q + 40*f*h*q - 8*f*q^2 -
20*h*q^2 - 20*i*q^2 + 50*f*g*r + 100*f*h*r + 50*f*i*r - 4*q^2 +
25*g*r + 25*h*r - 50*q*r - 25*r^2) == 0
Sol = flatten([[u|v
for v in e2.subs(u).solve(g, algorithm="sympy",
solution_dict=True)]
for u in e1.solve(f, algorithm="sympy", solution_dict=True)])

sage: solve([e1, e2], [f, g], solution_dict=True)
[{f: -1/2*(5*r + sqrt(64*q^3 + 128*q^2*r + 5*(12*q + 5)*r^2))/(4*q + 5*r),
g: -1/5*(5120*h*q^5 - 1024*q^6 + 625*(12*(2*h + i)*q + 10*h + 5*i)*r^4 + 50*(10*(94*h + 38*i - 1)*q^2 - 24*q^3 + 25*(5*h + i)*q)*r^3 + 80*(5*(132*h + 36*i - 1)*q^3 - 44*q^4 + 25*h*q^2)*r^2 + 128*(5*(41*h + 5*i)*q^4 - 26*q^5)*r + (80*(2*h + 2*i + 11)*q^3*r + 64*q^4 + 125*(5*h + 5*i + 18*q)*r^3 + 625*r^4 + 50*(4*(h + i + 12)*q^2 + 5*(h + i)*q)*r^2)*sqrt(64*q^3 + 128*q^2*r + 5*(12*q + 5)*r^2))/(1024*q^5 + 4608*q^4*r + 125*(12*q + 5)*r^4 + 200*(28*q^2 + 5*q)*r^3 + 80*(96*q^3 + 5*q^2)*r^2)},
{f: -1/2*(5*r - sqrt(64*q^3 + 128*q^2*r + 5*(12*q + 5)*r^2))/(4*q + 5*r),
g: -1/5*(5120*h*q^5 - 1024*q^6 + 625*(12*(2*h + i)*q + 10*h + 5*i)*r^4 + 50*(10*(94*h + 38*i - 1)*q^2 - 24*q^3 + 25*(5*h + i)*q)*r^3 + 80*(5*(132*h + 36*i - 1)*q^3 - 44*q^4 + 25*h*q^2)*r^2 + 128*(5*(41*h + 5*i)*q^4 - 26*q^5)*r - (80*(2*h + 2*i + 11)*q^3*r + 64*q^4 + 125*(5*h + 5*i + 18*q)*r^3 + 625*r^4 + 50*(4*(h + i + 12)*q^2 + 5*(h + i)*q)*r^2)*sqrt(64*q^3 + 128*q^2*r + 5*(12*q + 5)*r^2))/(1024*q^5 + 4608*q^4*r + 125*(12*q + 5)*r^4 + 200*(28*q^2 + 5*q)*r^3 + 80*(96*q^3 + 5*q^2)*r^2)}]


Alternative :let's be lazy and let Sage solve it for you you. Let :

var('f, q, r, h, i, g')
e1 = -(4*f^2*q + 5*f^2*r - 4*q^2 + 5*f*r - 3*q*r) == 0
e2 = -1/5*(20*f^2*h*q + 20*f^2*i*q + 40*f*g*q + 40*f*h*q - 8*f*q^2 -
20*h*q^2 - 20*i*q^2 + 50*f*g*r + 100*f*h*r + 50*f*i*r - 4*q^2 +
25*g*r + 25*h*r - 50*q*r - 25*r^2) == 0
Sol = flatten([[u|v
for v in e2.subs(u).solve(g, algorithm="sympy",
solution_dict=True)]
for u in e1.solve(f, algorithm="sympy", solution_dict=True)])



Then :

sage: solve([e1, e2], [f, g], solution_dict=True)
[{f: -1/2*(5*r + sqrt(64*q^3 + 128*q^2*r + 5*(12*q + 5)*r^2))/(4*q + 5*r),
g: -1/5*(5120*h*q^5 - 1024*q^6 + 625*(12*(2*h + i)*q + 10*h + 5*i)*r^4 + 50*(10*(94*h + 38*i - 1)*q^2 - 24*q^3 + 25*(5*h + i)*q)*r^3 + 80*(5*(132*h + 36*i - 1)*q^3 - 44*q^4 + 25*h*q^2)*r^2 + 128*(5*(41*h + 5*i)*q^4 - 26*q^5)*r + (80*(2*h + 2*i + 11)*q^3*r + 64*q^4 + 125*(5*h + 5*i + 18*q)*r^3 + 625*r^4 + 50*(4*(h + i + 12)*q^2 + 5*(h + i)*q)*r^2)*sqrt(64*q^3 + 128*q^2*r + 5*(12*q + 5)*r^2))/(1024*q^5 + 4608*q^4*r + 125*(12*q + 5)*r^4 + 200*(28*q^2 + 5*q)*r^3 + 80*(96*q^3 + 5*q^2)*r^2)},
{f: -1/2*(5*r - sqrt(64*q^3 + 128*q^2*r + 5*(12*q + 5)*r^2))/(4*q + 5*r),
g: -1/5*(5120*h*q^5 - 1024*q^6 + 625*(12*(2*h + i)*q + 10*h + 5*i)*r^4 + 50*(10*(94*h + 38*i - 1)*q^2 - 24*q^3 + 25*(5*h + i)*q)*r^3 + 80*(5*(132*h + 36*i - 1)*q^3 - 44*q^4 + 25*h*q^2)*r^2 + 128*(5*(41*h + 5*i)*q^4 - 26*q^5)*r - (80*(2*h + 2*i + 11)*q^3*r + 64*q^4 + 125*(5*h + 5*i + 18*q)*r^3 + 625*r^4 + 50*(4*(h + i + 12)*q^2 + 5*(h + i)*q)*r^2)*sqrt(64*q^3 + 128*q^2*r + 5*(12*q + 5)*r^2))/(1024*q^5 + 4608*q^4*r + 125*(12*q + 5)*r^4 + 200*(28*q^2 + 5*q)*r^3 + 80*(96*q^3 + 5*q^2)*r^2)}]