Group Abstract Group Abstract

Message Boards Message Boards

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

How to stop evaluation of an expression after pattern replacement?

Posted 10 years ago
POSTED BY: joseph pantina
2 Replies
Posted 10 years ago
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