Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## maxima-bugs

 [Maxima-bugs] [ maxima-Bugs-1285104 ] trigsimp and trigreduce & square roots From: SourceForge.net - 2006-08-13 01:07:12 ```Bugs item #1285104, was opened at 2005-09-08 10:53 Message generated for change (Comment added) made by robert_dodier 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: Lisp Core - Trigonometry 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: Robert Dodier (robert_dodier) Date: 2006-08-12 19:07 Message: Logged In: YES user_id=501686 Observed in 5.9.3cvs. ---------------------------------------------------------------------- Comment By: Raymond Toy (rtoy) Date: 2005-10-05 07: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 03: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 ```
 [Maxima-bugs] [ maxima-Bugs-1285104 ] trigsimp and trigreduce & square roots From: SourceForge.net - 2006-11-10 15:34:38 ```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: Lisp Core - Trigonometry Group: None Status: Open Resolution: None Priority: 5 Private: No 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: 2006-11-10 10:34 Message: Logged In: YES user_id=28849 What radcan returns seems to depend on the order of the variables. radcan(sqrt(c^2*cos(b)^2+c^2*sin(b)^2)) -> sqrt(sin(b)^2+cos(b)^2)*abs(c) radcan(sqrt(a^2*cos(b)^2+a^2*sin(b)^2)) -> a*sqrt(sin(b)^2+cos(b)^2) This seems to be true for any variables ordered in this way. FR1 returns different things in these two cases. For the first, FR1 factors c^2*cos(b)^2+c^2*sin(b)^2 to (sin(b)^2+cos(b)^2)*c^2. In the second, it's not factored out. Don't know why. ---------------------------------------------------------------------- Comment By: Robert Dodier (robert_dodier) Date: 2006-08-12 21:07 Message: Logged In: YES user_id=501686 Observed in 5.9.3cvs. ---------------------------------------------------------------------- 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 ```
 [Maxima-bugs] [ maxima-Bugs-1285104 ] trigsimp and trigreduce & square roots From: SourceForge.net - 2011-02-10 22:35:50 ```Bugs item #1285104, was opened at 2005-09-08 18:53 Message generated for change (Comment added) made by crategus 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: Lisp Core - Trigonometry Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No 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: Dieter Kaiser (crategus) Date: 2011-02-10 23:35 Message: Fixed in trigred.lisp revision 1.11. The original example works now as expected. Closing this bug report as fixed. Dieter Kaiser ---------------------------------------------------------------------- Comment By: Raymond Toy (rtoy) Date: 2006-11-10 16:34 Message: Logged In: YES user_id=28849 What radcan returns seems to depend on the order of the variables. radcan(sqrt(c^2*cos(b)^2+c^2*sin(b)^2)) -> sqrt(sin(b)^2+cos(b)^2)*abs(c) radcan(sqrt(a^2*cos(b)^2+a^2*sin(b)^2)) -> a*sqrt(sin(b)^2+cos(b)^2) This seems to be true for any variables ordered in this way. FR1 returns different things in these two cases. For the first, FR1 factors c^2*cos(b)^2+c^2*sin(b)^2 to (sin(b)^2+cos(b)^2)*c^2. In the second, it's not factored out. Don't know why. ---------------------------------------------------------------------- Comment By: Robert Dodier (robert_dodier) Date: 2006-08-13 03:07 Message: Logged In: YES user_id=501686 Observed in 5.9.3cvs. ---------------------------------------------------------------------- Comment By: Raymond Toy (rtoy) Date: 2005-10-05 15: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 11: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 ```