def cochran(sd, data, rnge): z = zScore.zScore(data) p = PopulationProportion.proportion(sd, data, rnge) e = MarginError.marginError(sd, data) q = 1 - p cochran = (Exponentiation.sqr(z, 2) * p * q) / Exponentiation.sqr(e, 2) return cochran
def sampleSize(sd, data): e = MarginError.margin(sd, data) stdDev = StandardDeviation.standardDeviation(data) val = (1.96 * stdDev) / e sample = Exponentiation.exponent(val, 2) return sample
def sampleSize(sd, data, percentage): z = Zscore.zscore(sd, data) e = MarginError.margin(sd, data) p = percentage q = 1 - p val = z / e sample = Exponentiation.exponent(val, 2) * p * q return sample
def sampleSize(sd, data, percentage): z = zScore.zScore(sd) e = MarginError.marginError(sd, data) p = percentage q = 1 - p val = z/e sample = Exponentiation.sqr(val, 2) * p * q return sample
def test_MathOperations_exponentiation(self): self.assertEqual(4, Exponentiation.exponentiation(2, 2))
def test_MathOperations_exponentiation(self): self.assertEqual(8, Exponentiation.power(2, 3))
def test_MathOperations_exponent(self): self.assertEqual(81, Exponentiation.exponent(9, 2))
def test_MathOperations_exponentiation(self): Exponentiation.power(2, 2) self.assertEqual(4, Exponentiation.power(2, 2))
def Exponentiation(self, a, b): self.Result = Exponentiation.exponentiation(a, b) return self.Result
def Power(a, b): return Exponentiation.power(a, b)
def Power(self, a, b): self.Result = Exponentiation.power(a, b) return math.pow(a, b)
def test_MathOperations_Exponentiation(self): self.assertEqual(16, Exponentiation.power(4, 2))
def test_MathOperations_Exponentiation(self): self.assertEqual(27, Exponentiation.exponentiation(3, 3))
def Power(self, a, b): self.Result = Exponentiation.power(a, b)
def Exponent(self, a, b): self.Result = Exponentiation.sqr(a, b) return self.Result