-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for path deformation in 1d and 2d
- Loading branch information
1 parent
503576d
commit bd17abb
Showing
2 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
""" | ||
Path deformation from CT | ||
======================== | ||
Tests for path deformation applied to 1d potentials parameterised by E and | ||
alpha. For tunneling, E < 0 and 0.5 < alpha < 0.75. | ||
V(f) = E * ((4. * alpha - 3.) / 2. * f**2 + f**3 - alpha * f**4) | ||
Spot check: | ||
>>> action_1d(0.6, -1.) | ||
7.445... | ||
>>> action_1d(0.55, -3.) | ||
19.157... | ||
Exception checks: | ||
>>> action_1d(0.6, 1.) | ||
Traceback (most recent call last): | ||
... | ||
ValueError: Maximum allowed size exceeded | ||
>>> action_1d(0.45, -1.) | ||
Traceback (most recent call last): | ||
... | ||
PotentialError: ('V(phi_metaMin) <= V(phi_absMin); tunneling cannot occur.', 'stable, not metastable') | ||
>>> action_1d(0.75, -1.) | ||
Traceback (most recent call last): | ||
... | ||
PotentialError: ('Barrier height is not positive, does not exist.', 'no barrier') | ||
Systematic check: | ||
>>> alpha = np.linspace(0.51, 0.749, 100) | ||
>>> E = -2. | ||
>>> action = [action_1d(a, E) for a in alpha] | ||
>>> expected = [562.92647189163586, 367.22180702340177, 258.65337026110859, 192.16481782909108, 148.47724421863325, 118.21852370609565, 96.383901938278768, 80.10344033396747, 67.6338797886024, 57.867532657401441, 50.072509618002243, 43.749156396166121, 38.547529535514386, 34.185909646521978, 30.543307423766056, 27.449313535197856, 24.800526223895005, 22.521447676079379, 20.574731459115796, 18.739223251865461, 17.169513582514359, 15.783149791721431, 14.5618758060631, 13.550904635140817, 12.565608908901291, 11.685280247098385, 10.869010755096969, 10.124142157820726, 9.44568875467181, 8.8279916343178222, 8.2632875985544647, 7.7452570926690365, 7.2676652494380605, 6.8267494245346443, 6.4175373784126162, 6.0376747548013547, 5.6914389287941276, 5.3554165827426816, 5.0705221440255359, 4.791996484443354, 4.5297073497757996, 4.2828914791509032, 4.0515569635462247, 3.8349094334723897, 3.6305752360114112, 3.4409770755842342, 3.2539978584608633, 3.0846092986447409, 2.9108358431735608, 2.7567245469680777, 2.6100700583506056, 2.4692584724608619, 2.3361399373781113, 2.210043151988573, 2.0904092847286364, 1.9764226992197085, 1.8678050154027728, 1.7655240012880855, 1.6679023775534181, 1.574854526781746, 1.4861153844329582, 1.4015387097538872, 1.3208902612276427, 1.2440384090792016, 1.1706648551024457, 1.1006590141085129, 1.0338216147825368, 0.97001008256914778, 0.90908200299037412, 0.85084046161777072, 0.79529828754359988, 0.74225104545346365, 0.69160841561155051, 0.64330682019730134, 0.59719197729990947, 0.55326396110926002, 0.51134154764300899, 0.4713569883129578, 0.43331005578464654, 0.39710922709558727, 0.36268780622023838, 0.32999460918823814, 0.29898581222260556, 0.26953408837941223, 0.24173476590470569, 0.21544404973607681, 0.19058184362100905, 0.16724757117510367, 0.14533602663807349, 0.12484511253240671, 0.1060537896725911, 0.088430534225688806, 0.072172325551223424, 0.057410548616978113, 0.043843863175876768, 0.031886858346490562, 0.021371414033251414, 0.012563681812002497, 0.0055929259686676863, 0.0009435456878673107] | ||
>>> assert all(np.isclose(action, expected)) | ||
""" | ||
|
||
from cosmoTransitions.pathDeformation import fullTunneling as path_deform | ||
import numpy as np | ||
|
||
|
||
def action_1d(alpha, E): | ||
""" | ||
:param alpha: Parametrises shape of 1d potential | ||
:param E: Parameteries height of 1d potential | ||
:returns: Action from path deformation | ||
""" | ||
def V(f): | ||
""" | ||
:returns: 1d potential | ||
""" | ||
return E * ((4. * alpha - 3.) / 2. * f**2 + f**3 - alpha * f**4) | ||
|
||
def dV(f): | ||
""" | ||
:returns: Derivative of 1d potential | ||
""" | ||
return E *((4. * alpha - 3.) * f + 3. * f**2 - 4. * alpha * f**3) | ||
|
||
n_points = 100 | ||
guess_phi = np.linspace(1., 0., n_points) # Extrema always at 1 and 0 | ||
guess_phi = np.reshape(guess_phi, (n_points, 1)) | ||
|
||
kwargs = {'deformation_deform_params': {'verbose': False}} | ||
|
||
profile_1d, phi, action = path_deform(guess_phi, V, dV, **kwargs)[:3] | ||
|
||
return action | ||
|
||
|
||
if __name__ == '__main__': | ||
import doctest | ||
doctest.testmod(optionflags=doctest.ELLIPSIS ^ doctest.REPORT_NDIFF) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
""" | ||
Path deformation from CT | ||
======================== | ||
Tests for path deformation applied to a 2d potential. | ||
The potential is eq. 13 in https://arxiv.org/pdf/1109.4189.pdf parameterised | ||
by the variable delta. The true vacuum was found by Mathematica in the below | ||
test cases. | ||
>>> action_2d(1., [1.06561, 2.24282]) | ||
2.0901... | ||
>>> action_2d(0.5, [1.05114, 1.77899]) | ||
8.7948... | ||
>>> action_2d(0.4, [1.04637, 1.66349]) | ||
12.972... | ||
>>> action_2d(0.3, [1.0403, 1.53521]) | ||
21.024... | ||
>>> action_2d(0.2, [1.03213, 1.38923]) | ||
39.648... | ||
>>> action_2d(0.1, [1.0202, 1.21683]) | ||
119.83... | ||
>>> action_2d(0.01, [1.00267, 1.02459]) | ||
7853.5... | ||
>>> action_2d(0.001, [1.00028, 1.0025]) | ||
639494.2... | ||
""" | ||
|
||
from cosmoTransitions.pathDeformation import fullTunneling as path_deform | ||
import numpy as np | ||
|
||
|
||
def action_2d(delta, true_vacuum): | ||
""" | ||
:param alpha: Parametrises shape of 1d potential | ||
:param E: Parameteries height of 1d potential | ||
:returns: Action from path deformation | ||
""" | ||
def V(fields): | ||
""" | ||
:returns: 2d potential | ||
""" | ||
f, g = fields[..., 0], fields[..., 1] | ||
return (f**2 + g**2) * (1.8 * (f - 1.)**2 + 0.2 * (g - 1.)**2 - delta) | ||
|
||
def dV(fields): | ||
""" | ||
:returns: Derivative of 2d potential | ||
""" | ||
f, g = fields[..., 0], fields[..., 1] | ||
df = -10.8 * f**2 + 7.2 * f**3 - 3.6 * g**2 - 2. * f * (-2. + delta + 0.4 * g - 2. * g**2) | ||
dg = -7.2 * f * g + f**2 * (-0.4 + 4. * g) + g * (4. - 2. * delta - 1.2 * g + 0.8 * g**2) | ||
rval = np.empty_like(fields) | ||
rval[..., 0] = df | ||
rval[..., 1] = dg | ||
return rval | ||
|
||
n_points = 100 | ||
guess_phi = np.array([np.linspace(t, 0., n_points) for t in true_vacuum]).T | ||
|
||
kwargs = {'deformation_deform_params': {'verbose': False}} | ||
|
||
profile_1d, phi, action = path_deform(guess_phi, V, dV, **kwargs)[:3] | ||
|
||
return action | ||
|
||
|
||
if __name__ == '__main__': | ||
import doctest | ||
doctest.testmod(optionflags=doctest.ELLIPSIS ^ doctest.REPORT_NDIFF) |