# Problem with imaginary/real parts of a complex function

I have a problem with this code:

b = 2*23.5;
nu = 0.3;
Ee = 10^5;
h = 4.5;
z = x + y*I;
G = Ee/(2*(1 + nu));
Zline = (Ee*2*h)/(2*Pi*(1 - nu^2))*ArcSinh[Sqrt[z/b]];
Z = (Ee*2*h)/(2*Pi*(1 - nu^2))*1/Sqrt[z (z + b)];
u = ((1 - 2 nu)*Re[Zline] - y*Im[Z])/(2 G);
v = (2*(1 - nu)*Im[Zline] - y*Re[Z])/(2 G);
Final = D[v, x] - D[u, y]
Plot3D[Final, {x, -b, -b/10}, {y, b/10, b}, AxesLabel -> Automatic]
Plot3D[u, {x, -b, 0}, {y, 0, b}, AxesLabel -> Automatic]
Plot3D[v, {x, -b, 0}, {y, 0, b}, AxesLabel -> Automatic]


Functions u and v should be real-valued functions. Can I get their analytical form? I tried to use ComplexExpand, but still has something like Arg[(x + I y) (47. + x + I y)].

Then I calculate derivative with Final = D[v, x] - D[u, y]. I don't understand why this line doesn't work:

Plot3D[Final, {x, -b, -b/10}, {y, b/10, b}, AxesLabel -> Automatic]

• The problem with Final is that you are taking derivatives of expressions that have Re and Im as Heads. Mathematica doesn't like taking derivatives of those functions: look at the output of D[Re[f[x]],x]. The same thing happens with Conjugate, so doing the obvious thing of replacing Re[a] with (a + Conjugate[a])/2 won't work. – march Nov 13 '15 at 18:36
• I suspect you need to use numerical derivatives. Have a look at ND ( which requires the NumericalCalculus package: do Needs["NumericalCalculus"] – george2079 Nov 13 '15 at 20:49
• Have you tried an explicit TargetFunctions -> {Re, Im} setting in ComplexExpand[]? – J. M. will be back soon Nov 14 '15 at 3:11

b = 2*23.5;
nu = 0.3;
Ee = 10^5;
h = 4.5;
z = x + y*I;
G = Ee/(2*(1 + nu));
Zline = (Ee*2*h)/(2*Pi*(1 - nu^2))*ArcSinh[Sqrt[z/b]];
Z = (Ee*2*h)/(2*Pi*(1 - nu^2))*1/Sqrt[z (z + b)];
u = ComplexExpand[((1 - 2 nu)*Re[Zline] - y*Im[Z])/(2 G),
TargetFunctions -> {Re, Im}];
v = ComplexExpand[(2*(1 - nu)*Im[Zline] - y*Re[Z])/(2 G),
TargetFunctions -> {Re, Im}];
Final = D[v, x] - D[u, y];

Plot3D[Final, {x, -b, -b/10}, {y, b/10, b}, AxesLabel -> Automatic,
BaseStyle -> FontSize -> 18, AxesStyle -> Black]
` • Knew it'd work… – J. M. will be back soon Nov 14 '15 at 6:51
• Thank you very much! Now I need understand why there are points of discontinuity... They definitely should not be here – Trarbish Nov 15 '15 at 6:57