use quarto, not Pluto to render pages
This commit is contained in:
@@ -77,6 +77,7 @@ on how it is being called. Within `Pluto`, a message about
|
||||
this will be noted.
|
||||
|
||||
|
||||
|
||||
The basic arithmetic operations on a calculator are "+", "-", "×",
|
||||
"÷", and "$xʸ$". These have parallels in `Julia` through the *binary*
|
||||
operators: `+`, `-`, `*`, `/`, and `^`:
|
||||
@@ -320,23 +321,21 @@ To emphasize, this is not the same as the value without the parentheses:
|
||||
1 + 2 / 3 + 4
|
||||
```
|
||||
|
||||
```julia; echo=false;
|
||||
alert(L"""
|
||||
!!! warning
|
||||
The viniculum also indicates grouping when used with the
|
||||
square root (the top bar), and complex conjugation. That usage is
|
||||
often clear enough, but the usage of the viniculum in division
|
||||
often leads to confusion. The example above is one where the
|
||||
parentheses are often, erroneously, omitted. However, more
|
||||
confusion can arise when there is more than one vinicula. An
|
||||
expression such as $a/b/c$ written inline has no confusion, it is:
|
||||
$(a/b) / c$ as left association is used; but when written with a
|
||||
pair of vinicula there is often the typographical convention of a
|
||||
slightly longer vinicula to indicate which is to be considered
|
||||
first. In the absence of that, then top to bottom association is
|
||||
often implied.
|
||||
|
||||
The viniculum also indicates grouping when used with the square root
|
||||
(the top bar), and complex conjugation. That usage is often clear
|
||||
enough, but the usage of the viniculum in division often leads to
|
||||
confusion. The example above is one where the parentheses are often,
|
||||
erroneously, omitted. However, more confusion can arise when there is
|
||||
more than one vinicula. An expression such as $a/b/c$ written inline
|
||||
has no confusion, it is: $(a/b) / c$ as left association is used; but
|
||||
when written with a pair of vinicula there is often the typographical
|
||||
convention of a slightly longer vinicula to indicate which is to
|
||||
be considered first. In the absence of that, then top to bottom association is
|
||||
often implied.
|
||||
|
||||
""")
|
||||
```
|
||||
|
||||
### Infix, postfix, and prefix notation
|
||||
|
||||
@@ -356,13 +355,9 @@ unfamiliar with. These mirror the familiar notation from most math
|
||||
texts.
|
||||
|
||||
|
||||
```julia; echo=false;
|
||||
note("""
|
||||
!!! note
|
||||
In `Julia` many infix operations can be done using a prefix manner. For example `14 + 2` can also be evaluated by `+(14,2)`. There are very few *postfix* operations, though in these notes we will overload one, the `'` operation, to indicate a derivative.
|
||||
|
||||
In `Julia` many infix operations can be done using a prefix manner. For example `14 + 2` can also be evaluated by `+(14,2)`. There are very few *postfix* operations, though in these notes we will overload one, the `'` operation, to indicate a derivative.
|
||||
|
||||
""")
|
||||
```
|
||||
|
||||
## Constants
|
||||
|
||||
@@ -378,11 +373,9 @@ Whereas, `e` is is not simply the character `e`, but *rather* a [Unicode](../uni
|
||||
ℯ
|
||||
```
|
||||
|
||||
```julia; echo=false
|
||||
note("""
|
||||
However, when the accompanying package, `CalculusWithJulia`, is loaded, the character `e` will refer to a floating point approximation to the Euler constant .
|
||||
""")
|
||||
```
|
||||
!!! note
|
||||
However, when the accompanying package, `CalculusWithJulia`, is loaded, the character `e` will refer to a floating point approximation to the Euler constant .
|
||||
|
||||
|
||||
In the sequel, we will just use `e` for this constant (though more commonly the `exp` function), with the reminder that base `Julia` alone does not reserve this symbol.
|
||||
|
||||
@@ -393,10 +386,12 @@ Mathematically these are irrational values with decimal expansions that do not r
|
||||
```
|
||||
|
||||
|
||||
```julia; echo=false;
|
||||
alert("""In most cases. There are occasional (basically rare) spots where using `pi` by itself causes an eror where `1*pi` will not. The reason is `1*pi` will create a floating point value from the irrational object, `pi`.
|
||||
""")
|
||||
```
|
||||
!!! warning
|
||||
In most cases. There are occasional (basically rare) spots
|
||||
where using `pi` by itself causes an eror where `1*pi` will
|
||||
not. The reason is `1*pi` will create a floating point value from
|
||||
the irrational object, `pi`.
|
||||
|
||||
|
||||
|
||||
### Numeric literals
|
||||
@@ -504,19 +499,14 @@ exp(2), log(10), sqrt(100), 10^(1/2)
|
||||
```
|
||||
|
||||
|
||||
!!! note
|
||||
Parentheses have many roles. We've just seen that parentheses may be
|
||||
used for grouping, and now we see they are used to indicate a function
|
||||
is being called. These are familiar from their parallel usage in
|
||||
traditional math notation. In `Julia`, a third usage is common, the
|
||||
making of a "tuple," or a container of different objects, for example
|
||||
`(1, sqrt(2), pi)`. In these notes, the output of multiple commands separated by commas is a printed tuple.
|
||||
|
||||
```julia; echo=false;
|
||||
note("""
|
||||
|
||||
Parentheses have many roles. We've just seen that parentheses may be
|
||||
used for grouping, and now we see they are used to indicate a function
|
||||
is being called. These are familiar from their parallel usage in
|
||||
traditional math notation. In `Julia`, a third usage is common, the
|
||||
making of a "tuple," or a container of different objects, for example
|
||||
`(1, sqrt(2), pi)`. In these notes, the output of multiple commands separated by commas is a printed tuple.
|
||||
|
||||
""")
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -621,21 +611,17 @@ exact, can represent much bigger values and are exact for a reasonably
|
||||
wide range of integer values.)
|
||||
|
||||
|
||||
```julia; echo=false;
|
||||
alert("""
|
||||
!!! warning
|
||||
In a turnaround from a classic blues song, we can think of
|
||||
`Julia` as built for speed, not for comfort. All of these errors
|
||||
above could be worked around so that the end user doesn't see
|
||||
them. However, this would require slowing things down, either
|
||||
through checking of operations or allowing different types of
|
||||
outputs for similar type of inputs. These are tradeoffs that are
|
||||
not made for performance reasons. For the most part, the tradeoffs
|
||||
don't get in the way, but learning where to be careful takes some
|
||||
time. Error messages often suggest a proper alternative.
|
||||
|
||||
In a turnaround from a classic blues song, we can think of `Julia` as
|
||||
built for speed, not for comfort. All of these errors above could be
|
||||
worked around so that the end user doesn't see them. However, this
|
||||
would require slowing things down, either through checking of
|
||||
operations or allowing different types of outputs for similar type of
|
||||
inputs. These are tradeoffs that are not made for performance
|
||||
reasons. For the most part, the tradeoffs don't get in the way, but
|
||||
learning where to be careful takes some time. Error messages
|
||||
often suggest a proper alternative.
|
||||
|
||||
""")
|
||||
```
|
||||
|
||||
##### Example
|
||||
|
||||
@@ -798,8 +784,8 @@ choices = [
|
||||
q"(3 - 2)/ 4 - 1",
|
||||
q"3 - 2 / (4 - 1)",
|
||||
q"(3 - 2) / (4 - 1)"]
|
||||
ans = 3
|
||||
radioq(choices, ans)
|
||||
answ = 3
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -818,8 +804,8 @@ choices = [
|
||||
q"3 * 2 / 4",
|
||||
q"(3 * 2) / 4"
|
||||
]
|
||||
ans = 1
|
||||
radioq(choices, ans)
|
||||
answ = 1
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -838,8 +824,8 @@ choices = [
|
||||
q"2 ^ 4 - 2",
|
||||
q"(2 ^ 4) - 2",
|
||||
q"2 ^ (4 - 2)"]
|
||||
ans = 3
|
||||
radioq(choices, ans)
|
||||
answ = 3
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -863,8 +849,8 @@ choices = [
|
||||
q"1 / (2 / 3 / 4 / 5 / 6)",
|
||||
q"1 / 2 * 3 / 4 * 5 / 6",
|
||||
q"1 /(2 * 3 * 4 * 5 * 6)"]
|
||||
ans = 3
|
||||
radioq(choices, ans)
|
||||
answ = 3
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -879,8 +865,8 @@ q"2 - 3 - 4",
|
||||
q"(2 - 3) - 4",
|
||||
q"2 - (3 - 4)"
|
||||
];
|
||||
ans = 3;
|
||||
radioq(choices, ans)
|
||||
answ = 3;
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
|
||||
@@ -895,8 +881,8 @@ q"2 - 3 * 4",
|
||||
q"(2 - 3) * 4",
|
||||
q"2 - (3 * 4)"
|
||||
];
|
||||
ans = 2;
|
||||
radioq(choices, ans)
|
||||
answ = 2;
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
|
||||
@@ -912,8 +898,8 @@ q"-1^2",
|
||||
q"(-1)^2",
|
||||
q"-(1^2)"
|
||||
];
|
||||
ans = 2;
|
||||
radioq(choices, ans)
|
||||
answ = 2;
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
|
||||
@@ -989,8 +975,8 @@ choices = [
|
||||
raw"``e^{\pi}``",
|
||||
raw"``\pi^{e}``"
|
||||
];
|
||||
ans = exp(pi) - pi^exp(1) > 0 ? 1 : 2;
|
||||
radioq(choices, ans)
|
||||
answ = exp(pi) - pi^exp(1) > 0 ? 1 : 2;
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -1002,8 +988,8 @@ What is the value of $\pi - (x - \sin(x)/\cos(x))$ when $x=3$?
|
||||
|
||||
```julia; hold=true; echo=false;
|
||||
x = 3;
|
||||
ans = x - sin(x)/cos(x);
|
||||
numericq(pi - ans)
|
||||
answ = x - sin(x)/cos(x);
|
||||
numericq(pi - answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -1022,8 +1008,8 @@ Will `-2^2` produce `4` (which is a unary `-` evaluated *before* `^`) or `-4` (w
|
||||
|
||||
```julia; hold=true; echo=false;
|
||||
choices = [q"4", q"-4"]
|
||||
ans = 2
|
||||
radioq(choices, ans)
|
||||
answ = 2
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -1057,6 +1043,6 @@ choices = [
|
||||
"The precedence of numeric literal coefficients used for implicit multiplication is higher than other binary operators such as multiplication (`*`), and division (`/`, `\\`, and `//`)",
|
||||
"Of course it is correct."
|
||||
]
|
||||
ans=1
|
||||
radioq(choices, ans)
|
||||
answ=1
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user