The Sine River is located between y = sin(x) and y = 1 + sin(x) (x in radians, not degrees).
Your starting point is on the shore, at location (0,0) and your destination is location (5,1).
Your running speed is 1 unit per minute.
Your swimming speed is 1/2 units per minute.
Your plan is to divide the trip into three legs (run, then swim, then run) each leg being a straight line. Assuming there is no current in the river (and no wind), what is the minimum travel time to the destination, and by what pathway?
Since the swimming speed is half the running speed, this can be treated as a light ray where the river has an index of refraction equal to 2, using Snell's law.
The commented code at the top was used to get a diagram to better visualize the situation. The active code was the final stage to get the appropriate starting slope.
% fplot(@(x)sin(x));
% axis 'equal'
% grid on;
% hold on
% fplot(@(x)1+sin(x));
% axis 'equal'
clearvars,clc
syms x
for angle1=7.79878848:.0000000001:7.79878849
slope1=tand(angle1);
eq1=slope1*x==sin(x);
x1=eval(vpasolve(eq1,x,3));
y1=slope1*x1;
slope2=cos(x1);
slopeNorm=-1/slope2;
angleNorm=atand(slopeNorm);
incident=angleNorm-angle1;
refract=asind(sind(incident)/2);
angleInWater=angleNorm-refract;
slopeInWater=tand(angleInWater);
eq2=slopeInWater*(x-x1)+y1==sin(x)+1;
x2=eval(vpasolve(eq2,x,3));
y2=sin(x2)+1;
slope3=cos(x2);
slopeNorm=-1/slope3;
angleNorm=atand(slopeNorm);
incident=angleNorm-angleInWater;
refract=asind(2*sind(incident));
angleOnLand=angleNorm-refract;
slopeOnLand=tand(angleOnLand);
y3=y2+slopeOnLand*(5-x2);
fprintf('%12.10f %12.10f %4.2f %4.2f %4.2f %4.2f
',angle1,y3,x1,y1,x2,y2)
end
starting y coordinate location (x,y)
angle when x=5 entering exiting
water water
7.7987884847 0.9999999999 2.75 0.38 3.41 0.74
7.7987884848 1.0000000000 2.75 0.38 3.41 0.74
7.7987884849 1.0000000000 2.75 0.38 3.41 0.74
7.7987884850 1.0000000000 2.75 0.38 3.41 0.74
7.7987884851 1.0000000000 2.75 0.38 3.41 0.74
7.7987884852 1.0000000000 2.75 0.38 3.41 0.74
7.7987884853 1.0000000000 2.75 0.38 3.41 0.74
7.7987884854 1.0000000000 2.75 0.38 3.41 0.74
7.7987884855 1.0000000000 2.75 0.38 3.41 0.74
7.7987884856 1.0000000001 2.75 0.38 3.41 0.74
Initial Slope 7.7987884852 is used.
Modified program to get more stats at given starting slope:
% fplot(@(x)sin(x));
% axis 'equal'
% grid on;
% hold on
% fplot(@(x)1+sin(x));
% axis 'equal'
clearvars,clc
syms x
for angle1=7.7987884852
slope1=tand(angle1);
eq1=slope1*x==sin(x);
x1=eval(vpasolve(eq1,x,3));
y1=slope1*x1;
slope2=cos(x1);
slopeNorm=-1/slope2;
angleNorm=atand(slopeNorm);
incident=angleNorm-angle1;
refract=asind(sind(incident)/2);
angleInWater=angleNorm-refract;
slopeInWater=tand(angleInWater);
eq2=slopeInWater*(x-x1)+y1==sin(x)+1;
x2=eval(vpasolve(eq2,x,3));
y2=sin(x2)+1;
land=norm([0,0]-[x1,y1]);
water=norm([x1,y1]-[x2,y2]);
slope3=cos(x2);
slopeNorm=-1/slope3;
angleNorm=atand(slopeNorm);
incident=angleNorm-angleInWater;
refract=asind(2*sind(incident));
angleOnLand=angleNorm-refract;
slopeOnLand=tand(angleOnLand);
y3=y2+slopeOnLand*(5-x2);
land=land+norm([x2,y2]-[5,y3]);
fprintf('%12.10f %12.10f %12.10f
',angle1,slope1,y3)
fprintf(' %14.12f %14.12f %12.10f %14.12f %14.12f %12.10f
', ...
x1,y1,slopeInWater,x2,y2,slopeOnLand)
fprintf('%12.10f %12.10f
',land,water)
end
7.7987884852 0.1369614190 1.0000000000
2.754723470620 0.377290835513 0.5473546539 3.409235511521 0.735541047127 0.1662464524
4.3930379165 0.7461428991
I'd start off at a slope of 0.13696 (geographically 7.7988 degrees north of east) so I'd arrive at the river at (2.7547,0.37729). Then I'd swim at slope 0.54735 (28.694° north of east) to reach the opposite bank at (3.4092,0.73554). I'd then proceed on foot at slope 0.16624 (9.4389° north of east) to reach the destination.
I'll have traveled 4.3930 units on land and 0.74614 units swimming, taking 5.8853 minutes (rounded from the full precision).
Edited on June 15, 2024, 4:25 pm
|
Posted by Charlie
on 2024-06-14 13:11:51 |