This commit is contained in:
jverzani 2023-04-20 10:39:27 -04:00
commit 05ddc2f002

View File

@ -66,7 +66,7 @@ The `Pluto` interface has some idiosyncracies that need explanation:
* Cells can only have one command within them. Multiple-command cells must be contained in a `begin` block or a `let` block. * Cells can only have one command within them. Multiple-command cells must be contained in a `begin` block or a `let` block.
* By default, the cells are *reactive*. This means when a variable in one cell is changed, then any references to that variable are also updated like a spreadsheet. This is fantastic for updating several computations at once. However it means variable names can not be repeated within a page. Pedagogically, it is convenient to use variable names and function names (e.g., `x` and `f`) repeatedly, but this is only possible *if* they are within a `let` block or a function body. * By default, the cells are *reactive*. This means when a variable in one cell is changed, then any references to that variable are also updated like a spreadsheet. This is fantastic for updating several computations at once. However it means variable names can not be repeated within a page. Pedagogically, it is convenient to use variable names and function names (e.g., `x` and `f`) repeatedly, but this is only possible *if* they are within a `let` block or a function body.
* To not repeat names, but to be able to reference a value from cell-to-cell, some Unicode variants are used within a page. Visually these look familiar, but typing the names requires some understanding of Unicode input. The primary usages is *bold italic* (e.g., `\bix[tab]` or `\bif[tab]`) or *bold face* (e.g. `\bfx[tab]` or `bff[tab]`). * To not repeat names, but to be able to reference a value from cell-to-cell, some Unicode variants are used within a page. Visually these look familiar, but typing the names requires some understanding of Unicode input. The primary usages is *bold italic* (e.g., `\bix[tab]` or `\bif[tab]`) or *bold face* (e.g. `\bfx[tab]` or `\bff[tab]`).
* The notebooks snapshot the packages they depend on, which is great for reproducability, but may mean older versions are silently used. * The notebooks snapshot the packages they depend on, which is great for reproducability, but may mean older versions are silently used.
@ -114,11 +114,11 @@ This command instructs `Julia` to look at its *general registry* for the `Calcul
:::{.callout-note} :::{.callout-note}
## Note ## Note
In a terminal setting, there is a package mode, entered by typing `]` as the leading character and exited by entering `<delete>` at a blank line. This mode allows direct access to `Pkg` with a simpler syntax. The command above would be just `add CalculusWithJulia`.) In a terminal setting, there is a package mode, entered by typing `]` as the leading character and exited by entering `<backspace>` at a blank line. This mode allows direct access to `Pkg` with a simpler syntax. The command above would be just `add CalculusWithJulia`.)
::: :::
Packages can be updated through the command `Pkg.up()`, and removed with `Pkg.rm(pkgname)`. Packages can be updated through the command `Pkg.update()`, and removed with `Pkg.rm(pkgname)`.
By default packages are installed in a common area. It may be desirable to keep packages for projects isolated. For this the `Pkg.activate` command can be used. This feature allows a means to have reproducible environments even if `Julia` or the packages used are upgraded, possibly introducing incompatabilities. By default packages are installed in a common area. It may be desirable to keep packages for projects isolated. For this the `Pkg.activate` command can be used. This feature allows a means to have reproducible environments even if `Julia` or the packages used are upgraded, possibly introducing incompatabilities.
@ -150,7 +150,7 @@ In a `Jupyter` notebook or `Pluto` notebook, commands are typed into a notebook
Commands are executed by using `shift-enter` or a run button near the cell. Commands are executed by using `shift-enter` or a run button near the cell.
In `Jupyter` multiple commands per cell are allowed. In `Pluto`, a `begin` or `let` block is used to collect multiple commmands into a single call. Commands may be separated by new lines or semicolons. In `Jupyter` multiple commands per cell are allowed. In `Pluto`, a `begin` or `let` block is used to collect multiple commmands into a single cell. Commands may be separated by new lines or semicolons.
On a given line, anything **after** a `#` is a *comment* and is not processed. On a given line, anything **after** a `#` is a *comment* and is not processed.
@ -159,7 +159,7 @@ On a given line, anything **after** a `#` is a *comment* and is not processed.
The results of the last command executed will be displayed in an output area. Separating values by commas allows more than one value to be displayed. Plots are displayed when the plot object is returned by the last executed command. The results of the last command executed will be displayed in an output area. Separating values by commas allows more than one value to be displayed. Plots are displayed when the plot object is returned by the last executed command.
In `Jupyter`, the state of the notebook is a determined by the cells executed along with their order. The state of a `Pluto` notebook is a result of all the cells in the notebook being executed. The cell order does not impact this and can be rearranged by the user. In `Jupyter`, the state of the notebook is determined by the cells executed along with their order. The state of a `Pluto` notebook is a result of all the cells in the notebook being executed. The cell order does not impact this and can be rearranged by the user.
## Numbers, variable types ## Numbers, variable types
@ -305,7 +305,7 @@ sin(pi/3)
log(5, 100) # log base 5 of 100 log(5, 100) # log base 5 of 100
``` ```
With out parentheses, the name (usually) refers to a generic name and the output lists the number of available implementations (methods). Without parentheses, the name (usually) refers to a generic name and the output lists the number of available implementations (methods).
```{julia} ```{julia}
@ -485,7 +485,7 @@ filter(iseven, [x^2 for x in 1:10])
## Broadcasting, mapping ## Broadcasting, mapping
A function can be applied to each element of a vector through mapping or broadcasting. The latter is implemented in a succinct notation. Calling a function with a "." before its opening "(` will apply the function to each individual value in the argument: A function can be applied to each element of a vector through mapping or broadcasting. The latter is implemented in a succinct notation. Calling a function with a "." before its opening "(" will apply the function to each individual value in the argument:
```{julia} ```{julia}
@ -527,7 +527,7 @@ With `Plots` loaded, we can plot a function by passing the function object by na
plot(sin, 0, 2pi) # plot a function - by name - over an interval [a,b] plot(sin, 0, 2pi) # plot a function - by name - over an interval [a,b]
``` ```
!!1 note This is in the form of **the** basic pattern employed: `verb(function_object, arguments...)`. The verb in this example is `plot`, the object `sin`, the arguments `0, 2pi` to specify `[a,b]` domain to plot over. !!! note This is in the form of **the** basic pattern employed: `verb(function_object, arguments...)`. The verb in this example is `plot`, the object `sin`, the arguments `0, 2pi` to specify `[a,b]` domain to plot over.
Plotting more than one function over `[a,b]` is achieved through the `plot!` function, which modifies the existing plot (`plot` creates a new one) by adding a new layer: Plotting more than one function over `[a,b]` is achieved through the `plot!` function, which modifies the existing plot (`plot` creates a new one) by adding a new layer: