Integration of functions with two args using integral property
Subject: Integration of functions with two args using integral property
From: Billinghurst, David (RTATECH)
Date: Sun, 28 Dec 2008 10:47:32 +1100
I have been looking at Deiter Kaiser's recent integral property code in
sin.lisp.
The initial version only integrates functions with two args wrt the
second argument.
At least three functions in sin.lisp are modified. I understand the
changes to
integrallookups, but not those in intform or diffdiv.
The patch below extends integrallookups to work for integration wrt
argument 1.
It can be combined with the arg2 case below it, but I wanted to develop
a few
tests first. Any objections if I apply it as is? It works and doesn't
break
the testsuite.
I have coded up the integrals of the Jacobi elliptic functions as test
cases,
and just need to get the last bugs out.
$ diff -u sin.lisp.~1.38.~ sin.lisp
--- sin.lisp.~1.38.~ Wed Dec 24 14:40:16 2008
+++ sin.lisp Sun Dec 28 10:31:09 2008
@@ -550,8 +550,6 @@
;; algorithm. This can be generalized to a lookup algorithm for
any
;; special function. The integral is put on the property list.
;; In a first step we support functions with one and two
arguments.
- ;; In the case of two arguments we do an integration only wrt
the
- ;; second argument.
((and (not (atom (car exp)))
(setq form (get (caar exp) 'integral)))
@@ -562,13 +560,27 @@
(format t "~&INTEGRALLOOKUPS: Found integral with 1
argument.~%"))
($substitute (cadr exp) (caar form) (cadr form)))
+ ((and (= (length (car form)) 2)
+ (cadr form)
+ (freevar (caddr exp)))
+ ;; integral on the property list with two arguments.
+ ;; integrate wrt argument 1.
+ (when *debug-integrate*
+ (format t "~&INTEGRALLOOKUPS: Found integral with 1st of 2
arguments.~%"))
+ (let ((arg1 (cadr exp))
+ (arg2 (caddr exp)))
+ ($substitute
+ arg2
+ (cadar form)
+ ($substitute arg1 (caar form) (cadr form)))))
+
((and (= (length (car form)) 2)
+ (caddr form)
(freevar (cadr exp)))
;; Found an integral on the property list with two
arguments.
- ;; We allow integration only wrt the 2. argument. This has
to
- ;; be generalized.
+ ;; Integrate wrt argument 2.
(when *debug-integrate*
- (format t "~&INTEGRALLOOKUPS: Found integral with 2
arguments.~%"))
+ (format t "~&INTEGRALLOOKUPS: Found integral with 2nd of 2
arguments.~%"))
(let ((arg1 (cadr exp))
(arg2 (caddr exp)))
($substitute
This email is confidential and may also be privileged. If you are not the intended recipient, please notify us immediately and delete this message from your system without first printing or copying it. Any personal data in this email (including any attachments) must be handled in accordance with the Rio Tinto Group Data Protection Policy and all applicable data protection laws.