# Numerical solution for Friedmann equations

+ 1 like - 0 dislike
1133 views

My problem today is to solve the Friedmann equations, for those who aren't familiar with them, here they are (in my specific case):

$$\left ( \frac{\dot{a}}{a^2} \right )^2 = \frac{\rho_1}{a^4} - \frac{\rho_2}{a^6}$$

So, my idea for solving this is to discretise in time, namely, write: $$\dot{a} = \pm \sqrt{\rho_1 - \frac{\rho_2}{a^2} }$$ And then $$\dot{a} = \frac{a_{i+1} - a_{i}}{dt}$$ Now, I want to start with $\dot{a} < 0$, and make it "bounce". Namely, if you solve these equations analytically, you get: $$a(t) = \sqrt{\rho_1 t^2 + \frac{\rho_2}{\rho_1}}$$ Meaning that $a(t)$ has a minimum value, at $t = 0$. However, using time discretisation one gets( in the phase when $\dot{a}<0$ $$a_{i+1} = a_i - dt \sqrt{\rho_1 - \frac{\rho_2}{a_i^2} }$$ Which at some point becomes complex.

This procedure has obviously some flaws, how can I correct it? I would like to write an algorithm that solves numerically using some sort of time discretisation, since I later will need to implement for a time variable $\rho_2(t)$. The algorithm must reproduce the analytical solution, with the feature that, once we have reached the minimum value for $a(t)$, it stops decreasing and starts increasing.

Any help is appreciated.

This post imported from StackExchange Physics at 2015-03-23 08:53 (UTC), posted by SE-user MrFermiMr
Would Computational Science be a better home for this question?

This post imported from StackExchange Physics at 2015-03-23 08:53 (UTC), posted by SE-user Qmechanic
You need an implicit differential equation solver.

This post imported from StackExchange Physics at 2015-03-23 08:53 (UTC), posted by SE-user CuriousOne
Pulsar's answer to this question may be useful. See also Did the Big Bang happen at a point? and How does the Hubble parameter change with the age of the universe?, which use Pulsar's results to calculate $a(t)$.

This post imported from StackExchange Physics at 2015-03-23 08:53 (UTC), posted by SE-user John Rennie

+ 3 like - 0 dislike

Rearranging your first equation you get $$\dot{a}^2 = \rho_1 - \frac{\rho_2}{a^2}$$ In this case you need only to give an initial condition $a(0)>\sqrt{\rho_2/\rho_1}$.

If you want to reach the bounce, integrate with a negative velocity forward in time (or vice versa), i.e. $\dot{a}=-\sqrt{\rho_1 -\rho_2/a^2}, \Delta t > 0$. Once you reach the bounce $a^2=\rho_2/\rho_1$ (or $\dot{a}=0$), switch the sign of the velocity so that your universe grows instead of shrinking. (Beware of NaNs from square-rooting a negative number!)

Note that the solution is not uniquely determined at the very point of the bounce - there are two possible branches, a real and a complex one, corresponding to negative and positive velocity. We choose the real one because of physical reasons. (See Picard theorem on existence and uniqueness of first order ODEs.)

This post imported from StackExchange Physics at 2015-03-23 08:53 (UTC), posted by SE-user Void
answered Dec 24, 2014 by (1,645 points)
No, the equation and the solutions are correct. The solution to your equation is also a bounce, but given by logarithm.. But thanks anyway, i'll try the change of sign..

This post imported from StackExchange Physics at 2015-03-23 08:53 (UTC), posted by SE-user MrFermiMr
@MrFermiMr Yes, sorry, I misread your first equation which is usually given in terms of $\dot{a}^2/a^2$ rather than $\dot{a}^2/a^4$ on the left hand side. Corrected.

This post imported from StackExchange Physics at 2015-03-23 08:53 (UTC), posted by SE-user Void
Yes, it's written in conformal time $dt = a(t') \; dt'$.. Actually i think that's precisely what happens: the solution goes and then, precisely at $a = \sqrt{\rho_1/\rho_2}$ the solution becomes complex. It is just a matter of telling mathematica to change sign when the complex part becomes non zero, and i should be good.

This post imported from StackExchange Physics at 2015-03-23 08:53 (UTC), posted by SE-user MrFermiMr

 Please use answers only to (at least partly) answer questions. To comment, discuss, or ask for clarification, leave a comment instead. To mask links under text, please type your text, highlight it, and click the "link" button. You can then enter your link URL. Please consult the FAQ for as to how to format your post. This is the answer box; if you want to write a comment instead, please use the 'add comment' button. Live preview (may slow down editor)   Preview Your name to display (optional): Email me at this address if my answer is selected or commented on: Privacy: Your email address will only be used for sending these notifications. Anti-spam verification: If you are a human please identify the position of the character covered by the symbol $\varnothing$ in the following word:p$\hbar$y$\varnothing$icsOverflowThen drag the red bullet below over the corresponding character of our banner. When you drop it there, the bullet changes to green (on slow internet connections after a few seconds). To avoid this verification in future, please log in or register.