scottwr

Mr. Scott Wright

15 Reputation

One Badge

2 years, 160 days

MaplePrimes Activity


These are replies submitted by scottwr

@Scot Gould 

I am simulating dice rolls, so I need to use integers in the range 1..6. I like your use of Statistics:-CumulativeSum -- it is easy to understand the expression.

@acer 

For this exercise the integers in the range 1..6 are what I need to use (this is just one part of a larger problem set). My target N is 1000. I don't need a particularly fast solution, but I would be interested to see optimizations for possible future use.

@acer 

Exactly what I wanted -- thanks!

I did many searches on the web and in Maple help and had to cobble things together from disparate sources and code samples.

From the Maple help pages on  map and  ifelse, I doubt I would have made the connection, though I thought  map might be involved somehow. I came across  Statistics:-CumulativeSum(), but I didn't think I was doing or needed statistics (that'll teach me!), so I didn't persue it (I didn't need to write my own solution for this). The [$N] notation is something I have never seen before.

I would be interested in more efficient ways to perform this calculation so that I can learn more about Maple.

@Christian Wolinski 

That was what I was after -- thanks!

@Christian Wolinski 

That's closer, but with printlevel := 2 the successive x values are shown ("x := -1, ...) and on printlevel := 3 both the x and y values are shown. I just want output like:

     1

    -1

    -1

     1

It looks like printlevel is intended as a debugging tool?

Page 1 of 1