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

#1 2008-11-18 22:52:35

Fourex
Scratcher
Registered: 2008-01-30
Posts: 35

"(Blank) to the (Blank) power" block

I think that another block should be added to the numbers section. It it would multiply a number by its self a number of times. It could look something like:

([  ] ^ [  ])  <--that is means to look like a block

For example ([ 2 ] ^ [ 3 ]) would be equal to 8.

This would be pretty simple to implement, and would be useful to quite a few people.

Post your opinion?

Last edited by Fourex (2008-11-18 22:54:51)

Offline

 

#2 2008-11-18 23:07:50

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: "(Blank) to the (Blank) power" block

couldnt you do

<repeat( # power ) >
     <set{ variable   }to(  (( <{ variable   }> <*> 2  ))
<end>


I dont know alot about powers but i think you can do this.

Last edited by keroro645 (2008-11-18 23:08:27)

Offline

 

#3 2008-11-19 01:21:49

Fourex
Scratcher
Registered: 2008-01-30
Posts: 35

Re: "(Blank) to the (Blank) power" block

keroro645 wrote:

couldnt you do

<repeat( # power ) >
     <set{ variable   }to(  (( <{ variable   }> <*> 2  ))
<end>


I dont know alot about powers but i think you can do this.

No thats not how powers work. 5^4 is 5*5*5*5

EDIT: Actually you have a point there. If you replace the 2 with variable than it would work the same way. But you wouldn't be able to put something like that in the middle of an equation. What I want is something like the multiplication or addition blocks. They can be used as numbers.

Last edited by Fourex (2008-11-19 01:24:47)

Offline

 

#4 2008-11-19 05:02:00

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: "(Blank) to the (Blank) power" block

Fourex wrote:

I think that another block should be added to the numbers section. It it would multiply a number by its self a number of times. It could look something like:

([  ] ^ [  ])  <--that is means to look like a block

For example ([ 2 ] ^ [ 3 ]) would be equal to 8.

This would be pretty simple to implement, and would be useful to quite a few people.

Post your opinion?

Yes, I agree that there really should be a Raise to the Power function.  You can work around it though, using the existing blocks by noting that

          x^y = 10^ ( log(x) * y )

and they do give you the 10^ function and the log function in the drop-down functioon block.  So, using your previous example:
 
         2 ^ 3 = 10 ^ ( log(2) * 3) = 8

Fun with exponents and logarithms!

You can see this technique in action in this project here

http://scratch.mit.edu/projects/Paddle2SeeFixIt/292399


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#5 2008-11-19 21:43:59

Fourex
Scratcher
Registered: 2008-01-30
Posts: 35

Re: "(Blank) to the (Blank) power" block

Wow thats cool how you did that! I need to write this down...

Offline

 

#6 2008-11-19 23:20:39

maki
Scratcher
Registered: 2008-01-21
Posts: 100+

Re: "(Blank) to the (Blank) power" block

I tried making a power function last year, and failed miserably, lists might be able to help it, i don't know, but the 10^ could be used as a base (not the mathematical base) for logarithms.


Creepers are exceptionally volatile.

Offline

 

Board footer