Group Abstract Group Abstract

Message Boards Message Boards

0
|
7K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to stop evaluation of an expression after pattern replacement?

Posted 11 years ago
POSTED BY: joseph pantina
2 Replies
Posted 11 years ago

Thanks Eric,

I had noticed that would be a possible solution when I saw the full form of the trace cause it wasnt type setting correctly in the post, but didn't try it until a few minutes after I posted.

Now I am just wondering on the proper pattern matching for things such as the derivative of a function. Whether or not they should be expanded to full-form or if there is a pattern to match the the "short" form such as y'[x]?

Joe

POSTED BY: joseph pantina

Hi Joseph,

Try using HoldForm instead of Hold. "HoldForm[expr] prints as the expression expr, with expr maintained in an unevaluated form."

In[208]:= y=x^2
Out[208]= x^2
In[216]:= y/.x->HoldForm[2]
Out[216]= 2^2

Eric

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