1

I have some discrete data of the beta spectrum of Bismuth-210, which I would like to try to fit a continuous PDF to so I can improve the accuracy of a simulation I'm building. Is there anything in Python that allows me to input discrete PDF data and output a function for a continuous distribution? I'm looking to be able to derive a mathematical function, i.e. f(x)= ax+b (obviously not actually of this form, but you get the point). I haven't been able to try too much because I'm so lost as to where to start, but I tried creating a piecewise function of the data, which is not sufficiently smooth (nor succinct) for my purposes.

  • Possible duplicate of https://stackoverflow.com/questions/19165259/python-numpy-scipy-curve-fitting – ivan_pozdeev Apr 18 '19 at 23:24
  • I'm not looking for a polynomial fit, it'd be more like a continuous distribution function. That polynomial example I gave in the question statement was just a placeholder to show I'm just looking for a function of a single variable – Adam Tidball Apr 19 '19 at 02:51
  • `curve_fit` takes an arbitrary function. – ivan_pozdeev Apr 19 '19 at 04:06
  • Also see https://en.wikipedia.org/wiki/Probability_distribution_fitting for what other math methods you may be interested in. I'm sure `scipy` has at least some of them. – ivan_pozdeev Apr 19 '19 at 04:09
  • The problem is I don't know what form the function is supposed to take, so I can't give a function to base it off of. – Adam Tidball Apr 19 '19 at 19:27
  • When fitting a curve, you deduce the probable kind of the function (from theory, perhaps). Then, for terms that don't correlate with the data, the least squares method (I'm not familiar with others) will produce very small coefficients compared to the terms that do. Then, if the approximation is not good enough, you can try another function kind using that information (for applied physics, you need to ensure it has physical sense, of course). – ivan_pozdeev Apr 19 '19 at 20:44
  • https://www.google.com/search?q=scipy+probability+distribution+fitting+site:stackoverflow.com has a few other relevant questions. – ivan_pozdeev Apr 19 '19 at 20:45
  • @ivan_pozdeev Ok I think I get what you're saying now. Thank you! This should help a lot – Adam Tidball Apr 19 '19 at 22:59

0 Answers0