I use the following code to calculate the Kretschmann scala of the Schwartzchild spacetime:
print("Initialization of manifold, chart, and metric. Definitions of constants.")
M=Manifold(4,'M',structure='Lorentzian')
X.<t,r,th,ph> = M.chart(r"t r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi")
m=var('m')
g=M.metric()
g[0,0]=-(1-2*m/r)
g[1,1]=1/(1-2*m/r)
g[2,2]=r^2
g[3,3]=r^2*sin(th)^2
print('Calculating Riemann tensor')
R = g.riemann()
print(R[:])
uR=R.up(g)
dR=R.down(g)
print('Calculating Kretschmann scalar')
kr= uR['^{abcd}']*dR['_{abcd}']
print(kr.expr())
It works, but now I want to substitute a value for the variable m. I have tried with:
kr.substitute(m==10)
kr.subs(m==10)
kr.substitute_expression(m==10)
but none of these work. How can I make the substituteion m=10?