Question: 1. Write a MatLab program that solves the general cubic equation with real coefficients a, b, and c that are entered by the user. The

1. Write a MatLab program that solves the general cubic equation with real coefficients a, b, and c that are entered by the user. The solutions of a cubic equation can be found by first computing a2-3b 9 If Q3- R2 0, the cubic equation has three real roots. They are found by first computing The three roots are then given by 1 COS Your program must also be able to handle and print out solutions for two special cases 1. If ab 0, the equation becomesc0 with a single root given by -c/3 2. lfc 0, the equation becom es z(z2 + az + b)-0 with three roots given by a2 -4b 2 In addition to printing out the roots of the equation, your program must check that the roots found are correct by having your program substitute each root back into the expression +ax2+ba+c, and show that the result is nearly zero (there could be tiny round-off errors in the evaluation, so the result may not be exactly zero) Test your program using the following cubic equations: You should also upload the final MatLab program to http://d2l.arizona.edu
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
