Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

We often need to know how long a lasts when performed by Maple (and by other sof

ID: 3793664 • Letter: W

Question

We often need to know how long a lasts when performed by Maple (and by other software), i.e., how long the CPU of the computer is engaged by Maple to perform the task. This, example, can motivate for us to optimize the programming, or to whether it is worth doing it at all, or to weigh the benefits of the calculation versus and resources invested it. Find a way to time the generation of 500,000 random numbers by Maple, using the rand() command, as is shown at the beginning of the worksheet that I emailed you. Repeat for 1 million numbers, 2, 3, 4, and 5 million. Plot your results (i.e., time vs. number of random numbers) and do a polynomial fit of an appropriate order. What is the dependence of time on the number of random numbers generated?

Explanation / Answer

restart: randomize(): st := time(): X:=Statistics:-RandomVariable('Uniform'(0,1)): S:=Statistics:-Sample(X,5000000): for i from 1 by 1 to 5000000 do S[i]; end do: time() - st; restart: randomize(): with(RandomTools[MersenneTwister]): st := time(): for i from 1 by 1 to 5000000 do GenerateFloat(); end do: time() - st; restart: randomize(): st := time(): for i from 1 by 1 to 5000000 do rand()/(1000000000000.); end do: time() - st;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote