/[emacs]/emacs/lisp/calc/calc-alg.el
ViewVC logotype

Diff of /emacs/lisp/calc/calc-alg.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by jpb, Thu Jul 14 19:31:12 2005 UTC revision 1.16 by jpb, Fri Oct 28 03:52:38 2005 UTC
# Line 91  Line 91 
91                                      (calc-top-n 1))                                      (calc-top-n 1))
92                                (and n (list (prefix-numeric-value n)))))))                                (and n (list (prefix-numeric-value n)))))))
93    
94    ;;; Write out powers (a*b*...)^n as a*b*...*a*b*...
95    (defun calcFunc-writeoutpower (expr)
96      (math-normalize (math-map-tree 'math-write-out-power expr)))
97    
98    (defun math-write-out-power (expr)
99      (if (eq (car-safe expr) '^)
100          (let ((a (nth 1 expr))
101                (n (nth 2 expr))
102                (prod (nth 1 expr))
103                (i 1))
104            (if (and (integerp n)
105                     (> n 0))
106                (progn
107                  (while (< i n)
108                    (setq prod (math-mul prod a))
109                    (setq i (1+ i)))
110                  prod)
111              expr))
112        expr))
113    
114    (defun calc-writeoutpower ()
115      (interactive)
116      (calc-slow-wrapper
117       (calc-enter-result 1 "expp"
118                          (calcFunc-writeoutpower (calc-top-n 1)))))
119    
120  (defun calc-collect (&optional var)  (defun calc-collect (&optional var)
121    (interactive "sCollect terms involving: ")    (interactive "sCollect terms involving: ")
122    (calc-slow-wrapper    (calc-slow-wrapper

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26