Exemple #1
0
        /// <summary>
        /// Adaptive integration on infinite interval (-Infinity,+Infinity) using default settings for integration rule and debugging.
        /// </summary>
        /// <param name="f">Function to integrate.</param>
        /// <param name="epsabs">Specifies the expected absolute error of integration. Should be set to zero (0) if you specify a relative error.</param>
        /// <param name="epsrel">Specifies the expected relative error of integration. Should be set to zero (0) if you specify an absolute error.</param>
        /// <param name="limit">Maximum number of subintervals used for integration.</param>
        /// <param name="result">On return, contains the integration result.</param>
        /// <param name="abserr">On return, contains the absolute error of integration.</param>
        /// <param name="tempStorage">Provides a temporary storage object that you can reuse for repeating function calls.</param>
        /// <returns>Null if successfull, otherwise the appropriate error code.</returns>
        public static GSL_ERROR Integration(Func <double, double> f,
                                            double epsabs, double epsrel,
                                            int limit,
                                            out double result, out double abserr,
                                            ref object tempStorage
                                            )
        {
            var algo = tempStorage as QagiIntegration;

            if (null == algo)
            {
                tempStorage = algo = new QagiIntegration();
            }
            return(algo.Integrate(f, epsabs, epsrel, limit, out result, out abserr));
        }
Exemple #2
0
		/// <summary>
		/// Adaptive integration on infinite interval (-Infinity,+Infinity) using default settings for integration rule and debugging.
		/// </summary>
		/// <param name="f">Function to integrate.</param>
		/// <param name="epsabs">Specifies the expected absolute error of integration. Should be set to zero (0) if you specify a relative error.</param>
		/// <param name="epsrel">Specifies the expected relative error of integration. Should be set to zero (0) if you specify an absolute error.</param>
		/// <param name="limit">Maximum number of subintervals used for integration.</param>
		/// <param name="result">On return, contains the integration result.</param>
		/// <param name="abserr">On return, contains the absolute error of integration.</param>
		/// <param name="tempStorage">Provides a temporary storage object that you can reuse for repeating function calls.</param>
		/// <returns>Null if successfull, otherwise the appropriate error code.</returns>
		public static GSL_ERROR Integration(Func<double, double> f,
					double epsabs, double epsrel,
					int limit,
					out double result, out double abserr,
					ref object tempStorage
					)
		{
			QagiIntegration algo = tempStorage as QagiIntegration;
			if (null == algo)
				tempStorage = algo = new QagiIntegration();
			return algo.Integrate(f, epsabs, epsrel, limit, out result, out abserr);
		}