Files
CalculusWithJuliaNotes.jl/quarto/_freeze/precalc/calculator/execute-results/html.json
2022-09-08 07:03:08 -04:00

15 lines
91 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"hash": "77f6ddbe041bcfa68dd92248d3cfdeda",
"result": {
"markdown": "# From calculator to computer\n\n\n\n\n\nLet 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 familiarity with a *graphing* calculator is expected. `Julia` makes these familiar tasks just as easy, offering numerous conveniences along the way. In this section we describe how.\n\n\nThe following image is the calculator that Google presents upon searching for \"calculator.\"\n\n![Screenshot of a calculator provided by the Google search engine.](../precalc/figures/calculator.png)\n\n\n\nThis calculator should have a familiar appearance with a keypad of numbers, a set of buttons for arithmetic operations, a set of buttons for some common mathematical functions, a degree/radian switch, and buttons for interacting with the calculator: `Ans`, `AC` (also `CE`), and `=`.\n\n\nThe goal here is to see the counterparts within `Julia` to these features.\n\n---\n\n\nFor an illustration of a *really* basic calculator, have some fun watching this video:\n\n::: {.cell execution_count=4}\n\n::: {.cell-output .cell-output-display execution_count=5}\n```{=html}\n<center>\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/sxLdGjV-_yg\" frameborder=\"0\" allowfullscreen>\n</iframe>\n</center>\n```\n:::\n:::\n\n\n## Operations\n\n\nPerforming a simple computation on the calculator typically involves hitting buttons in a sequence, such as \"`1`\", \"`+`\", \"`2`\", \"`=`\" to compute `3` from adding `1 + 2`. In `Julia`, the process is not so different. Instead of pressing buttons, the various values are typed in. So, we would have:\n\n::: {.cell execution_count=5}\n``` {.julia .cell-code}\n1 + 2\n```\n\n::: {.cell-output .cell-output-display execution_count=6}\n```\n3\n```\n:::\n:::\n\n\nSending an expression to `Julia`'s interpreter - the equivalent of pressing the \"`=`\" key on a calculator - is done at the command line by pressing the `Enter` or `Return` key, and in `Pluto`, also using the \"play\" icon, or the keyboard shortcut `Shift-Enter`. If the current expression is complete, then `Julia` evaluates it and shows any output. If the expression is not complete, `Julia`'s response depends on how it is being called. Within `Pluto`, a message about \"`premature end of input`\" is given. If the expression raises an error, this will be noted.\n\n\nThe basic arithmetic operations on a calculator are \"+\", \"-\", \"×\", \"÷\", and \"$xʸ$\". These have parallels in `Julia` through the *binary* operators: `+`, `-`, `*`, `/`, and `^`:\n\n::: {.cell execution_count=6}\n``` {.julia .cell-code}\n1 + 2, 2 - 3, 3 * 4, 4 / 5, 5 ^ 6\n```\n\n::: {.cell-output .cell-output-display execution_count=7}\n```\n(3, -1, 12, 0.8, 15625)\n```\n:::\n:::\n\n\nOn some calculators, there is a distinction between minus signs - the binary minus sign and the unary minus sign to create values such as $-1$.\n\n\nIn `Julia`, the same symbol, \"`-`\", is used for each:\n\n::: {.cell execution_count=7}\n``` {.julia .cell-code}\n-1 - 2\n```\n\n::: {.cell-output .cell-output-display execution_count=8}\n```\n-3\n```\n:::\n:::\n\n\nAn expression like $6 - -3$, subtracting minus three from six, must be handled with some care. With the Google calculator, the expression must be entered with accompanying parentheses: $6 -(-3)$. In `Julia`, parentheses may be used, but are not needed. However, if omitted, a space is required between the two minus signs:\n\n::: {.cell execution_count=8}\n``` {.julia .cell-code}\n6 - -3\n```\n\n::: {.cell-output .cell-output-display execution_count=9}\n```\n9\n```\n:::\n:::\n\n\n(If no space is included, the value \"`--`\" is parsed like a different, undefined, operation.)\n\n::: {.cell execution_count=9}\n\n::: {.cell-output .cell-output-display execution_count=10}\n```{=html}\n<div class=\"markdown\"><div class=\"admonition warning\"><p class=\"admonition-title\">Warning</p><p><code>Julia</code> only uses one symbol for minus, but web pages may not&#33; Copying and pasting an expression with a minus sign can lead to hard to understand errors such as: <code>invalid character &quot;&quot;</code>. There are several Unicode symbols that look similar to the ASCII minus sign, but are different. These notes use a different character for the minus sign for the typeset math &#40;e.g., \\(1 - \\pi\\)&#41; than for the code within cells &#40;e.g. <code>1 - 2</code>&#41;. Thus, copying and pasting the typeset math may not work as expected.</p>\n</div>\n</div>\n```\n:::\n:::\n\n\n### Examples\n\n\n##### Example\n\n\nFor everyday temperatures, the conversion from Celsius to Fahrenheit ($9/5 C + 32$) is well approximated by simply doubling and adding $30$. Compare these values for an average room temperature, $C=20$, and for a relatively chilly day, $C=5$:\n\n\nFor $C=20$:\n\n::: {.cell execution_count=10}\n``` {.julia .cell-code}\n9 / 5 * 20 + 32\n```\n\n::: {.cell-output .cell-output-display execution_count=11}\n```\n68.0\n```\n:::\n:::\n\n\nThe easy to compute approximate value is:\n\n::: {.cell execution_count=11}\n``` {.julia .cell-code}\n2 * 20 + 30\n```\n\n::: {.cell-output .cell-output-display execution_count=12}\n```\n70\n```\n:::\n:::\n\n\nThe difference is:\n\n::: {.cell execution_count=12}\n``` {.julia .cell-code}\n(9/5*20 + 32) - (2 * 20 + 30)\n```\n\n::: {.cell-output .cell-output-display execution_count=13}\n```\n-2.0\n```\n:::\n:::\n\n\nFor $C=5$, we have the actual value of:\n\n::: {.cell execution_count=13}\n``` {.julia .cell-code}\n9 / 5 * 5 + 32\n```\n\n::: {.cell-output .cell-output-display execution_count=14}\n```\n41.0\n```\n:::\n:::\n\n\nand the easy to compute value is simply $40 = 10 + 30$. The difference is\n\n::: {.cell execution_count=14}\n``` {.julia .cell-code}\n(9 / 5 * 5 + 32) - 40\n```\n\n::: {.cell-output .cell-output-display execution_count=15}\n```\n1.0\n```\n:::\n:::\n\n\n##### Example\n\n\nAdd the numbers $1 + 2 + 3 + 4 + 5$.\n\n::: {.cell execution_count=15}\n``` {.julia .cell-code}\n1 + 2 + 3 + 4 + 5\n```\n\n::: {.cell-output .cell-output-display execution_count=16}\n```\n15\n```\n:::\n:::\n\n\n##### Example\n\n\nHow small is $1/2/3/4/5/6$? It is about $14/10,000$, as this will show:\n\n::: {.cell execution_count=16}\n``` {.julia .cell-code}\n1/2/3/4/5/6\n```\n\n::: {.cell-output .cell-output-display execution_count=17}\n```\n0.001388888888888889\n```\n:::\n:::\n\n\n##### Example\n\n\nWhich is bigger $4^3$ or $3^4$? We can check by computing their difference:\n\n::: {.cell execution_count=17}\n``` {.julia .cell-code}\n4^3 - 3^4\n```\n\n::: {.cell-output .cell-output-display execution_count=18}\n```\n-17\n```\n:::\n:::\n\n\nSo $3^4$ is bigger.\n\n\n##### Example\n\n\nA right triangle has sides $a=11$ and $b=12$. Find the length of the hypotenuse squared. As $c^2 = a^2 + b^2$ we have:\n\n::: {.cell execution_count=18}\n``` {.julia .cell-code}\n11^2 + 12^2\n```\n\n::: {.cell-output .cell-output-display execution_count=19}\n```\n265\n```\n:::\n:::\n\n\n## Order of operations\n\n\nThe calculator must use some rules to define how it will evaluate its instructions when two or more operations are involved. We know mathematically, that when $1 + 2 \\cdot 3$ is to be evaluated the multiplication is done first then the addition.\n\n\nWith the Google Calculator, typing `1 + 2 x 3 =` will give the value $7$, but *if* we evaluate the `+` sign first, via `1` `+` `2` `=` `x` `3` `=` the answer will be 9, as that will force the addition of `1+2` before multiplying. The more traditional way of performing that calculation is to use *parentheses* to force an evaluation. That is, `(1 + 2) * 3 =` will produce `9` (though one must type it in, and not use a mouse to enter). Except for the most primitive of calculators, there are dedicated buttons for parentheses to group expressions.\n\n\nIn `Julia`, the entire expression is typed in before being evaluated, so the usual conventions of mathematics related to the order of operations may be used. These are colloquially summarized by the acronym [PEMDAS](http://en.wikipedia.org/wiki/Order_of_operations).\n\n\n> **PEMDAS**. This acronym stands for Parentheses, Exponents, Multiplication, Division, Addition, Subtraction. The order indicates which operation has higher precedence, or should happen first. This isn't exactly the case, as \"M\" and \"D\" have the same precedence, as do \"A\" and \"S\". In the case of two operations with equal precedence, *associativity* is used to decide which to do. For the operations `+`, `-`, `*`, `/` the associativity is left to right, as in the left one is done first, then the right. However, `^` has right associativity, so `4^3^2` is `4^(3^2)` and not `(4^3)^2`. (Be warned that some calculators - and spread sheets, such as Excel - will treat this expression with left associativity.)\n\n\n\nWith rules of precedence, an expression like the following has a clear interpretation to `Julia` without the need for parentheses:\n\n::: {.cell execution_count=19}\n``` {.julia .cell-code}\n1 + 2 - 3 * 4 / 5 ^ 6\n```\n\n::: {.cell-output .cell-output-display execution_count=20}\n```\n2.999232\n```\n:::\n:::\n\n\nWorking through PEMDAS we see that `^` is first, then `*` and then `/` (this due to associativity and `*` being the leftmost expression of the two) and finally `+` and then `-`, again by associativity rules. So we should have the same value with:\n\n::: {.cell execution_count=20}\n``` {.julia .cell-code}\n(1 + 2) - ((3 * 4) / (5 ^ 6))\n```\n\n::: {.cell-output .cell-output-display execution_count=21}\n```\n2.999232\n```\n:::\n:::\n\n\nIf different parentheses are used, the answer will likely be different. For example, the following forces the operations to be `-`, then `*`, then `+`. The result of that is then divided by `5^6`:\n\n::: {.cell execution_count=21}\n``` {.julia .cell-code}\n(1 + ((2 - 3) * 4)) / (5 ^ 6)\n```\n\n::: {.cell-output .cell-output-display execution_count=22}\n```\n-0.000192\n```\n:::\n:::\n\n\n### Examples\n\n\n##### Example\n\n\nThe percentage error in $x$ if $y$ is the correct value is $(x-y)/y \\cdot 100$. Compute this if $x=100$ and $y=98.6$.\n\n::: {.cell execution_count=22}\n``` {.julia .cell-code}\n(100 - 98.6) / 98.6 * 100\n```\n\n::: {.cell-output .cell-output-display execution_count=23}\n```\n1.4198782961460505\n```\n:::\n:::\n\n\n##### Example\n\n\nThe marginal cost of producing one unit can be computed by finding the cost for $n+1$ units and subtracting the cost for $n$ units. If the cost of $n$ units is $n^2 + 10$, find the marginal cost when $n=100$.\n\n::: {.cell execution_count=23}\n``` {.julia .cell-code}\n(101^2 + 10) - (100^2 + 10)\n```\n\n::: {.cell-output .cell-output-display execution_count=24}\n```\n201\n```\n:::\n:::\n\n\n##### Example\n\n\nThe average cost per unit is the total cost divided by the number of units. Again, if the cost of $n$ units is $n^2 + 10$, find the average cost for $n=100$ units.\n\n::: {.cell execution_count=24}\n``` {.julia .cell-code}\n(100^2 + 10) / 100\n```\n\n::: {.cell-output .cell-output-display execution_count=25}\n```\n100.1\n```\n:::\n:::\n\n\n##### Example\n\n\nThe slope of the line through two points is $m=(y_1 - y_0) / (x_1 - x_0)$. For the two points $(1,2)$ and $(3,4)$ find the slope of the line through them.\n\n::: {.cell execution_count=25}\n``` {.julia .cell-code}\n(4 - 2) / (3 - 1)\n```\n\n::: {.cell-output .cell-output-display execution_count=26}\n```\n1.0\n```\n:::\n:::\n\n\n### Two ways to write division - and they are not the same\n\n\nThe expression $a + b / c + d$ is equivalent to $a + (b/c) + d$ due to the order of operations. It will generally have a different answer than $(a + b) / (c + d)$.\n\n\nHow would the following be expressed, were it written inline:\n\n\n\n$$\n\\frac{1 + 2}{3 + 4}?\n$$\n\n\nIt would have to be computed through $(1 + 2) / (3 + 4)$. This is because unlike `/`, the implied order of operation in the mathematical notation with the *horizontal division symbol* (the [vinicula](http://tinyurl.com/y9tj6udl)) is to compute the top and the bottom and then divide. That is, the vinicula is a grouping notation like parentheses, only implicitly so. Thus the above expression really represents the more verbose:\n\n\n\n$$\n\\frac{(1 + 2)}{(3 + 4)}.\n$$\n\n\nWhich lends itself readily to the translation:\n\n::: {.cell execution_count=26}\n``` {.julia .cell-code}\n(1 + 2) / (3 + 4)\n```\n\n::: {.cell-output .cell-output-display execution_count=27}\n```\n0.42857142857142855\n```\n:::\n:::\n\n\nTo emphasize, this is not the same as the value without the parentheses:\n\n::: {.cell execution_count=27}\n``` {.julia .cell-code}\n1 + 2 / 3 + 4\n```\n\n::: {.cell-output .cell-output-display execution_count=28}\n```\n5.666666666666666\n```\n:::\n:::\n\n\n:::{.callout-warning}\n## Warning\nThe 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.\n\n:::\n\n### Infix, postfix, and prefix notation\n\n\nThe factorial button on the Google Button creates an expression like `14!` that is then evaluated. The operator, `!`, appears after the value (`14`) that it is applied to. This is called *postfix notation*. When a unary minus sign is used, as in `-14`, the minus sign occurs before the value it operates on. This uses *prefix notation*. These concepts can be extended to binary operations, where a third possibility is provided: *infix notation*, where the operator is between the two values. The infix notation is common for our familiar mathematical operations. We write `14 + 2` and not `+ 14 2` or `14 2 +`. (Though if we had an old reverse-Polish notation calculator, we would enter `14 2 +`!) In `Julia`, there are several infix operators, such as `+`, `-`, ... and others that we may be unfamiliar with. These mirror the familiar notation from most math texts.\n\n\n:::{.callout-note}\n## Note\nIn `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.\n\n:::\n\n## Constants\n\n\nThe Google calculator has two built in constants, `e` and `π`. Julia provides these as well, though not quite as easily. First, `π` is just `pi`:\n\n::: {.cell execution_count=28}\n``` {.julia .cell-code}\npi\n```\n\n::: {.cell-output .cell-output-display execution_count=29}\n```\nπ = 3.1415926535897...\n```\n:::\n:::\n\n\nWhereas, `e` is is not simply the character `e`, but *rather* a [Unicode](../unicode.html) character typed in as `\\euler[tab]`.\n\n::: {.cell execution_count=29}\n``` {.julia .cell-code}\n\n```\n\n::: {.cell-output .cell-output-display execution_count=30}\n```\n = 2.7182818284590...\n```\n:::\n:::\n\n\n:::{.callout-note}\n## Note\nHowever, when the accompanying package, `CalculusWithJulia`, is loaded, the character `e` will refer to a floating point approximation to the Euler constant .\n\n:::\n\nIn 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.\n\n\nMathematically these are irrational values with decimal expansions that do not repeat. `Julia` represents these values internally with additional accuracy beyond that which is displayed. Math constants can be used as though they were numbers, such is done with this expression:\n\n::: {.cell execution_count=30}\n``` {.julia .cell-code}\n^(1/(2*pi))\n```\n\n::: {.cell-output .cell-output-display execution_count=31}\n```\n1.17251960642002\n```\n:::\n:::\n\n\n:::{.callout-warning}\n## Warning\nIn 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`.\n\n:::\n\n### Numeric literals\n\n\nFor some special cases, Julia implements *multiplication* without a multiplication symbol. This is when the value on the left is a number, as in `2pi`, which has an equivalent value to `2*pi`. *However* the two are not equivalent, in that multiplication with *numeric literals* does not have the same precedence as regular multiplication - it is higher. This has practical importance when used in division or powers. For instance, these two are **not** the same:\n\n::: {.cell execution_count=31}\n``` {.julia .cell-code}\n1/2pi, 1/2*pi\n```\n\n::: {.cell-output .cell-output-display execution_count=32}\n```\n(0.15915494309189535, 1.5707963267948966)\n```\n:::\n:::\n\n\nWhy? Because the first `2pi` is performed before division, as multiplication with numeric literals has higher precedence than regular multiplication, which is at the same level as division.\n\n\nTo confuse things even more, consider\n\n::: {.cell execution_count=32}\n``` {.julia .cell-code}\n2pi^2pi\n```\n\n::: {.cell-output .cell-output-display execution_count=33}\n```\n2658.978166443007\n```\n:::\n:::\n\n\nIs this the same as `2 * (pi^2) * pi` or `(2pi)^(2pi)`?. The former would be the case is powers had higher precedence than literal multiplication, the latter would be the case were it the reverse. In fact, the correct answer is `2 * (pi^(2*pi))`:\n\n::: {.cell execution_count=33}\n``` {.julia .cell-code}\n2pi^2pi, 2 * (pi/2) * pi, (2pi)^(2pi), 2 * (pi^(2pi))\n```\n\n::: {.cell-output .cell-output-display execution_count=34}\n```\n(2658.978166443007, 9.869604401089358, 103540.92043427199, 2658.978166443007)\n```\n:::\n:::\n\n\nThis follows usual mathematical convention, but is a source of potential confusion. It can be best to be explicit about multiplication, save for the simplest of cases.\n\n\n## Functions\n\n\nOn the Google calculator, the square root button has a single purpose: for the current value find a square root if possible, and if not signal an error (such as what happens if the value is negative). For more general powers, the $x^y$ key can be used.\n\n\nIn `Julia`, functions are used to perform the actions that a specialized button may do on the calculator. `Julia` provides many standard mathematical functions - more than there could be buttons on a calculator - and allows the user to easily define their own functions. For example, `Julia` provides the same set of functions as on Google's calculator, though with different names. For logarithms, $\\ln$ becomes `log` and $\\log$ is `log10` (computer programs almost exclusively reserve `log` for the natural log); for factorials, $x!$, there is `factorial`; for powers $\\sqrt{}$ becomes `sqrt`, $EXP$ becomes `exp`, and $x^y$ is computed with the infix operator `^`. For the trigonometric functions, the basic names are similar: `sin`, `cos`, `tan`. These expect radians. For angles in degrees, the convenience functions `sind`, `cosd`, and `tand` are provided. On the calculator, inverse functions like $\\sin^{-1}(x)$ are done by combining $Inv$ with $\\sin$. With `Julia`, the function name is `asin`, an abbreviation for \"arcsine.\" (Which is a good thing, as the notation using a power of $-1$ is often a source of confusion and is not supported by `Julia` without work.) Similarly, there are `asind`, `acos`, `acosd`, `atan`, and `atand` functions available to the `Julia` user.\n\n\nThe following table summarizes the above:\n\n::: {.cell execution_count=34}\n\n::: {.cell-output .cell-output-display execution_count=35}\n```{=html}\n\n<div class=\"table-responsive\">\n<table class=\"table table-hover\">\n<tr><th>Calculator</th><th>Julia</th></tr>\n\n<tr><td><div class=\"markdown\"><p>\\(+\\), \\(-\\), \\(\\times\\), \\(\\div\\)</p>\n</div></td><td><div class=\"markdown\"><p><code>&#43;</code>, <code>-</code>, <code>*</code>, <code>/</code></p>\n</div></td></tr>\n<tr><td><div class=\"markdown\">\\(x^y\\)\n</div></td><td><div class=\"markdown\"><p><code>^</code></p>\n</div></td></tr>\n<tr><td><div class=\"markdown\">\\(\\sqrt{}, \\sqrt[3]{}\\)\n</div></td><td><div class=\"markdown\"><p><code>sqrt</code>, <code>cbrt</code></p>\n</div></td></tr>\n<tr><td><div class=\"markdown\">\\(e^x\\)\n</div></td><td><div class=\"markdown\"><p><code>exp</code></p>\n</div></td></tr>\n<tr><td><div class=\"markdown\"><p>\\(\\ln\\), \\(\\log\\)</p>\n</div></td><td><div class=\"markdown\"><p><code>log</code>, <code>log10</code></p>\n</div></td></tr>\n<tr><td><div class=\"markdown\">\\(\\sin, \\cos, \\tan, \\sec, \\csc, \\cot\\)\n</div></td><td><div class=\"markdown\"><p><code>sin</code>, <code>cos</code>, <code>tan</code>, <code>sec</code>, <code>csc</code>, <code>cot</code></p>\n</div></td></tr>\n<tr><td><div class=\"markdown\"><p>In degrees, not radians</p>\n</div></td><td><div class=\"markdown\"><p><code>sind</code>, <code>cosd</code>, <code>tand</code>, <code>secd</code>, <code>cscd</code>, <code>cotd</code></p>\n</div></td></tr>\n<tr><td><div class=\"markdown\">\\(\\sin^{-1}, \\cos^{-1}, \\tan^{-1}\\)\n</div></td><td><div class=\"markdown\"><p><code>asin</code>, <code>acos</code>, <code>atan</code></p>\n</div></td></tr>\n<tr><td><div class=\"markdown\">\\(n!\\)\n</div></td><td><div class=\"markdown\"><p><code>factorial</code></p>\n</div></td></tr>\n\n</table>\n</div>\n\n```\n:::\n:::\n\n\nUsing a function is very straightforward. A function is called using parentheses, in a manner visually similar to how a function is called mathematically. So if we consider the `sqrt` function, we have:\n\n::: {.cell execution_count=35}\n``` {.julia .cell-code}\nsqrt(4), sqrt(5)\n```\n\n::: {.cell-output .cell-output-display execution_count=36}\n```\n(2.0, 2.23606797749979)\n```\n:::\n:::\n\n\nThe function is referred to by name (`sqrt`) and called with parentheses. Any arguments are passed into the function using commas to separate values, should there be more than one. When there are numerous values for a function, the arguments may need to be given in a specific order or may possibly be specified with *keywords*. (A semicolon can be used instead of a comma to separate keyword arguments.)\n\n\nSome more examples:\n\n::: {.cell execution_count=36}\n``` {.julia .cell-code}\nexp(2), log(10), sqrt(100), 10^(1/2)\n```\n\n::: {.cell-output .cell-output-display execution_count=37}\n```\n(7.38905609893065, 2.302585092994046, 10.0, 3.1622776601683795)\n```\n:::\n:::\n\n\n:::{.callout-note}\n## Note\nParentheses 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.\n\n:::\n\n### Multiple arguments\n\n\nFor the logarithm, we mentioned that `log` is the natural log and `log10` implements the logarithm base 10. As well there is `log2`. However, in general there is no `logb` for any base `b`. Instead, the basic `log` function can take *two* arguments. When it does, the first is the base, and the second the value to take the logarithm of. This avoids forcing the user to remember that $\\log_b(x) = \\log(x)/\\log(b)$.\n\n\nSo we have all these different, but related, uses to find logarithms:\n\n::: {.cell execution_count=37}\n``` {.julia .cell-code}\nlog(e), log(2, e), log(10, e), log(e, 2)\n```\n\n::: {.cell-output .cell-output-display execution_count=38}\n```\n(1.0, 1.4426950408889634, 0.43429448190325176, 0.6931471805599453)\n```\n:::\n:::\n\n\nIn `Julia`, the \"generic\" function `log` not only has different implementations for different types of arguments (real or complex), but also has a different implementation depending on the number of arguments.\n\n\n### Examples\n\n\n##### Example\n\n\nA right triangle has sides $a=11$ and $b=12$. Find the length of the hypotenuse. As $c^2 = a^2 + b^2$ we have:\n\n::: {.cell execution_count=38}\n``` {.julia .cell-code}\nsqrt(11^2 + 12^2)\n```\n\n::: {.cell-output .cell-output-display execution_count=39}\n```\n16.278820596099706\n```\n:::\n:::\n\n\n##### Example\n\n\nA formula from statistics to compute the variance of a binomial random variable for parameters $p$ and $n$ is $\\sqrt{n p (1-p)}$. Compute this value for $p=1/4$ and $n=10$.\n\n::: {.cell execution_count=39}\n``` {.julia .cell-code}\nsqrt(10 * 1/4 * (1 - 1/4))\n```\n\n::: {.cell-output .cell-output-display execution_count=40}\n```\n1.3693063937629153\n```\n:::\n:::\n\n\n##### Example\n\n\nFind the distance between the points $(-3, -4)$ and $(5,6)$. Using the distance formula $\\sqrt{(x_1-x_0)^2+(y_1-y_0)^2}$, we have:\n\n::: {.cell execution_count=40}\n``` {.julia .cell-code}\nsqrt((5 - -3)^2 + (6 - -4)^2)\n```\n\n::: {.cell-output .cell-output-display execution_count=41}\n```\n12.806248474865697\n```\n:::\n:::\n\n\n##### Example\n\n\nThe formula to compute the resistance of two resistors in parallel is given by: $1/(1/r_1 + 1/r_2)$. Suppose the resistance is $10$ in one resistor and $20$ in the other. What is the resistance in parallel?\n\n::: {.cell execution_count=41}\n``` {.julia .cell-code}\n1 / (1/10 + 1/20)\n```\n\n::: {.cell-output .cell-output-display execution_count=42}\n```\n6.666666666666666\n```\n:::\n:::\n\n\n## Errors\n\n\nNot all computations on a calculator are valid. For example, the Google calculator will display `Error` as the output of $0/0$ or $\\sqrt{-1}$. These are also errors mathematically, though the second is not if the complex numbers are considered.\n\n\nIn `Julia`, there is a richer set of error types. The value `0/0` will in fact not be an error, but rather a value `NaN`. This is a special floating point value indicating \"not a number\" and is the result for various operations. The output of $\\sqrt{-1}$ (computed via `sqrt(-1)`) will indicate a domain error:\n\n::: {.cell execution_count=42}\n``` {.julia .cell-code}\nsqrt(-1)\n```\n\n::: {.cell-output .cell-output-error}\n```\nLoadError: DomainError with -1.0:\nsqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).\n```\n:::\n:::\n\n\nFor integer or real-valued inputs, the `sqrt` function expects non-negative values, so that the output will always be a real number.\n\n\nThere are other types of errors. Overflow is a common one on most calculators. The value of $1000!$ is actually *very* large (over 2500 digits large). On the Google calculator it returns `Infinity`, a slight stretch. For `factorial(1000)` `Julia` returns an `OverflowError`. This means that the answer is too large to be represented as a regular integer.\n\n::: {.cell execution_count=43}\n``` {.julia .cell-code}\nfactorial(1000)\n```\n\n::: {.cell-output .cell-output-error}\n```\nLoadError: OverflowError: 1000 is too large to look up in the table; consider using `factorial(big(1000))` instead\n```\n:::\n:::\n\n\nHow `Julia` handles overflow is a study in tradeoffs. For integer operations that demand high performance, `Julia` does not check for overflow. So, for example, if we are not careful strange answers can be had. Consider the difference here between powers of 2:\n\n::: {.cell execution_count=44}\n``` {.julia .cell-code}\n2^62, 2^63\n```\n\n::: {.cell-output .cell-output-display execution_count=45}\n```\n(4611686018427387904, -9223372036854775808)\n```\n:::\n:::\n\n\nOn a machine with $64$-bit integers, the first of these two values is correct, the second, clearly wrong, as the answer given is negative. This is due to overflow. The cost of checking is considered too high, so no error is thrown. The user is expected to have a sense that they need to be careful when their values are quite large. (Or the user can use floating point numbers, which though not always exact, can represent much bigger values and are exact for a reasonably wide range of integer values.)\n\n\n:::{.callout-warning}\n## Warning\nIn 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.\n\n:::\n\n##### Example\n\n\nDid Homer Simpson disprove [Fermat's Theorem](http://www.npr.org/sections/krulwich/2014/05/08/310818693/did-homer-simpson-actually-solve-fermat-s-last-theorem-take-a-look)?\n\n\nFermat's theorem states there are no solutions over the integers to $a^n + b^n = c^n$ when $n > 2$. In the photo accompanying the linked article, we see:\n\n\n\n$$\n3987^{12} + 4365^{12} - 4472^{12}.\n$$\n\n\nIf you were to do this on most calculators, the answer would be $0$. Were this true, it would show that there is at least one solution to $a^{12} + b^{12} = c^{12}$ over the integers - hence Fermat would be wrong. So is it $0$?\n\n\nWell, let's try something with `Julia` to see. Being clever, we check if $(3987^{12} + 4365^{12})^{1/12} = 4472$:\n\n::: {.cell execution_count=45}\n``` {.julia .cell-code}\n(3987^12 + 4365^12)^(1/12)\n```\n\n::: {.cell-output .cell-output-display execution_count=46}\n```\n28.663217591132355\n```\n:::\n:::\n\n\nNot even close. Case closed. But wait? This number to be found must be *at least* as big as $3987$ and we got $28$. Doh! Something can't be right. Well, maybe integer powers are being an issue. (The largest $64$-bit integer is less than $10^{19}$ and we can see that $(4\\cdot 10^3)^{12}$ is bigger than $10^{36})$. Trying again using floating point values for the base, we see:\n\n::: {.cell execution_count=46}\n``` {.julia .cell-code}\n(3987.0^12 + 4365.0^12)^(1/12)\n```\n\n::: {.cell-output .cell-output-display execution_count=47}\n```\n4472.000000007058\n```\n:::\n:::\n\n\nAhh, we see something really close to $4472$, but not exactly. Why do most calculators get this last part wrong? It isn't that they don't use floating point, but rather the difference between the two numbers:\n\n::: {.cell execution_count=47}\n``` {.julia .cell-code}\n(3987.0^12 + 4365.0^12)^(1/12) - 4472\n```\n\n::: {.cell-output .cell-output-display execution_count=48}\n```\n7.057678885757923e-9\n```\n:::\n:::\n\n\nis less than $10^{-8}$ so on a display with $8$ digits may be rounded to $0$.\n\n\nMoral: with `Julia` and with calculators, we still have to be mindful not to blindly accept an answer.\n\n\n## Questions\n\n\n###### Question\n\n\nCompute $22/7$ with `Julia`.\n\n::: {.cell hold='true' execution_count=48}\n\n::: {.cell-output .cell-output-display execution_count=49}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='2707284837395280667' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_2707284837395280667\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"2707284837395280667\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='2707284837395280667_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"2707284837395280667\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 3.142857142857143) <= 0.001);\n var msgBox = document.getElementById('2707284837395280667_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_2707284837395280667\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_2707284837395280667\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nCompute $\\sqrt{220}$ with `Julia`.\n\n::: {.cell hold='true' execution_count=49}\n\n::: {.cell-output .cell-output-display execution_count=50}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='1469780136784502398' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_1469780136784502398\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"1469780136784502398\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='1469780136784502398_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"1469780136784502398\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 14.832396974191326) <= 0.001);\n var msgBox = document.getElementById('1469780136784502398_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_1469780136784502398\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_1469780136784502398\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nCompute $2^8$ with `Julia`.\n\n::: {.cell hold='true' execution_count=50}\n\n::: {.cell-output .cell-output-display execution_count=51}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='17636315183480905659' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_17636315183480905659\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"17636315183480905659\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='17636315183480905659_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"17636315183480905659\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 256) <= 0);\n var msgBox = document.getElementById('17636315183480905659_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_17636315183480905659\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_17636315183480905659\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nCompute the value of\n\n\n\n$$\n\\frac{9 - 5 \\cdot (3-4)}{6 - 2}.\n$$\n\n::: {.cell hold='true' execution_count=51}\n\n::: {.cell-output .cell-output-display execution_count=52}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='916735451525325958' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_916735451525325958\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"916735451525325958\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='916735451525325958_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"916735451525325958\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 3.5) <= 0.001);\n var msgBox = document.getElementById('916735451525325958_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_916735451525325958\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_916735451525325958\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nCompute the following using `Julia`:\n\n\n\n$$\n\\frac{(.25 - .2)^2}{(1/4)^2 + (1/3)^2}\n$$\n\n::: {.cell hold='true' execution_count=52}\n\n::: {.cell-output .cell-output-display execution_count=53}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='15357330293742070961' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_15357330293742070961\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"15357330293742070961\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='15357330293742070961_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"15357330293742070961\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 0.014399999999999993) <= 0.001);\n var msgBox = document.getElementById('15357330293742070961_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_15357330293742070961\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_15357330293742070961\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nCompute the decimal representation of the following using `Julia`:\n\n\n\n$$\n1 + \\frac{1}{2} + \\frac{1}{2^2} + \\frac{1}{2^3} + \\frac{1}{2^4}\n$$\n\n::: {.cell hold='true' execution_count=53}\n\n::: {.cell-output .cell-output-display execution_count=54}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='14810865975156266866' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_14810865975156266866\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"14810865975156266866\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='14810865975156266866_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"14810865975156266866\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 1.9375) <= 0.001);\n var msgBox = document.getElementById('14810865975156266866_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_14810865975156266866\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_14810865975156266866\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nCompute the following using `Julia`:\n\n\n\n$$\n\\frac{3 - 2^2}{4 - 2\\cdot3}\n$$\n\n::: {.cell hold='true' execution_count=54}\n\n::: {.cell-output .cell-output-display execution_count=55}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='3089233332313954079' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_3089233332313954079\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"3089233332313954079\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='3089233332313954079_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"3089233332313954079\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 0.5) <= 0.001);\n var msgBox = document.getElementById('3089233332313954079_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_3089233332313954079\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_3089233332313954079\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nCompute the following using `Julia`:\n\n\n\n$$\n(1/2) \\cdot 32 \\cdot 3^2 + 100 \\cdot 3 - 20\n$$\n\n::: {.cell hold='true' execution_count=55}\n\n::: {.cell-output .cell-output-display execution_count=56}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='2644468498157595882' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_2644468498157595882\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"2644468498157595882\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='2644468498157595882_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"2644468498157595882\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 424.0) <= 0.001);\n var msgBox = document.getElementById('2644468498157595882_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_2644468498157595882\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_2644468498157595882\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nWich of the following is a valid `Julia` expression for\n\n\n\n$$\n\\frac{3 - 2}{4 - 1}\n$$\n\n\nthat uses the least number of parentheses?\n\n::: {.cell hold='true' execution_count=56}\n\n::: {.cell-output .cell-output-display execution_count=57}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='12720961597508922444' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_12720961597508922444\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_12720961597508922444_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_12720961597508922444\"\n id=\"radio_12720961597508922444_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n <code>&#40;3 - 2&#41;/ 4 - 1</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_12720961597508922444_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_12720961597508922444\"\n id=\"radio_12720961597508922444_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n <code>3 - 2 / &#40;4 - 1&#41;</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_12720961597508922444_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_12720961597508922444\"\n id=\"radio_12720961597508922444_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n <code>&#40;3 - 2&#41; / &#40;4 - 1&#41;</code>\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='12720961597508922444_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_12720961597508922444\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 3;\n var msgBox = document.getElementById('12720961597508922444_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_12720961597508922444\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_12720961597508922444\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nWich of the following is a valid `Julia` expression for\n\n\n\n$$\n\\frac{3\\cdot2}{4}\n$$\n\n\nthat uses the least number of parentheses?\n\n::: {.cell hold='true' execution_count=57}\n\n::: {.cell-output .cell-output-display execution_count=58}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='4638455306928547837' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_4638455306928547837\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_4638455306928547837_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_4638455306928547837\"\n id=\"radio_4638455306928547837_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n <code>&#40;3 * 2&#41; / 4</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_4638455306928547837_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_4638455306928547837\"\n id=\"radio_4638455306928547837_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n <code>3 * 2 / 4</code>\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='4638455306928547837_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_4638455306928547837\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 2;\n var msgBox = document.getElementById('4638455306928547837_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_4638455306928547837\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_4638455306928547837\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nWhich of the following is a valid `Julia` expression for\n\n\n\n$$\n2^{4 - 2}\n$$\n\n\nthat uses the least number of parentheses?\n\n::: {.cell hold='true' execution_count=58}\n\n::: {.cell-output .cell-output-display execution_count=59}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='7311129893676026074' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_7311129893676026074\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_7311129893676026074_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_7311129893676026074\"\n id=\"radio_7311129893676026074_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n <code>2 ^ &#40;4 - 2&#41;</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_7311129893676026074_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_7311129893676026074\"\n id=\"radio_7311129893676026074_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n <code>2 ^ 4 - 2</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_7311129893676026074_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_7311129893676026074\"\n id=\"radio_7311129893676026074_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n <code>&#40;2 ^ 4&#41; - 2</code>\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='7311129893676026074_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_7311129893676026074\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 1;\n var msgBox = document.getElementById('7311129893676026074_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_7311129893676026074\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_7311129893676026074\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nIn the U.S. version of the Office, the opening credits include a calculator calculation. The key sequence shown is `9653 +` which produces `11532`. What value was added to?\n\n::: {.cell hold='true' execution_count=59}\n\n::: {.cell-output .cell-output-display execution_count=60}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='7056678514438295107' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_7056678514438295107\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"7056678514438295107\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='7056678514438295107_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"7056678514438295107\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 1879) <= 0);\n var msgBox = document.getElementById('7056678514438295107_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_7056678514438295107\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_7056678514438295107\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nWe saw that `1 / 2 / 3 / 4 / 5 / 6` is about $14$ divided by $10,000$. But what would be a more familiar expression representing it:\n\n::: {.cell hold='true' execution_count=60}\n\n::: {.cell-output .cell-output-display execution_count=61}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='10572622881436477837' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_10572622881436477837\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_10572622881436477837_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_10572622881436477837\"\n id=\"radio_10572622881436477837_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n <code>1 / &#40;2 / 3 / 4 / 5 / 6&#41;</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_10572622881436477837_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_10572622881436477837\"\n id=\"radio_10572622881436477837_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n <code>1 /&#40;2 * 3 * 4 * 5 * 6&#41;</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_10572622881436477837_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_10572622881436477837\"\n id=\"radio_10572622881436477837_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n <code>1 / 2 * 3 / 4 * 5 / 6</code>\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='10572622881436477837_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_10572622881436477837\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 2;\n var msgBox = document.getElementById('10572622881436477837_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_10572622881436477837\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_10572622881436477837\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nOne of these three expressions will produce a different answer, select that one:\n\n::: {.cell hold='true' execution_count=61}\n\n::: {.cell-output .cell-output-display execution_count=62}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='11368071522042367814' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_11368071522042367814\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_11368071522042367814_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_11368071522042367814\"\n id=\"radio_11368071522042367814_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n <code>2 - &#40;3 - 4&#41;</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_11368071522042367814_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_11368071522042367814\"\n id=\"radio_11368071522042367814_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n <code>2 - 3 - 4</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_11368071522042367814_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_11368071522042367814\"\n id=\"radio_11368071522042367814_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n <code>&#40;2 - 3&#41; - 4</code>\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='11368071522042367814_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_11368071522042367814\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 1;\n var msgBox = document.getElementById('11368071522042367814_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_11368071522042367814\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_11368071522042367814\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nOne of these three expressions will produce a different answer, select that one:\n\n::: {.cell hold='true' execution_count=62}\n\n::: {.cell-output .cell-output-display execution_count=63}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='13542899995679480380' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_13542899995679480380\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_13542899995679480380_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_13542899995679480380\"\n id=\"radio_13542899995679480380_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n <code>2 - 3 * 4</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_13542899995679480380_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_13542899995679480380\"\n id=\"radio_13542899995679480380_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n <code>&#40;2 - 3&#41; * 4</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_13542899995679480380_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_13542899995679480380\"\n id=\"radio_13542899995679480380_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n <code>2 - &#40;3 * 4&#41;</code>\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='13542899995679480380_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_13542899995679480380\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 2;\n var msgBox = document.getElementById('13542899995679480380_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_13542899995679480380\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_13542899995679480380\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nOne of these three expressions will produce a different answer, select that one:\n\n::: {.cell hold='true' execution_count=63}\n\n::: {.cell-output .cell-output-display execution_count=64}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='8576425324776872069' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_8576425324776872069\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_8576425324776872069_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_8576425324776872069\"\n id=\"radio_8576425324776872069_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n <code>-&#40;1^2&#41;</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_8576425324776872069_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_8576425324776872069\"\n id=\"radio_8576425324776872069_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n <code>&#40;-1&#41;^2</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_8576425324776872069_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_8576425324776872069\"\n id=\"radio_8576425324776872069_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n <code>-1^2</code>\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='8576425324776872069_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_8576425324776872069\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 2;\n var msgBox = document.getElementById('8576425324776872069_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_8576425324776872069\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_8576425324776872069\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nWhat is the value of $\\sin(\\pi/10)$?\n\n::: {.cell hold='true' execution_count=64}\n\n::: {.cell-output .cell-output-display execution_count=65}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='11840849613948748839' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_11840849613948748839\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"11840849613948748839\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='11840849613948748839_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"11840849613948748839\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 0.3090169943749474) <= 0.001);\n var msgBox = document.getElementById('11840849613948748839_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_11840849613948748839\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_11840849613948748839\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nWhat is the value of $\\sin(52^\\circ)$?\n\n::: {.cell hold='true' execution_count=65}\n\n::: {.cell-output .cell-output-display execution_count=66}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='10129368280704520752' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_10129368280704520752\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"10129368280704520752\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='10129368280704520752_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"10129368280704520752\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 0.788010753606722) <= 0.001);\n var msgBox = document.getElementById('10129368280704520752_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_10129368280704520752\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_10129368280704520752\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nWhat is the value of\n\n\n\n$$\n\\frac{\\sin(\\pi/3) - 1/2}{\\pi/3 - \\pi/6}\n$$\n\n::: {.cell hold='true' execution_count=66}\n\n::: {.cell-output .cell-output-display execution_count=67}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='13441349926300566779' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_13441349926300566779\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"13441349926300566779\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='13441349926300566779_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"13441349926300566779\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 0.6990570277140041) <= 0.001);\n var msgBox = document.getElementById('13441349926300566779_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_13441349926300566779\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_13441349926300566779\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nIs $\\sin^{-1}(\\sin(3\\pi/2))$ equal to $3\\pi/2$? (The \"arc\" functions do no use power notation, but instead a prefix of `a`.)\n\n::: {.cell hold='true' execution_count=67}\n\n::: {.cell-output .cell-output-display execution_count=68}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='12846901546368670317' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_12846901546368670317\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_12846901546368670317_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_12846901546368670317\"\n id=\"radio_12846901546368670317_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n Yes\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_12846901546368670317_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_12846901546368670317\"\n id=\"radio_12846901546368670317_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n No\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='12846901546368670317_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_12846901546368670317\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 2;\n var msgBox = document.getElementById('12846901546368670317_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_12846901546368670317\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_12846901546368670317\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nWhat is the value of `round(3.5000)`\n\n::: {.cell hold='true' execution_count=68}\n\n::: {.cell-output .cell-output-display execution_count=69}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='1174830050822701506' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_1174830050822701506\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"1174830050822701506\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='1174830050822701506_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"1174830050822701506\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 4.0) <= 0.001);\n var msgBox = document.getElementById('1174830050822701506_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_1174830050822701506\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_1174830050822701506\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nWhat is the value of `sqrt(32 - 12)`\n\n::: {.cell hold='true' execution_count=69}\n\n::: {.cell-output .cell-output-display execution_count=70}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='4480147880015049912' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_4480147880015049912\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"4480147880015049912\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='4480147880015049912_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"4480147880015049912\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 4.47213595499958) <= 0.001);\n var msgBox = document.getElementById('4480147880015049912_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_4480147880015049912\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_4480147880015049912\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nWhich is greater $e^\\pi$ or $\\pi^e$?\n\n::: {.cell hold='true' execution_count=70}\n\n::: {.cell-output .cell-output-display execution_count=71}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='15507250772322884239' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_15507250772322884239\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_15507250772322884239_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_15507250772322884239\"\n id=\"radio_15507250772322884239_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n \\(e^{\\pi}\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_15507250772322884239_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_15507250772322884239\"\n id=\"radio_15507250772322884239_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n \\(\\pi^{e}\\)\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='15507250772322884239_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_15507250772322884239\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 1;\n var msgBox = document.getElementById('15507250772322884239_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_15507250772322884239\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_15507250772322884239\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nWhat is the value of $\\pi - (x - \\sin(x)/\\cos(x))$ when $x=3$?\n\n::: {.cell hold='true' execution_count=71}\n\n::: {.cell-output .cell-output-display execution_count=72}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='7962049342928745198' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_7962049342928745198\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"7962049342928745198\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='7962049342928745198_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"7962049342928745198\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - -0.0009538894844847157) <= 0.001);\n var msgBox = document.getElementById('7962049342928745198_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_7962049342928745198\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_7962049342928745198\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nFactorials in `Julia` are computed with the function `factorial`, not the postfix operator `!`, as with math notation. What is $10!$?\n\n::: {.cell hold='true' execution_count=72}\n\n::: {.cell-output .cell-output-display execution_count=73}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='14248980175605238452' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_14248980175605238452\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"14248980175605238452\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='14248980175605238452_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"14248980175605238452\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 3628800) <= 0);\n var msgBox = document.getElementById('14248980175605238452_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_14248980175605238452\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_14248980175605238452\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nWill `-2^2` produce `4` (which is a unary `-` evaluated *before* `^`) or `-4` (which is a unary `-` evaluated *after* `^`)?\n\n::: {.cell hold='true' execution_count=73}\n\n::: {.cell-output .cell-output-display execution_count=74}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='11527391987522023763' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_11527391987522023763\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_11527391987522023763_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_11527391987522023763\"\n id=\"radio_11527391987522023763_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n <code>-4</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_11527391987522023763_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_11527391987522023763\"\n id=\"radio_11527391987522023763_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n <code>4</code>\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='11527391987522023763_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_11527391987522023763\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 1;\n var msgBox = document.getElementById('11527391987522023763_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_11527391987522023763\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_11527391987522023763\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\n###### Question\n\n\nA twitter post from popular mechanics generated some attention.\n\n\n![](https://raw.githubusercontent.com/jverzani/CalculusWithJuliaNotes.jl/master/CwJ/precalc/figures/order_operations_pop_mech.png)\n\n\nWhat is the answer?\n\n::: {.cell hold='true' execution_count=74}\n\n::: {.cell-output .cell-output-display execution_count=75}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='14440223491503027624' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_14440223491503027624\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"14440223491503027624\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='14440223491503027624_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"14440223491503027624\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 16.0) <= 0.001);\n var msgBox = document.getElementById('14440223491503027624_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_14440223491503027624\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_14440223491503027624\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\nDoes this expression return the *correct* answer using proper order of operations?\n\n::: {.cell execution_count=75}\n``` {.julia .cell-code}\n8÷2(2+2)\n```\n\n::: {.cell-output .cell-output-display execution_count=76}\n```\n1\n```\n:::\n:::\n\n\n::: {.cell hold='true' execution_count=76}\n\n::: {.cell-output .cell-output-display execution_count=77}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='14314703439762892898' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_14314703439762892898\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_14314703439762892898_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_14314703439762892898\"\n id=\"radio_14314703439762892898_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n Yes\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_14314703439762892898_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_14314703439762892898\"\n id=\"radio_14314703439762892898_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n No\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='14314703439762892898_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_14314703439762892898\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 2;\n var msgBox = document.getElementById('14314703439762892898_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_14314703439762892898\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_14314703439762892898\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\nWhy or why not:\n\n::: {.cell hold='true' execution_count=77}\n\n::: {.cell-output .cell-output-display execution_count=78}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='3838121093989944316' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_3838121093989944316\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_3838121093989944316_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_3838121093989944316\"\n id=\"radio_3838121093989944316_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n Of course it is correct.\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_3838121093989944316_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_3838121093989944316\"\n id=\"radio_3838121093989944316_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n The precedence of numeric literal coefficients used for implicit multiplication is higher than other binary operators such as multiplication &#40;<code>*</code>&#41;, and division &#40;<code>/</code>, <code>\\</code>, and <code>//</code>&#41;\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='3838121093989944316_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_3838121093989944316\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 2;\n var msgBox = document.getElementById('3838121093989944316_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_3838121093989944316\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_3838121093989944316\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\n",
"supporting": [
"calculator_files"
],
"filters": [],
"includes": {
"include-in-header": [
"<script src=\"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js\" integrity=\"sha512-c3Nl8+7g4LMSTdrm621y7kf9v3SDPnhxLNhcjFJbKECVnmZHTdo+IRO05sNLTH/D3vA6u1X32ehoLC7WFVdheg==\" crossorigin=\"anonymous\"></script>\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js\" integrity=\"sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==\" crossorigin=\"anonymous\"></script>\n<script type=\"application/javascript\">define('jquery', [],function() {return window.jQuery;})</script>\n"
]
}
}
}