Mathematica Conjugate of a Function Assuming Real Variables

In summary: That is the summary of the conversation. In summary, the individual is having trouble using the Conjugate[] function in Mathematica to take the complex conjugate of a function with imaginary numbers. They have tried using the Assuming[] function, but it does not seem to have any effect. They ask for advice on whether there is a better way to accomplish this or if they are using Assuming[] incorrectly. The other person suggests using Simplify and FullSimplify, as well as making sure to include the assumptions in the function. They also mention defining a new function, ConjugateNEW, using a pattern to simplify the process. The conversation ends with the individual thanking for the advice and mentioning that they have encountered similar problems before.
  • #1
rynlee
45
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
  • #2
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.
 
  • #3
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
  • #4
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.
 
  • #5
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]
 

What is the purpose of taking the conjugate of a function in Mathematica?

The conjugate of a function in Mathematica is used to find the complex conjugate of a given function. This is useful in various mathematical operations, such as finding the magnitude of a complex number or solving differential equations involving complex functions.

How do I take the conjugate of a function in Mathematica?

To take the conjugate of a function in Mathematica, you can use the Conjugate function. For example, if you have a function f[x] and want to find its complex conjugate, you can use Conjugate[f[x]]. You can also use the shortcut notation f[x]\[Conjugate].

Can I assume that the variables in my function are real when finding the conjugate in Mathematica?

Yes, you can use the Assuming function in Mathematica to assume that the variables in your function are real. For example, if you have a function f[x,y] and want to find its conjugate assuming that x and y are real, you can use Assuming[x \[Element] Reals && y \[Element] Reals, Conjugate[f[x,y]]].

What is the difference between Conjugate and ComplexExpand in Mathematica?

While both Conjugate and ComplexExpand can be used to find the complex conjugate of a function, they have different purposes. Conjugate simply takes the conjugate of a given function, while ComplexExpand expands a given expression in terms of complex variables. If you only want to find the complex conjugate of a function, it is more efficient to use Conjugate.

Can I use Mathematica to find the conjugate of a symbolic expression?

Yes, you can use Mathematica to find the conjugate of a symbolic expression. Simply use the Conjugate function on the expression or use the shortcut notation expression\[Conjugate]. This is useful in solving problems involving complex numbers and functions.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
111
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
240
Replies
1
Views
536
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
203
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top