Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Exponents on Scratch
- PawnMate314
-
38 posts
Exponents on Scratch
Hello!
I’m making a project that provides custom blocks that perform math operations not included with Scratch. So far, I have found methods of making factorials, nPr and nCr, and hyperbolic functions (sinh cosh and tanh). I would now like to find a rigorous method of performing exponents. I’m well aware that you can replace integer exponents with repeated multiplication (e.g. 2^3 = 2*2*2) and that negative exponents are the reciprocal of the the positive exponent (e.g. 2^-3 = 1/2^3), but I do not know a substitution for any real exponent using only Scratch blocks. Does anyone know a solution?
Thank you for answering my question. Have a great day!
I’m making a project that provides custom blocks that perform math operations not included with Scratch. So far, I have found methods of making factorials, nPr and nCr, and hyperbolic functions (sinh cosh and tanh). I would now like to find a rigorous method of performing exponents. I’m well aware that you can replace integer exponents with repeated multiplication (e.g. 2^3 = 2*2*2) and that negative exponents are the reciprocal of the the positive exponent (e.g. 2^-3 = 1/2^3), but I do not know a substitution for any real exponent using only Scratch blocks. Does anyone know a solution?
Thank you for answering my question. Have a great day!
- indium13
-
4 posts
Exponents on Scratch
For x^y try
It's not the most efficient but it's the only way I can think of.
It's not the most efficient but it's the only way I can think of.
Last edited by indium13 (Feb. 15, 2023 00:32:33)
- Spentine
-
1000+ posts
Exponents on Scratch
You can use various exponential identities to create exponents. I already have it memorized though.
Some others you might find helpful:
The thing is, although works for positive real numbers, negatives mess it up. This is because the graph will seep into the c o m p l e x p l a n e.
-1 ^ 1.5
= sqrt(-1 ^ 3)
= sqrt(-1)
= i
This calculates x ^ y.
Some others you might find helpful:
y-th root of x
log y (x)
The thing is, although works for positive real numbers, negatives mess it up. This is because the graph will seep into the c o m p l e x p l a n e.
-1 ^ 1.5
= sqrt(-1 ^ 3)
= sqrt(-1)
= i
Last edited by Spentine (Feb. 15, 2023 01:57:04)
- PawnMate314
-
38 posts
Exponents on Scratch
Wow! Thank you so much! I wasn’t aware of this property of logarithms.
Have a good day!
Have a good day!
- lion334
-
100+ posts
Exponents on Scratch
Woah! Think this might work. Personally I'd have used custom blocks (but in the same way), but this should work the same… For x^y try
It's not the most efficient but it's the only way I can think of.
- Discussion Forums
- » Help with Scripts
-
» Exponents on Scratch