lundi 5 octobre 2020

Transforming pseudocode with conditional statements into mathematical equation

I am currently in the process of transforming my programming code into mathematical equations for my bachelor thesis.

My pseudocode looks like this:

for i in range(0, n):
    if X[i] < Y[i] then
         p += X[i] * k1 + (Y[i] - X[i]) * k2
    else
         p += Y[i] * k1
    endif
endfor

My attempt to convert the pseudocode into a mathematical equation:

equation

Would that be mathematically correct? Or are there more intuitive ways?

Aucun commentaire:

Enregistrer un commentaire