For loan repayments, there are formulas in terms of difference equations that deal with finding out loan repayments giving interest rates, and how they are calculated depending on what the rate is and how its compounded (very important).
If it is compounded instantaneously the mathematicians use the exponential function to model this.
For loan repayments, I suggest you take a look at this:
With regards with things like trade-in value, you need to assume that if you make a trade-in you sell it there and then: if you don't then you are dealing with depreciation and this is a really complex subject because depreciation depends on so many things and you get into the issue of valuation which is a complex topic in itself. So if using those formulas, make sure you deal with the situation where the car is liquidated there and then in full.
Actually a lot of these are not so straight-forward and the reason is not so much mathematically: it's because that a lot of the information to make the calculations is hidden.
For example: if you look at lease vs loan, then the actual costs of leasing are not direct unless you find a dealer that says "here is the lease contract: $X for term of blah so much per sub-term plus blah fees" and this is simple. The contract could be horrendous and the bottom line is that it depends on the contract itself.
But in terms of things involving loans and repayments, you should be able to use the annuity and loan repayment results in that PDF, but if the models become more complex then you will need to learn very serious mathematics that banks and hedge funds use to value contracts and promises (i.e. loans).