Hi Michael,
On 2013-01-14, Michael Beeson <[email protected]> wrote:
> ------=_Part_111_11990633.1358202706289
> Content-Type: text/plain; charset=ISO-8859-1
>
> sage: K.<p,d,e,N> = FractionField(PolynomialRing(QQ,4,'pdeN'))
> sage: R.<x> = K[]
> sage: a = x^3-x^-3
> sage: b = x^5-x^-5
> sage: c = x^8-x^-8
Are you aware that a, b, c do *not* live in R?
sage: a.parent() is R
False
In fact, your computations take place in a very complicated ring, namely
in the fraction field of a polynomial ring in x with coefficients in the
fraction field of a polynomial ring with variables p,d,e,N.
If you want to invert x anyway, then it would probably make sense to
simply work in the fraction field of the polynomial ring with variables
x,p,d,e,N. Or do you have a particular reason not to work there?
> sage: X = p*a + d*b + e*c
> sage: f = x^16 *(X^2- N*b*c)
>
> and Sage does not answer. It just hangs...
I can confirm that it hangs (or at least takes long time, after all this
complicated ring has no efficient implementation), but...
> ... and I have to kill the session.
... I can simply interrupt with Ctrl-c, without killing the session (at
least when I use a debug version of sage-5.6.beta1).
Here is what happens if you work in a simpler (better implemented) ring:
sage: K2.<x,p,d,e,N> = QQ[]
sage: a = x^3-x^-3
sage: b = x^5-x^-5
sage: c = x^8-x^-8
sage: X = p*a + d*b + e*c
Sage automatically creates the fraction field of K2 when you invert x:
sage: X.parent()
Fraction Field of Multivariate Polynomial Ring in x, p, d, e, N over
Rational Field
And then
sage: f = x^16 *(X^2- N*b*c)
sage: f
x^32*e^2 + 2*x^29*d*e - x^29*N + 2*x^27*p*e + x^26*d^2 + 2*x^24*p*d +
x^22*p^2 - 2*x^21*p*e - 2*x^19*d*e - 2*x^18*p*d + x^19*N - 2*x^16*p^2
- 2*x^16*d^2 - 2*x^16*e^2 - 2*x^14*p*d - 2*x^13*d*e + x^13*N -
2*x^11*p*e + x^10*p^2 + 2*x^8*p*d + x^6*d^2 + 2*x^5*p*e + 2*x^3*d*e
- x^3*N + e^2
works immediately.
> If it would answer I would like to continue with
>
> F = R(f)
> psi = cyclotomic_polynomial(30)
> g = F.quo_rem(psi)[1]
> g
Let's try something similar. As you can see, all exponents are positive,
and thus we can map the element into K2:
sage: F = K2(f)
sage: psi = cyclotomic_polynomial(30)
sage: g = F.quo_rem(psi)[1]
sage: g
-x^7*p^2 - 6*x^7*p*d - 2*x^7*p*e - 4*x^6*p*d - 2*x^6*d*e + x^5*p^2 +
2*x^5*p*d + 2*x^5*p*e - 2*x^5*d*e + x^6*N + 4*x^4*p*d + 2*x^4*d*e +
x^5*N + 8*x^3*p*d + 4*x^3*d*e - x^4*N + 4*x^2*p*d + 2*x^2*p*e +
2*x^2*d*e + x^2*e^2 - 2*x^3*N + 2*x*p^2 - 2*x*p*d + 3*x*d^2 + 2*x*p*e
+ 2*x*d*e + 2*x*e^2 - x^2*N - p^2 - 6*p*d + e^2 - x*N
Does that work as you wanted it to be?
Best regards,
Simon
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.