Hi, I am trying to use the trapezoidal rule for this equation:

$\displaystyle Pp = \int Pdp / uZ$

But I would also like to apply the trapezoidal rule to a rearrange version of this equation, rearrange for P (incidentally this is the equation for pseudopressure).

I am using this in a project where I need to calculate Pp from given P values, and then after lots of conversions, I need to recalculate P from the values of Pp.

Also, for each value of P, it has its own values of u and Z.

My attempt at using the trapezoidal rule on this equation got me here, assuming Pp0 is known:

$\displaystyle Pp1 = \frac {1}{2} (\Delta P)(\frac {P0}{u0Z0} + \frac {P1}{u1Z1}) + Pp0$

Is this correct? If so, I have tried rearrange it so that I can work out P but everytime I try to rearrange to work out P1, I seem to end up with P1 on both sides...

EDIT: Forgot to mention limits. I have a series of pressures (around 400) and at each point need to calculate Pp for each P, and vice versa so I think the limits should just be between the latest point being calculated and the previously calculated one.

Upon rearrange to try to calculate P from Pp, I am ending up with the following, where a, b and c are just a numbers:

$\displaystyle a = b*P1^2 + c*P1$