TimeGrid - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Finance

 TimeGrid
 return an object for time discretization

 Calling Sequence TimeGrid(endtime, timesteps) TimeGrid(timeinterval, timesteps) TimeGrid(gridpoints)

Parameters

 timeinterval - range; length time interval in years timesteps - positive integer; number of steps in the time interval endtime - positive; end of the time interval gridpoints - list or Vector; points in the time grid

Description

 • The TimeGrid command generates discretizing grids for the time space with the given parameters; the command returns a module representing the constructed time grid. This module can be passed to other commands of the Finance package that expect a time grid as one of the parameters; it can also be used as if it were a procedure. Assume for example that the module returned by TimeGrid was assigned to the name T. Then for any positive integer i, $T\left(i\right)$ will return the ith member of the corresponding time grid or issue an error if i exceeds the size of the time grid. For negative i, $T\left(i\right)$ returns the ith from the right element of the time grid. The number of time steps in the created time grid can be accessed using the timesteps export.
 • The calling sequence TimeGrid(endtime, timesteps) creates a uniform time grid on the interval $0..\mathrm{endtime}$ using the specified number of timesteps.
 • The calling sequence TimeGrid(timesteps, timesteps) creates a uniform time grid on the interval $0..\mathrm{endtime}$ using the specified number of timesteps. The parameter timeinterval must be a range of type $\mathrm{t0}..\mathrm{t1}$, where t0 and t1 are non-negative real constants such that $\mathrm{t0}<\mathrm{t1}$.
 • Finally, the calling sequence TimeGrid(gridpoints) can be used to create non-uniform time grids with the specified points. The parameter gridpoints can be either a list or a Vector. The elements of gridpoints must be sorted in ascending order.
 • Note that all time grids must contain the point $0$, which will be added if necessary.

Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$
 > $\mathrm{T1}≔\mathrm{TimeGrid}\left(1.0,10\right):$
 > $\mathrm{n1}≔\mathrm{T1}\left[\mathrm{timesteps}\right]$
 ${\mathrm{n1}}{≔}{10}$ (1)
 > $\left[\mathrm{seq}\left(\mathrm{T1}\left(i\right),i=0..\mathrm{n1}\right)\right]$
 $\left[{0.}{,}{0.1000000000}{,}{0.2000000000}{,}{0.3000000000}{,}{0.4000000000}{,}{0.5000000000}{,}{0.6000000000}{,}{0.7000000000}{,}{0.8000000000}{,}{0.9000000000}{,}{1.000000000}\right]$ (2)
 > $\mathrm{T2}≔\mathrm{TimeGrid}\left(0.5..1.0,10\right):$
 > $\mathrm{n2}≔\mathrm{T2}\left[\mathrm{timesteps}\right]$
 ${\mathrm{n2}}{≔}{11}$ (3)
 > $\left[\mathrm{seq}\left(\mathrm{T2}\left(i\right),i=0..\mathrm{n2}\right)\right]$
 $\left[{0.}{,}{0.5}{,}{0.5500000000}{,}{0.6000000000}{,}{0.6500000000}{,}{0.7000000000}{,}{0.7500000000}{,}{0.8000000000}{,}{0.8500000000}{,}{0.9000000000}{,}{0.9500000000}{,}{1.000000000}\right]$ (4)
 > $\mathrm{T3}≔\mathrm{TimeGrid}\left(\left[1,1.1,1.3,1.6,2.0,3\right]\right):$
 > $\mathrm{n3}≔\mathrm{T3}\left[\mathrm{timesteps}\right]$
 ${\mathrm{n3}}{≔}{6}$ (5)
 > $\left[\mathrm{seq}\left(\mathrm{T3}\left(i\right),i=0..\mathrm{n3}\right)\right]$
 $\left[{0.}{,}{1}{,}{1.1}{,}{1.3}{,}{1.6}{,}{2.0}{,}{3}\right]$ (6)

Compatibility

 • The Finance[TimeGrid] command was introduced in Maple 15.
 • For more information on Maple 15 changes, see Updates in Maple 15.

 See Also