Three days ago, I asked a question about B-Spline Basis fuction here
@Michael E2 given a solution to make the order of interval looks normal
The easiest way would be to sort it afterwards: MapAt[SortBy[Last], piecewisefn, 1], piecewisefn is the result of NBSpline. (Use SortBy[#, Last] & instead of SortBy[Last] if you're using V9 or earlier.)
Trial 1
sortResult[res_] := MapAt[SortBy[#, Last] &, res, 1] /; res != 0
sortResult[0] := 0;
knots={1, 2, 2, 4, 5, 7};
sortResult[NBSpline[1, 2, u, knots]]
Trial 2
NBSpline[1, 3, u, {1, 2, 2, 4, 5, 7}]// MapAt[SortBy[#, Last] &, #, 1] &
This time, it gives me a normal order $2 \leq u <4, 4 \leq u <5, 5 \leq u <7$
Question:
How to revise it ? And can someone give me a explanation about this case?


tmp = NBSpline[1, 2, u, knots]; sortResult[tmp]; tmp? – kglr Oct 18 '14 at 07:43