MathGroup Archive 2006

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

Search the Archive

Re: General--Difficulties in Understanding Mathematica Syntax


In article <ecrbsu$pc5$1 at smc.vnet.net>,
 Bill Rowe <readnewsciv at earthlink.net> wrote:


> lBut the code with Map is simpler since I do not need to worry about 
> indexing. For example, a typical error when coding with For loops to index an 
> array is to be one off, i.e., using say greater as the stopping criteria when 
> it should have been greater than or equal. Since indexing is never explicitly 
> coded with Map, this error cannot happen.

I do agree with the underlying point in this comment.  The gimmick I've 
learned to always use with indexing is more or less the following.  If 
I'm doing a problem that involves say stepping over values of an 
independent variable  x ranging from 0 to xmax -- or more generally from 
xmin to xmax -- I start by defining an x array using

   xArray = Table[x, {xmin, xmax, (xmax-xmin)/nSteps]} ]

and then never touch a specific index or use [[ ]] notation again.  
Plotting of results is done using  

   ListPlot[Transpose[{ xArray, resultArray} ]


  • Prev by Date: Re: Re: Subscript vs SubscriptBox
  • Next by Date: Re: Numerical evaluation is Mathematica bottleneck?!
  • Previous by thread: Re: General--Difficulties in Understanding Mathematica Syntax
  • Next by thread: RE: Re: General--Difficulties in Understanding Mathematica Syntax