File:C-transformation of a gaussian curve.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 864 × 576 pixels, file size: 5.22 MB)

    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:

    Matplotlib code

    import numpy as np
    import matplotlib.pyplot as plt
    
    def psi_flipped(x):
        return np.exp(-x**2)
    
    def weird_cost(y_grid, x_center):
        diff = np.abs(y_grid - x_center)
        s = 2 * (np.cos(3 * x_center) + 1)
        c = s * diff**2 + (4 - s) * diff**4
        return c
    
    xlims = (-1.5, 1.5)
    ylims = (0.1, 1)
    
    xs = np.linspace(xlims[0], xlims[1], 1000)
    ys = psi_flipped(xs)
    
    randxs = np.linspace(xlims[0], xlims[1], 100)
    randys = psi_flipped(randxs)
    
    y_fill_top = 7.5 
    
    fig, ax = plt.subplots(figsize=(9, 6), dpi=150)
    
    for x0, y0 in zip(randxs, randys):
        cost_ys = y0 + weird_cost(xs, x0)
        
        ax.plot(xs, cost_ys, color='forestgreen', linewidth=0.8, alpha=0.6)
        
        ax.fill_between(xs, cost_ys, y_fill_top, color='forestgreen', alpha=0.02, linewidth=0)
    
    ax.plot(xs, ys, color='#0088CC', linewidth=1.5, zorder=5)
    
    ax.scatter(randxs, randys, color='#D6604D', edgecolors='black', s=40, zorder=6, linewidth=0.8)
    
    ax.set_xlim(xlims)
    ax.set_ylim(ylims)
    
    ax.spines['top'].set_visible(False)
    ax.spines['right'].set_visible(False)
    
    ax.grid(True, which='both', linestyle='-', linewidth=0.5, color='gray', alpha=0.15)
    
    ax.tick_params(direction='in', length=4)
    
    plt.tight_layout()
    plt.savefig('c-transformation of a gaussian curve.svg')
    
    plt.show()
    

    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

    5,474,585 byte

    image/svg+xml

    7bf399309f4640d2101dba83128e9ebbc27f7881

    19 November 2025

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current05:18, 20 November 2025Thumbnail for version as of 05:18, 20 November 2025864 × 576 (5.22 MB)wikimediacommons>Cosmia NebulaUploaded while editing "Transportation theory (mathematics)" on en.wikipedia.org

    There are no pages that use this file.