1

I'm trying to use powerlaw module for a very simple case and it's not working properly. I read the documentation but didn't understand quite well. Using the code below, I'm getting 8.36310071704202, instead of 0.5, the exponent of my lambda function

import powerlaw
func_powerlaw = lambda x, exp: (x**exp)
xdata = np.linspace(1.0, 10, num_points)
num_points=10
exp=0.5
y=func_powerlaw(xdata,exp)
plt.plot(xdata,y,'bo')
results = powerlaw.Fit(y)
print results.power_law.alpha()
ziulfer
  • 1,339
  • 5
  • 18
  • 30
  • 1
    This module isn't for fitting an exponential function to your x-data. It is for fitting a powerlaw _distribution_ to a given data sample. – cadolphs Dec 14 '19 at 00:02
  • why, do you need a named `lambda` when you can simply do `y = xdata ** exp`? – accdias Dec 14 '19 at 00:03

0 Answers0