Re: thanks for the help with list - extended syntax question
- To: mathgroup at smc.vnet.net
- Subject: [mg40648] Re: thanks for the help with list - extended syntax question
- From: atelesforos at hotmail.com (Orestis Vantzos)
- Date: Sat, 12 Apr 2003 03:09:01 -0400 (EDT)
- References: <b75mvb$24v$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Just because the scientific world was brainwashed with FORTRAN it doesn't mean we can't look for something better! As a mathematician I don't want to think about loops; they are not a mathematical concept per se. When I see a sum like the one you posted...well it's obviously an inner product. I don't see a for-loop! Transposing the initial matrix will give me the proper vectors and then it's just a matter of applying Inner on that matrix. So: Inner@@Transpose[data] Let vectors be vectors; that is the reason we invented Linear Algebra after all. Why splice them up and mess around with indices and temporary variables? It's not that you have to learn a new computer language; it's just that you have to relearn how to use the (old) mathematical one... Orestis "Nathan Moore" <nmoore at physics.umn.edu> wrote in message news:<b75mvb$24v$1 at smc.vnet.net>... > Why is it in Mathematica that I can't operate on lists as if they are long > arrays(in the style of c) It would be orders of magnitude easier or me to > just type, > data = {{x1,y1},{x2,y2}...{xn,yn}} > and then find the desited sum like, > for(i=0,sum=0;i<;i++) { sum += data[[i,1]]*data[[i,2]]; } > > It seems idiotic that syntax like this (which most of the scientific world > would understand) is not allowed! I hate learning new (redundant) computer > languages!!! > > Nathan