Discuss Scratch

crazy-assassin
Scratcher
1 post

How do you make exponents in Scratch?

I'm trying to program exponents into my Scratch project, but it's not working properly. I tried using the “join” block to evaluate 2^3, which should be 8, but I ended up getting a completely different number. Does anyone know how to program exponents?
drmcw
Scratcher
1000+ posts

How do you make exponents in Scratch?

See here
Am53108
Scratcher
4 posts

How do you make exponents in Scratch?

I know how!!!

I made a block for it


define Exponent (a)^(b)
set to (a)
repeat (b-1)
set to ((a)*(returning value))
end

then use returning value as your response input
Vanilla2011
Scratcher
500+ posts

How do you make exponents in Scratch?

I came here to search for the answer to a decimal exponent, something like 135^0.6309. Can anyone help me?
Tutor-42
Scratcher
100+ posts

How do you make exponents in Scratch?

From the Scratch Wiki (more detail there including exceptions): https://en.scratch-wiki.info/wiki/Solving_Exponents

set [base v] to [135]
set [exponent v] to [0.6309]
set [Result v] to ([10 ^ v] of ((exponent) * ([log v] of ([abs v] of (base)))))
cs345375567
Scratcher
53 posts

How do you make exponents in Scratch?

Am53108 wrote:

I know how!!!

I made a block for it


define Exponent (a)^(b)
set to (a)
repeat (b-1)
set to ((a)*(returning value))
end

then use returning value as your response input
did you mean
define Exponent (a)^(b)
set [returning value v] to (a)
repeat ((b) - (1))
set [returning value v] to ((a)*(returning value))
end
MrNB
New Scratcher
1 post

How do you make exponents in Scratch?

shouldnt there be a dedicated block for this (and squere-, triple-, quadruple- roots) in scratch???
THis really should be added!
deck26
Scratcher
1000+ posts

How do you make exponents in Scratch?

MrNB wrote:

shouldnt there be a dedicated block for this (and squere-, triple-, quadruple- roots) in scratch???
THis really should be added!
Square root is in the drop down list. The others are not generally standard in any language I've used and easy to work around with logs.

(Fourth root is sqrt of sqrt.)

Last edited by deck26 (Jan. 2, 2020 18:40:59)

MineUp1000
Scratcher
50 posts

How do you make exponents in Scratch?

Yes. there is a way.
Right here: https://scratch.mit.edu/projects/384284409/ (THIS WORKS FOR NEGATIVE EXPONENTS TOO!)

Last edited by MineUp1000 (April 10, 2020 07:28:40)

Powered by DjangoBB