em dash; sentence case
This commit is contained in:
@@ -11,6 +11,8 @@ using CalculusWithJulia
|
||||
nothing
|
||||
```
|
||||
|
||||
|
||||
|
||||
The [`Julia`](http://www.julialang.org) programming language is well suited as a computer accompaniment while learning the concepts of calculus. The following overview covers the language-specific aspects of the pre-calculus part of the [Calculus with Julia](calculuswithjulia.github.io) notes.
|
||||
|
||||
|
||||
@@ -34,35 +36,29 @@ The [https://mybinder.org/](https://mybinder.org/) service in particular allows
|
||||
|
||||
[Google colab](https://colab.research.google.com/) offers a free service with more computing power than `binder`, though setup is a bit more fussy. To use `colab` along with these notes, you need to execute a command that downloads `Julia` and installs the `CalculusWithJulia` package and a plotting package. (Modify the `pkg"add ..."` command to add other desired packages; update the julia version as necessary):
|
||||
|
||||
```
|
||||
# Installation cell
|
||||
%%capture
|
||||
%%shell
|
||||
if ! command -v julia 3>&1 > /dev/null
|
||||
then
|
||||
wget -q 'https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.2-linux-x86_64.tar.gz' \
|
||||
-O /tmp/julia.tar.gz
|
||||
tar -x -f /tmp/julia.tar.gz -C /usr/local --strip-components 1
|
||||
rm /tmp/julia.tar.gz
|
||||
fi
|
||||
julia -e 'using Pkg; pkg"add IJulia CalculusWithJulia; precompile;"'
|
||||
julia -e 'using Pkg; Pkg.add(url="https://github.com/mth229/BinderPlots.jl")'
|
||||
echo 'Now change the runtime type'
|
||||
```
|
||||
|
||||
(The `BinderPlots` is a light-weight, barebones, plotting package that uses `PlotlyLight` to render graphics with commands mostly following those of the `Plots` package. Though suitable for most examples herein, the `Plots` package could instead be installed)
|
||||
> Go to google colab:
|
||||
|
||||
[https://colab.research.google.com/](https://colab.research.google.com/)
|
||||
|
||||
|
||||
After this executes (which can take quite some time, as in a few minutes) under the `Runtime` menu select `Change runtime type` and then select `Julia`.
|
||||
> Click on "Runtime" menu and then "Change Runtime Type"
|
||||
|
||||
After that, in a cell execute these commands to load the two installed packages:
|
||||
> Select Julia as the "Runtime Type" then save
|
||||
|
||||
|
||||
> Copy and paste then run this set of commands
|
||||
|
||||
```
|
||||
using Pkg
|
||||
Pkg.add("Plots")
|
||||
Pkg.add("CalculusWithJulia")
|
||||
using CalculusWithJulia
|
||||
using BinderPlots
|
||||
using Plots
|
||||
```
|
||||
|
||||
As mentioned, other packages can be chosen for installation.
|
||||
|
||||
This may take 2-3 minutes to load. The `plotly()` backend doesn't work out of the box. Use `gr()` to recover if that command is issued.
|
||||
|
||||
|
||||
|
||||
@@ -85,7 +81,7 @@ $ julia
|
||||
(_) | (_) (_) |
|
||||
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
|
||||
| | | | | | |/ _` | |
|
||||
| | |_| | | | (_| | | Version 1.11.1 (2024-10-16)
|
||||
| | |_| | | | (_| | | Version 1.11.6 (2025-07-09)
|
||||
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|
||||
|__/ |
|
||||
|
||||
@@ -452,7 +448,7 @@ a = 4
|
||||
f(3) # now 2 * 4 + 3
|
||||
```
|
||||
|
||||
User-defined functions can have $0$, $1$ or more positional arguments:
|
||||
User-defined functions can have $0$, $1$, or more positional arguments:
|
||||
|
||||
|
||||
```{julia}
|
||||
@@ -573,7 +569,7 @@ With `Plots` loaded, we can plot a function by passing the function object by na
|
||||
|
||||
|
||||
```{julia}
|
||||
plot(sin, 0, 2pi) # plot a function - by name - over an interval [a,b]
|
||||
plot(sin, 0, 2pi)
|
||||
```
|
||||
|
||||
::: {.callout-note}
|
||||
@@ -629,7 +625,7 @@ ys = f.(xs)
|
||||
plot(f, a, b) # recipe for a function
|
||||
plot(xs, f) # alternate recipe
|
||||
plot(xs, ys) # plot coordinates as two vectors
|
||||
plot([(x,f(x)) for x in xs]) # plot a vector o points
|
||||
plot([(x,f(x)) for x in xs]) # plot a vector of points
|
||||
```
|
||||
|
||||
The choice should depend on convenience.
|
||||
@@ -637,7 +633,7 @@ The choice should depend on convenience.
|
||||
## Equations
|
||||
|
||||
|
||||
Notation for `Julia` and math is *similar* for functions - but not for equations. In math, an equation might look like:
|
||||
Notation for `Julia` and math is *similar* for functions---but not for equations. In math, an equation might look like:
|
||||
|
||||
|
||||
$$
|
||||
@@ -664,13 +660,15 @@ using SymPy
|
||||
(A macro rewrites values into other commands before they are interpreted. Macros are prefixed with the `@` sign. In this use, the "macro" `@syms` translates `x a b c` into a command involving `SymPy`s `symbols` function.)
|
||||
|
||||
|
||||
Symbolic expressions - unlike numeric expressions - are not immediately evaluated, though they may be simplified:
|
||||
Symbolic expressions---unlike numeric expressions---are not immediately evaluated, though they may be simplified:
|
||||
|
||||
|
||||
```{julia}
|
||||
p = a*x^2 + b*x + c
|
||||
```
|
||||
|
||||
The above command illustrates that the mathematical operations of `*`, `^`, and `+` work with symbolic objects. This is the case for most mathematical functions as well.
|
||||
|
||||
To substitute a value, we can use `Julia`'s `pair` notation (`variable=>value`):
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user