Other

项目介绍

spacetimeengineer/spacetimeengine 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 Other 许可证,目前获得 160 个 Star、18 次 Fork。

仓库全名
spacetimeengineer/spacetimeengine
开源许可证
Other
Star 数
160
Fork 数
18
未关闭 Issue
16

README 摘要

A Python utility built on Sympy (A symbolic mathematics library) which will analyze any given metric solution to the Einstein field equations. Prerequisites (Linux) 1.) Install Python3 $ sudo apt install python3 2.) Install pip3 $ sudo apt install python3-pip 3.) Install git $ sudo apt-get install git Prerequisites (MacOS) 1.) Install homebrew $ ruby -e "$(curl -fsSL…

完整内容见 GitHub 原始 README 或本页 。

常见问题

spacetimeengine 用什么语言开发?

主要使用 Python 编写,采用 Other 许可证,目前有 160 个 Star。

spacetimeengine 可以免费商用吗?

仓库标注的许可证为 Other,商用前请先阅读仓库 LICENSE 文件确认授权范围。

如何获取 spacetimeengine 的源码?

可以直接克隆仓库:git clone https://github.com/spacetimeengineer/spacetimeengine.git,默认分支为 master;安装与运行步骤见仓库 README。

spacetimeengine 最近还在维护吗?

仓库最近一次更新为 2025年4月17日,当前有 16 个未关闭 Issue;Star 数为 160,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

A Python utility for analyzing a given solution to the Einstein's field equations. Built on Sympy.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

语言占比

Python

README

alt text

A Python utility built on Sympy (A symbolic mathematics library) which will analyze any given metric solution to the Einstein field equations.

equation

Prerequisites (Linux)

1.) Install Python3

$ sudo apt install python3

2.) Install pip3

$ sudo apt install python3-pip

3.) Install git

$ sudo apt-get install git

Prerequisites (MacOS)

1.) Install homebrew

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew doctor

2.) Set python as an environmental variable.

$ export PATH="/usr/local/opt/python/libexec/bin:$PATH"

3.) Install git

$ brew install git

4.) Install python3 and pip3 (https://docs.python-guide.org/starting/install3/osx/)

$ brew install python3
$ brew postinstall python3

Prerequisites (Windows)

1.) Install Python3 & pip3

Navigate to https://www.python.org/downloads/

2.) Install git

Navigate to https://gitforwindows.org/

Installation with pip3

1.) Install with pip3

$ pip3 install spacetimeengine  

2.) Enter python shell

$ python3

3.) Import spacetimeengine

>> from spacetimeengine import *

4.) Create a SpaceTime object which describes the Schwarzschild spacetime

>> schwarzschild_spacetime = SpaceTime(Solution().schwarzschild())

5.) Enjoy watching the coefficients get computed.

Installation with git

1.) Clone repository

$ git clone https://github.com/spacetimeengineer/spacetimeengine

2.) Enter directory

$ cd spacetimeengine/spacetimeengine/samples

3.) Run example.py

$ python3 example.py

Suggested Use

If you are a student or researcher, and you find yourself reading a publication based in General Relativity which provides metric solutions, then this utility can be used for working out the curvature coefficients associated with the solution provided by the user. This can be a helpful utility as you read through the literature because you will be able to cross-reference the information provided by the literature with the values the spacetimeengine provides (this is why I developed it originally). More commonly, this utility can be used for error checking.

Metric Tensor

Generally speaking, any metric solution to the Einstein field equations will be packaged into a geometric object known as the metric tensor. The metric tensor is often represented in matrix form, and the spacetimeengine package adopts this representation.

equation

The spacetimeengine package employs the Sympy ‘Matrix’ object for packaging the metric tensor and it serves as the essential parameter for constructing a ‘SpaceTime’ object. The Solutions module currently stores some well-known metrics for study, but these can be used for understanding how to construct new solutions.

Constructing a solution (In development)

Currently, all metric solutions are packaged by specifying four key parameters and storing them in an array. These parameters include an index configuration for the given metric solution, the coordinates to define the metric in terms of, the metric itself, and the cosmological constant. It is important to note that a zero-valued cosmological constant indicates the employment of a classical formulation to the Einstein field equations. Below represents a valid definition of the Schwarzschild stationary black hole solution.

def schwarzschild(self):    

    # Assigns meaning to the coordinates.
    x0, x1, x2, x3 = symbols('t r theta phi')
    # Groups the coordinates in an array.
    coordinate_set = [x0, x1, x2, x3]
    
    # Constants required to describe the metric.
    G, M, c = symbols('G M c')
    
    # Metric.
    metric = Matrix([    
                        [ (1-(2*G*M)/(x1*c**2)), 0, 0, 0 ], 
                        [ 0, - (1-(2*G*M)/(x1*c**2))**(-1), 0, 0 ], 
                        [ 0, 0, - x1**2, 0 ], 
                        [ 0, 0, 0, - x1**2*sin(x2)**2 ]
                    ])
    
    # Describes the index configuration which the metric represents.
    index_config = "dd"
    
    # Cosmological constant.
    cosmological_constant = 0
    
    # An array detailing the solution.
    solution_array = [ metric, coordinate_set, index_config, cosmological_constant ]
    
    # Returns solution
    return solution_array

评论

暂无评论