Mathematica Cookbook by Mangano Sal

Mathematica Cookbook by Mangano Sal

Author:Mangano, Sal [Sal Mangano]
Language: eng
Format: epub
Tags: COMPUTERS / Mathematical & Statistical Software
ISBN: 9781449390761
Publisher: O'Reilly Media
Published: 2010-04-01T16:00:00+00:00


If we use a constant function (uniform density), we get the surface area of the half sphere as expected (surface area of an entire sphere is 4 πr2).

In[97]:= g2[{x_, y_, z_}] := 1 surfaceIntegralScalar[g2, f1, {ϕ, 0, Pi/2}, {θ, 0, 2 Pi}] Out[98]= 2 π

For a vector field, there is a similar equation using Dot in place of scalar multiplication by the norm. The traditional way to visualize the vector surface interval is to consider a fluid flowing through a surface where there is a vector function F describing the velocity of the fluid at various points on the surface. The surface integral is then the flux, or the quantity of fluid flowing through the surface in unit time.

In[99]:= surfaceIntegralVector[F_, f_, {v1_, v1a_, v1b_}, {v2_, v2a_, v2b_}] := Integrate[Dot[F[f[v1, v2]], Cross[D[f[v1, v2], v1], D[f[v1, v2], v2]]], {v1, v1a, v1b}, {v2, v2a, v2b}]

Here is the solution to the flux described by {3 y, -z, x^2} through a surface described parametrically as {s t, s + t, (s^2 - t^2)/2}.

In[100]:= f[s_, t_] := {s t, s + t, (s^2 - t^2) /2} F[{x_, y_, z_}] := {3 y, -z, x^2} surfaceIntegralVector[F, f, {s, 0, 1}, {t, 0, 3}] Out[102]= -15

A standard result from electrostatics is that the net flux out of a unit sphere, for a field that is everywhere normal, is zero. We can verify this as follows:

In[103]:= F2[{x_, y_, z_}] := {1, 1, 1}/(x^2 + y^2 + z^2) In[104]:= f2[θ_, ϕ_] := {Sin[ϕ] Cos[θ], Sin[ϕ] Sin[θ], Cos[ϕ]} In[105]:= surfaceIntegralVector[F2, f2, {θ, 0, 2 Pi}, {ϕ, 0, Pi}] Out[105]= 0



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.