You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Using symbolic calculations to understand derivatives and nonlinear maps
@@ -121,26 +107,23 @@ Let's see what happens if we perturb a function $f$ around a point $z$ by a smal
121
107
# ╔═╡ 71efd6b0-7c30-11eb-0da7-0d4a5ab8f8ff
122
108
@variables z, η
123
109
110
+
# ╔═╡ a869e6c6-7c31-11eb-13c8-155d08be02eb
111
+
md"""
112
+
m = $(@bind m Slider(1:6, show_value=true))
113
+
"""
114
+
124
115
# ╔═╡ 6dc89964-7c30-11eb-0a41-8d97b210ed34
125
116
f(x) = x^m -2;
126
117
127
118
# ╔═╡ d35e0cc8-7c30-11eb-28d3-17c9e221ea62
128
119
f′(x) = ForwardDiff.derivative(f, x);
129
120
130
-
# ╔═╡ a869e6c6-7c31-11eb-13c8-155d08be02eb
131
-
md"""
132
-
m = $(@bind m Slider(1:6, show_value=true))
133
-
"""
134
-
135
121
# ╔═╡ 63dbf052-7c32-11eb-1062-5b3581d38f70
136
122
f(z)
137
123
138
124
# ╔═╡ 9371f930-7c30-11eb-1f77-c7f31b97ea26
139
125
f(z + η)
140
126
141
-
# ╔═╡ 98158a38-7c30-11eb-0796-2335e97ec6d0
142
-
expand( f(z + η) )
143
-
144
127
# ╔═╡ 9d778e36-7c30-11eb-1f4b-894af86a8f5d
145
128
md"""
146
129
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:
@@ -152,9 +135,6 @@ f′(z)
152
135
# ╔═╡ ea741018-7c30-11eb-3912-a50475e6ec49
153
136
f(z) + η*f′(z)
154
137
155
-
# ╔═╡ e18f2470-7c31-11eb-2b74-d59d00d20ba4
156
-
expand( f(z + η) ) - ( f(z) + η*f′(z) )
157
-
158
138
# ╔═╡ 389e990e-7c40-11eb-37c4-5ba0f59173b3
159
139
md"""
160
140
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.
@@ -259,21 +239,6 @@ p = $(@bind p Slider(0:0.01:1, show_value=true))
0 commit comments