Chi2 comparison of X-Y points and a function (chi2, p-values)
Code: "stat_chi2_p1d.py"
Programming language: Python
DMelt Version 1. Last modified: 12/10/2015. License: Free
http://jwork.org/dmelt/code/cache/stat_chi2_p1d_979.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.



from jhplot  import * 

p=P1D("Data")
p.add(1, 9, 3); p.add(2, 21, 5); p.add(3, 36, 6)
f=F1D('10+x*x*x',1,3)
print p.compareChi2(f)
c=HPlot()
c.visible()
c.setAutoRange()
c.draw(p);  c.draw(f)