2014-03-31-calculus

2014-03-31-calculus
Sergey Mozgovoy
01 April 2014
Contents
1 Some integrals
1
2 Differential equations
4
3 Applications of integrals
5
1
Some integrals
• Integral
R2
0
x2 ex dx
x = var ( ’x ’)
A = integral ( x ^2* e ^x ,x ,0 ,2) ; A
2*e^2 - 2
A . n () # numerical value of A
12.7781121978613
plot ( x ^2* e ^x ,x ,0 ,2 , fill = true , figsize =4) # graph of the same curve
1
• Integral
R
1
x2 −3x+2 dx
integral (1/( x ^2 -3* x +2) ,x )
-log(x - 1) + log(x - 2)
• Integral
R
1
1+cos x dx
integral (1/(1+ cos ( x ) ) ,x )
sin(x)/(cos(x) + 1)
# A different method of integration can give the answer tan ( x /2) . Let us \
see that the graphs are the same :
plot ( tan ( x /2) ,(x ,0 ,3) , figsize =4) ;
2
plot ( sin ( x ) /( cos ( x ) +1) ,(x ,0 ,3) , figsize =4)
3
2
Differential equations
• Solve the initial value problem y 0 =
2x+1
2y−2 ,
y(0) = −1.
x = var ( ’x ’)
y = function ( ’y ’ ,x )
desolve ( diff (y , x ) ==(2* x +1) /(2* y -2) ,y ,[0 , -1])
y(x)^2 - 2*y(x) == x^2 + x + 3
solve ( y ^2 -2* y == x ^2+ x +3 , y ) # express y in terms of x ; condition y (0) = -1 \
implies that only the first solution fits
[y(x) == -sqrt(x^2 + x + 4) + 1, y(x) == sqrt(x^2 + x + 4) + 1]
• Solve the differential equation y 0 − y = x with an initial value condition y(0) = 2
x = var ( ’x ’)
y = function ( ’y ’ ,x )
desolve ( diff (y , x ) -y == x ,y ,[0 ,2])
4
-x + 3*e^x - 1
• Apply Eulers method with increment ∆ = 0.1 to approximate y(0.4) for the initial value problem
y 0 = x + y + 1, y(0) = 1
x , y = var ( ’x , y ’)
f (x , y ) = x + y +1
x =0; y =1; de =0.1
for i in range (5) :
print (i ,x , y )
y = y + f (x , y ) * de ;
(0, 0, 1)
(1, 0.100000000000000,
(2, 0.200000000000000,
(3, 0.300000000000000,
(4, 0.400000000000000,
x = x + de
1.20000000000000)
1.43000000000000)
1.69300000000000)
1.99230000000000)
This implies that y(0.4) ≈ 1.9923
3
Applications of integrals
• Find the volume of the solid of revolution generated by the region bounded by y = 2x − x2 and y = 0
x , y = var ( ’x , y ’) ;
f ( x ) =2* x - x ^2
solve ([ y == f ( x ) ,y ==0] , x , y ) # find the points of intersection
[[x == 2, y == 0], [x == 0, y == 0]]
The graph of f (x):
plot ( f ( x ) ,x , -1 ,3 , figsize =4)
5
V = pi * integral ( f ( x ) ^2 ,x ,0 ,2) ; V # the volume
16/15*pi
• Find the length of the curve y = x3/2 + 1 with x ∈ [0, 1]
f ( x ) = x ^(3/2) +1
L = integral ( sqrt (1+ diff (f , x ) ^2) ,x ,0 ,1) ; L # arc length
13/27*sqrt(13) - 8/27
L . n () # numerical value
1.43970987337155
6