This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-01-28 21:26:02

pannulaa1
Scratcher
Registered: 2010-10-16
Posts: 100+

square root function

how can i get a square root function thingy i really need it can i have some script ideas?

Offline

 

#2 2011-01-28 21:29:08

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: square root function

In the operators section of the blocks, there should be a block at the bottom that looks like:

([sqrt] of ( ))[/blocks]

That's the square root function.

Through the drop down menu of the same block you can get sine, cosine, absolute value, and more.

Last edited by Kileymeister (2011-01-28 21:30:16)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#3 2011-03-31 20:41:19

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: square root function

Kileymeister is correct, but on another note, the method all computers use (I believe) to find the square root is a form of "guess and check".  For example, say they're using this formula:
(Square root of n) = (n+(x^2) )/2x
The computer would do this:

Square of 100 is...
1st Guess: 2
(100+(2^2) )/(2*2)=26
2nd Guess: 26
(100+(26^2) )/(2*26)=14.92
3rd Guess: 14.92
(100+(14.92^2) )/(2*14.92)=10.81
4th Guess: 10.81
(100+(10.81^2) )/(2*10.81)=10.03

etc.

The more guesses the computer gives it, the more accurate it gets.

Anyway, because of this, the square root tool can be pretty expensive (in terms of computer speed), but that shouldn't be a problem unless you used it a ton of times.

Why did I bother posting this? Because I found it interesting  tongue

Last edited by MoreGamesNow (2011-03-31 20:42:02)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#4 2011-03-31 20:51:00

puppetadventurer
Scratcher
Registered: 2011-02-20
Posts: 1000+

Re: square root function

yeah you people are right


3

Offline

 

Board footer