changeset 66023:06892c426dff

(calc-integral): With an argument, compute the definite integral.
author Jay Belanger <jay.p.belanger@gmail.com>
date Tue, 11 Oct 2005 19:41:48 +0000
parents 4d2d767965d3
children 3134f8c4aa7b
files lisp/calc/calcalg2.el
diffstat 1 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calc/calcalg2.el	Tue Oct 11 15:30:31 2005 +0000
+++ b/lisp/calc/calcalg2.el	Tue Oct 11 19:41:48 2005 +0000
@@ -52,19 +52,21 @@
        (setq expr (list func expr var)))
      (calc-enter-result n "derv" expr))))
 
-(defun calc-integral (var)
-  (interactive "sIntegration variable: ")
-  (calc-slow-wrapper
-   (if (or (equal var "") (equal var "$"))
-       (calc-enter-result 2 "intg" (list 'calcFunc-integ
-					 (calc-top-n 2)
-					 (calc-top-n 1)))
-     (let ((var (math-read-expr var)))
-       (if (eq (car-safe var) 'error)
-	   (error "Bad format in expression: %s" (nth 1 var)))
-       (calc-enter-result 1 "intg" (list 'calcFunc-integ
-					 (calc-top-n 1)
-					 var))))))
+(defun calc-integral (var &optional arg)
+  (interactive "sIntegration variable: \nP")
+  (if arg
+      (calc-tabular-command 'calcFunc-integ "Integration" "intg" nil var nil nil)
+    (calc-slow-wrapper
+     (if (or (equal var "") (equal var "$"))
+         (calc-enter-result 2 "intg" (list 'calcFunc-integ
+                                           (calc-top-n 2)
+                                           (calc-top-n 1)))
+       (let ((var (math-read-expr var)))
+         (if (eq (car-safe var) 'error)
+             (error "Bad format in expression: %s" (nth 1 var)))
+         (calc-enter-result 1 "intg" (list 'calcFunc-integ
+                                           (calc-top-n 1)
+                                           var)))))))
 
 (defun calc-num-integral (&optional varname lowname highname)
   (interactive "sIntegration variable: ")