MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Finance Pack ListPlot3D

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9607] Re: Finance Pack ListPlot3D
  • From: Leszek Sczaniecki <lsczan at concentric.net>
  • Date: Fri, 14 Nov 1997 21:39:50 -0500
  • Organization: Concentric Internet Services
  • Sender: owner-wri-mathgroup at wolfram.com

Rui Batista wrote:

> I've been writing this simple notebook to analyse the performance of a
> bond.
>
> I'm getting an error with graph3 that I don't understand.
>
> :-)
>
> Needs["Finance`Bonds`"]
> settlement1 = {11, 6, 1997};
> zeroCoupon = Bond[{10, 30, 2000}, 100, 2}]; couponVal[c_, x_] = Value
> [zeroCoupon, settlment1, x]; Plot [couponVal [0, x], {x, 0, .1}]; p[c_]
> = Table[{t, Value[zeroCoupon, {11, 6, 1997+t}, 5/100]}, {t, 0, 4}];
> graph2 = ListPlot [p[0], PlotJoined -> True, FrameLabel -> False]; k[c_]
> = Table [{t, Value [zeroCoupon, {11, 6, 1997+t, r]}, {t, 0, 5}, {r, 0,
> 5/100}];
> graph3 = ListPlot3D [k[0]];
>
> :-(
>
> SurfaceGraphics: :gmat : {{{0,100}}, << 3>>, {{5,100}}}
>     is not a rectangular array larger than 2 x 2.
>
> I hope someone can help me.
>
> Rui Batista
> rbatista at goldcompass.com

 There is nothing wrong with Finance Pack or ListPlot3D. You simply made
several typos and your function k[c_] does not return data in the
format that can be used as input for ListPlot3D. Here is a corrected
version. Though, I am not sure if I guessed correctly what k[c_]
supposed to do.

Needs["Finance`Bonds`"]

settlement1 = {11, 6, 1997};

zeroCoupon = Bond[{0, {10, 30, 2000}, 100, 2}];

couponVal[c_, x_] = Value[zeroCoupon, settlement1, x];

Plot [Evaluate[couponVal [0, x]], {x, 0, .1}];

p[c_]= Table[{t, Value[zeroCoupon, {11, 6, 1997+t}, 5/100]}, {t, 0, 4}];

graph2 =ListPlot [p[0], PlotJoined -> True, FrameLabel -> False];

k[c_] = Table[Value [zeroCoupon, {11, 6, 1997+t}, r], {t, 0, 5}, {r,
0,5/100, 1/100}];

k[0] // N

graph3 = ListPlot3D [k[0]// N];


-Leszek




  • Prev by Date: (Newbie) Replace without Evaluation
  • Next by Date: Re: numerical inverse functions
  • Previous by thread: Finance Pack ListPlot3D
  • Next by thread: Color Printing of simple graphs