6234 Reputation

7 years, 318 days

Search for an explanation about CycleBas...

Maple 2015

Could someone please explain to me why the procedure GraphTheory:-CycleBasis requires that the vertices of a graph be integers for it to work correctly ?
(while the definition of a graph supports other types of vertex names)

restart:
with(GraphTheory):

#------------------------------------------------------- test 1

g1 := Graph({{"a", 1}, {1, 3}, {"a", 3}});
DrawGraph(g1);
CycleBasis(g1);

Error, (in GraphTheory:-CycleBasis) cannot determine if this expression is true or false: "a" < 1

#------------------------------------------------------- test 2

g2 := Graph({{a, 1}, {1, 3}, {a, 3}});
CycleBasis(g2);

Error, (in GraphTheory:-CycleBasis) cannot determine if this expression is true or false: a < 1

#------------------------------------------------------- test 3

g3 := Graph({{4, 1}, {1, 3}, {4, 3}});
CycleBasis(g3);

[[1, 3, 4]]

Knowing this limitation I usually rename to integers the vertices of the graphs, next do some operations, and next go back to the original names.

Thanks for any explanation.

The scope of the ';' statement operator ...

Maple

hello everybody,

Is there some trick to bypass the limiited scope of the semicolon statement operator ?

More specifically, is it possible to force Maple to display (apart from the explicit use of the 'print' command) the results of the commands within two nested loops or within a loop and and a conditional statement ?

From the help page concerning statement operators it seems that it is truly impossible ...

"Note: This rule does not apply to statements enclosed in the body of another statement such as an if statement, loop, procedure, module, use statement, or try statement. In these cases, all enclosed statements must be separated by a semicolon or colon."

While not blocking it is a rather irritating limitation :-)

How to recover the content of .m files ?...

Maple

hello everyone,

To illustrate my question I will get Bob and Alice

Suppose Bob and Alice work separately on the same subject and must share some information.
They decide to exchange information among themselves by using .m files (Maple internal format files).

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

1) Bob performs the first serie of calculus which ends by some "result".
This result is the information Bob must send to Alice for her doing her part of the job.
Bob assigns this result to a variable named MyVar and saves it in a .m file :

.....
MyVar := ... :
save  MyVar   "/.../MyFile.m"

Then Bob indicates to Alice the complete path to MyFile.m ... but forgets to say her the name of the variable he has saved.

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

Of course, if Alice knew the name of the variable Bob used in his "save" command, it would be the simplest thing in the World for her to browse the content of the .m file (eval(MyVar) generally works well).

But I assumed it is not the case, so my question :

Can Alice recover the name of the variable and visualize it ?

Any answer will be greatly appreciated

postscript : it is not the first time I find myself in the situation Alice faces here. Often I have to recover the content of .m files written years ago by people who have changed their core business without having properly documented (like Bob) what these files contain

Interaction between two packages...

Maple

Hello everybody,

* The following set of instructions returns me an error

restart:
with(Maplets[Examples]):
A := Matrix(2,2,[1,2,3,4]):
LinearAlgebra:-Transpose(A);

Error, Transpose is not a command in the Maplets:-Examples:-LinearAlgebra package

(it would be the same for any other command from the LinearAlgebra package)

* If I try

restart:
with(Maplets[Examples]):
with(LinearAlgebra):
A := Matrix(2,2,[1,2,3,4]):
Transpose(A);

the answer is Transpose(...),  as if Transpose was an undefined function (no matter the order of the loading of the two packages)

* In Maplets[Examples] there is a subpackage named LinearAlgebra : could it be the reason of these observed behaviour ?
* Is there any way to fix that other than copying from Maplets[Examples] the only pieces of code I need avoiding thus its complete loading ?
* More generally : is it possible to load a package "partly" by discarding some of its subpackages ?