Ask Your Question

mugiseyebrows's profile - activity

2020-12-28 21:51:58 +0100 received badge  Famous Question (source)
2016-09-01 17:54:02 +0100 received badge  Notable Question (source)
2016-01-04 23:50:23 +0100 received badge  Popular Question (source)
2015-04-05 11:02:17 +0100 received badge  Supporter (source)
2015-04-04 07:36:21 +0100 received badge  Nice Question (source)
2015-04-04 03:07:00 +0100 received badge  Scholar (source)
2015-04-03 16:48:36 +0100 received badge  Student (source)
2015-04-02 22:53:40 +0100 received badge  Editor (source)
2015-04-02 22:44:11 +0100 asked a question find_fit possible bug

find_fit() seems a bit broken to me in sage-6.5 (sage-6.5-x86_64-Linux-Ubuntu_14.04_x86_64.tar.lzma), though it worked in sage-4.8 it has better results then (mean square error 7.8 then, and 12.2 now)

how it works in sage-6.5 (sorry, not enough karma to post images)

how it works in sage-4.8

data = [(0,1),(1,2),(2,3),(3,3),(7,2),(8,5),(9,2),(11,1),(12,2),(13,4),(14,6),(15,11),(16,13),(17,14),(18,13),(19,15),(20,10),(21,3),(22,4),(23,12),(24,17),(25,4),(26,2),(27,5),(28,6),(29,6),(30,5),(31,7),(32,6),(33,2),(34,9),(35,5),(36,1),(37,4),(38,5),(39,1)]
var('a1,b1,c1,a2,b2,c2,x')
model(x) = a1*exp(-((x-b1)/c1)^2) + a2*exp(-((x-b2)/c2)^2)
sol = find_fit(data,model)
show(sol)
f(x) = model(a1=sol[0].rhs(),a2=sol[1].rhs(),b1=sol[2].rhs(),b2=sol[3].rhs(),c1=sol[4].rhs(),c2=sol[5].rhs())
er = sum([pow(f(p[0])-p[1],2) for p in data])/len(data)
show(er)
p2 = scatter_plot(data)
p3 = plot(f(x),(0,40))
p3 + p2

code

sagecloud gives same result as sage-6.5

magic is broken, god must be angry