ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 24 Sep 2014 02:59:28 -0500given a list of coefficients how can I get a polynomialhttp://ask.sagemath.org/question/24252/given-a-list-of-coefficients-how-can-i-get-a-polynomial/ In sage,
given a list/vector v of coefficients, how can I get the polynomial v[i]*x^i ?
Here is my environment;
n = 11
K = GF(4,'a')
R = PolynomialRing(GF(4,'a'),"x")
x = R.gen()
a = K.gen()
v = vector([1,a,0,0,1,1,1,a,a,0,1])
I want to get the polynomial v(x) in x, having v as the list of coefficients.
This seems simple but I couldn't write it...
Can anyone help?
Tue, 23 Sep 2014 04:26:39 -0500http://ask.sagemath.org/question/24252/given-a-list-of-coefficients-how-can-i-get-a-polynomial/Answer by FrédéricC for <p>In sage,</p>
<p>given a list/vector v of coefficients, how can I get the polynomial v[i]*x^i ?</p>
<p>Here is my environment;</p>
<pre><code>n = 11
K = GF(4,'a')
R = PolynomialRing(GF(4,'a'),"x")
x = R.gen()
a = K.gen()
v = vector([1,a,0,0,1,1,1,a,a,0,1])
</code></pre>
<p>I want to get the polynomial v(x) in x, having v as the list of coefficients.
This seems simple but I couldn't write it...
Can anyone help?</p>
http://ask.sagemath.org/question/24252/given-a-list-of-coefficients-how-can-i-get-a-polynomial/?answer=24253#post-id-24253Like that
sage: R(v.list())
x^10 + a*x^8 + a*x^7 + x^6 + x^5 + x^4 + a*x + 1
Tue, 23 Sep 2014 06:54:45 -0500http://ask.sagemath.org/question/24252/given-a-list-of-coefficients-how-can-i-get-a-polynomial/?answer=24253#post-id-24253Comment by algebraicallyclosed for <p>Like that</p>
<pre><code>sage: R(v.list())
x^10 + a*x^8 + a*x^7 + x^6 + x^5 + x^4 + a*x + 1
</code></pre>
http://ask.sagemath.org/question/24252/given-a-list-of-coefficients-how-can-i-get-a-polynomial/?comment=24264#post-id-24264Ah, thanks, little before that, I wrote R(v) and it worked. Thank you for answering.Wed, 24 Sep 2014 02:58:06 -0500http://ask.sagemath.org/question/24252/given-a-list-of-coefficients-how-can-i-get-a-polynomial/?comment=24264#post-id-24264Comment by algebraicallyclosed for <p>Like that</p>
<pre><code>sage: R(v.list())
x^10 + a*x^8 + a*x^7 + x^6 + x^5 + x^4 + a*x + 1
</code></pre>
http://ask.sagemath.org/question/24252/given-a-list-of-coefficients-how-can-i-get-a-polynomial/?comment=24265#post-id-24265do you have any idea about my next question? http://ask.sagemath.org/question/24263/applying-the-script-to-running-over-variables-write-to-fileread-from-file/Wed, 24 Sep 2014 02:59:28 -0500http://ask.sagemath.org/question/24252/given-a-list-of-coefficients-how-can-i-get-a-polynomial/?comment=24265#post-id-24265