ipynb Cheat Sheet#
Maths#
A smooth system can generally be represented as \(\dot{x} = f(x,u)\).
\[\begin{split}
\left.\frac{\partial f}{\partial x}\right|_{\sigma=0}=\left[\begin{array}{cc}
0 & 1 \\
-i / e & 0
\end{array}\right] \Rightarrow \operatorname{eig}\left(\frac{\partial f}{\partial x}\right) \pm i \sqrt{\frac{g}{e}}
\end{split}\]
And numbered (https://jupyterbook.org/en/stable/content/math.html)
(1)#\[w_{t+1} = (1 + r_{t+1}) s(w_t) + y_{t+1}\]
or this
(2)#\[
w_{t+1} = (1 + r_{t+1}) s(w_t) + y_{t+1}
\]
Now I can refer to (1) or (2) with
{eq}`my_other_label`
Some special content blocks#
Note
Here is a note!
Warning
Here is a warning!
Here is some more info…
For more info expand me
Here is some more info…
Hiden cells#
Show code cell content
# hidden with In browser (View -> Cell Toolbar -> Tags)
# Add ""
# Activate the enironment
import Pkg
Pkg.activate(@__DIR__); # activate the env in the directory
# Pkg.instantiate()
Activating project at `/__w/CMU-16-745/CMU-16-745/optimalcontrol`
Look a pretty plot with hidden input
Show code cell source
using Plots
# our first plot is just a normal one
x = -10:.001:10
# now let's plot multiple
plot(x, sin.(x), label = "sin(x)", xlabel = "x label",
ylabel = "y label", xlim = (-5,5), ylim = (-2, 2))
# now I use plot! to modify my existing plot
plot!(x, cos.(x), label = "cos(x)")
scatter!(randn(100), randn(100), label = "random scatter points")
[ Info: Precompiling IJuliaExt [2f4121a4-3b3a-5ce6-9c5e-1f2673ce168a]
# You can copy this
using Plots
@gif for i in 1:50
plot(sin, 0, i * 2pi / 10)
end
[ Info: Saved animation to /__w/CMU-16-745/CMU-16-745/optimalcontrol/tmp.gif
using Random
anim = @animate for i in 1:50
Random.seed!(123)
scatter(cumsum(randn(i)), ms=i, lab="", alpha = 1 - i/50,
xlim=(0,50), ylim=(-5, 7))
end
gif(anim, fps=15)
[ Info: Saved animation to /__w/CMU-16-745/CMU-16-745/optimalcontrol/tmp.gif
# Interative plots don't display in html. Gues that makes sense ...
# import Pkg; Pkg.add("Plotly");
# using Plots
# plotly()
# x = range(0, 10, length=100)
# y = sin.(x)
# plot(x, y)
# @show x
# @show A = [1 2 3.0; 4 5 6]
# @show A = [1 2 3]
# @show A = range(1, 10)
# x = [1 2 3]
# y = [4 5 6]
# plot(x',y',label="sin(x)")