All published worksheets from http://sagenb.org
Image: ubuntu2004
File: /sagenb/sage_install/sage-4.7.2/local/lib/python2.6/site-packages/sage/misc/functional.py
Type: <type ‘function’>
Definition: integral(x, *args, **kwds)
Docstring:
Returns an indefinite or definite integral of an object x.
First call x.integrate() and if that fails make an object and integrate it using Maxima, maple, etc, as specified by algorithm.
For symbolic expression calls sage.calculus.calculus.integral - see this function for available options.
EXAMPLES:
sage: f = cyclotomic_polynomial(10) sage: integral(f) 1/5*x^5 - 1/4*x^4 + 1/3*x^3 - 1/2*x^2 + xsage: integral(sin(x),x) -cos(x)sage: y = var('y') sage: integral(sin(x),y) y*sin(x)sage: integral(sin(x), x, 0, pi/2) 1 sage: sin(x).integral(x, 0,pi/2) 1 sage: integral(exp(-x), (x, 1, oo)) e^(-1)Numerical approximation:
sage: h = integral(tan(x)/x, (x, 1, pi/3)); h integrate(tan(x)/x, x, 1, 1/3*pi) sage: h.n() 0.07571599101...Specific algorithm can be used for integration:
sage: integral(sin(x)^2, x, algorithm='maxima') 1/2*x - 1/4*sin(2*x) sage: integral(sin(x)^2, x, algorithm='sympy') -1/2*sin(x)*cos(x) + 1/2*x
File: /sagenb/sage_install/sage-4.7.2/local/lib/python2.6/site-packages/sage/calculus/functional.py
Type: <type ‘function’>
Definition: derivative(f, *args, **kwds)
Docstring:
The derivative of f.
Repeated differentiation is supported by the syntax given in the examples below.
ALIAS: diff
EXAMPLES: We differentiate a callable symbolic function:
sage: f(x,y) = x*y + sin(x^2) + e^(-x) sage: f (x, y) |--> x*y + e^(-x) + sin(x^2) sage: derivative(f, x) (x, y) |--> 2*x*cos(x^2) + y - e^(-x) sage: derivative(f, y) (x, y) |--> xWe differentiate a polynomial:
sage: t = polygen(QQ, 't') sage: f = (1-t)^5; f -t^5 + 5*t^4 - 10*t^3 + 10*t^2 - 5*t + 1 sage: derivative(f) -5*t^4 + 20*t^3 - 30*t^2 + 20*t - 5 sage: derivative(f, t) -5*t^4 + 20*t^3 - 30*t^2 + 20*t - 5 sage: derivative(f, t, t) -20*t^3 + 60*t^2 - 60*t + 20 sage: derivative(f, t, 2) -20*t^3 + 60*t^2 - 60*t + 20 sage: derivative(f, 2) -20*t^3 + 60*t^2 - 60*t + 20We differentiate a symbolic expression:
sage: var('a x') (a, x) sage: f = exp(sin(a - x^2))/x sage: derivative(f, x) -2*e^(sin(-x^2 + a))*cos(-x^2 + a) - e^(sin(-x^2 + a))/x^2 sage: derivative(f, a) e^(sin(-x^2 + a))*cos(-x^2 + a)/xSyntax for repeated differentiation:
sage: R.<u, v> = PolynomialRing(QQ) sage: f = u^4*v^5 sage: derivative(f, u) 4*u^3*v^5 sage: f.derivative(u) # can always use method notation too 4*u^3*v^5sage: derivative(f, u, u) 12*u^2*v^5 sage: derivative(f, u, u, u) 24*u*v^5 sage: derivative(f, u, 3) 24*u*v^5sage: derivative(f, u, v) 20*u^3*v^4 sage: derivative(f, u, 2, v) 60*u^2*v^4 sage: derivative(f, u, v, 2) 80*u^3*v^3 sage: derivative(f, [u, v, v]) 80*u^3*v^3