Ask Your Question
0

substitution not simplifying

asked 2016-11-03 02:47:59 +0100

Sha gravatar image

updated 2016-11-03 10:07:15 +0100

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-11-03 11:20:35 +0100

slelievre gravatar image

Sage's Symbolic Ring is probably not the best setting for your computations.

Would the following satisfy your needs?

First define number fields for a and B.

sage: k.<a> = NumberField(x^4-5*x^2-32)
sage: K.<B> = k.extension(x^2+2)
sage: a^4
5*a^2 + 32
sage: B^2
-2

Now define some expressions in a and B. Note how they self-simplify.

sage: xx = ((-12*a^3+92*a+24)*B-48*a^3-80*a+6)/(8*B-6); xx
(114/41*a^3 + 22/41*a - 48/41)*B + 24/41*a^3 + 488/41*a + 87/41
sage: yy = ((11*a^3+65*a-52)*B-605*a^3+13*a-12)/(8*B+70); yy
(935/838*a^3 + 741/838*a - 886/1257)*B - 7029/838*a^3 + 325/838*a - 418/1257

Now define a polynomial ring P over K, define some polynomial f, and substitute.

sage: P.<x,y> = K[]
sage: f = x^2 + y^2
sage: f.subs({x: xx, y: yy})
(19045574740/885354123*a^3 - 178146516864/295118041*a^2 - 23662616188/885354123*a - 2091104351128/2656062369)*B + 21451563214/885354123*a^3 + 924837417564/295118041*a^2 + 48925292450/885354123*a + 22206643558277/2656062369
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-11-03 02:47:59 +0100

Seen: 698 times

Last updated: Nov 03 '16