Three factor continuous case

The reader should first read the file for the simpler two-factor case in order to become oriented to the methodology we employ.

Instead of evaluating the entire notebook, it is advised to choose Evaluate Initialization Cells from the Evaluation menu.

Approach: 
1. Section: The basic case.  
2. Section: Numerical test case Create a numerical test case based upon 1980.
3. Section: Calculate KH assuming a CRcr Use an assumed value of CRcr and LB to calculate the capital in human sector.
4. Section: Set up wage functions Need functions to calculate wB, wK, and wA given factors in the production function.
5. Section: Developing yi at the critical point  Get an expression for pi yi for a good at CRcr using human sector, which will be the start for approaching the robot sector.
6. Section: Basic treatment of the robot sector
7. Section: Eliminating kti to create a function for lai.
8. Section: Eliminating lai to create a function for kti. 
9. Section: Determining function for the amount of LA in the robot sector: LAR   Amount of Type A in robot section is LAR. Assuming a value of LAH (Type A in human), integrate lai from CR 0 to CRcr. 
10. Section: Calculations of KTR (similar to section 9) using kti function 
11. Section: Finding the value of CRcr and the distribution of LA from input values Use FindRoot to solve simultaneously two equations: one to insure that the total amount of capital equals Khat (or more generally Kt0) and the other to determine the distribution of LA between sectors.
12. Create function to tabulate all relevant quantities.
13. Verification by using 12. above to plot value/good over total range

A hook on the bottom a cell indicates hidden cells. Doubleclick on a cell with a hook to expose the hidden material; a red face font also indicates hidden material. Some cells are nested inside other cells. Double clicking on the bracket containing a list of cells closes that section or subsection

Purpose

The aim of this work is introduce automation into the economy as a new form of capital and to introduce and use the concept of two kinds of workers: Type A and Type B.  We think of automation in terms of robots where one robot is the automation needed to replace one Type B worker.  As capital grows, the cost of capital decreases so that automations previously unaffordable become affordable displacing more workers while slowing the rate at which the return on capital decreases.  Thus we need an economy in which the production of different goods has different costs of automation.

Warning

Warning: Most of the cells in this file are not intended to be executed unless you want to check something. The functions that one might want to use to create plots for example have been made initialization cells. If you want to use the functions here (normally this should not be necessary), evaluate initialization cells in the Evaluation menu above.  To use these functions in plots, etc., evaluate initialization cells in a separate Mathematica notebook “Functions for 2 and 3 factors.nb” in the Evaluation menu for that notebook and then start a new notebook to use them.

1. The basic model

In this model, we assume there are 3 factors of production: Capital, highly skilled labor, which we call Type A labor, and less skilled labor, which we call Type B labor.  The difference between the two kinds of labor is that Type A labor is thought of not being replaceable by any conceiveable robot because the issues Type A workers face are unpredictable and important.  Arbitrarily we assume that Type A labor is 10% of the workforce with Type B the remaining 90% of the workforce. Our aim is to compute the effect of the automation, here called robotization, upon the economy.

Repeat of the welfare approach to the goods market of 2 factor model

The first problem we encounter is that any model based upon maximizing total production will put all resources into the good with the smallest cost of robots. Since people want not just one good, but a variety of goods, this lopsided economy is not realistic.  This overproduction of a single good can be overcome by introducing a welfare moded with at welfare function of the form below will prevent this and result in a production scheme in which pi yi is independent of i . Here pi is the shadow price of good i.

	W=(∑_(ig=1)^NG)log[yi]

where NG is the total number of goods and i is a label of a particular good).

Assume that the goods are arranged in order of increasing cost of robots over the range 1 to NG, and that the cost of a good is proportional to its number in this line. CR[[i]]=cr i.  Here this icr=CRtech/cr. The situation in which the process of automation is stopped by the cost of robots equaling the cost of Type B labor is treated elsewhere. Thus the human sector corresponds to goods over the range icr to NG. Every good in the human range has the same yi. Thus the production of a good in the human sector is yi=YH/(NG-icr).  (The good at icr can be thought of as belonging to either the human or the robot sector.)

We continue the progress of robotization of goods until robotization is terminated by cost of robots reaching the wage of Type B labor.

We assume that production functions are in a 3 term CES form. The basic production function for a good i is given by
	yi=A (((a ki^ρ + b lai^ρ + c lbi^ρ))^(1/ρ))
A considerable body of empirical work exists concerning with estimating the appropriate value of ρ to use. This suggests that ρ=-1 is roughly correct with considerable scatter.  Therefore we’ll immediately specialize to ρ=-1  .

Procedure

Different approaches are used for each sector.

Human sector

The analysis of the system requires determining the value of (Subscript[i, c]) at various values of total capital, Kt, where

Kt=(∑_(i=1)^(OverTilde[n]))((Subscript[Kc, i])+(Subscript[CR, i])(Subscript[R, i]))

where (Subscript[CR, i])has the form

(Subscript[CR, i])=CR0+i

A value of (Subscript[i, c]) determines CRcrit by the immediately preceding equation substituting (Subscript[i, c]) for i.  At this value CRcrit of CR, the wage of robots (Subscript[w, R]) is the cost of capital (Subscript[w, K]) times CRcrit, (Subscript[w, R])=(Subscript[w, K]) CRcrit = (Subscript[w, L]) because the operator is indifferent between robots or type B humans. Thus for an assumed CRcrit, the ratio (Subscript[w, LB])/(Subscript[w, K]) is known. This ratio can relate the amount of capital, KH, in the human sector to the amount of Type B labor LB through the first order condition.

D[Y, LB]/D[Y, K] = wB/wK

where Mathematica notation for derivatives is used, i.e. D[Y,LB] is the partial derivative of Y with respect  to LB, etc.

For ρ=-1, this results in

KH=(((Sqrt[a]) (Sqrt[CRcrit]) LB)/(Sqrt[c]))

Unlike the 2 factor case YH cannot be expressed in terms of CRcrit because it also depends upon LAH, the number of Type A workers in the human sector.

YH=A (((a  KH^ρ + b LAH^ρ + cLB^ρ))^(1/ρ))

KH can be replaced by a function of LB and CRcrit but LAH cannot, i.e. YH[CRcrit,LAH]

The number of firms in the human sector can be calculated from CRcrit and LAH through the relation between CRcrit and (Subscript[i, c]) combined with (OverTilde[n]).  Since all human goods have identical factors, all human produced goods have the same price. Making that price equal to 1, we have for the reference value of each good

value=(Subscript[p, i]) (Subscript[y, i])= ((YH[CRcrit,LAH])/((OverTilde[n])-(Subscript[i, c])))

Because of the previous utility and welfare considerations, the value of any good, robot or human produced, is equal to the value expression above.

Robot sector

For a single good in the robot sector,

(Subscript[y, i])= A (((a ki^ρ + b lai^ρ + c ri^ρ))^(1/ρ))

We are going to need pi.  We  determine it from the equation
wK=pi D[yi,ki]

By setting the derivative of this with respect to R equal to zero, the optimum apportionment of the total capital available to the good, (Subscript[Kt, i]) between conventional capital (Subscript[Kc, i]) and robot capital (Subscript[R, i]) is determined. Then (Subscript[Kc, i]) and (Subscript[R, i]) can be eliminated and replaced in the expression above for (Subscript[p, i]) (Subscript[y, i]) by (Subscript[Kt, i]) resulting for ρ = -1 in
(Subscript[p, i]) (Subscript[y, i])=((kti (b kti+((((Sqrt[a])+(Sqrt[c]) (Sqrt[CR])))^2) lai) wK)/(((((Sqrt[a])+(Sqrt[c]) (Sqrt[CR])))^2) lai))

Unlike the 2 factor case, (Subscript[p, i]) (Subscript[y, i]) is now a function of both lai and kti.

Our aim is to create two functions, KtR[CRcrit,LAH] and LAR[CRcrit,LAH] and then the equations 
KtR[CRcrit,LAH]+KH[CRcrit,LAH]=Kt
LAR[CRcrit,LAH]+LAH =LA
where Kt is the total capital available,and solve them simultaneously for CRcrit and LAH using the FindRoot function.

To do this we need to create kti[CRcrit,LAH] and lai[CRcrit,LAH] and sum them over the robot sector. For the kti[CRcrit,LAH] case, we must eliminate lai from the expression 
(Subscript[p, i]) (Subscript[y, i])=((kti (b kti+((((Sqrt[a])+(Sqrt[c]) (Sqrt[CR])))^2) lai) wKa)/(((((Sqrt[a])+(Sqrt[c]) (Sqrt[CR])))^2) lai)) 
and for lai[CRcrit,LAH] , we must eliminate kti from this equation.

The relation between lai and kti is obtained from the ratio of the expressions wK/wK.  Functions for wK and wA can be developed from the human sector. These involve the unknowns CRcrit and LAH.

D[piyi, kti] = wK
D[piyi,lai] = wA

The ratio of these two equations is 
 
wA/wK = ((b (kti^2))/(((((Sqrt[a])+(Sqrt[c]) (Sqrt[CR])))^2) (lai^2)))


The square root of this equation is used eliminate the undesired quantity either lai or kti from the general equation from pi yi above.

The sums over kti and lai can be converted into integrals over the robot sector giving KtR and LAR as functions of CRcrit.  Both integrals result in analytic expressions.  These are added to the expressions for KH and LAH and the resulting equations solved for CRcrit and LAH. Once these are known any wage or the value of all production can be calculated.

Glossary of symbols and purposes of each section

2. 1980 economy symbols

We need a somewhat realistic reference economy without automation. We choose 1980.

labor = 1980 tax returns filed
YCAL =1980  U.S. GDP  (here CAL stands for calibration not calculated)
Khat = Estimate of 1980 total capital based upon Piketty’s approximation of Khat=4 YCAL
α = estimated capital share of GDP (assumed 1/3)
β = estimated Type A labor’s share of GDP (assumed 2/9)
γ = estimated Type B labor’s share of GDP (assumed 4/9)
ρ = CES exponent of factors
a = coefficient of K^ρ from 1980 numbers
b = coefficient of LA^ρ from 1980 numbers
c  = coefficient of LB^ρ from 1980 numbers a+b+c=1
AF = factor in front of CES production to make it  match 1980 CAL

3. Calculate KH assuming CRcr

The point of this section is to express KH in terms of L, a1, c1 and then to express total human production in terms of L, a1 and c1

YH = CES production function for human sector with ρ = -1
YHf = function for the production function in the human sector.
A = the symbolic coefficient with the same purpose as the numeric AF determined above
a1 = coefficient used instead of a because we need it to be symboiic rather than the numeric a determined above
KH = total capital in the human sector
c1 = coefficient used instead of a because we need it to be symboiic rather than the numeric c determined above
L = total number of human workers
CR = the value of the cost of robots relative to a unit of ordinary capital. We are splitting capital into ordinary and robots
wK = return on capital. Equals price of a human good times D[YH,KH]
wA = wage of Type A labor. Equals price of a human good times D[YH,LA]
wB = wage of Type B labor. Equals price of a human good times D[YH,LB]
CRcr   = wB/wK  and is the point where any lower CR is part of the robot sector and any higher CR is part of the human sector.

3. Create production function for human sector, and a function to calculate KH assuming a CRcr and calculate CRcr1980

YH= production in the human sector.

The point of this section is to determine the value of CR needed to prevent robots in 1980.

The result is CRcr1980v ≡ CR0

4. Set up wage functions

wB= wage of Type B workers
wK = return on capital
wA = wage of Type A workers

5. Developing yi in the human sector and pi yi throughout economy

CRmx= maximum value of CR possible. CRmx=CR0+number of goods
yiH= the production of any single good in the human sector.
yiHf=function for calculating the production of any single good in the human sector.
piyi = product of the price and the production of any good in the economy assuming the price of a human produced good is one.

6. Basic treatment of the robot sector

The purpose of this section is to create the production functions for a good in the robot sector by treating the capital market competion to express yi in terms of the total capital available to produce the good and then to find pi for a good in the robot sector in order to create an expression for piyi

yi = the ith robot production functiom for good i. Initially a function of A, a, b, c, kti, lai, CRi, and ri, ri is eliminated to produce a function of A, a, b, c, kti, lai, and CRi
ri = the number of robots in the ith production function in terms of the total ith capital
CRi = the relative cost of a robot for good i.
pi = price of good i in the robot sector
piyi= value of good in the robot sector

7. Eliminating kti to create a function for lai

Creating an expression for piyi in the robot sector with kti eliminated. Then solving this for lai.

piyil  is introduced to convert piyi into something undefined.
piyila is introduced to convert piyil into something undefined so that lai can be expressed in terms of piyi.
laif[CRi_,LAH_,LB_,CRcr_,A_,a_,b_,c_,CRmx_] = function for lai to be summed over i

8. Eliminating lai to create a function for kti

The process of eliminating kti to create a function for lai is now inverted to eliminate lai to create a function for kti.
Again the new variables laiv, piyika, piyikb to undefine the underlying quantities in order to make them free variables.

ktif[CRi_,LAH_,LB_,CRcr_,A_,a_,b_,c_,CRmx_]

9.  Determining function for the amount of LA in the robot sector: LAR

Converting sum to integral and integrating over lai from CR0 to CRcr to obtain
LARf[LAH_,LB_,CRcr_,A_,a_,b_,c_,CR0_,CRmx_]

10. Calculation of KTR (the total capital in robot section) and RK (number of robots) by integrating kti function.

Converting sum to integral and integrating over kti from CR0 to CRcr to obtain the total capital in the robot sector.
KtRf[LAH_,LB_,CRcr_,A_,a_,b_,c_,CR0_,CRmx_]

Using the relation between kti and ri to create a function for the number of robots.
RKf[LAH_,LB_,CRcr_,A_,av_,bv_,cv_,CR0_,CRmx_]

11. Finding the value of CRcr and the LA distribution from input values

The approach is to use FindRoot with 2 equations to determine CRcr and LAH.
The 2 equations are

LARf[LaH, LBI, CRcr, AF, a, b, c, inparp] + LAH == LAI
KtRf[LAH, LBI, CRcr, AF, a, b, c, inparp] + KHf[CRcr, LBI, a, c] == Ktot

Ansf[Kt0_,LAI_,LBI_,A_,a_,b_,c_,CR0_,CRmx_]  Invokes FindRoot to determine LAH and CRcr

where
Kt0 = the total capital available to the economy
LAI = the total number of Type A workers
LBI = the total number of Type B workers
A = AF multiplier of K 1980  calculated in Section 2
a, b, c =  the multipliers of K calculated in Section 2
CR0 = the value of CR that just prevents the use of robots in the most easily robotized good = 16582. calculated in Section 3.
CRmx= maximum value of CR possible. CRmx=CR0+number of goods.  The value of this is arbitrary as long as it is large enough to gve real values of CRcrit. Its value does affect the answers, but not greatly.

12. Create functions to tabulate all relevant quantities

valuef[Kt0_,LAI_,LBI_,A_,a_,b_,c_,CR0_,CRmx_] is a function to calculate the total value of all goods produced in the economy using the parameters listed in Section 11 above.  It first uses Ansf to determine LAH and CRcr and then inserts these into the expression for piyi to obtain the value of an individual good. Then multiplies by the total number of goods to obtain the total value of the production of the economy.

tResf[Kt0_,LAI_,LBI_,A_,a_,b_,c_,CR0_,CRmx_] calculates the values of

CRcr, KtR, robot KR , KtR-KR, KH, LAH, wK, wA, wB, piyi

The final functions needed are to calculate the shares of production that the 3 factors receive.

Kshare3f[Kt0_,LAI_,LBI_,A_,a_,b_,c_,CR0_,CRmx_]

LAshare3f[Kt0_, LAI_, LBI_, A_, a_, b_, c_, CR0_, CRmx_]

LBshare3f[Kt0_, LAI_, LBI_, A_, a_, b_, c_, CR0_, CRmx_]

13.  Verification by using 12. above to plot value/good over total range

If all is well, a plot of value/good calculated by applying Euler’s theorem on homogeneous functions to each good using kti and lai in the robot sector using the output of tResf.

2. Numerical test case

Once again we need a numerical test case. Because the production function is different, the results for 1980 are different from the 2 factor case treated in a separate Mathematica notebook 2 factor CRcr treatment.

The cell below is an initialization cell.

labor=99.634*10^6;
LBI=.9*labor;
LAI=.1*labor;
(* Output*)
YCAL=2.788*(10^12);
(* Capital Stock as a function of output *)
Khat =4*YCAL;

Developing a scheme for calculating a, b, c from shares.

The first step is to determine a,  b, and c given Kv’s share, Type A’s share and Type B labor’s share.

Y=(A/(a/ Kv+b/LA +(1-a-b)/LB))

Use Euler’s theorem to produce shares. i.e.
wK Kv/Y = Kshare
wA LA/Y = LAshare
wB LB/Y = LBshare

wK=D[Y,Kv]

Kshare=wK Kv/Y

Kshare=(a/(Kv ((a/Kv)+(b/LA)+(c/LB))))

Type A’s share is

Ashare=LA D[Y,LA]/Y

Ashare=(b/(LA ((a/Kv)+(b/LA)+(c/LB))))

And LB’s share is by analogy

Bshare= ((1-a-b)/(LB ((a/Kv)+(b/LA)+((1-a-b)/LB))))

Bshare=(c/(((a/Kv)+(b/LA)+(c/LB)) LB))

FullSimplify[Kshare+Ashare+Bshare]

Invert this

Reduce[Kshare==α&&Ashare==β&&Bshare==γ&&0<α<1&&0<β<1&&0<γ<1&&α+β+γ==1&&Kv>0&&LA>0&&LB>0&&0<a<1&&0<b<1&&0<c<1&&a+b+c==1,{a,b,c},Reals]

ToRules[a==((Kv α)/(LA+Kv α-LA α-LA γ+LB γ))&&b==((a LA-a LA α-a LA γ)/(Kv α))&&c==((a LA LB-b Kv LB α-a LA LB α)/(Kv LA α))]

FullSimplify[{a,b,c}//.{a->((Kv α)/(LA+Kv α-LA α-LA γ+LB γ)),b->((a LA-a LA α-a LA γ)/(Kv α)),c->((a LA LB-b Kv LB α-a LA LB α)/(Kv LA α))}]

The cell below is an initialization cell.

cof[Kv_,LA_,LB_,α_,β_,γ_,ρ_]:={((Kv α)/(Kv α+LB γ-LA (-1+α+γ))),-((LA (-1+α+γ))/(Kv α+LB γ-LA (-1+α+γ))),((LB γ)/(Kv α+LB γ-LA (-1+α+γ)))}

Capital’s share is 1/3, Type A’s share 2/9, and Type B’s share is 4/9 in 1980.

We want capital’s share to be 1/3, Type A’s share to be 2/9, and Type B’s share to be 4/9 in 1980.

The cell below is an initialization cell.

cof[4 2.788 (10^12),99.634*10^5,99.634*10^6 .9,1/3,2/9,4/9,-1]

a=1-5.956054070514504`*^-7-0.000010720897326926106`  (* Initialization cell *)

b=5.956054070514504`*^-7   (* Initialization cell *)

c=0.000010720897326926106` (* Initialization cell *)

AF=YCAL(a/Khat+b/LAI+c/LBI) (* Initialization cell *)

D[(AF/(a/Kv+b/LAI+c/LBI)),Kv]/.Kv-> Khat

D[(AF/(a/Khat+b/LAI+c/LB)),LB]/.LB->LBI

D[(AF/(a/Khat+b/LA+c/LBI)),LA]/.LA-> LAI

3. Create production function for human sector and a function to calculate KH assuming a CRcr

YH= A /(a1 /KH+b1 /LA+ c1/LB)

where a1 is used instead of a because a already has a numerical value, etc.

The cell below is an initialization cell.

YHf[LAH_,KH_,LB_,A_,a_,b_,c_]:=(A/((a/KH)+(b/LAH)+(c/LB)))

YHf[LAI,Khat,LBI,AF,a,b,c]

Checks previous sectiion

D[YHf[LA,KH,LB,A,a1,b1,c1],KH]/. {KH-> Khat,LA-> LAI,LB-> LBI,a1->a,b1-> b,c1-> c,A-> AF}

D[YHf[LA,KH,LB,A,a1,b1,c1],LB]/. {KH-> Khat,LA-> LAI,LB-> LBI,a1->a,b1-> b,c1-> c,A-> AF}

13818.476859875045`/0.08333333333333334`

At the critical value of CRcr=wB/wK

CRcr = D[YH,LB]/D[YH,KH]

CRcr1980=((c1 (KH^2))/(a1 (LB^2)))/.{KH-> Khat,LB->LBI,c1-> c,a1-> a}

This is different from the 2 sector case.

Now solve for KH

Solve[CRcr==((c1 (KH^2))/(a1 (LB^2))),KH]

Introduce the needed functions.

The cell below is an initialization cell.

KHf[CRcr_,LB_,a_,c_]:=(((Sqrt[a]) (Sqrt[CRcr]) LB)/(Sqrt[c]))

KHf[165821.7223185005`,LBI,a,c]

KH3crf[165821.7223185005`,LBI,a3,c3]

Khat

Checks immediately above

4. Set up wage functions

We are going to calculate wB, wK, and wA for arbitrary inputs.

We’ll need the production function for the human sector

The cell below is a reminder of the human production function. It is not an input.

YHf[LAH_,KH_,LB_,A_,a_,b_,c_]:=(A/((a/KH)+(b/LAH)+(c/LB)))

Note the order of arguments in YHf.  LAH and KH are unknowns. The other arguments are known.

Function for wB needed

wB=D[YH,LB]

wBv=wB/. (a1/KH)+(b1/LA)+(c1/LB)-> A/ yHv

checking

wBv/. {c1->c,yHv-> 2.788 (10^12),A->AF,LB-> LBI}

Checks previous section

The cell below is an initialization cell.

wBf[LAH_,KH_,LB_,A_,a_,b_,c_]:=((c ((YHf[LAH,KH,LB,A,a,b,c])^2))/(A LB LB))

Function for wK needed

D[YHf[LA,KH,LB,A,a1,b1,c1],KH]

The cell below is an initialization cell.

wKf[LAH_,KH_,LB_,A_,a_,b_,c_]:=((A a)/(((((a/KH)+(b/LAH)+(c/LB)))^2) (KH^2)))

Function for wA needed

D[YHf[LA,KH,LB,A,a1,b1,c1],LA]

If one guesses a value fo LAH, then can calculate wA/wK

wAdwK=D[YH,LA]/D[YH,KH]

The cell below is an initialization cell.

wAf[LA_,KH_,LB_,A_,a_,b_,c_]:=((A b)/((LA^2) ((((a/KH)+(b/LA)+(c/LB)))^2)))

5. Developing yi in the human sector and pi yi throughout economy

The program is assuming pH=1 to find yi at an arbitrary good in the human sector and thus (pi yi) at CRcr. (Note: Henceforth CRcrit is abbreviated to CRcr.) This simply means dividing the expression for YH by the number of goods in the human sector or by 
NG-iCRcr = CRmx -CRcr . The quantitity CRmx is the maximum value of the cost of robots.  Like NG, CRmx=NG+CR0 is variable that is not known and the results of calculations depend upon its value.

The cell below is an initialization cell.

yiHf[LAH_,CRcr_,LB_,A_,a_,b_,c_,CRmx_] := YHf[LAH,KHf[CRcr,LB,a,c],LB,A,a,b,c] /(CRmx-CRcr)

yiHf[LAI,265821.7224185005`,LBI,AF,a,b,c,400000]

We can set the price of yiH at any value we choose. Choose p[yiH]=1. Then piyi = pi yi = yiH

6. Basic treatment of the robot sector

the production function for a single good i

yi= A(((a (((kti-CRi ri))^ρ)+b (lai^ρ)+c (((lbi+ri))^ρ)))^(1/ρ))

in the robot sector lbi = 0.

yi= A(((a (((kti-CRi ri))^ρ)+b (lai^ρ)+c (ri^ρ)))^(1/ρ))/. ρ-> -1

determine ri using the capital market

The capital market requires that the derivative of yi w.r.t. ri equals zero

sri=Solve[D[yi,ri]==0,{ri}]

Choose the positive root

ri=Factor[ri/.sri[[2]]//PowerExpand]

The expression above gives the number of robots employed by good i in the robot sector

examine new form for yi

ri is automatically substituted into yi

yi=FullSimplify[yi//PowerExpand]

find pi through wK

wK=pi  D[yi,kti]

pis=Solve[wK==pi  D[yi,kti],pi]

pi=pi/.pis[[1]]

FullSimplify[pi yi//PowerExpand]

The above is the expression for pi yi in the robot sector.

7. Eliminating kti to create a function for lai

We must eliminate kti from the equation for piyi just calculated because we need a lai to integrate to LAR.

Repeating the expression for piyi

piyi=((kti (b kti+((((Sqrt[a])+(Sqrt[c]) (Sqrt[CRi])))^2) lai) wK)/(((((Sqrt[a])+(Sqrt[c]) (Sqrt[CRi])))^2) lai))

Eliminate kti from the above by taking the ratio  wA/wK.

FullSimplify[D[yi,lai]/D[yi,kti]//PowerExpand]

skti=Solve[((b (kti^2))/(((((Sqrt[a])+(Sqrt[c]) (Sqrt[CRi])))^2) (lai^2)))==wA/wK,{kti}]

Use the positive root

kti=kti/.skti[[2]]

Since piyi is already defined use a new variable piyil to make it symbolic.

piyil=FullSimplify[((kti (b kti+((((Sqrt[a])+(Sqrt[c]) (Sqrt[CRi])))^2) lai) wK)/(((((Sqrt[a])+(Sqrt[c]) (Sqrt[CRi])))^2) lai))/. kti-> ((((Sqrt[a])+(Sqrt[c]) (Sqrt[CRi])) lai (Sqrt[wA]))/((Sqrt[b]) (Sqrt[wK])))//PowerExpand]

Since piyili is already defined use a new variable piyila to make it symbolic.

slai=Solve[lai wA+((((Sqrt[a])+(Sqrt[c]) (Sqrt[CRi])) lai (Sqrt[wA]) (Sqrt[wK]))/(Sqrt[b]))==piyila,{lai}]

lai=lai/.slai[[1]]

piyi is constant throughout the calculations and is determined by the being the same as at the critical point where piH=1. Thus yiHf[LAH_,KH_,CRcr_,LB_,A_,a_,b_,c_,inpar_] is substituted for piyi in the expression for lai, in addtion we must use the functions for KH, wA, and wK.

The cell below is an initialization cell.

laif[CRi_,LAH_,LB_,CRcr_,A_,a_,b_,c_,CRmx_]:=Module[{piyi,wA,wK,KH,res},KH=KHf[CRcr,LB,a,c];piyi=yiHf[LAH,CRcr,LB,A,a,b,c,CRmx];wA=wAf[LAH,KH,LB,A,a,b,c];wK=wKf[LAH,KH,LB,A,a,b,c];res=(((Sqrt[b]) piyi)/((Sqrt[b]) wA+(Sqrt[a]) (Sqrt[wA]) (Sqrt[wK])+(Sqrt[c]) (Sqrt[CRi]) (Sqrt[wA]) (Sqrt[wK])));Return[res];]

8. Eliminating lai to create a function for kti

In reverse of the previous section, now solve for lai in terms of kti

slai=Solve[((b (kti^2))/(((((Sqrt[a])+(Sqrt[c]) (Sqrt[CRi])))^2) (laiv^2)))==wA/wK,{laiv}]

Substitute this into the expression for piyi

piyika=FullSimplify[((kti (b kti+((((Sqrt[a])+(Sqrt[c]) (Sqrt[CRi])))^2) laiv) wK)/(((((Sqrt[a])+(Sqrt[c]) (Sqrt[CRi])))^2) laiv))/. laiv->(((Sqrt[b]) kti (Sqrt[wK]))/(Sqrt[a wA+2 (Sqrt[a]) (Sqrt[c]) (Sqrt[CRi]) wA+c CRi wA]))//PowerExpand]

skti=Solve[kti ((((Sqrt[b]) wA)/(Sqrt[((((Sqrt[a])+(Sqrt[c]) (Sqrt[CRi])))^2) wA]))+(Sqrt[wK])) (Sqrt[wK])==piyikb,{kti}]

kti=FullSimplify[kti/.skti[[1]]//PowerExpand]

Factor[kti]

Using both the  KHF, yiHf, wK, wA functions, we can substitute for the quantities in the expression and create a function for kti.

The cell below is an initialization cell.

ktif[CRi_,LAH_,LB_,CRcr_,A_,a_,b_,c_,CRmx_]:=Module[{piyi,wA,wK,KH,res},KH=KHf[CRcr,LB,a,c];piyi=yiHf[LAH,CRcr,LB,A,a,b,c,CRmx];wA=wAf[LAH,KH,LB,A,a,b,c];wK=wKf[LAH,KH,LB,A,a,b,c];res=((((Sqrt[a])+(Sqrt[c]) (Sqrt[CRi])) piyi)/(((Sqrt[b]) (Sqrt[wA])+(Sqrt[a]) (Sqrt[wK])+(Sqrt[c]) (Sqrt[CRi]) (Sqrt[wK])) (Sqrt[wK])));Return[res];]

9.  Determining function for the amount of LA in the robot sector: LAR

The issue that arises is that if there are to be no robots in 1980, we must not start CR at 1 but instead at CRcr in 1980.
In the robot sector, we will find that lai and kti depends upon CR.  For this flat case, we must sum

lai[CR] from CR0 to CRcr in order to calculate LAR thus

LAR=(∑_(i=1)^Ncr)lai[i]

However our function for lai is given not in terms of i but rather in terms of CR.  If we assume that CR increases by one for every step in i, we can rewrite this sum as 

LAR[CRcr]=(∑_(i=CR0)^CRcr)lai[CR]
This becomes the integral

LAR[CRcr]=(∫_CR0^CRcr)lai[CR']dCR'
and we start with CR0

Integrate lai analytically

s=Integrate[(((Sqrt[b]) piyi)/((Sqrt[b]) wA+(Sqrt[a]) (Sqrt[wA]) (Sqrt[wK])+(Sqrt[c]) (Sqrt[CR]) (Sqrt[wA]) (Sqrt[wK]))),CR]

Start with CR=CR0

s/. CR-> CR0

And end with CR=CRcr

s/.CR-> CRcr

Subtract the former from the latter to create a function for LAR

The cell below is an initialization cell.

LARf[LAH_,LB_,CRcr_,A_,av_,bv_,cv_,CR0_,CRmx_]:=Module[{piyi,wA,wK,KH,res,},KH=KHf[CRcr,LB,av,cv];piyi=yiHf[LAH,CRcr,LB,A,av,bv,cv,CRmx];wA=wAf[LAH,KH,LB,A,av,bv,cv];wK=wKf[LAH,KH,LB,A,av,bv,cv];(*Print[KH,piyi,wA,wK];*)res=(((Sqrt[b]) piyi (2 (Sqrt[c]) (Sqrt[CRcr]) (Sqrt[wK])-2 ((Sqrt[b]) (Sqrt[wA])+(Sqrt[a]) (Sqrt[wK])) Log[(Sqrt[b]) (Sqrt[wA])+((Sqrt[a])+(Sqrt[c]) (Sqrt[CRcr])) (Sqrt[wK])]))/(c (Sqrt[wA]) wK))-(((Sqrt[b]) piyi (2 (Sqrt[c]) (Sqrt[CR0]) (Sqrt[wK])-2 ((Sqrt[b]) (Sqrt[wA])+(Sqrt[a]) (Sqrt[wK])) Log[(Sqrt[b]) (Sqrt[wA])+((Sqrt[a])+(Sqrt[c]) (Sqrt[CR0])) (Sqrt[wK])]))/(c (Sqrt[wA]) wK));If[Im[res]/Re[res]>(10^(-5)),Print[res]];Return[Re[res]];]

LARf[LAI,LBI,265821.7224185005`,AF,a,b,c,165820.7224185005`,400000]

10. Calculation of KTR (the total capital in robot section) and RK (number of robots) by integrating kti function

KTR development

The issue that arises is that if there are to be no robots in 1980, we must not start CR at 1 but instead at CRcr in 1980.
In the robot sector, we will find that lai and kti depends upon CR.  For this flat case, we must sum

lai[CR] from 1 to CRcr in order to calculate LAR thus

KTR=(∑_(i=1)^NG)lai[i]

However our function for lai is given not in terms of i but rather in terms of CR.  If we assume that CR increases by one for every step in i, we can rewrite this sum as 

KTR[CRt]=(∑_(i=CR0)^CRt)lai[CR]
This becomes the integral

KTR[CR]=(∫_CR0^CR)lai[CR']dCR'
and we start with CR0.

sk=Integrate[((((Sqrt[av])+(Sqrt[CR]) (Sqrt[cv])) piyi)/(((Sqrt[bv]) (Sqrt[wA])+(Sqrt[av]) (Sqrt[wK])+(Sqrt[CR]) (Sqrt[cv]) (Sqrt[wK])) (Sqrt[wK]))),CR]

sk/.CR->CR0

(1/(cv (wK^2)))piyi (-2 (Sqrt[bv]) (Sqrt[CR0]) (Sqrt[cv]) (Sqrt[wA]) (Sqrt[wK])+CR0 cv wK+2 (bv wA+(Sqrt[av]) (Sqrt[bv]) (Sqrt[wA]) (Sqrt[wK])) Log[(Sqrt[bv]) (Sqrt[wA])+((Sqrt[av])+(Sqrt[CR0]) (Sqrt[cv])) (Sqrt[wK])])

sk/. CR-> CRcr

The cell below is an initialization cell.

KtRf[LAH_,LB_,CRcr_,A_,av_,bv_,cv_,CR0_,CRmx_]:=Module[{piyi,wA,wK,KH,res},KH=KHf[CRcr,LB,av,cv];piyi=yiHf[LAH,CRcr,LB,A,av,bv,cv,CRmx];wA=wAf[LAH,KH,LB,A,av,bv,cv];wK=wKf[LAH,KH,LB,A,av,bv,cv];(*Print[KH,piyi,wA,wK];*)res=((piyi (-2 (Sqrt[bv]) (Sqrt[CRcr]) (Sqrt[cv]) (Sqrt[wA]) (Sqrt[wK])+CRcr cv wK+2 (bv wA+(Sqrt[av]) (Sqrt[bv]) (Sqrt[wA]) (Sqrt[wK])) Log[(Sqrt[bv]) (Sqrt[wA])+((Sqrt[av])+(Sqrt[CRcr]) (Sqrt[cv])) (Sqrt[wK])]))/(cv (wK^2)))-(1/(cv (wK^2)))piyi (-2 (Sqrt[bv]) (Sqrt[CR0]) (Sqrt[cv]) (Sqrt[wA]) (Sqrt[wK])+CR0 cv wK+2 (bv wA+(Sqrt[av]) (Sqrt[bv]) (Sqrt[wA]) (Sqrt[wK])) Log[(Sqrt[bv]) (Sqrt[wA])+((Sqrt[av])+(Sqrt[CR0]) (Sqrt[cv])) (Sqrt[wK])]);Return[res];]

KtRf[LAI,LBI,165821.7223185005`,AF,a,b,c,165821.7223185005,400000]

KHf[165821.7223185005`,LBI,a,c]

Develop function for the amount of capital invested in robots

The number of robots is given by the expression previously derived in cell group #6

(((Sqrt[cv]) kti)/(((Sqrt[av])+(Sqrt[cv]) (Sqrt[CR])) (Sqrt[CR])))

The capital invested in robots is given by the CRi ri

CRi(((Sqrt[cv]) kti)/(((Sqrt[av])+(Sqrt[cv]) (Sqrt[CR])) (Sqrt[CR])))

Introducing the expression for kti

((((Sqrt[av])+(Sqrt[CR]) (Sqrt[cv])) piyi)/(((Sqrt[bv]) (Sqrt[wA])+(Sqrt[av]) (Sqrt[wK])+(Sqrt[CR]) (Sqrt[cv]) (Sqrt[wK])) (Sqrt[wK])))

rki=FullSimplify[(((Sqrt[cv]) kti)/(((Sqrt[av])+(Sqrt[cv]) (Sqrt[CR])) (Sqrt[CR])))CR/.kti-> ((((Sqrt[av])+(Sqrt[CR]) (Sqrt[cv])) piyi)/(((Sqrt[bv]) (Sqrt[wA])+(Sqrt[av]) (Sqrt[wK])+(Sqrt[CR]) (Sqrt[cv]) (Sqrt[wK])) (Sqrt[wK])))//PowerExpand]

Factor[(((Sqrt[CR]) (Sqrt[cv]) piyi)/((Sqrt[bv]) (Sqrt[wA]) (Sqrt[wK])+((Sqrt[av])+(Sqrt[CR]) (Sqrt[cv])) wK))]

sRK=Integrate[((((Sqrt[CR]) (Sqrt[cv])) piyi)/(((Sqrt[bv]) (Sqrt[wA])+(Sqrt[av]) (Sqrt[wK])+(Sqrt[CR]) (Sqrt[cv]) (Sqrt[wK])) (Sqrt[wK]))),CR]

sRK/.CR-> CR0

(1/(cv (wK^2)))piyi (-2 (Sqrt[bv]) (Sqrt[CR0]) (Sqrt[cv]) (Sqrt[wA]) (Sqrt[wK])-2 (Sqrt[av]) (Sqrt[CR0]) (Sqrt[cv]) wK+CR0 cv wK+2 ((((Sqrt[bv]) (Sqrt[wA])+(Sqrt[av]) (Sqrt[wK])))^2) Log[(Sqrt[bv]) (Sqrt[wA])+((Sqrt[av])+(Sqrt[CR0]) (Sqrt[cv])) (Sqrt[wK])])

sRK/.CR-> CRcr

The function below is created in case there is a need to know the total number of robots.

The cell below is an initialization cell.

RKf[LAH_,LB_,CRcr_,A_,av_,bv_,cv_,CR0_,CRmx_]:=Module[{piyi,wA,wK,KH,res,CRcr1980},KH=KHf[CRcr,LB,av,cv];piyi=yiHf[LAH,CRcr,LB,A,av,bv,cv,CRmx];wA=wAf[LAH,KH,LB,A,av,bv,cv];wK=wKf[LAH,KH,LB,A,av,bv,cv];(*Print[KH,piyi,wA,wK];*)res=(1/(cv (wK^2)))piyi (-2 (Sqrt[bv]) (Sqrt[CRcr]) (Sqrt[cv]) (Sqrt[wA]) (Sqrt[wK])-2 (Sqrt[av]) (Sqrt[CRcr]) (Sqrt[cv]) wK+CRcr cv wK+2 ((((Sqrt[bv]) (Sqrt[wA])+(Sqrt[av]) (Sqrt[wK])))^2) Log[(Sqrt[bv]) (Sqrt[wA])+((Sqrt[av])+(Sqrt[CRcr]) (Sqrt[cv])) (Sqrt[wK])])-(1/(cv (wK^2)))piyi (-2 (Sqrt[bv]) (Sqrt[CR0]) (Sqrt[cv]) (Sqrt[wA]) (Sqrt[wK])-2 (Sqrt[av]) (Sqrt[CR0]) (Sqrt[cv]) wK+CR0 cv wK+2 ((((Sqrt[bv]) (Sqrt[wA])+(Sqrt[av]) (Sqrt[wK])))^2) Log[(Sqrt[bv]) (Sqrt[wA])+((Sqrt[av])+(Sqrt[CR0]) (Sqrt[cv])) (Sqrt[wK])]);Return[res];]

11. Finding the value of CRcr and the LA distribution from input values

The approach is to use FindRoot with 2 equations.
The 2 equations are

LARf[LaH, LBI, CRcr, AF, a, b, c, inparp] + LAH == LAI
KtRf[LAH, LBI, CRcr, AF, a, b, c, inparp] + KHf[CRcr, LBI, a, c] == Ktot

Create a function to solve the two simultaneous equations and report LAH and CRcr

The cell below is an initialization cell.

Ansf[Kt0_,LAI_,LBI_,A_,a_,b_,c_,CR0_,CRmx_]:=Module[{sol,res},sol=FindRoot[{LARf[LAH,LBI,CRcr,A,a,b,c,CR0,CRmx]+LAH==LAI,KtRf[LAH,LBI,CRcr,A,a,b,c,CR0,CRmx]+KHf[CRcr,LBI,a,c]== Kt0},{{LAH,100000},{CRcr,CR0}}];res={LAH,CRcr}/.sol[[1;;2]];Return[res];]

Ansf[3 Khat,LAI,LBI,AF,a,b,c,5821.72231850054`,700000]

The first number is LHcalc; the second is CRcr. In the calculation FindRoot is adjusting LAH and CRcr to find a solution to the two equations.

12. Create functions to tabulate all relevant quantities

Create a function for the value of the total production of the economy

The cell below is an initialization cell.

valuef[Kt0_,LAI_,LBI_,A_,a_,b_,c_,CR0_,CRmx_]:=Module[{s,LAH,CRcr},s=Ansf[Kt0,LAI,LBI,A,a,b,c,CR0,CRmx];LAH=s[[1]];CRcr=s[[2]];Return[yiHf[LAH,CRcr,LBI,A,a,b,c,CRmx] (CRmx-CR0)];]

valuef[3 Khat,LAI,LBI,AF,a,b,c,165821.72231850054`,700000]

The cell below is an initialization cell.

tResf[Kt0_,LAI_,LBI_,A_,a_,b_,c_,CR0_,CRmx_]:=Module[{ansv,CRcr,KtR,RK,KR,KH,LAH,wK,wA,wB,piyi,res},ansv=Ansf[Kt0,LAI,LBI,A,a,b,c,CR0,CRmx];CRcr=ansv[[2]];LAH=ansv[[1]];KtR=KtRf[LAH,LBI,CRcr,A,a,b,c,CR0,CRmx];RK=RKf[LAH,LBI,CRcr,A,a,b,c,CR0,CRmx];KR=KtR-RK;KH=Kt0-KtR;wK=wKf[LAH,KH,LBI,A,a,b,c];wA=wAf[LAH,KH,LBI,A,a,b,c];wB=wK CRcr;piyi=yiHf[LAH,CRcr,LBI,A,a,b,c,CRmx] ;res={CRcr,KtR,RK,KR,KH,LAH,wK,wA,wB,piyi};Return[res];]

tstRes=tResf[3 Khat,LAI,LBI,AF,a,b,c,165821.7223185005`,700000]

resT=Table[tResf[Khat (1+i),LAI,LBI,AF,a,b,c,165821.7223185005`,700000],{i,0,1,.1}];

MatrixForm[resT]

TableForm[resT,TableHeadings->{{Khat,Khat 1.1,Khat 1.2,Khat 1.3,Khat 1.4,Khat 1.5,Khat 1.6,Khat 1.7,Khat 1.8,Khat 1.9,Khat 2},{CRcr,KtR,"robot KR" ,"KtR-KR",KH,LAH,wK,wA,wB,"piyi"}}]

Ksharef[Kt0_,LAI_,LBI_,A_,a_,b_,c_,CR0_,CRmx_]:=Module[{tRes,wK,wA,wB,pY,Ksh},tRes=tResf[Kt0,LAI,LBI,A,a,b,c,CR0,CRmx]; wK=tRes[[7]];wA=tRes[[8]];wB=tRes[[9]];pY=λ2 Kt0+λ3 LAI+λ4 LBI; Return[λ2 Kt0/pY];]

LAsharef[Kt0_,LAI_,LBI_,A_,a_,b_,c_,CR0_,CRmx_]:=Module[{tRes,wK,wA,wB,pY,Ksh},tRes=tResf[Kt0,LAI,LBI,A,a,b,c,CR0,CRmx]; wK=tRes[[7]];wA=tRes[[8]];wB=tRes[[9]];pY=wK Kt0+wA LAI+wB LBI; Return[wA LAI/pY];]

LBsharef[Kt0_,LAI_,LBI_,A_,a_,b_,c_,CR0_,CRmx_]:=Module[{tRes,wK,wA,wB,pY,Ksh},tRes=tResf[Kt0,LAI,LBI,A,a,b,c,CR0,CRmx]; wK=tRes[[7]];wA=tRes[[8]];wB=tRes[[9]];pY=wK Kt0+wA LAI+wB LBI; Return[wB LBI/pY];]

13. Verification by using tResf results from 12. above to plot value/good over total range

Choose Ktotal=3 Khat and CRmx=700000

tResv=tResf[3 Khat,LAI,LBI,AF,a,b,c,165821.7223185005`,700000]

Define a function for the value of each good in the robot sector.

valueRf[i_,K0_,LA_,LB_,A_,a_,b_,c_,CR0_,CRmx_,tres_]:=Module[{wK,wA,kti,lai,CRcr,LAH},CRcr=tres[[1]];LAH=tres[[6]];wK=tres[[7]];wA=tres[[8]];kti=ktif[CR0+i,LAH,LB,CRcr,A,a,b,c,CRmx];lai=laif[CR0+i,LAH,LB,CRcr,A,a,b,c,CRmx];Return[wK kti+wA lai];]

Below the value for each good is plotted from CR0 to CRcr

ListPlot[Table[{165821.7223185005`+i,valueRf[i,3 Khat,LAI,LBI,AF,a,b,c,165821.7223185005`,700000,tResv]},{i,1,322518.4027777191`-165821.7223185005`,5}],AxesOrigin->{0,0},AxesLabel->{CR,value}]

Below is the value of each good plotted from good 1 to nCRcr

ListPlot[Table[{i,valueRf[i,3 Khat,LAI,LBI,AF,a,b,c,165821.7223185005`,700000,tResv]},{i,1,322518.4027777191`-165821.7223185005`,5}],AxesOrigin->{0,0},AxesLabel-> {good number,value}]

The value of a good in the human sector is the 10th element of the list tResv. It is determined entirely by CRcr and the quantities LB, LAH. Here CRcr=322518.4027777191.

Below the value of each good in the human sector is plotted from CRcr to CRmx

Plot[tResv[[10]],{i,322518.4027777191,700000},PlotRange->{{0,700000},{0,10^7}},AxesLabel->{CR,value}]

Below the value of each good in the human sector is plotted from goodCRcr to nbar

Plot[tResv[[10]],{i,322518.4027777191-165821.7223185005`,700000-165821.7223185005`},PlotRange->{{0,550000},{0,10^7}},AxesLabel->{good number,value}]

The two regions are joined at CRcr.

Plot both regions together x axis is CR.

Show[Plot[tResv[[10]],{i,322518.4027777191,700000},PlotRange->{{0,700000},{0,10^7}},PlotStyle->{Thick},AxesLabel->{CR,value}],ListLinePlot[Table[{165821.7223185005`+i,valueRf[i,3 Khat,LAI,LBI,AF,a,b,c,165821.7223185005`,700000,tResv]},{i,1,322518.4027777191`-165821.7223185005`,10}],PlotStyle->{Red,Thick}],Graphics[{Orange,PointSize[0.03], Point[{tResv[[1]],tResv[[10]]}]}]]

Plot both regions together x axis is good number.

Show[Plot[tResv[[10]],{i,322518.4027777191-165821.7223185005`,700000-165821.7223185005},PlotRange->{{0,550000},{0,10^7}},PlotStyle->{Thick},AxesLabel->{good number,value}],ListLinePlot[Table[{i,valueRf[i,3 Khat,LAI,LBI,AF,a,b,c,165821.7223185005`,700000,tResv]},{i,1,322518.4027777191`-165821.7223185005`,10}],PlotStyle->{Red,Thick}],Graphics[{Orange,PointSize[0.03], Point[{tResv[[1]]-165821.7223185005,tResv[[10]]}]}]]

The vertical scale can be expanded to show the junction.

Show[Plot[tResv[[10]],{i,322518.4027777191,700000},PlotRange-> {{0,700000},{7.35725 10^6,7.3573 10^6}}],ListLinePlot[Table[{165821.7223185005`+i,valueRf[i,3 Khat,LAI,LBI,AF,a,b,c,165821.7223185005`,700000,tResv]},{i,1,322518.4027777191`-165821.7223185005`,10}],PlotStyle->{Red}],Graphics[{Orange,PointSize[0.015], Point[{tResv[[1]],tResv[[10]]}]}]]

These plots show that value is the same for each good to high degree of numerical accuracy using the results for LAH and CRcr from Ansf and the values of wages derived from these quantities.