feat: add binomial distribution calc #1

Open
pitbuster wants to merge 3 commits from binom into main
8 changed files with 67 additions and 55 deletions
Showing only changes of commit 9b4ac16610 - Show all commits

86
Cargo.lock generated
View file

@ -30,9 +30,9 @@ checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
[[package]] [[package]]
name = "async-lock" name = "async-lock"
version = "3.4.0" version = "3.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" checksum = "5fd03604047cee9b6ce9de9f70c6cd540a0520c813cbd49bae61f33ab80ed1dc"
dependencies = [ dependencies = [
"event-listener", "event-listener",
"event-listener-strategy", "event-listener-strategy",
@ -131,9 +131,9 @@ dependencies = [
[[package]] [[package]]
name = "bumpalo" name = "bumpalo"
version = "3.18.1" version = "3.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793db76d6187cd04dff33004d8e6c9cc4e05cd330500379d2394209271b4aeee" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
[[package]] [[package]]
name = "bytes" name = "bytes"
@ -149,9 +149,9 @@ checksum = "0da45bc31171d8d6960122e222a67740df867c1dd53b4d51caa297084c185cab"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.27" version = "1.2.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2"
dependencies = [ dependencies = [
"shlex", "shlex",
] ]
@ -173,9 +173,9 @@ checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
[[package]] [[package]]
name = "codee" name = "codee"
version = "0.3.0" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f18d705321923b1a9358e3fc3c57c3b50171196827fc7f5f10b053242aca627" checksum = "fd8bbfdadf2f8999c6e404697bc08016dce4a3d77dec465b36c9a0652fdb3327"
dependencies = [ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
@ -184,9 +184,9 @@ dependencies = [
[[package]] [[package]]
name = "collection_literals" name = "collection_literals"
version = "1.0.1" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "186dce98367766de751c42c4f03970fc60fc012296e706ccbb9d5df9b6c1e271" checksum = "26b3f65b8fb8e88ba339f7d23a390fe1b0896217da05e2a66c584c9b29a91df8"
[[package]] [[package]]
name = "concurrent-queue" name = "concurrent-queue"
@ -376,6 +376,23 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "distribution-calc"
version = "0.1.1"
dependencies = [
"console_error_panic_hook",
"console_log",
"fluent-templates",
"leptos",
"leptos-fluent",
"leptos_meta",
"leptos_router",
"log",
"wasm-bindgen",
"wasm-bindgen-test",
"web-sys",
]
[[package]] [[package]]
name = "drain_filter_polyfill" name = "drain_filter_polyfill"
version = "0.1.3" version = "0.1.3"
@ -412,9 +429,9 @@ checksum = "a1731451909bde27714eacba19c2566362a7f35224f52b153d3f42cf60f72472"
[[package]] [[package]]
name = "event-listener" name = "event-listener"
version = "5.4.0" version = "5.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab"
dependencies = [ dependencies = [
"concurrent-queue", "concurrent-queue",
"parking", "parking",
@ -753,23 +770,6 @@ dependencies = [
"throw_error", "throw_error",
] ]
[[package]]
name = "hypergeometric-calc"
version = "0.1.0"
dependencies = [
"console_error_panic_hook",
"console_log",
"fluent-templates",
"leptos",
"leptos-fluent",
"leptos_meta",
"leptos_router",
"log",
"wasm-bindgen",
"wasm-bindgen-test",
"web-sys",
]
[[package]] [[package]]
name = "icu_collections" name = "icu_collections"
version = "2.0.0" version = "2.0.0"
@ -895,9 +895,9 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.9.0" version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.15.4", "hashbrown 0.15.4",
@ -1543,9 +1543,9 @@ dependencies = [
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.5.13" version = "0.5.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77"
dependencies = [ dependencies = [
"bitflags", "bitflags",
] ]
@ -1694,9 +1694,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.140" version = "1.0.142"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7"
dependencies = [ dependencies = [
"itoa", "itoa",
"memchr", "memchr",
@ -1965,9 +1965,9 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.9.4" version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41ae868b5a0f67631c14589f7e250c1ea2c574ee5ba21c6c8dd4b1485705a5a1" checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8"
dependencies = [ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
@ -1987,9 +1987,9 @@ dependencies = [
[[package]] [[package]]
name = "toml_parser" name = "toml_parser"
version = "1.0.1" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97200572db069e74c512a14117b296ba0a80a30123fbbb5aa1f4a348f639ca30" checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10"
dependencies = [ dependencies = [
"winnow", "winnow",
] ]
@ -2407,9 +2407,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.7.11" version = "0.7.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -2499,9 +2499,9 @@ dependencies = [
[[package]] [[package]]
name = "zerovec" name = "zerovec"
version = "0.11.2" version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" checksum = "bdbb9122ea75b11bf96e7492afb723e8a7fbe12c67417aa95e7e3d18144d37cd"
dependencies = [ dependencies = [
"yoke", "yoke",
"zerofrom", "zerofrom",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "hypergeometric-calc" name = "distribution-calc"
version = "0.1.0" version = "0.1.1"
edition = "2024" edition = "2024"
authors = ["Felipe Contreras Salinas <felipe@bstr.cl>"] authors = ["Felipe Contreras Salinas <felipe@bstr.cl>"]

View file

@ -219,7 +219,7 @@ If you develop a new program, and you want it to be of the greatest possible use
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
hypergeometric-calc distribution-calc
Copyright (C) 2025 LuckyMeowth Copyright (C) 2025 LuckyMeowth
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

View file

@ -1,5 +1,5 @@
# hypergeometric-calc # distribution-calc
Web calculator for Hypergeometric Distribution built using [Leptos]. Web calculator for Probability Distributions built using [Leptos].
## Dependencies ## Dependencies
You will need to install the Rust toolchain. We recommend to do using [Rustup]. Once You will need to install the Rust toolchain. We recommend to do using [Rustup]. Once

View file

@ -6,3 +6,8 @@ population = Population Size
successes = Successes in Population successes = Successes in Population
sample = Sample Size sample = Sample Size
sample-successes = Successes in Sample sample-successes = Successes in Sample
hyper-description = Hypergeometric distribution measures the probability of getting a given amount of a certain type of elements from a sample on a population. Think on drawing
success-probability = Success probability
trials-number = Number of trials
successes-number = Number of successes
binom-description = .

View file

@ -6,3 +6,8 @@ population = Tamaño población
successes = Éxitos en la población successes = Éxitos en la población
sample = Tamaño de la muestra sample = Tamaño de la muestra
sample-successes = Éxitos en la muestra sample-successes = Éxitos en la muestra
hyper-description = Hypergeometric distribution measures the probability of getting a given amount of a certain type of elements from a sample on a population. Think on drawing
success-probability = Probabilidad de éxito
trials-number = Número de intentos
successes-number = Número de éxitos
binom-description = .

View file

@ -36,12 +36,14 @@ pub fn LanguageSelector() -> impl IntoView {
let i18n = expect_context::<leptos_fluent::I18n>(); let i18n = expect_context::<leptos_fluent::I18n>();
view! { view! {
<span>
<label for="language">"A/文:"</label> <label for="language">"A/文:"</label>
<select id="language"> <select id="language">
{move || { {move || {
i18n.languages.iter().map(|lang| render_language(lang)).collect::<Vec<_>>() i18n.languages.iter().map(|lang| render_language(lang)).collect::<Vec<_>>()
}} }}
</select> </select>
</span>
} }
} }

View file

@ -1,4 +1,4 @@
use hypergeometric_calc::App; use distribution_calc::App;
use leptos::{mount::mount_to_body, view}; use leptos::{mount::mount_to_body, view};
fn main() { fn main() {