Þ¥bonds€¬cell_resultsÞAÙ$2e2e5f0e-7c31-11eb-0da7-770b07ee6202Цqueued¤logs�§running¦output†¤bodyÙ)inverse (generic function with 3 methods)¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­†ˆ¯`ݰpersist_js_state·has_pluto_hook_features§cell_idÙ$2e2e5f0e-7c31-11eb-0da7-770b07ee6202¹depends_on_disabled_cells§runtimeÎÊèµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$9d778e36-7c30-11eb-1f4b-894af86a8f5dЦqueued¤logs�§running¦output†¤bodyÚ•

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:

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}Dy¯°persist_js_state·has_pluto_hook_features§cell_idÙ$9d778e36-7c30-11eb-1f4b-894af86a8f5d¹depends_on_disabled_cells§runtimeÎxµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$395fd8e2-7c31-11eb-1933-dd719fa0cd22Цqueued¤logs�§running¦output†¤bodyÚ

α = 0.0

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†ŒþŰpersist_js_state·has_pluto_hook_features§cell_idÙ$395fd8e2-7c31-11eb-1933-dd719fa0cd22¹depends_on_disabled_cells§runtimeΣԵpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$3828b94c-7c2d-11eb-2e01-79038b0f5226Цqueued¤logs�§running¦output†¤body…¦prefix­Symbolics.Num¨elements’’’ÙY

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

©text/html’’Ù[

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

©text/html¤type¥Array¬prefix_short ¨objectid°ba7cca127c16a593¤mimeÙ!application/vnd.pluto.tree+object¬rootassignee¥image²last_run_timestampËAÚ­†�õ+9°persist_js_state·has_pluto_hook_features§cell_idÙ$3828b94c-7c2d-11eb-2e01-79038b0f5226¹depends_on_disabled_cells§runtimeÎI–µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$ce44554e-847f-4129-8841-1a729dfa7a2eЦqueued¤logs�§running¦output†¤bodyÚ

n = 1

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†„§�—°persist_js_state·has_pluto_hook_features§cell_idÙ$ce44554e-847f-4129-8841-1a729dfa7a2e¹depends_on_disabled_cells§runtimeÎͤíµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$923bde64-7ba4-11eb-21e9-a11993aaab2eЦqueued¤logs�§running¦output†¤bodyÙÎ
newton2D

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†ˆ }°persist_js_state·has_pluto_hook_features§cell_idÙ$923bde64-7ba4-11eb-21e9-a11993aaab2e¹depends_on_disabled_cells§runtimeÎl;µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$a869e6c6-7c31-11eb-13c8-155d08be02ebЦqueued¤logs�§running¦output†¤bodyÚ

m = 1

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­††Í¾@°persist_js_state·has_pluto_hook_features§cell_idÙ$a869e6c6-7c31-11eb-13c8-155d08be02eb¹depends_on_disabled_cells§runtimeÎ_âµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$2fb40dc6-7c2f-11eb-2469-8deb4db59b5cЦqueued¤logs�§running¦output†¤body±1.414213562373095¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­†‡ô<ó°persist_js_state·has_pluto_hook_features§cell_idÙ$2fb40dc6-7c2f-11eb-2469-8deb4db59b5c¹depends_on_disabled_cells§runtimeÎ>!óµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$f4fda666-7b9c-11eb-0304-716c5e710462Цqueued¤logs�§running¦output†¤body ¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­†�Ý7‚°persist_js_state·has_pluto_hook_features§cell_idÙ$f4fda666-7b9c-11eb-0304-716c5e710462¹depends_on_disabled_cells§runtimeÎʳq͵published_object_keys�¸depends_on_skipped_cells§erroredÂÙ$35791bca-7c2f-11eb-1cfb-8d5ebd0208cbЦqueued¤logs�§running¦output†¤body²1.4142135623730951¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­†‡õk¾°persist_js_state·has_pluto_hook_features§cell_idÙ$35791bca-7c2f-11eb-1cfb-8d5ebd0208cb¹depends_on_disabled_cells§runtimeÍ%µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffЦqueued¤logs�§running¦output†¤body…¦prefix­Symbolics.Num¨elements’’’ÙL

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

©text/html’’ÙO

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

©text/html¤type¥Array¬prefix_short ¨objectid°6d9e62afd5501d83¤mimeÙ!application/vnd.pluto.tree+object¬rootassigneeÀ²last_run_timestampËAÚ­††ÌX!°persist_js_state·has_pluto_hook_features§cell_idÙ$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff¹depends_on_disabled_cells§runtimeÎs¤'µµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$dd6b0ae2-cc87-4d19-ac78-f3a990aa692eЦqueued¤logs�§running¦output†¤bodyÚ

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.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}C9?°persist_js_state·has_pluto_hook_features§cell_idÙ$dd6b0ae2-cc87-4d19-ac78-f3a990aa692e¹depends_on_disabled_cells§runtimeÎìúµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$2445da24-7b9d-11eb-02bd-eb99a3d95a2eЦqueued¤logs�§running¦output†¤bodyÚ

n = 1

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†„¨,R°persist_js_state·has_pluto_hook_features§cell_idÙ$2445da24-7b9d-11eb-02bd-eb99a3d95a2e¹depends_on_disabled_cells§runtimeÎ{Ôµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$98158a38-7c30-11eb-0796-2335e97ec6d0Цqueued¤logs�§running¦output†¤bodyÙ`

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†�â&ò°persist_js_state·has_pluto_hook_features§cell_idÙ$98158a38-7c30-11eb-0796-2335e97ec6d0¹depends_on_disabled_cells§runtimeÏ6‰_Hµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0Цqueued¤logs�§running¦output†¤bodyÙÌ

Newton for transformations in 2 dimensions

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}Eغ°persist_js_state·has_pluto_hook_features§cell_idÙ$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0¹depends_on_disabled_cells§runtimeÎXâµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$8c0c412e-7c2f-11eb-1880-4f6c45d77597Цqueued¤logs�§running¦output†¤bodyÚZ

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:

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}D˰persist_js_state·has_pluto_hook_features§cell_idÙ$8c0c412e-7c2f-11eb-1880-4f6c45d77597¹depends_on_disabled_cells§runtimeκkµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45Цqueued¤logs�§running¦output†¤bodyÙ'expand (generic function with 1 method)¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­†�€’аpersist_js_state·has_pluto_hook_features§cell_idÙ$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45¹depends_on_disabled_cells§runtimeÎQ޵published_object_keys�¸depends_on_skipped_cells§erroredÂÙ$f25af026-7b9c-11eb-1f11-77a8b06b2d71Цqueued¤logs�§running¦output†¤bodyÙ1standard_Newton (generic function with 3 methods)¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­†ˆÍ5r°persist_js_state·has_pluto_hook_features§cell_idÙ$f25af026-7b9c-11eb-1f11-77a8b06b2d71¹depends_on_disabled_cells§runtimeÎ䇵published_object_keys�¸depends_on_skipped_cells§erroredÂÙ$fe742fec-7c3e-11eb-1f54-55cdf02a1574Цqueued¤logs�§running¦output†¤bodyÚ

p = 0.0

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†ˆ ·°persist_js_state·has_pluto_hook_features§cell_idÙ$fe742fec-7c3e-11eb-1f54-55cdf02a1574¹depends_on_disabled_cells§runtimeΡs×µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750Цqueued¤logs�§running¦output†¤bodyÙT

Implementation in 2D

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}F•á°persist_js_state·has_pluto_hook_features§cell_idÙ$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750¹depends_on_disabled_cells§runtimeÎÃYµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0Цqueued¤logs�§running¦output†¤bodyÙ"T (generic function with 1 method)¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­†‹þ °persist_js_state·has_pluto_hook_features§cell_idÙ$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0¹depends_on_disabled_cells§runtimeÎGßµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$1b77fada-7b9d-11eb-3266-ebb3895cb76aЦqueued¤logs�§running¦output†¤bodyÙ)straight (generic function with 1 method)¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­†ˆ¾IZ°persist_js_state·has_pluto_hook_features§cell_idÙ$1b77fada-7b9d-11eb-3266-ebb3895cb76a¹depends_on_disabled_cells§runtimeÎåôµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$80917990-7ba0-11eb-029a-dba981c52b58Цqueued¤logs�§running¦output†¤bodyÚ¦

$$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$.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}Fø°persist_js_state·has_pluto_hook_features§cell_idÙ$80917990-7ba0-11eb-029a-dba981c52b58¹depends_on_disabled_cells§runtimeÎÇ«µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$b7dc4666-7ba1-11eb-32eb-fd3d720c2960Цqueued¤logs�§running¦output†¤bodyÙç

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

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}FXŰpersist_js_state·has_pluto_hook_features§cell_idÙ$b7dc4666-7ba1-11eb-32eb-fd3d720c2960¹depends_on_disabled_cells§runtimeÎâ²µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$d35e0cc8-7c30-11eb-28d3-17c9e221ea62Цqueued¤logs�§running¦output†¤body ¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­††Îs°persist_js_state·has_pluto_hook_features§cell_idÙ$d35e0cc8-7c30-11eb-28d3-17c9e221ea62¹depends_on_disabled_cells§runtimeÎ= µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$61905ae0-7ba6-11eb-0773-17e9aa4e9991Цqueued¤logs�§running¦output†¤bodyÙö

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:

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}F¸R°persist_js_state·has_pluto_hook_features§cell_idÙ$61905ae0-7ba6-11eb-0773-17e9aa4e9991¹depends_on_disabled_cells§runtimeÎkµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$1ba1ae44-7ba1-11eb-21ff-558c95446435Цqueued¤logs�§running¦output†¤bodyÚY

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.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}E\S°persist_js_state·has_pluto_hook_features§cell_idÙ$1ba1ae44-7ba1-11eb-21ff-558c95446435¹depends_on_disabled_cells§runtimeÎYEµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$23536420-7c2d-11eb-20b0-9523f7a5f9d7Цqueued¤logs�§running¦output†¤body…¦prefix­Symbolics.Num¨elements”’’ÙL

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

©text/html’’ÙL

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

©text/html’’ÙQ

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

©text/html’’ÙS

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

©text/html¤type¥Array¬prefix_short ¨objectid°66f6f9cc277917c9¤mimeÙ!application/vnd.pluto.tree+object¬rootassigneeÀ²last_run_timestampËAÚ­†ˆqóZ°persist_js_state·has_pluto_hook_features§cell_idÙ$23536420-7c2d-11eb-20b0-9523f7a5f9d7¹depends_on_disabled_cells§runtime΢ʵpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$c519704c-7ba1-11eb-12da-8b9b176daa0dЦqueued¤logs�§running¦output†¤bodyÙd

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}Fv¸°persist_js_state·has_pluto_hook_features§cell_idÙ$c519704c-7ba1-11eb-12da-8b9b176daa0d¹depends_on_disabled_cells§runtimeλµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$9cfa9062-7ba0-11eb-3a93-197ac0287ab4Цqueued¤logs�§running¦output†¤bodyÙm

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}E,ä°persist_js_state·has_pluto_hook_features§cell_idÙ$9cfa9062-7ba0-11eb-3a93-197ac0287ab4¹depends_on_disabled_cells§runtimeÎ4bµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05Цqueued¤logs�§running¦output†¤bodyÚa

xâ‚€ = 6

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†„¨q?°persist_js_state·has_pluto_hook_features§cell_idÙ$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05¹depends_on_disabled_cells§runtimeÎŒKµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$af887dea-7ba1-11eb-3b0d-6925756382a7Цqueued¤logs�§running¦output†¤bodyÙ}

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}F9аpersist_js_state·has_pluto_hook_features§cell_idÙ$af887dea-7ba1-11eb-3b0d-6925756382a7¹depends_on_disabled_cells§runtimeÎ&ãµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$5123c038-7ba2-11eb-1be2-19f789b02c1fЦqueued¤logs�§running¦output†¤bodyÙl

Mathematics of the Newton method

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}D»�°persist_js_state·has_pluto_hook_features§cell_idÙ$5123c038-7ba2-11eb-1be2-19f789b02c1f¹depends_on_disabled_cells§runtimeÎÑjµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$e18f2470-7c31-11eb-2b74-d59d00d20ba4Цqueued¤logs�§running¦output†¤bodyÙL

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†�ä×ù°persist_js_state·has_pluto_hook_features§cell_idÙ$e18f2470-7c31-11eb-2b74-d59d00d20ba4¹depends_on_disabled_cells§runtimeη=>µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$5faa2784-7c31-11eb-34f1-3f8224dbdbdeЦqueued¤logs�§running¦output†¤body…¦prefix§Float64¨elements’’’£0.3ªtext/plain’’£0.4ªtext/plain¤type¥Array¬prefix_short ¨objectid°745eb412f9ce4fdd¤mimeÙ!application/vnd.pluto.tree+object¬rootassigneeÀ²last_run_timestampËAÚ­†�qE™°persist_js_state·has_pluto_hook_features§cell_idÙ$5faa2784-7c31-11eb-34f1-3f8224dbdbde¹depends_on_disabled_cells§runtime΃’µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$9371f930-7c30-11eb-1f77-c7f31b97ea26Цqueued¤logs�§running¦output†¤bodyÙ`

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†‡©ÚY°persist_js_state·has_pluto_hook_features§cell_idÙ$9371f930-7c30-11eb-1f77-c7f31b97ea26¹depends_on_disabled_cells§runtimeÎ tȵpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8Цqueued¤logs�§running¦output†¤bodyÙ¼

Using symbolic calculations to understand derivatives and nonlinear maps

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}D/õ°persist_js_state·has_pluto_hook_features§cell_idÙ$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8¹depends_on_disabled_cells§runtimeÎçéµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$ed605b90-7c3e-11eb-34e9-776a05a177ddЦqueued¤logs�§running¦output†¤body…¦prefix­Symbolics.Num¨elements’’’ÙQ

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

©text/html’’ÙS

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

©text/html¤type¥Array¬prefix_short ¨objectid¯aa6b9d30d5a0187¤mimeÙ!application/vnd.pluto.tree+object¬rootassigneeÀ²last_run_timestampËAÚ­†�ý°[°persist_js_state·has_pluto_hook_features§cell_idÙ$ed605b90-7c3e-11eb-34e9-776a05a177dd¹depends_on_disabled_cells§runtimeÎ÷Ú µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$d44c73b4-7c3e-11eb-1302-8ba9039ae789Цqueued¤logs�§running¦output†¤bodyÚA

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)$:

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}E¸$°persist_js_state·has_pluto_hook_features§cell_idÙ$d44c73b4-7c3e-11eb-1302-8ba9039ae789¹depends_on_disabled_cells§runtimeΤƒµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$09b97be8-7c2e-11eb-05fd-65bbd097afb8Цqueued¤logs‘ˆ¤lineÿ£msg’Ù´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/plain§cell_idÙ$09b97be8-7c2e-11eb-05fd-65bbd097afb8¦kwargs�¢id²Symbolics_16d4609c¤fileÙ;/home/fons/.julia/packages/Symbolics/AmMIj/src/Symbolics.jl¥group©Symbolics¥level¤Warn§running¦output†¤bodyÙ)2×2 Matrix{Text{Num}}: 1.0 0 0 1.0¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­†ŒØØf°persist_js_state·has_pluto_hook_features§cell_idÙ$09b97be8-7c2e-11eb-05fd-65bbd097afb8¹depends_on_disabled_cells§runtimeÎN=çµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$389e990e-7c40-11eb-37c4-5ba0f59173b3Цqueued¤logs�§running¦output†¤bodyÚT

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.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}Dœõ°persist_js_state·has_pluto_hook_features§cell_idÙ$389e990e-7c40-11eb-37c4-5ba0f59173b3¹depends_on_disabled_cells§runtimeΕëµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82Цqueued¤logs�§running¦output†¤bodyÚ³

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.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}Cä.°persist_js_state·has_pluto_hook_features§cell_idÙ$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82¹depends_on_disabled_cells§runtimeθ•µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$ec6c6328-7b9c-11eb-1c69-dba12ae522adЦqueued¤logs�§running¦output†¤bodyÉJ¹ ¤mime­image/svg+xml¬rootassigneeÀ²last_run_timestampËAÚ­†‹k°persist_js_state·has_pluto_hook_features§cell_idÙ$ec6c6328-7b9c-11eb-1c69-dba12ae522ad¹depends_on_disabled_cells§runtimeÎŽYµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$ecb40aea-7b9c-11eb-1476-e54faf32d91cЦqueued¤logs�§running¦output†¤bodyÈè` ¤mime­image/svg+xml¬rootassigneeÀ²last_run_timestampËAÚ­†‹T£°persist_js_state·has_pluto_hook_features§cell_idÙ$ecb40aea-7b9c-11eb-1476-e54faf32d91c¹depends_on_disabled_cells§runtimeÏ8Iܵpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7Цqueued¤logs�§running¦output†¤bodyÚ

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:

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}Eúý°persist_js_state·has_pluto_hook_features§cell_idÙ$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7¹depends_on_disabled_cells§runtimeÎ$Sµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$ee91563e-7c3e-11eb-3f65-1f336073869aЦqueued¤logs�§running¦output†¤bodyÙ<

Appendix

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}FÖV°persist_js_state·has_pluto_hook_features§cell_idÙ$ee91563e-7c3e-11eb-3f65-1f336073869a¹depends_on_disabled_cells§runtimeνCµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$d690f83a-7c2e-11eb-14d7-79a250deb473Цqueued¤logs�§running¦output†¤bodyÙ)newton1D (generic function with 1 method)¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­†‡åë°persist_js_state·has_pluto_hook_features§cell_idÙ$d690f83a-7c2e-11eb-14d7-79a250deb473¹depends_on_disabled_cells§runtimeÎx9µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8Цqueued¤logs�§running¦output†¤bodyÚ§

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}EA°persist_js_state·has_pluto_hook_features§cell_idÙ$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8¹depends_on_disabled_cells§runtimeΆµµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$07a754da-7c31-11eb-0394-4bef4d79fc30Цqueued¤logs�§running¦output†¤body…¦prefix§Float64¨elements’’’£0.3ªtext/plain’’£0.4ªtext/plain¤type¥Array¬prefix_short ¨objectid°c31ce18a9857e127¤mimeÙ!application/vnd.pluto.tree+object¬rootassigneeÀ²last_run_timestampËAÚ­†�níú°persist_js_state·has_pluto_hook_features§cell_idÙ$07a754da-7c31-11eb-0394-4bef4d79fc30¹depends_on_disabled_cells§runtimeÎK�¡-µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$63dbf052-7c32-11eb-1062-5b3581d38f70Цqueued¤logs�§running¦output†¤bodyÙU

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†‡˜¶°persist_js_state·has_pluto_hook_features§cell_idÙ$63dbf052-7c32-11eb-1062-5b3581d38f70¹depends_on_disabled_cells§runtimeÎY~€µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$18ce2fac-7c2e-11eb-03d2-b3a674621662Цqueued¤logs�§running¦output†¤body…¦prefix­Symbolics.Num¨elements’’’ÙQ

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

©text/html’’ÙS

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

©text/html¤type¥Array¬prefix_short ¨objectid°98372eba15349bdf¤mimeÙ!application/vnd.pluto.tree+object¬rootassigneeÀ²last_run_timestampËAÚ­†Œý³°persist_js_state·has_pluto_hook_features§cell_idÙ$18ce2fac-7c2e-11eb-03d2-b3a674621662¹depends_on_disabled_cells§runtimeÎ hîµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$6dc89964-7c30-11eb-0a41-8d97b210ed34Цqueued¤logs�§running¦output†¤body ¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­††Íê-°persist_js_state·has_pluto_hook_features§cell_idÙ$6dc89964-7c30-11eb-0a41-8d97b210ed34¹depends_on_disabled_cells§runtimeÎY¤µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0Цqueued¤logs�§running¦output†¤bodyÙ^

Symbolic derivative in 2D

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}E™°persist_js_state·has_pluto_hook_features§cell_idÙ$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0¹depends_on_disabled_cells§runtimeÎÀеpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$35b5c5c6-7c3f-11eb-2723-4b406a809114Цqueued¤logs�§running¦output†¤body…¦prefix­Symbolics.Num¨elements’’’ÙL

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

©text/html’’ÙL

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

©text/html¤type¥Array¬prefix_short ¨objectid°12224a0893c16f7a¤mimeÙ!application/vnd.pluto.tree+object¬rootassigneeÀ²last_run_timestampËAÚ­†�œ°persist_js_state·has_pluto_hook_features§cell_idÙ$35b5c5c6-7c3f-11eb-2723-4b406a809114¹depends_on_disabled_cells§runtimeÎþ£?µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$e410c1d0-7ba1-11eb-394f-71dac89756b7Цqueued¤logs�§running¦output†¤bodyÚ

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".

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}C®Ñ°persist_js_state·has_pluto_hook_features§cell_idÙ$e410c1d0-7ba1-11eb-394f-71dac89756b7¹depends_on_disabled_cells§runtimeÎ zÒµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$db26375a-7c30-11eb-066e-ab9e8ded3356Цqueued¤logs�§running¦output†¤bodyÙL

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†‡Ð@°persist_js_state·has_pluto_hook_features§cell_idÙ$db26375a-7c30-11eb-066e-ab9e8ded3356¹depends_on_disabled_cells§runtimeÎ醧µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$615aff3c-7c30-11eb-2ca8-9d2fdf299017Цqueued¤logs�§running¦output†¤bodyÚ]

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$.

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}DUe°persist_js_state·has_pluto_hook_features§cell_idÙ$615aff3c-7c30-11eb-2ca8-9d2fdf299017¹depends_on_disabled_cells§runtimeÎM»µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$77ef0cfb-60db-4599-bec2-b65e99e5b246Цqueued¤logs�§running¦output†¤bodyÚb

xâ‚€ = 6

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†„§ãаpersist_js_state·has_pluto_hook_features§cell_idÙ$77ef0cfb-60db-4599-bec2-b65e99e5b246¹depends_on_disabled_cells§runtimeΤVµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$1db66b0e-7ba4-11eb-2157-d5a399a73b1fЦqueued¤logs�§running¦output†¤bodyÙ.newton2D_step (generic function with 1 method)¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ­†ˆƒßH°persist_js_state·has_pluto_hook_features§cell_idÙ$1db66b0e-7ba4-11eb-2157-d5a399a73b1f¹depends_on_disabled_cells§runtimeÎÖŸµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7Цqueued¤logs�§running¦output†¤bodyÚ
inverse

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†ˆ È°persist_js_state·has_pluto_hook_features§cell_idÙ$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7¹depends_on_disabled_cells§runtimeÎêjµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$ea741018-7c30-11eb-3912-a50475e6ec49Цqueued¤logs�§running¦output†¤bodyÙ`

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

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†‡ÓÖ9°persist_js_state·has_pluto_hook_features§cell_idÙ$ea741018-7c30-11eb-3912-a50475e6ec49¹depends_on_disabled_cells§runtimeÎÃU^µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08Цqueued¤logs�§running¦output†¤bodyÙâ

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.)

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}DÚ¾°persist_js_state·has_pluto_hook_features§cell_idÙ$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08¹depends_on_disabled_cells§runtimeÎ)µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$02b1b470-7c31-11eb-28f4-411956f73f12Цqueued¤logs�§running¦output†¤body…¦prefix§Float64¨elements’’’£0.3ªtext/plain’’£0.4ªtext/plain¤type¥Array¬prefix_short ¨objectid°2d03dd4a41630ff1¤mimeÙ!application/vnd.pluto.tree+object¬rootassigneeÀ²last_run_timestampËAÚ­†�İpersist_js_state·has_pluto_hook_features§cell_idÙ$02b1b470-7c31-11eb-28f4-411956f73f12¹depends_on_disabled_cells§runtimeÍ6`µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$ba570c4c-7ba2-11eb-2125-9f23e415a1dcЦqueued¤logs�§running¦output†¤bodyÙT

Implementation in 1D

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}Ezò°persist_js_state·has_pluto_hook_features§cell_idÙ$ba570c4c-7ba2-11eb-2125-9f23e415a1dc¹depends_on_disabled_cells§runtimeÎÏ:µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71aЦqueued¤logs�§running¦output†¤bodyÙÆ

Solving equations and finding inverse transformations using the Newton method

¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ­†}C`̰persist_js_state·has_pluto_hook_features§cell_idÙ$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71a¹depends_on_disabled_cells§runtimeÎêµpublished_object_keys�¸depends_on_skipped_cells§errored±cell_dependenciesÞAÙ$2e2e5f0e-7c31-11eb-0da7-770b07ee6202„´precedence_heuristic §cell_idÙ$2e2e5f0e-7c31-11eb-0da7-770b07ee6202´downstream_cells_map�§inverse’Ù$07a754da-7c31-11eb-0394-4bef4d79fc30Ù$5faa2784-7c31-11eb-34f1-3f8224dbdbde²upstream_cells_map€Ù$9d778e36-7c30-11eb-1f4b-894af86a8f5d„´precedence_heuristic §cell_idÙ$9d778e36-7c30-11eb-1f4b-894af86a8f5d´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$395fd8e2-7c31-11eb-1933-dd719fa0cd22„´precedence_heuristic §cell_idÙ$395fd8e2-7c31-11eb-1933-dd719fa0cd22´downstream_cells_map�¢Î±“Ù$02b1b470-7c31-11eb-28f4-411956f73f12Ù$07a754da-7c31-11eb-0394-4bef4d79fc30Ù$5faa2784-7c31-11eb-34f1-3f8224dbdbde²upstream_cells_map‹§@md_str�¤Core�¡:�¨Base.get�¥@bind�¦Slider�¤Base�«PlutoRunner�·PlutoRunner.create_bond�¯Core.applicable�¨getindex�Ù$3828b94c-7c2d-11eb-2e01-79038b0f5226„´precedence_heuristic §cell_idÙ$3828b94c-7c2d-11eb-2e01-79038b0f5226´downstream_cells_map�¥image’Ù$ed605b90-7c3e-11eb-34e9-776a05a177ddÙ$35b5c5c6-7c3f-11eb-2723-4b406a809114²upstream_cells_mapˆ¢Î´‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¡T‘Ù$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0¢Ïµ‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¡b‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¡+�¡a‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¡p‘Ù$fe742fec-7c3e-11eb-1f54-55cdf02a1574¦expand‘Ù$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45Ù$ce44554e-847f-4129-8841-1a729dfa7a2e„´precedence_heuristic §cell_idÙ$ce44554e-847f-4129-8841-1a729dfa7a2e´downstream_cells_map�¢n2‘Ù$ecb40aea-7b9c-11eb-1476-e54faf32d91c²upstream_cells_map‹§@md_str�¤Core�¡:�¨Base.get�¥@bind�¦Slider�¤Base�«PlutoRunner�·PlutoRunner.create_bond�¯Core.applicable�¨getindex�Ù$923bde64-7ba4-11eb-21e9-a11993aaab2e„´precedence_heuristic §cell_idÙ$923bde64-7ba4-11eb-21e9-a11993aaab2e´downstream_cells_map�¨newton2D‘Ù$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7²upstream_cells_map‡¤@doc�¡:�¥Tuple�¥Union�º#___this_pluto_module_name�­newton2D_step‘Ù$1db66b0e-7ba4-11eb-2157-d5a399a73b1f£Any�Ù$a869e6c6-7c31-11eb-13c8-155d08be02eb„´precedence_heuristic §cell_idÙ$a869e6c6-7c31-11eb-13c8-155d08be02eb´downstream_cells_map�¡m‘Ù$6dc89964-7c30-11eb-0a41-8d97b210ed34²upstream_cells_map‹§@md_str�¤Core�¡:�¨Base.get�¥@bind�¦Slider�¤Base�«PlutoRunner�·PlutoRunner.create_bond�¯Core.applicable�¨getindex�Ù$2fb40dc6-7c2f-11eb-2469-8deb4db59b5c„´precedence_heuristic §cell_idÙ$2fb40dc6-7c2f-11eb-2469-8deb4db59b5c´downstream_cells_map€²upstream_cells_mapƒ¨newton1D‘Ù$d690f83a-7c2e-11eb-14d7-79a250deb473¡-�¡^�Ù$f4fda666-7b9c-11eb-0304-716c5e710462„´precedence_heuristic§cell_idÙ$f4fda666-7b9c-11eb-0304-716c5e710462´downstream_cells_map‡¨jacobian“Ù$09b97be8-7c2e-11eb-05fd-65bbd097afb8Ù$18ce2fac-7c2e-11eb-03d2-b3a674621662Ù$35b5c5c6-7c3f-11eb-2723-4b406a809114«ForwardDiff”Ù$d35e0cc8-7c30-11eb-28d3-17c9e221ea62Ù$d690f83a-7c2e-11eb-14d7-79a250deb473Ù$1db66b0e-7ba4-11eb-2157-d5a399a73b1fÙ$f25af026-7b9c-11eb-1f11-77a8b06b2d71©Symbolics�§PlutoUI�¥Plots�¨Latexify�¬LaTeXStrings‘Ù$f25af026-7b9c-11eb-1f11-77a8b06b2d71²upstream_cells_map€Ù$35791bca-7c2f-11eb-1cfb-8d5ebd0208cb„´precedence_heuristic §cell_idÙ$35791bca-7c2f-11eb-1cfb-8d5ebd0208cb´downstream_cells_map€²upstream_cells_map�¤sqrt�Ù$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff„´precedence_heuristic §cell_idÙ$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff´downstream_cells_map‚¢Î·”Ù$9371f930-7c30-11eb-1f77-c7f31b97ea26Ù$98158a38-7c30-11eb-0796-2335e97ec6d0Ù$ea741018-7c30-11eb-3912-a50475e6ec49Ù$e18f2470-7c31-11eb-2b74-d59d00d20ba4¡z–Ù$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-d59d00d20ba4²upstream_cells_map�ª@variables�Ù$dd6b0ae2-cc87-4d19-ac78-f3a990aa692e„´precedence_heuristic §cell_idÙ$dd6b0ae2-cc87-4d19-ac78-f3a990aa692e´downstream_cells_map€²upstream_cells_mapƒ¤Base�®Base.Docs.HTML�©@html_str�Ù$2445da24-7b9d-11eb-02bd-eb99a3d95a2e„´precedence_heuristic §cell_idÙ$2445da24-7b9d-11eb-02bd-eb99a3d95a2e´downstream_cells_map�¡n‘Ù$ec6c6328-7b9c-11eb-1c69-dba12ae522ad²upstream_cells_map‹§@md_str�¤Core�¡:�¨Base.get�¥@bind�¦Slider�¤Base�«PlutoRunner�·PlutoRunner.create_bond�¯Core.applicable�¨getindex�Ù$98158a38-7c30-11eb-0796-2335e97ec6d0„´precedence_heuristic §cell_idÙ$98158a38-7c30-11eb-0796-2335e97ec6d0´downstream_cells_map€²upstream_cells_map…¡f‘Ù$6dc89964-7c30-11eb-0a41-8d97b210ed34¢Î·‘Ù$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff¡+�¡z‘Ù$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff¦expand‘Ù$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45Ù$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0„´precedence_heuristic §cell_idÙ$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$8c0c412e-7c2f-11eb-1880-4f6c45d77597„´precedence_heuristic §cell_idÙ$8c0c412e-7c2f-11eb-1880-4f6c45d77597´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45„´precedence_heuristic §cell_idÙ$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45´downstream_cells_map�¦expand”Ù$98158a38-7c30-11eb-0796-2335e97ec6d0Ù$e18f2470-7c31-11eb-2b74-d59d00d20ba4Ù$3828b94c-7c2d-11eb-2e01-79038b0f5226Ù$35b5c5c6-7c3f-11eb-2723-4b406a809114²upstream_cells_map�¨simplify�Ù$f25af026-7b9c-11eb-1f11-77a8b06b2d71„´precedence_heuristic §cell_idÙ$f25af026-7b9c-11eb-1f11-77a8b06b2d71´downstream_cells_map�¯standard_Newton’Ù$ecb40aea-7b9c-11eb-1476-e54faf32d91cÙ$ec6c6328-7b9c-11eb-1c69-dba12ae522ad²upstream_cells_map�¸LaTeXStrings.latexstring�«ForwardDiff‘Ù$f4fda666-7b9c-11eb-0304-716c5e710462¡:�¦@L_str�¢|>�¨straight‘Ù$1b77fada-7b9d-11eb-3266-ebb3895cb76a¦hline!�¦as_svg�¡-�¶ForwardDiff.derivative�¤plot�¡/�¥plot!�¬LaTeXStrings‘Ù$f4fda666-7b9c-11eb-0304-716c5e710462¨scatter!�Ù$fe742fec-7c3e-11eb-1f54-55cdf02a1574„´precedence_heuristic §cell_idÙ$fe742fec-7c3e-11eb-1f54-55cdf02a1574´downstream_cells_map�¡p•Ù$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²upstream_cells_map‹§@md_str�¤Core�¡:�¨Base.get�¥@bind�¦Slider�¤Base�«PlutoRunner�·PlutoRunner.create_bond�¯Core.applicable�¨getindex�Ù$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750„´precedence_heuristic §cell_idÙ$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0„´precedence_heuristic §cell_idÙ$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0´downstream_cells_map�¡T˜Ù$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-3f8224dbdbde²upstream_cells_mapƒ¡^�¡+�¡*�Ù$1b77fada-7b9d-11eb-3266-ebb3895cb76a„´precedence_heuristic §cell_idÙ$1b77fada-7b9d-11eb-3266-ebb3895cb76a´downstream_cells_map�¨straight‘Ù$f25af026-7b9c-11eb-1f11-77a8b06b2d71²upstream_cells_mapƒ¡-�¡+�¡*�Ù$80917990-7ba0-11eb-029a-dba981c52b58„´precedence_heuristic §cell_idÙ$80917990-7ba0-11eb-029a-dba981c52b58´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$b7dc4666-7ba1-11eb-32eb-fd3d720c2960„´precedence_heuristic §cell_idÙ$b7dc4666-7ba1-11eb-32eb-fd3d720c2960´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$d35e0cc8-7c30-11eb-28d3-17c9e221ea62„´precedence_heuristic §cell_idÙ$d35e0cc8-7c30-11eb-28d3-17c9e221ea62´downstream_cells_map�¤f′“Ù$db26375a-7c30-11eb-066e-ab9e8ded3356Ù$ea741018-7c30-11eb-3912-a50475e6ec49Ù$e18f2470-7c31-11eb-2b74-d59d00d20ba4²upstream_cells_mapƒ¡f‘Ù$6dc89964-7c30-11eb-0a41-8d97b210ed34«ForwardDiff‘Ù$f4fda666-7b9c-11eb-0304-716c5e710462¶ForwardDiff.derivative�Ù$61905ae0-7ba6-11eb-0773-17e9aa4e9991„´precedence_heuristic §cell_idÙ$61905ae0-7ba6-11eb-0773-17e9aa4e9991´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$1ba1ae44-7ba1-11eb-21ff-558c95446435„´precedence_heuristic §cell_idÙ$1ba1ae44-7ba1-11eb-21ff-558c95446435´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7„´precedence_heuristic §cell_idÙ$23536420-7c2d-11eb-20b0-9523f7a5f9d7´downstream_cells_map„¢Ïµ“Ù$3828b94c-7c2d-11eb-2e01-79038b0f5226Ù$18ce2fac-7c2e-11eb-03d2-b3a674621662Ù$35b5c5c6-7c3f-11eb-2723-4b406a809114¡b•Ù$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¡a•Ù$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-4b406a809114²upstream_cells_map�ª@variables�Ù$c519704c-7ba1-11eb-12da-8b9b176daa0d„´precedence_heuristic §cell_idÙ$c519704c-7ba1-11eb-12da-8b9b176daa0d´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$9cfa9062-7ba0-11eb-3a93-197ac0287ab4„´precedence_heuristic §cell_idÙ$9cfa9062-7ba0-11eb-3a93-197ac0287ab4´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05„´precedence_heuristic §cell_idÙ$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05´downstream_cells_map�¢x0‘Ù$ec6c6328-7b9c-11eb-1c69-dba12ae522ad²upstream_cells_map‹§@md_str�¤Core�¡:�¨Base.get�¥@bind�¦Slider�¤Base�«PlutoRunner�·PlutoRunner.create_bond�¯Core.applicable�¨getindex�Ù$af887dea-7ba1-11eb-3b0d-6925756382a7„´precedence_heuristic §cell_idÙ$af887dea-7ba1-11eb-3b0d-6925756382a7´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$5123c038-7ba2-11eb-1be2-19f789b02c1f„´precedence_heuristic §cell_idÙ$5123c038-7ba2-11eb-1be2-19f789b02c1f´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$e18f2470-7c31-11eb-2b74-d59d00d20ba4„´precedence_heuristic §cell_idÙ$e18f2470-7c31-11eb-2b74-d59d00d20ba4´downstream_cells_map€²upstream_cells_mapˆ¡f‘Ù$6dc89964-7c30-11eb-0a41-8d97b210ed34¤f′‘Ù$d35e0cc8-7c30-11eb-28d3-17c9e221ea62¡-�¢Î·‘Ù$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff¡+�¡*�¡z‘Ù$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff¦expand‘Ù$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45Ù$5faa2784-7c31-11eb-34f1-3f8224dbdbde„´precedence_heuristic §cell_idÙ$5faa2784-7c31-11eb-34f1-3f8224dbdbde´downstream_cells_map€²upstream_cells_map„£âˆ˜�¡T‘Ù$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0§inverse’Ù$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7Ù$2e2e5f0e-7c31-11eb-0da7-770b07ee6202¢Î±‘Ù$395fd8e2-7c31-11eb-1933-dd719fa0cd22Ù$9371f930-7c30-11eb-1f77-c7f31b97ea26„´precedence_heuristic §cell_idÙ$9371f930-7c30-11eb-1f77-c7f31b97ea26´downstream_cells_map€²upstream_cells_map„¡f‘Ù$6dc89964-7c30-11eb-0a41-8d97b210ed34¢Î·‘Ù$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff¡+�¡z‘Ù$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffÙ$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8„´precedence_heuristic §cell_idÙ$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$ed605b90-7c3e-11eb-34e9-776a05a177dd„´precedence_heuristic §cell_idÙ$ed605b90-7c3e-11eb-34e9-776a05a177dd´downstream_cells_map€²upstream_cells_map†¡T‘Ù$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0¡-�¥image‘Ù$3828b94c-7c2d-11eb-2e01-79038b0f5226¡b‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¡a‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¡p‘Ù$fe742fec-7c3e-11eb-1f54-55cdf02a1574Ù$d44c73b4-7c3e-11eb-1302-8ba9039ae789„´precedence_heuristic §cell_idÙ$d44c73b4-7c3e-11eb-1302-8ba9039ae789´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$09b97be8-7c2e-11eb-05fd-65bbd097afb8„´precedence_heuristic §cell_idÙ$09b97be8-7c2e-11eb-05fd-65bbd097afb8´downstream_cells_map€²upstream_cells_map‡¨jacobian‘Ù$f4fda666-7b9c-11eb-0304-716c5e710462¡T‘Ù$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0¡b‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¢|>�¡a‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¡p‘Ù$fe742fec-7c3e-11eb-1f54-55cdf02a1574¤Text�Ù$389e990e-7c40-11eb-37c4-5ba0f59173b3„´precedence_heuristic §cell_idÙ$389e990e-7c40-11eb-37c4-5ba0f59173b3´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82„´precedence_heuristic §cell_idÙ$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$ec6c6328-7b9c-11eb-1c69-dba12ae522ad„´precedence_heuristic §cell_idÙ$ec6c6328-7b9c-11eb-1c69-dba12ae522ad´downstream_cells_map€²upstream_cells_mapˆ¯standard_Newton‘Ù$f25af026-7b9c-11eb-1f11-77a8b06b2d71¡:�¡-�¢x0‘Ù$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05¡^�¡+�¡*�¡n‘Ù$2445da24-7b9d-11eb-02bd-eb99a3d95a2eÙ$ecb40aea-7b9c-11eb-1476-e54faf32d91c„´precedence_heuristic §cell_idÙ$ecb40aea-7b9c-11eb-1476-e54faf32d91c´downstream_cells_map€²upstream_cells_map†¯standard_Newton‘Ù$f25af026-7b9c-11eb-1f11-77a8b06b2d71¡:�¡-�£x02‘Ù$77ef0cfb-60db-4599-bec2-b65e99e5b246¡^�¢n2‘Ù$ce44554e-847f-4129-8841-1a729dfa7a2eÙ$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7„´precedence_heuristic §cell_idÙ$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$ee91563e-7c3e-11eb-3f65-1f336073869a„´precedence_heuristic §cell_idÙ$ee91563e-7c3e-11eb-3f65-1f336073869a´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$d690f83a-7c2e-11eb-14d7-79a250deb473„´precedence_heuristic §cell_idÙ$d690f83a-7c2e-11eb-14d7-79a250deb473´downstream_cells_map�¨newton1D‘Ù$2fb40dc6-7c2f-11eb-2469-8deb4db59b5c²upstream_cells_map…¡:�«ForwardDiff‘Ù$f4fda666-7b9c-11eb-0304-716c5e710462¡-�¶ForwardDiff.derivative�¡/�Ù$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8„´precedence_heuristic §cell_idÙ$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$07a754da-7c31-11eb-0394-4bef4d79fc30„´precedence_heuristic §cell_idÙ$07a754da-7c31-11eb-0394-4bef4d79fc30´downstream_cells_map€²upstream_cells_mapƒ¡T‘Ù$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0§inverse’Ù$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7Ù$2e2e5f0e-7c31-11eb-0da7-770b07ee6202¢Î±‘Ù$395fd8e2-7c31-11eb-1933-dd719fa0cd22Ù$63dbf052-7c32-11eb-1062-5b3581d38f70„´precedence_heuristic §cell_idÙ$63dbf052-7c32-11eb-1062-5b3581d38f70´downstream_cells_map€²upstream_cells_map‚¡f‘Ù$6dc89964-7c30-11eb-0a41-8d97b210ed34¡z‘Ù$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffÙ$18ce2fac-7c2e-11eb-03d2-b3a674621662„´precedence_heuristic §cell_idÙ$18ce2fac-7c2e-11eb-03d2-b3a674621662´downstream_cells_map€²upstream_cells_mapˆ¨jacobian‘Ù$f4fda666-7b9c-11eb-0304-716c5e710462¡T‘Ù$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0¢Ïµ‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¡b‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¡*�¡a‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¡p‘Ù$fe742fec-7c3e-11eb-1f54-55cdf02a1574¢Î´‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7Ù$6dc89964-7c30-11eb-0a41-8d97b210ed34„´precedence_heuristic §cell_idÙ$6dc89964-7c30-11eb-0a41-8d97b210ed34´downstream_cells_map�¡f–Ù$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-d59d00d20ba4²upstream_cells_mapƒ¡m‘Ù$a869e6c6-7c31-11eb-13c8-155d08be02eb¡-�¡^�Ù$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0„´precedence_heuristic §cell_idÙ$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$35b5c5c6-7c3f-11eb-2723-4b406a809114„´precedence_heuristic §cell_idÙ$35b5c5c6-7c3f-11eb-2723-4b406a809114´downstream_cells_map€²upstream_cells_mapŒ¨jacobian‘Ù$f4fda666-7b9c-11eb-0304-716c5e710462¡T‘Ù$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0¥image‘Ù$3828b94c-7c2d-11eb-2e01-79038b0f5226¢Ïµ‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¡b‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¢Î´‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¡a‘Ù$23536420-7c2d-11eb-20b0-9523f7a5f9d7¨simplify�¡-�¡*�¡p‘Ù$fe742fec-7c3e-11eb-1f54-55cdf02a1574¦expand‘Ù$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45Ù$e410c1d0-7ba1-11eb-394f-71dac89756b7„´precedence_heuristic §cell_idÙ$e410c1d0-7ba1-11eb-394f-71dac89756b7´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$db26375a-7c30-11eb-066e-ab9e8ded3356„´precedence_heuristic §cell_idÙ$db26375a-7c30-11eb-066e-ab9e8ded3356´downstream_cells_map€²upstream_cells_map‚¤f′‘Ù$d35e0cc8-7c30-11eb-28d3-17c9e221ea62¡z‘Ù$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffÙ$615aff3c-7c30-11eb-2ca8-9d2fdf299017„´precedence_heuristic §cell_idÙ$615aff3c-7c30-11eb-2ca8-9d2fdf299017´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$77ef0cfb-60db-4599-bec2-b65e99e5b246„´precedence_heuristic §cell_idÙ$77ef0cfb-60db-4599-bec2-b65e99e5b246´downstream_cells_map�£x02‘Ù$ecb40aea-7b9c-11eb-1476-e54faf32d91c²upstream_cells_map‹§@md_str�¤Core�¡:�¨Base.get�¥@bind�¦Slider�¤Base�«PlutoRunner�·PlutoRunner.create_bond�¯Core.applicable�¨getindex�Ù$1db66b0e-7ba4-11eb-2157-d5a399a73b1f„´precedence_heuristic §cell_idÙ$1db66b0e-7ba4-11eb-2157-d5a399a73b1f´downstream_cells_map�­newton2D_step‘Ù$923bde64-7ba4-11eb-21e9-a11993aaab2e²upstream_cells_map„«ForwardDiff‘Ù$f4fda666-7b9c-11eb-0304-716c5e710462´ForwardDiff.jacobian�¡\�¡-�Ù$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7„´precedence_heuristic §cell_idÙ$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7´downstream_cells_map�§inverse’Ù$07a754da-7c31-11eb-0394-4bef4d79fc30Ù$5faa2784-7c31-11eb-34f1-3f8224dbdbde²upstream_cells_map‡¤@doc�¡-�¥Tuple�¨newton2D‘Ù$923bde64-7ba4-11eb-21e9-a11993aaab2e¥Union�º#___this_pluto_module_name�£Any�Ù$ea741018-7c30-11eb-3912-a50475e6ec49„´precedence_heuristic §cell_idÙ$ea741018-7c30-11eb-3912-a50475e6ec49´downstream_cells_map€²upstream_cells_map†¡f‘Ù$6dc89964-7c30-11eb-0a41-8d97b210ed34¤f′‘Ù$d35e0cc8-7c30-11eb-28d3-17c9e221ea62¢Î·‘Ù$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff¡+�¡*�¡z‘Ù$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ffÙ$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08„´precedence_heuristic §cell_idÙ$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$02b1b470-7c31-11eb-28f4-411956f73f12„´precedence_heuristic §cell_idÙ$02b1b470-7c31-11eb-28f4-411956f73f12´downstream_cells_map€²upstream_cells_map‚¡T‘Ù$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0¢Î±‘Ù$395fd8e2-7c31-11eb-1933-dd719fa0cd22Ù$ba570c4c-7ba2-11eb-2125-9f23e415a1dc„´precedence_heuristic §cell_idÙ$ba570c4c-7ba2-11eb-2125-9f23e415a1dc´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71a„´precedence_heuristic §cell_idÙ$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71a´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�´cell_execution_orderÜAÙ$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-4b406a809114´last_hot_reload_timeË©shortpath©newton.jl®process_status¥ready¤pathÙS/home/fons/featured-slider-server/featured_fix/src/computational-thinking/newton.jl­pluto_version¦v1.0.0®last_save_timeËAÚ­†}>¶Rªcell_orderÜAÙ$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-c5cb2e349f45­julia_version§v1.12.4±published_objects€¥nbpkgНinstall_time_nsÎo7€¬instantiatedòinstalled_versionsˆ«ForwardDiff¥1.3.3©Symbolics¦7.24.2§PlutoUI¦0.7.81¥Plots¦1.41.6¨Latexify§0.16.10Ù!__internal_julia_manifest_version ¸__internal_julia_version¦1.12.4¬LaTeXStrings¥1.4.0°terminal_outputs‡«ForwardDiffÚ: Waiting for other notebooks to finish Pkg operations... === ┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Manifest.toml:0 Precompiling... ===ªnbpkg_syncÚ: Waiting for other notebooks to finish Pkg operations... === ┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Manifest.toml:0 Precompiling... ===©SymbolicsÚ: Waiting for other notebooks to finish Pkg operations... === ┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Manifest.toml:0 Precompiling... ===§PlutoUIÚ: Waiting for other notebooks to finish Pkg operations... === ┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Manifest.toml:0 Precompiling... ===¥PlotsÚ: Waiting for other notebooks to finish Pkg operations... === ┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Manifest.toml:0 Precompiling... ===¨LatexifyÚ: Waiting for other notebooks to finish Pkg operations... === ┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Manifest.toml:0 Precompiling... ===¬LaTeXStringsÚ: Waiting for other notebooks to finish Pkg operations... === ┌ Warning: The active manifest file at `/home/fons/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Project.toml`  Manifest No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_nkbhxojrcu/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_nkbhxojrcu/Manifest.toml:0 Precompiling... ===§enabled÷restart_recommended_msgÀ´restart_required_msgÀ­busy_packages�¶waiting_for_permissionÂÙ,waiting_for_permission_but_probably_disabled«cell_inputsÞAÙ$2e2e5f0e-7c31-11eb-0da7-770b07ee6202„§cell_idÙ$2e2e5f0e-7c31-11eb-0da7-770b07ee6202¤code¿inverse(f) = y -> inverse(f, y)¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$9d778e36-7c30-11eb-1f4b-894af86a8f5d„§cell_idÙ$9d778e36-7c30-11eb-1f4b-894af86a8f5d¤codeÙãmd""" 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: """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$395fd8e2-7c31-11eb-1933-dd719fa0cd22„§cell_idÙ$395fd8e2-7c31-11eb-1933-dd719fa0cd22¤codeÙ@md""" α = $(@bind α Slider(0.0:0.01:1.0, show_value=true)) """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$3828b94c-7c2d-11eb-2e01-79038b0f5226„§cell_idÙ$3828b94c-7c2d-11eb-2e01-79038b0f5226¤codeÙ/image = expand.(T(p)( [ (a + δ), (b + ϵ) ] ))¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$ce44554e-847f-4129-8841-1a729dfa7a2e„§cell_idÙ$ce44554e-847f-4129-8841-1a729dfa7a2e¤codeÙBmd""" n = $(@bind n2 Slider(0:10, show_value=true, default=1)) """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$923bde64-7ba4-11eb-21e9-a11993aaab2e„§cell_idÙ$923bde64-7ba4-11eb-21e9-a11993aaab2e¤codeÙŠ"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 end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$a869e6c6-7c31-11eb-13c8-155d08be02eb„§cell_idÙ$a869e6c6-7c31-11eb-13c8-155d08be02eb¤codeÙ5md""" m = $(@bind m Slider(1:6, show_value=true)) """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$2fb40dc6-7c2f-11eb-2469-8deb4db59b5c„§cell_idÙ$2fb40dc6-7c2f-11eb-2469-8deb4db59b5c¤code¼newton1D(x -> x^2 - 2, 37.0)¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$f4fda666-7b9c-11eb-0304-716c5e710462„§cell_idÙ$f4fda666-7b9c-11eb-0304-716c5e710462¤codeÙvbegin using Symbolics, ForwardDiff, Plots, PlutoUI, LaTeXStrings using ForwardDiff: jacobian import Latexify end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$35791bca-7c2f-11eb-1cfb-8d5ebd0208cb„§cell_idÙ$35791bca-7c2f-11eb-1cfb-8d5ebd0208cb¤code§sqrt(2)¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff„§cell_idÙ$71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff¤code°@variables z, η¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$dd6b0ae2-cc87-4d19-ac78-f3a990aa692e„§cell_idÙ$dd6b0ae2-cc87-4d19-ac78-f3a990aa692e¤codeÚhtml"""

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.

"""¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$2445da24-7b9d-11eb-02bd-eb99a3d95a2e„§cell_idÙ$2445da24-7b9d-11eb-02bd-eb99a3d95a2e¤codeÙAmd""" n = $(@bind n Slider(0:10, show_value=true, default=1)) """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$98158a38-7c30-11eb-0796-2335e97ec6d0„§cell_idÙ$98158a38-7c30-11eb-0796-2335e97ec6d0¤code³expand( f(z + η) )¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0„§cell_idÙ$4dd2322c-7ba0-11eb-2b3b-af7c6c1d60a0¤codeÙ^md""" ## Newton for transformations in 2 dimensions $$T: \mathbb{R}^2 \to \mathbb{R}^2$$ """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$8c0c412e-7c2f-11eb-1880-4f6c45d77597„§cell_idÙ$8c0c412e-7c2f-11eb-1880-4f6c45d77597¤codeÚmd""" 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: """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45„§cell_idÙ$786f8e78-7c2d-11eb-1bb8-c5cb2e349f45¤codeÙ(expand(ex) = simplify(ex, polynorm=true)¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$f25af026-7b9c-11eb-1f11-77a8b06b2d71„§cell_idÙ$f25af026-7b9c-11eb-1f11-77a8b06b2d71¤codeÚ�function 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 end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$fe742fec-7c3e-11eb-1f54-55cdf02a1574„§cell_idÙ$fe742fec-7c3e-11eb-1f54-55cdf02a1574¤codeÙ:md""" p = $(@bind p Slider(0:0.01:1, show_value=true)) """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750„§cell_idÙ$e1afc6ca-7ba1-11eb-3fb9-ef3a7f82d750¤codeÙ!md""" ## Implementation in 2D """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0„§cell_idÙ$515c23b6-7c2d-11eb-28c9-1b1d92eb4ba0¤codeÙ-T(α) = ((x, y),) -> [x + α*y^2, y + α*x^2]¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$1b77fada-7b9d-11eb-3266-ebb3895cb76a„§cell_idÙ$1b77fada-7b9d-11eb-3266-ebb3895cb76a¤codeÙ*straight(x0, y0, x, m) = y0 + m * (x - x0)¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$80917990-7ba0-11eb-029a-dba981c52b58„§cell_idÙ$80917990-7ba0-11eb-029a-dba981c52b58¤codeÙÅmd""" $$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$. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$b7dc4666-7ba1-11eb-32eb-fd3d720c2960„§cell_idÙ$b7dc4666-7ba1-11eb-32eb-fd3d720c2960¤codeÙumd""" $$J \cdot \delta = -T(x_0)$$ Then we again construct the new approximation $x_1$ as $x_1 := x_0 + \delta$. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$d35e0cc8-7c30-11eb-28d3-17c9e221ea62„§cell_idÙ$d35e0cc8-7c30-11eb-28d3-17c9e221ea62¤codeÙ'f′(x) = ForwardDiff.derivative(f, x);¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$61905ae0-7ba6-11eb-0773-17e9aa4e9991„§cell_idÙ$61905ae0-7ba6-11eb-0773-17e9aa4e9991¤codeÙ‹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: """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$1ba1ae44-7ba1-11eb-21ff-558c95446435„§cell_idÙ$1ba1ae44-7ba1-11eb-21ff-558c95446435¤codeÚºmd""" 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. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$23536420-7c2d-11eb-20b0-9523f7a5f9d7„§cell_idÙ$23536420-7c2d-11eb-20b0-9523f7a5f9d7¤code·@variables a, b, δ, ϵ¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$c519704c-7ba1-11eb-12da-8b9b176daa0d„§cell_idÙ$c519704c-7ba1-11eb-12da-8b9b176daa0d¤codeÙJmd""" In 2D we have an explicit formula for the inverse of the matrix. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$9cfa9062-7ba0-11eb-3a93-197ac0287ab4„§cell_idÙ$9cfa9062-7ba0-11eb-3a93-197ac0287ab4¤codeÙ/md""" $$f(x_1) = f(x_0 + \delta) \simeq 0$$ """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05„§cell_idÙ$9addbcbe-7b9e-11eb-3e8c-fbab3be40e05¤codeÙGmd""" xâ‚€ = $(@bind x0 Slider(-10:10, show_value=true, default=6)) """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$af887dea-7ba1-11eb-3b0d-6925756382a7„§cell_idÙ$af887dea-7ba1-11eb-3b0d-6925756382a7¤codeÙJmd""" Hence $\delta$ is the solution of the system of linear equations """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$5123c038-7ba2-11eb-1be2-19f789b02c1f„§cell_idÙ$5123c038-7ba2-11eb-1be2-19f789b02c1f¤codeÙ-md""" ## Mathematics of the Newton method """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$e18f2470-7c31-11eb-2b74-d59d00d20ba4„§cell_idÙ$e18f2470-7c31-11eb-2b74-d59d00d20ba4¤codeÙ+expand( f(z + η) ) - ( f(z) + η*f′(z) )¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$5faa2784-7c31-11eb-34f1-3f8224dbdbde„§cell_idÙ$5faa2784-7c31-11eb-34f1-3f8224dbdbde¤codeÙ*( T(α) ∘ inverse(T(α)) )( [0.3, 0.4] )¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$9371f930-7c30-11eb-1f77-c7f31b97ea26„§cell_idÙ$9371f930-7c30-11eb-1f77-c7f31b97ea26¤code©f(z + η)¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8„§cell_idÙ$c0b4defe-7c2f-11eb-1913-bdb01d28a4a8¤codeÙUmd""" ## Using symbolic calculations to understand derivatives and nonlinear maps """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$ed605b90-7c3e-11eb-34e9-776a05a177dd„§cell_idÙ$ed605b90-7c3e-11eb-34e9-776a05a177dd¤code´image - T(p)([a, b])¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$d44c73b4-7c3e-11eb-1302-8ba9039ae789„§cell_idÙ$d44c73b4-7c3e-11eb-1302-8ba9039ae789¤codeÙž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)$: """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$09b97be8-7c2e-11eb-05fd-65bbd097afb8„§cell_idÙ$09b97be8-7c2e-11eb-05fd-65bbd097afb8¤code¿jacobian(T(p), [a, b]) .|> Text¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$389e990e-7c40-11eb-37c4-5ba0f59173b3„§cell_idÙ$389e990e-7c40-11eb-37c4-5ba0f59173b3¤codeÚmd""" 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. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82„§cell_idÙ$5ea7344c-7ba2-11eb-2cc5-0bbdca218c82¤codeÚsmd""" ## 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. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$ec6c6328-7b9c-11eb-1c69-dba12ae522ad„§cell_idÙ$ec6c6328-7b9c-11eb-1c69-dba12ae522ad¤codeÙRlet f(x) = 0.2x^3 - 4x + 1 standard_Newton(f, n, -10:0.01:10, x0, -10, 70) end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$ecb40aea-7b9c-11eb-1476-e54faf32d91c„§cell_idÙ$ecb40aea-7b9c-11eb-1476-e54faf32d91c¤codeÙJlet f(x) = x^2 - 2 standard_Newton(f, n2, -1:0.01:10, x02, -10, 70) end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7„§cell_idÙ$5c9edb2c-7ba0-11eb-14f6-3d5e52123bc7¤codeÙ�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: """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$ee91563e-7c3e-11eb-3f65-1f336073869a„§cell_idÙ$ee91563e-7c3e-11eb-3f65-1f336073869a¤codeµmd""" ## Appendix """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$d690f83a-7c2e-11eb-14d7-79a250deb473„§cell_idÙ$d690f83a-7c2e-11eb-14d7-79a250deb473¤codeÙÊfunction 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 end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8„§cell_idÙ$f153b4b8-7ba0-11eb-37ec-4f1a3dbe20e8¤codeÙ×md""" 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 """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$07a754da-7c31-11eb-0394-4bef4d79fc30„§cell_idÙ$07a754da-7c31-11eb-0394-4bef4d79fc30¤code¼inverse(T(α))( [0.3, 0.4] )¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$63dbf052-7c32-11eb-1062-5b3581d38f70„§cell_idÙ$63dbf052-7c32-11eb-1062-5b3581d38f70¤code¤f(z)¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$18ce2fac-7c2e-11eb-03d2-b3a674621662„§cell_idÙ$18ce2fac-7c2e-11eb-03d2-b3a674621662¤codeÙ!jacobian(T(p), [a, b]) * [δ, ϵ]¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$6dc89964-7c30-11eb-0a41-8d97b210ed34„§cell_idÙ$6dc89964-7c30-11eb-0a41-8d97b210ed34¤code¯f(x) = x^m - 2;¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0„§cell_idÙ$1d7dd328-7c2d-11eb-2b35-bdbf5df686f0¤codeÙ'md""" ## Symbolic derivative in 2D """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$35b5c5c6-7c3f-11eb-2723-4b406a809114„§cell_idÙ$35b5c5c6-7c3f-11eb-2723-4b406a809114¤codeÙLsimplify.(expand.(image - T(p)([a, b]) - jacobian(T(p), [a, b]) * [δ, ϵ]))¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$e410c1d0-7ba1-11eb-394f-71dac89756b7„§cell_idÙ$e410c1d0-7ba1-11eb-394f-71dac89756b7¤codeÚ|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". """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$db26375a-7c30-11eb-066e-ab9e8ded3356„§cell_idÙ$db26375a-7c30-11eb-066e-ab9e8ded3356¤code§f′(z)¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$615aff3c-7c30-11eb-2ca8-9d2fdf299017„§cell_idÙ$615aff3c-7c30-11eb-2ca8-9d2fdf299017¤codeÙÞmd""" 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$. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$77ef0cfb-60db-4599-bec2-b65e99e5b246„§cell_idÙ$77ef0cfb-60db-4599-bec2-b65e99e5b246¤codeÙHmd""" xâ‚€ = $(@bind x02 Slider(-10:10, show_value=true, default=6)) """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$1db66b0e-7ba4-11eb-2157-d5a399a73b1f„§cell_idÙ$1db66b0e-7ba4-11eb-2157-d5a399a73b1f¤codeÙ“function newton2D_step(T, x) J = ForwardDiff.jacobian(T, x) # should use StaticVectors δ = J \ T(x) # J^(-1) * T(x) return x - δ end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7„§cell_idÙ$ff8b6aec-7ba5-11eb-0d83-19803b1bdda7¤codeÙ‰"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) end¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$ea741018-7c30-11eb-3912-a50475e6ec49„§cell_idÙ$ea741018-7c30-11eb-3912-a50475e6ec49¤code±f(z) + η*f′(z)¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08„§cell_idÙ$9bfafcc0-7ba2-11eb-1b67-e3a3803ead08¤codeÙ¶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.) """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$02b1b470-7c31-11eb-28f4-411956f73f12„§cell_idÙ$02b1b470-7c31-11eb-28f4-411956f73f12¤code³T(α)( [0.3, 0.4] )¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$ba570c4c-7ba2-11eb-2125-9f23e415a1dc„§cell_idÙ$ba570c4c-7ba2-11eb-2125-9f23e415a1dc¤codeÙ!md""" ## Implementation in 1D """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71a„§cell_idÙ$d82f1eae-7b9c-11eb-24d8-e1dcb2eef71a¤codeÙZmd""" ## Solving equations and finding inverse transformations using the Newton method """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedënotebook_idÙ$8a1f3b4e-b8ad-11f1-a4d6-67a7304150f8«in_temp_dir¨metadata�«frontmatter�§chapter¡1«license_urlÙHhttps://github.com/mitmath/computational-thinking/blob/Fall23/LICENSE.mdªyoutube_id«Wjcx9sNSLP8¥videoÙ+https://www.youtube.com/watch?v=Wjcx9sNSLP8¦author‘‚¤name¯MIT mathematics£urlºhttps://github.com/mitmath¦layout­layout.jlhtml«descriptionÚ.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_license¬CC-BY-SA-4.0¥imageÙdhttps://user-images.githubusercontent.com/6933510/136196605-b6119b9d-223c-44bc-97d5-ef7cfce66483.gif¬code_license£MIT§section¡6¥title±The Newton Method¤tagsš§lecture§module1ªtrack_mathªcontinuous¯differentiation¹automatic differentiation«ForwardDiff«interactive©Symbolics®transformation