File:BesselProcess1D.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 720 × 540 pixels, file size: 11.75 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: Bessel processes with three different dimensions.
    Date
    Source Own work
    Author Shiyu Ji
    SVG development
    InfoField
     The SVG code is valid.
     This oversized plot was created with Matplotlib.

    Python/Matplotlib Code

    # A realization of 1D Bessel process with n = 3, 10, 20 and time step dt = .0001
    
    import matplotlib.pyplot as pl
    import numpy as np
    import matplotlib.patches as mpatches
    
    t0 = 0.0
    dt = 0.0001
    t_final = 2.0
    T = np.arange(t0, t_final, dt)
    ax = pl.figure().add_subplot(111)
    ax.set_xlabel('t')
    ax.set_ylabel('X')
    
    def realize(ax, n, color):
        B = [0.0 for _ in range(n)]
        np.random.seed(1)
    
        for t in T:
            old_value = np.sqrt(sum([x*x for x in B]))
            for i in range(len(B)):
                B[i] += np.random.normal(0, dt)
            new_value = np.sqrt(sum([x*x for x in B]))
            ax.plot([t, t+dt], [old_value, new_value], color, linewidth=0.5)
    
    realize(ax, 3, 'b-')
    realize(ax, 10, 'r-')
    realize(ax, 20, 'g-')
    
    bluePatch = mpatches.Patch(color='blue', label='$n = 3$')
    redPatch = mpatches.Patch(color='red', label='$n = 10$')
    greenPatch = mpatches.Patch(color='green', label='$n = 20$')
    pl.legend(handles = [bluePatch, redPatch, greenPatch], loc=2)
    
    pl.show()
    

    Licensing

    Shiyu Ji, the copyright holder of this work, hereby publishes 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.
    Attribution:
    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

    13 November 2016

    image/svg+xml

    1e719e47b47326381348299f3f4f8995c6a1b804

    12,318,976 byte

    540 pixel

    720 pixel

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current10:06, 13 November 2016Thumbnail for version as of 10:06, 13 November 2016720 × 540 (11.75 MB)wikimediacommons>Shiyu Jiadd the legend

    There are no pages that use this file.