As we know, finding the arc length of a function $f(x)$ from $x=a$ to $x=b$ is straightforward and can be implemented numerically.
For a particular function $f(x)$ that I have, suppose that I have numerically computed its arclength to be approximately $L$ using Simpson's rule.
Now, for a set of values $\ell_k$ such that $0 \le \ell_k \le L$, I want to find $x_k\in [a,b]$ for which the arc length of $f(x)$ from $x=a$ to $x = x_k$ is $\ell_k$.
I am not sure what's the best way to do this numerically but I followed the suggestion here. That is, if $L(x)$ is the arclength function, $L(x) = \int_a^x \sqrt{1+f'(x)^2} dx$ which yields a differential equation $\frac{dx}{dL} = \frac{1}{\sqrt{1+f'(x)^2}}$.
Solving this differential equation numerically is then not much of a problem. I used the initial condition that the $x-$value corresponding to arclength 0 is $x=a$.
Now, inevitably, numerical errors arise. That is, after solving the differential equation numerically, the $x-value$ corresponding to length $L$ is not exactly $b$. Oftentimes, it goes slightly beyond $b$. I used Matlab's ode45 to solve the differential equation.
I am wondering if I can impose two conditions on this equation, i.e. $x(0) = a$ and $x(L) = b$. If so, how can I solve the ODE numerically? It seems like bvp methods don't apply.
Any suggestions?
The naive approach (which is possibly justified and adequate in this particular case due to how you obtained $L$ in the first place) is this:
In evaluating $L$, you did in fact practically evaluate $\ell(x)$ (such that $L = \ell(b)$). What you are looking for is $x(\ell)$, its inverse. Thus my suggestion would be to either
This may appear brute force, but it has two justifications:
If you feel you need more accurate results, I suggest the following:
Say you find that $\ell(x_i) < \ell_k$ and $\ell(x_{i+1}) > \ell_k$. My first advice is to assume that $\ell(x_i)$ is exact, because if it isn't, everything afterwards including $L$ will be wrong as well. So doubting $\ell(x_i)$ at this particular point isn't a very good model - if you doubt $\ell(x_i)$, rerun with a smaller $x_{i+1} - x_{i}$. So $\ell(x_i)$ and $\ell(x_{i+1})$ are accurate, but you need values in between.
All in all you might want to consider using the trapezoid scheme instead of Simpson (first degree Newton-Cotes) because it is easier to interpolate (the intermediate $x_k$ would (consistently with all other numbers!) lie between $x_i$ and $x_{i+1}$ as $\ell_k$ does between $\ell(x_i)$ and $\ell(x_{i+1})$.
All in all, pending contrary opinions, I believe that this approach is as computationally expensive as solving a whole new ODE, and numerically stable in the sense that it maintains the accuracy you've achieved with computing $L$, and gives you $x$ values that are consistent with $L$.