File:Bounded probability distributions, compared with the normal distribution.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 1,080 × 900 pixels, file size: 46 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
English: ```python

import numpy as np import matplotlib.pyplot as plt

  1. Define the distributions

def n(x):

   return np.exp(-0.5 * x**2) / np.sqrt(2 * np.pi)

def cosine(x):

   scos = 1.0 / np.sqrt(1/3.0 - 2/np.pi**2)
   return np.where(np.abs(x) > scos, 0, (1 + np.cos(x * np.pi / scos)) * 0.5 / scos)

def wigner(x):

   return np.where(np.abs(x) > 2, 0, np.sqrt(4 - x**2) * 0.5 / np.pi)

def uniform(x):

   return np.where(np.abs(x) > np.sqrt(3), 0, 0.5 / np.sqrt(3))
  1. Create x-axis values

x = np.linspace(-4, 4, 200)

  1. Calculate y-axis values for each distribution

y_n = n(x) y_cosine = cosine(x) y_wigner = wigner(x) y_uniform = uniform(x)

  1. Plot the distributions

plt.figure(figsize=(12, 10)) plt.plot(x, y_n, label='Normal (Kurtosis: 0)') plt.plot(x, y_cosine, label='Raised Cosine (Kurtosis: -0.59)') plt.plot(x, y_wigner, label='Wigner Semicircle (Kurtosis: -1)') plt.plot(x, y_uniform, label='Uniform (Kurtosis: -1.2)')

  1. Add legend and labels

plt.legend() plt.xlabel('x') plt.ylabel('Probability Density') plt.title('Some Bounded Distributions')

plt.savefig('some_bounded_distributions.svg')

```
Date
Source Own work
Author Cosmia Nebula

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current21:51, 3 April 2024Thumbnail for version as of 21:51, 3 April 20241,080 × 900 (46 KB)Cosmia Nebula (talk | contribs)Uploaded while editing "Sub-Gaussian distribution" on en.wikipedia.org

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata