# Mathematica Conjugate of a Function Assuming Real Variables

• Mathematica

## Main Question or Discussion Point

Hi All,

In mathematica, I'm trying to use Conjugate[] to take the complex conjugate of a function that has imaginary numbers in it, but I want to tell mathematica that the variables are real and positive, so that it can nicely combine terms into, say, x^2 instead of x*x.

I've tried doing this using the Assuming[] function, but while it compiles fine it has no effect, the code I'm using is as follows:

Code:
Assuming[{m \[Element] Reals, \[Omega] \[Element] Reals,
a \[Element] Reals, h \[Element] Reals, \[Omega] > 0, m > 0, h > 0},
Conjugate[psi[x, t]]*psi[x, t]]
where earlier psi[x_,t_] is defined as:
Code:
psi[x_, t_] := ((m*\[Omega])/(Pi*h))^(1/4)*
Exp[((-m*\[Omega])/(2*h))*(x^2 + (a^2)*(1 + Exp[-2*I*\[Omega]*t])/
2 + I*h*t/m - 2*a*x*Exp[-I*\[Omega]*t])]
note that there are imaginary components to the function, even though the variables are real and positive.

Is there a better way to accomplish this than the Assuming[] function, or am I using Assuming[] wrong? I also tried nested Assuming[]'s, i.e. Assuming[m\[Element] Reals, Assuming[a \[Element] Reals, Assuming[.....

Related MATLAB, Maple, Mathematica, LaTeX News on Phys.org
Users sometimes expect magic power from Assuming. ALL it does is add some declarations to a list on the wall. Some functions in Mathematica look at that list, many do not.

Simplify looks at the list. Try wrapping a Simplify around your Conjugate. Then FullSimplify the result of that. Then use your Assuming with another Simplify inside that on the result from FullSimplify. That should get you to something like

(E^(ω*(Im[t] - (m*Re[(a^2*(1 + E^((-2*I)*t*ω)))/2 - (2*a*x)/E^(I*t*ω) + x^2])/h))*Sqrt[(m*ω)/h])/Sqrt[Pi]

If you can Assume t is real then it can make this a little simpler.

For the case the problem still exists.
Define a pattren
Code:
pattern={I->-I,-I->I}
If you want you can define a new function
Code:
ConjugateNEW[A_]:=A/.pattern

hunc
Order is Important

I have been stuck with related problems several times, the example below shows when assume will and won't be effective:

Simplify[Assuming[p \[Element] Reals, Conjugate[p]]]

returns:
Conjugate[p]

Assuming[p \[Element] Reals, Simplify[Conjugate[p]]]

returns:
p

The assuming command must be around everything, including the simplify command, for the assumptions to be used effectively.

Hepth
Gold Member
You can also put it as a requirement of a function :

Refine[Conjugate[p], Assumptions -> p \[Element] Reals]

Simplify[Conjugate[p], Assumptions -> p \[Element] Reals]