ローレンツ関数へ
1. (最初)
$ f(x) = \frac{1}{x^2+1} を描きましょう
code:julia.jl
xs= -2:0.05:2
ys=1 ./ (xs.^2+1);
code:julia.jl
using PyPlot
plot(xs,ys)
https://gyazo.com/ea389f76d3e3fecd4e05413b86c6691c
code:output.txt
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x321739790>
2. (次)
原点をずらしてみます
$ f(x) = \frac{1}{(x-x_0)^2+1}
code:julia.jl
x0=-0.2
ys=1 ./ ((xs-x0).^2+1);
plot(xs,ys)
https://gyazo.com/8697983b96c67859b00ad11b2e74a3c9
code:output.txt
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x3218b9e90>
3. (その次)
幅を変えてみる。
$ f(x) = \frac{\gamma}{(x-x_0)^2+(\gamma)^2}
code:julia.jl
x0=-0.2
gamma=3
ys=gamma ./ ((xs-x0).^2+gamma^2);
plot(xs,ys)
https://gyazo.com/7982eaceeb65aed0c5ef71a48f1c77d9
code:output.txt
1-element Array{Any,1}:
PyObject <matplotlib.lines.Line2D object at 0x321a98250>
code: (julia)