Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168741
Image: ubuntu2004

Calculate the line integral of C+(ydx+xdy)\int_{C^+} \,(-ydx+xdy) \, for each of the curves C+C^+ from (0,0) to (1,1)

Cool graphs with explanations are at the bottom of each problem!

Other Sage pages for Line Integral of Work Type:    SOLVER  


Formula Sheet  C+P(x,y,z)dx+Q(x,y,z)dy+R(x,y,z)dz=CFds= t1t2<P(t),Q(t),R(t)><x˙,y˙,z˙>dt\int_{C^+} P(x,y,z)\, dx+Q(x,y,z) \,dy+R(x,y,z) \,dz = \int_C \vec F \cdot d \vec s = \int_{t_1}^{t_2}\, \lt P(t), Q(t), R(t) \gt \cdot \lt \dot{x}, \dot{y},\dot{z} \gt \, dt

where C is the curve parameterized by s(t)=<x(t),y(t),z(t)>\vec s(t)= \lt x(t),\, y(t),\, z(t) \gt with given orientation t[t1,t2]t \in [t1,t2] and F=<P,Q,R>\vec F= \lt P,Q,R \gt.



SOLUTION TO PROBLEMS 

Check type of line integral: This line integral is of work type (Type II) since the integrand is a vector function (it has components: P=-y and Q=x) - watch the video.

Preparation for SOLVER: We must parameterize the curve C with a vector function s(t)\vec s(t) in 1 parameter t, find the interval and check that the order of this interval puts the orientation of the curve as given.

Work particular to the given problems: All curves are 2d and given explicitly with interval: x[0,1]x \in [0,1 ]. We simply let x=t, y=f(t) and z=0 with interval: t[0,1]t\in [0,1 ]




Problem 1: Calculate the line integral of work type C(ydx+xdy)\int_C \,(-ydx+xdy) where C:y=x2C: y=x^2 from (0,0) to (1,1).

Step 0: The program declares our variables. We are given variables (x,y,z). We need t as parameter.

var ('t'); var('x y z')
t (x, y, z)

Step 1: We define C(t)=s(t)C(t)=\vec s(t), the interval of t and F\vec F. Changes with problem; you must input your parametrization of the curve, your interval for t (check orientation) and your vector function F(x,y,z).

s=vector((t,t^2,0)) t1=0; t2=1 F=vector((-y,x,0))

Step 2: The program finds the vector function with the partial derivatives: ds(t)=<x˙,y˙,z˙>d \vec s(t)=\lt {\dot{x}},\, {\dot{y}},\, {\dot{z}} \gt

ds=diff(s,t) view(ds)
\newcommand{\Bold}[1]{\mathbf{#1}}\left(1,\,2 \, t,\,0\right)

Step 3: The program defines a standard sage function for "change of variables" for a 1-variable parametrization (curve).

The program changes the variables of F\vec F from a vector in x, y, z to a vector of t using the components of s(t).

def changevar(f, eqn, newvar1): return f.substitute(eqn)
F=changevar(F,x==s[0],t) F=changevar(F,y==s[1],t) F=changevar(F,z==s[2],t) view(F)
\newcommand{\Bold}[1]{\mathbf{#1}}\left(-t^{2},\,t,\,0\right)

Step 4: Then program finds the dot product of the vectors from Step2 and Step3.

integrand=F.dot_product(ds) view(integrand)
\newcommand{\Bold}[1]{\mathbf{#1}}t^{2}

Step 6: The program computes the integral (work).

result=integral(integrand,(t,t1,t2)) view(result)
\newcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{3}
n(result)
\newcommand{\Bold}[1]{\mathbf{#1}}0.333333333333333


So the work done by F=<y,x>\vec F = \lt -y, \, x \gt along the line curve y=x2y=x^2 from (0,0) to (1,1) is: C(ydx+xdy)=1/30.33\int_C \,(-ydx+xdy) =1/3 \approx 0.33  



Graph 1: We graph the vector field F\vec F and the curve y=x2y=x^2  from (0,0) to (1,1).

  • Remember the orientation of the curve is from (0,0) to (1,1).
  • With respect to this orientation, the vector field  F\vec F is "mildly positive" with respect to the curve, i.e. they are pointing slightly in the direction of the orientation.
  • So some "work" is being done along the line. 
xmin=-2; xmax=2; ymin=-2; ymax=2; zmin=-1; zmax=1 VF=plot_vector_field(vector((-y,x)), (x,xmin,xmax),(y,ymin,ymax), color='red') C=parametric_plot(vector((t,t^2)),(t,0,1)) show(VF+C)



Problem 2: Calculate the line integral of work type C(ydx+xdy)=0\int_C \,(-ydx+xdy) =0\, where C:y=xC: y=\sqrt{x}


Step 0: The program declares our variables. We are given variables (x,y,z). We need t as parameter.

var ('t'); var('x y z')
\newcommand{\Bold}[1]{\mathbf{#1}}t
\newcommand{\Bold}[1]{\mathbf{#1}}\left(x, y, z\right)

Step 1: We define C(t)=s(t)C(t)=\vec s(t), the interval of t and F\vec F. Changes with problem; you must input your parametrization of the curve, your interval for t (check orientation) and your vector function F(x,y,z).

s2=vector((t,sqrt(t),0)) t1=0; t2=1 F2=vector((-y,x,0))

Step 2: The program finds the vector function with the partial derivatives: ds(t)=<x˙,y˙,z˙>d \vec s(t)=\lt {\dot{x}},\, {\dot{y}},\, {\dot{z}} \gt

ds2=diff(s2,t) view(ds2)
\newcommand{\Bold}[1]{\mathbf{#1}}\left(1,\,\frac{1}{2 \, \sqrt{t}},\,0\right)

Step 3: The program defines a standard sage function for "change of variables" for a 1-variable parametrization (curve).

The program changes the variables of F\vec F from a vector in x, y, z to a vector of t using the components of s(t).

def changevar(h, eqn, newvar1): return h.substitute(eqn)
F2=changevar(F2,x==s2[0],t) F2=changevar(F2,y==s2[1],t) F2=changevar(F2,z==s2[2],t) view(F2)
\newcommand{\Bold}[1]{\mathbf{#1}}\left(-\sqrt{t},\,t,\,0\right)

Step 4: Then program finds the dot product of the vectors from Step2 and Step3.

integrand2=F2.dot_product(ds2) view(integrand2)
\newcommand{\Bold}[1]{\mathbf{#1}}-\frac{1}{2} \, \sqrt{t}

Step 6: The program computes the integral (work).

result2=integral(integrand2,(t,t1,t2)) view(result2)
\newcommand{\Bold}[1]{\mathbf{#1}}-\frac{1}{3}
n(result2)
\newcommand{\Bold}[1]{\mathbf{#1}}-0.333333333333333


So the work done by F=<y,x>\vec F = \lt -y, \, x \gt along the line curve y=xy=\sqrt{x} from (0,0) to (1,1) is: C(ydx+xdy)=1/30.33\int_C \,(-ydx+xdy) = -1/3 \approx -0.33  



Graph 2: We graph the vector field F\vec F and the curve y=xy=\sqrt{x}  from (0,0) to (1,1).

  • Remember the orientation of the curve is from (0,0) to (1,1).
  • With respect to this orientation, the vector field  F\vec F is "mildly negative" That is, the arrows point "backwards". 
  • So some "work" is being lost along the line. 
xmin=-2; xmax=2; ymin=-2; ymax=2; zmin=-1; zmax=1 VF2=plot_vector_field(vector((-y,x)), (x,xmin,xmax),(y,ymin,ymax), color='red') C2=parametric_plot(vector((t,sqrt(t))),(t,0,1)) show(VF2+C2)



Problem 3: Calculate the line integral of work type C(ydx+xdy)=0\int_C \,(-ydx+xdy) =0\, where C:y=sin(πx2)C: \,\, y=sin(\frac{\pi x}{2})


Step 0: The program declares our variables. We are given variables (x,y,z). We need t as parameter.

var ('t'); var('x y z')
\newcommand{\Bold}[1]{\mathbf{#1}}t
\newcommand{\Bold}[1]{\mathbf{#1}}\left(x, y, z\right)

Step 1: We define C(t)=s(t)C(t)=\vec s(t), the interval of t and F\vec F. Changes with problem; you must input your parametrization of the curve, your interval for t (check orientation) and your vector function F(x,y,z).

s3=vector((t,sin(pi*t/2),0)) t1=0; t2=1 F3=vector((-y,x,0))

Step 2: The program finds the vector function with the partial derivatives: ds(t)=<x˙,y˙,z˙>d \vec s(t)=\lt {\dot{x}},\, {\dot{y}},\, {\dot{z}} \gt

ds3=diff(s3,t) view(ds3)
\newcommand{\Bold}[1]{\mathbf{#1}}\left(1,\,\frac{1}{2} \, \pi \cos\left(\frac{1}{2} \, \pi t\right),\,0\right)

Step 3: The program defines a standard sage function for "change of variables" for a 1-variable parametrization (curve).

The program changes the variables of F\vec F from a vector in x, y, z to a vector of t using the components of s(t).

def changevar(h, eqn, newvar1): return h.substitute(eqn)
F3=changevar(F3,x==s3[0],t) F3=changevar(F3,y==s3[1],t) F3=changevar(F3,z==s3[2],t) view(F3)
\newcommand{\Bold}[1]{\mathbf{#1}}\left(-\sin\left(\frac{1}{2} \, \pi t\right),\,t,\,0\right)

Step 4: Then program finds the dot product of the vectors from Step2 and Step3.

integrand3=F3.dot_product(ds3) view(integrand3)
\newcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{2} \, \pi t \cos\left(\frac{1}{2} \, \pi t\right) - \sin\left(\frac{1}{2} \, \pi t\right)

Step 6: The program computes the integral (work).

result3=integral(integrand3,(t,t1,t2)) view(result3)
\newcommand{\Bold}[1]{\mathbf{#1}}\frac{\pi - 4}{\pi}
n(result3)
\newcommand{\Bold}[1]{\mathbf{#1}}-0.273239544735163


So the work done by F=<y,x>\vec F = \lt -y, \, x \gt along the line curve $y=\sin ({{\pi x} \over 2})$ from (0,0) to (1,1) is: C(ydx+xdy)=π4π0.27\int_C \,(-ydx+xdy) = \frac{\pi-4}{\pi} \approx -0.27  



Graph 1: We graph the vector field F\vec F and the curve $y=\sin ({{\pi x} \over 2})$  from (0,0) to (1,1).

  • Remember the orientation of the curve is from (0,0) to (1,1).
  • With respect to this orientation, it is hard to tell exactly the direction of the vector field  F\vec F
  • Our calculations show us that some work is lost.
xmin=-2; xmax=2; ymin=-2; ymax=2; zmin=-1; zmax=1 VF3=plot_vector_field(vector((-y,x)), (x,xmin,xmax),(y,ymin,ymax), color='red') C3=parametric_plot(vector((t,sin(pi*t/2))),(t,0,1)) show(VF3+C3)