# Problem with the Rank of a matrix after a FindRoot

I am solving a boundary problem defined by a set of four-component vectorial functions. Without going into many details, I have two functions on the left and two on the right of an interface. The boundary problem is defined by requiring that the sum of the two functions on the left is equal to the sum of the two on the right at the interface position. The functions contain confluent hypergeometric functions of the first and second kind.

A similar problem is studied in this work but with two-components functions.

The problem admits a unique solution when the determinant of the matrix associated is zero. There is a free parameter $$j$$, and for a given value of it, I can determine with FindRoot the associated value of the energy $$e$$. For this pair of number, the determinant is smaller than $$10^{-10}$$. However, the rank of the associated matrix is not reduced to 3 but is still 4. To reduce the Rank of the matrix, I need to work around the solution $$e$$ until the determinant is not smaller than $$10^{-16}$$!

The two vectorial functions are

WFmFR[j_, e_, b_, V0_, x_, lR_] := Module[{wf, av, mm, mp,U,M},
M[a_, b_,x_] := Hypergeometric1F1[a, b, x]
U[a_, b_,x_] := HypergeometricU[a, b, x]
mm = (e - V0)^2;
mp = e - V0;
av = UnitStep[j] j -
1/2 (+(e - V0)^2 - 1 + Sqrt[1 + lR^2 (e - V0)^2] b);
wf = E^(-x/2)
If[j > 0,
x^(j/2) {Sqrt[2] j x^(-1/2) lR  M[av, j, x],
lR  mp M[av, j + 1, x], -(2 (av - j) + mm) M[av, j + 1, x],
Sqrt[2] ((av - j - 1) (2 (av - j) + mm))/(mp (j + 1)) x^(1/2)
M[av, j + 2, x]},
If[j == 0, {Sqrt[2] av x^(1/2) lR  M[av + 1, 2, x],
lR  mp M[av, 1, x], -(2 av + mm) M[av, 1, x],
Sqrt[2]/mp (av - 1) (2 av + mm) x^(1/2) M[av, 2, x]},
x^(-j/2) {(Sqrt[2] av)/(1 - j) lR  x^(1/2) M[av + 1, -j + 2, x],
lR  mp M[av, -j + 1, x], -(2 av + mm) M[av, -j + 1,
x], -Sqrt[2] (j (2 av + mm))/mp x^(-1/2)
M[av - 1, -j, x]}]];
Normalize[wf]]


and

WFMFR[j_, e_, b_, V0_, x_, lR_] := Module[{wf, av, mm, mp,M,U},
M[a_, b_,x_] := Hypergeometric1F1[a, b, x]
U[a_, b_,x_] := HypergeometricU[a, b, x]
mm = (e - V0)^2;
mp = e - V0;
av = UnitStep[j] j -
1/2 (+(e - V0)^2 - 1 + Sqrt[1 + lR^2 (e - V0)^2] b);
wf = E^(-x/2)
If[j > 0,
x^(j/2) {Sqrt[2] (j - av) x^(-1/2) lR  U[av, j, x],
lR  mp U[av, j + 1, x], -(2 (av - j) + mm) U[av, j + 1, x], -(
Sqrt[2]/mp) (2 (av - j) + mm) x^(1/2) U[av, j + 2, x]},
If[j == 0, {Sqrt[2] (-av) x^(1/2) lR  U[av + 1, 2, x],
lR  mp U[av, 1, x], -(2 av + mm) U[av, 1, x], -(Sqrt[2]/
mp) (2 av + mm) x^(1/2) U[av, 2, x]},
x^(-j/2) {-Sqrt[2] av x^(1/2) lR   U[av + 1, -j + 2, x],
lR  mp U[av, -j + 1, x], -(2 av + mm) U[av, -j + 1, x], -(
Sqrt[2]/mp) (2 av + mm) x^(-1/2) U[av - 1, -j, x]}]];
Normalize[wf]]


The matrix is defined as

MFR[j_, e_, rr_, V0_, lR_] := Module[{c1, c2, c3, c4, mat},
c1 = WFmFR[j, e, +1, -V0, rr, lR];
c2 = WFmFR[j, e, -1, -V0, rr, lR];
c3 = -WFMFR[j, e, +1, V0, rr, lR];
c4 = -WFMFR[j, e, -1, V0, rr, lR];
mat = {c1, c2, c3, c4};
mat]


For a fixed value of $$j$$, I am interested in the value of $$e$$ that makes zero of the determinant of this matrix. To find all zeros in a fixed interval, I used a routine suggested in the Wolfram Community Forum. I do not copy the function FindRoots since it can be copied from there.

To show my problem, I am evaluating a set of zeros in a specific interval

  FindRoots[Det[MFR[-2, x, 5., 0.50, 0.1]], {x, -5, 5},
Debug -> True]


These are nullifying the determinant.

Det[MFR[-2, #, 5., 0.50, 0.1]] & /@ test


However, not all of the solutions are decreasing the rank of the matrix:

MatrixRank[MFR[-2, #, 5., 0.50, 0.1]] & /@ test

• Should not be difficult to type a $4\times4$ numerical matrix. Commented May 12, 2021 at 17:04
• Does the matrix have any particular structure (for example, is it symmetric)?. If so there might be tricks you could play to reduce the error. But really - where does this magic number 10^-16 come from? Commented May 12, 2021 at 18:34
• No the matrix has no particular structure. I will post soon a simplified version of the problem. Commented May 12, 2021 at 18:45
• You might want to use SingularValueDecomposition with a suitably large Tolerance option setting to force the rank to be regarded as 3. Or just drop the smallest singular value. Commented May 12, 2021 at 18:48
• Without working code, I don't know how to track down what is probably a numerics issue. You could follow @yarchik's advice and post one of the MFR[] matrices whose rank does not appear to be reduced, and further advice about Daniel's suggestion might be able to be given. Commented May 17, 2021 at 13:13