@Sradharam I admit that the code is in need of some explanation.
Here I will just point to a few essential features.
1. Using the parameters option in dsolve ( here parameters=[f1,th1] ) sets up the result (here named respar) as a complete recipe for computation before any values are actually given to those parameters. This avoids having to call dsolve for every new pair of actual values for the parameters. To insert values for the parameters you just do
respar( parameters = [xx, yy]) or more explicitly respar( parameters = [f1=xx, th1=yy]), where xx and yy are actual numbers.
2. Using output = listprocedure instead of the default output = procedurelist makes it easy to extract the procedures you will actually use. In our case they are called F and TH. They compute values for f(xi) and theta(xi), respectively, when given a concrete value for xi. We need F(inf) = 0 and TH(inf) -1 = 0, where inf is here taken to be 10 later.
3. The procedure Q produces a list of the values F(inf) and TH(inf) -1 on input of concrete values for f1 and th1.
To make it possible to solve for f1 and th1 using either of the 3 methods I used I have made the procedures q1 and q2 return the single values F(inf) and TH(inf) -1, respectively. The option remember in Q implies that a call to q1 will make it very cheap to answer the call to q2. Both will be taken from the same call to Q.
4. Since respar( parameters = [xx, yy]) sets the parameters to the values xx and yy the parameters are reset many times when either of the 3 solution methods are used. Since we don't necessarily know what values are set last, the cautious user will set the parameters returned by either of the 3 methods if respar (or F or TH) is going to be used with those parameters. I used respar subsequently to plot using odeplot. I set respar at the result from fsolve.
5. I'm using the default rkf45 dsolve method as mentioned. This is a variable step method. It adjusts the step taken in order to make sure that the absolute and relative error bounds are satisfied. The classical RK4 method is a fixed step method, i.e. you choose the stepsize in advance. There is no error control.
Another drawback for RK4 is that the parameters option is not available for that method.