Created code for the function body

Used the code from the function examples replacing the mean functions
with solve.