diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9feb01a..6570037 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,24 +7,27 @@
-
+
+
+
+ {
+ "customColor": "",
+ "associatedIndex": 3
+}
- {
+ "keyToString": {
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "kotlin-language-version-configured": "true",
+ "nodejs_package_manager_path": "npm",
+ "vue.rearranger.settings.migration": "true"
}
-}]]>
+}
@@ -41,6 +44,7 @@
1713175398866
+
diff --git a/MonteCarlo_Java/src/Main.java b/MonteCarlo_Java/src/Main.java
index e6a6552..19b0a9b 100644
--- a/MonteCarlo_Java/src/Main.java
+++ b/MonteCarlo_Java/src/Main.java
@@ -1,7 +1,8 @@
public class Main {
-
- static Bounds bounds = new Bounds(new LinearBounds(0, 20), new LinearBounds(-100, 150000));
- static double samples = 1_000_000;
+ static Bounds bounds;
+ static final float lowerX = 0;
+ static final float upperX = 20;
+ static double samples = 10_000_000;
static int threadCount = 16;
static class Point {
@@ -65,6 +66,25 @@ public class Main {
}
}
+ static float getUpperLimit() {
+ float upperLimit = 0;
+ for(float i = lowerX; i< upperX; i+= 0.025F) {
+ if(function(i) > upperLimit) {
+ upperLimit = (float) (function(i) * 1.025);
+ }
+ }
+ return upperLimit;
+ }
+ static float getLowerLimit() {
+ float lowerLimit = 0;
+ for(float i = lowerX; i< upperX; i+= 0.025F) {
+ if(function(i) < lowerLimit) {
+ lowerLimit = (float) (function(i) * 1.025);
+ }
+ }
+ return lowerLimit;
+ }
+
static double function(double x) {
return Math.pow(x,4)-4*Math.pow(x,3)+18*Math.pow(x,2)-12*x-69;
}
@@ -86,6 +106,8 @@ public class Main {
public static void main(String[] args) throws InterruptedException {
+ bounds = new Bounds(new LinearBounds(lowerX, upperX), new LinearBounds(getLowerLimit(), getUpperLimit()));
+
double pointsInside = 0;
long startTime = System.nanoTime();
double real_value = getRealIntegral(bounds.getX());