janhardo

435 Reputation

8 Badges

10 years, 232 days

MaplePrimes Activity


These are questions asked by janhardo


Don't see here the FunctionAdvisor , what is included for every choosen function.

 

How to obtain a clear plot of Zeta function
- via a total plot ?
- via partial plots ?
- further take circle in complex domain : complex plane ( riemann surface) , to be continued..

 

ComplexSurface := proc(complex_function, x_range, y_range, view_opt, orient_opt, grid_opt)
    local f, plot, combined_plot;
    
    # Define the complex function f(z)
    f := unapply(complex_function, z);
    
    # Call the FunctionAdvisor to provide plot recommendations
    FunctionAdvisor(f(z), z = x + I*y, 'view' = view_opt, 'orientation' = orient_opt, 'grid' = grid_opt);
    
    # Plot the complex surface
    plot := plot3d([evalc(Re(f(x + I*y))), evalc(Im(f(x + I*y)))], x = x_range, y = y_range, view = view_opt, orientation = orient_opt, grid = grid_opt, style = surface, title = sprintf("Plot of %a", complex_function));
    
    # Print the combined plot
    combined_plot := plot;
    #printf("Plot of the complex surface:\n");
    print(combined_plot);
    
    # Display additional messages
    printf("Procedure input:\n");
    printf("ComplexSurface(complex_function, x_range, y_range, view_opt, orient_opt, grid_opt)\n");
    printf("complex_function: The complex function to be plotted\n");
    printf("x_range: Range of the real axis\n");
    printf("y_range: Range of the imaginary axis\n");
    printf("view_opt: List of the form [x_min..x_max, y_min..y_max, z_min..z_max], determines the visible region\n");
    printf("orient_opt: List of the form [angle_x, angle_y], determines the viewing angle\n");
    printf("grid_opt: List of the form [x_grid, y_grid], determines the grid resolution\n");
    printf("\n");
    printf("Example usage:\n");
    printf("ComplexSurface(Zeta(z), -50..5, -5..5, [-50..50, -5..5, 0..15], [120, 60], [50, 50]);\n");
    printf("\n");
    printf("Where Zeta(z) is the complex function to be plotted, and the ranges, view options, orientation options, and grid options are specified accordingly.\n");
end proc:
 

 

ComplexSurface(Zeta(z), -50..50, -5..5, [-50..50, -5..5, 0..15], [120, 60], [50, 50]);

 

Procedure input:
ComplexSurface(complex_function, x_range, y_range, view_opt, orient_opt, grid_opt)
complex_function: The complex function to be plotted
x_range: Range of the real axis
y_range: Range of the imaginary axis
view_opt: List of the form [x_min..x_max, y_min..y_max, z_min..z_max], determines the visible region
orient_opt: List of the form [angle_x, angle_y], determines the viewing angle
grid_opt: List of the form [x_grid, y_grid], determines the grid resolution

Example usage:
ComplexSurface(Zeta(z), -50..5, -5..5, [-50..50, -5..5, 0..15], [120, 60], [50, 50]);

Where Zeta(z) is the complex function to be plotted, and the ranges, view options, orientation options, and grid options are specified accordingly.

 

 

ComplexSurface(ln(z), -50..50, -5..5, [-50..50, -5..5, 0..15], [120, 60], [50, 50]);

 

Procedure input:
ComplexSurface(complex_function, x_range, y_range, view_opt, orient_opt, grid_opt)
complex_function: The complex function to be plotted
x_range: Range of the real axis
y_range: Range of the imaginary axis
view_opt: List of the form [x_min..x_max, y_min..y_max, z_min..z_max], determines the visible region
orient_opt: List of the form [angle_x, angle_y], determines the viewing angle
grid_opt: List of the form [x_grid, y_grid], determines the grid resolution

Example usage:
ComplexSurface(Zeta(z), -50..5, -5..5, [-50..50, -5..5, 0..15], [120, 60], [50, 50]);

Where Zeta(z) is the complex function to be plotted, and the ranges, view options, orientation options, and grid options are specified accordingly.

 

 


 

Download complex_oppervlak_zeta_functie_maple_primes.mw

Can this be better done in Maple ? , see worksheet.

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

1 2 3 4 5 6 7 Last Page 3 of 21