Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!not-for-mail From: David Kuehling Newsgroups: comp.lang.forth Subject: Re: Sumbrero puzzle solver Date: Sun, 11 Mar 2012 22:35:24 +0100 Lines: 27 Message-ID: <87d38ies83.fsf@snail.Pool> References: <17111793008435@frunobulax.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.uni-berlin.de 80ZLQXNFIfw2MLm4Sxz+nA+5Du82I2YIKLBIBz07qkmSgIMr4= Cancel-Lock: sha1:ebxOVgrCjfNRnzuxMVg+TAL/SWk= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Xref: csiph.com comp.lang.forth:10018 >>>>> "Albert" == Albert van der Horst writes: >> >> x = [a b c d e f g]'; b = [8 14 13 3 16 16 8 11 16]'; A * x = b; A^t >> * A * x = A^t * b x = (A^t * A)^-1 * A^t * b >> >> This doesn't work: A'*A is not invertible (quadruple eigenvalue) > This look like the Java syndrome, killing a flie with a cannon. The > problem can be solved in less operations then needed to calculate A'*A > leave alone inspecting it. Maybe less operations, but it might take more code :) In Octave (matlab, too?) you have the reverse division operator '\' for solving systems of equations without explicitely inverting the matrix A: to solve Ax=b you write x=A\b . (which is probably implemented via LR-decomposition of A, then forward/backward substitution to find x). BTW even if you save some operations, asymptotic complexity is still O(n^3), so inversion doesn't hurt that much. cheers, David -- GnuPG public key: http://dvdkhlng.users.sourceforge.net/dk.gpg Fingerprint: B17A DC95 D293 657B 4205 D016 7DEF 5323 C174 7D40