Question: Cauchy-Riemann test of analyticity of a complex function ...

The CauchyRiemann procedure (for older version  of Maple )doesn't work quite right in Maple 2024 .
Also ran the procedure through the AI for so-called code improvement and now it shows what the code stands for 
The output according to the original procedure would look like on the screenshot, but running original procedure does not give this output ? 
I also want to extend the procedure with a plot of the complex function. 
That differentiability of complex functions is not obvious even if the cauchy-riemann equation is satisfied ?

 

restart

"maple.ini in users"

(1)

NULL

CauchyRiemann:=proc(expr::algebraic) # original procedure
  local x, y, u, v, u_x, u_y, v_x, v_y, flag1, flag2;

  u:=evalc(Re(eval(expr, z=x+I*y)));
  v:=evalc(Im(eval(expr, z=x+I*y)));

  u_x:=diff(u,x);
  u_y:=diff(u,y);
  v_x:=diff(v,x);
  v_y:=diff(v,y);

  print('f(z)'=expr);
  printf("\n");
  
  print('u(x,y)'=u);
  print('u[x](x,y)'=u_x);
  print('u[y](x,y)'=u_y);
  printf("\n");

  print('v(x,y)'=v);
  print('v[x](x,y)'=v_x);
  print('v[y](x,y)'=v_y);
  printf("\n");

  if u_x=v_y then
    print('u[x]=v[y]');
    print(u_x=v_y);
    flag1:=true;
  else
    print('u[x]<>v[y]');
    print(u_x<>v_y);
    flag1:=false;
  end if;

  if u_y=-v_x then
    print('u[y]=-v[x]');
    print(u_y=-v_x);
    flag2:=true;
  else
    print('u[y]<>-v[x]');
    print(u_y<>-v_x);
    flag2:=false;
  end if;
  
printf("\n");
if flag1=true and flag2=true then
   print(`Fullfill the Cauchy-Riemann Equations`);
   print(`The derivative is:`='u[x]+I*v[y]');
   print('diff(f(z),z)'=u_x+I*v_y);
else
   print(`Cauchy-Riemann ?`);
end if

end proc:

f(z):=1/(z+2):
CauchyRiemann(f(z))

f(z) = 1/(z+2)

 

 

 

u(x, y) = (x+2)/(y^2+(x+2)^2)

 

u[x](x, y) = 1/(y^2+(x+2)^2)-(x+2)*(2*x+4)/(y^2+(x+2)^2)^2

 

u[y](x, y) = -2*(x+2)*y/(y^2+(x+2)^2)^2

 

 

 

v(x, y) = -y/(y^2+(x+2)^2)

 

v[x](x, y) = y*(2*x+4)/(y^2+(x+2)^2)^2

 

v[y](x, y) = -1/(y^2+(x+2)^2)+2*y^2/(y^2+(x+2)^2)^2

 

 

 

u[x] <> v[y]

 

1/(y^2+(x+2)^2)-(x+2)*(2*x+4)/(y^2+(x+2)^2)^2 <> -1/(y^2+(x+2)^2)+2*y^2/(y^2+(x+2)^2)^2

 

u[y] <> -v[x]

 

-2*(x+2)*y/(y^2+(x+2)^2)^2 <> -y*(2*x+4)/(y^2+(x+2)^2)^2

 

 

 

`Cauchy-Riemann ?`

(2)

 

Also ran the procedure through the AI for so-called code improvement and now it shows what the code stands for

restart;

# Improved and corrected version of the CauchyRiemann procedure :ASKED AI 
CauchyRiemann := proc(expr::algebraic)
    local x, y, u, v, u_x, u_y, v_x, v_y, CR1, CR2;

    # Assign real and imaginary parts of the function
    u := evalc(Re(eval(expr, z = x + I*y)));
    v := evalc(Im(eval(expr, z = x + I*y)));

    # Calculate partial derivatives
    u_x := diff(u, x);
    u_y := diff(u, y);
    v_x := diff(v, x);
    v_y := diff(v, y);

    # Properly format and print function details
    printf("f(z) = %a\n", expr);
    printf("u(x, y) = %a, u_x = %a, u_y = %a\n", u, u_x, u_y);
    printf("v(x, y) = %a, v_x = %a, v_y = %a\n", v, v_x, v_y);

    # Evaluate and print Cauchy-Riemann equations
    CR1 := u_x = v_y;
    CR2 := u_y = -v_x;
    printf("\nCauchy-Riemann Equations:\n");
    printf("u_x = v_y: %a\n", CR1);
    printf("u_y = -v_x: %a\n", CR2);

    # Check both equations
    if CR1 and CR2 then
        printf("The function is analytic (holomorphic) at this point.\n");
        printf("The derivative f'(z) is %a + I*%a\n", u_x, v_y);
    else
        printf("The function does not satisfy the Cauchy-Riemann equations and is not analytic.\n");
    end if;
end proc;

# Test the procedure with a specific function
f := z -> 1/(z + 2);
CauchyRiemann(f(z));

"maple.ini in users"

 

proc (expr::algebraic) local x, y, u, v, u_x, u_y, v_x, v_y, CR1, CR2; u := evalc(Re(eval(expr, z = x+I*y))); v := evalc(Im(eval(expr, z = x+I*y))); u_x := diff(u, x); u_y := diff(u, y); v_x := diff(v, x); v_y := diff(v, y); printf("f(z) = %a
", expr); printf("u(x, y) = %a, u_x = %a, u_y = %a
", u, u_x, u_y); printf("v(x, y) = %a, v_x = %a, v_y = %a
", v, v_x, v_y); CR1 := u_x = v_y; CR2 := u_y = -v_x; printf("
Cauchy-Riemann Equations:
"); printf("u_x = v_y: %a
", CR1); printf("u_y = -v_x: %a
", CR2); if CR1 and CR2 then printf("The function is analytic (holomorphic) at this point.
"); printf("The derivative f'(z) is %a + I*%a
", u_x, v_y) else printf("The function does not satisfy the Cauchy-Riemann equations and is not analytic.
") end if end proc

 

proc (z) options operator, arrow; 1/(z+2) end proc

 

f(z) = 1/(z+2)
u(x, y) = (x+2)/(y^2+(x+2)^2), u_x = 1/(y^2+(x+2)^2)-(x+2)/(y^2+(x+2)^2)^2*(2*x+4), u_y = -2*(x+2)/(y^2+(x+2)^2)^2*y
v(x, y) = -y/(y^2+(x+2)^2), v_x = y/(y^2+(x+2)^2)^2*(2*x+4), v_y = -1/(y^2+(x+2)^2)+2*y^2/(y^2+(x+2)^2)^2

Cauchy-Riemann Equations:
u_x = v_y: 1/(y^2+(x+2)^2)-(x+2)/(y^2+(x+2)^2)^2*(2*x+4) = -1/(y^2+(x+2)^2)+2*y^2/(y^2+(x+2)^2)^2
u_y = -v_x: -2*(x+2)/(y^2+(x+2)^2)^2*y = -y/(y^2+(x+2)^2)^2*(2*x+4)
The function does not satisfy the Cauchy-Riemann equations and is not analytic.

 

NULL

Download CAUCHY_RIEMANN_-FORUM_VRAAG.mw

Please Wait...