1 ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*- ;;;;
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ;;; The data in this file contains enhancments. ;;;;;
5 ;;; Copyright (c) 1984,1987 by William Schelter,University of Texas ;;;;;
6 ;;; All rights reserved ;;;;;
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; (c) Copyright 1980 Massachusetts Institute of Technology ;;;
9 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13 (macsyma-module tlimit
)
15 (load-macsyma-macros rzmac
)
17 ;; TOP LEVEL FUNCTION(S): $TLIMIT $TLDEFINT
19 (defmfun $tlimit
(&rest args
)
20 (let ((limit-using-taylor t
))
21 (declare (special limit-using-taylor
))
22 (apply #'$limit args
)))
24 (defmfun $tldefint
(exp var ll ul
)
25 (let ((limit-using-taylor t
))
26 (declare (special limit-using-taylor
))
27 ($ldefint exp var ll ul
)))
29 (defun tlimp (expr) ; TO BE EXPANDED TO BE SMARTER (MAYBE)
30 (declare (ignore expr
))
33 ;; compute limit of exp by finding its taylor series expansion.
34 ;; asks for $lhospitallim terms of taylor series.
35 ;; this is an arbitrary limit: with default value $lhospitallim = 4,
36 ;; tlimit(2^n/n^5, n, inf) => 0
37 (defun taylim (exp var val
*i
*)
39 (setq ex
(catch 'taylor-catch
40 (let ((silent-taylor-flag t
))
41 (declare (special silent-taylor-flag
))
42 ($taylor exp var
(ridofab val
) $lhospitallim
))))
43 (or ex
(return (cond ((eq *i
* t
)
46 (if (member (caar exp
) '(mtimes mexpt
) :test
#'eq
)
48 (simplimit exp var val
)))
50 (simplimit exp var val
)))))
53 (declare (special taylored
))
54 (limit (simplify ($ratdisrep ex
)) var val
'think
)))))