📄 m2_op_arith.hlp
字号:
{smcl}
{* 18mar2005}{...}
{cmd:help m2 op_arith}
{hline}
{* index operators}{...}
{* index arithmetic operators}{...}
{* index product}{...}
{* index multiplication}{...}
{* index division}{...}
{* index addition}{...}
{* index subtraction}{...}
{* index power}{...}
{* index negation}{...}
{title:Title}
{p 4 4 2}
{hi:[M-2] op_arith -- Arithmetic operators}
{title:Syntax}
{it:a} {cmd:+} {it:b} addition
{it:a} {cmd:-} {it:b} subtraction
{it:a} {cmd:*} {it:b} multiplication
{it:a} {cmd:/} {it:b} division
{it:a} {cmd:^} {it:b} power
{cmd:-}{it:a} negation
{p 4 4 2}
where {it:a} and {it:b} may be numeric scalars, vectors, or matrices.
{title:Description}
{p 4 4 2}
The above operators perform basic arithmetic.
{title:Remarks}
{p 4 4 2}
Also see {bf:{help m2_op_colon:[M-2] op_colon}}
for the {cmd::+}, {cmd::-}, {cmd::*}, and {cmd::/} operators.
Colon operators have relaxed conformability restrictions.
{p 4 4 2}
The {cmd:*} and {cmd::*} multiplication operators can also perform string
duplication -- 3*"a" = "aaa" -- see {bf:{help mf_strdup:[M-5] strdup()}}.
{title:Conformability}
{it:a} {cmd:+} {it:b}, {it:a} {cmd:-} {it:b}:
{it:a}: {it:r x c}
{it:b}: {it:r x c}
{it:result}: {it:r x c}
{it:a} {cmd:*} {it:b}:
{it:a}: {it:k x n} {it:k x n} 1 {it:x} 1
{it:b}: {it:n x m} 1 {it:x} 1 {it:n x m}
{it:result}: {it:k x m} {it:k x n} {it:n x m}
{it:a} {cmd:/} {it:b}:
{it:a}: {it:r x c}
{it:b}: 1 {it:x} 1
{it:result}: {it:r x c}
{it:a} {cmd:^} {it:b}:
{it:a}: 1 {it:x} 1
{it:b}: 1 {it:x} 1
{it:result}: 1 {it:x} 1
{cmd:-}{it:a}:
{it:a}: {it:r x c}
{it:result}: {it:r x c}
{title:Diagnostics}
{p 4 4 2}
All operators return missing when arguments are missing.
{p 4 4 2}
{it:a}{cmd:*}{it:c} with {it:a}: {it:k} {it:x} 0 and {it:b}: 0 {it:x} {it:m}
returns a {it:k} {it:x} {it:m} matrix of zeros.
{p 4 4 2}
{it:a}{cmd:/}{it:b} returns missing when {it:b}==0 or when {it:a}{cmd:/}{it:b}
would result in overflow.
{p 4 4 2}
{it:a}{cmd:^}{it:b} returns a real when both {it:a} and {it:b} are real;
thus {cmd:(-4)^.5} evaluates to missing, whereas
{cmd:(-4+0i)^.5} evaluates to {cmd:2i}.
{p 4 4 2}
{it:a}{cmd:^}{it:b} returns missing on overflow.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-2] op_arith}
{p 4 13 2}
Online: help for
{bf:{help m2_exp:[M-2] exp}};
{bf:{help m2_intro:[M-2] intro}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -