Roots of a two variables equation involving a numerical integration

3 ビュー (過去 30 日間)
Daniel Tamayo
Daniel Tamayo 2020 年 4 月 12 日
コメント済み: J. Alex Lee 2020 年 4 月 17 日
I'm looking for a solution of a of two variables equation problem,
The issue is that '' and '' are integrals of a certain kind of functions 'f' and 'g' involving the variables x, y and p, in a very complicate way (since the integration is only on p, it eventually disappears), that include logarithms of the three variables, like the example function below
I have tried to use a double for loop for the variables x and y, so that I can integrate numerically over p only. However, it has not been efficient and one of the problems I have is that for certain configurations of values of x,y and p, negative numbers are obtained that generate an indeterminacy in the logarithm.
In summary, I must find the pairs of numbers (x, y) that satisfy the following type of equation, and plot them
  3 件のコメント
Daniel Tamayo
Daniel Tamayo 2020 年 4 月 13 日
Thanks for your answer! sorry about the length...
Where,
and
and
Ameer Hamza
Ameer Hamza 2020 年 4 月 14 日
Yes, these are quite long. If you can write them in MATLAB, maybe we can suggest a solution with fsolve, fmincon or some other optimization algorithm.

サインインしてコメントする。

回答 (1 件)

J. Alex Lee
J. Alex Lee 2020 年 4 月 14 日
Assuming x and y are scalars and there is a solution, use fsolve, not an optimization algorithm. You'll need initial guesses. The beauty of numerical solution is that you can literally just define the functions you have written out, and call them. The numerical integration can be done with matlab's in-built integral() function, which according to docs can even take Inf as an integration limit (sounds cool, i have never tried this). The structure would look something like
X0 = [x0,y0]
X = fsolve(@(X)myresidual(X),X0)
function res = myresidual(X)
x = X(1);
y = X(2);
res = (y-x) .* (1+integral(@(p)f(x,y,p),0,Inf)) + integral(@(p)g(x,y,p),0,Inf);
end
function out = f(x,y,p)
% and you call other functions to do the other complicated sub-parts like eps1, L1p, L1m, etc.
end
function out = g(x,y,p)
end
function out = L1(x,y,M,e1)
end
% etc
  6 件のコメント
John D'Errico
John D'Errico 2020 年 4 月 17 日
One thing that I love is the ability of contour and contourc to solve problems of this sort, as well as return the solution locus as an approximation.
Path following is another nice idea, one that is also often overlooked. I even considered writing a toolbox for the purpose once.
J. Alex Lee
J. Alex Lee 2020 年 4 月 17 日
Indeed, I am using contourX more and more in lieu of actually solving for conditions when the problem is challenging. ironically i am hell bent on analytical solutions when my problem reduces to a cubic polynomial.
I never bothered to google it until now, but there's a nice wiki page with links to toolboxes in different languages
including 1 for matlab, though i haven't at all looked at it:

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by