There are a few things that might be wrong.
- you should use sum() instead of summation
- Your piece wise expression should be like this:
(1, condition) where the condition is a boolean expression
- The way your function is set up is wrong, there is now reason to have two result sections when you only use the results of 1. If you want both you have to specify it in the result