7
$\begingroup$

In Stephen Wolfram's elementary introduction to the wolfram language it says you can use the table function like this: Table[5, 10], to create a table of the element 5 repeated 10 times. This works in WolframCloud but not in Mathematica, at least not Mathematica on the Raspberry Pi which is the version I use because it's free. Is there a way I can make the Table function in Mathematica behave the same as in WolframCloud? At the moment it's throwing me an error saying Table::itform : Argument 10 at position 2 does not have the correct for for an iterator.

Here's Wolfram's introduction: http://wolfram.com/language/elementary-introduction/06-making-tables.html

$\endgroup$
1
  • $\begingroup$ The command Table[5,10] works for me in Mathematica 10.3.1. $\endgroup$
    – M.R.
    Jan 7, 2016 at 3:36

1 Answer 1

10
$\begingroup$

Recently this issue has been discovered for several times in this site, because a new syntax of Table

Table[expr, n]

is added silently in v10.3 and the corresponding old syntax

Table[expr, {imax}]

is no longer mentioned in the document. (Yeah it still works! ) Just compare the first usage information of Table in v10.3 and v10.2 yourself.

Maybe this should be considered as a bug of the document.


As mentioned by george2079 in the comment, the same thing has also happened on Do, in v10.2.

You may want to check the document of Do in v10.2 and v10.1.

Not sure if there're more. BTW, this does not happen on ParallelTable and ParallelDo.


Update

The syntax change of Table and Do has now been documented in v10.4.

$\endgroup$
4
  • $\begingroup$ In my version (V10.0.1 on OS X 10.10.5), Table[expr, 10] ("Argument 10 does not have the correct form for an iterator.") Perhaps this was introduced in 10.1, 2 or 3? $\endgroup$
    – march
    Jan 7, 2016 at 4:29
  • $\begingroup$ @march You're right, according to the legacy document, it's actually added in v10.3. Thanks for pointing out, edited. $\endgroup$
    – xzczd
    Jan 7, 2016 at 5:09
  • 2
    $\begingroup$ oh my think of how much code will break if they drop the old syntax. I see the same change for Do by the way. Anywhere else? $\endgroup$
    – george2079
    Jan 7, 2016 at 14:49
  • $\begingroup$ @george2079 And this actually happens in v10.2. So this syntax of Do isn't as popular as that of Table 囧. $\endgroup$
    – xzczd
    Jan 8, 2016 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.