# Dimension mismatch with integrate_ode and single dimension y

Hi

I’m having some problems with a very simple ode which has a single dimension.
(It’s analytically solvable which I know is preferred, it’s the first piece in a model which is not).

In the examples for using the ODE solver in stan the state always has more than 1 dimension,
e.g. real y[N, 2].

If I want to have y have a single dimension: real y[N] I get a dimension mismatch.
Is this deliberate? Do I need to always define the state and initial conditions as
real y[N, 1]? Or should “real y[N]” work?

Hi. If you’re simulating/fitting an ODE with one state then you have to declare `y` as you stated in order for the Stan program to parse. For the sake of clarity (in the context of simulation),

``````...
generated quantities {
real y[N,1];
y = integrate_ode_rk45(ode_func, yini t0, time, theta, x_r, x_i);
}
``````

If you need `y` to be of dimension `y[N]` so that it’s compatible with some other part of the model then you can use the `to_array_1d` or `to_vector` function (see the Mixed Operations section of the Stan Reference Manual which starts on p.474).