How many times do you have go back and forth to get out of a deadlock? Here's a challenging question for you math lovers. 
This question was originally asked in Physics SE but I was suggested to post it here.( You can see it here.)
Many a times we have been inside a vehicle when it is deadlocked between two vehicles parked irresponsibly before and after you. Or, imagine a situation as shown below. 



You have to put your patience to test, while mechanically doing the same driving procedures again and again, making little progress. You never know for how long you would have to keep trying. 
It was such an incident that made me keen to know,
 how many cycles would it take to get your vehicle out of the deadlock, without potentially damaging your vehicle?
By one cycle, I mean the following steps. 


*

*Driving the vehicle to the extreme end;

*Turning the wheels to one extreme;

*Driving the vehicle back to other extreme end and

*Turning the wheels to the other extreme.


Now, it's going to be really tough. 
Using all the necessary parameters, can you obtain an expression for the minimum number of cycles required to get out of the deadlock?
Some of the measurements may be taken as below. 


*

*Length of the wheelbase$=d$

*Length of the vehicle$=b$

*Length of the gap$=a$

*Breadth of the gap$=c$

*Turning radius$=R_t$

*Maximum angle of tilt of wheels from normal$=\theta$

*Wheel-front grill separation$=g$


To make calculations simpler, consider the classic situation as shown below. 


Here, the shaded portion represents the obstacles (the other vehicles parked along with our vehicle). 


The image above shows the position of wheels in the vehicle body. 
Now, if the velocity of the vehicle is approximated to be having a constant value $v$ during each cycle, we can find an expression for the total time taken for the operation. 
It would be interesting to know how many times you have to do the cycles and more importantly, for how long. 
So,  why don't you give it a try?
 A: Let us consider a simplified situation: The car  is parked in an alley between two parallel walls "$y=0$" and $y=a$" of distance $a$. Initially the car is perpendicular to the walls (facing north aka the positive $y$-axis) and touches one wall at its back. The goal is to drive away in a direction parallel to the wall (to the west aka negative $x$-axis).
We shall assume that, 
while driving a curve at (extreme) fixed steering angle, the wheels do not slip sideways. This requires the four wheel axes to intersect in a single point $O$. The car then simply rotates around the vertical axis through $O$. In particular, the aft wheels (as well as any point on their common axis) follow a circle around $O$ (note that the fore wheels do not share a common axis and are also titled by different angles). Let $R$ be that radius for the mid-point $M$ of the aft axis.
Then this mid-point follows arcs of such circles of radius $R$, back and forth, with consecutive arcs having opposite curvature a common tangent at their common end point.
The length of each arc is limited by the gap size and how far the (rotated) shape of the car protrudes when the car is rotated by some angle $\alpha$ against the principle direction.
This way, the path is determined by a sequence of angles $\alpha_0=0<\alpha_1<\alpha_2<\ldots$, where $\alpha_k$ denotes the angle between car direction and original direction after $k$ arcs.
While we follow only the trajectory of $M$, the constraints come from the shape of the car, which we assume rectangular. Measured from $M$, let the front right vertex be $r$ to the right and $b_1$ to the front, and let the back left vertex be $r$ to the left and $b_0$ to the back (so the width of the car is $2r$ and its length is $b_1+b_0$). The only other characteristic of the car that we need is the turning radius $R$ defined above.
An obvious necessary condition in order to escape is that the car fits the alley diagonally (no Harry Potter reference intended), i.e.,  $$(2r)^2+(b_0+b_1)^2<a^2.$$
Whenever this inequality is almost sharp, the total number of cycles will be very high and very sensitive to the input.
With the above setup, the $y$-coordinate of $M$ after $k$ arcs is
$$y_k=\begin{cases}r\sin\alpha_k+b_0\cos\alpha_k&\text{if }k\text{ is even},\\
a-r\sin\alpha_k-b_1\cos\alpha_k&\text{if }k\text{ is odd}
\end{cases} $$
The $y$-coordinates of the centre points of the two arcs touching at that point are accordingly
$$ y_k\pm R\sin\alpha_k.$$
The algorithm to escape then runs as follows (and allows us to count the number of cycles while we run it):


*

*Set $u=y=b_0$, $\alpha=0$

*Find the smallest positive $t$ such that $$u+R\sin(\alpha+t)=a-r\sin(\alpha+t)-b_1\cos(\alpha+t)$$ (If no solution exists, we have escaped)

*Set $\alpha=\alpha+t$, then $y=u+R\sin\alpha$, then $u=y+R\sin\alpha$

*Find the smallest positive $t$ such that $$u-R\sin(\alpha+t)=r\sin(\alpha+t)+b_0\cos(\alpha+t)$$ (If no solution exists, we have escaped)

*Set $\alpha=\alpha+t$, then $y=u-R\sin\alpha$, then $u=y-R\sin\alpha$

*Go back to step 2


Note that the equations in $\sin(\alpha+t)$ and $\cos(\alpha+t)$ can be rewritten as quadratic equations in the sine, say.
