Maple Questions and Posts Maple Questions and Posts Feed

These are Posts and Questions associated with the product, Maple

How can I limit the number of processors that are used by a multi-threaded operation? The help pages ?multithreaded and ?kernelopts both suggest, vaguely, that this can be controlled with kernelopts(numcpus). The following worksheet shows, however, that this doesn't work: While Maple does remember what you set numcpus to, this setting has no effect on the number processors used by Threads. And, if this doesn't work, what purpose is there in being able to set the value of numcpus?

restart:

First, warm-up and stretch the memory. Otherwise, the timings are invalid.

L:= RandomTools:-Generate(list(integer, 2^18)):

CodeTools:-Usage(Threads:-Mul(x, x= L)):

memory used=1.21GiB, alloc change=0.98GiB, cpu time=18.66s, real time=3.75s, gc time=27.54m

Now this is the actual test.

L:= RandomTools:-Generate(list(integer, 2^18)):

gc();

for n to kernelopts(numcpus) do
     print(kernelopts(numcpus= n));
     CodeTools:-Usage(Threads:-Mul(x, x= L), iterations= 4)
end do:

8

memory used=1.21GiB, alloc change=322.34MiB, cpu time=4.04s, real time=933.75ms, gc time=566.41ms

1

memory used=1.21GiB, alloc change=-2.00MiB, cpu time=4.22s, real time=859.50ms, gc time=656.25ms

2

memory used=1.21GiB, alloc change=-1.17MiB, cpu time=4.03s, real time=841.75ms, gc time=566.41ms

3

memory used=1.21GiB, alloc change=256.00MiB, cpu time=4.47s, real time=911.25ms, gc time=738.28ms

4

memory used=1.21GiB, alloc change=0 bytes, cpu time=4.33s, real time=852.50ms, gc time=605.47ms

5

memory used=1.21GiB, alloc change=0 bytes, cpu time=4.34s, real time=853.50ms, gc time=628.91ms

6

memory used=1.21GiB, alloc change=0 bytes, cpu time=4.27s, real time=826.75ms, gc time=535.16ms

7

memory used=1.21GiB, alloc change=0 bytes, cpu time=4.19s, real time=841.50ms, gc time=308.59ms

 

Download numcpus.mw

You'll get equivalent results if you replace Mul by Add and increase the size of L to about 2^24.

Hi There,

Im currently on using a trial version of maple for engineering students. I am looking to see how you can view a step by step method of solving equations. I can't seem to find a way of doing so and I keep just getting the final answer. Can you assist?

 

Also I can't find the quadratic equation option.

 

thanks,

 

stuart

I'm trying to solve vast system of differential equations (Hamiltonian equations of motions). 

I have this kind of error and don't know what to do with it:

Error, (in dsolve) found the independent variables {t} also present in the names of the functions of the system {(cos(varphi(t)))((3333333333/10000000000)/sin(theta(t))^2+(1/23)*cot(theta(t))^2/R(t)^2), (sin(psi(t)))((3333333333/10000000000)/sin(theta(t))^2+(1/23)*cot(theta(t))^2/R(t)^2)}

Here's the file:ClassicalTrajectoriesAr-CO2.mw

 

 

Hi everyone,

I've not been able to figure this one out. Say I have an expression dependant on two random variables, like this:

C:=A+B

where A and B are randomvariables, each following a specific distribution.

If I ask for a Sample of C

Sample(C,1)

Maple will sample A, sample B and compute C. But say that A and B are correlated (with a cc of 0.8). How do I define this?

Thanks in advance

 

Maple debugger uses very small font, different from main worksheet. It seems to use its own font size. Changing font size on the main worksheet has no effect.

For example, if you type

restart;
f:=proc()
return 3;
end proc;

stopat(f);

f();

 

Now the debugger comes up. On my system, windows 7, and Maple 2016, the font is very small. I'd like to make it larger.

How can one do this? I looked at format->style but see nothing related to debugger.

when writing by error the following

restart;
f:=proc()
dsolve(diff(y(x),x)+y(x)=0,y(x));
end proc();

Maple did not complain and returned  f := y(x) = _C1*exp(-x)

Then I noticed I needed to change "end proc();" to "end proc;" 

The question is, why did Maple not generate a syntax error? If "end proc();" is valid Maple code, then what does it mean? or Did Maple ignore it? what is the parsing steps used to make Maple generate the above output? 

Hello people in mapleprimes,

I want to distribute limit or Limit to each terms of summation.

Limit(f(a+h)-f(a),h=0);

But, the output is not distributed one, but the same as the input, though

I want it to become Limit(f(a+h),h=0)+Limit(f(a),h=0), or

Limit(f(a+h),h=0)+f(a).

Isn't there any way for it, other than a trivial one that is

subs(Limit(f(a+h)-f(a),h=0)=Limit(f(a+h),h=0)+Limit(f(a),h=0),Limit(f(a+h)-f(a),h=0));

?

I hope someone will teach me.

Thanks in advance.

taro

 

I am trying to duplicate the answer to a problem of the nutation of a spinning top. The problem is number 6.1.3 in the book Computer Algebra Recipes for Classical Mechanics by Richard Ens and George McGuire.

TopSC := `<,>`(5*sin(z)*exp(-(Pi-z)/(1.5)), 0, z) for z = 0..Pi

Spacecurve TopSC, when rotated about the z axis, generates the surface of revolution of the top.

The solution requires knowing the moments of inertia (MI) of the top about the z axis and the x or y axis.

Does the following integral correctly calculate the MI about the z axis?

int(2*Pi*TopSC[1]*(TopSC[1]^2), [z = 0 .. z, z = 0 .. Pi])

What sequence of Maple 2016 commands will calculate the top's MI about the x or y axis?

The following command works fine until you use it in the combination conjugate and diff.

example in Physics:

declare(phi(X));

diff(conjugate(phi(X)),x1);

phi(X) should now appear as phi with index x1 and a bar only, but

it comes as phi(X) x1 , the declare command is not effective. Non conjugate works fine.

Any idea - thanks in advance

Hi all,

need to plot the positve roots and  against so(4-->5)

restart:
assume(so,real):
m1:=5:m2:=2:m3:=1.5:a1:=0.16:a2:=0.45:a3:=0.833:d1:=0.25:d2:=0.1:d3:=0.075:
ys:=a3*d3/(m3-d3):
d:=0.5:
w3:=d*(m1-d1):w2:=d*d1*so-d*m1*so-2*a1*d*d1+a1*d*m1-a2*m1^2+a2*d1*m1+m1*m2*ys:w1:=2*a1*d*d1*so-a1*d*m1*so-a1^2*d*d1+a1*a2*d1*m1+a1*m1*m2*ys:wo:=a1^2*d*d1*so:
Q:=s->w3*s^3+w2*s^2+w1*s+wo:Q(s):
sol:=evalf(solve(Q(s),s)): S:=array([],1..3): S[1]:=sol[1];S[2]:=sol[2];S[3]:=sol[3]:

 

 

I tried to use a for loop to assign the bounds for creating an RTable in a Maple C wrapper (actually it does not matter what I do here). I checked that the for loop syntax is correct C syntax, for example even as simple as for (int i = 0; i < 2; i++){...} but the loop becomes an infinite loop and takes forever to run. Has anyone encountered the same problem as I did

Hi everybody,

 

For at least one function (I haven’t done extensive testing), the package Logic behaves differently in Maple 2015.0 and maple 2016.0

 
Maple 2015.0 :
Logic:-Tautology(true);
      true

Maple 2016.0
Logic:-Tautology(true);
      Error, (in sprint) integer expected for integer format   ????     (??? are mine)

For information :
1)  Logic:-Contradiction(true) retruns false for both 2015.0 and 2016.0
2) OS : Windows 7

 

Is there some modification of the “Logic” package that  I have  missed ?

 

Thanks in advance

 Hi everybody,

Until recently I was using Maple 2015.0 on this PC :

Windows XP
2 dual core proc Intel(R) Xeon(R) CPU E3-1225 V2 ; 3.19 GHz
64 bytes,
16 Go RAM

For two days now I am using Maple 2015.0 on this one

Windows 7
4 dual core proc Intel(R) Xeon(R) CPU 5-2637 V3 ; 3.50 GHz
64 bytes,
64 Go RAM


Comparisons of the running times for exactly the same code, consisting in 10000 independent Monte Carlo  simulations distributed over all the nodes (resp 4 and 8) give :

Windows XP :  504 sec  (with a variation of the order of  +/- 3s for different replicates)

Windows 7   :  343 sec  (with a variation of the order of  +/- 3s for different replicates)


The expected running time should be 504 * (3.2/3.5) * (4/8) = 230 s
(or 504 * (4/8) = 252 s if you neglect the acceleration due to the clock rate)
The realized running time (343 s) is thus at least  40% larger than the expected one.


Does anybody has already observed this kind of performance loss during XP -> 7 migration ?
Are there some comparisons of cpu times between Windows XP and 7 ?


Thank you all for sharing your own experience.



postscript : a NOTIONALexample of how the computations are distributed is given below

NbOfRuns := 10000:

# Data is a Matix(NbOfRuns, NbOfCols, …) constructed elsewhere

NbOfNodes := Grid:-NumNodes():
NbOfRunsPerNode := NbOfRuns / NbOfNodes:
for k from 0 to NbOfNodes do
   FirstData := 1 + k * NbOfRunsPerNode:
   LastData := (k+1) * NbOfRunsPerNode:
   Grid:-Run(k+1, MyCode, [Data[FirstData..LastData, ..], …])
end do:

I have some vector field defined on real coordinate space of 3 dimensions (R3). For example:

I want to plot this vector field in 3D (with Cartesian coordinates), but only in one z contour (for example z=0).

Can somebody help me what is the right command to do this?

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