# Financial library functions

These financial functions are not built-in to Analytica, but are located in the Financial library installed with Analytica.

## Calloption(S, X, T, r, theta)

Calculates the value of a call option using the Black-Scholes formula. For further information on the Black-Scholes model for option pricing see Basic Black-Scholes: Option Pricing and Trading by Timothy Falcon Crack.

Parameters:

`S` = price of security now
`X` = exercise price
`T` = time in years to exercise
`r` = risk-free interest rate
`theta` = volatility of security

Library: Financial (add-in library)

Syntax: `Calloption(S, X, T, r, theta: Numeric)`

Example:

` Calloption(50, 50, 0.25, 0.05, 0.3) → 3.292`

## Putoption(S, X, T, r, theta)

Calculates the value of a put option using the Black-Scholes formula. For further information on the Black-Scholes model for option pricing see Basic Black-Scholes: Option Pricing and Trading by Timothy Falcon Crack.

Parameters:

`S` = price of security now
`X` = exercise price
`T` = time in years to exercise
`r` = risk-free interest rate
`theta` = volatility of security

Library: Financial (add-in library)

Syntax: `Putoption(S, X, T, r, theta: Numeric)`

Example:

`Putoption(50, 50, 0.25, 0.05, 0.3) → 2.67`

## Capm(Rf, Rm, Beta)

Calculates the expected stock return under the Capital Asset Pricing Model (CAPM). For more, see Black, F., Jensen, M., and Scholes, M. "The Capital Asset Pricing Model: Some Empirical Tests,” in M. Jensen ed., Studies in the Theory of Capital Markets. (1972).

Parameters:

`Rf` = risk free rate
`Rm` = market return
`Beta` = beta of individual stock. Beta is the relative marginal contribution of the stock to the market return, defined as the ratio of the covariance between the stock return and market return, to the variance in the market return.

Library: Financial (add-in library)

Syntax: `Capm(Rf, Rm, Beta: Numeric)`

Example:

`Capm(8%, 12%, 1.5) → 0.14`

## CostCapme(rOpp, rD, Tc, L)

This function calculates Miles and Ezzell’s (M/E) formula for adjusting the weighted average cost of capital for financial leverage. The M/E formula works when the firm adjusts its future borrowing to keep debt proportions constant.

Parameters:

`rOpp` = opportunity cost of capital
`rD` = expected return on debt
`Tc` = net tax saving per dollar of interest paid. This is difficult to pin down in practice and is usually taken as the corporate tax rate.
`L` = debt-to-value ratio

Library: Financial (add-in library)

Syntax: `CostCapme(rOpp, rD, Tc, L: Numeric)`

Example:

`CostCapme(14%, 8%, 35%, 0.5) → 0.1252`

## CostCapmm(rAllEq, Tc, L)

This function calculates Modigliani and Miller’s (M/M) formula for adjusting the weighted average cost of capital for financial leverage. The M/M formula works for any project that is expected to:

1. Generate a level, perpetual cash flow.
2. Support fixed permanent debt.

Parameters:

`rAllEq` = cost of capital under all-equity financing
`Tc` = net tax saving per dollar of interest paid. This is difficult to pin down in practice and is usually taken as the corporate tax rate.
`L` = debt-to-value ratio

Library: Financial (add-in library)

Syntax: `CostCapmm(rAllEq, Tc, L: Numeric)`

Example:

`CostCapmm(20%, 35%, 0.4) → 0.172`

## Implied_volatility_c(S, X, T, r, p)

This function calculates the implied volatility of a call option, based on using the Black-Scholes formula for options.

Parameters:

`S` = price of security now
`X` = exercise price
`T` = time in years to exercise
`r` = risk-free interest rate
`p` = option price

Library: Financial (add-in library)

Syntax: `Implied_volatility_c(S, X, T, r, p: atomic numeric)`

Example:

`Implied_volatility_c(50, 35, 4, 6%, 15) &rarr 3.052e-005`

## Implied_volatility_p(S, X, T, r, p)

This function calculates the implied volatility of a put option, based on using the Black-Scholes formula for options.

Parameters:

`S` = price of security now
`X`» = exercise price
`T` = time in years to exercise
`r` = risk-free interest rate
`p` = option price

Library: Financial (add-in library)

Syntax: `Implied_volatility_p(S, X, T, r, p: atomic numeric)`

Example:

`Implied_volatility_p(50, 35, 4, 6%, 15) → 9.416e-001`

## Pvperp(C, rate)

Pvperp() calculates the present value of a perpetuity (a bond that pays a constant amount in perpetuity).

Parameters:

`C` = constant payment amount
`rate` = interest rate per period

Library: Financial (add-in library)

Syntax: `Pvperp(C, rate: Numeric)`

Example:

`Pvperp(200, 8%) → 2500`

## Pvgperp(C1, rate, growth)

Pvgperp() calculates the present value of a growing perpetuity (a bond that pays an amount growing at a constant rate in perpetuity).

Parameters:

`C1` = payment amount in year 1
`rate` = interest rate per period
`growth` = growth rate per period

Library: Financial (add-in library)

Syntax: `Pvgperp(C1, rate, growth: Numeric)`

Example:

`Pvgperp(200, 8%, 6%) → 10K`

## Wacc(Debt, Equity, rD, rE, Tc)

Wacc() calculates the after-tax weighted average cost of capital, based on the expected return on a portfolio of all the firm’s securities. Used as a hurdle rate for capital investment.

Parameters:

`Debt` = market value of debt
`Equity` = market value of equity
`rD` = expected return on debt
`rE` = expected return on equity
`Tc` = corporate tax rate

Library: Financial (add-in library)

Syntax: `Wacc(Debt, Equity, rD, rE, Tc: Numeric)`

Example:

`Wacc(1M, 3M, 8%, 16%, 35%) → 0.133`