Mathematica Mathematica Conjugate of a Function Assuming Real Variables

AI Thread Summary
In Mathematica, using the Conjugate function with the Assuming function does not automatically simplify expressions involving complex variables unless properly structured. The Assuming function merely adds declarations that some functions may or may not utilize. To effectively simplify expressions with real and positive variables, it is recommended to wrap the Conjugate function with Simplify or FullSimplify, ensuring the Assuming command encompasses the entire expression. For example, using Assuming with Simplify around Conjugate can yield simplified results. Additionally, defining a custom function to handle conjugation with specific patterns can also be beneficial. It is crucial to note that the placement of the Assuming command is vital; it must encompass the entire expression for the assumptions to take effect.
rynlee
Messages
44
Reaction score
0
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[...

Thanks for any advice!
 
Physics 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
 
  • Like
Likes 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.
 
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]
 

Similar threads

Replies
1
Views
2K
Replies
1
Views
2K
Replies
2
Views
2K
Replies
2
Views
2K
Replies
13
Views
2K
Replies
19
Views
2K
Replies
1
Views
2K
Replies
1
Views
1K
Back
Top