Sum[(events[[i]] - f[x, a, b])^2/
  events[[i]], {i, 1, 40}]

I want to minimize X to find the value of a and b. How will i do it?

  • 2
    $\begingroup$ Look at FindFit, NonlinearModelFit, and related functions. $\endgroup$
    – Bob Hanlon
    Commented Aug 31, 2018 at 17:30
  • $\begingroup$ You're not using the usual chi-square statistic. The denominator ought to be the "expected value" which I assume is f[a, a, b] (with the observed counts being events). In other words, what happens when events[[i]] == 0 and f[x, a, b] > 0 ? $\endgroup$
    – JimB
    Commented Sep 13, 2018 at 13:13

1 Answer 1


Do not write the function definition, write the real function and summation would also include x. Then use the function FindMinimum[X,{a,b}]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.