Maple 2022 Questions and Posts

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

I found another big problem. 

In 2022, I get Error, (in SolveTools:-Polynomial) too many levels of recursion when using alias(seq(c[k] = _C||k, k = 0..10)); at the top of my code and the solution to the ode has c[2],c[3] etc.. as constants of integration.

This solution was given by Kitonum in this answer

I had this for years in the code (i.e. the alias) code.

In Maple 2022 the following gives the above exception error from odetest. I am using 2022, because in 2023 it just hangs on the same code.  

If I remove the alias code, no error shows. (solution is wrong, but that is different story). 

Also, If I remove the alias code, 2023 no long hangs!  

restart;

#kernelopts('assertlevel'=2):

alias(seq(c[k] = _C||k, k = 0..10));

c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10]

ode:=diff(diff(y(x),x),x)+4*diff(y(x),x)+12*y(x) = 80*sin(2*x);
sol:=y(x) = -10*exp(-1/2*2^(1/2)*arctan(sin(2*2^(1/2)*x)/cos(2*2^(1/2)*x)))*(c[3]*cos(2*2^(1/2)*x)+c[2]*sin(2*2^(1/2)*x))*((-1/10*exp(4*I*2^(1/2)*x)+1/10)*c[2]-1/10*I*c[3]*exp(4*I*2^(1/2)*x)-1/10*I*c[3])/((exp(4*I*2^(1/2)*x)-1)*c[2]+I*c[3]*exp(4*I*2^(1/2)*x)+I*c[3])*c[1]-10*I*exp(-1/2*2^(1/2)*arctan(sin(2*2^(1/2)*x)/cos(2*2^(1/2)*x)))*(c[3]*cos(2*2^(1/2)*x)+c[2]*sin(2*2^(1/2)*x))*(cos(2*x)-sin(2*x))*exp(2*I*2^(1/2)*x)*exp(2*I*2^(1/2)*x)^(-1/2*I*2^(1/2))/((exp(4*I*2^(1/2)*x)-1)*c[2]+I*c[3]*exp(4*I*2^(1/2)*x)+I*c[3]);

odetest(sol,ode);

diff(diff(y(x), x), x)+4*(diff(y(x), x))+12*y(x) = 80*sin(2*x)

y(x) = -10*exp(-(1/2)*2^(1/2)*arctan(sin(2*2^(1/2)*x)/cos(2*2^(1/2)*x)))*(c[3]*cos(2*2^(1/2)*x)+c[2]*sin(2*2^(1/2)*x))*((-(1/10)*exp((4*I)*2^(1/2)*x)+1/10)*c[2]-((1/10)*I)*c[3]*exp((4*I)*2^(1/2)*x)-((1/10)*I)*c[3])*c[1]/((exp((4*I)*2^(1/2)*x)-1)*c[2]+I*c[3]*exp((4*I)*2^(1/2)*x)+I*c[3])-(10*I)*exp(-(1/2)*2^(1/2)*arctan(sin(2*2^(1/2)*x)/cos(2*2^(1/2)*x)))*(c[3]*cos(2*2^(1/2)*x)+c[2]*sin(2*2^(1/2)*x))*(cos(2*x)-sin(2*x))*exp((2*I)*2^(1/2)*x)*(exp((2*I)*2^(1/2)*x))^(-((1/2)*I)*2^(1/2))/((exp((4*I)*2^(1/2)*x)-1)*c[2]+I*c[3]*exp((4*I)*2^(1/2)*x)+I*c[3])

Error, (in SolveTools:-Polynomial) too many levels of recursion

 

Download odetest_error_june_15_2023.mw

Why using the alias line above causes this error?  If you remove the alias line, you will see it completes with no error.

But it hangs in 2023. I am no longer using 2023 but went back to 2022 due to too many hangs in 2023. I wonder now if it because of this alias line I had there all the time.  I will remove now and see if this solves some of the hangs I had in 2023.

Anyone can shed some more light on what is going on?

Windows 10.

I can't figure how to obtain list of all modules inside my .mla file.

I can see all the modules using the command LibraryTools:-Browse("..../my_file.mla") then clicking EDIT then VIEW option at top right corner.  Member type is automatically set to MODULE in the lower left corner. So I can see the names of all the modules. And using the slider, I can scrol down. I see 73 modules listed.

But I want to do this in code. Not using GUI.

I tried the command

          L:=LibraryTools:-ShowContents(my_file.mla):

And this gives L of lenght 15805. Looking at each entry in the above list, it shows things I do not understand and I do not want. It has names in there which I do not know where these came from.

There does not seem to be an option in LibraryTools:-ShowContents() to only return the names of the modules inside .mla. At least I can't find such option.

reference Maple help page

Any idea how to do this in code? Not using the maplet? 

Maple 2022 on windows 10

ps. I know I can use the GUI and do EXTRACT to save the list to a file. But this is not good solution. I need the list of names of the modules be in a list so I can do this all in a function with no manual steps.

Does Maple have a command to list all names of all procs (local and exported) given a name of module?

There is a question/answer here which shows how to list all procs in module. But I only want the names.

The reason I am asking, I am trying to see if I can code 

     trace(moduleA:-proc1,
               moduleA:-proc2,
               moduleB:-proc3,....,
               moduleE:-proc1000,
               statements = false)

Before running my programming in order to turn tracing on. The problem is that there are 1,000's of proc's in dozens of modules so I need a way to obtain a sequence of the names all such procs automatically each time.

Once I figure how to do it for one module (say moduleA), I will apply this to the other modules I have and collect all names in one long sequence and see if this will work.

Any suggestion how to do this?  I now have all my modules inside one .mla file if it helps. They are all build ito this .mla from source tree of dozens of .mpl files.

Maple 2022 on windows 10

When adding option trace: inside a proc, Maple display trace of all assignments. I only want to see the --> enter  and <-- exit messages,.

I can't figure how to do that. Any suggestions? 

Maple 2022 on windows

restart;

A := module()
 export foo:=proc(n,m,k)   
   option trace:
   local r;

   r:=n:
   B:-boo(r);
 end proc:
end module:
B := module()
 export boo:=proc(n)
   option trace:
   local k;

   k:=n;
   RETURN();
 end proc:
end module:

#kernelopts(tracelineinfo=2);
#printlevel := 10:
kernelopts(traceincidentalassign=false):
kernelopts(tracesplitmulassign=false):
kernelopts(traceshowspecassign=false):
kernelopts(traceincidentalassign=false):
kernelopts(tracesplitmulassign=false):
kernelopts(traceshowspecassign=false):
kernelopts(tracelineinfo=0):
A:-foo(1,2,diff(y(x),x)=sin(x))

{--> enter foo, args = 1, 2, diff(y(x), x) = sin(x)

1

{--> enter boo, args = 1

1

<-- exit boo (now in foo) = }

<-- exit foo (now at top level) = }

 

Download trace_june_14_2023.mw

I want to plot phase portrait for 4 dimension. help me

4_equation_phase_portrait.mw

thank youvery much

Hi,

Here is the code I would like to complete:

with(plots):
theta:= s -> -2*Pi*n*s/ell;
v:=s->piecewise(And(0<=s,s<=ell/2), c*s, ell/2<s, c*(ell-s));
ell:=1;
c:=1;
n:=2;
spacecurve([cos(theta(s)),v(s),sin(theta(s))],s=0..ell,colorscheme = ["valuesplit",???????]);

What to put in place of the question marks so that the color of the curve is, for example, red if s is between 0 and ell/2, and green if s is between ell/2 and ell?

Thanks.

Hi senior, i am trying to customize the range for horizontal axis means in my case y axis but got error, also trying to give different color for outcomes. Please help in this regards.

Axis_Help.mw

I desire to find the summation value of errors from EA1 to EA19. After finding the summation, i want to find the average error. Can any of experts show how the maple should be done?

restart

ERROR COMPARISON

 

n := [84, 83, 83, 81, 85, 86, 86, 83, 82, 83, 84, 83, 81, 80, 83, 79, 82, 81, 85]

[84, 83, 83, 81, 85, 86, 86, 83, 82, 83, 84, 83, 81, 80, 83, 79, 82, 81, 85]

(1)

nops(n)

19

(2)
• 

-BBDF*FORMULA*FORWARD+PC

A := [90.3333, 85.3636, 80.1313, 81.4518, 78.9241, 90.2078, 89.8305, 85.9949, 78.7198, 79.8495, 84.3264, 86.2465, 82.7222, 78.1001, 77.8260, 86.7687, 77.2371, 85.2345, 81.7439]

[90.3333, 85.3636, 80.1313, 81.4518, 78.9241, 90.2078, 89.8305, 85.9949, 78.7198, 79.8495, 84.3264, 86.2465, 82.7222, 78.1001, 77.8260, 86.7687, 77.2371, 85.2345, 81.7439]

(3)

``

nops(A)

19

(4)

NULL

for i to 19 do EA[i] := abs(A[i]-n[i]) end do

6.3333

 

2.3636

 

2.8687

 

.4518

 

6.0759

 

4.2078

 

3.8305

 

2.9949

 

3.2802

 

3.1505

 

.3264

 

3.2465

 

1.7222

 

1.8999

 

5.1740

 

7.7687

 

4.7629

 

4.2345

 

3.2561

(5)

``

 

NULL

``

(6)

Download error_pc-bbdf_forward_formula.mw

When I look for petrov type II vacuum solutions in the Metric search, one of the metrics i get is Stephani [33,8,3].

But when I load the metric and calculate the Ricci or the Einstein tensor, they are not identically zero.
Am I using the metric search wrong or is there a glitch in the program?

Download Temp.mw

How can an equation containing a logarithmic function be converted into a polynomial?

Hi,

I have a data structure/plotting question. How do I plot the 3 lambdas (singleaxis) and the 6 betas (dualaxis) for 12 calibrations (1000 runs each)? All the details are in the script 230523_different-calibrations.mw. Thank you!

For the beta plots and subplots, please follow the dualaxis example output format at the bottom of my script for each of the 12 calibrations.

For the lambda plots, I'd like to combine a few of them as follows (each plot with lambda_1 subplot, lambda_2 subplot, and lambda_3 subplot - note that the lambda plot example at the bottom of the script is dualaxis but I just need singleaxis):

PLOT 1 (singleaxis): lambda_1, _2, _3 for ncal2 and ncal3 (superimposed, 2 data series for each subplot)

PLOT 2 (singleaxis):  lambda_1, _2, _3 for ncal7 and ncal8 (superimposed, 2 data series for each subplot)

PLOT 3 (singleaxis):  lambda_1, _2, _3 for ncal4, ncal5, ncal6 (superimposed, 3 data series for each subplot)

PLOT 4 (singleaxis):  lambda_1, _2, _3 for ncal9, ncal10, ncal11 (superimposed, 3 data series for each subplot)

 I run the attached code, but after waiting for a few minutes, there is no response, does anyone know the reason?

 It only shows Evaluating!!!!

 sy01.mw

I know trig functions are hard to simplify in general but was wondering if there was any simplification command that comes in handy for trig functions of the following form.

sin(theta)^(A - 2)*cos(theta)^2 - sin(theta)^(A - 2) + sin(theta)^A

I am trying to make a very rough animation of a rotating pulsar magnetosphere that would very roughly resemble this gif.
I was able to make a sphere and the dipolar field lines. I was wondering if anyone could provide any possible suggestion regarding.

1. How do i animate the rotation such that the rotation axis is not z but slightly misaligned to z.

2. Is there a better way to make the field likes from the poles (jets).

restart

[1.1, cos(theta), theta]

[1.1, cos(theta), theta]

(1)

sph := [.5, theta, phi]; c1 := [A*sin(phi)^2, 0, phi]; c2 := [A*sin(phi)^2, (1/6)*Pi, phi]; c3 := [A*sin(phi)^2, (1/3)*Pi, phi]; c4 := [A*sin(phi)^2, (1/2)*Pi, phi]; c5 := [A*sin(phi)^2, 2*Pi*(1/3), phi]; c6 := [A*sin(phi)^2, 5*Pi*(1/6), phi]

[A*sin(phi)^2, (5/6)*Pi, phi]

(2)

NULL

NULL

NULL

A := 2; plot3d([c1, c2, c3, c4, c5, c6, sph], phi = 0 .. 2*Pi, theta = 0 .. 2*Pi, coords = spherical, plotlist = true, scaling = constrained)

2

 

 

NULL

s1 := [sqrt(theta), 1, 1/10]; s2 := [sqrt(theta), 3, -1/10]; s3 := [sqrt(theta), 2, 1/10]; s4 := [sqrt(theta), 1.7, 1/7]

p := plot3d([sph, s1, s2, s3, s4, s5, s6, c1, c2, c3, c4, c5, c6], phi = 0 .. 2*Pi, theta = 0 .. Pi, coords = spherical, orientation = [-75, 58, 10], scaling = constrained, color = ["SkyBlue", "yellow", "yellow", "yellow", "yellow", "yellow", "yellow", "red", "red", "red", "red", "red", "red"])

``

NULL

NULL

plots[animate](plot3d, [[sph, s1, s2, s3, s4, s5, s6, c1, c2, c3, c4, c5, c6], theta = 0 .. Pi, phi = 0 .. 2*Pi, orientation = [B, 45, 52], coords = spherical], B = -180 .. 180)

NULL

 

Download Pulsar_temp.mw

3. Any other suggestions that could help with the aesthetics.

120523_problem_parallel.mw

Last execution block is not producing any output. Why?

The 3x3 nonlinear system I am trying to solve is already a stylized version of my problem, as I already:

  1. Calibrated my equations before attempting to solve for them (search for "Calib_1" in my script)
  2. Split the original 6x6 system into two 3x3 sub-systems (since 3 out of 6 variables only appear in 3 out of 6 equations) and solved for one sub-system

What else can you think of? Should I instead use the parallel solver on the whole 6x6 system rather than just the unsolved 3x3 sub-system?

How to find, if exist, singular solutions? That is, some valuation of some parameters that will yield a solution that cannot be obtained by applying the same valuation to a general solution. Carl Love (who I cannot tag) once mentioned: "The parameter valuations that lead to singular solutions can often be guessed by using valuations that would produce zeros in denominators in the general solution. A singular solution can't be expressed as any instantiation of a generic symbolic solution. By instantiation I mean an assigment of numeric values to some parameters. Here's an example:"

#2x2 matrix and 2x1 vector. 5 parameters (a, b, d, x, y). The 2 decision variables are
#unseen and unnamed in this pure matrix-vector form. Their values are the two entries 
#in the solution vectors S0 and S1.

A:= <a, b; 0, d>;  B:= <x, y>;

#Get a generic solution:
S0:= LinearAlgebra:-LinearSolve(A, B);

#Instantiate 3 parameters (a, d, y) to 0 and solve again:
S1:= LinearAlgebra:-LinearSolve(eval([A, B], [a, d, y]=~ 0)[]);

#Note that no possible instantiation of S0 can produce S1.

Thank you!

First 9 10 11 12 13 14 15 Last Page 11 of 39