@JohnRudnicki wrote:
Actually, I am using MC 14 (I posted MC 11 for Luc).
I already suspected that, hence my question.
MC14/15 often behaves differently than MC11. We recently discovered in a thread here that this is especially true for the implementation of sums. In MC14/15 the symbolic evaluation of sums is identical to the numeric one. In MC11 the symbolic evaluation of sums follows a bit more the math standards - a sum from 1 to 0 yields 0, but unfortunately a sum from 1 to -1 should also return 0 but it doesn't. -> Re: Limit value sought - PTC Community
The symbolic evaluation never liked if-statements because the expressions are simplified before any specific values were applied and so the symbolic can't decide which branch to go.
Maybe it helps to define it using the Heaviside function (which fortunately is implemented with Phi(0)=0.5) which the symbolics usually can handle

RHS evaluates symbolically now, but the result is too large to display.
The same may apply to the symbolic evaluation of Jacob(...), but as it seemed to need infinite time to finish I cancelled the operation (I am not a very patient person).
BTW, the second argument (m) of your function "Gvec" is never used in that function. It rather uses the global variable n (=7)