use quarto, not Pluto to render pages
This commit is contained in:
9
quarto/misc/Project.toml
Normal file
9
quarto/misc/Project.toml
Normal file
@@ -0,0 +1,9 @@
|
||||
[deps]
|
||||
CalculusWithJulia = "a2e0e22d-7d4c-5312-9169-8b992201a882"
|
||||
HCubature = "19dc6840-f33b-545b-b366-655c7e3ffd49"
|
||||
ImplicitEquations = "95701278-4526-5785-aba3-513cca398f19"
|
||||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
||||
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
|
||||
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"
|
||||
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
|
||||
SymPy = "24249f21-da20-56a4-8eb1-6a02cf4ae2e6"
|
||||
93
quarto/misc/bibliography.md
Normal file
93
quarto/misc/bibliography.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# Bibliography, etc.
|
||||
|
||||
(A work in progress...)
|
||||
|
||||
## Historical Books
|
||||
|
||||
* Oeuvres complètes d'Augustin Cauchy. Série 2, tome 4
|
||||
Calcul Diferentiel
|
||||
[link](http://gallica.bnf.fr/ark:/12148/bpt6k90196z/f16.image)
|
||||
|
||||
*
|
||||
Analyse des infiniment petits, pour l'intelligence des lignes courbes
|
||||
by L'Hospital, marquis de, 1661-1704
|
||||
|
||||
[link](https://archive.org/details/infinimentpetits1716lhos00uoft)
|
||||
|
||||
* Fermat on maxmin
|
||||
http://science.larouchepac.com/fermat/fermat-maxmin.pdf
|
||||
|
||||
* Argobast (1800, primary book for a long time)
|
||||
|
||||
http://books.google.com/books?id=YoPq8uCy5Y8C&printsec=frontcover&source=gbs_ge_summary_r&cad=0#v=onepage&q&f=false
|
||||
|
||||
## Open source text books
|
||||
|
||||
Refer to [open](http://danaernst.com/resources/free-and-open-source-textbooks/) source textbooks to find
|
||||
|
||||
* Strang
|
||||
http://ocw.mit.edu/resources/res-18-001-calculus-online-textbook-spring-2005/textbook/
|
||||
|
||||
* Oliver Knill teaching notes
|
||||
http://www.math.harvard.edu/~knill/teaching/summer2018/handouts.html
|
||||
|
||||
* Open Stax
|
||||
https://math.libretexts.org/Bookshelves/Calculus/Book%3A_Calculus_(OpenStax)
|
||||
|
||||
* David Guichard (also Neal Koblitz)
|
||||
http://www.whitman.edu/mathematics/calculus/
|
||||
|
||||
* Marsden, Weinstein
|
||||
http://www.cds.caltech.edu/~marsden/volume/Calculus/
|
||||
|
||||
|
||||
* Joyner Differential Calculus with Sage based on Granville's text
|
||||
http://wdjoyner.com/teach/calc1-sage/
|
||||
|
||||
* Sage for undergraudate
|
||||
http://wdjoyner.com/teach/calc1-sage/
|
||||
|
||||
* AI Math
|
||||
http://aimath.org/textbooks/approved-textbooks/
|
||||
|
||||
|
||||
## Articles
|
||||
|
||||
http://www.ams.org/samplings/feature-column/fc-2012-02
|
||||
|
||||
http://www.maa.org/external_archive/joma/Volume7/Aktumen/Polygon.html
|
||||
|
||||
* Bressoud - FTC
|
||||
http://www.math.harvard.edu/~knill/teaching/math1a_2011/exhibits/bressoud/
|
||||
|
||||
* [Katz](http://www.jstor.org/stable/2689856) and [Katz](https://www.jstor.org/stable/2690275)
|
||||
|
||||
|
||||
|
||||
## Websites
|
||||
|
||||
* Math insight https://mathinsight.org/ has many informative pages to peruse
|
||||
|
||||
* http://www.math.wpi.edu/IQP/BVCalcHist/calc4.html#_Toc407004376
|
||||
|
||||
* earliest uses of symbols in calculus
|
||||
http://jeff560.tripod.com/calculus.html
|
||||
|
||||
* Famous curves index https://www-history.mcs.st-and.ac.uk/Curves/Curves.html. See also [Kokoska](https://elepa.files.wordpress.com/2013/11/fifty-famous-curves.pdf).
|
||||
|
||||
## Videos
|
||||
|
||||
* https://www.coursera.org/learn/calculus1
|
||||
|
||||
* http://ocw.mit.edu/resources/res-18-005-highlights-of-calculus-spring-2010/
|
||||
|
||||
* http://ocw.mit.edu/courses/mathematics/18-01sc-single-variable-calculus-fall-2010/
|
||||
|
||||
* draining conical tank
|
||||
https://www.youtube.com/watch?v=2jQ1jA8uJuU
|
||||
|
||||
* proof of trapezoid rule
|
||||
http://www.maa.org/sites/default/files/An_Elementary_Proof30705.pdf
|
||||
|
||||
* Some notes on `Plots.jl`
|
||||
https://www.math.purdue.edu/~allen450/Plotting-Tutorial.html
|
||||
170
quarto/misc/calculus_with_julia.qmd
Normal file
170
quarto/misc/calculus_with_julia.qmd
Normal file
@@ -0,0 +1,170 @@
|
||||
# The `CalculusWithJulia` package
|
||||
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
|
||||
import Logging
|
||||
Logging.disable_logging(Logging.Info) # or e.g. Logging.Info
|
||||
Logging.disable_logging(Logging.Warn)
|
||||
|
||||
import SymPy
|
||||
function Base.show(io::IO, ::MIME"text/html", x::T) where {T <: SymPy.SymbolicObject}
|
||||
println(io, "<span class=\"math-left-align\" style=\"padding-left: 4px; width:0; float:left;\"> ")
|
||||
println(io, "\\[")
|
||||
println(io, sympy.latex(x))
|
||||
println(io, "\\]")
|
||||
println(io, "</span>")
|
||||
end
|
||||
|
||||
# hack to work around issue
|
||||
import Markdown
|
||||
import CalculusWithJulia
|
||||
function CalculusWithJulia.WeaveSupport.ImageFile(d::Symbol, f::AbstractString, caption; kwargs...)
|
||||
nm = joinpath("..", string(d), f)
|
||||
u = ""
|
||||
Markdown.parse(u)
|
||||
end
|
||||
|
||||
nothing
|
||||
```
|
||||
|
||||
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`. 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 can be done with this key sequence:
|
||||
|
||||
|
||||
```{julia}
|
||||
#| eval: false
|
||||
] add CalculusWithJulia
|
||||
```
|
||||
|
||||
Or, using the `Pkg` package, the commands would be
|
||||
|
||||
|
||||
```{julia}
|
||||
#| eval: false
|
||||
import Pkg
|
||||
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:
|
||||
|
||||
|
||||
```{julia}
|
||||
using CalculusWithJulia
|
||||
```
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
#| results: "hidden"
|
||||
using CalculusWithJulia.WeaveSupport
|
||||
```
|
||||
|
||||
That is all. The rest of this page just provides some details for the interested reader.
|
||||
|
||||
|
||||
## The package concept
|
||||
|
||||
|
||||
The `Julia` language provides the building blocks for the wider `Julia` ecosystem that enhance and extend the language's applicability.
|
||||
|
||||
|
||||
`Julia` is extended through "packages." Some of these, such as packages for certain math constants and some linear algebra operations, are part of all `Julia` installations and must simple by loaded to be used. Others, such as packages for finding integrals or (automatic) derivatives are provided by users and must first be *installed* before being used.
|
||||
|
||||
|
||||
### Package installation
|
||||
|
||||
|
||||
Package installation is straightforward, as `Julia` has a package, `Pkg`, that facilitates this.
|
||||
|
||||
|
||||
Since `Julia` version 1.7, just attempting to load a package through `using PackageName` at the *command line* will either load an installed package *or* query for an uninstalled package to be installed before lading. So installation just requires confirming a prompt.
|
||||
|
||||
|
||||
For more control, the command line and `IJulia` provide access to the function in `Pkg` through the escape command `]`. For example, to find the status of all currently installed packages, the following command can be executed:
|
||||
|
||||
|
||||
```{julia}
|
||||
#| eval: false
|
||||
] status
|
||||
```
|
||||
|
||||
External packages are *typically* installed from GitHub and if they are regisered, installation is as easy as calling `add`:
|
||||
|
||||
|
||||
```{julia}
|
||||
#| eval: false
|
||||
] add QuadGK
|
||||
```
|
||||
|
||||
That command will consult `Julia`'s general registry for the location of the `QuadGK` package, use this location to download the necessary files, if necessary dependencies will be built and installed, and then the package available for use.
|
||||
|
||||
|
||||
For these notes, when the `CalculusWithJulia` package is installed it will also install many of the other packages that are needed.
|
||||
|
||||
|
||||
See [Pkg](https://docs.julialang.org/en/v1/stdlib/Pkg/index.html) for more details, such as how to update the set of available packages.
|
||||
|
||||
|
||||
### Using a package
|
||||
|
||||
|
||||
The features of an installed package are not available until the package is brought into the current session. A package need only be *installed* once, but must be loaded each session.
|
||||
|
||||
|
||||
To load a package, the `using` keyword is provided:
|
||||
|
||||
|
||||
```{julia}
|
||||
using QuadGK
|
||||
```
|
||||
|
||||
The above command will make available all *exported* function names from the `QuadGK` package so they can be directly used, as in:
|
||||
|
||||
|
||||
```{julia}
|
||||
quadgk(sin, 0, pi)
|
||||
```
|
||||
|
||||
(A command to find an integral of $f(x) = \sin(x)$ over $[0, \pi]$.)
|
||||
|
||||
|
||||
### Package details
|
||||
|
||||
|
||||
When a package is *first* loaded after installation, or some other change, it will go through a *pre-compilation* process. Depending on the package size, this can take a moment to several seconds. This won't happen the second time a package is loaded.
|
||||
|
||||
|
||||
However, subsequent times a package is loaded some further compilation is done, so it can still take some time for a package to load. Mostly this is not noticeable, though with the plotting package used in these notes, it is.
|
||||
|
||||
|
||||
When a package is loaded, all of its dependent packages are also loaded, but their functions are not immediately available to the user.
|
||||
|
||||
|
||||
In *typical* `Julia` usage, each needed package is loaded on demand. This is faster and also keeps the namespace (the collection of variable and function names) smaller to avoid collisions. However, for these notes, the package `CalculusWithJulia` will load a few of the packages needed for the entire set of notes, not just the current section. This is to make it a bit *easier* for the *beginning* user.
|
||||
|
||||
|
||||
One issue with loading several packages is the possibility that more than one will export a function with the same name, causing a collision. Moreover, at times, there can be dependency conflicts between packages. A suggested workflow is to use projects and in each project use a minimal set of packages. In Pluto, this is done behind the scenes.
|
||||
|
||||
|
||||
The `Julia` language is designed around have several "generic" functions each with many different methods depending on their usage. This design allows many different implementations for operations such as addition or multiplication yet the user only needs to call one function name. Packages can easily extend these generic functions by providing their own methods for their own new types of data. For example, `SymPy`, which adds symbolic math features to `Julia` (using a Python package) extends both `+` and `*` for use with symbolic objects.
|
||||
|
||||
|
||||
This design works great when the "generic" usage matches the needs of the package authors, but there are two common issues that arise:
|
||||
|
||||
|
||||
* The extension of a generic is for a type defined outside the author's package. This is known as "type piracy" and is frowned on, as it can lead to subtle errors. The `CalculusWithJulia` package practices this for one case: using `'` to indicate derivatives for `Function` objects.
|
||||
* The generic function concept is not part of base `Julia`. An example might be the `solve` function. This name has a well-defined mathematical usage (e.g., "solve for $x$."), but the generic concept is not part of base `Julia`. As it is used by `SymPy` and `DifferentialEquations`, among others, the ecosystem has a stub package `CommonSolve` allowing the sharing of this "verb."
|
||||
|
||||
|
||||
132
quarto/misc/getting_started_with_julia.qmd
Normal file
132
quarto/misc/getting_started_with_julia.qmd
Normal file
@@ -0,0 +1,132 @@
|
||||
# Getting started with Julia
|
||||
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
|
||||
import Logging
|
||||
Logging.disable_logging(Logging.Info) # or e.g. Logging.Info
|
||||
Logging.disable_logging(Logging.Warn)
|
||||
|
||||
import SymPy
|
||||
function Base.show(io::IO, ::MIME"text/html", x::T) where {T <: SymPy.SymbolicObject}
|
||||
println(io, "<span class=\"math-left-align\" style=\"padding-left: 4px; width:0; float:left;\"> ")
|
||||
println(io, "\\[")
|
||||
println(io, sympy.latex(x))
|
||||
println(io, "\\]")
|
||||
println(io, "</span>")
|
||||
end
|
||||
|
||||
# hack to work around issue
|
||||
import Markdown
|
||||
import CalculusWithJulia
|
||||
function CalculusWithJulia.WeaveSupport.ImageFile(d::Symbol, f::AbstractString, caption; kwargs...)
|
||||
nm = joinpath("..", string(d), f)
|
||||
u = ""
|
||||
Markdown.parse(u)
|
||||
end
|
||||
|
||||
nothing
|
||||
```
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
#| results: "hidden"
|
||||
using CalculusWithJulia
|
||||
using CalculusWithJulia.WeaveSupport
|
||||
nothing
|
||||
```
|
||||
|
||||
Julia is a freely available, open-source programming language aimed at technical computing.
|
||||
|
||||
|
||||
As it is open source, indeed with a liberal MIT license, it can be installed for free on many types of computers (though not phones or tablets).
|
||||
|
||||
|
||||
## 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.
|
||||
|
||||
|
||||
[lauch 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.
|
||||
|
||||
|
||||
## Installing Julia locally
|
||||
|
||||
|
||||
Installing `Julia` locally is not more difficult than installing other software.
|
||||
|
||||
|
||||
Binaries of `Julia` are provided at [julialang.org](http://julialang.org/downloads/). Julia has an official released version and a developmental version. Unless there is a compelling reason, the latest released version should be downloaded and installed for use.
|
||||
|
||||
|
||||
For Windows users, there is a `juliaup` program for managing the installation of Julia.
|
||||
|
||||
|
||||
The base `Julia` provides a *command-line interface*, or REPL (read-evaluate-parse).
|
||||
|
||||
|
||||
## Basic interactive usage
|
||||
|
||||
|
||||
Once installed, `Julia` can be started by clicking on an icon or typing `julia` at the command line. Either will open a *command line interface* for a user to interact with a `Julia` process. The basic workflow is easy: commands are typed then sent to a `Julia` process when the "return" key is pressed for a complete expression. Then the output is displayed.
|
||||
|
||||
|
||||
A command is typed following the *prompt*. An example might be `2 + 2`. To send the command to the `Julia` interpreter the "return" key is pressed. A complete expression or expressions will then be parsed and evaluated (executed). If the expression is not complete, `julia`'s prompt will still accept input to complete the expression. Type `2 +` to see. (The expression `2 +` is not complete, as the infix operator `+` expects two arguments, one on its left and one on its right.)
|
||||
|
||||
|
||||
```{julia}
|
||||
#| eval: false
|
||||
_
|
||||
_ _ _(_)_ | Documentation: https://docs.julialang.org
|
||||
(_) | (_) (_) |
|
||||
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
|
||||
| | | | | | |/ _` | |
|
||||
| | |_| | | | (_| | | Version 1.7.0 (2021-11-30)
|
||||
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|
||||
|__/ |
|
||||
|
||||
julia> 2 + 2
|
||||
4
|
||||
```
|
||||
|
||||
Above, `julia>` is the prompt. These notes will not include the prompt, so that copying-and-pasting can be more easily used. Input and output cells display similarly, though with differences in coloring. For example:
|
||||
|
||||
|
||||
```{julia}
|
||||
2 + 2
|
||||
```
|
||||
|
||||
While many prefer a command line for interacting with `Julia`, when learning a notebook interfaces is suggested. (An IDE like [Julia for Visual Studio Code](https://www.julia-vscode.org/) might be preferred for experienced programmers). In [Julia interfaces](./julia_interfaces.html), we describe two different notebook interfaces that are available through add-on packages.
|
||||
|
||||
|
||||
## Add-on packages
|
||||
|
||||
|
||||
`Julia` is well on its way towards 10,000 external add-on packages that enhance the offerings of base `Julia`. We refer to one, `CalculusWithJulia`, that is designed to accompany these notes. [Installation notes](./calculus_with_julia.html) are available.
|
||||
|
||||
|
||||
In `Julia` graphics are provided only by add-on packages – there is no built-in graphing. This is the case under `Pluto` or `Jupyter` or the command line.
|
||||
|
||||
|
||||
In these notes, we use the `Plots` package and its default backend. The `Plots` package provides a common interface to several different backends; this choice is easily changed. The `gr` backend is used in these notes, though for interactive use the `Plotly` backend has advantages; for more complicated graphics, `pyplot` has some advantages; for publication `PGFPlotsX` has advantages.
|
||||
|
||||
|
||||
The package, if installed, is loaded as any other package:
|
||||
|
||||
|
||||
```{julia}
|
||||
using Plots
|
||||
```
|
||||
|
||||
With that in hand, to make a graph of a function over a range, we follow this pattern:
|
||||
|
||||
|
||||
```{julia}
|
||||
plot(sin, 0, 2pi)
|
||||
```
|
||||
|
||||
176
quarto/misc/julia_interfaces.qmd
Normal file
176
quarto/misc/julia_interfaces.qmd
Normal file
@@ -0,0 +1,176 @@
|
||||
# Julia interfaces
|
||||
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
|
||||
import Logging
|
||||
Logging.disable_logging(Logging.Info) # or e.g. Logging.Info
|
||||
Logging.disable_logging(Logging.Warn)
|
||||
|
||||
import SymPy
|
||||
function Base.show(io::IO, ::MIME"text/html", x::T) where {T <: SymPy.SymbolicObject}
|
||||
println(io, "<span class=\"math-left-align\" style=\"padding-left: 4px; width:0; float:left;\"> ")
|
||||
println(io, "\\[")
|
||||
println(io, sympy.latex(x))
|
||||
println(io, "\\]")
|
||||
println(io, "</span>")
|
||||
end
|
||||
|
||||
# hack to work around issue
|
||||
import Markdown
|
||||
import CalculusWithJulia
|
||||
function CalculusWithJulia.WeaveSupport.ImageFile(d::Symbol, f::AbstractString, caption; kwargs...)
|
||||
nm = joinpath("..", string(d), f)
|
||||
u = ""
|
||||
Markdown.parse(u)
|
||||
end
|
||||
|
||||
nothing
|
||||
```
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
#| results: "hidden"
|
||||
using CalculusWithJulia
|
||||
using CalculusWithJulia.WeaveSupport
|
||||
using Plots
|
||||
nothing
|
||||
```
|
||||
|
||||
`Julia` can be used in many different manners. This page describes a few.
|
||||
|
||||
|
||||
## The `REPL`
|
||||
|
||||
|
||||
Base `Julia` comes with a `REPL` package, which provides a means to interact with `Julia` at the command line.
|
||||
|
||||
|
||||
```{julia}
|
||||
#| eval: false
|
||||
_
|
||||
_ _ _(_)_ | Documentation: https://docs.julialang.org
|
||||
(_) | (_) (_) |
|
||||
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
|
||||
| | | | | | |/ _` | |
|
||||
| | |_| | | | (_| | | Version 1.7.0 (2021-11-30)
|
||||
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|
||||
|__/ |
|
||||
|
||||
julia> 2 + 2
|
||||
4
|
||||
```
|
||||
|
||||
The `julia>` prompt is where commands are typed. The `return` key will send a command to the interpreter and the results are displayed in the REPL terminal.
|
||||
|
||||
|
||||
The REPL has many features for editing, for interacting with the package manager, or interaction with the shell. However it is command-line based, which no support for mouse interaction. For that, other options are available.
|
||||
|
||||
|
||||
## `Pluto`
|
||||
|
||||
|
||||
The `Pluto` package provides a notebook interface for interacting with `Julia`, which has a few idiosyncrasies, as compared to other interfaces.
|
||||
|
||||
|
||||
Pluto is started from the REPL terminal with these two commands:
|
||||
|
||||
|
||||
```{julia}
|
||||
#| eval: false
|
||||
using Pluto
|
||||
Pluto.run()
|
||||
```
|
||||
|
||||
Primarily, the variables in the notebook are **reactive**, meaning if a variable's value is modified, all references to that variables are also modified. This reactive nature makes it very easy to see the results of slight modifications and when coupled with HTML controls, allows easy user interfaces to be developed.
|
||||
|
||||
|
||||
As a result, a variable name may only be used once in the top-level scope. (Names can be reused inside functions, which create their own scope and in "`let`" blocks, a trick used within these notes.) In the notes, subscripting and unicode variants are used for symbols which are typically repurposed (e.g., `x` or `f`).
|
||||
|
||||
|
||||
Pluto cells may only contain one command, the result of which is displayed *above* the cell. This one command can be a `begin` or `let` block to join multiple statements.
|
||||
|
||||
|
||||
Pluto has a built-in package management system that manages the installation of packages on demand.
|
||||
|
||||
|
||||
`Pluto` notebooks can be easily run locally using `Pluto`.
|
||||
|
||||
|
||||
`Pluto` notebooks are just `.jl` scripts, so can easily be shared.
|
||||
|
||||
|
||||
## `IJulia`
|
||||
|
||||
|
||||
"Project [Jupyter](https://jupyter.org/) exists to develop open-source software, open-standards, and services for interactive computing across dozens of programming languages." The `IJulia` package allows `Julia` to be one of these programming languages. This package must be installed prior to use.
|
||||
|
||||
|
||||
The Jupyter Project provides two web-based interfaces to `Julia`: the Jupyter notebook and the newer JupyterLab. The 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)
|
||||
|
||||
|
||||
To run locally, these interfaces are available once `IJulia` is installed. Since version 1.7, the following commands should do this:
|
||||
|
||||
|
||||
```{julia}
|
||||
#| eval: false
|
||||
using IJulia
|
||||
notebook()
|
||||
```
|
||||
|
||||
Should that not work, then this should as well:
|
||||
|
||||
|
||||
```{julia}
|
||||
#| eval: false
|
||||
using Pkg
|
||||
Pkg.add("PyCall")
|
||||
Pkg.add("IJulia")
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
||||
The notebook interface has "cells" where one or more commands can be entered.
|
||||
|
||||
|
||||
In `IJulia`, a block of commands is sent to the kernel (the `Julia` interpreter) by typing "shift+return" or clicking on a "run" button. The output is printed below a cell, including graphics.
|
||||
|
||||
|
||||
When a cell is evaluating, the leading `[]` has an asterick (`[*]`) showing the notebook is awaiting the results of the calculation.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
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`, ...).
|
||||
|
||||
|
||||
To run all cells in a notebook from top to bottom, the "run all" command under the "Cell" menu is available.
|
||||
|
||||
|
||||
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".
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
JupyterLab, a variant, has more features, commonly associated with an integrated development environment (IDE).
|
||||
|
||||
|
||||
## VSCode
|
||||
|
||||
|
||||
[Julia for Visual Studio Code](https://www.julia-vscode.org/) provides support for the julia programming language for [VS Code](https://code.visualstudio.com/). VS Code is an open-sourced code editor supported by Microsoft. VS Code provides a cross-platform interface to `Julia` geared towards programming within the language.
|
||||
|
||||
|
||||
BIN
quarto/misc/logo-60-by-48.png
Normal file
BIN
quarto/misc/logo-60-by-48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
53
quarto/misc/logo.jl
Normal file
53
quarto/misc/logo.jl
Normal file
@@ -0,0 +1,53 @@
|
||||
using Plots
|
||||
|
||||
# https://github.com/JuliaLang/julia-logo-graphics
|
||||
blue, green, purple, red = :royalblue, :forestgreen, :mediumorchid3, :brown3
|
||||
|
||||
|
||||
function archimedes!(p, n, xy=(0,0), radius=1; color=blue)
|
||||
|
||||
x₀,y₀=xy
|
||||
ts = range(0, 2pi, length=100)
|
||||
|
||||
plot!(p, x₀ .+ sin.(ts), y₀ .+ cos.(ts), linewidth=2)
|
||||
|
||||
α = ((2π)/n)/2
|
||||
αs = (-pi/2 + α):2α:(3pi/2 + α)
|
||||
r = radius/cos(α)
|
||||
|
||||
xs = x₀ .+ r*cos.(αs)
|
||||
ys = y₀ .+ r*sin.(αs)
|
||||
|
||||
plot!(p, xs, ys,
|
||||
fill=true,
|
||||
fillcolor=color,
|
||||
alpha=0.4)
|
||||
|
||||
r = radius
|
||||
xs = x₀ .+ r*cos.(αs)
|
||||
ys = y₀ .+ r*sin.(αs)
|
||||
|
||||
plot!(p, xs, ys,
|
||||
fill=true,
|
||||
fillcolor=color,
|
||||
alpha=0.8)
|
||||
|
||||
p
|
||||
end
|
||||
|
||||
gr()
|
||||
Δ = 2.75
|
||||
p = plot(;xlims=(-Δ,Δ), ylims=(-Δ,Δ),
|
||||
axis=nothing,
|
||||
xaxis=false,
|
||||
yaxis=false,
|
||||
legend=false,
|
||||
padding = (0.0, 0.0),
|
||||
background_color = :transparent,
|
||||
foreground_color = :black,
|
||||
aspect_ratio=:equal)
|
||||
archimedes!(p, 5, (-1.5, -1); color=red )
|
||||
archimedes!(p, 8, (0, 1); color=green )
|
||||
archimedes!(p, 13, (1.5, -1); color=purple )
|
||||
|
||||
savefig(p, "logo.png")
|
||||
BIN
quarto/misc/logo.png
Normal file
BIN
quarto/misc/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
1336
quarto/misc/quick_notes.qmd
Normal file
1336
quarto/misc/quick_notes.qmd
Normal file
File diff suppressed because it is too large
Load Diff
399
quarto/misc/toc.qmd
Normal file
399
quarto/misc/toc.qmd
Normal file
@@ -0,0 +1,399 @@
|
||||
```{julia}
|
||||
#| echo: false
|
||||
import CalculusWithJulia
|
||||
logo_url = "https://raw.githubusercontent.com/jverzani/CalculusWithJulia.jl/master/CwJ/misc/logo.png"
|
||||
txt = """
|
||||
<div class="card" style="width: 18rem; mx-auto;">
|
||||
<img class="card-img-top" src="$logo_url" alt="Card image cap">
|
||||
</div>
|
||||
"""
|
||||
CalculusWithJulia.WeaveSupport.HTMLoutput(txt)
|
||||
```
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
|
||||
import Logging
|
||||
Logging.disable_logging(Logging.Info) # or e.g. Logging.Info
|
||||
Logging.disable_logging(Logging.Warn)
|
||||
|
||||
import SymPy
|
||||
function Base.show(io::IO, ::MIME"text/html", x::T) where {T <: SymPy.SymbolicObject}
|
||||
println(io, "<span class=\"math-left-align\" style=\"padding-left: 4px; width:0; float:left;\"> ")
|
||||
println(io, "\\[")
|
||||
println(io, sympy.latex(x))
|
||||
println(io, "\\]")
|
||||
println(io, "</span>")
|
||||
end
|
||||
|
||||
# hack to work around issue
|
||||
import Markdown
|
||||
import CalculusWithJulia
|
||||
function CalculusWithJulia.WeaveSupport.ImageFile(d::Symbol, f::AbstractString, caption; kwargs...)
|
||||
nm = joinpath("..", string(d), f)
|
||||
u = ""
|
||||
Markdown.parse(u)
|
||||
end
|
||||
|
||||
nothing
|
||||
```
|
||||
|
||||
# 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.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
There are many examples of integrating a computer algebra system (such as `Mathematica`, `Maple`, or `Sage`) into the calculus conversation. Computer algebra systems can be magical. The popular [WolframAlpha](http://www.wolframalpha.com/) website calls the full power of `Mathematica` while allowing an informal syntax that is flexible enough to be used as a backend for Apple's Siri feature. ("Siri what is the graph of x squared minus 4?") For learning purposes, computer algebra systems model very well the algebraic/symbolic treatment of the material while providing means to illustrate the numeric aspects. Theses notes are a bit different in that `Julia` is primarily used for the numeric style of computing and the algebraic/symbolic treatment is added on. Doing the symbolic treatment by hand can be very beneficial while learning, and computer algebra systems make those exercises seem kind of pointless, as the finished product can be produced much easier.
|
||||
|
||||
|
||||
Our real goal is to get at the concepts using technology as much as possible without getting bogged down in the mechanics of the computer language. We feel `Julia` has a very natural syntax that makes the initial start up not so much more difficult than using a calculator. The notes restrict themselves to a reduced set of computational concepts. This set is sufficient for working many of the problems in calculus, but do not cover thoroughly many aspects of programming. (Those who are interested can go off on their own and `Julia` provides a rich opportunity to do so.) Within this restricted set, are operators that make many of the computations of calculus reduce to a function call of the form `action(function, arguments...)`. With a small collection of actions that can be composed, many of the problems associated with introductory calculus can be attacked.
|
||||
|
||||
|
||||
These notes are presented in pages covering a fairly focused concept, in a spirit similar to a section of a book. Just like a book, there are try-it-yourself questions at the end of each page. All have a limited number of self-graded answers. These notes borrow ideas from many sources including [Strang](https://ocw.mit.edu/resources/res-18-001-calculus-online-textbook-spring-2005/), [Knill](http://www.math.harvard.edu/~knill/teaching), [Schey](https://www.amazon.com/Div-Grad-Curl-All-That/dp/0393925161/), Thomas Calculus, Rogawski and Adams, and several Wikipedia pages.
|
||||
|
||||
|
||||
## Getting started with Julia
|
||||
|
||||
|
||||
Before beginning, we need to get started with Julia. This is akin to going out and buying a calculator, though it won't take as long.
|
||||
|
||||
|
||||
* [Getting started](misc/getting_started_with_julia.html)
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
[launch binder](https://mybinder.org/v2/gh/CalculusWithJulia/CwJScratchPad.git/master)
|
||||
|
||||
|
||||
Julia can be used through the internet for free using the [mybinder.org](https://mybinder.org) service. Click on the `CalculusWithJulia.ipynb` file after launching Binder by clicking on the badge.
|
||||
|
||||
|
||||
## Precalculus
|
||||
|
||||
|
||||
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).
|
||||
|
||||
|
||||
### Number systems
|
||||
|
||||
|
||||
Taking for granted a familiarity with basic calculators, we show in these two sections how `Julia` implements the functionality of a calculator in a manner not so different.
|
||||
|
||||
|
||||
* [Calculator](precalc/calculator.html)
|
||||
* [Variables](precalc/variables.html)
|
||||
|
||||
|
||||
Calculators really only use one type of number - floating point numbers. Floating point numbers are a model for the real numbers. However, there are many different sets of numbers in mathematics. Common ones include the integers, rational numbers, real numbers, and complex numbers. As well, we discuss logical values and vectors of numbers. Though integers are rational numbers, rational numbers are real numbers, and real numbers may be viewed as complex numbers, mathematically, these distinctions serve a purpose. `Julia` also makes these distinctions and more.
|
||||
|
||||
|
||||
* [Number systems](precalc/numbers_types.html)
|
||||
* [Inequalities and Boolean values](precalc/logical_expressions.html)
|
||||
|
||||
|
||||
Vectors as a mathematical object could be postponed for later, but they are introduced here as the `Julia` implementation makes an excellent choice for a container of one or more values. We also see how to work with more than one value at a time, a useful facility in future work.
|
||||
|
||||
|
||||
* [Vectors](precalc/vectors.html)
|
||||
|
||||
|
||||
An arithmetic progression is a sequence of the form $a, a+h, a+2h, \dots, a+kh$. For example $3, 10, 17, 24, .., 52$. They prove very useful in describing collections of numbers. We introduce the range operator that models these within `Julia` and broadcasting, mapping, and comprehensions – various styles that allow one to easily modify the simple sequences.
|
||||
|
||||
|
||||
* [Arithmetic progressions](precalc/ranges.html)
|
||||
|
||||
|
||||
### Functions
|
||||
|
||||
|
||||
The use of functions within calculus is widespread. This section shows how the basic usage within `Julia` follows very closely to common mathematical usage. It also shows that the abstract concept of a function is quite valuable.
|
||||
|
||||
|
||||
* [Functions](precalc/functions.html)
|
||||
|
||||
|
||||
A graphing calculator makes it very easy to produce a graph. `Julia`, using the `Plots` package, makes it even easier and more flexible.
|
||||
|
||||
|
||||
* [Graphs of functions](precalc/plotting.html)
|
||||
* [Transformations of functions](precalc/transformations.html)
|
||||
* [Inverse functions](precalc/inversefunctions.html)
|
||||
|
||||
|
||||
#### Polynomials
|
||||
|
||||
|
||||
Polynomials play an important role in calculus. They give a family of functions for which the basic operations are well understood. In addition, they can be seen to provide approximations to functions. This section discusses polynomials and introduces the add-on package `SymPy` for manipulating expressions in `Julia` symbolically. (This package uses the SymPy library from Python.)
|
||||
|
||||
|
||||
* [Polynomials](precalc/polynomial.html)
|
||||
|
||||
|
||||
The roots of a univariate polynomial are the values of $x$ for which $p(x)=0$. Roots are related to its factors. In calculus, the zeros of a derived function are used to infer properties of a function. This section shows some tools in `SymPy` to find factors and roots, when they are available, and introduces the `Roots` package for estimating roots numerically.
|
||||
|
||||
|
||||
* [Polynomial roots](precalc/polynomial_roots.html)
|
||||
|
||||
|
||||
The `Polynomials` package provides methods for working with polynomials of different types.
|
||||
|
||||
|
||||
* [The `Polynomials` package](precalc/polynomials_package.html)
|
||||
|
||||
|
||||
A rational expression is the ratio of two polynomial expressions. This section covers some additional details that arise when graphing such expressions.
|
||||
|
||||
|
||||
* [Rational functions](precalc/rational_functions.html)
|
||||
|
||||
|
||||
#### Exponential and logarithmic functions
|
||||
|
||||
|
||||
* [Exponential and logarithmic functions](precalc/exp_log_functions.html)
|
||||
|
||||
|
||||
#### Trigonometric functions
|
||||
|
||||
|
||||
Trigonometric functions are used to describe triangles, circles and oscillatory behaviors. This section provide a brief review.
|
||||
|
||||
|
||||
* [Trigonometric functions](precalc/trig_functions.html)
|
||||
|
||||
|
||||
## Limits and Continuity
|
||||
|
||||
|
||||
The notion of a limit is at the heart of the two main operations of calculus: differentiation and integration.
|
||||
|
||||
|
||||
* [Limits](limits/limits.html)
|
||||
* [Examples and extensions of the basic limit definition](limits/limits_extensions.html)
|
||||
|
||||
|
||||
Continuous functions are at the center of any discussion of calculus concepts. These sections define them and illustrate a few implications for continuous functions.
|
||||
|
||||
|
||||
* [Continuity](limits/continuity.html)
|
||||
* [Implications of continuity](limits/intermediate_value_theorem.html) includes the intermediate value theorem, the extreme value theorem and the bisection method.
|
||||
|
||||
|
||||
## Derivatives
|
||||
|
||||
|
||||
The derivative of a function is a derived function that for each $x$ yields the slope of the *tangent line* of the graph of $f$ at $(x,f(x))$.
|
||||
|
||||
|
||||
* [Derivatives](derivatives/derivatives.html)
|
||||
* [Numeric derivatives](derivatives/numeric_derivatives.html)
|
||||
* [Symbolic derivatives](derivatives/symbolic_derivatives.html)
|
||||
|
||||
|
||||
The derivative of a function has certain features. These next sections explore one of the first uses of the derivative - using its zeros to characterize the original function.
|
||||
|
||||
|
||||
* [The Mean Value Theorem](derivatives/mean_value_theorem.html)
|
||||
* [Optimization](derivatives/optimization.html)
|
||||
* [First and second derivatives](derivatives/first_second_derivatives.html)
|
||||
* [Curve sketching](derivatives/curve_sketching.html)
|
||||
|
||||
|
||||
The tangent line to the graph of a function at a point has slope given through the derivative. That the tangent line is the best linear approximation to the curve yields some insight to the curve through knowledge of just the tangent lines.
|
||||
|
||||
|
||||
* [Linearization](derivatives/linearization.html)
|
||||
* [Newton's method](derivatives/newtons_method.html)
|
||||
* [Derivative-free zero-finding methods](derivatives/more_zeros.html)
|
||||
* [L'Hospital's rule](derivatives/lhospitals_rule.html)
|
||||
|
||||
|
||||
The derivative finds use outside of the traditional way of specifying a function or relationship. These two sections look at some different cases.
|
||||
|
||||
|
||||
* [Implicit differentiation](derivatives/implicit_differentiation.html)
|
||||
* [Related rates](derivatives/related_rates.html)
|
||||
|
||||
|
||||
A generalization of the tangent line as the "best" approximation to a function by a line leads to the concept of the Taylor polynomial.
|
||||
|
||||
|
||||
* [Taylor polynomials](derivatives/taylor_series_polynomials.html)
|
||||
|
||||
|
||||
## Integration
|
||||
|
||||
|
||||
The integral is initially defined in terms of an associated area and then generalized. The Fundamental Theorem of Calculus allows this area to be computed easily through a related function and specifies the relationship between the integral and the derivative.
|
||||
|
||||
|
||||
* [Area](integrals/area.html)
|
||||
* [The Fundamental Theorem of Calculus](integrals/ftc.html)
|
||||
|
||||
|
||||
Integration is not algorithmic, but rather problems can involve an array of techniques. Many of these are implemented in `SymPy`. Theses sections introduce the main techniques that find widespread usage.
|
||||
|
||||
|
||||
* [Substitution](integrals/substitution.html)
|
||||
* [Integration by parts](integrals/integration_by_parts.html)
|
||||
* [Partial fractions](integrals/partial_fractions.html)
|
||||
* [Improper integrals](integrals/improper_integrals.html)
|
||||
|
||||
|
||||
### Applications
|
||||
|
||||
|
||||
Various applications of the integral are presented. The first two sections continue with the idea that an integral is related to area. From there, it is seen that volumes, arc-lengths, and surface areas may be expressed in terms of related integrals.
|
||||
|
||||
|
||||
* [Mean Value Theorem for integrals](integrals/mean_value_theorem.html)
|
||||
* [Area between curves](integrals/area_between_curves.html)
|
||||
* [Center of mass](integrals/center_of_mass.html)
|
||||
* [Volumes by slicing](integrals/volumes_slice.html)
|
||||
* [Arc length](integrals/arc_length.html)
|
||||
* [Surface Area](integrals/surface_area.html)
|
||||
|
||||
|
||||
### Ordinary differential equations
|
||||
|
||||
|
||||
Ordinary differential equations are an application of integration and the fundamental theorem of calculus.
|
||||
|
||||
|
||||
* [ODEs](ODEs/odes.html)
|
||||
* [Euler method](ODEs/euler.html)
|
||||
* [The problem-algorithm-solve interface](ODEs/solve.html)
|
||||
* [The DifferentialEquations suite of packages](ODEs/differential_equations.html)
|
||||
|
||||
|
||||
## Multivariable calculus
|
||||
|
||||
|
||||
Univariate functions take a single number as an input and return a number as the output. Notationally, we write $f: R \rightarrow R$. More generally, a function might have several input variables and might return several output variables, notationally $F: R^n \rightarrow R^m$, for positive, integer values of $n$ and $m$. Special cases are when $n=1$ (a space curve) or when $m=1$ (a scalar-valued function). Many of the concepts of calculus for univariate functions carry over, with suitable modifications.
|
||||
|
||||
|
||||
Polar coordinates are an often useful alternative to describing location in the $x$-$y$ plane.
|
||||
|
||||
|
||||
* [Polar Coordinates](differentiable_vector_calculus/polar_coordinates.html)
|
||||
|
||||
|
||||
The calculus of functions involving more than $1$ variable is greatly simplified by the introduction of vectors and matrices. These objects, and their associated properties, allow many of the concepts of calculus of a single variable to be carried over.
|
||||
|
||||
|
||||
* [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)
|
||||
* [Scalar functions and their derivatives](differentiable_vector_calculus/scalar_functions.html)
|
||||
|
||||
|
||||
We discuss applications of the derivative for scalar functions. These include linearization, optimization, and constrained optimization.
|
||||
|
||||
|
||||
* [Applications for scalar functions](differentiable_vector_calculus/scalar_functions_applications.html)
|
||||
|
||||
|
||||
The derivative of a mulitvariable function is discussed here. We will see that with the proper notation, many formulas from single variable calculus will hold with slight modifications.
|
||||
|
||||
|
||||
* [Vector fields](differentiable_vector_calculus/vector_fields.html)
|
||||
|
||||
|
||||
### 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.
|
||||
|
||||
|
||||
We begin with the generalization of the Riemann integral to compute area to the computation of volume and its higher dimensional interpretations.
|
||||
|
||||
|
||||
* [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](integral_vector_calculus/line_integrals.html)
|
||||
|
||||
|
||||
There are three main operations in differential vector calculus, the gradient, the divergence, and the curl. This is an introduction to the two latter ones.
|
||||
|
||||
|
||||
* [Divergence and curl](integral_vector_calculus/div_grad_curl.html)
|
||||
|
||||
|
||||
The fundamental theorem of calculus states that a definite integral over an interval can be computed using a related function and the boundary points of the interval. The fundamental theorem of line integrals is a higher dimensional analog. In this section, related theorems are considered: Green's theorem in $2$ dimensions and Stokes' theorem and the divergence theorem in $3$ dimensions.
|
||||
|
||||
|
||||
* [Green's theorem, Stokes' theorem, and the divergence theorem](integral_vector_calculus/stokes_theorem.html)
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
Here is a quick review of the math topics discussed on vector calculus.
|
||||
|
||||
|
||||
* [Review of vector calculus](integral_vector_calculus/review.html)
|
||||
|
||||
|
||||
For reference purposes, there are examples of creating graphics for `Plots`,`Makie`, and `PlotlyLight`.
|
||||
|
||||
|
||||
* [Two- and three-dimensional graphics with Plots](differentiable_vector_calculus/plots_plotting.html)
|
||||
* [Two- and three-dimensional graphics with Makie](alternatives/makie_plotting.html)
|
||||
* [Two- and three-dimensional graphics with PlotlyLight](alternatives/plotly_plotting.html)
|
||||
|
||||
|
||||
## Bibliography
|
||||
|
||||
|
||||
* [Bibliography](misc/bibliography.html)
|
||||
|
||||
|
||||
## A quick review
|
||||
|
||||
|
||||
* [Quick notes](misc/quick_notes.html)
|
||||
|
||||
|
||||
A review of the `Julia` concepts used within these notes.
|
||||
|
||||
|
||||
## Miscellaneous
|
||||
|
||||
|
||||
* Some different [interfaces](misc/julia_interfaces.html) to `Julia`.
|
||||
* The [CalculusWithJulia](misc/calculus_with_julia.html) package.
|
||||
* [Unicode symbol](misc/unicode.html) usage in `Julia`.
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Contributing, commenting, ...
|
||||
|
||||
|
||||
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 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.
|
||||
|
||||
|
||||
75
quarto/misc/unicode.qmd
Normal file
75
quarto/misc/unicode.qmd
Normal file
@@ -0,0 +1,75 @@
|
||||
# Usages of Unicode symbols
|
||||
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
|
||||
import Logging
|
||||
Logging.disable_logging(Logging.Info) # or e.g. Logging.Info
|
||||
Logging.disable_logging(Logging.Warn)
|
||||
|
||||
import SymPy
|
||||
function Base.show(io::IO, ::MIME"text/html", x::T) where {T <: SymPy.SymbolicObject}
|
||||
println(io, "<span class=\"math-left-align\" style=\"padding-left: 4px; width:0; float:left;\"> ")
|
||||
println(io, "\\[")
|
||||
println(io, sympy.latex(x))
|
||||
println(io, "\\]")
|
||||
println(io, "</span>")
|
||||
end
|
||||
|
||||
# hack to work around issue
|
||||
import Markdown
|
||||
import CalculusWithJulia
|
||||
function CalculusWithJulia.WeaveSupport.ImageFile(d::Symbol, f::AbstractString, caption; kwargs...)
|
||||
nm = joinpath("..", string(d), f)
|
||||
u = ""
|
||||
Markdown.parse(u)
|
||||
end
|
||||
|
||||
nothing
|
||||
```
|
||||
|
||||
`Julia` allows the use of *Unicode* symbols to replace variable names and for function calls. Unicode operations are entered in this pattern `\name[tab]`. That is a slash, `\`, the name (e.g., `alpha`), and then a press of the `tab` key.
|
||||
|
||||
|
||||
In these notes, the following may appear as variable or function names
|
||||
|
||||
|
||||
| `\Name` | Symbol | Usage notes |
|
||||
|:-------- |:------ |:------------------------------- |
|
||||
| `\euler` | `ℯ` | The variable `e` |
|
||||
| `\pi` | `π` | |
|
||||
| `\alpha` | `α` | |
|
||||
| `\beta` | `β` | |
|
||||
| `\delta` | `δ` | |
|
||||
| `\Delta` | `Δ` | Change, as in `Δx` |
|
||||
| `\gamma` | `γ` | |
|
||||
| `\phi` | `ϕ` | |
|
||||
| `\Phi` | `Φ` | Used for parameterized surfaces |
|
||||
| `x\_1` | `x₁` | Subscripts |
|
||||
| `r\vec` | `r⃗` | Vector annotation |
|
||||
| `T\hat` | `T̂` | Unit vector annotation |
|
||||
|
||||
|
||||
The following are associated with derivatives
|
||||
|
||||
|
||||
| `\Name` | Symbol | Usage notes |
|
||||
|:---------- |:------ |:--------------------------- |
|
||||
| `\partial` | `∂` | |
|
||||
| `\nabla` | `∇` | del operator in CwJ package |
|
||||
|
||||
|
||||
The following are *infix* operators
|
||||
|
||||
|
||||
| `\Name` | Symbol | Usage notes |
|
||||
|:-------- |:------ |:------------- |
|
||||
| `\circ` | `∘` | composition |
|
||||
| `\cdot` | `⋅` | dot product |
|
||||
| `\times` | `×` | cross product |
|
||||
|
||||
|
||||
Infix operators may need parentheses due to precedence rules. For example, to call a composition, one needs `(f ∘ g)(x)` so that composition happens before function evaluation (`g(x)`).
|
||||
|
||||
|
||||
37
quarto/misc/using-pluto.qmd
Normal file
37
quarto/misc/using-pluto.qmd
Normal file
@@ -0,0 +1,37 @@
|
||||
# Using Pluto
|
||||
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
|
||||
import Logging
|
||||
Logging.disable_logging(Logging.Info) # or e.g. Logging.Info
|
||||
Logging.disable_logging(Logging.Warn)
|
||||
|
||||
import SymPy
|
||||
function Base.show(io::IO, ::MIME"text/html", x::T) where {T <: SymPy.SymbolicObject}
|
||||
println(io, "<span class=\"math-left-align\" style=\"padding-left: 4px; width:0; float:left;\"> ")
|
||||
println(io, "\\[")
|
||||
println(io, sympy.latex(x))
|
||||
println(io, "\\]")
|
||||
println(io, "</span>")
|
||||
end
|
||||
|
||||
# hack to work around issue
|
||||
import Markdown
|
||||
import CalculusWithJulia
|
||||
function CalculusWithJulia.WeaveSupport.ImageFile(d::Symbol, f::AbstractString, caption; kwargs...)
|
||||
nm = joinpath("..", string(d), f)
|
||||
u = ""
|
||||
Markdown.parse(u)
|
||||
end
|
||||
|
||||
nothing
|
||||
```
|
||||
|
||||
:::{.callout-note}
|
||||
## Note
|
||||
We see in this notebook the use of `let` blocks, which is not typical with `Pluto`. As `Pluto` is reactive – meaning changes in a variable propagate automatically to variables which reference the changed one – a variable can only be used *once* per notebook at the top level. The `let` block, like a function body, introduces a separate scope for the binding so `Pluto` doesn't incorporate the binding in its reactive model. This is necessary as we have more than one function named `f`. This is unlike `begin` blocks, which are quite typical in `Pluto`. The `begin` blocks allow one or more commands to occur in a cell, as the design of `Pluto` is one object per cell.
|
||||
|
||||
:::
|
||||
|
||||
Reference in New Issue
Block a user