Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to solve the matrix equation AX = B for X without using Mata


From   Tirthankar Chakravarty <[email protected]>
To   [email protected]
Subject   Re: st: How to solve the matrix equation AX = B for X without using Mata
Date   Thu, 15 Dec 2011 05:11:39 -0800

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
<[email protected]> 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
[email protected]
[email protected]

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index