# Get absolute value of a complex number?

Posted 6 months ago
795 Views
|
6 Replies
|
1 Total Likes
|
 Hi! I'll start right away. I have a question about Complex Numbers.I have a complex number, or a bunch of complex numbers, like you can see below. Here I need to know the absolute value of the number B squared, but in the result there is still the imaginery unit in it. I said that all the variables are real numbers greater than zero, so it should be possible to give me a correct term for the absolute value of B.Or what is my mistake here? How do I use complex numbers with variables in it? How do I make sure that the variables are part of the reals numbers an grater than zero? Input \[Alpha] \[Element] Reals; \[Lambda] \[Element] Reals; L \[Element] Reals; \[Alpha] > 0; \[Lambda] > 0; L > 0; \[CapitalOmega] = (\[Alpha] - I*\[Lambda])/(\[Alpha] + I*\[Lambda])*Exp[\[Alpha]*L]; c = (2*I*\[Lambda])/(I*\[Lambda] + \[Alpha])*Exp[(\[Alpha] - I*\[Lambda])*L/2]/(1 + \[CapitalOmega]^2); d = c*\[CapitalOmega]; B = c*Exp[(-\[Alpha] + I*\[Lambda])*L/2] + d*Exp[(\[Alpha] + I*\[Lambda])*L/2] - 1; Abs[B]^2 Output Abs[-1 + ( 2 I E^(L \[Alpha] + 1/2 L (\[Alpha] - I \[Lambda]) + 1/2 L (\[Alpha] + I \[Lambda])) (\[Alpha] - I \[Lambda]) \[Lambda])/((1 + ( E^(2 L \[Alpha]) (\[Alpha] - I \[Lambda])^2)/(\[Alpha] + I \[Lambda])^2) (\[Alpha] + I \[Lambda])^2) + ( 2 I E^(1/2 L (\[Alpha] - I \[Lambda]) + 1/2 L (-\[Alpha] + I \[Lambda])) \[Lambda])/((1 + ( E^(2 L \[Alpha]) (\[Alpha] - I \[Lambda])^2)/(\[Alpha] + I \[Lambda])^2) (\[Alpha] + I \[Lambda]))]^2 In[7]:= Simplify[ Abs[-1 + ( C E^(L \[Alpha] + 1/2 L (\[Alpha] + I \[Lambda])) (\[Alpha] - I \[Lambda]))/(\[Alpha] + I \[Lambda]) + ( 2 I E^(1/2 L (\[Alpha] - I \[Lambda]) + 1/2 L (-\[Alpha] + I \[Lambda])) \[Lambda])/((1 + ( E^(2 L \[Alpha]) (\[Alpha] - I \[Lambda])^2)/(\[Alpha] + I \[Lambda])^2) (\[Alpha] + I \[Lambda]))]^2] Out[7]= Abs[-1 + ( C E^(1/2 L (3 \[Alpha] + I \[Lambda])) (\[Alpha] - I \[Lambda]))/(\[Alpha] + I \[Lambda]) + ( 2 I \[Lambda])/((1 + ( E^(2 L \[Alpha]) (\[Alpha] - I \[Lambda])^2)/(\[Alpha] + I \[Lambda])^2) (\[Alpha] + I \[Lambda]))]^2 I hope you can help me. Thanks in advance! :)Best regards, Thomas
6 Replies
Sort By:
Posted 6 months ago
 The mechanism for assumptions is different: myAssumptions = {\[Alpha] \[Element] Reals, \[Lambda] \[Element] Reals, L \[Element] Reals, \[Alpha] > 0, \[Lambda] > 0, L > 0}; FullSimplify[Abs[B]^2, myAssumptions] If you need global assumptions, look up \$Assumptions.
Posted 6 months ago
 Ahh ok. Thank you for the quick answer!
Posted 6 months ago
 So I have another question: Why doesn't that work for Abs[], Im[] or Re[]? When i type FullSimplify[Abs[B], myAssumptions] I just get Abs[((\[Alpha] - I \[Lambda]) ((\[Alpha] - I \[Lambda]) Cosh[L \[Alpha]] - 2 I \[Lambda] Sinh[ L \[Alpha]]))/((\[Alpha] - \[Lambda]) (\[Alpha] + \[Lambda]) * Cosh[L \[Alpha]] - 2 I \[Alpha] \[Lambda] Sinh[L \[Alpha]])] as result. Same for Re and Im.
Posted 6 months ago
 Perhaps the "simplest" form is the one with the imaginary unit. You can force the separation with ComplexExpand: Simplify[ComplexExpand@Abs[B], myAssumptions] 
 Or perhaps with your B from above B Bstar = B /. Complex[u_, v_] -> Complex[u, -v] and then (giving Abs[ B ]^2 ) B *Bstar // FullSimplify