From: SourceForge.net <no...@so...> - 2005-10-05 13:41:54
|
Bugs item #1285104, was opened at 2005-09-08 12:53 Message generated for change (Comment added) made by rtoy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=1285104&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Barton Willis (willisbl) Assigned to: Nobody/Anonymous (nobody) Summary: trigsimp and trigreduce & square roots Initial Comment: Sometimes trigsimp and trigreduce seem to make assumptions of the sign of variables. Consider: (%i1) sqrt(r^2 * cos(x)^2 + r^2 * sin(x)^2); (%o1) sqrt(r^2*sin(x)^2+r^2*cos(x)^2) (%i2) trigsimp(%o1); (%o2) r <--- should be |r| (%i3) trigreduce(%o1); (%o3) r <--- should be |r| (%i4) trigreduce(sqrt(r^2)); (%o4) abs(r) <---- OK here (%i5) trigsimp(sqrt(r^2)); (%o5) abs(r) <--- OK here too And oh my! Using z instead of r makes the problem go away. (%i9) sqrt(z^2 * cos(x)^2 + z^2 * sin(x)^2); (%o9) sqrt(sin(x)^2*z^2+cos(x)^2*z^2) (%i10) trigsimp(%); (%o10) abs(z) <--- OK here as well! (%i6) build_info(); Maxima version: 5.9.1.1cvs Maxima build date: 14:5 8/30/2005 host type: i686-pc-mingw32 lisp-implementation-type: GNU Common Lisp (GCL) lisp-implementation-version: GCL 2.6.7 Barton ---------------------------------------------------------------------- >Comment By: Raymond Toy (rtoy) Date: 2005-10-05 09:41 Message: Logged In: YES user_id=28849 Neat. It appears to be a bug in radcan. radcan(sqrt(r^2*cos(x)^2+r^2*sin(x)^2)) returns just r*stuff, but with r replaced with z, it returns abs(z)*stuff. Tracing radcan and friends, I see that fr1 returns something different for the r version. I don't know why. ---------------------------------------------------------------------- Comment By: Barton Willis (willisbl) Date: 2005-09-10 05:35 Message: Logged In: YES user_id=895922 A possible fix: (defun sp1expt (b e) (cond ((mexptp b) (power b e)) ;;(sp1expt (cadr b) (m* e (caddr b)))) <--- (sp1expt x^2 1/2) --> x The old code calls sp1expt after it does (a^b)^c --> a^(bc). I'm not sure if that second call to sp1expt ever makes a difference. Barton ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=1285104&group_id=4933 |