Discuss Scratch

ProdigyZeta7
Scratcher
1000+ posts

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

ErnieParke wrote:

([10 ^ v] of ((power) * ([log v] of (base))))
And to prove this works:

10 ^ (b log a) = x >Setting up the equation
log 10 ^ (b log a) = log x >Property of logarithms
(b log a) log 10 = log x >Bringing the exponent down
b log a = log x >log 10 = 1
log (a ^ b) = log x >Bringing the exponent back to the base
a ^ b = x >Getting rid of log



Firedrake969
Scratcher
1000+ posts

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

-5^2.

I support… the workaround doesn't perfectly work.

log base X of a negative number is undefined. (unless in some rare cases the base is negative, but that doesn't happen in Scratch)

Last edited by Firedrake969 (Nov. 17, 2013 20:53:34)


'17 rickoid

bf97b44a7fbd33db070f6ade2b7dc549
1234abcdcba4321
Scratcher
1000+ posts

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

Well, you could always do

if <(base) > [0]> then
([10 ^ v] of ((power) * ([log v] of (base))))
else
((0) - ([10^ v] of ((power) * ([log v] of ([abs v] of (base))))))
end

I'd highly appreciate it if you were to follow me. Don't forget to go to my profile.
All of my programming suggestions <— You should really get the suggestions move back to the suggestions forum!
Five hundred posts! I never expected to get up there… In only 2-3 months.
Does anyone know what a signature is? I mean, I've already seen 6-7 people get confused.
Firedrake969
Scratcher
1000+ posts

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

Bumping because of a duplicate I found.

The workaround doesn't allow for negative numbers. ^ does.

'17 rickoid

bf97b44a7fbd33db070f6ade2b7dc549
seanbobe
Scratcher
500+ posts

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

savaka wrote:

I understand all these work, but wouldn't a block be way easier for new Scratchers? I have no idea what logarithms are.
correct
you dont teach logarithms in 5th grade!


Sadly my kumquat was eaten by an evil signature.
_______________
|My internets.…..|
\Kumquat Shield/
Firedrake969
Scratcher
1000+ posts

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

Some of us did

But yeah, for some odd reason, kids are taught exponents way before logs, but logs and exponents are analogous to multiplication and division.

'17 rickoid

bf97b44a7fbd33db070f6ade2b7dc549
mitchboy
Scratcher
1000+ posts

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

scratchisthebest wrote:

Even better than that huge script: this block!
you call that huge? that's a rather simple script.

Firedrake969 wrote:

Bumping because of a duplicate I found.

The workaround doesn't allow for negative numbers. ^ does.
yes it does. all you have to do is add this:
if <(x) < [0]> then
set [result v] to ((1) / (result))
end

and tell me one other reason to add this other than for making a calculator. sorry, but i think this is very low on the st's priorities.

Last edited by mitchboy (Nov. 20, 2013 00:12:56)


Capsicum annuum.
mathfreak231
Scratcher
1000+ posts

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

DadOfMrLog wrote:

define result = (x) ^ (y)
if <(y) = [0]> then
set [result v] to [1] // yes, we also include 0^0=1 :O
Last time I checked, 0^0 was undefined.

i have grown as a person. and ive grown, literally. none of my posts from before 2022 represent me accurately.
DadOfMrLog
Scratcher
1000+ posts

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

mathfreak231 wrote:

Last time I checked, 0^0 was undefined.
Technically, it's an "indeterminate form", yes.

However, for practical computation it's typically given the value one - and doing that also helps along several useful mathematical theorems…

(EDIT: actually, wikipedia gives a really decent overview of the 0^0 question, including treatment on computers.)

Firedrake969 wrote:

The workaround doesn't allow for negative numbers. ^ does.
See my (supposedly really long) script for a slightly more thorough treatment of negative numbers.

However, note that a^b with both a & b negative (and b not an integer) is certainly not for the faint-hearted - I'd be really interested to know how the proponents of the a^b block would see it behaving under such situations…

Last edited by DadOfMrLog (Nov. 20, 2013 02:26:36)



Alternate account: TheLogFather –– HowTos and useful custom blocks (see studio). Examples below…


- String manipulation - - - X to power of Y - - - Clone point to clone - Detect New Scratcher - Speed tests studio -

jh1234l
Scratcher
100+ posts

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

Poemon1_REMIX wrote:

SuperNicky wrote:

power what do you mean power?
like 5^2 = 25, or 2^3 = 8.

(^ is power)

Basically, if you have 5^5, it is 5x5x5x5x5. If you have 5^4, it is 5x5x5x5, and so on.
Basically, is the number multiplying by itself that many times.

Two Advertising and sharing groups:
Scratch Cat's Hideout: Home Page / Advertise! / Members / Write A Review / Read A Review / FAQs
Scratching fame:

jh1234l
Scratcher
100+ posts

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

A () ^ () block is not necessary right now, as you could just use the workaround and add a script to check if it is zero.
However, it is certainly nice to have.

Two Advertising and sharing groups:
Scratch Cat's Hideout: Home Page / Advertise! / Members / Write A Review / Read A Review / FAQs
Scratching fame:

1234abcdcba4321
Scratcher
1000+ posts

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

And, wouldn't the workaround work, if you just put an abs() around the base value?

I'd highly appreciate it if you were to follow me. Don't forget to go to my profile.
All of my programming suggestions <— You should really get the suggestions move back to the suggestions forum!
Five hundred posts! I never expected to get up there… In only 2-3 months.
Does anyone know what a signature is? I mean, I've already seen 6-7 people get confused.
ErnieParke
Scratcher
1000+ posts

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

1234abcdcba4321 wrote:

And, wouldn't the workaround work, if you just put an abs() around the base value?
No, it wouldn't work because let's take the example:

2^3

It equals 8. Meanwhile:

(-2)^3

It equals -8. Then you get into the problem of fractional powers, and I haven't been able to figure that out.

Pointing out,

ErnieParke

goldfish678
Scratcher
1000+ posts

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

I think the scratch team might have said they're not going to add it and there's a workaround.
Photoguy77
Scratcher
100+ posts

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

I certainly support this!

-Photoguy77

“Without enjoying, one will never truly learn” ~Flome

“Finding happiness starts in you” ~ProdigyZeta7

savaka
Scratcher
1000+ 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
Scratch is made to be for kids to learn how to program. It's not for professionals. I don't know how to use trigonometry to move a sprite.
supero
Scratcher
11 posts

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

Or this too!



((x) * ((x) * ((x) * (.....))))

Just keep repeating it as many powers as you need it to.

Last edited by supero (Dec. 23, 2013 00:58:44)


"I always finish projects last in school; not because I had no ideas, but because I had too many." -Me.
savaka
Scratcher
1000+ posts

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

This makes me think, they should add this:
(() √ ()) // category=operators

Last edited by savaka (Dec. 26, 2013 23:17:03)

frodewin
Scratcher
500+ posts

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

Support for a new ((x) ^ (y)) block.
1. it is simpler than other solutions
2. it is faster than other solutions
3. at least in the form ((x) ^ (2)) it will be used a lot
4. young scratchers (below 10) might not know what ^is, but the same holds for log, sin, cos, mod, … - at least the code of others becomes easier to read


((x) ^ (y))
(but in green)

Last edited by frodewin (Dec. 23, 2013 18:06:47)




You can also find my best projects here or stop at my profile and say hi!
mariobros406
Scratcher
500+ posts

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

You mean like
(() ^ ()) // category=operators
Anyway…

savaka wrote:

This makes me think, they should add this:
(() √ ()) // category=operators
That block kinda already exists:
([sqrt v] of ())
Also, that block would make you input the answer. It would be a boolean block, not a reporter block.

Last edited by mariobros406 (Dec. 23, 2013 21:02:41)


I only check in to Scratch from time to time to see what others have been up to. I don't really post anything anymore. I'll occasionally post a question in the AT forum if I can't find an answer anywhere else.

Powered by DjangoBB