# Mathematica:How can I acclaim a variable is real in a complex function (1 Viewer)

### Users Who Are Viewing This Thread (Users: 0, Guests: 1)

#### palzle

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:

#### CRGreathouse

Homework Helper
You could do
Code:
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).

#### palzle

Well,I have some...eerr...
what if I'd define the domain for function f[x]?
I mean that I wanna prescribe x in f[x] must be real or pure imaginary or rational number.How to do that.

I've a similar question here.How to claim a letter constant to be real or pure imaginary or rational number?

Last edited:

### The Physics Forums Way

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving