Пример #1
0
def _create_evalf_table():
    global evalf_table
    from sympy.functions.combinatorial.numbers import bernoulli
    from sympy.concrete.products import Product
    from sympy.concrete.summations import Sum
    from sympy.core.add import Add
    from sympy.core.mul import Mul
    from sympy.core.numbers import Exp1, Float, Half, ImaginaryUnit, Integer, NaN, NegativeOne, One, Pi, Rational, Zero
    from sympy.core.power import Pow
    from sympy.core.symbol import Dummy, Symbol
    from sympy.functions.elementary.complexes import Abs, im, re
    from sympy.functions.elementary.exponential import exp, log
    from sympy.functions.elementary.integers import ceiling, floor
    from sympy.functions.elementary.piecewise import Piecewise
    from sympy.functions.elementary.trigonometric import atan, cos, sin
    from sympy.integrals.integrals import Integral
    evalf_table = {
        Symbol: evalf_symbol,
        Dummy: evalf_symbol,
        Float: lambda x, prec, options: (x._mpf_, None, prec, None),
        Rational: lambda x, prec, options: (from_rational(x.p, x.q, prec), None, prec, None),
        Integer: lambda x, prec, options: (from_int(x.p, prec), None, prec, None),
        Zero: lambda x, prec, options: (None, None, prec, None),
        One: lambda x, prec, options: (fone, None, prec, None),
        Half: lambda x, prec, options: (fhalf, None, prec, None),
        Pi: lambda x, prec, options: (mpf_pi(prec), None, prec, None),
        Exp1: lambda x, prec, options: (mpf_e(prec), None, prec, None),
        ImaginaryUnit: lambda x, prec, options: (None, fone, None, prec),
        NegativeOne: lambda x, prec, options: (fnone, None, prec, None),
        NaN: lambda x, prec, options: (fnan, None, prec, None),

        exp: lambda x, prec, options: evalf_pow(
            Pow(S.Exp1, x.args[0], evaluate=False), prec, options),

        cos: evalf_trig,
        sin: evalf_trig,

        Add: evalf_add,
        Mul: evalf_mul,
        Pow: evalf_pow,

        log: evalf_log,
        atan: evalf_atan,
        Abs: evalf_abs,

        re: evalf_re,
        im: evalf_im,
        floor: evalf_floor,
        ceiling: evalf_ceiling,

        Integral: evalf_integral,
        Sum: evalf_sum,
        Product: evalf_prod,
        Piecewise: evalf_piecewise,

        bernoulli: evalf_bernoulli,
    }
Пример #2
0
def _create_evalf_table():
    global evalf_table
    from sympy.functions.combinatorial.numbers import bernoulli
    from sympy.concrete.products import Product
    from sympy.concrete.summations import Sum
    from sympy.core.add import Add
    from sympy.core.mul import Mul
    from sympy.core.numbers import Exp1, Float, Half, ImaginaryUnit, Integer, NaN, NegativeOne, One, Pi, Rational, Zero
    from sympy.core.power import Pow
    from sympy.core.symbol import Dummy, Symbol
    from sympy.functions.elementary.complexes import Abs, im, re
    from sympy.functions.elementary.exponential import exp, log
    from sympy.functions.elementary.integers import ceiling, floor
    from sympy.functions.elementary.piecewise import Piecewise
    from sympy.functions.elementary.trigonometric import atan, cos, sin
    from sympy.integrals.integrals import Integral
    evalf_table = {
        Symbol: evalf_symbol,
        Dummy: evalf_symbol,
        Float: lambda x, prec, options: (x._mpf_, None, prec, None),
        Rational: lambda x, prec, options: (from_rational(x.p, x.q, prec), None, prec, None),
        Integer: lambda x, prec, options: (from_int(x.p, prec), None, prec, None),
        Zero: lambda x, prec, options: (None, None, prec, None),
        One: lambda x, prec, options: (fone, None, prec, None),
        Half: lambda x, prec, options: (fhalf, None, prec, None),
        Pi: lambda x, prec, options: (mpf_pi(prec), None, prec, None),
        Exp1: lambda x, prec, options: (mpf_e(prec), None, prec, None),
        ImaginaryUnit: lambda x, prec, options: (None, fone, None, prec),
        NegativeOne: lambda x, prec, options: (fnone, None, prec, None),
        NaN : lambda x, prec, options: (fnan, None, prec, None),

        exp: lambda x, prec, options: evalf_pow(
            Pow(S.Exp1, x.args[0], evaluate=False), prec, options),

        cos: evalf_trig,
        sin: evalf_trig,

        Add: evalf_add,
        Mul: evalf_mul,
        Pow: evalf_pow,

        log: evalf_log,
        atan: evalf_atan,
        Abs: evalf_abs,

        re: evalf_re,
        im: evalf_im,
        floor: evalf_floor,
        ceiling: evalf_ceiling,

        Integral: evalf_integral,
        Sum: evalf_sum,
        Product: evalf_prod,
        Piecewise: evalf_piecewise,

        bernoulli: evalf_bernoulli,
    }
Пример #3
0
def _create_evalf_table():
    global evalf_table
    from ..functions.combinatorial.numbers import bernoulli
    from ..concrete.products import Product
    from ..concrete.summations import Sum
    from .add import Add
    from .mul import Mul
    from .numbers import (Exp1, Float, Half, ImaginaryUnit,
                          Integer, NaN, NegativeOne, One, Pi,
                          Rational, Zero)
    from .power import Pow
    from .symbol import Dummy, Symbol
    from ..functions.elementary.complexes import Abs, im, re
    from ..functions.elementary.exponential import log
    from ..functions.elementary.piecewise import Piecewise
    from ..functions.elementary.trigonometric import atan, cos, sin
    from ..integrals.integrals import Integral
    evalf_table = {
        Symbol: evalf_symbol,
        Dummy: evalf_symbol,
        Float: lambda x, prec, options: (x._mpf_, None, prec if prec <= x._prec else x._prec, None),
        Rational: lambda x, prec, options: (from_rational(x.numerator, x.denominator, prec),
                                            None, prec, None),
        Integer: lambda x, prec, options: (from_int(x.numerator, prec),
                                           None, prec, None),
        Zero: lambda x, prec, options: (None, None, prec, None),
        One: lambda x, prec, options: (fone, None, prec, None),
        Half: lambda x, prec, options: (fhalf, None, prec, None),
        Pi: lambda x, prec, options: (mpf_pi(prec), None, prec, None),
        Exp1: lambda x, prec, options: (mpf_e(prec), None, prec, None),
        ImaginaryUnit: lambda x, prec, options: (None, fone, None, prec),
        NegativeOne: lambda x, prec, options: (fnone, None, prec, None),
        NaN: lambda x, prec, options: (fnan, None, prec, None),

        cos: evalf_trig,
        sin: evalf_trig,

        Add: evalf_add,
        Mul: evalf_mul,
        Pow: evalf_pow,

        log: evalf_log,
        atan: evalf_atan,
        Abs: evalf_abs,

        re: evalf_re,
        im: evalf_im,

        Integral: evalf_integral,
        Sum: evalf_sum,
        Product: evalf_prod,
        Piecewise: evalf_piecewise,

        bernoulli: evalf_bernoulli,
    }
Пример #4
0
def _create_evalf_table():
    global evalf_table
    from ..functions.combinatorial.numbers import bernoulli
    from ..concrete.products import Product
    from ..concrete.summations import Sum
    from .add import Add
    from .mul import Mul
    from .numbers import (Exp1, Float, Half, ImaginaryUnit,
                          Integer, NaN, NegativeOne, One, Pi,
                          Rational, Zero)
    from .power import Pow
    from .symbol import Dummy, Symbol
    from ..functions.elementary.complexes import Abs, im, re
    from ..functions.elementary.exponential import log
    from ..functions.elementary.piecewise import Piecewise
    from ..functions.elementary.trigonometric import atan, cos, sin
    from ..integrals.integrals import Integral
    evalf_table = {
        Symbol: evalf_symbol,
        Dummy: evalf_symbol,
        Float: lambda x, prec, options: (x._mpf_, None, prec if prec <= x._prec else x._prec, None),
        Rational: lambda x, prec, options: (from_rational(x.numerator, x.denominator, prec),
                                            None, prec, None),
        Integer: lambda x, prec, options: (from_int(x.numerator, prec),
                                           None, prec, None),
        Zero: lambda x, prec, options: (None, None, prec, None),
        One: lambda x, prec, options: (fone, None, prec, None),
        Half: lambda x, prec, options: (fhalf, None, prec, None),
        Pi: lambda x, prec, options: (mpf_pi(prec), None, prec, None),
        Exp1: lambda x, prec, options: (mpf_e(prec), None, prec, None),
        ImaginaryUnit: lambda x, prec, options: (None, fone, None, prec),
        NegativeOne: lambda x, prec, options: (fnone, None, prec, None),
        NaN: lambda x, prec, options: (fnan, None, prec, None),

        cos: evalf_trig,
        sin: evalf_trig,

        Add: evalf_add,
        Mul: evalf_mul,
        Pow: evalf_pow,

        log: evalf_log,
        atan: evalf_atan,
        Abs: evalf_abs,

        re: evalf_re,
        im: evalf_im,

        Integral: evalf_integral,
        Sum: evalf_sum,
        Product: evalf_prod,
        Piecewise: evalf_piecewise,

        bernoulli: evalf_bernoulli,
    }
Пример #5
0
def _create_evalf_table():
    global evalf_table
    evalf_table = {
        C.Symbol: evalf_symbol,
        C.Dummy: evalf_symbol,
        C.Float: lambda x, prec, options: (x._mpf_, None, prec, None),
        C.Rational: lambda x, prec, options: (from_rational(x.p, x.q, prec), None, prec, None),
        C.Integer: lambda x, prec, options: (from_int(x.p, prec), None, prec, None),
        C.Zero: lambda x, prec, options: (None, None, prec, None),
        C.One: lambda x, prec, options: (fone, None, prec, None),
        C.Half: lambda x, prec, options: (fhalf, None, prec, None),
        C.Pi: lambda x, prec, options: (mpf_pi(prec), None, prec, None),
        C.Exp1: lambda x, prec, options: (mpf_e(prec), None, prec, None),
        C.ImaginaryUnit: lambda x, prec, options: (None, fone, None, prec),
        C.NegativeOne: lambda x, prec, options: (fnone, None, prec, None),
        C.NaN : lambda x, prec, options: (fnan, None, prec, None),

        C.exp: lambda x, prec, options: evalf_pow(C.Pow(S.Exp1, x.args[0],
        evaluate=False), prec, options),

        C.cos: evalf_trig,
        C.sin: evalf_trig,

        C.Add: evalf_add,
        C.Mul: evalf_mul,
        C.Pow: evalf_pow,

        C.log: evalf_log,
        C.atan: evalf_atan,
        C.Abs: evalf_abs,

        C.re: evalf_re,
        C.im: evalf_im,
        C.floor: evalf_floor,
        C.ceiling: evalf_ceiling,

        C.Integral: evalf_integral,
        C.Sum: evalf_sum,
        C.Product: evalf_prod,
        C.Piecewise: evalf_piecewise,

        C.bernoulli: evalf_bernoulli,
    }