mmcdara

7891 Reputation

22 Badges

9 years, 64 days

MaplePrimes Activity


These are replies submitted by mmcdara

@dharr 

A little complement  T := dsn(eventfired=[1]);  catches the time when event "1" was fired.
(this information is not that easy fo find in the help pages)

@Carl Love 

I don't understand, I've tried a lot of times to do this, and I systematically got an error (Maple 2015) saying than c was a list of objects and that the method  NearestNamedColor was not applicable (or couldn't be used, I no longer remind of the exact error message).
A patty that I did not think to join a screen capture !
I've just quit my Maple's session and run a new one... that works perfectly well

Sorry for the disturbance

Absolutely agree with Tom.
It's very easy to compare sources with Notepad++: a necessary argument if you codevelop a project that must last over years and you have to do code versioning (use Git in addition)

Of course this need you workind under Windows

 

@naili @Carl Love

Sorry Carl if I take the liberty to respond

If you use  PolynomialInterpolation don't even have to use a list of lists.
If you got an error it comes probably from a misconstruction of this latter:

with(CurveFitting):
PolynomialInterpolation([[0,0],[1,3],[2,1],[3,3]], z);
PolynomialInterpolation([0, 1, 2, 3], [0, 3, 1, 3], z);

 

@Carl Love @nm

Thanks to both of us.
In fact all of this comes from the fact that indets recursively searches for all the occurences of the selected typename.

Carl Love showed you how to built the list you can use in pointplot.
But if you are only interested in ploting, this command seems simpler (the options are the same as for a classic "plot")
Statistics:-ScatterPlot(List1, List2)

@acer 

 

(I suspect that was just an oversight or a typo on your part.) :
Right, I first put the column of row names on the left "as usual", with the same kind of collor filling you used.  But when I saw that the OP had put this same column in the right most osition I just moved without redefining the color filling strategy.
I didn't even realize of awfull the result was.
Thanks for correcting all of this
 

 

@vv 

Thank you

@acer

I didn't doubt you knew that.
I was just giving the "no dataframe" solution (which has, I repeat,the advantage to out the column and row titles on either side of the matrix).

In desperation there is also the possibility of making a plot, as in the old days.

@Carl Love

You're right, I wrote my question without paying attention to what I was writing.
So, Is it possible to define an involution in Maple ?

@acer  @lmbs

Hi, 
I don't think it's necessary to built a DataFrame (a structure which was introduced in Maple 2018 I think).
For older Maple's versions you can call Tabulate with a Matrix instead (I guess it works the same with Maple 2020)

More than this th column of rox names is meant to be on the left of the matrix S, which is not possible with DataFrames


 

restart:

interface(version)

`Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895`

(1)

S        := Matrix([[0,9,8,0,7],[3,5,6,5,1],[1,0,0,3,2]]):

RowNames := Vector(3, ["small","medium","large"]):
ColNames := Vector[row](6, ["Rose","Teal","Plum","Sand","Peach", ""]):

M        := < ColNames, < S | RowNames >>:

DocumentTools:-Tabulate(
      M,
      color=((T,i,j)->`if`(i=1 and j=1, "0000FF", `if`(i>1 and j>=i, "#000000", "#0000FF"))),
      fillcolor=((T,i,j)->`if`(i=1 or j=1, "HTML NavajoWhite", white)),
      width=40, weights=[1, 1$5]
)

 


 

restart:

interface(version)

`Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895`

(1)

S        := Matrix([[0,9,8,0,7],[3,5,6,5,1],[1,0,0,3,2]]):

RowNames := Vector(3, ["small","medium","large"]):
ColNames := Vector[row](6, ["Rose","Teal","Plum","Sand","Peach", ""]):

M        := < ColNames, < S | RowNames >>:

DocumentTools:-Tabulate(
      M,
      color=((T,i,j)->`if`(i=1 and j=1, "0000FF", `if`(i>1 and j>=i, "#000000", "#0000FF"))),
      fillcolor=((T,i,j)->`if`(i=1 or j=1, "HTML NavajoWhite", white)),
      width=40, weights=[1, 1$5]
)

 


 

Download Tabulate.mw

@JAMET 

Ok, I didn't think it was a constraint of yours.
Could you download your worksheet code by using the big green up arrow? It would be easier for anyone to work on it, thanks.

@vv 

Hi, 
I didn't pay attention to the end of the question "as close as possible to optimize the selection".
Good point...and pretty solution

An improved version of my previous reply

 

restart:

randomize():

M    := 10.:
roll := rand(0. .. M):
N    := 10:
L    := [seq(roll(), k=1..N)]

[4.642947111, 3.799964258, 8.312019404, 2.745959356, 7.617268886, 2.643016721, 7.560355187, 8.427926897, 8.209026733, 6.182349681]

(1)

ROLL := rand(0..N*M):
S    := ROLL();  # target sum

19.20858495

(2)

R := 10:
AllSets := NULL:
for r from 1 to R do
  rL := combinat:-randperm(L):
  c := Statistics:-CumulativeSum(rL):
  if c[-1] < S then
    printf("The sum of all the numbers (%a) is less than rge desired sum (%a)\n", c[-1], S)
  else
    select[flatten](`<`, c, S);
    AllSets := AllSets, convert(rL[1..numelems(%)+1], set);
  end if;
end do:

AllSets := { AllSets }: # remove replicated sets

for r in sort(AllSets) do  # display sets in increasing number of members
  printf("%a\n", r);
end do:

{3.799964258, 7.560355187, 8.209026733}
{6.182349681, 7.560355187, 7.617268886}
{6.182349681, 8.209026733, 8.312019404}
{2.643016721, 3.799964258, 6.182349681, 8.312019404}
{2.643016721, 7.617268886, 8.312019404, 8.427926897}
{2.745959356, 3.799964258, 6.182349681, 8.312019404}
{2.745959356, 3.799964258, 7.617268886, 8.312019404}
{2.745959356, 6.182349681, 7.560355187, 8.209026733}
{3.799964258, 4.642947111, 7.617268886, 8.209026733}
{2.643016721, 2.745959356, 4.642947111, 7.560355187, 8.209026733}

 

 


 

Download search_improved.mw

@Carl Love 

Thanks, 
I hadn't paid attention that e mod m do the job even if e is a list

First 108 109 110 111 112 113 114 Last Page 110 of 154