# Higher order functions - how should they be defined?

1. Feb 24, 2009

### seanos

I want to write a function that takes other functions as inputs. Specifically I want to define a function F that takes input 't' (time) and 2 distribution functions, D1 and D2, as inputs (each distribution function itself a function of 't').

For a simple example, if function F is the product of these distribution functions at time t then I could write:

F(t) = D1(t) * D2(t)

So far so good. But now, this is where I get stuck, how do I define another function whose definition includes several F functions each using different distribution functions?

To give an example, lets say I want to define a function G which is the difference between two F functions of different distribution functions. Could I write this:

G(t) = F(t, D1(t), D2(t)) - F(t, D2(t), D3(t)) where F(t, X(t), Y(t)) = X(t) * Y(t)

If not, what is a better way to write this?