Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: computational efficiency

by moritz (Cardinal)
on Oct 05, 2011 at 10:01 UTC ( #929746=note: print w/replies, xml ) Need Help??


in reply to computational efficiency

First focus on which one is correct. $cosine = sqrt(1 - $sine**2) will only give you non-negative $cosine values, so that solution will only cover 2 of four possible quandrants.

In cases involving random numbers, it helps to know the theory of how probability density functions are transformed; if you don't want to learn the theory, at least create a few hundred or thousand random points with each method you consider, and plot them in some way -- either in a histogram, or in a density plot or so. That way you have a chance to see if the resulting distribution is what you want.

MJD #11963, It's easy to get the *wrong* answer in O(1) time.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://929746]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2016-10-01 14:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (578 votes). Check out past polls.