Problem 834. Solve Quadratic : No * - or key functions permitted
Solve the quadratic equation ax^2+bx+c=0. However, some of the normal functions and symbols are not allowed.
x=[ -b +/- sqrt ( b^2 - 4ac ) ] / ( 2a )
Unallowed functions and symbols:
roots mtimes cross prod cumprod times mldivide mrdivide dot numstr int2str dec2bin * / \ - ^ '
Derivative of Aurelien's Cody 813 Multiply 2 numbers
Also related to Cody 833 Side of a Triangle
Test suite "disallowed function usage check" courtesy of Aurelien Queffurust.
Example :
Input
a= 1; b= 1; c=1
Output
x(1)= -0.5+0.866i; x(2)= -0.5-0.866i
Solution Stats
Problem Comments
-
1 Comment
Just as a heads up, your final answer should be in a row vector, and not a column vector.
Solution Comments
Show commentsProblem Recent Solvers34
Suggested Problems
-
Get the area codes from a list of phone numbers
1053 Solvers
-
Construct a string from letters and counts
142 Solvers
-
Back to basics 21 - Matrix replicating
1531 Solvers
-
Getting the row and column location from a matrix
286 Solvers
-
MATCH THE STRINGS (2 CHAR) very easy
286 Solvers
More from this Author308
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!