Message Boards Message Boards

What went wrong with this NDSolve command usage?

POSTED BY: INTAN SUPRABA
2 Replies

Hi,

The problem is that you trying to use lists as functions. Make functions from your list with Interpolation[]. Here is a simple example:

Plot[#, {s, 0, 10.}] &@ NDSolveValue[{q'[s] == Sin[s] q[s], q[0] == 1}, q[s], {s, 0, 10.}]
sin = Interpolation[Table[{s, Sin[s]}, {s, 0., 10., 0.1}]];
Plot[#, {s, 0, 10.}] &@  NDSolveValue[{q'[s] == sin[s] q[s], q[0] == 1}, q[s], {s, 0, 10.}]

I.M.

POSTED BY: Ivan Morozov

Dear Ivan,

Thanks for your response. I really appreciate it. Yes, you are right. It has something to do with the usage of lists. So I changed my equation into:

sol = NDSolve[{q'[t] == (a q[t]^b newefr[t] - q[t]) + (a q[t]^b (newefr[t] - newefr1[t])), q[1] == 0.001}, q, {t, 1, 456}]

where:

newefr = Interpolation[newefrain, InterpolationOrder -> 1]; where: newefrain = Table[rainfun[t]*ff, {t, 1, 456}]

similarly to newefr1:

newefr1 = Interpolation[newefrain1, InterpolationOrder -> 1]; where: newefrain1 = Table[rainfun[t]*ff1, {t, 1, 456}]

And it works! Thanks for your help!

Best Regards, Intan

POSTED BY: INTAN SUPRABA
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract