Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Tirthankar Chakravarty <tirthankar.chakravarty@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 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 <f.rios.a@gmail.com> wrote: > 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/ -- 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/

**References**:**st: How to solve the matrix equation AX = B for X without using Mata***From:*"Tiago V. Pereira" <tiago.pereira@mbe.bio.br>

**Re: st: How to solve the matrix equation AX = B for X without using Mata***From:*Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com>

**Re: st: How to solve the matrix equation AX = B for X without using Mata***From:*Fernando Rios Avila <f.rios.a@gmail.com>

- Prev by Date:
**st: ml - could not calculate numerical derivatives missing values encountered** - Next by Date:
**Re: st: ml - could not calculate numerical derivatives missing values encountered** - Previous by thread:
**Re: st: How to solve the matrix equation AX = B for X without using Mata** - Next by thread:
**st: How to solve the matrix equation AX = B for X without using Mata** - Index(es):