emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/calc/calc-alg.el


From: Jay Belanger
Subject: [Emacs-diffs] Changes to emacs/lisp/calc/calc-alg.el
Date: Mon, 14 Nov 2005 15:12:56 -0500

Index: emacs/lisp/calc/calc-alg.el
diff -c emacs/lisp/calc/calc-alg.el:1.16 emacs/lisp/calc/calc-alg.el:1.17
*** emacs/lisp/calc/calc-alg.el:1.16    Fri Oct 28 03:52:38 2005
--- emacs/lisp/calc/calc-alg.el Mon Nov 14 20:12:56 2005
***************
*** 92,121 ****
                              (and n (list (prefix-numeric-value n)))))))
  
  ;;; Write out powers (a*b*...)^n as a*b*...*a*b*...
! (defun calcFunc-writeoutpower (expr)
!   (math-normalize (math-map-tree 'math-write-out-power expr)))
  
! (defun math-write-out-power (expr)
    (if (eq (car-safe expr) '^)
!       (let ((a (nth 1 expr))
!             (n (nth 2 expr))
!             (prod (nth 1 expr))
!             (i 1))
!         (if (and (integerp n)
!                  (> n 0))
!             (progn
!               (while (< i n)
!                 (setq prod (math-mul prod a))
!                 (setq i (1+ i)))
!               prod)
!           expr))
      expr))
  
! (defun calc-writeoutpower ()
    (interactive)
    (calc-slow-wrapper
!    (calc-enter-result 1 "expp"
!                     (calcFunc-writeoutpower (calc-top-n 1)))))
  
  (defun calc-collect (&optional var)
    (interactive "sCollect terms involving: ")
--- 92,130 ----
                              (and n (list (prefix-numeric-value n)))))))
  
  ;;; Write out powers (a*b*...)^n as a*b*...*a*b*...
! (defun calcFunc-powerexpand (expr)
!   (math-normalize (math-map-tree 'math-powerexpand expr)))
  
! (defun math-powerexpand (expr)
    (if (eq (car-safe expr) '^)
!       (let ((n (nth 2 expr)))
!         (cond ((and (integerp n)
!                     (> n 0))
!                (let ((i 1)
!                      (a (nth 1 expr))
!                      (prod (nth 1 expr)))
!                  (while (< i n)
!                    (setq prod (math-mul prod a))
!                    (setq i (1+ i)))
!                  prod))
!               ((and (integerp n)
!                     (< n 0))
!                (let ((i -1)
!                      (a (math-pow (nth 1 expr) -1))
!                      (prod (math-pow (nth 1 expr) -1)))
!                  (while (> i n)
!                    (setq prod (math-mul a prod))
!                    (setq i (1- i)))
!                  prod))
!               (t
!                expr)))
      expr))
  
! (defun calc-powerexpand ()
    (interactive)
    (calc-slow-wrapper
!    (calc-enter-result 1 "pexp"
!                     (calcFunc-powerexpand (calc-top-n 1)))))
  
  (defun calc-collect (&optional var)
    (interactive "sCollect terms involving: ")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]