erik10

I have a degree in Mathematics and Physics from the Danish University Aarhus, comparable to a masters degree with thesis - majoring in Mathematics. In 1991-92 I was a visting scholar at UCLA, Los Angeles, following graduate courses in Applied Mathematics. Since 1992 I have been a teacher in a high school (gymnasium) in Denmark. Special interests: Applied mathematics, graphics and popularizing Mathematics.

MaplePrimes Activity


These are replies submitted by erik10

@Carl Love Actually to be completely detailed I want two lists of real numbers. Each time the computer arrives at a box combination two real numbers are being calculated from the box combination information. One of the numbers are actually a probability, but just think of it as a real number. You ask about if the order matters. Well it does not as long as the two real numbers associated with the same box combination have the same position in either of the two lists. No, I don't need to be able to reconstruct the box combination from the two lists, and the order in which they appear doesn't matter - except the pairing! I hope this makes sense?

Erik

@Carl Love Actually to be completely detailed I want two lists of real numbers. Each time the computer arrives at a box combination two real numbers are being calculated from the box combination information. One of the numbers are actually a probability, but just think of it as a real number. You ask about if the order matters. Well it does not as long as the two real numbers associated with the same box combination have the same position in either of the two lists. No, I don't need to be able to reconstruct the box combination from the two lists, and the order in which they appear doesn't matter - except the pairing! I hope this makes sense?

Erik

Great Carl! I was aware of the problem with memory, because when the computer makes it's way through the recursive procedure it need to hold all information on it's way! So I assume you need to choose the iterative method if the number of boxes is too large. Maybe you need to know a bit more about my "do something here". Here I mean that when the computer has arrived at a certain state corresponding to a box combination, say [10,5,8,9,0,8] - meaning 10 marbles in box 1, 5 marbles in box 2, etc - then the information about this combination should be available, so that a third quantity: som function of the box combination can be calculated. In the end I wish as output a list of the results of having applied the real-valued function to every box combination:

List = [f([40,0,0,0,0,0]), f([39,1,0,0,0,0]), ... , f([0,0,0,0,0,40])]

I will look closer at your code. Thanks a lot!

Erik

Great Carl! I was aware of the problem with memory, because when the computer makes it's way through the recursive procedure it need to hold all information on it's way! So I assume you need to choose the iterative method if the number of boxes is too large. Maybe you need to know a bit more about my "do something here". Here I mean that when the computer has arrived at a certain state corresponding to a box combination, say [10,5,8,9,0,8] - meaning 10 marbles in box 1, 5 marbles in box 2, etc - then the information about this combination should be available, so that a third quantity: som function of the box combination can be calculated. In the end I wish as output a list of the results of having applied the real-valued function to every box combination:

List = [f([40,0,0,0,0,0]), f([39,1,0,0,0,0]), ... , f([0,0,0,0,0,40])]

I will look closer at your code. Thanks a lot!

Erik

I like your link to the Mathematica page. Apparently they already have the command I am requesting. I realize my expression "Line graph" means something completely different, haha.

Your suggestion is pretty much what I am requesting as a built-in command in Maple. Thanks!

 

I like your link to the Mathematica page. Apparently they already have the command I am requesting. I realize my expression "Line graph" means something completely different, haha.

Your suggestion is pretty much what I am requesting as a built-in command in Maple. Thanks!

 

@Alejandro Jakubi Your suggestions for a solution are very smart, but I think rather few Maple users can sort out a solution themselves easily. I consider you guys here experts! I just think it is very basic to have a command that given a list of DIFFERENT numbers (outcomes) with a corresponding list of frequencies plots a linegraph (What is it called in English?). As it seems to be now, it is rather hard to produce a linegraph unless you have raw data. I mean it seems artificial to have to use the CURVES thing, which is intended for another purpose. But it is necessary here. Just my opinion.

I know my request that the list can have repetitions is a complication that you cannot expect to be supported. If the basic command was present, I would probably make a loop running through my list of outcomes to produce a new list with different elements (probably in n^2 time) and then apply the basic command to plot it. 

Erik

 

 

@Alejandro Jakubi Your suggestions for a solution are very smart, but I think rather few Maple users can sort out a solution themselves easily. I consider you guys here experts! I just think it is very basic to have a command that given a list of DIFFERENT numbers (outcomes) with a corresponding list of frequencies plots a linegraph (What is it called in English?). As it seems to be now, it is rather hard to produce a linegraph unless you have raw data. I mean it seems artificial to have to use the CURVES thing, which is intended for another purpose. But it is necessary here. Just my opinion.

I know my request that the list can have repetitions is a complication that you cannot expect to be supported. If the basic command was present, I would probably make a loop running through my list of outcomes to produce a new list with different elements (probably in n^2 time) and then apply the basic command to plot it. 

Erik

 

 

And probably a few changes in the code will make it possible to have the code calculate the appropriate plotting region, so the user don't need to choose it ...

And probably a few changes in the code will make it possible to have the code calculate the appropriate plotting region, so the user don't need to choose it ...

Hi Carl. Your suggestion is very ingenious! It took me a while to understand what is going on. Several of those special commands/signs ($, ~ and zip) are new to me. By trying parts of your expressions, I figured your idea. It is great and works perfectly in the present example. I was however posing a reduced problem, and not the one I am really working on. Firstly the frequencies in the vector B - hence each 0 or positive - can have many digits, so you will need to multiply by say 1000000 or so. It will yield an enormous vector. Of course you could say one will never be able to watch the difference if you take only 4 decimals or so, but the vector A may contain 10000 entrances. Also it would be of interest to have a more safe method. How will you create the lineplot if their are no repetitions in the A vector? I can't even find a command in Maple creating the lineplot when only the frequencies are given and not a list of raw data ...

Erik

Hi Carl. Your suggestion is very ingenious! It took me a while to understand what is going on. Several of those special commands/signs ($, ~ and zip) are new to me. By trying parts of your expressions, I figured your idea. It is great and works perfectly in the present example. I was however posing a reduced problem, and not the one I am really working on. Firstly the frequencies in the vector B - hence each 0 or positive - can have many digits, so you will need to multiply by say 1000000 or so. It will yield an enormous vector. Of course you could say one will never be able to watch the difference if you take only 4 decimals or so, but the vector A may contain 10000 entrances. Also it would be of interest to have a more safe method. How will you create the lineplot if their are no repetitions in the A vector? I can't even find a command in Maple creating the lineplot when only the frequencies are given and not a list of raw data ...

Erik

@Carl Love I have 8 kernels. Cpu time 13.01 sec, Real time 2.87 sec., for compiled + parallel. 

But when I run Un-compiled and Parallelized I get CPU time 6.47 sec and Real time 935 ms.

So it seems like the compilation here increases time.

Anyway I think we should stop here. I have already received very useful help from you two guys!

I learned some new tricks, that I can use in the future, when execution time is an issue!

 

Erik

@Carl Love I have 8 kernels. Cpu time 13.01 sec, Real time 2.87 sec., for compiled + parallel. 

But when I run Un-compiled and Parallelized I get CPU time 6.47 sec and Real time 935 ms.

So it seems like the compilation here increases time.

Anyway I think we should stop here. I have already received very useful help from you two guys!

I learned some new tricks, that I can use in the future, when execution time is an issue!

 

Erik

@erik10 Correction: I mean the non-compiled & parallelized method seems to be the fastest ...

First 7 8 9 10 11 12 13 Last Page 9 of 17