Info

此问题已关闭。 请重新打开它进行编辑或回答。

how to convert symbolic expression and use solve function to solve equations

3 次查看(过去 30 天)
I used diff(fun,x) to find out analytically some equations. And I wanted to solve these equations using solve function. But I cannot get desirable solutions. Please help me point out what the problems are.
lambda=0.5;
Rbar=2; %R is R bar here;
Rb=1.4;
ro=2;
syms c1 ca cb gamma1 gamma2
e1= 2*lambda*c1^(1-ro)/(1-ro)+(1-lambda)*ca^(1-ro)/(1-ro)+ ...
(1-lambda)*cb^(1-ro)/(1-ro)+gamma1*(c1-cb)+gamma2*(cb-ca);
x1 = diff(e1,c1);
x2 = diff(e1,ca);
x3 = diff(e1,cb);
x4 = diff(e1,gamma1);
x5 = diff(e1,gamma2);
f1 = x1==0;
f2 = x2==0;
f3 = x3==0;
f4 = x4==0;
f5 = x5==0;
sol = solve([f1, f2, f3, f4, f5], [c1, ca, cb, gamma1, gamma2]);
% cSol = sol.c1;
% gammaSol = sol.gamma1;

回答(1 个)

Walter Roberson
Walter Roberson 2016-5-25
The solutions are:
ca = cb = c1 = +/- infinity
gamma1 = gamma2 = 0
but only if you allow "infinity - infinity == 0" to be true -- that is, if your "ca - cb == 0" is an expression for "ca == cb". Otherwise there is no solution. f1 and f2 together require that gamma1 and gamma2 be either 0 or opposite signs, and by the time the dust all settles they can only be 0.

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by