ScratchData LogoScratchData
Back to MasterOfArithmetic's profile

Shunting-Yard Algorithm 3

MAMasterOfArithmetic•Created January 25, 2015
Shunting-Yard Algorithm 3
25
15
471 views
View on Scratch

Instructions

Enter a math problem! This is much better than the previous version. It now has full support for negative numbers, and can multiply by putting a number before a parenthesis. You could enter something like 9(2*-3). Inside, it also has a debug log that keeps track of everything as the algorithm converts it, if you wanted to see the process of it converting your problem. And, it has error detection now, so instead of freezing up the project, it tells you the error. If you put 3*(4+3)) it would say "mismatched parenthesis."

Description

UPDATE- It now does modulus and has argument separators. mod(5,3) would be the same as ((5) mod (3)) with Scratch blocks. You can also put math operations in the arguments. mod(2+3,3) is the same as mod(5,3) UPDATE-Now you can enter constants pi and e. Make sure you still use the multiplication symbol (*) when multiplying! This uses the Shunting-Yard algorithm to convert an infix notation problem (like 4+3) to postfix notation. 4 + 3 would become 4 3 + For more information about the shunting yard algorithm, go to http://en.wikipedia.org/wiki/shunting-yard_algorithm For info on postfix notation, go to http://en.wikipedia.org/wiki/Reverse_Polish_notation

Project Details

Project ID44845436
CreatedJanuary 25, 2015
Last ModifiedMay 3, 2015
SharedFebruary 8, 2015
Visibilityvisible
CommentsAllowed