How about this. Use nroots() to find the number of roots, use hipow() to determine the degree. If the degree is not equal to the
number of roots returned by nroots() then you have a complex factor and so the relationship between abs(x) and signum() does not
hold. That is abs(x) # x*signum(x) for the complex root or rooots. So in that case return a noun form otherwise you can return the
product.
signum(x-r[1])*signum(x-r[2])*signum(x-r[3]).
Does this make sense? Finding the roots of course is usually impossible for the higher degrees but this might fix the degree 3
case.
Rich
----- Original Message -----
From: "Barton Willis" <willisb at unk.edu>
To: "Richard Hennessy" <rvh2007 at comcast.net>
Cc: "Maxima List" <maxima at math.utexas.edu>
Sent: Saturday, December 20, 2008 7:54 AM
Subject: Re: [Maxima] pw.mac version 2.3.1
By the way:
(%i15) ratprint : false$
(%i16) f(x) := 1+signum(x^3-23*x^2-71*x-11)$
(%i17) pwdefint(f(x),x,-5,10), algexact :false;
(%o17) 4.888402276042864
(%i18) pwdefint(f(x),x,-5,10), algexact :true;
(%o18) 0
(%i19) [f(-5), f(-2), f(-1), f(0)];
(%o19) [0,2,2,0]
What's the story? The equation x^3-23*x^2-71*x-11 = 0 has three real roots,
but
the roots expressed in terms of radicals involves %i. So Maxima wrongly
assumes
that these solutions are nonreal.
(%i48) algsys([x^3-23*x^2-71*x-11 = 0],[x]), algexact : true, realonly :
true;
(%o48) []
(%i49) algsys([x^3-23*x^2-71*x-11 = 0],[x]), algexact : false, realonly :
true;
(%o49) [[x=25.77153920619555],[x=-0.16366897755369],[x=-2.607870115575124]]
Possible cures:
(1) return a noun form for signum arguments of degree 3 or more;
(2) locally set algexact to false and be happy with decimal approximations
--this is risky, some real roots might have a tiny, but spurious,
imaginary part;
(3) use nroots to do a better job of detecting the number of roots -- this
might fail
for polynomials with floating point coefficients (you could first
apply rationalize).
For abs_integrate, I took the easy route (1).
Barton