When I enter the following:
(define (root a b c)
(/ (+ (-b) (sqrt (- (exp b 2) (* 4 a c)))) (* 2 a)))
and then enter:
(root 3 6 2)
I get a message indicating that the procedure had two arguments but only requires exactly one. What am I doing wrong?
The
expfunction doesn’t do exponents really, it does something else mathy. (I don’t know.)What you want is usually called
powfor “power” but probably isn’t defined in your environment, so I suggest you just define your ownsquaremethod:And then:
Edit: Oh, you’ll also have to change a couple spacing issues, like
(* 4 a c)instead of(*4 a c), and(- b)instead of(-b). You always have to separate the operator from the operands with spaces.