# Problems with NDSolve and NDSolveValue [closed]

I have solved, with NDSolve, a differential equation. Now, I want to use this numerical solution in another system of differential equations, but I don't now how to do it. Could you help me?

Edit1: The first equation is this

Friedmann1 = Cu/Derivative[1][y][x]^2 + R/(y[x]^2 Derivative[1][y][x]^2) + M/(y[x] Derivative[1][y][x]^2) + (\[CapitalLambda] y[x]^2)/Derivative[1][y][x]^2;


which I solve using

s1\[CapitalLambda]CDM = DSolve[{Friedmann1 == 1, y[0] == 1}, y, {x, -0.9637, 0.9637}][[1]]


Up to now there are not problems: I have solved and plotted the solution. Now, I will consider the following equations

CovariantDM = DMm'[t] + 3 y'[t]/y[t] DMm[t] + Q[t];
CovariantDE = DE'[t] + 3 y'[t]/y[t] DMm[t] (1 + w[t]) - Q[t];
Variance0 = w'[t]/w[t] + DE[t]/Q[t]


Which I want to solve using

solmod1a = NDSolve[{CovariantDE == 0, CovariantDM == 0, Variance0 == 0,
DMm[0] == 0.25, DE[0] == 0.7, w[0] == -1}, {DMm, DE,
w}, {t, -.9798, 0.97}][[1]]


I would like to use the numerical solution that I have already obtained in the last line of code, as a input. Is this possible? Thank you for your patience.

Edit2: I solved my previous problem using NDSolveValue as suggested here. The equation has been solved using

a = NDSolveValue[{Friedmann1 == 1, y[0] == 1}, y, {x, -0.93, 0.93}]


When I try to put the solution in another system of ODE using this code

In[8]:= CovariantDM = DM'[t] + 3 a'[t]/a[t] DM[t] + Q[t];

In[9]:= CovariantDE = DE'[t] + 3 a'[t]/a[t] DE[t] (1 + w[t]) - Q[t];

In[10]:= Variance0 = w'[t]*Q + DE[t]*w[t]

Out[10]= DE[t] w[t] + Q Derivative[1][w][t]

In[11]:= Q = 0;

In[13]:= {DMsol, DEsol, wsol} = NDSolve[{CovariantDE == 0, CovariantDM == 0, Variance0 == 0,
DM[0] == 0.25, DE[0] == 0.7, w[0] == -0.85}, {DM, DE, w}, {t, -0.93, 0.93}]


where a[t] has been obtained with the first equations I solved, I obtain

During evaluation of In[13]:= NDSolve::nlnum: The function value {0.315013 -0[0.],0.750031 +0[0.],-0.595} is not a list of numbers with dimensions {3} at {t,DE[t],DM[t],w[t],(DE^\[Prime])[t],(DM^\[Prime])[t],(w^\[Prime])[t]} = {0.,0.7,0.25,-0.85,0.,0.,0.}.

During evaluation of In[13]:= NDSolve::icfail: Unable to find initial conditions that satisfy the residual function within specified tolerances. Try giving initial conditions for both values and derivatives of the functions.

During evaluation of In[13]:= NDSolve::nlnum: The function value {0.315013 -0[0.],0.750031 +0[0.],-0.595} is not a list of numbers with dimensions {3} at {t,DE[t],DM[t],w[t],(DE^\[Prime])[t],(DM^\[Prime])[t],(w^\[Prime])[t]} = {0.,0.7,0.25,-0.85,0.,0.,0.}.

During evaluation of In[13]:= NDSolve::icfail: Unable to find initial conditions that satisfy the residual function within specified tolerances. Try giving initial conditions for both values and derivatives of the functions.

During evaluation of In[13]:= Set::shape: Lists {DMsol,DEsol,wsol} and {} are not the same shape.

Out[13]= {}


• I think you are looking for NDSolveValue. Have a look in the documentation. – user21 Jul 6 '18 at 6:12
• The error message talks about 0[t]. That's because you have Q[t] in your equations, but set Q=0. Q can't be both a function and a constant here. – Chris K Jul 6 '18 at 13:49