#6) (p196 #17) CBL estimate of g
#find and graph power regression y=f(x): [y]=height ball falls in feet vs. [x]=time of fall in seconds
var('a,b')
l=[[1.003,16],[1.365,30],[1.769,50],[2.093,70],[2.238,80]]
f(x)=a*x^b
q=find_fit(l,f,solution_dict=True)
show(q[a])
show(q[b])
show(f(a=q[a],b=q[b]))
show(points(l,color='blue')+plot(f(a=q[a],b=q[b]),(x,0,3),color='red')+plot(100,0,3,color='green'))
#f(x) should equal 0.5*g*x^2, estimate g in ft/sec/sec
f(x)=q[a]*x^q[b]
show(f(x))
show(q[a]*2)