janhardo

695 Reputation

12 Badges

11 years, 39 days

MaplePrimes Activity


These are questions asked by janhardo

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

I just discoverd today the step solutions for series in Student package 

Now i try to solve this with my own steps here ..

Note: SummationSteps(Sum(1/n^2, n = 1 .. infinity))was not capable to get a closed form?

"maple.ini in users"

(1)

NULL

Euler's Basel Problem
In the Student Basics package, there is a command :

 

SummationSteps

generate steps for evaluating summations

NULL

help("SummationSteps")

The SummationSteps command accepts an expression that is expected to contain summations and displays the steps required to evaluate each summation given.

2024

with(Student[Basics])

 

" restart; with(Student[Basics])"

"maple.ini in users"

 

[CompleteSquareSteps, CurveSketchSteps, ExpandSteps, FactorSteps, FractionSteps, GCDSteps, LCMSteps, LinearSolveSteps, LongDivision, ModuloSteps, OutputStepsRecord, PartialFractionSteps, PowerSteps, PracticeSheet, SimplifySteps, SolveSteps, SummationSteps, TrigSteps]

(2)

Try this out this SummationStepscommand for the Basel problem series  ( p-series example)

SummationSteps(Sum(1/n, n = 1 .. infinity))

"[[,,[]],["&bullet;",,"Apply the P-test on" (1)/(n)", which shows the summation diverges if" p<=1 "for" (&sum;)1/((n)^p)],[,,p=1],["&bullet;",,"Since" 0<1 "and" 1<=1", we get that the summation diverges"],[,,([[(&sum;)(1)/(n)" diverges"]])],["&bullet;",,"We know the summation diverges, so now we should find what it diverges to"],[,,[]],["&bullet;",,"Evaluate sum" (&sum;)1/n],[,,infinity]]"

(3)

Now the Basel Problem from Euler

SummationSteps(Sum(1/n^2, n = 1 .. infinity))

"[[,,[]],["&bullet;",,"Apply the P-test on" (n)^(-2)", which shows the summation diverges if" p<=1 "for" (&sum;)1/((n)^p)],[,,p=2],["&bullet;",,"Since" 1<2", we get that the summation converges"],[,,([[(&sum;)(n)^(-2)" converges"]])]]"

(4)

f := sum(1/n^2, n = 1 .. infinity)

(1/6)*Pi^2

(5)

How do we get this value from Euler ( The Basel Problem)

# Step 1: Define the series f
f := sum(1/n^2, n = 1 .. infinity);

# Step 2: Write the series as a product of terms (1 - 1/p)
g := convert(product(1 - 1/p, p = primes), hypergeom);

# Step 3: Compare with the Taylor series of the sine function
h := series(sin(x), x = 0, 10);

# Step 4: Set up equations between corresponding terms
eq := seq(coeff(h, x, 2*k)/k!, k = 1 .. 5) =
      seq(coeff(g, x, k), k = 1 .. 5);

# Step 5: Solve the equations to find the value of the series
sol := solve({eq, seq(coeff(g, x, k) = 0, k = 6 .. 10)});

# Step 6: Replace x with pi/2 to find the value
sol_pi := subs(x = Pi/2, sol);

# Step 7: Compute the value of the series
value := sol_pi[1][2];

value;

(1/6)*Pi^2

 

1-1/primes

 

series(x-(1/6)*x^3+(1/120)*x^5-(1/5040)*x^7+(1/362880)*x^9+O(x^11),x,11)

 

(0, 0, 0, 0, 0) = (0, 0, 0, 0, 0)

 

Error, invalid input: solve expects its 1st argument, eqs, to be of type {`and`, `not`, `or`, rtable, algebraic, relation(algebraic), relation({rtable, algebraic}), {list, set}({`and`, `not`, `or`, algebraic, relation(algebraic)})}, but received {0 = 0, (0, 0, 0, 0, 0) = (0, 0, 0, 0, 0)}

 

sol

 

Error, attempting to assign to `value` which is protected.  Try declaring `local value`; see ?protect for details.

 

value

(6)

NULL

Download Het_Basel_Probleem_van_Euler.mw

 

"restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ;"NULL

"maple.ini in users"

 

3

(1)

NULL#  plot  solutions to a system  of DEs

NULL

sys := {diff(x(t), t) = y(t), diff(y(t), t) = -x(t) - 1/2*y(t)}

{diff(x(t), t) = y(t), diff(y(t), t) = -x(t)-(1/2)*y(t)}

(2)

DEplot(sys, [x(t), y(t)], t = 0 .. 15, [[x(0) = 1, y(0) = 0]])

 

;

This is not working, seems to be simple ...
Have made an attempt to create a procedure from these two commands, but no success
Apparently, I need to learn to use a debugger to determine what is wrong, then?

dv_systeemplot:= proc ( DV1,DV2 ,RV1,RV2 )
                 local t, sys,systeemplot;  
                 sys := {DV1 , DV2 }:
                 systeemplot:= DEplot(sys, [x(t), y(t)], t = 0 .. 15, [[RV1 , RV2]]);
                 return systeemplot;
end proc;

proc (DV1, DV2, RV1, RV2) local t, sys, systeemplot; sys := {DV1, DV2}; systeemplot := DEplot(sys, [x(t), y(t)], t = 0 .. 15, [[RV1, RV2]]); return systeemplot end proc

(3)

NULL

DV1 := diff(x(t), t) = y(t)

diff(x(t), t) = y(t)

(4)

DV2 := diff(y(t), t) = -x(t)-(1/2)*y(t)

diff(y(t), t) = -x(t)-(1/2)*y(t)

(5)

RV1 := x(0) = 1

x(0) = 1

(6)

RV2 := y(0) = 0

y(0) = 0

(7)

dv_systeemplot( DV1,DV2 ,RV1,RV2 );

 

Error, (in DEtools/DEplot/CheckDE) inputs must be ODEs

 

NULL

Ask AI to get some code: never i got the right Maple code ! :)

 

"restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ;"``
 

"maple.ini in users"

 

3

(8)

restart;

systeem := proc(eq1, eq2, beginwaarden)
  local x, y, oplossing;
  x := unapply(rhs(dsolve({eq1, eq2, beginwaarden}, {x(t), y(t)})), t);
  y := unapply(rhs(dsolve({eq1, eq2, beginwaarden}, {x(t), y(t)})), t);
  oplossing := DEplot([x(t), y(t)], t = 0 .. 10, beginwaarden);
  oplossing;
end proc;

# Definieer de differentiaalvergelijkingen
eq1 := diff(x(t), t) = y(t);
eq2 := diff(y(t), t) = -x(t);

# Geef de beginwaarden op
beginwaarden := [x(0) = 1, y(0) = 0];

# Roep de procedure aan met de differentiaalvergelijkingen en beginwaarden
systeem(eq1, eq2, beginwaarden);

"maple.ini in users"

 

proc (eq1, eq2, beginwaarden) local x, y, oplossing; x := unapply(rhs(dsolve({eq1, eq2, beginwaarden}, {x(t), y(t)})), t); y := unapply(rhs(dsolve({eq1, eq2, beginwaarden}, {x(t), y(t)})), t); oplossing := DEplot([x(t), y(t)], t = 0 .. 10, beginwaarden); oplossing end proc

 

diff(x(t), t) = y(t)

 

diff(y(t), t) = -x(t)

 

[x(0) = 1, y(0) = 0]

 

Error, (in dsolve) invalid input: PDEtools/sdsolve expects its 1st argument, SYS, to be of type Or(set({`<>`, `=`, algebraic}),list({`<>`, `=`, algebraic}),`casesplit/ans`(list,list)), but received {diff(x(t),t) = y(t), diff(y(t),t) = -x(t), [x(0) = 1, y(0) = 0]}

 

Probably i do need to work with a debugger here?


Download dv_systeem_via_mapleprimes_.mw

Well , honestly I can't make sense of how to do this.

Interactive can be done step by step , but now generalize via a procedure , but can't get a handle on it
How to get the right procedure ?

"maple.ini in users"

(1)

NULL

" restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ;"

"maple.ini in users"

 

3

(2)

DV := y(x)*(diff(y(x), x)) = exp(x)

y(x)*(diff(y(x), x)) = exp(x)

(3)

opl_1 := dsolve({DV, RV1}, y(x))

y(x) = (1-2*exp(1)+2*exp(x))^(1/2)

(4)

opl_2 := dsolve({DV, RV2}, y(x))

y(x) = -(1-2*exp(1)+2*exp(x))^(1/2)

(5)

opl := plot({rhs(opl_1), rhs(opl_2)}, x = 0 .. 5, y = -10 .. 10, thickness = 3)

lijnelement := dfieldplot(DV, y(x), x = 0 .. 5, y = -10 .. 10, title = "lijnelementveld met intergaalkromme door (1,1)(1,-1)")

display({opl, lijnelement})

 

NULL

" restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ;"

"maple.ini in users"

 

3

(6)

NULL

DV, RV1, RV2

y(x)*(diff(y(x), x)) = exp(x), y(1) = 1, y(1) = -1

(7)

``

NULL

NULL

"restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ; "

"maple.ini in users"

 

3

(8)

DVplot:=proc(DVA,RV1A,RV2A)
          local DV;RV1;RV2;opl_1;opl_2;opl;lijnelement;
          DV:
          RV1:
          RV2:
          opl_1 := dsolve({DV, RV1}, y(x)):
          opl_2 := dsolve({DV, RV2}, y(x)):
          opl:= plot({rhs(opl_1), rhs(opl_2)}, x = 0 .. 5, y = -10 .. 10, thickness = 3):
          lijnelement:=dfieldplot(DV, y(x), x = 0 .. 5, y = -10 .. 10, title = "lijnelementveld met                intergaalkromme door (1,1)(1,-1)"):
          display({opl, lijnelement});
end proc:

NULL

DVA := y(x)*(diff(y(x), x)) = exp(x)

y(x)*(diff(y(x), x)) = exp(x)

(9)

RV1A := y(1) = 1

y(1) = 1

(10)

RV2A := y(1) = -1

y(1) = -1

(11)

DVplot(DVA, RV1A, RV2A)

Error, (in dsolve) not a system with respect to the unknowns [y(x)]

 
 

NULL

Download DV_plotten-_procedure.mw

I have here a function  
                           "sin(x)/x"

and suppose sin(x)/x = 0 
Can I now use MapleAI to retrieve the correct command for this in Maple..could I?

The intersection points with the x-axis are positive and negative multiples of Pi
I have put these in an ordered list, but Maple gives this:
For x domain = -20...20 
X := {x = Pi}, {x = 2*Pi}, {x = 3*Pi}, {x = 4*Pi}, {x = 5*Pi}, {x = 6*Pi}, {x = -6*Pi}, {x = -5*Pi}, {x = -4*Pi}, {x = -3*Pi}, {x = -2*Pi}, {x = -Pi};

 
X := sort(eval~(x, [X]));
 X := [, -6 Pi, -5 Pi, -4 Pi, -3 Pi, -2 Pi, -Pi, 2 Pi, 3 Pi, 4 Pi, 5 Pi, 6 Pi]


A strange ranking that Maple comes up with ? 

with(NaturalLanguage);
        [Explain, GetCommand, GetMath, Query, RawQuery]



GetCommand("give for Maple solve command all options?");
            "solve(equations, variables, options);"

Explain("give for Maple solve command all options?");

"Maple is a symbolic and numeric computing environment. Its 

   "solve" command is used to find solutions (roots) of a given 

   equation or a system of equations.
  

  There are a number of options (or "parameters") which can be 

   specified in this command to alter its behavior:

  

  1. `Allsolutions`: This option makes Maple to generate all 

   possible solutions of an equation.

  

  2. `Real`: This option only provides the real solutions. If 

   equations do not have real solutions, it will return an 

   empty set.

  

  3. `Positive`: It only includes positive solutions in the 

   output.

  

  4. `explicit`: If specified, Maple attempts to isolate roots 

   and provide an explicit solution for each variable.

  

  5. `assume = real`: This option restrict the solutions to 

   only real numbers.

  

  6. `parametric`: This option allows Maple to write the 

   solutions in a parametric form. 

  

  7. `avoid ={x = a}`: This option makes solve exclude the 

   possibility `x = a` as a solution.

  

  8. `MaxDegree = d`: This option allows you to limit the 

   degree of the polynomial equations to be considered.

  

  9. `maxdepth = d`: This sets a limit on recursive depth to 

   which the computation should go to seek a solution.

  

  10. `multiplicities`: This option reports multiplicity of the 

   roots.

  

  11. `solutions = vars`: This option tells Maple to look for 

   solutions for specific variables.

  

  12. `numeric`: This option makes solve find a numeric 

   solution to the equation.

  

  13. `symbolic`: This option makes solve find a symbolic 

   solution to the equation.

  

  14. `simplify`: This option simplifies the solutions returned 

   by solve.

  

  15. `sqrt`: This option allows square roots in the output.

  

  It is important to note that not all options are suited for 

   use with all types of equations. Also, the "solve" command 

   in Maple can be occasionally limited by the complexity of 

   the equation, and may sometimes fail to find solutions that 

   more specialized software or methods can find."



 

 

2 3 4 5 6 7 8 Last Page 4 of 22