My question is: how to define a corresponding function in the case of an ODE system?
My following attempt to devise an analogous function failed:
sol=NDSolve[{Subscript[u, 1]'[t]+Subscript[u, 1][t]-Subscript[u, 2][t]==0,Subscript[u, 2]'[t]-Subscript[u, 1][t]+Subscript[u, 2][t]==0,Subscript[u, 1][0]==1,Subscript[u, 2][0]==2},{Subscript[u, 1][t],Subscript[u, 2][t]},{t,0,1}];
Subscript[uns, i][t_]:=Evaluate[sol[[1]][[i]][[2]]];
Part::pkspec1: The expression i cannot be used as a part specification.
Subscript[uns, 1][1/2]
It seems that “i” must be a predefined constant, so how one can access a relevant FunctionInterpolation object corresponding to a variable “i”? Or is there a better alternative?
If you believe there is no difference, then try my first example (single ODE) without calling “Evaluate”.
Especially when you want to plot the solution.
It would be nice if one could find some explanation in manuals, or in the online help, why in some cases “Evaluate” is necessary and in some other it is not. In my opinion, the main problem with MATHEMATICA is that almost nothing is explained, with regard to what this program actually does, and why. It would be nice if the producers took this observation into account.