Zufälliges¶
anfängliche Fingerübungen
In [1]:
4*6
Out[1]:
24
In [2]:
using Plots
In [3]:
f(x)=x/(1+x^2)
Out[3]:
f (generic function with 1 method)
In [4]:
plot(f,-3,3,fmt=:png,label="rationale Funktion",xlabel="Input",
ylabel="Ergebnis")
Out[4]:
In [5]:
rand(3,3)
Out[5]:
3×3 Matrix{Float64}:
0.951301 0.0029108 0.877782
0.661287 0.0883877 0.686778
0.71806 0.472352 0.241093
In [6]:
using Distributions
In [7]:
N=Normal(180,12)
Out[7]:
Normal{Float64}(μ=180.0, σ=12.0)
In [8]:
randsample=rand(N,250);
In [9]:
histogram(randsample,bins=11,legend=false,xlabel="Größe",ylabel="abs. Häufigkeit")
Out[9]:
In [10]:
cdf(N,190)
Out[10]:
0.797671619036357
In [11]:
quantile(N,0.9)
Out[11]:
195.3786187865352
Irrfahrt¶
In [12]:
U=Uniform(0,2*pi)
Out[12]:
Uniform{Float64}(a=0.0, b=6.283185307179586)
In [13]:
m=1000
Out[13]:
1000
In [14]:
angsample=rand(U,m);
In [15]:
N=Uniform()
Out[15]:
Uniform{Float64}(a=0.0, b=1.0)
In [16]:
lensample=rand(N,m);
In [17]:
dx=cos.(angsample).*lensample;
In [18]:
dy=sin.(angsample).*lensample;
In [19]:
x=cumsum(dx); y=cumsum(dy);
In [20]:
plot(x,y)
Out[20]:
In [ ]: