Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.4K Views
|
9 Replies
|
1 Total Like
View groups...
Share
Share this post:

Make a list for numbers up to 20 in which each element is a column of the values

Posted 1 year ago

I'm working through the exercise questions for the language intro course and on question 6.11 it asks, "Make a list for numbers up to 20 in which each element is a column of the values of n, n^2, and n^3."

I thought this would work but its wrong. Look at the expected result shows only the second row is enclosed in squiggly brackets (see picture).

Column[{Range[20],Range[20]^2, Range[20]^3}]

I'm not sure what I'm misunderstanding about this question.

Thanks in advance.

Attachments:
POSTED BY: Steve Ruzila
9 Replies
Posted 1 year ago

the expected result shows only the second row is enclosed in squiggly brackets

No, that's not what it's showing. That's just an effect of the display. There is one overall List, and it contains 20 Columns. And each Column contains one List, and each of those Lists in turn contain three Integers.

Your code produces one Column that contains one List which in turn contains three Lists and each of those contains 20 Integers.

POSTED BY: Eric Rimbey
Posted 1 year ago

I get what you're saying but I have no clue on how to do it. It's not a required question to answer for the course bu I'd like to know what the answer is so i can understand the logic. I've looked the documentation page but it's so minimal and I can't find any examples to help me.

POSTED BY: Steve Ruzila
Posted 1 year ago

Okay, the section is on Tables, so I assume we want to use Table rather than threading or any other "fancy" stuff. The result should be a List of 20 Columns, so the general shape of the code will be something like this:

Table[Column[ ...], {i, ...}]

We can fill in the iterator bounds easily (it's 20):

Table[Column[ ...], {i, 20}]

Each Column should have a list like {n, n^2, n^3}. I used i for my iterator, so

Table[Column[{i, i^2, i^3}], {i, 20}]

For what it's worth, Column is kind of a weird thing to use here without any contextual justification. Not sure why they would expect you to use column, but it does make the problem a bit confusing, in my opinion.

POSTED BY: Eric Rimbey
Posted 1 year ago

Thank you so much! I see the logic now...I was way off. I really like Wolfram, but they REALLY need better examples in the documentation. Yes, i totally agree that exercise was odd. Not sure what you'd use that for. Thanks again!

POSTED BY: Steve Ruzila
Posted 1 year ago

So, this kind of complaint about Wolfram documentation is very common for people new to the language. I always find this amazing, because Wolfram documentation is literally the best of any I've every seen before. I mean literally, and by a huge margin. Of course, I haven't seen everything, so your mileage may vary.

The question is why do newcomers feel this way? I think that it's just a choice that Wolfram made to make documentation most usable "in the long run", i.e. they don't really target Mathematica novices. You'll only be a true novice for a short period of time if you stick with the language. At some point, you'll start seeing the patterns, you'll know what to expect, you'll know how to find connections, you'll be able to guess at options and variants, and you'll just start grokking the jargon. Right now you feel like you need better examples, but after a bit, you'll realize that the examples you used to want are completely superfluous. Right now you're probably thinking "why can't they just explain it in plain terms?", but after a bit you'll realize that the explanations are actually incredibly rich and use consistent patterns--they are in fact very clear if not "plain" to the uninitiated.

POSTED BY: Eric Rimbey
Posted 1 year ago

The issue is that the documentation is written by people who know the language for people who also know the language. This is fine ONCE you've learned it, but is brutal for newcomers. It's a barrier to actually learning it. So even though it seems obvious to someone who knows it, for the rest of us it's quite obtuse and frustrating...especially in an Introduction class where the most basic uses are shown and then we're supposed to magically be able to extrapolate to harder things. You don't teach by going from step 1 to step 5 and have people have to struggle with figuring out the middle. You have to show them those intermediate steps. Sadly it's a common failure with a large number of learning systems because people who are teaching the material KNOW the material and fail to take into account that new comers don't have the corpus of knowledge the instructor has to easily make those jumps in logic/steps so easily.

POSTED BY: Steve Ruzila
Posted 1 year ago

Yes, I tend to agree. I was trying to make a similar point. But I'm trying to put an optimistic spin on it. If you can get through the learning curve of a few weeks, your productivity will start on an exponential climb.

POSTED BY: Eric Rimbey

You are supposed to make a list of columns, not a column of lists. Try again.

POSTED BY: Gianluca Gorni
Posted 1 year ago

I'm not understanding the difference though I know there is one.

POSTED BY: Steve Ruzila
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard