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

Click For Summary
SUMMARY

The discussion focuses on how to declare a variable as real in a complex function using Mathematica. The user initially defines a function f[x_] as E^(I*x) and encounters issues with obtaining a real result from Conjugate[f[x]]*f[x]. The solution provided is to redefine the function as f[x_] := Exp[I*Re[x]], which effectively restricts x to its real part. Additionally, the user inquires about defining the domain of x to ensure it is real, pure imaginary, or rational.

PREREQUISITES
  • Understanding of Mathematica syntax and functions
  • Familiarity with complex numbers and their properties
  • Knowledge of function definitions in Mathematica
  • Basic concepts of variable domains in mathematical functions
NEXT STEPS
  • Explore Mathematica's domain specification features for functions
  • Learn about defining constraints on variables in Mathematica
  • Investigate complex number manipulation in Mathematica
  • Study the use of Re[] and Im[] functions in Mathematica for real and imaginary parts
USEFUL FOR

Mathematica users, mathematicians, and students dealing with complex functions and variable constraints in their computations.

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

  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 27 ·
Replies
27
Views
2K
  • · Replies 4 ·
Replies
4
Views
18K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 6 ·
Replies
6
Views
8K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
6K