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.Thu, 21 May 2020 11:11:39 +0200manifolds : ricci_scalar() has no attribute 'at'https://ask.sagemath.org/question/51473/manifolds-ricci_scalar-has-no-attribute-at/ gP3.ricci_scalar().at(p) does not produce value of ricci_scalar at point p. (gP3 is my metric).
whilst ricci().at(p) is working.
Error message :
AttributeError: 'DiffScalarFieldAlgebra_with_category.element_class' object has no attribute 'at'Wed, 20 May 2020 15:52:31 +0200https://ask.sagemath.org/question/51473/manifolds-ricci_scalar-has-no-attribute-at/Answer by eric_g for <p>gP3.ricci_scalar().at(p) does not produce value of ricci_scalar at point p. (gP3 is my metric).
whilst ricci().at(p) is working.
Error message :
AttributeError: 'DiffScalarFieldAlgebra_with_category.element_class' object has no attribute 'at'</p>
https://ask.sagemath.org/question/51473/manifolds-ricci_scalar-has-no-attribute-at/?answer=51474#post-id-51474To get the value of a scalar field at a point, simply use the call method, i.e. the parenthesis operator. In your case:
gP3.ricci_scalar()(p)
Actually, `at()` is reserved to tensor fields of valence $>0$, since for them the call method has a different meaning. For instance, if `g` is the metric tensor and `u` and `v` are two vector fields, the call method of `g` is used to denote the bilinear form action of `g` on the pair `(u,v)` as `g(u,v)`. The following identity, which involves the various call methods and `at()`, holds:
g.at(p)(u.at(p), v.at(p)) == g(u, v)(p)
Here is a full example:
sage: E.<x,y> = EuclideanSpace()
sage: g = E.metric()
sage: g.display()
g = dx*dx + dy*dy
sage: u = E.vector_field(-y, x)
sage: v = E.vector_field(x+y, x-y)
sage: p = E((2, 3)); p
Point on the Euclidean plane E^2
sage: bool( g.at(p)(u.at(p), v.at(p)) == g(u, v)(p) )
TrueWed, 20 May 2020 21:38:02 +0200https://ask.sagemath.org/question/51473/manifolds-ricci_scalar-has-no-attribute-at/?answer=51474#post-id-51474Comment by LPsFR for <p>To get the value of a scalar field at a point, simply use the call method, i.e. the parenthesis operator. In your case:</p>
<pre><code>gP3.ricci_scalar()(p)
</code></pre>
<p>Actually, <code>at()</code> is reserved to tensor fields of valence $>0$, since for them the call method has a different meaning. For instance, if <code>g</code> is the metric tensor and <code>u</code> and <code>v</code> are two vector fields, the call method of <code>g</code> is used to denote the bilinear form action of <code>g</code> on the pair <code>(u,v)</code> as <code>g(u,v)</code>. The following identity, which involves the various call methods and <code>at()</code>, holds:</p>
<pre><code>g.at(p)(u.at(p), v.at(p)) == g(u, v)(p)
</code></pre>
<p>Here is a full example:</p>
<pre><code>sage: E.<x,y> = EuclideanSpace()
sage: g = E.metric()
sage: g.display()
g = dx*dx + dy*dy
sage: u = E.vector_field(-y, x)
sage: v = E.vector_field(x+y, x-y)
sage: p = E((2, 3)); p
Point on the Euclidean plane E^2
sage: bool( g.at(p)(u.at(p), v.at(p)) == g(u, v)(p) )
True
</code></pre>
https://ask.sagemath.org/question/51473/manifolds-ricci_scalar-has-no-attribute-at/?comment=51476#post-id-51476As simple as that. Many thanks.Thu, 21 May 2020 11:11:39 +0200https://ask.sagemath.org/question/51473/manifolds-ricci_scalar-has-no-attribute-at/?comment=51476#post-id-51476