Image

Chapter 3

Some Math Background

Programming even the simplest physics will inevitably involve some math. Therefore, we assume that readers of this book will be comfortable with math notation and have at least some math knowledge. This knowledge need not be very sophisticated; familiarity with basic algebra and simple algebraic manipulations of equations and formulas is the most important requirement and will be assumed without review. In addition, some appreciation of coordinate geometry and the basics of trigonometry and vectors would provide a good foundation. In case you need it, this chapter provides a review or refresher of these topics. Prior knowledge of calculus is a bonus, but is not essential; similarly for numerical methods. We provide an overview of the basic concepts on these topics at a level sufficient to apply them in physics programming.

Here is what we'll cover:

  • Coordinates and simple graphs: Math functions and their graphs crop up constantly in physics applications. We review some common math functions, and plot their graphs using a custom ActionScript graph plotting class. We also show how to make an object move along any curve described by a mathematical equation.
  • Basic trigonometry: Trigonometry crops up a lot in graphics and animation in general, and is pretty much an indispensable tool in physics-based animation. In this section, we'll review some trigonometry essentials that will be used in later chapters. We'll also get to play with trig functions such as sin and cos to produce some cool animation effects.
  • Vectors and vector algebra: Vectors are useful because physics equations can be expressed, manipulated, and coded up more simply using them. After a review of vector concepts, we'll construct an ActionScript 3.0 (AS3.0) Vector2D class that will be used throughout the rest of the book.
  • Simple calculus ideas: Calculus deals with things that change continuously, including motion. It is, therefore, a natural tool to apply to physics. Calculus is usually considered part of advanced math. So we'll give only an overview of the basic concepts here to show how they can be implemented in physics equations and in code.

Although this chapter consists of review material, much of it covers application of the math in ActionScript and physics. Therefore, even if you have a solid math background, we recommend that you at least skim through this chapter to see how we apply the math.

In our attempt to illustrate the application of otherwise abstract math concepts to physics, we have picked some examples of physics concepts that will be explained more fully in later chapters. So don't worry if you don't immediately get everything that we'll cover here; you can always come back to this chapter as needed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.41.27