Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

what is wrong here?




I am having a lot of difficulty in trying to use commands on a matrix as
follows:

matrix[[{i,j,k},{i,j,k}]] = matrix[[{i,j,k},{i,j,k}]] + some 3x3 matrix.

See the example below. When   i,j,k areconsecutive indices, there seems
to   be no problem. When the indices are, say {3,4,7,8},  the program 
always crashes with a  bus error.  

----------------------------------------------------------


supermod 103$ math
Mathematica 3.0 for NEXTSTEP Intel
Copyright 1988-97 Wolfram Research, Inc.
 -- Motif graphics initialized -- 

In[1]:= matrix = Table[a , {i,8},{j,8}]

Out[1]= {{a, a, a, a, a, a, a, a}, {a, a, a, a, a, a, a, a}, 
 
>    {a, a, a, a, a, a, a, a}, {a, a, a, a, a, a, a, a}, 
 
>    {a, a, a, a, a, a, a, a}, {a, a, a, a, a, a, a, a}, 
 
>    {a, a, a, a, a, a, a, a}, {a, a, a, a, a, a, a, a}}

In[2]:= matrix[[{1,2,3,4},{1,2,3,4}]] //MatrixForm

Out[2]//MatrixForm= a   a   a   a

                    a   a   a   a

                    a   a   a   a

                    a   a   a   a

In[3]:= temp=Table[b, {i,4},{j,4}]

Out[3]= {{b, b, b, b}, {b, b, b, b}, {b, b, b, b}, {b, b, b, b}}

In[4]:= matrix[[{1,2,3,4},{1,2,3,4}]] = \ matrix[[{1,2,3,4},{1,2,3,4}]]
+ temp

Out[4]= {{a + b, a + b, a + b, a + b}, {a + b, a + b, a + b, a + b}, 
 
>    {a + b, a + b, a + b, a + b}, {a + b, a + b, a + b, a + b}}

In[5]:= matrix //MatrixForm

Out[5]//MatrixForm= 
 
>   a + b   a + b   a + b   a + b   a       a       a       a

    a + b   a + b   a + b   a + b   a       a       a       a

    a + b   a + b   a + b   a + b   a       a       a       a

    a + b   a + b   a + b   a + b   a       a       a       a

    a       a       a       a       a       a       a       a

    a       a       a       a       a       a       a       a

    a       a       a       a       a       a       a       a

    a       a       a       a       a       a       a       a

In[6]:= matrix = Table[a , {i,8},{j,8}]

Out[6]= {{a, a, a, a, a, a, a, a}, {a, a, a, a, a, a, a, a}, 
 
>    {a, a, a, a, a, a, a, a}, {a, a, a, a, a, a, a, a}, 
 
>    {a, a, a, a, a, a, a, a}, {a, a, a, a, a, a, a, a}, 
 
>    {a, a, a, a, a, a, a, a}, {a, a, a, a, a, a, a, a}}

In[7]:= matrix[[{3,4,7,8},{3,4,7,8}]]= \ matrix[[{3,4,7,8},{3,4,7,8}]] +
temp Bus error
supermod 104$ 


--
Jagannatha Rao				E-mail:rao@uh.edu
Associate Professor
Department of Mechanical Engineering    Tel   :(713) 743-4535 University
of Houston                   Fax   :(713) 743-4503 Houston, TX
77204-4792




  • Prev by Date: Clifford algebra package?
  • Next by Date: Plotting w/o artifacts at discontinuities
  • Prev by thread: Re: Clifford algebra package?
  • Next by thread: Re: what is wrong here?