Turn on thread page Beta

Problem with loops in Mathematica watch

    • Thread Starter
    Offline

    0
    ReputationRep:
    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?
 
 
 
Turn on thread page Beta
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: July 27, 2004
Poll
Who is most responsible for your success at university

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.