787 Reputation

11 Badges

9 years, 149 days

MaplePrimes Activity

These are replies submitted by sand15

@Thomas Richard 

Using strict inequalities is indeed a good advice.

Converning your last remark "The help file (?convert,Heaviside) indicates that proper conversion is not always possible." :
yes, @acer has recently told me something about this recently.
But his advice was about using And/Or/Not instead of and/or/not (thus my code), but it seems we must be even more careful.


Thanks, I've just sent the suspicious file to @Thomas Richard

@Thomas Richard 

Thanks for your reply.

Did you install the last update for Maple 2020?
I use  the version 2020.2 with W10. It has been installed by the technical support of my company in november 2020.
Looking at the link you give it seems that I am using the latest update.
If this is not the case I will soon have Maple 2021, which will solve the problem if I understand correctly.

Here is the file? I hope you will be able to read it (we have very little permissive firewalls and it has already happened that files are not loaded correctly)


No explanation but a very usefull workaround.
Thank you very much acer.


(reply from the office)

Point 1: I agree with your interpretation but this would mean that it is not necessary to click on the point you want to move in order to select it, but simply in a neighborhood of it whose extent is controlled by the value 5.
I didn't verified this but it seemed so strange that I suspected some hidden meaning (thus the search of the point closest to the click point) 

Point 2: a solid argument in favor of the tables, thanks for the tip

@Fargues Marisa 

You're right
I don't have Maple on this machine, so I translated from memory what I'd done on another one.
The correct syntax would have been

pch := plottools:-getdata(ch)[-1][-1]; 

or yours, which is the same ([-1] meaning the "last element of the list"


By the way, in case you have 2 points with the same absissas the correrspondig vertical segment must belong to the Newton polygon
So you must replace

while pch[n, 1] > pch[n-1, 1] do


while pch[n, 1] >=  pch[n-1, 1] do

Some comments:

  • I've always thought that there was a unique definition of the Newton polygon (lower bound of the convex hull of the points), but looking to the French entry of the topic in WikipediaPolygone_de_Newton I discovered that some authors consider that the Newton Polygon  is the whole convex hull (maybe this is related to tomleslie's "Needs clarification" reply?).
    Unfornutately the English entry doesn't mention that.
  • In Newton.pdf you will see that the Newton Polygon contains 2 semi infinite vertical lines originating from the first and last point of the lower bound of the convex hull.
  • Finally, a better alternative to simplex:-convexhull is provided by the  PolyhedralSets package.
    Even if this package is aimed to manipulate 3D objects, it can be used for 2D ones.
    An interesting feature of it is that it represents a convex hull by a list on inequalities.
    You will find in the attached file a few examples treated with this package and, at the end of it, a 
    procedure that returns :
    • the Newton polydon as a list of inequalities which includes left and right vertical bounds (a correct mathematical description),
    • a plot of the convexhull and the Newton polygon

These file uses Maple 2015 but should work with newer versions.


Thank you (I'm replying from my office).

@Carl Love 

I discovered MathML in the context of Maple a few months ago and found it very useful although a bit confusing at first
Avoiding parse and "..." indeed makes things more readable.



Thank you acer, 


(from my professional account)

Thank's for having this modification.
It was so natural that I blame myself for not having thought of it myself.


I was aware of the existence of the ImageTools package and I had already replayed some of the examples it contains, but without digging deeper. In fact I thought it was essentially used to manipulate kind of jpeg or png images.
That's why I didn't think of it as a potentially useful tool for my problem.

Using Convolution is therefore a good advice.

Concerning the "bins" issue, the correct way to address it would be to have a 2D KernelDensity function (every trick like smoothing or filtering a "binned" scatterplot introduces artifacts that can lead to misinterpretations).
There is such a function in R and I think I could translate it into MAPLE, as I already did for a few other algorithims.
In case I do I will publish it in a specific Post.

​​​​​​​Thanks again for your involvement


Hi, I am now answering from my office.

I just found out your last post but, in the meantime, I have done a few things on my own.
Because of our security policy it takes me some time to transfer a file from my professional network on this open one, so no file given here.
I mainly worked on smoothing the original matrix NP for a better rendering.
Here his the code I made (the look-up table F is just an example among many matrices we can use ; I'm going to look at what ImageTools proposes)

Filtering := proc(M::Matrix(square))
  local N, MF, F, KP, nx, ny:
  uses LinearAlgebra:
  KP := KroneckerProduct:
  N := numelems(M[1]):
  MF := copy(M):
  F := Matrix(3$2, [[1, 2, 1], [2, 4, 2], [1, 2, 1]]):
  for nx from 2 to N-1 do
    for ny from 2 to N-1 do
      MF[nx, ny] := KP(M[nx-1..nx+1, ny-1..ny+1]; F):
    end do:
  end do:
  return MF:
end proc:

NPF := Filtering(NP)

Used in plots:-surfdata, this filtered matrix NPF looks rather pretty (prtty doesn't mean correct of course).

I will continue to work on this idea with all the material you sent me.
See you later


For your particular case (S=1, because I do not know how the "conditions" write for S > 1);
(Here the result is obviously 3)

# These 2 lines with Sum only serve to obtain concise outputs
Expr := (J, S) -> Sum(Sum(Sum(pi[i,j,k,F], i=1..J), j=1..J), k:1..S);
Rel := (j,k,J) -> Sum(pi[i,j,k,F],i=1..J)=1;

expr := (J,S)  -> eval(Expr(J,S), Sum=sum):
rel := (j, k, J) -> eval(Rel(j, k, J), Sum=sum):  # could be a function of (j, j, J, S)

e := expr(3, 1);
for j from 1 to 3 do
  e := algsubs(rel(j, 1, 3), e)
end do;

For S > 1 you could maybe inspire yourself from this ?


Thanks for your reply but the worksheet will only shows that I'm not bullshitting.
The real issue is about the lost of connection to the mpython server.
Either it is something already identified by the development team (or any mapleprimes member) or something that is due to the way Maple is installed on my machine.




Thank you acer, it's very usefull.
A classical example I often meet is the following: randomly select a column or a row of a matrix according to some probability distribution.
I almost systematically forget the necessary conversion of hfloats into integers.

First 8 9 10 11 12 13 14 Last Page 10 of 24