>
|
|
For the first example consider the standard Wiener process.
>
|
|
| (2.1) |
The previous command created a new Maple variable representing the standard Wiener process. This is an ordinary Maple variable with additional attributes containing some information about the underlying stochastic process. This variable is typically accessed in the form , where is the time of interest. For example, the following command can be used to generate some replications of the sample path for the underlying stochastic process.
>
|
|
| (2.2) |
>
|
|
You can now generate a larger sample and use tools from the Statistics package to analyze the generated data.
>
|
|
| (2.3) |
>
|
|
| (2.4) |
>
|
|
| (2.5) |
>
|
|
| (2.6) |
>
|
|
| (2.7) |
>
|
|
| (2.8) |
You can also simulate any expression involving our stochastic variable.
>
|
|
| (2.9) |
>
|
|
>
|
|
| (2.10) |
Simple expressions involving multiple stochastic parameters can be handled the same way.
>
|
|
>
|
|
>
|
|
| (2.11) |
>
|
|
| (2.12) |
Alternatively, you can implement any kind of path function using Maple procedures. This function will be called on every replication of the sample path. In the case of a single stochastic factor the path function will be passed a one-dimensional array containing the sample path. In the case of multiple stochastic factors, the path function will be passed a two-dimensional array where each row contains a sample path for the corresponding stochastic factor.
Consider, for example, a path function that returns In the case when the path function is given explicitly, you must know the number of time steps in advance. You will use time steps in this example, which means that the sample path will contain points.
>
|
|
Now you can compute the expected value of this path function.
>
|
|
| (2.13) |
Compare this to:
>
|
|
| (2.14) |
Consider an example involving two stochastic factors (the same as above).
>
|
|
>
|
|
| (2.15) |
Here is a procedure that computes the expected value of the absorbing Wiener process.
>
|
|
>
|
|
| (2.16) |