Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168742
Image: ubuntu2004

Surface Integrals

Here, we are computing

    Sf(x,y,z)dσ\iint_S f(x,y,z)\, d\sigma

where ff is a scalar function, as in Exercises 6, 7, 8, 9, 13, 14 and 34 of Section 13.7 of the Stewart book ``Essential Calculus: Early Transcendentals."

First, we identify the integrand and the surface.  The specific ff and surface used in the cell below are appropriate for Exercise 5, Section 13.7.  Note that I have used uu and vv as parameters for the surface.

var('x y z u v') f(x,y,z) = y*z r = vector([u^2, u*sin(v), u*cos(v)]) f_times_dsigma(v,u) = f(*r) * diff(r,u).cross_product(diff(r,v)).norm()

If it is possible to compute the surface integral exactly, commands like those of the next cell (which relies on definitions made in the previous one) should do so.

startu = 0; endu = 1 a(u) = 0; b(u) = pi/2 innerint(u) = integral(f_times_dsigma(v,u), v, a, b) integral(innerint(u), u, startu, endu)
5/48*sqrt(5) + 1/240

Alternately, one might compute the integral numerically.  In fact, when antiderivatives are not to be found, this is how one must carry out an integral.  The next cell is one way to compute our surface integral numerically.

import scipy from scipy import integrate a(u) = 0; b(u) = pi/2 integrate.dblquad(f_times_dsigma, 0, 1, a, b)[0]
0.23709041432289477

Let us summarize the quantities which must be given or found during the computation of the surface integral.  You need not pay attention to the commands in the next cell.  However, if you make changes to the integrand and/or surface, you can re-execute it so as to update the results in the table it produces.

from sage.misc.html import math_parse as mp html.table([ [mp(r" $f(x,y,z)$"), f(x,y,z)], [mp(r" ${\mathbf r}(u,v)$"), r], [mp(r" $f({\mathbf r}(u,v))$"), f(*r)], [mp(r" ${\mathbf r}_u\times {\mathbf r}_v$"), diff(r,u).cross_product(diff(r,v))], [mp(r" $|{\mathbf r}_u\times {\mathbf r}_v|$"), diff(r,u).cross_product(diff(r,v)).norm()], [mp(r" $f({\mathbf r}(u,v)) |{\mathbf r}_u\times {\mathbf r}_v|$"), f(*r)*diff(r,u).cross_product(diff(r,v)).norm()] ])
f(x,y,z) y z
{\mathbf r}(u,v) \left(u^{2},u \sin\left(v\right),u \cos\left(v\right)\right)
f({\mathbf r}(u,v)) u^{2} \sin\left(v\right) \cos\left(v\right)
{\mathbf r}_u\times {\mathbf r}_v \left(-u \sin\left(v\right)^{2} - u \cos\left(v\right)^{2},2 \, u^{2} \sin\left(v\right),2 \, u^{2} \cos\left(v\right)\right)
|{\mathbf r}_u\times {\mathbf r}_v| \sqrt{{\left| -u \sin\left(v\right)^{2} - u \cos\left(v\right)^{2} \right|}^{2} + {\left| 2 \, u^{2} \sin\left(v\right) \right|}^{2} + {\left| 2 \, u^{2} \cos\left(v\right) \right|}^{2}}
f({\mathbf r}(u,v)) |{\mathbf r}_u\times {\mathbf r}_v| \sqrt{{\left| -u \sin\left(v\right)^{2} - u \cos\left(v\right)^{2} \right|}^{2} + {\left| 2 \, u^{2} \sin\left(v\right) \right|}^{2} + {\left| 2 \, u^{2} \cos\left(v\right) \right|}^{2}} u^{2} \sin\left(v\right) \cos\left(v\right)

Flux across a Surface

These are special surface integrals taking the form

    SFndσ\iint_S {\mathbf F} \cdot {\mathbf n}\,d\sigma.

This type of integral appears in Exercises 19, 20, 22, 25 and 26 of Section 13.7 in the Stewart text ``Essential Calculus: Early Transcentals."

The cells below have been tailored to the specifics of Exercise 21 of Section 13.7.

var('x y z u v') F = vector([x*z*exp(y), -x*z*exp(y), z]) r = vector([u, v, 1 - u - v]) full_integrand(v,u) = F(x=r[0], y=r[1], z=r[2]) * diff(r,u).cross_product(diff(r,v))

If it is possible to find the exact value of the flux integral, the next cell will do so.

startu = 0; endu = 1 a(u) = 0; b(u) = 1 - u innerint(u) = integral(full_integrand(v,u), v, a, b) integral(innerint(u), u, startu, endu)
1/6

Whether the value just computed is the correct answer or the negative of it depends on which of the two normals we picked to our surface.

In the next cell, we repeat this calculation using numerical integration (quadrature, as it is called), which should yield answers even when antiderivatives are unavailable.  The only downside is not having exact answers.

import scipy from scipy import integrate a(x)=0 b(x)=1-x integrate.dblquad(full_integrand,0,1,a,b)[0]
0.16666666666666669

The relevant quantities in the integral appear below.  They are contingent on your being able to find a valid parametrization of your surface using parameters uu and vv.

from sage.misc.html import math_parse as mp html.table([ [mp(r" ${\mathbf F}(x,y,z)$"), F], [mp(r" ${\mathbf r}(u,v)$"), r], [mp(r" ${\mathbf F}({\mathbf r}(u,v))$"), F(x=r[0], y=r[1], z=r[2])], [mp(r" ${\mathbf r}_u\times {\mathbf r}_v$"), diff(r,u).cross_product(diff(r,v))], [mp(r" ${\mathbf F}({\mathbf r}(u,v)) \cdot ({\mathbf r}_u\times {\mathbf r}_v)$"), F(x=r[0], y=r[1], z=r[2])*diff(r,u).cross_product(diff(r,v))] ])
{\mathbf F}(x,y,z) \left(x z e^{y},-x z e^{y},z\right)
{\mathbf r}(u,v) \left(u,v,-u - v + 1\right)
{\mathbf F}({\mathbf r}(u,v)) \left(-{\left(u + v - 1\right)} u e^{v},{\left(u + v - 1\right)} u e^{v},-u - v + 1\right)
{\mathbf r}_u\times {\mathbf r}_v \left(1,1,1\right)
{\mathbf F}({\mathbf r}(u,v)) \cdot ({\mathbf r}_u\times {\mathbf r}_v) -u - v + 1