Question
Write a LISP program to solve a quadratic equation ax2 + bx + c = 0
having real coefficients a, b, c.
Answer :
Word Count : 347
______ ______ _________ _______ _______.
___ ______ __________ ____ ____ _______ ____ ___ ____ ____ __________ _________.
______ _______ _______ ______ ____ _____ __________ ____ ______ ________ ________.
________ ___ _____ _______ ___ ______ _______ ________.
_________ ______ _____ __________ _____ _____ ______ _________.
__________ ___ __________ ________ ___ __________ ______.
_______ __________ ____ _______ _____ ____.
__________ ______ ____ ____ _____ _________ ________ _______ ______.
________ _____ _____ _______ ____ _______ _______ _______ _______.
__________ _____ ___ _______ ________ ____ ______ ____ _______ ______.
__________ ______ ___ ______ ____ _____ ________ ______ _____ _______.
_____ ___ _________ _________ _______ _________ __________ ________.
_______ ___ ______ ___ _____.
_____ ________ ____ _______ __________ __________ ________ ____ _____ ___.
_________ ___ _________ _____ ____ ____ ____ _____ _________.
___ _______ ______ _____ __________ _______ __________ ________.
________ _________ ____ __________ __________ ________ _________ ________ ____.
_______ ________ _________ _______ ______ ________ ____ _______ ___ ____ ___.
______ _______ _____ __________ _____ _______ _________ _____ ________.
_____ ___ _______ ______ __________.
______ ________ _________ _________ ___ ______ ____ _________ ___ __________ ______.
_______ ____ __________ _______ __________ _______ _______ ___ _______ ____ ________ _____.
___ __________ ______ ____ ____ _______ ____ _____.
__________ __________ ____ ___ ______ _________ ________ _________.
_________ _______ ______ ______ ____ _________.
_______ ____ ____ _________ _______ ______ ___ _______ ________ _____.
________ __________ ____ _____ ________ ___ ________ _______ ________ _______.
_____ __________ ______ _________ ______ _________ _________ __________.
__________ ___ ________ __________ __________ _____ ________ ___ ___.
________ _____ _______ _____ ______ __________ ______ ______ _____ ______ ________.
________ _______.
Skip in 10
? (defun quadratic-roots (a b c)
"Returns the roots of a quadratic equation aX^2 + bX + c = 0"
(let ((discriminant (- (* b b) (* 4 a c))))
(values (/ (+ (- b) (sqrt discriminant)) (* 2 a))
(/ (- (- b) (sqrt discriminant)) (* 2 a)))))
QUADRATIC-ROOTS
? (quadratic-roots 1 2 4)
#c(-1.0 1.7320508075688772)
#c(-1.0 -1.7320508075688772)
? (quadratic-roots 2 -16 36)
#c(4.0 1.4142135623730951)
#c(4.0 -1.4142135623730951)
? (quadratic-roots 1 4 4)
-2
-2
? (quadratic-roots 1 -14 49)
7
7
?
___ ______ __________ ____ ____ _______ ____ ___ ____ ____ __________ _________.
______ _______ _______ ______ ____ _____ __________ ____ ______ ________ ________.
________ ___ _____ _______ ___ ______ _______ ________.
_________ ______ _____ __________ _____ _____ ______ _________.
__________ ___ __________ ________ ___ __________ ______.
_______ __________ ____ _______ _____ ____.
__________ ______ ____ ____ _____ _________ ________ _______ ______.
________ _____ _____ _______ ____ _______ _______ _______ _______.
__________ _____ ___ _______ ________ ____ ______ ____ _______ ______.
__________ ______ ___ ______ ____ _____ ________ ______ _____ _______.
_____ ___ _________ _________ _______ _________ __________ ________.
_______ ___ ______ ___ _____.
_____ ________ ____ _______ __________ __________ ________ ____ _____ ___.
_________ ___ _________ _____ ____ ____ ____ _____ _________.
___ _______ ______ _____ __________ _______ __________ ________.
________ _________ ____ __________ __________ ________ _________ ________ ____.
_______ ________ _________ _______ ______ ________ ____ _______ ___ ____ ___.
______ _______ _____ __________ _____ _______ _________ _____ ________.
_____ ___ _______ ______ __________.
______ ________ _________ _________ ___ ______ ____ _________ ___ __________ ______.
_______ ____ __________ _______ __________ _______ _______ ___ _______ ____ ________ _____.
___ __________ ______ ____ ____ _______ ____ _____.
__________ __________ ____ ___ ______ _________ ________ _________.
_________ _______ ______ ______ ____ _________.
_______ ____ ____ _________ _______ ______ ___ _______ ________ _____.
________ __________ ____ _____ ________ ___ ________ _______ ________ _______.
_____ __________ ______ _________ ______ _________ _________ __________.
__________ ___ ________ __________ __________ _____ ________ ___ ___.
________ _____ _______ _____ ______ __________ ______ ______ _____ ______ ________.
________ _______.
IGNOU ACADEMY
Your IGNOU journey, made easier.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
Continue Reading — It's Free
Sign in with Google to unlock more of this answer.
✓ Free access
✓ Unlock up to 60% of the answer
✓ No payment required
✓ Unlock up to 60% of the answer
✓ No payment required
Quick Google sign-in. No separate registration form.