Sorry to ramble. I don't think range is going to be that much of an issue since the algorithm you provided has a range of 4.29 x 10 ^ 9 to 2.32 x 10 ^ -10. BTW I found the arm code that I was talking about. It's toward the bottom of this page: http://www.sciencezero.org/computing/arm.htm Keep up the good work. I hope to see more.
I've used this method before to do integer square roots. The only disadvantage that it had was that it only worked within a certain range. With the integer version you could also early out if result * result = parameter. The ARM processors have conditional instructions that allow this method to be done in a very small number of instructions.
Actually, check out my Trig demo at
[url](link to project)]
for the cosines, sines, and tangents.
Keep in mind that what I'm doing here is to demonstrate a very basic concept that could be implemented in a much larger Scratch project, as a sort of "function" library.
I would like to know how to get the slider bar to stay fixed at a larger size, but it seems as though the Java applet doesn't preserve the slider size that I use within the development environment.
Good idea but the slider is tricky to use unless you click very varefully and close to the 'indicator'. It increments by 122 if you just use the button. To be useful to younger users, you probably need a longer slide. However, this is a good example of how Scratch could be used to perform calculations without being cluttered up with unnecessary and distracting displays or graphics. What's next - cosines, sines, squares, cubes - what?
This is a square root algorithm implemented in Scratch based upon the idea suggested on http://tima-cmp.imag.fr/~guyot/Cours/Oparithm/english/Extrac.htm
*Note* This does *not* use the Newton approximation method, but rather uses a faster algorithm based upon how this is usually implemented in hardware and is not a convergant algorithm.
Instead, for algorithm explorations, this has a big "O" of O(1). Yes, if you know what that means, it is just as efficient no matter what value is put in for calculations.
This is another in my series of demo Scratch programs that you can extract the icon and import it into your project to perform this sort of avanced mathematical function
Comments
You need to be logged in to post comments
Add a Comment
its pretty clever but i agree with wii and mohlar you should be able to type in your number it would be useful
(view all replies)Comment Reply
How do you make the slider go so high?
(view all replies)Comment Reply
u should make it a number that u type in so kids can use it for square root homework =p lol come in use pretty soon
(view all replies)Comment Reply
Sorry to ramble. I don't think range is going to be that much of an issue since the algorithm you provided has a range of 4.29 x 10 ^ 9 to 2.32 x 10 ^ -10. BTW I found the arm code that I was talking about. It's toward the bottom of this page: http://www.sciencezero.org/computing/arm.htm Keep up the good work. I hope to see more.
(view all replies)Comment Reply
In integer having a fixed range isn't so bad since it is always fixed.
(view all replies)Comment Reply
I've used this method before to do integer square roots. The only disadvantage that it had was that it only worked within a certain range. With the integer version you could also early out if result * result = parameter. The ARM processors have conditional instructions that allow this method to be done in a very small number of instructions.
(view all replies)Comment Reply
Actually, check out my Trig demo at [url](link to project)] for the cosines, sines, and tangents. Keep in mind that what I'm doing here is to demonstrate a very basic concept that could be implemented in a much larger Scratch project, as a sort of "function" library. I would like to know how to get the slider bar to stay fixed at a larger size, but it seems as though the Java applet doesn't preserve the slider size that I use within the development environment.
(view all replies)Comment Reply
Good idea but the slider is tricky to use unless you click very varefully and close to the 'indicator'. It increments by 122 if you just use the button. To be useful to younger users, you probably need a longer slide. However, this is a good example of how Scratch could be used to perform calculations without being cluttered up with unnecessary and distracting displays or graphics. What's next - cosines, sines, squares, cubes - what?
(view all replies)Comment Reply