bondscell_resultsA$2e2e5f0e-7c31-11eb-0da7-770b07ee6202queued¤logsrunning¦outputbody)inverse (generic function with 3 methods)mimetext/plainrootassigneelast_run_timestampAڎ ?İpersist_js_state·has_pluto_hook_features§cell_id$2e2e5f0e-7c31-11eb-0da7-770b07ee6202depends_on_disabled_cells§runtime&published_object_keysdepends_on_skipped_cells§errored$9d778e36-7c30-11eb-1f4b-894af86a8f5dqueued¤logsrunning¦outputbody

When $\eta$ is small, $\eta^2$ is very small, so we can ignore it. We are left with terms that either don't contain $\eta$ (constants), or multiply $\eta$ (linear). The part that multiplies $\eta$ is the derivative:

mimetext/htmlrootassigneelast_run_timestampAڎpersist_js_state·has_pluto_hook_features§cell_id$9d778e36-7c30-11eb-1f4b-894af86a8f5ddepends_on_disabled_cells§runtimeflpublished_object_keysdepends_on_skipped_cells§errored$395fd8e2-7c31-11eb-1933-dd719fa0cd22queued¤logsrunning¦outputbody

α = 0.0

mimetext/htmlrootassigneelast_run_timestampAڎ$bEpersist_js_state·has_pluto_hook_features§cell_id$395fd8e2-7c31-11eb-1933-dd719fa0cd22depends_on_disabled_cells§runtime&published_object_keysdepends_on_skipped_cells§errored$3828b94c-7c2d-11eb-2e01-79038b0f5226queued¤logsrunning¦outputbodyprefixSymbolics.NumelementsY

$$\begin{equation} a + \delta \end{equation}$$

text/html[

$$\begin{equation} b + \epsilon \end{equation}$$

text/htmltypeArrayprefix_shortobjectida58ae45d98ea2ad5mime!application/vnd.pluto.tree+objectrootassigneeimagelast_run_timestampAڎ'persist_js_state·has_pluto_hook_features§cell_id$3828b94c-7c2d-11eb-2e01-79038b0f5226depends_on_disabled_cells§runtime,published_object_keysdepends_on_skipped_cells§errored$ce44554e-847f-4129-8841-1a729dfa7a2equeued¤logsrunning¦outputbody

n = 1

mimetext/htmlrootassigneelast_run_timestampAڎtpersist_js_state·has_pluto_hook_features§cell_id$ce44554e-847f-4129-8841-1a729dfa7a2edepends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$923bde64-7ba4-11eb-21e9-a11993aaab2equeued¤logsrunning¦outputbody
newton2D

Find $x$ such that $T(x) = 0$

mimetext/htmlrootassigneelast_run_timestampAڎ xpersist_js_state·has_pluto_hook_features§cell_id$923bde64-7ba4-11eb-21e9-a11993aaab2edepends_on_disabled_cells§runtimeԌpublished_object_keysdepends_on_skipped_cells§errored$a869e6c6-7c31-11eb-13c8-155d08be02ebqueued¤logsrunning¦outputbody

m = 1

mimetext/htmlrootassigneelast_run_timestampAڎ:persist_js_state·has_pluto_hook_features§cell_id$a869e6c6-7c31-11eb-13c8-155d08be02ebdepends_on_disabled_cells§runtime published_object_keysdepends_on_skipped_cells§errored$2fb40dc6-7c2f-11eb-2469-8deb4db59b5cqueued¤logsrunning¦outputbody1.414213562373095mimetext/plainrootassigneelast_run_timestampAڎpersist_js_state·has_pluto_hook_features§cell_id$2fb40dc6-7c2f-11eb-2469-8deb4db59b5cdepends_on_disabled_cells§runtime7fpublished_object_keysdepends_on_skipped_cells§errored$f4fda666-7b9c-11eb-0304-716c5e710462queued¤logsrunning¦outputbodymimetext/plainrootassigneelast_run_timestampAڎjpersist_js_state·has_pluto_hook_features§cell_id$f4fda666-7b9c-11eb-0304-716c5e710462depends_on_disabled_cells§runtime$8mpublished_object_keysdepends_on_skipped_cells§errored$35791bca-7c2f-11eb-1cfb-8d5ebd0208cbqueued¤logsrunning¦outputbody1.4142135623730951mimetext/plainrootassigneelast_run_timestampAڎNpersist_js_state·has_pluto_hook_features§cell_id$35791bca-7c2f-11eb-1cfb-8d5ebd0208cbdepends_on_disabled_cells§runtime*Xpublished_object_keysdepends_on_skipped_cells§errored$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffqueued¤logsrunning¦outputbodyprefixSymbolics.NumelementsL

$$\begin{equation} z \end{equation}$$

text/htmlO

$$\begin{equation} \eta \end{equation}$$

text/htmltypeArrayprefix_shortobjectid660b86240b6acadfmime!application/vnd.pluto.tree+objectrootassigneelast_run_timestampAڎ°persist_js_state·has_pluto_hook_features§cell_id$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffdepends_on_disabled_cells§runtimeoFpublished_object_keysdepends_on_skipped_cells§errored$dd6b0ae2-cc87-4d19-ac78-f3a990aa692equeued¤logsrunning¦outputbody

This lecture is part of Computational Thinking, a live online Julia/Pluto textbook. Go to computationalthinking.mit.edu to read all 50 lectures for free.

mimetext/htmlrootassigneelast_run_timestampAڎ/persist_js_state·has_pluto_hook_features§cell_id$dd6b0ae2-cc87-4d19-ac78-f3a990aa692edepends_on_disabled_cells§runtimeՊpublished_object_keysdepends_on_skipped_cells§errored$2445da24-7b9d-11eb-02bd-eb99a3d95a2equeued¤logsrunning¦outputbody

n = 1

mimetext/htmlrootassigneelast_run_timestampAڎZpersist_js_state·has_pluto_hook_features§cell_id$2445da24-7b9d-11eb-02bd-eb99a3d95a2edepends_on_disabled_cells§runtime#ŵpublished_object_keysdepends_on_skipped_cells§errored$98158a38-7c30-11eb-0796-2335e97ec6d0queued¤logsrunning¦outputbody`

$$\begin{equation} -2 + z + \eta \end{equation}$$

mimetext/htmlrootassigneelast_run_timestampAڎ'persist_js_state·has_pluto_hook_features§cell_id$98158a38-7c30-11eb-0796-2335e97ec6d0depends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0queued¤logsrunning¦outputbody

Newton for transformations in 2 dimensions

$$T: \mathbb{R}^2 \to \mathbb{R}^2$$

mimetext/htmlrootassigneelast_run_timestampAڎ&persist_js_state·has_pluto_hook_features§cell_id$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0depends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$8c0c412e-7c2f-11eb-1880-4f6c45d77597queued¤logsrunning¦outputbodyZ

The idea of the Newton method is to follow the direction in which the function is pointing! We do this by building a tangent line at the current position and following that instead, until it hits the $x$-axis.

Let's look at that visually first:

mimetext/htmlrootassigneelast_run_timestampAڎjjpersist_js_state·has_pluto_hook_features§cell_id$8c0c412e-7c2f-11eb-1880-4f6c45d77597depends_on_disabled_cells§runtime}published_object_keysdepends_on_skipped_cells§errored$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45queued¤logsrunning¦outputbody'expand (generic function with 1 method)mimetext/plainrootassigneelast_run_timestampAڎ%@persist_js_state·has_pluto_hook_features§cell_id$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45depends_on_disabled_cells§runtimeGpublished_object_keysdepends_on_skipped_cells§errored$f25af026-7b9c-11eb-1f11-77a8b06b2d71queued¤logsrunning¦outputbody1standard_Newton (generic function with 3 methods)mimetext/plainrootassigneelast_run_timestampAڎ &persist_js_state·has_pluto_hook_features§cell_id$f25af026-7b9c-11eb-1f11-77a8b06b2d71depends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$fe742fec-7c3e-11eb-1f54-55cdf02a1574queued¤logsrunning¦outputbody

p = 0.0

mimetext/htmlrootassigneelast_run_timestampAڎ`Ȱpersist_js_state·has_pluto_hook_features§cell_id$fe742fec-7c3e-11eb-1f54-55cdf02a1574depends_on_disabled_cells§runtime]5published_object_keysdepends_on_skipped_cells§errored$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750queued¤logsrunning¦outputbodyT

Implementation in 2D

mimetext/htmlrootassigneelast_run_timestampAڎpersist_js_state·has_pluto_hook_features§cell_id$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750depends_on_disabled_cells§runtimeǹpublished_object_keysdepends_on_skipped_cells§errored$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0queued¤logsrunning¦outputbody"T (generic function with 1 method)mimetext/plainrootassigneelast_run_timestampAڎ#V1persist_js_state·has_pluto_hook_features§cell_id$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0depends_on_disabled_cells§runtimeܵpublished_object_keysdepends_on_skipped_cells§errored$1b77fada-7b9d-11eb-3266-ebb3895cb76aqueued¤logsrunning¦outputbody)straight (generic function with 1 method)mimetext/plainrootassigneelast_run_timestampAڎ persist_js_state·has_pluto_hook_features§cell_id$1b77fada-7b9d-11eb-3266-ebb3895cb76adepends_on_disabled_cells§runtimeNpublished_object_keysdepends_on_skipped_cells§errored$80917990-7ba0-11eb-029a-dba981c52b58queued¤logsrunning¦outputbody

$$T(x_0 + \delta) \simeq 0$$

$$T(x_0) + J \cdot \delta \simeq 0,$$

where $J := DT_{x_0}$ is the Jacobian matrix of $T$ at $x_0$, i.e. the best linear approximation of $T$ near to $x_0$.

mimetext/htmlrootassigneelast_run_timestampAڎ[ٰpersist_js_state·has_pluto_hook_features§cell_id$80917990-7ba0-11eb-029a-dba981c52b58depends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$b7dc4666-7ba1-11eb-32eb-fd3d720c2960queued¤logsrunning¦outputbody

$$J \cdot \delta = -T(x_0)$$

Then we again construct the new approximation $x_1$ as $x_1 := x_0 + \delta$.

mimetext/htmlrootassigneelast_run_timestampAڎ|persist_js_state·has_pluto_hook_features§cell_id$b7dc4666-7ba1-11eb-32eb-fd3d720c2960depends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$d35e0cc8-7c30-11eb-28d3-17c9e221ea62queued¤logsrunning¦outputbodymimetext/plainrootassigneelast_run_timestampAڎ˒6persist_js_state·has_pluto_hook_features§cell_id$d35e0cc8-7c30-11eb-28d3-17c9e221ea62depends_on_disabled_cells§runtimenpublished_object_keysdepends_on_skipped_cells§errored$61905ae0-7ba6-11eb-0773-17e9aa4e9991queued¤logsrunning¦outputbody

Remember that Newton is designed to look for roots, i.e. places where $T(x) = 0$. We want $T(x) = y$, so we need another layer:

mimetext/htmlrootassigneelast_run_timestampAڎ`persist_js_state·has_pluto_hook_features§cell_id$61905ae0-7ba6-11eb-0773-17e9aa4e9991depends_on_disabled_cells§runtime)published_object_keysdepends_on_skipped_cells§errored$1ba1ae44-7ba1-11eb-21ff-558c95446435queued¤logsrunning¦outputbodyY

If we are already "quite close" to the root then $\delta$ should be small, so we can approximate $f$ using the tangent line:

$$f(x_0) + \delta \, f'(x_0) \simeq 0$$

and hence

$$\delta \simeq \frac{-f(x_0)}{f'(x_0)}$$

so that

$$x_1 = x_0 - \frac{f(x_0)}{f'(x_0)}$$

Now we can repeat so that

$$x_2 = x_1 - \frac{f(x_1)}{f'(x_1)}$$

and in general

$$x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}.$$

This is the Newton method in 1D.

mimetext/htmlrootassigneelast_run_timestampAڎ^persist_js_state·has_pluto_hook_features§cell_id$1ba1ae44-7ba1-11eb-21ff-558c95446435depends_on_disabled_cells§runtimernpublished_object_keysdepends_on_skipped_cells§errored$23536420-7c2d-11eb-20b0-9523f7a5f9d7queued¤logsrunning¦outputbodyprefixSymbolics.NumelementsL

$$\begin{equation} a \end{equation}$$

text/htmlL

$$\begin{equation} b \end{equation}$$

text/htmlQ

$$\begin{equation} \delta \end{equation}$$

text/htmlS

$$\begin{equation} \epsilon \end{equation}$$

text/htmltypeArrayprefix_shortobjectid3c15f9b820d2260dmime!application/vnd.pluto.tree+objectrootassigneelast_run_timestampAڎ persist_js_state·has_pluto_hook_features§cell_id$23536420-7c2d-11eb-20b0-9523f7a5f9d7depends_on_disabled_cells§runtimel published_object_keysdepends_on_skipped_cells§errored$c519704c-7ba1-11eb-12da-8b9b176daa0dqueued¤logsrunning¦outputbodyd

In 2D we have an explicit formula for the inverse of the matrix.

mimetext/htmlrootassigneelast_run_timestampAڎpersist_js_state·has_pluto_hook_features§cell_id$c519704c-7ba1-11eb-12da-8b9b176daa0ddepends_on_disabled_cells§runtime{ published_object_keysdepends_on_skipped_cells§errored$9cfa9062-7ba0-11eb-3a93-197ac0287ab4queued¤logsrunning¦outputbodym

$$f(x_1) = f(x_0 + \delta) \simeq 0$$

mimetext/htmlrootassigneelast_run_timestampAڎmpersist_js_state·has_pluto_hook_features§cell_id$9cfa9062-7ba0-11eb-3a93-197ac0287ab4depends_on_disabled_cells§runtime+published_object_keysdepends_on_skipped_cells§errored$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05queued¤logsrunning¦outputbodya

x₀ = 6

mimetext/htmlrootassigneelast_run_timestampAڎpersist_js_state·has_pluto_hook_features§cell_id$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05depends_on_disabled_cells§runtimeƵpublished_object_keysdepends_on_skipped_cells§errored$af887dea-7ba1-11eb-3b0d-6925756382a7queued¤logsrunning¦outputbody}

Hence $\delta$ is the solution of the system of linear equations

mimetext/htmlrootassigneelast_run_timestampAڎ|persist_js_state·has_pluto_hook_features§cell_id$af887dea-7ba1-11eb-3b0d-6925756382a7depends_on_disabled_cells§runtimeM˵published_object_keysdepends_on_skipped_cells§errored$5123c038-7ba2-11eb-1be2-19f789b02c1fqueued¤logsrunning¦outputbodyl

Mathematics of the Newton method

mimetext/htmlrootassigneelast_run_timestampAڎ,persist_js_state·has_pluto_hook_features§cell_id$5123c038-7ba2-11eb-1be2-19f789b02c1fdepends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$e18f2470-7c31-11eb-2b74-d59d00d20ba4queued¤logsrunning¦outputbodyL

$$\begin{equation} 0 \end{equation}$$

mimetext/htmlrootassigneelast_run_timestampAڎ'persist_js_state·has_pluto_hook_features§cell_id$e18f2470-7c31-11eb-2b74-d59d00d20ba4depends_on_disabled_cells§runtimeƵpublished_object_keysdepends_on_skipped_cells§errored$5faa2784-7c31-11eb-34f1-3f8224dbdbdequeued¤logsrunning¦outputbodyprefixFloat64elements0.3text/plain0.4text/plaintypeArrayprefix_shortobjectide7c74a8e22ef144dmime!application/vnd.pluto.tree+objectrootassigneelast_run_timestampAڎ$ =persist_js_state·has_pluto_hook_features§cell_id$5faa2784-7c31-11eb-34f1-3f8224dbdbdedepends_on_disabled_cells§runtime|published_object_keysdepends_on_skipped_cells§errored$9371f930-7c30-11eb-1f77-c7f31b97ea26queued¤logsrunning¦outputbody`

$$\begin{equation} -2 + z + \eta \end{equation}$$

mimetext/htmlrootassigneelast_run_timestampAڎ*^persist_js_state·has_pluto_hook_features§cell_id$9371f930-7c30-11eb-1f77-c7f31b97ea26depends_on_disabled_cells§runtimeUpublished_object_keysdepends_on_skipped_cells§errored$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8queued¤logsrunning¦outputbodyټ

Using symbolic calculations to understand derivatives and nonlinear maps

mimetext/htmlrootassigneelast_run_timestampAڎ]persist_js_state·has_pluto_hook_features§cell_id$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8depends_on_disabled_cells§runtimerpublished_object_keysdepends_on_skipped_cells§errored$ed605b90-7c3e-11eb-34e9-776a05a177ddqueued¤logsrunning¦outputbodyprefixSymbolics.NumelementsQ

$$\begin{equation} \delta \end{equation}$$

text/htmlS

$$\begin{equation} \epsilon \end{equation}$$

text/htmltypeArrayprefix_shortobjectidbc1543eec876b5d7mime!application/vnd.pluto.tree+objectrootassigneelast_run_timestampAڎ'$persist_js_state·has_pluto_hook_features§cell_id$ed605b90-7c3e-11eb-34e9-776a05a177dddepends_on_disabled_cells§runtime rGpublished_object_keysdepends_on_skipped_cells§errored$d44c73b4-7c3e-11eb-1302-8ba9039ae789queued¤logsrunning¦outputbodyA

Let's see what happens when we perturb by small amounts $\delta$ in the $x$ direction and $\epsilon$ in the $y$ direction around the point $(a, b)$:

mimetext/htmlrootassigneelast_run_timestampAڎpersist_js_state·has_pluto_hook_features§cell_id$d44c73b4-7c3e-11eb-1302-8ba9039ae789depends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$09b97be8-7c2e-11eb-05fd-65bbd097afb8queued¤logslinemsgٴAttempting to print a symbolic expression in a Pluto notebook. Please run `import Latexify` to enable pretty-printing of symbolic expressions. This warning will only display once. text/plaincell_id$09b97be8-7c2e-11eb-05fd-65bbd097afb8kwargsidSymbolics_16d4609cfile;/home/fons/.julia/packages/Symbolics/AmMIj/src/Symbolics.jlgroupSymbolicslevelWarnrunning¦outputbody)2×2 Matrix{Text{Num}}: 1.0 0 0 1.0mimetext/plainrootassigneelast_run_timestampAڎ#persist_js_state·has_pluto_hook_features§cell_id$09b97be8-7c2e-11eb-05fd-65bbd097afb8depends_on_disabled_cells§runtimeP?"published_object_keysdepends_on_skipped_cells§errored$389e990e-7c40-11eb-37c4-5ba0f59173b3queued¤logsrunning¦outputbodyT

The derivative gives the "linear part" of the function. ForwardDiff.jl, and forward-mode automatic differentiation in general, effectively uses this (although not symbolically in this sense) to just propagate the linear part of each function through a calculation.

mimetext/htmlrootassigneelast_run_timestampAڎ9persist_js_state·has_pluto_hook_features§cell_id$389e990e-7c40-11eb-37c4-5ba0f59173b3depends_on_disabled_cells§runtimeIpublished_object_keysdepends_on_skipped_cells§errored$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82queued¤logsrunning¦outputbody

The Newton method in 1D

We would like to solve equations like $f(x) = g(x)$. We rewrite that by moving all the terms to one side of the equation so that we can write $h(x) = 0$, with $h(x) := f(x) - g(x)$.

A point $x^*$ such that $h(x^*) = 0$ is called a root or zero of $h$.

The Newton method finds zeros, and hence solves the original equation.

mimetext/htmlrootassigneelast_run_timestampAڎ3Qpersist_js_state·has_pluto_hook_features§cell_id$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82depends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$ec6c6328-7b9c-11eb-1c69-dba12ae522adqueued¤logsrunning¦outputbodyJ mimeimage/svg+xmlrootassigneelast_run_timestampAڎ#Gxpersist_js_state·has_pluto_hook_features§cell_id$ec6c6328-7b9c-11eb-1c69-dba12ae522addepends_on_disabled_cells§runtime.ݵpublished_object_keysdepends_on_skipped_cells§errored$ecb40aea-7b9c-11eb-1476-e54faf32d91cqueued¤logsrunning¦outputbody` mimeimage/svg+xmlrootassigneelast_run_timestampAڎ#0 persist_js_state·has_pluto_hook_features§cell_id$ecb40aea-7b9c-11eb-1476-e54faf32d91cdepends_on_disabled_cells§runtime:Opublished_object_keysdepends_on_skipped_cells§errored$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7queued¤logsrunning¦outputbody

We want to find the inverse $T^{-1}(y)$, i.e. to solve the equation $T(x) = y$ for $x$.

We use the same idea as in 1D, but now in 2D:

mimetext/htmlrootassigneelast_run_timestampAڎ;ްpersist_js_state·has_pluto_hook_features§cell_id$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7depends_on_disabled_cells§runtime3˵published_object_keysdepends_on_skipped_cells§errored$ee91563e-7c3e-11eb-3f65-1f336073869aqueued¤logsrunning¦outputbody<

Appendix

mimetext/htmlrootassigneelast_run_timestampAڎ"persist_js_state·has_pluto_hook_features§cell_id$ee91563e-7c3e-11eb-3f65-1f336073869adepends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$d690f83a-7c2e-11eb-14d7-79a250deb473queued¤logsrunning¦outputbody)newton1D (generic function with 1 method)mimetext/plainrootassigneelast_run_timestampAڎqpersist_js_state·has_pluto_hook_features§cell_id$d690f83a-7c2e-11eb-14d7-79a250deb473depends_on_disabled_cells§runtimePεpublished_object_keysdepends_on_skipped_cells§errored$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8queued¤logsrunning¦outputbody

Suppose we have a guess $x_0$ for the root and we want to find a (hopefully) better guess $x_1$.

Let's set $x_1 = x_0 + \delta$, where $x_1$ and $\delta$ are still unknown.

We want $x_1$ to be a root, so

mimetext/htmlrootassigneelast_run_timestampAڎRapersist_js_state·has_pluto_hook_features§cell_id$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8depends_on_disabled_cells§runtimeBlpublished_object_keysdepends_on_skipped_cells§errored$07a754da-7c31-11eb-0394-4bef4d79fc30queued¤logsrunning¦outputbodyprefixFloat64elements0.3text/plain0.4text/plaintypeArrayprefix_shortobjectidd1375a327945f2damime!application/vnd.pluto.tree+objectrootassigneelast_run_timestampAڎ$?persist_js_state·has_pluto_hook_features§cell_id$07a754da-7c31-11eb-0394-4bef4d79fc30depends_on_disabled_cells§runtimeJ @published_object_keysdepends_on_skipped_cells§errored$63dbf052-7c32-11eb-1062-5b3581d38f70queued¤logsrunning¦outputbodyU

$$\begin{equation} -2 + z \end{equation}$$

mimetext/htmlrootassigneelast_run_timestampAڎ3jpersist_js_state·has_pluto_hook_features§cell_id$63dbf052-7c32-11eb-1062-5b3581d38f70depends_on_disabled_cells§runtimeWvŵpublished_object_keysdepends_on_skipped_cells§errored$18ce2fac-7c2e-11eb-03d2-b3a674621662queued¤logsrunning¦outputbodyprefixSymbolics.NumelementsQ

$$\begin{equation} \delta \end{equation}$$

text/htmlS

$$\begin{equation} \epsilon \end{equation}$$

text/htmltypeArrayprefix_shortobjectid6d34f3818d78b196mime!application/vnd.pluto.tree+objectrootassigneelast_run_timestampAڎ$bepersist_js_state·has_pluto_hook_features§cell_id$18ce2fac-7c2e-11eb-03d2-b3a674621662depends_on_disabled_cells§runtimeYpublished_object_keysdepends_on_skipped_cells§errored$6dc89964-7c30-11eb-0a41-8d97b210ed34queued¤logsrunning¦outputbodymimetext/plainrootassigneelast_run_timestampAڎfIpersist_js_state·has_pluto_hook_features§cell_id$6dc89964-7c30-11eb-0a41-8d97b210ed34depends_on_disabled_cells§runtime-Fpublished_object_keysdepends_on_skipped_cells§errored$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0queued¤logsrunning¦outputbody^

Symbolic derivative in 2D

mimetext/htmlrootassigneelast_run_timestampAڎ۶persist_js_state·has_pluto_hook_features§cell_id$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0depends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$35b5c5c6-7c3f-11eb-2723-4b406a809114queued¤logsrunning¦outputbodyprefixSymbolics.NumelementsL

$$\begin{equation} 0 \end{equation}$$

text/htmlL

$$\begin{equation} 0 \end{equation}$$

text/htmltypeArrayprefix_shortobjectid7a897c15c5e21f5amime!application/vnd.pluto.tree+objectrootassigneelast_run_timestampAڎ'}gpersist_js_state·has_pluto_hook_features§cell_id$35b5c5c6-7c3f-11eb-2723-4b406a809114depends_on_disabled_cells§runtime-published_object_keysdepends_on_skipped_cells§errored$e410c1d0-7ba1-11eb-394f-71dac89756b7queued¤logsrunning¦outputbody

In science and engineering we often need to solve systems of equations.

If the equations are linear then linear algebra tells us a general method to solve them; these are now routinely applied to solve systems of millions of linear equations.

If the equations are nonlinear then things are less obvious. The main solution methods we know work by... reducing the nonlinear equations to a sequence of linear equations! They do this by approximating the function by a linear function and solving that to get a better solution, then repeating this operation as many times as necessary to get a sequence of increasingly better solutions. This is an example of an iterative algorithm.

A well-known and elegant method, which can be used in many different contexts, is the Newton method. It does, however, have the disadvantage that it requires derivatives of the function. This can be overcome using automatic differentiation techniques.

We will illustrate the Newton method using the ForwardDiff.jl package to carry out automatic differentiation, but we will also try to understand what's going on "under the hood".

mimetext/htmlrootassigneelast_run_timestampAڎ"persist_js_state·has_pluto_hook_features§cell_id$e410c1d0-7ba1-11eb-394f-71dac89756b7depends_on_disabled_cells§runtime published_object_keysdepends_on_skipped_cells§errored$db26375a-7c30-11eb-066e-ab9e8ded3356queued¤logsrunning¦outputbodyL

$$\begin{equation} 1 \end{equation}$$

mimetext/htmlrootassigneelast_run_timestampAڎɍpersist_js_state·has_pluto_hook_features§cell_id$db26375a-7c30-11eb-066e-ab9e8ded3356depends_on_disabled_cells§runtimeBQIpublished_object_keysdepends_on_skipped_cells§errored$615aff3c-7c30-11eb-2ca8-9d2fdf299017queued¤logsrunning¦outputbody]

We can use Julia's new symbolic capabilities to understand what's going on with a nonlinear (polynomial) function.

Let's see what happens if we perturb a function $f$ around a point $z$ by a small amount $\eta$.

mimetext/htmlrootassigneelast_run_timestampAڎpersist_js_state·has_pluto_hook_features§cell_id$615aff3c-7c30-11eb-2ca8-9d2fdf299017depends_on_disabled_cells§runtime2۵published_object_keysdepends_on_skipped_cells§errored$77ef0cfb-60db-4599-bec2-b65e99e5b246queued¤logsrunning¦outputbodyb

x₀ = 6

mimetext/htmlrootassigneelast_run_timestampAڎ4persist_js_state·has_pluto_hook_features§cell_id$77ef0cfb-60db-4599-bec2-b65e99e5b246depends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$1db66b0e-7ba4-11eb-2157-d5a399a73b1fqueued¤logsrunning¦outputbody.newton2D_step (generic function with 1 method)mimetext/plainrootassigneelast_run_timestampAڎ dcpersist_js_state·has_pluto_hook_features§cell_id$1db66b0e-7ba4-11eb-2157-d5a399a73b1fdepends_on_disabled_cells§runtime Ppublished_object_keysdepends_on_skipped_cells§errored$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7queued¤logsrunning¦outputbody
inverse

Looks for $x$ such that $f(x) = y$, i.e. $f(x) - y = 0$

mimetext/htmlrootassigneelast_run_timestampAڎ zXupersist_js_state·has_pluto_hook_features§cell_id$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7depends_on_disabled_cells§runtime,>$$\begin{equation} -2 + z + \eta \end{equation}$$

mimetext/htmlrootassigneelast_run_timestampAڎW\persist_js_state·has_pluto_hook_features§cell_id$ea741018-7c30-11eb-3912-a50475e6ec49depends_on_disabled_cells§runtimed;published_object_keysdepends_on_skipped_cells§errored$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08queued¤logsrunning¦outputbody

We can convert the idea of "following the tangent line" into equations as follows. (You can also do so by just looking at the geometry in 1D, but that does not help in 2D.)

mimetext/htmlrootassigneelast_run_timestampAڎ-persist_js_state·has_pluto_hook_features§cell_id$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08depends_on_disabled_cells§runtime;published_object_keysdepends_on_skipped_cells§errored$02b1b470-7c31-11eb-28f4-411956f73f12queued¤logsrunning¦outputbodyprefixFloat64elements0.3text/plain0.4text/plaintypeArrayprefix_shortobjectide60e146d02d2a72mime!application/vnd.pluto.tree+objectrootassigneelast_run_timestampAڎ$Hpersist_js_state·has_pluto_hook_features§cell_id$02b1b470-7c31-11eb-28f4-411956f73f12depends_on_disabled_cells§runtime8published_object_keysdepends_on_skipped_cells§errored$ba570c4c-7ba2-11eb-2125-9f23e415a1dcqueued¤logsrunning¦outputbodyT

Implementation in 1D

mimetext/htmlrootassigneelast_run_timestampAڎðpersist_js_state·has_pluto_hook_features§cell_id$ba570c4c-7ba2-11eb-2125-9f23e415a1dcdepends_on_disabled_cells§runtime֒published_object_keysdepends_on_skipped_cells§errored$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71aqueued¤logsrunning¦outputbody

Solving equations and finding inverse transformations using the Newton method

mimetext/htmlrootassigneelast_run_timestampAڎ$persist_js_state·has_pluto_hook_features§cell_id$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71adepends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored±cell_dependenciesA$2e2e5f0e-7c31-11eb-0da7-770b07ee6202precedence_heuristic cell_id$2e2e5f0e-7c31-11eb-0da7-770b07ee6202downstream_cells_mapinverse$07a754da-7c31-11eb-0394-4bef4d79fc30$5faa2784-7c31-11eb-34f1-3f8224dbdbdeupstream_cells_map$9d778e36-7c30-11eb-1f4b-894af86a8f5dprecedence_heuristic cell_id$9d778e36-7c30-11eb-1f4b-894af86a8f5ddownstream_cells_mapupstream_cells_map@md_strgetindex$395fd8e2-7c31-11eb-1933-dd719fa0cd22precedence_heuristic cell_id$395fd8e2-7c31-11eb-1933-dd719fa0cd22downstream_cells_mapα$02b1b470-7c31-11eb-28f4-411956f73f12$07a754da-7c31-11eb-0394-4bef4d79fc30$5faa2784-7c31-11eb-34f1-3f8224dbdbdeupstream_cells_map@md_strCore:Base.get@bindSliderBasePlutoRunnerPlutoRunner.create_bondCore.applicablegetindex$3828b94c-7c2d-11eb-2e01-79038b0f5226precedence_heuristic cell_id$3828b94c-7c2d-11eb-2e01-79038b0f5226downstream_cells_mapimage$ed605b90-7c3e-11eb-34e9-776a05a177dd$35b5c5c6-7c3f-11eb-2723-4b406a809114upstream_cells_mapδ$23536420-7c2d-11eb-20b0-9523f7a5f9d7T$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0ϵ$23536420-7c2d-11eb-20b0-9523f7a5f9d7b$23536420-7c2d-11eb-20b0-9523f7a5f9d7+a$23536420-7c2d-11eb-20b0-9523f7a5f9d7p$fe742fec-7c3e-11eb-1f54-55cdf02a1574expand$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45$ce44554e-847f-4129-8841-1a729dfa7a2eprecedence_heuristic cell_id$ce44554e-847f-4129-8841-1a729dfa7a2edownstream_cells_mapn2$ecb40aea-7b9c-11eb-1476-e54faf32d91cupstream_cells_map@md_strCore:Base.get@bindSliderBasePlutoRunnerPlutoRunner.create_bondCore.applicablegetindex$923bde64-7ba4-11eb-21e9-a11993aaab2eprecedence_heuristic cell_id$923bde64-7ba4-11eb-21e9-a11993aaab2edownstream_cells_mapnewton2D$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7upstream_cells_map@doc:TupleUnion#___this_pluto_module_namenewton2D_step$1db66b0e-7ba4-11eb-2157-d5a399a73b1fAny$a869e6c6-7c31-11eb-13c8-155d08be02ebprecedence_heuristic cell_id$a869e6c6-7c31-11eb-13c8-155d08be02ebdownstream_cells_mapm$6dc89964-7c30-11eb-0a41-8d97b210ed34upstream_cells_map@md_strCore:Base.get@bindSliderBasePlutoRunnerPlutoRunner.create_bondCore.applicablegetindex$2fb40dc6-7c2f-11eb-2469-8deb4db59b5cprecedence_heuristic cell_id$2fb40dc6-7c2f-11eb-2469-8deb4db59b5cdownstream_cells_mapupstream_cells_mapnewton1D$d690f83a-7c2e-11eb-14d7-79a250deb473-^$f4fda666-7b9c-11eb-0304-716c5e710462precedence_heuristiccell_id$f4fda666-7b9c-11eb-0304-716c5e710462downstream_cells_mapjacobian$09b97be8-7c2e-11eb-05fd-65bbd097afb8$18ce2fac-7c2e-11eb-03d2-b3a674621662$35b5c5c6-7c3f-11eb-2723-4b406a809114ForwardDiff$d35e0cc8-7c30-11eb-28d3-17c9e221ea62$d690f83a-7c2e-11eb-14d7-79a250deb473$1db66b0e-7ba4-11eb-2157-d5a399a73b1f$f25af026-7b9c-11eb-1f11-77a8b06b2d71SymbolicsPlutoUIPlotsLatexifyLaTeXStrings$f25af026-7b9c-11eb-1f11-77a8b06b2d71upstream_cells_map$35791bca-7c2f-11eb-1cfb-8d5ebd0208cbprecedence_heuristic cell_id$35791bca-7c2f-11eb-1cfb-8d5ebd0208cbdownstream_cells_mapupstream_cells_mapsqrt$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffprecedence_heuristic cell_id$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffdownstream_cells_mapη$9371f930-7c30-11eb-1f77-c7f31b97ea26$98158a38-7c30-11eb-0796-2335e97ec6d0$ea741018-7c30-11eb-3912-a50475e6ec49$e18f2470-7c31-11eb-2b74-d59d00d20ba4z$63dbf052-7c32-11eb-1062-5b3581d38f70$9371f930-7c30-11eb-1f77-c7f31b97ea26$98158a38-7c30-11eb-0796-2335e97ec6d0$db26375a-7c30-11eb-066e-ab9e8ded3356$ea741018-7c30-11eb-3912-a50475e6ec49$e18f2470-7c31-11eb-2b74-d59d00d20ba4upstream_cells_map@variables$dd6b0ae2-cc87-4d19-ac78-f3a990aa692eprecedence_heuristic cell_id$dd6b0ae2-cc87-4d19-ac78-f3a990aa692edownstream_cells_mapupstream_cells_mapBaseBase.Docs.HTML@html_str$2445da24-7b9d-11eb-02bd-eb99a3d95a2eprecedence_heuristic cell_id$2445da24-7b9d-11eb-02bd-eb99a3d95a2edownstream_cells_mapn$ec6c6328-7b9c-11eb-1c69-dba12ae522adupstream_cells_map@md_strCore:Base.get@bindSliderBasePlutoRunnerPlutoRunner.create_bondCore.applicablegetindex$98158a38-7c30-11eb-0796-2335e97ec6d0precedence_heuristic cell_id$98158a38-7c30-11eb-0796-2335e97ec6d0downstream_cells_mapupstream_cells_mapf$6dc89964-7c30-11eb-0a41-8d97b210ed34η$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff+z$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffexpand$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0precedence_heuristic cell_id$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0downstream_cells_mapupstream_cells_map@md_strgetindex$8c0c412e-7c2f-11eb-1880-4f6c45d77597precedence_heuristic cell_id$8c0c412e-7c2f-11eb-1880-4f6c45d77597downstream_cells_mapupstream_cells_map@md_strgetindex$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45precedence_heuristic cell_id$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45downstream_cells_mapexpand$98158a38-7c30-11eb-0796-2335e97ec6d0$e18f2470-7c31-11eb-2b74-d59d00d20ba4$3828b94c-7c2d-11eb-2e01-79038b0f5226$35b5c5c6-7c3f-11eb-2723-4b406a809114upstream_cells_mapsimplify$f25af026-7b9c-11eb-1f11-77a8b06b2d71precedence_heuristic cell_id$f25af026-7b9c-11eb-1f11-77a8b06b2d71downstream_cells_mapstandard_Newton$ecb40aea-7b9c-11eb-1476-e54faf32d91c$ec6c6328-7b9c-11eb-1c69-dba12ae522adupstream_cells_mapLaTeXStrings.latexstringForwardDiff$f4fda666-7b9c-11eb-0304-716c5e710462:@L_str|>straight$1b77fada-7b9d-11eb-3266-ebb3895cb76ahline!as_svg-ForwardDiff.derivativeplot/plot!LaTeXStrings$f4fda666-7b9c-11eb-0304-716c5e710462scatter!$fe742fec-7c3e-11eb-1f54-55cdf02a1574precedence_heuristic cell_id$fe742fec-7c3e-11eb-1f54-55cdf02a1574downstream_cells_mapp$3828b94c-7c2d-11eb-2e01-79038b0f5226$09b97be8-7c2e-11eb-05fd-65bbd097afb8$18ce2fac-7c2e-11eb-03d2-b3a674621662$ed605b90-7c3e-11eb-34e9-776a05a177dd$35b5c5c6-7c3f-11eb-2723-4b406a809114upstream_cells_map@md_strCore:Base.get@bindSliderBasePlutoRunnerPlutoRunner.create_bondCore.applicablegetindex$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750precedence_heuristic cell_id$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750downstream_cells_mapupstream_cells_map@md_strgetindex$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0precedence_heuristic cell_id$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0downstream_cells_mapT$3828b94c-7c2d-11eb-2e01-79038b0f5226$09b97be8-7c2e-11eb-05fd-65bbd097afb8$18ce2fac-7c2e-11eb-03d2-b3a674621662$ed605b90-7c3e-11eb-34e9-776a05a177dd$35b5c5c6-7c3f-11eb-2723-4b406a809114$02b1b470-7c31-11eb-28f4-411956f73f12$07a754da-7c31-11eb-0394-4bef4d79fc30$5faa2784-7c31-11eb-34f1-3f8224dbdbdeupstream_cells_map^+*$1b77fada-7b9d-11eb-3266-ebb3895cb76aprecedence_heuristic cell_id$1b77fada-7b9d-11eb-3266-ebb3895cb76adownstream_cells_mapstraight$f25af026-7b9c-11eb-1f11-77a8b06b2d71upstream_cells_map-+*$80917990-7ba0-11eb-029a-dba981c52b58precedence_heuristic cell_id$80917990-7ba0-11eb-029a-dba981c52b58downstream_cells_mapupstream_cells_map@md_strgetindex$b7dc4666-7ba1-11eb-32eb-fd3d720c2960precedence_heuristic cell_id$b7dc4666-7ba1-11eb-32eb-fd3d720c2960downstream_cells_mapupstream_cells_map@md_strgetindex$d35e0cc8-7c30-11eb-28d3-17c9e221ea62precedence_heuristic cell_id$d35e0cc8-7c30-11eb-28d3-17c9e221ea62downstream_cells_mapf′$db26375a-7c30-11eb-066e-ab9e8ded3356$ea741018-7c30-11eb-3912-a50475e6ec49$e18f2470-7c31-11eb-2b74-d59d00d20ba4upstream_cells_mapf$6dc89964-7c30-11eb-0a41-8d97b210ed34ForwardDiff$f4fda666-7b9c-11eb-0304-716c5e710462ForwardDiff.derivative$61905ae0-7ba6-11eb-0773-17e9aa4e9991precedence_heuristic cell_id$61905ae0-7ba6-11eb-0773-17e9aa4e9991downstream_cells_mapupstream_cells_map@md_strgetindex$1ba1ae44-7ba1-11eb-21ff-558c95446435precedence_heuristic cell_id$1ba1ae44-7ba1-11eb-21ff-558c95446435downstream_cells_mapupstream_cells_map@md_strgetindex$23536420-7c2d-11eb-20b0-9523f7a5f9d7precedence_heuristic cell_id$23536420-7c2d-11eb-20b0-9523f7a5f9d7downstream_cells_mapϵ$3828b94c-7c2d-11eb-2e01-79038b0f5226$18ce2fac-7c2e-11eb-03d2-b3a674621662$35b5c5c6-7c3f-11eb-2723-4b406a809114b$3828b94c-7c2d-11eb-2e01-79038b0f5226$09b97be8-7c2e-11eb-05fd-65bbd097afb8$18ce2fac-7c2e-11eb-03d2-b3a674621662$ed605b90-7c3e-11eb-34e9-776a05a177dd$35b5c5c6-7c3f-11eb-2723-4b406a809114a$3828b94c-7c2d-11eb-2e01-79038b0f5226$09b97be8-7c2e-11eb-05fd-65bbd097afb8$18ce2fac-7c2e-11eb-03d2-b3a674621662$ed605b90-7c3e-11eb-34e9-776a05a177dd$35b5c5c6-7c3f-11eb-2723-4b406a809114δ$3828b94c-7c2d-11eb-2e01-79038b0f5226$18ce2fac-7c2e-11eb-03d2-b3a674621662$35b5c5c6-7c3f-11eb-2723-4b406a809114upstream_cells_map@variables$c519704c-7ba1-11eb-12da-8b9b176daa0dprecedence_heuristic cell_id$c519704c-7ba1-11eb-12da-8b9b176daa0ddownstream_cells_mapupstream_cells_map@md_strgetindex$9cfa9062-7ba0-11eb-3a93-197ac0287ab4precedence_heuristic cell_id$9cfa9062-7ba0-11eb-3a93-197ac0287ab4downstream_cells_mapupstream_cells_map@md_strgetindex$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05precedence_heuristic cell_id$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05downstream_cells_mapx0$ec6c6328-7b9c-11eb-1c69-dba12ae522adupstream_cells_map@md_strCore:Base.get@bindSliderBasePlutoRunnerPlutoRunner.create_bondCore.applicablegetindex$af887dea-7ba1-11eb-3b0d-6925756382a7precedence_heuristic cell_id$af887dea-7ba1-11eb-3b0d-6925756382a7downstream_cells_mapupstream_cells_map@md_strgetindex$5123c038-7ba2-11eb-1be2-19f789b02c1fprecedence_heuristic cell_id$5123c038-7ba2-11eb-1be2-19f789b02c1fdownstream_cells_mapupstream_cells_map@md_strgetindex$e18f2470-7c31-11eb-2b74-d59d00d20ba4precedence_heuristic cell_id$e18f2470-7c31-11eb-2b74-d59d00d20ba4downstream_cells_mapupstream_cells_mapf$6dc89964-7c30-11eb-0a41-8d97b210ed34f′$d35e0cc8-7c30-11eb-28d3-17c9e221ea62-η$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff+*z$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffexpand$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45$5faa2784-7c31-11eb-34f1-3f8224dbdbdeprecedence_heuristic cell_id$5faa2784-7c31-11eb-34f1-3f8224dbdbdedownstream_cells_mapupstream_cells_map∘T$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0inverse$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7$2e2e5f0e-7c31-11eb-0da7-770b07ee6202α$395fd8e2-7c31-11eb-1933-dd719fa0cd22$9371f930-7c30-11eb-1f77-c7f31b97ea26precedence_heuristic cell_id$9371f930-7c30-11eb-1f77-c7f31b97ea26downstream_cells_mapupstream_cells_mapf$6dc89964-7c30-11eb-0a41-8d97b210ed34η$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff+z$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8precedence_heuristic cell_id$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8downstream_cells_mapupstream_cells_map@md_strgetindex$ed605b90-7c3e-11eb-34e9-776a05a177ddprecedence_heuristic cell_id$ed605b90-7c3e-11eb-34e9-776a05a177dddownstream_cells_mapupstream_cells_mapT$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0-image$3828b94c-7c2d-11eb-2e01-79038b0f5226b$23536420-7c2d-11eb-20b0-9523f7a5f9d7a$23536420-7c2d-11eb-20b0-9523f7a5f9d7p$fe742fec-7c3e-11eb-1f54-55cdf02a1574$d44c73b4-7c3e-11eb-1302-8ba9039ae789precedence_heuristic cell_id$d44c73b4-7c3e-11eb-1302-8ba9039ae789downstream_cells_mapupstream_cells_map@md_strgetindex$09b97be8-7c2e-11eb-05fd-65bbd097afb8precedence_heuristic cell_id$09b97be8-7c2e-11eb-05fd-65bbd097afb8downstream_cells_mapupstream_cells_mapjacobian$f4fda666-7b9c-11eb-0304-716c5e710462T$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0b$23536420-7c2d-11eb-20b0-9523f7a5f9d7|>a$23536420-7c2d-11eb-20b0-9523f7a5f9d7p$fe742fec-7c3e-11eb-1f54-55cdf02a1574Text$389e990e-7c40-11eb-37c4-5ba0f59173b3precedence_heuristic cell_id$389e990e-7c40-11eb-37c4-5ba0f59173b3downstream_cells_mapupstream_cells_map@md_strgetindex$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82precedence_heuristic cell_id$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82downstream_cells_mapupstream_cells_map@md_strgetindex$ec6c6328-7b9c-11eb-1c69-dba12ae522adprecedence_heuristic cell_id$ec6c6328-7b9c-11eb-1c69-dba12ae522addownstream_cells_mapupstream_cells_mapstandard_Newton$f25af026-7b9c-11eb-1f11-77a8b06b2d71:-x0$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05^+*n$2445da24-7b9d-11eb-02bd-eb99a3d95a2e$ecb40aea-7b9c-11eb-1476-e54faf32d91cprecedence_heuristic cell_id$ecb40aea-7b9c-11eb-1476-e54faf32d91cdownstream_cells_mapupstream_cells_mapstandard_Newton$f25af026-7b9c-11eb-1f11-77a8b06b2d71:-x02$77ef0cfb-60db-4599-bec2-b65e99e5b246^n2$ce44554e-847f-4129-8841-1a729dfa7a2e$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7precedence_heuristic cell_id$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7downstream_cells_mapupstream_cells_map@md_strgetindex$ee91563e-7c3e-11eb-3f65-1f336073869aprecedence_heuristic cell_id$ee91563e-7c3e-11eb-3f65-1f336073869adownstream_cells_mapupstream_cells_map@md_strgetindex$d690f83a-7c2e-11eb-14d7-79a250deb473precedence_heuristic cell_id$d690f83a-7c2e-11eb-14d7-79a250deb473downstream_cells_mapnewton1D$2fb40dc6-7c2f-11eb-2469-8deb4db59b5cupstream_cells_map:ForwardDiff$f4fda666-7b9c-11eb-0304-716c5e710462-ForwardDiff.derivative/$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8precedence_heuristic cell_id$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8downstream_cells_mapupstream_cells_map@md_strgetindex$07a754da-7c31-11eb-0394-4bef4d79fc30precedence_heuristic cell_id$07a754da-7c31-11eb-0394-4bef4d79fc30downstream_cells_mapupstream_cells_mapT$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0inverse$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7$2e2e5f0e-7c31-11eb-0da7-770b07ee6202α$395fd8e2-7c31-11eb-1933-dd719fa0cd22$63dbf052-7c32-11eb-1062-5b3581d38f70precedence_heuristic cell_id$63dbf052-7c32-11eb-1062-5b3581d38f70downstream_cells_mapupstream_cells_mapf$6dc89964-7c30-11eb-0a41-8d97b210ed34z$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff$18ce2fac-7c2e-11eb-03d2-b3a674621662precedence_heuristic cell_id$18ce2fac-7c2e-11eb-03d2-b3a674621662downstream_cells_mapupstream_cells_mapjacobian$f4fda666-7b9c-11eb-0304-716c5e710462T$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0ϵ$23536420-7c2d-11eb-20b0-9523f7a5f9d7b$23536420-7c2d-11eb-20b0-9523f7a5f9d7*a$23536420-7c2d-11eb-20b0-9523f7a5f9d7p$fe742fec-7c3e-11eb-1f54-55cdf02a1574δ$23536420-7c2d-11eb-20b0-9523f7a5f9d7$6dc89964-7c30-11eb-0a41-8d97b210ed34precedence_heuristic cell_id$6dc89964-7c30-11eb-0a41-8d97b210ed34downstream_cells_mapf$d35e0cc8-7c30-11eb-28d3-17c9e221ea62$63dbf052-7c32-11eb-1062-5b3581d38f70$9371f930-7c30-11eb-1f77-c7f31b97ea26$98158a38-7c30-11eb-0796-2335e97ec6d0$ea741018-7c30-11eb-3912-a50475e6ec49$e18f2470-7c31-11eb-2b74-d59d00d20ba4upstream_cells_mapm$a869e6c6-7c31-11eb-13c8-155d08be02eb-^$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0precedence_heuristic cell_id$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0downstream_cells_mapupstream_cells_map@md_strgetindex$35b5c5c6-7c3f-11eb-2723-4b406a809114precedence_heuristic cell_id$35b5c5c6-7c3f-11eb-2723-4b406a809114downstream_cells_mapupstream_cells_mapjacobian$f4fda666-7b9c-11eb-0304-716c5e710462T$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0image$3828b94c-7c2d-11eb-2e01-79038b0f5226ϵ$23536420-7c2d-11eb-20b0-9523f7a5f9d7b$23536420-7c2d-11eb-20b0-9523f7a5f9d7δ$23536420-7c2d-11eb-20b0-9523f7a5f9d7a$23536420-7c2d-11eb-20b0-9523f7a5f9d7simplify-*p$fe742fec-7c3e-11eb-1f54-55cdf02a1574expand$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45$e410c1d0-7ba1-11eb-394f-71dac89756b7precedence_heuristic cell_id$e410c1d0-7ba1-11eb-394f-71dac89756b7downstream_cells_mapupstream_cells_map@md_strgetindex$db26375a-7c30-11eb-066e-ab9e8ded3356precedence_heuristic cell_id$db26375a-7c30-11eb-066e-ab9e8ded3356downstream_cells_mapupstream_cells_mapf′$d35e0cc8-7c30-11eb-28d3-17c9e221ea62z$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff$615aff3c-7c30-11eb-2ca8-9d2fdf299017precedence_heuristic cell_id$615aff3c-7c30-11eb-2ca8-9d2fdf299017downstream_cells_mapupstream_cells_map@md_strgetindex$77ef0cfb-60db-4599-bec2-b65e99e5b246precedence_heuristic cell_id$77ef0cfb-60db-4599-bec2-b65e99e5b246downstream_cells_mapx02$ecb40aea-7b9c-11eb-1476-e54faf32d91cupstream_cells_map@md_strCore:Base.get@bindSliderBasePlutoRunnerPlutoRunner.create_bondCore.applicablegetindex$1db66b0e-7ba4-11eb-2157-d5a399a73b1fprecedence_heuristic cell_id$1db66b0e-7ba4-11eb-2157-d5a399a73b1fdownstream_cells_mapnewton2D_step$923bde64-7ba4-11eb-21e9-a11993aaab2eupstream_cells_mapForwardDiff$f4fda666-7b9c-11eb-0304-716c5e710462ForwardDiff.jacobian\-$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7precedence_heuristic cell_id$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7downstream_cells_mapinverse$07a754da-7c31-11eb-0394-4bef4d79fc30$5faa2784-7c31-11eb-34f1-3f8224dbdbdeupstream_cells_map@doc-Tuplenewton2D$923bde64-7ba4-11eb-21e9-a11993aaab2eUnion#___this_pluto_module_nameAny$ea741018-7c30-11eb-3912-a50475e6ec49precedence_heuristic cell_id$ea741018-7c30-11eb-3912-a50475e6ec49downstream_cells_mapupstream_cells_mapf$6dc89964-7c30-11eb-0a41-8d97b210ed34f′$d35e0cc8-7c30-11eb-28d3-17c9e221ea62η$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff+*z$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08precedence_heuristic cell_id$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08downstream_cells_mapupstream_cells_map@md_strgetindex$02b1b470-7c31-11eb-28f4-411956f73f12precedence_heuristic cell_id$02b1b470-7c31-11eb-28f4-411956f73f12downstream_cells_mapupstream_cells_mapT$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0α$395fd8e2-7c31-11eb-1933-dd719fa0cd22$ba570c4c-7ba2-11eb-2125-9f23e415a1dcprecedence_heuristic cell_id$ba570c4c-7ba2-11eb-2125-9f23e415a1dcdownstream_cells_mapupstream_cells_map@md_strgetindex$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71aprecedence_heuristic cell_id$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71adownstream_cells_mapupstream_cells_map@md_strgetindexcell_execution_orderA$f4fda666-7b9c-11eb-0304-716c5e710462$dd6b0ae2-cc87-4d19-ac78-f3a990aa692e$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71a$e410c1d0-7ba1-11eb-394f-71dac89756b7$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82$8c0c412e-7c2f-11eb-1880-4f6c45d77597$ce44554e-847f-4129-8841-1a729dfa7a2e$77ef0cfb-60db-4599-bec2-b65e99e5b246$2445da24-7b9d-11eb-02bd-eb99a3d95a2e$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8$615aff3c-7c30-11eb-2ca8-9d2fdf299017$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff$a869e6c6-7c31-11eb-13c8-155d08be02eb$6dc89964-7c30-11eb-0a41-8d97b210ed34$d35e0cc8-7c30-11eb-28d3-17c9e221ea62$63dbf052-7c32-11eb-1062-5b3581d38f70$9371f930-7c30-11eb-1f77-c7f31b97ea26$9d778e36-7c30-11eb-1f4b-894af86a8f5d$db26375a-7c30-11eb-066e-ab9e8ded3356$ea741018-7c30-11eb-3912-a50475e6ec49$389e990e-7c40-11eb-37c4-5ba0f59173b3$5123c038-7ba2-11eb-1be2-19f789b02c1f$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8$9cfa9062-7ba0-11eb-3a93-197ac0287ab4$1ba1ae44-7ba1-11eb-21ff-558c95446435$ba570c4c-7ba2-11eb-2125-9f23e415a1dc$d690f83a-7c2e-11eb-14d7-79a250deb473$2fb40dc6-7c2f-11eb-2469-8deb4db59b5c$35791bca-7c2f-11eb-1cfb-8d5ebd0208cb$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0$d44c73b4-7c3e-11eb-1302-8ba9039ae789$fe742fec-7c3e-11eb-1f54-55cdf02a1574$23536420-7c2d-11eb-20b0-9523f7a5f9d7$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7$80917990-7ba0-11eb-029a-dba981c52b58$af887dea-7ba1-11eb-3b0d-6925756382a7$b7dc4666-7ba1-11eb-32eb-fd3d720c2960$c519704c-7ba1-11eb-12da-8b9b176daa0d$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750$1db66b0e-7ba4-11eb-2157-d5a399a73b1f$923bde64-7ba4-11eb-21e9-a11993aaab2e$61905ae0-7ba6-11eb-0773-17e9aa4e9991$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7$2e2e5f0e-7c31-11eb-0da7-770b07ee6202$1b77fada-7b9d-11eb-3266-ebb3895cb76a$f25af026-7b9c-11eb-1f11-77a8b06b2d71$ecb40aea-7b9c-11eb-1476-e54faf32d91c$ec6c6328-7b9c-11eb-1c69-dba12ae522ad$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0$09b97be8-7c2e-11eb-05fd-65bbd097afb8$18ce2fac-7c2e-11eb-03d2-b3a674621662$395fd8e2-7c31-11eb-1933-dd719fa0cd22$02b1b470-7c31-11eb-28f4-411956f73f12$07a754da-7c31-11eb-0394-4bef4d79fc30$5faa2784-7c31-11eb-34f1-3f8224dbdbde$ee91563e-7c3e-11eb-3f65-1f336073869a$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45$98158a38-7c30-11eb-0796-2335e97ec6d0$e18f2470-7c31-11eb-2b74-d59d00d20ba4$3828b94c-7c2d-11eb-2e01-79038b0f5226$ed605b90-7c3e-11eb-34e9-776a05a177dd$35b5c5c6-7c3f-11eb-2723-4b406a809114last_hot_reload_timeshortpathnewton.jlprocess_statusreadypathS/home/fons/featured-slider-server/featured_fix/src/computational-thinking/newton.jlpluto_versionv1.0.0last_save_timeAڎȴcell_orderA$dd6b0ae2-cc87-4d19-ac78-f3a990aa692e$f4fda666-7b9c-11eb-0304-716c5e710462$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71a$e410c1d0-7ba1-11eb-394f-71dac89756b7$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82$8c0c412e-7c2f-11eb-1880-4f6c45d77597$ce44554e-847f-4129-8841-1a729dfa7a2e$77ef0cfb-60db-4599-bec2-b65e99e5b246$ecb40aea-7b9c-11eb-1476-e54faf32d91c$2445da24-7b9d-11eb-02bd-eb99a3d95a2e$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05$ec6c6328-7b9c-11eb-1c69-dba12ae522ad$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8$615aff3c-7c30-11eb-2ca8-9d2fdf299017$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff$6dc89964-7c30-11eb-0a41-8d97b210ed34$d35e0cc8-7c30-11eb-28d3-17c9e221ea62$a869e6c6-7c31-11eb-13c8-155d08be02eb$63dbf052-7c32-11eb-1062-5b3581d38f70$9371f930-7c30-11eb-1f77-c7f31b97ea26$98158a38-7c30-11eb-0796-2335e97ec6d0$9d778e36-7c30-11eb-1f4b-894af86a8f5d$db26375a-7c30-11eb-066e-ab9e8ded3356$ea741018-7c30-11eb-3912-a50475e6ec49$e18f2470-7c31-11eb-2b74-d59d00d20ba4$389e990e-7c40-11eb-37c4-5ba0f59173b3$5123c038-7ba2-11eb-1be2-19f789b02c1f$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8$9cfa9062-7ba0-11eb-3a93-197ac0287ab4$1ba1ae44-7ba1-11eb-21ff-558c95446435$ba570c4c-7ba2-11eb-2125-9f23e415a1dc$d690f83a-7c2e-11eb-14d7-79a250deb473$2fb40dc6-7c2f-11eb-2469-8deb4db59b5c$35791bca-7c2f-11eb-1cfb-8d5ebd0208cb$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0$d44c73b4-7c3e-11eb-1302-8ba9039ae789$fe742fec-7c3e-11eb-1f54-55cdf02a1574$23536420-7c2d-11eb-20b0-9523f7a5f9d7$3828b94c-7c2d-11eb-2e01-79038b0f5226$09b97be8-7c2e-11eb-05fd-65bbd097afb8$18ce2fac-7c2e-11eb-03d2-b3a674621662$ed605b90-7c3e-11eb-34e9-776a05a177dd$35b5c5c6-7c3f-11eb-2723-4b406a809114$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7$80917990-7ba0-11eb-029a-dba981c52b58$af887dea-7ba1-11eb-3b0d-6925756382a7$b7dc4666-7ba1-11eb-32eb-fd3d720c2960$c519704c-7ba1-11eb-12da-8b9b176daa0d$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750$1db66b0e-7ba4-11eb-2157-d5a399a73b1f$923bde64-7ba4-11eb-21e9-a11993aaab2e$61905ae0-7ba6-11eb-0773-17e9aa4e9991$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7$2e2e5f0e-7c31-11eb-0da7-770b07ee6202$1b77fada-7b9d-11eb-3266-ebb3895cb76a$f25af026-7b9c-11eb-1f11-77a8b06b2d71$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0$395fd8e2-7c31-11eb-1933-dd719fa0cd22$02b1b470-7c31-11eb-28f4-411956f73f12$07a754da-7c31-11eb-0394-4bef4d79fc30$5faa2784-7c31-11eb-34f1-3f8224dbdbde$ee91563e-7c3e-11eb-3f65-1f336073869a$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45julia_versionv1.12.4published_objectsnbpkginstall_time_nsyHinstantiatedòinstalled_versionsForwardDiff1.3.3Symbolics7.24.2PlutoUI0.7.81Plots1.41.6Latexify0.16.10!__internal_julia_manifest_version__internal_julia_version1.12.4LaTeXStrings1.4.0terminal_outputsForwardDiff0┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` has an old format that is being maintained. │ To update to the new format, which is supported by Julia versions ≥ 1.6.2, run `import Pkg; Pkg.upgrade_manifest()` which will upgrade the format without re-resolving. │ To then record the julia version re-resolve with `Pkg.resolve()` and if there are resolve conflicts consider `Pkg.update()`. └ @ Pkg.Types ~/.julia/juliaup/julia-1.12.4+0.aarch64.linux.gnu/share/julia/stdlib/v1.12/Pkg/src/manifest.jl:383 Resolving... ===  Project No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` Instantiating... === ┌ Warning: The active manifest file is an older format with no julia version entry. Dependencies may have been resolved with a different julia version. └ @ ~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml:0 Precompiling... === Waiting for notebook process to start... Done. Starting precompilation...nbpkg_sync0┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` has an old format that is being maintained. │ To update to the new format, which is supported by Julia versions ≥ 1.6.2, run `import Pkg; Pkg.upgrade_manifest()` which will upgrade the format without re-resolving. │ To then record the julia version re-resolve with `Pkg.resolve()` and if there are resolve conflicts consider `Pkg.update()`. └ @ Pkg.Types ~/.julia/juliaup/julia-1.12.4+0.aarch64.linux.gnu/share/julia/stdlib/v1.12/Pkg/src/manifest.jl:383 Resolving... ===  Project No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` Instantiating... === ┌ Warning: The active manifest file is an older format with no julia version entry. Dependencies may have been resolved with a different julia version. └ @ ~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml:0 Precompiling... === Waiting for notebook process to start... Done. Starting precompilation...Symbolics0┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` has an old format that is being maintained. │ To update to the new format, which is supported by Julia versions ≥ 1.6.2, run `import Pkg; Pkg.upgrade_manifest()` which will upgrade the format without re-resolving. │ To then record the julia version re-resolve with `Pkg.resolve()` and if there are resolve conflicts consider `Pkg.update()`. └ @ Pkg.Types ~/.julia/juliaup/julia-1.12.4+0.aarch64.linux.gnu/share/julia/stdlib/v1.12/Pkg/src/manifest.jl:383 Resolving... ===  Project No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` Instantiating... === ┌ Warning: The active manifest file is an older format with no julia version entry. Dependencies may have been resolved with a different julia version. └ @ ~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml:0 Precompiling... === Waiting for notebook process to start... Done. Starting precompilation...PlutoUI0┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` has an old format that is being maintained. │ To update to the new format, which is supported by Julia versions ≥ 1.6.2, run `import Pkg; Pkg.upgrade_manifest()` which will upgrade the format without re-resolving. │ To then record the julia version re-resolve with `Pkg.resolve()` and if there are resolve conflicts consider `Pkg.update()`. └ @ Pkg.Types ~/.julia/juliaup/julia-1.12.4+0.aarch64.linux.gnu/share/julia/stdlib/v1.12/Pkg/src/manifest.jl:383 Resolving... ===  Project No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` Instantiating... === ┌ Warning: The active manifest file is an older format with no julia version entry. Dependencies may have been resolved with a different julia version. └ @ ~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml:0 Precompiling... === Waiting for notebook process to start... Done. Starting precompilation...Plots0┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` has an old format that is being maintained. │ To update to the new format, which is supported by Julia versions ≥ 1.6.2, run `import Pkg; Pkg.upgrade_manifest()` which will upgrade the format without re-resolving. │ To then record the julia version re-resolve with `Pkg.resolve()` and if there are resolve conflicts consider `Pkg.update()`. └ @ Pkg.Types ~/.julia/juliaup/julia-1.12.4+0.aarch64.linux.gnu/share/julia/stdlib/v1.12/Pkg/src/manifest.jl:383 Resolving... ===  Project No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` Instantiating... === ┌ Warning: The active manifest file is an older format with no julia version entry. Dependencies may have been resolved with a different julia version. └ @ ~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml:0 Precompiling... === Waiting for notebook process to start... Done. Starting precompilation...Latexify0┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` has an old format that is being maintained. │ To update to the new format, which is supported by Julia versions ≥ 1.6.2, run `import Pkg; Pkg.upgrade_manifest()` which will upgrade the format without re-resolving. │ To then record the julia version re-resolve with `Pkg.resolve()` and if there are resolve conflicts consider `Pkg.update()`. └ @ Pkg.Types ~/.julia/juliaup/julia-1.12.4+0.aarch64.linux.gnu/share/julia/stdlib/v1.12/Pkg/src/manifest.jl:383 Resolving... ===  Project No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` Instantiating... === ┌ Warning: The active manifest file is an older format with no julia version entry. Dependencies may have been resolved with a different julia version. └ @ ~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml:0 Precompiling... === Waiting for notebook process to start... Done. Starting precompilation...LaTeXStrings0┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` has an old format that is being maintained. │ To update to the new format, which is supported by Julia versions ≥ 1.6.2, run `import Pkg; Pkg.upgrade_manifest()` which will upgrade the format without re-resolving. │ To then record the julia version re-resolve with `Pkg.resolve()` and if there are resolve conflicts consider `Pkg.update()`. └ @ Pkg.Types ~/.julia/juliaup/julia-1.12.4+0.aarch64.linux.gnu/share/julia/stdlib/v1.12/Pkg/src/manifest.jl:383 Resolving... ===  Project No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml` Instantiating... === ┌ Warning: The active manifest file is an older format with no julia version entry. Dependencies may have been resolved with a different julia version. └ @ ~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_dvbripjqcx/Manifest.toml:0 Precompiling... === Waiting for notebook process to start... Done. Starting precompilation...enabled÷restart_recommended_msgrestart_required_msgbusy_packageswaiting_for_permission,waiting_for_permission_but_probably_disabled«cell_inputsA$2e2e5f0e-7c31-11eb-0da7-770b07ee6202cell_id$2e2e5f0e-7c31-11eb-0da7-770b07ee6202codeinverse(f) = y -> inverse(f, y)metadatashow_logsèdisabled®skip_as_script«code_folded$9d778e36-7c30-11eb-1f4b-894af86a8f5dcell_id$9d778e36-7c30-11eb-1f4b-894af86a8f5dcodemd""" When $\eta$ is small, $\eta^2$ is *very* small, so we can ignore it. We are left with terms that either don't contain $\eta$ (constants), or multiply $\eta$ (linear). The part that multiplies $\eta$ is the derivative: """metadatashow_logsèdisabled®skip_as_script«code_folded$395fd8e2-7c31-11eb-1933-dd719fa0cd22cell_id$395fd8e2-7c31-11eb-1933-dd719fa0cd22code@md""" α = $(@bind α Slider(0.0:0.01:1.0, show_value=true)) """metadatashow_logsèdisabled®skip_as_script«code_folded$3828b94c-7c2d-11eb-2e01-79038b0f5226cell_id$3828b94c-7c2d-11eb-2e01-79038b0f5226code/image = expand.(T(p)( [ (a + δ), (b + ϵ) ] ))metadatashow_logsèdisabled®skip_as_script«code_folded$ce44554e-847f-4129-8841-1a729dfa7a2ecell_id$ce44554e-847f-4129-8841-1a729dfa7a2ecodeBmd""" n = $(@bind n2 Slider(0:10, show_value=true, default=1)) """metadatashow_logsèdisabled®skip_as_script«code_folded$923bde64-7ba4-11eb-21e9-a11993aaab2ecell_id$923bde64-7ba4-11eb-21e9-a11993aaab2ecodeي"Find ``x`` such that ``T(x) = 0``" function newton2D(T, x0, n=10) x = x0 for i in 1:n x = newton2D_step(T, x) end return x endmetadatashow_logsèdisabled®skip_as_script«code_folded$a869e6c6-7c31-11eb-13c8-155d08be02ebcell_id$a869e6c6-7c31-11eb-13c8-155d08be02ebcode5md""" m = $(@bind m Slider(1:6, show_value=true)) """metadatashow_logsèdisabled®skip_as_script«code_folded$2fb40dc6-7c2f-11eb-2469-8deb4db59b5ccell_id$2fb40dc6-7c2f-11eb-2469-8deb4db59b5ccodenewton1D(x -> x^2 - 2, 37.0)metadatashow_logsèdisabled®skip_as_script«code_folded$f4fda666-7b9c-11eb-0304-716c5e710462cell_id$f4fda666-7b9c-11eb-0304-716c5e710462codevbegin using Symbolics, ForwardDiff, Plots, PlutoUI, LaTeXStrings using ForwardDiff: jacobian import Latexify endmetadatashow_logsèdisabled®skip_as_script«code_folded$35791bca-7c2f-11eb-1cfb-8d5ebd0208cbcell_id$35791bca-7c2f-11eb-1cfb-8d5ebd0208cbcodesqrt(2)metadatashow_logsèdisabled®skip_as_script«code_folded$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffcell_id$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffcode@variables z, ηmetadatashow_logsèdisabled®skip_as_script«code_folded$dd6b0ae2-cc87-4d19-ac78-f3a990aa692ecell_id$dd6b0ae2-cc87-4d19-ac78-f3a990aa692ecodehtml"""

This lecture is part of Computational Thinking, a live online Julia/Pluto textbook. Go to computationalthinking.mit.edu to read all 50 lectures for free.

"""metadatashow_logsèdisabled®skip_as_script«code_folded$2445da24-7b9d-11eb-02bd-eb99a3d95a2ecell_id$2445da24-7b9d-11eb-02bd-eb99a3d95a2ecodeAmd""" n = $(@bind n Slider(0:10, show_value=true, default=1)) """metadatashow_logsèdisabled®skip_as_script«code_folded$98158a38-7c30-11eb-0796-2335e97ec6d0cell_id$98158a38-7c30-11eb-0796-2335e97ec6d0codeexpand( f(z + η) )metadatashow_logsèdisabled®skip_as_script«code_folded$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0cell_id$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0code^md""" ## Newton for transformations in 2 dimensions $$T: \mathbb{R}^2 \to \mathbb{R}^2$$ """metadatashow_logsèdisabled®skip_as_script«code_folded$8c0c412e-7c2f-11eb-1880-4f6c45d77597cell_id$8c0c412e-7c2f-11eb-1880-4f6c45d77597codemd""" The idea of the Newton method is to *follow the direction in which the function is pointing*! We do this by building a **tangent line** at the current position and following that instead, until it hits the $x$-axis. Let's look at that visually first: """metadatashow_logsèdisabled®skip_as_script«code_folded$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45cell_id$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45code(expand(ex) = simplify(ex, polynorm=true)metadatashow_logsèdisabled®skip_as_script«code_folded$f25af026-7b9c-11eb-1f11-77a8b06b2d71cell_id$f25af026-7b9c-11eb-1f11-77a8b06b2d71codefunction standard_Newton(f, n, x_range, x0, ymin=-10, ymax=10) f′ = x -> ForwardDiff.derivative(f, x) p = plot(f, x_range, lw=3, ylim=(ymin, ymax), legend=:false, size=(400, 300)) hline!([0.0], c="magenta", lw=3, ls=:dash) scatter!([x0], [0], c="green", ann=(x0, -5, L"x_0", 10)) for i in 1:n plot!([x0, x0], [0, f(x0)], c=:gray, alpha=0.5) scatter!([x0], [f(x0)], c=:red) m = f′(x0) plot!(x_range, [straight(x0, f(x0), x, m) for x in x_range], c=:blue, alpha=0.5, ls=:dash, lw=2) x1 = x0 - f(x0) / m scatter!([x1], [0], c="green", ann=(x1, -5, L"x_%$i", 10)) x0 = x1 end p |> as_svg endmetadatashow_logsèdisabled®skip_as_script«code_folded$fe742fec-7c3e-11eb-1f54-55cdf02a1574cell_id$fe742fec-7c3e-11eb-1f54-55cdf02a1574code:md""" p = $(@bind p Slider(0:0.01:1, show_value=true)) """metadatashow_logsèdisabled®skip_as_script«code_folded$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750cell_id$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750code!md""" ## Implementation in 2D """metadatashow_logsèdisabled®skip_as_script«code_folded$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0cell_id$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0code-T(α) = ((x, y),) -> [x + α*y^2, y + α*x^2]metadatashow_logsèdisabled®skip_as_script«code_folded$1b77fada-7b9d-11eb-3266-ebb3895cb76acell_id$1b77fada-7b9d-11eb-3266-ebb3895cb76acode*straight(x0, y0, x, m) = y0 + m * (x - x0)metadatashow_logsèdisabled®skip_as_script«code_folded$80917990-7ba0-11eb-029a-dba981c52b58cell_id$80917990-7ba0-11eb-029a-dba981c52b58codemd""" $$T(x_0 + \delta) \simeq 0$$ $$T(x_0) + J \cdot \delta \simeq 0,$$ where $J := DT_{x_0}$ is the Jacobian matrix of $T$ at $x_0$, i.e. the best linear approximation of $T$ near to $x_0$. """metadatashow_logsèdisabled®skip_as_script«code_folded$b7dc4666-7ba1-11eb-32eb-fd3d720c2960cell_id$b7dc4666-7ba1-11eb-32eb-fd3d720c2960codeumd""" $$J \cdot \delta = -T(x_0)$$ Then we again construct the new approximation $x_1$ as $x_1 := x_0 + \delta$. """metadatashow_logsèdisabled®skip_as_script«code_folded$d35e0cc8-7c30-11eb-28d3-17c9e221ea62cell_id$d35e0cc8-7c30-11eb-28d3-17c9e221ea62code'f′(x) = ForwardDiff.derivative(f, x);metadatashow_logsèdisabled®skip_as_script«code_folded$61905ae0-7ba6-11eb-0773-17e9aa4e9991cell_id$61905ae0-7ba6-11eb-0773-17e9aa4e9991codeًmd""" Remember that Newton is designed to look for *roots*, i.e. places where $T(x) = 0$. We want $T(x) = y$, so we need another layer: """metadatashow_logsèdisabled®skip_as_script«code_folded$1ba1ae44-7ba1-11eb-21ff-558c95446435cell_id$1ba1ae44-7ba1-11eb-21ff-558c95446435codemd""" If we are already "quite close" to the root then $\delta$ should be small, so we can approximate $f$ using the tangent line: $$f(x_0) + \delta \, f'(x_0) \simeq 0$$ and hence $$\delta \simeq \frac{-f(x_0)}{f'(x_0)}$$ so that $$x_1 = x_0 - \frac{f(x_0)}{f'(x_0)}$$ Now we can repeat so that $$x_2 = x_1 - \frac{f(x_1)}{f'(x_1)}$$ and in general $$x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}.$$ This is the Newton method in 1D. """metadatashow_logsèdisabled®skip_as_script«code_folded$23536420-7c2d-11eb-20b0-9523f7a5f9d7cell_id$23536420-7c2d-11eb-20b0-9523f7a5f9d7code@variables a, b, δ, ϵmetadatashow_logsèdisabled®skip_as_script«code_folded$c519704c-7ba1-11eb-12da-8b9b176daa0dcell_id$c519704c-7ba1-11eb-12da-8b9b176daa0dcodeJmd""" In 2D we have an explicit formula for the inverse of the matrix. """metadatashow_logsèdisabled®skip_as_script«code_folded$9cfa9062-7ba0-11eb-3a93-197ac0287ab4cell_id$9cfa9062-7ba0-11eb-3a93-197ac0287ab4code/md""" $$f(x_1) = f(x_0 + \delta) \simeq 0$$ """metadatashow_logsèdisabled®skip_as_script«code_folded$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05cell_id$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05codeGmd""" x₀ = $(@bind x0 Slider(-10:10, show_value=true, default=6)) """metadatashow_logsèdisabled®skip_as_script«code_folded$af887dea-7ba1-11eb-3b0d-6925756382a7cell_id$af887dea-7ba1-11eb-3b0d-6925756382a7codeJmd""" Hence $\delta$ is the solution of the system of linear equations """metadatashow_logsèdisabled®skip_as_script«code_folded$5123c038-7ba2-11eb-1be2-19f789b02c1fcell_id$5123c038-7ba2-11eb-1be2-19f789b02c1fcode-md""" ## Mathematics of the Newton method """metadatashow_logsèdisabled®skip_as_script«code_folded$e18f2470-7c31-11eb-2b74-d59d00d20ba4cell_id$e18f2470-7c31-11eb-2b74-d59d00d20ba4code+expand( f(z + η) ) - ( f(z) + η*f′(z) )metadatashow_logsèdisabled®skip_as_script«code_folded$5faa2784-7c31-11eb-34f1-3f8224dbdbdecell_id$5faa2784-7c31-11eb-34f1-3f8224dbdbdecode*( T(α) ∘ inverse(T(α)) )( [0.3, 0.4] )metadatashow_logsèdisabled®skip_as_script«code_folded$9371f930-7c30-11eb-1f77-c7f31b97ea26cell_id$9371f930-7c30-11eb-1f77-c7f31b97ea26codef(z + η)metadatashow_logsèdisabled®skip_as_script«code_folded$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8cell_id$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8codeUmd""" ## Using symbolic calculations to understand derivatives and nonlinear maps """metadatashow_logsèdisabled®skip_as_script«code_folded$ed605b90-7c3e-11eb-34e9-776a05a177ddcell_id$ed605b90-7c3e-11eb-34e9-776a05a177ddcodeimage - T(p)([a, b])metadatashow_logsèdisabled®skip_as_script«code_folded$d44c73b4-7c3e-11eb-1302-8ba9039ae789cell_id$d44c73b4-7c3e-11eb-1302-8ba9039ae789codeٞmd""" Let's see what happens when we perturb by small amounts $\delta$ in the $x$ direction and $\epsilon$ in the $y$ direction around the point $(a, b)$: """metadatashow_logsèdisabled®skip_as_script«code_folded$09b97be8-7c2e-11eb-05fd-65bbd097afb8cell_id$09b97be8-7c2e-11eb-05fd-65bbd097afb8codejacobian(T(p), [a, b]) .|> Textmetadatashow_logsèdisabled®skip_as_script«code_folded$389e990e-7c40-11eb-37c4-5ba0f59173b3cell_id$389e990e-7c40-11eb-37c4-5ba0f59173b3codemd""" The derivative gives the "*linear* part" of the function. `ForwardDiff.jl`, and forward-mode automatic differentiation in general, effectively uses this (although not symbolically in this sense) to just propagate the linear part of each function through a calculation. """metadatashow_logsèdisabled®skip_as_script«code_folded$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82cell_id$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82codesmd""" ## The Newton method in 1D We would like to solve equations like $f(x) = g(x)$. We rewrite that by moving all the terms to one side of the equation so that we can write $h(x) = 0$, with $h(x) := f(x) - g(x)$. A point $x^*$ such that $h(x^*) = 0$ is called a **root** or **zero** of $h$. The Newton method finds zeros, and hence solves the original equation. """metadatashow_logsèdisabled®skip_as_script«code_folded$ec6c6328-7b9c-11eb-1c69-dba12ae522adcell_id$ec6c6328-7b9c-11eb-1c69-dba12ae522adcodeRlet f(x) = 0.2x^3 - 4x + 1 standard_Newton(f, n, -10:0.01:10, x0, -10, 70) endmetadatashow_logsèdisabled®skip_as_script«code_folded$ecb40aea-7b9c-11eb-1476-e54faf32d91ccell_id$ecb40aea-7b9c-11eb-1476-e54faf32d91ccodeJlet f(x) = x^2 - 2 standard_Newton(f, n2, -1:0.01:10, x02, -10, 70) endmetadatashow_logsèdisabled®skip_as_script«code_folded$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7cell_id$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7codeِmd""" We want to find the inverse $T^{-1}(y)$, i.e. to solve the equation $T(x) = y$ for $x$. We use the same idea as in 1D, but now in 2D: """metadatashow_logsèdisabled®skip_as_script«code_folded$ee91563e-7c3e-11eb-3f65-1f336073869acell_id$ee91563e-7c3e-11eb-3f65-1f336073869acodemd""" ## Appendix """metadatashow_logsèdisabled®skip_as_script«code_folded$d690f83a-7c2e-11eb-14d7-79a250deb473cell_id$d690f83a-7c2e-11eb-14d7-79a250deb473codefunction newton1D(f, x0) f′(x) = ForwardDiff.derivative(f, x) # \prime x0 = 37.0 # starting point sequence = [x0] x = x0 for i in 1:10 x -= f(x) / f′(x) end return x endmetadatashow_logsèdisabled®skip_as_script«code_folded$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8cell_id$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8codemd""" Suppose we have a guess $x_0$ for the root and we want to find a (hopefully) better guess $x_1$. Let's set $x_1 = x_0 + \delta$, where $x_1$ and $\delta$ are still unknown. We want $x_1$ to be a root, so """metadatashow_logsèdisabled®skip_as_script«code_folded$07a754da-7c31-11eb-0394-4bef4d79fc30cell_id$07a754da-7c31-11eb-0394-4bef4d79fc30codeinverse(T(α))( [0.3, 0.4] )metadatashow_logsèdisabled®skip_as_script«code_folded$63dbf052-7c32-11eb-1062-5b3581d38f70cell_id$63dbf052-7c32-11eb-1062-5b3581d38f70codef(z)metadatashow_logsèdisabled®skip_as_script«code_folded$18ce2fac-7c2e-11eb-03d2-b3a674621662cell_id$18ce2fac-7c2e-11eb-03d2-b3a674621662code!jacobian(T(p), [a, b]) * [δ, ϵ]metadatashow_logsèdisabled®skip_as_script«code_folded$6dc89964-7c30-11eb-0a41-8d97b210ed34cell_id$6dc89964-7c30-11eb-0a41-8d97b210ed34codef(x) = x^m - 2;metadatashow_logsèdisabled®skip_as_script«code_folded$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0cell_id$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0code'md""" ## Symbolic derivative in 2D """metadatashow_logsèdisabled®skip_as_script«code_folded$35b5c5c6-7c3f-11eb-2723-4b406a809114cell_id$35b5c5c6-7c3f-11eb-2723-4b406a809114codeLsimplify.(expand.(image - T(p)([a, b]) - jacobian(T(p), [a, b]) * [δ, ϵ]))metadatashow_logsèdisabled®skip_as_script«code_folded$e410c1d0-7ba1-11eb-394f-71dac89756b7cell_id$e410c1d0-7ba1-11eb-394f-71dac89756b7code|md""" In science and engineering we often need to *solve systems of equations*. If the equations are *linear* then linear algebra tells us a general method to solve them; these are now routinely applied to solve systems of millions of linear equations. If the equations are *non*linear then things are less obvious. The main solution methods we know work by... reducing the nonlinear equations to a sequence of linear equations! They do this by *approximating* the function by a linear function and solving that to get a better solution, then repeating this operation as many times as necessary to get a *sequence* of increasingly better solutions. This is an example of an **iterative algorithm**. A well-known and elegant method, which can be used in many different contexts, is the **Newton method**. It does, however, have the disadvantage that it requires derivatives of the function. This can be overcome using **automatic differentiation** techniques. We will illustrate the Newton method using the `ForwardDiff.jl` package to carry out automatic differentiation, but we will also try to understand what's going on "under the hood". """metadatashow_logsèdisabled®skip_as_script«code_folded$db26375a-7c30-11eb-066e-ab9e8ded3356cell_id$db26375a-7c30-11eb-066e-ab9e8ded3356codef′(z)metadatashow_logsèdisabled®skip_as_script«code_folded$615aff3c-7c30-11eb-2ca8-9d2fdf299017cell_id$615aff3c-7c30-11eb-2ca8-9d2fdf299017codemd""" We can use Julia's new symbolic capabilities to understand what's going on with a nonlinear (polynomial) function. Let's see what happens if we perturb a function $f$ around a point $z$ by a small amount $\eta$. """metadatashow_logsèdisabled®skip_as_script«code_folded$77ef0cfb-60db-4599-bec2-b65e99e5b246cell_id$77ef0cfb-60db-4599-bec2-b65e99e5b246codeHmd""" x₀ = $(@bind x02 Slider(-10:10, show_value=true, default=6)) """metadatashow_logsèdisabled®skip_as_script«code_folded$1db66b0e-7ba4-11eb-2157-d5a399a73b1fcell_id$1db66b0e-7ba4-11eb-2157-d5a399a73b1fcodeٓfunction newton2D_step(T, x) J = ForwardDiff.jacobian(T, x) # should use StaticVectors δ = J \ T(x) # J^(-1) * T(x) return x - δ endmetadatashow_logsèdisabled®skip_as_script«code_folded$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7cell_id$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7codeى"Looks for ``x`` such that ``f(x) = y``, i.e. ``f(x) - y = 0``" function inverse(f, y, x0=[0, 0]) return newton2D(x -> f(x) - y, x0) endmetadatashow_logsèdisabled®skip_as_script«code_folded$ea741018-7c30-11eb-3912-a50475e6ec49cell_id$ea741018-7c30-11eb-3912-a50475e6ec49codef(z) + η*f′(z)metadatashow_logsèdisabled®skip_as_script«code_folded$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08cell_id$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08codeٶmd""" We can convert the idea of "following the tangent line" into equations as follows. (You can also do so by just looking at the geometry in 1D, but that does not help in 2D.) """metadatashow_logsèdisabled®skip_as_script«code_folded$02b1b470-7c31-11eb-28f4-411956f73f12cell_id$02b1b470-7c31-11eb-28f4-411956f73f12codeT(α)( [0.3, 0.4] )metadatashow_logsèdisabled®skip_as_script«code_folded$ba570c4c-7ba2-11eb-2125-9f23e415a1dccell_id$ba570c4c-7ba2-11eb-2125-9f23e415a1dccode!md""" ## Implementation in 1D """metadatashow_logsèdisabled®skip_as_script«code_folded$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71acell_id$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71acodeZmd""" ## Solving equations and finding inverse transformations using the Newton method """metadatashow_logsèdisabled®skip_as_script«code_foldedënotebook_id$1af265ba-6f93-11f1-abd7-0560c9d99e49in_temp_dir¨metadatafrontmatterchapter1license_urlHhttps://github.com/mitmath/computational-thinking/blob/Fall23/LICENSE.mdyoutube_idWjcx9sNSLP8video+https://www.youtube.com/watch?v=Wjcx9sNSLP8authornameMIT mathematicsurlhttps://github.com/mitmathlayoutlayout.jlhtmldescription.This lecture explains a method for finding the root of a function, but using code an illustrations instead of a chalkboard! We will illustrate the Newton method using the ForwardDiff.jl package to carry out automatic differentiation, but we will also try to understand what's going on "under the hood".text_licenseCC-BY-SA-4.0imagedhttps://user-images.githubusercontent.com/6933510/136196605-b6119b9d-223c-44bc-97d5-ef7cfce66483.gifcode_licenseMITsection6titleThe Newton Methodtagslecturemodule1track_mathcontinuousdifferentiationautomatic differentiationForwardDiffinteractiveSymbolicstransformation