3
$\begingroup$

While there is this question with a very similar title, it does not answer my question, which is:

I have part of an input, in my case

Re[Exp[I*x]]

which Mathematica "simplifies" to

Cos[Re[x]]/E^Im[x]

So I am wondering how to tell Mathematica to leave this expression, whether it's alone or part of a longer formula, in its previous form rather than to change it as shown here.

Update

I should probably add I am still running version 6, hoping this is not causing the issue.

$\endgroup$
8
  • $\begingroup$ I can not reproduce your problem. Re[Exp[I*x]] does not automatically simplify to anything. Evaluating it leaves it unchanged. Evaluating Re[Exp[I*x]] // Simplify doesn't change it either. $\endgroup$
    – m_goldberg
    Jul 15, 2013 at 12:47
  • $\begingroup$ Maybe this is because I am still running Mathematica v6? But should it behave differently in such a way? If I evaluate Re[Exp[I*x]] in a new notebook, I get the above expression. $\endgroup$
    – Bernd
    Jul 15, 2013 at 12:51
  • $\begingroup$ i agree with @m_goldberg, but if you want to suppress on the fly simplification from Mathematica enclose it in a HoldForm expression. Is that what you're asking for? $\endgroup$
    – Stefan
    Jul 15, 2013 at 12:51
  • $\begingroup$ @Stefan, HoldForm might work but it seems be a little tricky to use in this case if I want to use the expression in a longer formula e.g. involving slots (#) where the evaluation must not be stopped. I was hoping there would be some solution of the form expression //SomeForm? $\endgroup$
    – Bernd
    Jul 15, 2013 at 12:58
  • $\begingroup$ @Bernd what about Defer@Integrate[x^# Exp[-x], {x, 0, 1}]&/@Range[2] ? $\endgroup$
    – Stefan
    Jul 15, 2013 at 13:07

1 Answer 1

4
$\begingroup$

In case you want Mathematica to suppress on the fly simplification and having slots (#) involved, you might consider using Defer:

Defer@Integrate[x^# Exp[-x], {x, 0, 1}]&/@Range[2] 

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.