Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix maths #106

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# In this example, we check that the reference probabilities in the reliability problems
# are consistent with confidence bounds from Monte-Carlo simulations.
# These 95% confidence bounds are stored in 'reliability_compute_reference_proba.csv'
# and required approximately than :math`10^9` function evaluations for each problem.
# and required approximately than :math:`10^9` function evaluations for each problem.
#
# We consider two different metrics:
#
Expand Down
2 changes: 0 additions & 2 deletions doc/examples/reliability/README.txt

This file was deleted.

2 changes: 0 additions & 2 deletions doc/examples/sensitivity/README.txt

This file was deleted.

12 changes: 9 additions & 3 deletions otbenchmark/ReliabilityLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,26 @@


def ComputeLogRelativeError(exact, computed, basis=10.0):
"""
r"""
Compute the log-relative error between exact and computed.

The log-relative error (LRE) is defined by:

.. math::

LRE = -logB(relativeError)

where relativeError is the relative error:

relativeError = abs(exact - computed) / abs(exact)
.. math::

relativeError = \frac{|exact - computed|}{|exact|}

and logB is the base-b logarithm:

logB(x) = log(x) / log(basis)
.. math::

logB(x) = \frac{log(x)}{log(basis)}

where log is the natural logarithm.
This assumes that exact is different from zero.
Expand Down
6 changes: 4 additions & 2 deletions otbenchmark/_FloodingSensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ class FloodingSensitivity(SensitivityBenchmarkProblem):
"""Class to define a Flooding sensitivity benchmark problem."""

def __init__(self):
"""
r"""
Create a Flooding sensitivity problem.

The function is defined by the equation:

g(x) = (Q/(Ks*B*sqrt((Zm-Zv)/L)))^(3.0/5.0)+Zv-Zb-Hd
.. math::

g(x) = (\frac{Q}{K_s B \sqrt{\frac{Z_m-Z_v}{L}}})^{\frac{3}{5}}+Z_v-Z_b-H_d

with:

Expand Down
20 changes: 8 additions & 12 deletions otbenchmark/_FourBranchSerialSystemReliability.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,14 @@ def __init__(self):
References
----------

Waarts, P.-H. (2000). Structural reliability using finite element
methods: an appraisal of DARS: Directional Adaptive Response Surface
Sampling. Ph. D. thesis, Technical University of Delft, The
Netherlands. Pages 58, 69, 160.

Thèse Vincent Dubourg 2011, Méta-modèles adaptatifs pour l’analyse
de fiabilité et l’optimisation sous contrainte fiabiliste,
section "A two-dimensional four-branch serial system", page 182

Parameters
----------
None.
- Waarts, P.-H. (2000). Structural reliability using finite element
methods: an appraisal of DARS: Directional Adaptive Response Surface
Sampling. Ph. D. thesis, Technical University of Delft, The
Netherlands. Pages 58, 69, 160.

- Thèse Vincent Dubourg 2011, Méta-modèles adaptatifs pour l’analyse
de fiabilité et l’optimisation sous contrainte fiabiliste,
section "A two-dimensional four-branch serial system", page 182

Examples
--------
Expand Down
8 changes: 4 additions & 4 deletions otbenchmark/_NLOscillatorSensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ class NLOscillatorSensitivity(SensitivityBenchmarkProblem):
"""Class to define a Oscillator sensitivity benchmark problem."""

def __init__(self):
"""
r"""
Create a nonlinear oscillator sensitivity problem.

The function is defined by the equation:

.. math::
g(x) = fs - 3*ks*np.sqrt(np.pi*S0/(4.*xis*omegas**3)*
xi_a*xis/(xip*xis*(4.*xi_a**2+theta**2)+gamma*xi_a**2)*
(xip*omegap**3+xis*omegas**3)*omegap/(4.*xi_a*omegaa**4))
g(x) = fs - 3*ks*\sqrt{\pi*S0/(4.*xis*omegas^3)*
xi_a*xis/(xip*xis*(4.*xi_a^2+theta^2)+gamma*xi_a^2)*
(xip*omegap^3+xis*omegas^3)*omegap/(4.*xi_a*omegaa^4)}

where
* omegap = np.sqrt(kp/mp)
Expand Down