mela

20 Reputation

4 Badges

4 years, 144 days

MaplePrimes Activity


These are replies submitted by mela

Thank you very much, @tomleslie.

@tomleslie

Hi, very sorry about that! I have attached the file which couldn't run in Maple 17 and 18.

Thanks for your prompt response!

 

Regards

Mela_25112015.mw

@tomleslie 

Hi again!

I share my files with a colleague who couldn't run the file I sent, even after I converted the file to 1-D Math Input and saving same in .mws format. (I use Maple 2015 Student version, but he uses Maple 17 and 18.). When I tried it by using Maple 18 I receive 

code applied:

names := ['UK_SOL_FIRST', 'ES_SOL_FIRST', 'DK_SOL_FIRST']; ans := Matrix([convert(map(lhs, UK_SOL_FIRST), Vector), seq(convert(`~`[rhs](convert(j, list)), Vector), j in names)]);

Error message:

Error, invalid input: `convert/Vector` expects its 1st argument, V, to be of type {Array, Matrix, Vector, array, list}, but received

Wondering why this is the case. Please any help will be highly appreciated!

 

regards,

@gkokovidis  Thank you so much! This has made my life so easy!

@tomleslie thanks very much for your help! I ran the file you attached and the result appeared as follows:

ans := Vector(4, {(1) = ` 32 x 4 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

Wondering if I'm missing something: is the matrix stored somewhere in maple or meant to display?

 

Thanks again.

@Carl Love 

Many Thanks Carl for your clarification; I'm so grateful!!!!

@Carl Love 

Hi Carl, I just realised I had to be doing guess work for all my solutions (I have from SOL3 to SOL7, within which I intend to carry out various experiments by changing the values of parameters and evaluating their effects on the variables). On each ocassion I have to change the range of almost all the variables before I can get fsolve to work. Is their a way one can just identify that it is a particular variable whose solution range is not good enough to allow fsolve search for solution? In Matlab one just gives initial guess value and fsolve finds the value that makes f(x)=0.

@Carl Love Thanks so very much Carl. I had solved these in matlab and wanted to confirm my results using Maple (hence the choice of the range of variables). I now see where the problem lies; sorted and results are perfect!

 

@tomleslie Thanks so very much for your help! 

@tomleslie 

I now have the two final equations; a huge thanks to you! However, there are obvious terms that wont cancel/factor out or simplify further (even after trying different methods suggested on Mapleprime, such as collect, factor etc). here are instances:

eq2a:= Y^(-alpha_c)*(-(tau*F_f*(tau*sigma*w^(1-gamma)*r_f^gamma/((sigma-1)*phi))^(-sigma)*w^(1-gamma)*r_f^gamma*M*gamma-r_f*K*phi)/(w^(1-gamma)*r_f^gamma*M*gamma*M^(lambda-1)*Y))^(-1/sigma)*(sigma-1)*phi/(sigma*w^(1-gamma)*r_f^gamma)-A*(-(-1+gamma)*r_f*K/(gamma*w))^alpha_h/w = 0

 

eq3a := sigma*w^(1-gamma)*r_f^gamma*Y/((-(tau*F_f*(tau*sigma*w^(1-gamma)*r_f^gamma/((sigma-1)*phi))^(-sigma)*w^(1-gamma)*r_f^gamma*M*gamma-r_f*K*phi)/(w^(1-gamma)*r_f^gamma*M*gamma*M^(lambda-1)*Y))^(-1/sigma)*(sigma-1)*phi)-M*sigma*w^(1-gamma)*r_f^gamma*M^(lambda-1)*Y*((-(tau*F_f*(tau*sigma*w^(1-gamma)*r_f^gamma/((sigma-1)*phi))^(-sigma)*w^(1-gamma)*r_f^gamma*M*gamma-r_f*K*phi)/(w^(1-gamma)*r_f^gamma*M*gamma*M^(lambda-1)*Y))^(-1/sigma))^(-sigma)/((sigma-1)*phi)-M_f*tau*p_f*M_f^(lambda-1)*Y*(tau*p_f*(-(tau*F_f*(tau*sigma*w^(1-gamma)*r_f^gamma/((sigma-1)*phi))^(-sigma)*w^(1-gamma)*r_f^gamma*M*gamma-r_f*K*phi)/(w^(1-gamma)*r_f^gamma*M*gamma*M^(lambda-1)*Y))^(-1/sigma)*(sigma-1)*phi/(sigma*w^(1-gamma)*r_f^gamma))^(-sigma) = 0

 

For example in eq2a, terms like M*M^(lambda-1) is obviously equal to M^lambda, and M_f*M_f^(lambda-1)= M_f*M_f^(lambda-1)= M_f^lambda in eq3a. Please is there a better way to make these equations simplify further? thanks a great deal for your help!!!!

 

 

@tomleslie thanks for taking time to read through and for your comments/assistance!

@tomleslie 

 

Hi Tomleslie,

Thanks for your response. Sorry for my mistake; its meant to be 10 eq and 10 var. Apart from the 10 variables, the system contains exogenous variables and parameters {A, Phi, Y, gamma, lambda, sigma, tau, F[star], M[bar], M[star],  alpha[c], alpha[h], p[star], r[star]} also

My original aim was to reduce the 10 eqns to 2 which only defines Y and w only in terms of these exogenous variables and parameters. So far, I have eliminated 7 eqns (by subsititing and canselling out terms) to arrive at only 3 eqns given below. These 3 equations can be used to solve for 3 unknowns (Y, w and P):

eq1:= Y^(-alpha[c])/P-A*(-(-1+gamma)*r[star]*K[bar]/(gamma*w))^alpha[h]/w = 0

 

eq2:= r[star]*K[bar]*phi/(w^(1-gamma)*r[star]^gamma*M*gamma)-M^(lambda-1)*Y*(sigma*w^(1-       gamma)*r[star]^gamma/((sigma-1)*phi*P))^(-sigma)-tau*F[star](tau*sigma*w^(1-gamma)*r[star]^gamma/((sigma-1)*phi))^(-sigma) = 0

 

eq3:= P*Y-M*sigma*w^(1-gamma)*r[star]^gamma*M^(lambda-1)*Y*(sigma*w^(1-gamma)*r[star]^gamma/((sigma-1)*phi*P))^(-sigma)/((sigma-1)*phi)-M[star]*tau*p[star]*M[star]^(lambda-1)*Y*(tau*p[star]/P)^(-sigma)=0

 

I tried to go further but it becomes messy and I get terms like 'ln Phi' (natural log Phi). As I intend to use the equations  (with all exogenous variables and parameters clearly shown in the final equation for Y and that for w)  in my research, I'm wondering if there is a way one can go from here. 

@Markiyan Hirnyk 

Hi Hirnyk, actually yis represented in the equation as y[star] (equation 7 below). What I was basically asking for is how to use maple to eliminate the other endogenous variables (q, y[d], y[star], y[x], H,  p[d], P and P[v]), by sustituting equations as approriate, such that the only two equations left will determine only two unknowns (i.e., Y and w). 

eq1; P[v] = w^(1-gamma)*r[star]^gamma;
eq2; w*H/M[bar] = (1-gamma)*P[v]*q/Phi;
eq3; p[d] = sigma*P[v]/((sigma-1)*Phi;
eq4; Y^(-alpha[c])/P = A*H^alpha[h]/w;
eq5; q = tau*y[x]+y[d];
eq6; y[d] = M[bar]^(lambda-1)*Y*(p[d]/P)^(-sigma);
eq7; y[star] = M[star]^(lambda-1)*Y*(tau*p[star]/P)^(-sigma);
eq8; PY = tau*M[star]*p[star]*y[star]+M[bar]*p[d]*y[d];
eq9; y[x] = F[star]*(tau*p[star])^(-sigma[x]);

Regards,

 

Page 1 of 1