5 years, 85 days

## How to add a legend to a plot?...

Maple

Good morning everybody

I know this question has already been widely discussed, for example in
http://www.mapleprimes.com/questions/149585-How-To-Order-Legend-Of-Multiple-Plots

I used the answer Kitonum then gave because I have basically the same kind of problem.
As an illustration, here is a sketch of my coding :

N := 3:
for k from 1 to N do
...
MyPlot||k := PLOT(CURVES(....)):
...
end do:
plots:-display(seq(MyPlot||k, k=1..N));

The only difference is that I use PLOT instead of plot ... so I have thought that using LEGEND instead of legend would give me the desired result.
But I don't understand how to use LEGEND and how to place the legend in the correct location.

## A problem in using Grid[Launch]...

Maple 2015

Hi all,

I start working with the Grid package.
To familiarize myself with it I ran the "primeChecker" example, which of course has worked perfectly well.

Next I did this (a priori harmless) simple modifications :

1. within the primeChecker procedure :
replace  myVal := userData[thisNode+1] :
by         myVal := userData[thisNode+1, 1] :
2. before launching the procedure with Grid[Launch] :
replace  userData := [ .... ] :  #which is a list
by         userData := [ .... ] :  # the same thing
userData := convert(userData, matrix):

I get the following error message :
error, (in unknown) Matrix index out of range

What does it mean and how can I fix this ?

## Memory inflation in computations...

Maple

Hi guys,

I have written a program in Maple 2016 (Windows 7) made of two parts :

1. An initialization step where a formal system of algebraic equations (some non linear) is built
Let S(U, P) this system, where U denotes a set of unknowns and P a set of parameters (see step 2 below)
2. An iterative step where this system is solved with respect to U for different values of parameters P
This loop has to be executed N times for values P1, ..., Pn, ... of P

I observe that the size of the memory (bottom right of the Maple window) inflates as the value of n increases.

I was able to isolate in the loop corresponding to step 2, the procedure MyProc I wrote which is responsible of this memory inflation.
Now I would like to manage this inflation (typically the memory size grows up to 3 GiB for n about one thousand) because of its very negative effects on the computational time (probably Maple does spend a lot of time in swapping operations).

Suspecting the remember process to be the source of this problem, I tried simple tricks such as

• systematically write   > quantity := 'quantity';   for fome intermediate quantities
• use forget  : for example MyProc contains a call to fsolve and,  after "local" declarations, I inserted  the command  forget(fsolve)
• in the the loop over n,  I even inserted the command forget(Myproc).

None of these tricks was to some extent efficient to contain the memory inflation.

I suppose it is a very common situation that people who use to develop code are familiar with. So maybe some of you could provide my some advices or move me towards "strategies" or "methodologies" to prevent this situation ?
My purpose here is not to ask you to solve my problem, but rather to ask youy to give me hints to be able to manage such kind of situations by myself.

Maybe this question is unorthodox and doesn't have its place here ?
It that case please let me know.

PS : it would be very difficult for me to provide you the code : if it is a necessary condition for you to help me, just forget it, I will understand

## How to give an answer a vote up ?...

MaplePrimes

I have a simple minded question :
How can I give an answer a Vote Up or select it as the Best Answer to a question ?

## Converting piecewise to if selection st...

Maple

Hi guys,

I would like to convert a piecewise defined function of two variables into an if structure
Example :

F := (x,y) -> piecewise(x < 0, piecewise(y < 0, 0, 1), piecewise(y < 0, 1, 0));

What I expect is something like (the indentation is just for fun)
if x < 0 then
if y < 0 then 0 else 1 end if;
else
if y < 0 then 1 else 0 end if;
end if

I tried the following :

convert(F(x,y), `if`)  # but it only converts the "outer x condition" and keeps the "inner y conditions" unchanged

And next this :

map(u -> convert(u, `if`), F(x,y)):   # fails to give m
# and
map(u -> convert(u(x,y), `if`), F(x,y)):
# ...

without success.