Random Vectors
Description
We can produce random elements of a vector space with the .random_element() method. This is useful for generating elements of the span of several vectors. For example, if we consider the subspace of $\mathbf Q^3$ spanned by vectors $(2, 3, 5)$ and $(7, 11, 13)$, then we can use random_element to generate random vectors in the span.
Sage Cell
Code
V = QQ^3
S = V.span([vector(QQ, [2, 3, 5]), vector(QQ, [7, 11, 13])])
vecs = [(i, S.random_element()) for i in range(10)]
vecs
Options
none
Tags
Primary Tags:
Secondary Tags:
A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.
Related Cells
- Vectors in Sage. Vectors in Sage.
- Linear Combinations of Vector Building Linear Combinations in Sage.
- Vector Addition & Subtraction. Adding and subtracting vectors in Sage.
- Vector Spaces in Sage Vector Spaces in Sage.
- Bases of Vector Spaces Using Sage to find bases of vector spaces.
- Vector Spans Finding the span of a finite set of vectors.
- Testing Sets for Linear Independence Testing a subset of a vector space for linear independence.
Attribute
Permalink:
Author:
Date: 10 Apr 2020 16:41
Submitted by: Zane Corbiere