Effacer les filtres
Effacer les filtres

Solve equations with constraints

56 vues (au cours des 30 derniers jours)
Zongo Amara Mohamed Isaac
Zongo Amara Mohamed Isaac le 16 Sep 2019
Can you help me solve equation f with the different constraints established?
I can't get the optimal solution:
syms A k q c k;
beta= sym('beta');
q=(A+beta*k)/3;
c=(A+beta*k)/3;
k=(2*A*beta)/(9-2*beta^2);
f= A*q+beta*q*k-q^2-c*q- k^2/2;
solve(f)
if f>=0
if c>=0
if q>=0
if beta >0
if beta-1<=0
if A>0
end
end
end
end
end
end ;
King regards

Réponse acceptée

Prabhan Purwar
Prabhan Purwar le 19 Sep 2019
Hi,
Following code represents the working of solve and assume functions to solve equations with conditions.
syms A k q c beta;
q=(A+beta*k)/3;
c=(A+beta*k)/3;
k=(2*A*beta)/(9-2*beta^2);
f= A*q+beta*q*k-q^2-c*q- k^2/2;
%Conditions
%assume(S >= 0);
assume(c >= 0);
assume(q >= 0);
assume(beta > 0);
assume(beta <= 1);
assume(A > 0);
%Solve for beta
S=solve(f,beta,'ReturnConditions',true);
%disply solution
S
%beta represents required value in terms of parameters
%parameters are internal variable created to represent multiple solutions
%conditions represents the assumed conditions imposed upon equation
Please refer the following link for further information
  1 commentaire
Zongo Amara Mohamed Isaac
Zongo Amara Mohamed Isaac le 23 Sep 2019
Thank you so much. It works well

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Partial Differential Equation 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!

Translated by