###Development version, written by Kees van Schaik (k.van.schaik@bath.ac.uk)
###How to use:
###1. Fill in a formula for G and values for a and b.
###2. Click 'evaluate' left below this cell (or hit [enter] while holding down [shift] key) and wait for the output to appear.
###Load the algorithm:
load(DATA+'optStoppLegendre.sage')
###Give a formula for the payoff function G and end points a<b (recall G(a)=G(b)=0 is needed):
G(x)=-x*(x-1/8)*(x-1/4)*(x-1/3)*(x-1)*(x-3/2)*(x-7/4)*(x-8/5)*(x-2); a=0; b=2
OSL=OptStoppLegendre(G,a,b)
###replace 'showProgress=false' below by 'showProgress=true' to get a detailed report of the progress in the algorithm:
time OSL.runAlgorithm(showProgress=false)
OSL.plot().show()
|
|
Time: CPU 4.31 s, Wall: 4.41 s

|