Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- R<x,n> := PolynomialRing(Rationals(), 2);
- // Define A, B, C
- A := (36*n + 27)^2;
- B := 15552*n^3 + 34992*n^2 + 26244*n + 6561;
- C := 46656*n^4 + 139968*n^3 + 157464*n^2 + 78713*n + 14748;
- // Perform substitution
- expr := (x - A/3)^3
- + A*(x - A/3)^2
- + B*(x - A/3)
- + C;
- // Extract coefficients directly
- a3 := Coefficient(expr, x, 3);
- a2 := Coefficient(expr, x, 2);
- a1 := Coefficient(expr, x, 1);
- a0 := Coefficient(expr, x, 0);
- // Output
- print "a3 =", a3;
- print "a2 =", a2;
- print "a1 =", a1;
- print "a0 =", a0;
- print "Final Weierstrass equation:";
- print "y^2 = x^3 + (", a1, ")*x + (", a0, ")";
Advertisement
Add Comment
Please, Sign In to add comment