Lateral Surface Area

## Description

This interact calculates the lateral surface area of a surface determined by two functions of two variables and a parametric curve on the xy plane. The user may change the top and bottom functions and the the parametric curve defining the surface.

## Sage Cell

#### Code

``````##  Display and compute the area of the lateral surface between two surfaces
##  corresponding to the (scalar) line integral
##  John Travis
##  Spring 2011
##

var('x,y,t,s')
@interact(layout=dict(top=[['f','u'],['g','v']],
left=[['a'],['b'],['in_3d'],['smoother']],
bottom=[['xx','yy']]))
def _(f=input_box(default=6-4*x^2-y^2*2/5,label='Top = \$f(x,y) = \$',width=30),
g=input_box(default=-2+sin(x)+sin(y),label='Bottom = \$g(x,y) = \$',width=30),
u=input_box(default=cos(t),label='   \$ x = u(t) = \$',width=20),
v=input_box(default=2*sin(t),label='   \$ y = v(t) = \$',width=20),
a=input_box(default=0,label='\$a = \$',width=10),
b=input_box(default=3*pi/2,label='\$b = \$',width=10),
xx = range_slider(-5, 5, 1, default=(-1,1), label='x view'),
yy = range_slider(-5, 5, 1, default=(-2,2), label='y view'),
in_3d = checkbox(default=true,label='3D'),
smoother=checkbox(default=false),
auto_update=true):

ds = sqrt(derivative(u,t)^2+derivative(v,t)^2)

#   Set up the integrand to compute the line integral, making all attempts
#   to simplify the result so that it looks as nice as possible.
A = (f(x=u,y=v)-g(x=u,y=v))*ds.simplify_trig().simplify()

#   It is not expected that Sage can actually perform the line integral calculation.
#   So, the result displayed may not be a numerical value as expected.
#   Creating a good but harder example that "works" is desirable.
#   If you want Sage to try, uncomment the lines below.

#    line_integral = integrate(A,t,a,b)
#    html(r'<align=center size=+1>Lateral Surface Area = \$ %s \$ </font>'%latex(line_integral))

line_integral_approx = numerical_integral(A,a,b)[0]

pretty_print(html(r'<font align=center size=+1>Lateral Surface \$ \approx \$ %s</font>'%str(line_integral_approx)))

#   Plot the top function z = f(x,y) that is being integrated.
G = plot3d(f,(x,xx[0],xx[1]),(y,yy[0],yy[1]),opacity=0.2)
G += plot3d(g,(x,xx[0],xx[1]),(y,yy[0],yy[1]),opacity=0.2)

#   Add space curves on the surfaces "above" the domain curve (u(t),v(t))
G += parametric_plot3d([u,v,g(x=u,y=v)],(t,a,b),thickness=2,color='red')
G += parametric_plot3d([u,v,f(x=u,y=v)],(t,a,b),thickness=2,color='red')
k=0
if smoother:
delw = 0.025
lat_thick = 3
else:
delw = 0.10
lat_thick = 10
for w in (a,a+delw,..,b):
G += parametric_plot3d([u(t=w),v(t=w),s*f(x=u(t=w),y=v(t=w))+(1-s)*g(x=u(t=w),y=v(t=w))],(s,0,1),thickness=lat_thick,color='yellow',opacity=0.9)

if in_3d:
show(G,stereo='redcyan',spin=true)
else:
show(G,perspective_depth=true,spin=true)```
```

none

## Tags

Primary Tags:

Secondary Tags:

A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.

## Related Cells

Any related cells go here. Provide a link to the page containing the information about the cell.