I have a question in an example that I am trying to develop in lisp the exercise says:
Modify the function that returns the roots of an equation of the to return the real and imaginary parts of the roots, in the case of they are complex. Suppose the coefficients are real.
I developed this way:
(defun raizes(a b c)
(let (
(raiz1 (/(+ (* -1 b)(sqrt (- (expt b 2)(* 4 a c ))))(* 2 a)))
(raiz2 (/(- (* -1 b)(sqrt (-(expt b 2)(* 4 a c ))))(* 2 a)))
)
(format t "x1=~,2f" raiz1)
(format t ", x2=~,2f~%" raiz2)
)
)
(raizes 1 -3 -4)
(raizes 1 0 -4)
(raizes 6 11 -35)
(raizes 1 -7 0)
(raizes 5 3 5)
But I can not do the part that the exercise asks to return the real and imaginary parts in case it is complex.