diff --git a/quarto/alternatives/symbolics.qmd b/quarto/alternatives/symbolics.qmd index bed78cd..0a36132 100644 --- a/quarto/alternatives/symbolics.qmd +++ b/quarto/alternatives/symbolics.qmd @@ -142,7 +142,7 @@ The `TermInterface` package is used by `SymbolicUtils` to explore the tree struc * `istree(ex)`: `true` if `ex` is not a *leaf* node (like a symbol or numeric literal) * `operation(ex)`: the function being called (if `istree` returns `true`) - * `arguments(ex)`: the arguments to the function begin called + * `arguments(ex)`: the arguments to the function being called * `symtype(ex)`: the inferred type of the expression @@ -447,7 +447,7 @@ Symbolics.get_variables(ex) ### Polynomial manipulations -There are some facilities for manipulating polynomial expressions in `Symbolics`. A polynomial, mathematically, is an expression involving one or more symbols with coefficients from a collection that has, at a minimum, addition and multiplication defined. The basic building blocks of polynomials are *monomials*, which are comprised of products of powers of the symbols. Mathematically, monomials are often allowed to have a multiplying coefficient and may be just a coefficient (if each symbol is taken to the power $0$), but here we consider just expressions of the type $x_1^{a_1} \cdot x_2^{a_2} \cdots x_k^{a_k}$ with the $a_i > 0$ as monomials. +There are some facilities for manipulating polynomial expressions in `Symbolics`. A polynomial, mathematically, is an expression involving one or more symbols with coefficients from a collection that has, at a minimum, addition and multiplication defined. The basic building blocks of polynomials are *monomials*, which are comprised of products of powers of the symbols. Mathematically, monomials are often allowed to have a multiplying coefficient and may be just a coefficient (if each symbol is taken to the power $0$), but here we consider just expressions of the type $x_1^{a_1} \cdot x_2^{a_2} \cdots \cdot x_k^{a_k}$ with the $a_i > 0$ as monomials. With this understanding, then an expression can be broken up into monomials with a possible coefficient (possibly just $1$) *and* terms which are not monomials (such as a constant or a more complicated function of the symbols). This is what is returned by the `polynomial_coeffs` function. @@ -461,7 +461,7 @@ For example d, r = polynomial_coeffs(a*x^2 + b*x + c, (x,)) ``` -The first term output is a dictionary with keys which are the monomials and with values which are the coefficients. The second term, the residual, is all the remaining parts of the expression, in this case just the constant `c`. +The first term output is a dictionary with keys which are the monomials and with values which are the coefficients. The second term, the residual, is all the remaining parts of the expression, in this case just $0$. The expression can then be reconstructed through @@ -802,7 +802,7 @@ The example in the [paper](https://arxiv.org/pdf/2201.12468v2.pdf) describing th $$ -\int f(x) dx = q_1 x + q_2 \sin(x) + q_3 \cos(x) + q_4 x \sin(x) + q_4 x \cos(x) +\int f(x) dx = q_1 x + q_2 \sin(x) + q_3 \cos(x) + q_4 x \sin(x) + q_5 x \cos(x) $$ We differentiate the right hand side: diff --git a/quarto/integral_vector_calculus/div_grad_curl.qmd b/quarto/integral_vector_calculus/div_grad_curl.qmd index 503a6fc..8966b6c 100644 --- a/quarto/integral_vector_calculus/div_grad_curl.qmd +++ b/quarto/integral_vector_calculus/div_grad_curl.qmd @@ -141,7 +141,7 @@ $$ as $F \cdot \hat{i} = F_x$. -*Were* we to divide by $\Delta V = \Delta x \Delta y \Delta z$ *and* take a limit as the volume shrinks, the limit would be $\partial{F}/\partial{x}$. +*Were* we to divide by $\Delta V = \Delta x \Delta y \Delta z$ *and* take a limit as the volume shrinks, the limit would be $\partial{F_x}/\partial{x}$. If this is repeated for the other two pair of matching faces, we get a definition for the *divergence*: @@ -363,7 +363,7 @@ In the limit, as $\Delta{S} \rightarrow 0$, this will converge to $\partial{F_y Had the bottom of the box been used, a similar result would be found, up to a minus sign. -Unlike the two dimensional case, there are other directions to consider and here the other sides will yield different answers. Consider now the face connecting $(x,y,z), (x+\Delta{x}, y, z), (x+\Delta{x}, y, z + \Delta{z})$, and $ (x,y,z+\Delta{z})$ with outward pointing normal $-\hat{j}$. Let $S_2$ denote this face and $C_2$ describe its boundary. Orient this curve so that the right hand rule points in the $-\hat{j}$ direction (the outward pointing normal). Then, as before, we can approximate: +Unlike the two dimensional case, there are other directions to consider and here the other sides will yield different answers. Consider now the face connecting $(x,y,z), (x+\Delta{x}, y, z), (x+\Delta{x}, y, z + \Delta{z})$, and $(x,y,z +\Delta{z})$ with outward pointing normal $-\hat{j}$. Let $S_2$ denote this face and $C_2$ describe its boundary. Orient this curve so that the right hand rule points in the $-\hat{j}$ direction (the outward pointing normal). Then, as before, we can approximate: @@ -522,7 +522,7 @@ Mathematically operators have not been seen previously, but the concept of an op --- -In the `CalculusWithJulia` package, the constant `\nabla[\tab]`, producing $\nabla$ implements this operator for functions and symbolic expressions. +In the `CalculusWithJulia` package, the constant `\nabla[tab]`, producing $\nabla$ implements this operator for functions and symbolic expressions. ```{julia} @@ -807,7 +807,7 @@ The magnetic field has no divergence. This says that there no magnetic charges ( -The curl of the *time-varying* electric field is in the direction of the partial derivative of the magnetic field. For example, if a magnet is in motion in the in the $z$ axis, then the electric field has rotation in the $x-y$ plane *induced* by the motion of the magnet. +The curl of the *time-varying* electric field is in the direction of the partial derivative of the magnetic field. For example, if a magnet is in motion in the $z$ axis, then the electric field has rotation in the $x-y$ plane *induced* by the motion of the magnet. > Ampere's circuital law: $\nabla\times{B} = \mu_0J + \mu_0\epsilon_0 \partial{E}/\partial{t}$ @@ -872,7 +872,7 @@ The cross product of two vector fields is a vector field for which the divergenc \begin{align*} \nabla\cdot(F \times G) &= (\nabla\times{F})\cdot G - F \cdot (\nabla\times{G})\\ -\nabla\times(F \times G) &= F(\nabla\cdot{G}) - G(\nabla\cdot{F} + (G\cdot\nabla)F-(F\cdot\nabla)G\\ +\nabla\times(F \times G) &= F(\nabla\cdot{G}) - G(\nabla\cdot{F}) + (G\cdot\nabla)F-(F\cdot\nabla)G\\ &= \nabla\cdot(BA^t - AB^t). \end{align*} @@ -894,7 +894,7 @@ Surprisingly, the curl and divergence satisfy two vanishing properties. First -if the scalar function $f$ is has continuous second derivatives (so the mixed partials do not depend on order). +if the scalar function $f$ has continuous second derivatives (so the mixed partials do not depend on order). Vector fields where $F = \nabla{f}$ are conservative. Conservative fields have path independence, so any line integral, $\oint F\cdot \hat{T} ds$, around a closed loop will be $0$. But the curl is defined as a limit of such integrals, so it too will be $\vec{0}$. In short, conservative fields have no rotation. @@ -1087,7 +1087,7 @@ d\vec{r} &= \langle dx,dy,dz \rangle = J \langle du,dv,dw\rangle\\ \frac{\partial{\vec{r}}}{\partial{v}} \vdots \frac{\partial{\vec{r}}}{\partial{w}} \right] \langle du,dv,dw\rangle\\ &= \frac{\partial{\vec{r}}}{\partial{u}} du + -\frac{\partial{\vec{r}}}{\partial{v}} dv +\frac{\partial{\vec{r}}}{\partial{v}} dv + \frac{\partial{\vec{r}}}{\partial{w}} dw. \end{align*} @@ -1128,7 +1128,7 @@ Consider the surface for constant $u$. The vector $\hat{e}_v$ and $\hat{e}_w$ li $$ -dS_u = \| h_v dv \hat{e}_v \times h_w dw \hat{e}_w \| = h_v h_w dv dw \| \hat{e}_v \| = h_v h_w dv dw. +dS_u = \| h_v dv \hat{e}_v \times h_w dw \hat{e}_w \| = h_v h_w dv dw \| \hat{e}_u \| = h_v h_w dv dw. $$ This uses orthogonality, so $\hat{e}_v \times \hat{e}_w$ is parallel to $\hat{e}_u$ and has unit length. Similarly, $dS_v = h_u h_w du dw$ and $dS_w = h_u h_v du dv$ . @@ -1144,7 +1144,7 @@ The volume element is found by *projecting* $d\vec{r}$ onto the $\hat{e}_u$, $\h \left[(d\vec{r} \cdot\hat{e}_v) \hat{e}_v\right] \times \left[(d\vec{r} \cdot\hat{e}_w) \hat{e}_w\right] \right) &= -(h_u h_v h_w) ( du dv dw ) (\hat{e}_u \cdot (\hat{e}_v \times \hat{e}_w) \\ +(h_u h_v h_w) ( du dv dw ) (\hat{e}_u \cdot (\hat{e}_v \times \hat{e}_w)) \\ &= h_u h_v h_w du dv dw, \end{align*} @@ -1229,7 +1229,7 @@ With this, we have $h_r=1$, $h_\theta=r\sin(\phi)$, and $h_\phi = r$. So that \begin{align*} -dl &= \sqrt{dr^2 + (r\sin(\phi)d\theta^2) + (rd\phi)^2},\\ +dl &= \sqrt{dr^2 + (r\sin(\phi)d\theta)^2 + (rd\phi)^2},\\ dS_r &= r^2\sin(\phi)d\theta d\phi,\\ dS_\theta &= rdr d\phi,\\ dS_\phi &= r\sin(\phi)dr d\theta, \quad\text{and}\\ @@ -1360,7 +1360,7 @@ $$ \left[ \frac{\partial{F_r r}}{\partial{r}} + \frac{\partial{F_\theta}}{\partial{\theta}} + -\frac{\partial{F_x}}{\partial{z}} +\frac{\partial{F_z r}}{\partial{z}} \right]. $$ diff --git a/quarto/integral_vector_calculus/line_integrals.qmd b/quarto/integral_vector_calculus/line_integrals.qmd index a1fce07..1da2715 100644 --- a/quarto/integral_vector_calculus/line_integrals.qmd +++ b/quarto/integral_vector_calculus/line_integrals.qmd @@ -137,7 +137,7 @@ quadgk(integrand, 0, pi) ##### Example -Imagine the $z$ axis is a wire and in the $x$-$y$ plane the unit circle is a path. If there is a magnetic field, $B$, then the field will induce a current to flow along the wire. [Ampere's]https://tinyurl.com/y4gl9pgu) circuital law states $\oint_C B\cdot\hat{T} ds = \mu_0 I$, where $\mu_0$ is a constant and $I$ the current. If the magnetic field is given by $B=(x^2+y^2)^{1/2}\langle -y,x,0\rangle$ compute $I$ in terms of $\mu_0$. +Imagine the $z$ axis is a wire and in the $x$-$y$ plane the unit circle is a path. If there is a magnetic field, $B$, then the field will induce a current to flow along the wire. [Ampere's](https://tinyurl.com/y4gl9pgu) circuital law states $\oint_C B\cdot\hat{T} ds = \mu_0 I$, where $\mu_0$ is a constant and $I$ the current. If the magnetic field is given by $B=(x^2+y^2)^{1/2}\langle -y,x,0\rangle$ compute $I$ in terms of $\mu_0$. We have the path is parameterized by $\vec{r}(t) = \langle \cos(t), \sin(t), 0\rangle$, and so $\hat{T} = \langle -\sin(t), \cos(t), 0\rangle$ and the integrand, $B\cdot\hat{T}$ is @@ -145,7 +145,7 @@ We have the path is parameterized by $\vec{r}(t) = \langle \cos(t), \sin(t), 0\r $$ (x^2 + y^2)^{-1/2}\langle -\sin(t), \cos(t), 0\rangle\cdot -\langle -\sin(t), \cos(t), 0\rangle = (x^2 + y^2)(-1/2), +\langle -\sin(t), \cos(t), 0\rangle = (x^2 + y^2)^{-1/2}, $$ which is $1$ on the path $C$. So $\int_C B\cdot\hat{T} ds = \int_C ds = 2\pi$. So the current satisfies $2\pi = \mu_0 I$, so $I = (2\pi)/\mu_0$. @@ -177,7 +177,7 @@ The canonical example is [work](https://en.wikipedia.org/wiki/Work_(physics)), w --- -In the $n=2$ case, there is another useful interpretation of the line integral. In this dimension the normal vector, $\hat{N}$, is well defined in terms of the tangent vector, $\hat{T}$, through a rotation: $\langle a,b\rangle^t = \langle b,-a\rangle^t$. (The negative, $\langle -b,a\rangle$ is also a candidate, the difference in this choice would lead to a sign difference in in the answer.) This allows the definition of a different line integral, called a flow integral, as detailed later: +In the $n=2$ case, there is another useful interpretation of the line integral. In this dimension the normal vector, $\hat{N}$, is well defined in terms of the tangent vector, $\hat{T}$, through a rotation: $\langle a,b\rangle^t = \langle b,-a\rangle$. (The negative, $\langle -b,a\rangle$ is also a candidate, the difference in this choice would lead to a sign difference in the answer.) This allows the definition of a different line integral, called a flow integral, as detailed later: > The *flow* across a curve $C$ is given by @@ -470,7 +470,7 @@ For a Jordan curve, the positive orientation of the curve is such that the norma ##### Example -The [New York Times](https://www.nytimes.com/interactive/2019/06/20/world/asia/hong-kong-protest-size.html) showed aerial photos to estimate the number of protest marchers in Hong Kong. This is a more precise way to estimate crowd size, but requires a drone or some such to take photos. If one is on the ground, the number of marchers could be *estimated* by finding the flow of marchers across a given width. In the Times article, we see "Protestors packed the width of Hennessy Road for more than 5 hours. If this road is 50 meters wide and the rate of the marchers is 3 kilometers per hour, estimate the number of marchers. +The [New York Times](https://www.nytimes.com/interactive/2019/06/20/world/asia/hong-kong-protest-size.html) showed aerial photos to estimate the number of protest marchers in Hong Kong. This is a more precise way to estimate crowd size, but requires a drone or some such to take photos. If one is on the ground, the number of marchers could be *estimated* by finding the flow of marchers across a given width. In the Times article, we see "Protestors packed the width of Hennessy Road for more than 5 hours. If this road is 40 meters wide and the rate of the marchers is 3 kilometers per hour, estimate the number of marchers. The basic idea is to compute the rate of flow *across* a part of the street and then multiply by time. For computational sake, say the marchers are on a grid of 1 meters (that is in a 40m wide street, there is room for 40 marchers at a time. In one minute, the marchers move 50 meters: @@ -505,7 +505,7 @@ r(t) = [cos(t), 2sin(t)] F(x,y) = [cos(x), sin(x*y)] F(v) = F(v...) normal(a,b) = [b, -a] -G(t) = (F ∘ r)(t) ⋅ normal(r(t)...) +G(t) = (F ∘ r)(t) ⋅ normal(r'(t)...) a, b = 0, pi/2 quadgk(G, a, b)[1] ``` @@ -547,7 +547,7 @@ integrate((F ∘ r)(t) ⋅ normal(T(t)...) , (t, 0, 2PI)) ##### Example -Let $F(x,y) = \langle x, y\rangle / \| \langle x, y\rangle\|^3$: +Let $F(x,y) = \langle x, y\rangle / \| \langle x, y\rangle\|^2$: ```{julia} @@ -710,7 +710,7 @@ $$ In the case that the surface is described by $z = f(x,y)$, then the formula's become $\vec{v}_1 = \langle 1,0,\partial{f}/\partial{x}\rangle$ and $\vec{v}_2 = \langle 0, 1, \partial{f}/\partial{y}\rangle$ with cross product $\vec{v}_1\times\vec{v}_2 =\langle -\partial{f}/\partial{x}, -\partial{f}/\partial{y},1\rangle$. -The value $\| \frac{\partial{\Phi}}{\partial{u}} \times \frac{\partial{\Phi}}{\partial{y}} \|$ is called the *surface element*. As seen, it is the scaling between a unit area in the $u-v$ plane and the approximating area on the surface after the parameterization. +The value $\| \frac{\partial{\Phi}}{\partial{u}} \times \frac{\partial{\Phi}}{\partial{v}} \|$ is called the *surface element*. As seen, it is the scaling between a unit area in the $u-v$ plane and the approximating area on the surface after the parameterization. ### Examples @@ -806,10 +806,10 @@ Phi(x, theta) = [x, 𝒇(x)*cos(theta), 𝒇(x)*sin(theta)] Jac = Phi(x, theta).jacobian([x, theta]) v1, v2 = Jac[:,1], Jac[:,2] se = norm(v1 × v2) -se .|> simplify +se |> simplify ``` -This in agreement with the previous formula. +This is in agreement with the previous formula. ##### Example @@ -872,7 +872,7 @@ $$ du dv. $$ -When the surface is described by a function, $z=f(x,y)$, the parameterization is $(u,v) \rightarrow \langle u, v, f(u,v)\rangle$, and the two vectors are $\vec{v}_1 = \langle 1, 0, \partial{f}/\partial{u}\rangle$ and $\vec{v}_2 = \langle 0, 1, \partial{f}/\partial{v}\rangle$ and their cross product is $\vec{v}_1\times\vec{v}_1=\langle -\partial{f}/\partial{u}, -\partial{f}/\partial{v}, 1\rangle$. +When the surface is described by a function, $z=f(x,y)$, the parameterization is $(u,v) \rightarrow \langle u, v, f(u,v)\rangle$, and the two vectors are $\vec{v}_1 = \langle 1, 0, \partial{f}/\partial{u}\rangle$ and $\vec{v}_2 = \langle 0, 1, \partial{f}/\partial{v}\rangle$ and their cross product is $\vec{v}_1\times\vec{v}_2=\langle -\partial{f}/\partial{u}, -\partial{f}/\partial{v}, 1\rangle$. ##### Example @@ -902,7 +902,7 @@ integrate(F(Phi(y,theta)) ⋅ Normal, (theta, 0, 2PI), (y, 0, 4)) ##### Example -Let $S$ be the closed surface bounded by the cylinder $x^2 + y^2 = 1$, the plane $z=0$, and the plane $z = 1+x$. Let $F(x,y,z) = \langle 1, y, -z \rangle$. Compute $\oint_S F\cdot\vec{N} dS$. +Let $S$ be the closed surface bounded by the cylinder $x^2 + y^2 = 1$, the plane $z=0$, and the plane $z = 1+x$. Let $F(x,y,z) = \langle 1, y, z \rangle$. Compute $\oint_S F\cdot\vec{N} dS$. ```{julia} @@ -910,7 +910,7 @@ Let $S$ be the closed surface bounded by the cylinder $x^2 + y^2 = 1$, the plane 𝐅(v) = 𝐅(v...) ``` -The surface has three faces, with different outward pointing normals for each. Let $S_1$ be the unit disk in the $x-y$ plane with normal $-\hat{k}$; $S_2$ be the top part, with normal $\langle \langle-1, 0, 1\rangle$ (as the plane is $-1x + 0y + 1z = 1$); and $S_3$ be the cylindrical part with outward pointing normal $\vec{r}$. +The surface has three faces, with different outward pointing normals for each. Let $S_1$ be the unit disk in the $x-y$ plane with normal $-\hat{k}$; $S_2$ be the top part, with normal $\langle-1, 0, 1\rangle$ (as the plane is $-1x + 0y + 1z = 1$); and $S_3$ be the cylindrical part with outward pointing normal $\vec{r}$. Integrating over $S_1$, we have the parameterization $\Phi(r,\theta) = \langle r\cos(\theta), r\sin(\theta), 0\rangle$: @@ -963,7 +963,7 @@ The contribution is ```{julia} -A₃ = integrate(𝐅(𝐏hi₃(𝐑, 𝐭heta)) ⋅ (-𝐍ormal₃), (𝐳, 0, 1 + cos(𝐭heta)), (𝐭heta, 0, 2PI)) +A₃ = integrate(𝐅(𝐏hi₃(𝐳, 𝐭heta)) ⋅ (-𝐍ormal₃), (𝐳, 0, 1 + cos(𝐭heta)), (𝐭heta, 0, 2PI)) ``` In total, the surface integral is @@ -989,10 +989,10 @@ We have (using $\oint$ for a surface integral over a closed surface): $$ -\oint_S S \cdot \vec{N} dS = +\oint_S E \cdot \vec{N} dS = \oint_S \frac{kq}{\|\vec{r}\|^2} \hat{r} \cdot \hat{r} dS = \oint_S \frac{kq}{\|\vec{r}\|^2} dS = -kqq_0 \cdot SA(S) = +kq \cdot SA(S) = 4\pi k q $$ @@ -1038,7 +1038,7 @@ That constant being $0$. This is a consequence of [Gauss's law](https://en.wikipedia.org/wiki/Gauss%27s_law), which states that for an electric field $E$, the electric flux through a closed surface is proportional to the total charge contained. (Gauss's law is related to the upcoming divergence theorem.) When `a` is inside the surface, the total charge is the same regardless of exactly where, so the integral's value is always the same. When `a` is outside the surface, the total charge inside the sphere is $0$, so the flux integral is as well. -Gauss's law is typically used to identify the electric field by choosing a judicious surface where the surface integral can be computed. For example, suppose a ball of radius $R_0$ has a *uniform* charge. What is the electric field generated? *Assuming* it is dependent only on the distance from the center of the charged ball, we can, first, take a sphere of radius $R > R_0$ and note that $E(\vec{r})\cdot\hat{N}(r) = \|E(R)\|$, the magnitude a distance $R$ away. So the surface integral is simply $\|E(R)\|4\pi R^2$ and by Gauss's law a constant depending on the total charge. So $\|E(R)\| ~ 1/R^2$. When $R < R_0$, the same applies, but the total charge within the surface will be like $(R/R_0 )^3$, so the result will be *linear* in $R$, as: +Gauss's law is typically used to identify the electric field by choosing a judicious surface where the surface integral can be computed. For example, suppose a ball of radius $R_0$ has a *uniform* charge. What is the electric field generated? *Assuming* it is dependent only on the distance from the center of the charged ball, we can, first, take a sphere of radius $R > R_0$ and note that $E(\vec{r})\cdot\hat{N}(r) = \|E(R)\|$, the magnitude a distance $R$ away. So the surface integral is simply $\|E(R)\|4\pi R^2$ and by Gauss's law a constant depending on the total charge. So $\|E(R)\| \sim 1/R^2$. When $R < R_0$, the same applies, but the total charge within the surface will be like $(R/R_0 )^3$, so the result will be *linear* in $R$, as: $$ @@ -1198,7 +1198,7 @@ Let $F(x,y) = (x^2+y^2)^{-k/2} \langle x, y \rangle$ be a radial field. The work $$ -\int_C F\cdot \frac{dr}{dt} dt = \int_0^{2pi} \langle (1)^{-k/2} \cos(t), \sin(t) \rangle \cdot \langle-\sin(t), \cos(t)\rangle dt. +\int_C F\cdot \frac{dr}{dt} dt = \int_0^{2pi} (1)^{-k/2} \langle \cos(t), \sin(t) \rangle \cdot \langle-\sin(t), \cos(t)\rangle dt. $$ For any $k$, this integral will be: @@ -1236,7 +1236,7 @@ Why is this surprising? #| hold: true #| echo: false choices = [ -L"The field is a potential field, but the path integral around $0$ is not path dependent.", +L"The field is a potential field, but the path integral around $0$ is not path independent.", L"The value of $d/dt(f\circ\vec{r})=0$, so the integral should be $0$." ] answ =1 @@ -1340,7 +1340,7 @@ answ = 1 radioq(choices, answ, keep_order=true) ``` -Compute $\vec{v}_2 = \partial{\Phi}/\partial{u}$ +Compute $\vec{v}_2 = \partial{\Phi}/\partial{v}$ ```{julia} @@ -1394,7 +1394,7 @@ numericq(a) ###### Question -For the surface parameterized by $\Phi(u,v) = \langle uv, u^2v, uv^2\rangle$ for $(u,v)$ in $[0,1]\times[0,1]$ and vector field $F(x,y,z) =\langle y^2, x, z\langle$, numerically find $\iint_S (F\cdot\hat{N}) dS$. +For the surface parameterized by $\Phi(u,v) = \langle uv, u^2v, uv^2\rangle$ for $(u,v)$ in $[0,1]\times[0,1]$ and vector field $F(x,y,z) =\langle y^2, x, z\rangle$, numerically find $\iint_S (F\cdot\hat{N}) dS$. ```{julia} @@ -1456,11 +1456,11 @@ Compute this. #| echo: false #@syms x y real=true #phi = 1 - (x+y) -#SE = sqrt(1 + diff(phi,x)^2, diff(phi,y)^2) -#integrate(x*y*S_, (y, 0, 1-x), (x,0,1)) # \sqrt{2}/24 +#SE = sqrt(1 + diff(phi,x)^2 + diff(phi,y)^2) +#integrate(x*y*SE, (y, 0, 1-x), (x,0,1)) # \sqrt{3}/24 choices = [ -raw" ``\sqrt{2}/24``", -raw" ``2/\sqrt{24}``", +raw" ``\sqrt{3}/24``", +raw" ``3/\sqrt{24}``", raw" ``1/12``" ] answ = 1 diff --git a/quarto/integral_vector_calculus/review.qmd b/quarto/integral_vector_calculus/review.qmd index bb02fd7..36e0b8a 100644 --- a/quarto/integral_vector_calculus/review.qmd +++ b/quarto/integral_vector_calculus/review.qmd @@ -76,7 +76,7 @@ The **tangent** vector is the unit vector in the direction of $\vec{r}'(t)$: $$ -\hat{T} = \frac{\vec{r}'(t)}{\|\vec{r}(t)\|}. +\hat{T} = \frac{\vec{r}'(t)}{\|\vec{r}'(t)\|}. $$ The path is parameterized by *arc* length if $\|\vec{r}'(t)\| = 1$ for all $t$. In this case an "$s$" is used for the parameter, as a notational hint: $\hat{T} = d\vec{r}/ds$. @@ -240,7 +240,7 @@ Define the **divergence** of a vector-valued function $F:R^n \rightarrow R^n$ by $$ \text{divergence}(F) = \frac{\partial{F_{x_1}}}{\partial{x_1}} + -\frac{\partial{F_{x_2}}}{\partial{x_2}} + \cdots +\frac{\partial{F_{x_2}}}{\partial{x_2}} + \cdots + \frac{\partial{F_{x_n}}}{\partial{x_n}}. $$ @@ -424,7 +424,7 @@ For $F=\langle -y,x\rangle$, Green's theorem says the area of $D$ is given by $( ### Surface integrals -A surface in $3$ dimensions can be described by a scalar function $z=f(x,y)$, a parameterization $F:R^2 \rightarrow R^3$ or as a level curve of a scalar function $f(x,y,z)$. The second case, covers the first through the parameterization $(x,y) \rightarrow (x,y,f(x,y)$. For a parameterization of a surface, $\Phi(u,v) = \langle \Phi_x, \Phi_y, \Phi_z\rangle$, let $\partial{\Phi}/\partial{u}$ be the $3$-d vector $\langle \partial{\Phi_x}/\partial{u}, \partial{\Phi_y}/\partial{u}, \partial{\Phi_z}/\partial{u}\rangle$, similarly define $\partial{\Phi}/\partial{v}$. As vectors, these lie in the tangent plane to the surface and this plane has normal vector $\vec{N}=\partial{\Phi}/\partial{u}\times\partial{\Phi}/\partial{v}$. For a closed surface, the parametrization is positive if $\vec{N}$ is an outward pointing normal. Let the *surface element* be defined by $\|\vec{N}\|$. +A surface in $3$ dimensions can be described by a scalar function $z=f(x,y)$, a parameterization $F:R^2 \rightarrow R^3$ or as a level curve of a scalar function $f(x,y,z)$. The second case, covers the first through the parameterization $(x,y) \rightarrow (x,y,f(x,y))$. For a parameterization of a surface, $\Phi(u,v) = \langle \Phi_x, \Phi_y, \Phi_z\rangle$, let $\partial{\Phi}/\partial{u}$ be the $3$-d vector $\langle \partial{\Phi_x}/\partial{u}, \partial{\Phi_y}/\partial{u}, \partial{\Phi_z}/\partial{u}\rangle$, similarly define $\partial{\Phi}/\partial{v}$. As vectors, these lie in the tangent plane to the surface and this plane has normal vector $\vec{N}=\partial{\Phi}/\partial{u}\times\partial{\Phi}/\partial{v}$. For a closed surface, the parametrization is positive if $\vec{N}$ is an outward pointing normal. Let the *surface element* be defined by $\|\vec{N}\|$. The surface integral of a scalar function $f:R^3 \rightarrow R$ for a parameterization $\Phi:R \rightarrow S$ is defined by diff --git a/quarto/integral_vector_calculus/stokes_theorem.qmd b/quarto/integral_vector_calculus/stokes_theorem.qmd index fafd4b0..394a74c 100644 --- a/quarto/integral_vector_calculus/stokes_theorem.qmd +++ b/quarto/integral_vector_calculus/stokes_theorem.qmd @@ -118,7 +118,7 @@ The total area under the blue curve from $a$ to $b$, is found by adding the area Let's consider now what an integral over the boundary would mean. The region, or interval, $[x_{i-1}, x_i]$ has a boundary that clearly consists of the two points $x_{i-1}$ and $x_i$. If we *orient* the boundary, as we need to for higher dimensional boundaries, using the outward facing direction, then the oriented boundary at the right-hand end point, $x_i$, would point towards $+\infty$ and the left-hand end point, $x_{i-1}$, would be oriented to point to $-\infty$. An "integral" on the boundary of $F$ would naturally be $F(b) \times 1$ plus $F(a) \times -1$, or $F(b)-F(a)$. -With this choice of integral over the boundary, we can see much cancellation arises were we to compute this integral for each piece, as we would have with $a=x_0 < x_1 < \cdots x_{n-1} < x_n=b$: +With this choice of integral over the boundary, we can see much cancellation arises were we to compute this integral for each piece, as we would have with $a=x_0 < x_1 < \cdots < x_{n-1} < x_n=b$: $$ @@ -199,7 +199,7 @@ $$ \right) \Delta{x}\Delta{y} . $$ -We interpret the right hand side as a Riemann sum approximation for the $2$ dimensional integral of the function $f(x,y) = \frac{\partial{F_x}}{\partial{y}} - \frac{\partial{F_y}}{\partial{x}}=\text{curl}(F)$, the two-dimensional curl. Were the green squares continued to fill out the large blue square, then the sum of these terms would approximate the integral +We interpret the right hand side as a Riemann sum approximation for the $2$ dimensional integral of the function $f(x,y) = \frac{\partial{F_y}}{\partial{x}} - \frac{\partial{F_x}}{\partial{y}}=\text{curl}(F)$, the two-dimensional curl. Were the green squares continued to fill out the large blue square, then the sum of these terms would approximate the integral $$ @@ -375,7 +375,7 @@ Fx, Fy = F(x,y) diff(Fy, x) - diff(Fx, y) |> simplify ``` -As the integrand is $00$, $\iint_D \left( \partial{F_y}/{\partial{x}}-\partial{F_xy}/{\partial{y}}\right)dA = 0$, as well. But, +As the integrand is $0$, $\iint_D \left( \partial{F_y}/{\partial{x}}-\partial{F_xy}/{\partial{y}}\right)dA = 0$, as well. But, $$ @@ -394,7 +394,7 @@ That is, for this example, Green's theorem does **not** apply, as the two integr A simple closed curve is one that does not cross itself. Green's theorem applies to regions bounded by curves which have finitely many crosses provided the orientation used is consistent throughout. -Consider the curve $y = f(x)$, $a \leq x \leq b$, assuming $f$ is continuous, $f(a) > 0$, and $f(b) < 0$. We can use Green's theorem to compute the signed "area" under under $f$ if we consider the curve in $R^2$ from $(b,0)$ to $(a,0)$ to $(a, f(a))$, to $(b, f(b))$ and back to $(b,0)$ in that orientation. This will cross at each zero of $f$. +Consider the curve $y = f(x)$, $a \leq x \leq b$, assuming $f$ is continuous, $f(a) > 0$, and $f(b) < 0$. We can use Green's theorem to compute the signed "area" under $f$ if we consider the curve in $R^2$ from $(a,0)$ to $(b,0)$ to $(b, f(b))$, to $(a, f(a))$ and back to $(a,0)$ in that orientation. This will cross at each zero of $f$. ```{julia} @@ -403,11 +403,11 @@ Consider the curve $y = f(x)$, $a \leq x \leq b$, assuming $f$ is continuous, $f a, b = pi/2, 3pi/2 f(x) = sin(x) p = plot(f, a, b, legend=false, xticks=nothing, border=:none, color=:green) -arrow!(p, [3pi/4, f(3pi/4)], 0.01*[1,cos(3pi/4)], color = :green) -arrow!(p, [5pi/4, f(5pi/4)], 0.01*[1,cos(5pi/4)], color = :green) -arrow!(p, [a,0], [0, f(a)], color=:red) -arrow!(p, [b, f(b)], [0, -f(b)], color=:blue) -arrow!(p, [b, 0], [a-b, 0], color=:black) +arrow!(p, [3pi/4, f(3pi/4)], -0.01*[1,cos(3pi/4)], color = :green) +arrow!(p, [5pi/4, f(5pi/4)], -0.01*[1,cos(5pi/4)], color = :green) +arrow!(p, [a,f(a)], [0, -f(a)], color=:red) +arrow!(p, [b, 0], [0, f(b)], color=:blue) +arrow!(p, [a, 0], [b-a, 0], color=:black) del = -0.1 annotate!(p, [(a,del, "a"), (b,-del,"b")]) p @@ -418,8 +418,8 @@ Let $A$ label the red line, $B$ the green curve, $C$ the blue line, and $D$ the \begin{align*} -\int_A (xdy - ydx) &= a f(a)\\ -\int_C (xdy - ydx) &= b(-f(b))\\ +\int_A (xdy - ydx) &= a(-f(a))\\ +\int_C (xdy - ydx) &= b f(b)\\ \int_D (xdy - ydx) &= 0\\ \end{align*} @@ -430,7 +430,7 @@ Finally the integral over $B$, using integration by parts: \begin{align*} \int_B F(\vec{r}(t))\cdot \frac{d\vec{r}(t)}{dt} dt &= -\int_b^a \langle -f(t),t)\rangle\cdot\langle 1, f'(t)\rangle dt\\ +\int_b^a \langle -f(t),t \rangle\cdot\langle 1, f'(t)\rangle dt\\ &= \int_a^b f(t)dt - \int_a^b tf'(t)dt\\ &= \int_a^b f(t)dt - \left(tf(t)\mid_a^b - \int_a^b f(t) dt\right). \end{align*} @@ -489,7 +489,7 @@ Adding the two gives $4\pi - \pi = \pi \cdot(b^2 - a^2)$, with $b=2$ and $a=1$. #### Flow not flux -Green's theorem has a complement in terms of flow across $C$. As $C$ is positively oriented (so the bounded interior piece is on the left of $\hat{T}$ as the curve is traced), a normal comes by rotating $90^\circ$ counterclockwise. That is if $\hat{T} = \langle a, b\rangle$, then $\hat{N} = \langle b, -a\rangle$. +Green's theorem has a complement in terms of flow across $C$. As $C$ is positively oriented (so the bounded interior piece is on the left of $\hat{T}$ as the curve is traced), a normal comes by rotating $90^\circ$ clockwise. That is if $\hat{T} = \langle a, b\rangle$, then $\hat{N} = \langle b, -a\rangle$. Let $F = \langle F_x, F_y \rangle$ and $G = \langle F_y, -F_x \rangle$, then $G\cdot\hat{T} = -F\cdot\hat{N}$. The curl formula applied to $G$ becomes @@ -497,7 +497,7 @@ Let $F = \langle F_x, F_y \rangle$ and $G = \langle F_y, -F_x \rangle$, then $G\ $$ \frac{\partial{G_y}}{\partial{x}} - \frac{\partial{G_x}}{\partial{y}} = -\frac{\partial{-F_x}}{\partial{x}}-\frac{\partial{(F_y)}}{\partial{y}} +\frac{\partial{(-F_x)}}{\partial{x}}-\frac{\partial{(F_y)}}{\partial{y}} = -\left(\frac{\partial{F_x}}{\partial{x}} + \frac{\partial{F_y}}{\partial{y}}\right)= -\nabla\cdot{F}. @@ -596,19 +596,19 @@ p Again, the microscopic boundary integrals when added will give a macroscopic boundary integral due to cancellations. -But, as seen in the derivation of the divergence, only modified for $2$ dimensions, we have $\nabla\cdot{F} = \lim \frac{1}{\Delta S} \oint_C F\cdot\hat{N}$, so for each cell +But, as seen in the derivation of the divergence, only modified for $2$ dimensions, we have $\nabla\cdot{F} = \lim \frac{1}{\Delta S} \oint_C F\cdot\hat{N} ds$, so for each cell $$ -\oint_{C_i} F\cdot\hat{N} \approx \left(\nabla\cdot{F}\right)\Delta{x}\Delta{y}, +\oint_{C_i} F\cdot\hat{N} ds \approx \left(\nabla\cdot{F}\right)\Delta{x}\Delta{y}, $$ an approximating Riemann sum for $\iint_D \nabla\cdot{F} dA$. This yields: $$ -\oint_C (F \cdot\hat{N}) dA = -\sum_i \oint_{C_i} (F \cdot\hat{N}) dA \approx +\oint_C (F \cdot\hat{N}) ds = +\sum_i \oint_{C_i} (F \cdot\hat{N}) ds \approx \sum \left(\nabla\cdot{F}\right)\Delta{x}\Delta{y} \approx \iint_S \nabla\cdot{F}dA, $$ @@ -630,11 +630,11 @@ The integral of the flow across $C$ consists of $4$ parts. By symmetry, they all $$ \int_C F \cdot \hat{N} ds= -\int_{-1}^1 \langle F_x, F_y\rangle\cdot\langle 0, 1\rangle ds = -\int_{-1}^1 b dy = 2b. +\int_{-1}^1 \langle F_x, F_y\rangle\cdot\langle 1, 0\rangle ds = +\int_{-1}^1 a dy = 2a. $$ -Integrating across the top will give $2a$, along the bottom $2a$, and along the left side $2b$ totaling $4(a+b)$. +Integrating across the top will give $2b$, along the bottom $2b$, and along the left side $2a$ totaling $4(a+b)$. --- @@ -822,7 +822,7 @@ $$ \oint_C B\cdot\hat{T} ds = \mu_0 I. $$ -The goal here is to re-express this integral law to produce a law at each point of the field. Let $S$ be a surface with boundary $C$, Let $J$ be the current density - $J=\rho v$, with $\rho$ the density of the current (not time-varying) and $v$ the velocity. The current can be re-expressed as $I = \iint_S J\cdot\hat{n}dA$. (If the current flows through a wire and $S$ is much bigger than the wire, this is still valid as $\rho=0$ outside of the wire.) +The goal here is to re-express this integral law to produce a law at each point of the field. Let $S$ be a surface with boundary $C$, Let $J$ be the current density - $J=\rho v$, with $\rho$ the density of the current (not time-varying) and $v$ the velocity. The current can be re-expressed as $I = \iint_S J\cdot\hat{N}dA$. (If the current flows through a wire and $S$ is much bigger than the wire, this is still valid as $\rho=0$ outside of the wire.) We then have: @@ -859,7 +859,7 @@ $$ -\iint_S \left(\frac{\partial{B}}{\partial{t}}\cdot\hat{N}\right)dS = -\frac{\partial{\phi}}{\partial{t}} = \oint_C E\cdot\hat{T}ds = -\iint_S (\nabla\times{E}) dS. +\iint_S (\nabla\times{E})\cdot\hat{N} dS. $$ This is true for any capping surface for $C$. Shrinking $C$ to a point means it will hold for each point in $R^3$. That is: @@ -884,10 +884,10 @@ Green's theorem gave a characterization of $2$-dimensional conservative fields, Stokes's theorem can be used to show the first and fourth are equivalent. -First, if $0 = \oint_C F\cdot\hat{T} ds$, then by Stokes' theorem $0 = \int_S \nabla\times{F} dS$ for any orientable surface $S$ with boundary $C$. For a given point, letting $C$ shrink to that point can be used to see that the cross product must be $0$ at that point. +First, if $0 = \oint_C F\cdot\hat{T} ds$, then by Stokes' theorem $0 = \iint_S \nabla\times{F}\cdot\hat{N} dS$ for any orientable surface $S$ with boundary $C$. For a given point, letting $C$ shrink to that point can be used to see that the cross product must be $0$ at that point. -Conversely, if the cross product is zero in a simply connected region, then take any simple closed curve, $C$ in the region. If the region is [simply connected](http://math.mit.edu/~jorloff/suppnotes/suppnotes02/v14.pdf) then there exists an orientable surface, $S$ in the region with boundary $C$ for which: $\oint_C F\cdot{N} ds = \iint_S (\nabla\times{F})\cdot\hat{N}dS= \iint_S \vec{0}\cdot\hat{N}dS = 0$. +Conversely, if the cross product is zero in a simply connected region, then take any simple closed curve, $C$ in the region. If the region is [simply connected](http://math.mit.edu/~jorloff/suppnotes/suppnotes02/v14.pdf) then there exists an orientable surface, $S$ in the region with boundary $C$ for which: $\oint_C F\cdot\hat{T} ds = \iint_S (\nabla\times{F})\cdot\hat{N}dS= \iint_S \vec{0}\cdot\hat{N}dS = 0$. The construction of a scalar potential function from the field can be done as illustrated in this next example. @@ -970,7 +970,7 @@ This is also easy, as `Ft` has only an `x` component and `rp` has only `y` and ` In two dimensions the vector field $F(x,y) = \langle -y, x\rangle/(x^2+y^2) = S(x,y)/\|R\|^2$ is irrotational ($0$ curl) and has $0$ divergence, but is *not* conservative in $R^2$, as with $C$ being the unit disk we have $\oint_C F\cdot\hat{T}ds = \int_0^{2\pi} \langle -\sin(\theta),\cos(\theta)\rangle \cdot \langle-\sin(\theta), \cos(\theta)\rangle/1 d\theta = 2\pi$. This is because $F$ is not continuously differentiable at the origin, so the path $C$ is not in a simply connected domain where $F$ is continuously differentiable. (Were $C$ to avoid the origin, the integral would be $0$.) -In three dimensions, removing a single point in a domain does change simple connectedness, but removing an entire line will. So the function $F(x,y,z) =\langle -y,x,0\rangle/(x^2+y^2)\rangle$ will have $0$ curl, $0$ divergence, but won't be conservative in a domain that includes the $z$ axis. +In three dimensions, removing a single point in a domain does not change simple connectedness, but removing an entire line will. So the function $F(x,y,z) =\langle -y,x,0\rangle/(x^2+y^2)\rangle$ will have $0$ curl, $0$ divergence, but won't be conservative in a domain that includes the $z$ axis. However, the function $F(x,y,z) = \langle x, y,z\rangle/\sqrt{x^2+y^2+z^2}$ has curl $0$, except at the origin. However, $R^3$ less the origin, as a domain, is simply connected, so $F$ will be conservative. @@ -983,15 +983,15 @@ The divergence theorem is a consequence of a simple observation. Consider two ad $$ -\oint_S F\cdot{N} dA = \sum \oint_{S_i} F\cdot{N} dA. +\oint_S F\cdot\hat{N} dA = \sum \oint_{S_i} F\cdot\hat{N} dA. $$ -If the partition provides a microscopic perspective, then the divergence approximation $\nabla\cdot{F} \approx (1/\Delta{V_i}) \oint_{S_i} F\cdot{N} dA$ can be used to say: +If the partition provides a microscopic perspective, then the divergence approximation $\nabla\cdot{F} \approx (1/\Delta{V_i}) \oint_{S_i} F\cdot\hat{N} dA$ can be used to say: $$ -\oint_S F\cdot{N} dA = -\sum \oint_{S_i} F\cdot{N} dA \approx +\oint_S F\cdot\hat{N} dA = +\sum \oint_{S_i} F\cdot\hat{N} dA \approx \sum (\nabla\cdot{F})\Delta{V_i} \approx \iiint_V \nabla\cdot{F} dV, $$ @@ -1046,7 +1046,7 @@ In fact, all $6$ sides will be $0$, as in this case $F \cdot \hat{i} = xy$ and a As such, the two sides of the Divergence theorem are both $0$, so the theorem is verified. -###### Example +##### Example (From Strang) If the temperature inside the sun is $T = \log(1/\rho)$ find the *heat* flow $F=-\nabla{T}$; the source, $\nabla\cdot{F}$; and the flux, $\iint F\cdot\hat{N}dS$. Model the sun as a ball of radius $\rho_0$. @@ -1193,7 +1193,7 @@ The simplification done by SymPy masks the presence of $R^{-5/2}$ when taking th $$ 0 = \iiint_V \nabla\cdot{F} dV = -\oint_S F\cdot{N}dS = \oint_S \frac{R}{\|R\|^3} \cdot{R} dS = +\oint_S F\cdot\hat{N}dS = \oint_S \frac{R}{\|R\|^3} \cdot{R} dS = \oint_S 1 dS = 4\pi. $$ @@ -1249,7 +1249,7 @@ numericq(val) Let $\hat{N} = \langle \cos(t), \sin(t) \rangle$ and $\hat{T} = \langle -\sin(t), \cos(t)\rangle$. Then polar coordinates can be viewed as the parametric curve $\vec{r}(t) = r(t) \hat{N}$. -Applying Green's theorem to the vector field $F = \langle -y, x\rangle$ which along the curve is $r(t) \hat{T}$ we know the area formula $(1/2) (\int xdy - \int y dx)$. What is this in polar coordinates (using $\theta=t$?) (Using $(r\hat{N}' = r'\hat{N} + r \hat{N}' = r'\hat{N} +r\hat{T}$ is useful.) +Applying Green's theorem to the vector field $F = \langle -y, x\rangle$ which along the curve is $r(t) \hat{T}$ we know the area formula $(1/2) (\int xdy - \int y dx)$. What is this in polar coordinates (using $\theta=t$?) (Using $(r\hat{N})' = r'\hat{N} + r \hat{N}' = r'\hat{N} +r\hat{T}$ is useful.) ```{julia} @@ -1338,7 +1338,7 @@ answ = 2 radioq(choices, answ, keep_order=true) ``` -Along path $C$, $F(x,y) = [1,x]$ and $\hat{T}=-\hat{i}$ so $F\cdot\hat{T} = -1$. The path integral $\int_C (F\cdot\hat{T})ds = -1$. What is the value of the path integral over $A$? +Along path $C$, $F(x,y) = [1,x]$ and $\hat{T}=-\hat{i}$ so $F\cdot\hat{T} = -1$. The path integral $\int_C (F\cdot\hat{T})ds = -1$. What is the value of the path integral over $B$? ```{julia} @@ -1441,7 +1441,7 @@ radioq(choices, answ, keep_order=true) ###### Question -Let $R(x,y,z) = \langle x, y, z\rangle$ and $\rho = \|R\|^2$. If $F = 2R/\rho^2$ then $F$ is the gradient of a potential. Which one? +Let $R(x,y,z) = \langle x, y, z\rangle$ and $\rho = \|R\|^2$. If $F = 2R/\rho$ then $F$ is the gradient of a potential. Which one? ```{julia} @@ -1545,7 +1545,7 @@ The diagram emphasizes a few different things: The one for the curl in $n=2$ is Green's theorem: $\iint_S \nabla\times{F}dA = \oint_{\partial{S}} F\cdot d\vec{r}$. -The one for the curl in $n=3$ is Stoke's theorem: $\iint S \nabla\times{F}dA = \oint_{\partial{S}} F\cdot d\vec{r}$. Finally, the divergence for $n=3$ is the divergence theorem $\iint_V \nabla\cdot{F} dV = \iint_{\partial{V}} F dS$. +The one for the curl in $n=3$ is Stoke's theorem: $\iint_S \nabla\times{F}dA = \oint_{\partial{S}} F\cdot d\vec{r}$. Finally, the divergence for $n=3$ is the divergence theorem $\iint_V \nabla\cdot{F} dV = \iint_{\partial{V}} F dS$. * Working left to right along a row of the diagram, applying two steps of these operations yields: