## maxima-commits

 [Maxima-commits] CVS: maxima/share/contrib solve_rat_ineq.mac, 1.8, 1.9 From: Volker van Nek - 2010-01-24 12:27:49 ```Update of /cvsroot/maxima/maxima/share/contrib In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14356 Modified Files: solve_rat_ineq.mac Log Message: freeof %i isn't sufficient for being real; algsys bug 2786017 Index: solve_rat_ineq.mac =================================================================== RCS file: /cvsroot/maxima/maxima/share/contrib/solve_rat_ineq.mac,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- solve_rat_ineq.mac 2 Nov 2009 19:28:17 -0000 1.8 +++ solve_rat_ineq.mac 24 Jan 2010 12:24:25 -0000 1.9 @@ -13,7 +13,7 @@ more examples see below - Copyright(C) 2008 - 2009 Volker van Nek + Copyright(C) 2008 - 2010 Volker van Nek This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, @@ -35,21 +35,24 @@ if atom(ineq) or not member(op:op(ineq), ["<","<=",">",">="]) then error("solve_rat_ineq: ",ineq," is not an inequality."), -/* ineq is real:*/ - if not freeof(%i,'infinity,ineq) then +/* simplify:*/ + ineq: fullratsimp(ineq), + +/* check if ineq is real:*/ + if not freeof(%i, 'infinity, fullratsimp(map('rectform,ineq))) then error("solve_rat_ineq: Inequality is not real: ",ineq), /* variable:*/ vars: listofvars(ineq), if length(vars)=0 then ( - if is(map('fullratsimp,ineq)) then return('all) + if is(ineq) then return('all) else return([]) ), if length(vars)>1 then error("solve_rat_ineq: Inequality is not univariate: ",ineq), var: vars[1], /* numerators and denominators:*/ - [left,right]: map('fullratsimp,args(ineq)), + [left,right]: args(ineq), [lden,rden]: map('denom,[left,right]), [lnum,rnum]: map('num,[left,right]), if not every('lambda([p],polynomialp(p,[var])),[lnum,rnum,lden,rden]) then @@ -58,6 +61,9 @@ /* solutions:*/ sol: map('rhs, flatten(apply('algsys,[[expand(lnum*rden=rnum*lden)],[var]]))), + /* clean out erroneous complex solutions: + (due to bug 2786017 in algsys using realonly:true) */ + sol: sublist(sol, 'lambda([x], is(equal(imagpart(x),0)))), /* singularities:*/ [lsing,rsing]: map( ```