MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica and Lisp


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



  • Prev by Date: Using NIntegrate in a function
  • Next by Date: Re: Why mathematica can't solve this non linear equation
  • Previous by thread: Re: Mathematica and Lisp
  • Next by thread: Strange behavior of System Modeler