Precision in $f : A \to B$ notation Here I have a nice function (also known as $f(x)=\sin (\pi x/2)+1$) that is continuous on the interval $[0,4]$:

￼

According to the definitions I've found, $f:A\rightarrow B$ means that $\forall n\in A:f(n)\in B$. Therefore, in describing this function’s domain and range, the most precise thing to do would be to say $f:[1,4]\rightarrow [0,2]$. However, from what I understand, this notation is not the most precise, and the following would also be true:


$f:[1,4]\rightarrow [-5,5]$
$f:[1,4]\rightarrow\Bbb{R}$
$f:[1,2]\rightarrow\Bbb{R}$


Basically, $A$ must include some—but not all of—$f$’s domain but must not include any number for which $f$ is not defined while $B$ can include any numbers so long as it includes the range of $f$ on $A$—which makes sense when looking at the definition of $f:A\rightarrow B$.

All of this research I’ve been doing (I’m only a junior in high school who just started AP Calculus BC) was originally to determine a concise and symbolic way to express that a function is continuous on a certain interval, but now my question has evolved to include something else: how can one clearly and symbolically define the full domain and range of a function without any ambiguity and in one fell swoop?



Update:

It has come to my attention that codomain and range are actually different. From what I understand at this point, codomain is a kind of restriction on the range. Here's an example:

Let $f:x\mapsto\sin\left(\dfrac{\pi x}{2}\right) +1$, as shown in red:


If one wishes to restrict the domain, simply graph $f:[0,4]\rightarrow\Bbb R$ (as shown in blue):


Want to restrict the range, too? Go ahead and meddle with the codomain. Here's $f:[0,4]\rightarrow [0.25,1.75]$ in green:

As of right now I'm confused as to whether or not you have to restrict the domain to exclude images of x that would be excluded anyways by restricting the codomain
The Range of $f:A\to B$ is sometimes denoted $f(A)$. $f(A)$ is defined as $\{f(a) \ | \  a\in A\}$. A well-defined function (i.e. a function) satisfies $f(A)\subseteq B$.

Requiring a function be defined as $f: A\to f(A)$ is too constricting. While this defines in a sense the "best" restriction of any $f:A\to B$, sometimes the set $f(A)$ is unknowable or tedious to describe.

Take for example the function

$$f:\mathbb N\to \mathbb N, \ \ \ \ f(n) = \text{the $n^{th}$ largest prime number}$$

We don't have a formulaic way to describe $f(\mathbb N)$. $\mathbb N$ is simply a good choice for a codomain, rather than say $\mathbb Z$ or $[0,\infty)$ because the others are unncessarily large or complicated.
One notation that I have seen is

$f([0, 4])
= [0, 2]
$.