예제 #1
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_ln(self):
     form = ac_formula.Function('f', Ln(Variable('x')))
     deriv = ac_formula.Function(label='f',body=Power(base=Variable(label='x'),exponent=-1),deriv_order=1)
     np.testing.assert_equal(form.deriv(), deriv, deriv_message(form, deriv))
예제 #2
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_e_equivalent(self):
     form = ac_formula.Function('f', E(Variable('x')))
     np.testing.assert_almost_equal(form.integrate('x').eval({'x': 5}), 148.413,3)
예제 #3
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_ln_equivalent(self):
     form = ac_formula.Function('f', Ln(Variable('x')))
     np.testing.assert_almost_equal(form.integrate('x').eval({'x': 42}), 114.982,3)
예제 #4
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_log(self):
     form = ac_formula.Function('f', Log(Constant(3),Variable('x')))
     integral = ac_formula.Function('f',Sum(Product(Product(Variable('x'),Sum(Ln(Variable('x')),
                  ac_formula.Negative(Constant(1)))),Power(Ln(Constant(3)),-1)),Variable('C')),-1)
     np.testing.assert_equal(form.integrate('x'), integral, integrate_message(form, integral))
예제 #5
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_cos_equivalent(self):
     form = ac_formula.Function('f', Cos(Variable('x')))
     np.testing.assert_almost_equal(form.integrate('x').eval({'x': 7}), 0.657,3)
예제 #6
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_power_equivalent(self):
     form = ac_formula.Function('f', Power(Variable('x'), 3))
     np.testing.assert_equal(form.integrate('x').eval({'x': 11}), 3660.25)
예제 #7
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_e(self):
     form = ac_formula.Function('f', E(Variable('x')))
     integral = ac_formula.Function('f',Sum(E(Variable('x')),Variable('C')),-1)
     np.testing.assert_equal(form.integrate('x'), integral, integrate_message(form, integral))
예제 #8
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_five_log_e_x(self):
     form = ac_formula.Function('f', Log(Constant(5), E(Variable('x'))))
     deriv = ac_formula.Function(label='f',body=Power(base=Ln(argument=Constant(value=5)),exponent=-1),deriv_order=1)
     np.testing.assert_equal(form.deriv(), deriv, deriv_message(form, deriv))
예제 #9
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_sin_squared_x(self):
     form = ac_formula.Function('f', Power(Sin(Variable('x')), 2))
     deriv = ac_formula.Function(label='f',body=Product(left=Product(left=Constant(value=2),right=Cos(argument=Variable(label='x'))),right=Sin(argument=Variable(label='x'))),deriv_order=1)
     np.testing.assert_equal(form.deriv(), deriv, deriv_message(form, deriv))
예제 #10
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_five_to_the_e_x(self):
     form = ac_formula.Function('f', Exponent(Constant(5), E(Variable('x'))))
     deriv = ac_formula.Function(label='f',body=Product(left=E(exponent=Variable(label='x')),right=Product(left=Exponent(base=Constant(value=5),exponent=E(exponent=Variable(label='x'))),right=Ln(argument=Constant(value=5)))),deriv_order=1)
     np.testing.assert_equal(form.deriv(), deriv, deriv_message(form, deriv))
예제 #11
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_ln_x_squared(self):
     form = ac_formula.Function('f', Ln(Power(Variable('x'),2)))
     deriv = ac_formula.Function(label='f',body=Product(left=Constant(value=2),right=Power(base=Variable(label='x'),exponent=-1)),deriv_order=1)
     np.testing.assert_equal(form.deriv(), deriv, deriv_message(form, deriv))
예제 #12
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_log_equivalent(self):
     form = ac_formula.Function('f', Log(Constant(2), Variable('x')))
     np.testing.assert_almost_equal(form.deriv().eval({'x':5}), 0.289, 3)
예제 #13
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_ln_equivalent(self):
     form = ac_formula.Function('f', Ln(Variable('x')))
     np.testing.assert_almost_equal(form.deriv().eval({'x':3}), 0.333, 3)
예제 #14
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_exponent_equivalent(self):
     form = ac_formula.Function('f', Exponent(Constant(2), Variable('x')))
     np.testing.assert_almost_equal(form.deriv().eval({'x':7}), 88.723, 3)
예제 #15
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_product_equivalent(self):
     form = ac_formula.Function('f', Product(Variable('x'), Variable('y')))
     np.testing.assert_equal(form.integrate('x').eval({'x': 8, 'y': 2}), 64)
예제 #16
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_e_x_squared_equivalent(self):
     form = ac_formula.Function('f', E(Power(Variable('x'),2)))
     np.testing.assert_almost_equal(form.deriv().eval({'x':5}), 720048993373.859, 3)
예제 #17
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_sum_equivalent(self):
     form = ac_formula.Function('f', Sum(Variable('x'), Variable('y')))
     np.testing.assert_equal(form.integrate('x').eval({'x': 1, 'y': 9}), 9.5)
예제 #18
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_five_to_the_e_x_equivalent(self):
     form = ac_formula.Function('f', Exponent(Constant(5), E(Variable('x'))))
     np.testing.assert_almost_equal(form.deriv().eval({'x':-1}), 1.07, 3)
예제 #19
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_tan(self):
     form = ac_formula.Function('f', Tan(Variable('x')))
     integral = ac_formula.Function('f',Sum(ac_formula.Negative(Ln(Cos(Variable('x')))),Variable('C')),-1)
     np.testing.assert_equal(form.integrate('x'), integral, integrate_message(form, integral))
예제 #20
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_ln_x_squared_equivalent(self):
     form = ac_formula.Function('f', Ln(Power(Variable('x'),2)))
     np.testing.assert_equal(form.deriv().eval({'x':8}), 0.25)
예제 #21
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_exponent(self):
     form = ac_formula.Function('f', Exponent(Constant(3), Variable('x')))
     integral = ac_formula.Function('f',Sum(Product(Exponent(Constant(3),Variable('x')),
                                         Power(Ln(Constant(3)),-1)),Variable('C')),-1)
     np.testing.assert_equal(form.integrate('x'), integral, integrate_message(form, integral))
예제 #22
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_five_log_e_x_equivalent(self):
     form = ac_formula.Function('f', Log(Constant(5), E(Variable('x'))))
     np.testing.assert_almost_equal(form.deriv().eval({'x':3}), 0.621, 3)
예제 #23
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_sin_equivalent(self):
     form = ac_formula.Function('f', Sin(Variable('x')))
     np.testing.assert_almost_equal(form.integrate('x').eval({'x': -1}), -0.54,3)
예제 #24
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_sin_squared_x_equivalent(self):
     form = ac_formula.Function('f', Power(Sin(Variable('x')), 2))
     np.testing.assert_almost_equal(form.deriv().eval({'x': 1.5 * math.pi}), 0, 3)
예제 #25
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_tan_equivalent(self):
     form = ac_formula.Function('f', Tan(Variable('x')))
     np.testing.assert_almost_equal(form.integrate('x').eval({'x': 13}), 0.097,3)
예제 #26
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_power(self):
     form = ac_formula.Function('f', Power(Variable('x'), 3))
     integral = ac_formula.Function('f',Sum(Product(Constant(0.25),Power(Variable('x'),4)),Variable('C')),-1)
     np.testing.assert_equal(form.integrate('x'), integral, integrate_message(form, integral))
예제 #27
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_exponent_equivalent(self):
     form = ac_formula.Function('f', Exponent(Constant(3), Variable('x')))
     np.testing.assert_almost_equal(form.integrate('x').eval({'x': 7}), 1990.693,3)
예제 #28
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_variable_y_equivalent(self):
     form = ac_formula.Function('f', Variable('y'))
     np.testing.assert_equal(form.integrate('x').eval({'x': 3, 'y': 4}), 12)
예제 #29
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_log_equivalent(self):
     form = ac_formula.Function('f', Log(Constant(3),Variable('x')))
     np.testing.assert_almost_equal(form.integrate('x').eval({'x': 72}), 214.744,3)
예제 #30
0
파일: ac_tests.py 프로젝트: Verrem98/v1ac
 def test_e(self):
     form = ac_formula.Function('f', E(Variable('x')))
     deriv = ac_formula.Function(label='f',body=E(exponent=Variable(label='x')),deriv_order=1)
     np.testing.assert_equal(form.deriv(), deriv, deriv_message(form, deriv))