Comment #52 on issue 1598 by mattpap: New polynomials manipulation module
http://code.google.com/p/sympy/issues/detail?id=1598
I was bored with what I was supposed to do today, so in the mean time I
implemented
factorization algorithm over algebraic number fields, e.g.:
In [1]: factor(x**4+1, extension=sqrt(2))
Out[1]:
⎛ ⎽⎽⎽ 2⎞ ⎛ ⎽⎽⎽ 2⎞
⎝1 + x⋅╲╱ 2 + x ⎠⋅⎝1 - x⋅╲╱ 2 + x ⎠
In [2]: expand(_)
Out[2]:
4
1 + x
In [3]: factor(x**4+1, extension=I)
Out[3]:
⎛ 2⎞ ⎛ 2⎞
⎝ⅈ + x ⎠⋅⎝-ⅈ + x ⎠
In [4]: expand(_)
Out[4]:
4
1 + x
You can also create Poly instances with algebraic coefficients, e.g.:
In [5]: f = Poly(2*I*x**2 + I/2, x, extension=I)
In [6]: f
Out[6]: Poly(2*I*x**2 + I/2, x, domain='QQ<I>')
or alternatively (for Gaussian integers):
In [7]: f = Poly(2*I*x**2 + I/2, x, gaussian=True)
In [8]: f
Out[8]: Poly(2*I*x**2 + I/2, x, domain='QQ<I>')
If you provide a wrong extension you will get:
In [9]: f = Poly(2*I*x**2 + I/2, x, extension=sqrt(2))
(...)
CoercionFailed: expected `Rational` object, got 2*I
Currently only univariate polynomials over a single extension of rationals
are
supported. However, soon I should have support for multivariate polynomials
and
multiple extensions.
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.