use quarto, not Pluto to render pages

This commit is contained in:
jverzani committed 2022-07-24 16:38:24 -04:00
1 parent 93c993206a
commit 7b37ca828c
879 files changed
+793311 -2678

No files matched your search

@@ -0,0 +1,15 @@
{
"hash": "7317e93a149e9ec056ededf2a071699c",
"result": {
"markdown": "# Implicit Differentiation\n\n\n\nThis section uses these add-on packages:\n\n``` {.julia .cell-code}\nusing CalculusWithJulia\nusing Plots\nusing ImplicitPlots\nusing Roots\nusing SymPy\n```\n\n\n\n\n---\n\n\n## Graphs of equations\n\n\nAn **equation** in $y$ and $x$ is an algebraic expression involving an equality with two (or more) variables. An example might be $x^2 + y^2 = 1$.\n\n\nThe **solutions** to an equation in the variables $x$ and $y$ are all points $(x,y)$ which satisfy the equation.\n\n\nThe **graph** of an equation is just the set of solutions to the equation represented in the Cartesian plane.\n\n\nWith this definition, the graph of a function $f(x)$ is just the graph of the equation $y = f(x)$. In general, graphing an equation is more complicated than graphing a function. For a function, we know for a given value of $x$ what the corresponding value of $f(x)$ is through evaluation of the function. For equations, we may have $0$, $1$ or more $y$ values for a given $x$ and even more problematic is we may have no rule to find these values.\n\n\nThere are a few options for plotting equations in `Julia`. We will use `ImplicitPlots` in this section, but note both `ImplicitEquations` and `IntervalConstraintProgramming` offer alternatives that are a bit more flexible.\n\n\nTo plot an implicit equation using `ImplicitPlots` requires expressing the relationship in terms of a function, and then plotting the equation `f(x,y) = 0`. In practice this simply requires all the terms be moved to one side of an equals sign.\n\n\nTo plot the circle of radius $2$, or the equations $x^2 + y^2 = 2^2$ we would move all terms to one side $x^2 + y^2 - 2^2 = 0$ and then express the left hand side through a function:\n\n::: {.cell execution_count=4}\n``` {.julia .cell-code}\nf(x,y) = x^2 + y^2 - 2^2\n```\n\n::: {.cell-output .cell-output-display execution_count=5}\n```\nf (generic function with 1 method)\n```\n:::\n:::\n\n\nThis function is then is passed to the `implicit_plot` function, which works with `Plots` to render the graphic:\n\n::: {.cell execution_count=5}\n``` {.julia .cell-code}\nimplicit_plot(f)\n```\n\n::: {.cell-output .cell-output-display execution_count=6}\n![](implicit_differentiation_files/figure-html/cell-6-output-1.svg){}\n:::\n:::\n\n\n:::{.callout-note}\n## Note\nThe `f` is a function of *two* variables, used here to express one side of an equation. `Julia` makes this easy to do - just make sure two variables are in the signature of `f` when it is defined. Using functions like this, we can express our equation in the form $f(x,y) = c$ or, more generally, as $f(x,y) = g(x,y)$. The latter of which can be expressed as $h(x,y) = f(x,y) - g(x,y) = 0$. That is, only the form $f(x,y)=0$ is needed to represent an equation.\n\n:::\n\n:::{.callout-note}\n## Note\nThere are two different styles in `Julia` to add simple plot recipes. `ImplicitPlots` adds a new plotting function (`implicit_plot`); alternatively many packages add a new recipe for the generic `plot` method using new types. (For example, `SymPy` has a plot recipe for symbolic types.\n\n:::\n\nOf course, more complicated equations are possible and the steps are similar - only the function definition is more involved. For example, the [Devils curve](http://www-groups.dcs.st-and.ac.uk/~history/Curves/Devils.html) has the form\n\n\n\n$$\ny^4 - x^4 + ay^2 + bx^2 = 0\n$$\n\n\nHere we draw the curve for a particular choice of $a$ and $b$. For illustration purposes, a narrower viewing window is specified below using `xlims` and `ylims`:\n\n::: {.cell hold='true' execution_count=6}\n``` {.julia .cell-code}\na,b = -1,2\nf(x,y) = y^4 - x^4 + a*y^2 + b*x^2\nimplicit_plot(f; xlims=(-3,3), ylims=(-3,3), legend=false)\n```\n\n::: {.cell-output .cell-output-display execution_count=7}\n![](implicit_differentiation_files/figure-html/cell-7-output-1.svg){}\n:::\n:::\n\n\n## Tangent lines, implicit differentiation\n\n\nThe graph $x^2 + y^2 = 1$ has well-defined tangent lines at all points except $(-1,0)$ and $(0, 1)$ and even at these two points, we could call the vertical lines $x=-1$ and $x=1$ tangent lines. However, to recover the slope of these tangent lines would need us to express $y$ as a function of $x$ and then differentiate that function. Of course, in this example, we would need two functions: $f(x) = \\sqrt{1-x^2}$ and $g(x) = - \\sqrt{1-x^2}$ to do this completely.\n\n\nIn general though, we may not be able to solve for $y$ in terms of $x$. What then?\n\n\nThe idea is to *assume* that $y$ is representable by some function of $x$. This makes sense, moving on the curve from $(x,y)$ to some nearby point, means changing $x$ will cause some change in $y$. This assumption is only made *locally* - basically meaning a complicated graph is reduced to just a small, well-behaved, section of its graph.\n\n\nWith this assumption, asking what $dy/dx$ is has an obvious meaning - what is the slope of the tangent line to the graph at $(x,y)$. (TheLine truncated
"supporting": [
"implicit_differentiation_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"
]
}
}
}