1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * https://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /* 19 * This is not the original file distributed by the Apache Software Foundation 20 * It has been modified by the Hipparchus project 21 */ 22 package org.hipparchus.analysis.integration; 23 24 import org.hipparchus.analysis.UnivariateFunction; 25 import org.hipparchus.exception.MathIllegalArgumentException; 26 import org.hipparchus.exception.MathIllegalStateException; 27 import org.hipparchus.exception.NullArgumentException; 28 29 /** 30 * Interface for univariate real integration algorithms. 31 * 32 */ 33 public interface UnivariateIntegrator { 34 35 /** 36 * Get the relative accuracy. 37 * 38 * @return the accuracy 39 */ 40 double getRelativeAccuracy(); 41 42 /** 43 * Get the absolute accuracy. 44 * 45 * @return the accuracy 46 */ 47 double getAbsoluteAccuracy(); 48 49 /** 50 * Get the min limit for the number of iterations. 51 * 52 * @return the actual min limit 53 */ 54 int getMinimalIterationCount(); 55 56 /** 57 * Get the upper limit for the number of iterations. 58 * 59 * @return the actual upper limit 60 */ 61 int getMaximalIterationCount(); 62 63 /** 64 * Integrate the function in the given interval. 65 * 66 * @param maxEval Maximum number of evaluations. 67 * @param f the integrand function 68 * @param min the lower bound for the interval 69 * @param max the upper bound for the interval 70 * @return the value of integral 71 * @throws MathIllegalStateException if the maximum number of function 72 * evaluations is exceeded 73 * @throws MathIllegalStateException if the maximum iteration count is exceeded 74 * or the integrator detects convergence problems otherwise 75 * @throws MathIllegalArgumentException if {@code min > max} or the endpoints do not 76 * satisfy the requirements specified by the integrator 77 * @throws NullArgumentException if {@code f} is {@code null}. 78 */ 79 double integrate(int maxEval, UnivariateFunction f, double min, 80 double max) 81 throws MathIllegalArgumentException, MathIllegalStateException, NullArgumentException; 82 83 /** 84 * Get the number of function evaluations of the last run of the integrator. 85 * 86 * @return number of function evaluations 87 */ 88 int getEvaluations(); 89 90 /** 91 * Get the number of iterations of the last run of the integrator. 92 * 93 * @return number of iterations 94 */ 95 int getIterations(); 96 97 }