Example #1
0
    def __init__(self):
        r"""
        Initialize ``self``.

        EXAMPLES::

            sage: erfinv(2)._sympy_()
            erfinv(2)
            sage: maxima(erfinv(2))
            inverse_erf(2)

        TESTS:

        Check that :trac:`11349` is fixed::

            sage: _ = var('z,t')
            sage: PDF = exp(-x^2 /2)/sqrt(2*pi)
            sage: integralExpr = integrate(PDF,x,z,oo).subs(z==log(t))
            sage: y = solve(integralExpr==z,t)[0].rhs().subs(z==1/4)    
            sage: y
            e^(sqrt(2)*erfinv(1/2))
            sage: y.n()
            1.96303108415826
        """
        BuiltinFunction.__init__(self, "erfinv",
                                 latex_name=r"\operatorname{erfinv}",
                                 conversions=dict(sympy='erfinv',
                                                  maxima='inverse_erf'))
Example #2
0
    def __init__(self):
        r"""
        The unit step function, ``unit_step(x)``.

        INPUT:

        -  ``x`` - a real number or a symbolic expression

        EXAMPLES:

            sage: unit_step(-1)
            0
            sage: unit_step(1)
            1
            sage: unit_step(0)
            1
            sage: unit_step(x)
            unit_step(x)
            sage: latex(unit_step(x))
            \mathrm{u}\left(x\right)

        TESTS::

            sage: t = loads(dumps(unit_step(x)+1)); t
            unit_step(x) + 1
            sage: t.subs(x=0)
            2
        """
        BuiltinFunction.__init__(self, "unit_step", latex_name=r"\mathrm{u}",
                                   conversions=dict(mathematica='UnitStep'))
Example #3
0
    def __init__(self):
        """
        The arccosecant function.

        EXAMPLES::

            sage: arccsc(2)
            arccsc(2)
            sage: RDF(arccsc(2))  # rel tol 1e-15
            0.5235987755982988
            sage: arccsc(1 + I)
            arccsc(I + 1)

        We can delay evaluation using the ``hold`` parameter::

            sage: arccsc(1,hold=True)
            arccsc(1)

        To then evaluate again, we currently must use Maxima via
        :meth:`sage.symbolic.expression.Expression.simplify`::

            sage: a = arccsc(1,hold=True); a.simplify()
            1/2*pi

        """
        BuiltinFunction.__init__(self, "arccsc", latex_name=r'{\rm arccsc}',
                                   conversions=dict(maxima='acsc'))
Example #4
0
    def __init__(self):
        r"""
        The generalized derivative of the Airy Ai function

        INPUT:

        - ``alpha`` -- Return the `\alpha`-th order fractional derivative with
          respect to `z`.
          For `\alpha = n = 1,2,3,\ldots` this gives the derivative
          `\operatorname{Ai}^{(n)}(z)`, and for `\alpha = -n = -1,-2,-3,\ldots`
          this gives the `n`-fold iterated integral.

        .. MATH::

            f_0(z) = \operatorname{Ai}(z)

            f_n(z) = \int_0^z f_{n-1}(t) dt

        - ``x`` -- The argument of the function

        EXAMPLES::

            sage: from sage.functions.airy import airy_ai_general
            sage: x, n = var('x n')
            sage: airy_ai_general(-2, x)
            airy_ai(-2, x)
            sage: derivative(airy_ai_general(-2, x), x)
            airy_ai(-1, x)
            sage: airy_ai_general(n, x)
            airy_ai(n, x)
            sage: derivative(airy_ai_general(n, x), x)
            airy_ai(n + 1, x)
        """
        BuiltinFunction.__init__(self, "airy_ai", nargs=2,
                                 latex_name=r"\operatorname{Ai}")
Example #5
0
    def __init__(self):
        r"""
        The Dirac delta (generalized) function, ``dirac_delta(x)``.

        INPUT:

        -  ``x`` - a real number or a symbolic expression

        EXAMPLES::

            sage: dirac_delta(1)
            0
            sage: dirac_delta(0)
            dirac_delta(0)
            sage: dirac_delta(x)
            dirac_delta(x)
            sage: latex(dirac_delta(x))
            \delta\left(x\right)

            sage: loads(dumps(dirac_delta(x)))
            dirac_delta(x)
        """
        BuiltinFunction.__init__(self, "dirac_delta", latex_name=r"\delta",
                                   conversions=dict(maxima='delta',
                                    mathematica='DiracDelta'))
Example #6
0
    def __init__(self):
        r"""
        The Heaviside step function, ``heaviside(x)``.

        INPUT:

        -  ``x`` - a real number or a symbolic expression

        EXAMPLES::

            sage: heaviside(-1)
            0
            sage: heaviside(1)
            1
            sage: heaviside(0)
            heaviside(0)
            sage: heaviside(x)
            heaviside(x)
            sage: latex(heaviside(x))
            H\left(x\right)
        """
        BuiltinFunction.__init__(self, "heaviside", latex_name="H",
                                 conversions=dict(maxima='hstep',
                                                  mathematica='HeavisideTheta',
                                                  sympy='Heaviside'))
Example #7
0
    def __init__(self):
        """
        Class to represent an indefinite integral.

        EXAMPLES::

            sage: from sage.symbolic.integration.integral import indefinite_integral
            sage: indefinite_integral(log(x), x) #indirect doctest
            x*log(x) - x
            sage: indefinite_integral(x^2, x)
            1/3*x^3
            sage: indefinite_integral(4*x*log(x), x)
            2*x^2*log(x) - x^2
            sage: indefinite_integral(exp(x), 2*x)
            2*e^x

        """
        # The automatic evaluation routine will try these integrators
        # in the given order. This is an attribute of the class instead of
        # a global variable in this module to enable customization by
        # creating a subclasses which define a different set of integrators
        self.integrators = [external.maxima_integrator]

        BuiltinFunction.__init__(self, "integrate", nargs=2, conversions={'sympy': 'Integral',
                                                                          'giac': 'integrate'})
Example #8
0
    def __init__(self):
        """
        Return the value of the complex exponential integral Ei(z) at a
        complex number z.

        EXAMPLES::

            sage: Ei(10)
            Ei(10)
            sage: Ei(I)
            Ei(I)
            sage: Ei(3+I)
            Ei(I + 3)
            sage: Ei(1.3)
            2.72139888023202

        The branch cut for this function is along the negative real axis::

            sage: Ei(-3 + 0.1*I)
            -0.0129379427181693 + 3.13993830250942*I
            sage: Ei(-3 - 0.1*I)
            -0.0129379427181693 - 3.13993830250942*I

        ALGORITHM: Uses mpmath.
        """
        BuiltinFunction.__init__(self, "Ei",
                                 conversions=dict(maxima='expintegral_ei'))
Example #9
0
    def __init__(self):
        r"""
        Symbolic `\min` function.

        The Python builtin `\min` function doesn't work as expected when symbolic
        expressions are given as arguments. This function delays evaluation
        until all symbolic arguments are substituted with values.

        EXAMPLES::

            sage: min_symbolic(3, x)
            min(3, x)
            sage: min_symbolic(3, x).subs(x=5)
            3
            sage: min_symbolic(3, 5, x)
            min(x, 3)
            sage: min_symbolic([3,5,x])
            min(x, 3)

        TESTS::

            sage: loads(dumps(min_symbolic(x,5)))
            min(x, 5)
            sage: latex(min_symbolic(x,5))
            \min\left(x, 5\right)
            sage: min_symbolic(x, 5)._sympy_()
            Min(5, x)
        """
        BuiltinFunction.__init__(self, 'min', nargs=0, latex_name="\min",
                                 conversions=dict(sympy='Min'))
Example #10
0
File: trig.py Project: CETHop/sage
    def __init__(self):
        r"""
        The cosecant function.

        EXAMPLES::

            sage: csc(pi/4)
            sqrt(2)
            sage: RR(csc(pi/4))
            1.41421356237310
            sage: n(csc(pi/4),100)
            1.4142135623730950488016887242
            sage: csc(1/2)
            csc(1/2)
            sage: csc(0.5)
            2.08582964293349

            sage: latex(csc(x))
            \csc\left(x\right)

        We can prevent evaluation using the ``hold`` parameter::

            sage: csc(pi/4,hold=True)
            csc(1/4*pi)

        To then evaluate again, we currently must use Maxima via
        :meth:`sage.symbolic.expression.Expression.simplify`::

            sage: a = csc(pi/4,hold=True); a.simplify()
            sqrt(2)

        """
        BuiltinFunction.__init__(self, "csc", latex_name=r"\csc")
Example #11
0
File: trig.py Project: CETHop/sage
    def __init__(self):
        r"""
        The cotangent function.

        EXAMPLES::

            sage: cot(pi/4)
            1
            sage: RR(cot(pi/4))
            1.00000000000000
            sage: cot(1/2)
            cot(1/2)
            sage: cot(0.5)
            1.83048772171245

            sage: latex(cot(x))
            \cot\left(x\right)

        We can prevent evaluation using the ``hold`` parameter::

            sage: cot(pi/4,hold=True)
            cot(1/4*pi)

        To then evaluate again, we currently must use Maxima via
        :meth:`sage.symbolic.expression.Expression.simplify`::

            sage: a = cot(pi/4,hold=True); a.simplify()
            1

        """
        BuiltinFunction.__init__(self, "cot", latex_name=r"\cot")
Example #12
0
File: trig.py Project: CETHop/sage
    def __init__(self):
        """
        The arccotangent function.

        EXAMPLES::

            sage: arccot(1/2)
            arccot(1/2)
            sage: RDF(arccot(1/2))
            1.10714871779
            sage: arccot(1 + I)
            arccot(I + 1)

        We can delay evaluation using the ``hold`` parameter::

            sage: arccot(1,hold=True)
            arccot(1)

        To then evaluate again, we currently must use Maxima via
        :meth:`sage.symbolic.expression.Expression.simplify`::

            sage: a = arccot(1,hold=True); a.simplify()
            1/4*pi

        """
        BuiltinFunction.__init__(self, "arccot", latex_name=r'{\rm arccot}',
                conversions=dict(maxima='acot', sympy='acot'))
Example #13
0
    def __init__(self):
        r"""
        The incomplete gamma function.

        EXAMPLES::

            sage: gamma_inc(CDF(0,1), 3)
            0.00320857499337 + 0.0124061858119*I
            sage: gamma_inc(RDF(1), 3)
            0.0497870683678639
            sage: gamma_inc(3,2)
            gamma(3, 2)
            sage: gamma_inc(x,0)
            gamma(x)
            sage: latex(gamma_inc(3,2))
            \Gamma\left(3, 2\right)
            sage: loads(dumps((gamma_inc(3,2))))
            gamma(3, 2)
            sage: i = ComplexField(30).0; gamma_inc(2, 1 + i)
            0.70709210 - 0.42035364*I
            sage: gamma_inc(2., 5)
            0.0404276819945128
        """
        BuiltinFunction.__init__(self, "gamma", nargs=2, latex_name=r"\Gamma",
                conversions={'maxima':'gamma_incomplete', 'mathematica':'Gamma',
                    'maple':'GAMMA'})
Example #14
0
    def __init__(self):
        r"""
        Symbolic `\max` function.

        The Python builtin `\max` function doesn't work as expected when symbolic
        expressions are given as arguments. This function delays evaluation
        until all symbolic arguments are substituted with values.

        EXAMPLES::

            sage: max_symbolic(3, x)
            max(3, x)
            sage: max_symbolic(3, x).subs(x=5)
            5
            sage: max_symbolic(3, 5, x)
            max(x, 5)
            sage: max_symbolic([3,5,x])
            max(x, 5)

        TESTS::

            sage: loads(dumps(max_symbolic(x,5)))
            max(x, 5)
            sage: latex(max_symbolic(x,5))
            \max\left(x, 5\right)
        """
        BuiltinFunction.__init__(self, 'max', nargs=0, latex_name="\max")
Example #15
0
    def __init__(self):
        """
        The secant function

        EXAMPLES::

            sage: sec(pi/4)
            sqrt(2)
            sage: RR(sec(pi/4))
            1.41421356237310
            sage: n(sec(pi/4),100)
            1.4142135623730950488016887242       
            sage: sec(1/2)
            sec(1/2)
            sage: sec(0.5)
            1.13949392732455

            sage: latex(sec(x))
            \sec\left(x\right)

        We can prevent evaluation using the ``hold`` parameter::

            sage: sec(pi/4,hold=True)
            sec(1/4*pi)

        To then evaluate again, we currently must use Maxima via
        :meth:`sage.symbolic.expression.Expression.simplify`::

            sage: a = sec(pi/4,hold=True); a.simplify()
            sqrt(2)

        """
        BuiltinFunction.__init__(self, "sec", latex_name=r"\sec")
Example #16
0
File: trig.py Project: CETHop/sage
    def __init__(self):
        """
        The arcsecant function.

        EXAMPLES::

            sage: arcsec(2)
            arcsec(2)
            sage: RDF(arcsec(2))
            1.0471975512
            sage: arcsec(1 + I)
            arcsec(I + 1)

        We can delay evaluation using the ``hold`` parameter::

            sage: arcsec(1,hold=True)
            arcsec(1)

        To then evaluate again, we currently must use Maxima via
        :meth:`sage.symbolic.expression.Expression.simplify`::

            sage: a = arcsec(1,hold=True); a.simplify()
            0

        """
        BuiltinFunction.__init__(self, "arcsec", latex_name=r'{\rm arcsec}',
                                   conversions=dict(maxima='asec'))
Example #17
0
    def __init__(self):
        r"""
        EXAMPLES::

            sage: loads(dumps(elliptic_eu))
            elliptic_eu
        """
        BuiltinFunction.__init__(self, 'elliptic_eu', nargs=2,
                                 conversions=dict(maxima='elliptic_eu'))
Example #18
0
    def __init__(self):
        """
        TESTS::

            sage: Ei(10)
            Ei(10)
            sage: Ei(x)._sympy_()
            Ei(x)
        """
        BuiltinFunction.__init__(self, "Ei", conversions=dict(maxima="expintegral_ei", sympy="Ei"))
Example #19
0
    def __init__(self):
        r"""
        EXAMPLES::

            sage: loads(dumps(harmonic_number(x,5)))
            harmonic_number(x, 5)
            sage: harmonic_number(x, x)._sympy_()
            harmonic(x, x)
        """
        BuiltinFunction.__init__(self, "harmonic_number", nargs=2,
                conversions={'sympy':'harmonic'})
Example #20
0
    def __init__(self):
        r"""
        TESTS::

            sage: latex(hurwitz_zeta(x, 2))
            \zeta\left(x, 2\right)
            sage: hurwitz_zeta(x, 2)._sympy_()
            zeta(x, 2)
        """
        BuiltinFunction.__init__(
            self, "hurwitz_zeta", nargs=2, conversions=dict(mathematica="HurwitzZeta", sympy="zeta"), latex_name="\zeta"
        )
Example #21
0
    def __init__(self):
        r"""
        See the docstring for :meth:`Function_lambert_w`.

        EXAMPLES::

            sage: lambert_w(0, 1.0)
            0.567143290409784
        """
        BuiltinFunction.__init__(self, "lambert_w", nargs=2,
                                 conversions={'mathematica':'ProductLog',
                                              'maple':'LambertW'})
Example #22
0
    def __init__(self):
        """
        See the docstring for ``Function_log_integral-offset``.

        EXAMPLES::

            sage: log_integral_offset(3)
            log_integral(3) - log_integral(2)

        """
        BuiltinFunction.__init__(self, "log_integral_offset", nargs=1,
                                 latex_name=r'log_integral_offset')
Example #23
0
File: log.py Project: sagemath/sage
    def __init__(self):
        r"""
        Representation of a complex number in a polar form.

        INPUT:

        - ``z`` - a complex number `z = a + ib`.

        OUTPUT:

        A complex number with modulus `\exp(a)` and argument `b`.

        If `-\pi < b \leq \pi` then `\operatorname{exp\_polar}(z)=\exp(z)`.
        For other values of `b` the function is left unevaluated.

        EXAMPLES:

        The following expressions are evaluated using the exponential
        function::

            sage: exp_polar(pi*I/2)
            I
            sage: x = var('x', domain='real')
            sage: exp_polar(-1/2*I*pi + x)
            e^(-1/2*I*pi + x)

        The function is left unevaluated when the imaginary part of the
        input `z` does not satisfy `-\pi < \Im(z) \leq \pi`::

            sage: exp_polar(2*pi*I)
            exp_polar(2*I*pi)
            sage: exp_polar(-4*pi*I)
            exp_polar(-4*I*pi)

        This fixes :trac:`18085`::

            sage: integrate(1/sqrt(1+x^3),x,algorithm='sympy')
            1/3*x*gamma(1/3)*hypergeometric((1/3, 1/2), (4/3,), -x^3)/gamma(4/3)


        .. SEEALSO::

            `Examples in Sympy documentation <http://docs.sympy.org/latest/modules/functions/special.html?highlight=exp_polar>`_,
            `Sympy source code of exp_polar <http://docs.sympy.org/0.7.4/_modules/sympy/functions/elementary/exponential.html>`_

        REFERENCES:

            :wikipedia:`Complex_number#Polar_form`
        """
        BuiltinFunction.__init__(self, "exp_polar",
                                latex_name=r"\operatorname{exp\_polar}",
                                conversions=dict(sympy='exp_polar'))
Example #24
0
    def __init__(self):
        """
        See the docstring for :class:`Function_cos_integral`.

        EXAMPLES::

            sage: cos_integral(1)
            cos_integral(1)

        """
        BuiltinFunction.__init__(self, "cos_integral", nargs=1,
                                 latex_name=r'\operatorname{Ci}',
                                 conversions=dict(maxima='expintegral_ci'))
Example #25
0
    def __init__(self):
        """
        See the docstring for :meth:`Function_Bessel_K`.

        EXAMPLES::

            sage: sage.functions.bessel.Function_Bessel_K()
            bessel_K
        """
        BuiltinFunction.__init__(self, "bessel_K", nargs=2,
                                 conversions=dict(mathematica='BesselK',
                                                  maxima='bessel_k',
                                                  sympy='besselk'))
Example #26
0
    def __init__(self):
        """
        See the docstring for ``Function_log_integral``.

        EXAMPLES::

            sage: log_integral(3)
            log_integral(3)

        """
        BuiltinFunction.__init__(self, "log_integral", nargs=1,
                                 latex_name=r'log_integral',
                                 conversions=dict(maxima='expintegral_li'))
Example #27
0
    def __init__(self):
        """
        TESTS::

            sage: Ei(10)
            Ei(10)
            sage: Ei(x)._sympy_()
            Ei(x)
        """
        BuiltinFunction.__init__(self,
                                 "Ei",
                                 conversions=dict(maxima='expintegral_ei',
                                                  sympy='Ei'))
Example #28
0
    def __init__(self):
        """
        See the docstring for :meth:`Function_exp_integral_e`.

        EXAMPLES::

            sage: exp_integral_e(1,0)
            exp_integral_e(1, 0)

        """
        BuiltinFunction.__init__(self, "exp_integral_e", nargs=2,
                                 latex_name=r'exp_integral_e',
                                 conversions=dict(maxima='expintegral_e'))
Example #29
0
    def __init__(self):
        """
        See the docstring for :class:`Function_exp_integral_e1`.

        EXAMPLES::

            sage: exp_integral_e1(1)
            exp_integral_e1(1)

        """
        BuiltinFunction.__init__(self, "exp_integral_e1", nargs=1,
                                 latex_name=r'exp_integral_e1',
                                 conversions=dict(maxima='expintegral_e1'))
Example #30
0
    def __init__(self):
        """
        See the docstring for :meth:`Function_Bessel_I`.

        EXAMPLES::

            sage: bessel_I(1,x)
            bessel_I(1, x)
        """
        BuiltinFunction.__init__(self, "bessel_I", nargs=2,
                                 conversions=dict(mathematica='BesselI',
                                                  maxima='bessel_i',
                                                  sympy='besseli'))
Example #31
0
    def __init__(self):
        """
        See the docstring for ``Function_sin_integral``.

        EXAMPLES::

            sage: sin_integral(1)
            sin_integral(1)

        """
        BuiltinFunction.__init__(self, "sin_integral", nargs=1,
                                 latex_name=r'\operatorname{Si}',
                                 conversions=dict(maxima='expintegral_si'))
Example #32
0
    def __init__(self):
        r"""
        Representation of a complex number in a polar form.

        INPUT:

        - ``z`` - a complex number `z = a + ib`.

        OUTPUT:

        A complex number with modulus `\exp(a)` and argument `b`.

        If `-\pi < b \leq \pi` then `\operatorname{exp\_polar}(z)=\exp(z)`.
        For other values of `b` the function is left unevaluated.

        EXAMPLES:

        The following expressions are evaluated using the exponential
        function::

            sage: exp_polar(pi*I/2)
            I       
            sage: x = var('x', domain='real')
            sage: exp_polar(-1/2*I*pi + x)
            e^(-1/2*I*pi + x)

        The function is left unevaluated when the imaginary part of the
        input `z` does not satisfy `-\pi < \Im(z) \leq \pi`::

            sage: exp_polar(2*pi*I)
            exp_polar(2*I*pi)
            sage: exp_polar(-4*pi*I)
            exp_polar(-4*I*pi)

        This fixes :trac:`18085`::

            sage: integrate(1/sqrt(1+x^3),x,algorithm='sympy')
            1/3*x*hypergeometric((1/3, 1/2), (4/3,), -x^3)*gamma(1/3)/gamma(4/3)

        SEEALSO:

            `Examples in Sympy documentation <http://docs.sympy.org/latest/modules/functions/special.html?highlight=exp_polar>`_,
            `Sympy source code of exp_polar <http://docs.sympy.org/0.7.4/_modules/sympy/functions/elementary/exponential.html>`_

        REFERENCES:

            :wikipedia:`Complex_number#Polar_form`
        """
        BuiltinFunction.__init__(self, "exp_polar",
                                latex_name=r"\operatorname{exp\_polar}",
                                conversions=dict(sympy='exp_polar'))
Example #33
0
    def __init__(self):
        """
        See the docstring for ``Function_log_integral-offset``.

        EXAMPLES::

            sage: log_integral_offset(3)
            log_integral(3) - log_integral(2)

        """
        BuiltinFunction.__init__(self,
                                 "log_integral_offset",
                                 nargs=1,
                                 latex_name=r'log_integral_offset')
Example #34
0
    def __init__(self):
        r"""
        TESTS::

            sage: n, m, theta, phi = var('n m theta phi')
            sage: spherical_harmonic(n, m, theta, phi)._sympy_()
            Ynm(n, m, theta, phi)
        """
        BuiltinFunction.__init__(self, 'spherical_harmonic', nargs=4,
                                 conversions=dict(
                                    maple='SphericalY',
                                    mathematica= 'SphericalHarmonicY',
                                    maxima='spherical_harmonic',
                                    sympy='Ynm'))
Example #35
0
    def __init__(self, name, nargs=2, conversions={}):
        """
        EXAMPLES::

            sage: from sage.functions.special import MaximaFunction
            sage: f = MaximaFunction("jacobi_sn")
            sage: f(1,1)
            tanh(1)
            sage: f(1/2,1/2).n()
            0.470750473655657
        """
        c = dict(maxima=name)
        c.update(conversions)
        BuiltinFunction.__init__(self, name=name, nargs=nargs, conversions=c)
Example #36
0
    def __init__(self):
        r"""
        See the docstring for :meth:`Function_lambert_w`.

        EXAMPLES::

            sage: lambert_w(0, 1.0)
            0.567143290409784
        """
        BuiltinFunction.__init__(self, "lambert_w", nargs=2,
                                 conversions={'mathematica': 'ProductLog',
                                              'maple': 'LambertW',
                                              'matlab': 'lambertw',
                                              'maxima': 'generalized_lambert_w'})
Example #37
0
 def __init__(self):
     """
     Initialize class.
     
     EXAMPLES::
     
         sage: maxima(hypergeometric)
         hypergeometric
     """
     BuiltinFunction.__init__(self, 'hypergeometric', nargs=3,
                              conversions={'mathematica':
                                           'HypergeometricPFQ',
                                           'maxima': 'hypergeometric',
                                           'sympy': 'hyper'})
Example #38
0
 def __init__(self):
     """
     EXAMPLES::
 
         sage: loads(dumps(elliptic_kc))
         elliptic_kc
         sage: elliptic_kc(x)._sympy_()
         elliptic_k(x)
     """
     BuiltinFunction.__init__(self, 'elliptic_kc', nargs=1, latex_name='K',
                              conversions=dict(mathematica='EllipticK',
                                               maxima='elliptic_kc',
                                               sympy='elliptic_k',
                                               fricas='ellipticK'))
Example #39
0
    def __init__(self):
        """
        See the docstring for :class:`Function_exp_integral_e1`.

        EXAMPLES::

            sage: exp_integral_e1(1)
            exp_integral_e1(1)

        """
        BuiltinFunction.__init__(self,
                                 "exp_integral_e1",
                                 nargs=1,
                                 latex_name=r'exp_integral_e1',
                                 conversions=dict(maxima='expintegral_e1'))
Example #40
0
    def __init__(self):
        """
        See the docstring for :meth:`Function_Bessel_K`.

        EXAMPLES::

            sage: sage.functions.bessel.Function_Bessel_K()
            bessel_K
        """
        BuiltinFunction.__init__(self,
                                 "bessel_K",
                                 nargs=2,
                                 conversions=dict(mathematica='BesselK',
                                                  maxima='bessel_k',
                                                  sympy='besselk'))
Example #41
0
    def __init__(self):
        """
        See the docstring for :meth:`Function_Bessel_I`.

        EXAMPLES::

            sage: bessel_I(1,x)
            bessel_I(1, x)
        """
        BuiltinFunction.__init__(self,
                                 "bessel_I",
                                 nargs=2,
                                 conversions=dict(mathematica='BesselI',
                                                  maxima='bessel_i',
                                                  sympy='besseli'))
Example #42
0
    def __init__(self):
        """
        See the docstring for :meth:`Function_Bessel_Y`.

        EXAMPLES::

            sage: sage.functions.bessel.Function_Bessel_Y()(0, x)
            bessel_Y(0, x)
        """
        BuiltinFunction.__init__(self,
                                 "bessel_Y",
                                 nargs=2,
                                 conversions=dict(mathematica='BesselY',
                                                  maxima='bessel_y',
                                                  sympy='bessely'))
Example #43
0
    def __init__(self):
        r"""
        EXAMPLES::

            sage: maxima(erfc(2))
            erfc(2)
            sage: erfc(2)._sympy_()
            erfc(2)
        """
        BuiltinFunction.__init__(self, "erfc",
                                 latex_name=r"\operatorname{erfc}",
                                 conversions=dict(maxima='erfc',
                                                  sympy='erfc',
                                                  fricas='erfc',
                                                  giac='erfc'))
Example #44
0
    def __init__(self):
        r"""
        TESTS::

            sage: latex(hurwitz_zeta(x, 2))
            \zeta\left(x, 2\right)
            sage: hurwitz_zeta(x, 2)._sympy_()
            zeta(x, 2)
        """
        BuiltinFunction.__init__(self,
                                 'hurwitz_zeta',
                                 nargs=2,
                                 conversions=dict(mathematica='HurwitzZeta',
                                                  sympy='zeta'),
                                 latex_name='\zeta')
Example #45
0
    def __init__(self):
        """
        See the docstring for ``Function_sin_integral``.

        EXAMPLES::

            sage: sin_integral(1)
            sin_integral(1)

        """
        BuiltinFunction.__init__(self,
                                 "sin_integral",
                                 nargs=1,
                                 latex_name=r'\operatorname{Si}',
                                 conversions=dict(maxima='expintegral_si'))
Example #46
0
    def __init__(self):
        """
        See the docstring for ``Function_log_integral-offset``.

        EXAMPLES::

            sage: log_integral_offset(3)
            log_integral(3) - log_integral(2)
            sage: log_integral_offset(x, hold=True)._sympy_()
            Li(x)

        """
        BuiltinFunction.__init__(self, "log_integral_offset", nargs=1,
                                 latex_name=r'log_integral_offset',
                                 conversions=dict(sympy='Li'))
Example #47
0
 def __init__(self):
     """
     EXAMPLES::
 
         sage: loads(dumps(elliptic_pi))
         elliptic_pi
         sage: elliptic_pi(x, pi/4, 1)._sympy_()
         elliptic_pi(x, pi/4, 1)
     """
     BuiltinFunction.__init__(self,
                              'elliptic_pi',
                              nargs=3,
                              conversions=dict(mathematica='EllipticPi',
                                               maxima='EllipticPi',
                                               sympy='elliptic_pi'))
Example #48
0
    def __init__(self):
        """
        EXAMPLES::

            sage: loads(dumps(elliptic_f))
            elliptic_f
            sage: elliptic_f(x, 2)._sympy_()
            elliptic_f(x, 2)
        """
        BuiltinFunction.__init__(self,
                                 'elliptic_f',
                                 nargs=2,
                                 conversions=dict(mathematica='EllipticF',
                                                  maxima='elliptic_f',
                                                  sympy='elliptic_f'))
Example #49
0
    def __init__(self):
        """
        The class for the Airy Bi function.

        EXAMPLES::

            sage: from sage.functions.airy import airy_bi_simple
            sage: f = airy_bi_simple(x); f
            airy_bi(x)
        """
        BuiltinFunction.__init__(self,
                                 "airy_bi",
                                 latex_name=r'\operatorname{Bi}',
                                 conversions=dict(mathematica='AiryBi',
                                                  maxima='airy_bi'))
Example #50
0
    def __init__(self):
        """
        See the docstring for :meth:`Function_exp_integral_e`.

        EXAMPLES::

            sage: exp_integral_e(1,0)
            exp_integral_e(1, 0)

        """
        BuiltinFunction.__init__(self,
                                 "exp_integral_e",
                                 nargs=2,
                                 latex_name=r'exp_integral_e',
                                 conversions=dict(maxima='expintegral_e'))
Example #51
0
    def __init__(self):
        """
        Constructs an object to represent Dickman's rho function.

        TESTS::

            sage: dickman_rho(x)
            dickman_rho(x)
            sage: dickman_rho(3)
            0.0486083882911316
            sage: dickman_rho(pi)
            0.0359690758968463
        """
        self._cur_prec = 0
        BuiltinFunction.__init__(self, "dickman_rho", 1)
Example #52
0
    def __init__(self):
        """
        See the docstring for :class:`Function_cos_integral`.

        EXAMPLES::

            sage: cos_integral(1)
            cos_integral(1)

        """
        BuiltinFunction.__init__(self,
                                 "cos_integral",
                                 nargs=1,
                                 latex_name=r'\operatorname{Ci}',
                                 conversions=dict(maxima='expintegral_ci'))
Example #53
0
    def __init__(self):
        """
        See the docstring for ``Function_log_integral``.

        EXAMPLES::

            sage: log_integral(3)
            log_integral(3)

        """
        BuiltinFunction.__init__(self,
                                 "log_integral",
                                 nargs=1,
                                 latex_name=r'log_integral',
                                 conversions=dict(maxima='expintegral_li'))
Example #54
0
    def __init__(self):
        """
        See the docstring for :meth:`Function_exp_integral_e`.

        EXAMPLES::

            sage: exp_integral_e(1, 0)
            exp_integral_e(1, 0)
            sage: exp_integral_e(1, x)._sympy_()
            expint(1, x)

        """
        BuiltinFunction.__init__(self, "exp_integral_e", nargs=2,
                                 conversions=dict(maxima='expintegral_e',
                                                  sympy='expint'))
Example #55
0
    def __init__(self):
        r"""
        EXAMPLES::

            sage: k=var('k')
            sage: loads(dumps(sum(1/k,k,1,x)))
            harmonic_number(x)
            sage: harmonic_number(x)._sympy_()
            harmonic(x)
        """
        BuiltinFunction.__init__(self, "harmonic_number", nargs=1,
                                 conversions={'mathematica':'HarmonicNumber',
                                              'maple':'harmonic',
                                              'maxima':'harmonic_number',
                                              'sympy':'harmonic'})
Example #56
0
    def __init__(self):
        """
        See the docstring for :class:`Function_exp_integral_e1`.

        EXAMPLES::

            sage: exp_integral_e1(1)
            exp_integral_e1(1)
            sage: exp_integral_e1(x)._sympy_()
            expint(1, x)

        """
        BuiltinFunction.__init__(self, "exp_integral_e1", nargs=1,
                                 conversions=dict(maxima='expintegral_e1',
                                                  sympy='E1'))
Example #57
0
 def __init__(self):
     """
     TESTS::
     
         sage: maxima(hypergeometric_M(1,1,x))
         kummer_m(1,1,_SAGE_VAR_x)
         sage: latex(hypergeometric_M(1,1,x))
         M\left(1, 1, x\right)
     """
     BuiltinFunction.__init__(self, 'hypergeometric_M', nargs=3,
                              conversions={'mathematica':
                                           'Hypergeometric1F1',
                                           'maxima': 'kummer_m',
                                           'fricas': 'kummerM'},
                              latex_name='M')
Example #58
0
    def __init__(self):
        """
        Class to represent an indefinite integral.

        EXAMPLES::

            sage: from sage.symbolic.integration.integral import indefinite_integral
            sage: indefinite_integral(log(x), x) #indirect doctest
            x*log(x) - x
            sage: indefinite_integral(x^2, x)
            1/3*x^3
            sage: indefinite_integral(4*x*log(x), x)
            2*x^2*log(x) - x^2
            sage: indefinite_integral(exp(x), 2*x)
            2*e^x

        TESTS:

        Check for :trac:`28913`::

            sage: Ex = (1-2*x^(1/3))^(3/4)/x
            sage: integrate(Ex, x, algorithm="giac")  # long time
            4*(-2*x^(1/3) + 1)^(3/4) + 6*arctan((-2*x^(1/3) + 1)^(1/4)) - 3*log((-2*x^(1/3) + 1)^(1/4) + 1) + 3*log(abs((-2*x^(1/3) + 1)^(1/4) - 1))

        Check for :trac:`29833`::

            sage: (x,a,b)=var('x a b')
            sage: assume(b > 0)
            sage: f = (exp((x-a)/b) + 1)**(-1)
            sage: (f*f).integrate(x, algorithm="mathematica_free") # optional -- internet
            -b*log(e^(-(a - x)/b) + 1) + x + b/(e^(-(a - x)/b) + 1)
        """
        # The automatic evaluation routine will try these integrators
        # in the given order. This is an attribute of the class instead of
        # a global variable in this module to enable customization by
        # creating a subclasses which define a different set of integrators
        self.integrators = [
            external.maxima_integrator, external.giac_integrator,
            external.sympy_integrator
        ]

        BuiltinFunction.__init__(self,
                                 "integrate",
                                 nargs=2,
                                 conversions={
                                     'sympy': 'Integral',
                                     'giac': 'integrate'
                                 })
Example #59
0
    def __init__(self):
        """
        TESTS::

            sage: loads(dumps(elliptic_e))
            elliptic_e
        """
        BuiltinFunction.__init__(
            self,
            'elliptic_e',
            nargs=2,
            # Maple conversion left out since it uses
            # k instead of m as the second argument
            conversions=dict(mathematica='EllipticE',
                             maxima='elliptic_e',
                             sympy='elliptic_e'))
Example #60
0
    def __init__(self):
        """
        See the docstring for ``Function_cosh_integral``.

        EXAMPLES::

            sage: cosh_integral(1)
            cosh_integral(1)
            sage: cosh_integral(x)._sympy_()
            Chi(x)

        """
        BuiltinFunction.__init__(self, "cosh_integral", nargs=1,
                                 latex_name=r'\operatorname{Chi}',
                                 conversions=dict(maxima='expintegral_chi',
                                                  sympy='Chi'))