# TESTS::¶

sage.symbolic.integration.external.fricas_integrator(expression, v, a=None, b=None, noPole=True)

Integration using FriCAS

EXAMPLES:

sage: from sage.symbolic.integration.external import fricas_integrator  # optional - fricas
sage: fricas_integrator(sin(x), x)                                      # optional - fricas
-cos(x)
sage: fricas_integrator(cos(x), x)                                      # optional - fricas
sin(x)
sage: fricas_integrator(1/(x^2-2), x, 0, 1)                             # optional - fricas
1/4*sqrt(2)*(log(3*sqrt(2) - 4) - log(sqrt(2)))
sage: fricas_integrator(1/(x^2+6), x, -oo, oo)                          # optional - fricas
1/6*sqrt(6)*pi

sage.symbolic.integration.external.giac_integrator(expression, v, a=None, b=None)

Integration using Giac

EXAMPLES:

sage: from sage.symbolic.integration.external import giac_integrator
sage: giac_integrator(sin(x), x)
-cos(x)
sage: giac_integrator(1/(x^2+6), x, -oo, oo)
1/6*sqrt(6)*pi

sage.symbolic.integration.external.maxima_integrator(expression, v, a=None, b=None)

Integration using Maxima

EXAMPLES:

sage: from sage.symbolic.integration.external import maxima_integrator
sage: maxima_integrator(sin(x), x)
-cos(x)
sage: maxima_integrator(cos(x), x)
sin(x)
sage: f(x) = function('f')(x)
sage: maxima_integrator(f(x), x)
integrate(f(x), x)

sage.symbolic.integration.external.mma_free_integrator(expression, v, a=None, b=None)

Integration using Mathematica’s online integrator

EXAMPLES:

sage: from sage.symbolic.integration.external import mma_free_integrator
sage: mma_free_integrator(sin(x), x) # optional - internet
-cos(x)


A definite integral:

sage: mma_free_integrator(e^(-x), x, a=0, b=oo) # optional - internet
1

sage: mma_free_integrator(exp(-x^2)*log(x), x) # optional - internet
1/2*sqrt(pi)*erf(x)*log(x) - x*hypergeometric((1/2, 1/2), (3/2, 3/2), -x^2)

sage.symbolic.integration.external.parse_moutput_from_json(page_data, verbose=False)

Return the list of outputs found in the json (with key 'moutput')

INPUT:

• page_data – json obtained from Wolfram Alpha
• verbose – bool (default: False)

OUTPUT:

list of unicode strings

EXAMPLES:

sage: from sage.symbolic.integration.external import request_wolfram_alpha
sage: from sage.symbolic.integration.external import parse_moutput_from_json
sage: page_data = request_wolfram_alpha('integrate Sin[x]') # optional internet
sage: parse_moutput_from_json(page_data)                    # optional internet
[u'-Cos[x]']

sage: page_data = request_wolfram_alpha('Sin[x]')           # optional internet
sage: L = parse_moutput_from_json(page_data)                # optional internet
sage: sorted(L)                                             # optional internet
[u'-Cos[x]', u'{{x == Pi C[1], Element[C[1], Integers]}}']

sage.symbolic.integration.external.request_wolfram_alpha(input, verbose=False)

Request Wolfram Alpha website.

INPUT:

• input – string
• verbose – bool (default: False)

OUTPUT:

json

EXAMPLES:

sage: from sage.symbolic.integration.external import request_wolfram_alpha
sage: page_data = request_wolfram_alpha('integrate Sin[x]')      # optional internet
sage: [str(a) for a in sorted(page_data.keys())]                 # optional internet
['queryresult']
sage: [str(a) for a in sorted(page_data['queryresult'].keys())]  # optional internet
['datatypes',
'encryptedEvaluatedExpression',
'encryptedParsedExpression',
'error',
'host',
'id',
'numpods',
'parsetimedout',
'parsetiming',
'pods',
'recalculate',
'related',
'server',
'success',
'timedout',
'timedoutpods',
'timing',
'version']

sage.symbolic.integration.external.symbolic_expression_from_mathematica_string(mexpr)

Translate a mathematica string into a symbolic expression

INPUT:

• mexpr – string

OUTPUT:

symbolic expression

EXAMPLES:

sage: from sage.symbolic.integration.external import symbolic_expression_from_mathematica_string
sage: symbolic_expression_from_mathematica_string(u'-Cos[x]')
-cos(x)

sage.symbolic.integration.external.sympy_integrator(expression, v, a=None, b=None)

Integration using SymPy

EXAMPLES:

sage: from sage.symbolic.integration.external import sympy_integrator
sage: sympy_integrator(sin(x), x)
-cos(x)
sage: sympy_integrator(cos(x), x)
sin(x)