CS 282.  Any question about… ◦ SVN  Permissions?  General Usage? ◦ Doxygen  Remember that Project 1 will require it  However, Assignment 2 is good.

Slides:



Advertisements
Similar presentations
Formal Computational Skills
Advertisements

N-Body Simulation Michael Mersic CS680.
CS 282.  Review of projectile physics  Examine gravity projectile model  Examine drag forces ◦ Simulate drag on a projectile  Examine wind forces.
CS 282.  Last week we dealt with projectile physics ◦ Examined the gravity-only model ◦ Coded drag affecting projectiles  Used Runge-Kutta for approximating.
6.7 Applications of Rational Expressions. Objective 1 Solve problems about numbers. Slide
Error Measurement and Iterative Methods
Today: 1. Hand back/review Test 1 2. Lecture on Section 3.1, with HW 3.1 due tomorrow 3. Daily Quiz at end of hour, on Test 1 questions.
CS 282.  Questions about Assignment 1?  Questions about last week’s lab?  Otherwise, please sit next to your partner (or someone else if your partner.
Area between two curves: A standard kind of problem is to find the area above one curve and below another (or to the left of one curve and to the right.
Physics 218, Lecture V1 Physics 218 Lecture 5 Dr. David Toback.
The Islamic University of Gaza Faculty of Engineering Numerical Analysis ECIV 3306 Introduction.
Numerical Solutions of Ordinary Differential Equations
Free Fall Lecture 3.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 1 Mathematical Modeling.
Please open your laptops, log in to the MyMathLab course web site, and open Daily Quiz 18. You will have 10 minutes for today’s quiz. The second problem.
Numerical Solutions to ODEs Nancy Griffeth January 14, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis.
Please CLOSE YOUR LAPTOPS, and turn off and put away your cell phones, and get out your note-taking materials. Today’s daily quiz will be given at the.
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 13.
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
Numerical Integration Methods
Numerical Methods Adam Keaney Aisling Butler Jody Monahan
FW364 Ecological Problem Solving Lab 4: Blue Whale Population Variation [Ramas Lab]
Physics Activity #4 9/30/14. Objective:  To measure the acceleration of gravity in the lab, by using two different methods.
Linear Motion with constant acceleration Physics 6A Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB.
Game Physics – Part I Dan Fleck Coming up: Rigid Body Dynamics.
Kinematics in One Dimension. Mechanics Kinematics (Chapter 2 and 3) The movement of an object itself Concepts needed to describe motion without reference.
Chapter 9 Numerical Integration Flow Charts, Loop Structures Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 6 Finding the Roots of Equations
Chapter 1 Computing Tools Analytic and Algorithmic Solutions Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
CS 122 Engineering Computation Lab Lab 2 Dan De Sousa and Tim Cheeseman Department of Computer Science Drexel University April 2009 ©By the author. All.
Numerical Methods Applications of Loops: The power of MATLAB Mathematics + Coding 1.
Section 8.1 Estimating  When  is Known In this section, we develop techniques for estimating the population mean μ using sample data. We assume that.
Tom Wilson, Department of Geology and Geography tom.h.wilson Dept. Geology and Geography West Virginia University.
Kinematics in One Dimension We will focus today on problem- solving. Note: some problems are hard, some are not so hard. Part of the learning is recognizing.
PASS Senior Tutorial Review Using the calculator to help you. Equation Manipulations And Griddables.
CS 123 Engineering Computation Lab Lab 2 Dan De Sousa and Bruce Char Department of Computer Science Drexel University April 2009 ©By the author. All rights.
Big Oh CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and Computer Science University of Wisconsin.
CFD Refinement By: Brian Cowley. Overview 1.Background on CFD 2.How it works 3.CFD research group on campus for which problem exists o Our current techniques.
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 12.
4-6 Solving Absolute Value Equations & Inequalities
CHAPTER 3 NUMERICAL METHODS
Solving Inequalities by adding or subtracting, checking the inequality & graphing it!! This is so easy you won’t even need one of these!!!
Newton’s Method, Root Finding with MATLAB and Excel
Introduction to the Runge-Kutta algorithm for approximating derivatives PHYS 361 Spring, 2011.
Honors Physics 28 Sept 09 Today: Intro to on-line text and acceleration Homework: Read section 2.2 p Text address: Tomorrow: We.
 In this packet we will look at:  The meaning of acceleration  How acceleration is related to velocity and time  2 distinct types acceleration  A.
PHY 301: MATH AND NUM TECH Contents Chapter 10: Numerical Techniques I. Integration A.Intro B.Euler  Recall basic  Predictor-Corrector C. Runge-Kutta.
Lecture 40 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
ME451 Kinematics and Dynamics of Machine Systems Numerical Integration October 28, 2013 Radu Serban University of Wisconsin-Madison.
Unit 0-Day 4 Click when ready for answers 1. Graph y = -x Graph 0 = y – 3x  y = ½ x + 1 when we solve for y.
Winter 2016CISC101 - Prof. McLeod1 CISC101 Reminders Assignment 5 is posted. Exercise 8 is very similar to what you will be doing with assignment 5. Exam.
Copyright © Cengage Learning. All rights reserved. 4 Integrals.
S5.40. Module Structure 30% practical tests / 70% written exam 3h lectures / week (except reading week) 3 x 2h of computer labs (solving problems practicing.
Numerical Integration Methods
Linear Motion with constant acceleration
Solving Systems of Equations
Example: Consider the following equations of motion for a submarine in the dive plane زمستان 1382 Dr. H. Bolandi.
ZCE 111 Assignment 11.
Do Now: Kinematic Chart
Mechanical Engineering at Virginia Tech
Class Notes 18: Numerical Methods (1/2)
Autonomous Cyber-Physical Systems: Dynamical Systems
Another method for solving systems of linear equations
Numerical Integration Methods
Practical Application of Integral Calculus
Solving for x and y when you have two equations
Numerical Computation and Optimization
Straight Line Motion (continued)
Presentation transcript:

CS 282

 Any question about… ◦ SVN  Permissions?  General Usage? ◦ Doxygen  Remember that Project 1 will require it  However, Assignment 2 is good practice place ◦ Assignment 2  Is posted on the class website

 Go over methods of integration ◦ Euler’s method ◦ Analytical ◦ Approximation  Examine the boat problem  Program Runge-Kutta ◦ Compare against analytical and euler methods ◦ Plot position vs. time (due next week’s lab)

 We use integration to move our system forward in time given a force/control  If you remember the falling ball lab, we used an Euler method (kind of like cheating) to integrate ◦ velocity = old_velocity + delta_time * acceleration ◦ position = old_position + delta_time * velocity  There exists better methods, however, for integration.

 Let’s say we are trying to solve the equation x – 5 = 0  Analytical methods solve for the exact answer ◦ In this case it’s easy to come up the analytical answer x = 5  Let’s assume we weren’t so smart. Then we could develop an algorithm to numerically solve this problem on a computer ◦ The algorithm could have the computer “guess” the answer by testing different values of x. We could specify our “error tolerance” to speed this process up.

Forces on the boat: B = BuoyancyT = Thrust W = WeightR = Resistance If B = W, we can ignore the movement in y

 new_velocity = old_velocity + acceleration * dt  new_position = old_position + new_velocity * dt  Pros: ◦ Easy to compute ◦ Easy to understand ◦ This means it’s also easy to program  Cons: ◦ Highly erroneous ◦ Not stable (i.e. tends to not converge to the true solution)

 Open up this week’s framework  Examine rigid_body.cpp ◦ Notice that it is conveniently modeled like a boat ◦ Take a look at the function “euler_update_state”  Make sure you understand each line in this function  This function is the Euler method of updating the boat’s state  Compile the code  Run the executable  Now let’s examine the analytical solution

 Here we see the equations for the velocity, distance traveled, and acceleration of the boat  Pro ◦ The one, true solution  Cons: ◦ Often hard to derive ◦ For complex systems, infeasible to implement

 Why not take advantage of the fact that we’re computer scientists?  Pros ◦ More realistic compared to Euler’s method ◦ Utilizes computational power ◦ We do not have to analytically solve (which for some systems is infeasible)  Con ◦ Not as accurate since its an approximation ◦ Power depends on skill of programmer and the computational capacity of the computer

 The numerical method we will be using today is called “Runge-Kutta”  Essentially, Runge-Kutta uses Euler’s Method and splits up the integration into four parts. It then takes the average of these parts, and computes the new integration.  The reason this works better is because after each split, it uses a newly computed control to re-integrate.

 First, we compute k 1 using Euler’s method of integration.  After this, we integrate while adding half of k 1 to our velocity (or state). This allows us to solve for k 2.  Next we integrate while adding half of k 2, and solve for k 3.  Finally, we integrate by completely adding k 3 and solve for k 4.  After averaging together all k x, we now have a new velocity (or state).

xixi x i + h/2 x i + h k1k1 k2k2 k3k3 k4k4 Credit to: Dr. E.W. Sandt Civil Engineering Department Texas A&M University

Consider Exact Solution The initial condition is: The step size is: Credit to: Dr. E.W. Sandt Civil Engineering Department Texas A&M University

The example of a single step: Credit to: Dr. E.W. Sandt Civil Engineering Department Texas A&M University

 The goal for today is to implement Runge- Kutta for simulating the movement of a boat. ◦ And if you finish early, to start working on the graph due next week.  At the beginning of next week’s lab, you must turn in a graph comparing the position of the boat over time using ◦ the Euler Method (already implemented) ◦ the Analytical Method (plug into the equations) ◦ Runge-Kutta

 Let’s do the first step of Runge-Kutta ◦ Follow the Euler method and compute k 1 ◦ This will involve you computing the Force and Acceleration  This gives us k 1 = delta_time * acceleration  Now that we have k 1, we can use this to compute the halves (k 2 and k 3 )

 Step two starts off nearly the same ◦ However, when computing force, be sure to add half of k1 to your velocity  F = thrust - (drag * (velocity + k 1 /2) ) ◦ Solve for acceleration ◦ Compute k 2 like before  Step three is exactly the same as step two, except use k 2 now.

 Step four (surprise!) is exactly the same ◦ Except, since we are integrating over the entire period, we do not halve our duration ◦ Solve for k 4 now  We need to average together our k x ’s ◦ k 2 and k 3 account for double because we integrated only half of them. ◦ So, we have 6 parts in total to average.  Finally, add the average to your velocity, and compute position like normal.

 Go to lab5.cpp, and look in the DrawGLScene ◦ Comment out the euler method, and add the appropriate call to the runge-kutta method  Examine Runge-Kutta running  It will be hard to visually notice a difference. Instead, run the Euler method for a short period, and compare the numbers.

 For next week, you will be turning in a graph comparing the three methods. ◦ Euler Method (already implemented), Analytical Method (plug into the equations), Runge-Kutta ◦ Output the position at each time step to a file ◦ Copy those numbers into excel (or the software of your choice) and plot a graph over time comparing the positions for each method. ◦ For the analytical method, you can  a) Program the equations and run it  or b) Plug in time, solve them, and put the numbers into the graph