## 721 Reputation

15 years, 178 days

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.

## Hard to produce linegraphs in Maple...

@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

## Automatic calculation of the plotting re...

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 ...

## Automatic calculation of the plotting re...

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 ...

## Very ingenious!...

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

## Very ingenious!...

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

## Kernels...

@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

## Kernels...

@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

## Correction...

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

## Correction...

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

## Compiled but non-parallelized...

@Carl Love I tried Acers original code. Again compilation succeeded and it yielded times around 1.10-1.20 seconds. So the fastest so far seem to be compiled & parallelized. Maybe that is the final conclusion? The evalhf command seem to be pretty fast.

Erik

## Compiled but non-parallelized...

@Carl Love I tried Acers original code. Again compilation succeeded and it yielded times around 1.10-1.20 seconds. So the fastest so far seem to be compiled & parallelized. Maybe that is the final conclusion? The evalhf command seem to be pretty fast.

Erik

## Compilation INCREASES execution time!...

@Carl Love Thanks!

Regarding Acer's compilation code, then I read in the Help menu under 'Compile':

On 64-bit Windows platforms, the Microsoft compiler, if available, is used to compile the emitted C code.

So I searched on the Internet to get information about compilers. One place it was mentioned you could get a compiler installed together with the free Visual Studio Express 2012. So I installed it, and restarted my worksheet. This time I got a 'true' for compilation, BUT time was increased by a factor of 2-3. Without compilation it was less than 1 sec, and with compilation it was 2-3 seconds. Here is my file after some edits:

simulering_teststati.mw

I supposed it to be faster. What can be the problem?

Erik

## Compilation INCREASES execution time!...

@Carl Love Thanks!

Regarding Acer's compilation code, then I read in the Help menu under 'Compile':

On 64-bit Windows platforms, the Microsoft compiler, if available, is used to compile the emitted C code.

So I searched on the Internet to get information about compilers. One place it was mentioned you could get a compiler installed together with the free Visual Studio Express 2012. So I installed it, and restarted my worksheet. This time I got a 'true' for compilation, BUT time was increased by a factor of 2-3. Without compilation it was less than 1 sec, and with compilation it was 2-3 seconds. Here is my file after some edits:

simulering_teststati.mw

I supposed it to be faster. What can be the problem?

Erik

## Now it works!...

@Carl Love Great! With your new file, it works. Little less than 1 sec. Starting up with an execution time of 40 seconds (ignoring my initial unnecessary loop) it is now reduced to less than 1 second. That is indeed really nice.

I think I understand your basic idea, using the Seq command in the Threads package to get access to parallel execution. For every i, the procedure is being executed. But there is one line I don't understand: Why

(),

in line 94?

Could be interesting if Acer could tell how to make the compilation work ...

Erik

## Now it works!...

@Carl Love Great! With your new file, it works. Little less than 1 sec. Starting up with an execution time of 40 seconds (ignoring my initial unnecessary loop) it is now reduced to less than 1 second. That is indeed really nice.

I think I understand your basic idea, using the Seq command in the Threads package to get access to parallel execution. For every i, the procedure is being executed. But there is one line I don't understand: Why

(),

in line 94?

Could be interesting if Acer could tell how to make the compilation work ...

Erik

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