Use inline expression instead of parse for differentiation of ifelse funtion