Calculus of variations: time of travel between two points

I'm reading Calculus of Variations by Elsgolc. On the page 35 there is example number 7.

Let me introduce the problem.

We have a functional given by:

$v(y(x)) = \int_{x_0}^{x_1}F(x,y,y')dx$

If $F$ depends only on $y'$: $F=F(y')$ the Euler equation is $\frac{d^2 F}{d y'^2}y''=0$ and the solution (the extremals) is a two-parameter family of stright lines: $y = C_1x+C_2$.

Ok, now lets move to the mentioned example:

EXAMPLE 7. Let $t(y(x))$ be the time in which a particle moves from a point $A(x_0,y_0)$ to some other point $B(x_1,y_1)$ along a curve $y=y(x)$ with velocity $ds/dt=v(y')$. If this velocity depends only on $y'$, t is a functional of the form: $t(y(x))=\int_{x_0}^{x_1}\frac{\sqrt{1+y'^2}}{v(y')}dx$, $\frac{ds}{dt}=v(y')$, $dt = \frac{ds}{v(y')} = \frac{\sqrt{1+y'^2}dx}{v(y')}$, $t=\int_{x_0}^{x_1}\frac{\sqrt{1+y'^2}}{v(y')}dx$. Consequently the extremals of this functional are straight lines.

Now let suppose that we have point $A=(0,0)$, point $B=(\pi,\pi)$ and a velocity profile of the form: $v(y') = \frac{1}{1+e^{1000(y'-0.99)}}+\frac{1}{1+e^{-1000(y'-1.01)}}+0.1$ It means that for $dy/dx\approx1$ it it equal $0.1$ and for other cases is equal $1.1$: And family of trajectories given by: $y=a\cdot \sin(x)+x$: For such conditions one can obtain the following solution: It means that also other curves than straight lines give us an extremum. In this case for parameter $a\approx\pm0.7$ we obtain minima.

So where is the mistake in my reasoning?

P.S. Here is the MATLAB code for creating charts:

dydx = linspace(0,5,10000);
V = @(x)(1./(1+exp(1000*(x-0.99)))+1./(1+exp(-1000*(x-1.01))))+0.1;
plot(dydx,V(dydx))
%%
x = linspace(0,pi,10000);
figure
hold all
c = [];
for a = linspace(-4,4,50)
f = @(x)a*sin(x)+x;
plot(x,f(x))
c(end+1)=trapz(x(1:end-1),sqrt(1+(diff(f(x))./diff(x)).^2)./V(diff(f(x))./diff(x)));
end
figure
plot(linspace(-4,4,50),c)
• In what sense is your velocity profile a function of $y'$ alone? The example explicitly assumed that dependence in concluding that the externals were straight lines. Nov 7 '14 at 12:20
• It means that in this special case velocity depends only on direction (y'), not on position in space. The example doesn't assume anything about trajectory shape.
– mc2
Nov 7 '14 at 14:42
• What I'm getting at is that your velocity profile $$v(y') = \frac{1}{1+e^{1000(x-0.99)}}+\frac{1}{1+e^{-1000(x-1.01)}}+0.1$$ is explicitly a function of $x$, rather than $y'$. So I don't see how the example contradicts yours, since its assumptions exclude the proposed counter-example. Nov 7 '14 at 15:08
• Sorry, it was a typo. I fixed it.
– mc2
Nov 7 '14 at 21:34