testing julia
This commit is contained in:
parent
7c841df98a
commit
b45fe0321f
3 changed files with 55 additions and 8 deletions
32
schule/mathe/calc/lib/binomialverteilung.jl
Normal file
32
schule/mathe/calc/lib/binomialverteilung.jl
Normal file
|
@ -0,0 +1,32 @@
|
|||
"""
|
||||
# Variablen
|
||||
- n: Anzahl der Versuche
|
||||
- p: Chance für erfolgreichen Versuch
|
||||
- x: Anzahl der zu berechnenden erfolgreichen Versuche
|
||||
"""
|
||||
module Binomialverteilung
|
||||
|
||||
"""
|
||||
# Variablen
|
||||
- `n`: Anzahl der Versuche
|
||||
- `p`: Chance für erfolgreichen Versuch
|
||||
"""
|
||||
erwartungswert(n, p) = n * p
|
||||
|
||||
"""
|
||||
# Variablen
|
||||
- `n`: Anzahl der Versuche
|
||||
- `p`: Chance für erfolgreichen Versuch
|
||||
"""
|
||||
standardabweichung(n, p) = sqrt(n * p * (1 - p))
|
||||
|
||||
"""
|
||||
# Variablen
|
||||
- `x`: Anzahl der zu berechnenden erfolgreichen Versuche
|
||||
- `n`: Anzahl der Versuche
|
||||
- `p`: Chance für erfolgreichen Versuch
|
||||
"""
|
||||
function verteilung(x, n, p)
|
||||
binomial(n, x) * p^x * (1-p)^(n-x)
|
||||
end
|
||||
end # of module
|
14
schule/mathe/jupyter/julia.jl
Normal file
14
schule/mathe/jupyter/julia.jl
Normal file
|
@ -0,0 +1,14 @@
|
|||
function mittelwert(list::Vector{<:Tuple{<:Real, <:Real}})
|
||||
upper_sum = sum(wert * anzahl for (wert, anzahl) in list)
|
||||
total_count = sum(anzahl for (_, anzahl) in list)
|
||||
return upper_sum/total_count
|
||||
end
|
||||
|
||||
|
||||
input = [
|
||||
(1,0)
|
||||
(3,0.4)
|
||||
(5,6)
|
||||
]
|
||||
|
||||
mittelwert(input)
|
17
shell.nix
17
shell.nix
|
@ -10,14 +10,15 @@
|
|||
mermaid-cli
|
||||
|
||||
# for math
|
||||
python312
|
||||
python312Packages.sympy
|
||||
python312Packages.numpy
|
||||
python312Packages.matplotlib
|
||||
python312Packages.scipy
|
||||
python312Packages.pandas
|
||||
python312Packages.jupyter
|
||||
python312Packages.ipykernel
|
||||
python313
|
||||
python313Packages.sympy
|
||||
python313Packages.numpy
|
||||
python313Packages.matplotlib
|
||||
python313Packages.scipy
|
||||
python313Packages.pandas
|
||||
python313Packages.jupyter
|
||||
python313Packages.ipykernel
|
||||
julia-bin
|
||||
|
||||
# for the project
|
||||
pre-commit
|
||||
|
|
Loading…
Add table
Reference in a new issue