Line
1
2{{{id=44|
3# trac 22801 on top of ...
4version()
5///
6'SageMath version 8.1.beta8, Release Date: 2017-10-16'
7}}}
8
9{{{id=45|
10Parallelism().set(nproc=4)
11///
12}}}
13
14{{{id=1|
15var('rho12,rho13,rho23', domain='real')
16assume(rho12>0, rho13>0, rho23>0)
17var('r12,r13,r23', domain='real')
18var('m1 m2 m3', domain='real')
19var('mu12,mu13,mu23', domain='real')
20
21assume(m1>0, m2>0, m3>0)
22#m1=1; m2=1; m3=1
23#
24#m3 = m2 #Extra constraint for 2 electrons
25#
26mu12 = (m1*m2)/(m1+m2); mu23 = (m2*m3)/(m2+m3); mu13 = (m1*m3)/(m1+m3)
27m_CM = m1+m2+m3
28///
29}}}
30
31<p><span style="font-size: small; font-family: book antiqua,palatino;">Contravariant metric tensor, per Miller <em>et al., </em>arXiv:1709.01108.<br /></span></p>
32
33{{{id=2|
34Ginv = matrix([[2/mu12*rho12, 1/m1*(rho12+rho13-rho23), 1/m2*(rho12+rho23-rho13)],\
35        [1/m1*(rho12+rho13-rho23), 2/mu13*rho13, 1/m3*(rho13+rho23-rho12)],\
36        [1/m2*(rho12+rho23-rho13), 1/m3*(rho13+rho23-rho12), 2/mu23*rho23]])
37Ginv
38///
39[  2*(m1 + m2)*rho12/(m1*m2)  (rho12 + rho13 - rho23)/m1  (rho12 - rho13 + rho23)/m2]
40[ (rho12 + rho13 - rho23)/m1   2*(m1 + m3)*rho13/(m1*m3) -(rho12 - rho13 - rho23)/m3]
41[ (rho12 - rho13 + rho23)/m2 -(rho12 - rho13 - rho23)/m3   2*(m2 + m3)*rho23/(m2*m3)]
42}}}
43
44<p><span style="font-family: book antiqua,palatino; font-size: small;">Feed the following into the metric tensor: M.metric().set() seems to require the covariant form.<br /></span></p>
45
46{{{id=3|
47G = Ginv.inverse(); #G.simplify_full()
48///
49}}}
50
51{{{id=36|
52#G.inverse().simplify_full()    # Check 1
53///
54}}}
55
56{{{id=7|
57#(G*Ginv).simplify_full(); (Ginv*G).simplify_full()    # Check 2
58///
59}}}
60
61{{{id=8|
62#Ginv.trace()    # Check 3
63///
64}}}
65
66{{{id=14|
67#Ginv.det().factor()    # Check 4
68///
69}}}
70
71<p><span style="font-family: book antiqua,palatino; font-size: small;">Begin manifold creation</span></p>
72
73{{{id=38|
74M = Manifold(1*3,'R^3',field='real',start_index=1)
75###
76M.set_calculus_method('sympy')
77###
78U = M.open_subset('U')
79///
80}}}
81
82{{{id=39|
83Rho.<rho12,rho13,rho23> = U.chart("rho12:(0,+oo) rho13:(0,+oo) rho23:(0,+oo)")
85    sqrt(rho13)<sqrt(rho12)+sqrt(rho23), sqrt(rho12)<sqrt(rho13)+sqrt(rho23)])
86g = M.riemannian_metric('g');
87g[:] = G[:].simplify_full()
88#g.display()
89///
90}}}
91
92{{{id=46|
93ginv = g.inverse(); ginv.display()
94///
95inv_g = 2*rho12*(m1 + m2)/(m1*m2) d/drho12*d/drho12 + (rho12 + rho13 - rho23)/m1 d/drho12*d/drho13 + (rho12 - rho13 + rho23)/m2 d/drho12*d/drho23 + (rho12 + rho13 - rho23)/m1 d/drho13*d/drho12 + 2*rho13*(m1 + m3)/(m1*m3) d/drho13*d/drho13 - (rho12 - rho13 - rho23)/m3 d/drho13*d/drho23 + (rho12 - rho13 + rho23)/m2 d/drho23*d/drho12 - (rho12 - rho13 - rho23)/m3 d/drho23*d/drho13 + 2*rho23*(m2 + m3)/(m2*m3) d/drho23*d/drho23
96}}}
97
98{{{id=41|
99%time
100# One thread takes 317s in Sage, 9311s in SymPy!
101nabla = g.connection()
102///
103CPU time: 6.20 s,  Wall time: 7880.62 s
104}}}
105
106{{{id=43|
107psi = U.scalar_field({Rho: function('Psi')(rho12,rho13,rho23)}, name='psi',latex_name='\Psi'); psi
108///
109Scalar field psi on the Open subset U of the 3-dimensional differentiable manifold R^3
110}}}
111
112{{{id=47|
113%time
114# One thread takes 95s in Sage, 1134s in SymPy!
115LBpsi = nabla(nabla(psi).up(g)).trace(); LBpsi;
116///
117Traceback (most recent call last):
118  File "<stdin>", line 1, in <module>
119  File "_sage_input_16.py", line 12, in <module>
120    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("IyBPbmUgdGhyZWFkIHRha2VzIDk1cyBpbiBTYWdlLCAxMTM0cyBpbiBTeW1QeSEKTEJwc2kgPSBuYWJsYShuYWJsYShwc2kpLnVwKGcpKS50cmFjZSgpOyBMQnBzaTs="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")); print("CPU time: %.2f s,  Wall time: %.2f s"%(cputime(__SAGE_t__), walltime(__SAGE_w__)))' + '\n', '', 'single')
121  File "", line 1, in <module>
122
123  File "/tmp/tmpMR0aBV/___code___.py", line 3, in <module>
124    exec compile(u'LBpsi = nabla(nabla(psi).up(g)).trace(); LBpsi;' + '\n', '', 'single')
125  File "", line 1, in <module>
126
127  File "/home/rllozes/Development/sage/local/lib/python2.7/site-packages/sage/manifolds/differentiable/tensorfield.py", line 3263, in up
128    result = result.up(metric, k)
129  File "/home/rllozes/Development/sage/local/lib/python2.7/site-packages/sage/manifolds/differentiable/tensorfield.py", line 3269, in up
130    return self.contract(pos, metric.inverse(), 0)
131  File "/home/rllozes/Development/sage/local/lib/python2.7/site-packages/sage/manifolds/differentiable/tensorfield_paral.py", line 1540, in contract
132    return TensorField.contract(self, *args)
133  File "/home/rllozes/Development/sage/local/lib/python2.7/site-packages/sage/manifolds/differentiable/tensorfield.py", line 2788, in contract
134    return FreeModuleTensor.contract(self_r, *args)
135  File "/home/rllozes/Development/sage/local/lib/python2.7/site-packages/sage/tensor/modules/free_module_tensor.py", line 2551, in contract
136    cmp_res = self._components[basis].contract(*args)
137  File "/home/rllozes/Development/sage/local/lib/python2.7/site-packages/sage/tensor/modules/comp.py", line 2326, in contract
138    for ii, val in make_Contraction(listParalInput):
139  File "/home/rllozes/Development/sage/local/lib/python2.7/site-packages/sage/parallel/multiprocessing_sage.py", line 76, in parallel_iter
140    for res in result:
141  File "/home/rllozes/Development/sage/local/lib/python2.7/multiprocessing/pool.py", line 673, in next
142    raise value
143TypeError: expected string or Unicode object, NoneType found
144}}}
145