The Levy Distribution

The plot above shows several Levy distributions using formulas provided in the Wikipedia article about them.

Its fairly easy to make function plots like this. Use the Tools | “Generate a reference table…” to generate x values:

then use ALTER, UPDATE and the MySQL Mathematical Functions to add a column and fill it in with function values:

    ALTER TABLE ref1
        ADD COLUMN y double;

    SET @c = 1.0;
    UPDATE ref1
        SET y = SQRT(@c / (PI() * 2.0))
            * (EXP(-@c/ (2.0 * x)))
            / (POW(x, 1.5 )) ;

Finally, do the plot:

    PLOT SCATTER
        X, RED LINE, DARK GREEN LINE, BLUE LINE
      WITH
        TITLE "Levy Distributions"
        SCALE Y 0 1.0 0.25
        FORMAT Y DECIMAL "#.##"

        SCALE Y2 0 1.0 0.25
        NO LABELS Y2
        TICKS X2 LEFT

        SCALE X 0 3.0 1.0
        SCALE X2 0 3.0 1.0
        NO LABELS X2
        TICKS X2 BOTTOM
        LIGHT GRAY GRID LINES
        LEGEND BOTTOM
    SELECT
        x,
        y AS "c = 0.5",
        y2 AS "c = 1.0",
        y3 AS "c = 2.0"
        FROM ref1;

Comments are closed.