MCPcopy Create free account
hub / github.com/Aghajari/MathParser / Integration

Class Integration

MathParser/src/com/aghajari/math/custom/Integration.java:8–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7// https://github.com/gbenroscience/ParserNG/blob/master/src/main/java/math/numericalmethods/Integration.java
8public class Integration {
9
10 private FunctionWrapper function = null; // Function to be integrated
11 private boolean setFunction = false; // = true when Function set
12 private double lowerLimit = Double.NaN; // Lower integration limit
13 private double upperLimit = Double.NaN; // Upper integration limit
14 private boolean setLimits = false; // = true when limits set
15
16 private int glPoints = 0; // Number of points in the Gauss-Legendre integration
17 private boolean setGLpoints = false; // = true when glPoints set
18 private int nIntervals = 0; // Number of intervals in the rectangular rule integrations
19 private boolean setIntervals = false; // = true when nIntervals set
20
21 private double integralSum = 0.0D; // Sum returned by the numerical integration method
22 private boolean setIntegration = false; // = true when integration performed
23
24 // ArrayLists to hold Gauss-Legendre Coefficients saving repeated calculation
25 private static ArrayList<Integer> gaussQuadIndex = new ArrayList<Integer>(); // Gauss-Legendre indices
26 private static ArrayList<double[]> gaussQuadDistArrayList = new ArrayList<double[]>(); // Gauss-Legendre distances
27 private static ArrayList<double[]> gaussQuadWeightArrayList = new ArrayList<double[]>();// Gauss-Legendre weights
28
29 // Iterative trapezium rule
30 private double requiredAccuracy = 0.0D; // required accuracy at which iterative trapezium is terminated
31 private double trapeziumAccuracy = 0.0D; // actual accuracy at which iterative trapezium is terminated as instance variable
32 private static double trapAccuracy = 0.0D; // actual accuracy at which iterative trapezium is terminated as class variable
33 private int maxIntervals = 0; // maximum number of intervals allowed in iterative trapezium
34 private int trapeziumIntervals = 1; // number of intervals in trapezium at which accuracy was satisfied as instance variable
35 private static int trapIntervals = 1; // number of intervals in trapezium at which accuracy was satisfied as class variable
36
37 // CONSTRUCTORS
38
39 // Constructor taking function to be integrated
40 public Integration(FunctionWrapper intFunc) {
41 this.function = intFunc;
42 this.setFunction = true;
43 }
44
45 // Constructor taking function to be integrated and the limits
46 public Integration(FunctionWrapper intFunc, double lowerLimit, double upperLimit) {
47 this.function = intFunc;
48 this.setFunction = true;
49 this.lowerLimit = lowerLimit;
50 this.upperLimit = upperLimit;
51 this.setLimits = true;
52 }
53
54 // SET METHODS
55
56 // Set function to be integrated
57 public void setFunction(FunctionWrapper intFunc) {
58 this.function = intFunc;
59 this.setFunction = true;
60 }
61
62 // Set limits
63 public void setLimits(double lowerLimit, double upperLimit) {
64 this.lowerLimit = lowerLimit;
65 this.upperLimit = upperLimit;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected