⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 matrix_define.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 28feb2005}{...}
{cmd:help matrix define}, {cmd:help matrix input}{...}
{right:dialog:  {bf:{dialog matrix_define:matrix define}}  {bf:{dialog matrix_input:matrix input}}}
{hline}

{title:Title}

{p2colset 5 26 28 2}{...}
{p2col :{hi:[P] matrix define} {hline 2}}Matrix definition{p_end}
{p2colreset}{...}


{title:Syntax}

	{cmdab:mat:rix} [{cmdab:def:ine}] {it:A} = {it:matrix_expression}

{p 8 24 2}{cmdab:mat:rix} [{cmdab:in:put}]{space 2}{it:A}
		{cmd:= (}{it:#}[{cmd:,}{it:#...}]
		[{cmd:\} {it:#}[{cmd:,}{it:#...}] [{cmd:\} [{it:...}]]]{cmd:)}


{title:Description}

{pstd}
{cmd:matrix define} performs matrix computations.  The word {cmd:define} may
be omitted.

{pstd}
{cmd:matrix input} provides a way to input matrices.  The word
{cmd:input} may be omitted (see discussion that follows).

{pstd}
See {helpb matrix} for background information and links to more matrix
help.


{title:Remarks}

{pstd}
{cmd:matrix define} calculates matrix results from other matrices.  For
instance,

{phang2}{cmd:. matrix define D = A + B + C}

{pstd}
creates {cmd:D} containing the sum of {cmd:A}, {cmd:B}, and {cmd:C}.  The
word {cmd:define} may be omitted, 

{phang2}{cmd:. matrix D = A + B + C}

{pstd}
and the command may be further abbreviated:

{phang2}{cmd:. mat D = A + B + C}

{pstd}
The same matrix may appear on both the left and the right of the equals
sign in all contexts, and Stata will not become confused.  Complicated
matrix expressions are allowed; see {help matrix operators} and
{help matrix functions}.

{pstd}
With {cmd:matrix input} you define the matrix elements rowwise; commas are
used to separate elements within a row and backslashes are used to separate
the rows.  Spacing does not matter.

    Examples:

{phang2}{cmd:. matrix input mymat = (1,2\3,4)}{p_end}
{phang2}{cmd:. matrix input myvec = (1.7, 2.93, -5, 3)}{p_end}
{phang2}{cmd:. matrix input mycol = (1.7\ 2.93\ -5\ 3)}

{pstd}
Each of the above would also work if you omitted the subcommand {cmd:input}:

{phang2}{cmd:. matrix mymat = (1,2\3,4)}{p_end}
{phang2}{cmd:. matrix myvec = (1.7, 2.93, -5, 3)}{p_end}
{phang2}{cmd:. matrix mycol = (1.7\ 2.93\ -5\ 3)}

{pstd}
There is a subtle difference:  The first method uses the {cmd:matrix input}
command; the second uses the matrix expression parser.  In one sense, using
the second method is better because

{phang2}{cmd:. matrix xmpl = (1+1, 2*3/4 \ 5/2, 3)}

{pstd}
is understood but would be a syntax error with {cmd:matrix input}.

{pstd}
{cmd:matrix input}, however, has two other advantages:

{phang2}1){space 2}{cmd:matrix input} will allow you to input very large
matrices.  {cmd:matrix define}, which uses the expression parser, is limited
because it must "compile" the expression and, if it is too long, will produce
an error message.

{phang2}2){space 2}{cmd:matrix input} will allow you to omit the commas.


{title:Examples}

    {cmd:. matrix D = B}
    {cmd:. matrix C = (C+C')/2}
{phang}{cmd:. matrix L = cholesky(0.1*I(rowsof(X)) + 0.9*X)}{p_end}

    {cmd:. matrix input A = (1,2\3,4)}


{title:Also see}

{psee}
Manual:  {bf:[P] matrix define}

{psee}
Online:  
{helpb matrix};
{help exp},
{help matrix functions},
{help matrix operators}
{p_end}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -