MathGroup Archive 2008

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

Search the Archive

Re: ListManipulationQuestion

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93196] Re: ListManipulationQuestion
  • From: lynette <xiaochu at gmail.com>
  • Date: Thu, 30 Oct 2008 02:04:55 -0500 (EST)
  • References: <ge9f0p$95h$1@smc.vnet.net>

I got an email, Let me explain a little bit more about this problem

I think nextprice[...] doesn't return 90.9091 is due to the
typesetting  of the webpage. I tried it again, the nextprice[...]
seems work on single parametre,
but it doesn't work with a list.I re-format it, and put it below.
Please help, thanks a lot.

successors[{s_Integer, {{nhu_Integer, nhd_Integer}, {nlu_Integer,
    nld_Integer}}}] := {
 {1, {{nhu + 1, nhd}, {nlu, nld}}},
 {1, {{nhu, nhd + 1}, {nlu, nld}}},
 {2, {{nhu, nhd}, {nlu + 1, nld}}},
 {2, {{nhu, nhd}, {nlu, nld + 1}}}
 }

\[Delta]hu = 1.2;
\[Delta]hd = 1./\[Delta]hu;
\[Delta]lu = 1.1;
\[Delta]ld = 1./\[Delta]lu;

nextprice[p_, n_] := price[p] Total[Flatten[(n[[2]] - p[[2]]) {{\
[Delta]hu, \[Delta]hd}, {\[Delta]lu, \[Delta]ld}}]];

p_ means previous node, n_ means next node, which is one of the
successors of p_.

input: nextprice[{1, {{0, 0}, {0, 0}}}, #] & /@ successors[{1, {{0,0},
{0, 0}}}]
output: {120., 83.3333, 110., 90.9091}

I cannot get the price of successors as I want. For example,  {1, {{1,
0}, {0, 0}}} which is one of the successor of
present node {1, {{0, 0}, {0, 0}}}.

input: price[{1, {{1, 0}, {0, 0}}}]
output: price[{1, {{1, 0}, {0, 0}}}]








  • Prev by Date: Re: 3D Graphics in a Palette or Dialog
  • Next by Date: Re: ListManipulationQuestion
  • Previous by thread: ListManipulationQuestion
  • Next by thread: Re: ListManipulationQuestion