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="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo"><![CDATA[{
|
||||
"customColor": "",
|
||||
"associatedIndex": 3
|
||||
}]]></component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"customColor": "",
|
||||
"associatedIndex": 3
|
||||
}</component>
|
||||
<component name="ProjectId" id="2f8GfgPc4SNisU2YtrGzKkx27b1" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="SharedIndexes">
|
||||
<attachedChunks>
|
||||
<set>
|
||||
@@ -41,6 +44,7 @@
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1713175398866</updated>
|
||||
<workItem from="1713175399721" duration="45000" />
|
||||
<workItem from="1714631445701" duration="14000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user