Updates:
Status: Started
Owner: mattpap
Cc: -mattpap
Labels: Milestone-Release0.7.0 NeedsReview
Comment #6 on issue 1881 by mattpap: solve -> OverflowError: mpz too large
for int
http://code.google.com/p/sympy/issues/detail?id=1881
After recent changes, the initialization procedure of ground types will now
fall back to non-gmpy ground types if gmpy is installed but doesn't support
int() properly. This was the easy part. The harder was to implement an
algorithm in RootOf, which tries to get rid of symbolic coefficients from
an input polynomial to RootOf, e.g.:
In [1]: var('J,L,F,E')
Out[1]: (J, L, F, E)
In [2]: f = -21601054687500000000*E**8*J**8/L**16 +
508232812500000000*F*x*E**7*J**7/L**14 -
4269543750000000*E**6*F**2*J**6*x**2/L**12 +
16194716250000*E**5*F**3*J**5*x**3/L**10 -
27633173750*E**4*F**4*J**4*x**4/L**8 + 14840215*E**3*F**5*J**3*x**5/L**6 +
54794*E**2*F**6*J**2*x**6/ (5*L**4) - 1153*E*J*F**7*x**7/(80*L**2) +
633*F**8*x**8/160000
In [3]: r = RootOf(Poly(f, x))
In [4]: str(r)
Out[4]:
[20*E*J*RootOf(633*x**8 - 115300*x**7 + 4383520*x**6 + 296804300*x**5 -
27633173750*x**4 + 809735812500*x**3 -
10673859375000*x**2 + 63529101562500*x - 135006591796875, 0)/(F*L**2),
20*E*J*RootOf(633*x**8 - 115300*x**7 + 4
383520*x**6 + 296804300*x**5 - 27633173750*x**4 + 809735812500*x**3 -
10673859375000*x**2 + 63529101562500*x -
135006591796875, 1)/(F*L**2), 20*E*J*RootOf(633*x**8 - 115300*x**7 +
4383520*x**6 + 296804300*x**5 - 2763317375
0*x**4 + 809735812500*x**3 - 10673859375000*x**2 + 63529101562500*x -
135006591796875, 2)/(F*L**2), 20*E*J*Root
Of(633*x**8 - 115300*x**7 + 4383520*x**6 + 296804300*x**5 -
27633173750*x**4 + 809735812500*x**3 - 106738593750
00*x**2 + 63529101562500*x - 135006591796875, 3)/(F*L**2),
20*E*J*RootOf(633*x**8 - 115300*x**7 + 4383520*x**6
+ 296804300*x**5 - 27633173750*x**4 + 809735812500*x**3 -
10673859375000*x**2 + 63529101562500*x - 135006591796
875, 4)/(F*L**2), 20*E*J*RootOf(633*x**8 - 115300*x**7 + 4383520*x**6 +
296804300*x**5 - 27633173750*x**4 + 809
735812500*x**3 - 10673859375000*x**2 + 63529101562500*x - 135006591796875,
5)/(F*L**2), 20*E*J*RootOf(633*x**8
- 115300*x**7 + 4383520*x**6 + 296804300*x**5 - 27633173750*x**4 +
809735812500*x**3 - 10673859375000*x**2 + 63
529101562500*x - 135006591796875, 6)/(F*L**2), 20*E*J*RootOf(633*x**8 -
115300*x**7 + 4383520*x**6 + 296804300*
x**5 - 27633173750*x**4 + 809735812500*x**3 - 10673859375000*x**2 +
63529101562500*x - 135006591796875, 7)/(F*L
**2)]
In [5]: r[0]
Out[5]:
⎛ 8 7 6 5
4 3
20⋅E⋅J⋅RootOf⎝633⋅x - 115300⋅x + 4383520⋅x + 296804300⋅x -
27633173750⋅x + 809735812500⋅x - 1067385937500
───────────────────────────────────────────────────────────────────────────────────────────────────────────────
2
F⋅L
2 ⎞
0⋅x + 63529101562500⋅x - 135006591796875, 0⎠
─────────────────────────────────────────────
So, the result is now the same as in Maple (and Mathematica by the way).
Note that RootOf still doesn't have true support for symbolic coefficients,
so either the new algorithm removes all symbolic coefficients or RootOf
will fail with DomainError.
--
You received this message because you are subscribed to the Google Groups
"sympy-patches" group.
To post to this group, send email to sympy-patc...@googlegroups.com.
To unsubscribe from this group, send email to
sympy-patches+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-patches?hl=en.