Roots of a two variables equation involving a numerical integration

7 次查看(过去 30 天)
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 个评论
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 CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by