Section 6.1 Functions
A function from a set \(A\) into a set \(B\) is a relation from \(A\) into \(B\) such that each element of \(A\) is related to exactly one element of the set \(B\text{.}\) The set \(A\) is called the domain of the function, and the set \(B\) is called the co-domain. Functions are fundamental in both mathematics and computer science for describing mathematical relationships and implementing computational logic.
In Sage, functions can be defined using direct definition.
For example, defining a function \(f : \mathbb{R} \rightarrow \mathbb{R}\) to calculate the cube of a number, such as 3:
Subsection 6.1.1 Graphical Representations
Sage provides powerful tools for visualizing functions, enabling you to explore the graphical representations of mathematical relationships.
For example, to plot the function \(f(x) = x^3\) over the interval \([-2, 2]\text{:}\)