6 map('signum,[-2, -2/3, -3.4b-2, -7.8b-32]);
7 [- 1, - 1, - 1.0b0, - 1.0b0]$
9 map('signum,[0,0.0, 0.0b0]);
12 map('signum,[2, 2/3, 3.4b-2, 7.8b-32]);
15 map('signum, [minf, %pi, %e, %phi, inf]);
26 signum(a) + signum(-a)$
29 signum(a - b) + signum(b-a);
32 signum(rat(a-b)) + signum(rat(b-a));
35 /* expunge negative or positive factors */
46 /* nounform for complex */
48 (declare(z, complex),0);
63 (assume(p > 0, n < 0, pz >= 0, nz <= 0),0);
84 factor(signum(p * x + p));
87 factor(signum(p * x^2 + p));
90 signum(p * x) - signum(x);
93 signum(n * x) + signum(x);
96 signum(%i * sqrt(1 - sqrt(2)));
99 limit(signum(x),x,minf);
102 limit(signum(x),x,0,'minus);
105 limit(signum(x),x,0);
108 limit(signum(x),x,0,'plus);
111 limit(signum(x),x,inf);
114 limit(x * signum(x),x,0);
117 limit(signum(x+a),x,minf);
120 limit(signum(x+a),x,inf);
123 (assume(notequal(a,0)),0);
126 limit(signum(x),x,a);
129 limit(signum(a*x),x,minf);
132 limit(signum(a*x),x,inf);
135 limit(signum(x),x,1/a);
147 rectform(signum(x + %i));
148 x/sqrt(x^2+1)+%i/sqrt(x^2+1)$
150 rectform(signum(42 + %i*x));
151 %i*x/sqrt(x^2+1764)+42/sqrt(x^2+1764)$
153 rectform(signum(x+%i*y));
154 realpart(signum(%i*y+x))+%i*imagpart(signum(%i*y+x))$
156 (forget(p > 0, n < 0, pz >= 0, nz <= 0,notequal(a,0)), remove(z,complex), 0);
159 /* SF bug #2242: "integrating function with signum incorrect" */
161 integrate(x*signum(x^2-1/4),x,-1,0);
164 /* SF bug #3123: "integrate(x*signum(x^2 - 4), x, 0, 3) yields spurious result" */
166 integrate(x*signum(x^2 - 4), x, 0, 3);
169 /* integrate can handle signum if it has constant sign between limits of integration */
171 integrate(x*signum(x^2-1/4),x, -1, -1/2);
174 integrate(x*signum(x^2-1/4),x, -1/2, 1/2);
177 integrate(x*signum(x^2-1/4),x, 1/2, 1);
180 /* ... or it's an odd function from -a to a */
182 integrate(x*signum(x^2-1/4),x,-1,1);
185 /* other integrate(signum) examples */
187 integrate(x*signum(x^3 - 8), x, 0, 3);
188 'integrate(x*signum(x^3 - 8), x, 0, 3);
190 integrate(x*signum(x^3 - 8), x, -2, 5);
191 'integrate(x*signum(x^3 - 8), x, -2, 5);
193 integrate(x*signum(x^3 - 8), x, 2, 5);
196 /* Tests for new (August, 2020) integrals of signum, unit_step, and mod. */
198 integrate(signum(x),x);
201 integrate(-signum(-x),x);
204 integrate(signum(a),a,-107,107);
207 integrate(signum(a),a,0,107);
210 integrate(unit_step(x),x);
213 integrate(unit_step(x),x);
216 integrate(-unit_step(-x),x);
219 integrate(mod(x,b),x);
220 (mod(x,b)^2-b*mod(x,b)+b*x)/2$
222 integrate(mod(x,b),x,0,b);
225 integrate(mod(x,b),x,0,2*b);
228 integrate(mod(x,b),x,0,42*b);