Re: System Ax=b!
- To: mathgroup at smc.vnet.net
- Subject: [mg32231] Re: [mg32224] System Ax=b!
- From: BobHanlon at aol.com
- Date: Wed, 9 Jan 2002 03:17:19 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 1/7/02 3:44:05 AM, irc_rebecca at yahoo.com writes:
>I would really be happy, if someone could help me.
>I was trying to write a program in mathematica on how
>to solve the system Ax=b with partial pivoting, where
>A is a three-diagonal matrix(a matrix that only has
>numbers on the main diagonal and on two diagonals that
>are lying on both sides from that main diagonal, every
>other element is 0), but came nowhere.
>That is why it would be nice if someone has any
>suggestions how I could do that.
>I am looking forward on your answer and am thanking
>you in advance!
>
n = 3;
A = Table[If[Abs[i-j]<=1,
ToExpression[
"a" <> ToString[i]<>ToString[j]],
0],{i,n},{j,n}];
x = Table[ToExpression[
"x" <> ToString[i]],{i,n}];
b = Table[ToExpression[
"b" <> ToString[i]],{i,n}];
Solve[A.x==b, x]
Bob Hanlon
Chantilly, VA USA