Exemplo n.º 1
0
    def test_trig_functions(self):
        """tests for trigonometric functions"""

        a = q.Measurement(0.7853981633974483)
        b = q.Measurement(45)
        c = q.Measurement(0.5)

        res = q.sin(a)
        assert res.value == pytest.approx(0.7071067811865475244)

        res = q.sind(b)
        assert res.value == pytest.approx(0.7071067811865475244)

        res = q.cos(a)
        assert res.value == pytest.approx(0.7071067811865475244)

        res = q.cosd(b)
        assert res.value == pytest.approx(0.7071067811865475244)

        res = q.tan(a)
        assert res.value == pytest.approx(1)

        res = q.tand(b)
        assert res.value == pytest.approx(1)

        res = q.sec(a)
        assert res.value == pytest.approx(1.4142135623730950488)

        res = q.secd(b)
        assert res.value == pytest.approx(1.4142135623730950488)

        res = q.csc(a)
        assert res.value == pytest.approx(1.4142135623730950488)

        res = q.cscd(b)
        assert res.value == pytest.approx(1.4142135623730950488)

        res = q.cot(a)
        assert res.value == pytest.approx(1)

        res = q.cotd(b)
        assert res.value == pytest.approx(1)

        res = q.asin(c)
        assert res.value == pytest.approx(0.523598775598298873077)

        res = q.acos(c)
        assert res.value == pytest.approx(1.047197551196597746154)

        res = q.atan(c)
        assert res.value == pytest.approx(0.463647609000806116214)
Exemplo n.º 2
0
 def func4(x, a, *args):
     return a + args[0] * q.sin(args[1] * x)  # pragma: no cover
Exemplo n.º 3
0
 def func(x, **kwargs):
     return kwargs.get("a") * q.sin(
         kwargs.get("b") * x)  # pragma: no cover
Exemplo n.º 4
0
 def func3(x, *args):
     return args[0] * q.sin(args[1] * x)
Exemplo n.º 5
0
 def model(x, a, b):
     return a * q.sin(b * x)