Maple Questions and Posts

These are Posts and Questions associated with the product, Maple
t := (5/9)*Pi;
e:=tan(t) + 4*sin(t);

is -sqrt(3)  but how to make Maple show this?

This is what I tried

t := (5/9)*Pi;
e:=tan(t) + 4*sin(t);
convert(e,radical);
simplify(e,trig);
simplify(e,constant);
allvalues(e);

 

The command "is" and "identify" knows this

is(e=-sqrt(3));
identify(evalf[32](e))

In Mathematica, FullSimplify can do it.

 

Any suggestions in Maple to simplify like the above?

Maple desperately needs a new full_simplify() command.

Having to keep trying different commands by trial and error in the hope one works is not the right way to do things.

I am trying to run Python for the first time in Maple 2025. Below is my simple proof of concept. This code only produces the following output: a # (a is a variable that contains a Python list) I don't understand why the python list which is assigned to variable "a" is not being displayed? It appears that the variable "a" is not being returned to Maple. This is the code that is being run in Maple 2025:

restart;
with(Python):
Start():
Run("import numpy as np"):
Run("a = np.arange(10).tolist()"):
a;

I am trying to calculate the stability of my solution using this integral test:

U = 1/2 * ∫ u(x,t)^2 dx

Then I want to compute the derivative with respect to epsilon and check if the result is greater than zero or less than zero.

I tried to do it in Maple but it is not working correctly.

Also, I want to substitute random numbers for the parameters to test stability. I prefer to use simple integer values like 1, 2, 3, etc., not decimal numbers. When I try random values, sometimes the result does not evaluate or gives complicated output.

S-test.mw

I am trying to use the command try for catching errors. In the second case it does not work. Is there a way to catch the error in the second example?
I have Maple 2025.2

restart;
try : x:=0:1/x :catch: end try:#ok

try : simplify(convert(WhittakerW(7/3,1,hypergeom([1],[2],z)),trig))  catch : end try:

Does this symbol for equicalence exist in Maple ?  I can't find it in the pallets. 

If not is there a way of making it so I could add it to my favourites?

Example: For

ex:=(a+b*c)^2

I would like to get the following output

[`^`, [`+`, [`*`, b, c], a], 2]

I am mainly looking for "elegant" code (short but understandable).

If a one-liner is doable, which I doubt, I would be interested as well.

f:=subs(r=(sqrt(5)+1)/2,7*arctan(r)^2+2*arctan(r^3)^2-arctan(r^5)^2); 

The above expression is in fact equal to (7*Pi**2)/8 (which may be obtained by the `identify` command). 
As the following worksheet shows, simplify(f); fails to do full simplifications and the result consists of the less simplified arctan(2/11), while simplify(f/Pi^2); succeeds in making full simplifications and returning the remarkably simpler form: 

restart;

f := subs(r = (sqrt(5) + 1)/2, 7*arctan(r)^2 + 2*arctan(r^3)^2 - arctan(r^5)^2); # which is actually equal to “7/8*Pi^2”

7*arctan((1/2)*5^(1/2)+1/2)^2+2*arctan(((1/2)*5^(1/2)+1/2)^3)^2-arctan(((1/2)*5^(1/2)+1/2)^5)^2

(1)

is(f = 7/8*Pi^2);

true

(2)

simplify(f); # This cannot yield the desired result.

(11/16)*Pi^2+(3/4)*arctan(1/2)*Pi+(9/4)*arctan(1/2)^2-(1/4)*arctan(2/11)^2+(1/2)*arctan(2/11)*Pi

(3)

simplify(f/Pi^2); # To obtain the desired result, `f` has to be divided by Pi^2 manually.

7/8

(4)

simplify(arctan(2/11) - 3*arctan(2)); # So, Maple knows that arctan(2/11) = 3*arctan(2) - Pi (or, somewhat more elegantly, arccot(2/11) = 3*arccot(2)).

-Pi

(5)

simplify((3), constant); # No further simplification.

(11/16)*Pi^2+(3/4)*arctan(1/2)*Pi+(9/4)*arctan(1/2)^2-(1/4)*arctan(2/11)^2+(1/2)*arctan(2/11)*Pi

(6)

As Maple does indeed know that arctan(2/11) = 3*arctan(2)-Pi, why can't Maple further simplify (3) by attempting to eliminate arctan(2/11) (so that we don't have to enter the identity manually)?

simplify(simplify((3), {arctan(2/11) = 3*arctan(2) - Pi}));

(7/8)*Pi^2

(7)

simplify(subs(((sqrt(5)+1)*(1/2))^5 = ((sqrt(5)-1)*(1/2))*((sqrt(5)+1)*(1/2))^6, f))

(7/8)*Pi^2

(8)
 

 

Download simplify_a_constant.mw

Since arctan(2/11) can be expressed by the significantly more concise arctan(1/2) and Pi (that is, arctan(2/11) = 3*arctan(2) - Pi), why didn't simplify(f); attempt to eliminate arctan(2/11) in the result to further simplify `f`?

In the attached file, I want to calculate the integral Q1. Numerically, this is easy to do in Maple. For theoretical reasons, the exact result pi/e is known. However, a contradiction arises between command lines (4) and (5). Command (6) is also unsuccessful, as its exact result is unknown. What am I doing wrong?

restart

Q1 := int(sin(Pi*x)/(x^x*(1-x)^(1-x)), x = 0 .. 1)

int(sin(Pi*x)/(x^x*(1-x)^(1-x)), x = 0 .. 1)

(1)

evalf[100](Q1)

1.155727349790921717910093183312696299120851023164415820499706535327288631840916939440188434235673559

(2)

evalf[100](Pi/exp(1))

1.155727349790921717910093183312696299120851023164415820499706535327288631840916939440188434235673559

(3)

is(Q1 = Pi/exp(1))

false

(4)

identify(evalf[100](Q1))

Pi*exp(-1)

(5)

identify(.2340257795502385151002175791580229871350403567739388325733228478980460706709848394726222465477567339)

.2340257795502385151002175791580229871350403567739388325733228478980460706709848394726222465477567339

(6)

NULL

Download test.mw

is been a while i work on it but i can't figure out where is problem and even my solution is so far from it when numerically i tested , i got same outcome as the paper did maybe is  long but it is same and maybe have some typical different but they are same , the problem in here is that which when i substitue is not my answer i don't know where is my mistake ?

pde-te.mw

f18.mw

f19.mw

I recently attempted to Fourier Transform the LommelS1 function using Maple. After loading

restart;
with(inttrans);
[addtable, fourier, fouriercos, fouriersin, hankel, hilbert, invfourier, invhilbert, invlaplace, invmellin, laplace, mellin,   savetable, setup]

the command did not work on LommelS1, after several attempts. I then used the 1F2 hypergeometric definition of LommelS1, and tried
fourier (t^(mu + 1)*hypergeom([1], [3/2 + nu/2 + mu/2, 3/2 - nu/2 + mu/2], -t^2/4)/((mu - nu + 1)*(mu + nu + 1)), t, w)

and after about 6 attempts of restart thru to fourier(...), it finally gave me about 30 lines of output, which simplified to about 8 lines, then subsequently simplified symbolically to two final lines of output- but I haven't been able to reproduce the result since (after about 20 attempts), so it really makes me question the algorithm, its implementation and its stability, or am I missing something here??

The plot in the attached file only works if the complete function expression is entered. If only the function name is entered, no plot appears. What am I doing wrong?test.mw

restart;

c(x)dsum(sin(10^k*x)/10^k, k = 1 .. 10^2)

plot(c(x), x = -(1/4)*Pi .. (1/4)*Pi)

 

``

c(x)dsum(sin(10^k*x)/10^k, k = 1 .. 10^2)

plot(sum(sin(10^k*x)/10^k, k = 1 .. 10^2), x = -(1/4)*Pi .. (1/4)*Pi)

 

 

NULL

Download test.mw

Dear All,

I am currently encountering an issue while solving my boundary value problem in Maple. The following error message appears:
"Error, (in dsolve/numeric/bvp) cannot determine a suitable initial profile; please specify an approximate initial solution."

This problem arises when I attempt to generate plots by varying the parameters λl, λu, βl, βu, etc.

Lamda_l_new.mw


I recently got access to a 12-core Intel MacPro with 64 GB main memory. This motivated me to try parallel programming again, even though in prior years I have never been successfull. The project I am trying to do is particle tracking through a circular accelerator, an embarassingly parallel problem in the sense that you can track n particles in parallel through your machine for many turns and then gather up the results for analysis. The function describing the tracking is a 6-component polynomial function acting on 6-vectors and yielding a 6-Vector as a result. Each accelerator component (magnet, drift section, rf, ...) is described by such a function. I am simplifying this a bit here, but in the problem at hand this is what I am doing. The point is that each particle gets treated independently from the others, hence parallelization should be trivial.

Using an existing package (Lattice, which I published with Maple) as framework I set this up such that the tracking proc for n turns of one particle in the accelerator is a member of a module. This module is in the body of a proc and gets returned when the proc is called, essentially instantiating the tracking object and assigning it to a Vector with as many elements as I have particles to track. The tracking function returns a 6-Vector with the coordinates after all turns are complete. 
A separate proc does the instantiation of all tracking objects, gives each one its particle number (from a Beam object it is being given) and sends it off using Threads:-Create. It then waits until every task is done (using Threads:-Wait) and assembles the result in another Beam object which it returns. Please refer to the enclosed Maple worksheet for how it is done.

This actually all appears to work. MacOS is 15.7.2 (Sequoia); Maple is 2023.2. The results are identical both parallel and serial.

The "interesting" result however, is that usage of the available CPU cores saturates at about 4. In the graph shown below, the green line shows the CPU usage of the mserver process, and it saturates between 400 & 500%, actually going down to 360% as more particles get added. 100% is one core, so I am never getting more than about 4 cores to work for me. Correspondingly, the no. of seconds per particle goes up from about 3 s (particle 1 to 4) up to about 15 s/particle, settling at about 10 s/particle as 12 particles are approached. Below is a graph against no. of particles (n) of running time (red), CPU time (dark blue), CPU usage (yellow) and # or mkernel threads (green). 

Bottom line: I am only getting 4 cores out of the 12. Process limits of MacOS (ulimit -a) do not indicate any limit that would cause this (and I have had build jobs that would merrily use all 12 cores).

Is there a limit in Maple that prevents using all available cores? Am I doing something inefficient that could cause this?? This is the first time I actually got parallel operations in Maple to work, so I am happy about that, but my happiness is tempered by not getting it to work at the level I was aiming for. I did google around a bit and found some prior conversations on MP (mostly involving @acer and @Carl Love) about parallel threads which indicated that (a) environment variable OMP_NUM_THREADS should be set and (b) that numcpus can only be set at the very beginning of a Maple session (which I interpret as "right after firing up Maple"). Did both (and verified the settings were in) but no change in behaviour of this code; I only get four cpu cores to work.

Thanks,

Mac Dude

Parallel_tracking_attempt.mw

Edit: Added graph, fixed up graph.

I do not think I've ever seen this before.

I have Maple set up to use one engine per one worksheet.

 

Today, when I tried to open new worksheet (after Maple had an internal error running some code in another worksheet), I was not able to execute anything in the new worksheet. I get this message

Looking at task manager, I see the front end running at high CPU

Stange thing, there was nothing else running at the time.

Had to kill all of Maple.

Just wondering if any one saw this message before and what could cause it?

I'll try to see if I can reproduce it again by running same code which caused that initial Maple error in the first worksheet. But as I said, this is the first I see such a problem in Maple.

I was connected to the network at the time, if this makes any difference.

I want the Minkowski metric in spherical coordinates, so I do the following:

restart;

with(Physics):

Setup(coordinatesystems=spherical,signature=`-+++`);

`Systems of spacetime coordinates are:`*{X = (t, r, theta, phi)}

 

[coordinatesystems = {X}, signature = `- + + +`]

(1)

g_[lineelement]

-Physics:-d_(t)^2+Physics:-d_(r)^2+Physics:-d_(theta)^2+Physics:-d_(phi)^2

(2)

 

Which is not correct, it should return:

-d_(t)^2 + d_(r)^2 + r^2*d_(theta)^2 + r^2*sin(theta)^2*d_(phi)^2

Any ideas why it is giving the wrong answer? I usually just define my metric manually, but I was curious why this is occuring. I also noticed something else strange: after running the worksheet, if I go back to the setup line and execute, it will return the correct expression! But if I execute restart and then Setup again, wrong answer. 

Any thoughts would be appreciated, thanks! 

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