Ask Your Question
1

Substituting variable value

asked 2019-12-18 11:16:14 +0100

mattiav gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-12-18 12:01:17 +0100

eric_g gravatar image

updated 2019-12-18 12:03:09 +0100

To use substitute, you have to be at the level of the symbolic expression underlying the scalar field kr. The symbolic expression (in the default chart) being returned by .expr(), it suffices to write

kr.expr().subs(m==10)
edit flag offensive delete link more

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

Stats

Asked: 2019-12-18 11:16:14 +0100

Seen: 774 times

Last updated: Dec 18 '19