Re: Matrix operation
- To: mathgroup at smc.vnet.net
- Subject: [mg125765] Re: Matrix operation
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Sun, 1 Apr 2012 03:38:44 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201203310845.DAA13058@smc.vnet.net>
s1 = {{0, 4, 3, 6, 1, 0, 0, 30},
{0, 6, 16, 8, 0, 1, 0, 256},
{0, 4, 1, 10, 0, 0, 1, 9},
{1, -2, -4, -3, 0, 0, 0, 0}};
s2 = -s1;
s2 = ReplacePart[s2, 4 -> -s1[[4]] - 4 s1[[3]]];
Bob Hanlon
On Sat, Mar 31, 2012 at 4:45 AM, Andrey Demidov
<andrey.demidov at gmail.com> wrote:
> Hi,
>
> I have a matrix:
>
>>> s1 = {{0, 4, 3, 6, 1, 0, 0, 30}, {0, 6, 16, 8, 0, 1, 0, 256}, {0, 4, 1,
> 10, 0, 0, 1, 9}, {1, -2, -4, -3, 0, 0, 0, 0}}
>
>>> MatrixForm[s1]
>
> Now, I need to get another matrix (s2) where:
>
> - s2[i, j] = s1[i, j] where i <> 4
> - s2[i, j] = s1[i, j] + 4 * s1[i - 1, j] where i == 4
>
> What is the best way to get s2 ?
>