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

AI Thread Summary
The discussion centers on defining a function in a mathematical context, specifically using the example f[x_] := E^(I*x). The user seeks assistance in ensuring that the variable x is treated as a real number to obtain a result of 1 when calculating Conjugate[f[x]]*f[x]. A suggested solution is to redefine the function as f[x_] := Exp[I*Re[x]], which successfully addresses the user's issue. The conversation then shifts to the user's interest in defining the domain of the function, specifically how to restrict x to be real, pure imaginary, or rational. The user also inquires about how to declare a constant as real or pure imaginary. The responses focus on providing methods to achieve these definitions and constraints in mathematical functions.
palzle
Messages
2
Reaction score
0
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.
please help me:how to claim x is real?

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:
Physics news on Phys.org
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).
 
Thanks for your reply.
I tried your answer,and it works.

Well,I have some...eerr...
what if I'd define the domain for function f[x]?
I mean that I want to 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?

Waiting for your kindness.
 
Last edited:

Similar threads

Back
Top