Question: two problems with "solve" output

Hi to everybody. Im trying to use "solve" to find the coefficient that solve a set of equations(a set of polynomials).
 

> restart;
> with(linalg):
> with(codegen):
> M:=3;
> np:=(M+1)*(M+2)/2;  

>
> XX:= vector([0, 1/3, 2/3, 1, 0, 1/2, 1, 0, 1, .5]):
> TT:=vector([0, 0, 0, 0, 1/3, 1/3, 1/3, 2/3, 2/3, 1]):
> polin:=unapply(a[1]+a[2]*t+a[3]*t^2+a[4]*t^3+a[5]*x+a[6]*x*t+a[7]*x*t^2+a[8]*x^2+a[9]*x^2*t+a[10]*x^3,x,t):
>  a := vector((M+1)*(M+2)/2);
>
> eq:=vector(np);
> for i from 1 to np do;
>   if i=1 then
>     eq[i]:= polin(XX[i],TT[i])=1;
>   else
>     eq[i]:= polin(XX[i],TT[i])=0;
>   end if;
>   #print(eq[i]);
> od;
> sol:=solve(convert(eq, list),convert(a, list)):
> base[i]:=eval(polin(x,t),sol[1]);
 

I have 2 problem:

1) the result for coefficients "a" is provided as floating points!! Its weird since they are fractions and they should be provided exactly. do you know why?I need them as fractions.

2) minor problem. It s not clear to me how to pass a list. i use:
convert(eq, list)
but it gives me back an array 1x1 (i.e. sol) that contains the array that i want. there is another way to pass a set of equations?i would like a general procedure for whatever number of equations.I tried also convert(eq, set) but does not work. 

thanks so much for any help

alberto

Please Wait...