All pastes #1744868 Raw Edit

Inf III Blatt 9 Aufgabe 2e rev 1

public text v1 · immutable
#1744868 ·published 2010-01-10 02:00 UTC
rendered paste body
(define li '(A B))

(define (mitternacht_p a b c) (exact->inexact(/ (+ (- 0 b) (sqrt (- (* b b) (* 4 a c)))) (* 2 a))))
(define (mitternacht_n a b c) (exact->inexact(/ (- (- 0 b) (sqrt (- (* b b) (* 4 a c)))) (* 2 a))))
(define (geisterstunde b c) (exact->inexact (- 0 (/ c b))))

(define (quad-gleich a b c)
   (if (and (= a 0) (= b 0) (= c 0))
      (begin (display "Alles Null oder was.")(newline))
   )
   (if (> c 0)
      (begin (display "Es gibt keine Nullstellen")(newline))
   )
   (if (and (<= c 0) (not (= a 0)))
      (begin
         (display "Die Nullstellen sind ")(newline)
         (display "x = ")
         (display (mitternacht_p a b c))(newline)
         (display "und")(newline)
         (display "x = ")
         (display (mitternacht_n a b c))(newline)
      )
   )
   (if (and (<= c 0) (= a 0) (not (= b 0)))
      (begin
         (display "Die Nullstelle ist")
         (display "x = ")
         (display (geisterstunde b c))(newline)
      )
   )
   (if (and (<= c 0) (= a 0) (= b 0))
      (begin
         (display "c = 0, also ")
         (display c)
         (display " = 0 ")
         (display "geht nicht.")(newline)
      )
   )
)

(quad-gleich 0 64 -4)