1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Figuring out formula from graph

  1. Jul 24, 2007 #1
    Hi, i'm not sure if this is the best forum to post this question but i'm gonna give it a try.
    I would like to be able to figure out a formula from a given graph( http://img46.imageshack.us/img46/8172/graphun4.jpg ). basically that would be the motion of a bouncing ball. Ultimately what i would like to do is figure out how to simulate those kind of motions into flash via action script to build bouncing windows, drop down menues etc.
    I guess i can go and do some research on snippets and copy past but i'd rather try to understand it how it works :P.
    thank you in advance.
     
  2. jcsd
  3. Jul 24, 2007 #2
    MOST functions can't be easily defined in a formula.

    I'd make it a piecewise function. The first "hump" will be a kinematic equation i'm sure, then after you analyze the collision with the ground you can keep using kinematics.
     
  4. Jul 25, 2007 #3

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    You can always fit a curve with N 'humps' with a polynomial with N terms
    ( if you're an astronomer you can fit 1 hump with N terms ;-)

    For 'real world' objects you could look at Fourier series.

    For a simple bouncing simulation I would just make each bounce x% smaller than the previous, adjust x to get the degree of damping you want. This prettry much models the real energy loss in a bouncing ball.
     
  5. Jul 25, 2007 #4
    ohh the graph doesn't represent the trajectory of a bouncing ball, it represents height vs time. how high would the ball be at x seconds. sorry :P.
    basically what i need is a simple formula, for example if i want to make a point a de-acceleration, i'll just do:
    1.dist= final_x-current_x;
    2.acel = .7;
    3.next_x = current_x+(dist*acel)
    4.repeat step 3 until dist<=0;

    basically the object will move "dist" many units every tick(second).

    I'm looking for a similar formula to simulate bouncing. The formula should (lets say y=100 and a tick of 5 seconds) make y=0 after 5 seconds, y=60 after 5 more seconds; than back to 0 after 5 more secs, y=40,y=0,y=20,y=0, y=7,y=0,y=1,y=0,y=0 and than y stays constant at 0.
    Now i understand the concept is just that i don't have the knowledge to come up with a formula. I'm not sure if i'm making myself clear.
     
  6. Jul 25, 2007 #5

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    The simplest way to get something that looks like a bouncing ball would be to use y=sin(x)^2.
    Not quite the correct shape ( a parabola ) but unless you are writing physics simulations it will look close enough. You can reduce Y on each round by a factor if you want to loose energy.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?