The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Mathematica and Lisp
Replies: 6   Last Post: Mar 7, 2013 3:58 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 6,677
Registered: 2/7/05
Re: Mathematica and Lisp
Posted: Mar 7, 2013 3:58 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.