diff --git a/.github/workflows/SpellCheck.yml b/.github/workflows/SpellCheck.yml new file mode 100644 index 0000000..3d62423 --- /dev/null +++ b/.github/workflows/SpellCheck.yml @@ -0,0 +1,13 @@ +name: Spell Check + +on: [pull_request] + +jobs: + typos-check: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Check spelling + uses: crate-ci/typos@master \ No newline at end of file diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 0000000..49abb14 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,15 @@ +[default.extend-words] +astroid = "astroid" + +nd = "nd" +BA = "BA" +ba = "ba" +brach = "brach" +ABD = "ABD" +DNE = "DNE" + +Hass = "Hass" + +multline = "multline" + +infiniment = "infiniment" \ No newline at end of file diff --git a/quarto/ODEs/euler.qmd b/quarto/ODEs/euler.qmd index c858cfb..92dc4a7 100644 --- a/quarto/ODEs/euler.qmd +++ b/quarto/ODEs/euler.qmd @@ -133,7 +133,7 @@ $$ \langle x_0, y_0 \rangle + h \cdot \langle 1, F(y_0, x_0) \rangle. $$ -The above uses vector notation to add the piece scaled by $h$ to the starting point. Rather than continue with that notation, we will use subscripts. Let $x_1$, $y_1$ be the postion of the tip of the vector. Then we have: +The above uses vector notation to add the piece scaled by $h$ to the starting point. Rather than continue with that notation, we will use subscripts. Let $x_1$, $y_1$ be the position of the tip of the vector. Then we have: $$ diff --git a/quarto/ODEs/odes.qmd b/quarto/ODEs/odes.qmd index c2ec479..03cbe85 100644 --- a/quarto/ODEs/odes.qmd +++ b/quarto/ODEs/odes.qmd @@ -148,7 +148,7 @@ $$ U'(t) = -r U(t), \quad U(0) = U_0. $$ -This shows that the rate of change of $U$ depends on $U$. Large postive values indicate a negative rate of change - a push back towards the origin, and large negative values of $U$ indicate a positive rate of change - again, a push back towards the origin. We shouldn't be surprised to either see a steady decay towards the origin, or oscillations about the origin. +This shows that the rate of change of $U$ depends on $U$. Large positive values indicate a negative rate of change - a push back towards the origin, and large negative values of $U$ indicate a positive rate of change - again, a push back towards the origin. We shouldn't be surprised to either see a steady decay towards the origin, or oscillations about the origin. What will we find? This equation is different from the previous two equations, as the function $U$ appears on both sides. However, we can rearrange to get: @@ -678,7 +678,7 @@ We now attempt to solve these. ```{julia} -@syms alpha::real, γ::postive, v() +@syms alpha::real, γ::positive, v() @syms x_0::real y_0::real v_0::real eq₁ = Dₜ(Dₜ(u))(t) ~ - γ * Dₜ(u)(t) diff --git a/quarto/README-quarto.md b/quarto/README-quarto.md index a85900f..4deda9d 100644 --- a/quarto/README-quarto.md +++ b/quarto/README-quarto.md @@ -24,7 +24,7 @@ To compile the pages through quarto * should also push project to github * no need to push `_freeze` the repo, as files are locally rendered for now. -* NO LONGERto get `PlotlyLight` to work the plotly library needs loading **before** require.min.js. This is accomplished by **editing** the .html file and moving up this line: +* NO LONGER to get `PlotlyLight` to work the plotly library needs loading **before** require.min.js. This is accomplished by **editing** the .html file and moving up this line: This can be done with this commandline call: julia adjust_plotly.jl @@ -102,7 +102,7 @@ DONE * clean up edit link DONE * remove pinned header DONE * clean up directory DONE (?) * JSXGraph files -WON'T DO * download links to Pluto .jl files (if we have .jmd, but we might deprecate...) For *now* .jmd is derprecated; though we keep the files around .... +WON'T DO * download links to Pluto .jl files (if we have .jmd, but we might deprecate...) For *now* .jmd is deprecated; though we keep the files around .... ## Cone, general # https://discourse.julialang.org/t/general-plotting-code-for-cone-in-3d-with-glmakie-or-plots/92104/3 diff --git a/quarto/alternatives/interval_arithmetic.__jmd__ b/quarto/alternatives/interval_arithmetic.__jmd__ index 78fd860..ad3e859 100644 --- a/quarto/alternatives/interval_arithmetic.__jmd__ +++ b/quarto/alternatives/interval_arithmetic.__jmd__ @@ -1,4 +1,4 @@ -# Using interval arithemetic +# Using interval arithmetic Highlighted here is the use of interval arithmetic for calculus problems. diff --git a/quarto/alternatives/makie_plotting.qmd b/quarto/alternatives/makie_plotting.qmd index 39ca3fb..1f48952 100644 --- a/quarto/alternatives/makie_plotting.qmd +++ b/quarto/alternatives/makie_plotting.qmd @@ -111,7 +111,7 @@ These then can be plotted directly: scatter(pts) ``` -The ploting of points in three dimesions is essentially the same, save the use of `Point3` instead of `Point2`. +The plotting of points in three dimensions is essentially the same, save the use of `Point3` instead of `Point2`. ```{julia} diff --git a/quarto/alternatives/symbolics.qmd b/quarto/alternatives/symbolics.qmd index 575b148..082eed9 100644 --- a/quarto/alternatives/symbolics.qmd +++ b/quarto/alternatives/symbolics.qmd @@ -615,7 +615,7 @@ and norm(collect(v)) ``` -Matrix multiplication is also deferred, but the size compatability of the matrices and vectors is considered immediately: +Matrix multiplication is also deferred, but the size compatibility of the matrices and vectors is considered immediately: ```{julia} diff --git a/quarto/derivatives/curve_sketching.qmd b/quarto/derivatives/curve_sketching.qmd index fc76aca..6ea4207 100644 --- a/quarto/derivatives/curve_sketching.qmd +++ b/quarto/derivatives/curve_sketching.qmd @@ -100,7 +100,7 @@ We can easily make a graph of a function over a specified interval. What is not Produce a graph of the function $f(x) = x^4 -13x^3 + 56x^2-92x + 48$. -We identify this as a fourth-degree polynomial with postive leading coefficient. Hence it will eventually look $U$-shaped. If we graph over a too-wide interval, that is all we will see. Rather, we do some work to produce a graph that shows the zeros, peaks, and valleys of $f(x)$. To do so, we need to know the extent of the zeros. We can try some theory, but instead we just guess and if that fails, will work harder: +We identify this as a fourth-degree polynomial with positive leading coefficient. Hence it will eventually look $U$-shaped. If we graph over a too-wide interval, that is all we will see. Rather, we do some work to produce a graph that shows the zeros, peaks, and valleys of $f(x)$. To do so, we need to know the extent of the zeros. We can try some theory, but instead we just guess and if that fails, will work harder: ```{julia} @@ -351,7 +351,7 @@ Consider the function $p(x) = x + 2x^3 + 3x^3 + 4x^4 + 5x^5 +6x^6$. Which interv choices = ["``(-5,5)``, the default bounds of a calculator", "``(-3.5, 3.5)``, the bounds given by Cauchy for the real roots of ``p``", "``(-1, 1)``, as many special polynomials have their roots in this interval", -"``(-1.1, .25)``, as this constains all the roots, the critical points, and inflection points and just a bit more" +"``(-1.1, .25)``, as this contains all the roots, the critical points, and inflection points and just a bit more" ] radioq(choices, 4, keep_order=true) ``` @@ -577,7 +577,7 @@ Why should asymptotics matter? #| hold: true #| echo: false choices = [ -L"A vertical asymptote can distory the $y$ range, so it is important to avoid too-large values", +L"A vertical asymptote can distort the $y$ range, so it is important to avoid too-large values", L"A horizontal asymptote must be plotted from $-\infty$ to $\infty$", "A slant asymptote must be plotted over a very wide domain so that it can be identified." ] diff --git a/quarto/derivatives/derivatives.qmd b/quarto/derivatives/derivatives.qmd index 0153039..d1194e1 100644 --- a/quarto/derivatives/derivatives.qmd +++ b/quarto/derivatives/derivatives.qmd @@ -1278,7 +1278,7 @@ Consider the graph of the `airyai` function (from `SpecialFunctions`) over $[-5, plot(airyai, -5, 5) ``` -At $x = -2.5$ the derivative is postive or negative? +At $x = -2.5$ the derivative is positive or negative? ```{julia} @@ -1289,7 +1289,7 @@ answ = 1 radioq(choices, answ, keep_order=true) ``` -At $x=0$ the derivative is postive or negative? +At $x=0$ the derivative is positive or negative? ```{julia} @@ -1300,7 +1300,7 @@ answ = 2 radioq(choices, answ, keep_order=true) ``` -At $x = 2.5$ the derivative is postive or negative? +At $x = 2.5$ the derivative is positive or negative? ```{julia} diff --git a/quarto/derivatives/first_second_derivatives.qmd b/quarto/derivatives/first_second_derivatives.qmd index 8856395..f81b5d2 100644 --- a/quarto/derivatives/first_second_derivatives.qmd +++ b/quarto/derivatives/first_second_derivatives.qmd @@ -124,7 +124,7 @@ plotif(f, f', -2, 2) When a function changes from increasing to decreasing, or decreasing to increasing, it will have a peak or a valley. More formally, such points are relative extrema. -When discussing the mean value thereom, we defined *relative extrema* : +When discussing the mean value theorem, we defined *relative extrema* : > * The function $f(x)$ has a *relative maximum* at $c$ if the value $f(c)$ is an *absolute maximum* for some *open* interval containing $c$. @@ -264,9 +264,9 @@ Such values are often summarized graphically on a number line using a *sign char Reading this we have: - * the derivative changes sign from negative to postive at $x=-1$, so $g(x)$ will have a relative minimum. + * the derivative changes sign from negative to positive at $x=-1$, so $g(x)$ will have a relative minimum. * the derivative changes sign from positive to negative at $x=0$, so $g(x)$ will have a relative maximum. - * the derivative changes sign from negative to postive at $x=1$, so $g(x)$ will have a relative minimum. + * the derivative changes sign from negative to positive at $x=1$, so $g(x)$ will have a relative minimum. In the `CalculusWithJulia` package there is `sign_chart` function that will do such work for us, though with a different display: diff --git a/quarto/derivatives/linearization.qmd b/quarto/derivatives/linearization.qmd index 90b2039..2290342 100644 --- a/quarto/derivatives/linearization.qmd +++ b/quarto/derivatives/linearization.qmd @@ -192,7 +192,7 @@ p The plot shows the tangent line with slope $dy/dx$ and the actual change in $y$, $\Delta y$, for some specified $\Delta x$. The small gap above the sine curve is the error were the value of the sine approximated using the drawn tangent line. We can see that approximating the value of $\Delta y = \sin(c+\Delta x) - \sin(c)$ with the often easier to compute $(dy/dx) \cdot \Delta x = f'(c)\Delta x$ - for small enough values of $\Delta x$ - is not going to be too far off provided $\Delta x$ is not too large. -This approximation is known as linearization. It can be used both in theoretical computations and in pratical applications. To see how effective it is, we look at some examples. +This approximation is known as linearization. It can be used both in theoretical computations and in practical applications. To see how effective it is, we look at some examples. ##### Example diff --git a/quarto/derivatives/mean_value_theorem.qmd b/quarto/derivatives/mean_value_theorem.qmd index ef0a84b..21ae30a 100644 --- a/quarto/derivatives/mean_value_theorem.qmd +++ b/quarto/derivatives/mean_value_theorem.qmd @@ -354,7 +354,8 @@ That is the function $f(x)$, minus the secant line between $(a,f(a))$ and $(b, f #The polynomial function interpolates the points ``A``,``B``,``C``, and ``D``. #Adjusting these creates different functions. Regardless of the #function -- which as a polynomial will always be continuous and -#differentiable -- the slope of the secant line between ``A`` and ``B`` is alway#s matched by **some** tangent line between the points ``A`` and ``B``. +#differentiable -- the slope of the secant line between ``A`` and ``B`` is +#always matched by **some** tangent line between the points ``A`` and ``B``. #""" #JSXGraph(:derivatives, "mean-value.js", caption) nothing diff --git a/quarto/derivatives/more_zeros.qmd b/quarto/derivatives/more_zeros.qmd index 90806e4..3932ed4 100644 --- a/quarto/derivatives/more_zeros.qmd +++ b/quarto/derivatives/more_zeros.qmd @@ -111,7 +111,7 @@ f0,f1 = f1, sin(x1) x1,f1 ``` -Like Newton's method, the secant method coverges quickly for this problem (though its rate is less than the quadratic rate of Newton's method). +Like Newton's method, the secant method converges quickly for this problem (though its rate is less than the quadratic rate of Newton's method). This method is included in `Roots` as `Secant()` (or `Order1()`): @@ -210,7 +210,7 @@ Though the above can be simplified quite a bit when computed by hand, here we si An inverse quadratic step is utilized by Brent's method, as possible, to yield a rapidly convergent bracketing algorithm implemented as a default zero finder in many software languages. `Julia`'s `Roots` package implements the method in `Roots.Brent()`. An inverse cubic interpolation is utilized by [Alefeld, Potra, and Shi](https://dl.acm.org/doi/10.1145/210089.210111) which gives an asymptotically even more rapidly convergent algorithm than Brent's (implemented in `Roots.AlefeldPotraShi()` and also `Roots.A42()`). This is used as a finishing step in many cases by the default hybrid `Order0()` method of `find_zero`. -In a bracketing algorithm, the next step should reduce the size of the bracket, so the next iterate should be inside the current bracket. However, quadratic convergence does not guarantee this to happen. As such, sometimes a subsitute method must be chosen. +In a bracketing algorithm, the next step should reduce the size of the bracket, so the next iterate should be inside the current bracket. However, quadratic convergence does not guarantee this to happen. As such, sometimes a substitute method must be chosen. [Chandrapatla's](https://www.google.com/books/edition/Computational_Physics/cC-8BAAAQBAJ?hl=en&gbpv=1&pg=PA95&printsec=frontcover) method, is a bracketing method utilizing an inverse quadratic step as the centerpiece. The key insight is the test to choose between this inverse quadratic step and a bisection step. This is done in the following based on values of $\xi$ and $\Phi$ defined within: diff --git a/quarto/derivatives/newtons_method.qmd b/quarto/derivatives/newtons_method.qmd index d5d3b14..20f2efd 100644 --- a/quarto/derivatives/newtons_method.qmd +++ b/quarto/derivatives/newtons_method.qmd @@ -758,7 +758,7 @@ ImageFile(imgfile, caption) # {{{newtons_method_flat}}} caption = L""" -Illustration of Newton's method failing to coverge as for some $x_i$, +Illustration of Newton's method failing to converge as for some $x_i$, $f'(x_i)$ is too close to ``0``. In this instance after a few steps, the algorithm just cycles around the local minimum near $0.66$. The values of $x_i$ repeat in the pattern: $1.0002, 0.7503, -0.0833, 1.0002, @@ -1105,7 +1105,7 @@ If $x_0$ is $1$ what occurs? nm_choices = [ "The algorithm converges very quickly. A good initial point was chosen.", "The algorithm converges, but slowly. The initial point is close enough to the answer to ensure decreasing errors.", -"The algrithm fails to converge, as it cycles about" +"The algorithm fails to converge, as it cycles about" ] radioq(nm_choices, 1, keep_order=true) ``` diff --git a/quarto/derivatives/optimization.qmd b/quarto/derivatives/optimization.qmd index 8bd7955..fc4ce2a 100644 --- a/quarto/derivatives/optimization.qmd +++ b/quarto/derivatives/optimization.qmd @@ -157,7 +157,7 @@ find_zeros(A', 0, 10) # find_zeros in `Roots`, :::{.callout-note} ## Note -Look at the last definition of `A`. The function `A` appears on both sides, though on the left side with one argument and on the right with two. These are two "methods" of a *generic* function, `A`. `Julia` allows multiple definitions for the same name as long as the arguments (their number and type) can disambiguate which to use. In this instance, when one argument is passed in then the last defintion is used (`A(b,h(b))`), whereas if two are passed in, then the method that multiplies both arguments is used. The advantage of multiple dispatch is illustrated: the same concept - area - has one function name, though there may be different ways to compute the area, so there is more than one implementation. +Look at the last definition of `A`. The function `A` appears on both sides, though on the left side with one argument and on the right with two. These are two "methods" of a *generic* function, `A`. `Julia` allows multiple definitions for the same name as long as the arguments (their number and type) can disambiguate which to use. In this instance, when one argument is passed in then the last definition is used (`A(b,h(b))`), whereas if two are passed in, then the method that multiplies both arguments is used. The advantage of multiple dispatch is illustrated: the same concept - area - has one function name, though there may be different ways to compute the area, so there is more than one implementation. ::: @@ -1143,7 +1143,7 @@ numericq(Prim(val), 1e-3) ## a square! ###### Question -A running track is in the shape of two straight aways and two half circles. The total distance (perimeter) is 400 meters. Suppose $w$ is the width (twice the radius of the circles) and $h$ is the height. What dimensions minimize the sum $w + h$? +A running track is in the shape of two straightaways and two half circles. The total distance (perimeter) is 400 meters. Suppose $w$ is the width (twice the radius of the circles) and $h$ is the height. What dimensions minimize the sum $w + h$? You have $P(w, h) = 2\pi \cdot (w/2) + 2\cdot(h-w)$. @@ -1306,7 +1306,7 @@ Let $f(x) = (a/x)^x$ for $a,x > 0$. When is this maximized? The following might ```{julia} #| hold: true -@syms x::positive a::postive +@syms x::positive a::positive diff((a/x)^x, x) ``` @@ -1377,7 +1377,7 @@ Why is the following set of commands useful in this task: #| eval: false c2 = a^2*(1 + 1/p)^2 + b^2*(1+p)^2 c2p = diff(c2, p) -eq = numer(together(c2p)) +eq = numerator(together(c2p)) solve(eq ~ 0, p) ``` diff --git a/quarto/derivatives/taylor_series_polynomials.qmd b/quarto/derivatives/taylor_series_polynomials.qmd index 66027bb..539d2d5 100644 --- a/quarto/derivatives/taylor_series_polynomials.qmd +++ b/quarto/derivatives/taylor_series_polynomials.qmd @@ -64,7 +64,7 @@ gif(anim, imgfile, fps = 1) caption = L""" -Illustration of the Taylor polynomial of degree $k$, $T_k(x)$, at $c=0$ and its graph overlayed on that of the function $1 - \cos(x)$. +Illustration of the Taylor polynomial of degree $k$, $T_k(x)$, at $c=0$ and its graph overlaid on that of the function $1 - \cos(x)$. """ @@ -921,7 +921,7 @@ end gᵏs ``` -We can see the expected `g' = 1/f'` (where the point of evalution is $g'(y) = 1/f'(f^{-1}(y))$ is not written). In addition, we get 3 more formulas, hinting that the answers grow rapidly in terms of their complexity. +We can see the expected `g' = 1/f'` (where the point of evaluation is $g'(y) = 1/f'(f^{-1}(y))$ is not written). In addition, we get 3 more formulas, hinting that the answers grow rapidly in terms of their complexity. In the above, for each `n`, the code above sets up the two sides, `left` and `right`, of an equation involving the higher-order derivatives of $g$. For example, when `n=2` we have: diff --git a/quarto/differentiable_vector_calculus/plots_plotting.qmd b/quarto/differentiable_vector_calculus/plots_plotting.qmd index 6bd4731..82e15ad 100644 --- a/quarto/differentiable_vector_calculus/plots_plotting.qmd +++ b/quarto/differentiable_vector_calculus/plots_plotting.qmd @@ -118,7 +118,7 @@ Adding many arrows this way would be inefficient. ### Setting a viewing angle for 3D plots -For 3D plots, the viewing angle can make the difference in visualizing the key features. In `Plots`, some backends allow the viewing angle to be set with the mouse by clicking and dragging. Not all do. For such, the `camera` argument is used, as in `camera(azimuthal, elevation)` where the angles are given in degrees. If the $x$-$y$-$z$ coorinates are given, then `elevation` or *inclination*, is the angle between the $z$ axis and the $x-y$ plane (so `90` is a top view) and `azimuthal` is the angle in the $x-y$ plane from the $x$ axes. +For 3D plots, the viewing angle can make the difference in visualizing the key features. In `Plots`, some backends allow the viewing angle to be set with the mouse by clicking and dragging. Not all do. For such, the `camera` argument is used, as in `camera(azimuthal, elevation)` where the angles are given in degrees. If the $x$-$y$-$z$ coordinates are given, then `elevation` or *inclination*, is the angle between the $z$ axis and the $x-y$ plane (so `90` is a top view) and `azimuthal` is the angle in the $x-y$ plane from the $x$ axes. ## Visualizing functions from $R^2 \rightarrow R$ diff --git a/quarto/differentiable_vector_calculus/scalar_functions.qmd b/quarto/differentiable_vector_calculus/scalar_functions.qmd index 2f94442..bccd006 100644 --- a/quarto/differentiable_vector_calculus/scalar_functions.qmd +++ b/quarto/differentiable_vector_calculus/scalar_functions.qmd @@ -739,7 +739,7 @@ To go from a function that takes a point to a function of that point, we have th ```{julia} #| eval: false -FowardDiff.gradient(f::Function) = x -> ForwardDiff.gradient(f, x) +ForwardDiff.gradient(f::Function) = x -> ForwardDiff.gradient(f, x) ``` It works as follows, where a vector of values is passed in for the point in question: @@ -781,7 +781,7 @@ partial_x(f, y) = x -> ForwardDiff.derivative(u -> f(u,y), x) :::{.callout-note} ## Note -For vector-valued functions, we can overide the syntax `'` using `Base.adjoint`, as `'` is treated as a postfix operator in `Julia` for the `adjoint` operation. The symbol `\\nabla` is also available in `Julia`, but it is not an operator, so can't be used as mathematically written `∇f` (this could be used as a name though). In `CalculusWithJulia` a definition is made so essentially `∇(f) = x -> ForwardDiff.gradient(f, x)`. It does require parentheses to be called, as in `∇(f)`. +For vector-valued functions, we can override the syntax `'` using `Base.adjoint`, as `'` is treated as a postfix operator in `Julia` for the `adjoint` operation. The symbol `\\nabla` is also available in `Julia`, but it is not an operator, so can't be used as mathematically written `∇f` (this could be used as a name though). In `CalculusWithJulia` a definition is made so essentially `∇(f) = x -> ForwardDiff.gradient(f, x)`. It does require parentheses to be called, as in `∇(f)`. ::: @@ -1471,7 +1471,7 @@ We see that `diff(ex, x, y)` and `diff(ex, y, x)` are identical. This is not a c -For higher order mixed partials, something similar to Schwarz's theorem still holds. Say $f:R^n \rightarrow R$ is $C^k$ if $f$ is continuous and all partial derivatives of order $j \leq k$ are continous. If $f$ is $C^k$, and $k=k_1+k_2+\cdots+k_n$ ($k_i \geq 0$) then +For higher order mixed partials, something similar to Schwarz's theorem still holds. Say $f:R^n \rightarrow R$ is $C^k$ if $f$ is continuous and all partial derivatives of order $j \leq k$ are continuous. If $f$ is $C^k$, and $k=k_1+k_2+\cdots+k_n$ ($k_i \geq 0$) then $$ @@ -1507,7 +1507,7 @@ hessian(ex, (x, y)) When the mixed partials are continuous, this will be a symmetric matrix. The Hessian matrix plays the role of the second derivative in the multivariate Taylor theorem. -For numeric use, `FowardDiff` has a `hessian` function. It expects a scalar function and a point and returns the Hessian matrix. We have for $f(x,y) = e^x\cos(y)$ at the point $(1,2)$, the Hessian matrix is: +For numeric use, `ForwardDiff` has a `hessian` function. It expects a scalar function and a point and returns the Hessian matrix. We have for $f(x,y) = e^x\cos(y)$ at the point $(1,2)$, the Hessian matrix is: ```{julia} diff --git a/quarto/differentiable_vector_calculus/scalar_functions_applications.qmd b/quarto/differentiable_vector_calculus/scalar_functions_applications.qmd index c8a3177..ed49f11 100644 --- a/quarto/differentiable_vector_calculus/scalar_functions_applications.qmd +++ b/quarto/differentiable_vector_calculus/scalar_functions_applications.qmd @@ -320,7 +320,7 @@ $$ A [piriform](http://www.math.harvard.edu/~knill/teaching/summer2011/handouts/32-linearization.pdf) is described by the quartic surface $f(x,y,z) = x^4 -x^3 + y^2+z^2 = 0$. Find the tangent line at the point $\langle 2,2,2 \rangle$. -Here, $\nabla{f}$ describes a *normal* to the tangent plane. The description of a plane may be described by $\hat{N}\cdot(\vec{x} - \vec{x}_0) = 0$, where $\vec{x}_0$ is identified with a point on the plane (the point $(2,2,2)$ here). With this, we have $\hat{N}\cdot\vec{x} = ax + by + cz = \hat{N}\cdot\langle 2,2,2\rangle = 2(a+b+c)$. For ths problem, $\nabla{f}(2,2,2) = \langle a, b, c\rangle$ is given by: +Here, $\nabla{f}$ describes a *normal* to the tangent plane. The description of a plane may be described by $\hat{N}\cdot(\vec{x} - \vec{x}_0) = 0$, where $\vec{x}_0$ is identified with a point on the plane (the point $(2,2,2)$ here). With this, we have $\hat{N}\cdot\vec{x} = ax + by + cz = \hat{N}\cdot\langle 2,2,2\rangle = 2(a+b+c)$. For this problem, $\nabla{f}(2,2,2) = \langle a, b, c\rangle$ is given by: ```{julia} @@ -1404,7 +1404,7 @@ ys = range(-0.5, 0.5, length=100) contour!(xs, ys, f, levels = [.7, .85, 1, 1.15, 1.3]) ``` -We can still identify the tangent and normal directions. What is different about this point is that local movement on the constraint curve is also local movement on the contour line of $f$, so $f$ doesn't increase or decrease here, as it would if this point were an extrema along the contraint. The key to seeing this is the contour lines of $f$ are *tangent* to the constraint. The respective gradients are *orthogonal* to their tangent lines, and in dimension $2$, this implies they are parallel to each other. +We can still identify the tangent and normal directions. What is different about this point is that local movement on the constraint curve is also local movement on the contour line of $f$, so $f$ doesn't increase or decrease here, as it would if this point were an extrema along the constraint. The key to seeing this is the contour lines of $f$ are *tangent* to the constraint. The respective gradients are *orthogonal* to their tangent lines, and in dimension $2$, this implies they are parallel to each other. > *The method of Lagrange multipliers*: To optimize $f(x,y)$ subject to a constraint $g(x,y) = k$ we solve for all *simultaneous* solutions to @@ -1552,7 +1552,7 @@ Following Lagrange, we generalize the problem to the following: maximize $\int_{ The starting point is a *perturbation*: $\hat{y}(x) = y(x) + \epsilon_1 \eta_1(x) + \epsilon_2 \eta_2(x)$. There are two perturbation terms, were only one term added, then the perturbation may make $\hat{y}$ not satisfy the constraint, the second term is used to ensure the constraint is not violated. If $\hat{y}$ is to be a possible solution to our problem, we would want $\hat{y}(x_0) = \hat{y}(x_1) = 0$, as it does for $y(x)$, so we *assume* $\eta_1$ and $\eta_2$ satisfy this boundary condition. -With this notation, and fixing $y$ we can re-express the equations in terms ot $\epsilon_1$ and $\epsilon_2$: +With this notation, and fixing $y$ we can re-express the equations in terms of $\epsilon_1$ and $\epsilon_2$: @@ -1699,7 +1699,7 @@ Now to identify $C$ in terms of $L$. $L$ is the length of arc of circle of radiu ##### Example: more constraints -Consider now the case of maximizing $f(x,y,z)$ subject to $g(x,y,z)=c$ and $h(x,y,z) = d$. Can something similar be said to characterize potential values for this to occur? Trying to describe where $g(x,y,z) = c$ and $h(x,y,z)=d$ in general will prove difficult. The easy case would be it the two equations were linear, in which case they would describe planes. Two non-parallel planes would intersect in a line. If the general case, imagine the surfaces locally replaced by their tangent planes, then their intersection would be a line, and this line would point in along the curve given by the intersection of the surfaces formed by the contraints. This line is similar to the tangent line in the $2$-variable case. Now if $\nabla{f}$, which points in the direction of greatest increase of $f$, had a non-zero projection onto this line, then moving the point in that direction along the line would increase $f$ and still leave the point following the contraints. That is, if there is a non-zero directional derivative the point is not a maximum. +Consider now the case of maximizing $f(x,y,z)$ subject to $g(x,y,z)=c$ and $h(x,y,z) = d$. Can something similar be said to characterize potential values for this to occur? Trying to describe where $g(x,y,z) = c$ and $h(x,y,z)=d$ in general will prove difficult. The easy case would be it the two equations were linear, in which case they would describe planes. Two non-parallel planes would intersect in a line. If the general case, imagine the surfaces locally replaced by their tangent planes, then their intersection would be a line, and this line would point in along the curve given by the intersection of the surfaces formed by the constraints. This line is similar to the tangent line in the $2$-variable case. Now if $\nabla{f}$, which points in the direction of greatest increase of $f$, had a non-zero projection onto this line, then moving the point in that direction along the line would increase $f$ and still leave the point following the constraints. That is, if there is a non-zero directional derivative the point is not a maximum. The tangent planes are *orthogonal* to the vectors $\nabla{g}$ and $\nabla{h}$, so in this case parallel to $\nabla{g} \times \nabla{h}$. The condition that $\nabla{f}$ be *orthogonal* to this vector, means that $\nabla{f}$ *must* sit in the plane described by $\nabla{g}$ and $\nabla{h}$ - the plane of orthogonal vectors to $\nabla{g} \times \nabla{h}$. That is, this condition is needed: diff --git a/quarto/differentiable_vector_calculus/vector_fields.qmd b/quarto/differentiable_vector_calculus/vector_fields.qmd index ff37fa9..c344ec7 100644 --- a/quarto/differentiable_vector_calculus/vector_fields.qmd +++ b/quarto/differentiable_vector_calculus/vector_fields.qmd @@ -178,7 +178,7 @@ Instead of the comprehension, broadcasting can be used surface(X.(thetas, phis'), Y.(thetas, phis'), Z.(thetas, phis')) ``` -If the parameterization is presented as a function, broadcasting can be used to succintly plot +If the parameterization is presented as a function, broadcasting can be used to succinctly plot ```{julia} diff --git a/quarto/differentiable_vector_calculus/vector_valued_functions.qmd b/quarto/differentiable_vector_calculus/vector_valued_functions.qmd index 314c593..2ea85c4 100644 --- a/quarto/differentiable_vector_calculus/vector_valued_functions.qmd +++ b/quarto/differentiable_vector_calculus/vector_valued_functions.qmd @@ -586,7 +586,7 @@ With this, the equation is simply $\vec{tl}(t) = \vec{f}(t_0) + \vec{f}'(t_0) \c ##### Example: parabolic motion -In physics, we learn that the equation $F=ma$ can be used to derive a formula for postion, when acceleration, $a$, is a constant. The resulting equation of motion is $x = x_0 + v_0t + (1/2) at^2$. Similarly, if $x(t)$ is a vector-valued postion vector, and the *second* derivative, $x''(t) =\vec{a}$, a constant, then we have: $x(t) = \vec{x_0} + \vec{v_0}t + (1/2) \vec{a} t^2$. +In physics, we learn that the equation $F=ma$ can be used to derive a formula for position, when acceleration, $a$, is a constant. The resulting equation of motion is $x = x_0 + v_0t + (1/2) at^2$. Similarly, if $x(t)$ is a vector-valued position vector, and the *second* derivative, $x''(t) =\vec{a}$, a constant, then we have: $x(t) = \vec{x_0} + \vec{v_0}t + (1/2) \vec{a} t^2$. For two dimensions, we have the force due to gravity acts downward, only in the $y$ direction. The acceleration is then $\vec{a} = \langle 0, -g \rangle$. If we start at the origin, with initial velocity $\vec{v_0} = \langle 2, 3\rangle$, then we can plot the trajectory until the object returns to ground ($y=0$) as follows: @@ -1109,7 +1109,7 @@ $$ 0 = \frac{d(r^2 \dot{\theta})}{dt} = 2r\dot{r}\dot{\theta} + r^2 \ddot{\theta}, $$ -which is the tranversal component of the acceleration times $r$, as decomposed above. This means, that the acceleration of the planet is completely towards the Sun at the origin. +which is the transversal component of the acceleration times $r$, as decomposed above. This means, that the acceleration of the planet is completely towards the Sun at the origin. Kepler's first law, relates $r$ and $\theta$ through the polar equation of an ellipse: @@ -2020,7 +2020,7 @@ Let $r$ be the radius of a circle and for concreteness we position it at $(-r, 0 * Between angles $0$ and $\pi/2$ the horse has unconstrained access, so they can graze a wedge of radius $R$. * Between angles $\pi/2$ and until the horse's $y$ position is $0$ when the tether is taut the boundary of what can be eaten is described by the involute. - * The horse can't eat from withing the circle or radius $r$. + * The horse can't eat from within the circle or radius $r$. ```{julia} diff --git a/quarto/differentiable_vector_calculus/vectors.qmd b/quarto/differentiable_vector_calculus/vectors.qmd index 3003e0d..f621e34 100644 --- a/quarto/differentiable_vector_calculus/vectors.qmd +++ b/quarto/differentiable_vector_calculus/vectors.qmd @@ -564,7 +564,7 @@ Vectors are defined similarly. As they are identified with *column* vectors, we 𝒷 = [10, 11, 12] # not 𝒷 = [10 11 12], which would be a row vector. ``` -In `Julia`, entries in a matrix (or a vector) are stored in a container with a type wide enough accomodate each entry. In this example, the type is SymPy's `Sym` type: +In `Julia`, entries in a matrix (or a vector) are stored in a container with a type wide enough accommodate each entry. In this example, the type is SymPy's `Sym` type: ```{julia} diff --git a/quarto/integral_vector_calculus/double_triple_integrals.qmd b/quarto/integral_vector_calculus/double_triple_integrals.qmd index e073557..fcab403 100644 --- a/quarto/integral_vector_calculus/double_triple_integrals.qmd +++ b/quarto/integral_vector_calculus/double_triple_integrals.qmd @@ -1028,7 +1028,7 @@ end ``` -The tranformation to elliptical coordinates, $G(u,v) = \langle \cosh(u)\cos(v), \sinh(u)\sin(v)\rangle$, may be viewed similarly: +The transformation to elliptical coordinates, $G(u,v) = \langle \cosh(u)\cos(v), \sinh(u)\sin(v)\rangle$, may be viewed similarly: ```{julia} diff --git a/quarto/integral_vector_calculus/line_integrals.qmd b/quarto/integral_vector_calculus/line_integrals.qmd index 8c36880..0b56a05 100644 --- a/quarto/integral_vector_calculus/line_integrals.qmd +++ b/quarto/integral_vector_calculus/line_integrals.qmd @@ -1,322 +1,4 @@ -# Line and Surface Integrals - - -{{< include ../_common_code.qmd >}} - -This section uses these add-on packages: - - -```{julia} -using CalculusWithJulia -using Plots -using QuadGK -using SymPy -using HCubature -``` - - ---- - - -This section discusses generalizations to the one- and two-dimensional definite integral. These two integrals integrate a function over a one or two dimensional region (e.g., $[a,b]$ or $[a,b]\times[c,d]$). The generalization is to change this region to a one-dimensional piece of path in $R^n$ or a two-dimensional surface in $R^3$. - - -To fix notation, consider $\int_a^b f(x)dx$ and $\int_a^b\int_c^d g(x,y) dy dx$. In defining both, a Riemann sum is involved, these involve a partition of $[a,b]$ or $[a,b]\times[c,d]$ and terms like $f(c_i) \Delta{x_i}$ and $g(c_i, d_j) \Delta{x_i}\Delta{y_j}$. The $\Delta$s the diameter of an intervals $I_i$ or $J_j$. Consider now two parameterizations: $\vec{r}(t)$ for $t$ in $[a,b]$ and $\Phi(u,v)$ for $(u,v)$ in $[a,b]\times[c,d]$. One is a parameterization of a space curve, $\vec{r}:R\rightarrow R^n$; the other a parameterization of a surface, $\Phi:R^2 \rightarrow R^3$. The *image* of $I_i$ or $I_i\times{J_j}$ under $\vec{r}$ and $\Phi$, respectively, will look *almost* linear if the intervals are small enough, so, at least on the microscopic level. A Riemann term can be based around this fact, provided it is understood how much the two parameterizations change the interval $I_i$ or region $I_i\times{J_j}$. - - -This chapter will quantify this change, describing it in terms of associated vectors to $\vec{r}$ and $\Phi$, yielding formulas for an integral of a *scalar* function along a path or over a surface. Furthermore, these integrals will be generalized to give meaning to physically useful interactions between the path or surface and a vector field. - - -## Line integrals - - -In [arc length](../integrals/arc-length.html) a formula to give the arc-length of the graph of a univariate function or parameterized curve in $2$ dimensions is given in terms of an integral. The intuitive approximation involved segments of the curve. To review, let $\vec{r}(t)$, $a \leq t \leq b$, describe a curve, $C$, in $R^n$, $n \geq 2$. Partition $[a,b]$ into $a=t_0 < t_1 < \cdots < t_{n-1} < t_n = b$. - - -Consider the path segment connecting $\vec{r}(t_{i-1})$ to $\vec{r}(t_i)$. If the partition of $[a,b]$ is microscopically small, this path will be *approximated* by $\vec{r}(t_i) - \vec{r}(t_{i-1})$. This difference in turn is approximately $\vec{r}'(t_i) (t_i - t_{i-1}) = \vec{r}'(t_i) \Delta{t}_i$, provided $\vec{r}$ is differentiable. - - -If $f:R^n \rightarrow R$ is a scalar function. Taking right-hand end points, we can consider the Riemann sum $\sum (f\circ\vec{r})(t_i) \|\vec{r}'(t_i)\| \Delta{t}_i$. For integrable functions, this sum converges to the *line integral* defined as a one-dimensional integral for a given parameterization: - - -$$ -\int_a^b f(\vec{r}(t)) \| \vec{r}'(t) \| dt. -$$ - -The weight $\| \vec{r}'(t) \|$ can be interpreted by how much the parameterization stretches (or contracts) an interval $[t_{i-1},t_i]$ when mapped to its corresponding path segment. - - ---- - - -The curve $C$ can be parameterized many different ways by introducing a function $s(t)$ to change the time. If we use the arc-length parameterization with $\gamma(0) = a$ and $\gamma(l) = b$, where $l$ is the arc-length of $C$, then we have by change of variables $t = \gamma(s)$ that - - -$$ -\int_a^b f(\vec{r}(t)) \| \vec{r}'(t) \| dt = -\int_0^l (f \circ \vec{r} \circ \gamma)(s) \| \frac{d\vec{r}}{dt}\mid_{t = \gamma(s)}\| \gamma'(s) ds. -$$ - -But, by the chain rule: - - -$$ -\frac{d(\vec{r} \circ\gamma)}{du}(s) = \frac{d\vec{r}}{dt}\mid_{t=\gamma(s)} \frac{d\gamma}{du}. -$$ - -Since $\gamma$ is increasing, $\gamma' \geq 0$, so we get: - - -$$ -\int_a^b f(\vec{r}(t)) \| \vec{r}'(t) \| dt = -\int_0^l (f \circ \vec{r} \circ \gamma)(s) \|\frac{d(\vec{r}\circ\gamma)}{ds}\| ds = -\int_0^l (f \circ \vec{r} \circ \gamma)(s) ds. -$$ - -The last line, as the derivative is the unit tangent vector, $T$, with norm $1$. - - -This shows that the line integral is *not* dependent on the parameterization. The notation $\int_C f ds$ is used to represent the line integral of a scalar function, the $ds$ emphasizing an implicit parameterization of $C$ by arc-length. When $C$ is a closed curve, the $\oint_C fds$ is used to indicate that. - - -### Example - - -When $f$ is identically $1$, the line integral returns the arc length. When $f$ varies, then the line integral can be interpreted a few ways. First, if $f \geq 0$ and we consider a sheet hung from the curve $f\circ \vec{r}$ and cut to just touch the ground, the line integral gives the area of this sheet, in the same way an integral gives the area under a positive curve. - - -If the composition $f \circ \vec{r}$ is viewed as a density of the arc (as though it were constructed out of some non-uniform material), then the line integral can be seen to return the mass of the arc. - - -Suppose $\rho(x,y,z) = 5 - z$ gives the density of an arc where the arc is parameterized by $\vec{r}(t) = \langle \cos(t), 0, \sin(t) \rangle$, $0 \leq t \leq \pi$. (A half-circular arc.) Find the mass of the arc. - - -```{julia} -rho(x,y,z) = 5 - z -rho(v) = rho(v...) -r(t) = [cos(t), 0, sin(t)] - -@syms t -rp = diff.(r(t),t) # r' -area = integrate((rho ∘ r)(t) * norm(rp), (t, 0, PI)) -``` - -Continuing, we could find the center of mass by integrating $\int_C z (f\circ \vec{r}) \|r'\| dt$: - - -```{julia} -Mz = integrate(r(t)[3] * (rho ∘ r)(t) * norm(rp), (t, 0, PI)) -Mz -``` - -Finally, we get the center of mass by - - -```{julia} -Mz / area -``` - -##### Example - - -Let $f(x,y,z) = x\sin(y)\cos(z)$ and $C$ the path described by $\vec{r}(t) = \langle t, t^2, t^3\rangle$ for $0 \leq t \leq \pi$. Find the line integral $\int_C fds$. - - -We find the numeric value with: - - -```{julia} -#| hold: true -f(x,y,z) = x*sin(y)*cos(z) -f(v) = f(v...) -r(t) = [t, t^2, t^3] -integrand(t) = (f ∘ r)(t) * norm(r'(t)) -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$. - - -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 - - -$$ -(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}, -$$ - -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$. - - -(Ampere's law is more typically used to find $B$ from an current, then $I$ from $B$, for special circumstances. The Biot-Savart does this more generally.) - - -### Line integrals and vector fields; work and flow - - -As defined above, the line integral is defined for a scalar function, but this can be generalized. If $F:R^n \rightarrow R^n$ is a vector field, then each component is a scalar function, so the integral $\int (F\circ\vec{r}) \|\vec{r}'\| dt$ can be defined component by component to yield a vector. - - -However, it proves more interesting to define an integral incorporating how properties of the path interact with the vector field. The key is $\vec{r}'(t) dt = \hat{T} \| \vec{r}'(t)\|dt$ describes both the magnitude of how the parameterization stretches an interval but also a direction the path is taking. This direction allows interaction with the vector field. - - -The canonical example is [work](https://en.wikipedia.org/wiki/Work_(physics)), which is a measure of a force times a distance. For an object following a path, the work done is still a force times a distance, but only that force in the direction of the motion is considered. (The *constraint force* keeping the object on the path does no work.) Mathematically, $\hat{T}$ describes the direction of motion along a path, so the work done in moving an object over a small segment of the path is $(F\cdot\hat{T}) \Delta{s}$. Adding up incremental amounts of work leads to a Riemann sum for a line integral involving a vector field. - - -> The *work* done in moving an object along a path $C$ by a force field, $F$, is given by the integral -> -> $$ -> \int_C (F \cdot \hat{T}) ds = \int_C F\cdot d\vec{r} = \int_a^b ((F\circ\vec{r}) \cdot \frac{d\vec{r}}{dt})(t) dt. -> $$ - - - ---- - - -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 -> -> $$ -> \int_C (F\cdot\hat{N}) ds = \int_a^b (F \circ \vec{r})(t) \cdot (\vec{r}'(t))^t dt. -> $$ - - - -### Examples - - -##### Example - - -Let $F(x,y,z) = \langle x - y, x^2 - y^2, x^2 - z^2 \rangle$ and $\vec{r}(t) = \langle t, t^2, t^3 \rangle$. Find the work required to move an object along the curve described by $\vec{r}$ between $0$ and $1$. - - -```{julia} -#| hold: true -F(x,y,z) = [x-y, x^2 - y^2, x^2 - z^2] -F(v) = F(v...) -r(t) = [t, t^2, t^3] - -@syms t::real -integrate((F ∘ r)(t) ⋅ diff.(r(t), t), (t, 0, 1)) -``` - -##### Example - - -Let $C$ be a closed curve. For a closed curve, the work integral is also termed the *circulation*. For the vector field $F(x,y) = \langle -y, x\rangle$ compute the circulation around the triangle with vertices $(-1,0)$, $(1,0)$, and $(0,1)$. - - -We have three integrals using $\vec{r}_1(t) = \langle -1+2t, 0\rangle$, $\vec{r}_2(t) = \langle 1-t, t\rangle$ and $\vec{r}_3(t) = \langle -t, 1-t \rangle$, all from $0$ to $1$. (Check that the parameterization is counter clockwise.) - - -The circulation then is: - - -```{julia} -#| hold: true -r1(t) = [-1 + 2t, 0] -r2(t) = [1-t, t] -r3(t) = [-t, 1-t] -F(x,y) = [-y, x] -F(v) = F(v...) -integrand(r) = t -> (F ∘ r)(t) ⋅ r'(t) -C1 = quadgk(integrand(r1), 0, 1)[1] -C2 = quadgk(integrand(r2), 0, 1)[1] -C3 = quadgk(integrand(r3), 0, 1)[1] -C1 + C2 + C3 -``` - -That this is non-zero reflects a feature of the vector field. In this case, the vector field spirals around the origin, and the circulation is non zero. - - -##### Example - - -Let $F$ be the force of gravity exerted by a mass $M$ on a mass $m$ a distance $\vec{r}$ away, that is $F(\vec{r}) = -(GMm/\|\vec{r}\|^2)\hat{r}$. - - -Let $\vec{r}(t) = \langle 1-t, 0, t\rangle$, $0 \leq t \leq 1$. For concreteness, we take $G M m$ to be $10$. Then the work to move the mass is given by: - - -```{julia} -uvec(v) = v/norm(v) # unit vector -GMm = 10 -Fₘ(r) = - GMm /norm(r)^2 * uvec(r) -rₘ(t) = [1-t, 0, t] -quadgk(t -> (Fₘ ∘ rₘ)(t) ⋅ rₘ'(t), 0, 1) -``` - -Hmm, a value of $0$. That's a bit surprising at first glance. Maybe it had something to do with the specific path chosen. To investigate, we connect the start and endpoints with a circular arc, instead of a straight line: - - -```{julia} -rₒ(t) = [cos(t), 0, sin(t)] -quadgk(t -> (Fₘ ∘ rₒ)(t) ⋅ rₒ'(t), 0, 1) -``` - -Still $0$. We will see next that this is not surprising if something about $F$ is known. - - -:::{.callout-note} -## Note -The [Washington Post](https://www.washingtonpost.com/outlook/everything-you-thought-you-knew-about-gravity-is-wrong/2019/08/01/627f3696-a723-11e9-a3a6-ab670962db05_story.html") had an article by Richard Panek with the quote "Well, yes — depending on what we mean by 'attraction.' Two bodies of mass don’t actually exert some mysterious tugging on each other. Newton himself tried to avoid the word 'attraction' for this very reason. All (!) he was trying to do was find the math to describe the motions both down here on Earth and up there among the planets (of which Earth, thanks to Copernicus and Kepler and Galileo, was one)." The point being the formula above is a mathematical description of the force, but not an explanation of how the force actually is transferred. - -::: - -#### Work in a *conservative* vector field - - -Let $f: R^n \rightarrow R$ be a scalar function. Its gradient, $\nabla f$ is a *vector field*. For a *scalar* function, we have by the chain rule: - - -$$ -\frac{d(f \circ \vec{r})}{dt} = \nabla{f}(\vec{r}(t)) \cdot \frac{d\vec{r}}{dt}. -$$ - -If we integrate, we see: - - -$$ -W = \int_a^b \nabla{f}(\vec{r}(t)) \cdot \frac{d\vec{r}}{dt} dt = -\int_a^b \frac{d(f \circ \vec{r})}{dt} dt = -(f\circ\vec{r})\mid_{t = a}^b = -(f\circ\vec{r})(b) - (f\circ\vec{r})(a), -$$ - -using the Fundamental Theorem of Calculus. - - -The main point above is that *if* the vector field is the gradient of a scalar field, then the work done depends *only* on the endpoints of the path and not the path itself. - - -> **Conservative vector field**: If $F$ is a vector field defined in an *open* region $R$; $A$ and $B$ are points in $R$ and *if* for *any* curve $C$ in $R$ connecting $A$ to $B$, the line integral of $F \cdot \vec{T}$ over $C$ depends *only* on the endpoint $A$ and $B$ and not the path, then the line integral is called *path indenpendent* and the field is called a *conservative field*. - - - -The force of gravity is the gradient of a scalar field. As such, the two integrals above which yield $0$ could have been computed more directly. The particular scalar field is $f = -GMm/\|\vec{r}\|$, which goes by the name the gravitational *potential* function. As seen, $f$ depends only on magnitude, and as the endpoints of the path in the example have the same distance to the origin, the work integral, $(f\circ\vec{r})(b) - (f\circ\vec{r})(a)$ will be $0$. - - -##### Example - - -Coulomb's law states that the electrostatic force between two charged particles is proportional to the product of their charges and *inversely* proportional to square of the distance between the two particles. That is, - - -$$ -F = k\frac{ q q_0}{\|\vec{r}\|^2}\frac{\vec{r}}{\|\vec{r}\|}. -$$ - -This is similar to gravitational force and is a *conservative force*. We saw that a line integral for work in a conservative force depends only on the endpoints. Verify, that for a closed loop the work integral will yield $0$. - - -Take as a closed loop the unit circle, parameterized by arc-length by $\vec{r}(t) = \langle \cos(t), \sin(t)\rangle$. The unit tangent will be $\hat{T} = \vec{r}'(t) = \langle -\sin(t), \cos(t) \rangle$. The work to move a particle of charge $q_0$ about a partical of charge $q$ at the origin around the unit circle would be computed through: + of charge $q$ at the origin around the unit circle would be computed through: ```{julia} @@ -729,7 +411,7 @@ The surface element is the cross product $\langle \cos(\theta), \sin(\theta), -b ```{julia} -@syms 𝑹::postive θ::positive 𝒂::positive 𝒃::positive +@syms 𝑹::positive θ::positive 𝒂::positive 𝒃::positive 𝒏 = [cos(θ), sin(θ), -𝒃] × [-𝑹*sin(θ), 𝑹*cos(θ), 0] 𝒔𝒆 = simplify(norm(𝒏)) ``` @@ -1213,7 +895,7 @@ numericq(0) ###### Question -Let $f(x,y) = \tan^{-1}(y/x)$. We will integrate $\nabla{f}$ over the unit circle. The integrand wil be: +Let $f(x,y) = \tan^{-1}(y/x)$. We will integrate $\nabla{f}$ over the unit circle. The integrand will be: ```{julia} @@ -1418,7 +1100,7 @@ numericq(a) ###### Question -Let $F=\langle 0,0,1\rangle$ and $S$ be the upper-half unit sphere, parameterized by $\Phi(\theta, \phi) = \langle \sin(\phi)\cos(\theta), \sin(\phi)\sin(\theta), \cos(\phi)\rangle$. Compute $\iint_S (F\cdot\hat{N}) dS$ numerically. Choose the normal direction so that the answer is postive. +Let $F=\langle 0,0,1\rangle$ and $S$ be the upper-half unit sphere, parameterized by $\Phi(\theta, \phi) = \langle \sin(\phi)\cos(\theta), \sin(\phi)\sin(\theta), \cos(\phi)\rangle$. Compute $\iint_S (F\cdot\hat{N}) dS$ numerically. Choose the normal direction so that the answer is positive. ```{julia} diff --git a/quarto/integrals/arc_length.qmd b/quarto/integrals/arc_length.qmd index 5c1a217..d031561 100644 --- a/quarto/integrals/arc_length.qmd +++ b/quarto/integrals/arc_length.qmd @@ -761,7 +761,7 @@ This comes from solving the projectile motion equations with a drag force *propo ```{julia} #| hold: true -@syms gₑ::postive, k::postive, v₀::positive, θ::postive, x::postive +@syms gₑ::positive, k::positive, v₀::positive, θ::positive, x::positive ex = (gₑ/(k*v₀*cos(θ)) + tan(θ))*x + gₑ/k^2 * log(1 - k/(v₀*cos(θ))*x) diff(ex, x, x), diff(ex, x, x, x,) ``` diff --git a/quarto/integrals/area_between_curves.qmd b/quarto/integrals/area_between_curves.qmd index c0d7877..559b6f2 100644 --- a/quarto/integrals/area_between_curves.qmd +++ b/quarto/integrals/area_between_curves.qmd @@ -824,11 +824,11 @@ Doubling the answer above gives a value that Galileo had struggled with for many #| echo: false imgfile="figures/companion-curve-bisects-rectangle.png" caption = """ -Roberval, avoiding a trignometric integral, instead used symmetry to show that the area under the companion curve was half the area of the rectangle, which in this figure is `2pi`. +Roberval, avoiding a trigonometric integral, instead used symmetry to show that the area under the companion curve was half the area of the rectangle, which in this figure is `2pi`. """ # ImageFile(:integrals, imgfile, caption) nothing ``` -![Roberval, avoiding a trignometric integral, instead used symmetry to show that the area under the companion curve was half the area of the rectangle, which in this figure is $2\pi$. +![Roberval, avoiding a trignoometric integral, instead used symmetry to show that the area under the companion curve was half the area of the rectangle, which in this figure is $2\pi$. ](./figures/companion-curve-bisects-rectangle.png) diff --git a/quarto/integrals/center_of_mass.qmd b/quarto/integrals/center_of_mass.qmd index 7d1af2a..3b30c31 100644 --- a/quarto/integrals/center_of_mass.qmd +++ b/quarto/integrals/center_of_mass.qmd @@ -63,7 +63,7 @@ $$ Writing $w_i = m_i / (m_1 + m_2 + \cdots + m_n)$, we get the center of mass is just a weighted sum: $w_1 x_1 + \cdots + w_n x_n$, where the $w_i$ are the relative weights. -With some rearrangment, we can see that the center of mass satisfies the equation: +With some rearrangement, we can see that the center of mass satisfies the equation: $$ diff --git a/quarto/integrals/mean_value_theorem.qmd b/quarto/integrals/mean_value_theorem.qmd index 1e7321c..ef03c2a 100644 --- a/quarto/integrals/mean_value_theorem.qmd +++ b/quarto/integrals/mean_value_theorem.qmd @@ -29,7 +29,7 @@ $$ \frac{1}{b-a} \int_a^b f(x) dx. $$ -If $f$ is a constant, this is just the contant value, as would be expected. If $f$ is *piecewise* linear, then this is the weighted average of these constants. +If $f$ is a constant, this is just the constant value, as would be expected. If $f$ is *piecewise* linear, then this is the weighted average of these constants. #### Examples diff --git a/quarto/integrals/surface_area.qmd b/quarto/integrals/surface_area.qmd index 28bb5f9..cec88c4 100644 --- a/quarto/integrals/surface_area.qmd +++ b/quarto/integrals/surface_area.qmd @@ -85,7 +85,7 @@ To see why this formula is as it is, we look at the parameterized case, the firs Let a partition of $[a,b]$ be given by $a = t_0 < t_1 < t_2 < \cdots < t_n =b$. This breaks the curve into a collection of line segments. Consider the line segment connecting $(g(t_{i-1}), f(t_{i-1}))$ to $(g(t_i), f(t_i))$. Rotating this around the $x$ axis will generate something approximating a disc, but in reality will be the frustum of a cone. What will be the surface area? -Consider a right-circular cone parameterized by an angle $\theta$ and the largest radius $r$ (so that the height satisfies $r/h=\tan(\theta)$). If this cone were made of paper, cut up a side, and layed out flat, it would form a sector of a circle, whose area would be $R^2\gamma/2$ where $R$ is the radius of the circle (also the side length of our cone), and $\gamma$ an angle that we can figure out from $r$ and $\theta$. To do this, we note that the arc length of the circle's edge is $R\gamma$ and also the circumference of the bottom of the cone so $R\gamma = 2\pi r$. With all this, we can solve to get $A = \pi r^2/\sin(\theta)$. But we have a frustum of a cone with radii $r_0$ and $r_1$, so the surface area is a difference: $A = \pi (r_1^2 - r_0^2) /\sin(\theta)$. +Consider a right-circular cone parameterized by an angle $\theta$ and the largest radius $r$ (so that the height satisfies $r/h=\tan(\theta)$). If this cone were made of paper, cut up a side, and laid out flat, it would form a sector of a circle, whose area would be $R^2\gamma/2$ where $R$ is the radius of the circle (also the side length of our cone), and $\gamma$ an angle that we can figure out from $r$ and $\theta$. To do this, we note that the arc length of the circle's edge is $R\gamma$ and also the circumference of the bottom of the cone so $R\gamma = 2\pi r$. With all this, we can solve to get $A = \pi r^2/\sin(\theta)$. But we have a frustum of a cone with radii $r_0$ and $r_1$, so the surface area is a difference: $A = \pi (r_1^2 - r_0^2) /\sin(\theta)$. Relating this to our values in terms of $f$ and $g$, we have $r_1=f(t_i)$, $r_0 = f(t_{i-1})$, and $\sin(\theta) = \Delta f / \sqrt{(\Delta g)^2 + (\Delta f)^2}$, where $\Delta f = f(t_i) - f(t_{i-1})$ and similarly for $\Delta g$. diff --git a/quarto/integrals/volumes_slice.qmd b/quarto/integrals/volumes_slice.qmd index c5018cd..1156cb0 100644 --- a/quarto/integrals/volumes_slice.qmd +++ b/quarto/integrals/volumes_slice.qmd @@ -242,17 +242,17 @@ cone = integrate(pi*R^2, (y, 0, h)) It is not unusual to parameterize a cone by the angle $\theta$ it makes and the height. Since $r/h=\tan\theta$, this gives the formula $V = \pi/3\cdot h^3\tan(\theta)^2$. -The frustum of a cone is simply viewed as a cone with its top cut off. If the original height would have been $h_0$ and the actual height $h_1$, then the volume remaining is just $\int_0^{h_1} \pi r(y)^2 dy$. We can see the formula for the frustrum of the right cone: +The frustum of a cone is simply viewed as a cone with its top cut off. If the original height would have been $h_0$ and the actual height $h_1$, then the volume remaining is just $\int_0^{h_1} \pi r(y)^2 dy$. We can see the formula for the frustum of the right cone: ```{julia} @syms h0 -frustrum = integrate(pi*R^2, (y, 0, h0)) +frustum = integrate(pi*R^2, (y, 0, h0)) ``` Simplifying, we can see this volume can be expressed using the ratio $(h_0/h_1)$: ```{julia} -frustrum - cone * ( 3h0/h - 3(h0/h)^2 + (h0/h)^3) |> simplify +frustum - cone * ( 3h0/h - 3(h0/h)^2 + (h0/h)^3) |> simplify ``` diff --git a/quarto/jmd2qmd.jl b/quarto/jmd2qmd.jl index 8c95dd6..2a13282 100644 --- a/quarto/jmd2qmd.jl +++ b/quarto/jmd2qmd.jl @@ -68,7 +68,7 @@ Convert `.jmd` file in `jmd_file` to a `.qmd` file, write output to `io`. * code blocks use comments at the top of the file to add features like `echo=false` * admonitions use "callout" syntax -* LaTeX uses dollar signs for delimeters, not double back tics or a `math` block +* LaTeX uses dollar signs for delimiters, not double back tics or a `math` block """ function jmd2qmd(io::IO, jmd_file::AbstractString) diff --git a/quarto/limits/continuity.qmd b/quarto/limits/continuity.qmd index 92594c1..8935cd7 100644 --- a/quarto/limits/continuity.qmd +++ b/quarto/limits/continuity.qmd @@ -73,7 +73,7 @@ This speaks to continuity at a point, we can extend this to continuity over an i -Finally, as with limits, it can be convenient to speak of *right* continuity and *left* continuity at a point, where the limit in the defintion is replaced by a right or left limit, as appropriate. +Finally, as with limits, it can be convenient to speak of *right* continuity and *left* continuity at a point, where the limit in the definition is replaced by a right or left limit, as appropriate. :::{.callout-warning} diff --git a/quarto/limits/intermediate_value_theorem.qmd b/quarto/limits/intermediate_value_theorem.qmd index d370fed..d48b27c 100644 --- a/quarto/limits/intermediate_value_theorem.qmd +++ b/quarto/limits/intermediate_value_theorem.qmd @@ -86,7 +86,7 @@ Suppose we have a continuous function $f(x)$ on $[a,b]$ with $f(a) < 0$ and $f(b We use this fact when building a "sign chart" of a polynomial function. Between any two consecutive real zeros the polynomial can not change sign. (Why?) So a "test point" can be used to determine the sign of the function over an entire interval. -Here, we use the Bolzano theorem to give an algorithm - the *bisection method* - to locate the value $c$ under the assumption $f$ is continous on $[a,b]$ and changes sign between $a$ and $b$. +Here, we use the Bolzano theorem to give an algorithm - the *bisection method* - to locate the value $c$ under the assumption $f$ is continuous on $[a,b]$ and changes sign between $a$ and $b$. ```{julia} @@ -603,7 +603,7 @@ The output of `find_zeros` is a vector of values. To check that each value is an f₁.(zs) ``` -(For a continuous function this should be the case that the values returned by `find_zeros` are approximate zeros. Bear in mind that if $f$ is not continous the algorithm might find jumping points that are not zeros and may not even be in the domain of the function.) +(For a continuous function this should be the case that the values returned by `find_zeros` are approximate zeros. Bear in mind that if $f$ is not continuous the algorithm might find jumping points that are not zeros and may not even be in the domain of the function.) ### An alternate interface to `find_zero` diff --git a/quarto/limits/limits.qmd b/quarto/limits/limits.qmd index ccd4d34..1f55555 100644 --- a/quarto/limits/limits.qmd +++ b/quarto/limits/limits.qmd @@ -235,7 +235,7 @@ annotate!([(0,0+Δ,"A"), (x-Δ,y+Δ/4, "B"), (1+Δ/2,y/x, "C"), annotate!([(.2*cos(θ/2), 0.2*sin(θ/2), "θ")]) imgfile = tempname() * ".png" savefig(p, imgfile) -caption = "Triangle ABD has less area than the shaded wedge, which has less area than triangle ACD. Their respective areas are ``(1/2)\\sin(\\theta)``, ``(1/2)\\theta``, and ``(1/2)\\tan(\\theta)``. The inequality used to show ``\\sin(x)/x`` is bounded below by ``\\cos(x)`` and above by ``1`` comes from a division by ``(1/2) \\sin(x)`` and taking reciprocals. +caption = "Triangle ``ABD` has less area than the shaded wedge, which has less area than triangle ``ACD``. Their respective areas are ``(1/2)\\sin(\\theta)``, ``(1/2)\\theta``, and ``(1/2)\\tan(\\theta)``. The inequality used to show ``\\sin(x)/x`` is bounded below by ``\\cos(x)`` and above by ``1`` comes from a division by ``(1/2) \\sin(x)`` and taking reciprocals. " ImageFile(imgfile, caption) ``` @@ -1666,7 +1666,7 @@ Should `SymPy` have needed an assumption like ```{julia} -@syms a::postive +@syms a::positive ``` ```{julia} diff --git a/quarto/limits/limits_extensions.qmd b/quarto/limits/limits_extensions.qmd index 60a8401..5c8d472 100644 --- a/quarto/limits/limits_extensions.qmd +++ b/quarto/limits/limits_extensions.qmd @@ -103,7 +103,7 @@ Let's loosen up the language in the definition of a limit to read: The $\epsilon-\delta$ definition has $V = (L-\epsilon, L + \epsilon)$ and $U=(c-\delta, c+\delta)$. This is a rewriting of $L-\epsilon < f(x) < L + \epsilon$ as $|f(x) - L| < \epsilon$. -Now for the defintion: +Now for the definition: > A function $f(x)$ has a limit on the right of $c$, written $\lim_{x \rightarrow c+}f(x) = L$ if for every $\epsilon > 0$, there exists a $\delta > 0$ such that whenever $0 < x - c < \delta$ it holds that $|f(x) - L| < \epsilon$. That is, $U$ is $(c, c+\delta)$ @@ -573,7 +573,7 @@ fx, gx = exp(x^2), exp(x)^2 limit(gx^n / fx, x => oo) ``` -A negative test for compatability is the following: if +A negative test for compatibility is the following: if $$ diff --git a/quarto/misc/getting_started_with_julia.qmd b/quarto/misc/getting_started_with_julia.qmd index 922733d..04a978c 100644 --- a/quarto/misc/getting_started_with_julia.qmd +++ b/quarto/misc/getting_started_with_julia.qmd @@ -19,10 +19,10 @@ As it is open source, indeed with a liberal MIT license, it can be installed for ## Running Julia through the web -There are a few services for running `Julia` through the web. Mentioned here is [Binder](https://mybinder.org), which provides a web-based interface to `Julia` built around `Jupyter`. `Jupyter` is a wildly succesful platform for interacting with different open-source software programs. +There are a few services for running `Julia` through the web. Mentioned here is [Binder](https://mybinder.org), which provides a web-based interface to `Julia` built around `Jupyter`. `Jupyter` is a wildly successful platform for interacting with different open-source software programs. -[lauch binder](https://mybinder.org/v2/gh/CalculusWithJulia/CwJScratchPad.git/master) +[launch binder](https://mybinder.org/v2/gh/CalculusWithJulia/CwJScratchPad.git/master) Clicking the launch link above will open a web page which provides a blank notebook, save for a package used by these notes. However, `Binder` is nowhere near as reliable as a local installation. diff --git a/quarto/misc/julia_interfaces.qmd b/quarto/misc/julia_interfaces.qmd index d1bee43..04eb72c 100644 --- a/quarto/misc/julia_interfaces.qmd +++ b/quarto/misc/julia_interfaces.qmd @@ -83,7 +83,7 @@ Pluto has a built-in package management system that manages the installation of The Jupyter Project provides two web-based interfaces to `Julia`: the Jupyter notebook and the newer JupyterLab. The [binder](https://mybinder.org/) project use Juptyer notebooks for their primary interface to `Julia`. To use a binder notebook, follow this link: -[lauch binder](https://mybinder.org/v2/gh/CalculusWithJulia/CwJScratchPad.git/master) +[launch binder](https://mybinder.org/v2/gh/CalculusWithJulia/CwJScratchPad.git/master) To run locally, these interfaces are available once `IJulia` is installed. Since version 1.7, the following commands should do this: @@ -120,7 +120,7 @@ When a cell is evaluating, the leading `[]` has an asterick (`[*]`) showing the Once a cell is evaluated, the leading `[]` has a number inserted (e.g., `[1]`, as in the figure). This number indicates the order of cell evaluation. Once a notebook is interacted with, the state of the namespace need not reflect the top-to-bottom order of the notebook, but rather reflects the order of cell evaluations. -To be specific, a variable like `x` may be redefined in a cell above where the variable is intially defined and this redefinition will hold the current value known to the interpreter. As well, a notebook, when reloaded, may have unevaluated cells with output showing. These will not influence the state of the kernel until they are evaluated. +To be specific, a variable like `x` may be redefined in a cell above where the variable is initially defined and this redefinition will hold the current value known to the interpreter. As well, a notebook, when reloaded, may have unevaluated cells with output showing. These will not influence the state of the kernel until they are evaluated. When a cell's commands are evaluated, the last command executed is displayed. If it is desirable that multiple values be displayed, they can be packed into a tuple. This is done by using commas to separate values. `IJulia` will also display other means to print output (e.g., `@show`, `display`, `print`, ...). @@ -132,7 +132,7 @@ To run all cells in a notebook from top to bottom, the "run all" command under t If a calculation takes much longer than anticipated, the "kernel" can be interrupted through a menu item of "Kernel". -If the kernal appears unresponsive, it can be restarted through a menu item of "Kernel". +If the kernel appears unresponsive, it can be restarted through a menu item of "Kernel". Notebooks can be saved (as `*.ipynb` files) for sharing or for reuse. Notebooks can be printed at HTML pages, and if the proper underlying software is available, as formatted pages. diff --git a/quarto/misc/quick_notes.qmd b/quarto/misc/quick_notes.qmd index 06fc853..3d4e68e 100644 --- a/quarto/misc/quick_notes.qmd +++ b/quarto/misc/quick_notes.qmd @@ -52,7 +52,7 @@ Packages can also be loaded through `import PackageName`. Importing does not add ## Types -Objects in `Julia` are "typed." Common numeric types are `Float64`, `Int64` for floating point numbers and integers. Less used here are types like `Rational{Int64}`, specifying rational numbers with a numerator and denominator as `Int64`; or `Complex{Float64}`, specifying a comlex number with floating point components. Julia also has `BigFloat` and `BigInt` for arbitrary precision types. Typically, operations use "promotion" to ensure the combination of types is appropriate. Other useful types are `Function`, an abstract type describing functions; `Bool` for true and false values; `Sym` for symbolic values (through `SymPy`); and `Vector{Float64}` for vectors with floating point components. +Objects in `Julia` are "typed." Common numeric types are `Float64`, `Int64` for floating point numbers and integers. Less used here are types like `Rational{Int64}`, specifying rational numbers with a numerator and denominator as `Int64`; or `Complex{Float64}`, specifying a complex number with floating point components. Julia also has `BigFloat` and `BigInt` for arbitrary precision types. Typically, operations use "promotion" to ensure the combination of types is appropriate. Other useful types are `Function`, an abstract type describing functions; `Bool` for true and false values; `Sym` for symbolic values (through `SymPy`); and `Vector{Float64}` for vectors with floating point components. For the most part the type will not be so important, but it is useful to know that for some function calls the type of the argument will decide what method ultimately gets called. (This allows symbolic types to interact with Julia functions in an idiomatic manner.) @@ -175,7 +175,7 @@ Here the number of arguments is used: ```{julia} Area(w, h) = w * h # area of rectangle -Area(w) = Area(w, w) # area of square using area of rectangle defintion +Area(w) = Area(w, w) # area of square using area of rectangle definition ``` Calling `Area(5)` will call `Area(5,5)` which will return `5*5`. @@ -294,7 +294,7 @@ We use a few different containers: x1 = (1, "two", 3.0) ``` -Tuples are useful for programming. For example, they are uesd to return multiple values from a function. +Tuples are useful for programming. For example, they are used to return multiple values from a function. * Vectors. These are objects of the same type (typically) grouped together using square brackets, values separated by commas: @@ -304,7 +304,7 @@ Tuples are useful for programming. For example, they are uesd to return multiple x2 = [1, 2, 3.0] # 3.0 makes theses all floating point ``` -Unlike tuples, the expected arithmatic from Linear Algebra is implemented for vectors. +Unlike tuples, the expected arithmetic from Linear Algebra is implemented for vectors. * Matrices. Like vectors, combine values of the same type, only they are 2-dimensional. Use spaces to separate values along a row; semicolons to separate rows: @@ -628,7 +628,7 @@ ys = [vs[i][2] for i in eachindex(vs)] plot(xs, ys) ``` -This approach is faciliated by the `unzip` function in `CalculusWithJulia` (and used internally by `plot_parametric`): +This approach is facilitated by the `unzip` function in `CalculusWithJulia` (and used internally by `plot_parametric`): ```{julia} @@ -698,7 +698,7 @@ f(x, y) = 2 - x^2 + y^2 contour(xs, ys, f.(xs, ys')) ``` - * An implicit equation. The constraint $f(x,y)=c$ generates an implicit equation. While `contour` can be used for this type of plot - by adjusting the requested contours - the `ImplicitPlots` package does this to make a plot of the equations $f(x,y) = 0$. (The `CalculusWithJulia` package re-uses the `implict_plot` function.) + * An implicit equation. The constraint $f(x,y)=c$ generates an implicit equation. While `contour` can be used for this type of plot - by adjusting the requested contours - the `ImplicitPlots` package does this to make a plot of the equations $f(x,y) = 0$. (The `CalculusWithJulia` package re-uses the `implicit_plot` function.) ```{julia} @@ -785,7 +785,7 @@ Numerically, the `ForwardDiff.derivative(f, x)` function call will find the deri ForwardDiff.derivative(sin, pi/3) - cos(pi/3) ``` -The `CalculusWithJulia` package overides the `'` (`adjoint`) syntax for functions to provide a derivative which takes a function and returns a function, so its usage is familiar +The `CalculusWithJulia` package overrides the `'` (`adjoint`) syntax for functions to provide a derivative which takes a function and returns a function, so its usage is familiar ```{julia} diff --git a/quarto/misc/toc.qmd b/quarto/misc/toc.qmd index 6ab4d2d..8d8079d 100644 --- a/quarto/misc/toc.qmd +++ b/quarto/misc/toc.qmd @@ -15,7 +15,7 @@ CalculusWithJulia.WeaveSupport.HTMLoutput(txt) # Calculus with Julia -`CalculusWithJulia.jl` is a package for a set of notes for learning [calculus](http://en.wikipedia.org/wiki/Calculus) using the `Julia` languge. The package contains some support functions and the files that generate the notes being read now. +`CalculusWithJulia.jl` is a package for a set of notes for learning [calculus](http://en.wikipedia.org/wiki/Calculus) using the `Julia` language. The package contains some support functions and the files that generate the notes being read now. Since the mid 90s there has been a push to teach calculus using many different points of view. The [Harvard](http://www.math.harvard.edu/~knill/pedagogy/harvardcalculus/) style rule of four says that as much as possible the conversation should include a graphical, numerical, algebraic, and verbal component. These notes use the programming language [Julia](http://julialang.org) to illustrate the graphical, numerical, and, at times, the algebraic aspects of calculus. @@ -54,7 +54,7 @@ Julia can be used through the internet for free using the [mybinder.org](https:/ Many of the necessary computational skills needed for employing `Julia` successfully to assist in learning calculus are in direct analogy to concepts of mathematics that are first introduced in precalculus or prior. This precalculus *review*, covers some of the basic materials mathematically (though not systematically). More importantly it illustrates the key computational mechanics we will use throughout. -A quick rundown of the `Julia` concepts presented in this setion is in a [Julia overview](precalc/julia_overview.html). +A quick rundown of the `Julia` concepts presented in this section is in a [Julia overview](precalc/julia_overview.html). ### Number systems @@ -301,7 +301,7 @@ We begin with the generalization of the Riemann integral to compute area to the * [Double and triple integrals](integral_vector_calculus/double_triple_integrals.html) -Line and surface integrals are computed by 1- and 2-dimensional integrals, but offer new interpretations, espcially when vector fields are considered. +Line and surface integrals are computed by 1- and 2-dimensional integrals, but offer new interpretations, especially when vector fields are considered. * [Line and surface integrals](integral_vector_calculus/line_integrals.html) @@ -369,5 +369,3 @@ This is a work in progress. To report an issue, make a comment, or suggest somet To make edits to the documents directly, a pull request with the modified `*.jmd` files in the `CwJ` directory should be made. Minor edits to the `*.jmd` files should be possible through the GitHub web interface. In the footer of each page a pencil icon accompanying "suggest an edit" when clicked should cause the opening of the corresponding `*.jmd` file on GitHub for suggesting modifications. The html files will be generated independently, that need not be done. - - diff --git a/quarto/precalc/calculator.qmd b/quarto/precalc/calculator.qmd index 0219ce0..a0c68ce 100644 --- a/quarto/precalc/calculator.qmd +++ b/quarto/precalc/calculator.qmd @@ -400,7 +400,7 @@ Mathematically these are irrational values with decimal expansions that do not r :::{.callout-warning} ## Warning -In most cases. There are occasional (basically rare) spots where using `pi` by itself causes an eror where `1*pi` will not. The reason is `1*pi` will create a floating point value from the irrational object, `pi`. +In most cases. There are occasional (basically rare) spots where using `pi` by itself causes an error where `1*pi` will not. The reason is `1*pi` will create a floating point value from the irrational object, `pi`. ::: @@ -763,7 +763,7 @@ numericq(val) ###### Question -Wich of the following is a valid `Julia` expression for +Which of the following is a valid `Julia` expression for $$ @@ -787,7 +787,7 @@ radioq(choices, answ) ###### Question -Wich of the following is a valid `Julia` expression for +Which of the following is a valid `Julia` expression for $$ @@ -1132,7 +1132,7 @@ Attempting to compute this, we have: ```{julia} c = 299_792_458; # the speed of light G = 6.67430e-11; # Gravitational constant -h = 6.62607015e-34; # Planck's contant +h = 6.62607015e-34; # Planck's constant h_bar = h / (2*pi); planck_length = sqrt(h_bar * G / c^3) ``` diff --git a/quarto/precalc/exp_log_functions.qmd b/quarto/precalc/exp_log_functions.qmd index af7e5d3..1c58370 100644 --- a/quarto/precalc/exp_log_functions.qmd +++ b/quarto/precalc/exp_log_functions.qmd @@ -146,7 +146,7 @@ The value of `2^n` and `2.0^n` is different in `Julia`. The former remains an in ##### Example -The famous [Fibonacci](https://en.wikipedia.org/wiki/Fibonacci_number) numbers are $1,1,2,3,5,8,13,\dots$, where $F_{n+1}=F_n+F_{n-1}$. These numbers increase. To see how fast, if we *guess* that the growth is eventually exponential and assume $F_n \approx c \cdot a^n$, then our equation is approximately $ca^{n+1} = ca^n + ca^{n-1}$. Factoring out common terms gives $ca^{n-1} \cdot (a^2 - a - 1) = 0$. The term $a^{n-1}$ is always positive, so any solution would satisfy $a^2 - a -1 = 0$. The positve solution is $(1 + \sqrt{5})/2 \approx 1.618$ +The famous [Fibonacci](https://en.wikipedia.org/wiki/Fibonacci_number) numbers are $1,1,2,3,5,8,13,\dots$, where $F_{n+1}=F_n+F_{n-1}$. These numbers increase. To see how fast, if we *guess* that the growth is eventually exponential and assume $F_n \approx c \cdot a^n$, then our equation is approximately $ca^{n+1} = ca^n + ca^{n-1}$. Factoring out common terms gives $ca^{n-1} \cdot (a^2 - a - 1) = 0$. The term $a^{n-1}$ is always positive, so any solution would satisfy $a^2 - a -1 = 0$. The positive solution is $(1 + \sqrt{5})/2 \approx 1.618$ That is evidence that the $F_n \approx c\cdot 1.618^n$. (See [Relation to golden ratio](https://en.wikipedia.org/wiki/Fibonacci_number#Relation_to_the_golden_ratio) for a related, but more explicit exact formula. diff --git a/quarto/precalc/functions.qmd b/quarto/precalc/functions.qmd index 1def502..ed7e9bf 100644 --- a/quarto/precalc/functions.qmd +++ b/quarto/precalc/functions.qmd @@ -82,7 +82,7 @@ For typical cases like the three above, there isn't really much new to learn. ## Note The equals sign in `Julia` always indicates either an assignment or a mutation of the object on the left side. The definition of a function above is an *assignment*, in that a function is added (or modified) in a table holding the methods associated with the function's name. -The equals sign restricts the expressions available on the *left*-hand side to a) a variable name, for assignment; b) mutating an object at an index, as in `xs[1]`; c) mutating a property of a stuct; or d) a function assignment following this form `function_name(args...)`. +The equals sign restricts the expressions available on the *left*-hand side to a) a variable name, for assignment; b) mutating an object at an index, as in `xs[1]`; c) mutating a property of a struct; or d) a function assignment following this form `function_name(args...)`. Whereas function definitions and usage in `Julia` mirrors standard math notation; equations in math are not so mirrored in `Julia`. In mathematical equations, the left-hand of an equation is typically a complicated algebraic expression. Not so with `Julia`, where the left hand side of the equals sign is prescribed and quite limited. @@ -276,7 +276,7 @@ The line `return x^2`, could have just been `x^2` as it is the last (and) only l :::{.callout-note} ## Note -The `return` keyword is not a function, so is not called with parentheses. An emtpy `return` statement will return a value of `nothing`. +The `return` keyword is not a function, so is not called with parentheses. An empty `return` statement will return a value of `nothing`. ::: @@ -1271,7 +1271,7 @@ A mathematical interval is a set of values of the form * an open interval: $a < x < b$, or $(a,b)$; * a closed interval: $a \leq x \leq b$, or $[a,b]$; - * or a half-open interval: $a < x \leq b$ or $a \leq x < b$, repectively $(a,b]$ or $[a,b)$. + * or a half-open interval: $a < x \leq b$ or $a \leq x < b$, respectively $(a,b]$ or $[a,b)$. They all contain all real numbers between the endpoints, the distinction is whether the endpoints are included or not. @@ -1332,7 +1332,7 @@ Guess why or why not? #| hold: true #| echo: false choices = ["Well it does, because ``[0,1]`` is the range", - """It does not. The bound found is a provably known bound. The small deviation is due to the possible errors in evalution of the `sin` function near the floating point approximation of `pi`, + """It does not. The bound found is a provably known bound. The small deviation is due to the possible errors in evaluation of the `sin` function near the floating point approximation of `pi`, """] radioq(choices, 2) ``` diff --git a/quarto/precalc/julia_overview.qmd b/quarto/precalc/julia_overview.qmd index 0e76e28..aa740b9 100644 --- a/quarto/precalc/julia_overview.qmd +++ b/quarto/precalc/julia_overview.qmd @@ -61,13 +61,13 @@ julia> 2 + 2 * The [Pluto](https://github.com/fonsp/Pluto.jl) package provides a *reactive* notebook interface. Reactive means when one "cell" is modified and executed, the new values cascade to all other dependent cells which in turn are updated. This is very useful for exploring a parameter space, say. Pluto notebooks can be exported as HTML files which make them easy to read online and – by clever design – embed the `.jl` file that can run through `Pluto` if it is downloaded. -The `Pluto` interface has some idiosyncracies that need explanation: +The `Pluto` interface has some idiosyncrasies that need explanation: * Cells can only have one command within them. Multiple-command cells must be contained in a `begin` block or a `let` block. * By default, the cells are *reactive*. This means when a variable in one cell is changed, then any references to that variable are also updated – like a spreadsheet. This is fantastic for updating several computations at once. However it means variable names can not be repeated within a page. Pedagogically, it is convenient to use variable names and function names (e.g., `x` and `f`) repeatedly, but this is only possible *if* they are within a `let` block or a function body. * To not repeat names, but to be able to reference a value from cell-to-cell, some Unicode variants are used within a page. Visually these look familiar, but typing the names requires some understanding of Unicode input. The primary usages is *bold italic* (e.g., `\bix[tab]` or `\bif[tab]`) or *bold face* (e.g. `\bfx[tab]` or `\bff[tab]`). - * The notebooks snapshot the packages they depend on, which is great for reproducability, but may mean older versions are silently used. + * The notebooks snapshot the packages they depend on, which is great for reproducibility, but may mean older versions are silently used. ## Augmenting base `Julia` @@ -121,7 +121,7 @@ In a terminal setting, there is a package mode, entered by typing `]` as the lea Packages can be updated through the command `Pkg.update()`, and removed with `Pkg.rm(pkgname)`. -By default packages are installed in a common area. It may be desirable to keep packages for projects isolated. For this the `Pkg.activate` command can be used. This feature allows a means to have reproducible environments even if `Julia` or the packages used are upgraded, possibly introducing incompatabilities. +By default packages are installed in a common area. It may be desirable to keep packages for projects isolated. For this the `Pkg.activate` command can be used. This feature allows a means to have reproducible environments even if `Julia` or the packages used are upgraded, possibly introducing incompatibilities. For these notes, the following packages, among others, are used: @@ -150,7 +150,7 @@ In a `Jupyter` notebook or `Pluto` notebook, commands are typed into a notebook Commands are executed by using `shift-enter` or a run button near the cell. -In `Jupyter` multiple commands per cell are allowed. In `Pluto`, a `begin` or `let` block is used to collect multiple commmands into a single cell. Commands may be separated by new lines or semicolons. +In `Jupyter` multiple commands per cell are allowed. In `Pluto`, a `begin` or `let` block is used to collect multiple commands into a single cell. Commands may be separated by new lines or semicolons. On a given line, anything **after** a `#` is a *comment* and is not processed. diff --git a/quarto/precalc/plotting.qmd b/quarto/precalc/plotting.qmd index ae7f9b8..1cb4296 100644 --- a/quarto/precalc/plotting.qmd +++ b/quarto/precalc/plotting.qmd @@ -352,7 +352,7 @@ plot(0:pi/4:2pi, sin) #### NaN values -At times it is not desirable to draw lines between each succesive point. For example, if there is a discontinuity in the function or if there were a vertical asymptote, such as what happens at $0$ with $f(x) = 1/x$. +At times it is not desirable to draw lines between each successive point. For example, if there is a discontinuity in the function or if there were a vertical asymptote, such as what happens at $0$ with $f(x) = 1/x$. The most straightforward plot is dominated by the vertical asymptote at $x=0$: @@ -667,7 +667,7 @@ Playing with the toy makes a few things become clear: These all apply to parametric plots, as the Etch A Sketch trace is no more than a plot of $(f(t), g(t))$ over some range of values for $t$, where $f$ describes the movement in time of the left knob and $g$ the movement in time of the right. -Now, we revist the last problem in the context of this. We saw in the last problem that the parametric graph was nearly a line - so close the eye can't really tell otherwise. That means that the growth in both $f(t) = t^3$ and $g(t)=t - \sin(t)$ for $t$ around $0$ are in a nearly fixed ratio, as otherwise the graph would have more curve in it. +Now, we revisit the last problem in the context of this. We saw in the last problem that the parametric graph was nearly a line - so close the eye can't really tell otherwise. That means that the growth in both $f(t) = t^3$ and $g(t)=t - \sin(t)$ for $t$ around $0$ are in a nearly fixed ratio, as otherwise the graph would have more curve in it. ##### Example: Spirograph diff --git a/quarto/precalc/polynomial.qmd b/quarto/precalc/polynomial.qmd index a13aa17..878db58 100644 --- a/quarto/precalc/polynomial.qmd +++ b/quarto/precalc/polynomial.qmd @@ -137,7 +137,7 @@ When `SymPy` is installed through the package manager, the underlying `Python` l :::{.callout-note} ## Note -The [`Symbolics`](../alternatives/symbolics) package is a rapidly developing `Julia`-only packge that provides symbolic math options. +The [`Symbolics`](../alternatives/symbolics) package is a rapidly developing `Julia`-only package that provides symbolic math options. ::: diff --git a/quarto/precalc/polynomial_roots.qmd b/quarto/precalc/polynomial_roots.qmd index a3e3625..c99181d 100644 --- a/quarto/precalc/polynomial_roots.qmd +++ b/quarto/precalc/polynomial_roots.qmd @@ -366,7 +366,7 @@ solve(x^5 - x + 1) Related to `solve` is the specialized `roots` function for identifying roots, Unlike solve, it will identify multiplicities. -For a polynomial with only one indeterminate the usage is straight foward: +For a polynomial with only one indeterminate the usage is straight forward: ```{julia} @@ -533,7 +533,7 @@ An immediate consequence, is that a polynomial whose coefficients are all non-ne Applying this to the polynomial $x^5 -x + 1$ we get That the coefficients have signs: `+ 0 0 0 - +` which collapses to the sign pattern `+`, `-`, `+`. This pattern has two changes of sign. The number of *positive* real roots is either $2$ or $0$. In fact there are $0$ for this case. -What about negative roots? Cleary, any negative root of $p$ is a positive root of $q(x) = p(-x)$, as the graph of $q$ is just that of $p$ flipped through the $y$ axis. But the coefficients of $q$ are the same as $p$, except for the odd-indexed coefficients ($a_1, a_3, \dots$) have a changed sign. Continuing with our example, for $q(x) = -x^5 + x + 1$ we get the new sign pattern `-`, `+`, `+` which yields one sign change. That is, there *must* be a negative real root, and indeed there is, $x \approx -1.1673$. +What about negative roots? Clearly, any negative root of $p$ is a positive root of $q(x) = p(-x)$, as the graph of $q$ is just that of $p$ flipped through the $y$ axis. But the coefficients of $q$ are the same as $p$, except for the odd-indexed coefficients ($a_1, a_3, \dots$) have a changed sign. Continuing with our example, for $q(x) = -x^5 + x + 1$ we get the new sign pattern `-`, `+`, `+` which yields one sign change. That is, there *must* be a negative real root, and indeed there is, $x \approx -1.1673$. With this knowledge, we could have known that in an earlier example the graph of `p = x^7 - 16129x^2 + 254x - 1` – which indicated two positive real roots – was misleading, as there must be $1$ or $3$ by a count of the sign changes. @@ -1001,7 +1001,7 @@ Now consider the case $p_0 > 0$. There are two possibilities either `pos(p)` is So there is parity between `var(p)` and `pos(p)`: if $p$ is monic and $p_0 < 0$ then both `var(p)` and `pos(p)` are both odd; and if $p_0 > 0$ both `var(p)` and `pos(p)` are both even. -Descartes' rule of signs will be established if it can be shown that `var(p)` is at least as big as `pos(p)`. Supppose $r$ is a positive real root of $p$ with $p = (x-r)q$. We show that `var(p) > var(q)` which can be repeatedly applied to show that if $p=(x-r_1)\cdot(x-r_2)\cdot \cdots \cdot (x-r_l) q$, where the $r_i$s are the postive real roots, then `var(p) >= l + var(q) >= l = pos(p)`. +Descartes' rule of signs will be established if it can be shown that `var(p)` is at least as big as `pos(p)`. Supppose $r$ is a positive real root of $p$ with $p = (x-r)q$. We show that `var(p) > var(q)` which can be repeatedly applied to show that if $p=(x-r_1)\cdot(x-r_2)\cdot \cdots \cdot (x-r_l) q$, where the $r_i$s are the positive real roots, then `var(p) >= l + var(q) >= l = pos(p)`. As $p = (x-c)q$ we must have the leading term is $p_nx^n = x \cdot q_{n-1} x^{n-1}$ so $q_{n-1}$ will also be `+` under our monic assumption. Looking at a possible pattern for the signs of $q$, we might see the following unfinished synthetic division table for a specific $q$: @@ -1014,7 +1014,7 @@ As $p = (x-c)q$ we must have the leading term is $p_nx^n = x \cdot q_{n-1} x^{n- + - - - + - + + 0 ``` -But actually, we can fill in more, as the second row is formed by multiplying a postive $c$: +But actually, we can fill in more, as the second row is formed by multiplying a positive $c$: ```{verbatim} diff --git a/quarto/precalc/polynomials_package.qmd b/quarto/precalc/polynomials_package.qmd index 8353277..3cde933 100644 --- a/quarto/precalc/polynomials_package.qmd +++ b/quarto/precalc/polynomials_package.qmd @@ -108,7 +108,7 @@ A polynomial in factored form, as `r` above is, can be constructed from its root fromroots([2,2,1,-1]) ``` -The `fromroots` function is basically the [factor thereom](https://en.wikipedia.org/wiki/Factor_theorem) which links the factored form of the polynomial with the roots of the polynomial: $(x-k)$ is a factor of $p$ if and only if $k$ is a root of $p$. By combining a factor of the type $(x-k)$ for each specified root, the polynomial can be constructed by multiplying its factors. For example, using `prod` and a generarator, we would have: +The `fromroots` function is basically the [factor theorem](https://en.wikipedia.org/wiki/Factor_theorem) which links the factored form of the polynomial with the roots of the polynomial: $(x-k)$ is a factor of $p$ if and only if $k$ is a root of $p$. By combining a factor of the type $(x-k)$ for each specified root, the polynomial can be constructed by multiplying its factors. For example, using `prod` and a generarator, we would have: ```{julia} diff --git a/quarto/precalc/trig_functions.qmd b/quarto/precalc/trig_functions.qmd index 89f113f..752d8f6 100644 --- a/quarto/precalc/trig_functions.qmd +++ b/quarto/precalc/trig_functions.qmd @@ -600,7 +600,7 @@ We can simplify a few: For example, when $n=0$ we see immediately that $T_0(x) = A few things become clear from the above two representations: - * Starting from $T_0(x) = 1$ and $T_1(x)=x$ and using the recursive defintion of $T_{n+1}$ we get a family of polynomials where $T_n(x)$ is a degree $n$ polynomial. These are defined for all $x$, not just $-1 \leq x \leq 1$. + * Starting from $T_0(x) = 1$ and $T_1(x)=x$ and using the recursive definition of $T_{n+1}$ we get a family of polynomials where $T_n(x)$ is a degree $n$ polynomial. These are defined for all $x$, not just $-1 \leq x \leq 1$. * Using the initial definition, we see that the zeros of $T_n(x)$ all occur within $[-1,1]$ and happen when $n\arccos(x) = k\pi + \pi/2$, or $x=\cos((2k+1)/n \cdot \pi/2)$ for $k=0, 1, \dots, n-1$. @@ -717,7 +717,7 @@ radioq(choices, answ, keep_order=true) ###### Question -The cosine function is a simple tranformation of the sine function. Which one? +The cosine function is a simple transformation of the sine function. Which one? ```{julia} @@ -787,7 +787,7 @@ numericq(val) ###### Question -For any postive integer $n$ the equation $\cos(x) - nx = 0$ has a solution in $[0, \pi/2]$. Graphically estimate the value when $n=10$. +For any positive integer $n$ the equation $\cos(x) - nx = 0$ has a solution in $[0, \pi/2]$. Graphically estimate the value when $n=10$. ```{julia} diff --git a/quarto/precalc/variables.qmd b/quarto/precalc/variables.qmd index d3cd914..a939c5e 100644 --- a/quarto/precalc/variables.qmd +++ b/quarto/precalc/variables.qmd @@ -59,7 +59,7 @@ x = 2 :::{.callout-note} ## Note -The `Pluto` interface for `Julia` is idiosyncratic, as variables are *reactive*. This interface allows changes to a variable `x` to propogate to all other cells referring to `x`. Consequently, the variable name can only be assigned *once* per notebook **unless** the name is in some other namespace, which can be arranged by including the assignment inside a function or a `let` block. +The `Pluto` interface for `Julia` is idiosyncratic, as variables are *reactive*. This interface allows changes to a variable `x` to propagate to all other cells referring to `x`. Consequently, the variable name can only be assigned *once* per notebook **unless** the name is in some other namespace, which can be arranged by including the assignment inside a function or a `let` block. ::: diff --git a/quarto/precalc/vectors.qmd b/quarto/precalc/vectors.qmd index bdf2ec1..e7f5396 100644 --- a/quarto/precalc/vectors.qmd +++ b/quarto/precalc/vectors.qmd @@ -702,7 +702,7 @@ The style generally employed here is to use plural variable names for a collecti ## Other container types -Vectors in `Julia` are a container, one of many different types. Another useful type for programming purposes are *tuples*. If a vector is formed by placing comma-separated values within a `[]` pair (e.g., `[1,2,3]`), a tuple is formed by placing comma-separated values withing a `()` pair. A tuple of length $1$ uses a convention of a trailing comma to distinguish it from a parenthesized expression (e.g. `(1,)` is a tuple, `(1)` is just the value `1`). +Vectors in `Julia` are a container, one of many different types. Another useful type for programming purposes are *tuples*. If a vector is formed by placing comma-separated values within a `[]` pair (e.g., `[1,2,3]`), a tuple is formed by placing comma-separated values within a `()` pair. A tuple of length $1$ uses a convention of a trailing comma to distinguish it from a parenthesized expression (e.g. `(1,)` is a tuple, `(1)` is just the value `1`). :::{.callout-note} ## Well, actually...