예제 #1
0
    def fix(self, n):
        from sympy import im, sympify
        from sympy.mpmath import mpmathify

        if im(n) != 0: n = complex(n)
        else: n = float(n)
        n = mpmathify(n)
        n = sympify(n)
        return (n)
예제 #2
0
def test_conversion_to_mpmath():
    assert mpmath.mpmathify(Integer(1)) == mpmath.mpf(1)
    assert mpmath.mpmathify(Rational(1, 2)) == mpmath.mpf(0.5)
    assert mpmath.mpmathify(Float('1.23')) == mpmath.mpf('1.23')
예제 #3
0
def test_conversion_to_mpmath():
    assert mpmath.mpmathify(Integer(1)) == mpmath.mpf(1)
    assert mpmath.mpmathify(Rational(1, 2)) == mpmath.mpf(0.5)
    assert mpmath.mpmathify(Float('1.23', 15)) == mpmath.mpf('1.23')
예제 #4
0
def test_conversion_to_mpmath():
    assert mpmath.mpmathify(Integer(1)) == mpmath.mpf(1)
    assert mpmath.mpmathify(Rational(1, 2)) == mpmath.mpf(0.5)
    assert mpmath.mpmathify(Real("1.23")) == mpmath.mpf("1.23")