Calculate values of a discrete function called V(d) using PYTHON

Job ID: 35307280

Budget: $10 – $30 USD

Calculate the value of a discrete function based on rules as given.

V depends on d, so let V(d), which d stands for days, from d = 0 till d = N

N is thus a input data.

V(d) = V0 - Apps(d) + Returns(d)

V0 is input data.

Apps(d) = 0 if V(d-1) <=SOP
Apps(d) = SOP if V(d-1) > SOP

SOP is input data.

Returns(d) = SOP + gain(t)

t is a day ahead of d.

try must be calculated by the code as follows.

every time you increment d, you verify value of SOP. If SOP is not zero, then you calculate try, otherwise gain(t) equals 0.

try is a result of a random process, which defines if the iteration was successful or not.
if iteration was successful, try will be a number btw 1 and 5, chosen by a Normal Distribution Randomic proccess.
if iteration was not successful, try will be a number btw 30 and 300, chosen by a Normal Distribution Randomic proccess.

Once you have try value, you proceed to calculate gain(t) as follows:

for success result of process were succesfull
gain(t) = 0 for t < d + try,
gain(t) = 0,02 SOP, if t = try,
gain(t) = 0 for t > d + try

for success result of process were failure
gain(t) = 0 till t < d + try
gain(t) = SOP when t = try
gain(t) = 0 when t > d + try

as a summary, or in other words, for each d you have a set of values called gain(t). And gain(t) is zero for most of t, and different of zero
for a very specific value of t, that depends on the value of variable try. Besides, if SOP is zero for the specif d, then gain(t) is full of
zeroes.

at the end: output is V(d)
Related categories: Python Statistics Mathematics