# Numerical integration

1. Feb 15, 2010

### a.mlw.walker

Hi,

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. Feb 15, 2010

### HallsofIvy

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).

3. Feb 15, 2010

### a.mlw.walker

yeah. p is a function of time. Does this change much?

Last edited: Feb 15, 2010
4. Feb 15, 2010

### D H

Staff Emeritus
Yes.

5. Feb 15, 2010

### a.mlw.walker

ok, so dv/dt = P(t)A/m

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

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?

6. Feb 15, 2010

### D H

Staff Emeritus
7. Feb 15, 2010

### Cvan

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,

Chet

8. Feb 15, 2010

### a.mlw.walker

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: