How can I define a vector function?

Please create a minimal working example that reproduced your error.
Guidelines for such examples can be found in: Read before posting: How do I get my question answered?