# Mathematica:How can I acclaim a variable is real in a complex function

1. ### palzle

2
Hi,I'm a beginner.
here's the example:
f[x_] := E^(I*x)
Conjugate[f[x]]*f[x]
I'd like get 1,but it give me a complex function coz it regard x as complex.

by the way,is that necessary to define a letter as a constant.no matter yes or not,how to refer a letter constant to be real or pure imaginary

Thank you!

Last edited: Feb 17, 2009
2. ### CRGreathouse

3,682
You could do
Code (Text):
f[x_]:=Exp[I*Re[x]]
so it takes only the real part of x (which doesn't change it, of course, when x is real).

2