# Computing Riemann connection fails in Maxima

Set up manifold with Riemann metric:

'SageMath version 7.6, Release Date: 2017-03-25'
sage: M = Manifold(2,'R^2',field='real',start_index=1)
sage: c_Cart.<x1,x2> = M.chart();
sage: g = M.riemannian_metric('g');
sage: g[1,1],g[2,2] = 1,1;
sage: g.display()
g = dx1dx1 + dx2dx2

And a change of coordinates:

sage: c_CM.<x,x> = M.chart();
sage: m1, m2 = var('m1 m2', domain='positive');
sage: m_CM = m1+m2; mu1 = m1/m_CM; mu2 = m2/m_CM; mu = m1m2/m_CM
sage: # Restrictions in following line seem to make no difference ...
sage: ch_Cart_CM = c_Cart.transition_map(c_CM, [mu1
x1+mu2*x2, x1-x2], restrictions1 = x1!=x2, restrictions2 = x!=0)
sage: ch_Cart_CM;
Change of coordinates from Chart (R^2, (x1, x2)) to Chart (R^2, (X, x))

Now define a connection on g:

sage: g.comp(c_CM.frame())[:]
[ 2 -(m1 - m2)/(m1 + m2)]
[ -(m1 - m2)/(m1 + m2) (m1^2 + m2^2)/(m1^2 + 2m1m2 + m2^2)]

And a connection on G:

sage: G = M.riemannian_metric('G');
sage: G[:]= g.comp(c_CM.frame())[:]
sage: G.display()
G = 2 dx1dx1 - (m1 - m2)/(m1 + m2) dx1dx2 - (m1 - m2)/(m1 + m2) dx2dx1 + (m1^2 + m2^2)/(m1^2 + 2m1m2 + m2^2) dx2dx2

Everything appears to be fine. Let's try the Riemann connection:

sage: g.connection()
Levi-Civita connection nabla_g associated with the Riemannian metric g on the 2-dimensional differentiable manifold R^2

Good. BUT

sage: #G.connection() # blows up (in Maxima?) w/ "Detected access to protected memory ..."

Is there something wrong in the way G was defined, or are we limited by Maxima (whose ECL routines contain the message)?

edit retag close merge delete

Sort by » oldest newest most voted

This is indeed a bug in Maxima (nothing to do with the Riemannian connections per se). One can trace it back to

sage: m1, m2 = var('m1 m2', domain='positive')
sage: a = (m2-m1)*m2/(m1+m2)^2
sage: bool(a == 0) # crashes the Sage session !!!


A workaround is to declare the variables m1 and m2 in the domain 'real' instead of 'positive':

sage: m1, m2 = var('m1 m2', domain='real')

more

Thanks to both for reporting and opening a ticket ! confirmed_bug tag added.