Advertisement
Guest User

Untitled

a guest
Oct 4th, 2018
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.73 KB | None | 0 0
  1. (defun left-hand (a b n f)
  2.   (declare (type double-float a b n)
  3.            (ftype (function (double-float) double-float) f)
  4.            (optimize (speed 3) (safety 1)))
  5.   (do* ((dt (/ (- b a) n))
  6.         (time a (+ time dt))
  7.         (suma 0d0 (+ suma (the double-float (funcall f time))))
  8.         (end (- b (/ dt 2))))
  9.        ((> time end) (* dt suma)) (declare (type double-float suma dt))))
  10.  
  11.  
  12. vs
  13.  
  14. (defun left-hand (a b n)
  15.   (declare (type double-float a b n)
  16.            (optimize (speed 3) (safety 1)))
  17.   (do* ((dt (/ (- b a) n))
  18.         (time a (+ time dt))
  19.         (suma 0d0 (+ suma (the double-float (sin time))))
  20.         (end (- b (/ dt 2))))
  21.        ((> time end) (* dt suma)) (declare (type double-float suma dt))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement