Built In Fields

Description

For certain mathematical objects, it is useful to designate the field of numbers (such as the rationals or the complex numbers) that they are constructed over. Luckily, Sage has several built in fields for this purpose.

  • QQ: The field of rational numbers
  • RR: The field of real numbers. Since not all real numbers can be expressed rationally, this field is made up of decimal approximations
  • CC: The field of complex numbers. Similar to the reals, this field is made up of decimal approximations.

Sage Cell

We can use these fields to construct vectors specifically over the given field:

Code

A = vector(QQ, [2, 3, 5])
B = vector(RR, [2, 3, 5])
C = vector(CC, [2, 3, 5])
print(A.parent())
print(B.parent())
print(C.parent())

Options

Finding the Parent Field

We can find the parent field of an object with the .parent() method.

Code

A = matrix(QQ, [[2, 3], [5, 7]])
A.parent()

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

Any related cells go here. Provide a link to the page containing the information about the cell.

Attribute

Permalink:

Author:

Date: 02 Mar 2020 15:18

Submitted by: Zane Corbiere

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License