ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 18 Apr 2016 19:36:10 +0200variable assumptionhttps://ask.sagemath.org/question/33126/variable-assumption/I have an expression in term of an independent variable $q$. Now, I would like to assume that $q$ is an arbitrary $14$-th root of unity (i.e. $q^{14}=1$).
It is not allow to evaluate in any primitive root of unity, say $\eta$, since the coefficients of my expression are in the $7$-th cyclotomic field (i.e. the field is generated by $\xi=e^{2\pi i/7}$), so $\eta$ is in the field.
I also tried with "assume(q^14==1)", but it didn't work.
How can I do?
**Added after Bruno's comment**: Here is an example. I have the expression
exp=q^16*xi^5 + (q^325-12*q^235)*xi^2.
where q is an independent variable and xi is the 7th-root of unity with least argument. In other words, I have an expression in terms of an independent variable q with coefficients in the 7-th cyclotomic field
K.<xi> = CyclotomicField(7)
Now, I want to assume that $q^{14}=1$, thus the resultant expression should be
q^2*xi^5 + (q^3-12*q^11)*xi^2
since $16\equiv 2\pmod {14}$, $325 \equiv 3\pmod {14}$ and $235\equiv 11\pmod {14}$.
How can I do that? Note that it is not sufficient to evaluate the expression in $q=$some primitive $14$-th root of unity, since $q$ can be $+1$ or $-1$.
Please, think that the expression have thousands of terms, so I cannot do it by hand as above.
Sat, 16 Apr 2016 01:49:39 +0200https://ask.sagemath.org/question/33126/variable-assumption/Comment by B r u n o for <p>I have an expression in term of an independent variable $q$. Now, I would like to assume that $q$ is an arbitrary $14$-th root of unity (i.e. $q^{14}=1$). </p>
<p>It is not allow to evaluate in any primitive root of unity, say $\eta$, since the coefficients of my expression are in the $7$-th cyclotomic field (i.e. the field is generated by $\xi=e^{2\pi i/7}$), so $\eta$ is in the field.</p>
<p>I also tried with "assume(q^14==1)", but it didn't work. </p>
<p>How can I do?</p>
<p><strong>Added after Bruno's comment</strong>: Here is an example. I have the expression</p>
<pre><code>exp=q^16*xi^5 + (q^325-12*q^235)*xi^2.
</code></pre>
<p>where q is an independent variable and xi is the 7th-root of unity with least argument. In other words, I have an expression in terms of an independent variable q with coefficients in the 7-th cyclotomic field</p>
<pre><code>K.<xi> = CyclotomicField(7)
</code></pre>
<p>Now, I want to assume that $q^{14}=1$, thus the resultant expression should be</p>
<pre><code>q^2*xi^5 + (q^3-12*q^11)*xi^2
</code></pre>
<p>since $16\equiv 2\pmod {14}$, $325 \equiv 3\pmod {14}$ and $235\equiv 11\pmod {14}$. </p>
<p>How can I do that? Note that it is not sufficient to evaluate the expression in $q=$some primitive $14$-th root of unity, since $q$ can be $+1$ or $-1$. </p>
<p>Please, think that the expression have thousands of terms, so I cannot do it by hand as above. </p>
https://ask.sagemath.org/question/33126/variable-assumption/?comment=33128#post-id-33128You should describe a bit more what you've done, and what you are trying to do. For instance, you may include some (minimal) code that does not work as you wish. Why do you want to assume that $q$ is a 14-th root of unity? To find the solutions of some equation?Sat, 16 Apr 2016 10:04:33 +0200https://ask.sagemath.org/question/33126/variable-assumption/?comment=33128#post-id-33128Comment by emiliocba for <p>I have an expression in term of an independent variable $q$. Now, I would like to assume that $q$ is an arbitrary $14$-th root of unity (i.e. $q^{14}=1$). </p>
<p>It is not allow to evaluate in any primitive root of unity, say $\eta$, since the coefficients of my expression are in the $7$-th cyclotomic field (i.e. the field is generated by $\xi=e^{2\pi i/7}$), so $\eta$ is in the field.</p>
<p>I also tried with "assume(q^14==1)", but it didn't work. </p>
<p>How can I do?</p>
<p><strong>Added after Bruno's comment</strong>: Here is an example. I have the expression</p>
<pre><code>exp=q^16*xi^5 + (q^325-12*q^235)*xi^2.
</code></pre>
<p>where q is an independent variable and xi is the 7th-root of unity with least argument. In other words, I have an expression in terms of an independent variable q with coefficients in the 7-th cyclotomic field</p>
<pre><code>K.<xi> = CyclotomicField(7)
</code></pre>
<p>Now, I want to assume that $q^{14}=1$, thus the resultant expression should be</p>
<pre><code>q^2*xi^5 + (q^3-12*q^11)*xi^2
</code></pre>
<p>since $16\equiv 2\pmod {14}$, $325 \equiv 3\pmod {14}$ and $235\equiv 11\pmod {14}$. </p>
<p>How can I do that? Note that it is not sufficient to evaluate the expression in $q=$some primitive $14$-th root of unity, since $q$ can be $+1$ or $-1$. </p>
<p>Please, think that the expression have thousands of terms, so I cannot do it by hand as above. </p>
https://ask.sagemath.org/question/33126/variable-assumption/?comment=33129#post-id-33129I tried to improve my question with an example. The reason of why do I want to do it is difficult and not necessary, since it is involved to calculations in ugly algebras.Sat, 16 Apr 2016 16:06:05 +0200https://ask.sagemath.org/question/33126/variable-assumption/?comment=33129#post-id-33129Answer by tmonteil for <p>I have an expression in term of an independent variable $q$. Now, I would like to assume that $q$ is an arbitrary $14$-th root of unity (i.e. $q^{14}=1$). </p>
<p>It is not allow to evaluate in any primitive root of unity, say $\eta$, since the coefficients of my expression are in the $7$-th cyclotomic field (i.e. the field is generated by $\xi=e^{2\pi i/7}$), so $\eta$ is in the field.</p>
<p>I also tried with "assume(q^14==1)", but it didn't work. </p>
<p>How can I do?</p>
<p><strong>Added after Bruno's comment</strong>: Here is an example. I have the expression</p>
<pre><code>exp=q^16*xi^5 + (q^325-12*q^235)*xi^2.
</code></pre>
<p>where q is an independent variable and xi is the 7th-root of unity with least argument. In other words, I have an expression in terms of an independent variable q with coefficients in the 7-th cyclotomic field</p>
<pre><code>K.<xi> = CyclotomicField(7)
</code></pre>
<p>Now, I want to assume that $q^{14}=1$, thus the resultant expression should be</p>
<pre><code>q^2*xi^5 + (q^3-12*q^11)*xi^2
</code></pre>
<p>since $16\equiv 2\pmod {14}$, $325 \equiv 3\pmod {14}$ and $235\equiv 11\pmod {14}$. </p>
<p>How can I do that? Note that it is not sufficient to evaluate the expression in $q=$some primitive $14$-th root of unity, since $q$ can be $+1$ or $-1$. </p>
<p>Please, think that the expression have thousands of terms, so I cannot do it by hand as above. </p>
https://ask.sagemath.org/question/33126/variable-assumption/?answer=33130#post-id-33130Instead of thinking `exp` as a symbolic expression with the symbol `q` on which you pus assumptions, you should define it as a polynomial on the field `F` with indeterminate `q`, and then work modulo `q^14-1`. So, you can do:
sage: K.<xi> = CyclotomicField(7)
sage: R.<q> = PolynomialRing(K)
sage: P = q^16*xi^5 + (q^325 - 12*q^235)*xi^2
sage: P
xi^2*q^325 - 12*xi^2*q^235 + xi^5*q^16
sage: P.parent()
Univariate Polynomial Ring in q over Cyclotomic Field of order 7 and degree 6
sage: P.mod(q^14-1)
-12*xi^2*q^11 + xi^2*q^3 + xi^5*q^2
You can also work in the quotient ring defined by the ideal generated by `(q^14-1)` if necessary:
sage: I = R.ideal(q^14-1)
sage: Q = R.quotient(I)
sage: Q
Univariate Quotient Polynomial Ring in qbar over Cyclotomic Field of order 7 and degree 6 with modulus q^14 - 1
sage: Q(P)
-12*xi^2*qbar^11 + xi^2*qbar^3 + xi^5*qbar^2
Sat, 16 Apr 2016 23:29:41 +0200https://ask.sagemath.org/question/33126/variable-assumption/?answer=33130#post-id-33130Comment by nbruin for <p>Instead of thinking <code>exp</code> as a symbolic expression with the symbol <code>q</code> on which you pus assumptions, you should define it as a polynomial on the field <code>F</code> with indeterminate <code>q</code>, and then work modulo <code>q^14-1</code>. So, you can do:</p>
<pre><code>sage: K.<xi> = CyclotomicField(7)
sage: R.<q> = PolynomialRing(K)
sage: P = q^16*xi^5 + (q^325 - 12*q^235)*xi^2
sage: P
xi^2*q^325 - 12*xi^2*q^235 + xi^5*q^16
sage: P.parent()
Univariate Polynomial Ring in q over Cyclotomic Field of order 7 and degree 6
sage: P.mod(q^14-1)
-12*xi^2*q^11 + xi^2*q^3 + xi^5*q^2
</code></pre>
<p>You can also work in the quotient ring defined by the ideal generated by <code>(q^14-1)</code> if necessary:</p>
<pre><code>sage: I = R.ideal(q^14-1)
sage: Q = R.quotient(I)
sage: Q
Univariate Quotient Polynomial Ring in qbar over Cyclotomic Field of order 7 and degree 6 with modulus q^14 - 1
sage: Q(P)
-12*xi^2*qbar^11 + xi^2*qbar^3 + xi^5*qbar^2
</code></pre>
https://ask.sagemath.org/question/33126/variable-assumption/?comment=33136#post-id-33136Note that `Q(zeta_14)` is not isomorphic to `Q[x]/(x^14-1)`. It's `Q[x]/(x^6 - x^5 + x^4 - x^3 + x^2 - x + 1)`. (because not all the roots of `x^14-1` are primitive 14-th roots of unity)Mon, 18 Apr 2016 19:36:10 +0200https://ask.sagemath.org/question/33126/variable-assumption/?comment=33136#post-id-33136