This section is focused on applying tools provided by Sage to the concepts learned in this chapter. In particular, Sage allows us to avoid tedious algebraic computations in proving general formulas involving the gradient, divergence and curl. The relevant Sage commands are as follows (assuming we are working with fields in \(\RR^3\)):
You can also make use of the pretty_print() command to provide more readable output.
Example3.6.2.Proving the Product Rule for Gradients.
Let \(f(x,y,z)\) and \(g(x, y, z)\) be differentiable scalar fields in \(\RR^3\text{.}\) Prove that \(\del(fg) = f(\del g) + (\del f) g\text{.}\)
To prove this using Sage, you can complete the code cell below by filling in the variables lhs and rhs to represent the left hand and right hand sides of the equation
The final line of code, lhs == rhs, then checks if the two quantities are equal by returning True or False.
Example3.6.3.Computing a Laplacian.
The Laplacian of a scalar field \(f(x, y, z)\) is the scalar field \(\del^2 f\) where \(\del^2 = \div\del\text{.}\) In other words,
\begin{equation*}
\del^2 f = \divt(\del f)\text{.}
\end{equation*}
Use the Sage cell below to find formulas for both \(\del^2 f\) and \(\del^2 (fg)\text{.}\)
Example3.6.4.Checking if a Vector Field is Conservative.
Recall that a differentiable vector field \(\FF\) is conservative if \(\curl\FF = \vb{0}\text{.}\) With this in mind, determine if the vector field given by
\begin{equation*}
\FF = xyz\mqty[xy \amp yz \amp zx]
\end{equation*}
is conservative using the Sage cell below.
Example3.6.5.Computing a Vector Laplacian.
The vector Laplacian of a vector field \(\FF\) in \(\RR^3\) is the vector field \(\del^2\FF\) defined by