How to transformate the value of solve to the others equation?




On Wed, 11 Nov 2009, ? ?? wrote:

< 
< Dear All
< ?1. How to transformate value of solve to the others equation?
< ?
< ?? eq1 and eq2 is group (1)
< ?? eq3 and eq4 is group (2)
< ??
< ??? eq1:x-6y=1??????? eq3:x+y=-6
< ??? eq2:ax-by=1?????? eq4:ax+by=-1
< 
< they have the some solution.? Solving the a=?, b=?
< We have transformate the solution of (eq1 and eq3) into
< (eq2 and eq4) can solve a=?, b=???
< 
< How can I transformate x,y (don't reassign [x,y]:[5,-1])
< into (eq2 and eq4) directly and solve a,b?
< 
< 
< ========code==================
< kill(all);
< powerdisp:true;
< eq1:x-6*y=1;
< eq2:a*x-b*y=1;
< eq3:x+y=-6;
< eq4:a*x+b*y=-1;
< tmp:solve([eq1,eq3]);
< tmp[1][1];
< tmp[1][2];
< 
< /*[x,y]:[-5,-1];*/ /* reassign x=5,y=-1 , for later use */
< eq2(x,y):=a*x-b*y=1;
< eq2(x,y);
< eq4(x,y):=a*x+b*y=-1;
< eq4(x,y);
< so! lve([eq2(x,y),eq4(x,y)]);
< ===============================
< =====running=======
< .....
< (%i6) tmp:solve([eq1,eq3])
< (%o6) [[y=-1,x=-5]]
< (%i7) (tmp[1])[1]
< (%o7) y=-1
< (%i8) (tmp[1])[2]
< (%o8) x=-5
< (%i9) eq2(x,y):=a*x-b*y=1
< (%o9) eq2(x,y):=a*x-b*y=1
< (%i10) eq2(x,y)(%o10) a*x-b*y=1
< (%i11) eq4(x,y):=a*x+b*y=-1
< (%o11) eq4(x,y):=a*x+b*y=-1
< (%i12) eq4(x,y)
< (%o12) a*x+b*y=-1
< (%i13) solve([eq2(x,y),eq4(x,y)])
< More unknowns than equations - `solve'
< Unknowns given :? [y,b,x,a]
< Equations given:? [a*x-b*y=1,a*x+b*y=-1] -- an error.?
< To debug this try debugmode(true);


Adam,
Is this what you want to do?

(%i2) eqs:[x-6*y=1,a*x-b*y=1,x+y=-6,a*x+b*y=-1];

(%o2) [x-6*y = 1,a*x-b*y = 1,y+x = -6,b*y+a*x = -1]
(%i3) solve(eqs,[a,b,x,y]);

(%o3) [[a = 0,b = 1,x = -5,y = -1]]

Leo








< 
< 
< 2. How to reassign one of col of maxtrix?
< ?? we have d is a constant item,?
 
How about

r : 3;
c : 4;
x : genmatrix(lambda([i,j],1/(i+j)),r,c);
k : 2;

for i thru r do x[i,k] : d;

This reassigns the k-th column of x. You can easily write a function
to do this.

Leo
-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.