Value of continuously rebalanced stock portfolio

I'm thinking about what a theoretical continuously re-balanced stock portfolio could look like, in which the portfolio is uniformly distributed over a selection of stocks at all times.

For example, if my portfolio consists only of 2 stocks the value of the portfolio would be described by some function $$f(x,y)$$ of the values of the share-price of the stocks X and Y, and at all times my portfolio shall be 50% x-stock and 50% y-stock, under the assumption that shares of X and Y can be continuously bought and sold with zero additional cost (transaction fees, etc.) in infinitely small amounts while share prices chance, in order to keep the portfolio balanced.

Here, $$x(t)$$ and $$y(t)$$ shall be functions of time, representing the current share price of the stocks. I arrive at the following differential equations: $$\frac{\partial f}{\partial x}(x,y)=\frac{1}{2}\frac{f(x,y)}{x}$$, respectively $$\frac{\partial f}{\partial y}(x,y)=\frac{1}{2}\frac{f(x,y)}{y}$$, because those are the amounts of (fractional) shares of the stock in the portfolio at any time.

In the general case of n stocks that would then be $$\frac{\partial f}{\partial x_k}(x_1,...,x_n)=\frac{1}{n}\frac{f(x_1,...,x_n)}{x_k}$$ for all k.

How could f be defined?