예제 #1
0
def test_CMfunc_constant():
    assert CMfunc.sin(2) == np.sin(2)
    assert CMfunc.cos(5) == np.cos(5)
    assert CMfunc.tan(9) == np.tan(9)
    assert CMfunc.arcsin(.5) == np.arcsin(.5)
    assert CMfunc.arccos(.4) == np.arccos(.4)
    assert CMfunc.arctan(.1) == np.arctan(.1)
    assert CMfunc.exp(3) == np.exp(3)
    assert CMfunc.log(
        74088, 42) == np.log(74088) / np.log(42)  #using alternative base

    print('passed constants test')
예제 #2
0
def test_arcsin():
    x = CMG(0.5)
    f = CMfunc.arcsin(x)
    assert (f.val, f.grad) == (np.arcsin(.5), (1 - .5**2)**(-0.5))