Updated testsuite with an expected GCL error in to_poly_share
[maxima.git] / src / tlimit.lisp
blobd332e42aeca0b62dbc04ff8439fcbc50be51253e
1 ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*- ;;;;
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ;;; The data in this file contains enhancements. ;;;;;
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 ($taylor exp var (ridofab val) $lhospitallim))))
42 (or ex (return (cond ((eq *i* t)
43 (limit1 exp var val))
44 ((eq *i* 'think)
45 (if (member (caar exp) '(mtimes mexpt) :test #'eq)
46 (limit1 exp var val)
47 (simplimit exp var val)))
49 (simplimit exp var val)))))
50 (return
51 (let ((taylored t))
52 (declare (special taylored))
53 (limit (simplify ($ratdisrep ex)) var val 'think)))))