X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=math.lisp;fp=math.lisp;h=9772b7a52df849bfee3b40b4eebb4f5a6162c541;hb=d78955696cc7e6fa8c50a880085c019f506c8bd9;hp=0000000000000000000000000000000000000000;hpb=93b0a41567a808a95f8fc07bd7c76cedc5fbfa40;p=kmrcl.git diff --git a/math.lisp b/math.lisp new file mode 100644 index 0000000..9772b7a --- /dev/null +++ b/math.lisp @@ -0,0 +1,31 @@ +;;;; -*- 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)