Ask Your Question

Error with metric

asked 2016-11-30 09:23:31 +0200

gucheuta gravatar image

updated 2016-11-30 14:52:38 +0200

eric_g gravatar image


I am learning Sage Math and Sage Manifolds. As in the reference manual, I just used the command:

M = Manifold(4, 'M')

g = M.lorentz_metric('g')

Running the second line gave me the following message:

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "", line 10, in <module> exec compile(u'open("","w").write("# -- coding: utf-8 --\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZyA9IE0ubG9yZW50el9tZXRyaWMoJ2cnKQ=="),globals())+"\n"); execfile(os.path.abspath("")) File "", line 1, in <module>

File "/private/var/folders/hw/dshmtl910nb4nk8_pc8f7ldr0000gn/T/tmptEzTup/", line 2, in <module> exec compile(u"g = M.lorentz_metric('g')" + '\n', '', 'single') File "", line 1, in <module>

File "sage/structure/category_object.pyx", line 834, in sage.structure.category_object.CategoryObject.__getattr__ (/Applications/ File "sage/structure/category_object.pyx", line 849, in sage.structure.category_object.CategoryObject.getattr_from_category (/Applications/ File "sage/structure/misc.pyx", line 295, in sage.structure.misc.getattr_from_other_class (/Applications/ AttributeError: 'DifferentiableManifold_with_category' object has no attribute 'lorentz_metric'

I appreciate it if somebody would give me some advice. Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-11-30 14:50:38 +0200

eric_g gravatar image

It's because SageManifolds is not fully installed on your computer. Probably, you are using the limited version of SageManifolds which is included in SageMath 7.4. This version does not contain the metrics (nor any tensor field calculus). The next release of SageMath (i.e. 7.5) will contain the totality of SageManifolds. Meanwhile, you have to install SageManifolds atop SageMath 7.4 by following these instructions.

Another option is to use the SageMathCloud, where SageManifolds is installed system-wide in the SageMath 7.4 kernels of Jupyter notebooks.

edit flag offensive delete link more


It is strange. I got the same error after following the installation instructions, too. In fact, g = M.lorentz_metric('g') (or g = M.metric('g') ) did not work even in SageMathCloud...

P.S. I installed and SageManigolds on MacOSX.

gucheuta gravatar imagegucheuta ( 2016-11-30 22:10:09 +0200 )edit

It looks that SageManifolds is not correctly installed on your MacOSX computer. Are you sure you have run the install script from the Sage root directory?

Regarding the SageMathCloud, you have to open a Jupyter notebook, go to the Kernel menu, then to Change kernel and select SageMath 7.4. It should work, cf. this example.

eric_g gravatar imageeric_g ( 2016-12-01 15:33:14 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-11-30 09:23:31 +0200

Seen: 264 times

Last updated: Nov 30 '16