Ian Jauslin
summaryrefslogtreecommitdiff
blob: b480db0aa1c48043bd83af9a4f5e73e416399e1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
## Copyright 2021-2023 Ian Jauslin
## 
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
## 
##     http://www.apache.org/licenses/LICENSE-2.0
## 
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.

# exponential potential in 3 dimensions
@everywhere function v_exp(
  k::Float64,
  a::Float64
)
  return 8*pi/(1+k^2)^2*a
end
@everywhere function a0_exp(
  a::Float64
)
  if a>0.
    return log(a)+2*MathConstants.eulergamma+2*besselk(0,2*sqrt(a))/besseli(0,2*sqrt(a))
  elseif a<0.
    return log(-a)+2*MathConstants.eulergamma-pi*bessely(0,2*sqrt(-a))/besselj(0,2*sqrt(-a))
  else
    return 0.
  end
end

# exp(-x)-a*exp(-b*x) in 3 dimensions
@everywhere function v_expcry(
  k::Float64,
  a::Float64,
  b::Float64
)
  return 8*pi*((1+k^2)^(-2)-a*b*(b^2+k^2)^(-2))
end
@everywhere function a0_expcry(
  a::Float64,
  b::Float64
)
  return 1.21751642717932720441274114683413710125487579284827462 #ish
end

# x^2*exp(-|x|) in 3 dimensions
@everywhere function v_npt(
  k::Float64
)
  return 96*pi*(1-k^2)/(1+k^2)^4
end
@everywhere function a0_npt()
  return 1. #ish
end

# 1/(1+x^4/4) potential in 3 dimensions
@everywhere function v_alg(
  k::Float64
)
  if(k==0)
    return 4*pi^2
  else
    return 4*pi^2*exp(-k)*sin(k)/k
  end
end
a0_alg=1. #ish

# (1+a x^4)/(1+x^2)^4 potential in 3 dimensions
@everywhere function v_algwell(
  k::Float64
)
  a=4
  return pi^2/24*exp(-k)*(a*(k^2-9*k+15)+k^2+3*k+3)
end
a0_algwell=1. #ish

# potential corresponding to the exact solution c/(1+b^2x^2)^2
@everywhere function v_exact(
  k::Float64,
  b::Float64,
  c::Float64,
  e::Float64
)
  if k!=0
    return 48*pi^2*((18+3*sqrt(c)-(4-3*e/b^2)*c-(1-2*e/b^2)*c^1.5)/(4*(3+sqrt(c))^2*sqrt(c))*exp(-sqrt(1-sqrt(c))*k/b)+(-18+3*sqrt(c)+(4-3*e/b^2)*c-(1-2*e/b^2)*c^1.5)/(4*(3-sqrt(c))^2*sqrt(c))*exp(-sqrt(1+sqrt(c))*k/b)+(1-k/b)/2*exp(-k/b)-c*e/b^2*(3*(9-c)*k/b+8*c)/(8*(9-c)^2)*exp(-2*k/b))/k
  else
    return 48*pi^2*(-sqrt(1-sqrt(c))/b*(18+3*sqrt(c)-(4-3*e/b^2)*c-(1-2*e/b^2)*c^1.5)/(4*(3+sqrt(c))^2*sqrt(c))-sqrt(1+sqrt(c))/b*(-18+3*sqrt(c)+(4-3*e/b^2)*c-(1-2*e/b^2)*c^1.5)/(4*(3-sqrt(c))^2*sqrt(c))-1/b-c*e/b^2*(27-19*c)/(8*(9-c)^2))
  end
end
@everywhere function a0_exact(
  b::Float64,
  c::Float64,
  e::Float64
)
  return 1. #ish
end

# tent potential (convolution of soft sphere with itself): a*pi/12*(2*|x|/b-2)^2*(2*|x|/b+4) for |x|<b
@everywhere function v_tent(
  k::Float64,
  a::Float64,
  b::Float64
)
  if k!=0
    return (b/2)^3*a*(4*pi*(sin(k*b/2)-k*b/2*cos(k*b/2))/(k*b/2)^3)^2
  else
    return (b/2)^3*a*(4*pi/3)^2
  end
end
@everywhere function a0_tent(
  a::Float64,
  b::Float64
)
  return b #ish
end