## 615 Reputation

8 years, 311 days

## My procedure works well, but fails while...

Maple

Hi everiboty

This is a notional example derived from my real application.
I have different quantities named Object1, Object2, ... ObjectN (N being a nonnegative integer) and a boolean sequence A of length N.
By construction A contains only one "true" values (and thus N=-1 "false").
I wrote a procedure Choice that takes as input such a sequence and returns the single object among Object1, ... ObjectN for which [A][n]=true.

I know that it would have been clever to name the quantities Object1, ... ObjectN differently (for instance by indexing them), but I'm constrained by what already exists.
Here is my procedure

restart:
Choice := proc(a)
local l, n, object:
l := [seq(args(k), k=1..nargs)]:
n := ListTools:-Search(true, l):
object := Object||n:
print(object):
end proc:

# a few examples of Object(s)
Object1 := {x1, y1, z1}:
Object2 := {x2, y2}:
Object3 := {x3}:

# application:
A := false, true, false:
Choice(A);

{x2, y2}

Now I want to insert this procedure within a another one named “f”:
restart:

f := proc():
local Object1, Object2, Object3:
local Choice, A:
Choice := proc(a)

local l, n, object:
l := [seq(args(k), k=1..nargs)]:
n := ListTools:-Search(true, l):
object := Object||n:
print(object):
end proc:

Object1 := {x1, y1, z1}:
Object2 := {x2, y2}:
Object3 := {x3}:

# here I give A some values, in the true application A is the sequence
# returned by a Maplet through a Shutdown command
# More precisely A correspond to “N” buttons of the same group … then
# only one is “true”.

A := false, true, false:
Choice(A);
end proc;

f();

Object2

Replacing print(object): by print(eval(object)): within procedure  Choice produces  the same ‘uneval’ answer.

I cannot figure out why procedure f doesn’t return the expected {x2, y2} answer
The only workaround I have found is to replace
object := Object||n:
print(object):

by this awfull sequence
if n=1 then print(Object1)
elif n=2 then print(Object1)
…
end if

Could you please help me to understand where is my error and how could I fix it?

## How could I obtain prettier Graph plots ...

Hi all,

I use GraphTheory:-DrawGraph (Maple 2018)
Is there a simple way to suppress or modify the ellipses plotted around a vertex ?

(by "simple" I mean: without using plootools:-getdata and doing some ad hoc modifications)

BTW: I'm asking you this because DrawGraph returns poor results in some situations:

with(GraphTheory):
g := Graph({{"azertyuiopqsdfghjklmwxcvbn", 1}, {"azertyuiopqsdfghjklmwxcvbn", 2}}):
DrawGraph(g, style=tree, root="azertyuiopqsdfghjklmwxcvbn")

## Problem with the Maple2018 user interfac...

Maple 2018

Hi everybody,

I'm facing that strange and blocking situation:

I was in a Maple 2018 worksheet "W"   (Windows 7, worksheet mode, not document mode) when, probably from some spurious keys combination, the small vertical bar that materializes the position of the mouse disappeared, rendering any further writting impossible.
In the same Maple session I had a few other worksheets  where the this same bar was still present: so it was not a Windows problem (this bar appeared in Word documents too).

I quitted Maple and ran it again. The result is still the same: among all the worksheet I load, only the worksheet  "W"  does not exhibit the location of the mouse.
This problem still persists after rebooting my working station.

Does anyone have any idea to fix this ?

## Maple 2015 vs Maple 2018: elements of ta...

Hi everybody,

Written in Maple 2015
restart:
t := table([1=table([a=123]) ]):
save t, MyFile:
restart:
t[1][a] := 321;

The answer is  t[1][a] =321 (here a double underscore)

Now I read MyFile from Maple 2018
restart:
t[1][a] := 321;

The result is   (t[1])[a] = 321   (still a double undercsore but the first level is enclosed between parentheses).

For a more hierarchical table, all the entries but the deeper one are between parentheses.

Does this difference in representations mean something about the inner representation of a table ?

Thank you all

## Behaviour of forget: Maple 2015 vs Maple...

Maple

Hi everybody,

Maybe it's more a warning than a true question ?

I have written a rather heavy-duty code in Maple 2015. A few years ago I faced strong problems of increases in memory. After some investigations I found there came from a procedure P in which a loop realizes a few tenth of calls to  fsolve.
This same procedure  P was itself called a large number of times.

To try to  fix them I inserted a forget(fsolve, initialize=true) command after the fsolve command.
At the end this didn't prove to be very efficient and I decided to rewrite some part of the code in a more efficient way. Basically the  procedure  P is now called only a few times but its inner loop is executed about 200 hundred times.
This new version of the code no longer presents memory size problems, while being more efficient from a computational time point of view.

Today procedure  P still contains the forget(fsolve, initialize=true) command (I had forgotten to remove it)

Now I keep developping this same code under Maple 2018.
The Maple 2015 and Maple 2018 versions both return the same results, but the procedure  P runs in about 20 times the time it runs in Maple 2015 (40 seconds instead of 2)
This comes from the 200 forget(fsolve, initialize=true) calls which consumme about  38 seconds.

With Maple 2015 these same 200 calls to forget(fsolve, initialize=true) only consumme 0.5 second:

As a cure I remove the forget(fsolve, initialize=true) command, plain and simple.

But maybe this misadventure could reveal an unseen behaviour of Maple 2018 ?

 First 7 8 9 10 11 12 13 Last Page 9 of 20
﻿