Difference between revisions of "Documentation/How Tos/Calc: SUMX2PY2 function"
From Apache OpenOffice Wiki
< Documentation | How Tos
(Initial content) |
(forced arrays) |
||
Line 6: | Line 6: | ||
=== Syntax: === | === Syntax: === | ||
<tt>'''SUMX2PY2(x; y)'''</tt> | <tt>'''SUMX2PY2(x; y)'''</tt> | ||
− | : <tt>'''x'''</tt> and <tt>'''y'''</tt> are arrays or ranges of the same size. <tt>'''SUMX2PY2'''</tt> calculates [[Image:Calc_sumx2py2_equation.png]] for the <i>i</i> elements in the arrays. | + | : <tt>'''x'''</tt> and <tt>'''y'''</tt> are arrays or ranges of the same size. <tt>'''SUMX2PY2'''</tt> calculates [[Image:Calc_sumx2py2_equation.png]] for the <i>i</i> elements in the arrays or ranges. |
+ | |||
+ | :<i>Advanced topic:</i> | ||
+ | |||
+ | :<tt>'''SUMX2PY2'''</tt> evaluates its parameters <tt>'''x'''</tt> and <tt>'''y'''</tt> as [[Documentation/How_Tos/Using Arrays|array formulas]], but does not need to be entered as an array formula. In other words it can be entered with the '''Enter''' key, rather than '''Cntrl-Shift-Enter'''. See the example below. | ||
=== Example: === | === Example: === | ||
<tt>'''SUMX2PY2(A1:A2; {2|1})'''</tt> | <tt>'''SUMX2PY2(A1:A2; {2|1})'''</tt> | ||
:where cells A1 and A2 contain <tt>'''4'''</tt> and <tt>'''3'''</tt> respectively, returns (4<sup>2</sup>+2<sup>2</sup>) + (3<sup>2</sup>+1<sup>2</sup>) = <tt>'''30'''</tt>. | :where cells A1 and A2 contain <tt>'''4'''</tt> and <tt>'''3'''</tt> respectively, returns (4<sup>2</sup>+2<sup>2</sup>) + (3<sup>2</sup>+1<sup>2</sup>) = <tt>'''30'''</tt>. | ||
+ | |||
+ | <i>Advanced topic (parameter evaluated as array formula):</i> | ||
+ | |||
+ | <tt>'''SUMX2PY2(A1:A2+1; {2|1})'''</tt> | ||
+ | :when entered 'normally' (not as an [[Documentation/How_Tos/Using Arrays|array formula]]), and where cells A1 and A2 contain <tt>'''3'''</tt> and <tt>'''2'''</tt> respectively, returns ((3+1)<sup>2</sup>+2<sup>2</sup>) + ((2+1)<sup>2</sup>+1<sup>2</sup>) = <tt>'''30'''</tt>. <tt>'''SUMX2PY2'''</tt> forces <tt>'''(A1:A2+1)'''</tt> to be evaluated as an [[Documentation/How_Tos/Using Arrays|array formula]] (internally returning the array {4|3}). | ||
=== See also: === | === See also: === |
Revision as of 18:09, 20 May 2008
SUMX2PY2
Returns the sum of the squares of all elements of two matrices.
Syntax:
SUMX2PY2(x; y)
- x and y are arrays or ranges of the same size. SUMX2PY2 calculates for the i elements in the arrays or ranges.
- Advanced topic:
- SUMX2PY2 evaluates its parameters x and y as array formulas, but does not need to be entered as an array formula. In other words it can be entered with the Enter key, rather than Cntrl-Shift-Enter. See the example below.
Example:
SUMX2PY2(A1:A2; {2|1})
- where cells A1 and A2 contain 4 and 3 respectively, returns (42+22) + (32+12) = 30.
Advanced topic (parameter evaluated as array formula):
SUMX2PY2(A1:A2+1; {2|1})
- when entered 'normally' (not as an array formula), and where cells A1 and A2 contain 3 and 2 respectively, returns ((3+1)2+22) + ((2+1)2+12) = 30. SUMX2PY2 forces (A1:A2+1) to be evaluated as an array formula (internally returning the array {4|3}).
See also:
SUM, SUMIF, SUMSQ, SUMPRODUCT,SUMX2MY2, SUMXMY2