File:QWeibull pdf.svg

Summary

Description
English: Graph of the q-Weibull pdf
Date
Source Own work
Author Bscan
SVG development
InfoField
Source code
InfoField

Python code

from __future__ import division
import numpy as np
import matplotlib.pyplot as plt

def qexp(x,q):
 
    if q == 1:
        y = np.exp(x)
    else:
        y = (1+(1-q)*x)**(1/(1-q))
     
    y[ 1+(1-q)*x <=0 ] = 0
    
    return y
step = 0.001
X = np.arange(0, 2.5, step)
 
col = {1: 'orange', 2: 'purple', 3: 'lightblue', 4:'pink'}
 
                                                                             
plt.figure(figsize=(4,3.2))
plt.axes([0.17,0.13,0.79,0.8])
plt.hold(True)

A = []
leg_str = []
lvals = [1, 1, 1, 0.5]
qvals = [0, 0, 1, 1.5]
kvals = [1,2,2,1]
for i,q,k,l in zip(range(qvals.__len__()),qvals,kvals,lvals):
    b = 1-(1-q)*(X/l)**k
    P = (2-q)*k/l*(X/l)**(k-1)*qexp(-(X/l)**k,q)
    integral = sum(P)*step
    a, = plt.plot(X, P, '-', color=col[i+1],lw =2.5)
    A.append(a)
    leg_str.append(r"$\kappa={k},q={q},\lambda={l}$".format(k=k, q=q, l=l))
 
 
plt.xlabel("x")
plt.ylabel(r"P(x)")

bx = plt.legend(A, leg_str,numpoints=1, handletextpad=0, loc="upper right")
bx.draw_frame(False)
 
plt.savefig("qWeibull_pdf.svg")

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#QWeibull%20pdf.svgCategory:Self-published work
Category:Q-Weibull distribution
Category:CC-Zero Category:Q-Weibull distribution Category:Self-published work Category:Valid SVG created with Matplotlib code