Message Boards Message Boards


Isolate imaginary/real part of simple algebraic expression?

Posted 1 month ago
5 Replies
1 Total Likes

Using Mathematica can be often very frustrating. Either I'm doing something wrong here, or Mathematica is just dumb.

So, I have the below expression:

-1 + ((2*I*(1 + Log[Pi] - (I*Pi)/2))/Pi)*(r + I*t)

And I am trying to put it in form a+i*b, nothing complicated at all, but Mathematica chokes on it. I tried to use the below, but it's ignoring my attempts to tell it that r and t are reals:

In[298]:= Clear[r, t]; x1 = -1 + ((2*I*(1 + Log[Pi] - (I*Pi)/2))/
     Pi)*(r + I*t); 
  FullSimplify[Abs[x1]*Cos[Arg[x1]], Assumptions -> 
      r*In*Reals && t*In*Reals]

Out[298]= -1 - Im[t] + Re[r] - (2*(1 + Log[Pi])*(Im[r] + Re[t]))/Pi

Where am I going wrong? Please help, I really appreciate.

5 Replies
Posted 1 month ago

Since r and t are both Real

ComplexExpand[-1 + ((2*I*(1 + Log[Pi] - (I*Pi)/2))/Pi)*(r + I*t)]


-1 + r - (2*t)/Pi - (2*t*Log[Pi])/Pi + I*((2*r)/Pi + t + (2*r*Log[Pi])/Pi)
Posted 1 month ago

Thanks, that's the function I needed.

Posted 1 month ago

Wow, the result is absolutely horrible. Mathematica doesn't simplify a lot of the things it should:

ComplexExpand[(Cos[r v] Cosh[t v] - 
    I Sin[r v] Sinh[t v]) (Cos[t Log[Cos[v]]] - I Sin[t Log[Cos[v]]])]

Cos[v] Cos[1/2 t Log[Cos[v]^2]] Cosh[t v] Cosh[t Arg[Cos[v]]] - 
 Cosh[t Arg[Cos[v]]] Sin[v] Sin[1/2 t Log[Cos[v]^2]] Sinh[t v] + 
 Cos[v] Cos[1/2 t Log[Cos[v]^2]] Cosh[t v] Sinh[t Arg[Cos[v]]] - 
 Sin[v] Sin[1/2 t Log[Cos[v]^2]] Sinh[t v] Sinh[t Arg[Cos[v]]] + 
 I (-Cos[v] Cosh[t v] Cosh[t Arg[Cos[v]]] Sin[1/2 t Log[Cos[v]^2]] - 
    Cos[1/2 t Log[Cos[v]^2]] Cosh[t Arg[Cos[v]]] Sin[v] Sinh[t v] - 
    Cos[v] Cosh[t v] Sin[1/2 t Log[Cos[v]^2]] Sinh[t Arg[Cos[v]]] - 
    Cos[1/2 t Log[Cos[v]^2]] Sin[v] Sinh[t v] Sinh[t Arg[Cos[v]]])

Maybe something like this?

Assuming[Element[{v, t, r}, Reals] && Cos[v]^2 != 0, 
     (Cos[r v] Cosh[t v] - I Sin[r v] Sinh[t v])*
      (Cos[t Log[Cos[v]]] - I Sin[t Log[Cos[v]]])]]]
Posted 1 month ago

Can you show the simplified version including all those things?

Are you assuming anything about the values of those variables?


Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract