# Notation for numerical solutions to differential equations

Can somebody explain this notation to me? Using Mathematica's first example in the NDSolve documentation:

s = NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}]


The output is:

{{y -> InterpolatingFunction[{{0.,30.}}, <>]}}


What do all the curly brackets and the angle signs indicate? Why is there no indication of dependence on x?

I'm also curious why you have to use this result in what I consider to be an awkward way:

Plot[Evaluate[y[x] /. s], {x, 0, 30}, PlotRange -> All]


as opposed to simply:

Plot[s, {x, 0, 30}, PlotRange -> All]

-

The angle signs mean that you're looking at a shorthanded expression. Take a look at

FullForm[s]


to see the real thing.

The curly braces are there because NDSolve is going to give you consistently formatted results whether you look for only one function with only one solution or your solution involves more than one function, and more than one possible set.

As for the Evaluate thing inside the Plot isn't really needed, although in my opinion shows clearly what you're doing. In any case, if that disturbs you, you may do:

Plot[s[[1, 1, 2]][x], {x, 0, 30}, PlotRange -> All]


Edit:

The form of s is

s == {{y->InterpolatingFunction[{{0.,30.}},<>]}}


So

s[[1]] == {y->InterpolatingFunction[{{0.,30.}},<>]}


and

s[[1,1]] == y->InterpolatingFunction[{{0.,30.}},<>]


further

s[[1,1,2]] == InterpolatingFunction[{{0.,30.}},<>]


and that's why we are plotting s[[1, 1, 2]]

-