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.
dontdont9
(Bill Nelson)
November 28, 2020, 6:17am
2
Since r and t are both Real
ComplexExpand[-1 + ((2*I*(1 + Log[Pi] - (I*Pi)/2))/Pi)*(r + I*t)]
returns
-1 + r - (2*t)/Pi - (2*t*Log[Pi])/Pi + I*((2*r)/Pi + t + (2*r*Log[Pi])/Pi)
Thanks, that’s the function I needed.
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]]])
dontdont9
(Bill Nelson)
December 2, 2020, 12:43am
5
Can you show the simplified version including all those things?
Are you assuming anything about the values of those variables?
Thanks.
Maybe something like this?
Assuming[Element[{v, t, r}, Reals] && Cos[v]^2 != 0,
FullSimplify@PiecewiseExpand[ReIm@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]]])]]]