Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated documentation #123

Merged
merged 9 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Documentation/.vitepress/cache/deps/_metadata.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"hash": "d97f0896",
"browserHash": "c0859cb5",
"hash": "1cd17bc6",
"browserHash": "cc3e279a",
"optimized": {
"vue": {
"src": "../../../node_modules/vue/dist/vue.runtime.esm-bundler.js",
"file": "vue.js",
"fileHash": "cf7e76c1",
"fileHash": "1771e818",
"needsInterop": false
}
},
Expand Down
3,671 changes: 2,475 additions & 1,196 deletions Documentation/.vitepress/cache/deps/vue.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Documentation/.vitepress/cache/deps/vue.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Documentation/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ function envSidebar() {
text: "Update",
link: "/env/update",
},
{
text: "UwpApp",
link: "/env/uwpapp",
},
],
},
];
Expand Down
154 changes: 125 additions & 29 deletions Documentation/core/maths/stats.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Stats

This page is about the `Stats` class available in [`PeyrSharp.Core.Maths`](/core/maths).
You can find here all of its methods.

Expand All @@ -10,87 +11,182 @@ This class is `static`.

The `Stats` class is part of the `PeyrSharp.Core` module, which is compatible with all of these frameworks and platforms:

| Package/Platform | Windows | macOS | Linux + others |
|------------------ |--------- |------- |---------------- |
| Core | ✅ | ✅ | ✅ |
| **Framework** | **.NET 5** | **.NET 6** | **.NET 7** |
| Core | ✅ | ✅ | ✅ |
| Package/Platform | Windows | macOS | Linux + others |
| ---------------- | ---------- | ---------- | -------------- |
| Core | ✅ | ✅ | ✅ |
| **Framework** | **.NET 5** | **.NET 6** | **.NET 7** |
| Core | ✅ | ✅ | ✅ |

## Methods

### Mean(values)

#### Definition

Returns the mean of a dataset as a `double`.

#### Arguments

| Type | Name | Meaning |
|---------- |---------- |--------------------------- |
| `List<double>` | `values` | The dataset to calculate. |
| Type | Name | Meaning |
| -------------- | -------- | ------------------------- |
| `List<double>` | `values` | The dataset to calculate. |

#### Exceptions

| Type | Meaning |
|------------------------- |------------------------------------- |
| `ArgumentException` | Thrown if the dataset is empty. |
| Type | Meaning |
| ------------------- | ------------------------------- |
| `ArgumentException` | Thrown if the dataset is empty. |

#### Usage

~~~ c#
```c#
using PeyrSharp.Core.Maths;

List<double> dataset = new List<double> { 1, 2, 3, 4, 5 };
double mean = Stats.Mean(dataset); // Calculate the mean of the dataset
// mean = 3
~~~
```

### Median(values)

#### Definition

Returns the median of a dataset as a `double`.

#### Arguments

| Type | Name | Meaning |
|---------- |---------- |--------------------------- |
| `List<double>` | `values` | The dataset to calculate. |
| Type | Name | Meaning |
| -------------- | -------- | ------------------------- |
| `List<double>` | `values` | The dataset to calculate. |

#### Exceptions

| Type | Meaning |
|------------------------- |------------------------------------- |
| `ArgumentException` | Thrown if the dataset is empty. |
| Type | Meaning |
| ------------------- | ------------------------------- |
| `ArgumentException` | Thrown if the dataset is empty. |

#### Usage

~~~ c#
```c#
using PeyrSharp.Core.Maths;

List<double> dataset = new List<double> { 1, 2, 3, 4, 5 };
double median = Stats.Median(dataset); // Calculate the median of the dataset
// median = 3
~~~
```

### Mode(values)

#### Definition

Returns the mode of a dataset as a `double`.

#### Arguments

| Type | Name | Meaning |
|---------- |---------- |--------------------------- |
| `List<double>` | `values` | The dataset to calculate. |
| Type | Name | Meaning |
| -------------- | -------- | ------------------------- |
| `List<double>` | `values` | The dataset to calculate. |

#### Exceptions

| Type | Meaning |
|------------------------- |------------------------------------- |
| `ArgumentException` | Thrown if the dataset is empty. |
| Type | Meaning |
| ------------------- | ------------------------------- |
| `ArgumentException` | Thrown if the dataset is empty. |

#### Usage

~~~ c#
```c#
using PeyrSharp.Core.Maths;

List<double> dataset = new List<double> { 1, 2, 3, 3, 3, 4, 5 };
double mode = Stats.Mode(dataset); // Calculate the mode of the dataset
// mode = 3
~~~
```

### Range(numbers)

#### Definition

Calculates the range of a list of `double` numbers.

#### Arguments

| Type | Name | Meaning |
| -------------- | --------- | --------------------------- |
| `List<double>` | `numbers` | The list of double numbers. |

#### Exceptions

| Type | Meaning |
| ------------------- | -------------------------------------- |
| `ArgumentException` | Thrown when the list is null or empty. |

#### Returns

`double` - The range of the list of double numbers.

#### Usage

```c#
using PeyrSharp.Core.Maths;

List<double> numbers = new List<double> { 1.5, 2.6, 3.7, 4.8, 5.9 };
double range = Stats.Range(numbers); // Calculate the range of the list of numbers
// range = 4.4
```

### Variance(values)

#### Definition

Calculates the sample variance of a list of `double` values. Returns the sample variance of the list of `double` values as a `double`.

#### Arguments

| Type | Name | Meaning |
| -------------- | -------- | -------------------------- |
| `List<double>` | `values` | The list of double values. |

#### Exceptions

| Type | Meaning |
| ------------------- | -------------------------------------- |
| `ArgumentException` | Thrown when the list is null or empty. |

#### Usage

```c#
using PeyrSharp.Core.Maths;

List<double> dataset = new List<double> { 1, 2, 3, 4, 5 };
double variance = Stats.Variance(dataset); // Calculate the variance of the dataset
// variance = 2.5
```

### StandardDeviation(values)

#### Definition

Calculates the standard deviation of a list of `double` numbers. Returns the standard deviation of the list of `double` numbers as a `double`.

#### Arguments

| Type | Name | Meaning |
| -------------- | -------- | --------------------------- |
| `List<double>` | `values` | The list of double numbers. |

#### Exceptions

| Type | Meaning |
| ------------------- | -------------------------------------- |
| `ArgumentException` | Thrown when the list is null or empty. |

#### Usage

```c#
using PeyrSharp.Core.Maths;

List<double> dataset = new List<double> { 1, 2, 3, 4, 5 };
double sd = Stats.StandardDeviation(dataset); // Calculate the standard deviation of the dataset
// sd = 1.5811388300841898
```
Loading
Loading