Alec Mihailovs

Dr. Aleksandrs Mihailovs

4455 Reputation

21 Badges

20 years, 307 days
Mihailovs, Inc.
Owner, President, and CEO
Tyngsboro, Massachusetts, United States

Social Networks and Content at Maplesoft.com

I received my Ph.D. from the University of Pennsylvania in 1998 and I have been teaching since then at SUNY Oneonta for 1 year, at Shepherd University for 5 years, at Tennessee Tech for 2 years, at Lane College for 1 year, and this year I taught at the University of Massachusetts Lowell. My research interests include Representation Theory and Combinatorics.

MaplePrimes Activity


These are answers submitted by Alec Mihailovs

break (inside a loop in the procedure) is often used for that. But it has to be followed by either error or return.

If you mean stopping a procedure running too long manually, there is an interrupt button for that (looking like a Stop sign) in the toolbar.

Glad to see that you have gotten Maple 13. Maple 9.5 is obsolete.

Alec

From the description on the Typesetting:-Settings help page, it seems as if that can be done by setting striptrailing to true,

Typesetting:-Settings(striptrailing=true);

                                false

However, that doesn't seem to work, either in Classic, or Standard. I tried a few different examples and didn't notice any difference in displays with striptrailing set to true, or to false.

Alec

In addition to the procedures above, the conversion can be also done using the following procedure,

g:=n->StringTools:-Permute(cat("","0"$(32-length(n)),n),
    [seq('k,k+1',k=31..1,-2)]):

For example,

n:=`18DBD3547552C73BE4DE87731C500`:

g(n);

                  "00C53177E84DBE732C554735BD8D0100"

g(%);

                  "00018DBD3547552C73BE4DE87731C500"

Alec

Maple has MD5 implemented in StringTools:-Hash. For SHA-1, one can rewrite the pseudocode in wikipedia in Maple language. I didn't try that, but all the needed functions are available using Bits package and mod.

If one needs that for some practical reasons, it should be possible to use Maple external calling to call the corresponding functions from a dll or so - for instance, it is implemented in OpenSSL. Or use Python's hashlib.

Alec

 

Also, the following command does direct transformation of decimal numbers to the requested format,

f:=n->nprintf("%{s}02X",<convert(n+16^32,base,256)[..-2]>):

In the given example,

num:=8067107224306383990011936212370688:

f(num);
                   00C53177E84DBE732C554735BD8D0100

Alec

Statistics:-Mean and Statistics:-StandardDeviation work OK for Vectors and lists. If you have a n×1 matrix, you can either convert it to list, or extract a vector (the first column) from it and use those commands on them. For example,

A:=<<1,2,3>>;

                                    [1]
                                    [ ]
                               A := [2]
                                    [ ]
                                    [3]

Statistics:-Mean(convert(A,list));

                                  2.

Statistics:-StandardDeviation(convert(A,list));

                                  1.

Statistics:-Mean(A[..,1]);

                                  2.

Statistics:-StandardDeviation(A[..,1]);

                                  1.

Alec

It should work in Classic. For calling qHull, one has to either change currentdir to its location first, or use the full path to it,

ssystem("C:\\ etc.\\qHull --option1 --option2");

with using either \\ for directory separators, or /. The spaces in the directory names may cause a problem. It may not work in Standard, because both system and ssystem commands are seriously screwed there (like everything else).

Alec

Matrix(sort(convert(M,listlist)));

                               [2    5]
                               [      ]
                               [3    9]
                               [      ]
                               [4    0]

Alec

For example,

A:=Matrix([[B, C, F, G, 7, 8, 9], [0, 1, 2, 3, 21, 22, 23]]);

                   [B    C    F    G     7     8     9]
              A := [                                  ]
                   [0    1    2    3    21    22    23]

T:=table(Equate(A[1],A[2])):

T[B];

                                  0

T[8];

                                  22

f:=x->T[x]:

f(B);

                                  0

f(8);

                                  22

Alec

It can be done in one loop,

A:=Array(1..5*z):
for i to 5 do A[z*i-z+1..z*i]:=[a,b,c,d,e][i] od;

Alec

nops([8374, 32875]);
                                  2

I don't exactly understand the second question. Could you provide some code that can be tried? Anything, including procedures, can be used as input parameters.

Alec

The easiest way, probably, is to use 1d-input (Maple notation) instead of 2D-input. It could be configured in options (you migt also search this site for something like 1D - there were posts with detailed instructions.)

Alec

V1:=M[2];

                           V1 := [3, 2, 0]

V2:=M[..,2];

                                    [2]
                                    [ ]
                                    [2]
                              V2 := [ ]
                                    [5]
                                    [ ]
                                    [3]

Alec

For example,

Utot:=Vector[row](NbNode):
Utot[Elim]:=UElim:
Utot[LinearAlgebra:-ComplementaryIndices(Elim,NbNode)]:=U:
Utot;

                          [1, 0, 2, 5, 2, 3]

Alec

eval(A,u=U);
                                 [4]
                                 [ ]
                                 [6]
                                 [ ]
                                 [7]

Alec

First 23 24 25 26 27 28 29 Last Page 25 of 76