sand15

872 Reputation

13 Badges

10 years, 267 days

MaplePrimes Activity


These are replies submitted by sand15

@Andiguys 

There is no possibility to associate a legend to the structure named  back.

The attached file contains two straightforward alternatives plus another coding to mimic a legend.

This latter is more complex to code and require adjustements and tunning to render exactly what you want. So it will be up to you do these tunnings... but you have to be extremely careful: adjustng the position of a plots:-textplot will never make Maple crash or corrupt your file, but toying with the DocumentTools:-Layout:-Table structure can have dramatic consequences if you do something wrong (for instance a corrupted file that you won't be able to read)

3_possibilities.mw

Last point you must be aware of when using  DocumentTools:-Layout:-Table: contrary to a "classical" plot while clicking on it enables you to export it in some formatted file, there is no such possibility for a picture produced by DocumentTools.
So you have to realize a screenshot of this image, or part of it, and convert this latter in some format.
For instance the image below is a PNG conversion of a screenshot of the the last figure in the attached file.

@sym_group_p 

Something bothers me. You write "You write "My matrices are relatively sparse and I specified "storage=sparse" when creating them". storage=parse is a Maple option (maybe the same syntax in other softwares?): What is the software you use to create those matrices?

Aside:
(1) As it is a sparse matrix, asuming it is built in an astute way it does not contain about 1010 elements , so I do not understand why you speak about 105x105 matrix?
Let's take the extreme case of a diagonal matrix of size 105x105 : an astute way to represent it is to store only its diagonal... would you then ask the same question you asked?

(2) "... in the past... Perhaps, this particular example may be less sparse than other examples that I have considered".
I think so.
I understand this matrix (file) already exists, right? So you can be able to determine its size (because you have built it in some way or another) and determine if it is more or less sparse than the ones you already succcesfully loaded into Maple.

If these matrices have been built out of Maple, the question I would ask byself if I was in your position is "Why do I want to read, and probably work with, this matrix in Maple as it has likely be generated by some other software which, presumably, contains all the features to do what Maple is supposed to do?"

(1) Reading huge ascii formated structures is extremely time consuming.
It is always better to save them in binary format and read them using FileTools[Binary][Read]?
For instance I use to use Maple and R for statistical analysis and manipulate large matrices, typically 106 by 50.
Those matrices are generated by R: saving them in ascii format and then loading  into Maple takes about 30 seconds on my PC.
Using a binary format takes less than 1 second.

(2) The reading time put aside your matrix is huge
      Look to this file to see why your matrix will not use less than 110 gigabytes Bytes.mw

@Andiguys 

Reply to this question

Nothing's wrong, just a scaling problem.

Reply_to_Regional_plot_sand15.mw

@Andiguys 

REPLY to this question
Example from plots[inequal] help page.

Original

Hatched


plots_inequal_hatched.mw

@Andiguys 

Answer is in the help page:

<X, 2*Y>       vector which represents the point where the arrow starts from
< 0, -.9*Y >   vector which represents the displacement to the point where the arrow ends.

So if you want an arrow from, lets say, point <a, b> to point <c, b> where c < a define the arrow this way

plots:-arrow( < a, b >, < c-a, b >, ...)

If you find this definition is confusing use plottools:-arrow instead.

I advice you to carefully read plots/arrow and plottools/arrow help pages to understand how to draw arrows.

@acer 

"The OP seems to have indicated (elsewhere) that he couldn't use Kitonum's contour labelling proc..."
What I know is that the OP has posted a question saying that your code produced an error and I sent him a reply which basically said the same think as in my last reply above.

It was only when I saw that his question had been deleted that I wrote the above reply..
 

@Andiguys 

Watchout, @acer writes in LOOK HERE that his code uses "the new legend mechanism."  (meaning for Maple versions  >= 2020).
For instance the same code generates an error in Maple 2015 (my version) or earlier because option legend must be of the form legend=something.
It is thus likely this same code could not work for some versions in between 2016 and 2019 included

 


In my REPLY to your previous question @acer code is for Maple 2020 (and further versions I guess [I use Maple 2015 right now]).

In his answer @acer clearly speaks of the "new legend mechanism" meaning the syntax

plots:-contourplot(ee, contours = 20, opts, legend),

is not supposed to be supported by some versions anterior to 2020.
For instance Maple 2015 does not accept it and it is likely the same thing for your own version.

I suggest you to wait for @acer , or someone else more qualified than me, for a workaround adaptedto your own Maple version.

@Carl Love 

You write: "And how does this have any significant effect on the length of the plot structure?"

If X contains N elements then histogram(X, discrete=true, ...) contains exactly N CURVES structures.
If X ranges from A to B then histogram(X, bninwidth=W, ...) contains about (B-A)/W CURVES structures.

For instance if X= [1, 1.1, 10] histogram(X, discrete=true, ...) contains 3 CURVES while, a bandwith W=0.1 induces about 100 CURVES.
 

@Carl Love 

I didn't catch this point, sorry

@Carl Love 

Binwidth W:= min(Xs[2..] -~ Xs[..-2]); doesn't always good the correct result, like any other formula I think (not to even speak about the length of the plot structure it may generate).
So I still advice using option discrete=true instead... which of course requires adapting the thickness of the bars.

discrete.mw
 

data = [[1, 2], [11/3, 5], [16/3, 6], [6, 3], [19/3, 5], [28/3, 4]]




Option bindwidth=1/3 misses the bar at location x=1.
 

I agree that command randomize() should always end with a semicolon.

@erik10 

@Carl Love's use of option binwidth=something seems to me far too restrictive and is prone to give wrong results in a lot of situations.
I would advise you to use the option discrete=true instead: discrete.mw

@dharr 

Here is an updated version where I add a 2D ternary plot maybe_smarter_2.mw

Building a smooth representation of this ternary plot cannot be done with Maple built-in procedures.

Here is the result  from a package I developed from internal purposes. As the orientations of the axes of the ternary plot diffeet from those used in the attached worksheet, I simply reflected the figure using plottools:-reflect to ease the comparison with the Multinomial ternary plot [which explains why texts are badly positioned]):

@dharr 

You're the only one who did the things correctly because, indeed, a multinomial distribution with N characters is defined on a (N-1)-simplex.

To get a smart visualization of a 3 characters multinomial distribution I used, years ago, vertical bars of hexagonal cross sections in order tho "fill" the 2-simplex in the sense matrixplot does.
I can't put the hand on what I did bback then but here is the idea (the coloring was initially adapted to the heights of the bars)

restart

with(plots):

prob of m and k successes in N trials with prob p,q per trial

trinomial := proc (m, k, N, p, q) options operator, arrow; factorial(N)*p^m*q^k*(1-p-q)^(N-m-k)/(factorial(m)*factorial(k)*factorial(N-m-k)) end proc;

proc (m, k, N, p, q) options operator, arrow; factorial(N)*p^m*q^k*(1-p-q)^(N-m-k)/(factorial(m)*factorial(k)*factorial(N-m-k)) end proc

(1)

Ternary coords for m = N at (N,0), k=N at (1/2,sqrt(3)/2)*N, third one =N at the origin. - see  https://en.wikipedia.org/wiki/Ternary_plot

tcoords := proc (m, k) options operator, arrow; (2*m+k)/2., sqrt(3)*k/2. end proc;

proc (m, k) options operator, arrow; (2*m+k)/2., sqrt(3)*k/2. end proc

(2)

lbls := proc (N) options operator, arrow; textplot3d({[0, 0, 0, cat("var3 = ", N), align = [below, right]], [(1/2)*N, (1/2)*sqrt(3)*N, 0, cat("var2 = ", N), align = [below, right]], [N, 0, 0, cat("var1 = ", N), align = [below, left]]}) end proc:

N := 20;

20

(3)

with(plottools):


Without focusing on coloring:

ref  := display(
          polygon(
            [seq([cos(2*Pi/6*i)/sqrt(3), sin(2*Pi/6*i)/sqrt(3)], i=1..7)]
            , color=gray
          )
        ):

pins := (N, p, q) -> seq(
                       seq(
                         translate(
                           extrude(ref, 0..trinomial(m, k, N, p, q))
                           , tcoords(m, k), 0
                         )
                         , m=0..N-k
                       )
                       , k=0..N
                     ):

display(
  pins(N, .2, .5)
  , lbls(N)
  , axes = normal
  , labels = ["", "", prob]
  , axis[1, 2] = [color = white]
)

 
 

 

Download maybe_smarter.mw

A coloring example: maybe_smarter_2.mw

By the way I thought there was a built-in TernaryPlot in Maple now?

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