Numworks Epsilon  1.4.1
Graphing Calculator Operating System
left_integral_calculation.cpp
Go to the documentation of this file.
2 #include <assert.h>
3 #include <ion.h>
4 #include <cmath>
5 
6 namespace Probability {
7 
9  Calculation(),
10  m_upperBound(0.0),
11  m_result(0.0)
12 {
13  compute(0);
14 }
15 
17  return Type::LeftIntegral;
18 }
19 
21  return 2;
22 }
23 
25  assert(index >= 0 && index < 2);
26  if (index == 0) {
27  return I18n::Message::LeftIntegralFirstLegend;
28  }
29  return I18n::Message::LeftIntegralSecondLegend;
30 }
31 
33  assert(index >= 0 && index < 2);
34  if (index == 0) {
35  m_upperBound = f;
36  }
37  if (index == 1) {
38  m_result = f;
39  }
40  compute(index);
41 }
42 
44  assert(index >= 0 && index < 2);
45  if (index == 0) {
46  return m_upperBound;
47  }
48  return m_result;
49 }
50 
52  return m_upperBound;
53 }
54 
55 void LeftIntegralCalculation::compute(int indexKnownElement) {
56  if (m_law == nullptr) {
57  return;
58  }
59  if (indexKnownElement == 0) {
60  m_result = m_law->cumulativeDistributiveFunctionAtAbscissa(m_upperBound);
61  } else {
62  m_upperBound = m_law->cumulativeDistributiveInverseForProbability(&m_result);
63  }
64 }
65 
66 }
#define assert(e)
Definition: assert.h:9
void setParameterAtIndex(double f, int index) override
virtual double cumulativeDistributiveInverseForProbability(double *probability)
Definition: law.cpp:68
I18n::Message legendForParameterAtIndex(int index) override
virtual double cumulativeDistributiveFunctionAtAbscissa(double x) const
Definition: law.cpp:16