0% found this document useful (0 votes)
147 views7 pages

Line Integral and Greens Theorem

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views7 pages

Line Integral and Greens Theorem

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

LINE INTEGRAL AND GREEN’S THEOREM

Definition: let ⃗
F be a continuous vector filed defined on a smooth curve C given by a
vector function r⃗ ( t ) , a ≤ t ≤ b. Then the line integral of ⃗
F along C is integral
❑ b

∫ ⃗F ∙ d r⃗=¿ ∫ ⃗F (⃗r (t))∙ ⃗r ' (t) d t


C a

inline(expr) Constructs an inline function object from


the MATLAB expression contained in the
string expr.
vectorize(fun) Inserts a . before any ^, * or / in s. The
result is a character string
quiver(x,y,u,v) Displays velocity vectors as arrows with
components (u,v) at the points (x,y)
quiver3(x,y,z,u,v,w) Plots vectors with components (u,v,w) at
the points (x,y,z))
vectarrow(p0,p1) Plots a line vector with arrow pointing
from point p0 to point p1. The function
can plot both 2D and 3D vector with
arrow depending on the dimension of the
input

Matlab code
clc
clear
syms t x y
f=input('enter the f vector as i and j order in vector
form:');
rbar = input('enter the r vector as i and j order in vector
form:');
lim=input('enter the limit of integration:');
vecfi=input('enter the vector field range'); % knowledge of
the curve is essential
drbar=diff(rbar,t);
sub = subs(f,[x,y],rbar);
f1=dot(sub,drbar)
int(f1,t,lim(1),lim(2))
P = inline(vectorize(f(1)), 'x', 'y');
Q = inline(vectorize(f(2)), 'x', 'y')
x = linspace(vecfi(1),vecfi(2), 10); y = x;
[X,Y] = meshgrid(x,y);
U = P(X,Y);
V = Q(X,Y);
quiver(X,Y,U,V)
hold on
fplot(rbar(1),rbar(2),[lim(1),lim(2)])
axis on
xlabel('x')
ylabel('y')

Example 1
2⃗ ⃗j in moving a particle along the
Find the work done by the force field ⃗
F (x , y )=x i−xy
π
quarter – circle r⃗ (t )=cos ( t ) ⃗i + sin ⁡(t) ⃗j , 0≤ t ≤
2

Sol:
π π

2 2
∫ ⃗F ∙ d r⃗=¿ ∫ ⃗F (⃗r (t))∙ ⃗r ❑'❑ ( t ) dt=∫ ¿¿
C
0 0

In the command window

enter the f vector as i and j order in vector form:


[x^2 -x*y]
enter the r vector as i and j order in vector form:
[cos(t) sin(t)]
enter the limit of integration:
[0 pi/2]
enter the vector field range
[0 2]
ans = -2/3
In the figure window
The above figure shows the force field and the curve. The work done is negative because
the field impedes movement along the curve.

Example 2

Evaluate the line integral ∫ ⃗


F ∙ d r⃗ , ⃗
F ( x , y )=( x− y ) ⃗i + xy ⃗j, C is the arc of the circle
C

x + y =4 traversed counter-clockwise from (2, 0) to(0, -2)


2 2

In the command window

enter the f vector as i and j order in vector form:


[x-y x*y]
enter the r vector as i and j order in vector form:
[2*cos(t) 2*sin(t)]
enter the limit of integration:
[0, 3*pi/2]
enter the vector field range
[-2.5 2.5]
ans = 3*pi + 2/3
The above figure shows the force field and the curve. The work done is positive.

Exercise
1. Find the work done by the force field ⃗ F ( x , y )=( y+ z , x+ z , x+ y) on a particle that moves
along the line segment (1, 0, 0) to (3, 4, 2)

2. Find the work done by the force field ⃗


F ( x , y )=x sin ( y ) i⃗ + y ⃗j on a particle that moves
2
along the curve y=x from (-1, 1) to (2, 4)

3.Evaluate ∫ ⃗F ∙ d r⃗ , ⃗F ( x , y , z )= y sin ( z ) i⃗ + z sin ( x ) ⃗j+ x sin ( y ) ⃗k and


C

r⃗ ( t )=cos ( t ) i⃗ +sin ( t ) ⃗j+sin ⁡( 5t ) k⃗ , 0≤ t ≤ π .


GREEN’S THEOREM

Let C be a positively oriented, piecewise-smooth, simple closed curve in the plane


and let D be the region bounded by C. If P and Q have continuous partial
derivatives on an open region that contains D, then
❑ ❑

∫ Pdx +Q dy=∬ ( ∂∂Qx − ∂∂ Py ) dA


C D

Example 1

Evaluate ∮ ( 3 y −e
sin ( x )
) dx + ( 7 x + √ y 4 +1 ) dy , where C is the circle x 2+ y 2=9.
C

clc
clear all
syms x y r t
F=input('enter the F vector as i and j order in vector form:');
integrand=diff(F(2),x)-diff(F(1),y);
polarint=r*subs(integrand,[x,y],[r*cos(t),r*sin(t)]);
sol=int(int(polarint,r,0,3),t,0,2*pi);
P = inline(vectorize(F(1)), 'x', 'y');
Q = inline(vectorize(F(2)), 'x', 'y')
x = linspace(-3.2,3.2, 10); y = x;
[X,Y] = meshgrid(x,y);
U = P(X,Y);
V = Q(X,Y);
quiver(X,Y,U,V)
hold on
fplot(3*cos(t),3*sin(t),[0,2*pi])
axis equal

In the command window


enter the F vector as i and j order in vector form:
[3*y-exp(sin(x)) 7*x+ sqrt(y^4+1)]
sol = 36*pi
In the figure window
Example 2

Evaluate ∮ ( y ) dx + ( 3 xy ) dy , where C is the boundary of the semiannular region D in


2

the upper –plane between the circles x 2+ y 2=1 and x 2+ y 2=4.

Matlab code

clc
clear all
syms x y r t
F=input('enter the F vector as i and j order in vector form:');
integrand=diff(F(2),x)-diff(F(1),y);
polarint=r*subs(integrand,[x,y],[r*cos(t),r*sin(t)]);
sol=int(int(polarint,r,1,2),t,0,pi);
P = inline(vectorize(F(1)), 'x', 'y');
Q = inline(vectorize(F(2)), 'x', 'y')
x = linspace(-3.2,3.2,10); y = x;
[X,Y] = meshgrid(x,y);
U = P(X,Y);
V = Q(X,Y);
quiver(X,Y,U,V)
hold on
fplot(1*cos(t),1*sin(t),[0,pi])
fplot(2*cos(t),2*sin(t),[0,pi])
axis equal
enter the F vector as i and j order in vector form:
[y^2 3*x*y]

sol = 14/3

You might also like