create polymial in powers of (x-1) from given coefficients in python
<p>I have the following coefficient matrix.</p>

<pre><code>import numpy as np
coeffMatrix = np.array([[  1.        ,   1.46599761,   0.        ,   0.25228421],
   [  2.71828183,   2.22285026,   0.75685264,   1.69107137],
   [  7.3890561 ,   8.80976965,   5.83006675,  -1.94335558],
   [ 20.08553692,   0.        ,   0.        ,   0.        ]])
</code></pre>

<p>I can then create a polynomials <code>s0</code> as follows:</p>

<pre><code>s0 = np.poly1d(coeffMatrix[0][::-1])
print (s0)
</code></pre>

<p>It prints out the following output:</p>

<pre><code>        3
0.2523 x + 1.466 x + 1
</code></pre>

<p>I now want to create <code>s1</code> using <code>coeffMatrix[1][::-1]</code> as the coefficients but I want <code>s1</code> to be in powers of (x-1). </p>

<p>How can I do this?</p>

<p>On a side note. I don't know how to copy paste jupyter notebook input output straight into stackoverflow.</p>

<p>Use <code>variable</code> parameter. I used <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.poly1d.html" rel="nofollow">http://docs.scipy.org/doc/numpy/reference/generated/numpy.poly1d.html</a></p>

<p>(I prefer to look on <code>np.array</code> as matrix and not as list of arrays)</p>

<pre><code>s1 = np.poly1d(coeffMatrix[1, ::-1], variable='(x-1)')
print(s1)
</code></pre>

python numpy scipy polynomials