Vectors

## Description

The basic Sage command to enter the vector

(1)
\begin{align} \mathbf v = \begin{pmatrix} 1 \\ 1/2 \\ 1/3 \\ 1/4 \end{pmatrix} \end{align}

is v = vector(QQ, 4, [1, 1/2, 1/3, 1/4]). QQ designates that the vector is over the rationals.

## Sage Cell

#### Code

v = vector(QQ, 4, [1, 1/2, 1/3, 1/4])
v


## Options

#### Option

The number of coordinates in the vector v can be calculated with the Sage command v.degree().

#### Code

v = vector(QQ, 4, [1, 1/2, 1/3, 1/4])
v.degree()


#### Option

The parent field of the vector v is given by vparent().

#### Code

v = vector(CC, 4, [1, 1/2, 1/3, 1/4])
v.parent()


#### Option

The Sage command v, returns the third entry in the vector v. Sage counts array entries beginning with zero and not one.

#### Code

v = vector(QQ, 4, [1, 1/2, 1/3, 1/4])
v


#### Option

The command zero_vector generates the zero vector.

#### Code

z = zero_vector(QQ, 5)
z


## Tags

CC: math.la.i.vec.coord

Primary Tags: Linear Algebra: Vectors, Multivariable Calculus: Vector geometry.

Secondary Tags: Vectors: Vectors and vector arithmetic, Vector geometry: Vectors and vector arithmetic.

None

## Attribute

Author: R. Beezer

Date: 24 Jul 2017 14:41

Submitted by: Tom Judson