Question: "solve" with arbitary number of variables

Hi,

 

  Suppose I have the following code

 

***

f[1]:=x1^2+x2;
f[2]:=-x2^3+x1-2;

solve({f[1], f[2]}, {x1, x2}):
a,b:= eval([x1, x2], %[1])[]:
a, b;

***

 

It could work and give me "1 and -1". 

 

I would like to have a general subroutine, solving f[1]...f[n]. I cannot input  "solve({f[1], f[2],....,f[n]}, {x1, x2}):" just like that. Is ther any way to use "solve" or similar module to handle arbitary number of variables?

Please Wait...