I use of the following differential equation:

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

Output. enter image description here

The solution in a plot. enter image description here

What is y[x]?

  • $\begingroup$ For this equation you won´t get a closed form solution. You can see details by clicking the "plus"-sign in the solution, and can evaluate the solution with e.g. func = y /. Flatten[s]; func[2.5] $\endgroup$ – mgamer Jul 26 '15 at 9:44
  • $\begingroup$ Many thanks. Is there any " Interpolating Polynomial" when we have some value of y[x]( For example: func = y /. Flatten[s]; func[2.5]=0.33)? $\endgroup$ – Bahram Agheli Jul 26 '15 at 14:48
  • $\begingroup$ The solution itself is an approximation to the solution. If you want a polynominal. You can make a series expansion for a certain point with the "Series"function of Mathematica, but I´m not sure if this makes any sense. $\endgroup$ – mgamer Jul 26 '15 at 16:27
  • $\begingroup$ Can help me about a series expansion for a certain point with the "Series" function of Mathematica? $\endgroup$ – Bahram Agheli Jul 26 '15 at 17:42

Maybe I now understand your question right, so give it a try. First the series approach. With the series function you can approximate a function with a Taylor-Series. In the first step I calculate the maxima of your solution:

seedMax = Table[t, {t, 6, 30, 0.5}];
solsMax = Quiet @ FindMaximum[func[x], {x, #}] & /@ Flatten[seedMax];
xMax = x /. (Last /@ solsMax);
xMax = Union[xMax, SameTest -> (Abs[#1 - #2] < 0.0001 &)];

The "Union Stuff" is just to identify nearby solutions as identical. Now we take the maximum near 7 as our x0 in the Taylor series


and do the approximation (third degree here)

approx = Series[func[x], {x, x0, 3}] // Normal

In the neighborhood of the maximum this is a quite good approximation to the solution (but only in the neighborhood):

Plot[{func[x], approx}, {x, 7, 8}]

Plot around the first maximum

You can also determine the maxima and minima and fit the resulting data with a polynominal, but this is not very satisfactory (eg. picture for approximation of degree 20).

approx with polynominal of degree 20

BTW I do not think, that this type of Solution produces a polynominal. It should be a (damped) trigonometric function. But polynomials could be good in the neighborhood of extrema.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.