Maple 2016 Questions and Posts

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

Quite accidentally I discovered incorrect calculation of the simple definite integral:

int(1/(x^4+4), x=0..1);  

evalf(%);

                            1/8*ln(2)-1/16*ln(5)+1/32*Pi+1/8*arctan(1/3)   # This is incorrect result

                                                   0.1244471178

Is this a known bug?

 

If  first we calculate corresponding indefinite integral, and then by the formula of Newton - Leibniz, that everything is correct:

F:=int(1/(x^4+4), x):

eval(F, x=1)-eval(F, x=0);

evalf(%);

                                             1/16*ln(5)+1/8*arctan(2)

                                                     0.2389834593

 

 

It is very important that you learn to pose and solve equations in practical problems. Ernest Mach, a famous scientist of the nineteenth century, said that algebra is characterized by a lightening of mind, because the solution of a problem, after building the equation, you can "forget" all the practical situation to focus on the mathematical expression; everything that is not necessary to solve the problem no longer interfere with your mind. Another famous scientist, Isaac Newton, wrote that the language of algebra is the equation. To see a problem concerning abstract relations of numbers or amounts, simply translate the problem of colloquial language to the algebraic language. Here I leave the application for first order equations developed in 2016 Maple.

 

Aplicativo_Ecuaciones.mw

(In Spanish)

Lenin Araujo Castillo

Ambassador of Maple - Perú

 

Hello 

Is there a way to solve matrices symbolically?

an example would be A*X=B

where the answer would be 

X=A^-1B

 

I have tried to look for a thing in maple that will do this but so far i had no luck. Does anyone know ?

Thanks in advance

Given that I use Maple as a student I've had to update to the newest version to keep using Maple.

However I find I have a lot of problems with the new version.

 

Normally when I write an assignement or work on the given problems I use worksheet mode because it is the best mode to spot any mistakes, and I've grown accostumed to it.

 

My problem however is when I have to use text.

 

Normally I've hit CTRL+T to get Maple to recognize that I write text, whereupon I write the given assignment, and press CTRL+J for when I want to go on and write some math. However we do have a little issue about the symbols.

 

Since I am an engineering student we use a lot of greek letters, and in this case I bring up sigma. In the "old" Maple I pressed F5 to get into math, write the symbol I wanted, pressed F5 again to get back to text and keep writing. In Maple 2016 however I do the same and then at the end of the text paragraph maple spits out lines of blue text with all of the "math" that I have written.


So my question is thus: Can I stop Maple from giving me the blue text, or perhaps is there another way to type symbols without having to go into math?

 

hello!, How can i to plot the next data in a 2D plot?. it is the result of a loop for.... do....while. I had tried with pointplot anda dataplot, but must be something wrong!

with(plots);
for i from 1.73205080756887853 by 0.5e-2 while i < 2.87500000000000000 do roll := i; f1max := NLPSolve(f1, {f2 = i}, x1 = 0 .. 2, x2 = 0 .. 3, method = sqp, maximize = false); c := op([1], f1max), print(c, roll) end do; plot(roll, c);
Warning, limiting number of major iterations has been reached
            2.86923108976435204, 1.73205080756887853
                2.40562374977021154, 1.737050808
                2.36135298525774395, 1.742050808
                2.34703023482192563, 1.747050808
                2.33762023747274306, 1.752050808
                2.33074752039182975, 1.757050808
                2.32549269761476607, 1.762050808
                2.32138461334482216, 1.767050808
                2.31814359109128576, 1.772050808
                2.31558754335936889, 1.777050808
                2.31359008686494683, 1.782050808
                2.31205927196994354, 1.787050808
                2.31092573645557353, 1.792050808
                2.31013563350152307, 1.797050808
                2.30964617400063910, 1.802050808
                2.30942269107110354, 1.807050808
                2.30943663600124838, 1.812050808
                2.30966416809946962, 1.817050808

I have a simple algebraic problem, but Maple can't eliminate the exp(3P) in each term. Please help.

I get the following error:

Error, (in solve) cannot solve for an unknown function with other operations in its arguments


restart

R13eqn := -2*H*Ybar3*Zbar-H*Z1-H1*Z+H1*Zbar+H4*Ybar3-H41 = 0

-2*H*Ybar3*Zbar-H*Z1-H1*Z+H1*Zbar+H4*Ybar3-H41 = 0

(1)

H := exp(3*P)*(Z+Zbar)

exp(3*P)*(Z+Zbar)

(2)

H1 := 3*P1*exp(3*P)*(Z+Zbar)+exp(3*P)*(Z1+Zbar1)

3*P1*exp(3*P)*(Z+Zbar)+exp(3*P)*(Z1+Zbar1)

(3)

H4 := H*(Z4+Zbar4)/(Z+Zbar)

exp(3*P)*(Z4+Zbar4)

(4)

H41 := ((H1*(Z4+Zbar4)+H*(Z41+Zbar41))(Z+Zbar)-H*(Z4+Zbar4)(Z1+Zbar1))/(Z+Zbar)^2

((3*P1(Z+Zbar)*(exp(3*P))(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P))^3*Zbar*Zbar(Z1+Zbar1)^2/(Z+Zbar)^2-(exp(P))^3*Zbar*Z(Z1+Zbar1)^2/(Z+Zbar)^2+(exp(3*P))(Z+Zbar)*Z(Z+Zbar)^2*Zbar1(Z+Zbar)/(Z+Zbar)^2+(exp(3*P))(Z+Zbar)*Zbar(Z+Zbar)^2*Z1(Z+Zbar)/(Z+Zbar)^2-3*(exp(P))^3*Ybar3*Zbar^4/(Z+Zbar)^2-2*(exp(P))^3*Z^3*Z1/(Z+Zbar)^2-3*(exp(P))^3*P1*Z^4/(Z+Zbar)^2+3*(exp(P))^3*P1*Zbar^4/(Z+Zbar)^2+3*P1(Z+Zbar)*(exp(3*P))(Z+Zbar)*Z(Z+Zbar)^3/(Z+Zbar)^2+3*P1(Z+Zbar)*(exp(3*P))(Z+Zbar)*Zbar(Z+Zbar)^3/(Z+Zbar)^2+3*(exp(3*P))(Z+Zbar)*Z(Z+Zbar)^2*Z1(Z+Zbar)/(Z+Zbar)^2+3*(exp(3*P))(Z+Zbar)*Zbar(Z+Zbar)^2*Zbar1(Z+Zbar)/(Z+Zbar)^2 = 0, P1)

Error, (in solve) cannot solve for an unknown function with other operations in its arguments

 

NULL

``


Download Help_Maple_divide_an_Exp_on_both_sides.mwHelp_Maple_divide_an_Exp_on_both_sides.mw

This post is about the relationship between the number of processors used in parallel processing with the Threads package and the resultant real times and cpu times for a computation.

In the worksheet below, I perform the same computation using each possible number of processors on my machine, one thru eight. The computation is adding a list of 32 million pre-selected random integers. The real times and cpu times are collected from each run, and these are analyzed with a variety of metrics that I devised. Note that garbage-collection (gc) time is not an issue in the timings; as you can see below, the gc times are zero throughout.

My conclusion is that there are severely diminishing returns as the number of processors increases. There is a major benefit in going from one processor to two; there is a not-as-great-but-still-substantial benefit in going from two processors to four. But the real-time reduction in going from four processors to eight is very small compared to the substantial increase in resource consumption.

Please discuss the relevance of my six metrics, the soundness of my test technique, and how the presentation could be better. If you have a computer capable of running more than eight threads, please modify and run my worksheet on it.

Diminishing Returns from Parallel Processing: Is it worth using more than four processors with Threads?

Author: Carl J Love, 2016-July-30 

Set up tests

 

restart:

currentdir(kernelopts(homedir)):
if kernelopts(numcpus) <> 8 then
     error "This worksheet needs to be adjusted for your number of CPUs."
end if:
try fremove("ThreadsData.m") catch: end try:
try fremove("ThreadsTestData.m") catch: end try:
try fremove("ThreadsTest.mpl") catch: end try:

#Create and save random test data
L:= RandomTools:-Generate(list(integer, 2^25)):
save L, "ThreadsTestData.m":

#Create code file to be read for the tests.
fd:= FileTools:-Text:-Open("ThreadsTest.mpl", create):
fprintf(
     fd,
     "gc();\n"
     "read \"ThreadsTestData.m\":\n"
     "CodeTools:-Usage(Threads:-Add(x, x= L)):\n"
     "fd:= FileTools:-Text:-Open(\"ThreadsData.m\", create, append):\n"
     "fprintf(\n"
     "     fd, \"%%m%%m%%m\\n\",\n"
     "     kernelopts(numcpus),\n"
     "     CodeTools:-Usage(\n"
     "          Threads:-Add(x, x= L),\n"
     "          iterations= 8,\n"
     "          output= [realtime, cputime]\n"
     "     )\n"
     "):\n"
     "fclose(fd):"
):
fclose(fd):

#Code review
fd:= FileTools:-Text:-Open("ThreadsTest.mpl"):
while not feof(fd) do
     printf("%s\n", FileTools:-Text:-ReadLine(fd))
end do:

fclose(fd):

gc();
read "ThreadsTestData.m":
CodeTools:-Usage(Threads:-Add(x, x= L)):
fd:= FileTools:-Text:-Open("ThreadsData.m", create, append):
fprintf(
     fd, "%m%m%m\n",
     kernelopts(numcpus),
     CodeTools:-Usage(
          Threads:-Add(x, x= L),
          iterations= 8,
          output= [realtime, cputime]
     )
):
fclose(fd):

 

Run the tests

restart:

kernelopts(numcpus= 1):
currentdir(kernelopts(homedir)):
read "ThreadsTest.mpl":

memory used=0.79MiB, alloc change=0 bytes, cpu time=2.66s, real time=2.66s, gc time=0ns

memory used=0.78MiB, alloc change=0 bytes, cpu time=2.26s, real time=2.26s, gc time=0ns

 

Repeat above test using numcpus= 2..8.

 

restart:

kernelopts(numcpus= 2):
currentdir(kernelopts(homedir)):
read "ThreadsTest.mpl":

memory used=0.79MiB, alloc change=2.19MiB, cpu time=2.73s, real time=1.65s, gc time=0ns

memory used=0.78MiB, alloc change=0 bytes, cpu time=2.37s, real time=1.28s, gc time=0ns

 

restart:

kernelopts(numcpus= 3):
currentdir(kernelopts(homedir)):
read "ThreadsTest.mpl":

memory used=0.79MiB, alloc change=4.38MiB, cpu time=2.98s, real time=1.38s, gc time=0ns

memory used=0.78MiB, alloc change=0 bytes, cpu time=2.75s, real time=1.05s, gc time=0ns

 

restart:

kernelopts(numcpus= 4):
currentdir(kernelopts(homedir)):
read "ThreadsTest.mpl":

memory used=0.80MiB, alloc change=6.56MiB, cpu time=3.76s, real time=1.38s, gc time=0ns

memory used=0.78MiB, alloc change=0 bytes, cpu time=3.26s, real time=959.75ms, gc time=0ns

 

restart:

kernelopts(numcpus= 5):
currentdir(kernelopts(homedir)):
read "ThreadsTest.mpl":

memory used=0.80MiB, alloc change=8.75MiB, cpu time=4.12s, real time=1.30s, gc time=0ns

memory used=0.78MiB, alloc change=0 bytes, cpu time=3.74s, real time=910.88ms, gc time=0ns

 

restart:

kernelopts(numcpus= 6):
currentdir(kernelopts(homedir)):
read "ThreadsTest.mpl":

memory used=0.81MiB, alloc change=10.94MiB, cpu time=4.59s, real time=1.26s, gc time=0ns

memory used=0.78MiB, alloc change=0 bytes, cpu time=4.29s, real time=894.00ms, gc time=0ns

 

restart:

kernelopts(numcpus= 7):
currentdir(kernelopts(homedir)):
read "ThreadsTest.mpl":

memory used=0.81MiB, alloc change=13.12MiB, cpu time=5.08s, real time=1.26s, gc time=0ns

memory used=0.78MiB, alloc change=0 bytes, cpu time=4.63s, real time=879.00ms, gc time=0ns

 

restart:

kernelopts(numcpus= 8):
currentdir(kernelopts(homedir)):
read "ThreadsTest.mpl":

memory used=0.82MiB, alloc change=15.31MiB, cpu time=5.08s, real time=1.25s, gc time=0ns

memory used=0.78MiB, alloc change=0 bytes, cpu time=4.69s, real time=845.75ms, gc time=0ns

 

Analyze the data

restart:

currentdir(kernelopts(homedir)):

(R,C):= 'Vector(kernelopts(numcpus))' $ 2:
N:= Vector(kernelopts(numcpus), i-> i):

fd:= FileTools:-Text:-Open("ThreadsData.m"):
while not feof(fd) do
     (n,Tr,Tc):= fscanf(fd, "%m%m%m\n")[];
     (R[n],C[n]):= (Tr,Tc)
end do:

fclose(fd):

plot(
     (V-> <N | 100*~V>)~([R /~ max(R), C /~ max(C)]),
     title= "Raw timing data (normalized)",
     legend= ["real", "CPU"],
     labels= [`number of processors\n`, `%  of  max`],
     labeldirections= [HORIZONTAL,VERTICAL],
     view= [DEFAULT, 0..100]
);

The metrics:

 

R[1] /~ R /~ N:          Gain: The gain from parallelism expressed as a percentage of the theoretical maximum gain given the number of processors

C /~ R /~ N:               Evenness: How evenly the task is distributed among the processors

1 -~ C[1] /~ C:           Overhead: The percentage of extra resource consumption due to parallelism

R /~ R[1]:                   Reduction: The percentage reduction in real time

1 -~ R[2..] /~ R[..-2]:  Marginal Reduction: Percentage reduction in real time by using one more processor

C[2..] /~ C[..-2] -~ 1:  Marginal Consumption: Percentage increase in resource consumption by using one more processor

 

plot(
     [
          (V-> <N | 100*~V>)~([
               R[1]/~R/~N,             #gain from parallelism
               C/~R/~N,                #how evenly distributed
               1 -~ C[1]/~C,           #overhead
               R/~R[1]                 #reduction
          ])[],
          (V-> <N[2..] -~ .5 | 100*~V>)~([
               1 -~ R[2..]/~R[..-2],   #marginal reduction rate
               C[2..]/~C[..-2] -~ 1    #marginal consumption rate        
          ])[]
     ],
     legend= typeset~([
          'r[1]/r/n',
          'c/r/n',
          '1 - c[1]/c',
          'r/r[1]',
          '1 - `Delta__%`(r)',
          '`Delta__%`(c) - 1'       
     ]),
     linestyle= ["solid"$4, "dash"$2], thickness= 2,
     title= "Efficiency metrics\n", titlefont= [HELVETICA,BOLD,16],
     labels= [`number of processors\n`, `% change`], labelfont= [TIMES,ITALIC,14],
     labeldirections= [HORIZONTAL,VERTICAL],
     caption= "\nr = real time,  c = CPU time,  n = # of processors",
     size= combinat:-fibonacci~([16,15]),
     gridlines
);

 

 

Download Threads_dim_ret.mw

Couple of questions actually,

writebytes("c:/testfile.txt","hello") in Maple 2016 doesn't create a file to write the bytes to unless the file already exists.  In Maple 12 if the file didn't already exist Maple would create it.  Is this a programming change for writebytes?

After writing to the file, if you open the file with notepad (or any text editor) there is nothing in that file.  It is only once you write in maple ..

     filepos("c:/testfile.txt",0)

.. that you can then see something in the edited file with an external editor. 

This is probably connected but how do get Maple to relinquish command of the file I've used writebytes on?  The error message I get is "The process cannot access the file because it is being used by another process" I would guess once Maple releases command on that file all data written to it will be visible regardless of what filepos I'm at. 

 

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.

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?

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

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?

Hello people in mapleprimes,

I have an equation called aa in the following.

alias(`&delta;x`=dx, `&Delta;x`=Dx,`&Delta;y`=Dy,`&Delta;z`=Dz):
aa:=Dz=f(x+Dx,y+Dy)-f(x,y);

As for modification of this expression, I ask your favor to teach me.

Then, I want to change this aa to D[1](f)(x+theta__1*Dx,y+Dy)*Dx+D[2](f)(x,y+theta__2*Dy)*Dy.

But, to do so, I have to split aa into the one including -f(x,y+Dy)+f(x,y+Dy) between two terms

of aa.

But, as maple cancels these terms, I can't do so. How can I insert two terms, then

obtain the expression  D[1](f)(x+theta__1*Dx,y+Dy)*Dx+D[2](f)(x,y+theta__2*Dy)*Dy?

 

Thanks in advance.

taro

First 50 51 52 53 54 55 56 Last Page 52 of 60