Description
A complex interval is entered as a pair of real intervals to the
interval function. It is stored internally as a pair of arbitrary precision intervals using the
MPFI library.
i1 : interval(interval(3.1415,3.1416), interval(2.7182,2.7183))
o1 = [3.1415,3.1416]+[2.7182,2.7183]*ii
o1 : CCi (of precision 53)
|
The precision is measured in bits, is visible in the ring displayed on the second of each pair of output lines, and can be recovered using
precision.
i2 : precision interval(interval(3.1415,3.1416), interval(2.7182,2.7183))
o2 = 53
|
Complex intervals are objects in
class CCi which is an
InexactFieldFamily.For complex intervals, the functions
class and
ring yield different results. That allows numbers of various precisions to be used without creating a new ring for each precision.
i3 : class interval(interval(3.1,3.5),interval(1.1,1.2))
o3 = CCi
o3 : InexactFieldFamily
|
The precision can be specified on input by specifying the precision of both input
CC numbers. Alternatively, the precision can be specified by including the option
Precision.
i4 : interval(interval(2.5p1000,3.2p100),interval(2.3,3.1,Precision=>200))
o4 = [2.5,3.200000000000000000000000000001]+[2.299999999999999822364316059975
,3.100000000000000088817841970013]*ii
o4 : CCi (of precision 100)
|
Complex intervals can also be created using
span(Sequence) to create the smallest complex axis-aligned rectangle containing the inputs.
i5 : span(2+3*ii,Precision=>100)
o5 = [2,2]+[3,3]*ii
o5 : CCi (of precision 100)
|
i6 : span(2,3*ii,interval(interval(-1.5,-0.5),interval(3,3.1)),73)
o6 = [-1.5,73]+[0,3.1]*ii
o6 : CCi (of precision 53)
|
Operations using complex intervals are computed as sets so that the resulting intervals contain all possible outputs from pairs of points in input intervals.
i7 : (I, J, K) = (interval(interval(.5,.8),interval(.6,.9)), interval(interval(.54,.78),interval(.65,.89)), interval(interval(.45,.6),interval(.3,.78)));
|
i8 : I + J
o8 = [1.04,1.58]+[1.25,1.79]*ii
o8 : CCi (of precision 53)
|
i9 : I - J
o9 = [-.28,.26]+[-.29,.25]*ii
o9 : CCi (of precision 53)
|
i10 : I * K
o10 = [-.4770000000000001,.3000000000000001]+[.4199999999999999,1.164]*ii
o10 : CCi (of precision 53)
|
i11 : I / K
o11 = [.4182156133828995,4.041025641025643]+[-1.210256410256411,
1.333333333333334]*ii
o11 : CCi (of precision 53)
|
i12 : I ^ 3
o12 = [-1.744,-.1359999999999998]+[-.2040000000000001,1.404000000000001]*ii
o12 : CCi (of precision 53)
|
i13 : 2 * I
o13 = [1,1.6]+[1.2,1.8]*ii
o13 : CCi (of precision 53)
|
i14 : (2+3*ii) * I
o14 = [-1.7,-.1999999999999997]+[2.7,4.200000000000001]*ii
o14 : CCi (of precision 53)
|
The real and imaginary parts of a complex interval can be accessed with
realPart and
imaginaryPart. These are real intervals of class
RRi. The
diameter of a complex interval is the (rounded) approximation to the length of its diagonal, while its
midpoint is the complex midpoint of its real and imaginary parts
i15 : realPart interval(1+2*ii,3+4*ii)
o15 = [1,3]
o15 : RRi (of precision 53)
|
i16 : imaginaryPart interval(1+2*ii,3+4*ii)
o16 = [2,4]
o16 : RRi (of precision 53)
|
i17 : diameter interval(1+2*ii,3+4*ii)
o17 = 2.82842712474619
o17 : RR (of precision 53)
|
i18 : midpoint interval(1+2*ii,3+4*ii)
o18 = 2+3*ii
o18 : CC (of precision 53)
|