Message Boards Message Boards

0
|
4347 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

How do I compare the output of a cell to a desired result?

Posted 10 years ago

I want to be able to have my students work through questions in a Mathematica notebook and then run a piece of code that compares their solutions to what I want.

I thought along these lines:

NotebookLocate["Q18a"]; SelectionEvaluate[EvaluationNotebook[]];
If[% == 47/12 - 3/2(x + 25/6)^2,"CORRECT", "WRONG"]

Q18a is a Cell Tag for the cell the answer is in. The cell gets evaluated and then the last evaluation (the cell) is compared to the answer. But I keep getting responses like this as the output:

If[Null==47/12 - 3/2(x + 25/6)^2,CORRECT,WRONG]

Anyone able to fix or suggest a better way?

Thanks in advance.

POSTED BY: Miles Ford
Attachments:
POSTED BY: David Reiss
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