Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Numerical integration

  1. Feb 15, 2010 #1

    I have an excel spreadsheet that calculates the pressure inside a piston chamber, that is a function of time. I want to calculate the distance the piston moves, this is my situation.

    P=F/A, therefore force on piston = PA
    F = M(piston).a
    so ma = PA, a = P(t)A/m

    its all numerical in excel so i have a column of all the accelerations at the different pressures/time steps. By integrating a for velocity, I would just end up with v = PA/m
    and integrating that I would end up with s = PAt/m.

    Is this correct, it seems that something is not right in this method to get the distance moved by the piston from a numerical analysis?
  2. jcsd
  3. Feb 15, 2010 #2


    User Avatar
    Science Advisor

    You just said, above, that a= P(t)A/m. How does integrating that give the same thing again?

    Your notation indicates that P is a function of t, not a constant. The integral of PA/m is PAt/m only if P is a constant.

    And, if P were a constant, you would have v= PAt/m, s= PAt^2/(2m).

  4. Feb 15, 2010 #3
    yeah. p is a function of time. Does this change much?
    Last edited: Feb 15, 2010
  5. Feb 15, 2010 #4

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

  6. Feb 15, 2010 #5
    ok, so dv/dt = P(t)A/m

    I know the value of P, but not the function of it, so

    dv = P(t)Adt/m
    v = ds/dt = v + dv

    ds = P(t)A.dt^2/m

    s = s + ds

    I am worried that squaring the dt value will increase the error quite alot, so was going to use constant acceleration equations, but the acceleration isnt constant, so is there an alternative, or is it alright to square the time step?
  7. Feb 15, 2010 #6

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

  8. Feb 15, 2010 #7
    I don't get it. You say you have the pressures tabulated already? Why are you trying to integrate the function analytically still? Numerically is probably the way to go, i.e. you have an initial acceleration as you solved for, with a function for acceleration.

    Take that function, use a step size of however small your data collecting step size was (or just pick one and interpolate, or base it off the total time scale of the data). You've got a column of accelerations now say, so take one value, multiply it by your step size, and that gives you a velocity at that time. Take that velocity, multiply it by the same step size, and that's your displacement at that time interval.

    One thing to take note of is that since you're dealing with pressures and trying to do a position study, be sure to draw a free body diagram (I know, it sounds corny) and account for all the forces on the piston. A key thing to note is that atmospheric pressure may be acting over the top surface i.e. artificially inflating the values for acceleration that you think you're getting.

    Hope this helps,

  9. Feb 15, 2010 #8
    D_H has probably got closer to what i mean. With explicit numerical analysis, there is an issue with the size of the time step. I'm not trying to integrate analytically:

    dv = P(t)Adt/m
    v = ds/dt = v + dv

    is not the analytical way of looking at a problem.

    The issue is with squaring a time step. With explicit numerical analysis, the size of the time step decides whether the model is stable, so you choose a small time step. But if i need to square that time step will that increase errors, even if the time step is of the correct order of magnitude
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook