testing julia

This commit is contained in:
Erik Grobecker 2025-02-24 17:34:16 +01:00
parent 7c841df98a
commit b45fe0321f
Signed by: Erik
GPG key ID: 80D020D0ABBD3FB2
3 changed files with 55 additions and 8 deletions

View 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

View 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)

View file

@ -10,14 +10,15 @@
mermaid-cli mermaid-cli
# for math # for math
python312 python313
python312Packages.sympy python313Packages.sympy
python312Packages.numpy python313Packages.numpy
python312Packages.matplotlib python313Packages.matplotlib
python312Packages.scipy python313Packages.scipy
python312Packages.pandas python313Packages.pandas
python312Packages.jupyter python313Packages.jupyter
python312Packages.ipykernel python313Packages.ipykernel
julia-bin
# for the project # for the project
pre-commit pre-commit