[Maxima-commits] CVS: maxima/src rpart.lisp,1.33,1.34

 [Maxima-commits] CVS: maxima/src rpart.lisp,1.33,1.34 From: Raymond Toy - 2010-03-31 04:33:48 ```Update of /cvsroot/maxima/maxima/src In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25651 Modified Files: rpart.lisp Log Message: Oops. Fix mistake in sprecip for the case of abs(x)<=abs(y). Index: rpart.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/src/rpart.lisp,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- rpart.lisp 31 Mar 2010 03:39:12 -0000 1.33 +++ rpart.lisp 31 Mar 2010 04:33:39 -0000 1.34 @@ -529,10 +529,13 @@ (y (bigfloat:to y))) ;; 1/(x+%i*y). ;; - ;; Assume abs(x) > abs(y). Then 1/(x+%i*y) = 1/x/(1+%i*r) where - ;; r = y/x. Thus 1/(x+%i*y) = (1-%i*r)/(x*(1+r*r)) + ;; Assume abs(x) > abs(y). Let r = y/x. Then + ;; 1/(x+%i*y) = 1/x/(1+%i*r) + ;; = (1-%i*r)/(x*(1+r*r)) ;; - ;; The case for abs(x) <= abs(y) is similar. + ;; The case for abs(x) <= abs(y) is similar with r = x/y: + ;; 1/(x+%i*y) = 1/y/(r+%i) + ;; = (r-%i)/(y*(1+r^2)) (if (> (bigfloat:abs x) (bigfloat:abs y)) (let* ((r (bigfloat:/ y x)) (dn (bigfloat:* x (bigfloat:+ 1 (bigfloat:* r r))))) @@ -540,8 +543,8 @@ (to (bigfloat:/ (bigfloat:- r) dn)))) (let* ((r (bigfloat:/ x y)) (dn (bigfloat:* y (bigfloat:+ 1 (bigfloat:* r r))))) - (cons (to (bigfloat:/ x dn)) - (to (bigfloat:/ (bigfloat:- x) dn)))))))) + (cons (to (bigfloat:/ r dn)) + (to (bigfloat:/ (bigfloat:- dn))))))))) ```

 [Maxima-commits] CVS: maxima/src rpart.lisp,1.33,1.34 From: Raymond Toy - 2010-03-31 04:33:48 ```Update of /cvsroot/maxima/maxima/src In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25651 Modified Files: rpart.lisp Log Message: Oops. Fix mistake in sprecip for the case of abs(x)<=abs(y). Index: rpart.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/src/rpart.lisp,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- rpart.lisp 31 Mar 2010 03:39:12 -0000 1.33 +++ rpart.lisp 31 Mar 2010 04:33:39 -0000 1.34 @@ -529,10 +529,13 @@ (y (bigfloat:to y))) ;; 1/(x+%i*y). ;; - ;; Assume abs(x) > abs(y). Then 1/(x+%i*y) = 1/x/(1+%i*r) where - ;; r = y/x. Thus 1/(x+%i*y) = (1-%i*r)/(x*(1+r*r)) + ;; Assume abs(x) > abs(y). Let r = y/x. Then + ;; 1/(x+%i*y) = 1/x/(1+%i*r) + ;; = (1-%i*r)/(x*(1+r*r)) ;; - ;; The case for abs(x) <= abs(y) is similar. + ;; The case for abs(x) <= abs(y) is similar with r = x/y: + ;; 1/(x+%i*y) = 1/y/(r+%i) + ;; = (r-%i)/(y*(1+r^2)) (if (> (bigfloat:abs x) (bigfloat:abs y)) (let* ((r (bigfloat:/ y x)) (dn (bigfloat:* x (bigfloat:+ 1 (bigfloat:* r r))))) @@ -540,8 +543,8 @@ (to (bigfloat:/ (bigfloat:- r) dn)))) (let* ((r (bigfloat:/ x y)) (dn (bigfloat:* y (bigfloat:+ 1 (bigfloat:* r r))))) - (cons (to (bigfloat:/ x dn)) - (to (bigfloat:/ (bigfloat:- x) dn)))))))) + (cons (to (bigfloat:/ r dn)) + (to (bigfloat:/ (bigfloat:- dn))))))))) ```