Maple 2024 Questions and Posts

These are Posts and Questions associated with the product, Maple 2024

SI_MODEL.mw
I have tried the following code to simulate the following SI Model. But when I run it, it gives me several mistakes and most importantly does not calculate the Jacobian Matrix and the eigenvalues. 

Any help would be deeply appreciated


Many of the most interesting dynamics in nature have to do with interactions between organisms. These interactions are often subtle, indirect, and difficult to detect. Interactions in which one organism consumes all or part of another. This includes predator-prey, herbivore-plant, and parasite-host interactions. These linkages are the prime movers of energy through food chains. They are an important factor in the ecology of populations, determining the mortality of prey and the birth of new predators.

Mathematical models and logic suggest that a coupled system of predator and prey should cycle: predators increase when prey is abundant, prey are driven to low numbers by predation, the predators decline, and the prey recover, ad infinitum. One such model that simulates predator-prey interactions is the Lotka - Volterra Model.

 


We will discuss a behavior of 2 D - subsystems: SI - model.


SI Model (without predator)

 

We will study a mathematical model that appears in eco - eco-epidemiology.


The SI model describes the interactions between S-prey with density x and I-prey with density y under the assumption z≡0


Break the population into compartments.

• 

Prey (S)

• 

Infected prey (I)


SI Equations :

(D(x))(t) = r*x(t)-b*x(t)^2-c*x(t)*y(t)-beta*x(t)*y[t]/(a+x(t))

(D(y))(t) = -mu*y(t)+beta*x(t)*y(t)/(a+x(t))

– 

 r stands for the intrinsic growth rate of S-prey.

– 

b defines the intra-class competition in S-prey.

– 

c characterizes the inter-class competition between S-prey and I-prey.

– 

μ stands for the mortality of the I-prey

– 

β considered as the bifurcation parameter.

• 

Note: The dynamics of the system depend on parameter β

 

Modeling with Differential Equations

 

• 

We will fix the parameters in the study to have the following values r = 1, b = 1, c = 1/100, μ = 4/10, a=1/2.75.

• 

The initial values will be x(0)=0.2, y(0)=0.05


As mentioned above the dynamics of the system depend on parameter β. So we will consider two cases when β=0.75 and β=1


We will solve the system for the above values of parameters and initial conditions and for a time interval [0,200] , then we will create its plots

 

Case 1

  restart

beta := .75; r := 1; b := 1; c := 1/100; mu := 4*(1/10); a := 1/2.75; f := r*x(t)-b*x(t)^2-c*x(t)*y(t)-(3/4)*x(t)*y(t)/(a+x(t)); g := -mu*y(t)+(3/4)*x(t)*y(t)/(a+x(t)); deq1 := diff(x(t), t) = f; deq2 := diff(y(t), t) = g; equilibrio := solve({f = 0, g = 0}, {x(t), y(t)}); jacobian := simplify(Matrix(2, 2, [[diff(f, x(t)), diff(f, y(t))], [diff(g, x(t)), diff(g, y(t))]])); A := simplify(eval(jacobian, equilibrio[1])); B := simplify(eval(jacobian, equilibrio[2])); Q := simplify(eval(jacobian, equilibrio[3])); eigen1 := Eigenvalues(A); eigen2 := Eigenvalues(B); eigen3 := Eigenvalues(Q); soln := dsolve({deq1, deq2, x(0) = .2, y(0) = 0.5e-1}, numeric, output = listprocedure); plots:-display(plots:-odeplot(soln, [t, x(t)], 0 .. 200, color = blue, legend = ["x(t)"]), plots:-odeplot(soln, [t, y(t)], 0 .. 200, color = red, legend = ["y(t)"]), labels = ["t", "Population"], title = "Population Dynamics")

 

NULL

 

 

Case 2

restart``

beta := 1; r := 1; b := 1; c := 1/100; Mu := 4*(1/10); a := 1/2.75; f := r*x(t)-b*x(t)^2-c*x(t)*y(t)-x(t)*y(t)/(a+x(t)); g := -Mu*y(t)+x(t)*y(t)/(a+x(t)); deq1 := diff(x(t), t) = f; deq2 := diff(y(t), t) = g; equilibrio := solve({f = 0, g = 0}, {x(t), y(t)}); jacobian := Matrix(2, 2, [[diff(f, x(t)), diff(f, y(t))], [diff(g, x(t)), diff(g, y(t))]], simplify); J_at_equilibrio := [eval(jacobian, equilibrio)]; eigen1 := Eigenvalues(A); eigen2 := Eigenvalues(B); eigen3 := Eigenvalues(Q); soln := dsolve({deq1, deq2, x(0) = .2, y(0) = 0.5e-1}, numeric); plots:-display(plots:-odeplot(soln, [t, x(t)], 0 .. 200, color = blue, legend = ["x(t)"]), plots:-odeplot(soln, [t, y(t)], 0 .. 200, color = red, legend = ["y(t)"]), labels = ["t", "Population"], title = "Population Dynamics with Beta = 1")

 

NULL


 

Download SI_MODEL.mw

 

 

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 want to solve or try to solve this equation 

PDE := diff(G(a, H, phi, PI), a)(aH) + diff(G(a, H, phi, PI), H)(k/a^2 - kappa^2/2*PI^2/a^6) + diff(G(a, H, phi, PI), phi)(PI/a^3) = diff(G(a, H, phi, PI), PI)(a^3*diff(V(phi), phi))

with pdsolve(PDE, G)

and maple answer me the next

Error, (in pdsolve/info) first argument does not have a differentiated function with name G

I nw in maple, maybe I´m make a mistake, but I can't find what

I have  4 worksheets with derived equations. So I export the equations and  possibly some procedures (but they can be handled seperately if needed)  from each worksheet as a .mpl file. 

I want to combine the .mpl files  together without using copy/paste. Then I can open that single file in the VS code editor.
There may be other ways to achieve this so I am open to suggestions.

I chased down a problem to factoring a square that has sqrt in the coefficients. All numbers are real,
The code is inside a procedure in a package. Iso I could do with something robust.

expand((sqrt(A+B)*x+sqrt(7-K)*y)^2)
     2      2            (1/2)          (1/2)        2      2
  A x  + B x  + 2 (A + B)      x (7 - K)      y - K y  + 7 y 

factor(%) 

 

Hello, everyone,

I am new to Maple and I am trying to get use of it.

I tried to plot the following linear systems in different ways. I realized that the Student Linear Algebra is not as flexible as Linear Algebra. My question is the following. Is there any other way to create a plot without defining the implicit plots?

with(Student[LinearAlgebra])

A := Matrix([[1, 1], [12, 16]]); b := Vector([10, 136]); sol := LinearSolve(A, b)

Matrix(2, 2, {(1, 1) = 1, (1, 2) = 1, (2, 1) = 12, (2, 2) = 16})

 

Vector(2, {(1) = 10, (2) = 136})

 

Vector[column](%id = 36893488153382714652)

(1)

LinearSystemPlot({x+y = 10, 12*x+16*y = 136}, axes = normal)

 

restart

 

 

with(Student[LinearAlgebra])

A := Matrix([[2, -1, 1], [0, 1, 3], [0, 0, 1]]); b := Vector([-5, 7, 2]); sol := LinearSolve(A, b)

Matrix(3, 3, {(1, 1) = 2, (1, 2) = -1, (1, 3) = 1, (2, 1) = 0, (2, 2) = 1, (2, 3) = 3, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1})

 

Vector(3, {(1) = -5, (2) = 7, (3) = 2})

 

LinearSolve(Matrix(%id = 36893488151878044716), Vector[column](%id = 36893488151878030628))

(2)

LinearSystemPlot({w = 2, y+3*w = 7, 2*x-y+w = -5}, axes = normal)

 

restart

with(plots); with(LinearAlgebra); A := Matrix([[1, 1], [12, 16]]); b := Vector([10, 136]); sol := LinearSolve(A, b); eq1 := x+y = 10; eq2 := 12*x+16*y = 136; plot1 := implicitplot(eq1, x = -5 .. 10, y = -50 .. 50, color = "red", thickness = 2, labels = ["x", "y"]); plot2 := implicitplot(eq2, x = -5 .. 10, y = -50 .. 50, color = "blue", thickness = 2); display(plot1, plot2, title = "Plot of Linear System", legend = [x+y = 10, 12*x+16*y = 136])

Matrix(2, 2, {(1, 1) = 1, (1, 2) = 1, (2, 1) = 12, (2, 2) = 16})

 

Vector(2, {(1) = 10, (2) = 136})

 

Vector[column](%id = 36893488153330030820)

 

x+y = 10

 

12*x+16*y = 136

 

 

A := Matrix([[2, -1, 1], [0, 1, 3], [0, 0, 1]]); b := Vector([-5, 7, 2]); solution := LinearSolve(A, b); eq1 := 2*x-y+z = -5; eq2 := y+3*z = 7; eq3 := z = 2; plot1 := implicitplot3d(eq1, x = -10 .. 10, y = -10 .. 10, z = -10 .. 10, color = "red", style = surface); plot2 := implicitplot3d(eq2, x = -10 .. 10, y = -10 .. 10, z = -10 .. 10, color = "blue", style = surface); plot3 := implicitplot3d(eq3, x = -10 .. 10, y = -10 .. 10, z = -10 .. 10, color = "green", style = surface); display(plot1, plot2, plot3, title = "3D Plot of Linear System", axes = boxed)

Matrix(3, 3, {(1, 1) = 2, (1, 2) = -1, (1, 3) = 1, (2, 1) = 0, (2, 2) = 1, (2, 3) = 3, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1})

 

Vector(3, {(1) = -5, (2) = 7, (3) = 2})

 

Vector[column](%id = 36893488152610632156)

 

 

NULL


 

Download linear_systems.mw

 

OEIS A034828 and OEIS A000292 (which give the Wiener index for the cycle graph and the path graph respectively) mention that 

the Wiener index of the cycle of length 19 is 855 and 
the Wiener index of the path with 19 edges is 1330

However, 

GraphTheory:-WienerIndex(GraphTheory:-CycleGraph(19));
 = 
                               38

GraphTheory:-WienerIndex(GraphTheory:-PathGraph(20));
 = 
                               38

So what happened here? 

I was attempting to remove part of string using StringTools:-Remove()

But it causes server.exe crash each time.

Any idea why this happens?

Worksheet below

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1735. The version installed in this computer is 1732 created 2024, April 17, 19:33 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib\`

restart;

3048

ode:=x*y(x)*diff(y(x), x) = (x + 1)*(y(x) + 1):
ode:=diff(y(x), x$2) = (y(x) + 1):
the_output:=Student:-ODEs:-ODESteps(ode,y(x)):
 

s:=latex(the_output,'output'=string):

StringTools:-Remove(s,"\\begin{array}{ccc}");


Download crash_during_string_tools_remove_maple_2024.mw

ps. reported to Maplesoft also.

Maple dsolve fails to find many singular solutions using the option 'singsol'=all.

Any idea why that is? Here is one example

ode:=diff(y(x),x)=(y(x)-3)^2;
dsolve(ode,y(x),'singsol'=all)

It returns 

But we see that y=3 is singular solution which can't be obtained from the above solution for any value of c1

Mathematica finds this singular solution

ode=y'[x]==(y[x]-3)^2
DSolve[ode,y[x],x,IncludeSingularSolutions->True]

Here is second example.

restart;
ode:=diff(y(x),x)=2*x*sqrt(1-y(x)^2);
dsolve(ode,y(x),'singsol'=all)

Gives

But it misses the y=1,y=-1 singular solutions. 

Is there something I am doing wrong? Why does Maple sometimes fail to find singular solutions?

ps. reported to Mapesoft also.

Update

I remembered now a case similar to this. one has to use `Lie` solver and now Maple gives the singular solution

ode:=diff(y(x),x)=(y(x)-3)^2;
dsolve(ode,Lie,'singsol'=all)

There is no mention of this in help and it is still not clear to me if one has to always use Lie solver to obtain singsol or if this is just a coincidence for this one case.  

Same for the other case:

restart;
ode:=diff(y(x),x)=2*x*sqrt(1-y(x)^2);
dsolve(ode,'Lie','singsol'=all)

gives

I think singsol should work all the time and not only when using specific solver. If Lie solver is needed for singsol to work, then help should be clear and say this.

Consider the following exact algebraic number expr
 

restart;

kernelopts('version'):

Physics:-Version():

expr := Physics:-`*`(2-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2), sqrt(1-(1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2))^2))+Physics:-`*`(Physics:-`*`(3+Physics:-`*`(4, 1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)), 1/12), sqrt(3-Physics:-`*`(4, (1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2))^2)))+Physics:-`*`(Physics:-`*`(2, Physics:-`*`(2-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2), 1/3)), sqrt(Physics:-`*`(Physics:-`*`(2, 2-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)), 1-Physics:-`*`(2, 1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)))))+Physics:-`*`(Physics:-`*`(1+Physics:-`*`(2, 1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)), 1/6), sqrt(Physics:-`*`(2, (1/4)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)^2-Physics:-`*`(3, (1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2))^2)))):

CodeTools:-Usage(PolynomialTools:-MinimalPolynomial(expr));

memory used=0.97MiB, alloc change=12.00KiB, cpu time=31.00ms, real time=27.00ms, gc time=0ns

 

27*_X^2+70*_X-433

(1)

evalf[30](eval(27*_X^2+70*_X-433, _X = expr));

0.262508598220109180966e-6

(2)

"evalf((mp:=CodeTools:-Usage(evala(':-Minpoly'(expr,_X)))));"

memory used=70.25GiB, alloc change=48.00MiB, cpu time=23.63m, real time=21.81m, gc time=3.18m

 

-422.3889573*_X+2208.949800*_X^4-225.8139518*_X^3-230.2173498*_X^2+59.33811620+_X^10-19.92850932*_X^9+166.6440365*_X^8-755.9985571*_X^7+1997.484781*_X^6-3014.379082*_X^5

(3)

type(mp, polynom(rational, _X))

false

(4)


 

Download wrong_minpoly.mw 
I would like to find its minimal polynomial (without a priori knowledge). 

According to the documentation, 

if is an exact algebraic number, and and are not given, then PolynomialTools:-MinimalPolynomial(expr) will call  to compute an exact minimal polynomial of . If a name is not specified for the variable , then  will be used.

Regretfully, it is easy to see that the minimal polynomial of expr cannot be the returned 27*_X^2 + 70*_X - 433. And when I invoke  directly, the result is still not correct (and this evaluation takes a rather long time). 
Another help page mentions that 

the call mp := evala(Minpoly(expr, _X)) computes the monic minimal polynomial of  in the variable  over the field of rational numbers (or multivariate rational functions); the resulting polynomial will not contain any algebraic numbers or functions.

However, as type(mp, polynom(rational, _X)) gives , we know that cannot be the desired minimal polynomial of expr either. 
So, what is the proper way to compute the minimal polynomial of expr in Maple? 

Code: 

use alpha=1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345,index=2)-1/2)**2) in 
	expr:=(1+alpha)*sqrt(1-alpha**2)+(3+4*alpha)/12*sqrt(3-4*alpha**2)+2*(1+alpha)/3*sqrt(2*(1+alpha)*(1-2*alpha))+(1+2*alpha)/6*sqrt(2*((1-alpha)**2-3*alpha**2)) 
end:
CodeTools:-Usage(PolynomialTools:-MinimalPolynomial(expr));

Of note, the minimal polynomial of an algebraic number zeta is the unique irreducible monic polynomial of smallest degree p(x) with rational coefficients such that p(zeta)=0 and whose leading coefficient is 1

As the following worksheet shows, 
 

restart

kernelopts('version');

Physics:-Version();

`Maple 2024.0, X86 64 WINDOWS, Mar 01 2024, Build ID 1794891`

`The "Physics Updates" version in the MapleCloud is 1732 and is the same as the version installed in this computer, created 2024, April 12, 17:58 hours Pacific Time.`

with(RealDomain):

eval(MTM:-det(<
   a, b/2, d/2 |
   b/2, c, e/2 |
   d/2, e/2, f
  >), PDETools:-Solve(MTM:-det(<
     x**2 + y**2, x1**2 + y1**2, x2**2 + y2**2, x3**2 + y3**2 |
     x, x1, x2, x3 |
     y, y1, y2, y3 |
     1, 1, 1, 1
    >) = inner([a, b, c, d, e, f], [x**2, x*y, y**2, x, y, 1]),
   {f, e, d, c, b, a}, 'independentof' = {y, x}))/MTM:-det(<
  x1, x2, x3 |
  y1, y2, y3 |
  1, 1, 1
 >): simplify(`%`);

-(1/4)*(x1^2-2*x1*x2+x2^2+(y1-y2)^2)*(x2^2-2*x2*x3+x3^2+(y2-y3)^2)*(x1^2-2*x1*x3+x3^2+(y1-y3)^2)

eval(MTM:-det(<
   a, b/2, d/2 |
   b/2, c, e/2 |
   d/2, e/2, f
  >), PDETools:-Solve(MTM:-det(<
     x**2 - y**2, x1**2 - y1**2, x2**2 - y2**2, x3**2 - y3**2, x4**2 - y4**2 |
     x*y, x1*y1, x2*y2, x3*y3, x4*y4 |
     x, x1, x2, x3, x4 |
     y, y1, y2, y3, y4 |
     1, 1, 1, 1, 1
    >) = inner([a, b, c, d, e, f], [x**2, x*y, y**2, x, y, 1]),
   {f, e, d, c, b, a}, 'independentof' = {y, x}))/(MTM:-det(<
   x2, x3, x4 | 
   y2, y3, y4 | 
   1, 1, 1
  >)*MTM:-det(<
   x3, x4, x1 | 
   y3, y4, y1 | 
   1, 1, 1
  >)*MTM:-det(<
   x4, x1, x2 | 
   y4, y1, y2 | 
   1, 1, 1
  >)*MTM:-det(<
   x1, x2, x3 | 
   y1, y2, y3 | 
   1, 1, 1
  >)): simplify(`%`);

(1/4)*((x2-x3)*x1-x2*x4+x3*x4+(y2-y3)*(y1-y4))*((x3-x4)*x1+(x4-x3)*x2+(y3-y4)*(y1-y2))*((x2-x4)*x1-x2*x3+x3*x4+(y2-y4)*(y1-y3))


 

Download Why_not_consider_subexpressions?.mw

the underlined part is evidently not the simplest. (For instance, shouldn't RealDomain:-simplify(x2^2 - 2*x2*x3 + x3^2 + (y2 - y3)^2, 'size') and RealDomain:-simplify((x2-x3)*x1-x2*x4+x3*x4+(y2-y3)*(y1-y4), 'size') be converted into RealDomain:-simplify((x2 - x3)^2 + (y2 - y3)^2, 'size') and RealDomain:-simplify((x2 - x3)*(x1 - x4) + (y2 - y3)*(y1 - y4), 'size')?) 
If I understand correctly, , by default, should try combining every part of an expression with every other to apply a vast range of potential transformations to look at many different forms of it and make progress in picking out the simplest possible one. So, why is simplify unable to touch certain sub-expressions when they are encountered at intermediate stages in a computation? 

Could someone be able to spot why I get different solution when solving for the constant of integration from this Maple dsolve solution manually than when asking Maple to do it directly?

This is the ode 

ode:=x*y(x)*diff(y(x), x) = (x + 1)*(y(x) + 1);
ic:=y(1) = 1;

If I ask Maple to solve it with the IC all at once, it gives solution which odetest verifies OK.

If I ask Maple to solve it with no IC, then solve the constant myself and plug the constant back into the solution I get solution which does not verify any more.

I am not able to find why. Could someone spot the error in this? Please see worksheet below. I suspect the problem is when plugging back the constant of integration into the general solution, but have no idea now what it is. Clearly Maple did something much smarter than what I did by just plugging the constant back into the solution. May be need to specify what branch to use when plugging the constant back? but how do I know which one?
 

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1730 and is the same as the version installed in this computer, created 2024, April 17, 19:33 hours Pacific Time.`

ode:=x*y(x)*diff(y(x), x) = (x + 1)*(y(x) + 1);
ic:=y(1) = 1;
sol_no_IC:=dsolve(ode);
 

x*y(x)*(diff(y(x), x)) = (x+1)*(y(x)+1)

y(1) = 1

y(x) = -LambertW(-exp(-x-1)/(x*c__1))-1

sol_with_IC_direct:=dsolve([ode,ic]);
odetest(sol_with_IC_direct,[ode,ic]);

y(x) = -LambertW(-1, -2*exp(-x-1)/x)-1

[0, 0]

#this verifies Maple found correct constant also:

solve(rhs(sol_with_IC_direct)=rhs(sol_no_IC),c__1)

1/2

#now solve for constant of integration manually. This gives invalid solution. Why?

eq:= 1=limit(rhs(sol_no_IC),x=1);

1 = -LambertW(-exp(-2)/c__1)-1

PDEtools:-Solve(eq,c__1);

c__1 = 1/2

sol_with_ic:=eval(sol_no_IC,%)

y(x) = -LambertW(-2*exp(-x-1)/x)-1

odetest(sol_with_ic,[ode,ic]);

[0, 2+LambertW(-2*exp(-2))]

 

 

Download why_wrong_solution.mw

In my view, <x || (1 .. 2); y || (1 .. 2); 1 $ 2> should return a Matrix without any error messages; however, 

<x || (1 .. 2); y || (1 .. 2); 1 $ 2>; # Arguments are shielded??? 
Error, (in Matrix) this entry is too wide or too narrow: 1

If I understand right, each argument of a function is evaluated in turn (unless the modifier is used). 
So why is it not equivalent to <x1, x2; y1, y2; 1, 1>

 

I am trying to find the minimum values of a table, but not of all of its indices, just some that comply to a certain pattern.

The minimum of the values of a table are found by using min(entries(atable)).

If the indices of atable are "a1", "a2", "b1", "b2", I would like to just have the ones starting with "a".

Can be done by a loop, but is there a easier way?

I any trying to seperate the real and imaginary components but they are mixed up inside and outside a square root.

Their seems to be a problem displaying the worksheet.

restart



expand((a+I*b)*(a-I*b))
(a+I*b)+(a-I*b)
# z = x *Iy    I need to seperate out solution to [x,y] & [x,-y]
#https://math.stackexchange.com/questions/44391/foci-of-a-general-conic-equation
eq := T*z^2 - (R + S*I)*z +G-K + H*I
sol:=solve(eq,z)
expand(sol[1]*sol[2])=a^2+b^2
simplify(sol[1]+sol[2]=2*a)
simplify(sol[1]-sol[2]=2*b)

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/2024-04-20_Q_Seperate_Real_&_Imaginary.mw .

Download 2024-04-20_Q_Seperate_Real_&_Imaginary.mw

First 20 21 22 23 24 25 26 Page 22 of 27