GithubHelp home page GithubHelp logo

nqntmqmqmb / pydilation Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 12 KB

Calculating the temporal dilation caused by an object in the universe considering metric of Schwarzschild in Python

Python 100.00%
schwarzschild mass universe surface distance

pydilation's Introduction

pyDilation

A script for calculating the temporal dilation caused by an object in the universe considering metric of Schwarzschild

Preview

Wolfram Alpha code

The WolframAlpha code is available to check the calculations

Based on

The script is based on these tests :

Example for VY CANIS MAJORIS :
Mass : 3,381 × 10^31 kg
RS = 2GM/c²
= 2 * 6.6743 * 10^-11 * 3.381 * 10^31 / 300000000^2
= 50146.24066666666666666666666666666666666666666666666666666m
= sqrt((1 - 50146.24 / (7 * 10^8)) * 1^2 - (1 - 50146.24 / 7 * 10^8)^-1*0^2 - (7 * 10^8)^2 (0 + sin^2 (0) * 0^2)))
= 0.99996418062
365*24*3600-365*24*3600*0.99996418062
= 1129.59996768s

Example for Mars:
Mass = 6,39 × 10^23 kg
RS = 2GM/c²
= 2 * 6.6743 * 10^-11 * 6.39 * 10^23 / 300000000^2
= 0.0009477506m
ds² = (1-Rs/r) dt² - (1-Rs/r)^-1 dr²- r²(dθ² + sin² θ dφ²)
= (1 - 0.0009477506m / 7 × 10^8) × 1² - (1 - 0.0009477506m / 7 × 10^8)^-1× 0² - (7 × 10^8)² (0 + sin² (0) × 0²)
= sqrt((1 - 0.0009477506 / (7 * 10^8)) * 1^2 - (1 - 0.0009477506 / 7 * 10^8)^-1× 0^2 - (7 × 10^8)^2 (0 + sin^2 (0) × 0^2)))
= 0.999999999999323035
365 * 24 * 3600 - 365 * 24 * 3600 * 0.999999999999323035
= 0.00002134876824s

Module

You can use PyDilation as a module by putting dilation.py it the same folder as your script.
dilation.Schwarzschild() or Schwarzschild() is used to calculate the Schwarzschild Radius
dilation.time_Space() or time_Space() is used to calculate the distance of time space at the surface of the object
dilation.Shift() or Shift() is used to calculate the Shift between the object and a distant observer.

dilation.Schwarzschild() two arguments : mass which is the solar mass of your object and details* dilation.time_Space() two arguments : SR which is the Schwarzschild Radius of your object and details* dilation.Shift() two arguments : time_space which is the distance of time space at the surface of the object and details*

*details is an additional parameter to print (or not) more informations about the calculation.

pydilation's People

Contributors

nqntmqmqmb avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.