Here is classic (and difficult) physics problem that poses an interestingquestion:

Take two points in space, Point 1 and Point 2. What is the path from point 1 to 2 that a frictionless object could slide in the least amount of time? Assume a constant gravitational field.

Here are two points with different paths. One might be faster, but whichwould be fastest? The solution to this problem is traditionally called the brachistochrone curve.

This difficult and interesting question has historical significance. The brachistochrone solution contributed to the creation of the calculus of variations . I won’t go into details, but I will remind you that Lagrangian mechanics is based on the calculus of variations.

The traditional textbook approach hereis to first solve for the time to slide down a curve. Since acurve isn’t straight, you mustset this up as an integral in which you calculate the time required for many small “straight” segmentsand add them up. That’s not too difficult. The tricky part is finding the function (curve) that gives the minimum value after integrating. It’s like a max-min problem in calculus butway harder.

I’ve gone over the derivation of the calculus of variations when I teach classical mechanics, but I’ve never been satisfied. I always feel it’s sort of a magical and mysterious step to find this function that minimizes the integral, and I just follow along with the textbook much likeI just follow my phone’s directions when trying to find a new location.

But with any great problem, there is more than one way to solve this. What about some type of numerical solution? Yes, that’s what I’ll do―at least for one of the solutions.

Human Intuition

I have an idea for a game. A physics game withcomplicated problems. The user (player) tries to guess at solutions without actually solving theproblems. Of course, such games already exist―basketball and baseball deal with projectile motion, even if no one actually solves for these trajectories. But what about guessingthe energy levels for some quantum object? Or the speed for a stable planetary orbit? Thatcould be a fun game.

But here is a real example: Can you estimate the path that would let a bead slide down a wire in the shortest time? Well, I put together some python code that let’s you test your intuition. Here’s how to play:

Adjust the gray balls to change the path of the curve from Point 1 to Point 2. Hint: you can click and drag in a path and it should move the points as you pass over them. Click “run” and watch the bead slide. The timer will revealthe total slide time. You can try again. Just click “pause” and “reset” and you should be good to go.

Here is the program.

If you really want to look at the code, here it is . I’ll be honest, I still don’t completely understand the buttons or mouse interactions, but I gotit to work.

Try different paths. See if you can get a fastertime. Yes, if you make the track go higher than the starting point, it won’t work (hopefully you already tested that). I tried to add comments to the code so you can play with it. There are two things you might change. First, adjustthe number of movable points on the path. Second, tweakthe location of the second point. Both can be fun.

Numerical Solution

The key to a numerical solution is to take a complicated problem and break it into a bunch of simpler problems. What if there was just one moveable point between two fixed points?

Here I can move the middle position up and down (with a variable y ) and calculate the time it takes to go from Position 1 to 2. Let me make this slightly different than the original problem. In this case, I am going to let the bead beginat Position 1 with some starting velocity. The bead will speed up as it moves to the middle point (assuming I move it lower than the starting point).

Calculating the time to reach the midpoint isn’t difficult, but it is a bit tedious. First, I will calculate the speed of the bead at the midpoint. Here, I can use the Work-Energy Principle. Using gravitational potential energy and a change in kinetic energy, I get:

For the travel time, I need the average speed and the distance. The average speed isthe sum of the starting and ending velocity divided by two (since the acceleration is constant). I will call the distance for this partial path the variable s . It will have the following value.

Perhapsyou noticed that I am calling “down” the positive y-direction. I hope that didn’t mess you up. Now I can put the average speed together with the distance to get the slide time. Remember the bead muststay on the wire so it’s a one dimensional problem.

Yes, both v 2 and s depend on the vertical position― y . But wait! We still aren’t finished. Now I mustdo the same thing for the path from the midpoint to Point 2. Remember two important things. First, the final velocity for the first part is the starting velocity for the second part. Second, it’s very possible that the acceleration for the bead is negative (if the wire goes up).

However, the point is that it’s entirely possible get an expression for the bead-time in terms of the variable y. With that expression, this things could be turned into a classic max-min problem. It could be done, but it would get messy. So instead, I’m going to do something else.

What if I just put the middle point at some value of y and then calculate the total time. Next, I will move the y position and calculate the total time again. With that, I could make a plot of slide-time vs. y-position. It would be so simple that I could do it right now.

Go ahead and examine the code if you like , but it’s a pretty simple program. As you can see, there is a y-position that gives a minimum time. But how do I know it’s not just some bogus graph? Maybe it just looks correct because it’s curvy and red? Well, there’s a fewthings I know for sure. I know the final speed of the bead. No matter what the path, the Work-Energy Principle dictates that final speed―so that’s something I can check. And what about special cases? I can easily solve for the slide-time in the case of a straight line. I can also solve for the time with point 2 directly below point 1 (but that is kind of boring). With these checks, I feel more comfortable about my model.

Now to put this calculation to something more useful. I just need to run the same calculation for every point in my curve. Yes, this can be slow―but it works. Here’s what that looks like. Click “play” to start it.

I think that’s pretty awesome. Honestly, this took me quite a bit longer to put together than I expected. In the end, it looks pretty nice. Oh, you say it’s not the fastest solution? Well, have you ever tried solving this problem on paper? It’s pretty tough.

Calculus of Variations But how does my solution compare to the traditional textbook answer? By the way, if you want to go over the derivation, I suggest looking at

tags: time,point

1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责；
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性，不作出任何保证或承若；
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。