Function defined correctly?

The built-in range function doesn’t support the multiplication operation. Instead you want to use a numpy array, which you can create in this case by using the arange() function.

import numpy as np
import matplotlib.pyplot as plt

def pdf(gamma, d, r, t, D): 
    return (1 / np.power(dispersion(gamma, d, t, D), (d / 2))) * np.exp((-A(gamma, d) * np.power((r / np.sqrt(g(gamma, d))), gamma)) + B(gamma, d))

r = np.arange(100)
t = np.arange(1000)
gamma = 2
d = 1
D = 2
p = pdf(gamma, d, r, t, D)
plt.plot(r, p)
plt.show()

Leave a Comment