Merge pull request #8 from jverzani/asyncmap_all_1

Asyncmap all 1
This commit is contained in:
john verzani 2022-06-07 16:48:56 -04:00 committed by GitHub
commit a2b62ded04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
93 changed files with 5560 additions and 210 deletions

1
.gitignore vendored
View File

@ -2,7 +2,6 @@
docs/Mainfest.toml
docs/build
docs/site
/html
test/benchmarks.json
Manifest.toml
TODO.md

View File

@ -0,0 +1,10 @@
# seems like with
* quadrature (renamed)
* nonlinsolve
* GalacticOptim (renamed)
* symbolic-numeric integration
* symbolics.jl
...
This should be mentioned

View File

@ -1,5 +1,39 @@
# Symbolics.jl
Incorporate:
Basics
https://github.com/SciML/ModelingToolkit.jl
https://github.com/JuliaSymbolics/Symbolics.jl
https://github.com/JuliaSymbolics/SymbolicUtils.jl
* Rewriting
https://github.com/JuliaSymbolics/SymbolicUtils.jl
* Plotting
Polynomials
Limits
XXX ... room here!
Derivatives
https://github.com/JuliaSymbolics/Symbolics.jl
Integration
https://github.com/SciML/SymbolicNumericIntegration.jl
The `Symbolics.jl` package is a Computer Algebra System (CAS) built entirely in `Julia`.
This package is under heavy development.

View File

@ -128,21 +128,16 @@ segments, and we could have derived the graph of `x` from that of
`speed`, just using the simple formula relating distance, rate, and
time.
```julia;echo=false
note("""
We were pretty loose with some key terms. There is a distinction
between "speed" and "velocity", this being the speed is the absolute
value of velocity. Velocity incorporates a direction as well as a
magnitude. Similarly, distance traveled and change in position are not
the same thing when there is back tracking involved. The total
distance traveled is computed with the speed, the change in position
is computed with the velocity. When there is no change of sign, it is
a bit more natural, perhaps, to use the language of speed and
distance.
""")
```
!!! note
We were pretty loose with some key terms. There is a
distinction between "speed" and "velocity", this being the speed
is the absolute value of velocity. Velocity incorporates a
direction as well as a magnitude. Similarly, distance traveled and
change in position are not the same thing when there is back
tracking involved. The total distance traveled is computed with
the speed, the change in position is computed with the
velocity. When there is no change of sign, it is a bit more
natural, perhaps, to use the language of speed and distance.
##### Example: Galileo's ball and ramp experiment
@ -326,15 +321,13 @@ ImageFile(imgfile, caption)
The tangent line is not just a line that intersects the graph in one
point, nor does it need only intersect the line in just one point.
```julia; echo=false
note("""
This last point was certainly not obvious at
first. [Barrow](http://www.maa.org/sites/default/files/0746834234133.di020795.02p0640b.pdf),
who had Newton as a pupil, and was the first to sketch a proof of part
of the Fundamental Theorem of Calculus, understood a tangent line to
be a line that intersects a curve at only one point.
""")
```
!!! note
This last point was certainly not obvious at
first. [Barrow](http://www.maa.org/sites/default/files/0746834234133.di020795.02p0640b.pdf),
who had Newton as a pupil, and was the first to sketch a proof of
part of the Fundamental Theorem of Calculus, understood a tangent
line to be a line that intersects a curve at only one point.
##### Example
@ -791,7 +784,7 @@ Find the derivative of ``f(x) = \sqrt{1 - x^2}``. We identify the composition of
```math
\begin{align*}
f(x) &=\sqrt{x} & g(x) &= 1 - x^2 \\
f(x) &=\sqrt{x} = x^{1/2} & g(x) &= 1 - x^2 \\
f'(\square) &=(1/2)(\square)^{-1/2} & g'(x) &= -2x
\end{align*}
```
@ -864,8 +857,34 @@ f(g(a+h)) - f(g(a)) - f'(g(a)) g'(a) h = f'(g(a))\epsilon_g(h))h + \epsilon_f(h'
where $\epsilon(h)$ combines the above terms which go to zero as $h\rightarrow 0$ into one. This is
the alternative definition of the derivative, showing $(f\circ g)'(a) = f'(g(a)) g'(a)$ when $g$ is differentiable at $a$ and $f$ is differentiable at $g(a)$.
##### The "chain" rule
##### More examples
The chain rule name could also be simply the "composition rule," as that is the operation the rule works for. However, in practice, there are usually *multiple* compositions, and the "chain" rule is used to chain together the different pieces. To get a sense, consider a triple composition ``u(v(w(x())))``. This will have derivative:
```math
\begin{align*}
[u(v(w(x)))]' &= u'(v(w(x))) \cdot [v(w(x))]' \\
&= u'(v(w(x))) \cdot v'(w(x)) \cdot w'(x)
\end{align*}
```
The answer can be viewed as a repeated peeling off of the outer
function, a view with immediate application to many compositions. To
see that in action with an expression, consider this derivative
problem, shown in steps:
```math
\begin{align*}
[\sin(e^{\cos(x^2-x)})]'
&= \cos(e^{\cos(x^2-x)}) \cdot [e^{\cos(x^2-x)}]'\\
&= \cos(e^{\cos(x^2-x)}) \cdot e^{\cos(x^2-x)} \cdot [\cos(x^2-x)]'\\
&= \cos(e^{\cos(x^2-x)}) \cdot e^{\cos(x^2-x)} \cdot (-\sin(x^2-x)) \cdot [x^2-x]'\\
&= \cos(e^{\cos(x^2-x)}) \cdot e^{\cos(x^2-x)} \cdot (-\sin(x^2-x)) \cdot (2x-1)\\
\end{align*}
```
##### More examples of differentiation
Find the derivative of $x^5 \cdot \sin(x)$.
@ -928,14 +947,10 @@ and finally,
diff(sin(x)^5)
```
```julia; echo=false
note("""
The `diff` function can be called as `diff(ex)` when there is just one
free variable, as in the above examples; as `diff(ex, var)` when there are parameters in the
expression.
"""
)
```
!!! note
The `diff` function can be called as `diff(ex)` when there is
just one free variable, as in the above examples; as `diff(ex,
var)` when there are parameters in the expression.
----

View File

@ -46,12 +46,12 @@ equations, we may have ``0``, ``1`` or more ``y`` values for a given ``x`` and
even more problematic is we may have no rule to find these values.
There are a few options for plotting implicit equations in `Julia`. We will use `ImplicitPlots`, but note both `ImplicitEquations` and `IntervalConstraintProgramming` offer alternatives that are a bit more flexible.
There are a few options for plotting equations in `Julia`. We will use `ImplicitPlots` in this section, but note both `ImplicitEquations` and `IntervalConstraintProgramming` offer alternatives that are a bit more flexible.
To plot an implicit equation using `ImplicitPlots` requires expressing the relationship in terms of a function equation `f(x,y) = 0`. In practice this simply requires all the terms be moved to one side of an equals sign.
To plot an implicit equation using `ImplicitPlots` requires expressing the relationship in terms of a function, and then plotting the equation `f(x,y) = 0`. In practice this simply requires all the terms be moved to one side of an equals sign.
To plot the circle of radius ``2``, or the equations ``x^2 + y^2 = 2^2`` we would solve ``x^2 + y^2 - 2^2 = 0`` and then express the left hand side through a function:
To plot the circle of radius ``2``, or the equations ``x^2 + y^2 = 2^2`` we would move all terms to one side ``x^2 + y^2 - 2^2 = 0`` and then express the left hand side through a function:
```julia;
f(x,y) = x^2 + y^2 - 2^2
@ -65,13 +65,11 @@ implicit_plot(f)
```
```julia; echo=false
note("""
!!! note
The `f` is a function of *two* variables, used here to express one side of an equation. `Julia` makes this easy to do - just make sure two variables are in the signature of `f` when it is defined. Using functions like this, we can express our equation in the form ``f(x,y) = c`` or, more generally, as ``f(x,y) = g(x,y)``. The latter of which can be expressed as ``h(x,y) = f(x,y) - g(x,y) = 0``. That is, only the form ``f(x,y)=0`` is needed to represent an equation.
The `f` is a function of *two* variables, used here to express one side of an equation. `Julia` makes this easy to do - just make sure two variables are in the signature of `f` when it is defined. Using functions like this, we can express our equation in the form ``f(x,y) = c`` or, more generally, as ``f(x,y) = g(x,y)``. The latter of which can be expressed as ``h(x,y) = f(x,y) - g(x,y) = 0``. That is, only the form ``f(x,y)=0`` is needed to represent an equation.
""")
```
!!! note
There are two different styles in `Julia` to add simple plot recipes. `ImplicitPlots` adds a new plotting function (`implicit_plot`); alternatively many packages add a new recipe for the generic `plot` method using new types. (For example, `SymPy` has a plot recipe for symbolic types.
Of course, more complicated equations are possible and the steps are
@ -90,7 +88,7 @@ illustration purposes, a narrower viewing window is specified below using `xlims
```julia; hold=true
a,b = -1,2
f(x,y) = y^4 - x^4 + a*y^2 + b*x^2
implicit_plot(f, xlims=(-3,3), ylims=(-3,3))
implicit_plot(f; xlims=(-3,3), ylims=(-3,3), legend=false)
```
## Tangent lines, implicit differentiation
@ -98,7 +96,7 @@ implicit_plot(f, xlims=(-3,3), ylims=(-3,3))
The graph ``x^2 + y^2 = 1`` has well-defined tangent lines at all points except
``(-1,0)`` and ``(0, 1)`` and even at these two points, we could call the vertical lines
``x=-1`` and ``x=1`` tangent lines. However, to recover the slope would
``x=-1`` and ``x=1`` tangent lines. However, to recover the slope of these tangent lines would
need us to express ``y`` as a function of ``x`` and then differentiate
that function. Of course, in this example, we would need two functions:
``f(x) = \sqrt{1-x^2}`` and ``g(x) = - \sqrt{1-x^2}`` to do this
@ -126,7 +124,7 @@ For example, starting with ``x^2 + y^2 = 1``, differentiating both sides in ``x
2x + 2y\cdot \frac{dy}{dx} = 0.
```
The chain rule was used to find ``(d/dx)(y^2) = 2y \cdot dy/dx``. From this we can solve for ``dy/dx`` (the resulting equations are linear in ``dy/dx``, so can always be solved explicitly):
The chain rule was used to find ``(d/dx)(y^2) = [y(x)^2]' = 2y \cdot dy/dx``. From this we can solve for ``dy/dx`` (the resulting equations are linear in ``dy/dx``, so can always be solved explicitly):
```math
\frac{dy}{dx} = -\frac{x}{y}.
@ -137,7 +135,7 @@ This says the slope of the tangent line depends on the point ``(x,y)`` through t
As a check, we compare to what we would have found had we solved for
``y= \sqrt{1 - x^2}`` (for ``(x,y)`` with ``y \geq 0``). We would have
found: ``dy/dx = 1/2 \cdot 1/\sqrt{1 - x^2} \cdot -2x``. Which can be
found: ``dy/dx = 1/2 \cdot 1/\sqrt{1 - x^2} \cdot (-2x)``. Which can be
simplified to ``-x/y``. This should show that the method
above - assuming ``y`` is a function of ``x`` and differentiating - is not
only more general, but can even be easier.
@ -275,7 +273,7 @@ implicit_plot(F, xlims=(-2, 2), ylims=(-2, 2), aspect_ratio=:equal)
plot!(tl)
```
We added *both* ``F ⩵ 1`` and the tangent line to the graph.
We added *both* the implicit plot of ``F`` and the tangent line to the graph at the given point.
##### Example
@ -356,7 +354,7 @@ Assume ``y`` is a function of ``x``, called `u(x)`, this substitution is just a
ex1 = ex(y => u(x))
```
At this point, we differentiate both sides in `x`:
At this point, we differentiate in `x`:
```julia;
ex2 = diff(ex1, x)
@ -393,7 +391,7 @@ Let ``a = b = c = d = 1``, then ``(1,4)`` is a point on the curve. We can draw a
H = ex(a=>1, b=>1, c=>1, d=>1)
x0, y0 = 1, 4
𝒎 = dydx₁(x=>1, y=>4, a=>1, b=>1, c=>1, d=>1)
implicit_plot(lambdify(H), xlims=(-5,5), ylims=(-5,5))
implicit_plot(lambdify(H); xlims=(-5,5), ylims=(-5,5), legend=false)
plot!(y0 + 𝒎 * (x-x0))
```
@ -491,7 +489,7 @@ As inverses are unique, their notation, ``f^{-1}(x)``, reflects the name of the
The chain rule can be used to give the derivative of an inverse
function when applied to ``f(f^{-1}(x)) = x``. Solving gives,
``[f^{-1}(x)]' = 1 / f'(g(x))``.
``[f^{-1}(x)]' = 1 / f'(f^{-1}(x))``.
This is great - if we can remember the rules. If not, sometimes implicit
differentiation can also help.
@ -502,6 +500,8 @@ Consider the inverse function for the tangent, which exists when the domain of t
\sec(y)^2 \frac{dy}{dx} = 1.
```
Or ``dy/dx = 1/\sec^2(y)``.
But ``\sec(y)^2 = 1 + \tan(y)^2 = 1 + x^2``, as can be seen by right-triangle trigonometry. This yields the formula ``dy/dx = [\tan^{-1}(x)]' = 1 / (1 + x^2)``.
##### Example
@ -955,7 +955,7 @@ There are other packages in the `Julia` ecosystem that can plot implicit equatio
The `ImplicitEquations` packages can plot equations and inequalities. The use is somewhat similar to the examples above, but the object plotted is a predicate, not a function. These predicates are created with functions like `Eq` or `Lt`.
For example, the `ImplicitPlots` manual shows this function ``f(x,y) = (x^4 + y^4 - 1) * (x^2 + y^2 - 2) + x^5 * y`` to plot. Using `ImplicitEquations`, this equation would be plotted with:
For example, the `ImplicitPlots` manual shows this function ``f(x,y) = (x^4 + y^4 - 1) \cdot (x^2 + y^2 - 2) + x^5 \cdot y`` to plot. Using `ImplicitEquations`, this equation would be plotted with:
```julia; hold=true
using ImplicitEquations

View File

@ -479,13 +479,13 @@ That is, any ladder less than this length can get around the hallway.
Ethan Hunt, a top secret spy, has a mission to chase a bad guy. Here
is what we know:
* Ethan likes to run. He can run at 10 miles per hour.
* He can drive a car - usually some concept car by BMW - at 30 miles per hour, but only on the road.
* Ethan likes to run. He can run at ``10`` miles per hour.
* He can drive a car - usually some concept car by BMW - at ``30`` miles per hour, but only on the road.
For his mission, he needs to go 10 miles west and 5 miles north. He
For his mission, he needs to go ``10`` miles west and ``5`` `miles north. He
can do this by:
* just driving 10 miles west then 5 miles north, or
* just driving ``8.310`` miles west then ``5`` miles north, or
* just running the diagonal distance, or
* driving $0 < x < 10$ miles west, then running on the diagonal
@ -524,14 +524,14 @@ The minimum happens way out near 8. We zoom in a bit:
plot(T, 7, 9)
```
It appears to be around 8.3. We now use `find_zero` to refine our
It appears to be around ``8.3``. We now use `find_zero` to refine our
guess at the critical point using $[7,9]$:
```julia;
α = find_zero(T', (7, 9))
```
Okay, got it. Around 8.23. So is our minimum time
Okay, got it. Around``8.23``. So is our minimum time
```julia;
T(α)
@ -615,7 +615,7 @@ p.coeffs()
```
Fourth degree polynomials can be solved. The critical points of the
original equation will be among the 4 solutions given. However, the result
original equation will be among the ``4`` solutions given. However, the result
is complicated. The
[article](http://www.ams.org/samplings/feature-column/fc-2016-05) -- from
which the figure came -- states that "In today's textbooks the problem,
@ -706,7 +706,7 @@ Here the extreme value theorem doesn't technically apply, as we don't
have a closed interval. However, **if** we can eliminate the endpoints as
candidates, then we should be able to convince ourselves the maximum
must occur at a critical point of $f(x)$. (If not, then convince yourself for all sufficiently large $M$ the maximum over $[0,M]$ occurs at
a critical point, not an endpoint. Then let $M$ go to infinity.)
a critical point, not an endpoint. Then let $M$ go to infinity. In general, for an optimization problem of a continuous function on the interval ``(a,b)`` if the right limit at ``a`` and left limit at ``b`` can be ruled out as candidates, the optimal value must occur at a critical point.)
So to approach this problem we first graph it over a wide interval.
@ -715,7 +715,7 @@ f(x) = x * exp(-x^2)
plot(f, 0, 100)
```
Clearly the action is nearer to 1 than 100. We try graphing the
Clearly the action is nearer to ``1`` than ``100``. We try graphing the
derivative near that area:
```julia;
@ -852,12 +852,23 @@ numericq(val)
###### Question
A rancher with 10 meters of fence wishes to make a pen adjacent to an
A rancher with ``10`` meters of fence wishes to make a pen adjacent to an
existing fence. The pen will be a rectangle with one edge using the
existing fence. Say that has length $x$, then $10 = 2y + x$, with $y$
the other dimension of the pen. What is the maximum area that can be
made?
```julia; hold=true; echo=false
p = plot(; legend=false, aspect_ratio=:equal, axis=nothing, border=:none)
plot!([0,10, 10, 0, 0], [0,0,10,10,0]; linewidth=3)
plot!(p, [10,14,14,10], [2, 2, 8,8]; linewidth = 1)
annotate!(p, [(15, 5, "x"), (12,1, "y")])
p
```
```julia; hold=true; echo=false
Ar(y) = (10-2y)*y;
val = Ar(find_zero(Ar', 5))
@ -906,6 +917,79 @@ ans = 1
radioq(choices, ans)
```
###### Question
A cardboard box is to be designed with a square base and an open top holding a fixed volume ``V``. What dimensions yield the minimal surface area?
If this problem were approached symbolically, we might see the following code. First:
```julia;eval=false
@syms V::positive x::positive z::positive
SA = 1 * x * x + 4 * x * z
```
What does this express?
```julia; hold=true; echo=false
radioq((
"The box has a square base with open top, so `x*x` is the amount of material in the base; the 4 sides each have `x*z` area.",
"The volume is a fixed amount, so is `x*x*z`, with sides suitably labeled",
"The surface area of a box is `6x*x`, so this is wrong."
), 1)
```
What does this command express?
```julia; eval=false
SA = subs(SA, z => V / x^2)
```
```julia; hold=true; echo=false
radioq((
"This command replaces `z` with an expression in `x` using the constraint of fixed volume `V`",
"This command replaces `z`, reparameterizing in `V` instead.",
"This command is merely algebraic simplification"
), 1)
```
What does this command find?
```julia; eval=false
solve(diff(SA, x) ~ 0, x)
```
```julia; hold=true; echo=false
radioq((
"This solves ``SA'=0``, that is it find critical points of a continuously differentiable function",
"This solves for ``V`` the fixed, but unknown volume",
"This checks the values of `SA` at the end points of the domain"
), 1)
```
What do these commands do?
```julia; eval=false
cps = solve(diff(SA, x) ~ 0, x)
xx = filter(isreal, cps)[1]
diff(SA, x, x)(xx) > 0
```
```julia; hold=true; echo=false
radioq((
"This applies the second derivative test to the lone *real* critical point showing there is a local minimum at that point.",
"This applies the first derivative test to the lone *real* critical point showing there is a local minimum at that point.",
"This finds the ``4`th derivative of `SA`"
), 1)
```
###### Question
A rain gutter is constructed from a 30" wide sheet of tin by bending
@ -1265,3 +1349,59 @@ raw" ``\sqrt{3}/2 \cdot (a/b)^{2/3}``"
]
radioq(choices, 1)
```
###### Question
In [Hall](https://www.maa.org/sites/default/files/hall03010308158.pdf) we can find a dozen optimization problems related to the following figure of the parabola ``y=x^2`` a point ``P=(a,a^2)``, ``a > 0``, and its normal line. We will do two.
```julia; hold=true, echo=false
p = plot(; legend=false, aspect_ratio=:equal, axis=nothing, border=:none)
b = 2.
plot!(p, x -> x^2, -b, b)
plot!(p, [-b,b], [0,0])
plot!(p, [0,0], [0, b^2])
a = 1
scatter!(p, [a],[a^2])
m = 2a
plot!(p, x -> a^2 + m*(x-a), 1/2, b)
mₚ = -1/m
plot!(p, x -> a^2 + mₚ*(x-a))
scatter!(p, [-3/2], [(3/2)^2])
annotate!(p, [(1+1/4, 1+1/8, "P"), (-3/2-1/4, (-3/2)^2-1/4, "Q")])
p
```
What do these commands do?
```julia; hold=true;
@syms x::real, a::real
mₚ = - 1 / diff(x^2, x)(a)
solve(x^2 - (a^2 + mₚ*(x-a)) ~ 0, x)
```
```julia; hold=true; echo=false
radioq((
"It finds the ``x`` value of the intersection points of the normal line and the parabola",
"It finds the tangent line",
"It finds the point ``P``"
), 1)
```
Numerically, find the value of ``a`` that minimizes the ``y`` coordinate of ``Q``.
```julia; hold=true; echo=false
y(a) = (-a - 1/(2a))^2
a = find_zero(y', 1)
numericq(a)
```
Numerically find the value of ``a`` that minimizes the length of the line seqment ``PQ``.
```juila; hold=true; echo=false
x(a) = -a - 1/(2a)
d(a) = (a-x(a))^2 + (a^2 - x(a)^2)^2
a = find_zero(d', 1)
numericq(a)
```

View File

@ -224,7 +224,7 @@ Solving, yields:
```
* If $l = 12$ and $db/dt = 2$ when $b=4$, find $dh/dt$.
* If when $l = 12$ it is known that $db/dt = 2$ when $b=4$, find $dh/dt$.
We just need to find $h$ for this value of $b$, as the other two quantities in the last equation are known.
@ -242,6 +242,9 @@ height = sqrt(length^2 - bottom^2)
As $b$ goes to $l$, $h$ goes to ``0``, so $b/h$ blows up. Unless $db/dt$
goes to $0$, the expression will become $-\infty$.
!!! note
Often, this problem is presented with ``db/dt`` having a constant rate. In this case, the ladder problem defies physics, as ``dh/dt`` eventually is faster than the speed of light as ``h \rightarrow 0+``. In practice, were ``db/dt`` kept at a constant, the ladder would necessarily come away from the wall. The trajectory would follow that of a tractrix were there no gravity to account for.
##### Example

View File

@ -14,6 +14,10 @@ using HCubature
```julia; echo=false; results="hidden"
using CalculusWithJulia.WeaveSupport
import PyPlot
pyplot()
const frontmatter = (
title = "Multi-dimensional integrals",
description = "Calculus with Julia: Multi-dimensional integrals",

View File

@ -2,18 +2,19 @@
To run the commands in these notes, some external packages must be installed and loaded.
The `Pluto` interface does this in the background, so there is nothing to do but execute the cells that call `using` or `import`.
The `Pluto` interface does this in the background, so there is nothing
to do but execute the cells that call `using` or `import`. For `Julia`
post version `1.7`, this installation will be initiated for you when
`using` is called in the REPL terminal.
----
For other interfaces, to use the `CalculusWithJulia` package requires first that it be installed. From the command line, this would be done with
All that is needed is to install with:
For other interfaces, to use the `CalculusWithJulia` package requires first that it be installed. From the command line. This can be done with this key sequence:
```julia; eval=false
] add CalculusWithJulia
```
Using the `Pkg` package, the commands would be
Or, using the `Pkg` package, the commands would be
```julia; eval=false
import Pkg
@ -22,6 +23,7 @@ Pkg.add("CalculusWithJulia")
Installation only needs to be done once.
----
However, for each new `Julia` session, the package must be *loaded*, as with the following command:

View File

@ -28,6 +28,8 @@ 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.
These notes use `Pluto` notebooks. The "Edit or run this notebook" button allows each notebook to be run through binder. However, it can take several minutes for binder to show any given notebook. (Binder works best when no or few external packages are used.)
## Installing Julia locally

View File

@ -124,7 +124,7 @@ Trigonometric functions are used to describe triangles, circles and oscillatory
## Limits and Continuity
The notion of a limit is at the heart of the two main operations of calculus, differentiation and integration.
The notion of a limit is at the heart of the two main operations of calculus: differentiation and integration.
- [Limits](limits/limits.html)
@ -171,7 +171,7 @@ The tangent line to the graph of a function at a point has slope given through t
The derivative finds use outside of the traditional way of specifying a function or relationship. These two sections look at some different cases.
- [Implicit derivatives](derivatives/implicit_differentiation.html)
- [Implicit differentiation](derivatives/implicit_differentiation.html)
- [Related rates](derivatives/related_rates.html)
@ -215,7 +215,7 @@ Various applications of the integral are presented. The first two sections conti
- [Surface Area](integrals/surface_area.html)
#### Ordinary differential equations
### Ordinary differential equations
Ordinary differential equations are an application of integration and the fundamental theorem of calculus.
@ -240,6 +240,8 @@ The calculus of functions involving more than $1$ variable is greatly simplified
- [Vectors](differentiable_vector_calculus/vectors.html)
### Differentiable vector calculus
In general we will consider multivariable functions from $R^n$ into $R^m$ (functions of $n$ variables that return $m$ different values), but it is helpful to specialize to two cases first. These are vector valued functions ($f: R \rightarrow R^n$) and scalar functions ($f:R^n \rightarrow R$).
- [Vector-valued functions](differentiable_vector_calculus/vector_valued_functions.html)
@ -257,7 +259,7 @@ The derivative of a mulitvariable function is discussed here. We will see that w
----
### Integral vector calculus
Integral vector calculus begins with a generalization of integration to compute area to integration to compute volumes (and its generalization to higher dimensions). The integration concept is then extended to integration over curves and surfaces. With this, generalizations of the fundamental theorem of calculus are discussed.
@ -308,7 +310,7 @@ A review of the `Julia` concepts used within these notes.
## Miscellaneous
- Some different [interfaces](misc/julia_interfaces.html) interfaces to `Julia`.
- Some different [interfaces](misc/julia_interfaces.html) to `Julia`.
- The [CalculusWithJulia](misc/calculus_with_julia.html) package.
@ -322,40 +324,4 @@ A review of the `Julia` concepts used within these notes.
This is a work in progress. To report an issue, make a comment, or suggest something new, please file an [issue](https://github.com/jverzani/CalculusWithJulia.jl/issues/). In your message add the tag `@jverzani` to ensure it is not overlooked. Otherwise, an email to `verzani` at `math.csi.cuny.edu` will also work.
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 (like the one below) 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.
```julia; hold=true; echo=false
# put in a custom footer
txt = """
<div class="card" style="">
<div class="card-header float-end text-muted">
<span class="text-muted float-end align-middle">
<a href="./precalc/calculator.html"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Next section"
aria-label="Next section"
class="bi bi-arrow-right-circle-fill">
</a>
&nbsp;
<a href="https://github.com/jverzani/CalculusWithJulia.jl/edit/master/CwJ/misc/toc.jmd"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Suggest an edit"
aria-label="Suggest an edit"
class="bi bi-pencil-square">
</a>
</span>
</div>
</div>
"""
CalculusWithJulia.WeaveSupport.HTMLoutput(txt)
```
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.

View File

@ -1,4 +1,4 @@
# Replacing the calculator with a computer
# From calculator to computer
```julia; echo=false;
@ -6,7 +6,7 @@ using CalculusWithJulia
using CalculusWithJulia.WeaveSupport
const frontmatter = (
title = "Replacing the calculator with a computer",
title = "From calculator to computer",
description = "Calculus with Julia: Replacing the calculator with a computer",
tags = ["CalculusWithJulia", "precalc", "replacing the calculator with a computer"],
);
@ -14,6 +14,7 @@ const frontmatter = (
nothing
```
Let us consider a basic calculator with buttons to add, subtract,
multiply, divide, and take square roots. Using such a simple thing is
certainly familiar for any reader of these notes. Indeed, a
@ -934,6 +935,21 @@ val = sind(52)
numericq(val)
```
###### Question
What is the value of
```math
\frac{sin(pi/3) - 1/2}{pi/3 - pi/6}
```
```julia; hold=true; echo=false;
val = (sin(pi/3) - 1/2)/(pi/3 - pi/6)
numericq(val)
```
###### Question

View File

@ -2,6 +2,7 @@
This section will use the following packages:
```julia
using CalculusWithJulia
using Plots

View File

@ -1,10 +0,0 @@
using WeavePynb
using Mustache
mmd(fname) = mmd_to_html(fname, BRAND_HREF="../toc.html", BRAND_NAME="Calculus with Julia")

View File

@ -1,11 +0,0 @@
---
title: Test
author: Chris Rackauckas
---
This is a test of the builder system.
```{julia; echo=false; skip="notebook"}
using CalculusWithJulia
CalculusWithJulia.WeaveSupport._footer(WEAVE_ARGS[:folder],WEAVE_ARGS[:file])
```

View File

@ -1 +1,6 @@
# CalculusWithJuliaNotes
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://jverzani.github.io/CalculusWithJuliaNotes.jl/dev/)
A collection of [notes]((https://jverzani.github.io/CalculusWithJuliaNotes.jl/dev/)) related to using `Julia` in the study of Calculus.

View File

@ -1,7 +1,7 @@
derivatives_optimization = "5975e12024d1cbb622b2879aacb70352f6632461ebb55b4631bdf82eca90a05b"
differentiable_vector_calculus_plots_plotting = "1fbca9144d419b406206671a04c6e5b954e1993192d53c1dfa3e132d8100b769"
alternatives_plotly_plotting = "38de16a0a8f975a4a69a7dca7e747ce3dbb42c9291fc9591852fee9668e85c61"
integral_vector_calculus_stokes_theorem = "072c2d4cead381d760b8617f75a4f3a2f9c3c7080ca2fe0d1b09937b09ba678c"
derivatives_derivatives = "1f463e9535956f67a1d1f67c0bb96561793c188e4dee516956e15524db0092ad"
derivatives_derivatives = "b7070253b31556a826bc277daeee8a81c64aaa16ab2ad3a653205a5c5e71d4e6"
integrals_arc_length = "2544b9be3fdfdc553788e655313ddc7bf0d06478d1d3122e32e09d39f2e18d9d"
integrals_area = "f615c00f21b19de93016e879bc19a36e77bbdff86b15176700fc81608c4f8505"
derivatives_more_zeros = "8c399cc058540b8180356eed20333209c8e0227e1b158bf6036acaef7b50be45"
@ -14,7 +14,7 @@ ODEs_euler = "7326d476767ecd1e68b3e33aff5683699e22257a3e4f252300c05c344aa2cb2f"
integrals_partial_fractions = "72cc5b7e96273fdc2d30d9c5532e399e86aa9e37ada3a7a173518d279be2a8c8"
differentiable_vector_calculus_scalar_functions = "660582e02440193a6b55721bc3690a4c61bdd76d3f0425fb7c9eabc7977ea982"
integrals_center_of_mass = "6a58f248e43cbcb664532a1edd3e418ca9b4aeb226eb7987daf69ba902f9752f"
misc_getting_started_with_julia = "2365a25db4c90c6681a020763269e57bcfe4e292aa9cecefbe59e80e56b546cc"
misc_getting_started_with_julia = "ebce6bccdf2f43078e4397b76bf5c2f60d4244a3cc628c89202ce629f4ac1ad6"
precalc_logical_expressions = "354f07b97bad092a198cef91a6403ef6bb6287e06b0b910de4bb9ce65477c1a9"
limits_continuity = "7ec41b103affe38d9a5a20d52971e7278bffa38e4daf11efd7dd10fa1f6df300"
differentiable_vector_calculus_scalar_functions_applications = "aaebf1333b4153e0678af7ba45c168dd15cca5a3fd5de43b27032c64f490735e"
@ -22,8 +22,9 @@ limits_intermediate_value_theorem = "d695cee3a813edd12b33f8502542a813bf78a7295c5
integral_vector_calculus_review = "7d9bc1ea81ecb731eaf781f3dd90fe93bcaed198bddbeae14095edb1665bab6d"
precalc_inversefunctions = "fe53a8d52a189d1969e9ccc178c3531b314a8039d036be934a7ca7d9b20c850f"
precalc_variables = "eac80638a636d707187269654ecc6b69bb5593dd87431de669b47f4ec48fb9b0"
derivatives_related_rates = "ad9978143e47775297a7611f3237c703c2e5062707893a299f5232cd83475651"
derivatives_related_rates = "caf0f93b516577b3cff39717269a27037364a5d7737c58904bc426906c81abb0"
precalc_numbers_types = "37c0ba15749a95eb2bb854af30d7c53351a14689d8cfefc6c514070c9ba49491"
misc_getting_started_with_juila = "2365a25db4c90c6681a020763269e57bcfe4e292aa9cecefbe59e80e56b546cc"
integrals_volumes_slice = "2c8bbdea196ab12447b1b9f3f4c90cc308c712dbebb3298fff47475ce39e6ad6"
integrals_surface_area = "5fc55f8068911a67723710a7faf87947d951428289d253142419e329291a7263"
limits_limits_extensions = "52316ab96de356e2d8c6c0b03ea96663b4c39f254840c4588f017648bdb3a221"
@ -40,7 +41,7 @@ derivatives_numeric_derivatives = "199441dc8c74f6854a907bcb7d380bab0e72bc3b6bb92
derivatives_linearization = "246e5fa6e9871f59c220f1891cd6a7b6c806670af5dae83779396e128f703d81"
misc_julia_interfaces = "2ecff77788c6c706450ab11ee45e21e0714cb545353d8879e2c2e6349dcf9608"
derivatives_newtons_method = "bd4185c9db9b8b7e3cb0ab582ae1f8d3908322fe81e208c25f62a68b2944859e"
integral_vector_calculus_double_triple_integrals = "8a1fe10844df05c69ff6fc5bdb53483462e3ef162ed2dcc873d647a0f2f3b15d"
integral_vector_calculus_double_triple_integrals = "84fc4918871b45dad08018655df4d60c03ba0ae5f54b09a68c17e5ea028f9f97"
precalc_polynomial_roots = "fa23b7f0dfdfb7fe85aae97cc94ebbc3de0ecf82ddccbf78ebf0c5c2d711578b"
precalc_ranges = "b262dbb5b0d7a87a21db72bb64d3fa37fe06cd5af2e38f48cc38b4ce820a0c33"
precalc_polynomial = "2c0ba02bd275e1fd51d7f0a239c691ed9ca57b7706a4cff7df462ffb364acc8c"
@ -53,18 +54,18 @@ integrals_area_between_curves = "b91a0c1631ec04cf065eefddf18db1ea24c28f06d745909
precalc_trig_functions = "a638b2d482c45d58da6bcff0d25c27a7cc44d326e9532890e3b023df8a502097"
differentiable_vector_calculus_polar_coordinates = "a5eed23614ec0815e9c6f88768619fce9fc0ada31535147468c44a6c9c586376"
integrals_improper_integrals = "cc96fa238225a198b1717a50f72cb0869fff21d35d275c4c2e4b9f5b005b4cc7"
misc_calculus_with_julia = "79d3617d1b0a7735bbae8a6eda83fe40b755bde9bf101bb592e3b903adfeb34f"
misc_calculus_with_julia = "bb5458e4ee8d05d74567bb9b97b9dbccb8cc9bc150c927b0e3e029bba78d68ca"
differentiable_vector_calculus_vectors = "cde2675466c01a697a7bfc73a94d58e9a58b7ed1b30cc1f03b9f573b6cb5a48d"
misc_unicode = "ef41cdddea251570f3757186ccb6a0d1f9a313a04b6ac0f074e266f71dfcb461"
integrals_mean_value_theorem = "7d7dbc1e2f8461f1b59f0df5143189cce576a3fdcef39365190859fb827ecf46"
ODEs_solve = "967c509f4b998a5f7a2f993fbb649dd52c99ed2ed4120c6d7726e04fc088f1c1"
misc_toc = "0663a465e34b5a8e1b7b375dac2b9872e94ac5a276877061fc19bc300740c5b9"
misc_toc = "547986a9a3d581cdc62419a80b8e8e2128ae4e227337d643f855c9636433e3f3"
misc_quick_notes = "26d355d223cd562804037e96412ac766d5dcd997c42263819cf2c89504524e24"
precalc_functions = "a6d4928a59cf9eb4a8e3f36469819289c21911e756d73c9fa294eb421c9c686b"
precalc_plotting = "1b85c91fb0488407a91b79c2613716b2788e50ca62520888e15676a63a7a966d"
precalc_plotting = "a4b3a1ceda5abbd9950ff0724295bd6a3f83b8838a0c2a5bcfcf38f5caccce5e"
integrals_substitution = "b96fe31960c9c8b0a46e3f8f6011abd9a8deb2fcbe8cc5402692415bcb8c04f6"
precalc_calculator = "a400b6003b6093fe7efade92bb1adff4fe014a7e020529825be1692f36ae2653"
precalc_calculator = "7ec826ee6eef52c97ba6f0aa7a54ef5e59a08dc4c3896b750cd3f586895761eb"
precalc_exp_log_functions = "bd5d1b555dd2c975f327ebf17d076ff390d6b480d35c52b3f88cdff441e6f2f3"
differentiable_vector_calculus_plots_plotting = "1fbca9144d419b406206671a04c6e5b954e1993192d53c1dfa3e132d8100b769"
differentiable_vector_calculus_vector_fields = "bd852d03a2a3397337649b23898252a7db0a298b6427d3e78262d4457e87a90b"
derivatives_implicit_differentiation = "e3bd825f55ed70502ea787361e0a3d4bbe3463dc56980e31feb2b2a6101ecc1c"
derivatives_implicit_differentiation = "bb10e33f783d2e9dbe47bd8734cce6e3878454e4d029ce464d8f6483d5de616f"
derivatives_optimization = "70c1435c1b0bfa3921a72f5f3b296f78e6f4e06c11c85f9c3468cee82e704042"

View File

@ -39,16 +39,14 @@ force = parse(Bool, d["force"])
if isnothing(folder) && isnothing(file)
# keep it simple for now; uncomment above once build goes through
#build_all(force)
build_pages("precalc", nothing, :html, force)
#build_toc()
build_pages(nothing, nothing, :html, force)
build_toc()
else
build_pages(folder, file, :html, force)
end
build_deploy()

View File

@ -105,7 +105,7 @@ function md2notebook(fname; header_cmds=(), footer_cmds=())
footer_cmds = vcat(footer_cmds...,
"using PlutoUI",
"PlutoUI.TableOfContents()",
"html\"\"\"<script src=\"https://utteranc.es/client.js\" repo=\"jverzani/CalculusWithJulia.jl\" issue-term=\"pathname\" theme=\"github-light\" crossorigin=\"anonymous\" async> </script>\"\"\""
"html\"\"\"<script src=\"https://utteranc.es/client.js\" repo=\"jverzani/CalculusWithJuliaNotes.jl\" issue-term=\"pathname\" theme=\"github-light\" crossorigin=\"anonymous\" async> </script>\"\"\""
)
for cmd footer_cmds
cell = Pluto.Cell(cmd)

188
docs/toc.jl Normal file
View File

@ -0,0 +1,188 @@
## Header and footer code
## includes log and table of contents
# keep up to date with misc/toc.jmd
table_of_contents = [
:precalc :calculator;
:precalc :variables;
:precalc :numbers_types;
:precalc :logical_expressions;
:precalc :vectors;
:precalc :ranges;
:precalc :functions;
:precalc :plotting;
:precalc :transformations;
:precalc :inversefunctions;
:precalc :polynomial;
:precalc :polynomial_roots;
:precalc :polynomials_package;
:precalc :rational_functions;
:precalc :exp_log_functions;
:precalc :trig_functions;
:precalc :julia_overview;
:limits :limits;
:limits :limits_extensions;
:limits :continuity;
:limits :intermediate_value_theorem;
:derivatives :derivatives;
:derivatives :numeric_derivatives;
:derivatives :symbolic_derivatives;
:derivatives :mean_value_theorem;
:derivatives :optimization;
:derivatives :first_second_derivatives;
:derivatives :curve_sketching;
:derivatives :linearization;
:derivatives :newtons_method;
:derivatives :more_zeros;
:derivatives :lhospitals_rule;
:derivatives :implicit_differentiation;
:derivatives :related_rates;
:derivatives :taylor_series_polynomials;
:integrals :area;
:integrals :ftc;
:integrals :substitution;
:integrals :integration_by_parts;
:integrals :partial_fractions;
:integrals :improper_integrals;
:integrals :mean_value_theorem;
:integrals :area_between_curves;
:integrals :center_of_mass;
:integrals :volumes_slice;
:integrals :arc_length;
:integrals :surface_area;
:ODEs :odes;
:ODEs :euler;
:ODEs :solve;
:ODEs :differential_equations;
:differentiable_vector_calculus :polar_coordinates;
:differentiable_vector_calculus :vectors;
:differentiable_vector_calculus :vector_valued_functions;
:differentiable_vector_calculus :scalar_functions;
:differentiable_vector_calculus :scalar_functions_applications;
:differentiable_vector_calculus :vector_fields;
:differentiable_vector_calculus :plots_plotting;
:alternatives :makie_plotting;
:alternatives :plotly_plotting;
:integral_vector_calculus :double_triple_integrals;
:integral_vector_calculus :line_integrals;
:integral_vector_calculus :div_grad_curl;
:integral_vector_calculus :stokes_theorem;
:integral_vector_calculus :review;
:alternatives :symbolics;
:misc :getting_started_with_julia
:misc :bibliography;
:misc :quick_notes;
:misc :julia_interfaces;
:misc :calculus_with_julia;
:misc :unicode
]
struct Logo
width::Int
end
Logo() = Logo(120)
const logo_url = "https://raw.githubusercontent.com/jverzani/CalculusWithJuliaNotes.jl/master/CwJ/misc/logo.png"
function Base.show(io::IO, ::MIME"text/html", l::Logo)
show(io, "text/html", Markdown.HTML("""
<img src="$(logo_url)" alt="Calculus with Julia" width="$(l.width)" />
"""))
end
header_cmd = """
HTML(\"\"\"
<div class="admonition info">
<a href="https://CalculusWithJulia.github.io">
<img src="$(logo_url)" alt="Calculus with Julia" width="48" />
</a>
<span style="font-size:32px">Calculus With Julia</span>
</div>
\"\"\")
"""
"""
Footer(:file, :directory)
Footer object for HTML display
"""
struct Footer
f
d
end
# create footer from basename of file, folder name
function footer_cmd(bnm, folder)
f = Footer(Symbol(bnm), Symbol(folder))
out = sprint(io -> show(io, "text/html", f))
"HTML(\"\"\"$(out)\"\"\")"
end
# compute from URL
file_dir(f::Symbol,d::Symbol) = (f,d)
function file_dir(f, d)
f = Symbol(last(split(foot.f, "/"))[1:end-4])
d = Symbol(split(foot.d, "/")[end])
f,d
end
function previous_current_next(foot::Footer)
f₀, d₀ = file_dir(foot.f, foot.d)
toc_url = "../index.html"
suggest_url = "https://github.com/jverzani/CalculusWithJuliaNotes.jl/edit/master/CwJ/$(d₀)/$(f₀).jmd"
prev_url = "https://calculuswithjulia.github.io"
next_url = "https://calculuswithjulia.github.io"
prev,nxt = prev_next(d₀, f₀)
if prev != nothing
d,f = prev
prev_url = "../$(d)/$(f).html"
end
if nxt != nothing
d,f = nxt
next_url = "../$(d)/$(f).html"
end
(base_url="https://calculuswithjulia.github.io",
toc_url=toc_url,
prev_url=prev_url,
next_url = next_url,
suggest_edit_url = suggest_url
)
end
function Base.show(io::IO, ::MIME"text/html", x::Footer)
home, toc, prev, next, suggest = previous_current_next(x)
show(io, "text/html", Markdown.parse("""
> [ previous]($prev) [ next]($next) [ table of contents]($toc) [ suggest an edit]($suggest)
"""))
end
# return :d,:f for previous and next
function prev_next(d,f)
vals = [table_of_contents[i,:] for i 1:size(table_of_contents,1)]
val = [d,f]
i = findfirst(Ref(val,) .== vals)
i == nothing && error(val)
i == 1 && return (prev=nothing, next=vals[2])
i == length(vals) && return (prev=vals[end-1], next=nothing)
return (prev=vals[i-1], next=vals[i+1])
end

View File

@ -9,11 +9,22 @@ using Pkg
using SHA
using TOML
include("toc.jl")
const _map = map # asyncmap
# Unfortunately, trying to build files during CI proves too time
# intensive, so we keep a copy of built html files in ./html
# build files in CwJ -> html_dir
# cp html_dir -> build_dir during build
const repo_directory = joinpath(@__DIR__,"..")
const cache_file = joinpath(@__DIR__, "build_cache.toml")
const html_dir = joinpath(repo_directory, "html")
const build_dir = joinpath(@__DIR__, "build")
# cache SHA for each .jmd file to monitor changes
const cache_file = joinpath(@__DIR__, "build_cache.toml")
sha(s::IO) = bytes2hex(sha256(s))
sha(path::AbstractString) = open(path, "r") do io
sha(io)
@ -39,14 +50,23 @@ function write_sha(folder, file)
write_cache(D)
end
# build file check sha in cache
# get jmd file from (folder, file) pair
function jmd_file(folder, file)
occursin(r"\.jmd$", file) || (file *= ".jmd")
joinpath(repo_directory, "CwJ", folder, file)
end
# should we build this file?
# where to write html file from (folder, file) pair
function out_file(folder, file; ext=".html")
file = replace(file, r"\.jmd$" => "")
joinpath(html_dir, folder, file * ext)
end
# should we build this file? Consult cache
function build_fileq(folder, file; force=true)
occursin(r"index.html", file) && return false
force && return force
file = replace(file, r"\.jmd$"=>"")
@ -60,53 +80,31 @@ function build_fileq(folder, file; force=true)
return Δ
end
## ----
function build_toc(force=true)
@info "building table of contents"
jmd_dir = joinpath(repo_directory, "CwJ", "misc")
build_dir = joinpath(@__DIR__, "build")
isdir(build_dir) || mkpath(build_dir)
file = joinpath(jmd_dir, "toc.jmd")
outfile = joinpath(build_dir, "index.html")
# cd(jmd_dir)
build_fileq(file, outfile, force=force) || return nothing
header = CalculusWithJulia.WeaveSupport.header_cmd
#footer = CalculusWithJulia.WeaveSupport.footer_cmd(bnm, folder)
html_content = md2html(file,
header_cmds=(header,),
footer_cmds=()
)
open(outfile, "w") do io
write(io, html_content)
end
# to use weave, not pluto
# weave(file;
# out_path=outfile,
# doctype="md2html",
# fig_ext=".svg",
# template=htmlfile,
# fig_path=tempdir())
end
# do we build the file check mtime
# function build_file(jmdfile, outfile; force=false)
# # do we build the file check mtime
# function build_fileq(folder, file; force=false)
# force && return true
# jmdfile = jmd_file(folder, file)
# outfile = out_file(folder, file)
# !isfile(outfile) && return true
# mtime(outfile) < mtime(jmdfile) && return true
# return false
# end
## ----
function build_toc(force=true)
@info "building table of contents"
# copy misc/toc.html to index.html
a = joinpath(html_dir, "misc", "toc.html")
b = joinpath(build_dir, "index.html")
isdir(build_dir) || mkdir(build_dir)
cp(a, b; force=true)
end
# build pluto html
# file **has** ".jmd" extension
function build_file(folder, file, force)
@ -121,19 +119,26 @@ function build_file(folder, file, force)
bnm = replace(file, r"\.jmd$"=>"")
jmd_dir = joinpath(repo_directory, "CwJ", folder)
#cd(jmd_dir)
out_dir = joinpath(html_dir, folder)
isdir(out_dir) || mkpath(oud_dir)
dir = joinpath(build_dir, folder)
isdir(dir) || mkpath(dir)
html_content = try
header = header_cmd
footer = footer_cmd(bnm, folder)
md2html(jmd_file(folder, file),
header_cmds=(header,),
footer_cmds=(footer,)
)
catch err
@info "Error with $folder / $bnm"
header = header_cmd
md2html(jmd_file(folder, file),
header_cmds=(header,)
)
end
header = CalculusWithJulia.WeaveSupport.header_cmd
footer = CalculusWithJulia.WeaveSupport.footer_cmd(bnm, folder)
html_content = md2html(jmd_file(folder, file),
header_cmds=(header,),
footer_cmds=(footer,)
)
outfile = joinpath(build_dir, folder, bnm * ".html")
#outfile = joinpath(build_dir, folder, bnm * ".html")
outfile = joinpath(out_dir, bnm * ".html")
open(outfile, "w") do io
write(io, html_content)
end
@ -146,14 +151,15 @@ end
function build_all(force)
folders = readdir(joinpath(repo_directory,"CwJ"))
folders = filter(F -> isdir(joinpath(repo_directory, "CwJ", F)), folders)
asyncmap(F -> build_folder(F, force), folders)
_map(F -> build_folder(F, force), folders)
end
function build_folder(folder, force)
!isnothing(match(r"\.ico$", folder)) && return nothing
@info "Build $(folder)/..."
files = readdir(joinpath(repo_directory,"CwJ",folder))
files = filter(f -> occursin(r".jmd$", basename(f)), files)
asyncmap(file -> build_file(folder, file, force), files)
_map(file -> build_file(folder, file, force), files)
end
@ -168,8 +174,29 @@ function build_pages(folder=nothing, file=nothing, target=:html, force=false)
end
end
"""
Copy files from /html to /docs/build
recurse one level deep
"""
function build_deploy(;dir=html_dir)
isdir(build_dir) || mkdir(build_dir)
ds = readdir(dir)
for d ds
D = joinpath(build_dir, d)
isdir(D) || mkdir(D)
for dᵢ readdir(joinpath(dir,d))
a = joinpath(dir, d, dᵢ)
b = joinpath(D, dᵢ)
cp(a, b; force=true)
end
end
end
# ## --------------------------------------------------
# ## Build more generally, but not use right now
# ## Build more generally, but not used right now
# const cssfile = joinpath(@__DIR__, "..", "templates", "skeleton_css.css")
# const htmlfile = joinpath(@__DIR__, "..", "templates", "bootstrap.tpl")
# const latexfile = joinpath(@__DIR__, "..", "templates", "julia_tex.tpl")

File diff suppressed because one or more lines are too long

69
html/ODEs/euler.html Normal file

File diff suppressed because one or more lines are too long

69
html/ODEs/odes.html Normal file

File diff suppressed because one or more lines are too long

69
html/ODEs/solve.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

69
html/integrals/area.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

69
html/integrals/ftc.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

69
html/limits/limits.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

69
html/misc/toc.html Normal file

File diff suppressed because one or more lines are too long

69
html/misc/unicode.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

69
html/precalc/ranges.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

69
html/precalc/vectors.html Normal file

File diff suppressed because one or more lines are too long