I've been given this equation, and I'm asked to create a program where the solutions for
a*(x^2) + b*x +c = 0
are given like this:
1) if D > 0, 2 solutions are:
x1 = (-b -sqrt(D))/2a and x2= (-b+ sqrt(D))/2a
2)if D = 0 , 1 'double' solution':
x1 = -b/2a
3)if D < 0, no true solution
where D the linear discriminant = b^2 - 4*a*
I have absolutely no idea in what to try, the only thing i did was try to define D:
`D <- b^2 - 4*a*c`
But i get an error
Error: object 'b' not found
.
Any help would be greatly appreciated.