How to Test if Each Number in a Vector Is Even or Odd

A vector is a list of numbers. A row vector has n rows and 1 column and a column vector has n columns and 1 row. To transform a row vector into a column vector (or vice versa) is called transposing the vector. Vectors are used in physics and other sciences, engineering, statistics and other fields. Although vectors can contain any sort of number (including integers, ratios, irrational number and even complex numbers) the question of oddness or evenness only makes sense for integers (whole numbers). You can test the oddness or evenness of the elements of a vector in a spreadsheet software program.

Instructions

    • 1

      Enter the vector in column A in a spreadsheet program. For example, suppose your vector is {1, 3, 4, 5}, enter these numbers in cells A1 through A4.

    • 2

      Highlight as many cells in column B as you have numbers in column A. In the example, highlight cells B1:B4

    • 3

      Enter =ROUND(A1:An/2,0), where n is the number of rows, and press control, shift and enter simultaneously. In the example, enter = ROUND(A1:A4/2,0)

    • 4

      Highlight the same number of cells in column C. In the example, highlight cells C1 to C4.

    • 5

      Enter =A1:an/2 and press control, shift and enter.

    • 6

      Highlight the same number of cells in column D and enter =IF(B1:Bn = C1:cn, "even", "odd") and press control shift and enter. The cells in column D now indicate which elements are odd or even.

Related Searches:

Comments

Related Ads

Featured