15 lines
52 KiB
JSON
15 lines
52 KiB
JSON
{
|
||
"hash": "38c114c653a0c94ca4cbef8ec3c61239",
|
||
"result": {
|
||
"markdown": "# Function manipulations\n\n\n\nIn this section we will use these add-on packages:\n\n``` {.julia .cell-code}\nusing CalculusWithJulia\nusing Plots\n```\n\n\n\n\n---\n\n\nThinking of functions as objects themselves that can be manipulated - rather than just blackboxes for evaluation - is a major abstraction of calculus. The main operations to come: the limit *of a function*, the derivative *of a function*, and the integral *of a function* all operate on functions. Hence the idea of an [operator](http://tinyurl.com/n5gp6mf). Here we discuss manipulations of functions from pre-calculus that have proven to be useful abstractions.\n\n\n## The algebra of functions\n\n\nWe can talk about the algebra of functions. For example, the sum of functions $f$ and $g$ would be a function whose value at $x$ was just $f(x) + g(x)$. More formally, we would have:\n\n\n\n$$\n(f + g)(x) = f(x) + g(x),\n$$\n\n\nWe have given meaning to a new function $f+g$ by defining what is does to $x$ with the rule on the right hand side. Similarly, we can define operations for subtraction, multiplication, addition, and powers.\n\n\nThese mathematical concepts aren't defined for functions in base `Julia`, though they could be if desired, by a commands such as:\n\n::: {.cell execution_count=4}\n``` {.julia .cell-code}\nimport Base: +\nf::Function + g::Function = x -> f(x) + g(x)\n```\n\n::: {.cell-output .cell-output-display execution_count=5}\n```\n+ (generic function with 314 methods)\n```\n:::\n:::\n\n\nThis adds a method to the generic `+` function for functions. The type annotations `::Function` ensure this applies only to functions. To see that it would work, we could do odd-looking things like:\n\n::: {.cell execution_count=5}\n``` {.julia .cell-code}\nss = sin + sqrt\nss(4)\n```\n\n::: {.cell-output .cell-output-display execution_count=6}\n```\n1.2431975046920718\n```\n:::\n:::\n\n\nDoing this works, as Julia treats functions as first class objects, lending itself to [higher](https://en.wikipedia.org/wiki/Higher-order_programming) order programming. However, this definition in general is kind of limiting, as functions in mathematics and Julia can be much more varied than just the univariate functions we have defined addition for. We won't pursue this further.\n\n\n### Composition of functions\n\n\nAs seen, just like with numbers, it can make sense mathematically to define addition, subtraction, multiplication and division of functions. Unlike numbers though, we can also define a new operation on functions called **composition** that involves chaining the output of one function to the input of another. Composition is a common practice in life, where the result of some act is fed into another process. For example, making a pie from scratch involves first making a crust, then composing this with a filling. A better abstraction might be how we \"surf\" the web. The output of one search leads us to another search whose output then is a composition.\n\n\nMathematically, a composition of univariate functions $f$ and $g$ is written $f \\circ g$ and defined by what it does to a value in the domain of $g$ by:\n\n\n\n$$\n(f \\circ g)(x) = f(g(x)).\n$$\n\n\nThe output of $g$ becomes the input of $f$.\n\n\nComposition depends on the order of things. There is no guarantee that $f \\circ g$ should be the same as $g \\circ f$. (Putting on socks then shoes is quite different from putting on shoes then socks.) Mathematically, we can see this quite clearly with the functions $f(x) = x^2$ and $g(x) = \\sin(x)$. Algebraically we have:\n\n\n\n$$\n(f \\circ g)(x) = \\sin(x)^2, \\quad (g \\circ f)(x) = \\sin(x^2).\n$$\n\n\nThough they may be *typographically* similar don't be fooled, the following graph shows that the two functions aren't even close except for $x$ near $0$ (for example, one composition is always non-negative, whereas the other is not):\n\n::: {.cell hold='true' execution_count=6}\n``` {.julia .cell-code}\nf(x) = x^2\ng(x) = sin(x)\nfg = f ∘ g # typed as f \\circ[tab] g\ngf = g ∘ f # typed as g \\circ[tab] f\nplot(fg, -2, 2, label=\"f∘g\")\nplot!(gf, label=\"g∘f\")\n```\n\n::: {.cell-output .cell-output-display execution_count=7}\n{}\n:::\n:::\n\n\n:::{.callout-note}\n## Note\nUnlike how the basic arithmetic operations are treated, `Julia` defines the infix Unicode operator `\\\\circ[tab]` to represent composition of functions, mirroring mathematical notation. This infix operations takes in two functions and returns an anonymous function. It can be useful and will mirror standard mathematical usage up to issues with precedence rules.\n\n:::\n\nStarting with two functions and composing them requires nothing more than a solid grasp of knowing the rules of function evaluation. If $f(x)$ is defined by some rule involving $x$, then $f(g(x))$ just replaces each $x$ in the rule with a $g(x)$.\n\n\nSo if $f(x) = x^2 + 2x - 1$ and $g(x) = e^x - x$ then $f \\circ g$ would be (before any simplification)\n\n\n\n$$\n(f \\circ g)(x) = (e^x - x)^2 + 2(e^x - x) - 1.\n$$\n\n\nIf can be helpful to think of the argument to $f$ as a \"box\" that gets filled in by $g$:\n\n\n\n$$\n\\begin{align*}\ng(x) &=e^x - x\\\\\nf(\\square) &= (\\square)^2 + 2(\\square) - 1\\\\\nf(g(x)) &= (g(x))^2 + 2(g(x)) - 1 = (e^x - x)^2 + 2(e^x - x) - 1.\n\\end{align*}\n$$\n\n\nHere we look at a few compositions:\n\n\n * The function $h(x) = \\sqrt{1 - x^2}$ can be seen as $f\\circ g$ with $f(x) = \\sqrt{x}$ and $g(x) = 1-x^2$.\n * The function $h(x) = \\sin(x/3 + x^2)$ can be viewed as $f\\circ g$ with $f(x) = \\sin(x)$ and $g(x) = x/3 + x^2$.\n * The function $h(x) = e^{-1/2 \\cdot x^2}$ can be viewed as $f\\circ g$ with $f(x) = e^{-x}$ and $g(x) = (1/2) \\cdot x^2$.\n\n\nDecomposing a function into a composition of functions is not unique, other compositions could have been given above. For example, the last function is also $f(x) = e^{-x/2}$ composed with $g(x) = x^2$.\n\n\n:::{.callout-note}\n## Note\nThe real value of composition is to break down more complicated things into a sequence of easier steps. This is good mathematics, but also good practice more generally. For example, when we approach a problem with the computer, we generally use a smallish set of functions and piece them together (that is, compose them) to find a solution.\n\n:::\n\n### Shifting and scaling graphs\n\n\nIt is very useful to mentally categorize functions within families. The difference between $f(x) = \\cos(x)$ and $g(x) = 12\\cos(2(x - \\pi/4))$ is not that much - both are cosine functions, one is just a simple enough transformation of the other. As such, we expect bounded, oscillatory behaviour with the details of how large and how fast the oscillations are to depend on the specifics of the function. Similarly, both these functions $f(x) = 2^x$ and $g(x)=e^x$ behave like exponential growth, the difference being only in the rate of growth. There are families of functions that are qualitatively similar, but quantitatively different, linked together by a few basic transformations.\n\n\nThere is a set of operations of functions, which does not really change the type of function. Rather, it basically moves and stretches how the functions are graphed. We discuss these four main transformations of $f$:\n\n::: {.cell execution_count=7}\n\n::: {.cell-output .cell-output-display execution_count=8}\n```{=html}\n\n<div class=\"table-responsive\">\n<table class=\"table table-hover\">\n<tr><th>Transformation</th><th>Description</th></tr>\n\n<tr><td><div class=\"markdown\"><p><em>vertical shifts</em></p>\n</div></td><td><div class=\"markdown\"><p>The function \\(h(x) = k + f(x)\\) will have the same graph as \\(f\\) shifted up by \\(k\\) units.</p>\n</div></td></tr>\n<tr><td><div class=\"markdown\"><p><em>horizontal shifts</em></p>\n</div></td><td><div class=\"markdown\"><p>The function \\(h(x) = f(x - k)\\) will have the same graph as \\(f\\) shifted right by \\(k\\) units.</p>\n</div></td></tr>\n<tr><td><div class=\"markdown\"><p><em>stretching</em></p>\n</div></td><td><div class=\"markdown\"><p>The function \\(h(x) = kf(x)\\) will have the same graph as \\(f\\) stretched by a factor of \\(k\\) in the \\(y\\) direction.</p>\n</div></td></tr>\n<tr><td><div class=\"markdown\"><p><em>scaling</em></p>\n</div></td><td><div class=\"markdown\"><p>The function \\(h(x) = f(kx)\\) will have the same graph as \\(f\\) compressed horizontally by a factor of \\(1\\) over \\(k\\).</p>\n</div></td></tr>\n\n</table>\n</div>\n\n```\n:::\n:::\n\n\nThe functions $h$ are derived from $f$ in a predictable way. To implement these transformations within `Julia`, we define operators (functions which transform one function into another). As these return functions, the function bodies are anonymous functions. The basic definitions are similar, save for the `x -> ...` part that signals the creation of an anonymous function to return:\n\n::: {.cell execution_count=8}\n``` {.julia .cell-code}\nup(f, k) = x -> f(x) + k\nover(f, k) = x -> f(x - k)\nstretch(f, k) = x -> k * f(x)\nscale(f, k) = x -> f(k * x)\n```\n\n::: {.cell-output .cell-output-display execution_count=9}\n```\nscale (generic function with 1 method)\n```\n:::\n:::\n\n\nTo illustrate, let's define a hat-shaped function as follows:\n\n::: {.cell execution_count=9}\n``` {.julia .cell-code}\n𝒇(x) = max(0, 1 - abs(x))\n```\n\n::: {.cell-output .cell-output-display execution_count=10}\n```\n𝒇 (generic function with 1 method)\n```\n:::\n:::\n\n\nA plot over the interval $[-2,2]$ is shown here:\n\n::: {.cell execution_count=10}\n``` {.julia .cell-code}\nplot(𝒇, -2,2)\n```\n\n::: {.cell-output .cell-output-display execution_count=11}\n{}\n:::\n:::\n\n\nThe same graph of $f$ and its image shifted up by $2$ units would be given by:\n\n::: {.cell execution_count=11}\n``` {.julia .cell-code}\nplot(𝒇, -2, 2, label=\"f\")\nplot!(up(𝒇, 2), label=\"up\")\n```\n\n::: {.cell-output .cell-output-display execution_count=12}\n{}\n:::\n:::\n\n\nA graph of $f$ and its shift over by $2$ units would be given by:\n\n::: {.cell execution_count=12}\n``` {.julia .cell-code}\nplot(𝒇, -2, 4, label=\"f\")\nplot!(over(𝒇, 2), label=\"over\")\n```\n\n::: {.cell-output .cell-output-display execution_count=13}\n{}\n:::\n:::\n\n\nA graph of $f$ and it being stretched by $2$ units would be given by:\n\n::: {.cell execution_count=13}\n``` {.julia .cell-code}\nplot(𝒇, -2, 2, label=\"f\")\nplot!(stretch(𝒇, 2), label=\"stretch\")\n```\n\n::: {.cell-output .cell-output-display execution_count=14}\n{}\n:::\n:::\n\n\nFinally, a graph of $f$ and it being scaled by $2$ would be given by:\n\n::: {.cell execution_count=14}\n``` {.julia .cell-code}\nplot(𝒇, -2, 2, label=\"f\")\nplot!(scale(𝒇, 2), label=\"scale\")\n```\n\n::: {.cell-output .cell-output-display execution_count=15}\n{}\n:::\n:::\n\n\nScaling by $2$ shrinks the non-zero domain, scaling by $1/2$ would stretch it. If this is not intuitive, the definition `x-> f(x/c)` could have been used, which would have opposite behaviour for scaling.\n\n\n---\n\nMore exciting is what happens if we combine these operations.\n\n\nA shift right by $2$ and up by $1$ is achieved through\n\n::: {.cell execution_count=15}\n``` {.julia .cell-code}\nplot(𝒇, -2, 4, label=\"f\")\nplot!(up(over(𝒇,2), 1), label=\"over and up\")\n```\n\n::: {.cell-output .cell-output-display execution_count=16}\n{}\n:::\n:::\n\n\nShifting and scaling can be confusing. Here we graph `scale(over(𝒇,2),1/3)`:\n\n::: {.cell execution_count=16}\n``` {.julia .cell-code}\nplot(𝒇, -1,9, label=\"f\")\nplot!(scale(over(𝒇,2), 1/3), label=\"over and scale\")\n```\n\n::: {.cell-output .cell-output-display execution_count=17}\n{}\n:::\n:::\n\n\nThis graph is over by $6$ with a width of $3$ on each side of the center. Mathematically, we have $h(x) = f((1/3)\\cdot x - 2)$\n\n\nCompare this to the same operations in opposite order:\n\n::: {.cell execution_count=17}\n``` {.julia .cell-code}\nplot(𝒇, -1, 5, label=\"f\")\nplot!(over(scale(𝒇, 1/3), 2), label=\"scale and over\")\n```\n\n::: {.cell-output .cell-output-display execution_count=18}\n{}\n:::\n:::\n\n\nThis graph first scales the symmetric graph, stretching from $-3$ to $3$, then shifts over right by $2$. The resulting function is $f((1/3)\\cdot (x-2))$.\n\n\nAs a last example, following up on the last example, a common transformation mathematically is\n\n\n\n$$\nh(x) = \\frac{1}{a}f(\\frac{x - b}{a}).\n$$\n\n\nWe can view this as a composition of \"scale\" by $1/a$, then \"over\" by $b$, and finally \"stretch\" by $1/a$:\n\n::: {.cell hold='true' execution_count=18}\n``` {.julia .cell-code}\na = 2; b = 5\n𝒉(x) = stretch(over(scale(𝒇, 1/a), b), 1/a)(x)\nplot(𝒇, -1, 8, label=\"f\")\nplot!(𝒉, label=\"h\")\n```\n\n::: {.cell-output .cell-output-display execution_count=19}\n{}\n:::\n:::\n\n\n(This transformation keeps the same amount of area in the triangles, can you tell from the graph?)\n\n\n##### Example\n\n\nA model for the length of a day in New York City must take into account periodic seasonal effects. A simple model might be a sine curve. However, there would need to be many modifications: Obvious ones would be that the period would need to be about $365$ days, the oscillation around $12$ and the amplitude of the oscillations no more than $12$.\n\n\nWe can be more precise. According to [dateandtime.info](http://dateandtime.info/citysunrisesunset.php?id=5128581) in $2015$ the longest day will be June $21$st when there will be $15$h $5$m $46$s of sunlight, the shortest day will be December $21$st when there will be $9$h $15$m $19$s of sunlight. On January $1$, there will be $9$h $19$m $44$s of sunlight.\n\n\nA model for a transformed sine curve is\n\n\n\n$$\na + b\\sin(d(x - c))\n$$\n\n\nWhere $b$ is related to the amplitude, $c$ the shift and the period is $T=2\\pi/d$. We can find some of these easily from the above:\n\n::: {.cell execution_count=19}\n``` {.julia .cell-code}\na = 12\nb = ((15 + 5/60 + 46/60/60) - (9 + 19/60 + 44/60/60)) / 2\nd = 2pi/365\n```\n\n::: {.cell-output .cell-output-display execution_count=20}\n```\n0.01721420632103996\n```\n:::\n:::\n\n\nIf we let January $1$ be $x=0$ then the first day of spring, March $21$, is day $80$ (`Date(2017, 3, 21) - Date(2017, 1, 1) + 1`). This day aligns with the shift of the sine curve. This shift is $80$:\n\n::: {.cell execution_count=20}\n``` {.julia .cell-code}\nc = 80\n```\n\n::: {.cell-output .cell-output-display execution_count=21}\n```\n80\n```\n:::\n:::\n\n\nPutting this together, we have our graph is \"scaled\" by $d$, \"over\" by $c$, \"stretched\" by $b$ and \"up\" by $a$. Here we plot it over slightly more than one year so that we can see that the shortest day of light is in late December ($x \\approx -10$ or $x \\approx 355$).\n\n::: {.cell execution_count=21}\n``` {.julia .cell-code}\nnewyork(t) = up(stretch(over(scale(sin, d), c), b), a)(t)\nplot(newyork, -20, 385)\n```\n\n::: {.cell-output .cell-output-display execution_count=22}\n{}\n:::\n:::\n\n\nTo test, if we match up with the model powering [dateandtime.info](http://dateandtime.info/citysunrisesunset.php?id=5128581) we note that it predicts \"$15$h $0$m $4$s\" on July $4$, $2015$. This is day $185$ (`Date(2015, 7, 4) - Date(2015, 1, 1) + 1`). Our model prediction has a difference of\n\n::: {.cell execution_count=22}\n``` {.julia .cell-code}\ndatetime = 15 + 0/60 + 4/60/60\ndelta = (newyork(185) - datetime) * 60\n```\n\n::: {.cell-output .cell-output-display execution_count=23}\n```\n-11.874016679895263\n```\n:::\n:::\n\n\nThis is off by a fair amount - almost $12$ minutes. Clearly a trigonometric model, based on the assumption of circular motion of the earth around the sun, is not accurate enough for precise work, but it does help one understand how summer days are longer than winter days and how the length of a day changes fastest at the spring and fall equinoxes.\n\n\n##### Example: a growth model in fisheries\n\n\nThe von Bertalanffy growth [equation](https://en.wikipedia.org/wiki/Von_Bertalanffy_function) is $L(t) =L_\\infty \\cdot (1 - e^{k\\cdot(t-t_0)})$. This family of functions can be viewed as a transformation of the exponential function $f(t)=e^t$. Part is a scaling and shifting (the $e^{k \\cdot (t - t_0)}$) along with some shifting and stretching. The various parameters have physical importance which can be measured: $L_\\infty$ is a carrying capacity for the species or organism, and $k$ is a rate of growth. These parameters may be estimated from data by finding the \"closest\" curve to a given data set.\n\n\n##### Example: the pipeline operator\n\n\nIn the last example, we described our sequence as scale, over, stretch, and up, but code this in reverse order, as the composition $f \\circ g$ is done from right to left. A more convenient notation would be to have syntax that allows the composition of $g$ then $f$ to be written $x \\rightarrow g \\rightarrow f$. `Julia` provides the [pipeline](https://docs.julialang.org/en/v1/manual/functions/#Function-composition-and-piping) operator for chaining function calls together.\n\n\nFor example, if $g(x) = \\sqrt{x}$ and $f(x) =\\sin(x)$ we could call $f(g(x))$ through:\n\n::: {.cell hold='true' execution_count=23}\n``` {.julia .cell-code}\ng(x) = sqrt(x)\nf(x) = sin(x)\npi/2 |> g |> f\n```\n\n::: {.cell-output .cell-output-display execution_count=24}\n```\n0.9500244274657834\n```\n:::\n:::\n\n\nThe output of the preceding expression is passed as the input to the next. This notation is especially convenient when the enclosing function is not the main focus. (Some programming languages have more developed [fluent interfaces](https://en.wikipedia.org/wiki/Fluent_interface) for chaining function calls. Julia has more powerful chaining macros provided in packages, such as `DataPipes.jl` or `Chain.jl`.)\n\n\n### Operators\n\n\nThe functions `up`, `over`, etc. are operators that take a function as an argument and return a function. The use of operators fits in with the template `action(f, args...)`. The action is what we are doing, such as `plot`, `over`, and others to come. The function `f` here is just an object that we are performing the action on. For example, a plot takes a function and renders a graph using the additional arguments to select the domain to view, etc.\n\n\nCreating operators that return functions involves the use of anonymous functions, using these operators is relatively straightforward. Two basic patterns are\n\n\n * Storing the returned function, then calling it:\n\n``` {.julia .cell-code}\nl(x) = action1(f, args...)(x)\nl(10)\n```\n\n\n * Composing two operators:\n\n``` {.julia .cell-code}\naction2( action1(f, args..), other_args...)\n```\n\n\nComposition like the above is convenient, but can get confusing if more than one composition is involved.\n\n\n##### Example: two operators\n\n\n(See [Krill](http://arxiv.org/abs/1403.5821) for background on this example.) Consider two operations on functions. The first takes the *difference* between adjacent points. We call this `D`:\n\n::: {.cell execution_count=26}\n``` {.julia .cell-code}\nD(f::Function) = k -> f(k) - f(k-1)\n```\n\n::: {.cell-output .cell-output-display execution_count=25}\n```\nD (generic function with 1 method)\n```\n:::\n:::\n\n\nTo see that it works, we take a typical function\n\n::: {.cell execution_count=27}\n``` {.julia .cell-code}\n𝐟(k) = 1 + k^2\n```\n\n::: {.cell-output .cell-output-display execution_count=26}\n```\n𝐟 (generic function with 1 method)\n```\n:::\n:::\n\n\nand check:\n\n::: {.cell execution_count=28}\n``` {.julia .cell-code}\nD(𝐟)(3), 𝐟(3) - 𝐟(3-1)\n```\n\n::: {.cell-output .cell-output-display execution_count=27}\n```\n(5, 5)\n```\n:::\n:::\n\n\nThat the two are the same value is no coincidence. (Again, pause for a second to make sure you understand why `D(f)(3)` makes sense. If this is unclear, you could name the function `D(f)` and then call this with a value of `3`.)\n\n\nNow we want a function to cumulatively *sum* the values $S(f)(k) = f(1) + f(2) + \\cdots + f(k-1) + f(k)$, as a function of $k$. Adding up $k$ terms is easy to do with a generator and the function `sum`:\n\n::: {.cell execution_count=29}\n``` {.julia .cell-code}\nS(f) = k -> sum(f(i) for i in 1:k)\n```\n\n::: {.cell-output .cell-output-display execution_count=28}\n```\nS (generic function with 1 method)\n```\n:::\n:::\n\n\nTo check if this works as expected, compare these two values:\n\n::: {.cell execution_count=30}\n``` {.julia .cell-code}\nS(𝐟)(4), 𝐟(1) + 𝐟(2) + 𝐟(3) + 𝐟(4)\n```\n\n::: {.cell-output .cell-output-display execution_count=29}\n```\n(34, 34)\n```\n:::\n:::\n\n\nSo one function adds, the other subtracts. Addition and subtraction are somehow inverse to each other so should \"cancel\" out. This holds for these two operations as well, in the following sense: subtracting after adding leaves the function alone:\n\n::: {.cell execution_count=31}\n``` {.julia .cell-code}\nk = 10 # some arbitrary value k >= 1\nD(S(𝐟))(k), 𝐟(k)\n```\n\n::: {.cell-output .cell-output-display execution_count=30}\n```\n(101, 101)\n```\n:::\n:::\n\n\nAny positive integer value of `k` will give the same answer (up to overflow). This says the difference of the accumulation process is just the last value to accumulate.\n\n\nAdding after subtracting also leaves the function alone, save for a vestige of $f(0)$. For example, `k=15`:\n\n::: {.cell execution_count=32}\n``` {.julia .cell-code}\nS(D(𝐟))(15), 𝐟(15) - 𝐟(0)\n```\n\n::: {.cell-output .cell-output-display execution_count=31}\n```\n(225, 225)\n```\n:::\n:::\n\n\nThat is the accumulation of differences is just the difference of the end values.\n\n\nThese two operations are discrete versions of the two main operations of calculus - the derivative and the integral. This relationship will be known as the \"fundamental theorem of calculus.\"\n\n\n## Questions\n\n\n###### Question\n\n\nIf $f(x) = 1/x$ and $g(x) = x-2$, what is $g(f(x))$?\n\n::: {.cell hold='true' execution_count=33}\n\n::: {.cell-output .cell-output-display execution_count=32}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='6370346390464312703' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_6370346390464312703\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_6370346390464312703_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_6370346390464312703\"\n id=\"radio_6370346390464312703_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n \\(1/(x-2)\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_6370346390464312703_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_6370346390464312703\"\n id=\"radio_6370346390464312703_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n \\(x - 2\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_6370346390464312703_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_6370346390464312703\"\n id=\"radio_6370346390464312703_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n \\(1/x - 2\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_6370346390464312703_4\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_6370346390464312703\"\n id=\"radio_6370346390464312703_4\" value=\"4\">\n </input>\n <span class=\"label-body px-1\">\n \\(-2\\)\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='6370346390464312703_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_6370346390464312703\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 3;\n var msgBox = document.getElementById('6370346390464312703_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_6370346390464312703\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_6370346390464312703\")\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\nIf $f(x) = e^{-x}$ and $g(x) = x^2$ and $h(x) = x-3$, what is $f \\circ g \\circ h$?\n\n::: {.cell hold='true' execution_count=34}\n\n::: {.cell-output .cell-output-display execution_count=33}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='17756555278286854445' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_17756555278286854445\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_17756555278286854445_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_17756555278286854445\"\n id=\"radio_17756555278286854445_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n \\((e^x -3)^2\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_17756555278286854445_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_17756555278286854445\"\n id=\"radio_17756555278286854445_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n \\(e^x+x^2+x-3\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_17756555278286854445_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_17756555278286854445\"\n id=\"radio_17756555278286854445_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n \\(e^{-x^2 - 3}\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_17756555278286854445_4\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_17756555278286854445\"\n id=\"radio_17756555278286854445_4\" value=\"4\">\n </input>\n <span class=\"label-body px-1\">\n \\(e^{-(x-3)^2}\\)\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='17756555278286854445_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_17756555278286854445\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 4;\n var msgBox = document.getElementById('17756555278286854445_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_17756555278286854445\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_17756555278286854445\")\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\nIf $h(x) = (f \\circ g)(x) = \\sin^2(x)$ which is a possibility for $f$ and $g$:\n\n::: {.cell hold='true' execution_count=35}\n\n::: {.cell-output .cell-output-display execution_count=34}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='9786296641466531065' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_9786296641466531065\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_9786296641466531065_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_9786296641466531065\"\n id=\"radio_9786296641466531065_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n \\(f(x)=x^2; \\quad g(x) = \\sin^2(x)\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_9786296641466531065_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_9786296641466531065\"\n id=\"radio_9786296641466531065_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n `\\(f(x)=x^2; \\quad g(x) = \\sin(x)\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_9786296641466531065_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_9786296641466531065\"\n id=\"radio_9786296641466531065_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n \\(f(x)=\\sin(x); \\quad g(x) = x^2\\)\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='9786296641466531065_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_9786296641466531065\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 2;\n var msgBox = document.getElementById('9786296641466531065_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_9786296641466531065\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_9786296641466531065\")\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 function would have the same graph as the sine curve shifted over by 4 and up by 6?\n\n::: {.cell hold='true' execution_count=36}\n\n::: {.cell-output .cell-output-display execution_count=35}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='4385195504629409489' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_4385195504629409489\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_4385195504629409489_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_4385195504629409489\"\n id=\"radio_4385195504629409489_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n \\(h(x) = 6 + \\sin(x-4)\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_4385195504629409489_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_4385195504629409489\"\n id=\"radio_4385195504629409489_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n \\(h(x) = 6 + \\sin(x + 4)\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_4385195504629409489_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_4385195504629409489\"\n id=\"radio_4385195504629409489_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n \\(h(x) = 4 + \\sin(6x)\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_4385195504629409489_4\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_4385195504629409489\"\n id=\"radio_4385195504629409489_4\" value=\"4\">\n </input>\n <span class=\"label-body px-1\">\n \\(h(x) = 6\\sin(x-4)\\)\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='4385195504629409489_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_4385195504629409489\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 1;\n var msgBox = document.getElementById('4385195504629409489_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_4385195504629409489\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_4385195504629409489\")\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\nLet $h(x) = 4x^2$ and $f(x) = x^2$. Which is **not** true:\n\n::: {.cell hold='true' execution_count=37}\n\n::: {.cell-output .cell-output-display execution_count=36}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='3410616478822027422' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_3410616478822027422\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_3410616478822027422_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_3410616478822027422\"\n id=\"radio_3410616478822027422_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n The graph of \\(h(x)\\) is the graph of \\(f(x)\\) stretched by a factor of \\(4\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_3410616478822027422_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_3410616478822027422\"\n id=\"radio_3410616478822027422_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n The graph of \\(h(x)\\) is the graph of \\(f(x)\\) scaled by a factor of \\(2\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_3410616478822027422_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_3410616478822027422\"\n id=\"radio_3410616478822027422_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n The graph of \\(h(x)\\) is the graph of f(x) shifted up by \\(4\\) units\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='3410616478822027422_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_3410616478822027422\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 3;\n var msgBox = document.getElementById('3410616478822027422_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_3410616478822027422\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_3410616478822027422\")\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\nThe transformation $h(x) = (1/a) \\cdot f((x-b)/a)$ can be viewed in one sequence:\n\n::: {.cell hold='true' execution_count=38}\n\n::: {.cell-output .cell-output-display execution_count=37}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='13996752188271541263' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_13996752188271541263\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_13996752188271541263_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_13996752188271541263\"\n id=\"radio_13996752188271541263_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n shifting by \\(a\\), then scaling by \\(a\\), and then scaling by \\(b\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_13996752188271541263_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_13996752188271541263\"\n id=\"radio_13996752188271541263_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n scaling by \\(1/a\\), then shifting by \\(b\\), then stretching by \\(1/a\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_13996752188271541263_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_13996752188271541263\"\n id=\"radio_13996752188271541263_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n shifting by \\(a\\), then scaling by \\(b\\), and then scaling by \\(1/a\\)\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='13996752188271541263_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_13996752188271541263\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 2;\n var msgBox = document.getElementById('13996752188271541263_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_13996752188271541263\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_13996752188271541263\")\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\nThis is the graph of a transformed sine curve.\n\n::: {.cell hold='true' execution_count=39}\n\n::: {.cell-output .cell-output-display execution_count=38}\n{}\n:::\n:::\n\n\nWhat is the period of the graph?\n\n::: {.cell hold='true' execution_count=40}\n\n::: {.cell-output .cell-output-display execution_count=39}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='1694416227256456541' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_1694416227256456541\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"1694416227256456541\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='1694416227256456541_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"1694416227256456541\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 2) <= 0);\n var msgBox = document.getElementById('1694416227256456541_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_1694416227256456541\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_1694416227256456541\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\nWhat is the amplitude of the graph?\n\n::: {.cell hold='true' execution_count=41}\n\n::: {.cell-output .cell-output-display execution_count=40}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='17206858458545729236' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_17206858458545729236\">\n <div style=\"padding-top: 5px\">\n </br>\n<div class=\"input-group\">\n <input id=\"17206858458545729236\" type=\"number\" class=\"form-control\" placeholder=\"Numeric answer\">\n</div>\n\n \n </div>\n </div>\n <div id='17206858458545729236_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.getElementById(\"17206858458545729236\").addEventListener(\"change\", function() {\n var correct = (Math.abs(this.value - 2) <= 0);\n var msgBox = document.getElementById('17206858458545729236_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_17206858458545729236\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_17206858458545729236\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n});\n\n</script>\n```\n:::\n:::\n\n\nWhat is the form of the function graphed?\n\n::: {.cell hold='true' execution_count=42}\n\n::: {.cell-output .cell-output-display execution_count=41}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='12432400528453614696' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_12432400528453614696\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_12432400528453614696_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_12432400528453614696\"\n id=\"radio_12432400528453614696_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n \\(2 \\sin(x)\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_12432400528453614696_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_12432400528453614696\"\n id=\"radio_12432400528453614696_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n \\(2 \\sin(\\pi x)\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_12432400528453614696_3\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_12432400528453614696\"\n id=\"radio_12432400528453614696_3\" value=\"3\">\n </input>\n <span class=\"label-body px-1\">\n \\(\\sin(2x)\\)\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_12432400528453614696_4\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_12432400528453614696\"\n id=\"radio_12432400528453614696_4\" value=\"4\">\n </input>\n <span class=\"label-body px-1\">\n \\(\\sin(\\pi x)\\)\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='12432400528453614696_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_12432400528453614696\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 2;\n var msgBox = document.getElementById('12432400528453614696_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_12432400528453614696\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_12432400528453614696\")\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\nConsider this expression\n\n\n\n$$\n\\left(f(1) - f(0)\\right) + \\left(f(2) - f(1)\\right) + \\cdots + \\left(f(n) - f(n-1)\\right) =\n-f(0) + f(1) - f(1) + f(2) - f(2) + \\cdots + f(n-1) - f(n-1) + f(n) =\nf(n) - f(0).\n$$\n\n\nReferring to the definitions of `D` and `S` in the example on operators, which relationship does this support:\n\n::: {.cell hold='true' execution_count=43}\n\n::: {.cell-output .cell-output-display execution_count=42}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='2108287558491679197' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_2108287558491679197\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_2108287558491679197_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_2108287558491679197\"\n id=\"radio_2108287558491679197_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n <code>D(S(f))(n) = f(n)</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_2108287558491679197_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_2108287558491679197\"\n id=\"radio_2108287558491679197_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n <code>S(D(f))(n) = f(n) - f(0)</code>\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='2108287558491679197_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_2108287558491679197\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 2;\n var msgBox = document.getElementById('2108287558491679197_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_2108287558491679197\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_2108287558491679197\")\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\nConsider this expression:\n\n\n\n$$\n\\left(f(1) + f(2) + \\cdots + f(n-1) + f(n)\\right) - \\left(f(1) + f(2) + \\cdots + f(n-1)\\right) = f(n).\n$$\n\n\nReferring to the definitions of `D` and `S` in the example on operators, which relationship does this support:\n\n::: {.cell hold='true' execution_count=44}\n\n::: {.cell-output .cell-output-display execution_count=43}\n```{=html}\n<form class=\"mx-2 my-3 mw-100\" name='WeaveQuestion' data-id='8270926553895560573' data-controltype=''>\n <div class='form-group '>\n <div class='controls'>\n <div class=\"form\" id=\"controls_8270926553895560573\">\n <div style=\"padding-top: 5px\">\n <div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_8270926553895560573_1\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_8270926553895560573\"\n id=\"radio_8270926553895560573_1\" value=\"1\">\n </input>\n <span class=\"label-body px-1\">\n <code>D(S(f))(n) = f(n)</code>\n </span>\n </label>\n</div>\n<div class=\"form-check\">\n <label class=\"form-check-label\" for=\"radio_8270926553895560573_2\">\n <input class=\"form-check-input\" type=\"radio\" name=\"radio_8270926553895560573\"\n id=\"radio_8270926553895560573_2\" value=\"2\">\n </input>\n <span class=\"label-body px-1\">\n <code>S(D(f))(n) = f(n) - f(0)</code>\n </span>\n </label>\n</div>\n\n \n </div>\n </div>\n <div id='8270926553895560573_message' style=\"padding-bottom: 15px\"></div>\n </div>\n </div>\n</form>\n\n<script text='text/javascript'>\ndocument.querySelectorAll('input[name=\"radio_8270926553895560573\"]').forEach(function(rb) {\nrb.addEventListener(\"change\", function() {\n var correct = rb.value == 1;\n var msgBox = document.getElementById('8270926553895560573_message');\n if(correct) {\n msgBox.innerHTML = \"<div class='pluto-output admonition note alert alert-success'><span> 👍 Correct </span></div>\";\n var explanation = document.getElementById(\"explanation_8270926553895560573\")\n if (explanation != null) {\n explanation.style.display = \"none\";\n }\n } else {\n msgBox.innerHTML = \"<div class='pluto-output admonition alert alert-danger'><span>👎 Incorrect </span></div>\";\n var explanation = document.getElementById(\"explanation_8270926553895560573\")\n if (explanation != null) {\n explanation.style.display = \"block\";\n }\n }\n\n})});\n\n</script>\n```\n:::\n:::\n\n\n",
|
||
"supporting": [
|
||
"transformations_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"
|
||
]
|
||
}
|
||
}
|
||
} |