1 | initial version |
You should do
sage: a,b = var('a', 'b')
sage: modelo(x) = a*x+b
sage: print modelo
x |--> a*x + b
sage: d = find_fit(dados, modelo, solution_dict=True)
sage: print d
{b: -0.1757321718542446, a: 0.4599622663189693}
sage: modelo2 = modelo.subs(d)
sage: print modelo2
x |--> 0.4599622663189693*x - 0.1757321718542446
sage: point(dados,color = "red",size=20,legend_label="pontos coletados") + plot(modelo2,(x,0,3))
In your code, the variable does not get substituted as expected. You can see it by printing what is modelo.