A formula is a string of symbols, arranged according to mathematical grammar.
A function is a mathematical object that plays a role in arithmetic operations like "evaluation" or "composition". A key point is that if $f$ and $g$ are expressions that denote two functions with the same domain and codomain, and we have $f(x) = g(x)$ for every $x$ in the domain, then $f$ and $g$ denote the same function.
So, in your example of functions $f$ and $g$ on the set $\{ -1, 0, 1 \}$, it is indeed true that $f=g$.
Some examples of mathematical grammar
Let $f$ be a variable that denotes a function on the reals. Let $x$ be a real-valued variable. Then:
- $f$ is a function.
- $f(x)$ is a real number.
- $x^2 + 3$ is a real number. In particular, it is not a function. Unfortunately, people are frequently grammatically incorrect on this point. :(
- $f(x) = x^2 + 3$ is an equation that relates two real numbers.
and all of the bullet points above are examples of formulas.
Recall that I mentioned functions were 'defined' pointwise: if two functions solve "$f(x) = x^2 + 3$ for all $x$" for $f$, then they must be the same function. Because of this, we can use equations like this as a way to specify functions.
But as you note, if two different formulas for the right hand side actually give the same values when you substitute values from the domain, then the functions so defined will be the same.
Incidentally, it is possible to define functions directly rather than pointwise, although it often isn't pleasant. e.g. the function $f$ defined above is given by
$$ f = p \circ ((\mu \circ \Delta), c_3) $$
where I'm using the notation
- $\Delta$ is the diagonal function $\Delta(x) = (x, x)$
- $\mu$ is the multiplication function $\mu(x,y) = xy$
- $p$ is the addition function $p(x,y) = x+y$
- $c_3$ is the constant function $c_3(x) = 3$
- $(,)$ is a binary operation on functions; it's defining property is $(g,h)(x) = (g(x), h(x))$. I don't actually know of standard notation for this; sometimes I see $\times$ in place of $,$.
- $\circ$ is composition of functions: $(g \circ h)(x) = g(h(x))$.
It's useful to think of it this way: A processor's speed is inversely proportional to the time it takes to complete the task. Therefore, for processor A we can give a "non-dimensional speed" of $\frac{1}{42.5}$. For processor B, this value is $\frac{1}{32.9}$. It's easy to see that B is faster in this case, because the speed is greater.
Now you want to compare their speeds, or in particular answer the question "How many per cent is processor B faster than A?". So you can just calculate the ratio of their speeds like this:
$$
\frac{\left( \frac{1}{32.9}\right)}{\left( \frac{1}{42.5}\right)} = \frac{42.5}{32.9}\approx 1.2917
$$
Therefore, our answer is: Processor B is faster than processor A by $29.2~\%$.
Should you calculate it the other way around, you'd be asking the question "How much slower is processor A compared to processor B?".
Best Answer
This is mostly a question of taste; but there's very, very good reason for that taste. Indeed, it's important to disambiguate things thoroughly to make sure we're correct when it concerns technical details.
Generally, the core factor where you can say "7 is equal to 3" without the fear mistaken is being in the right context, namely, being in the space $\mathbb{Z}/4\mathbb{Z}$. In this "four hour clock", $7$ and $3$ are indeed equal, but it's not the $7$ and $3$ that you know from $\mathbb{Z}$, it's one element, generally written with a hat, like so: $\hat{-1} = \hat3 = \hat 7$. The way we write this element refers to $\mathbb{Z}$, since we construct $\mathbb{Z}/4\mathbb{Z}$ from $\mathbb{Z}$; so it helps our intuition. But I could just as well forbid you from writing in a way that refers to $\mathbb{Z}$, and decide to write $\mathbb{Z}/4\mathbb{Z} = \{ 0, \alpha, \beta, \gamma \}$.
In the context of $\mathbb{Z}$ itself, $3$ and $7$ are NEVER equal. They are only EQUIVALENT, relative to the equivalence relation of congruence modulo 4. From any equivalence relation, you can make an algebraic quotient, and in the resulting space, the elements now become equal: $7$ and $3$ are both mapped to a single element $\gamma$, and their results are then equal. But you must never lose track of the space/context in which things are happening, since this is ripe for misuse and mistake.