Determining the initial angle between planets
Once the time needed for the transfer is determined, the initial positions for the planets can be calculated.
We know that the spacecraft will leave the Earth's orbit and intercept the Martian orbit pi radians or 180° later. During that time, then, Mars must travel the angular distance that separates it from the point of interception that is now fixed in time.
As the speed of the Martian orbit is less than that of the terrestrial orbit and the spacecraft will be traveling with a speed that is even greater than that of the Earth's orbit, at launch Mars should be "advanced" with respect to Earth in order to arrive at the point of rendezvous at the right moment.
If aEarth is the angle of Earth with respect to the x axis at the moment of launch, aMars is the angle subtended by Mars at the moment of launch, then:
aEarth-aMars + (2*pi/tMars)*Ttransfer = pi
so that Mars covers the remaining angle in the exact time.
The angle of separation will then be :
aEarth-aMars = pi- (2*pi/tMars)*Ttransfer
Replacing the values :
aEarth-aMars=0.773 radians, that is, approximately 44 degrees