Re: Matrix operation

• To: mathgroup at smc.vnet.net
• Subject: [mg125759] Re: Matrix operation
• From: Bill Rowe <readnews at sbcglobal.net>
• Date: Sun, 1 Apr 2012 03:36:09 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```On 3/31/12 at 3:45 AM, andrey.demidov at gmail.com (Andrey Demidov)
wrote:

>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 ?

Best depends on what criteria you use to define best. Meanwhile,
here is one way to do what you want

In[3]:= Join[Most@s1, {Transpose[s1[[-2 ;;]]].{1, 4}}]

Out[3]= {{0, 4, 3, 6, 1, 0, 0, 30}, {0, 6, 16, 8, 0, 1, 0, 256},
{0, 4, 1, 10, 0, 0, 1, 9}, {4, -4, -15, -2, 0, 0, 1, 9}}

```

• Prev by Date: Re: simplify Arg[E^(I x)]?
• Next by Date: Re: Matrix operation
• Previous by thread: Re: Simple Graph plot question
• Next by thread: Re: Matrix operation