Do you really need the math? Or would you believe Dave Dellenbaugh and a drawing? When facing a persistent shift he says to sail the shorter tack first. At this point, it isn't headed yet, but will be once you sail towards the shift.

Quote
• Sail the longer tack first - No!
When the wind is shifting persistently, you normally want to sail the shorter tack first because that will take you into the persistent shift. Once you get close to the layline, sail the longer tack. This is quite different from the strategy you should follow when the wind pattern is oscillating or unknown.

Upwind Strategies for Windshifts