How to expand symbolic exponential numerator to reduce fraction
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponse acceptée
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)
simplify(y_t,'IgnoreAnalyticConstraints',true)
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.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!