Computer Laboratory 1 CSCI 1913: Introduction to Algorithms, Data Structures, and Program Development September 12-13, 2017 0. Introduction. It’s possible to solve an equation numerically, by substituting numbers for its variables It’s also possible to solve an equation symbolically, by using algebra. For example, to solve the equation m ×x+b y symbolically for x, you’d first subtract b from both sides, giving m × z = y-b. Then you’d divide both sides by m, giving z (y-b) / m. You may assume that no variable is equal to zero. In this laboratory exercise, you’ll write a Python program that uses algebra to solve simple equations symbolically. Your program will use Python tuples to represent equations, and Python strings to represent variables. To simplify the problem, the equations will use only the binary arithmetic operators 4, , ‘x’, andゾ. Also, your program need only solve for a variable that appears exactly once in an equation. 1. Theory Here’s a mathematical description of how your program must work. First, L → R means that an equation L is algebraically transformed into a new equation R. For example: Second, a variable is said to be inside an expression if it appears in that expression at least once. For example, the variable x is inside the expression m × x + b, but it isn’t inside the expression u – v. Each variable is considered to be inside itself, so that x is inside x Now suppose that Ao B = C is an equation, where A, B, and C are expressions, and suppose that the variable a is inside o is one of the four binary arithmetic operators. Also either A or B. Then the following rules show how this equation can be solved for x A = C-B B if z is inside A is inside B /1 + B = C → C-A if A-B-C^[A-C+B if z is inside A B-A-C A C / B B = C / A A=C× B if z is inside B if is inside A if x is inside B ifx is inside A A/B=C→ B=A/C ifxīs inside B For example, I can use the rules to solve the equation m × z + b = y for z. In Rule 1, A is m × x, and B is b. Since is inside A, I can transform the equation to m × = y-b Then in Rule 3, A is m, and B is z. Since r is inside B, I can transform the equation to x -(y -b)/m. Now x is alone on the left side of the equal sign, so the equation is solved This solution used only two rules, but a more complex equation might use more rules, and it might use rules more than once.