Skip to content

Commit

Permalink
Merge branch 'main' into sankey
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrocapialbi authored Mar 3, 2025
2 parents 7d76c80 + e44990a commit 8250eed
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
6 changes: 3 additions & 3 deletions content/c-sharp/concepts/data-types/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ Value types are data types that are built-in to C#. The available types and thei
| --------- | ----------------------- | ------------ |
| `bool` | Boolean | 1 byte |
| `byte` | Byte | 1 byte |
| `sbyte` | Short Byte | 1 byte |
| `sbyte` | Signed Byte | 1 byte |
| `char` | Character | 2 bytes |
| `decimal` | Decimal | 16 bytes |
| `double` | Double | 8 bytes |
| `float` | Float | 4 bytes |
| `int` | Integer | 4 bytes |
| `uint` | Unsigned Integer | 4 bytes |
| `nint` | Native Integer | 4 or 8 bytes |
| `unint` | Unsigned Native Integer | 4 or 8 bytes |
| `nuint` | Unsigned Native Integer | 4 or 8 bytes |
| `long` | Long | 8 bytes |
| `ulong` | Unsigned Long | 8 bytes |
| `short` | Short | 2 bytes |
Expand All @@ -51,7 +51,7 @@ float heightOfGiraffe = 908.32f;
int seaLevel = -24;
uint year = 2023u;
nint pagesInBook = 412;
unint milesToNewYork = 2597;
nuint milesToNewYork = 2597;
long circumferenceOfEarth = 25000l;
ulong depthOfOcean = 28000ul;
short tableHeight = 4;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
Title: 'Exponential Distribution'
Description: 'The exponential distribution is a probability distribution often used to model the time between events in a Poisson process.'
Subjects:
- 'Data Science'
- 'Statistics'
Tags:
- 'Data Distributions'
- 'Exponential'
CatalogContent:
- 'learn-data-science'
- 'paths/data-science'
---

The **exponential distribution** models the time between independent events that occur at a fixed average rate. It is frequently used in reliability analysis, queuing theory, and survival analysis. The distribution is defined by a single parameter, the rate λ which determines how quickly events occur.

The exponential distribution formula is given by:

$$f(x|λ) = λ e^{-λ x}$$

- `λ`: The rate parameter that represents the number of events per unit time.
- `x`: A random variable that represents the time between events.

## Example

The example below demonstrates how to generate random samples from an exponential distribution using NumPy and visualize the results with a histogram using Matplotlib:

```python
import numpy as np
import matplotlib.pyplot as plt

# Set the rate parameter (lambda)
rate = 1.5 # Events per unit time

# Generate 1,000 random samples from the exponential distribution
data = np.random.exponential(scale=1/rate, size=1000)

# Plot the histogram of the generated data
plt.hist(data, bins=30, density=True, alpha=0.6, color='teal', edgecolor='black')
plt.title(f"Exponential Distribution (rate = {rate})")
plt.xlabel("Time Between Events")
plt.ylabel("Density")
plt.show()
```

The above code produces the following output:

![The output for the above example](https://raw.githubusercontent.com/Codecademy/docs/main/media/exponential-distribution.png)
1 change: 1 addition & 0 deletions documentation/tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ Visibility
VR
Vue
Web3
Exponential
WebRTC
Weight & Bias
While
Expand Down
Binary file added media/exponential-distribution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8250eed

Please sign in to comment.