## 02ps-01 Symplectic Euler

• 0:00 - 0:04
Now we come to the first problem of Unit 2. This time we're still dealing with orbits.
• 0:04 - 0:07
We have a pendulum and we want to create expressions
• 0:07 - 0:09
for the position, velocity, and acceleration.
• 0:09 - 0:11
• 0:11 - 0:14
Here you can see the time set, the magnitude of the acceleration due to gravity,
• 0:14 - 0:17
and the length of the pendulum, which is just the length of the
• 0:17 - 0:20
string to which the bulb of the pendulum is attached.
• 0:20 - 0:24
What we're asking you to do is to first fill in this definition of the acceleration of the pendulum
• 0:24 - 0:27
showing how it depends on the position of the weight.
• 0:27 - 0:30
Now if you think about the way that a pendulum swings, you can imagine
• 0:30 - 0:32
that if we extend the trajectory, we would get a circle.
• 0:32 - 0:35
So position is the length of this curve path.
• 0:35 - 0:39
The next thing that you need to do is to fill in this function called symplectic Euler
• 0:39 - 0:45
in which logically you will use symplectic Euler method to calculate both distance and velocity.
• 0:45 - 0:49
To help you out a little bit, here is a refresher on what the symplectic Euler method says.
• 0:49 - 0:52
Another important piece of information if you're not super-comfortable with physics stuff
• 0:52 - 0:57
is Newton's second law right here showing the relationship between force, mass, acceleration.
• 0:57 - 0:59
So looking back at our code, you can see that we've created
• 0:59 - 1:03
empty arrays for you--for position and for velocity.
• 1:03 - 1:07
It's up to you to fill these arrays in including the initial conditions.
• 1:07 - 1:12
Remember you'll need to initialize x and v where x is zero and v is zero
• 1:12 - 1:15
equals something that you're going to figure out.
• 1:15 - 1:17
I'm going to give you a few hints though--you can see that we've created
• 1:17 - 1:21
this constant called num_initial condition and set it to equal to 50.
• 1:21 - 1:25
What you're really doing overall in this problem is looking at 50 different pendulums
• 1:25 - 1:30
which each have different initial values for x and v, and to give you a visual of what this looks like,
• 1:30 - 1:33
I'm going to show you the final plot that you'll get with this program.
• 1:33 - 1:38
So here's the set of graph that you should get as your final result if the program is working correctly.
• 1:38 - 1:42
You're going to ignore these top two graphs for now. Let's focus on this bottom plot.
• 1:42 - 1:47
This is showing velocity on the vertical axis and position on the horizontal axis.
• 1:47 - 1:52
If we look at the top two graphs, we can see that this green set of points right here
• 1:52 - 1:55
corresponds to what's happening at time zero.
• 1:55 - 2:00
Since green ellipse down here is showing the set of initial conditions
• 2:00 - 2:03
for the 50 different pendulums that we're looking at.
• 2:03 - 2:06
This green ellipse is kind of like a snap shot of what's happening
• 2:06 - 2:09
to all these different pendulums at time zero.
• 2:09 - 2:11
The way that I want you to figure out how to set
• 2:11 - 2:16
• 2:16 - 2:20
Now in Unit 1 you learned about orbits and you'll actually be able to use
• 2:20 - 2:24
some of that knowledge in this problem knowing that this green shape is an ellipse.
• 2:24 - 2:29
You can see that its major axis right here lies along the line v=0
• 2:29 - 2:33
and its minor axis lies along this line x=2.
• 2:33 - 2:37
Now the half length of the major axis is 0.25
• 2:37 - 2:40
so I guess actually it don't looks like the major axis here.
• 2:40 - 2:47
It's really the minor axis if these two sets of axes had the same scales applied to them.
• 2:47 - 2:52
Either way, this rightmost point on ellipse corresponds to x=2.25
• 2:52 - 2:56
and the leftmost point corresponds to x=1.75.
• 2:56 - 3:01
In terms of v, we have values ranging from -2 down here to 2 up here.
• 3:01 - 3:07
So think about what equations for x and v you'll need to create an ellipse with these dimensions.
• 3:07 - 3:10
That would be how you set the initial conditions for x and v.
• 3:10 -
I think this is a very interesting problem so I hope you enjoy doing it. Good luck.
Title:
02ps-01 Symplectic Euler
Description:

Re-recording of ps2-1

more » « less
Team:
Udacity
Project:
CS222 - Differential Equations
Duration:
03:14
 Amara Bot edited English subtitles for 02ps-01 Symplectic Euler Gundega added a translation

• Amara Bot
• Gundega