I have a composition of 7 functions I need simplified into its real and imaginary parts. I have tried many of the suggestions on different posts such as ComplexExpand, ReIm, but none of them seem to work. Any suggestions on what to try? I am new to Mathematica, so apologies if there are other simple mistakes. Also, Mathematica is so awesome, I wish I knew about it earlier.

Thanks in advance, and here are the functions.

    f1[z_] = 2 (-I*z + 6 I)/(z)
    f2[z_] = (pi/2) (I*z + 1)
    f3[z_] = sin[z]
    f4[z_] = z^2
    C = sin[3 I]^2
    D = sin[(pi/2) + I*pi]^2
    f5[z_] = ( (C - D)/C)*(z/(D - z) )
    f6[z_] = Sqrt[z]
    f7[z_] = (2/pi)*arcsin[z]
    G[z_] = Composition[f7, f6, f5, f4, f3, f2, f1][z]
    G[2 + 2 I]
  • $\begingroup$ Built-in functions and constants all start with a capital letter, e.g., Sin, ArcSin, Pi. You must capitalize properly. Consequently, user-defined symbols/names should start with lower case letters to avoid conflicts, e.g., C and D are "reserved" words. $\endgroup$
    – Bob Hanlon
    Commented Apr 4, 2018 at 5:42
  • $\begingroup$ Your response is very much appreciated. I am starting to get a simplified expression for the real and imaginary parts. I think there is one last issue. The real and imaginary still contain some imaginary units in the square roots. They are in the form of the first function f1. $\endgroup$
    – user57361
    Commented Apr 4, 2018 at 5:52
  • $\begingroup$ Do I need to somehow represent z as x+iy so that it can simplify that expression (f1)? $\endgroup$
    – user57361
    Commented Apr 4, 2018 at 6:16

1 Answer 1

f1[z_] = 2 (-I*z + 6 I)/(z);
f2[z_] = (Pi/2) (I*z + 1);
f3[z_] = Sin[z];
f4[z_] = z^2;
c = Sin[3 I]^2;
d = Sin[(Pi/2) + I*Pi]^2;
f5[z_] = ((c - d)/c)*(z/(d - z));
f6[z_] = Sqrt[z];
f7[z_] = (2/Pi)*ArcSin[z];
G[z_] = Composition[f7, f6, f5, f4, f3, f2, f1][z] // Simplify

(* (2 ArcSin[
  Sqrt[Cos[(6 π)/z]^2/(-Cos[(12 π)/z] + Cosh[2 π])] Sqrt[
   2 + 2 Cosh[π]^2 Csch[3]^2]])/π *)

ReIm[G[2 + 2 I]]

(* {0, (2 ArcSinh[
   Sqrt[(2 + 2 Cosh[π]^2 Csch[3]^2)/(
    Cosh[2 π] + Cosh[3 π])] Sinh[(3 π)/2]])/π} *)

% // N

(* {0., 0.75963} *)

(Complex @@ %) == G[2 + 2 I]

(* True *)


(* 0 *)
  • $\begingroup$ People like you make change lives, man. This is helping me more than you can imagine. I'll pass on the knowledge when I can. Thanks again. $\endgroup$
    – user57361
    Commented Apr 4, 2018 at 6:30
  • $\begingroup$ Apologies, but I guess I still have one question. Is it possible to simplify G[z] further down to the sum of a real function and imaginary, i.e u(x,y)+iv(x,y)? I feel like I need to rewrite z as x+iy in order for Mathematica to be able to simplify it even further, but I am not sure of the best way to go about this. $\endgroup$
    – user57361
    Commented Apr 4, 2018 at 12:22
  • $\begingroup$ @ElGalloNegro - G[x + I*y] // ComplexExpand[#, TargetFunctions -> {Re, Im}] & will separate the real and imaginary parts; however, it is NOT simple. It has a LeafCount of 9254 and trying to Simplify this will likely take more time than you are willing to spend. $\endgroup$
    – Bob Hanlon
    Commented Apr 4, 2018 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.