### Depreciation Functions

The functions in this section calculate depreciation, which is the amount of value that a possession loses over time. These functions are characterized by three parameters: cost, the original cost of the asset; salvage, the value the asset will have at the end of its expected "useful life"; and life, the number of years (or other periods) of the expected useful life.

There are several methods for calculating depreciation that differ in the way they spread the depreciation over the lifetime of the asset.

The b S (`calc-fin-sln`) [`sln`] command computes the "straight-line" depreciation. In this method, the asset depreciates by the same amount every year (or period). For example, `sln(12000, 2000, 5)' returns 2000. The asset costs \$12000 initially and will be worth \$2000 after five years; it loses \$2000 per year.

The b Y (`calc-fin-syd`) [`syd`] command computes the accelerated "sum-of-years'-digits" depreciation. Here the depreciation is higher during the early years of the asset's life. Since the depreciation is different each year, b Y takes a fourth period parameter which specifies which year is requested, from 1 to life. If period is outside this range, the `syd` function will return zero.

The b D (`calc-fin-ddb`) [`ddb`] command computes an accelerated depreciation using the double-declining balance method. It also takes a fourth period parameter.

For symmetry, the `sln` function will accept a period parameter as well, although it will ignore its value except that the return value will as usual be zero if period is out of range.

For example, pushing the vector [1,2,3,4,5] (perhaps with v x 5) and then mapping V M ' [sln(12000,2000,5,\$), syd(12000,2000,5,\$), ddb(12000,2000,5,\$)] RET produces a matrix that allows us to compare the three depreciation methods:

```[ [ 2000, 3333, 4800 ]
[ 2000, 2667, 2880 ]
[ 2000, 2000, 1728 ]
[ 2000, 1333,  592 ]
[ 2000,  667,   0  ] ]
```

(Values have been rounded to nearest integers in this figure.) We see that `sln` depreciates by the same amount each year, syd depreciates more at the beginning and less at the end, and ddb weights the depreciation even more toward the beginning.

Summing columns with V R : + yields [10000, 10000, 10000]; the total depreciation in any method is (by definition) the difference between the cost and the salvage value.