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


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

Re: Mathematica and Lisp

From "Nasser M. Abbasi" <nma@12000.org>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Mathematica and Lisp
Date 2013-03-07 08:58 +0000
Message-ID <kh9kr2$1qg$1@smc.vnet.net> (permalink)
References <kh779n$pvu$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


On 3/6/2013 4:54 AM, Bill Rowe wrote:

> But
> if I had a variable mylist set to {x,y,z}, then I would either
> code the sum as Plus@@myList or Total@myList or Total[myList]
>
> Similarly if I myMatrix were a n x m array and I wanted to
> compute the sum of each row, I might well code this as Plus@@@myMatrix.
>

Nice examples.

I do not use @@@ myself. But interesting that the use
of Total in the matrix case does not follow the example
from the list case:

------- OK -----------------
myList = {1, 2, 3};
Plus  @@ myList
Total @  myList
-----------------------

So, I thought it should then work the same for matrix, I should
remove one "@" for Total compared to the Plus case

------Not OK -------------------
myList = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}
Plus  @@@ myList
Total @@  myList
------------------------------

I need to look more into this to see why it did
not follow the same example for list.

--Nasser

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: Mathematica and Lisp Bill Rowe <readnews@sbcglobal.net> - 2013-03-06 10:54 +0000
  Re: Mathematica and Lisp "Nasser M. Abbasi" <nma@12000.org> - 2013-03-07 08:58 +0000

csiph-web