0
$\begingroup$

I want this function

PrintEvalExpr[Sin[Pi/2]]

Which outputs

Sin[Pi/2] == 1

I can either not evaluate, or evaluate but not at the same time, how do I combine them? My attempt would be something like

PrintEvalExpr[x_]:=Hold[x]==x

Except it doesn't work.

$\endgroup$
  • $\begingroup$ printevalexpr[expr_] := expr == ReleaseHold[expr] , then use it like printevalexpr[HoldForm[Sin[Pi/2]]] $\endgroup$ – flinty Jul 4 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.