Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

download Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

of 17

Transcript of Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    1/17

    Page 1 of17 Sean Robinson 2011

    ASSESSMENT OF MATHEMATICAL INTEGRATION METHODS FOR

    USE IN CONTINUOUS SIMULATIONSEAN ROBINSON

    ABSTRACT:

    By continuous simulation we mean a process whereby we calculate the state of an object

    were trying to represent on the fly (1). We will investigate how different methods of

    propulsion will affect the object as it moves throughout the environment and then assess

    these methods based on efficiency and accuracy.

    CONTENTS

    Abstract: ................................................................................................................................................................. 1

    Euler Integration: ................................................................................ ...................................................... .............. 1

    Verlet Integration: .................................................................................................................................................. 3

    Runge-Kutta: ....................................................................... ..................................................................... ............. 11

    Conclusions: ........................................................................ .................................................................... .............. 15

    Appendices: .......................................................................................................................................................... 16

    Bibliography ............................................................................................................................................... 16

    EULER INTEGRATION:

    The Euler method was first set out by Leonhardo Euler in one of many seminal works on

    calculus in 1769 (2). The original manuscript has been scanned and is available from

    Dartmouth University (3); an English translation of the original text has been developed and

    is maintained by Bruce, I (4). This is one of the most basic ways for solving differential

    equations. In this particular case, we will look at how we can use this method for governing

    the movement of particles in a simulated world. While we are not interested in simulating

    particles within our world, we can use these methods to solve for basic particle entities and

    then expand them in order to affect a compound of rigid bodies.

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    2/17

    Page 2 of17 Sean Robinson 2011

    A basic Euler integration algorithm uses the first two terms in the Taylor Series Expansion

    (5), in order to solve for each integration step. First we solve for the new velocity of the

    particle by multiplying the elapsed time by the current acceleration. This is done for both x

    and y values, although in our final product, we will include a z component.

    The second integration is used to calculate the new position on the particle by multiplying

    the current position by the new velocity and the time elapsed since the last iteration. Once

    again, we calculate this for all axis values used.

    In pure Math, we have the function:

    x(t + t) ~= x(t) + t * (dx/dt)|t. (6)

    We let t represent the time elapsed since our last update and utilise the method outlined

    above to solve for both steps of integration.

    Once we understand this basic premise of this function, we can quite easily construct some

    pseudo code to aid us in the development of a code fragment.

    Create new 2d vector to represent new velocity;

    Assign X value as time elapsed * acceleration of particles current X;

    Assign Y value as time elapsed * acceleration of particles current Y;

    Create new 2d vector to represent updated position;

    Set new position x value as current x position * new x velocity * time elapsed;

    Set new position y value as current y position * new y velocity * time elapsed;

    Assign new position to particle;

    Assign new velocity to particle;

    As we can see, the implementation of a Euler Integration is very simple and can be

    developed easily. We have also touched on some problems with this method. Because the

    Euler method only uses the first two terms of the Taylor Series Expansion, it is classified as a

    First Order Method. This means we may lack the accuracy of others that utilise a deeper

    range in this system (7).

    One way of improving this accuracy would be to implement multiple iterations such as with

    the Runge-Kutta solution, which is covered later in this paper. This would allow us to

    improve the basic Euler from a first order, to an Nth order depending on how many

    iterations we choose to make. This system has increased overhead as we are looping

    multiple times, this would need to be weighed against accuracy in order to balance both

    criteria for the specific problem.

    One possible solution is suggested by Boesch (8). He suggests using the looping method

    because it divides the time step into uniform sections, each section now reduces the

    integration error as we are integrating a smaller section. This is most useful when we have alarge integration as the variance is dramatically reduced. This solution is quite interesting as

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    3/17

    Page 3 of17 Sean Robinson 2011

    we keep the advantages of Eulers efficiency, while dramatically reducing the integration

    error.

    Below is a code example for a potential Euler Implementation in C++ based on Golgobots

    (7).

    void updateParticle(double tElapsed, *particle currentParticle) {

    2DVector newVelocity = new 2DVector();

    newVelocity.x = tElapsed * currentParticle->acceleration->x;

    newVelocity.y = tElapsed * currentParticle->acceleration->y;

    2DVector updatedPosition = new 2DVector();

    updatedPosition.x = (tElapsed * newVelocity.x) + currentParticle->x;

    updatedPosition.y = (tElapsed * newVelocity.y) + currentParticle->y;

    currentParticle->position = updatedPosition;currentParticle->velocity = newVelocity;

    }

    VERLET INTEGRATION:

    Perhaps a misnomer, Brun, V (9) tells us that the Norwegian Mathematician and Physicist

    Carl Strmer used Verlet Integration in his Astrophysical work on aurorae many years

    before Verlet published. Verlet Integration is also called Strmers Method for this reason.The original paper (10) where Verlet set forth his research is available for further reading

    (11).

    Verlet is very similar to Euler, but has some slight variation. It is more compact as it does

    the necessary calculations in a single equation. It can achieve this as it does not store the

    particle velocity, but computes it on the fly. As we are not storing the velocity of our

    particle, we do not need to include this attribute when developing our vector class.

    The most basic version of Verlet integration involves simply adding Taylor Expansion for the

    current step in the iteration with the previous time step, Van Verth also gives us theequation for this method (12).

    y(t+h) + y(t-h) = y(t) + hy(t) + ((h^2)/2)y(t) +

    + y(t) hy(t) + ((h^2)/2)y(t) -

    As we are not using velocity as a stored variable anymore, this solution should not be used

    for systems where velocity is used in other calculations. We can mathematically estimate

    the velocity, but this may be inaccurate and would be more inefficient than simply storing

    the value.

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    4/17

    Page 4 of17 Sean Robinson 2011

    One of the reasons that we will discuss the Verlet integration method is the accuracy.

    According to Dummer (13), Verlet integration is 4th

    order accurate. We have already

    established that Euler is only 1st

    order and Runge-Kutta 2 is only second order.

    While we can obtain far greater accuracy from using a higher order Runge-Kutta, the

    substantial increase in computation may be something that is too high for us to ignore. By

    comparison, a basic Verlet implementation is very quick to compute and we can achieve a

    very high level of accuracy.

    An interesting use of Verlet integration was suggested by Kai-Alesi et al (14), it was

    suggested that if rigid bodies are also present, then the Verlet method can be applied to

    each bodies centre of mass and/or spring attachment points.

    In order to demonstrate the improved accuracy of Verlet over Euler, we can use some basic

    calculations and see how an object would react when utilising Euler methodology. We can

    then compare this against the same object with Verlet integration applied; we will then beable to compare these against the actual values of where the object should be according to

    Newtonian physics.

    We will set up an experiment where we calculate the position of a body over time as it is

    dropped from a finite height. We use the value 9.82 for acceleration (a) due to gravity and

    decide to drop our object from a height (y0) of 1000 metres. We will use time steps of 1

    second. I have synopsised the values and equations below.

    a = 9.82 m/22

    Y0 = 1000t = 1

    Height at t = y0 + v0t + (1/2)a0t2

    Our formula for calculating the position at these time steps becomes:

    y(t) = 1000 + (0*t) + ((1/2)*(-9.82)*t2)

    = 1000 4.91t2

    After breaking down our time step into blocks, we generate the following table, which

    indicates the objects position at uniform times within the step. To the side is a tableindicating where the object would actually be.

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    5/17

    Page 5 of17 Sean Robinson 2011

    Euler Method Actual Trajectory

    Time Position Velocity Time Position Velocity

    0 1000 0 0 1000 0

    1 1000 9.82 1 1000 9.82

    2 990.18 19.64 2 980.36 19.64

    3 970.54 29.46 3 950.9 29.46

    4 941.08 39.28 4 911.62 39.28

    5 901.8 49.1 5 862.52 49.1

    6 852.7 58.92 6 803.6 58.92

    7 793.78 68.74 7 734.86 68.74

    8 725.04 78.56 8 656.3 78.56

    9 646.48 88.38 9 567.92 88.38

    10 558.1 98.2 10 469.72 98.2

    11 459.9 108.02 11 361.7 108.02

    12 351.88 117.84 12 243.86 117.84

    13 234.04 127.66 13 116.2 127.66

    14 106.38 137.48 14 -21.28 137.48

    15 -31.1 147.3 15 -168.58 147.3

    Here we can see the error generated by using the Euler method. We can plot this to show

    exactly how both systems would plot the object.

    In order to demonstrate the accuracy of Verlet, we now include another set of values that

    represent how this method would plot the trajectory of our object. Here, we can see that

    Verlet is accurate as long as the acceleration remains constant.

    -400

    -200

    0

    200

    400

    600

    800

    1000

    1200

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

    Actual

    Euler

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    6/17

    Page 6 of17 Sean Robinson 2011

    Our Verlet method will use the same constants described above, but we will utilise the

    formula previously mentioned and use our own values. A difficulty in using Verlet

    Integration is that time steps are not controlled as well as with Euler, Dummer describes it

    as being a Non-Starter (13). To this end, we must set up the initial values ourselves. Verlet

    needs two steps to begin working, so we must backtrack from our initial starting point in

    order to obtain these values.

    yi yi-1 = vi-1 * dti-1 + 0.5 * ai-1 * dti-1 + dti

    We now use integration to determine vi and load this back into the equation.

    vi= vi-1 + ai-1 * dti-1

    yi yi-1 = (vi-1 + ai-1 * dti-1) * dti-1 + 0.5 * ai-1 * dti-1 + dti

    We now find several other issues that may plague Verlet integration. In order to utilise thebasic method, we must assume that each time step and acceleration value will be constant

    throughout the experiment. This will not work for more complex systems but there are

    steps we can take to remedy this to certain degrees, these will be discussed later. For now,

    we use the formula below and then plug this back into our initial equation.

    yi- yi-1 + a * dt * dt = vi* dt - 0.5 * a * dt * dt + a * dt * dt

    yi+1 = yi+ (yi yi-1) + a * dt * dt =

    y+1 = 1000+ (1000 1000-1) + 9.82 * 1 * 1 = 1008.82

    We now have our y+1 starting point value. By utilising the Verlet step equation of: newX =2(current) oldX + (acceleration * dt * dt), we generate a plot table.

    Verlet Integration

    Time Position Velocity

    -1 1008.82

    0 1000

    1 981.36

    2 952.9

    3 914.62

    4 866.52

    5 808.6

    6 740.86

    7 663.3

    8 575.92

    9 478.72

    10 371.7

    11 254.86

    12 128.2

    13 -8.28

    14 -154.5815 -310.7

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    7/17

    Page 7 of17 Sean Robinson 2011

    We can immediately see that Verlet integration has a much higher accuracy score than by simply

    using Euler. This is demonstrated on the graph below.

    Despite the accuracy we have now achieved, there is no ignoring the issue that became apparent

    earlier. For this system to be accurate, we need both the time step and acceleration to be constant.

    This is easily managed when we are simply explaining the process, but where this needs to be used

    to represent a real world solution, it becomes more fragile. As we are attempting to model objectsin a virtual world, our time step is going to vary due to the screen refresh rate. It is also unlikely that

    the acceleration will remain constant as the user will be using varying degrees of energy to power

    the bicycle and the world terrain itself will become a factor. First, we will look at correcting for

    varying acceleration.

    In order to modify our equation to account for this deviation, we will look at a basic harmonic

    oscillation system. This system is based on Isaac Newtons second law of motion. The second law

    was first described in Newtons seminal work Philosophi Naturalis Principia Mathematica

    (Mathematical Principles of Natural Philosophy) (15), an English translation of this

    manuscript is available from Google Books (16). We have refrained from quotations within

    this paper but feel that at least this should be included.

    The alteration of motion is ever proportional to the motive force impressed and is made in

    the direction of the right line in which that force is impressed

    Sir Isaac Newton

    The Mathematical Principles of Natural Philosophy (1687)

    We will not spend too much time devoted to the origin of these systems or the

    mathematics behind them as we are only interested in how they directly apply to our

    situation. We will look at Newtons Second law, solve it and use the results to apply new

    measures to the Verlet method in order to overcome the restrictions derived from avariance in acceleration.

    -400

    -200

    0

    200

    400

    600

    800

    1000

    1200

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

    Actual

    Euler

    Verlet

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    8/17

    Page 8 of17 Sean Robinson 2011

    The equation is:

    = =

    =

    Here, F is equal to the force pulling our object, m is the mass of our object, x gives theposition and k is the constant defined by Newton. We will simplify this for our basic system

    and use:

    = , =

    For simplicity, we will ignore mass for now and use the assumption that it is 1. Giving the

    following:

    =

    4

    Our object is starting at position 1000 (y) and with a null velocity (v 0 = 0), the solution that we use for

    our plot becomes:

    = cos

    2

    We now use this formula to approximate the trajectory of an object when acceleration varies. We

    can see from the data that our Verlet integration approximation is quite inaccurate now; this is

    because we have not accounted for a slight randomisation in the time step. Our dt is the product of

    a random function applied to our standard time step.

    Time a Actual Euler Verlet

    dt Velocity Position Velocity Position Position

    0.026799 0 0 -1 0 -1 0 1

    0.017896 0.026799 0.026796 -0.99964 -0.0268 -0.99964 -0.0268 0.999115

    0.001894 0.044695 0.04468 -0.999 -0.04468 -0.99916 -0.04468 0.997539

    0.174507 0.046589 0.046572 -0.99891 -0.04657 -0.99908 -0.04657 0.997326

    0.143306 0.221096 0.219299 -0.97566 -0.2193 -0.99095 -0.2195 0.940356

    0.065715 0.364402 0.35639 -0.93434 -0.35639 -0.95952 -0.357 0.84076

    0.024215 0.430117 0.416977 -0.90892 -0.41698 -0.9361 -0.41852 0.780529

    0.194272 0.454332 0.438862 -0.89855 -0.43886 -0.92601 -0.44094 0.756206

    0.13849 0.648604 0.604075 -0.79693 -0.60407 -0.84075 -0.60428 0.524806

    0.031749 0.787094 0.708305 -0.70591 -0.70831 -0.75709 -0.70912 0.328824

    0.18079 0.818843 0.730356 -0.68307 -0.73036 -0.7346 -0.73245 0.281361

    0.142205 0.999634 0.841273 -0.54061 -0.84127 -0.60256 -0.84138 0.001372

    0.054408 1.141838 0.9094 -0.41592 -0.9094 -0.48293 -0.91006 -0.22007

    0.182448 1.196246 0.930672 -0.36585 -0.93067 -0.43345 -0.93364 -0.3025

    0.06885 1.378694 0.981605 -0.19092 -0.98161 -0.26365 -0.98174 -0.55948

    0.182812 1.447544 0.992414 -0.12294 -0.99241 -0.19606 -0.99524 -0.64563

    0.18639 1.630356 0.998227 0.059525 -0.99823 -0.01464 -0.99792 -0.8354

    0.165648 1.816747 0.969906 0.243478 -0.96991 0.171421 -0.96597 -0.95844

    0.141371 1.982395 0.916483 0.400075 -0.91648 0.332083 -0.91096 -0.99957

    0.029471 2.123766 0.850969 0.525216 -0.85097 0.461647 -0.8457 -0.98149

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    9/17

    Page 9 of17 Sean Robinson 2011

    0.156094 2.153237 0.835123 0.550064 -0.83512 0.486726 -0.83135 -0.97158

    0.04697 2.309331 0.739456 0.673205 -0.73946 0.617084 -0.73503 -0.88511

    0.125581 2.356301 0.707031 0.707182 -0.70703 0.651817 -0.70441 -0.84842

    0.034601 2.481883 0.612888 0.79017 -0.61289 0.740607 -0.6114 -0.7283

    0.097476 2.516484 0.585185 0.8109 -0.58519 0.761813 -0.58505 -0.69001

    0.054734 2.61396 0.503489 0.864001 -0.50349 0.818855 -0.50523 -0.57161

    0.034168 2.668694 0.455469 0.890252 -0.45547 0.846413 -0.4589 -0.49908

    0.113073 2.702862 0.424791 0.905292 -0.42479 0.861975 -0.42945 -0.4519

    0.139187 2.815935 0.319932 0.947441 -0.31993 0.910008 -0.32655 -0.28727

    0.03803 2.955122 0.185392 0.982665 -0.18539 0.954538 -0.19369 -0.07278

    0.106171 2.993152 0.147896 0.989003 -0.1479 0.961589 -0.15712 -0.01314

    0.083779 3.099324 0.042256 0.999107 -0.04226 0.977291 -0.05336 0.152947

    0.086587 3.183103 -0.0415 0.999139 0.041498 0.980831 0.028813 0.281236

    0.062274 3.26969 -0.12775 0.991807 0.127747 0.977238 0.113429 0.408695

    0.057614 3.331963 -0.18922 0.981934 0.189223 0.969283 0.17379 0.495833

    0.111787 3.389577 -0.24545 0.969409 0.245451 0.958381 0.229006 0.57225

    0.160512 3.501365 -0.35206 0.935977 0.352061 0.930943 0.333073 0.706651

    0.050821 3.661877 -0.49713 0.867678 0.497127 0.874433 0.47343 0.860758

    0.077803 3.712698 -0.54056 0.841304 0.540562 0.849168 0.516586 0.898591

    0.065553 3.790501 -0.60432 0.796744 0.604317 0.80711 0.579382 0.94536

    0.192825 3.856054 -0.65521 0.755446 0.655211 0.767496 0.629693 0.973853

    0.082889 4.048879 -0.78784 0.615886 0.787835 0.641155 0.753324 0.997296

    0.051159 4.131768 -0.83612 0.548544 0.836122 0.575852 0.801056 0.979327

    0.098683 4.182926 -0.86308 0.50507 0.863079 0.533077 0.828327 0.95994

    0.189642 4.281609 -0.90864 0.41758 0.90864 0.447906 0.872528 0.905202

    0.051977 4.47125 -0.97107 0.238808 0.971067 0.27559 0.924791 0.740704

    0.153102 4.523228 -0.98216 0.188035 0.982162 0.225117 0.936492 0.683476

    0.07822 4.67633 -0.99935 0.036051 0.99935 0.074746 0.947936 0.490047

    0.102014 4.754549 -0.99911 -0.04215 0.999111 -0.00342 0.947668 0.379577

    0.115507 4.856564 -0.98962 -0.14368 0.989625 -0.10535 0.936921 0.227176

    0.165815 4.972071 -0.96647 -0.25677 0.966472 -0.21966 0.91155 0.047812

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    10/17

    Page 10 of17 Sean Robinson 2011

    Static dt:

    Random dt:

    We now come to the second issue with Verlet, accounting for a slight deviation in time step each

    cycle. By solving this, we are able to use Verlet integration in our simulated world should we wish.

    The solution to this issue is not a constant, more a way of increasing the accuracy of our

    approximations by utilising averages. The function in a pseudo-code style would be.

    +

    +

    Where:

    pP Previous Position

    ppP Previous, Previous Position

    cT Current Time

    pT Previous Time

    ppT Previous, Previous TimepA Previous Acceleration

    -1.5

    -1

    -0.5

    0

    0.5

    1

    1.5

    1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49

    Verlet

    Actual

    Euler

    -1.5

    -1

    -0.5

    0

    0.5

    1

    1.5

    1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49

    Verlet

    Actual

    Euler

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    11/17

    Page 11 of17 Sean Robinson 2011

    By creating a new column for a TCV, we can see how the accuracy is affected.

    As a final, small exercise, we also worked a primitive average to find out how accurate the different

    methods were overall. We simply averaged the absolute differences for each method, from the

    actual. This is only a single result as the dt is randomised every time an action is taken on the spread

    sheet. This changes the data every time; we do, however, see overwhelming consistency in the

    graph, data and final accuracy ratings.

    Euler Verlet TCV

    0.02194 0.347227 0.003489

    This is our end point with Verlet; we have explored the mechanics of the system, advantages and

    disadvantages, demonstrated how these factors affect our data and then explored solutions to the

    shortfalls. With these solutions, we have now successfully shown that Verlet integration is more

    accurate than Euler, has almost the same cost and can be modified to account for diversity in

    acceleration and time step values that would otherwise cause serious issues with our modelling.

    We will now take a step further and explore the final of our integration triumvirate.

    RUNGE-KUTTA:

    Runge-Kutta is an integration method that uses a trial step at the midpoint of integration;

    this is used to remove the error associated with lower order terms within the Taylor

    Expansion (17). There is a whole family of these methods, but we will focus on the most

    popular RK4 method.

    This method was first described in 1901 by Runge, C (18) and then modified by Kutta, M (19)to become the RK4 which we will look at in this paper.

    -1.5

    -1

    -0.5

    0

    0.5

    1

    1.5

    1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51

    Verlet

    Actual

    Euler

    TCV

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    12/17

    Page 12 of17 Sean Robinson 2011

    As the method is more complex than either previously discussed, we will be looking at this

    from a programmers perspective. This will allow us to move past the calculus and to start

    seeing how we can utilise this method for our specific aims.

    The overview of this method is that we attempting to detect curvature in our integration by

    evaluating derivatives, we do this several times during our time step and then use a

    weighted average to generate a best approximation over the dt.

    To being, we combine our position and velocity and values to give a state. The position

    could either be a single point in 1D space or something more complex like a vector, which

    will give the position in a 3D world. This is what we will be working towards.

    As we are taking samples through our time step, we also decide to store derivatives of

    certain values. The values we are going to store will be the derivative of the position, the

    velocity and the derivative of the velocity, which will give us the acceleration.

    The heart of the RK4 is the method we use to approximate the state as we advanced in the

    time step. After we have this approximation, we recalculate the derivatives.

    The approximated state will be the result of the following:

    = + = +

    We then recalculate the derivatives:

    = =

    This entire process will be repeating four times, this gives us the RK4 method. It is this

    multiple sampling method that affords us greater accuracy. It is essentially an average of

    several Euler samplings.

    In our code, we will define a function able to evaluate these new states and derivatives and

    call it several times. This function will simply perform the above calculations using the

    previous derivative each time. When we have all four derivatives, we can calculate the bestapproximation using a weighted total of each derivative. Now that we have a single value,

    this can be used to advance position and velocity in an accurate manner.

    We have plotted an RK4 system in Excel as we did for the other methods, below is the pure

    data calculated.

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    13/17

    Page 13 of17 Sean Robinson 2011

    dt Time Position d1 d2 d3 d4

    0.09229771 0 1 -0.09229771 -0.087586303 -0.088416895 -0.073031277

    0.114414475 0.09229771 0.913777436 -0.098704957 -0.097925654 -0.098079839 -0.0791919

    0.165939801 0.206712184 0.818792796 -0.101501139 -0.126185007 -0.119943703 -0.092499624

    0.155279604 0.372651985 0.704416432 -0.09985555 -0.092810212 -0.094246083 -0.07540413

    0.123279892 0.52793159 0.612854387 -0.094191088 -0.057893971 -0.063038388 -0.053508798

    0.0641516 0.651211481 0.547926953 -0.088060874 -0.024317992 -0.028569396 -0.026347822

    0.191193666 0.715363081 0.511229708 -0.083577313 -0.067484888 -0.070398368 -0.057526516

    0.076140863 0.906556747 0.441751318 -0.075463175 -0.020381359 -0.023885764 -0.022114276

    0.173054026 0.98269761 0.410732701 -0.070979318 -0.041734416 -0.04560659 -0.039141975

    0.021438646 1.155751636 0.363265484 -0.064177219 -0.00405493 -0.004947411 -0.004857323

    0.170895163 1.177190282 0.348758946 -0.061678773 -0.030676177 -0.034127105 -0.029965373

    0.122867024 1.348085444 0.311883828 -0.055955018 -0.018016261 -0.020751499 -0.019037343

    0.116164034 1.470952468 0.286462515 -0.051760974 -0.014592953 -0.016923362 -0.015696131

    0.172410143 1.587116502 0.264714225 -0.048075513 -0.018835044 -0.02133542 -0.019286096

    0.026451873 1.759526645 0.240097136 -0.043850144 -0.00238852 -0.002889811 -0.002847104

    0.137012337 1.785978518 0.230554818 -0.042124584 -0.011500642 -0.01332289 -0.012405633

    0.188907845 1.922990855 0.213191938 -0.039066013 -0.013725137 -0.015639917 -0.014300558

    0.012472451 2.1118987 0.194509158 -0.035741956 -0.000756617 -0.000918403 -0.000913179

    0.175453097 2.124371151 0.187841629 -0.034517167 -0.009980697 -0.011502231 -0.010681459

    0.184098438 2.299824248 0.173147548 -0.031869179 -0.008959485 -0.010333933 -0.009619426

    0.127204088 2.483922686 0.159801642 -0.02944508 -0.005293763 -0.00622227 -0.005939624

    0.168220476 2.611126774 0.150065513 -0.02766483 -0.006192365 -0.007215323 -0.006813677

    0.035425706 2.77934725 0.139849866 -0.025793563 -0.001133882 -0.001366462 -0.001350727

    0.140552761 2.814772956 0.13449237 -0.02480682 -0.00416559 -0.004903937 -0.004696162

    0.176624484 2.955325717 0.12655203 -0.023347901 -0.004642695 -0.005432662 -0.005163005

    0.174352007 3.131950201 0.118441761 -0.021856139 -0.004019587 -0.004716022 -0.004498828

    0.046385772 3.306302208 0.111137396 -0.02051091 -0.000942021 -0.001134047 -0.001120474

    0.114685944 3.35268798 0.106840143 -0.019718247 -0.002153179 -0.002561601 -0.002490057

    0.04933705 3.467373924 0.101567165 -0.018746031 -0.000837315 -0.001008145 -0.000996413

    0.121062244 3.516710974 0.097661605 -0.018025468 -0.001900121 -0.002261976 -0.002200952

    0.138490707 3.637773217 0.092903169 -0.017147818 -0.001967683 -0.002338212 -0.002269755

    0.085821459 3.776263924 0.088231609 -0.016286041 -0.001100042 -0.001318694 -0.001295659

    0.171269276 3.862085384 0.08449508 -0.015596547 -0.002013718 -0.00238636 -0.00230811

    0.133564322 4.03335466 0.080044278 -0.014775294 -0.001409561 -0.001680902 -0.001639781

    0.189023202 4.166918982 0.076278278 -0.014080277 -0.001811794 -0.00214715 -0.002076995

    0.005149927 4.355942184 0.072265751 -0.013339732 -4.43076E-05 -5.37456E-05 -5.36986E-05

    0.050182845 4.36109211 0.070000829 -0.01292164 -0.000405113 -0.000488865 -0.000484861

    0.154420839 4.411274956 0.067468419 -0.012454196 -0.001158091 -0.001381597 -0.001348637

    0.105277629 4.565695795 0.064321384 -0.011873329 -0.000717634 -0.000861325 -0.000847843

    0.06263202 4.670973424 0.061674869 -0.011384823 -0.000392535 -0.000473403 -0.000469145

    0.144425267 4.733605444 0.059410562 -0.010966855 -0.000839937 -0.001005089 -0.000985248

    0.106998589 4.878030711 0.056803536 -0.010485632 -0.000568873 -0.000683554 -0.000673934

    0.189177658 4.9850293 0.054526133 -0.010065245 -0.000926776 -0.001105804 -0.001079679

    0.198338238 5.174206958 0.051991119 -0.009597306 -0.000883423 -0.001054078 -0.001029183

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    14/17

    Page 14 of17 Sean Robinson 2011

    0.044870554 5.372545196 0.049574204 -0.009151162 -0.00018171 -0.000219736 -0.000218593

    0.170025064 5.417415751 0.047878762 -0.008838192 -0.000642256 -0.00076909 -0.000754669

    0.097824316 5.587440815 0.045809504 -0.00845622 -0.000338274 -0.00040754 -0.000403294

    0.054924425 5.685265131 0.044084313 -0.008137759 -0.000175892 -0.00021263 -0.000211427

    0.073219741 5.740189556 0.042563275 -0.007856983 -0.00021858 -0.000263932 -0.000262012

    0.180591984 5.813409297 0.041049272 -0.007577505 -0.000501445 -0.000601195 -0.00059091

    0.011627978 5.994001281 0.039320323 -0.00725835 -2.96246E-05 -3.59285E-05 -3.58899E-05

    The graph that we plot using this shows a very pleasing and smooth curve, this indicates

    that our approximations are helping to ensure that the curvature of our integration is as

    clear as possible to ensure a smooth running end result.

    If we compare this with our previous examples that use a randomised dt, there is a clear

    distinction favouring the RK4 method. This coupled with a very high accuracy rating and the

    possibility to extend the method for even greater clarity presents a very strong contender.

    The main factor that was considered when comparing RK4 with others is the extension

    capabilities. We need our system to model vectors within a world, not simply particles. To

    this end, we must extend whatever solution we choose to use vectors. This is actually

    something that we can implement rather easily with RK4; we simply include the other

    variables such as extra dimensions or spring components as extra differential equations and

    combine them into the integration (20). We will not explore this possibility further in this

    section, but will continue in the knowledge that we have a solution available that can be

    further explored should RK4 be utilised within our system.

    0

    0.2

    0.4

    0.6

    0.8

    1

    1.2

    0

    0.

    370505942

    0.560467842

    0.

    87485585

    1.

    055720134

    1.

    246652093

    1.

    4851065

    1.720910701

    1.

    804827196

    1.

    964739699

    2.

    08191124

    2.

    33737549

    2.

    498610598

    2.

    62348036

    2.758695435

    2.

    860150733

    3.

    044864439

    3.

    164707173

    3.514114689

    3.

    620559527

    3.753624642

    3.

    926642677

    4.

    1241743

    4.

    303745384

    4.584232267

    4.

    914369508

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    15/17

    Page 15 of17 Sean Robinson 2011

    We acknowledge and thank Fiedler for his excellent article explaining Runge-Kutta

    methodology, his site is also an excellent resource for further games physics. (21)

    CONCLUSIONS:

    Throughout this paper, we have discussed numerous methods for integration within our

    system. Each method has been carefully described in terms of an overview, mathematics

    and the some aspects to consider when programming.

    In addition to a discussion for each method, we have demonstrated their mechanics and

    then devised experiments that indicate their usefulness with regards to accuracy, simplicity

    and computational cost.

    Each of these methods has been evaluated against each other and all realistic

    improvements at this stage have been considered in order to achieve an accurate decision.We have decided that although we can achieve high levels of accuracy through the use of

    Verlet, or even high iterations of Euler; a Runge-Kutta method using four iterations provides

    us with a very high level of accuracy, even surpassing higher order Verlet. In addition, RK4

    gives us the option of quite easily expanding our mathematics in order to consider objects

    as vectors rather than particles. RK4 has been proven to work well for a variety of inputs

    and that it can handle randomised time steps very well, the inclusion of derivative

    approximations even generates a much smoother curvature than other methods.

    We conclude that while there may be more accurate or quicker solutions, RK4 presents us

    with a highly stable and balanced model that can be applied to a variety of situations. Wewill proceed from here and begin to examine how we will develop our method and how that

    method may be extended and modified to fit a selection of problems within our system.

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    16/17

    Page 16 of17 Sean Robinson 2011

    APPENDICES:

    BIBLIOGRAPHY

    1. Bourg DM. Physics for Game Developers. 1st ed.: O'Reilly; 2002.

    2. Euler L. Institutionum calculi integralis volumen secundum St. Petersburg: Imperial Academy of Science;

    1769.

    3. Dartmouth University. www.math.dartmouth.edu. [Online]. [cited 2011 10 27. Available from:

    http://www.math.dartmouth.edu/~euler/pages/E366.html.

    4. Bruce I. 17centurymaths.com. [Online].; 2010 [cited 2011 10 27. Available from:http://www.17centurymaths.com/contents/integralcalculus.html.

    5. Bourne M. Taylor Series. [Online]. [cited 2011 10 26. Available from: http://www.intmath.com/series-

    expansion/1-taylor-series.php.

    6. Bucknell University. Simulations Using Integration Algorithms - First Order Systems. [Online]. [cited 2011

    10 26. Available from:

    http://www.facstaff.bucknell.edu/mastascu/eControlHTML/Sim/Sim1Euler.html#Euler1.

    7. Golgobot. Physics2D. [Online].; 2010 [cited 2011 10 26. Available from:

    http://physics2d.com/content/euler-integration.

    8. Boesch F. codeflow.org. [Online].; 2010 [cited 2011 10 26. Available from:

    http://codeflow.org/entries/2010/aug/28/integration-by-example-euler-vs-verlet-vs-runge-kutta/.

    9. Brun V. Carl Strmer in memoriam. Acta Mathematica. 1958; 100(1-2).

    10. Verlet L. Computer "Experiments" on Classical Fluids. I. Thermodynamical Properties of Lennard-Jones

    Molecules. Physical Review. 1967 July; 158(98-103).

    11. Verlet L. prola.aps.org. [Online]. [cited 2010 10 27. Available from:

    http://prola.aps.org/abstract/PR/v159/i1/p98_1.

    12. Van Verth JM, Bishop LM. Essential Mathematics for Games & Interactive Applications; 2004.

    13. Dummer J. www.lonesock.net. [Online]. [cited 2010 10 26. Available from:

  • 8/3/2019 Assessment of Mathematical Propulsion Methods for Use in Continuous Simulation

    17/17

    Page 17 of17 Sean Robinson 2011

    http://www.lonesock.net/article/verlet.html.

    14. Kai-Alesi Z, Nordenstam M, Bullock D. A Practical Dynamics System. SCA '03 Proceedings of the 2003

    ACM SIGGRAPH/Eurographics symposium on Computer animation. 2003.

    15. Newton I. Philosophi Naturalis Principia Mathematica. 1st ed. London; 1687.

    16. Isaac N, Machin J. books.google.co.uk. [Online]. [cited 2011 10 30. Available from:

    http://books.google.co.uk/books?id=Tm0FAAAAQAAJ&pg=PA19&redir_esc=y#v=onepage&q&f=false.

    17. Weisstein EW. mathworld.wolfram.com. [Online]. [cited 2011 11 02. Available from:

    http://mathworld.wolfram.com/Runge-KuttaMethod.html.

    18. Encyclopedia.com. Encyclop. [Online].; 2008 [cited 2011 11 02. Available from:

    http://www.encyclopedia.com/doc/1G2-2830903781.html.

    19. GAP. http://www-gap.dcs.st-and.ac.uk. [Online]. [cited 2011 11 02. Available from: http://www-gap.dcs.st-

    and.ac.uk/~history/Biographies/Kutta.html.

    20. Neumann E. myphysicslab.com. [Online].; 2004 [cited 2011 11 02. Available from:

    http://myphysicslab.com/runge_kutta.html.

    21. Fiedler G. gafferongames.com. [Online].; 2006 [cited 2011 11 02. Available from:

    http://gafferongames.com/.