Initial Refactoring of yoshi_otter and Test Implementation

This commit is contained in:
2022-12-08 05:30:17 -03:00
parent 3b319573ee
commit b24723467e
106 changed files with 1010 additions and 8186 deletions

View File

View File

@@ -0,0 +1,35 @@
from yoshi_otter.algebra.integral.double import Double
import unittest
class MyTestCase(unittest.TestCase):
def setUp(self):
def g(x, y):
return x*y
self.g = g
def test_class_instantiation(self):
Double(self.g)
def test_riemann(self):
double = Double(self.g)
integral = double.riemann(0, 1, 0, 1, n=10**3)
self.assertAlmostEqual(integral, .25, 2)
def test_simpson(self):
double = Double(self.g)
integral = double.simpson(0, 1, 0, 1, n=10)
self.assertAlmostEqual(integral, .25, 7) # add assertion here
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,35 @@
from yoshi_otter.algebra.integral.simple import Simple
import unittest
class MyTestCase(unittest.TestCase):
def setUp(self):
def f(x):
return 2*x
self.f = f
def test_class_instantiation(self):
Simple(self.f)
def test_riemann(self):
simple = Simple(self.f)
integral = simple.riemann(0, 1)
self.assertAlmostEqual(integral, 1, 5)
def test_simpson(self):
simple = Simple(self.f)
integral = simple.simpson(0, 1)
self.assertAlmostEqual(integral, 1, 5) # add assertion here
if __name__ == '__main__':
unittest.main()