Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Range[imin,imax,di]; was it better in 3.0 than in 4.0 ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19584] Re: Range[imin,imax,di]; was it better in 3.0 than in 4.0 ?
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sat, 4 Sep 1999 01:34:23 -0400
  • References: <7qkqqn$h4p@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Ersek, Ted R <ErsekTR at navair.navy.mil> wrote in message
news:7qkqqn$h4p at smc.vnet.net...
> Range[imin,imax,di] had an interesting capability in version 3.0, but the
> capability is gone in version 4.0.
>
> --------------------------------
> Using version 3.0:
>
> In[1]:=
> Range[a,a+12 n, 2n]
>
> Out[1]=
> {a,a+2 n,a+4 n,a+6 n,a+8 n,a+10 n,a+12 n}
>
> -----------------------------------------------
>
> I thought that was rather nice, but using version 4.0 we get:
>
>
> In[1]:=
> Range[a,a+12 n,2n]
>
> Range::range: Range specification in Range[a,a+12 n,2 n] is not a
> machine-size integer.
>
> Out[1]=
> Range[a,a+12 n,2 n]
>
>
> Now contrary to what the message above suggests, Range doesn't need
Integer
> arguments.  Both version 3 and version 4 give the same result in the
> following example.
>
>
> In[2]:=
> Clear[x];
> Range[x- Pi, x+ Pi, E]
>
> Out[2]=
> {-Pi + x, E - Pi + x, 2*E - Pi + x}
>
>
> --------------------
> Regards,
> Ted Ersek
>
> For Mathematica tips, tricks see
> http://www.dot.net.au/~elisha/ersek/Tricks.html
>
>

Ted,
I miss this also.
It seems rather odd that nevertheless we have
Range[a, a + 4  n, n]

{a, a + n, a + 2 n, a + 3 n, a + 4 n}

And, Sum behaves as in 3.x:

Sum[x, {x, a, a + 4n, 2n}]

3 a + 6 n


But Table, Product and Do do not behave this way:

Table[x, {x, a, a + 4n, 2n}]

Table::"iterb": "Iterator \!\({x, a, \(\(a + \(\(4\\ n\)\)\)\), \(\(2\\ \
n\)\)}\) does not have appropriate bounds."

Table[x, {x, a, a + 4 n, 2 n}]

Table[x, {x, a, a + 4n, n}]

{a, a + n, a + 2 n, a + 3 n, a + 4 n}

Product[x, {x, a, a + 4n, 2n}]

Product[x, {x, a, a + 4 n, 2 n}]

Product[x, {x, a, a + 4n, n}]

a (a + n) (a + 2 n) (a + 3 n) (a + 4 n)

Do[Print[x], {x, a, a + 4n, 2n}]

Do::"iterb": "Iterator \!\({x, a, \(\(a + \(\(4\\ n\)\)\)\), \(\(2\\
n\)\)}\) \
does not have appropriate bounds."

Do[Print[x], {x, a, a + 4 n, 2 n}]

Do[Print[x], {x, a, a + 4n, n}]

a

a + n

a + 2 n

a + 3 n

a + 4 n





  • Prev by Date: Re: Re: Numbers problem
  • Next by Date: Re: About stochastic differential equations
  • Previous by thread: Re: Range[imin,imax,di]; was it better in 3.0 than in 4.0 ?
  • Next by thread: strict inequalities