Re: [Jprogramming] Different result of mean for row and column vectors

2020-04-16 Thread Raul Miller
That said, note that +/"1 does "lose" the last dimension. Thanks, -- Raul On Thu, Apr 16, 2020 at 5:30 PM Mike Powell wrote: > > Of course. (A place where J and APL differ.) > Thanks Jan-Pieter. > > Mike > > > On Apr 16, 2020, at 12:00, Jan-Pieter Jacobs > > wrote: > > > > Actually, the dime

Re: [Jprogramming] Different result of mean for row and column vectors

2020-04-16 Thread Mike Powell
Of course. (A place where J and APL differ.) Thanks Jan-Pieter. Mike > On Apr 16, 2020, at 12:00, Jan-Pieter Jacobs > wrote: > > Actually, the dimension lost is the first, as insert [0] (u/) inserts u > between the items [1]. > > Demonstration: > > $ foo =: i. 2 3 4 > 2 3 4 > $ +/ foo >

Re: [Jprogramming] Different result of mean for row and column vectors

2020-04-16 Thread Jan-Pieter Jacobs
Actually, the dimension lost is the first, as insert [0] (u/) inserts u between the items [1]. Demonstration: $ foo =: i. 2 3 4 2 3 4 $ +/ foo 3 4 [0]: https://code.jsoftware.com/wiki/Vocabulary/slash [1]: https://code.jsoftware.com/wiki/Vocabulary/AET#Item Cheers, Jan-Pieter Op wo 15 a

Re: [Jprogramming] Different result of mean for row and column vectors

2020-04-16 Thread Thomas Bulka
Am 15.04.2020 20:54 schrieb Mike Powell: Thomas, I J there is not really anything for a column vector. If an object, like your rvec, has a single dimension it’s a vector. If it has two dimensions, as does cvec, it’s a matrix. That’s different from most conventional mathematical notation. When y

Re: [Jprogramming] Different result of mean for row and column vectors

2020-04-15 Thread Skip Cave
i.3 3 0 1 2 3 4 5 6 7 8 mean i.3 3 3 4 5 |: i.3 3 NB. Transpose 0 3 6 1 4 7 2 5 8 mean |: i.3 3 NB. Now you can get the means of what used to be columns. 1 4 7 mean "1 i.3 3 NB. Another way to operate on columns, without transposing the array. 1 4 7 Skip Skip Cave Cave Consulting L

Re: [Jprogramming] Different result of mean for row and column vectors

2020-04-15 Thread Mike Powell
Thomas, I J there is not really anything for a column vector. If an object, like your rvec, has a single dimension it’s a vector. If it has two dimensions, as does cvec, it’s a matrix. That’s different from most conventional mathematical notation. When you do the summation with +/ you lose a d

Re: [Jprogramming] Different result of mean for row and column vectors

2020-04-15 Thread Thomas Bulka
Am 15.04.2020 19:50 schrieb 'Pascal Jasmin' via Programming: sum (insert) and count apply to items.  The items are the rows. +/ 3 2 $ 1 2 3 6 6 the result is a list.  If there is just 1 column (one result), it is still a list. Thanks everyone! I think, I got it... Kind regards, Thomas --

Re: [Jprogramming] Different result of mean for row and column vectors

2020-04-15 Thread Hauke Rehr
In other words, there is no such thing as a “column vector.” It’s a matrix with “dimension“ 2. A better way to phrase this is “has 2 axes” or, in J lingo, as Don Guinn said, it’s about ranks. You said rvec =: 1 2 3 rather than rvec =: 1 3 $ 1 2 3 but with cvec you told j to build a matrix aka ran

Re: [Jprogramming] Different result of mean for row and column vectors

2020-04-15 Thread 'Pascal Jasmin' via Programming
sum (insert) and count apply to items.  The items are the rows. +/ 3 2 $ 1 2 3 6 6 the result is a list.  If there is just 1 column (one result), it is still a list. On Wednesday, April 15, 2020, 01:33:35 p.m. EDT, Thomas Bulka wrote: Hello everyone, I do have some difficulties in

Re: [Jprogramming] Different result of mean for row and column vectors

2020-04-15 Thread Don Guinn
The rank is reduced by one. So the rank 2 is reduced to one. On Wed, Apr 15, 2020, 11:33 AM Thomas Bulka wrote: > Hello everyone, > > I do have some difficulties in understanding a certain behavior. Let's > assume, I define the classical mean verb, a row vector and a column > vector: > > mean =:

[Jprogramming] Different result of mean for row and column vectors

2020-04-15 Thread Thomas Bulka
Hello everyone, I do have some difficulties in understanding a certain behavior. Let's assume, I define the classical mean verb, a row vector and a column vector: mean =: +/ % # rvec =: 1 2 3 cvec =: 3 1 $ 1 2 3 When I apply mean to rvec I get the result 2 (as expected), which happens to be