Integration
Let's do some integration examples:
fricas
(1) -> integrate(%e^x, x)
Type: Union(Expression(Integer),...)
int(cos(x),x,0,pi); | reduce |
fricas
integrate(x^2/sqrt(4-x^2),x)
Type: Union(Expression(Integer),...)
Below FriCAS? gives up because sign of a
is unknown:
fricas
integrate(exp(-a*x^2),x=0..%plusInfinity)
Type: Union(fail: failed,...)
The following won't "work", see CommonMistakes?:
fricas
integrate(exp(-a::PositiveInteger*x^2),x=0..%plusInfinity)
Cannot convert the value from type Variable(a) to PositiveInteger .
fricas
integrate((x^3+x^2+2)/(x*(x^2-1)^2), x)
Type: Union(Expression(Integer),...)
fricas
integrate(2*x/sin(x)^2,x)
Type: Union(Expression(Integer),...)
Comparing FriCAS? and Reduce:
fricas
integrate(sin(1/x),x)
Type: Union(Expression(Integer),...)
load_package algint;
int(sin(1/x),x); | reduce |
A different problem, where FriCAS? has to give up:
fricas
integrate(sqrt(sin(1/x)),x)
>> Error detected within library code:
integrate: implementation incomplete (has polynomial part)
In Reduce:
load_package algint;
int(sqrt(sin(1/x)),x); | reduce |
fricas
integrate(exp(-x^2),x)
Type: Union(Expression(Integer),...)
fricas
integrate(sin(x)/x,x)
Type: Union(Expression(Integer),...)
fricas
differentiate(%,x)
Type: Expression(Integer)
fricas
integrate(sin(1/x),x=%minusInfinity..%plusInfinity,"noPole")
>> Error detected within library code:
integrate: pole in path of integration
fricas
integrate(2*x/sin(x)^2,x=1/2..1)
Type: Union(pole: potentialPole,...)
fricas
integrate(sin(x),x=0..%pi/2)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
fricas
integrate(atan(x/a)/x,x)
Type: Union(Expression(Integer),...)
fricas
integrate(1/(a+z^3), z=0..1,"noPole")
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
fricas
integrate(x^3+x^2/4+x,x)
Type: Polynomial(Fraction(Integer))
You cannot integrate Expression Float
fricas
integrate(50*%e^(-0.02*t),t)
There are 9 exposed and 11 unexposed library operations named
integrate having 2 argument(s) but none was determined to be
applicable. Use HyperDoc Browse, or issue
)display op integrate
to learn more about the available operations. Perhaps
package-calling the operation or using coercions on the arguments
will allow you to apply the operation.
Cannot find a definition or applicable library operation named
integrate with argument type(s)
Expression(Float)
Variable(t)
Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.
But symbolic integration works with integer expressions
fricas
integrate(50*%e^(-0.02*t)::Expression Fraction Integer,t)
Type: Union(Expression(Fraction(Integer)),...)
fricas
integrate(exp(cos(x)),x)
Type: Union(Expression(Integer),...)
fricas
integrate(sin(x),x)
Type: Union(Expression(Integer),...)
fricas
integrate(%,x)
Type: Union(Expression(Integer),...)
fricas
integrate(a/h - c*h/12 + (b/h)*r + (c/h)*r^2,r)
Type: Union(Expression(Integer),...)
fricas
integrate(exp(-(a+b*t)^2/2),t)
Type: Union(Expression(Integer),...)
fricas
integrate(exp(-(a+b*t)^2/t),t)
Type: Union(Expression(Integer),...)
fricas
integrate(exp(-1/t),t)
Type: Union(Expression(Integer),...)
fricas
integrate(exp(-1/t),t=1..x)
Type: Union(pole: potentialPole,...)
Unfortunately, there is currently no easy way to make "assumptions" about
variables. Thus, The following won't work:
\begin{axiom}
assume(x, real)
integrate(exp(-1/t),t=1..x)
\end{axiom}
fricas
integrate(t*exp(-(a+b*t)^2/2),t)
Type: Union(Expression(Integer),...)
fricas
integrate(1/(a+z^3), z=0..1,"noPole")
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
From the ReduceProblem?:
fricas
integrate(1/sqrt(2*%pi)*exp(-1/2*log(x)^2),x=0..%plusInfinity)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
fricas
integrate(1/sqrt(2*%pi)*exp(-1/2*log(x)^2),x)
Type: Union(Expression(Integer),...)
If you would get a result, you could use limit afterwards, of course.
- Area under the curve:
fricas
integrate(1/x,x=1..%plusInfinity)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
- Volume under that curve:
fricas
integrate(%pi*((1/x)^2), x=1..%plusInfinity)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
Curve has an infinite area...but a finite volume (I think I did this correctly)!
fricas
integrate(1/x,x)
Type: Union(Expression(Integer),...)
fricas
integrate(sqrt(x),x)
Type: Union(Expression(Integer),...)
fricas
integrate(sqrt(x^3+x),x)
Type: Union(Expression(Integer),...)
fricas
integrate(( a*sin( m + n*t + o*t*t/2 ) )/( n + ot ) + ( b*cos( m + n*t + o*t*t/2 ) )/( n + ot ), t)
Type: Union(Expression(Integer),...)
fricas
integrate(( a*cos( m + n*t + o*t*t/2 ) )- ( b*sin( m + n*t + o*t*t/2 ) ), t)
Type: Union(Expression(Integer),...)
fricas
integrate(-2*(3-3*t)^2*(3*t),t)
Type: Polynomial(Fraction(Integer))
fricas
integrate(1/(1+x^2),x=-u..u)
Type: Union(pole: potentialPole,...)
fricas
integrate(1/(1+x^2),x=-u..u, "noPole")
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
fricas
integrate(x^6*exp(-x^2), x=0..%plusInfinity)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
fricas
integrate(1/sqrt(1/x+1),x)
Type: Union(Expression(Integer),...)
fricas
integrate(sin(sin x), x)
Type: Union(Expression(Integer),...)
fricas
integrate(a/2*(1-cos(b*t)),t)
Type: Union(Expression(Integer),...)
fricas
integrate(tan(atan(x)/3),x)
Type: Union(Expression(Integer),...)
fricas
integrate(x, x)
Type: Polynomial(Fraction(Integer))
fricas
simplify((1/(2*z))*z^2)
Type: Expression(Integer)
fricas
integrate((1/(2*z))*z^2, z)
Type: Union(Expression(Integer),...)
fricas
integrate(log(x),x)
Type: Union(Expression(Integer),...)
fricas
integrate(1/x,x)
Type: Union(Expression(Integer),...)
fricas
integrate(0^0,x)
Type: Polynomial(Fraction(Integer))
fricas
integrate( log(y)^3/(y*(y-1)),y)
Type: Union(Expression(Integer),...)
fricas
integrate(exp(-x^2),x=0..%plusInfinity)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
fricas
integrate(x^2*exp(-x^2),x=0..%plusInfinity)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
No ; after command or else output is supressed.
fricas
integrate(exp(%i*2*%pi*f*t), t=0..T)
Type: Union(f1: OrderedCompletion
?(Expression(Complex(Integer))),
...)
int(exp(sin(x)),x); | reduce |
fricas
integrate(exp(sin(x)),x)
Type: Union(Expression(Integer),...)
fricas
integrate(sqrt(x+sqrt(1+x^2))/x,x)
Type: Union(Expression(Integer),...)
fricas
)set output algebra on
r2:=integrate((1 - x)*%e^((-b*(x - 1))/(x + d)),x)
(55)
- b x + b
---------
2 2 x + d
(- x + (- b d - b + 2)x + (- b + 1)d + (- b + 2)d)%e
+
2 2 2 2 b d + b - b
((b - 2 b)d + (2 b - 4 b)d + b - 2 b)Ei(-------)%e
x + d
/
2
Type: Union(Expression(Integer),...)
fricas
unparse(r2::InputForm)
(56)
"(((-1)*x^2+((-1)*b*d+((-1)*b+2))*x+(((-1)*b+1)*d^2+((-1)*b+2)*d))*exp(((-1)*
b*x+b)/(x+d))+((b^2+(-2)*b)*d^2+(2*b^2+(-4)*b)*d+(b^2+(-2)*b))*Ei((b*d+b)/(x+
d))*exp((-1)*b))/2"
Type: String
Test
fricas
ii := integral(sin(x), x)
x
++
(57) | sin(%A)d%A
++
Type: Expression(Integer)
fricas
integrate((7*x^13+10*x^8+4*x^7-7*x^6-4*x^3-4*x^2+3*x+3)/(x^14-2*x^8-2*x^7-2*x^4-4*x^3-x^2+2*x+1),x)
(58)
14 8 7 4 3 2
log(x - 2 x - 2 x - 2 x - 4 x - x + 2 x + 1)
+
+-+
\|2
*
log
9 8 3 2 +-+ 14 8 7
(- 2 x - 2 x + 2 x + 4 x + 2 x)\|2 + x - 2 x - 2 x
+
4 3 2
2 x + 4 x + 3 x + 2 x + 1
/
14 8 7 4 3 2
x - 2 x - 2 x - 2 x - 4 x - x + 2 x + 1
/
2
Type: Union(Expression(Integer),...)