Why does Matlab not simplify this further?
Ältere Kommentare anzeigen
I want Matlab to simplify the first partial derivative of the following function:

With the arguments of the function repressed, the first partial derivative with respect to
is
Matlab gives me the correct derivative but then does not simplify it further:
clear, clearvars
syms x1 x2 p1 p2 l C rho
syms f(p1,p2)
f(p1,p2) = (l.^(1/(1-rho)) *(p1).^(rho/(rho-1))+(1-l).^(1/(1-rho))*(p2).^(rho/(rho-1))).^((rho-1)/rho)
C = f(p1,p2)
x2 = (diff(f,p2))
simplify(x2,'Steps',10)
I tried to define C=f(p1,p2) but it doesn't help. Any ideas what I can do here?
Antworten (1)
Increase the ‘Steps’ value. It will then continue simplifying until it cannot simplify further, or reaches the maximum ‘Steps’ iteration limit. I use 500 here (as I do usually), however it can be either more or less than that, depending on the result you want. (In this instance, increasing it does not change the result.)
Try this —
clear, clearvars
syms x1 x2 p1 p2 l C rho
syms f(p1,p2)
f(p1,p2) = (l.^(1/(1-rho)) *(p1).^(rho/(rho-1))+(1-l).^(1/(1-rho))*(p2).^(rho/(rho-1))).^((rho-1)/rho)
C = f(p1,p2)
x2 = (diff(f,p2))
simplify(x2,'Steps',500)
.
Kategorien
Mehr zu Assumptions finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!







