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

#1 2013-02-09 12:38:45

lalala3
Scratcher
Registered: 2008-10-03
Posts: 100+

Add Exponent Operator

As the title says, Scratch could use the ^ operator. As in:

<() ^ ()>
And no, there is no valid workaround involving the repeat block. Reason why:
Say I want the cube root of a number for some reason. With the block, I could just do
<(number) ^ ((1)/(3))>
However,
repeat((1)/(3))
doSomething
end
is not going to work for obvious reasons. Scratch will not run something 1/3 of a time.


http://img515.imageshack.us/img515/9374/signature2nt.png

Offline

 

#2 2013-02-09 13:04:31

shadowmouse
New Scratcher
Registered: 2013-02-03
Posts: 100+

Re: Add Exponent Operator

Support! This is something that can only be done in BYOB, and even then it's not that easy and it's useful for finding distances as well as other things.

Offline

 

#3 2013-02-09 18:15:01

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: Add Exponent Operator

Support! And thank you for teaching me how to find the square root/cube root of a number. I've been trying to find how forever and that's ALL it takes?!

Offline

 

#4 2013-02-10 05:48:28

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Add Exponent Operator

ImagineIt wrote:

Support! And thank you for teaching me how to find the square root/cube root of a number. I've been trying to find how forever and that's ALL it takes?!

Yeah, sqrt(x) is x^(1/2) and cube root of x is x^(1/3) etc.

I think you cover it in algebra so you might not have learned it.

I think there's a way to do exponents with logarithms as a workaround, but little kids probably won't get that so a ()^() block might be nice.

Offline

 

#5 2013-02-10 11:56:59

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Add Exponent Operator

Seen this suggested many times before, support. The workaround of this does indeed involve logarithms and the "^10" block. Never seen a good reason not to add it either.


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#6 2013-02-12 12:12:39

shadowmouse
New Scratcher
Registered: 2013-02-03
Posts: 100+

Re: Add Exponent Operator

What is the workaround? Just asking because I'm doing a project involving algebra in byob and an exponent block would be useful.

Offline

 

#7 2013-02-12 14:02:50

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: Add Exponent Operator

This is in a bunch of mods (the raisedTo: function in Squeak), but I still think Scratchers could use it. Support.


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#8 2013-02-12 19:09:28

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: Add Exponent Operator

shadowmouse wrote:

What is the workaround? Just asking because I'm doing a project involving algebra in byob and an exponent block would be useful.

kayybee wrote:

Yeah, sqrt(x) is x^(1/2) and cube root of x is x^(1/3) etc.

I think you cover it in algebra so you might not have learned it.

I think there's a way to do exponents with logarithms as a workaround, but little kids probably won't get that so a ()^() block might be nice.


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

#9 2013-02-12 22:11:54

lalala3
Scratcher
Registered: 2008-10-03
Posts: 100+

Re: Add Exponent Operator

Mokat wrote:

shadowmouse wrote:

What is the workaround? Just asking because I'm doing a project involving algebra in byob and an exponent block would be useful.

kayybee wrote:

Yeah, sqrt(x) is x^(1/2) and cube root of x is x^(1/3) etc.

I think you cover it in algebra so you might not have learned it.

I think there's a way to do exponents with logarithms as a workaround, but little kids probably won't get that so a ()^() block might be nice.

I think you're missing the point.

shadowmouse wrote:

What is the workaround? Just asking because I'm doing a project involving algebra in byob and an exponent block would be useful.

There.

Last edited by lalala3 (2013-02-12 23:01:33)


http://img515.imageshack.us/img515/9374/signature2nt.png

Offline

 

#10 2013-02-13 03:35:35

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Add Exponent Operator

since everyone seems to be all excited about it, I guess I should post it.

I actually don't know/forgot it so ill have to think about it for a while.

Okay, I think I got it. it only took 6 minutes. Probably would've been faster searching I but oh well.

I think this should work. (you can use 10^ and log, or e^ and ln)

e^[y*ln(x)]=x^y
=10^[y*log(x)]

You might have to round it cause it'll be a bit off (like a billionth or a trillionth or so)

Offline

 

#11 2013-02-13 05:39:02

shadowmouse
New Scratcher
Registered: 2013-02-03
Posts: 100+

Re: Add Exponent Operator

Thanks Kayybee, I think Scratch rounds once it gets to  ceratin amount of decimal places anyway.

Offline

 

Board footer