乳胶中的二叉树

时间:2019-07-08 20:08:18

标签: latex

对于以下问题,我将不胜感激。

对于一个j周期的时间轴,我想描绘一个直到(包括)周期2(即j = 0,1,2)的二叉树,然后用虚线箭头表示最后一个周期。

    \begin{figure} [H]
        \tikzstyle{bag} = [text width=5em, text centered]
        \tikzstyle{end} = []
        \begin{tikzpicture}[sloped]

           \node (a) at ( 0,0) [bag] {$\$ S_{0,0}$};            %[bag] {$ \$ A $}
           \node (b) at ( 4,-2) [bag] {$S_{1,0}=S_0 d$};        %[bag] {B}
           \node (c) at ( 4,2) [bag] {$S_{1,1}=S_0 u$};     %[bag] {C}
           \node (d) at ( 8,-4) [bag] {$S_{2,0}=S_0 d^2$};      %[bag] {D}
           \node (e) at ( 8,0) [bag] {$S_{2,1}=S_0 d u$};       %[bag] {E}
           \node (f) at ( 8,4) [bag] {$S_{2,2}=S_0 u^2$};       %[bag] {F}
           \draw [->] (a) to node [below] {$(1-p)$} (b);
           \draw [->] (a) to node [above] {$p$} (c);
           \draw [->] (c) to node [below] {$p^2$} (f);
           \draw [->] (c) to node [above] {$(1-p)p$} (e);
           \draw [->] (b) to node [below] {$(1-p)p$} (e);
           \draw [->] (b) to node [above] {$(1-p)^2$} (d);

            %Next, the timeline
            %use a syntax similar to:  
            %                \draw (0,0) node[below=110pt] {$ n=0 $} node[above=110pt] {$ bla...  $}; 
            %for timelines above and below the tree.
            %In this case, only the timeline below the tree is used:
            \draw (0,0) node[below=140pt] {$ j=0 $} node[above=140pt] {$ i=0  $}; 
            \draw (4,0) node[below=140pt] {$ j=1 $} node[above=140pt] {$ i=0,1  $}; 
            \draw (8,0) node[below=140pt] {$ j=2 $} node[above=140pt] {$ i=0,1,2  $} ;                   
            \draw (10,0) node[below=140pt] {$ \cdots $} node[above=140pt] {$ \cdots  $}; 
            \draw (12,0) node[below=140pt] {$ j=T $} node[above=140pt] {$ i=0,1,\cdots,k  $};

        \end{tikzpicture}
        \caption{A binomial tree %
        \label{fig:multiperiodtree}}
    \end{figure}

输出有2个问题:1)节点(2,2)和(2,1)的公式标签分为两行,而节点(2,0)保留在同一行。为什么? 2)如何将虚线箭头描绘为j = T(图底部的时间轴)的状态?

0 个答案:

没有答案