mela

20 Reputation

4 Badges

10 years, 10 days

MaplePrimes Activity


These are questions asked by mela

Hi,

Please I would like to find out if it is possible to plot from a matrix, for example

1) Plot the first and second rows of a matrix, where y-axis is the first row and x-axis is the second row

2) Plot a 3-D diagram using,e.g., first, second and third rows from a matrix. Or

3) Plot the first row of the matrix on the y-axis and then let the x-axis be a time period (e.g. quarters 1, 2, 3, 4).

I attached my Maple file which is solved using FSOLVE. I would like to (i) plot variable A and parameter T  And (ii) plot variables A and F against parameter T in a 3-D form. 

Your help is highly appreciated.

 

Regards,

 

Mela

 

Hi, I have the equations (below) with different parameters. I'd like to find out if is it possitble to:

(1) Create a loop that solves for values of on of the parameters, T, in the interval -0.3<T<0.3 and obtain the solutions allowing for a grid of 0.01.

That is, if one can first solve for T= -0.3 and then use the loop with increments that raise T by 0.01 each time until T=0.3. Other parameters are held constant at their assigned values.

(2) Generates the corresponding vectors for T and all the endogenous variables.

eq1 := PI_T = alpha*M*(kappa/(1+kappa-sigma)-1):
eq2 := l = alpha*((sigma-1)*kappa/(1+kappa-sigma)+1):
eq3 := M = phi_c^(-kappa)*F:
eq4 := e*F = PI_T*v+T:
eq5 := M*l+L_A = L_s:
eq6 := F*e+A = A_s:
eq7 := A = (1-beta)*(L_s+(1-v)*PI_T-T):
eq8 := A_s = L_A:
eq9 := p = sigma/((sigma-1)*phi):
eq10 := P_Y = M^(lambda/(1-sigma))*p:
eq11 := L_s = N*(theta*P_Y^beta)^(-1/delta):
eq12 := phi = (kappa/(1+kappa-sigma))^(1/(sigma-1))*phi_c:
eq13 := U = delta*theta*L_s/((1+delta)*P_Y^beta)+((1-v)*PI_T-T)/P_Y^beta:

Params:= [ T=0, N = 1, v = 1, beta = .75, lambda = 1, sigma = 5, kappa = 4.8, delta = 2, theta = 2.591350635, alpha = 0.3998699153e-1, e = 0.8333333332e-1]:

Init_Values:= {A_s = .2500000000, l = .9996747882, PI_T = 0.8333333332e-1, L_A = .2500000000, phi = 1.878101496, M = .4168022157, A = .1666666667, p = .6655657336, P_Y = .8283396488, L_s = 2/3, phi_c = 1.2, F = 1, U = 1.326439132 }:


SOL:= fsolve(eval({eq||(1..13)}, Params), Init_Values);

 

Many thanks!!

Hi Please I need help with making the output of my fslolve appear in a way that I can easily copy to an excel.

I am doing analysis for 3 countries and each time I produce a result I copy manually to excel and use 'text to column' and the 'transpose' excel options to arrange the results in order. I do this for almost 20 time because I want to see how hows in parameter affect the variables. is there a way I can convert this to a 32 by 3 matrix so that I can copy all at the same time instead of copying each variable at a time. here is my solve command

UK_SOL_FIRST:= fsolve(eval({eq||(1..32)}, Params_UK_FIRST), InitValue_UK_FIRST);
ES_SOL_FIRST:= fsolve(eval({eq||(1..32)}, Params_ES_FIRST), InitValue_ES_FIRST);
DK_SOL_FIRST:= fsolve(eval({eq||(1..32)}, Params_DK_FIRST), InitValue_DK_FIRST);

The Results

UK_SOL_FIRST:={A_ss = 14.36104896, C_ss = 1.445842138, I_ss = 0.3136706500,

K_ss = 12.54682600, K_v_ss = 125.4682600,

LT_ss = 0.01061009037, L_ss = 4.014721807, N_ss = 0.9307582996,

P_a_ss = 0.9336893751, P_ss = 0.8625403648,

Surp = 0.9890479879, U_b_ss = 0.1781599919,

U_ss = 0.1046105158, V_ss = 0.05052687912, W_max = 1.476989982,

W_min = 0.4879419937, W_ss = 1.826907218,

W_tilde = 3.478049987, Y_ss = 2.428417935, aa_ss = 21.67403493,

chhi = 0.4523413798, f_c_ss = 0.04880034560,

m_ss = 0.03536881539, p_d_ss = 0.9907986980,

x_T = 0.7023268636, y_d_ss = 10.57030302, y_f_ss = 1.174478111,

y_x_ss = 10.57030300, z_ss = 21.14060602,

Profit_ss = 4.094720376, phi_prod = 0.9753885739,

theta_ss = 0.4830000000}

ES_SOL_FIRST:={A_ss = 10.91702785, C_ss = 2.038687975, I_ss = 0.3058575000,

K_ss = 12.23430000, LT_ss = 0.1309315222, L_ss = 2.857497927,

N_ss = 0.8398656215, P_a_ss = 0.9680877046,

P_ss = 0.8638978804, Surp = 2.541617932, U_b_ss = 0.9095925505,

U_ss = 0.1819708847, V_ss = 0.03119500880, W_max = 3.252738093,

W_min = 0.7111201606, W_ss = 3.605202340,

W_tilde = 3.665280790, Y_ss = 2.367929032, aa_ss = 15.67939783,

betta = 0.9909865708, chhi = 0.2898275349,

f_c_ss = 0.6743530978, m_ss = 0.02183650616,

p_d_ss = 0.9939322922, x_T = 0.005556307841,

y_d_ss = 7.853422751, y_f_ss = 1.195945300,

y_x_ss = 7.978400682, z_ss = 15.83182343,

Profit_ss = 3.084421270, phi_prod = 1.009721394,

theta_ss = 0.1714285714}


DK_SOL_FIRST:={A_ss = 16.18893837, C_ss = 1.359886068, I_ss = 0.2487000000,

K_ss = 9.948000000, LT_ss = 0.02282780783, L_ss = 5.834365727,

N_ss = 0.9399351536, P_a_ss = 0.7054445707,

P_ss = 0.8796237740, Surp = 0.6511024854,

U_b_ss = 0.4572819488, U_ss = 0.08450316042,

V_ss = 0.03491187713, W_max = 1.293898615,

W_min = 0.6427961298, W_ss = 2.363825013,

W_tilde = 2.758200925, Y_ss = 1.755529412, aa_ss = 34.56310241,

betta = 0.9851712031, chhi = 0.4499333284,

f_c_ss = 0.1898151486, m_ss = 0.02443831399,

p_d_ss = 1.032636460, x_T = 0.1506134910, y_d_ss = 11.17773688,

y_f_ss = 0.9144278497, y_x_ss = 13.74561008,

z_ss = 24.92334696, Profit_ss = 4.926248216,

phi_prod = 0.7210969276, theta_ss = 0.4131428571}

Hi, the fsolve works perfectly fine when otaining SOL2 below. However, as soon as I change the values of paramters (from 0 values in SOL2 to t_prof = .16, t_r = .16, t_w = .16 in SOL3) fsolve simplmy reproduces the eval results and would not solve! Please your help is highly appreciated. Thanks in advance!

restart;
eq1 := ((1-s)*w)^(1-gamma)*r^gamma-P_v = 0;
eq2 := (1-s)*w*H/M-(1-gamma)*P_v*q/phi = 0;
eq3 := r*(K+K_f)/M-gamma*P_v*q/phi = 0;
eq4 := prof-M*p_d*q+(1-s)*w*H+r*(K+K_f) = 0;
eq5 := -tau*y_x+q-y_d-y_g = 0;
eq6 := p_d-sigma*P_v/((sigma-1)*phi) = 0;
eq7 := y_d-M^(lambda-1)*Y*(p_d/P)^(-sigma) = 0;
eq8 := y_x-F_f*(tau*p_d)^(-sigma_x) = 0;
eq9 := y_f-M_f^(lambda-1)*Y*((1+z)*tau*p_f/P)^(-sigma) = 0;
eq10 := (G*alpha_g+Y)^(-alpha_c)/P-A*H^alpha_h/((1-t_w)*w) = 0;
eq11 := P*Y-(1-t_w)*w*H-(1-t_r)*r*K-(1-t_prof)*prof+T = 0;
eq12 := P*Y-M*p_d*y_d-M_f*(1+z)*tau*p_f*y_f = 0;
eq13 := (1-t_r)*r-r_f = 0;
eq14 := G-y_g*M^((lambda_g-1+sigma_g)/(sigma_g-1)) = 0;
eq15 := s*w*H+M*p_d*y_g-T-t_w*w*H-t_r*r*(K+K_f)-t_prof*prof-z*M_f*tau*p_f*y_f = 0;

SOL2 := fsolve(eval({eq1, eq10, eq11, eq12, eq13, eq14, eq15, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9}, [A = 7.716049383, K = 3.2, K_f = 0, alpha_c = .8, alpha_g = .2, alpha_h = 4, lambda = .5, p_f = 1, phi = .625, s = 0, sigma = 5, sigma_g = 5, sigma_x = 5, t_prof = 0, t_r = 0, t_w = 0, tau = 1.1, y_d = 1, y_f = 1, y_g = .4, y_x = 1, z = 0, lambda_g = .5, gamma = .25, gamma = .25]), {F_f, G, H, M, M_f, P, P_v, T, Y, p_d, prof, q, r, r_f, w}, {F_f = 2 .. 4, G = .1 .. .4, H = .4 .. .8, M = .4 .. .6, M_f = .3 .. .7, P = .8 .. 2, P_v = .4 .. .8, T = -.2 .. .3, Y = .7 .. 3, p_d = .9 .. 1.6, prof = .1 .. .4, q = 1.5 .. 2.7, r = 0.4e-1 .. 0.9e-1, r_f = 0.4e-1 .. 0.9e-1, w = .8 .. 3});

 

SOL3 := fsolve(eval({eq1, eq10, eq11, eq12, eq13, eq14, eq15, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9}, [A = 7.716049383, K = 3.2, K_f = 0, alpha_c = .8, alpha_g = .2, alpha_h = 4, lambda = .5, p_f = 1, phi = .625, s = 0, sigma = 5, sigma_g = 5, sigma_x = 5, t_prof = .16, t_r = .16, t_w = .16, tau = 1.1, y_d = 1, y_f = 1, y_g = .4, y_x = 1, z = 0, lambda_g = .5, gamma = .25, gamma = .25]), {F_f, G, H, M, M_f, P, P_v, T, Y, p_d, prof, q, r, r_f, w}, {F_f = 2 .. 4, G = .1 .. .4, H = .4 .. .8, M = .4 .. .6, M_f = .3 .. .7, P = .8 .. 2, P_v = .4 .. .8, T = -.2 .. .3, Y = .7 .. 3, p_d = .9 .. 1.6, prof = .1 .. .4, q = 1.5 .. 2.7, r = 0.4e-1 .. 0.9e-1, r_f = 0.4e-1 .. 0.9e-1, w = .8 .. 3});

Hi, I have 10 equation system and 10 unknown variables. I however, want to reduce the equations to 2 with two unknowns. I'm wondering how this could be done in maple. The variables are Y, q, yd, y*, yx, H,  pd, w, P and Pv. I intend to solve the equations for Y and w. 

Thanks in advance for your help. The maple file has also been attached.

 

Regards

Small_Open_Economy.mw

 

Page 1 of 1