get the size of a binomial/trinomial tree at the given level - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Mathematics : Finance : Lattice Methods : Finance/GetSize

Finance[GetSize] - get the size of a binomial/trinomial tree at the given level

 Calling Sequence GetSize(T, i)

Parameters

 T - binomial or trinomial tree data structure i - positive integer; level

Description

 • The GetSize command returns the number of nodes at level i of the tree T. See GetDescendants for more details about node indexing.

Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$
 > $M:=\mathrm{VasicekModel}\left(0.05,0.03,0.5,0.03\right)$
 ${M}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (1)
 > $T:=\mathrm{ShortRateTree}\left(M,3,20\right)$
 ${T}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2)
 > $\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true}\right)$
 > $\mathrm{GetSize}\left(T,1\right)$
 ${1}$ (3)
 > $\mathrm{GetSize}\left(T,2\right)$
 ${3}$ (4)
 > $\mathrm{GetSize}\left(T,3\right)$
 ${5}$ (5)
 > $\mathrm{GetSize}\left(T,10\right)$
 ${15}$ (6)
 > $\mathrm{GetSize}\left(T,11\right)$
 ${15}$ (7)

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam