(
        self,
        start: XValue[T],
        stop: XValue[T],
        step: XValueDiff[T],
        transform: Callable[[XValueDiff[T]], float] = lambda x: cast(float, x),
    )
return sequence
Compute a sequence of integrals of the function

        :param start: lower bound of integral sequence
        :param stop: upper bound of integral sequence
        :param step: width of each "chunk" of the integral sequence
        :param transform: function to apply to x-widths before computing the integral
        :returns: a SortedDict of the numeric integral values of the function between start and stop;
            each integral has a range of size `step`, and the key-value is the left endpoint of the chunk
Compute a sequence of integrals of the function
Compute a sequence of integrals of the function
def integrals(
        self,
        start: XValue[T],
        stop: XValue[T],
        step: XValueDiff[T],
        transform: Callable[[XValueDiff[T]], float] = lambda x: cast(float, x),
    ) -> "SortedDict[XValue[T], float]":
        """ Compute a sequence of integrals of the function

        :param start: lower bound of integral sequence
        :param stop: upper bound of integral sequence
        :param step: width of each "chunk" of the integral sequence
        :param transform: function to apply to x-widths before computing the integral
        :returns: a SortedDict of the numeric integral values of the function between start and stop;
            each integral has a range of size `step`, and the key-value is the left endpoint of the chunk
        """
        step = step or (stop - start)
        if len(self.breakpoints) == 0:
            # If there are no breakpoints, just split up the range into even widths and compute
            # (width * self._initial_value) for each chunk.
            step_width = transform(step)
            range_width = transform(stop - start)
            num_full_chunks = int(range_width // step_width)
            sequence = SortedDict(
                [(start + step * i, step_width * self._initial_value) for i in range(num_full_chunks)]
            )

            # If the width does not evenly divide the range, compute the last chunk separately
            if range_width % step_width != 0:
                sequence[start + step * num_full_chunks] = range_width % step_width * self._initial_value
            return sequence

        # Set up starting loop parameters
        curr_xval = start
        curr_value = self.call(start)
        next_index, next_breakpoint, next_value = self._breakpoint_info(self.breakpoints.bisect(start))

        # Loop through the entire range and compute the integral of each chunk
        sequence = SortedDict()
        while curr_xval < stop:
            orig_xval = curr_xval
            next_xval = min(stop, curr_xval + step)

            # For each breakpoint in [curr_xval, next_xval), compute the area of that sub-chunk
            next_integral: float = 0
            while next_breakpoint and next_xval >= next_breakpoint:
                assert next_index is not None  # if next_breakpoint is set, next_index should also be set
                next_integral += transform(next_breakpoint - curr_xval) * curr_value
                curr_xval = next_breakpoint
                curr_value = next_value
                next_index, next_breakpoint, next_value = self._breakpoint_info(next_index + 1)

            # Handle any remaining width between the last breakpoint and the end of the chunk
            next_integral += transform(next_xval - curr_xval) * curr_value
            sequence[orig_xval] = next_integral

            curr_xval = next_xval

        return sequence
def integrals ( self , start : XValue [ T ] , stop : XValue [ T ] , step : XValueDiff [ T ] , transform : Callable [ [ XValueDiff [ T ] ] , float ] = lambda x : cast ( float , x ) , ) -> "SortedDict[XValue[T], float]" : step = step or ( stop - start ) if len ( self . breakpoints ) == 0 : # If there are no breakpoints, just split up the range into even widths and compute # (width * self._initial_value) for each chunk. step_width = transform ( step ) range_width = transform ( stop - start ) num_full_chunks = int ( range_width // step_width ) sequence = SortedDict ( [ ( start + step * i , step_width * self . _initial_value ) for i in range ( num_full_chunks ) ] ) # If the width does not evenly divide the range, compute the last chunk separately if range_width % step_width != 0 : sequence [ start + step * num_full_chunks ] = range_width % step_width * self . _initial_value return sequence # Set up starting loop parameters curr_xval = start curr_value = self . call ( start ) next_index , next_breakpoint , next_value = self . _breakpoint_info ( self . breakpoints . bisect ( start ) ) # Loop through the entire range and compute the integral of each chunk sequence = SortedDict ( ) while curr_xval < stop : orig_xval = curr_xval next_xval = min ( stop , curr_xval + step ) # For each breakpoint in [curr_xval, next_xval), compute the area of that sub-chunk next_integral : float = 0 while next_breakpoint and next_xval >= next_breakpoint : assert next_index is not None # if next_breakpoint is set, next_index should also be set next_integral += transform ( next_breakpoint - curr_xval ) * curr_value curr_xval = next_breakpoint curr_value = next_value next_index , next_breakpoint , next_value = self . _breakpoint_info ( next_index + 1 ) # Handle any remaining width between the last breakpoint and the end of the chunk next_integral += transform ( next_xval - curr_xval ) * curr_value sequence [ orig_xval ] = next_integral curr_xval = next_xval return sequence