9a6862bad3f6168196b2838b69ef8eed1505f092
[kmrcl.git] / math.lisp
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          math.lisp
6 ;;;; Purpose:       General purpose math functions
7 ;;;; Programmer:    Kevin M. Rosenberg
8 ;;;; Date Started:  Nov 2002
9 ;;;;
10 ;;;; $Id: math.lisp,v 1.2 2003/04/28 16:07:42 kevin Exp $
11 ;;;;
12 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
13 ;;;;
14 ;;;; KMRCL users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
16 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
17 ;;;; *************************************************************************
18
19
20 (in-package :kmrcl)
21
22 (defun deriv (f dx)
23   #'(lambda (x)
24       (/ (- (funcall f (+ x dx)) (funcall f x))
25          dx)))
26
27 (defun sin^ (x)
28     (funcall (deriv #'sin 1d-8) x))
29
30 ;;; (sin^ pi)