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

midpoint -- midpoint of an interval

Description

Returns the midpoint (the average of the endpoints) of the input interval.

i1 : interval(2,4)

o1 = [2,4]

o1 : RRi (of precision 53)
i2 : midpoint oo

o2 = 3

o2 : RR (of precision 53)

For complex intervals, the center of the rectangle in the complex plane is returned.

i3 : interval(2 + 3*ii, 4 + 7*ii)

o3 = [2,4]+[3,7]*ii

o3 : CCi (of precision 53)
i4 : midpoint oo

o4 = 3+5*ii

o4 : CC (of precision 53)

The midpoint of a matrix is the matrix containing the midpoints of its entries.

i5 : A = matrix{{interval(1,3), interval(3,5)}, {interval(5,7), interval(7,9)}}

o5 = | [1,3] [3,5] |
     | [5,7] [7,9] |

                 2          2
o5 : Matrix RRi    <-- RRi
               53         53
i6 : midpoint A

o6 = | 2 4 |
     | 6 8 |

                2         2
o6 : Matrix RR    <-- RR
              53        53

The midpoint of a polynomial is obtained by taking the midpoints of the coefficients.

i7 : R = RRi[x,y,z]

o7 = R

o7 : PolynomialRing
i8 : f = interval(1,3)*x + interval(3,5)*y + interval(5,7)*z

o8 = ([1,3])x + ([3,5])y + ([5,7])z

o8 : R
i9 : midpoint f

o9 = 2x + 4y + 6z

o9 : RR  [x..z]
       53

See also

Ways to use midpoint:

  • midpoint(CCi)
  • midpoint(Matrix)
  • midpoint(Number)
  • midpoint(RingElement)
  • midpoint(RRi)

For the programmer

The object midpoint is a method function.


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