Re: Some problems with complex functions like Sqrt[z]
- To: mathgroup at smc.vnet.net
- Subject: [mg18207] Re: [mg18168] Some problems with complex functions like Sqrt[z]
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Mon, 21 Jun 1999 22:50:46 -0400
- References: <199906200354.XAA27497@smc.vnet.net.>
- Sender: owner-wri-mathgroup at wolfram.com
Robert Prus wrote: > > Hi, > > For any complex (holomorphic) function f[z] I should obtain 0 as the result > of the following calculations: > > Mathematica 3.0 for Silicon Graphics > Copyright 1988-97 Wolfram Research, Inc. > -- Motif graphics initialized -- > > In[1]:= f[z_]:=z^3 > > In[2]:= re=Re[f[a+I b]]//ComplexExpand > > 3 2 > Out[2]= a - 3 a b > > In[3]:= im=Im[f[a+I b]]//ComplexExpand > > 2 3 > Out[3]= 3 a b - b > > In[4]:= D[{re,im},a].D[{re,im},b]//Simplify > > Out[4]= 0 > > But if I choose more complicated function, like Sqrt[z], I obtain: > > In[5]:= f[z_]:=Sqrt[z] > > In[6]:= re=Re[f[a+I b]]//ComplexExpand > > Arg[a + I b] > Out[6]= Sqrt[Abs[a + I b]] Cos[------------] > 2 > > In[7]:= im=Im[f[a+I b]]//ComplexExpand > > Arg[a + I b] > Out[7]= Sqrt[Abs[a + I b]] Sin[------------] > 2 > > In[8]:= D[{re,im},a].D[{re,im},b]//Simplify > > I 2 2 2 > - (Abs'[a + I b] + Abs[a + I b] Arg'[a + I b] ) > 4 > Out[8]= ------------------------------------------------- > Abs[a + I b] > > In the following one can use the substitutions: > > Abs'[x_+I y_] -> x/Sqrt[x^2+y^2] > > Arg'[x_+I y_] -> -y/(x^2+y^2) > > (one can check them using: > > z=Abs'[x+I y]-x/Sqrt[x^2+y^2] (* or z=Arg'[x+I y]+y/(x^2+y^2) *) > Plot3D[Chop[z],{x,-10,10},{y,-10,10}] > Plot3D[Chop[z],{x,Random[],Random[]},{y,Random[],Random[]}] > ) > > As the final result I obtain: > > In[10]:= %8/.{Abs'[x_+I y_] -> x/Sqrt[x^2+y^2], Arg'[x_+I y_] -> -y/(x^2+y^2)}/.Abs[x_+I y_] -> Sqrt[x^2+y^2]//Together > > I > - > 4 > Out[10]= ------------- > 2 2 > Sqrt[a + b ] > > Under Mathematica 2.0 as the final result I have: > > In[9]:= %8/.{Abs'[x_+I y_] -> x/Sqrt[x^2+y^2], Arg'[x_+I y_] -> -y/(x^2+y^2)}/.Abs[x_+I y_] -> Sqrt[x^2+y^2]//Together > > b > Out[9]= ------------------------- > 2 2 > 4 (a - I b) Sqrt[a + b ] > > But it should be equal to zero !!! > > Any comments? > > Robert Prus, robert at fuw.edu.pl > Institute of Theoretical Physics, Warsaw University > Hoza 69, 00-681 Warsaw, Poland I guess the problem lies in assuming that Abs'[...] and Arg'[...] make sense. In your Plot3D version 3 of Mathematica does a numerical differentiation and gets the "correct" result (version 4 just leaves Abs'[...] unevaluated). But really you want to assume the function is real analytic in order for the manipulations you did to make sense, and this Abs is not. You need to replace Abs'[...] by a/Sqrt[a^2+b^2] in one place, and by b/(I*Sqrt[a^2+b^2]) in another. Similar considerations hold for Arg'[...]. How do I know this? You can rewrite your re and im using ComplexExpand[..., TargetFunctions->{Re,Im}] (in order to avoid the Abs and Arg) and then you get expressions like In[62]:= re2 = ComplexExpand[re, TargetFunctions->{Re,Im}] 2 2 1/4 ArcTan[a, b] Out[62]= (a + b ) Cos[------------] 2 In[63]:= im2 = ComplexExpand[im, TargetFunctions->{Re,Im}] 2 2 1/4 ArcTan[a, b] Out[63]= (a + b ) Sin[------------] 2 When you take derivatives with respect to a or b and compare to D[re,a] resp. D[im,b] you will see that the formal derivative Abs'[...] gets replaced by functions that have different values in the complex plane (specifically, the two I gave above). Same story for the other pair of derivatives. Note that it is now simple to verify the Cauchy-Riemann equations directly. For example: In[64]:= D[re2,a]-D[im2,b] Out[64]= 0 In[66]:= D[re2,b]+D[im2,a] Out[66]= 0 Daniel Lichtblau Wolfram Research
- References:
- Some problems with complex functions like Sqrt[z]
- From: Robert Prus <robert@fuw.edu.pl>
- Some problems with complex functions like Sqrt[z]