Integration
Let's do some integration examples:
fricas
(1) -> integrate(%e^x, x)
Type: Union(Expression(Integer),...)
int(cos(x),x,0,pi);
reduce
\displaylines{\qdd 0 \cr}
fricas
integrate(x^2/sqrt(4-x^2),x)
\label{eq2}\frac{{{\left(-{{32}\ {\sqrt{-{{x}^{2}}+ 4}}}-{8 \ {{x}^{2}}}+{64}\right)}\ {\arctan \left({\frac{{\sqrt{-{{x}^{2}}+ 4}}- 2}{x}}\right)}}+{{\left(-{{x}^{3}}+{8 \ x}\right)}\ {\sqrt{-{{x}^{2}}+ 4}}}+{4 \ {{x}^{3}}}-{{16}\ x}}{{8 \ {\sqrt{-{{x}^{2}}+ 4}}}+{2 \ {{x}^{2}}}-{16}}
(2)
Type: Union(Expression(Integer),...)
Below FriCAS gives up because sign of a is unknown:
fricas
integrate(exp(-a*x^2),x=0..%plusInfinity)
\label{eq3}\verb#"failed"#
(3)
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)
\label{eq4}\frac{{{\left(-{5 \ {{x}^{2}}}+ 5 \right)}\ {\log \left({x + 1}\right)}}+{{\left({8 \ {{x}^{2}}}- 8 \right)}\ {\log \left({x}\right)}}+{{\left(-{3 \ {{x}^{2}}}+ 3 \right)}\ {\log \left({x - 1}\right)}}-{2 \ x}- 6}{{4 \ {{x}^{2}}}- 4}
(4)
Type: Union(Expression(Integer),...)
fricas
integrate(2*x/sin(x)^2,x)
\label{eq5}\frac{{2 \ {\sin \left({x}\right)}\ {\log \left({\frac{\sin \left({x}\right)}{2}}\right)}}-{2 \ x \ {\cos \left({x}\right)}}}{\sin \left({x}\right)}
(5)
Type: Union(Expression(Integer),...)
Comparing FriCAS and Reduce:
fricas
integrate(sin(1/x),x)
\label{eq6}{x \ {\sin \left({\frac{1}{x}}\right)}}-{Ci \left({\frac{1}{x}}\right)}
(6)
Type: Union(Expression(Integer),...)
\displaylines{\qdd \int {\sin \(\frac{1}{ x}
load_package algint;
int(sin(1/x),x);
reduce
\displaylines{\qdd \int {\sin \(\frac{1}{ x}
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
\displaylines{\qdd \frac{2\cdot \sqrt{\sin \(\frac{1}{ x}
fricas
integrate(exp(-x^2),x)
\label{eq7}\frac{{\erf \left({x}\right)}\ {\sqrt{\pi}}}{2}
(7)
Type: Union(Expression(Integer),...)
fricas
integrate(sin(x)/x,x)
\label{eq8}Si \left({x}\right)
(8)
Type: Union(Expression(Integer),...)
fricas
differentiate(%,x)
\label{eq9}\frac{\sin \left({x}\right)}{x}
(9)
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)
\label{eq10}\verb#"potentialPole"#
(10)
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)
\label{eq12}\int^{ \displaystyle x}{{\frac{\arctan \left({\frac{\%A}{a}}\right)}{\%A}}\ {d \%A}}
(12)
Type: Union(Expression(Integer),...)
fricas
integrate(1/(a+z^3), z=0..1,"noPole")
\label{eq13}\frac{-{{\sqrt{3}}\ {\log \left({{3 \ {{a}^{2}}\ {{\root{3}\of{{a}^{2}}}^{2}}}+{{\left(-{2 \ {{a}^{3}}}+{{a}^{2}}\right)}\ {\root{3}\of{{a}^{2}}}}+{{a}^{4}}-{2 \ {{a}^{3}}}}\right)}}+{2 \ {\sqrt{3}}\ {\log \left({{{\root{3}\of{{a}^{2}}}^{2}}+{2 \ a \ {\root{3}\of{{a}^{2}}}}+{{a}^{2}}}\right)}}+{{12}\ {\arctan \left({\frac{{2 \ {\sqrt{3}}\ {\root{3}\of{{a}^{2}}}}-{a \ {\sqrt{3}}}}{3 \ a}}\right)}}+{{\sqrt{3}}\ {\log \left({{a}^{4}}\right)}}-{2 \ {\sqrt{3}}\ {\log \left({{a}^{2}}\right)}}+{2 \ \pi}}{{12}\ {\sqrt{3}}\ {\root{3}\of{{a}^{2}}}}
(13)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
fricas
integrate(x^3+x^2/4+x,x)
\label{eq14}{{\frac{1}{4}}\ {{x}^{4}}}+{{\frac{1}{12}}\ {{x}^{3}}}+{{\frac{1}{2}}\ {{x}^{2}}}
(14)
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)
\label{eq15}-{{2500}\ {{e}^{-{{\frac{1}{50}}\ t}}}}
(15)
Type: Union(Expression(Fraction(Integer)),...)
fricas
integrate(exp(cos(x)),x)
\label{eq16}\int^{ \displaystyle x}{{{e}^{\cos \left({\%A}\right)}}\ {d \%A}}
(16)
Type: Union(Expression(Integer),...)
fricas
integrate(sin(x),x)
\label{eq17}-{\cos \left({x}\right)}
(17)
Type: Union(Expression(Integer),...)
fricas
integrate(%,x)
\label{eq18}-{\sin \left({x}\right)}
(18)
Type: Union(Expression(Integer),...)
fricas
integrate(a/h - c*h/12 + (b/h)*r + (c/h)*r^2,r)
\label{eq19}\frac{{4 \ c \ {{r}^{3}}}+{6 \ b \ {{r}^{2}}}+{{\left(-{c \ {{h}^{2}}}+{{12}\ a}\right)}\ r}}{{12}\ h}
(19)
Type: Union(Expression(Integer),...)
fricas
integrate(exp(-(a+b*t)^2/2),t)
\label{eq20}\frac{{\sqrt{\pi}}\ {\erf \left({\frac{{\left({b \ t}+ a \right)}\ {\sqrt{\frac{{b}^{2}}{2}}}}{b}}\right)}}{2 \ {\sqrt{\frac{{b}^{2}}{2}}}}
(20)
Type: Union(Expression(Integer),...)
fricas
integrate(exp(-(a+b*t)^2/t),t)
\label{eq21}\int^{ \displaystyle t}{{{e}^{\frac{-{{{\%A}^{2}}\ {{b}^{2}}}-{2 \ \%A \ a \ b}-{{a}^{2}}}{\%A}}}\ {d \%A}}
(21)
Type: Union(Expression(Integer),...)
fricas
integrate(exp(-1/t),t)
\label{eq22}{t \ {{e}^{-{\frac{1}{t}}}}}+{Ei \left({-{\frac{1}{t}}}\right)}
(22)
Type: Union(Expression(Integer),...)
fricas
integrate(exp(-1/t),t=1..x)
\label{eq23}\verb#"potentialPole"#
(23)
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)
\label{eq24}\frac{-{a \ b \ {\sqrt{\pi}}\ {\erf \left({\frac{{\left({b \ t}+ a \right)}\ {\sqrt{\frac{{b}^{2}}{2}}}}{b}}\right)}}-{2 \ {{e}^{\frac{-{{{b}^{2}}\ {{t}^{2}}}-{2 \ a \ b \ t}-{{a}^{2}}}{2}}}\ {\sqrt{\frac{{b}^{2}}{2}}}}}{2 \ {{b}^{2}}\ {\sqrt{\frac{{b}^{2}}{2}}}}
(24)
Type: Union(Expression(Integer),...)
fricas
integrate(1/(a+z^3), z=0..1,"noPole")
\label{eq25}\frac{-{{\sqrt{3}}\ {\log \left({{3 \ {{a}^{2}}\ {{\root{3}\of{{a}^{2}}}^{2}}}+{{\left(-{2 \ {{a}^{3}}}+{{a}^{2}}\right)}\ {\root{3}\of{{a}^{2}}}}+{{a}^{4}}-{2 \ {{a}^{3}}}}\right)}}+{2 \ {\sqrt{3}}\ {\log \left({{{\root{3}\of{{a}^{2}}}^{2}}+{2 \ a \ {\root{3}\of{{a}^{2}}}}+{{a}^{2}}}\right)}}+{{12}\ {\arctan \left({\frac{{2 \ {\sqrt{3}}\ {\root{3}\of{{a}^{2}}}}-{a \ {\sqrt{3}}}}{3 \ a}}\right)}}+{{\sqrt{3}}\ {\log \left({{a}^{4}}\right)}}-{2 \ {\sqrt{3}}\ {\log \left({{a}^{2}}\right)}}+{2 \ \pi}}{{12}\ {\sqrt{3}}\ {\root{3}\of{{a}^{2}}}}
(25)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
From the ReduceProblem?:
fricas
integrate(1/sqrt(2*%pi)*exp(-1/2*log(x)^2),x=0..%plusInfinity)
\label{eq26}\frac{{{e}^{\frac{1}{2}}}\ {\sqrt{2}}\ {\sqrt{\pi}}}{\sqrt{2 \ \pi}}
(26)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
fricas
integrate(1/sqrt(2*%pi)*exp(-1/2*log(x)^2),x)
\label{eq27}\frac{{{e}^{\frac{1}{2}}}\ {\sqrt{2}}\ {\sqrt{\pi}}\ {\erf \left({\frac{{\log \left({x}\right)}- 1}{\sqrt{2}}}\right)}}{2 \ {\sqrt{2 \ \pi}}}
(27)
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)
\label{eq28}+ \infty
(28)
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)
\label{eq30}\log \left({x}\right)
(30)
Type: Union(Expression(Integer),...)
fricas
integrate(sqrt(x),x)
\label{eq31}\frac{2 \ x \ {\sqrt{x}}}{3}
(31)
Type: Union(Expression(Integer),...)
fricas
integrate(sqrt(x^3+x),x)
\label{eq32}\frac{-{4 \ {weierstrassZeta \left({- 4, \: 0, \:{weierstrassPInverse \left({- 4, \: 0, \: x}\right)}}\right)}}+{2 \ x \ {\sqrt{{{x}^{3}}+ x}}}}{5}
(32)
Type: Union(Expression(Integer),...)
fricas
)set output tex off
fricas
)set output algebra on
integrate(( a*sin( m + n*t + o*t*t/2 ) )/( n + ot ) + ( b*cos( m + n*t + o*t*t/2 ) )/( n + ot ), t)
(33)
+---+
| o
2 2 (o t + n) |---
2 m o - n 2 m o - n \|%pi
(- b sin(----------) + a cos(----------))fresnelS(---------------)
2 o 2 o o
+
+---+
| o
2 2 (o t + n) |---
2 m o - n 2 m o - n \|%pi
(a sin(----------) + b cos(----------))fresnelC(---------------)
2 o 2 o o
/
+---+
| o
(ot + n) |---
\|%pi
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)
(34)
+---+
| o
2 2 (o t + n) |---
2 m o - n 2 m o - n \|%pi
(- a sin(----------) - b cos(----------))fresnelS(---------------)
2 o 2 o o
+
+---+
| o
2 2 (o t + n) |---
2 m o - n 2 m o - n \|%pi
(- b sin(----------) + a cos(----------))fresnelC(---------------)
2 o 2 o o
/
+---+
| o
|---
\|%pi
Type: Union(Expression(Integer),...)
fricas
)set output algebra off
fricas
)set output tex on
fricas
integrate(-2*(3-3*t)^2*(3*t),t)
\label{eq33}-{{\frac{27}{2}}\ {{t}^{4}}}+{{36}\ {{t}^{3}}}-{{27}\ {{t}^{2}}}
(33)
Type: Polynomial(Fraction(Integer))
fricas
integrate(1/(1+x^2),x=-u..u)
\label{eq34}\verb#"potentialPole"#
(34)
Type: Union(pole: potentialPole,...)
fricas
integrate(1/(1+x^2),x=-u..u, "noPole")
\label{eq35}2 \ {\arctan \left({u}\right)}
(35)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
fricas
integrate(x^6*exp(-x^2), x=0..%plusInfinity)
\label{eq36}\frac{{15}\ {\sqrt{\pi}}}{16}
(36)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
fricas
integrate(1/sqrt(1/x+1),x)
\label{eq37}\frac{-{\log \left({{\sqrt{\frac{x + 1}{x}}}+ 1}\right)}+{\log \left({{\sqrt{\frac{x + 1}{x}}}- 1}\right)}+{2 \ x \ {\sqrt{\frac{x + 1}{x}}}}}{2}
(37)
Type: Union(Expression(Integer),...)
fricas
integrate(sin(sin x), x)
\label{eq38}\int^{ \displaystyle x}{{\sin \left({\sin \left({\%A}\right)}\right)}\ {d \%A}}
(38)
Type: Union(Expression(Integer),...)
fricas
integrate(a/2*(1-cos(b*t)),t)
\label{eq39}\frac{-{a \ {\sin \left({b \ t}\right)}}+{a \ b \ t}}{2 \ b}
(39)
Type: Union(Expression(Integer),...)
fricas
integrate(tan(atan(x)/3),x)
\label{eq40}\frac{{8 \ {\log \left({{3 \ {{\tan \left({\frac{\arctan \left({x}\right)}{3}}\right)}^{2}}}- 1}\right)}}-{3 \ {{\tan \left({\frac{\arctan \left({x}\right)}{3}}\right)}^{2}}}+{{18}\ x \ {\tan \left({\frac{\arctan \left({x}\right)}{3}}\right)}}}{1 8}
(40)
Type: Union(Expression(Integer),...)
fricas
integrate(x, x)
\label{eq41}{\frac{1}{2}}\ {{x}^{2}}
(41)
Type: Polynomial(Fraction(Integer))
fricas
simplify((1/(2*z))*z^2)
\label{eq42}\frac{z}{2}
(42)
Type: Expression(Integer)
fricas
integrate((1/(2*z))*z^2, z)
\label{eq43}\frac{{z}^{2}}{4}
(43)
Type: Union(Expression(Integer),...)
fricas
integrate(log(x),x)
\label{eq44}{x \ {\log \left({x}\right)}}- x
(44)
Type: Union(Expression(Integer),...)
fricas
integrate(1/x,x)
\label{eq45}\log \left({x}\right)
(45)
Type: Union(Expression(Integer),...)
fricas
integrate(0^0,x)
Type: Polynomial(Fraction(Integer))
fricas
integrate( log(y)^3/(y*(y-1)),y)
\label{eq47}\int^{ \displaystyle y}{{\frac{{\log \left({\%A}\right)}^{3}}{{{\%A}^{2}}- \%A}}\ {d \%A}}
(47)
Type: Union(Expression(Integer),...)
fricas
integrate(exp(-x^2),x=0..%plusInfinity)
\label{eq48}\frac{\sqrt{\pi}}{2}
(48)
Type: Union(f1: OrderedCompletion
?(Expression(Integer)),
...)
fricas
integrate(x^2*exp(-x^2),x=0..%plusInfinity)
\label{eq49}\frac{\sqrt{\pi}}{4}
(49)
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)
\label{eq50}\frac{-{i \ {{e}^{2 \ i \ T \ f \ \pi}}}+ i}{2 \ f \ \pi}
(50)
Type: Union(f1: OrderedCompletion
?(Expression(Complex(Integer))),
...)
int(exp(sin(x)),x);
reduce
\displaylines{\qdd \int {e^{\sin \(x
fricas
integrate(exp(sin(x)),x)
\label{eq51}\int^{ \displaystyle x}{{{e}^{\sin \left({\%A}\right)}}\ {d \%A}}
(51)
Type: Union(Expression(Integer),...)
fricas
integrate(sqrt(x+sqrt(1+x^2))/x,x)
\label{eq52}\begin{array}{@{}l} \displaystyle -{\log \left({{\sqrt{{\sqrt{{{x}^{2}}+ 1}}+ x}}+ 1}\right)}+{\log \left({{\sqrt{{\sqrt{{{x}^{2}}+ 1}}+ x}}- 1}\right)}- \ \ \displaystyle {2 \ {\arctan \left({\sqrt{{\sqrt{{{x}^{2}}+ 1}}+ x}}\right)}}+{2 \ {\sqrt{{\sqrt{{{x}^{2}}+ 1}}+ x}}}
(52)
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
\label{eq53}\frac{{{\left(-{{x}^{2}}+{{\left(-{b \ d}- b + 2 \right)}\ x}+{{\left(- b + 1 \right)}\ {{d}^{2}}}+{{\left(- b + 2 \right)}\ d}\right)}\ {{e}^{\frac{-{b \ x}+ b}{x + d}}}}+{{\left({{\left({{b}^{2}}-{2 \ b}\right)}\ {{d}^{2}}}+{{\left({2 \ {{b}^{2}}}-{4 \ b}\right)}\ d}+{{b}^{2}}-{2 \ b}\right)}\ {Ei \left({\frac{{b \ d}+ b}{x + d}}\right)}\ {{e}^{- b}}}}{2}
(53)
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"
x^2+((-1)b
d+((-1)b+2))
x+(((-1)b+1)
d^2+((-1)b+2)
d))exp(((-1)
bx+b)/(x+d))+((b^2+(-2)
b)d^2+(2
b^2+(-4)b)
d+(b^2+(-2)b))
Ei((bd+b)/(x+d))
exp((-1)b))/2"#" title="
\label{eq54}\verb#"(((-1)
x^2+((-1)b
d+((-1)b+2))
x+(((-1)b+1)
d^2+((-1)b+2)
d))exp(((-1)
bx+b)/(x+d))+((b^2+(-2)
b)d^2+(2
b^2+(-4)b)
d+(b^2+(-2)b))
Ei((bd+b)/(x+d))
exp((-1)b))/2"#" class="equation" src="images/8076628672726641697-16.0px.png" align="bottom" Style="vertical-align:text-bottom" width="818" height="17"/>
(54)
Type: String
Test
fricas
ii := integral(sin(x), x)
x
++
(57) | sin(%A)d%A
++
\label{eq55}\int^{ \displaystyle x}{{\sin \left({\%A}\right)}\ {d \%A}}
(55)
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
\label{eq56}\frac{{\log \left({{{x}^{14}}-{2 \ {{x}^{8}}}-{2 \ {{x}^{7}}}-{2 \ {{x}^{4}}}-{4 \ {{x}^{3}}}-{{x}^{2}}+{2 \ x}+ 1}\right)}+{{\sqrt{2}}\ {\log \left({\frac{{{\left(-{2 \ {{x}^{9}}}-{2 \ {{x}^{8}}}+{2 \ {{x}^{3}}}+{4 \ {{x}^{2}}}+{2 \ x}\right)}\ {\sqrt{2}}}+{{x}^{14}}-{2 \ {{x}^{8}}}-{2 \ {{x}^{7}}}+{2 \ {{x}^{4}}}+{4 \ {{x}^{3}}}+{3 \ {{x}^{2}}}+{2 \ x}+ 1}{{{x}^{14}}-{2 \ {{x}^{8}}}-{2 \ {{x}^{7}}}-{2 \ {{x}^{4}}}-{4 \ {{x}^{3}}}-{{x}^{2}}+{2 \ x}+ 1}}\right)}}}{2}
(56)
Type: Union(Expression(Integer),...)