Comment #88 on issue 1598 by mattpap: New polynomials manipulation module
http://code.google.com/p/sympy/issues/detail?id=1598
There is decompose() function which will do the job (up to constant terms),
e.g.:
In [1]: compose(x**3-3*x**2+1, x**3-2)
Out[1]:
3 6 9
-19 + 24⋅x - 9⋅x + x
In [2]: decompose(_)
Out[2]:
⎡ 2 3 3⎤
⎣-19 + 24⋅x - 9⋅x + x , x ⎦
In [3]: compose(x**3-3*x**2+1, x**6-x**3+2)
Out[3]:
6 9 12 15 18
-3 + 3⋅x - 7⋅x + 6⋅x - 3⋅x + x
In [4]: decompose(_)
Out[4]:
⎡ 2 3 2 3⎤
⎣-3 + 3⋅x + x , -x + x , x ⎦
Note that decompose() works only with univariate polynomials, so:
In [1]: compose(x**2 + 1, x**3-y, x)
Out[1]:
2 3 6
1 + y - 2⋅y⋅x + x
In [2]: decompose(_, x)
Out[2]:
⎡ 2 2 3⎤
⎣1 - 2⋅x⋅y + x + y , x ⎦
(actually in compose() you don't have to specify generators, because it
will do the
composition for the principal generator, assuming by default that x comes
before y,
but in decompose() this behavior is not yet implemented, so x is mandatory).
Also look into roots() and, especially, _try_decompose() where decompose()
is used
together with square-free factorization to compute roots the way you've
described.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to sympy-iss...@googlegroups.com.
To unsubscribe from this group, send email to
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.