That was it, feeling dumb now. Is this the correct way to make a function out of an expression dependent on parameters or is there a better way? I will have to compute it on a grid of values
Are a,b,c,d all parameters? Then what is the main variable? If a,b,c,d are indeed the final variables, I see nothing wrong with your definition, except that it will work only in a session where you have already calculated rootsFinal. If you need a function that works across sessions, you may want to paste the whole expression of rootsFinal[[1]] into the definition of f.