예제 #1
0
        /// <summary>
        /// Returns the differential of the current parametric function.
        /// </summary>
        /// <param name="index">The index to differentiate to, which must be greater than 0.</param>
        /// <returns>HyperbolicParametric.</returns>
        /// <exception cref="ArgumentOutOfRangeException">Index must not be greater than {_components.Count - 1} in order to differentiate.</exception>
        public ParametricComponents <T1, T2, T3> Differentiate(int index)
        {
            index++;
            if (_components.Count <= index)
            {
                throw new ArgumentOutOfRangeException($"Index: {index} must not be greater than {_components.Count - 1} in order to differentiate.");
            }
            ParametricComponents <T1, T2, T3> differential = Clone() as ParametricComponents <T1, T2, T3>;

            differential._differentiationIndex = index;
            return(differential);
        }
예제 #2
0
        /// <summary>
        /// Returns the current parametric function, differentiated to the specified # of times.
        /// </summary>
        /// <param name="index">The index to differentiate to, which must be greater than 0.</param>
        /// <returns>HyperbolicParametric.</returns>
        /// <exception cref="ArgumentOutOfRangeException">Index: {index} must not be less than 0.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Index: {index} must not be greater than {_components.Count - 1} in order to differentiate.</exception>
        public ParametricComponents <T1, T2, T3> DifferentiateBy(int index)
        {
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException($"Index: {index} must not be less than 0.");
            }
            if (index < _differentiationIndex)
            {
                throw new ArgumentOutOfRangeException($"Differentiation index {index} cannot be less than than current index {_differentiationIndex}.");
            }
            if (_components.Count <= index)
            {
                throw new ArgumentOutOfRangeException($"Index: {index} must not be greater than {_components.Count - 1} in order to differentiate.");
            }

            ParametricComponents <T1, T2, T3> differential = Clone() as ParametricComponents <T1, T2, T3>;

            differential._differentiationIndex = index;
            return(differential);
        }