use quarto, not Pluto to render pages
This commit is contained in:
1 parent
93c993206a
commit
7b37ca828c
879 files changed
+793311
-2678
No files matched your search
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"hash": "ec2f1c30dff010f5e3f1a13e16f47fea",
|
||||
"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\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! Copying and pasting an expression with a minus sign can lead to hard to understand errors such as: <code>invalid character "−"</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 (e.g., \\(1 - \\pi\\)) than for the code within cells (e.g. <code>1 - 2</code>). 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::: {.cellLine truncated
|
||||
"supporting": [
|
||||
"calculator_files/figure-html"
|
||||
],
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user