A function in mathematics is a "mapping" between one set and another set (in the non-strict definition, I think it suffices for this discussion). For example, a function $f: X \rightarrow Y$ where $X = \{a, b\}$ and $Y = \{1, 2\}$ could very well just be that $a = 1$ and $b = 2$. The key thing is you take one value $x\in X$ and you get one value $y\in Y$ (there are other constraints, but I have no wish to double check them or go into an in-depth mathematical discussion here).
A function in computer science (at least the ones I'm used to, in for example Python) are just a set of commands that can take some inputs, produce some outputs, and do some things along the way. For example, the Python equivalent of $f$ above would be
def someFunction(x):
if x == 'a':
return 1
elif x == 'b':
return 2
else:
return 'Stop messing with this pseudocode example, will ya?'
But another function could be
def anotherFunction(x, y, z):
localVar = x+y
list = []
list.append(localVar)
print("this function does all the things")
return sum(list) + z
The above, while a pretty useless function (I'm terrible at thinking up functions with no purpose =P), does a lot more things than a function in math does. It does some things on the side, returns some stuff, takes multiple inputs and outputs, and so on. It's a complicated beast. Heck, you can even write a function like
def yetAnotherFunction():
print('yay')
That doesn't take any inputs or return anything.
I guess, what I'm saying is - I think the two are so different, I'm not really sure there's a ton to be gained by exploring the contrast. A function in computer science is a module of code that can be called, perhaps with inputs, and does some stuff, maybe returning something. A function in math is a very strictly defined thing: you put something in, and you get only one thing out.
man
pages. :) $\endgroup$