TITLE: SAMPLE SCRIPT FILE

Contents

This script file is meant to provide a format that can be used for publishing your work. Please note that '%%" signifies the beginning of a 'cell' (if cell mode is enabled - which is the default). The spacing is important. Lines starting with '%' signs immediately below the beginning of a cell is converted into text. This script file replicates the solution to the sample problem 1-4 in the textbook (pages 26--27).

Data Input

Here we define the parameters used in the problem

P=5000;
r=0.085;
ta=17;
n=12;

Solution of the problem

Here we compute the balance $B$ and the time $t$ required in the problem

B=P*(1+r)^ta

t=log(B/P)/(n*log(1+r/n))
B =

   2.0011e+04


t =

   16.3737

Now display the time in a relevant format: (Note that youc an create a cell, such as this one, without naming it)

years=fix(t)

months=ceil((t-years)*12)

format short

% If a comment line is included NOT immediately after the
% beginning of a cell, then the published version includes the comment
% after the output and displays the '%' signs.
years =

    16


months =

     5

In conclusion, the best way to organize a script file so that the published version has the outputs immediately below the command lines is to use multiple cells (delimited by '%%')