Maple 2017 Questions and Posts

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

The On-Line Encyclopedia of Integer Sequences (OEIS) is an online database of integer sequences. Originally founded by Neil Sloane in 1964, OEIS has evolved into a larger community based project that today contains information records on over 280,000 sequences. Each record contains information on the leading terms of the sequence, keywords, mathematical motivations, literature links, and more - there’s even Maple code to reproduce many of the sequences!

You can read more about the OEIS project on the main site, or on Wikipedia. There have also been several articles written about the OEIS project; here’s a (somewhat) recent article on Building a Searching Engine for Mathematics that gives a little more history on the project.

I wrote a simple package for Maple that can be used to search OEIS for a sequence of numbers or a string and retrieve information on various integer sequences. You can interact with the OEIS package using the commands: Get, Search or Print, or using the right-click context menu.

Here are some examples:

with(OEIS):

 

Search for a sequence of 6 or more numbers (note that you can also just right-click on an integer sequence to run the search):

Search(0, 1, 1, 2, 4, 9, 20);
    6 results found
             81, 255636, 35084, 58386, 5908, 14267

 

Retrieve information on the integer sequence A000081. By default, this returns the data as a JSON string and stores the results in a table:

results81 := Get(81):
indices(results81);
    ["revision"], ["number"], ["formula"], ["offset"], ["example"], ["keyword"], ["id"], ["xref"], ["data"], ["reference"], ["mathematica"], ["maple"], ["created"], ["comment"], ["references"], ["time"], ["link"], ["author"], ["program"], ["name"]

 

Entries in the table can be accessed as follows:

results81["author"];
    "_N. J. A. Sloane_"

 

I’ve also added some functionality for printing tables containing information on integer sequences. The Print command displays an embedded table containing all or selected output from records. For example, say we search for a sequence of numbers:

Search(0, 1, 1, 2, 4, 9, 20);
    6 results found
             81, 255636, 35084, 58386, 5908, 14267

 

Let’s print out selected details on the first three of these sequences (including Maple code if available):

Print([81, 255636, 35084], output = ["author", "name", "data", "maple"]);

 

The OEIS API is somewhat limited, so I have had to put some restrictions in place for returning results. Any query that returns more than 100 entries will return an error and a message to provide a more precise specification for the query. Also, in order to reduce the number of search results, the Search command requires at least 6 integers.

 

You can install the OEIS package directly from the MapleCloud or by running:

PackageTools:-Install(5693538177122304);

 

Comments and feedback are welcome here, or on the project page: https://github.com/dskoog/Maple-OEIS

I have some elliptic curve with some points on it:

I would like to give the points some names, P, etc., but cannot figure out how to do that probably simple task. The help pages ?plot,options and ?pointplot do not seem to cover it; I may be mistaken, of course. The above plot is the result of the following code:

curve := y^2 = x^3 - 43*x + 166;
display([
   plot(+sqrt(rhs(curve)),x = -10..12),
   plot(-sqrt(rhs(curve)),x = -10..12),
   pointplot([[3,8],[-5,16],[11,32],[3,-8]],symbol = solidbox)
]);

Update: Using, among other things, the textplot command as suggested below, here, just for the fun of it, a plot illustrating the group 'addition' of points on an elliptic curve, the three lines being tangents to the curve:

Hello everybody!

I have Z which is a function of (b,p)! and two parameters g and d :

Z=p*b*d+2*g^p^2*b^2-2*sqrt(p*g*(b-1)*(b*g*p-b*p-g*p-4*d+p))

I want to plot Z vs. g (1<g<4) and explore with d, note that in plot i want Z to be maximum (it is obvious that we must find b and p optimal and then find Z optimal). in maximization consider we have this constraints: {b <= 1, 1-2*d/(p*(sqrt(g)+1)) <= b}

thank you in advance for your help!

I just started using Maple for civil engineering calculations and cant figure out how to manage units.  And all of the civil engineering Maple document examples I have seen are done as unitless calculations, sidestepping that issue.  Are there any examples available that show how to manage units to be more usable for civil engineering?  An example where I am having trouble involves pressure:

If I define f:=60 ksi; the result is displayed as 60,000 lbf/in^2

But if I apply that pressure over an area,

F:= f * 1 inch^2;   the result is displayed as "1930442.91 poundals"  And poundals is a totally foreign unit to me and anyone who might look at my calculations.

I would like to be able to display that as either lbf or kip but neither is on the list of options if I right click 'poundals' and try to 'affix units'.  I'm hoping there is an easy way to do this.  It was extremely easy in mathcad but I had to ditch mathcad because it is now crazy expensive.

thanks

Nick

 

 

 

in maple 2017 I have enconterd a problem in showing of matrix elements. this error did not exist in maple 2016.

after some mathematical operations with(Linearalgebra)

I have obtained a matrix but maple shows it as below

 

`Vector(3, {(1) = \`+\`(\`*\`(0.19498673e10, \`*\`(\`^\`(x[1], 3))), \`-\`(\`*\`(0.36539123e10, \`*\`(\`^\`(x[1], 2), \`*\`(x[2])))), \`*\`(0.12514628e10, \`*\`(\`^\`(x[1], 2), \`*\`(x[3]))), \`-\`(\`*\`(7987.1506, \`*\`(\`^\`(x[1], 2)))), \`*\`(0.35170874e10, \`*\`(x[1], \`*\`(\`^\`(x[2], 2)))), \`-\`(\`*\`(0.41418339e10, \`*\`(x[1], \`*\`(x[2], \`*\`(x[3]))))), \`-\`(\`*\`(9187.8615, \`*\`(x[1], \`*\`(x[2])))), \`*\`(0.28788960e10, \`*\`(x[1], \`*\`(\`^\`(x[3], 2)))), \`*\`(2871.4325, \`*\`(x[1], \`*\`(x[3]))), \`-\`(\`*\`(0.95594712e9, \`*\`(\`^\`(x[2], 3)))), \`*\`(0.21616680e10, \`*\`(\`^\`(x[2], 2), \`*\`(x[3]))), \`-\`(\`*\`(16552.293, \`*\`(\`^\`(x[2], 2)))), \`-\`(\`*\`(0.20009067e10, \`*\`(x[2], \`*\`(\`^\`(x[3], 2))))), \`-\`(\`*\`(30447.582, \`*\`(x[2], \`*\`(x[3])))), \`*\`(0.42009564e9, \`*\`(\`^\`(x[3], 3))), \`-\`(\`*\`(42372.407, \`*\`(\`^\`(x[3], 2))))), (2) = \`+\`(\`-\`(\`*\`(0.14713991e11, \`*\`(\`^\`(x[1], 3)))), \`*\`(0.42489026e11, \`*\`(\`^\`(x[1], 2), \`*\`(x[2]))), \`-\`(\`*\`(0.25018214e11, \`*\`(\`^\`(x[1], 2), \`*\`(x[3])))), \`-\`(\`*\`(55498.093, \`*\`(\`^\`(x[1], 2)))), \`-\`(\`*\`(0.34645652e11, \`*\`(x[1], \`*\`(\`^\`(x[2], 2))))), \`*\`(0.52229109e11, \`*\`(x[1], \`*\`(x[2], \`*\`(x[3])))), \`-\`(\`*\`(399927.96, \`*\`(x[1], \`*\`(x[2])))), \`-\`(\`*\`(0.24172439e11, \`*\`(x[1], \`*\`(\`^\`(x[3], 2))))), \`-\`(\`*\`(367829.40, \`*\`(x[1], \`*\`(x[3])))), \`*\`(0.11603445e11, \`*\`(\`^\`(x[2], 3))), \`-\`(\`*\`(0.24618238e11, \`*\`(\`^\`(x[2], 2), \`*\`(x[3])))), \`*\`(163169.71, \`*\`(\`^\`(x[2], 2))), \`*\`(0.24814370e11, \`*\`(x[2], \`*\`(\`^\`(x[3], 2)))), \`-\`(\`*\`(711030.81, \`*\`(x[2], \`*\`(x[3])))), \`-\`(\`*\`(0.64758011e10, \`*\`(\`^\`(x[3], 3)))), \`*\`(427083.52, \`*\`(\`^\`(x[3], 2)))), (3) = \`+\`(\`*\`(0.13627334e11, \`*\`(\`^\`(x[1], 3))), \`-\`(\`*\`(0.67651416e11, \`*\`(\`^\`(x[1], 2), \`*\`(x[2])))), \`*\`(0.94045968e11, \`*\`(\`^\`(x[1], 2), \`*\`(x[3]))), \`*\`(46901.078, \`*\`(\`^\`(x[1], 2))), \`*\`(0.70616015e11, \`*\`(x[1], \`*\`(\`^\`(x[2], 2)))), \`-\`(\`*\`(0.13072873e12, \`*\`(x[1], \`*\`(x[2], \`*\`(x[3]))))), \`-\`(\`*\`(994642.52, \`*\`(x[1], \`*\`(x[2])))), \`*\`(0.41170263e11, \`*\`(x[1], \`*\`(\`^\`(x[3], 2)))), \`-\`(\`*\`(2768390.4, \`*\`(x[1], \`*\`(x[3])))), \`-\`(\`*\`(0.22189949e11, \`*\`(\`^\`(x[2], 3)))), \`*\`(0.67100205e11, \`*\`(\`^\`(x[2], 2), \`*\`(x[3]))), \`-\`(\`*\`(961344.42, \`*\`(\`^\`(x[2], 2)))), \`-\`(\`*\`(0.52533380e11, \`*\`(x[2], \`*\`(\`^\`(x[3], 2))))), \`*\`(2309741.6, \`*\`(x[2], \`*\`(x[3]))), \`*\`(0.23373385e11, \`*\`(\`^\`(x[3], 3))), \`-\`(\`*\`(2708629.4, \`*\`(\`^\`(x[3], 2)))))})`

 

 

however its elemets is shown correctly

for example the first element is shown as:

x(1) ^ 3 * 0.194986727121702600e10 + x(1) ^ 2 * x(2) * (-0.365391227687975264e10) + x(1) ^ 2 * x(3) * 0.125146284187383199e10 + x(1) ^ 2 * (-0.798715058230362229e4) + x(1) * x(2) ^ 2 * 0.351708738191481209e10 + x(1) * x(2) * x(3) * (-0.414183393126536083e10) + x(1) * x(2) * (-0.918786154503699254e4) + x(1) * x(3) ^ 2 * 0.287889598946906424e10 + x(1) * x(3) * 0.287143252997207219e4 + x(2) ^ 3 * (-0.955947121705965400e9) + x(2) ^ 2 * x(3) * 0.216166802966718006e10 + x(2) ^ 2 * (-0.165522927641286878e5) + x(2) * x(3) ^ 2 * 

Hello people in mapleprimes,

I have a problem about map.

restart;
map(`*`,op([1/x,y,z]));

The output of this code is not y*z/x, but  (x*y*z)^(-y*z).

I can't understand why this occurs.
Can't you teach me about this?

Thanks in advance.

Nov_3_2017_mapleprimes.mw

I write shell scripts that call Maple to automate frequent tasks. Because I prefer writing Maple code to shell code, I've created a Maple package, Bark, that generates a shell script from Maple source code. It provides a compact notation for defining both optional and positional command-line parameters, and a mechanism to print a help page, from the command-line, for the script. The optional parameters can be both traditional single letter Unix options, or the more expressive GNU-style long options.

As an example, here is the Maple code, using Bark, for a hello-world script.

hello := module()
export
    Parser := Bark:-ArgParser(NULL
                              , 'prologue' = ( "Print `Hello, World!'" )
                              , 'opts' = ['help' :: 'help' &c "Print this help page"]
                             );
export
    ModuleApply := proc(cmdline :: string := "")
        Bark:-ArgParser:-Parse(Parser, cmdline);
        Bark:-printf("Hello, World!\n");
        NULL;
    end proc;
end module:

The following command creates and installs the shell script in the user's bin directory.

Bark:-CreateScript("hello", hello
                   , 'add_libname' = Bark:-SaveLib(hello, 'mla' = "hello.mla")
                  ):

The hello script is executed from the command-line as

$ hello
Hello,  World!

Pass the -h (or --help) option to display the help.

$ hello -h
Usage: hello [-h|--help] [--]

Print `Hello, World!'

Optional parameters:
-h, --help Print this help page

CreateScript creates two files that are installed in the bin directory: the shell script and a Maple archive file that contains the Maple procedures. The shell script passes its argument in a call to the parser (a Maple procedure) saved in the archive file (.mla file). Here's the created shell script for the hello command:

#!/usr/bin/env sh
MAPLE='/home/joe/maplesoft/sandbox/main/bin/maple'
CMD_LINE=$(echo $0; for arg in "$@"; do printf '%s\n' "$arg"; done)
echo "hello(\"$CMD_LINE\");" | "$MAPLE" -q -w2 -B --historyfile=none -b '/home/joe/bin/hello.mla'

I've used Bark on Linux and Windows (with Cygwin tools). It should work on any unix-compatible OS with the Bash shell. If you use a different shell that does not work with it, let me know and I should be able to modify the CreateScript command to have options for specific shells.

Bark is available on the MapleCloud. To install it, open the MapleCloud palette in Maple, select packages in the drop-down menu and go to the New tab (or possibly the Popular tab). You will also need the TextTools package which is also on the MapleCloud. The intro page for Bark has a command that automatically installs TextTools. Alternatively, executing the following commands in Maple 2017 should install both TextTools and Bark.

PackageTools:-Install~([5741316844552192,6273820789833728],'overwrite'):
Bark:-InstallExamples('overwrite'):

The source for a few useful scripts are included in the examples directory of the installed Bark toolbox. Maple help pages are included with Bark, use "Bark" as the topic.

restart;
unames();  # first call ok
unames();  # second call


Error, invalid input: Typeset:-Kernel expects an equation for keyword parameter numericformatting

Error, unexpected result from Typesetting

 

Hello

I wonder how I could use maple to manipulate a symbolic matrix.  For instance, I need to calculate the transpose of the following matrix:

 

Matrix(2, 2, [[Transpose(X)+X-Q, A . X], [Transpose(X) . Transpose(A), Q]])

 

where X, Q and A are matrices of unknown (but compatible) size.  Of course, the main problem is how  X, Q and A should be defined to allow maple to calculate the transpose. 

Many thanks.

 

Ed

 

 

z=(-1/(4*(-u+L)))(4*p^2*b^2*d-3*g*c*p^2)

given fixed values of u, L, and c, I would like to Maximiz Z(p, b) by finding best p and b, subject to 1-(2* d)/(p*(sqrt(g)+1))<=b<=1 and 0<=d<=L and Min(c,L)<=p<=u and1<=g<=4 

Seems to be when shading=none in fieldplot3d the plot returned is empty.  Is that a bug?

I have just posted an article with this title at Maplesoft Application Center here.
It was motivated by a question posed by  Markiyan Hirnyk  here and a test problem proposed there by Kitonum.

Now I just want to give the promissed complete solution to Kitonum's test:

Compute the plane area of the region defined by the inequalities:

R := [ (x-4)^2+y^2 <= 25, x^2+(y-3)^2 >= 9, (x+sqrt(7))^2+y^2 >= 16 ];

plots:-inequal(R, x=-7..10, y=-6..6, scaling=constrained);

The used procedures (for details see the mentioned article):

ranges:=proc(simpledom::list(relation), X::list(name))
local rez:=NULL, r,z,k,r1,r2;
if nops(simpledom)<>2*nops(X) then error "Domain not simple!" fi;
for k to nops(X) do    r1,r2:=simpledom[2*k-1..2*k][]; z:=X[k];
  if   rhs(r1)=z and lhs(r2)=z then rez:=z=lhs(r1)..rhs(r2),rez; #a<z,z<b
  elif lhs(r1)=z and rhs(r2)=z then rez:=z=lhs(r2)..rhs(r1),rez  #z<b,a<z
  else error "Strange order in a simple domain" fi
od;
rez
end proc:

MultiIntPoly:=proc(f, rels::list(relation(ratpoly)), X::list(name))
local r,rez,sol,irr,wirr, rels1, w;
irr:=[indets(rels,{function,realcons^realcons})[]];
wirr:=[seq(w[i],i=1..nops(irr))];
rels1:=eval(rels, irr=~wirr);
sol:=SolveTools:-SemiAlgebraic(rels1,X,parameters=wirr):
sol:=remove(hastype, eval(sol,wirr=~irr), `=`); 
add(Int(f,ranges(r,X)),r=sol)
end proc:

MeasApp:=proc(rel::{set,list}(relation), Q::list(name='range'(realcons)), N::posint)
local r, n:=0, X, t, frel:=evalf(rel)[];
if indets(rel,name) <> indets(Q,name)  then error "Non matching variables" fi;
r:=[seq(rand(evalf(rhs(t))), t=Q)];
X:=[seq(lhs(t),t=Q)];
to N do
  if evalb(eval(`and`(frel), X=~r())) then n:=n+1 fi;
od;
evalf( n/N*mul((rhs-lhs)(rhs(t)),t=Q) );
end proc:

Problem's solution:

MultiIntPoly(1, R, [x,y]):  # Unfortunately it's slow; patience needed!
radnormal(simplify(value(%)));

evalf(%) = MeasApp(R, [x=-7..10,y=-6..6], 10000); # A rough numerical check
           61.16217534 = 59.91480000

 

Hello,

I wann to send a file  with FTP. I need an example how to do this with URL post.

 

Thanks

thank you for helping!! 

I have been using CodeTools::Usage with Maple 17 to compare timings of a couple of matrix inversion routines against each other and against the Maple library routines LinearAlgebra::MatrixInverse and LinearAlgebra::Determinant.

The small section of code that I use to collect the cpu times for each method is:

----------------------------------------

udata := Usage(invTest(x,y,z,delta,mu), output=['cputime', 'bytesused'],
              iterations=nRepeats, quiet);
dat[1]:=udata[1]; dat[2]:=udata[2];

----------------------------------------
nRepeats has been set to 25.

In order to get the timings as accurate as possible, I only open a couple of terminal windows on my laptop so as to run the tests with as low a loaded machine as I can get. (I'm running Ubuntu 14.04 on an 8 core Intel (R) Core i7-3840QM, 2.8GHz CPU with 16Gb of memory.)

A test run consists of a sequence of test matrices each of which is run for an increasing sequence of matrix orders. I either time an implementation on its own or I time both an implementation and the Maple library routines. In the later case for each test matrix and order of matrix, I use Usage to first time the Maple routines and then the times for one of the implementations:

----------------------------------------

if compMaple then
udata := Usage(MatrixInverse(A), output=['cputime', 'bytesused'],
              iterations=nRepeats, quiet);
mdat[1]:=udata[1]; mdat[2]:=udata[2];

udata := Usage(Determinant(A), output=[cputime, bytesused],
              iterations=nRepeats, quiet);
mdat[1]:=mdat[1]+udata[1];
mdat[2]:=mdat[2]+udata[2];
else
  mdat[1..2] := 0:
end if:

udata := Usage(invTest(x,y,z,delta,mu), output=['cputime', 'bytesused'],
              iterations=nRepeats, quiet);
dat[1]:=udata[1]; dat[2]:=udata[2];

----------------------------------------

I have noticed the following:

a) If I time both Maple and an implementation, and the same implementation on its own I can get timings that vary up to a factor of 2 or more,

b) Changes in timings for the same test run and as close to the same environment as I can get (i.e., just the two user terminal windows open) can generate timing differences of up to 50%.

c) Sometimes `chaotic' timings are generated, for example,

    n = 150, t = 3 (secs)
    n = 200, t = 24 (secs)
    n = 250, t = 18 (secs)

which cannot be reflecting the times required to perform the calculations. This type of behaviour always seems to occur when the reported memory bytecount is increasing from ~0.25* 10^9 to over 10^9.

Is there anything I can be doing here to get more consistent timings?

I want to use the timings from these tests in a journal article so it would be good to have the same test run under very similar conditions to return timings within a few percent difference of one another. I certainly get this sort of tolerances (<10%) if I use the Fortran cpu_time intrinsic to time Fortran code.

Any advice would be gratefully received.

First 25 26 27 28 29 30 31 Last Page 27 of 40