How is it possible to substitute list of expressions?
For example:
sage: y=[4.0,2.0,5.0,1.0]
sage: x=[1.0,2.0,3.0,4.0]
sage: xy=zip(x,y)
sage: var('a,b,c,d,x')
(a, b, c, d, x)
sage: model(x)=ax^3+bx^2+c*x+d
sage: sol=find_fit(xy,model)
sage: sol
[a == -2.0000000000000031, b == 14.500000000000021, c == -31.500000000000046, d == 23.000000000000028]
Now sol is a list of expressions. How can I substitute it into my model? The only way I found is:
sage: func=model.substitute_expression(sol[0],sol[1],sol[2],sol[3])(x)
sage: func
-2.0000000000000031x^3 + 14.500000000000021x^2 - 31.500000000000046*x + 23.000000000000028
However, the expression like "sol[0],...,sol[3]" seems to be not a good style...
Best regards, Aleksey.