Discuss Scratch

8solarplanets
New to Scratch
100+ posts

Could we please have an exponents block? ( ) ^ ( )

( ( var ) ^ ( var ) )
PPPPPPPLLLLLLLLLLLLLZZZZZZZZZZZZ!!!!!!!!!!!!!!!!!!!

dracae
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

I support.
(EDIT: There's a workaround though, so…)

Last edited by dracae (July 4, 2013 02:53:52)


8solarplanets
New to Scratch
100+ posts

Could we please have an exponents block? ( ) ^ ( )

But what if we wanted to do x^50 or something? Why use 50 blocks when you could use 1?
EDIT: Support (though I started this post topic, so…)

Last edited by 8solarplanets (July 4, 2013 02:56:03)


mitchboy
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

8solarplanets wrote:

But what if we wanted to do x^50 or something? Why use 50 blocks when you could use 1?
You wouldn't need 50 blocks. I'm currently working on a x^y custom block right now, if you're interested.

Capsicum annuum.
8solarplanets
New to Scratch
100+ posts

Could we please have an exponents block? ( ) ^ ( )

Thanks. (I have Scratch 2.0, never heard of 1.4…)

dracae
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

8solarplanets wrote:

Thanks. (I have Scratch 2.0, never heard of 1.4…)
There's some log things that works…

8solarplanets
New to Scratch
100+ posts

Could we please have an exponents block? ( ) ^ ( )

But what if we wanted, for example 84 ^ 59? There's no block for that.

mitchboy
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

8solarplanets wrote:

But what if we wanted, for example 84 ^ 59? There's no block for that.
There now is.

This project.

EDIT: 84 ^ 59 = 3.40782965354148e+113. Boom.

Last edited by mitchboy (July 4, 2013 03:35:03)


Capsicum annuum.
8solarplanets
New to Scratch
100+ posts

Could we please have an exponents block? ( ) ^ ( )

But I wanted a block that you could link to other blocks, not a project.
EDIT: An operator block.

Last edited by 8solarplanets (July 4, 2013 03:36:24)


mitchboy
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

8solarplanets wrote:

But I wanted a block that you could link to other blocks, not a project.
EDIT: An operator block.
You can go see inside, drag the custom block script into your backpack, and boom! You now have a x ^ y block! (Note: requires a variable named Result.)

Capsicum annuum.
8solarplanets
New to Scratch
100+ posts

Could we please have an exponents block? ( ) ^ ( )

…I want it implemented so that EVERY SCRATCH USER can have one, not just the code geeks.

kayybee
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

8solarplanets wrote:

But what if we wanted, for example 84 ^ 59? There's no block for that.
Actually, that's not the problem. You can do set X to 1, and repeat {set X to X*84} 59 times.

The problem is like 84^(pi) or stuff. You can't repeat something pi times.

So we use logs.

But younger scratchers might not know logs, and you can't create custom returning values right now, so this would be good.

But saying PPPPPPPPLLLLLLLLLZZZZZZZ just makes you seem immature, so it's not the greatest idea to put that in your suggestion.
8solarplanets
New to Scratch
100+ posts

Could we please have an exponents block? ( ) ^ ( )

It's like a demand, e.g. I WANT CAKE AND IF I DO NOT GET 49620672093657 SLICES I WILL GO ON STRIKE AND AVOID WORK!!!!!!!!!!!

ProdigyZeta7
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

Calm down, please. What you ask is already suggested before several times. And don't worry, I'm sure at some point they'll add the exponent block.

The workarounds goes like this:
//short version
x ^ y = 10 ^ (y * log x)

//long version
if y = 0
set x = 1
else
tempx = x
repeat (y - 1)
x = x * tempx

Last edited by ProdigyZeta7 (July 4, 2013 05:35:36)




kayybee
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

ProdigyZeta7 wrote:

Calm down, please. What you ask is already suggested before several times. And don't worry, I'm sure at some point they'll add the exponent block.

The workarounds goes like this:
//short version
x ^ y = 10 ^ (y * log x)

//long version
if y = 0
set x = 1
else
tempx = x
repeat (y - 1)
x = x * tempx

your “long version” workaround isn't really the same as te short version.

The short version works for all real numbers, the long one doesn't.
mitchboy
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

kayybee wrote:

The short version works for all real numbers, the long one doesn't.
Actually, 3.14 ^ 3.14 results in 30.959 on my custom block (about seven posts above). Try it. It just doesn't work with negative numbers or fractions. And my project barely involves any heavy scripting or math at all. All you need is:
- three variables
- a repeat block
- a subtraction and a multiplication block
- a set variable block

That's it. It took me like two minutes.

Last edited by mitchboy (July 4, 2013 17:09:55)


Capsicum annuum.
savaka
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

(() ^ () :: operators)

This is necessary because there is no real workaround (AFAIK) that will work for all power calculations in Scratch.
Oh wait there is
(credit to DadOfMrLog) but this workaround is huge and no reason to not just have the block

It also isn't too complicated for young people who may not have learned this math yet because this block already has more complicated math operations:
([sqrt v] of (9))
The block could be positioned right above that block so both blocks with somewhat complex math are together.

Last edited by savaka (Aug. 9, 2016 14:44:58)

drmcw
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

You can use logarithms to do that.
([10^ v] of ((y) * ([log v] of (x))) // =  x^y

Last edited by drmcw (Sept. 11, 2013 12:22:57)


10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
xlk
Scratcher
100+ posts

Could we please have an exponents block? ( ) ^ ( )

yes, but same can be said of the change x/y by and go to blocks… They aren't necessary, but for new scratchers are a great help.

Lilifant7253
Scratcher
1000+ posts

Could we please have an exponents block? ( ) ^ ( )

You can do it like this too:
when gf clicked
set [variable1 v] to (1)
repeat (y)
set [variable1 v] to ((variable1) * (x))

I've reached the 1000+ post rank on wednesday, 11th Sept., 2013 18:29 (German time) / 12:29 (Eastern Standard Time)
Hi! I Iike helping others. So feel free to leave a question at my profile!

Powered by DjangoBB