solvelib::preImage
-- preimage
of a set under a mappingsolvelib::preImage
(a, x, S)
returns the
set of all numbers y
such that substituting y
for x
in a
gives an element of
S
.
solvelib::preImage(a, x, S)
a |
- | arithmetic expression |
x |
- | identifier |
S |
- | set |
set
S
can be a set of any type (finite or infinite).In case of a finite set S
, the preimage of
S is just the union of all sets solve(a=s, x)
, where
s
ranges over the elements of S
.
>> solvelib::preImage(x^2+2, x, {11, 15});
1/2 1/2 {-3, 3, 13 , - 13 }
For intervals, the preimage is usually an interval or a union of intervals.
>> solvelib::preImage(x^2+2, x, Dom::Interval(3..7));
]1, 5^(1/2)[ union ]-5^(1/2), -1[