login  home  contents  what's new  discussion  bug reports help  links  subscribe  changes  refresh  edit

## Integration

Let's do some integration examples:

fricas
(1) -> integrate(%e^x, x)
 (1)
Type: Union(Expression(Integer),...)

 int(cos(x),x,0,pi); reduce

fricas
integrate(x^2/sqrt(4-x^2),x)
 (2)
Type: Union(Expression(Integer),...)

Below FriCAS gives up because sign of a is unknown:

fricas
integrate(exp(-a*x^2),x=0..%plusInfinity)
 (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)
 (4)
Type: Union(Expression(Integer),...)

fricas
integrate(2*x/sin(x)^2,x)
 (5)
Type: Union(Expression(Integer),...)

Comparing FriCAS and Reduce:

fricas
integrate(sin(1/x),x)
 (6)
Type: Union(Expression(Integer),...)

 int(sin(1/x),x); reduce

 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)
 (7)
Type: Union(Expression(Integer),...)

fricas
integrate(sin(x)/x,x)
 (8)
Type: Union(Expression(Integer),...)
fricas
differentiate(%,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)
 (10)
Type: Union(pole: potentialPole,...)

fricas
integrate(sin(x),x=0..%pi/2)
 (11)
Type: Union(f1: OrderedCompletion?(Expression(Integer)),...)

fricas
integrate(atan(x/a)/x,x)
 (12)
Type: Union(Expression(Integer),...)

fricas
integrate(1/(a+z^3), z=0..1,"noPole")
 (13)
Type: Union(f1: OrderedCompletion?(Expression(Integer)),...)

fricas
integrate(x^3+x^2/4+x,x)
 (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
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)
 (15)
Type: Union(Expression(Fraction(Integer)),...)

fricas
integrate(exp(cos(x)),x)
 (16)
Type: Union(Expression(Integer),...)

fricas
integrate(sin(x),x)
 (17)
Type: Union(Expression(Integer),...)
fricas
integrate(%,x)
 (18)
Type: Union(Expression(Integer),...)

fricas
integrate(a/h - c*h/12 + (b/h)*r + (c/h)*r^2,r)
 (19)
Type: Union(Expression(Integer),...)

fricas
integrate(exp(-(a+b*t)^2/2),t)
 (20)
Type: Union(Expression(Integer),...)

fricas
integrate(exp(-(a+b*t)^2/t),t)
 (21)
Type: Union(Expression(Integer),...)

fricas
integrate(exp(-1/t),t)
 (22)
Type: Union(Expression(Integer),...)

fricas
integrate(exp(-1/t),t=1..x)
 (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)
 (24)
Type: Union(Expression(Integer),...)

fricas
integrate(1/(a+z^3), z=0..1,"noPole")
 (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)
 (26)
Type: Union(f1: OrderedCompletion?(Expression(Integer)),...)
fricas
integrate(1/sqrt(2*%pi)*exp(-1/2*log(x)^2),x)
 (27)
Type: Union(Expression(Integer),...)

If you would get a result, you could use limit afterwards, of course.

Thu, 10 Feb 2005 17:45:57 -0600 reply
Area under the curve:
fricas
integrate(1/x,x=1..%plusInfinity)
 (28)
Type: Union(f1: OrderedCompletion?(Expression(Integer)),...)
Thu, 10 Feb 2005 17:47:59 -0600 replyVolume under that curve:
fricas
integrate(%pi*((1/x)^2), x=1..%plusInfinity)
 (29)
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)
 (30)
Type: Union(Expression(Integer),...)
fricas
integrate(sqrt(x),x)
 (31)
Type: Union(Expression(Integer),...)
fricas
integrate(sqrt(x^3+x),x)
 (32)
Type: Union(Expression(Integer),...)

a turning moving body --unknown, Sun, 19 Jun 2005 20:16:03 -0500 reply
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),...)

a turning accelerating body --unknown, Sun, 19 Jun 2005 23:16:48 -0500 reply
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)
 (33)
Type: Polynomial(Fraction(Integer))

fricas
integrate(1/(1+x^2),x=-u..u)
 (34)
Type: Union(pole: potentialPole,...)
fricas
integrate(1/(1+x^2),x=-u..u, "noPole")
 (35)
Type: Union(f1: OrderedCompletion?(Expression(Integer)),...)

fricas
integrate(x^6*exp(-x^2), x=0..%plusInfinity)
 (36)
Type: Union(f1: OrderedCompletion?(Expression(Integer)),...)

fricas
integrate(1/sqrt(1/x+1),x)
 (37)
Type: Union(Expression(Integer),...)

fricas
integrate(sin(sin x), x)
 (38)
Type: Union(Expression(Integer),...)

fricas
integrate(a/2*(1-cos(b*t)),t)
 (39)
Type: Union(Expression(Integer),...)

yet another test that shall work but not in maple ? --unknown, Thu, 09 Mar 2006 09:21:47 -0600 reply
fricas
integrate(tan(atan(x)/3),x)
 (40)
Type: Union(Expression(Integer),...)

fricas
integrate(x, x)
 (41)
Type: Polynomial(Fraction(Integer))
fricas
simplify((1/(2*z))*z^2)
 (42)
Type: Expression(Integer)
fricas
integrate((1/(2*z))*z^2, z)
 (43)
Type: Union(Expression(Integer),...)
fricas
integrate(log(x),x)
 (44)
Type: Union(Expression(Integer),...)
fricas
integrate(1/x,x)
 (45)
Type: Union(Expression(Integer),...)
fricas
integrate(0^0,x)
 (46)
Type: Polynomial(Fraction(Integer))

from fr.sci.maths --unknown, Tue, 09 May 2006 09:58:11 -0500 reply
fricas
integrate( log(y)^3/(y*(y-1)),y)
 (47)
Type: Union(Expression(Integer),...)

fricas
integrate(exp(-x^2),x=0..%plusInfinity)
 (48)
Type: Union(f1: OrderedCompletion?(Expression(Integer)),...)

fricas
integrate(x^2*exp(-x^2),x=0..%plusInfinity)
 (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)
 (50)
Type: Union(f1: OrderedCompletion?(Expression(Complex(Integer))),...)

FriCAS and Maxima not capable of this integrand --WinnieThePooh?, Tue, 29 May 2007 17:24:44 -0500 reply
 int(exp(sin(x)),x); reduce

fricas
integrate(exp(sin(x)),x)
 (51)
Type: Union(Expression(Integer),...)

An integral which Maxima can't do, but FriCAS can --amca01, Tue, 05 Jan 2010 15:08:53 -0800 reply
fricas
integrate(sqrt(x+sqrt(1+x^2))/x,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
 (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"
 (54)
Type: String

Test

fricas
ii := integral(sin(x), x)
x
++
(57)   |   sin(%A)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
 (56)
Type: Union(Expression(Integer),...)

 Subject:   Be Bold !! ( 16 subscribers )