# Finding the complementary function from a boundary value problem

I have the following physics equation:

$$a = \int_0^R K_1\frac{\delta \rho}{\rho} + K_2 \frac{\delta c^2}{c^2} \,\text{d}r$$

where $$a$$ is a real number, $$R$$ is a positive real number, and $$K_1,K_2,\rho$$ are real functions of $$r$$ which spans from $$0$$ to $$R$$. Furthermore, $$c^2=\Gamma_1P/\rho$$ where $$\Gamma_1$$ and $$P$$ are also real functions of $$r$$. Here $$\delta$$ denotes a first-order (linearized) Lagrangian perturbation.

Edit: for clarity, $$\delta f$$ is really denoting the differences $$f - f_2$$ between two functions. In this case I know $$\rho$$ but not $$\rho_2$$, and I know $$c^2$$ but not $$c^2_2$$, etc. These functions are all solutions to a set of differential equations; I have linked to another question containing (some of) these functions in dimensionless form in the comments. In specific cases I can actually compute, e.g., $$\delta \rho$$, by finding two functions $$\rho$$ and $$\rho_2$$. However I am interested in the general case for an arbitrary e.g. $$\rho_2$$ and hence an arbitrary $$\delta \rho$$. However, $$\rho_2$$ can be assumed to have all similar kinds of properties as $$\rho$$, e.g., finite, nonnegative, etc.

I have computed all of $$K_1, K_2, \rho, P, \Gamma_1$$ via numerical simulation.

As $$\int_0^R r^2 \rho\,\text{d}r$$ should be conserved, we have that the complementary function for $$\rho$$ is $$T=r^2\rho$$, since $$\int_0^R T \frac{\delta \rho}{\rho} = 0$$.

Edit 2: Any multiple of $$T$$ can be added to $$K_1$$ and it will make no difference in $$a$$. We project $$T$$ into an orthogonal vector and remove it from $$K_1$$.

I am now transforming this equation to use $$u\equiv P/\rho$$ and $$\Gamma_1$$ instead of $$\rho$$ and $$c^2$$. In particular:

$$a = \int_0^R K_1\frac{\delta \rho}{\rho} + K_2 \frac{\delta c}{c} \,\text{d}r = \int_0^R K_3\frac{\delta u}{u} + K_4 \frac{\delta \Gamma_1}{\Gamma_1} \,\text{d}r.$$

Edit 3: As should be clear, $$\delta u/u = \delta P/P - \delta \rho/\rho$$.

According to the appendix of this paper, this can be found with

\begin{align} K_3 &= K_2 - P\frac{\text{d}}{\text{d}r}\left( \frac{\psi}{P} \right)\\ K_4 &= K_2 \end{align}

where $$\psi$$ is a solution to the ordinary differential equation $$$$\frac{\text{d}}{\text{d}r}\left( \frac{1}{r^2\rho} \left(\frac{\text{d}\psi}{\text{d}r} - K_1 \right) \right) + \frac{4\pi G\rho}{r^2P}\,\psi = 0$$$$ with boundary conditions $$\psi(0)=0, \psi(R)=0$$.

I am able to solve all of this numerically.

My question: how can I find (or numerically approximate) the complementary function for $$u$$, i.e., what is a (non-trivial) $$T_2$$ such that $$\int_0^R T_2 \frac{\delta u}{u}\,\text{d}r = 0$$?

• Your last sentence seems to be cut off. I guess from earlier you want that integral to be equal to zero. But this requirement alone makes $T_2$ extremely non-unique. Presumably what you want is for $T_2$ to correspond to some "natural" conserved quantity. But seeing as you haven't actually told us what the physics is here, we can't really do that.
– Ian
Aug 13 '20 at 15:40
• @Ian you are correct about it equaling zero, I have fixed that typo Aug 13 '20 at 16:08
• @Ian regarding it corresponding to some "natural" conserved quantity, does the fact that $u=P/\rho$ and the conservation regarding $\rho$ not suggest something here? Aug 13 '20 at 16:14
• Without knowing anything about the actual physics, not really, because there is both a $\delta P$ and a $\delta \rho$ contribution to $\delta u$. Namely to first order $\frac{\delta u}{u}=\frac{\delta P}{P} - \frac{\delta \rho}{\rho}$. Perhaps that simple calculation helps some?
– Ian
Aug 13 '20 at 16:49
• @Ian OK, fair enough. The physics are described (nondimensionally) in this question: math.stackexchange.com/questions/3780864/… where $x$ is the dimensionless counterpart of $r$, $g$ is $P$, and $t$ is $\rho$. Aug 13 '20 at 16:51

As far as your actual question is concerned, it really doesn't matter what $$\frac{\delta u}u$$ actually is, just that it is an integrable function on $$(0, R)$$. For simplicity, just call it $$h(r)$$. Also to simplify the mathematics a bit, let me assume it is continuous and further that $$\int_0^R h^2(r)\,dr$$ is also finite and non-zero.

Now consider the set $$V$$ of all such functions. Note that if $$a, b \in \Bbb R; f, g \in V$$ then $$af + bg \in V$$ as well. which makes $$V$$ a vector space. If we define $$\langle f, g\rangle = \int_0^Rf(r)g(r)\,dr$$ Then $$\langle \phantom f, \phantom g\rangle$$ is an inner product on $$V$$. We can use it to define the norm $$\|f\| = \sqrt{\langle f, f\rangle}$$

The condition you give for $$T$$ can now be restated as $$\langle T, h\rangle = 0$$ That is, it is a vector perpendicular to $$h = \frac {\delta u}u$$. But as I previously told you in another thread, and Ian has reiterated here, there is far more than a single function $$T$$ for which this holds.

Let $$f$$ be an arbitrary function in $$V$$. Then note that $$\left\langle f - \dfrac{\langle f, h\rangle}{\|h\|^2}, h\right\rangle = \langle f, h\rangle - \dfrac{\langle f, h\rangle}{\|h\|^2}\langle h, h\rangle = 0$$

In integral form, that means for any continuous function $$f$$ with $$\int_0^R f^2(r)\,dr < \infty$$, letting $$T = f - \dfrac{\int_0^R f\frac{\delta u}u\,dr}{\int_0^R \left(\frac{\delta u}u\right)^2\,dr}\frac{\delta u}u$$ gives a function $$T$$ satisfying $$\int_0^R T\frac{\delta u}u\,dr = 0$$.

If all you need is just that integral relation, then you can choose an arbitrary $$f$$ and produce $$T$$ as indicated. Unless you are so amazingly unlucky as to pick a constant multiple of $$\frac{\delta u}u$$, the resulting $$T$$ will be non-trivial.

The condition that $$\frac{\delta u}u$$ is continuous is a convenience that can be easily loosened. The condition that $$\int_0^R \left(\frac{\delta u}u\right)^2\,dr$$ is finite is a little harder to remove, but arrives at the same end: there are still infinitely many independent $$T$$ that satisfy the condition - they just have to be constructed differently.

• Thank you very much for taking the time on this thoughtful answer. It is absolutely fine to assume that $\delta u/u$ is continuous and finite. I would like to choose an arbitrary $f$ and produce $T$ as you have indicated, however, in the general case I do not have access to $\delta u/u$; I only have access to $u$. (Some additional context: it is an inverse problem where I solve for $\delta u/u$ given $a$, where in reality I have $N$ such equations with $a_i$, $K_{1,i}$ etc but only one $\delta u/u$.) Therefore, is it possible to construct $T$ without knowledge of $\delta u/u$, .. Aug 14 '20 at 9:56
• ..but rather only assumptions about $\delta u/u$, such that it is continuous and finite? Aug 14 '20 at 9:57
• Some more context, in case it helps: In the case of the first equation of this post, we project $T$ into an orthogonal vector and subtract it from $K_1$ (quite similar to what you have described). We have verified that this works by choosing arbitrary $\delta u/u$s (specifically: differences between different $u$s that are also the result of a simulation) and finding that it reproduces correct $a$ values. After applying the transformation, however, the new $K$'s don't "work" in the same way, and we suspect it is because we are not also removing a complementary function from them. Aug 14 '20 at 10:02
• My problem is that I do not know what you mean by "a first-order (linearized) Lagrangian perturbation". If you don't know what $\delta u$ is, then how do you expect to find a function perpendicular to it? Aug 15 '20 at 13:24
• $\delta u$ is really just the difference between two different functions $u$ (which can also both be assumed to be solutions to the set of equations I wrote in the other thread). We know one of the $u$s but we do not know the other one (in the general case, that is. I have many different $u$s that I can use to "test" the equations). Aug 15 '20 at 18:45