Exercises |
Problem1:
Compute the line integral |
> #
/ | | sin(x) dx | / C
where C is the arc of the curve x=y^4 from (1,-1) to (1,1).
|
Solution1:
If we use the parametrization: |
> y := t; x := t^4; dx := diff(x,t); dy := diff(y,t);
y := t 4 x := t 3 dx := 4 t dy := 1
here and in the rest of these problems dx and dy stand for the
derivatives with respecto to t of x and y respectively and not
for the usual differential that would include the additional
multiplication by dt. The line integral is then: |
> ans1 := Int(sin(x)*dx,t=-1..1)=int(sin(x)*dx,t=-1..1);
1 / | 4 3 ans1 := | 4 sin(t ) t dt = 0 | / -1
Notice that the integral is trivially 0 since we are integrating
an odd function over a symmetric (about 0) domain i.e. [-1,1].
|
Problem2:
Before the statement of the next problem let us write a little proc for cleanning up the variables quickly: |
> clean := proc()
> global x,y,z,dx,dy,dz;
> x :='x': y:='y' : z:= 'z':
> dx := 'dx': dy := 'dy' : dz := 'dz':
> end:
Now we are ready for problem2: Compute |
> clean():
> Int(y*z*dx + x*z*dy + x*y*dz,t);
/ | | y z dx + x z dy + x y dz | / C
where C consists of the line segments from the origin to (1,1,2), from
(1,1,2) to (2,-1,2) and from (2,-1,2) back to the origin.
i.e. a triangle!
|
Solution2:
First split the integral into 3 parts I1,I2 and I3 along each of the three segments. The answer is just I1+I2+I3. We need to parametrize each segment. The first segment from (0,0,0) to (1,1,2) is: |
> with(linalg): r := evalm([0,0,0]+t*([1,1,2]-[0,0,0]));
r := [ t, t, 2 t ]> x:=r[1]; y:=r[2]; z:=r[3]; dx:=diff(x,t);dy:=diff(y,t);dz:=diff(z,t);
x := t y := t z := 2 t dx := 1 dy := 1 dz := 2
(don't forget what we said above about the dx,dy...) so the integral is: |
> I1 := Int(y*z*dx + x*z*dy + x*y*dz,t=0..1) =
> int(y*z*dx + x*z*dy + x*y*dz,t=0..1);
1 / | 2 I1 := | 6 t dt = 2 | / 0
Now the second segment from (1,1,2) to (2,-1,2): |
> r := evalm([1,1,2]+t*([2,-1,2]-[1,1,2]));
r := [ 1 + t, 1 - 2 t, 2 ]> x:=r[1]; y:=r[2]; z:=r[3]; dx:=diff(x,t);dy:=diff(y,t);dz:=diff(z,t);
x := 1 + t y := 1 - 2 t z := 2 dx := 1 dy := -2 dz := 0> I2 := Int(y*z*dx + x*z*dy + x*y*dz,t=0..1) =
1 / | I2 := | - 2 - 8 t dt = -6 | / 0
and finally the last segment from (2,-1,2) to (0,0,0) is: |
> r:=evalm([2,-1,2]+t*[-2,1,-2]);
r := [ 2 - 2 t, - 1 + t, 2 - 2 t ]> x:=r[1]; y:=r[2]; z:=r[3]; dx:=diff(x,t);dy:=diff(y,t);dz:=diff(z,t);
x := 2 - 2 t y := - 1 + t z := 2 - 2 t dx := -2 dy := 1 dz := -2> I3 := Int(y*z*dx + x*z*dy + x*y*dz,t=0..1) =
1 / | 2 I3 := | - 4 (- 1 + t) (2 - 2 t) + (2 - 2 t) dt = 4 | / 0
The integral over the whole boundary of the triangle is then: |
> ans2 := I1+I2+I3;
ans2 := 1 1 1 / / / | 2 | | 2 | 6 t dt + | - 2 - 8 t dt + | - 4 (- 1 + t) (2 - 2 t) + (2 - 2 t) dt | | | / / / 0 0 0 = 0
Hmmm all this work to get 0? Well.. in fact we'd be able to deduce that
the answer is zero if we knew that F=[yz,xz,xy] is a conservative
vector field (since its curl is 0) and that line integrals of
conservative vector fields over close paths are always 0.
|
Problem3:
Compute the work done by the force field F=[x,y+2] in moving an object along an arch (t from 0 to 2Pi) of the cycloid: |
> r :=evalm([t-sin(t),1-cos(t)]);
r := [ t - sin(t), 1 - cos(t) ]
|
Solution3:
The cycloid is given by: |
> x:=r[1];y:=r[2];dx:=diff(x,t);dy:=diff(y,t);
x := t - sin(t) y := 1 - cos(t) dx := 1 - cos(t) dy := sin(t)> ans3 := Int(x*dx+(y+2)*dy,t=0..2*Pi) = int(x*dx+(y+2)*dy,t=0..2*Pi);
2 Pi / | 2 ans3 := | (t - sin(t)) (1 - cos(t)) + (3 - cos(t)) sin(t) dt = 2 Pi | / 0
|
Problem4:
Write a maple procedure for computing the line integral of a vector
field F over a parametrized curve r. Call it lint.
|
Solution4:
Here it is. lint expects a vector F (of dim 2 or 3) with expressions in x,y and z, a vector r with expressions in a parameter (usually t) and a range for the parameter like t=a..b (see examples below). |
> lint := proc(F,r,range)
> local t,a,b,P,Q,R,dx,dy,dz,Li,li,f;
> global x,y,z;
> t := eval(op(1,range));
> a := op(1,op(2,range));
> b := op(2,op(2,range));
> x := r[1];
> dx := diff(x,t);
> y := r[2];
> dy := diff(y,t);
> if nops(linalg[evalm](F)) = 2 then z := 0; dz := 0; R := 0
> else z := r[3]; dz := diff(z,t); R := F[3]
> fi;
> Q := F[2];
> P := F[1];
> f := eval(P*dx+Q*dy+R*dz);
> Li := Int(P*'dx'+Q*'dy'+R*'dz',oes);
> li := int(f,t = a .. b);
> x := 'x';
> y := 'y';
> z := 'z';
> RETURN(Li = li)
> end;
lint := proc(F,r,range) local t,a,b,P,Q,R,dx,dy,dz,Li,li,f; global x,y,z; t := eval(op(1,range)); a := op(1,op(2,range)); b := op(2,op(2,range)); x := r[1]; dx := diff(x,t); y := r[2]; dy := diff(y,t); if nops(linalg[evalm](F)) = 2 then z := 0; dz := 0; R := 0 else z := r[3]; dz := diff(z,t); R := F[3] fi; Q := F[2]; P := F[1]; f := eval(P*dx+Q*dy+R*dz); Li := Int(P*'dx'+Q*'dy'+R*'dz',oes); li := int(f,t = a .. b); x := 'x'; y := 'y'; z := 'z'; RETURN(Li = li) end
Let's try it with problem 3. |
> lint([x,y+2,0],[t-sin(t),1-cos(t),0],t=0..2*Pi);
/ | 2 | (t - sin(t)) dx + (3 - cos(t)) dy does = 2 Pi | /
Let's try it again with I3 of problem 2: |
> r := [2-2*t,t-1,2-2*t]: F := [y*z,x*z,x*y]:
> lint(F,r,t=0..1);
/ | | y z dx + x z dy + x y dz does = 4 | /
I like lint.. don't you? But wait isn't the above proc unnecessarily long?... You bet! Lint below does it in any number of dimensions and it is only 1 instruction. We need, however, to give F and r as funcitons instead of just vectors of expressions. |
> Lint := proc(F,r,range)
> local t;
> t := op(1,range);
> int(linalg[innerprod](F(op(r(t))),map(diff,r(t),t)),range)
> end;
Lint := proc(F,r,range) local t; t := op(1,range); int(linalg[innerprod](F(op(r(t))),map(diff,r(t),t)),range) end> F := unapply(F,x,y,z); r := unapply(r,t);
F := (x,y,z) -> [y z, x z, x y] r := t -> [2 - 2 t, - 1 + t, 2 - 2 t]> Lint(F,r,t=a..b);
3 2 3 2 12 b + 4 b - 12 b - 12 a - 4 a + 12 a> Lint(F,r,t=0..1);
4
Cool! |