Scaling and translating function so that we may assume that it is defined on the unit interval [0,1] with values in [0,1]. For a introductory course in statistics with python, i'm supposed to approximate the integral $\int\limits_{-1}^{1}f(x)dx$, where $f(x) = x^4$. But before I can start with the practical work in python, i'm given the information that i should
"Appropriately Scale and translate the function so that we may assume that it is defined on the unit interval [0,1] with values in [0,1]."
The action described like this in my notes: $[−1,1] →[0,1]$ given by $f(x) = x^4$, And frankly i'm struggling to understand how i should perform this action.
I come from a weak math background and i often struggle with the notation. I was hoping someone could bring some light as to how to perform the "scaling" and "translation"
I realize that this is a poorly formulated question and If it is considered of too poor quality for this site, I apologize in advance. Further, I struggle to find a suitable tag, for which i appologize in advance.
 A: In general, a scaling and translation is a function of the form $T(x) = a x + b$, where $a$ and $b$ are the scaling and translation factors respectively.
What this question is prompting you to do is to build a function $\tilde{f}$ by scaling and translating the input and/or output of $f$ in such a way that $\tilde{f} \colon [0, 1] \rightarrow [0, 1]$ and $\int_{-1}^1 f(x) dx$ can be easily deduced from $\int_0^1 \tilde{f}(y) dy$.
Now, what I mean precisely by "scaling and translating the input and output" is that
$$
\tilde{f}(x)
= a' f(ax + b) + b'
$$
for constants $a, b$ that control the input scaling and $a', b'$ that control the output scaling.
Now, since we want the domain of $\tilde{f}$ to be $[0, 1]$, we notice that the transformation of the interval $[0, 1]$ under $x\mapsto ax + b$ is
$$
[a\cdot 0 + b, a\cdot 1 + b]
= [b, a+b].
$$
This has to be the domain of $f$, which is $[-1, 1]$, so we solve for $a, b$ to find that $b = -1, a = 2$.
Moreover, the range of $f$ is already $[0, 1]$, so we don't need to do any output scaling.
Therefore, we have
$$
\tilde{f}(x)
= f(2x - 1).
$$
Last, making the substitution $y = 2x-1$, we consider the integral
\begin{align*}
  \int_0^1 \tilde{f}(x) dx
  = \int_0^1 f(2x - 1) dx 
  = \frac{1}{2} \int_{-1}^1 f(y) dy,
\end{align*}
so that we can easily use an approximation to $\int_0^1 \tilde{f}(y) dy$ to approximate $\int_{-1}^1 f(x) dx$.
