0
$\begingroup$
X= 
 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?

$\endgroup$
  • 2
    $\begingroup$ Look at FindFit, NonlinearModelFit, and related functions. $\endgroup$ – Bob Hanlon Aug 31 '18 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 Sep 13 '18 at 13:13
0
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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