Inverting a function when it becomes complex

44 Views Asked by At

So I am trying to create a cosmological simulator. In the simulator, I need a graph of $a(t)$ vs $t$, where time is in the x-axis as and the cosmic scale factor $a(t) in the y-axis.

In this simulator I am integrating $$dt = H(a)da~~(1)$$

For

$$H(a) = \frac{1}{H_0\sqrt{\Omega_ra(t)^{-1}+\Omega_ma(t)^{-2}+\Omega_{\Lambda}a(t)^2}}$$

This gives me $t(a)$, which is the inverse of the function that I am trying to plot. Here the idea is that I can change $t(a)$ to $a(t)$ just by taking the symmetry of the data points w.r.t $0x=y$ line

There's only one problem. For some values of omega, I get a collapsing universe. Which means something like this,

enter image description here

Fig 1: $a(t)$ vs $t $

However, from (1) I get the equation of $t(a)$ where a is the independent variable.

To get something like in Figure 1. My function must have 2 parts.

enter image description here Fig 2: $t$ vs $a(t)$

Such as $$t_1(a) = 1 +\sqrt{1-a}~~for~~t>1$$ and $$t_2(a) =1 -\sqrt{1-a}~~for~~t<1$$ (These are only the example functions)

So when I invert the function (which means take the symmetry w.r.t $x=y$ line) I should get something similar to Figure 1.

enter image description here Fig 3: Inverting $t(a)$ to $a(t)$ by taking the symmetry w.r.t $x=y$ line.

Which I do.

So in the simulator, I am changing the values of $a$. Concerning Figure 2 something like this should happen:

a(t) starts from 0 goes up to some value (a') at that value H(a) becomes complex ( which is not possible). So after hitting a max value, a(t) should go backward. In reality, it hits complex and gives me an error.

So my question us is there a way to do this using some sort of equation whereas I increase the $a$ it automatically comes back, without need to decrease the value of the $ a$?

I guess it's not possible but I just wanted to ask.

Note: a(t) must be always positive.

1

There are 1 best solutions below

6
On

What do you expect? Looking at your graph, we see that the maximum value is $5$. There is no real $t$ with a greater value of $a(t)$ so you should expect the inverse to fail. For values less than $5$, you will have two inverses (your function is not injective), don't forget to consider both square roots. For $5$ itself, you have a unique inverse. For greater than $5$, you will have two complex solutions but no real ones.

It's like solving a simpler problem: the height of a ball thrown vertically upwards. It will reach a certain maximum height. For values below that maximum, there will be two times when it is at that height (on the way up and the way down). For the maximum itself, there will be a unique time. For above the maximum, there will be no (real) time when it is at that height.

Addition

Remember that you can split a definite integral. If a function is easier to handle in one form in the range $[0, a)$ and another form in the range $[a, 1]$ then use

$$ \int_0^1 f(x) dx = \int_0^a f(x) dx + \int_a^1 f(x) dx $$