visualizing_line_integrals.mw

 

Area of a sheet: Interpreting line integrals with respect to arc length. 

 

> restart;
with(plots):
with(VectorCalculus):

sheetPlot := proc(f,fDom,r,rDom)
  local plotSurface, planeCurve, surfaceCurve, verticalSurface, plotTitle;

  plotSurface := plot3d(f(x,y),x=fDom[1],y=fDom[2],scaling=constrained,transparency=0.75);
  planeCurve := spacecurve(<r(t).<1,0>,r(t).<0,1>,0>,t=rDom,thickness=3,color=black);
  surfaceCurve := spacecurve(<r(t).<1,0>,r(t).<0,1>,f(r(t).<1,0>,r(t).<0,1>)>,t=rDom,thickness=2,color=blue,numpoints=5000);
  verticalSurface := plot3d(<r(t).<1,0>,r(t).<0,1>,s*f(r(t).<1,0>,r(t).<0,1>)>,t=rDom,s=0..1,color=green,numpoints=10000);

  #plotTitle := cat("Area = ",int(f(r(t).<1,0>,r(t).<0,1>)*Norm(r(t)),t=rDom)," = ",evalf(int(f(r(t).<1,0>,r(t).<0,1>)*Norm(r(t)),t=rDom)));

  #display({plotSurface,planeCurve,surfaceCurve,verticalSurface},scaling=constrained,title=plotTitle);


  # No plot title.
  display({plotSurface,planeCurve,surfaceCurve,verticalSurface},scaling=constrained);
end proc:
 

 

Example: Let plot and compute the area of the sheet below f(x, y) = VectorCalculus:-`+`(VectorCalculus:-`+`(4, VectorCalculus:-`-`(`*`(`^`(x, 2)))), VectorCalculus:-`-`(`*`(`^`(y, 2)))) and above the half circle VectorCalculus:-`+`(`*`(`^`(VectorCalculus:-`+`(x, -1), 2)), `*`(`^`(y, 2))) = 1 where `>=`(y, 0). 

 

"fDom" specifies the plot domain for the function f(x, y). Let's plot the graph of this function when its domain is restricted to the interior of the disk `<=`(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), 9).  

In other words, `and`(`<=`(-3, x), `<=`(x, 3)) and `and`(`<=`(VectorCalculus:-`-`(sqrt(VectorCalculus:-`+`(9, VectorCalculus:-`-`(`*`(`^`(x, 2)))))), y), `<=`(y, sqrt(VectorCalculus:-`+`(9, VectorCalculus:-`-`(`*`(`^`(x, 2))))))). 

 

"rDom" specifies the domain for our parameterized curve. In this case we parameterize the circle (using cosine and sine) and get r(t) = VectorCalculus:-`<,>`(VectorCalculus:-`+`(cos(t), 1), sin(t)). 

To restrict ourselves to the upper half of this circle we need `and`(`<=`(0, t), `<=`(t, Pi)). 

 

> f := (x,y) -> 4-x^2-y^2:
'f(x,y)' = f(x,y);

fDom := [-3..3,-sqrt(9-x^2)..sqrt(9-x^2)];

r := t -> <cos(t)+1,sin(t)>:
'r(t)' = r(t);

rDom := 0..Pi;
 

 

 

 

f(x, y) = `+`(`-`(`*`(`^`(x, 2))), `-`(`*`(`^`(y, 2))), 4)
[-3 .. 3, `+`(`-`(`*`(`^`(`+`(`-`(`*`(`^`(x, 2))), 9), `/`(1, 2))))) .. `*`(`^`(`+`(`-`(`*`(`^`(x, 2))), 9), `/`(1, 2)))]
r(t) = Vector[column](%id = 18446746091610103926)
0 .. Pi (1)
 

 

The "Int" command is inert. This is just there to print out a "nice" looking line integral. [Note:  \x20 is the code for a blank space. This makes the upper bound in the integral appear empty.] 

 

I added in a yellow xy-plane. Recall that the line integral is computing net area under the curve just like a regular definite integral. 

 

> Int(f(x,y),s=C..\x20) = int(f(r(t).<1,0>,r(t).<0,1>)*Norm(diff(r(t),t)),t=rDom);

display(sheetPlot(f,fDom,r,rDom),plot3d(0,x=-3..3,y=-3..3,color=yellow));
 

 

Int(`+`(`-`(`*`(`^`(x, 2))), `-`(`*`(`^`(y, 2))), 4), s = C .. ()) = `+`(`*`(2, `*`(Pi)))
Plot_2d
 

 

Example: Plot and find the net area of the sheet above/below f(x, y) = VectorCalculus:-`*`(2, sin(VectorCalculus:-`+`(`*`(`^`(x, 2)), y))) and the ellipse VectorCalculus:-`+`(VectorCalculus:-`*`(`*`(`^`(x, 2)), `/`(1, 9)), VectorCalculus:-`*`(`*`(`^`(y, 2)), `/`(1, 4))) = 1. 

 

> f := (x,y) -> 2*sin(x^2+y):
'f(x,y)' = f(x,y);

fDom := [-Pi..Pi,-Pi..Pi];

r := t -> <3*cos(t),2*sin(t)>:
'r(t)' = r(t);

rDom := 0..2*Pi;
 

 

 

 

f(x, y) = `+`(`*`(2, `*`(sin(`+`(`*`(`^`(x, 2)), y)))))
[`+`(`-`(Pi)) .. Pi, `+`(`-`(Pi)) .. Pi]
r(t) = Vector[column](%id = 18446746091567960062)
0 .. `+`(`*`(2, `*`(Pi))) (2)
 

> Int(f(x,y),s=C..\x20) = int(f(r(t).<1,0>,r(t).<0,1>)*Norm(diff(r(t),t)),t=rDom);
Int(f(x,y),s=C..\x20) = evalf(int(f(r(t).<1,0>,r(t).<0,1>)*Norm(diff(r(t),t)),t=rDom));

display(sheetPlot(f,fDom,r,rDom),viewpoint=circleleft);
 

 

 

Int(`+`(`*`(2, `*`(sin(`+`(`*`(`^`(x, 2)), y))))), s = C .. ()) = int(`+`(`*`(2, `*`(sin(`+`(`*`(9, `*`(`^`(cos(t), 2))), `*`(2, `*`(sin(t))))), `*`(`^`(`+`(`-`(`*`(5, `*`(`^`(cos(t), 2)))), 9), `/`(1...
Int(`+`(`*`(2, `*`(sin(`+`(`*`(`^`(x, 2)), y))))), s = C .. ()) = 2.496235883
Plot_2d