File size: 2,142 Bytes
389d072
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from visma.functions.structure import FuncOp
from visma.functions.exponential import NaturalLog
import math

########################
# Hyberbolic Functions #
########################


class Sinh(FuncOp):
    """Class for sinh function -- sinh(...)

    Extends:
        FuncOp
    """

    def __init__(self):
        super().__init__()
        self.value = 'sinh'

    def inverse(self, RHS):
        super().inverse(RHS)
        self.__class__ = ArcSinh

    def differentiate(self):
        super().differentiate()
        self.__class__ = Cosh

    def integrate(self):
        self.__class__ = Cosh

    def calculate(self, val):
        return self.coefficient * ((math.sinh(val))**self.power)


class Cosh(FuncOp):
    """Class for cosh function -- cosh(...)

    Extends:
        FuncOp
    """

    def __init__(self):
        super().__init__()
        self.value = 'cosh'

    def inverse(self, RHS):
        super().inverse(RHS)
        self.__class__ = ArcCosh

    def differentiate(self):
        super().differentiate()
        self.__class__ = Sinh

    def integrate(self):
        self.__class__ = Sinh

    def calculate(self, val):
        return self.coefficient * ((math.cosh(val))**self.power)


class Tanh(FuncOp):
    """Class for tanh function -- tanh(...)

        Extends:
            FuncOp
        """

    def __init__(self):
        super().__init__()
        self.value = 'tanh'

    def inverse(self, RHS):
        super().inverse(RHS)
        self.__class__ = ArcTanh

    def differentiate(self):
        super().differentiate()
        self.__class__ = Cosh       # Derivative of Tanh(x) is equal to 1-Tanh^2(x) = Sech^2(x) = Cosh^-2(x), So Class is Cosh, and Power is to be set to (-2).

    def integrate(self):
        self.__class__ = NaturalLog     # Ln(Cosh(x)), value is to be set to Cosh(...).

    def calculate(self, val):
        return self.coefficient * ((math.tanh(val)) ** self.power)

################################
# Inverse Hyperbolic Functions #
################################


class ArcSinh(FuncOp):
    pass


class ArcCosh(FuncOp):
    pass


class ArcTanh(FuncOp):
    pass