Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Fernando Rios Avila <f.rios.a@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: How to solve the matrix equation AX = B for X without using Mata |
Date | Thu, 15 Dec 2011 08:18:06 -0500 |
Also, a bit of traditional matrix algebra: AX = B X=inv(A)*B On Thu, Dec 15, 2011 at 8:11 AM, Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com> wrote: > You might want to reconsider Mata. The syntax is no more complicated, > and there are several advantages to doing numerical computations in > Mata, with a small overhead: > > ********************************** > matrix def A = (0.5, 0.25)' > matrix def B = (10, 0.5 \ 0.5, 15) > mata: st_matrix("C", /// > C=lusolve(st_matrix("B"), st_matrix("A"))) > mat li C > ********************************** > You might also want to read this excellent post by Bill Gould: > http://www.stata.com/statalist/archive/2011-02/msg00376.html > > Unless of course you are constrained by your Stata version... > > T > > On Thu, Dec 15, 2011 at 4:46 AM, Tiago V. Pereira > <tiago.pereira@mbe.bio.br> wrote: >> Dear statalisters, >> >> I need to perform the division of matrices A/B, and need to solve the >> matrix equation AX = B for X. >> >> Is there a quick way to solve for X without using Mata? >> >> For example, I have the following matrices: >> >> matrix A = (0.5, 0.25) >> matrix B = (10, 0.5 \ 0.5, 15) >> >> and the results should be something like: >> >> matrix C = (0.05, 0) >> >> >> Thanks for your time. >> >> Tiago >> >> >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/statalist/faq >> * http://www.ats.ucla.edu/stat/stata/ > > > > -- > Tirthankar Chakravarty > tchakravarty@ucsd.edu > tirthankar.chakravarty@gmail.com > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/