| Author |
Comment/Response |
Sean
|
04/25/09 12:40pm
I am having some trouble figuring out how to create the loop I need. Whenever sin[a] != 0, I want the loop to add a random number to a and then evaluate sin[a + random number] to see if it equals 0. If sin[a + random number] != 0, I want the loop to add another random number to the sin argument and evaluate that to see if it equals zero, and so on until it is zero. Then I want to print the number of random numbers I had to add to get sin = 0.
I want to start at a = 90 degress. I was thinking something like:
a=90 degress; If[Sin[a] != 0, a += RandomInteger[{0, 360}], Print[i]]
where i++ each time a random number is added. Thanks.
URL: , |
|