Optimizing Walking Time with a Function: Finding the Best Path to KFC

  • Thread starter Kolika28
  • Start date
  • Tags
    Function
In summary, the conversation discusses the optimal path for Ann to take around a pond in order to minimize her walking time. It is determined that the solution must be symmetric, and the distance and time calculations are outlined using simple geometry. The function to find the minimum time is also discussed, and it is noted that the derivative must be set equal to zero to find the optimal value.
  • #1
Kolika28
146
28
Homework Statement
Ann is in point ##(2,0)## and walks to KFC in ##(-2,0)##.On her way there’s a pond within the curve ##\big|x \big|+\big|y \big|=1##.She walks 5 km/h outside the pond and ##\frac{5\sqrt{5}}{2\sqrt{2}}## km/h in the pond. In which point does she enter the pond, or should she walk around?
Relevant Equations
The derivative.
Ok. So if i sketch the curve I can see that this pound has a shape of a square. Ann and KFC has the same distance from the pond. I'm able to calculate the time for Ann to walk around the pond, and if she walks in a straight line from where she stands to KFC.
If she walks around it will take about 0,96 hours and if she walks in straight line (enter pond in 1,0), it will take her 0,90. I did this using some simple geometry. But I don't know if Ann should rather enter the pond somewhere else to save time. So this must be an extreme value problem where I should make some sort of a function and find the derivative. I might be wrong about this, but that's the only assumption I have for now. How do I make such a function?
 
Physics news on Phys.org
  • #2
Assume that she enters the pond at some y value (by symmetry, she must stay at that y value within the pond) and compute the corresponding total time. Minimize wrt y.
 
  • #3
Orodruin said:
Assume that she enters the pond at some y value (by symmetry, she must stay at that y value within the pond) and compute the corresponding total time. Minimize wrt y.
Hmm, I'm not sure If I understand correctly. So if she enters at point (0.8, 0.2) she will leave the pond at point (-0.8, 0.2)? I don't understand the symmetry. Why will she stay at that y value within the pond?
 
  • #4
Kolika28 said:
So if she enters at point (0.8, 0.2) she will leave the pond at point (-0.8, 0.2)?
Yes.

Kolika28 said:
I don't understand the symmetry. Why will
Because the solution must be symmetric to be optimal. The argument is fairly simple. Consider the point where you cross x = 0. Minimizing time given that y(0) on both sides will give you the minimum total given that y(0). Both sides look exactly the same (just mirrored), so the solution must be symmetric. You can extend this argument to conclude that y is constant in the pond (try to do that yourself).

Edit: Note that if you had a non-symmetric path, then one of the sides would give a shorter time and the time could be made shorter by replacing the other side of the path by the mirror image of the shorter time side.
 
  • #5
Yes, she needs to cross the pond but, since she walks slower in the pond, she wants to make that part as small as possible. She can do that by walking directly from (x, y) to (-x, y). Now the portion of the boundary of the pond in the first quadrant is given by |x|+ |y|= x+ y= 1 or y= 1- x. So she first walks from (2, 0) to (x, 1- x), a distance of [itex]\sqrt{(x-2)^2+ (1- x)^2}[/itex] km. She walks that at 5 km/h so the time required to walk that is [itex]\left(\sqrt{(x-2)^2+ (1- x)^2}\right)/5[/itex] hours. (You don't say what units x and y are in but since you give her speed in "km/h" I will assume they are in km.). In the second quadrant, the edge of the pond is given by |x|+ |y|= -x+ y= 1 so y= x+ 1. She walks, in the pond, at [itex]\frac{5\sqrt{5}}{2\sqrt{2}}[/itex] from x to -x, a distance of 2x, which requires [itex]\frac{5\sqrt{5}}{\sqrt{2}}x[/itex] hours. Finally the last leg of the trip is, again by symmetry, the same as the first so also takes [itex]\left(\sqrt{(x-2)^2+ (1- x)^2}\right)/5[/itex] hours. The entire journey takes [itex]\left(2\sqrt{(x-2)^2+ (1- x)^2}\right)/5+ \frac{5\sqrt{5}}{\sqrt{2}}x[/itex]. Set the derivative of that equal to 0 and solve for x.
 
  • #6
HallsofIvy said:
Yes, she needs to cross the pond but, since she walks slower in the pond, she wants to make that part as small as possible. She can do that by walking directly from (x, y) to (-x, y). Now the portion of the boundary of the pond in the first quadrant is given by |x|+ |y|= x+ y= 1 or y= 1- x. So she first walks from (2, 0) to (x, 1- x), a distance of [itex]\sqrt{(x-2)^2+ (1- x)^2}[/itex] km. She walks that at 5 km/h so the time required to walk that is [itex]\left(\sqrt{(x-2)^2+ (1- x)^2}\right)/5[/itex] hours. (You don't say what units x and y are in but since you give her speed in "km/h" I will assume they are in km.). In the second quadrant, the edge of the pond is given by |x|+ |y|= -x+ y= 1 so y= x+ 1. She walks, in the pond, at [itex]\frac{5\sqrt{5}}{2\sqrt{2}}[/itex] from x to -x, a distance of 2x, which requires [itex]\frac{5\sqrt{5}}{\sqrt{2}}x[/itex] hours. Finally the last leg of the trip is, again by symmetry, the same as the first so also takes [itex]\left(\sqrt{(x-2)^2+ (1- x)^2}\right)/5[/itex] hours. The entire journey takes [itex]\left(2\sqrt{(x-2)^2+ (1- x)^2}\right)/5+ \frac{5\sqrt{5}}{\sqrt{2}}x[/itex]. Set the derivative of that equal to 0 and solve for x.
Thank you so much! It was a really good explanation. The only thing I'm wondering about. You write ##\frac{5\sqrt{5}}{\sqrt{2}}x##, but time is equal to distance/speed. So won't it be ##2x*\frac{2\sqrt{2}}{5\sqrt{5}}##??
 
  • #7
HallsofIvy said:
Yes, she needs to cross the pond but, since she walks slower in the pond, she wants to make that part as small as possible. She can do that by walking directly from (x, y) to (-x, y). Now the portion of the boundary of the pond in the first quadrant is given by |x|+ |y|= x+ y= 1 or y= 1- x. So she first walks from (2, 0) to (x, 1- x), a distance of [itex]\sqrt{(x-2)^2+ (1- x)^2}[/itex] km. She walks that at 5 km/h so the time required to walk that is [itex]\left(\sqrt{(x-2)^2+ (1- x)^2}\right)/5[/itex] hours. (You don't say what units x and y are in but since you give her speed in "km/h" I will assume they are in km.). In the second quadrant, the edge of the pond is given by |x|+ |y|= -x+ y= 1 so y= x+ 1. She walks, in the pond, at [itex]\frac{5\sqrt{5}}{2\sqrt{2}}[/itex] from x to -x, a distance of 2x, which requires [itex]\frac{5\sqrt{5}}{\sqrt{2}}x[/itex] hours. Finally the last leg of the trip is, again by symmetry, the same as the first so also takes [itex]\left(\sqrt{(x-2)^2+ (1- x)^2}\right)/5[/itex] hours. The entire journey takes [itex]\left(2\sqrt{(x-2)^2+ (1- x)^2}\right)/5+ \frac{5\sqrt{5}}{\sqrt{2}}x[/itex]. Set the derivative of that equal to 0 and solve for x.

Orodruin said:
Yes.Because the solution must be symmetric to be optimal. The argument is fairly simple. Consider the point where you cross x = 0. Minimizing time given that y(0) on both sides will give you the minimum total given that y(0). Both sides look exactly the same (just mirrored), so the solution must be symmetric. You can extend this argument to conclude that y is constant in the pond (try to do that yourself).

Edit: Note that if you had a non-symmetric path, then one of the sides would give a shorter time and the time could be made shorter by replacing the other side of the path by the mirror image of the shorter time side.

Thank you so much for your help (both of you). You really saved my day! :) The answer I got was that Ann will enter the pond at (0.5, 0.5) or (0.5, -0.5) given the symmetry. I hope this is right!
 
  • #8
Yes, that is correct. But you have to wonder if less than a minute savings is worth the time to take your shoes off and put them back on. :oldsmile:
 
  • #9
Why are you assuming Amy is wearing shoes?
 
  • #10
HallsofIvy said:
Why are you assuming Amy is wearing shoes?
Good point. She could have been at Burning Man and wearing nothing at all. :wideeyed:
 
  • #11
One of my neighbors told me that, when I was a child. we lived next to her for three years before she knew I HAD shoes!
 

1. What is a function?

A function is a block of code that performs a specific task and can be called or executed multiple times throughout a program. It can take in inputs, perform operations, and return an output.

2. How do I create a function?

To create a function, you use the keyword "function" followed by the name of the function and a set of parentheses. Inside the parentheses, you can include parameters that the function will take in as inputs. After the parentheses, you use curly brackets to enclose the code that the function will execute.

3. How do I call a function?

To call a function, you simply type its name followed by a set of parentheses. If the function takes in parameters, you would include the values for those parameters inside the parentheses. This will execute the code within the function.

4. How can I return a value from a function?

To return a value from a function, you use the keyword "return" followed by the value or variable that you want to return. This will end the execution of the function and pass the value back to where the function was called.

5. Can I use functions to make my code more efficient?

Yes, functions can help make your code more efficient by reducing repetition and allowing you to easily reuse code. By breaking down your program into smaller functions, you can also make your code more organized and easier to understand.

Similar threads

  • Calculus and Beyond Homework Help
Replies
9
Views
804
Replies
21
Views
4K
  • Calculus and Beyond Homework Help
Replies
11
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
910
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
Replies
11
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
3K
  • General Discussion
Replies
19
Views
3K
Replies
19
Views
1K
Back
Top