MathGroup Archive 2010

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

Search the Archive

Re: Symplify Table

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109027] Re: Symplify Table
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 11 Apr 2010 04:29:58 -0400 (EDT)

On 4/10/10 at 6:52 AM, ertlejack at sbcglobal.net (John Ertle Jr.)
wrote:

>I want to subtract array A by 1/2 array B and put it in array C.  I
>need something like this except more complicated later.  This is
>what I have thus far:

>C:=C=Simplify[Table[A[i]-1/2*B[i],{i,1,9}]]

The first thing to note is in Mathematica the syntax A[i] does
not refer to the element i of array A. It is a function named A
evaluated at i, much different than an array even though this
notation can sometimes be usefully treated as being element i of
array A.

So, I will first create two arrays

In[3]:= a = RandomInteger[100, {3, 3}];
         b = RandomInteger[10, {3, 3}];

then the third array c is computed simply as:

In[5]:= c = a - 1/2 b

Out[5]= {{99/2, 11/2, -2}, {121/2, 65, 78}, {84, 9/2, 60}}

No need to use Table or Simplify. And note:

In[6]:= ArrayQ[a]

Out[6]= True

But assigning values to d as if it were a 2D array by

In[7]:= Table[d[i, j] = RandomInteger[100], {i, 3}, {j, 3}];
         ArrayQ[d]

gives

Out[8]= False



  • Prev by Date: Re: Symplify Table
  • Next by Date: Re: Root again
  • Previous by thread: Re: Converting the integral of a sum into a sum of integrals
  • Next by thread: Re: Symplify Table