sand15athome

40 Reputation

4 Badges

8 years, 299 days

MaplePrimes Activity


These are replies submitted by sand15athome

@Carl Love 

thanks for the answer.

@Joe Riel 
It is not that I do not trust you but I will do mine once at the office again.
Although I am not really concerned by performances, I have rather huge tables ("depth" = 6 or 7, probably more than 300 termninal leaves) and an early stopping could be interesting.

 

@Carl Love @Joe Riel @vv
Great thanks to all the contributors

@Joe Riel I'm going to compare your solution to Carl's one.

Thank you for the answer

For the same reason I explained earlier to Carl, I'll fix the "wote up" issue next monday

@Carl Love Great thanks to you Carl.
It suits me well.

Can't vote up from this login, I'll fix that next monday

 

@vv I simply posted my question just before leaving the office and going into a weekend.

Apologies

@vv The structure of tables A and B is definitely imposed.
Your "multiple indices" proposal is smart but cannot unfortunately be used

thank you nevertheless

@Carl Love 
@tomleslie 

Tom put the finger on the solution and I did not realized he did ...

All the structures (rectangles, edges and arrows) DrawGraph returns are polygons ( ;-) Tom) 

Thus writting
PLOT( <list of POLYGONS>, < list of CURVES for the edges>, <list of CURVES for the arrows>)
is equivalent to  
PLOT( <list of POLYGONS>, < list of POLYGONS for the edges>, <list of POLYGONS for the arrows>).

In fact, and I did not realize this, CURVES is just POLYGONS of thickness 0. 

Thus 
      PLOT(POLYGONS([[0, 0], [0, 1], [1, 1], [1, 0]]), CURVES([[-1, -1], [2, 2]]))
places the polygon behind the straight segment, but 
      PLOT(POLYGONS([[0, 0], [0, 1], [1, 1], [1, 0]]), POLYGONS([[-1, -1], [2, 2]]))
places the "true" polygon in front of the straight segment

You can consider my question is then obsolete.

Thanks to both of you

@Carl Love 
Thank you Carl.
I suspected Maple used some rank based on the dimension of the structure to plot.
But I had some hope that a bypass could exist.
The reason is :

1 : DrawGraph display edges only "outside" of the rectangle that represent the vertices

2 : plottools:-getdata(DrawGraph(...)) returns a list of polygons where some are correspond to edges from a point A to a point B while others are rectangles centered at points A and B.
So, "materially", the edges arereally from A to B but they are hidden by theses rectangles ... I suspected where fleces in the foreground. ... so my question




@tomleslie 
Thank you Tom.
Indeed I have always been embarassed by PLOT : as it seems more powerful (?) than plot is, it is also more trick to use (personal opinion).
Your suggestion to use plot can be interesting

I Did that "plottools:-getdata(DrawGraph(G))" and observed the same thing : only "polygon" although DrawGraph exhibits lines (edges) and rectangles (where the names of the vertices are displayed in).

Seeing "polygon" my first idea was to use PLOT(POLYGONS(....)) for "true" polygons, that is those with a 4x2 matrix of points, and thus PLOT(CURVES(...)) for the other polygons.

I am interested in DAG (Directed Acyclic Graphs) and DrawGraph presents two main drawbacks (my opinion) :
1 : even if the DAG is planar the option "style = planar" generates an error message
2 : the arrows are really badly placed (I would prefer to see them in the middle of the edges)

For a DAG G with NV vertices and NE edges, "plottools:-getdata(DrawGraph(G))" returns a list of NV+3*NE objects.
Among them you find NV rectangles and 3*NE segments corresponding to :
1 : NE edges
2 : 2*NE "little" segments to draw each vart of the v-shaped arrow

This last observation suggested me that, somewhere in its limbo, DrawGraph should use PLOT, for plottools:-arrows enables to draw arrows.

So I decided to mimic what, I thought, DrawGraph was doing ...


You write "Suggest you provide an example of a graph which exhibits the behaviour you are concerned about - in other words it contains CURVES and POLYGONS and the undesirable foreground/background behaviour to which you refer: with an explanation of the foreground/background issue - as in what should be foreground? and why?

I will provide you this latter (I am about to go to the office) ; concerning foreground/background : what I would like is that the colored rectangle at any vertex be in front of the edges that start from or end to this vertex (as DrawGraph(G) displays).
But PLOT(POLYGONS(some rectangle), CURVES(some edge)...) places the rectengle behind the edge in the sense that the rectangle does not hide some part of the edge.


I will provide you an example later.
 

@Carl Love   This gives exactly what I wanted.

Thank you for all these helpful tips (use of quotes [although still obscure to me], mul vs product and the drawbacks the constructor || has).

I will vote up when I am at the office


@Carl Love Thank you Carl.

I just sent a response to tomleslie and (normally) to you too.

I am sorry for I did not express myself well.
Even useful your answer is not the one I was expecting for ... because my question was not correctly formulated and the attached file did not illustrate it well

Could you please look on the my previous response to Tom ?

Thank you in advance


@tomleslie 

@Carl Love 

Thank you for your answers


Tom : you are right to invoke this "typographic convention" : it is exactly what I want to use.

Tom and Carl : I agree fully with both of you when you say that indexed (x[n]) and "subscripted" (x__n) variables are two different things and that only the first is really an indexed variable, even if they look the same.

Your answers served to remind me I did not use the correct words for I would have written "Evaluation of subscripted variables ..".
Originally I had prepared a mw file with two different codings, both of them presenting unexpected outputs. I found its reading confusing and I discarded one of the two codings, then posting only one of them.

Maybe, if it is not too much to ask, could you take a peek to this new mw file ?

 

I would just like to stress that I do not want to use indexed variables but "subscripted" ones.


I'm sorry for this bungling.

 

Download WhatHappensHere2.mw






 

@Carl Love  It is exactly what I was looking for.

plot(eval([y(t), diff(y(t),t)], Sol)  is a very clever solution I would never have imagined

Thank you a lot Carl


PS : As you have probably noticed sand15 (office) and sand15athome (home) are the same person

@Markiyan Hirnyk 

output=Array is a solution.

But, and I am probably unforgivable, my original phrase was  "One of my colleagues wants the solution in array form for using it in a spreadsheet (namely Excel), but for my personal use within Maple I prefer a procedure as output" ... and I thought the bold text was superflous .... 

Of course not : I should have keep the full text

Sorry to have monopolised your time

1 2 3 Page 2 of 3