How to expand symbolic exponential numerator to reduce fraction
3 vues (au cours des 30 derniers jours)
I'm trying to write code to solve some macroeconomic models and I'm running into some issues getting MATLAB to give me my results in simplified form. I want the y_t equation only in terms of A_t and k_t, since L_t should cancel out. MATLAB won't seem to let me distribute the exponent and reduce the fraction unless there is a command I don't know.
Here is my code:
And here is the current output:
What I want is A_t k_t^(alpha). How do I get MATLAB to distribute the exponent?
Paul le 3 Août 2023
syms Y_t A_t K_t alpha L_t k_t w_t y_t
Y_t = A_t*K_t^alpha*L_t^(1-alpha)
lil_y = y_t == Y_t/L_t
labor_eqn = L_t == solve(lil_y, L_t,"Real",true)
y_t = solve(labor_eqn, y_t, "Real", true)
k_eqn = K_t/L_t == k_t
K_t = solve(k_eqn, K_t, "Real", true)
y_t = subs(y_t)
Use simplify with the additional name/value pair
Consider checking into those warnings to make sure the conditions for the solution apply to this problem. Also, it might be beneficial to add appropriate assumptions to the variables. For example, specfying all the variables as positive (if it makes sense to do so) cleans up the warnings and mitigates the need for IgnoreAnalyticConstraints.