;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION ;;;; ;;;; Name: math.lisp ;;;; Purpose: General purpose math functions ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Nov 2002 ;;;; ;;;; $Id: math.lisp,v 1.1 2002/11/08 06:43:34 kevin Exp $ ;;;; ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; ;;;; KMRCL users are granted the rights to distribute and use this software ;;;; as governed by the terms of the Lisp Lesser GNU Public License ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* (in-package :kmrcl) (declaim (optimize (speed 3) (safety 1) (compilation-speed 0) (debug 3))) (defun deriv (f dx) #'(lambda (x) (/ (- (funcall f (+ x dx)) (funcall f x)) dx))) (defun sin^ (x) (funcall (deriv #'sin 1d-8) x)) ;;; (sin^ pi)