Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
javawlp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
impresshs
javawlp
Commits
3c252474
Commit
3c252474
authored
8 years ago
by
Koen Wermer
Browse files
Options
Downloads
Patches
Plain Diff
.
parent
d308c33a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/BaseSecantSolver.java
+13
-6
13 additions, 6 deletions
Tests/BaseSecantSolver.java
with
13 additions
and
6 deletions
Tests/BaseSecantSolver.java
+
13
−
6
View file @
3c252474
...
...
@@ -22,6 +22,13 @@ import org.apache.commons.math3.analysis.UnivariateFunction;
import
org.apache.commons.math3.exception.ConvergenceException
;
import
org.apache.commons.math3.exception.MathInternalError
;
import
org.apache.commons.math3.exception.NoBracketingException
;
import
org.apache.commons.math3.exception.NotStrictlyPositiveException
;
import
org.apache.commons.math3.exception.NullArgumentException
;
import
org.apache.commons.math3.exception.NumberIsTooLargeException
;
import
org.apache.commons.math3.exception.util.LocalizedFormats
;
import
org.apache.commons.math3.util.FastMath
;
/**
* Base class for all bracketing <em>Secant</em>-based methods for root-finding
* (approximating a zero of a univariate real function).
...
...
@@ -256,13 +263,13 @@ public abstract class BaseSecantSolver
return
(
fLo
>=
0
&&
fHi
<=
0
)
||
(
fLo
<=
0
&&
fHi
>=
0
);
}
public
static
boolean
isSequence
(
final
double
start
,
public
static
boolean
isSequence
1
(
final
double
start
,
final
double
mid
,
final
double
end
)
{
return
(
start
<
mid
)
&&
(
mid
<
end
);
}
public
static
void
verifyInterval
(
final
double
lower2
,
public
static
void
verifyInterval
1
(
final
double
lower2
,
final
double
upper2
)
throws
NumberIsTooLargeException
{
if
(
lower2
>=
upper2
)
{
...
...
@@ -271,12 +278,12 @@ public abstract class BaseSecantSolver
}
}
public
static
void
verifySequence
(
final
double
lower3
,
public
static
void
verifySequence
1
(
final
double
lower3
,
final
double
initial
,
final
double
upper3
)
throws
NumberIsTooLargeException
{
verifyInterval
(
lower3
,
initial
);
verifyInterval
(
initial
,
upper3
);
verifyInterval
1
(
lower3
,
initial
);
verifyInterval
1
(
initial
,
upper3
);
}
public
static
void
verifyBracketing
(
UnivariateFunction
function2
,
...
...
@@ -287,7 +294,7 @@ public abstract class BaseSecantSolver
if
(
function2
==
null
)
{
throw
new
NullArgumentException
(
LocalizedFormats
.
FUNCTION
);
}
verifyInterval
(
lower4
,
upper4
);
verifyInterval
1
(
lower4
,
upper4
);
if
(!
isBracketing
(
function2
,
lower4
,
upper4
))
{
throw
new
NoBracketingException
(
lower4
,
upper4
,
function2
.
value
(
lower4
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment