<
:

## Solving Inequalities with Piecewise and Floats

Quick, what numbers x satisfy:
```abs( x-2 ) < 1
```
How does Maple answer this?
```solve( abs( x-2 ) < 1, x );
RealRange(Open(0), Open(2))
```
Now, change the RHS to 1. (floating-point 1):
```solve( abs(x-1) < 1., x );
RealRange(1., Open(2.)), RealRange(Open(0.), Open(1.))
```
Of course, these two intervals can be combined to the one interval. Maple 10 did not have this problem. (I will explain what Maple 11 is doing later, I want the next paragraph to appear in the truncated version of this post.) This issue is important for those of us trying to use Maple in the classroom. While it's not difficult to explain what is going on, the point is that this is not the mathematics I am trying to teach and these issues are a distraction. Explanation: The real source of the difficulty is the absolute value function - a piecewise defined function. Maple 11 correctly sees the two parts of the absolute value function. Solving the inequality for each part of the definition is the source for the two intervals:
```q := convert( abs(x-2), piecewise, x );
q := piecewise(x < 2, 2 - x, 2 <= x, -2 + x)
seq( op(i,q), i=1..nops(q) );
x < 2, 2 - x, 2 <= x, -2 + x
solve( {op(1,q),op(2,q)<1.}, x );
{x < 2., 1. < x}
solve( {op(3,q),op(4,q)<1.}, x );
{x < 3., 2. <= x}
```
The question is why was Maple 10 able to combine these two sets but Maple 11 cannot? Could it be because there is a gap the size of machine epsilon between Open(1.) and 1.? If this is the case, then the definition of the absolute value function with floating point numbers is not defined for all floating-point numbers. Surely this is not what is intended. Two additional points I want to make about this:
1. For problems where the result does consist of more than one set, why does Maple not report the output from solve as the UNION of two sets?
2. With all of the progress in 2D mathematics, couldn't there be a way to prettyprint intervals using standard mathematical notation? [I am not (yet) asking for simplified input for intervals, but why can't the output be improved?]
I look forward to any responses, suggestions, or differing opinions. Doug
```-----------------------------------------------------------------------
Prof. Douglas B. Meade      Phone:  (803) 777-6183  FAX: (803) 777-3783
Department of Mathematics   URL:    http://www.math.sc.edu/~meade/
USC, Columbia, SC 29208     E-mail: mailto:meade@math.sc.edu
``` ﻿