Algebra
Algebra
(i) 2𝑥 + 1 = 0 (ii) 5𝑥 − 3 = 2
6. Write a program that gets an input of linear equation from the user and solve the equation then prints the
solution.
7. Write a user defined function that takes degree and equation as input and solve the equation and returns
the solution. Call the user defined function into a main program that prints the solution.
8. Write a user defined function that gets an expression as input from the user and returns that expression to
the main program. Let your main program gets an integer as user input and evaluate the expression for the
integer. Execute the program and evaluate the following expressions.
(i) 𝑓(𝑥) = 𝑥 2 + 3𝑥 + 2 (ii) 𝑓(𝑥) = 𝑥 2 + 2𝑥 + 1 (iii) 𝑓(𝑥) = 𝑥 2 − 4𝑥 + 5 (iv) 𝑓(𝑥, 𝑦) = (𝑥 − 3)2 +
(𝑦 − 5)2 (v) 𝑓(𝑥) = 𝑥 3 − 2𝑥 2 + 5𝑥 − 4 (vi) 𝑓(𝑥) = 𝑥 3 + 3𝑥 2 + 4𝑥 + 2 (vii) 𝑓(𝑥, 𝑦, 𝑧) = 𝑥 + 2𝑦 + 3𝑧