1
$\begingroup$

How does one specify the assumption that a function is real for real arguments?

Compare

Simplify[Re[I f[x]], Assumptions -> f[x_] ∈ Reals]
0

with

Simplify[Re[I f[x]], Assumptions -> x ∈ Reals && f[x_/;x ∈ Reals] ∈ Reals]
-Im[f[x]]

How do I get zero in the second case?

$\endgroup$
  • 1
    $\begingroup$ Well, I know it does work in some cases, but pattern-matching-based assumption is never documented… $\endgroup$ – xzczd Sep 12 at 10:24
  • $\begingroup$ @xzczd How would you otherwise formulate the mathematical fact of this kind about the given function? $\endgroup$ – yarchik Sep 12 at 11:31
  • $\begingroup$ The first case will be Simplify[Re[I f[x]], Assumptions -> f[x] ∈ Reals], but sadly I've no idea how to express 2nd case. $\endgroup$ – xzczd Sep 12 at 11:47
  • $\begingroup$ Re[I f[x]] // ComplexExpand $\endgroup$ – Bob Hanlon Sep 13 at 4:56
  • $\begingroup$ @BobHanlon No, ComplexExpand unconditionally assumes that all symbols are real. I need to impose a condition. For instance ComplexExpand[Re[I (f[x] + f[I x])]] gives me zero. But if f[z] is Sin[z]---it is a false statement. $\endgroup$ – yarchik Sep 13 at 5:36

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.