Created
January 29, 2013 20:11
-
-
Save krv/4667329 to your computer and use it in GitHub Desktop.
Wortels van vierkantsvergelijkingen oplossen, yay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (discriminant a b c) | |
(- (expt b 2) (* 4 a c))) | |
(define (wortel a b c) | |
(if (> (discriminant a b c) 0) | |
(list (/ (- (- b) (sqrt (discriminant a b c))) (* 2 a)) (/ (+ (- b) (sqrt (discriminant a b c))) (* 2 a))) | |
(if (= (discriminant a b c) 0) | |
(/ (- (- b)) (* 2 a)) | |
"Imagine a solution"))) | |
(define (vierkantsvgl a b c) | |
(wortel a b c)) | |
(vierkantsvgl 1 1 1) | |
(vierkantsvgl 1 2 1) | |
(vierkantsvgl 1 5 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment