7
$\begingroup$

I have trouble solving this task to find eigenvalues and eigenvectors for the Fredholm integral. I could not find an analytic solution to the equation. That is why I am trying to solve it numerically in Wolfram Mathematica. enter image description here

b and c are constants = 0.1 I saw a similar task for another kernel function (Fredholm Integral Equation of the 2nd Kind with a Singular Difference Kernel), but the Gauss-Legendre quadrature formula code doesn't allow solving this task because of singularity (division by zero are constantly happening).

Thanks for the advice.

Code to find 2 eigenvalues and eigenfunctions:

points = 100;
integrand[x_] =(exp[-0.1*Abs[x-y]]*cos[0.1*Abs[x - y]]) f[x];
domain = {0,1};
{nodes, weights} = Most[NIntegrate`GaussRuleData[points, MachinePrecision]];
midgrid = Rescale[nodes, {0, 1}, domain];
grid = Flatten[{domain[[1]], midgrid, domain[[-1]]}];
int = -Subtract @@ domain weights.Map[integrand, midgrid];
{b, m} = CoefficientArrays[int, f /@ grid];
mat = Table[m, {y, grid}];
{val, vec} = Eigensystem[mat, 2];
ListLinePlot[vec[[;; 2]], PlotRange -> All]
$\endgroup$
3
  • 2
    $\begingroup$ Welcome to MSE. Please edit your question and share the code you have tried. $\endgroup$ Commented Nov 4, 2021 at 16:40
  • $\begingroup$ Thanks. Yes, please. $\endgroup$
    – user82523
    Commented Nov 5, 2021 at 13:12
  • $\begingroup$ It is not clear what is your problem. Do you try to solve Fredholm integral equation with method proposed in the post linked or do you try to get eigensystem itself? $\endgroup$ Commented Nov 6, 2021 at 5:14

1 Answer 1

5
$\begingroup$

There are several typos in the code, and after small correction we have

points = 100;
integrand[x_,y_] := (Exp[-0.1*Sqrt[(x - y)^2]]*Cos[0.1*Sqrt[(x - y)^2]]);
domain = {0, 1};
{nodes, weights} = 
  Most[NIntegrate`GaussRuleData[points, MachinePrecision]];
midgrid = Rescale[nodes, {0, 1}, domain];

mm = Table[
   integrand[midgrid[[i]], midgrid[[j]]] weights[[i]], {i, 
    Length[midgrid]}, {j, Length[midgrid]}];


{val, vec} = Eigensystem[mm, 2];
ListLinePlot[vec[[;; 2]], PlotRange -> All]

Figure 1

$\endgroup$
1
  • $\begingroup$ Thanks for this. $\endgroup$
    – user82523
    Commented Nov 6, 2021 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.