Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

1 回表示 (過去 30 日間)
Xin CUI
Xin CUI 2016 年 5 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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