Git Product home page Git Product logo

gravity-simulation's Introduction

Gravity simulation

Python package for calculation and simulation of n-bodies interaction under the influence of Gravity force.Written in NumPy and Numba.





Installing :

pip install gravity-simulation==2.0.1

Example :

#random example together with one body bigger mass than others
from gravity_simulation.gravity import *

field.generate_random(15, mass=[20, 500], r=[-5, 5], velocity=[-5, 5], alpha=[0, 360])
field.add_body(Body(x0=0, y0=0,v_x=0, v_y=0, mass = 3000))

field.run(1300, C=0.01)
field.save_animation(frames=50,name='my_example',reduce_size_body=50,frames=150)

more ...
Documentation










Nympy is an incredible library and without it, The Python is nothing (just an easy programming language and so on), but with the Numpy, The Python is able to solve serious processes involved a huge number of iterations. When the application was written in common Python then the results were quite bad, for example, when the number of bodies is 2000 and number of the iterations is 10000 the duration of the process takes about 2 days because of the app was useless now when the processes are vectorized with NumPy and Numba the execution time takes about 2 hours.

gravity-simulation's People

Contributors

daodavid avatar daodeiv avatar someanonimcoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gravity-simulation's Issues

Optimization problem (rewrite using numpy)

An implementation has been written using a normal Python rather than Numpy, therefore it is too slower,because Python is slow language. If the implementation will be rewritten applying the power of Nympy, this will give a significant result related to performance.

Not all modules are installed

When I install this module, several modules (ex) numba) are not installed.
I think you should make setup file by setuptools module

Incorrect parameter

in examples/2000body.py:

field.generate_random(3500,mass=[100,500],r = [-40,40])

in gravity_simulation/gravity.py:

def generate_random(self, N_bodies, mass=[20, 500], r_x=[-5, 5], r_y=[-5, 5], r_0=0, velocity=[-5, 5], alpha=[0, 360]):

So running this example causes unrecognized argument error

Overriding of math operators

On the object Body, the math operators should be overridden, which will bring the reducing the quantity of code and quality will be better. Also in this way will open the more possibility for implemented of Numpy

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.