Is there a way how to precisely compute the expansion path?
I know a consumer's utility function $U(\boldsymbol{x})$, I know the budget constraint $\sum P_i x_i \leq M$, I am able to compute the marshallian demands $\boldsymbol{D}(\boldsymbol{P}, M)$, therefore I am able to gain optimal point for any given prices and income.
If I plot this, using sliders, I can observe how the optimal point moves with changes in one single price. This movement, however, seems to be on a curve, the expansion path. Is there some way how to compute it analythically? Would the differentiation of demands be reasonable approach or is this too naive:
$\qquad \qquad x_1^{EP} = \frac{\partial D_1(\boldsymbol{P}, M)}{\partial P_1} \qquad \qquad x_2^{EP} = \frac{\partial D_2(\boldsymbol{P}, M)}{\partial P_1}$
What would be the next step? This would be two variables but I would like to plug it into single curve...
Or is there another approach?
EDIT: The expansion path I search for is also called price consumption curve in literature. I could find it by fitting few points (see illustration below), however, how can I find this analythically?