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

# Re: st: how to define a matrix with mathematical expression

 From Nina YIN To statalist@hsphsun2.harvard.edu Subject Re: st: how to define a matrix with mathematical expression Date Mon, 10 Sep 2012 14:55:05 +0200

```Okay, Nick, thank you for your answer,  Symbolic manipulation is
exactly what I want.

On Mon, Sep 10, 2012 at 2:49 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> I don't think I can add much to my previous post. The key is that
> Stata expects to be given a number for each element of a matrix. It
> won't do symbolic manipulation, if that is what you are seeking.
>
> If you made concrete what your matrix is, that might help make clear
> what you are finding difficult to understand.
>
> Nick
>
> On Mon, Sep 10, 2012 at 1:37 PM, Nina YIN <yinnina.ccer@gmail.com> wrote:
>> Hi Nick,
>>
>>
>> Does you mean that I should make these derivations into vectors and
>> then define them into matrix?
>>
>> However, it's a big matrix with size110*110. Also I want to define the
>> element "x_{ij}" as
>>
>> if some condition satisfied, x_{ij}= partial Di/partial Pj;
>>
>> else  x_{ij}=0.
>>
>> Therefore, it would be a problem if it need me to define each element by hand.
>>
>>
>> Best,
>> Nina
>>
>> On Mon, Sep 10, 2012 at 2:27 PM, Nick Cox <njcoxstata@gmail.com> wrote:
>>> I think you are correct. If your matrix is a matrix of partial
>>> derivatives, you have to do any calculus derivations yourself.
>>>
>>> Nick
>>>
>>> On Mon, Sep 10, 2012 at 1:22 PM, Nina YIN <yinnina.ccer@gmail.com> wrote:
>>>
>>>> I am trying to construct a matrix with elements defined in
>>>> mathematical expression. For example, a m*m matrix A with elements
>>>> "a_{ij}"=partial Di/ partial Pj. Di (Pj) is the i-th ( j-th ) element
>>>> of variable D(P).
>>>>
>>>> I just know -matrix define and -mkmat, however I didn't find out that
>>>> these two commands could help me in this problem. Do I understand it
>>>> well?
> *
> *   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/

--
Best Regards,
Nina YIN

Toulouse School of Economics
Manufacture des Tabacs
21 Allee de Brienne
Toulouse, 31000, France
Tel: 0033-(0)5 6123 8348
*
*   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/
```