Demo entry 6320109

qGauss1d

   

Submitted by anonymous on Nov 08, 2016 at 21:15
Language: Python. Code size: 448 Bytes.

from scipy.special import gamma
import numpy as np

def qGauss1d(x,q,b):
    if (q>1 and q<3): 
        Aq = (b*(q-1.)/np.pi)**(.5)*gamma(1./(q-1.))/gamma((1/(q-1))-.5)
        return Aq*(1.+(q-1.)*b*x**2)**(1./(1.-q))
    elif q==1.:
        return (b/np.pi)**(.5)*np.exp(-b*x**2)
    else:
        Aq = (b*(1.-q)/np.pi)**(.5)*gamma((1./(1-q))+1.5)/gamma((1./(1-q))+1.)
        return Aq*np.maximum((1.-(1.-q)*b*x**2),0.)**(1./(1.-q))

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).