# Engine model

I wasn't sure of where this question is best suited but since my interest is only mathematical I figured this is a good forum.

Using vectors I came up with a formula for the height of a piston above the center of the crankshaft for any given angle x (in radians). I set an x,y coordinate system with the origin at the center of the crank. With x=0 radians the crankshaft has the lower end of the connecting rod along the positive x-axis.

So if a is the radius of the crankshaft and b is the length of the connecting rod we have

$$f(x)=asin(x)+b \sqrt{ \frac{1-a^2cos^2(x)}{b^2} }$$

So if that formula is correct then if I differentiate it I should have a formula for the change of height with respect to any given angle. This is
$$f'(x)= \frac{a^2*b*sin(x)*cos(x)}{ \sqrt{ b^2-a^2*cos^2(x) }} +a*cos(x)$$

So to get the velocity I need to take $$\frac{f'*2 \pi*t}{minute}$$ where t is any given rpm.

So if I did everything correctly I should be able to find the speed in units of length per minute of the piston for any given rpm t.

So did I make any mistakes so far? Or does everything seem ok?