How to transfer the solve data to another function



?? ???? a e'crit :
> How to transfer the solve data to another function?
>
> Q: f(x)=x^2+ax+b,f(1)=10,f(2)=5, solve f(x)=?
> I want to transfer the data of the solve([eq1,eq2]) to F(a,b) directly,
> don't input F(-8,17) by myself.
>
> How Can I to do?
>
> f(x):=x^2+a*x+b;
> F(a,b):=f(x);
> eq1:f(1)=10;
> eq2:f(2)=5;
> solve([eq1,eq2]);
> F(-8,17);
>
> (%o34) f(x):=x^2+a*x+b
> (%o35) F(a,b):=f(x)
> (%o36) b+a+1=10
> (%o37) b+2*a+4=5
> (%o38) [[b=17,a=-8]]
> (%o39) x^2-8*x+17
>
Hello,

Here is one way to do it :
First get the list of values of a and b in a prescribed order using ev
(solve may randomly give you "a" first or "b" first).
And then "apply" your function F to the list [a,b]

f(x):=x^2+a*x+b;
F(a,b):=f(x);
eq1:f(1)=10;
eq2:f(2)=5;
s:solve([eq1,eq2]);
s:ev([a,b],s);
apply(F,s);

(%o2) f(x):=x^2+a*x+b
(%o3) F(a,b):=f(x)
(%o4) b+a+1 = 10
(%o5) b+2*a+4 = 5
(%o6) [[b = 17,a = -8]]
(%o7) [-8,17]
(%o8) x^2-8*x+17


Eric