ScratchData LogoScratchData
Back to popswilson's profile

Power of 2 Calculator

POpopswilson•Created November 7, 2015
Power of 2 Calculator
13
10
421 views
View on Scratch

Instructions

Set an exponent in the slider. Click on the green flag. Scratch will then tell you the computation. Note: This project does not use the[ Repeat (exponent)] block but if you 'See inside, the script without the green flag top hat connected uses the repeat block..

Description

Those of us older folks that learned to program in languages like Pascal, Basic, Logo, etc. are used to a Library of tools to do the arithmetic. But Scratch does not have the equivalent of 2^x so I had to find a work-around using the tools Scratch does provide. I am working on a random walker project that need to be able to compute 2^x so I wrote this project. I will probably convert it to a Make a Block. Here's the arithmetic used to build the block. y = 2^x, y =xlog(2). That's the (exponent *log2) section of the block. Next the inverse 10^ block is used to extend the block to (10^( (exponent *log(2))). But this gives a decimal close to the exact result so the block is finished with a round( ) block. I'm sure the Repeat (exponent) is a common way to compute 2^x but I think this method is closer to the spirit of the (sqrt ( )) block with the drop-down menu.

Project Details

Project ID86877882
CreatedNovember 7, 2015
Last ModifiedDecember 25, 2021
SharedNovember 7, 2015
Visibilityvisible
CommentsAllowed