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, 11 Nov 2021 16:51:30 +0100Globally redefine symbolic function in a tensor fieldhttps://ask.sagemath.org/question/59686/globally-redefine-symbolic-function-in-a-tensor-field/As a simple example, I have the following manifold and chart:
M = Manifold(2, 'M', structure='Lorentzian')
X.<t,r> = M.chart(r"t r:(0,+oo)")
with these functions:
h = function('h')(r)
h0 = function('h0')(r)
Now, I define the following tensor:
A = M.tensor_field(0,2)
A[0,0] = h
If I print `A`, I get:
[h(r) 0]
[ 0 0]
as I expected. However, from now on I want `h` to be:
h = 2*h0
After setting `h=2*h0`, if I print `A[:]` I get the same tensor I had before, instead of `A[0,0] = 2*h0`.
How can I redefine a symbolic function inside a tensor? I have tried with `A.subs` and `A.apply_map`, but none of them did the job.kekoThu, 11 Nov 2021 16:51:30 +0100https://ask.sagemath.org/question/59686/