How to define vector Expression with complicated piecewise behavior?
For simple expressions, I am able to use the usual Expression syntax. My piecewise expression seems too complicated for the "conditional" option. I found this approach:
but I have 2 problems with that.
1) I can get it to work, I don't understand how and why. I'd like to understand better before using it. Can anyone explain or point me to the right place in the documentation.
2) the link describes the scalar case. I tried and failed to do the vector case. I would appreciate help with that. Maybe the answer to my first question will also help me to generalize it myself.
I was able to figure out my answer at this page:
See the first example in Section 3. I had not changed the
return (1,) to
return (2,) in the example at the link in the original question.