Message Boards Message Boards

0
|
5146 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

A very simple but perplexing result from Mathematica

When I execute the following, the result is obvious and expected:

f [ Graphics@Circle[ ] ]

But when I execute the following, I should obtain the same result but instead get an error:

{Graphics@Circle[ ] } /. List -> f

This is the root of some serious difficulties I am having in more complicated situations.

POSTED BY: David Vasholz
2 Replies

Exploring this using InputForm one discovers that

Circle[] 

evaluates to

Circle[{0, 0}]

so, when you do the List->f replacement this becomes

Circle[f[0, 0]]

however, the first argument of Circle must be a coordinate list pair. Hence, the error message. If f[0,0] were to evaluate to a coordinate list pair then presumably the error would not occur.

POSTED BY: David Reiss

Thank you very much. I forgot my rule could mess things up deep within the expression to which it is applied.

POSTED BY: David Vasholz
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