summaryrefslogtreecommitdiffstats
path: root/profile.h
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2015-07-01 12:27:42 +0200
committerGravatar Jan Darowski <jan.darowski@gmail.com>2015-07-03 22:36:59 +0200
commit0180d2eb1e8101eb362efb00edaae9eb9bcb24aa (patch)
tree804480a3a693d383caf648448e7607e34b6b1fcc /profile.h
parentecd0e3e170e5a8ec96be8d19d095e7c75c63c825 (diff)
downloadsubsurface-0180d2eb1e8101eb362efb00edaae9eb9bcb24aa.tar.gz
VPM-B: use an analytic solution for nucleon inner pressure instead of binary root search
According to mathematica In[4]:= f[x_] := x^3 - b x^2 - c In[18]:= Solve[f[x] == 0, x] Out[18]= {{x -> 1/3 (b + ( 2^(1/3) b^2)/(2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^( 1/3) + (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(1/3)/ 2^(1/3))}, {x -> b/3 - ((1 + I Sqrt[3]) b^2)/( 3 2^(2/3) (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^( 1/3)) - ((1 - I Sqrt[3]) (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(1/3))/(6 2^(1/3))}, {x -> b/3 - ((1 - I Sqrt[3]) b^2)/( 3 2^(2/3) (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^( 1/3)) - ((1 + I Sqrt[3]) (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(1/3))/(6 2^(1/3))}} For the values of b and c encounterd in the algorithm, the first solution is in fact the only real one that we are after. So we can use this solution instead of doing a binary search for the root of the cubic. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Diffstat (limited to 'profile.h')
0 files changed, 0 insertions, 0 deletions