Macaulay2 » Documentation
Packages » Macaulay2Doc » rings » basic rings of numbers » RRi » interval
next | previous | forward | backward | up | index | toc

interval -- construct an interval

Description

If given one argument, returns a real or complex interval as small as possible containing n.

i1 : interval 3

o1 = [3,3]

o1 : RRi (of precision 53)
i2 : interval(2 + 5*ii)

o2 = [2,2]+[5,5]*ii

o2 : CCi (of precision 53)

If given two real arguments (or an array with two entries), the interval from l to r. Note that if l is to the right of r, the constructed interval is empty.

i3 : interval(2, 3)

o3 = [2,3]

o3 : RRi (of precision 53)
i4 : interval(5, 4)

o4 = [5,4] (an empty interval)

o4 : RRi (of precision 53)
i5 : interval [7, 8]

o5 = [7,8]

o5 : RRi (of precision 53)

If given two arguments, at least one of which is a complex number and neither of which is an interval, then the rectangle in the complex plane whose lower left hand corner is the first argument and upper right hand corner is the second argument is returned.

i6 : interval(2 + 3*ii, 5 + 4*ii)

o6 = [2,5]+[3,4]*ii

o6 : CCi (of precision 53)

If given two real arguments, at least one of which is an interval, then the first argument gives the real part and the second argument the imaginary part of a complex interval.

i7 : interval(interval(3, 4), interval(5, 6))

o7 = [3,4]+[5,6]*ii

o7 : CCi (of precision 53)

The Precision option sets the precision of the output.

i8 : interval(Precision => 100, 5)

o8 = [5,5]

o8 : RRi (of precision 100)

See also

Ways to use interval:

  • interval(Array)
  • interval(CC)
  • interval(CC,CC)
  • interval(CC,RR)
  • interval(CC,RRi)
  • interval(CCi)
  • interval(CCi,Number)
  • interval(Number)
  • interval(Number,CCi)
  • interval(Number,Number)
  • interval(RR)
  • interval(RR,CC)
  • interval(RR,RR)
  • interval(RR,RRi)
  • interval(RRi)
  • interval(RRi,CC)
  • interval(RRi,RR)
  • interval(RRi,RRi)

For the programmer

The object interval is a method function with options.


The source of this document is in /build/reproducible-path/macaulay2-1.26.05+ds/M2/Macaulay2/packages/Macaulay2Doc/doc_intervals.m2:357:0.