Comments (1)
pdb session:
s = (1, 2307248397882377, 7733869802996217998, 52)
def to_rational(s):
"""Convert a raw mpf to a rational number. Return integers (p, q)
such that s = p/q exactly."""
sign, man, exp, bc = s
if sign:
man = -man
if bc == -1:
raise ValueError("cannot convert %s to a rational number" % man)
if exp >= 0:
> return man * (1<<exp), 1
E MemoryError
../../.virtualenvs/test/lib/python3.4/site-packages/mpmath-0.19-py3.4.egg/mpmath/libmp/libmpf.py:479: MemoryError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /home/sk/.virtualenvs/test/lib/python3.4/site-packages/mpmath-0.19-py3.4.egg/mpmath/libmp/libmpf.py(479)to_rational()
-> return man * (1<<exp), 1
(Pdb) u
> /home/sk/src/omg/sympy/polys/domains/mpelements.py(121)to_rational()
-> p, q = to_rational(s._mpf_)
(Pdb) p s
-5.50575083743024e+2328126793261746619
(Pdb) u
> /home/sk/src/omg/sympy/polys/domains/realfield.py(98)to_rational()
-> return self._context.to_rational(element, limit)
(Pdb) u
> /home/sk/src/omg/sympy/polys/domains/pythonrationalfield.py(61)from_RealField()
-> p, q = K0.to_rational(a)
(Pdb) p a
-5.50575083743024e+2328126793261746619
(Pdb) u
> /home/sk/src/omg/sympy/polys/domains/domain.py(83)convert_from()
-> result = _convert(element, base)
(Pdb) u
> /home/sk/src/omg/sympy/polys/domains/domain.py(93)convert()
-> return self.convert_from(element, base)
(Pdb) u
> /home/sk/src/omg/sympy/polys/densebasic.py(489)<listcomp>()
-> return dup_strip([ K1.convert(c, K0) for c in f ])
(Pdb) p f
*** NameError: name 'f' is not defined
(Pdb) u
> /home/sk/src/omg/sympy/polys/densebasic.py(489)dup_convert()
-> return dup_strip([ K1.convert(c, K0) for c in f ])
(Pdb) p f
[-5.50575083743024e+2328126793261746619, 0.0]
(Pdb) u
> /home/sk/src/omg/sympy/polys/densebasic.py(510)dmp_convert()
-> return dup_convert(f, K0, K1)
(Pdb) u
> /home/sk/src/omg/sympy/polys/densebasic.py(516)<listcomp>()
-> return dmp_strip([ dmp_convert(c, v, K0, K1) for c in f ], u)
(Pdb) u
> /home/sk/src/omg/sympy/polys/densebasic.py(516)dmp_convert()
-> return dmp_strip([ dmp_convert(c, v, K0, K1) for c in f ], u)
(Pdb) p f
[[-5.50575083743024e+2328126793261746619, 0.0], [1.0]]
(Pdb) u
> /home/sk/src/omg/sympy/polys/euclidtools.py(1509)_dmp_inner_gcd()
-> f = dmp_convert(f, u, K, exact)
(Pdb) u
> /home/sk/src/omg/sympy/polys/euclidtools.py(1561)dmp_inner_gcd()
-> h, cff, cfg = _dmp_inner_gcd(f, g, u, K)
(Pdb) p f, g, u, K
([[-5.50575083743024e+2328126793261746619, 0.0], [1.0]], [[1.0, 0.0], []], 1, RR)
(Pdb) u
> /home/sk/src/omg/sympy/polys/euclidtools.py(1844)dmp_cancel()
-> _, p, q = dmp_inner_gcd(f, g, u, K)
(Pdb) u
> /home/sk/src/omg/sympy/polys/polyclasses.py(681)cancel()
-> cF, cG, F, G = dmp_cancel(F, G, lev, dom, include=False)
(Pdb) p F, G
([[-5.50575083743024e+2328126793261746619, 0.0], [1.0]], [[1.0, 0.0], []])
(Pdb) u
> /home/sk/src/omg/sympy/polys/polytools.py(3428)cancel()
-> result = F.cancel(G, include=include)
(Pdb) p F
DMP([[-5.50575083743024e+2328126793261746619, 0.0], [1.0]], RR, None)
(Pdb) p G
DMP([[1.0, 0.0], []], RR, None)
(Pdb) u
> /home/sk/src/omg/sympy/polys/polytools.py(6201)cancel()
-> c, P, Q = F.cancel(G)
(Pdb) p F, G
(Poly(Add(Float('1.0', prec=15), Mul(Integer(-1), Float('5.5057508374302426e+2328126793261746619', prec=15), E, Pow(E, Mul(Integer(-1), Pow(E, Mul(Integer(-1), EulerGamma))))))), Poly(Mul(Float('1.0', prec=15), E, Pow(E, Mul(Integer(-1), Pow(E, Mul(Integer(-1), EulerGamma)))))))
(Pdb) from sympy import pprint
(Pdb) pprint(F)
Poly(-5.50575083743024e+2328126793261746619*E*E**(-E**(-EulerGamma)) + 1.0, E, E**(-E**(-EulerGamma)), domain='RR')
(Pdb) u
> /home/sk/src/omg/sympy/simplify/simplify.py(607)simplify()
-> _e = cancel(expr)
(Pdb) p expr
Mul(Pow(E, Mul(Pow(E, Mul(Integer(-1), EulerGamma)), Add(Mul(Integer(-1), Pow(E, EulerGamma)), Integer(1)))), Add(Integer(1), Mul(Integer(-1), Float('5.5057508374302426e+2328126793261746619', prec=15), Pow(E, Mul(Integer(-1), Pow(E, Mul(Integer(-1), EulerGamma)), Add(Mul(Integer(-1), Pow(E, EulerGamma)), Integer(1)))))))
(Pdb) pprint(expr)
*** NameError: name 'pprint' is not defined
(Pdb) from sympy import pprint
(Pdb) pprint(expr)
-EulerGamma / EulerGamma \ / -EulerGamma / EulerGamma \\
E *\- E + 1/ | -E *\- E + 1/|
E *\1 - 5.50575083743024e+2328126793261746619*E /
(Pdb) u
> /home/sk/src/omg/sympy/core/expr.py(3033)simplify()
-> return simplify(self, ratio, measure)
(Pdb) u
> /home/sk/src/omg/sympy/core/expr.py(604)equals()
-> diff = factor_terms((self - other).simplify(), radical=True)
(Pdb) from sympy import pprint
(Pdb) pprint(other)
5.50575083743024e+2328126793261746619
(Pdb) pprint(self)
-EulerGamma
-1 + E
E
(Pdb) u
> /home/sk/src/omg/sympy/core/expr.py(545)is_constant()
-> if b is not None and b is not S.NaN and b.equals(a) is False:
(Pdb) args
self = Mul(Pow(E, Add(Pow(E, polygamma(Integer(0), Symbol('x', real=True, positive=True))), Mul(Integer(-1), Symbol('x', real=True, positive=True)))), Pow(Dummy('w', real=True, positive=True), Integer(-1)))
wrt = {Dummy('w', real=True, positive=True), Symbol('x', real=True, positive=True)}
flags = {'simplify': False, 'failing_number': True}
(Pdb) from sympy import pprint
(Pdb) pprint(self)
polygamma(0, x)
E - x
E
---------------------
w
(Pdb) pprint(expr)
polygamma(0, x)
E - x
E
---------------------
w
(Pdb) pprint(a)
5.50575083743024e+2328126793261746619
(Pdb) pprint(b)
-EulerGamma
-1 + E
E
(Pdb) pprint(b.n())
0.644977067918515
(Pdb)
from diofant.
Related Issues (20)
- Use cacheit for domains/polys
- Wrong test test_sympyissue_21785() HOT 2
- Provide access to the unicode_identifiers() transformer
- Enable algebraic extensions per default (extension=True now)
- Use solve_surd_system() instead of unrad()
- simplify/validate all helpers for exp/log series HOT 1
- Use mutable attributes instead of PolyElement.set_domain/ring?
- Wrong substitution in Derivative
- Document all xfail'ed tests
- Support git-archive for the repo
- Automatically expand with series() expressions with O terms
- Don't test _eval_foo helpers directly in tests HOT 1
- Support complex intervals in Piecewise._eval_interval()?
- Incorrect Prover._process_rule() if b is And?
- Refactior pprint helpers for Piecewise, hyper and meijerg
- FIXME in diofant/tensor/index_methods.py
- Get rid of packaging dependency
- Remove various workarouds with the new mpmath release
- Wrong limit for elliptic_k on the branch but
- Support ProductOrder's in core
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diofant.