Subversion Repositories programming

Rev

Rev 63 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
63 irasnyd 1
;Written by: Ira Snyder
2
;Date:       01-13-2005
3
;Project #:  Hw 02
4
 
5
;define a function to calculate the result of the infix expression
6
; -b + sqrt( -b^2 - 4*a*c )
7
 
8
(defun QUAD-MINUS (A B C)
9
  (/ 
10
    (+ (- B) (sqrt (- (* B B) (* 4 A C))))
11
    (* 2 A)
12
  )
13
)
14
 
15
;define a function to calculate the result if the infix expression
16
; -b - sqrt( -b^2 - 4*a*c )
17
 
18
(defun QUAD-PLUS (A B C)
19
  (/ 
20
    (- (- B) (sqrt (- (* B B) (* 4 A C))))
21
    (* 2 A)
22
  )
23
)
24
 
25
;define a function that evaluates to a list containing both
26
;roots provided by the quadratic function
27
 
28
(defun QUAD2 (A B C)
29
  (list (QUAD-MINUS A B C) (QUAD-PLUS A B C))
30
)
31