On 09/08/2015 10:45 PM, Aaron Meurer wrote: > On Mon, Sep 7, 2015 at 5:37 PM, Carsten Knoll <[email protected]> wrote: >> Hi, >> >> I want to write a routine to determine the rank of a symbolic matrix and >> it seems to be a quite tricky task. >> >> The routine is required to be applicable for matrices whose entries are >> "big expressions", hence calling simplify is not an option. >> >> >> My strategy: extracting all occurring symbols and replacing them by >> random numbers. This way, I arrive at a numeric matrix, which might >> contain very small numbers which are nevertheless different from zero. >> Then, I call evalf with different precisions and look at the singular >> values. My assumption was, that the singular values which are >> "practically 0" must become smaller with rising precision while singular >> values whose true value is small but greater zero wont change much. > > I don't know if that is going to be true. I believe what you are > dealing with is related the so-called table-maker's dilemma > https://en.wikipedia.org/wiki/Rounding#Table-maker.27s_dilemma. > There's no way to tell how many digits you need to get a "zero" value > below a certain epsilon. > > That isn't to say that there aren't good heuristics for doing this, > some of which are implemented in SymPy (see equal() for instance). >
Thanks for that hint. I now use a heuristic basing on Matrix.rank combined with an "adaptive" iszerofunc. Just in case someone has a related problem the code is here: https://github.com/cknoll/rst_symbtools/blob/7a2a4dc9eec617d41f9db3591931615272a80af9/symb_tools.py#L2636 (For curiosity, I still would be interested if there is a possibility to calculate singular values with arbitrary precision with mpmath.) Carsten -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/55F00210.3030902%40gmx.de. For more options, visit https://groups.google.com/d/optout.
