> Hi all, > > This question is perhaps too vague to have a meaningful answer, but > here it goes. > > In what follows, I am only interested in functions defined in some > interval of the type [0,a], with a > 0. > > Suppose that I want to solve numerically the ODE f'(x) = 2*sqrt(f(x)), > under the condition f(0) = 0. Of course, the null function is a > solution of this ODE. The problem is that I am not interested in that > solution; the solution that I am after is f(x) = x^2. > > For my purposes, numerical solutions are enough, but if I try to solve > numerically an ODE of the type f'(x) = g(f(x)) (with g(0) = 0) and > f(0) = 0, what I get is the null function. So far, my way of dealing > with this has been to solve numerically the ODE f'(x) = g(f(x)) and > f(0) = k, where _k_ is positive but very small and to hope that the > solution that I get is very close to the solution of the ODE that I am > interested in (that is, the one with k = 0). Do you know a better way > of dealing with this problem?
There is a standard trick for dealing with this type of problem for ODEs of the form dy/dx = g(y). Note that y = f(x) is a solution of this equation, then so is y = f(C + x) with an arbitrary constant C. Also, y = f(C - x) is a solution of dy/dx = -g(y). You can use this to work backward and forward from an arbitrary point where the equation is not singular and then translate the solution along the x-axis to satisfy the boundary condition.
For the case you mention, you might start by solving the IVP dy/dx = -2 sqrt y y(0) = 1 (instead of 1 any positive number will do) This should give you a solution that looks like f_1(x) = (1-x)^2 on [0, 1]. (What happens past 1 probably depends on the algorithm used). Because f_1(1) = 0, you know that there is a solution to your original problem that looks like (1 - (1 - x))^2 on [(1-1), (1-0)]. You can then complete the solution by solving the IVP dy/dx = 2 sqrt y y(1) = 1