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:30:54 -0800
> Also, a bit of traditional matrix algebra:
>
> AX = B
> X=inv(A)*B
This is the least numerically stable way of computing solutions to a
system of linear equations. See Bill Gould's post linked below.
T
On Thu, Dec 15, 2011 at 5:18 AM, Fernando Rios Avila <[email protected]> wrote:
> On Thu, Dec 15, 2011 at 8:11 AM, Tirthankar Chakravarty
> <[email protected]> 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
>> <[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/
>
> *
> * 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/