## maxima-bugs

 [Maxima-bugs] [ maxima-Bugs-2786017 ] realonly in algsys.lisp From: SourceForge.net - 2009-05-03 10:25:18 ```Bugs item #2786017, was opened at 2009-05-03 14:25 Message generated for change (Tracker Item Submitted) made by beshenov You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2786017&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: Alexey Beshenov (beshenov) Assigned to: Nobody/Anonymous (nobody) Summary: realonly in algsys.lisp Initial Comment: The option variable realonly is quite confusing since it does not find real solutions, but only solutions which are free of %i (purely using freeof). For example, when realonly is false, algsys ([x^4 + 1], [x]); returns [[x = (-1)^(1/4)], [x = -(-1)^(1/4)*%i], [x = -(-1)^(1/4)], [x = (-1)^(1/4)*%i]] But when realonly is true, it returns [[x = (-1)^(1/4)], [x = -(-1)^(1/4)]] while it is natural to expect []. Maybe it is better to modify the behavior and filter roots by checking something like is_real(x) := is(trigsimp(imagpart(x)) = 0); and not just freeof(%i, x) With the freeof approach we may also omit real roots of irreducible polynomials: sol : map ('rhs, solve (3*x^3 - 3*x + 1)); [(sqrt(3)*%i/2-1/2)/(3*(3^-(3/2)*%i/2-1/6)^(1/3)) +(3^-(3/2)*%i/2-1/6)^(1/3)*(-sqrt(3)*%i/2-1/2), (3^-(3/2)*%i/2-1/6)^(1/3)*(sqrt(3)*%i/2-1/2) +(-sqrt(3)*%i/2-1/2)/(3*(3^-(3/2)*%i/2-1/6)^(1/3)), (3^-(3/2)*%i/2-1/6)^(1/3)+1/(3*(3^-(3/2)*%i/2-1/6)^(1/3))] map (lambda([x], freeof(%i, x)), sol); [false,false,false] map ('is_real, sol); [true,true,true] So when realonly and algexact are set to true, algsys ([3*x^3 - 3*x + 1], [x]) just returns []. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2786017&group_id=4933 ```
 [Maxima-bugs] [ maxima-Bugs-2786017 ] realonly in algsys.lisp From: SourceForge.net - 2010-01-23 09:58:20 ```Bugs item #2786017, was opened at 2009-05-03 12:25 Message generated for change (Comment added) made by van_nek You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2786017&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: Alexey Beshenov (beshenov) Assigned to: Nobody/Anonymous (nobody) Summary: realonly in algsys.lisp Initial Comment: The option variable realonly is quite confusing since it does not find real solutions, but only solutions which are free of %i (purely using freeof). For example, when realonly is false, algsys ([x^4 + 1], [x]); returns [[x = (-1)^(1/4)], [x = -(-1)^(1/4)*%i], [x = -(-1)^(1/4)], [x = (-1)^(1/4)*%i]] But when realonly is true, it returns [[x = (-1)^(1/4)], [x = -(-1)^(1/4)]] while it is natural to expect []. Maybe it is better to modify the behavior and filter roots by checking something like is_real(x) := is(trigsimp(imagpart(x)) = 0); and not just freeof(%i, x) With the freeof approach we may also omit real roots of irreducible polynomials: sol : map ('rhs, solve (3*x^3 - 3*x + 1)); [(sqrt(3)*%i/2-1/2)/(3*(3^-(3/2)*%i/2-1/6)^(1/3)) +(3^-(3/2)*%i/2-1/6)^(1/3)*(-sqrt(3)*%i/2-1/2), (3^-(3/2)*%i/2-1/6)^(1/3)*(sqrt(3)*%i/2-1/2) +(-sqrt(3)*%i/2-1/2)/(3*(3^-(3/2)*%i/2-1/6)^(1/3)), (3^-(3/2)*%i/2-1/6)^(1/3)+1/(3*(3^-(3/2)*%i/2-1/6)^(1/3))] map (lambda([x], freeof(%i, x)), sol); [false,false,false] map ('is_real, sol); [true,true,true] So when realonly and algexact are set to true, algsys ([3*x^3 - 3*x + 1], [x]) just returns []. ---------------------------------------------------------------------- >Comment By: Volker van Nek (van_nek) Date: 2010-01-23 10:58 Message: Hi Alexey, yesterday I noticed this problem too and found your bug report. I think you are right, freeof(%i, x) is not a sufficient test to recognize non-zero imaginary parts. E.g. (-1)^(1/4) passes. So I wonder why you did not fix that problem. You suggested the right thing. It is one line in src/algsys.lisp to change: 348-352: (defun realonly (rootsl) (cond ((null rootsl) nil) ;; ((freeof '\$%i (car rootsl)) ;; problem ((equal 0 (sratsimp (\$imagpart (car rootsl)))) ;; fix ? (nconc (list (car rootsl)) (realonly (cdr rootsl)))) (t (realonly (cdr rootsl))))) This change passes the test suite. So I would commit this new line. Or do I overlook something? Why did you hesitate to commit? Volker van Nek ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2786017&group_id=4933 ```
 [Maxima-bugs] [ maxima-Bugs-2786017 ] realonly in algsys.lisp From: SourceForge.net - 2010-03-27 12:11:59 ```Bugs item #2786017, was opened at 2009-05-03 12:25 Message generated for change (Comment added) made by van_nek You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2786017&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: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Alexey Beshenov (beshenov) Assigned to: Nobody/Anonymous (nobody) Summary: realonly in algsys.lisp Initial Comment: The option variable realonly is quite confusing since it does not find real solutions, but only solutions which are free of %i (purely using freeof). For example, when realonly is false, algsys ([x^4 + 1], [x]); returns [[x = (-1)^(1/4)], [x = -(-1)^(1/4)*%i], [x = -(-1)^(1/4)], [x = (-1)^(1/4)*%i]] But when realonly is true, it returns [[x = (-1)^(1/4)], [x = -(-1)^(1/4)]] while it is natural to expect []. Maybe it is better to modify the behavior and filter roots by checking something like is_real(x) := is(trigsimp(imagpart(x)) = 0); and not just freeof(%i, x) With the freeof approach we may also omit real roots of irreducible polynomials: sol : map ('rhs, solve (3*x^3 - 3*x + 1)); [(sqrt(3)*%i/2-1/2)/(3*(3^-(3/2)*%i/2-1/6)^(1/3)) +(3^-(3/2)*%i/2-1/6)^(1/3)*(-sqrt(3)*%i/2-1/2), (3^-(3/2)*%i/2-1/6)^(1/3)*(sqrt(3)*%i/2-1/2) +(-sqrt(3)*%i/2-1/2)/(3*(3^-(3/2)*%i/2-1/6)^(1/3)), (3^-(3/2)*%i/2-1/6)^(1/3)+1/(3*(3^-(3/2)*%i/2-1/6)^(1/3))] map (lambda([x], freeof(%i, x)), sol); [false,false,false] map ('is_real, sol); [true,true,true] So when realonly and algexact are set to true, algsys ([3*x^3 - 3*x + 1], [x]) just returns []. ---------------------------------------------------------------------- >Comment By: Volker van Nek (van_nek) Date: 2010-03-27 13:11 Message: my recent cvs commit closes this report Volker van Nek ---------------------------------------------------------------------- Comment By: Volker van Nek (van_nek) Date: 2010-01-23 10:58 Message: Hi Alexey, yesterday I noticed this problem too and found your bug report. I think you are right, freeof(%i, x) is not a sufficient test to recognize non-zero imaginary parts. E.g. (-1)^(1/4) passes. So I wonder why you did not fix that problem. You suggested the right thing. It is one line in src/algsys.lisp to change: 348-352: (defun realonly (rootsl) (cond ((null rootsl) nil) ;; ((freeof '\$%i (car rootsl)) ;; problem ((equal 0 (sratsimp (\$imagpart (car rootsl)))) ;; fix ? (nconc (list (car rootsl)) (realonly (cdr rootsl)))) (t (realonly (cdr rootsl))))) This change passes the test suite. So I would commit this new line. Or do I overlook something? Why did you hesitate to commit? Volker van Nek ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2786017&group_id=4933 ```