13310 Reputation

29 Badges

11 years, 268 days

On google groups. (comp.soft-sys.math.maple and sci.math.symbolic)

On stackoverflow.


MaplePrimes Activity

These are replies submitted by acer

@sand15 FYI, you might also find this old thread of interest.

There, maple is the installed Linux shell script that launches Maple Command Line Interface (CLI) in a shell (while you might be using cmaple.exe).

From your wording it is not clear whether you: 1) want to plot a surface (expression in x,y,z) whose domain and range are constrained by those inequalities, or 2) just want to plot the boundaries of the constrained region.

If it is the first case then is the expression explicit like z=f(x,y) so that you could use the plot3d command, or is it only implicit like f(x,y,z)=0 so that the implicitplot3d command is needed?

If there is an expression in x,y,z to be plotted over the constrained region then show it to us.

@quo Yep. It's the same command, with all the same arguments except the one with `typesetdot`.

Typesetting:-Settings(usedot=true, dot=t);

IIRC those might even be default settings in Maple 2016. (I forget, offhand.) You'll have to ensure


since it might not be your default in 2016 (though it is in 2017). You probably already know that this aspect can be set as a GUI preference and stored "Globally" across sessions, via the menubar's Tools->Options.

In either Maple version you can read more details on the Help page for Typesetting:-Settings .

@quo The command Typesetting:-Settings only accepts the keyword `typesetdot` as of version Maple 2017.0.

I wrote the code that way because your Question here was marked as "Maple 2017".

Is it possible that you pasted that code into Maple 2016 or earlier, by mistake?

I am not sure why those other Inputs are not working (or being saved in the .mw file).

But I notice that the was last saved with Maple 2016.1. Have you considered getting the later point-release 2016.2? See here. (I don't know that this will remedy the situation, but it might be worth doing regardless.)

@colinbannister Note that OMP_NUM_THREADS only controls the numeric Linear Algebra done in hardware working precosion via the MKL.

If you also want to restrict/contain multi-threading done via either Maple's internal garbage-collector or its Threads package then you also need to set kernelopts(numcpus) as per comments above.

Neither setting (alone, by itself) controls all the kinds of multicore use that can occur.

@Adri van der Meer 

I notice that attached worksheet in the Original Poster's Question was made with Maple 2015.2.

And indeed your workaround to use one pair of (single right-quotes) unevaluation quotes works in version 2015.2 (and earlier, eg. version 18.02).

I also notice that in at least the 64bit Linux Maple versions 2016.0, 2016.1, 2016.2, and 2017.0 that approach of delaying any premature evaluation with just one pair of unevaluation quotes of the function call p(u,v) does not work. But it does seem to work on in Maple 2016 and Maple 2017 with two (nested) pairs of unevaluation quotes.

I am going to submit a bug report against this regression in behavior.

@Kitonum That's simple and very clear.

(We've switched earlier roles for this particular example, mine being geometrically inspired.)

You've motivated me to add a plot. (Perhaps it'd be more clear to show or mention that the red line goes through the origin...)


R:=evalc(3*abs(z-4-3*I)+4*abs(z-8-6*I) = 20);
simplify(eval(R, [eq])) assuming y::real;
a:=simplify(eval(sqrt(x^2+y^2), A)):
b:=simplify(eval(sqrt(x^2+y^2), B)):
with(plots): with(plottools):
P:=display(implicitplot(R, x=0..9, y=0..8,
                        color=blue, gridrefine=1),
           disk(rhs~(B), 0.1, color=black),
           disk(rhs~(A), 0.1, color=black),


3*((x-4)^2+(y-3)^2)^(1/2)+4*((x-8)^2+(y-6)^2)^(1/2) = 20

x = (4/3)*y

(1/3)*(20*y-120)*signum(y-6)+5*signum(y-3)*(y-3) = 20

y = 3, y = 45/7

75/7, [x = 60/7, y = 45/7]

5, [x = 4, y = 3]


Your first statement assigns a Matrix to the (typeset) 2D Input name

    `#mover(mi("Δ",fontstyle = "normal"),mo("&uminus0;"))`

Your second statement, which assigns to K, references another name,


They both get pretty-printed the same, but they are distinct names.

You could delete the instances of the problematic name in the second statement, and then copy and paste the name from the first statement instead. That worked for me, using your document in 64bit Maple 2017.0 for Windows.

I discovered the problem by copying both names and pasting them into an execution group that was toggled to 1D Maple Notation.

@Carl Love He wrote that he'd initialized parameters (presumably to numeric values). But that doesn't necessarily mean that Matrix K is yet all of type numeric. See example below.

I'd say that the OP's particular call to convert is somewhat obscure and cryptic, though. In modern Maple there are lots of simpler ways to hit all of Matrix K with evalhf and make the result have datatype=float[8].


M:= Matrix(K, datatype= float[8]);
Error, (in Matrix) unable to store 'sin(5)' when datatype=float[8]


Matrix(evalhf(K), datatype= float[8]);

Matrix(evalhf~(K), datatype= float[8]);

# Even this is simpler, working as far back as Maple 6?
Matrix(map(evalhf,K), datatype= float[8]);

Matrix(`~`[convert](K, float[8]), datatype = float[8]);

@toandhsp Welcome to the party. We are all at the mercy of solve and other Maple commands.

Perhaps there are other tacks, for this new example:


z := a+I*b:
C:=evalc(3*abs(z-4-3*I)+4*abs(z-8-6*I) = 20):

eq:=a=4/3*b: # where the fun is

simplify(eval(C,eq)) assuming real;

         - (20 b - 120) signum(b - 6) + 5 signum(b - 3) (b - 3) = 20
b=solve(eval(C,a=4/3*b)) assuming b>=3, b>=6:
eval(abs(a+b*I),[%,eval(eq,%)]), eval(eq,%), %;

                             75      60      45
                             --, a = --, b = --
                             7       7       7 

b=solve(eval(C,a=4/3*b)) assuming b>=3, b<=6:
eval(abs(a+b*I),[%,eval(eq,%)]), eval(eq,%), %;

                               5, a = 4, b = 3

@smiths I added my Comment above onto Kitonum's Answer, because (obviously, I had imagined) I was utilizing the same observation about "fixed points  A(-3, 2)  and  B(3, 8)".

If I had possessed a straightforward way to obtain the simple real-real restrictions on the a (or the b) of z=a+b*I then I would have submitted as an Answer instead. 

I was simply pointing out that, having introduced the a and b (and having made the observation about their ranges), it was not necessary to also work out and introduce a parametrization by t. And I also wanted to mention that there were at least (related) two ways of doing that.

I had thought that all the sensible people engaged in the discussion were already aware that the weakness (of solve, mostly) in generating the range restrictions on a and b was the outstanding issue. I didn't see much point it stating what others had already mentioned.

If I think of some reasonable, automated way, I'll mention it.

@sand15 My suggestion entails having all your source in plaintext files. After that, their text would never get re-imported back into any worksheet format (whether Maple Notation or otherwise).

Suppose you have an entire module, M, whose source definition is in the text file srcM.mpl . In that case you could, in either the GUI or the commandline interface, "load" that module with the command,

 read "srcM.mpl";

Having loaded the module in any session, you could then call it's exports (or itself, it is is an appliable module. That would cover both the interactive application as well as any unit testing.

I don't understand how Shift-Enter issues would come into that.

If procedure in module M also call procedures from outside M (user-defined top-level procs, or exports of user-defined module N, say) then you would load both before executing. Eg.

 read "srcM.mpl";
 read "srcN.mpl";

Another way would be to use LibraryTools to save(lib) both M and N to the same .mla Library archive. A worksheet's Startup Code could contain either the simple read statements, or a statement that appends to libname (so as to pick up any .mla archive).

I usually have a very small text file (of Maple code) which:
1) sets the Maple include path
2) reads the module defn files (which may contain $include directives)
3) saves to .mla archive
And then I just need to augment libname to get the package into play. If it's very useful then I may even end up putting the .mla into a toolbox folder, so that libname is augmented automatically, upon normal launch of the GUI or commandline interfaces.

The key thing is that, once my source gets migrated to plaintext then it never gets put pack, literally as code, into any worksheet.

Having said all the above, I'm afraind that I don't understand your comment about WorksheetToMapleText and difficulties with references from within a module to other user-defined procedures. And I'm afraid that I also don't understand the comments about Shift-Enter, after using the menubar's File->Export as..., because the format to export to is plaintext (ie. .mpl or .txt, but certainly not some other .mw variant or anything with input prompts).

I forgot to mention it before but additional benefits of plaintext files are A) the stand-alone Maple language Syntax Checker mint can be used easily and to its full power, and B) plaintext files are extremely well protected against file-corruption when using mature editors such as vi, emacs, etc.

As far as Carl's comment goes, yes of course you don't necessarily have to split up module sources into seperate files for each procedure. If you do, then the $include directive (and includepath) is very handy. That's a matter of taste. I find that as my project gets large, and the revision histories get long, then it helps me to make sense of the revision diffs if I don't have to visually process too much at once. This aspect is colored by your choice of revision control tool, naturally.

Or, without parametrizing by `t`,



C:=abs(z+3-2*I) + abs(z-3-8*I) = 6*sqrt(2):

# Key observation, the constraint allows the problem
# to be represented as univariate problem.


                eq := a = b - 5

# The univariate expression to be optimized, now with
# only the simple bounds on `b` as remaining constraints.


                          2    2 1/2
          expr := ((b - 5)  + b )

simplify( [ maximize( expr, b=2..8, location) ] ):

# Beautify
op(1,%), op([2,1,1,..],%), eval(eq, op([2,1,1],%));

           73   , b = 8, a = 3

simplify( [ minimize( expr, b=2..8, location) ] ):

# Beautify
op(1,%), op([2,1,1,..],%), eval(eq, op([2,1,1],%));

          5 2
        ------, b = 5/2, a = -5/2

# Alternative way, by getting the extreme points of
# the univariate problem.

Student:-Calculus1:-ExtremePoints( expr, b=2..8 );

                   [2, 5/2, 8]

simplify( [seq([expr,'b'=b,eq],b=%)] )[];

    [13   , b = 2, a = -3],

       5 2
    [------, b = 5/2, a = -5/2],

    [73   , b = 8, a = 3]

# And of course we can sort the above, to get the max and min.

If you have grief using the main menubar's item File->Export as... as a way to export (module and procedure sources) from .mw files to plaintext then you could also compare with the results from the undocumented command Worksheet:-WorksheetToMapleText.

If I recall, that command accepts a filename (string), and returns a string (with input code lines split by \n). So you then could use FileTools:-Text:-WriteFile command to push the result string into a .txt file.

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