Rev 100 | Blame | Compare with Previous | Last modification | View Log | RSS feed
;Written by: Ira Snyder
;Date: 01-13-2005
;Project #: Hw 02
;License: Public Domain
;define a function to calculate the result of the infix expression
; -b + sqrt( -b^2 - 4*a*c )
(defun QUAD-MINUS (A B C)
(/
(+ (- B) (sqrt (- (* B B) (* 4 A C))))
(* 2 A)
)
)
;define a function to calculate the result if the infix expression
; -b - sqrt( -b^2 - 4*a*c )
(defun QUAD-PLUS (A B C)
(/
(- (- B) (sqrt (- (* B B) (* 4 A C))))
(* 2 A)
)
)
;define a function that evaluates to a list containing both
;roots provided by the quadratic function
(defun QUAD2 (A B C)
(list (QUAD-MINUS A B C) (QUAD-PLUS A B C))
)