Message Boards Message Boards

1
|
6406 Views
|
11 Replies
|
18 Total Likes
View groups...
Share
Share this post:
GROUPS:

theoretical mathematica question

Posted 9 years ago

Hi folks.

I am doing a university unit this semester which briefly covers Mathematica(2 weeks) and the rest is Matlab(10 weeks). Anyway, the lecturer has given us some past exam papers to do. One of the questions is:

Which of the following statements about Mathematica Notebook is true: A) A notebook is the only way to execute Mathematica functions B) Each cell in the notebook has its own namespace C) Everything in the notebook is an expression D) %% is used to add comments in a notebook.

I know D is wrong, since " (* " is used to comment. I believe C is true, but I don't know about A & B?

For this unit,we only learnt basic commands like Plot and Solve etc, not any theory about Mathematica. However they might have spend more time on Mathematica in the past years, and hence the past exams have these types of questions. I certainly don't recall learning anything about namespace or how else functions can be calculated outside of a notebook.

Any help would be appreciated. Thanks in advance.

POSTED BY: D P
11 Replies

It's a "teachable moment" ;-)

POSTED BY: David Reiss

Truth be told, I've never encountered a moment I could teach anything. I once thought I was getting somewhere with a moment of inertia but then it just sort of spun off.

POSTED BY: Daniel Lichtblau

Alas, it would have been a momentous occasion.

POSTED BY: David Reiss

(Do you really first moment that?)

I can of course do much worse: "Kurt owes his sister five dollars after losing a bet that he couldn't name the fourth moment in a distribution"

POSTED BY: Daniel Lichtblau

Do you really mean that? I feel skewered.

POSTED BY: David Reiss

It's worth adding that since everything is an expression then a notebook can be set up where each cell has its own namespace though this is not the default. (not something you'd cover in a 2 week course though!) The Option to the Cell expression that can do this is CellContext. For example, execute the following in a notebook to create a Cell with a unique context to that cell.

CellPrint@ExpressionCell[Defer[f = 9], "Input", CellContext -> Cell]
POSTED BY: David Reiss

Hi David, you made a good point: There is no definite answer! For me this is another confirmation on how stupid those questions are!

POSTED BY: Henrik Schachner

Hi D.P.,

this is not the place where homework questions are answered - usually! But in case of stupid questions and stupid course concepts help is in order!

  • A: False, because you can run scripts;
  • B: Wrong!
  • C: True - because everything is an expression!
  • D: Wrong - because %% is the penultimate result;

Just as a reserved advice: Try to learn Mathematica on your own and (at least as a start) for its own sake; it is definitely worth the effort! And: Mathematica has a high degree of consistency and beauty and is by no means as ugly as those courses with those questions typically imply! What a sad thing!

Regards -- Henrik

POSTED BY: Henrik Schachner
Posted 9 years ago

Thanks for the reply. Very much appreciated.

Below is the second and very last question I will ask from the past the past exam papers. These past exam papers aren't homework. The lecturer gave us these past exam papers to practice for the exam on Friday. There are no more assessments this late in the semester, with the exam only a day away(and then university is finished for the year). So you aren't doing my homework for me. :)

In the following Mathematica expression, A[B[C]]]

Which of the following scenarios is possible?

A) A is a function, B is a function and C is an integer. B) A is a function, B is a list and C is a list C) A is a list, B is a list and C is an integer D) A is a list, B is a function and C is a list

I think A is correct, since it is possible to have nested function, and the innermost function takes a value ie. an integer. But we haven't learnt this sort of content this semester, so I really have no idea.

POSTED BY: D P

The answer to the new question is (A). Or rather, that's what the professor wants to see. The problem is that the prof does not seem to really get the structure of Mathematica, and is more or less imposing a mental picture based on knowledge of other languages. The idea seems to be that single brackets denote "application of a function" and double brackets denote "part(s) of a list or list-like thing". As an approximation to the underlying structure of Mathematica this has some merit. But it is far from the full picture (which is better captured by what was already stated: "everything is an expression").

I should say that I don't really object to this because profs have their varying areas of expertise, and throwing two weeks of Mathematica into a larger course means there is some likelihood the instructor may not have much expertise on that particular unit. What does seem bothersome is the misdirected emphases in regard to Mathematica that are appearing on the exams.

POSTED BY: Daniel Lichtblau
Posted 9 years ago

Thank you very much. :)

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

Group Abstract Group Abstract