A Python package to create and simulate physics models.
Project description
sagephysics
Category  Tools 

Development  
Package  
Documentation  
Communication 
Introduction
A Python package to create and simulate physics models.
Prerequisites
An installation of SageMath with version > 10.0 is required.
Installation
You can install sagephysics
either as a normal user or for development purposes.
User
For user installation, sagephysics
is currently available on the PyPi's repository, and you can
install it via pip
:
sage pip install sagephysics
You can then start the Sage REPL with the command sage
and use sagephysics
through the Sage REPL:
import sagephys
Development
Development installation requires to clone the repository and change directory to the project's root:
git clone https://github.com/georgedouzas/sagephysics.git
cd sagephysics
Then create a Python virtual environment using the sage
command:
sage python m venv systemsitepackages .venv
Finally, use PDM to select the virtual environment and install the project as well as the main and development dependencies:
pdm use .venv
pdm install
You can then start the Sage REPL with the command PYTHONPATH=src sage
and use sagephysics
through the Sage REPL:
import sagephys
Usage
One of the sagephysics
main goals is to provide a unified interface for various physics models. For example let's define two
independent harmonic oscillators that oscillate in the axes x and y:
from sage.all import var, assume
from sagephys.classical_mechanics import NewtonianPointParticlesModel
k, x_particle1, y_particle2 = var('k x_particle1 y_particle2')
assume(k > 0)
forces = {
'particle1': {'elastic': [ k * x_particle1, 0, 0]},
'particle2': {'elastic': [0, k * y_particle2, 0]}
}
model = NewtonianPointParticlesModel(forces)
We can get the dynamical equations:
model.analyze()
model.equations_
We can also try to solve them:
model.solve()
Project details
Release history Release notifications  RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sage_physics0.1.0py3noneany.whl
Algorithm  Hash digest  

SHA256  cc0611ac5a9c3b55a9168a673c2a6a160311f92293cae985aff1c57cbb8910ac 

MD5  719b6f70443d67a5e6f40b6c7ca8b958 

BLAKE2b256  aa68a16d585b7e81ce79018889bfbc30658011cf5b408d5b244b0fccba51130b 