domenica 16 novembre 2014

CALCOLO SIMBOLICO (INTEGRAZIONE):


sage: from sage.symbolic.integration.integral import definite_integral
sage: definite_integral(sin(x),x,0,pi)
2

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
esempi:
sage: x = var('x')
sage: h = sin(x)/(cos(x))^2
sage: h.integral(x)
1/cos(x
sage: f = x^2/(x+1)^3
sage: f.integral(x)
1/2*(4*x + 3)/(x^2 + 2*x + 1) + log(x + 1)
sage: f = x*cos(x^2)
sage: f.integral(x, 0, sqrt(pi))
0
sage: f.integral(x, a=-pi, b=pi)
0
sage: f(x) = sin(x)
sage: f.integral(x, 0, pi/2)
1
sage: y=var('y')
sage: integral(sin(x), x)
-cos(x)
sage: integral(sin(x), y)
y*sin(x)
sage: integral(sin(x), x, pi, 2*pi)
-2
sage: integral(sin(x), y, pi, 2*pi)
pi*sin(x)
sage: integral(sin(x), (x, pi, 2*pi))
-2
sage: integral(sin(x), (y, pi, 2*pi))
pi*sin(x)
sage: var('x, n')
(x, n)
sage: integral(x^n,x)
Traceback (most recent call last):
...
ValueError: Computation failed since Maxima requested additional
constraints; using the 'assume' command before evaluation
*may* help (example of legal syntax is 'assume(n>0)', see `assume?`
for more details)
Is n equal to -1?
sage: assume(n > 0)
sage: integral(x^n,x)
x^(n + 1)/(n + 1)
sage: forget()