Discuss Scratch

5values30
Scratcher
9 posts

Solve Block

The solve block would look like this.
solve
Here's a example of it being used.
whenclickedsetEquationtoround12+25x10/3askEquationandwaitifanswer=solveEquationthensayCorrectelsesayIncorrect
A-MARIO-PLAYER
Scratcher
1000+ posts

Solve Block

What will the block even do?
BigNate469
Scratcher
1000+ posts

Solve Block

A-MARIO-PLAYER wrote:

What will the block even do?
Solve math equations.
ThisIsTemp1
Scratcher
1000+ posts

Solve Block

A-MARIO-PLAYER wrote:

What will the block even do?

Solve equations like

9x=0

ninja'd

Last edited by ThisIsTemp1 (Sept. 2, 2024 17:18:13)

5values30
Scratcher
9 posts

Solve Block

Basically just solve any equation in text form with addition subtraction multiplication and division also parentheses in pemdas order(really just pmdas) also idk why I put a round block in it lol.
5values30
Scratcher
9 posts

Solve Block

It probably wouldn't solve for x or do algebra.
BringUpYourPost
Scratcher
500+ posts

Solve Block

couldn't you just solve the equation yourself,


whenclickedsetEquationto12+25x10/3askEquationandwaitifanswer=286/3thensayCorrectelsesayIncorrect
5values30
Scratcher
9 posts

Solve Block

Well there's this project I'm working on and it involves randomly generated equations so that wouldn't really work.
Za-Chary
Scratcher
1000+ posts

Solve Block

I'm going to be really picky here, but that's what happens when a mathematician sees a mathematical suggestion.

12+25x10/3 is not an equation (there is no equals sign); it is an expression. As such, there is nothing that one can solve for — this is just something that you simplify or evaluate or compute. There are a few formatting quirks that could be fixed about your suggestion, and the wording is one of them; I'd suggest that the block be called:

compute

Then you can do things like

compute12+25x10/3

so that it can compute an expression without necessarily having a variable in its input.
ScratchCat1038
Scratcher
1000+ posts

Solve Block

I don't think this is very practical because how often would you have some code that outputs an equation? The only use I can think of is this:
askWhat's your equation?andwaitsayjoinThe answer is solveanswer
TheCreatorOfUnTV
Scratcher
1000+ posts

Solve Block

ScratchCat1038 wrote:

I don't think this is very practical because how often would you have some code that outputs an equation? The only use I can think of is this:
askWhat's your equation?andwaitsayjoinThe answer is solveanswer
Well, I CAN think of a use for it. For example, this:
definemapfunctionoverthelistforeachiinlengthoflistreplaceitemioflistwithsolvejoinitemioflistfunctionmap*3overthelistmap+1overthelistsaylist
would multiply all elements in the list “list” by 3 and add 1 to the items, then say all items in the list.
Or this:
definecombinethelistbyfunctionrepeatuntillengthoflist=1replaceitem1oflistwithsolvejoinitem1oflistjoinfunctionitem2oflistdelete2oflistsetresulttoitem1oflistcombinethelistby+sayresult
which adds all the items in the list “list” together, then says the result.

However, just basic math is barely useful for most programs, which would be better suited with string manipulation - that is, letter () of (), length () and join () () - as well as control structures - that is, if <> then {}, repeat () {} and repeat until <> {}. However, both do not seem to be offered by this suggestion - and if the block were to have control structures, then it would just be text-based coding, or the language would also have to support lambda functions, which are beyond the scope of Scratch. Snap! has this feature in the form of a grey ring, though, so you may want to look into it.

To the original poster - use someone else's calculator (with credit) if you want to make it easier, and just add random equations.

Last edited by TheCreatorOfUnTV (Sept. 8, 2024 00:30:46)

BigNate469
Scratcher
1000+ posts

Solve Block

Homo-sec-shoe-whale wrote:

I don't support. Isn't this what the equation blocks are for? Is the difference that you just type a whole equation and it solves it? Like, if the input is 5-2 it outputs as 3? Why can't you do this?
5-2

5values30 wrote:

Here's a example of it being used.
whenclickedsetEquationtoround12+25x10/3askEquationandwaitifanswer=solveEquationthensayCorrectelsesayIncorrect
I think there's an error here. Assuming the variable in the round block is a mistake, if you told it to round “12+25x10/3”, it would answer with “95” and then it would ask “95”.

Why would rounding anything that is a string return anything other than (well in most programming languages it would throw a type error but in Scratch it returns a 0)?

That aside, it would ask the equation itself (it asks “12+25x10/3”), and checks if the answer is equal to x in the equation 12 + 25 * 10 / 3 = x

Last edited by BigNate469 (Sept. 8, 2024 00:52:09)

MillionOfficial
Scratcher
500+ posts

Solve Block

5values30 wrote:

Well there's this project I'm working on and it involves randomly generated equations so that wouldn't really work.
Solution
definegeneratetworandomnumberssetrandom number 1topickrandom1to999999setrandom number 2topickrandom1to999999whenyouwanttherandomquestionssetrandom operatortopickrandom1to4ifrandomoperator=1thengeneratetworandomnumberssetsolve equationtorandomnumber1+randomnumber2setequationtojoinrandomnumber1join+randomnumber2elseifrandomoperator=2thengeneratetworandomnumberssetsolve equationtorandomnumber1-randomnumber2setequationtojoinrandomnumber1join-randomnumber2elseifrandomoperator=3thengeneratetworandomnumberssetsolve equationtorandomnumber1*randomnumber2setequationtojoinrandomnumber1joinxrandomnumber2elsegeneratetworandomnumberssetsolve equationtorandomnumber1/randomnumber2setequationtojoinrandomnumber1join/randomnumber2askequationandwaitifanswer=solveequationthencorrectanswercodeelsewronganswercode
————————————————————————————————

TheCreatorOfUnTV wrote:

Well, I CAN think of a use for it. For example, this:
snip
Another use: Make prodigy.

Last edited by MillionOfficial (Sept. 8, 2024 03:07:17)

BringUpYourPost
Scratcher
500+ posts

Solve Block

MillionOfficial wrote:

5values30 wrote:

Well there's this project I'm working on and it involves randomly generated equations so that wouldn't really work.
Solution
definegeneratetworandomnumberssetrandom number 1topickrandom1to999999setrandom number 2topickrandom1to999999whenyouwanttherandomquestionssetrandom operatortopickrandom1to4ifrandomoperator=1thengeneratetworandomnumberssetsolve equationtorandomnumber1+randomnumber2setequationtojoinrandomnumber1join+randomnumber2elseifrandomoperator=2thengeneratetworandomnumberssetsolve equationtorandomnumber1-randomnumber2setequationtojoinrandomnumber1join-randomnumber2elseifrandomoperator=3thengeneratetworandomnumberssetsolve equationtorandomnumber1*randomnumber2setequationtojoinrandomnumber1joinxrandomnumber2elsegeneratetworandomnumberssetsolve equationtorandomnumber1/randomnumber2setequationtojoinrandomnumber1join/randomnumber2askequationandwaitifanswer=solveequationthencorrectanswercodeelsewronganswercode
No, because what about 2x(3+7/(2-9/(2x5)) this NOT oen of your equations.
gem1001
Scratcher
100+ posts

Solve Block

What order of operation will it use?
BODMAS?
Or Left to Right?
Or Right to Left?
Or will you be able to choose, perhaps like this?
evaluate5 * 3 + 2³withBODMAS

Last edited by gem1001 (Sept. 8, 2024 10:02:53)

5values30
Scratcher
9 posts

Solve Block

gem1001 wrote:

What order of operation will it use?
BODMAS?
Or Left to Right?
Or Right to Left?
Or will you be able to choose, perhaps like this?
evaluate5 * 3 + 2³withBODMAS
PEMDAS Probally, Well Really PMDAS
Paddle2See
Scratch Team
1000+ posts

Solve Block

It looks like this is a duplicate topic of this one over here so I'll close it to keep the conversation all in one place.

Please use the existing topic in the link above.

Powered by DjangoBB