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

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 1,080 × 900 pixels, file size: 46 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Desc

    Matplotlib

    import numpy as np
    import matplotlib.pyplot as plt
    
    # 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))
    
    # Create x-axis values
    x = np.linspace(-4, 4, 200)
    
    # Calculate y-axis values for each distribution
    y_n = n(x)
    y_cosine = cosine(x)
    y_wigner = wigner(x)
    y_uniform = uniform(x)
    
    # 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)')
    
    # 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

    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.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    3 April 2024

    image/svg+xml

    46,715 byte

    927785912a503579532d25601cb3465bd974610d

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current22:51, 3 April 2024Thumbnail for version as of 22:51, 3 April 20241,080 × 900 (46 KB)wikimediacommons>Cosmia NebulaUploaded while editing "Sub-Gaussian distribution" on en.wikipedia.org

    There are no pages that use this file.