I am trying to implement and algorithm and I am not sure how to implement in Python.
The algorithm is given as [e ^ -ax] * [((e ^ by) - (e ^ -ax)) / ((e ^ by) + (e ^ -ax))]
Where:
^represents power ofeis Euler’s number with a value of2.718aandbare constants and given asa = 0.2andb = 0.45- but
xandyare variables whereaandbwill always be>= 0
This is what I have come up with but I am not sure if this is correct. It would be great if anyone can tell me if it’s correct or is there an easier way to do this as it looks very complicated right now.
valueA = 0.2 * x
valueB = 0.45 * y
results = math.pow(math.e, -valueA) * (math.pow(math.e, valueB) - math.pow(math.e, -valueB)) / (math.pow(math.e, valueA) + math.pow(math.e, -valueB))
For computing ex, there’s no need to write:
Instead, use
math.expand write:or: