exam2.2.3

344阅读 0评论2011-12-05 maunix
分类:LINUX

  1. ;; mht created on Nov 9, 2011

  2. ;; equation1 : number -> boolean
  3. ;; to determine whether x is a solution for x^2+2*x+1=0
  4. (define (equation1 x)
  5.   (= (+ (* x x) (* 2 x) 1) 0))

  6. ; test
  7. (equation1 1)

  8. ;; equation2 : number -> boolean
  9. ;; to determine whether x is a solution for 4n+1=62
  10. (define (equation2 x)
  11.   (= (+ (* 4 x) 1) 62))

  12. (equation2 14)

  13. ;; equation3 : number -> boolean
  14. ;; to determine whether x is a solution for 2*n^2=102
  15. (define (equation3 x)
  16.   (= (* 2 (* x x)) 102))
  17. (equation3 14)

  18. ;; equation4 : number -> boolean
  19. ;; to determine whether x is a solution for 4*n^2+6n+2=462
  20. (define (equation4 x)
  21.   (= (+ (* 4 (* x x)) (* 6 x) 2) 462))
  22. (equation4 10)
上一篇:exam2.2.2
下一篇:exam2.2.4