Why do I keep getting "no solution found" message?
이전 댓글 표시
Hello. I am trying to solve a system of two equations that one of them is an algebraic equation and the second one is integral equation, but changing the initial guesses I keep getting "no solution found" or when the equation is solved, the answer is imaginary that can not be. for both unknown variables, only positive values are acceptable. I would really appreciate that if someone can help me in this.
here is the solver with all input parameters in the equations:
mpi = 138.0;
fpi = 93.0;
msigma = 370.58;
m0 = 790.0;
g1 = 13.0;
g2 = 6.96;
gp = g1+g2;
gm = g1-g2;
gomega = 6.80;
momega = 783;
gro = 7.98;
epsilon = (mpi.^2*fpi);
L2 = 0.5*(msigma.^2-3.*mpi.^2.);
L4 = (msigma.^2-mpi^2)/(2.*fpi.^2.);
f=zeros(150,7);
for j = 1:1:150
nb = j.*0.01;
omega = (gomega/(momega.^2)).*nb.*(197.3).^3;
%
sigmagap = @(S) [2./(3.*pi.^2).*((S(1).^2 - 1./4.*(sqrt(gp.^2.*S(2).^2 + 4.*m0.^2) + gm.*S(2)).^2) + (S(1).^2 - 1./4.*(sqrt(gp.^2.*S(2).^2 + 4.*m0.^2) - gm.*S(2)).^2))-(nb.*197.3^3);
integral(@(p) 1.0/(2.*pi.^2)*p.^2.* (((gp + ((S(2).*gm.^2)./sqrt ((gp.^2.*S(2).^2)+4.*790.^2))).* ...
((gm.*S(2) + sqrt ((gp.^2.*S(2).^2)+4.*790.^2))./( sqrt (p.^2.+ (1./4.*(sqrt(gp.^2*S(2).^2+4.*790.^2)+gm.*S(2)).^2.).^2 ))))), 0, sqrt(S(1).^2 - 1./4.*(sqrt(gp.^2.*S(2).^2 + 4.*m0.^2) + gm.*S(2)).^2), 'ArrayValued',1) + ...
integral(@(p) 1.0/(2.*pi.^2)*p.^2.* (( (-gm + ((S(2).*gp.^2)./sqrt ((gp.^2.*S(2).^2)+4.*790.^2))).* ...
((-gm.*S(2) + sqrt ((gp.^2.*S(2).^2)+4.*790.^2))./ ...
( sqrt (p.^2.+ (1./4.*(sqrt(gp.^2*S(2).^2+4.*790.^2)-gm.*S(2)).^2.).^2 ))))), 0, sqrt(S(1).^2 - 1./4.*(sqrt(gp.^2.*S(2).^2 + 4.*m0.^2) - gm.*S(2)).^2), 'ArrayValued',1) - epsilon - L2.*S(2) + L4.*S(2).^3];
S0 = [900; 90];
options = optimoptions('fsolve','Display','iter');
[S,fval] = fsolve(sigmagap,S0,options);
mstarp = 0.5*(sqrt(gp.^2.*S(2).^2.+4.*m0.^2)+gm.*S(2));
mstarm = 0.5*(sqrt(gp.^2.*S(2).^2.+4.*m0.^2)-gm.*S(2));
mub = S(1)+gomega.*omega;
f(j,1) = nb;
f(j,2) = S(2);
f(j,3) = omega;
f(j,4) = mstarp;
f(j,5) = mstarm;
f(j,6) = S(1);
f(j,7) = mub;
end
답변 (1개)
Maybe a better code structure to debug the values "fsolve" gets from "sigmagap".
You think that you know that "sigmagap" returns complex values, don't you ?
mpi = 138.0;
fpi = 93.0;
msigma = 370.58;
m0 = 790.0;
g1 = 13.0;
g2 = 6.96;
gp = g1+g2;
gm = g1-g2;
gomega = 6.80;
momega = 783;
gro = 7.98;
epsilon = (mpi.^2*fpi);
L2 = 0.5*(msigma.^2-3.*mpi.^2.);
L4 = (msigma.^2-mpi^2)/(2.*fpi.^2.);
f=zeros(150,7);
S0 = [900;90];
for j = 1:1:1
nb = j.*0.01;
sigmagap(S0,gp,m0,gm,nb,epsilon,L2,L4)
%options = optimset('Display','none');
[S,fval] = fsolve(@(S)sigmagap(S,gp,m0,gm,nb,epsilon,L2,L4),S0);%,options)
mstarp = 0.5*(sqrt(gp.^2.*S(2).^2.+4.*m0.^2)+gm.*S(2));
mstarm = 0.5*(sqrt(gp.^2.*S(2).^2.+4.*m0.^2)-gm.*S(2));
omega = (gomega/(momega.^2)).*nb.*(197.3).^3;
mub = S(1)+gomega.*omega;
f(j,1) = nb;
f(j,2) = S(2);
f(j,3) = omega;
f(j,4) = mstarp;
f(j,5) = mstarm;
f(j,6) = S(1);
f(j,7) = mub;
S0 = S;
end
function res = sigmagap(S,gp,m0,gm,nb,epsilon,L2,L4)
res(1) = 2./(3.*pi.^2).*((S(1).^2 - 1./4.*(sqrt(gp.^2.*S(2).^2 + 4.*m0.^2) + gm.*S(2)).^2) + ...
(S(1).^2 - 1./4.*(sqrt(gp.^2.*S(2).^2 + 4.*m0.^2) - gm.*S(2)).^2))-(nb.*197.3^3);
res(2) = integral(@(p) 1.0/(2.*pi.^2)*p.^2.* ...
(((gp + ((S(2).*gm.^2)./sqrt ((gp.^2.*S(2).^2)+4.*790.^2))).* ...
((gm.*S(2) + sqrt ((gp.^2.*S(2).^2)+4.*790.^2))./ ...
( sqrt (p.^2.+ (1./4.*(sqrt(gp.^2*S(2).^2+4.*790.^2)+gm.*S(2)).^2.).^2 ))))), 0, ...
sqrt(S(1).^2 - 1./4.*(sqrt(gp.^2.*S(2).^2 + 4.*m0.^2) + gm.*S(2)).^2), 'ArrayValued',1) + ...
integral(@(p) 1.0/(2.*pi.^2)*p.^2.* ...
(( (-gm + ((S(2).*gp.^2)./sqrt ((gp.^2.*S(2).^2)+4.*790.^2))).* ...
((-gm.*S(2) + sqrt ((gp.^2.*S(2).^2)+4.*790.^2))./ ...
( sqrt (p.^2.+ (1./4.*(sqrt(gp.^2*S(2).^2+4.*790.^2)-gm.*S(2)).^2.).^2 ))))), 0, ...
sqrt(S(1).^2 - 1./4.*(sqrt(gp.^2.*S(2).^2 + 4.*m0.^2) - gm.*S(2)).^2), 'ArrayValued',1) ...
- epsilon - L2.*S(2) + L4.*S(2).^3;
end
카테고리
도움말 센터 및 File Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!