Re: Part Function
- To: mathgroup at smc.vnet.net
- Subject: [mg132256] Re: Part Function
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Fri, 24 Jan 2014 04:20:38 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <20140123083445.902A469D4@smc.vnet.net>
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}];
With[{
k = RandomInteger[{1, 96}],
n = RandomInteger[{1, 96}]},
Part[Q1[[k]], n] === Q1[[k]][[n]] === Q1[[k, n]]
]
True
See documentation for Part.
Bob Hanlon
On Thu, Jan 23, 2014 at 3:34 AM, Fred Najmy <fnajmy at gmail.com> 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.
>
>
- References:
- Part Function
- From: Fred Najmy <fnajmy@gmail.com>
- Part Function