From: SourceForge.net <no...@so...> - 2008-10-21 13:05:15
|
Bugs item #2184396, was opened at 2008-10-21 22:05 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2184396&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: Satoshi Adachi (satoshi_adachi) Assigned to: Nobody/Anonymous (nobody) Summary: Wrong factorization of sqrt() Initial Comment: Dear Developers of Maxima, I found a wrong behavihor of sqrt(). It is a principle that sqrt(X*Y) should not be factorized to sqrt(X)*sqrt(Y) unless X and Y can be judged to be non-negative. I found a case in which this principle is broken. Here is a program for demonstration: ------------------------------------------------------------------------------ /* * wrong_factorization_of_sqrt.maxima: * * S.Adachi 2008/10/01 */ display2d:false; /* real for 1 <= x <= 2 */ correct:sqrt((1-1/x)*(2/x-1)); /* real for 2-sqrt(2) <= x <= 2+sqrt(2) */ INCORRECT:sqrt((1-(2-sqrt(2))/x)*((2+sqrt(2))/x-1)); INCORRECT_AT_2:at(INCORRECT,[x=2]); SHOULD_BE_POSITIVE:float(INCORRECT_AT_2); /* END */ ------------------------------------------------------------------------------ The result of execution is as follows: ------------------------------------------------------------------------------ Maxima 5.14.0cvs http://maxima.sourceforge.net Using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (aka GCL) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) batch(wrong_factorization_of_sqrt.maxima) batching #p/Volumes/HFS+2/home/adachi/work/307/wrong_factorization_of_sqrt.maxima (%i2) display2d : false (%o2) false (%i3) correct:sqrt((1-1/x)*(2/x-1)) (%o3) sqrt((1-1/x)*(2/x-1)) (%i4) INCORRECT:sqrt((1-(2-sqrt(2))/x)*((sqrt(2)+2)/x-1)) (%o4) sqrt((2-sqrt(2))/x-1)*sqrt(1-(sqrt(2)+2)/x) (%i5) INCORRECT_AT_2:at(INCORRECT,[x = 2]) (%o5) sqrt((2-sqrt(2))/2-1)*sqrt(1-(sqrt(2)+2)/2) (%i6) SHOULD_BE_POSITIVE:float(INCORRECT_AT_2) (%o6) -0.70710678118655 (%o7) "wrong_factorization_of_sqrt.maxima" ------------------------------------------------------------------------------ At first, as is seen from (%i2) and (%o2), sqrt(1-1/x)*(2/x-1)) is not factorized to sqrt(...)*sqrt(...) in any automatic way. This is the correct behavihor. Next, as is seen from (%i3) and (%o3), sqrt(1-(2-sqrt(2))/x)*((2+sqrt(2))/x-1)) is factorized to sqrt((2-sqrt(2))/x-1)*sqrt(1-(sqrt(2)+2)/x) in an automatic way. THIS IS AN INCORRECT BEHAVIOR. This expression is non-negative for 2-sqrt(2) <= x <= 2+sqrt(2). However, as is demonstrated by (%i4)-(%o5), the calculated expression takes a negative value at x=2. Please stop the incorrect factorization of sqrt(X*Y) to sqrt(X)*sqrt(Y). Sincerely yours, Satoshi Adachi ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2184396&group_id=4933 |