ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 28 Aug 2019 13:24:23 +0200How to set a metric tensor inverse?https://ask.sagemath.org/question/47633/how-to-set-a-metric-tensor-inverse/ I have a complicated metric tensor. In order to compute the Laplacian in this metric, I need the metric tensor inverse. But this exceeds my memory capacity after ~36 hours of computing.
I would like instead to set the inverse with what I believe to be the correct entries. Is that possible? Reviewing the documentation and the source code, I see no indication of such an operation.
I wonder if `g.inverse().comp(XI.frame())[:] = Ginv[:] ` would work, where `g` denotes the metric tensor, and `Ginv` the matrix of expressions which should be correct.
BTW, I have the metric and its inverse in one frame. It is after mapping into a second frame [XI] that the problem arises.Wed, 28 Aug 2019 03:29:09 +0200https://ask.sagemath.org/question/47633/how-to-set-a-metric-tensor-inverse/Answer by eric_g for <p>I have a complicated metric tensor. In order to compute the Laplacian in this metric, I need the metric tensor inverse. But this exceeds my memory capacity after ~36 hours of computing. </p>
<p>I would like instead to set the inverse with what I believe to be the correct entries. Is that possible? Reviewing the documentation and the source code, I see no indication of such an operation. </p>
<p>I wonder if <code>g.inverse().comp(XI.frame())[:] = Ginv[:]</code> would work, where <code>g</code> denotes the metric tensor, and <code>Ginv</code> the matrix of expressions which should be correct. </p>
<p>BTW, I have the metric and its inverse in one frame. It is after mapping into a second frame [XI] that the problem arises.</p>
https://ask.sagemath.org/question/47633/how-to-set-a-metric-tensor-inverse/?answer=47639#post-id-47639`g._inverse.set_comp(XI.frame())[:] = Ginv[:]` should work (notice that it starts with `g._inverse`, not `g.inverse()`, and that `set_comp` must be used instead of `comp`).
Probably we should implement a method `set_inverse()` to allow easily for this. Wed, 28 Aug 2019 13:24:23 +0200https://ask.sagemath.org/question/47633/how-to-set-a-metric-tensor-inverse/?answer=47639#post-id-47639