You cannot divide by a vector. You must use a for loop. Also you must properly define a function with a different variable than the one you will use inside the function afterwards.
When I encounter issues in smath, I think it's best to put an equal sign after each step to show the result, it's easier to trace where the issues are.
