370 Reputation

10 Badges

5 years, 334 days

MaplePrimes Activity

These are questions asked by sand15


I try using the DeepLearning package.
I use the function Classify and, even in the simplest test case presented in the its help page (please look at it), I regularly get connection errors to the mpython server as soon as I execute classifier := Classify(...) or classifier(...) more than once.
Errors are one of these twos

Error, (in Train) unable to communicate with mpython server
Error (in Python:-EvalFunction) unable to communicate with mpython server

I work with Windows 7 Enterprise, on an 8 proc PC and 64 GB of memory. The worst situation happened when Maple didn't even return these errors and that I saw inflating the consumed memory in 2 minutes, forcing me to manually shut down my PC because the task manager wasn't no longer  operational.

Is it a known problem?
Could it be an installation problem?

Even if it's not the point here, I would like to say that trying to use the DeepLearning package is really challenging considering the poverty of the help pages.


A year ago I submitted a problem about the sampling of a Gaussian Random Variable (GRV).
A serious problem with Statistics:-Sample()
In short, the default method (Ziggurat method) used in the Stratistics package to sample a GRV overestimates the weights of the tails of the distribution.

Forcing the method to "envelope" is a way to obtain a correct sample

Statistics:-Sample(Normal(0, 1), N, method=envelope)

(another one is to use for instance the Box-Muller sampling algorithm ; look to the reference above for the fast implementation acer proposed).

I recently observed that the envelope method generates an error ("too many inflexion points...") when the standard deviation of the GRV is not one.
I tried to avoid this error by adding the suboption "range" :

f := (sigma, k, N) => Statistics:-Sample(Normal, 0, sigma), N,  method=[envelope, range=-k*sigma..k*sigma]):
# this works
f(1, 3, 10):
# these do not work
f(0.1, 3, 10):
f(10, 3, 10):

Here, k is a positive real value (which could depend on N but can be imagined to be around 5 or 6 to fix the ideas
Even with this suboption I keep receivind the same error.

If there is no way to parameterize correctly the envelope method, this means that Maple is unable to sample correctly a GRV.

Of course, if X is a GRV of mean mu and standard deviation sigma on could do this to generate a sample of X:

Xstd := RandomVariable(Normal(0, 1)):
Sstd := Sample(Xstd, 10^6, method=envelope):
S := mu +~ sigma *~ Sstd

But this should not be a permanent solution.


I would like to determine if some lengthy expression F is linear in one of its inderteminates X.
 I use to use type(F, linear(X)) to do this but I've just found that if F is piiecewise defined, then type(F, linear(X)) returns false even if E is linear in X...
For instance, let  F := a*X+piecewise(Y<0, X, b)
then type(F, X) returns false.

I do not pretend it is a bug: at first sight I would say that F is linear with respect to X but maybe the notion of linearity with respect to an indeterlinate must be interpretated as "linear on each branch" ?

For the moment I've circumvented the problem by doing this :
dF := diff(F, X):
has(dF, X):
# returns {\emptyset} if F is linear in X

But, as I said, F can be a rather lengthy expression invoking a lot of piecewise constructors, and I don't think that computing dF is an efficient way to do the job.

Do you have a better idea to proceed?

Thanks in advance


I discovered that the option legend, when used in plots:-inequal, returns an empty graphic.
Is it a bug or a deliberate choice?

Anyways, is it possible to insert a legend in a simple way (that is without using textplot for instance)?



Let's take the last example (Maple 2019) given in help[sparsematrixplot] (representation of the adjacency matrix of a graph).
Vertices of this graph are labelled 1, 2, ...20.
Suppose I change these names as a, b, ...t.
I would like the tickmarks of the sparsematrixplot output match the names of the vertices of the graph, and not the integers 1, 2, ..20

I tried this:
S := [$1..20] =~ StringTools:-Char~(96 +~  [$1..20]);
plots:-sparsematrixplot(..., tickmarks=[S, S])

But the only the tickmars of the columns are changed, not those of the rows.

Is it possible to change the names of the tickmarks ?

Thanks in advance.

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