Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16478

Re: Part Function

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Part Function
Date 2014-01-24 09:18 +0000
Message-ID <lbtb5n$c8f$1@smc.vnet.net> (permalink)
References <20140123083445.902A469D4@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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@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.
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar


Thread

Re: Part Function Bob Hanlon <hanlonr357@gmail.com> - 2014-01-24 09:18 +0000

csiph-web