Need to know about error message and the way out........
when you call e() in the solve block twice you have to write e(t, x(t)) instead of just e(t,x).
It also helps significantly speeding up the calculations if you predefine the used derivations of Xp and lamdap.