Dynamic Y Bounds
This commit is contained in:
28
.idea/workspace.xml
generated
28
.idea/workspace.xml
generated
@@ -7,24 +7,27 @@
|
|||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectColorInfo"><![CDATA[{
|
<component name="Git.Settings">
|
||||||
"customColor": "",
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
"associatedIndex": 3
|
</component>
|
||||||
}]]></component>
|
<component name="ProjectColorInfo">{
|
||||||
|
"customColor": "",
|
||||||
|
"associatedIndex": 3
|
||||||
|
}</component>
|
||||||
<component name="ProjectId" id="2f8GfgPc4SNisU2YtrGzKkx27b1" />
|
<component name="ProjectId" id="2f8GfgPc4SNisU2YtrGzKkx27b1" />
|
||||||
<component name="ProjectViewState">
|
<component name="ProjectViewState">
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"kotlin-language-version-configured": "true",
|
"kotlin-language-version-configured": "true",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="SharedIndexes">
|
<component name="SharedIndexes">
|
||||||
<attachedChunks>
|
<attachedChunks>
|
||||||
<set>
|
<set>
|
||||||
@@ -41,6 +44,7 @@
|
|||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1713175398866</updated>
|
<updated>1713175398866</updated>
|
||||||
<workItem from="1713175399721" duration="45000" />
|
<workItem from="1713175399721" duration="45000" />
|
||||||
|
<workItem from="1714631445701" duration="14000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
public class Main {
|
public class Main {
|
||||||
|
static Bounds bounds;
|
||||||
static Bounds bounds = new Bounds(new LinearBounds(0, 20), new LinearBounds(-100, 150000));
|
static final float lowerX = 0;
|
||||||
static double samples = 1_000_000;
|
static final float upperX = 20;
|
||||||
|
static double samples = 10_000_000;
|
||||||
static int threadCount = 16;
|
static int threadCount = 16;
|
||||||
|
|
||||||
static class Point {
|
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) {
|
static double function(double x) {
|
||||||
return Math.pow(x,4)-4*Math.pow(x,3)+18*Math.pow(x,2)-12*x-69;
|
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 {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
|
|
||||||
|
bounds = new Bounds(new LinearBounds(lowerX, upperX), new LinearBounds(getLowerLimit(), getUpperLimit()));
|
||||||
|
|
||||||
double pointsInside = 0;
|
double pointsInside = 0;
|
||||||
long startTime = System.nanoTime();
|
long startTime = System.nanoTime();
|
||||||
double real_value = getRealIntegral(bounds.getX());
|
double real_value = getRealIntegral(bounds.getX());
|
||||||
|
|||||||
Reference in New Issue
Block a user