Borrar filtros
Borrar filtros

How to expand symbolic exponential numerator to reduce fraction

2 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Paul
Paul el 3 de Ag. de 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)
Y_t = 
lil_y = y_t == Y_t/L_t
lil_y = 
labor_eqn = L_t == solve(lil_y, L_t,"Real",true)
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
labor_eqn = 
y_t = solve(labor_eqn, y_t, "Real", true)
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
y_t = 
k_eqn = K_t/L_t == k_t
k_eqn = 
K_t = solve(k_eqn, K_t, "Real", true)
K_t = 
y_t = subs(y_t)
y_t = 
Use simplify with the additional name/value pair
simplify(y_t,'IgnoreAnalyticConstraints',true)
ans = 
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.

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by