Adding src/tools (created during build) and gp_image_01.png (created by the share...
[maxima.git] / src / tlimit.lisp
blobb4646c8ae0673c4b592418dff9140cf631e64f08
1 ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*- ;;;;
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ;;; The data in this file contains enhancments. ;;;;;
4 ;;; ;;;;;
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11 (in-package :maxima)
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*)
38 (prog (ex)
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)
44 (limit1 exp var val))
45 ((eq *i* 'think)
46 (if (member (caar exp) '(mtimes mexpt) :test #'eq)
47 (limit1 exp var val)
48 (simplimit exp var val)))
50 (simplimit exp var val)))))
51 (return
52 (let ((taylored t))
53 (declare (special taylored))
54 (limit (simplify ($ratdisrep ex)) var val 'think)))))