Ibrahim
Ibrahim

Reputation: 35

I need help to understand a formula

Maths is not my strongest suit and I'm new to python. I need help to understand the following formula:

Net Working Capital= MAX(Total Current Assets−Excess Cash−(Total Current Liabilities−(Total Debt−Long Term Debt)), 0)

I don't know what the MAX is in the equation above and what the zero means. From what I have gathered, the function max(x,0) is called a positive part of the real number x. Also, is it possible to do this calculation in python?

Thanks

Upvotes: 0

Views: 57

Answers (1)

Lewis
Lewis

Reputation: 4595

max(x,0) means "return whichever of these is biggest." It's used there so that the Net Working Capital is never less than zero, i.e., NWC cannot be negative.

In python, this code is:

def net_working_capital(
        total_current_assets, 
        excess_cash, 
        total_current_liabilites, 
        total_debt, 
        long_term_debt
    ):

    return max(total_current_assets - excess_cash - (total_current_liabilites - (total_debt - long_term_debt)), 0)

print(net_working_capital(10000, 1000, 1000, 1000, 1000))
# prints 8000

print(net_working_capital(0, 1000, 1000, 1000, 1000))
# prints 0

Upvotes: 2

Related Questions