Ask Your Question

Revision history [back]

    mydata = [[1,3],[2,7],[3,13],[4,24]]
    var('a,b,c')
    mymodel(x) = a*x^2 + b*x + c 
    myfit = find_fit(mydata,mymodel,solution_dict=True)
    myfit
    points(mydata,color='purple') + plot(
      mymodel(
        a=myfit[a],
        b=myfit[b],
        c=myfit[c]
        ), 
        (x,0,4,),
        color='red'
      )