MathGroup Archive 2004

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

Search the Archive

Problem with loops in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49693] Problem with loops in Mathematica
  • From: kristofer_eklundh at spray.se (Kristofer Eklundh)
  • Date: Thu, 29 Jul 2004 07:42:57 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi all, 

I am trying to work out the value of S at different nodes in a
binomial tree, using the following formula: 

Table[S u^j d^(n - j) p^j q^(n - j), {j, 0, n}] 

I would like to loop this in some way so that I don't have to assign
new values to n all the time (S, d, p, q are given). I have tried For
and Do, but when i print the result, Mathematica produces n lists that
are equal to the final value of n, and not for n=0,1,..., n-1. 

Anyone who could help me with this?


  • Prev by Date: How to code Conjugate Gradient Method
  • Next by Date: Re: Using "Sum" (i = 1 ... N) in a function definition
  • Previous by thread: Re: How to code Conjugate Gradient Method
  • Next by thread: Re: Problem with loops in Mathematica