add freeze
This commit is contained in:
1 parent
3862d89a69
commit
954f9a96d5
675 files changed
+572480
-2
No files matched your search
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"hash": "cb2889a42c1f9d801c5e2cbf4b5737cd",
|
||||
"result": {
|
||||
"markdown": "# Linearization\n\n\n\nThis section uses these add-on packages:\n\n``` {.julia .cell-code}\nusing CalculusWithJulia\nusing Plots\nusing SymPy\nusing TaylorSeries\nusing DualNumbers\n```\n\n\n\n\n---\n\n\nThe derivative of $f(x)$ has the interpretation as the slope of the tangent line. The tangent line is the line that best approximates the function at the point.\n\n\nUsing the point-slope form of a line, we see that the tangent line to the graph of $f(x)$ at $(c,f(c))$ is given by:\n\n\n\n$$\ny = f(c) + f'(c) \\cdot (x - c).\n$$\n\n\nThis is written as an equation, though we prefer to work with functions within `Julia`. Here we write such a function as an operator - it takes a function `f` and returns a function representing the tangent line.\n\n``` {.julia .cell-code}\ntangent(f, c) = x -> f(c) + f'(c) * (x - c)\n```\n\n\n(Recall, the `->` indicates that an anonymous function is being generated.)\n\n\nThis function along with the `f'` notation for automatic derivatives is defined in the `CalculusWithJulia` package.\n\n\nWe make some graphs with tangent lines:\n\n::: {.cell hold='true' execution_count=5}\n``` {.julia .cell-code}\nf(x) = x^2\nplot(f, -3, 3)\nplot!(tangent(f, -1))\nplot!(tangent(f, 2))\n```\n\n::: {.cell-output .cell-output-display execution_count=5}\n{}\n:::\n:::\n\n\nThe graph shows that near the point, the line and function are close, but this need not be the case away from the point. We can express this informally as\n\n\n\n$$\nf(x) \\approx f(c) + f'(c) \\cdot (x-c)\n$$\n\n\nwith the understanding this applies for $x$ \"close\" to $c$.\n\n\nUsually for the applications herein, instead of $x$ and $c$ the two points are $x+\\Delta_x$ and $x$. This gives:\n\n\n> *Linearization*: $\\Delta_y = f(x +\\Delta_x) - f(x) \\approx f'(x) \\Delta_x$, for small $\\Delta_x$.\n\n\n\nThis section gives some implications of this fact and quantifies what \"close\" can mean.\n\n\n##### Example\n\n\nThere are several approximations that are well known in physics, due to their widespread usage:\n\n\n * That $\\sin(x) \\approx x$ around $x=0$:\n\n::: {.cell hold='true' execution_count=6}\n``` {.julia .cell-code}\nplot(sin, -pi/2, pi/2)\nplot!(tangent(sin, 0))\n```\n\n::: {.cell-output .cell-output-display execution_count=6}\n{}\n:::\n:::\n\n\nSymbolically:\n\n::: {.cell hold='true' execution_count=7}\n``` {.julia .cell-code}\n@syms x\nc = 0\nf(x) = sin(x)\nf(c) + diff(f(x),x)(c) * (x - c)\n```\n\n::: {.cell-output .cell-output-display execution_count=7}\n```{=html}\n<span class=\"math-left-align\" style=\"padding-left: 4px; width:0; float:left;\"> \n\\[\nx\n\\]\n</span>\n```\n:::\n:::\n\n\n * That $\\log(1 + x) \\approx x$ around $x=0$:\n\n::: {.cell hold='true' execution_count=8}\n``` {.julia .cell-code}\nf(x) = log(1 + x)\nplot(f, -1/2, 1/2)\nplot!(tangent(f, 0))\n```\n\n::: {.cell-output .cell-output-display execution_count=8}\n{}\n:::\n:::\n\n\nSymbolically:\n\n::: {.cell hold='true' execution_count=9}\n``` {.julia .cell-code}\n@syms x\nc = 0\nf(x) = log(1 + x)\nf(c) + diff(f(x),x)(c) * (x - c)\n```\n\n::: {.cell-output .cell-output-display execution_count=9}\n```{=html}\n<span class=\"math-left-align\" style=\"padding-left: 4px; width:0; float:left;\"> \n\\[\nx\n\\]\n</span>\n```\n:::\n:::\n\n\n(The `log1p` function implements a more accurate version of this function when numeric values are needed.)\n\n\n * That $1/(1-x) \\approx x$ around $x=0$:\n\n::: {.cell hold='true' execution_count=10}\n``` {.julia .cell-code}\nf(x) = 1/(1-x)\nplot(f, -1/2, 1/2)\nplot!(tangent(f, 0))\n```\n\n::: {.cell-output .cell-output-display execution_count=10}\n{}\n:::\n:::\n\n\nSymbolically:\n\n::: {.cell hold='true' execution_count=11}\n``` {.julia .cell-code}\n@syms x\nc = 0\nf(x) = 1 / (1 - x)\nf(c) + diff(f(x),x)(c) * (x - c)\n```\n\n::: {.cell-output .cell-output-display execution_count=11}\n```{=html}\n<span class=\"math-left-align\" style=\"padding-left: 4px; width:0; float:left;\"> \n\\[\nx + 1.0\n\\]\n</span>\n```\n:::\n:::\n\n\n * That $(1+x)^n \\approx 1 + nx$ around $x = 0$. For example, with $n=5$\n\n::: {.cell hold='true' execution_count=12}\n``` {.julia .cell-code}\nn = 5\nf(x) = (1+x)^n # f'(0) = n = n(1+x)^(n-1) at x=0\nplot(f, -1/2, 1/2)\nplot!(tangent(f, 0))\n```\n\n::: {.cell-output .cell-output-display execution_count=12}\n{}\n:::\n:::\n\n\nSymbolically:\n\n::: {.cell hold='true' execution_count=13}\n``` {.julia .cell-code}\n@syms x, n::real\nc = 0\nf(x) = (1 + x)^n\nf(c) + diff(f(x),x)(x=>c) * (x - c)\n```\n\n::: {.cell-output .cell-output-display execution_count=13}\n```{=html}\n<span class=\"math-left-align\" style=\"padding-left: 4px; width:0; float:left;\"> \n\\[\nn x + 1\n\\]\n</span>\n```\n:::\n:::Line truncated
|
||||
"supporting": [
|
||||
"linearization_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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user