Discuss Scratch

CatClawz_
Scratcher
500+ posts

Finding a square root

writing some code to find a square root of a number (I get that there's probably a block for that, I'm just doing this for fun) I think I can do it but I'm having trouble making a start. Can someone give me a point in the right direction?
EDawg2011
Scratcher
1000+ posts

Finding a square root

There's already a block for this.

sqrtof9
Malicondi
Scratcher
1000+ posts

Finding a square root

i would recommend having a list of each perfect square (you can simply add this as show below) and a simple formula for calculating the approximate of a non perfect square would be using this formula:
√x = √y + ((x - y) / ((2) * (√y))
where y is the closest perfect square to x, and x is any number.
for adding in square roots of up to 100^2:
setito1repeat100addi*itoperfect squares can be named anythingchangeiby1
Hope this helps! if you need anything else just reply to this and i'll see it.

EDawg2011 wrote:

There's already a block for this.

sqrtof9
they said they know, they're doing this for fun.

Last edited by Malicondi (March 1, 2024 21:44:47)

EDawg2011
Scratcher
1000+ posts

Finding a square root

Malicondi wrote:

EDawg2011 wrote:

There's already a block for this.

sqrtof9
they said they know, they're doing this for fun.
They said probably, so they probably didn't know it existed.
homewins
Scratcher
47 posts

Finding a square root

Google “Heron's method for square roots”

Last edited by homewins (March 2, 2024 22:15:40)

CatClawz_
Scratcher
500+ posts

Finding a square root

thanks everyone! I think I've got it now

and yeah I'm not sure why i said probably I know there's a block for it loll
deck26
Scratcher
1000+ posts

Finding a square root

homewins wrote:

Google “Heron's method for square roots”
I didn't know there was a name for that method but it always seemed fairly intuitive to me and I've used that method for years without ever being taught it. After all if you have two positive factors and one is below the square root the other has to be greater than the square root. Think of a rectangle with those sides where the area is the value we're trying to find the square root of. Taking the average of the two values and dividing into the area will give us a rectangle with the same area that is closer to a square.

But I see it goes back around 2000 years when obviously mathematical knowledge was much less widespread. It is also known by multiple names.

CatClawz_
Scratcher
500+ posts

Finding a square root

Malicondi wrote:

i would recommend having a list of each perfect square (you can simply add this as show below) and a simple formula for calculating the approximate of a non perfect square would be using this formula:
√x = √y + ((x - y) / ((2) * (√y))
where y is the closest perfect square to x, and x is any number.
for adding in square roots of up to 100^2:
setito1repeat100addi*itoperfect squares can be named anythingchangeiby1
Hope this helps! if you need anything else just reply to this and i'll see it.

EDawg2011 wrote:

There's already a block for this.

sqrtof9
they said they know, they're doing this for fun.
This is a good idea, although it only goes up to 100, how would i find the square root of a number over 100², like 10201, using this method?
Cereal64
Scratcher
1 post

Finding a square root

defineirrationalnumbers

Powered by DjangoBB