clear ;
close all ;
clc ;
sigma = 1 ;
y_es = 1 ;
y_ss = 1 ;
R_ds = 0.015/4 + 1;
beta_h = 1 / R_ds ;
m_b = 0.8 ;
R_ss = 0.045/4 + 1 ;
R_es = 0.045/4 + 1 ;
beta_b = (1 - m_b) / ((R_ss - R_ds) + (1 - m_b)*R_ds) ; 
beta_e = 0.95 ;
xs = 0.9 ;
alpha = 0.4; 
alpha_e = 0.35 ; 
m_e = 0.8 ;
delta = 0.025 ;
ratios = 0.5 ;
m_s = 0.8 ;
alpha_s = 0.55  ;
beta_s = 0.96 ;
%%
lamd_s2s = ratios * (1 - beta_s  * R_ss) ;
lamd_s1s =  ratios  ;
fuzhu1 =  beta_s * lamd_s1s * (1 - delta) - lamd_s1s + lamd_s2s * m_s /R_ss ;
pss = xs * (1 - alpha) ;
mpk_ss = - fuzhu1 /(beta_s *(ratios * pss + 1 - ratios)) ;
ky_s  = alpha_s / mpk_ss ;
k_ss =ky_s ;
iy_s = delta * ky_s ;
i_ss = iy_s ;
iss = iy_s ;
b_ss = m_s * ky_s / R_ss ;
%%
other1 = 1 - beta_e * R_es ;
other2 = (1 - other1 * m_e  /R_es) / beta_e - (1 - delta) ;
ky_e = xs * alpha_e * alpha / other2 ;
k_es = ky_e ;
iy_e = delta * ky_e ;
i_es = iy_e ;
ies = iy_e ;
b_es = m_e  * ky_e  / R_es ;
c_es = xs + b_es - xs * (1- alpha_e) * alpha - pss - i_es - b_es * R_es ;
lamd_es = c_es ^(-1)  ;
llamd_es = other1 /c_es ;
%%
ds = m_b * (b_ss +b_es ) ;
c_bs = ds * ( (R_ss - 1)/m_b -(R_ds - 1) );
lamd_bs = c_bs^(-1) ;
llamd_bs = (1 - beta_b * R_ds) * lamd_bs ;
cs  = 1 - c_es - c_bs - ies - iss ;
%%
zeta_n = 0.5 ;
l_ns = (( xs * (1- alpha_e) * alpha) /cs)^(1/(zeta_n + 1)) ;
w_ns =  xs * (1- alpha_e) * alpha /l_ns ;
fuzhu2 = (ratios * pss + (1 - ratios) ) * (1 - alpha_s) / ratios ;
l_ss = ((fuzhu2)/cs)^(1 /(zeta_n + 1)) ;
w_ss = fuzhu2 /l_ss ;

A_es = 1 /((k_es^(alpha_e) * l_ns^(1 - alpha_e))^(alpha) * 1^(1 - alpha));

mpk_es = alpha_e * alpha  /k_es ;
mpl_es = (1- alpha_e) * alpha  /l_ns ;



A_ss = 1 /(k_ss ^(alpha_s) * l_ss^(1 - alpha_s)) ;

mpl_ss = (1 - alpha_s) /l_ss ;

mpi_es = 0;
mpi_ss = 0;
i_costss = 0;
i_costes = 0;
inflps = 1 ;
infls = 1;
vps = 1 ;
ys = 1  ;
sdfs = beta_h ;
q_es = 1;
q_ss = 1; 

thete = 0.75 ;
z1s = xs /( 1 - thete*sdfs);
z2s = 1 /(1 - thete*sdfs);



save data2.mat




