From: SourceForge.net <no...@so...> - 2012-06-11 13:12:34
|
Bugs item #3515955, was opened at 2012-04-08 15:08 Message generated for change (Comment added) made by willisbl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3515955&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 Private: No Submitted By: Ted Woollett (woollett) Assigned to: Nobody/Anonymous (nobody) Summary: is (equal (...)) with realpart Initial Comment: with 5.26.0 gcl (windows) (%i1) display2d:false$ (%i2) bex : 1/sqrt(sin(x)); (%o2) 1/sqrt(sin(x)) (%i3) realpart(bex); (%o3) cos(atan2(0,sin(x))/2)/sqrt(abs(sin(x))) (%i4) imagpart(bex); (%o4) -sin(atan2(0,sin(x))/2)/sqrt(abs(sin(x))) (%i5) is (equal (bex, realpart(bex))); (%o5) true <== wrong! (%i6) is (equal (bex, imagpart(bex))); (%o6) false <== correct Here we also show that if a calling program (test) gets the wrong "true" answer from is(equal(...)), and then calls a subprogram (test1), an incorrect evaluation of realpart(expr) is found in test1. This occurs in both 5.26.0gcl and 5.25.1gcl. program: test1(bex) := block([bexr], print (" test1 "), print(" bex = ",bex), bexr : realpart(bex), print(" bexr = ",bexr), bexr)$ test(aex) := block([aexr,ans1,isr], print(" test "), print(" aex = ",aex), aexr : realpart(aex), print(" aexr = ",aexr), isr : is(equal(aex,realpart(aex))), print(" isr = ",isr), ans1 : test1(aex), ans1)$ display2d:false$ demonstration of problem : (%i1) load(test); (%o1) "c:/work2/test.mac" (%i2) test(1/sqrt(sin(x))); test aex = 1/sqrt(sin(x)) aexr = cos(atan2(0,sin(x))/2)/sqrt(abs(sin(x))) isr = t test1 bex = 1/sqrt(sin(x)) bexr = 1/sqrt(sin(x)) (%o2) 1/sqrt(sin(x)) (%i3) realpart(1/sqrt(sin(x))); (%o3) cos(atan2(0,sin(x))/2)/sqrt(abs(sin(x))) (%i4) is(equal(1/sqrt(sin(x)), realpart(1/sqrt(sin(x))))); (%o4) true (%i5) build_info(); Maxima version: 5.26.0 Maxima build date: 22:48 1/15/2012 Host type: i686-pc-mingw32 Lisp implementation type: GNU Common Lisp (GCL) Lisp implementation version: GCL 2.6.8 ---------------------------------------------------------------------- >Comment By: Barton Willis (willisbl) Date: 2012-06-11 06:12 Message: Possible fix: in meqp-by-csign insert (clearsign) just before the first call to $csign. That doesn't fix the bug in sign mentioned in the first posting. ---------------------------------------------------------------------- Comment By: Barton Willis (willisbl) Date: 2012-06-11 03:21 Message: This is due to a bug in sign: (%i24) sign((sqrt(abs(sin(x)))-cos(atan2(0,sin(x))/2)*sqrt(sin(x)))/(sqrt(sin(x))*sqrt(abs(sin(x))))); (%o24) zero But (for example) (%i25) subst(x=4,(sqrt(abs(sin(x)))-cos(atan2(0,sin(x))/2)*sqrt(sin(x)))/(sqrt(sin(x))*sqrt(abs(sin(x))))); (%o25) 1/sqrt(sin(4)) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3515955&group_id=4933 |