| 查看: 568 | 回复: 1 | |||
[交流]
【求助】帮我看看这个程序有问提不哦,求引力场方程的 已有1人参与
|
|
BeginPackage[”Einstein‘”] Einstein::usage= ”Einstein[g-,v-] calculate the Ricci Tensor and the Curvature Scalar from the given metric. g-is the given metric, and v-are the variables.” Begin[”‘private‘”] Einstein[g-,v-]:= Block[ {invg, dg1, dg2, dg3, G, dG, Ruv1, Ruv2, Ruv3, Ruv4, Ruv, Rrr, Result} Result ={}; (* Result save the return Values. *) (* Calculate the inverse metric of g. *) invg = Inverse[ g ]; (* Calculate the affine connection. *) dg1 = Outer[ D, g, v ]; dg2 = Transpose[ dg1,{1,3,2} ]; dg3 = Transpose[ dg1,{2,3,1} ]; G = (1/2) invg . ( dg1 + dg2 - dg3 ); (* Calculate the Ricci tensor. *) dG = Outer[ D, G, v ]; Ruv1 = Table[Sum[dG[[k,i,k,j]],{k,4}],{i,4},{j,4}]; Ruv2 = Table[Sum[dG[[k,i,j,k]],{k,4}],{i,4},{j,4}]; Ruv3 = Table[Sum[G[[k,i,j]]G[[h,k,h]],{k,4},{h,4}],{i,4},{j,4}]; Ruv4 = Table[Sum[G[[k,i,h]]G[[h,j,k]],{k,4},{h,4}],{i,4},{j,4}]; Ruv = Ruv1 - Ruv2 - Ruv3 + Ruv4; Result = Append[ Result, Simplify[ Ruv ] ]; (* Calculate the Curvature Scalar. *) Rrr = Sum[ invg[[i,i]]Ruv[[i,i]], {i,4}]; Result = Append[ Result, Simplify[ Rrr ] ]; (* Return the Result. *) Return[ Result ] ] End[] EndPackage[] [ Last edited by nono2009 on 2009-12-1 at 07:14 ] |
» 猜你喜欢
面上提前没消息,有中的吗
已经有14人回复
这种情况还有戏吗
已经有12人回复
微信指数没变化,科研之友没阅读
已经有19人回复
准备明年的基金了
已经有7人回复
面上再次挂了,太难了,躺也躺不了,倦也卷不过,小学校之殇!
已经有24人回复
2026年国自然面上资助率
已经有21人回复
基础研究怎么拉横向,学校到款任务越来越多,难以完成 拉横向,都有哪些途径啊
已经有10人回复
2027年申博
已经有3人回复
一个有机合成实验室都需要哪些设备?
已经有7人回复
HXDI做水性聚氨酯乳液,是不是特别容易出渣
已经有3人回复
watercamel
银虫 (著名写手)
- 应助: 1 (幼儿园)
- 金币: 120.2
- 红花: 3
- 帖子: 1882
- 在线: 311.1小时
- 虫号: 342291
- 注册: 2007-04-09
- 专业: 固体力学
2楼2010-10-10 12:54:00










回复此楼