MathGroup Archive 2014

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

Search the Archive

Re: Part Function

Q1[k, 1] doesn't return anything useful since Q1 is not a function and
[k,1] is the form of an argument to a function.

For a part, you should be using Q1[[k,1]] rather than Q1[k,1].

Q1 = Array[q, {96, 96}];

  k = RandomInteger[{1, 96}],
  n = RandomInteger[{1, 96}]},
 Part[Q1[[k]], n] === Q1[[k]][[n]] === Q1[[k, n]]


See documentation for Part.

Bob Hanlon

On Thu, Jan 23, 2014 at 3:34 AM, Fred Najmy <fnajmy at> wrote:

> I have a Mathematica script containing the following line:
> v[k_] := SetAccuracy(2*(Part[Q1[[k]],1]),45]
> where Q1 is a 96 x 96 matrix.
> Is Part[Q1[[k]],1] the same as Q1[k,1]?  If not, what is it returning?
> Any help appreciated.

  • Prev by Date: Re: Default value in pattern matching
  • Next by Date: Re: Part Function
  • Previous by thread: Part Function
  • Next by thread: Re: Part Function