Discuss Scratch

lm1996
Scratcher
1000+ posts

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

Support, I could see the use for this.

Lm / She/her / D&D DM / April 3rd /
portalpower
Scratcher
1000+ posts

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

I could figure out how to make an operator that supports negatives but it would be so long it wouldn't even be worth it

unless this got implemented

([e^ v] of (([ln v] of ()) * ())::operators)//this is the current workaround

Last edited by portalpower (Jan. 7, 2021 21:59:49)


thank you for reading my post and have a nice day!
shift+down to view my signature



















idk what to put here.
the2000
Scratcher
1000+ posts

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

Support, though I don't know why I haven't done it already. Why not have such a basic math function from Scratch?

portalpower
Scratcher
1000+ posts

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

support because the short workaround doesn't support negative or bases less than 1 and the long one is way too long

thank you for reading my post and have a nice day!
shift+down to view my signature



















idk what to put here.
scienceexplorer1
Scratcher
100+ posts

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

scratchisthebest wrote:

by this logic, we can remove “move (10) steps”

why not just use
go to x: ((x position) + ([cos v] of ((direction)*(amt)))) y ((x position) + ([sin v] of ((direction)*(amt))))
i mean jeez so simple
How is that simple???

Be cool
- Chilout -
https://www.youtube.com/watch?v=4uoXbsmEBf4


The future lies ahead of us.

Did you know the universe is immensely filled with vacuum rather then any form of matter inside of it?. Well probably you do …
But here is the thing when andromeda galaxy collides with milky way it is expected that not a single star will collide. Space is space. Matter is in a very very small space.






IndianRuby718
Scratcher
100+ posts

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

scienceexplorer1 wrote:

scratchisthebest wrote:

by this logic, we can remove “move (10) steps”

why not just use
go to x: ((x position) + ([cos v] of ((direction)*(amt)))) y ((x position) + ([sin v] of ((direction)*(amt))))
i mean jeez so simple
How is that simple???
sarcasm :P

Last edited by IndianRuby718 (Jan. 31, 2021 23:06:35)


So… I didn't update my signature for over a year XP But… I left the forums, and I'm not coming back anytime soon
(and I'm not updating my signature)


Both stickied Suggestions Directories currently have 138 replies.
Only fdreerf can break the equilibrium.

________________




Za-chary wrote:

I get more frustrated with people telling me about “mass reporting” than I do about “mass reporting” itself.
source
good luck digging up the original reply in the comments
ctrl+f exists


https://scratch.mit.edu/discuss/post/6961734/


Bug with the color effect I would really like to see fixed






EEEEEEE   DDDDDD    IIIIIIII  TTTTTTTT           NNN    NN     OOOOO
EE DD DD II TT :: NNNN NN OO OO
EEEEEEE DD DD II TT NN NN NN OO OO
EE DD DD II TT :: NN NN NN OO OO
EE DD DD II TT NN NNNN OO OO
EEEEEEE DDDDDD IIIIIIII TT NN NNN OOOOO
Hand-done.

< :: extension>
< :: custom-arg>
< :: motion>



Don't click this link…
ssvbxx2
Scratcher
100+ posts

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

Greg8128 wrote:

Some people say that
([e ^ v] of (([ln v] of (base))*(exponent))
is a workaround but it really isn't because:
1. It often fails to return an integer result when it should: e.g. “3^2” will return “8.99999999998”
2. It is unable to take a negative base to a positive integer exponent because ln(x) is only defined for x > 0



Fully capturing the proper behavior of an exponent block requires the user to make a large block, such as:
([e ^ v] of (([ln v] of ([abs v] of (base)))*(exponent))*(magicexpr))
//magicexpr returns NaN if base is negative and exponent is not whole,
// -1 if base is negative and exponent is odd, and 1 otherwise. You should be able to make this expression from blocks but it will be large
// and I am too lazy to make it right now
This becomes extremely clumsy, especially if you need several exponents in one expression (for example to calculate a polynomial)
You could do:
round ([e ^ v] of (([ln v] of (base))*(exponent))
Here is a project I made to demonstrate: https://scratch.mit.edu/projects/481520931/

Last edited by ssvbxx2 (Feb. 1, 2021 00:06:25)


I'm ssvbxx2. I make a variety of original projects: games, animations, etc.

(Tile Scrolling Project | Square Root Calculator | The Sound of Sorting)

Last edited by kaj (Next year 00:00:00)
dimayajonelcid
Scratcher
100+ posts

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

ssvbxx2 wrote:

You could do
round ([e ^ v] of (([ln v] of (base))*(exponent))
I don't think that would work with non-whole (negative/non-integer) powers. Sure, there could be floating point errors, but what if you wanted to calculate something around the lines of an irrational number? Such as square-root 2?

BCMGF1137/19
Team: H: The Series

I'm going to avoid using Support/No Support in my forum posts from now on, since they are generally pointless

44 Phonemes. Very few usage rules. Self-explanatory. Join Alphabest. Simplify your life.

My browser / operating system: ChromeOS 14541.0.0, Chrome 111.0.0.0, No Flash version detected

Your everyday, generic internet user.

penguinie1567, in reaction to the above sentence fragment, said: “I would do it without the comma.”
if <(inSchool?) = [true]> then
if <(pick random (1) to (1000)) = [1]> then
set [online v] to [true]
else
set [online v] to [false]
end
end
ssvbxx2
Scratcher
100+ posts

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

dimayajonelcid wrote:

ssvbxx2 wrote:

You could do
round ([e ^ v] of (([ln v] of (base))*(exponent))
I don't think that would work with non-whole (negative/non-integer) powers. Sure, there could be floating point errors, but what if you wanted to calculate something around the lines of an irrational number? Such as square-root 2?
Then you would remove the round block. Here is what I did in my exponent project:
if <not <((base) mod (1)) = [0]>> then 
set [exponent v] to ([e ^ v] of (([ln v] of (base))*(exponent)
else
set [exponent v] to (round ([e ^ v] of (([ln v] of (base))*(exponent))
end
This works because
((base) mod (1))
returns a non-zero value for non-integer values of the base.

Last edited by ssvbxx2 (Feb. 1, 2021 00:15:33)


I'm ssvbxx2. I make a variety of original projects: games, animations, etc.

(Tile Scrolling Project | Square Root Calculator | The Sound of Sorting)

Last edited by kaj (Next year 00:00:00)
ssvbxx2
Scratcher
100+ posts

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

bump

I'm ssvbxx2. I make a variety of original projects: games, animations, etc.

(Tile Scrolling Project | Square Root Calculator | The Sound of Sorting)

Last edited by kaj (Next year 00:00:00)
dimayajonelcid
Scratcher
100+ posts

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

ssvbxx2 wrote:

Then you would remove the round block. Here is what I did in my exponent project:
if <not <((base) mod (1)) = [0]>> then 
set [exponent v] to ([e ^ v] of (([ln v] of (base))*(exponent)
else
set [exponent v] to (round ([e ^ v] of (([ln v] of (base))*(exponent))
end
This works because
((base) mod (1))
returns a non-zero value for non-integer values of the base.
Yes, but the exponent could be like 0.5, 2.3, 11.111, or 3.14159. It doesn't really work when the exponent is non-integer but the base is an integer

BCMGF1137/19
Team: H: The Series

I'm going to avoid using Support/No Support in my forum posts from now on, since they are generally pointless

44 Phonemes. Very few usage rules. Self-explanatory. Join Alphabest. Simplify your life.

My browser / operating system: ChromeOS 14541.0.0, Chrome 111.0.0.0, No Flash version detected

Your everyday, generic internet user.

penguinie1567, in reaction to the above sentence fragment, said: “I would do it without the comma.”
if <(inSchool?) = [true]> then
if <(pick random (1) to (1000)) = [1]> then
set [online v] to [true]
else
set [online v] to [false]
end
end
dimayajonelcid
Scratcher
100+ posts

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

Bump after 1 month and 2 weeks of silence. Oof

BCMGF1137/19
Team: H: The Series

I'm going to avoid using Support/No Support in my forum posts from now on, since they are generally pointless

44 Phonemes. Very few usage rules. Self-explanatory. Join Alphabest. Simplify your life.

My browser / operating system: ChromeOS 14541.0.0, Chrome 111.0.0.0, No Flash version detected

Your everyday, generic internet user.

penguinie1567, in reaction to the above sentence fragment, said: “I would do it without the comma.”
if <(inSchool?) = [true]> then
if <(pick random (1) to (1000)) = [1]> then
set [online v] to [true]
else
set [online v] to [false]
end
end
saphiralover
Scratcher
87 posts

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

I support this, though there are workarounds like others said, this will be easier to younger or newer members.
Bacteria999
Scratcher
1000+ posts

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

Support. It has always bothered me that we have such complex math blocks and we don't have an exponent block.
sathvikrias
Scratcher
500+ posts

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

bump

Moving from Scratch? Don't learn C or Java, try Snap!
Futurebot5
Scratcher
1000+ posts

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

Bump

So…hello, ou bonjour, o hola, o ciao, oder hallo.

Prime689
Scratcher
1000+ posts

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

Futurebot5 wrote:

Bump
Duplicate except.

6'2 - they/them - canadian - teen
dimayajonelcid
Scratcher
100+ posts

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

Ok, why is this topic dying
Bump because this is far from the first page

BCMGF1137/19
Team: H: The Series

I'm going to avoid using Support/No Support in my forum posts from now on, since they are generally pointless

44 Phonemes. Very few usage rules. Self-explanatory. Join Alphabest. Simplify your life.

My browser / operating system: ChromeOS 14541.0.0, Chrome 111.0.0.0, No Flash version detected

Your everyday, generic internet user.

penguinie1567, in reaction to the above sentence fragment, said: “I would do it without the comma.”
if <(inSchool?) = [true]> then
if <(pick random (1) to (1000)) = [1]> then
set [online v] to [true]
else
set [online v] to [false]
end
end
Socialix
Scratcher
1000+ posts

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

Bump. I'm bringing back March 29.

socialix - why is there a penguin breaking my window? - signatures are overrated

Powered by DjangoBB