substitution not simplifying
I have the following code where everything works fine until eq4
expression where all higher powers of B
were simplified, unfortunately with eq5
I can still see higher powers of a
like a^6
etc that were not simplified.
B,a,x,y = var('B a x y')
R=x^2+y^2;R
eq1=R.subs({x:((-12*a^3+92*a+24)*B-48*a^3-80*a+6)/(8*B-6)});eq1
eq2=eq1.subs({y:((11*a^3+65*a-52)*B-605*a^3+13*a-12)/(8*B+70)});eq2
eq3=eq2.simplify_full();eq3
eq4=eq3.subs({B: sqrt(-2)}).subs({sqrt(-2):B});eq4
eq5= eq4.subs({a^4: 5*a^2+32});eq5
which gives
1/4*(7291921*a^6 - 4678952*a^3 + 2*(3424035*a^6 + 1472328*a^3 + 24725813*a^2 + 1819560*a + 106127568)*B - 16*(19639*a^6 - 103688*a^3 + 1003105*a^2 - 163544*a + 8052784)*B - 70791609*a^2 + 10593256*a - 477643380)/(35072*B + 13999)
Is there a way I can fix this so that the only higher powers of a
remaining aren't higher than 3
because of the a^4
substitution.