3
$\begingroup$

In an algorithm I am writing, I need to solve the equation

$$ \det{(A+\epsilon B)} = 0, $$

for the smallest value of $\epsilon$, given large ($n$x$n$ ideally up to 150x150), dense and symmetric A and B. In the algorithm, I invert $B$ and have Mathematica solve the equation $\det(B^{-1}A+\epsilon I)=0$ by Eigenvalues[$B^{-1}A$].

This works fine for $n<20$, then I start getting errors:

Result for Inverse of badly conditioned matrix [$B$] may contain significant numerical errors.

As the algorithm runs, $B$ becomes more singular and wrecks the calculations. One thing that would help my algorithm is a way to solve the original equation fast in Mathematica without inverting $B$, but I am struggling to come up with one!

Anyone know a way?

$\endgroup$
  • $\begingroup$ This really needs a concrete example. Are the matrices comprised of approximate reals? Rationals? Gorillas? $\endgroup$ – Daniel Lichtblau Nov 14 '18 at 14:53
6
$\begingroup$

You can use the generalized form of Eigenvalues. Example matrices:

SeedRandom[1]
{A, B} = RandomReal[1, {2, 4, 4}];

Compare:

Eigenvalues[Inverse[B] . A]
Eigenvalues[{A, B}]

{2.41802, 1.42315, 0.685593, -0.296285}

{2.41802, 1.42315, 0.685593, -0.296285}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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