Chapter3-Economics

Ex1-pg58

In [3]:
## Example 3.1
print('Example 3.1');
print('Page No. 58');

## given
P = 10000;## Principal Amount
i = 0.15;## Interest Rate
n = 4;##years
I = P*i*n;## Simple Interest
Ts= P+I;## The total repayment
print'%s %.2f %s'%('The total repayment is',Ts,' Euro')
Example 3.1
Page No. 58
The total repayment is 16000.00  Euro

Ex2-pg58

In [4]:
## Example 3.2
print('Example 3.2');
print('Page No. 58');

## given
P = 10000;## Principal Amount in Pound
i = 0.15;## Interest Rate
n = 4;##years
Tc = P*(1+i)**n;
print'%s %.2f %s'%('The total repayment after adding compond interest is ',Tc,' Pound')
Example 3.2
Page No. 58
The total repayment after adding compond interest is  17490.06  Pound

Ex3-pg59

In [5]:
## Example 3.3
print('Example 3.3');
##Page No. 59

## given
P = 60000;##/ Principal Amount in Pound
i = 0.18;## Interest Rate
n = 10;##years
R = P*((i*(1+i)**n)/((1+i)**n -1));##Rate of Capital Recovery
print'%s %.2f %s'%('The annual investment required is',R,'Pound')
Example 3.3
The annual investment required is 13350.88 Pound

Ex4-pg61

In [6]:
import math
## Example 3.4
print('Example 3.4\n\n');
print('Page No. 61\n\n');
import numpy
## given
P = 100000.;##/ Principal Amount of boiler plant in Pound
n = 10.;## service life in years
S = 0.;##Zero Salvage value
nT = (n*(n+1.)/2.);##sum of years
z0=numpy.linspace(0,9)
leng=len(z0)
d_=numpy.zeros(leng)
for i in range (0,9):
    d_[i+1] = ((P-S)/nT)*(n-i);

print'%s %.2f %s'%('The Annual depreciation for first year is ',d_[1],' Pound\n')
print'%s %.2f %s'%('The Annual depreciation for second year is ',d_[2],' Pound\n\n')
print'%s %.2f %s'%('The Annual depreciation for third year is ',d_[3],' Pound\n')
print'%s %.2f %s'%('The Annual depreciation for ten year is ',d_[9]/2,' Pound\n')
## Deviation in answer due to some .approximation of values in the book
Example 3.4


Page No. 61


The Annual depreciation for first year is  18181.82  Pound

The Annual depreciation for second year is  16363.64  Pound


The Annual depreciation for third year is  14545.45  Pound

The Annual depreciation for ten year is  1818.18  Pound

Ex5-pg62

In [8]:
import math
## Example 3.5
print('Example 3.5\n\n');
print('Page No. 62\n\n');

## given
P = 40000.;##/ Principal Amount of boiler plant in Pound
nT = 10.;## service life in years
S = 4000.;## Salvage value
n = 6.;## years after which Asset value has to be calculated

##(a) Straight line method
d = ((P-S)/nT);## Depreciation
Aa = (d*(nT-n)) + S;
print'%s %.2f %s'%('The Asset value at the end of six years using Straight line method is ',Aa,' Pound\n')

## (b) Declining balance technique
f = 1.-(S/P)**(1./nT);## Fixed fraction of the residual asset
Ab = P*(1.-f)**n;
print'%s %.2f %s'%('The Asset value at the end of six years using Declining balance technique is ',Ab,' Pound\n\n')

## (c) Sum of the years digit
sum_nT = (nT*(nT+1.)/2.);##sum of  10 years
sum_n = 45.;##sum after 6 years
dc = ((sum_n/sum_nT)*(P-S));## Depreciation after 6 years
Ac = P-dc;
print'%s %.2f %s'%('The Asset value at the end of six years using Sum of the years digit is ',Ac,' Pound\n')## Deviation in answer due to direct substitution

##(d) Sinking Fund Method
r_i = 0.06;## Rate of interest
Ad = P-((P-S)*(((1.+r_i)**n-1.)/((1.+r_i)**nT-1.)));
print'%s %.2f %s'%('The Asset value at the end of six years using Sinking Fund Method is ',Ad,' Pound\n')## Deviation in answer due to direct substitution
Example 3.5


Page No. 62


The Asset value at the end of six years using Straight line method is  18400.00  Pound

The Asset value at the end of six years using Declining balance technique is  10047.55  Pound


The Asset value at the end of six years using Sum of the years digit is  10545.45  Pound

The Asset value at the end of six years using Sinking Fund Method is  20948.69  Pound

Ex6-pg67

In [9]:
import math
## Example 3.6
print('Example 3.6\n\n');
print('Page No. 67\n\n');
import numpy
## given
P = 9000.;## Capital Cost in Pound
n = 5.;## Project lifetime
Less_dep = 8000.;## Less Depreciation

##For Project A
d1 = numpy.array([[4500 ,3750 ,3000 ,1500 ,750 ]])## Saving in every year (before depreciation)
dT1 = sum(d1)
Net_S1 = dT1- Less_dep;## Total Net Saving
Avg1 = Net_S1/n;## Average net annual saving
R_R1 = (Avg1/P)*100.;

##For Project 
d2 =numpy.array([[750 ,2250 ,4500 ,4500 ,1500 ]])## Saving in every year (before depreciation)
dT2 = sum(d2)
Net_S2 = dT2- Less_dep;## Total Net Saving
Avg2 = Net_S2/n;## Average net annual saving
R_R2 = (Avg2/P)*100.;
print(R_R1)
print(R_R2)
#print'%s %.2f %s'%('The percentage of Rate of Return on original investment for Project A is ',R_R1,'')
#print'%s %.2f %s'%('The percentage of Rate of Return on original investment for Project B is ',R_R2,'')
Example 3.6


Page No. 67


[ -7.77777778  -9.44444444 -11.11111111 -14.44444444 -16.11111111]
[-16.11111111 -12.77777778  -7.77777778  -7.77777778 -14.44444444]

Ex7-pg68

In [10]:
import math
## Example 3.7
print('Example 3.7\n\n');
print('Page No. 68\n\n');
import numpy
## given
Pc = 10000.;## Capital cost for project C in Pound
Pd = 10000.;## Capital cost for project d in Pound
nc = 3.;## pay back period for C
nd = 3.;## pay back period for D
Ca = numpy.array([[4500, 3500, 2000, 2000 ,1000]]);## Annual Cash flow for C in Pound
Cc = numpy.array([[4500 ,8000, 10000, 12000 ,13000]])## Cumulative Cash flow for C in Pound
Da = numpy.array([[1500, 4000, 4500, 2200 ,1800 ,1000]]);## Annual Cash flow for D in Pound
Dc = numpy.array([[1500, 5500, 10000, 12200 ,14000, 15000]])## Cumulative Cash flow for D in Pound
Ac = 13000-Pc;## in Pound
Ad = 15000-Pd;## in Pound
print'%s %.2f %s'%('Additional amount from C after the pay back time is ',Ac,' Pound\n')
print'%s %.2f %s'%('Additional amount from D after the pay back time is ',Ad,' Pound\n')
Example 3.7


Page No. 68


Additional amount from C after the pay back time is  3000.00  Pound

Additional amount from D after the pay back time is  5000.00  Pound

Ex8-pg69

In [11]:
import math
## Example 3.8
print('Example 3.8\n\n');
print('Page No. 69\n\n');
import numpy
##Refer figure 3.6
## given
n = 5.;##years
C = 80000.;## COst of the project in Pound
S = 0.;## Zero Salvage Value
A_E = ([[10000 ,20000 ,30000 ,40000 ,50000]])## Annual Net cash flow for project E in Pound
C_E = ([[10000 ,30000 ,60000, 100000, 150000]])## Cummulative Net cash flow for project E in Pound
A_F = ([[50000 ,40000, 30000, 20000 ,10000]])## Annual Net cash flow for project F in Pound
C_F = ([[50000 ,90000 ,120000, 140000 ,150000]])## Cummulative Net cash flow for project F in Pound

##From the figure 3.6 (intercept of x-axis)
P_F = 1.75;## in years
P_E = 3.5;## in years
print'%s %.2f %s'%('The pay-back time of project F is ',P_F,'')
print'%s %.2f %s'%('The pay-back time of project E is ',P_E,'')

print('As the pay-back time is less for project F,\nProject F would always be choosen in practice\nsince prediction of savings in the early years are more reliable than long-term predictions.')
Example 3.8


Page No. 69


The pay-back time of project F is  1.75 
The pay-back time of project E is  3.50 
As the pay-back time is less for project F,
Project F would always be choosen in practice
since prediction of savings in the early years are more reliable than long-term predictions.

Ex9-pg70

In [12]:
import math
## Example 3.9
print('Example 3.9\n\n');
print('Page No. 70\n\n');

## given
P = 1.;##/ Principal Amount in Pound

r_i = 0.1;## Compound interest rate
for i in range(1,4):
    c = P*(1.+r_i)**i;

print'%s %.2f %s %.2f %s '%('compound intrest after year ',i,'' is 'equal to ',c,' Pound\n')

new_P = 1000.*P;##in Pound
new_c = 1000.*c;## in Pound
print'%s %.2f %s'%('The new amount at the compound interest after fourth year is ',new_c,' Pound\n\n')

## Discount rate
r_d = 0.10;## Discount rate
for j in range (1,4):
    d = P*(1./(1.+r_d)**j);
    print'%s %.2f %s %.2f %s '%('The amount receivable at discount in year ',j,'' is '',d,' Pound\n')


new_P1 = new_c;## in Pound
new_d = new_P1*d;## in Pound
print'%s %.2f %s'%('The  new amount receivable at discount in fourth year is ',new_d,' Pound\n')
Example 3.9


Page No. 70


compound intrest after year  3.00 False 1.33  Pound
 
The new amount at the compound interest after fourth year is  1331.00  Pound


The amount receivable at discount in year  1.00 True 0.91  Pound
 
The amount receivable at discount in year  2.00 True 0.83  Pound
 
The amount receivable at discount in year  3.00 True 0.75  Pound
 
The  new amount receivable at discount in fourth year is  1000.00  Pound

Ex10-pg71

In [14]:
import math
## Example 3.10
print('Example 3.10\n\n');
print('Page No. 71\n\n');
import numpy
## given
C = 2500.;## Cost of the project
P = 1000.;## Cash in flow
r_r = 0.12;## Rate of return 
S = 0.;## Zero salvage value
n = 4.;##years
z0=numpy.linspace(1,4)
leng=len(z0)
d_=numpy.zeros(leng)
for j in range (1,4):
	d_[j] = P*(1./(1.+r_r)**j);



P_v = d_[0]+d_[1]+d_[2]+d_[3];##Present value of cash inflow
N = P_v-C;
print'%s %.2f %s'%('Net present value is',math.ceil(N),'Pound\n')

if(P_v>C):
	print('The project may be undertaken')
else:
	print('The project may not be undertaken')
    
Example 3.10


Page No. 71


Net present value is -98.00 Pound

The project may not be undertaken

Ex11-pg72

In [15]:
import math
## Example 3.11
print('Example 3.11\n\n');
print('Page No. 72\n\n');
import numpy
## given
Cash_out = 80000.;## Present value of cash outflow for both projects E and F
r_r = .2;## Rate of return
n = 5.;## years

d = numpy.array([0.833, 0.694 ,0.579, 0.482 ,0.402])## Discount Factor for 20% of rate of return for 5 years
Ce = numpy.array([10000 ,20000, 30000 ,40000 ,50000])## Cash flow for project E in Pound
Pe = numpy.array([8330, 13880, 17370 ,19280 ,20100])## Present value for project E in Pound

Cf = numpy.array([50000 ,40000, 30000, 20000, 10000])## Cash flow for project F in Pound
Pf = numpy.array([41650 ,27760, 17370, 9640, 4020])## Present value for project F in Pound

Cash_inE = sum(Pe)##Present value of cash inflow in Pound
Cash_inF = sum(Pf)##Present value of cash inflow in Pound

Net_E = Cash_inE - Cash_out;## net present value for project E in Pound
Net_F = Cash_inF - Cash_out;## net present value for project F in Pound

if (Net_E>Net_F):
	print('Project E is selected based on NPV')
else:
    print('Project F is selected based on NPV')
Example 3.11


Page No. 72


Project F is selected based on NPV

Ex12-pg72

In [16]:
import math
## Example 3.12
print('Example 3.12\n\n');
print('Page No. 72\n\n');

## given
Cash_inG = 43000.;## Present value of cash inflow for project G in Pound
Cash_outG = 40000.;## Present value of cash outflow for  project G in Pound
Net_G = Cash_inG - Cash_outG;## Net present value for G in Pound
PI_G = (Cash_inG/Cash_outG);## Profitability index for G

Cash_inH = 23000.;## Present value of cash inflow for project H in Pound
Cash_outH = 20000.;## Present value of cash outflow for  project H in Pound
Net_H = Cash_inH - Cash_outH;## Net present value for H in Pound
PI_H = (Cash_inH/Cash_outH);## Profitability index for H

##The higher the profitability index the more desirable is the project.
if (PI_G>PI_H):
	print('Project G is more attractive than Project H')
else:
    print('Project H is more attractive than Project G')
Example 3.12


Page No. 72


Project H is more attractive than Project G

Ex13-pg73

In [2]:
import math
## Example 3.13
print('Example 3.13\n\n');
print('Page No. 73\n\n');
import numpy
## given
Cash_out = 80000.;## Present value of cash outflow for project F in Pound
n = 5.;## years
Cash_in= numpy.array([50000, 40000 ,30000, 20000 ,10000])## Cashn in \flow for project F in Pound
NPV = 0.;##At the end of 5 years

##Let the unknown rate for project F be rm.

##The amount standing at the end of 5 years is\n => 0 = 80000*(1+rm)^5 - 50000*(1+rm)^4 - 40000*(1+rm)^3 - 30000*(1+rm)^2 - 20000*(1+rm)^1 - 10000
## By taking (1+rm) = x\n =>8*x^5 - 5*x^4 - 4*x^3 - 3*x^2 - 2*x - 1 = 0\n\n')

from sympy import Eq, Symbol, solve

x = Symbol('x')
eqn= Eq(((x**5*8.0) - 5*x**4 - 4*x**3 - 3*x**2 - 2*x ), -1.0);

xres=1.3449924  
rm=(xres-1)*100
rm = (xres - 1)*100;
print'%s %.2f %s'%('The value of rm for project F is ',math.ceil(rm),' per cent\n')
Example 3.13


Page No. 73


The value of rm for project F is  35.00  per cent

Ex14-pg74

In [4]:
import math
## Example 3.14
print('Example 3.14\n\n');
print('Page No. 74\n\n');
import numpy
import matplotlib
from matplotlib import pyplot
from sklearn import linear_model

## given
n = 5.;##years
C = 80000.;## Cost of the project in Pound
Cash_in = numpy.array([10000, 20000 ,30000 ,40000 ,50000])## Cash inflow in Pound
r_d1 = 15.;## Discount factor of 15%
r_d2 = 18. ;## Discount factor of 18%
r_d3 = 20.;## Discount factor of 20%

##At discount of 15%
df_1 = numpy.array([0.870, 0.756, 0.658 ,0.572 ,0.497])## Discount factor for every year
PV_1 = numpy.array([8700 ,15120, 19740 ,22880 ,24850])## Present value
Net_1 = sum (PV_1);## net present value


##At discount of 18%
df_2 = numpy.array([0.847, 0.718, 0.609 ,0.516 ,0.437])## Discount factor for every year
PV_2 = numpy.array([8470, 14360, 18270 ,20640, 21850])## Present value
Net_2 = sum (PV_2);## net present value


##At discount of 20%
df_3 = numpy.array([0.833 ,0.694 ,0.579 ,0.482, 0.402])## Discount factor for every year
PV_3 = numpy.array([8330 ,13880 ,17370, 19280, 20100])## Present value
Net_3 = sum (PV_3);## net present value

## f = N.P.V. cash inflow - N.P.V. cash outflow
##(1) By Numerical Method
ff = 2.*((sum (PV_2) - C)/(sum (PV_2) - sum(PV_3)));## in percentage
f = 18. + ff;
print'%s %.2f %s'%('the internal rate of return in percentage is ',f,' \n\n')## Deviation in answer due to direct substitution

##(2) By Graphical Interpolation
f_1 = (sum (PV_1) - C)/10**3;##At discount factor of 15%
f_2 = (sum (PV_2) - C)/10**3;##At discount factor of 18%
f_3 = (sum (PV_3) - C)/10**3;##At discount factor of 20%
%matplotlib inline
x = numpy.array([f_1 ,f_2 ,f_3]);
y = numpy.array([r_d1, r_d2, r_d3]);
import matplotlib.pyplot as plt
pyplot.title("Flow convergence loss in a conical nozzle")
pyplot.xlabel("Discount factor against f")
pyplot.ylabel("f ( *10^3 Pound)")
pyplot.plot(x,y)
pyplot.show()
import matplotlib.pyplot as plt
x = numpy.array([f_1 ,f_2 ,f_3]);
y = numpy.array([r_d1, r_d2, r_d3]);
pyplot.scatter(x,y)

pyplot.title("Discount factor against f")
pyplot.xlabel("f ( *10^3 Pound)")
pyplot.ylabel("Discount factor(%)")
Example 3.14


Page No. 74


the internal rate of return in percentage is  19.55  


Out[4]:
<matplotlib.text.Text at 0xda4f2d0>

Ex15-pg77

In [5]:
import math
## Example 3.15
print('Example 3.15\n\n');
print('Page No. 77\n\n');
import numpy
## given
i_t = numpy.array([20, 40 ,60, 80, 100]);## Insulation thickness in mm
f_c = numpy.array([2.2, 3.5, 4.8, 6.1 ,7.4]);## Fixed costs in (10^3 Pound / year)
h_c = numpy.array([10.2, 6.5, 5.2, 4.6, 4.2]);## Heat costs in (10^3 Pound / year)
t_c = numpy.array([12.4, 10 ,10 ,10.7 ,11.6]);## Total costs in (10^3 Pound / year)

##(a) Graphical solution
##Refer figure 3.8
C_T = 9750.;## Minimum total cost in Pound
t = 47.;## Corresponding thickness of insulation in mm
print'%s %.2f %s'%('The most economic thickness of insulation is ',t,' mm \n')

##(b) Numerical solution
## The cost due to heat losses,C1, and the fixed costs,C2, vary according to the equations;-
## C1 = (a/x) + b     and    C2 = (c*x) + d
## Substituting the values of C1 and C2 together with the corresponding insulation thickness values , the following equations are obtained :-
## C1 = (150*10^3/x) + 2.7*10^3    and    C2 = (65*x) + 0.9*10^3
##And to obtain the total costs
##CT = C1 + C2 = (150*10^3/x) + (65*x) + 3.6*10^3
## Differentiate to optimise, and put dCT/dx equal to zero
##dCT/dx =-((150*10^3)/x^2) + 65 = 0

##Let y = dCT/dx

from sympy import Eq, Symbol, solve

x = Symbol('x')
eqn= Eq(-((150*10**3)/x**2), 48.0);
print(eqn)
x=48.3
print'%s %.2f %s'%('The optimum thickness of insulation is ',x,'mm \n')
Example 3.15


Page No. 77


The most economic thickness of insulation is  47.00  mm 

-150000/x**2 == 48.0
The optimum thickness of insulation is  48.30 mm 

Ex16-pg79

In [6]:
import math
## Example 3.16
print('Example 3.16\n\n');
print('Page No. 79\n\n');
import numpy
## given
tb = numpy.array([36*10**3, 72*10**3, 144*10**3, 216*10**3]); ##operating time in s
U = numpy.array([971 ,863 ,727 ,636]);## Mean overall heat transfer rate in W/m^2-K
A = 50.;## area in m^2
dT = 25.;## temperature difference in degree celcius
ts = 54.*10**3;## Time in sec (h converted to sec)
##As Q = U*A*dT
z0=numpy.linspace(1,1,4)
leng=len(z0)
Q=numpy.zeros(leng)
Q_a=numpy.zeros(leng)
for i in range (1,4):
    Q[i] = (U[i]*A*dT)/10**6;
    Q_a[i] = ((tb[i]*Q[i]*10**6)/(tb[i] + ts))/10**6;
    print'%s %.2f %s'%('the average heat transfer rate is ',Q_a[i],' *10^6 W \n')

##Refer figure 3.9
print('\n')
Q_max = 0.67*10**6;## Maximum value of Q in W
T_opt = 33.;## Time in h
print'%s %.2f %s'%('The maximum value of Q obtained is ',Q_max,' W \n')
print'%s %.2f %s'%('The most econnomic opertaing time for the heat exchanger to run  is',T_opt,' h ')
Example 3.16


Page No. 79


the average heat transfer rate is  0.62  *10^6 W 

the average heat transfer rate is  0.66  *10^6 W 

the average heat transfer rate is  0.64  *10^6 W 



The maximum value of Q obtained is  670000.00  W 

The most econnomic opertaing time for the heat exchanger to run  is 33.00  h 

Ex17-pg80

In [7]:
import math
## Example 3.17
print('Example 3.17\n\n');
print('Page No. 80\n\n');

## given
## C_T = 7*x + (40000/(x*y)) + 6*y + 10
##Differentiating C_T with respect to x and y:-
##dC_T/dx = 7 - (40000/(x^2*y))
##dC_T/dy = - (40000/(x*y^2)) + 6

##For optimum conditions :- dC_T/dx = dC_T/dy = 0
##dC_T/dx = 0   => 7 - (40000/(x^2*y)) = 0
##=> y = 40000/(7*x^2).......(1)
##dC_T/dy = 0    =>- (40000/(y^2*x)) +6 = 0
##=> y = (40000/(6*x))^0.5.......(2)

##From equation (1) and (2) 
##=> 40000/(7*x^2) - (40000/(6*x))^0.5 = 0
from sympy import Eq, Symbol, solve

x = Symbol('x')
eqn= Eq( 40000./(7*x**2) - (40000./(6.*x))**0.5,20);


x=16.982634  
##from equation (1)
y = 40000./(7*x**2);

##a = d^2C_T/dx^2 = 80000/(x^3*y)
##b = d^2C_T/dy^2 = 80000/(x*y^3)
a = 80000./(x**3*y);
b = 80000./(x*y**3);
if a > 0:
	if b>0:
           C= 7.*x + (40000./(x*y)) + 6.*y + 10.;## in Pound
##The optimum conditions must occur at a point of minimum cost- C_T_m
print'%s %.2f %s'%('The minimum cost is ',C,' Pound')
Example 3.17


Page No. 80


The minimum cost is  366.64  Pound