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
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
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
Offline
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.
Offline