# Swarmalator
Swarmalators are a hybrid swarm oscillator system, combining features of both swarming (particles that align their spatial motion) and oscillators (units that synchronize their phase). This repository provides an implementation of the swarmalator model in a 3D environment using PyTorch.
# Install
```bash
```
## Overview
At the heart of the model are two main components for each swarmalator:
1. **Spatial Position (`xi`)**: Represents where the swarmalator is in a 3D space.
2. **Phase/Orientation (`sigma_i`)**: Defines the state or phase of the swarmalator.
The dynamics of each swarmalator are driven by interactions with its neighbors. These interactions are based on their relative spatial distances and differences in their phases.
## Dynamics Explained
The dynamics of the swarmalators are governed by two main equations:
1. For the spatial position (`xi`):
- Swarmalators are attracted or repelled based on the difference in their phases.
- They also experience a self-propelling force and a damping on high velocities.
2. For the phase/orientation (`sigma_i`):
- The phase changes based on the relative spatial positioning of the swarmalators.
- There's also an intrinsic phase precession and a nonlinearity which can cause the phase to wrap around.
Using the Runge-Kutta 4th order method (RK4), the system numerically integrates these dynamics over time, leading to the emergent behaviors of the swarmalators.
## Visualization
In the visualization, you will witness:
- A 3D cube that encapsulates the world of swarmalators.
- `N` points inside this 3D space, each representing a swarmalator. The movements and dynamics of these swarmalators are based on the aforementioned interactions.
- A mesmerizing dance of points as they evolve over time, showcasing various patterns, clusters, or scattered behaviors.
## Parameters
The behavior of swarmalators can be fine-tuned using several parameters:
- `N`: Number of swarmalators.
- `J, alpha, beta, gamma, epsilon_a, epsilon_r, R`: Parameters that govern the strength and nature of interactions and dynamics.
- `D`: Dimensionality of the phase/orientation.
## Usage
To simulate the swarmalators, adjust the parameters as desired and run the provided script. Post-simulation, the final positions and phases of the swarmalators are printed, and the visualization can be observed.
```python
N = 100
J, alpha, beta, gamma, epsilon_a, epsilon_r, R = [0.1]*7
D = 3
xi, sigma_i = simulate_swarmalators(N, J, alpha, beta, gamma, epsilon_a, epsilon_r, R, D)
print(xi[-1], sigma_i[-1])
```
## Conclusion
Swarmalators provide a unique and intriguing insight into systems that exhibit both swarming and synchronization behaviors. By studying and visualizing such models, we can gain a better understanding of complex systems in nature and potentially apply these insights to engineering and technological domains.
Raw data
{
"_id": null,
"home_page": "https://github.com/kyegomez/swarmalator",
"name": "swarmalator",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6,<4.0",
"maintainer_email": "",
"keywords": "artificial intelligence,deep learning,optimizers,Prompt Engineering",
"author": "Kye Gomez",
"author_email": "kye@apac.ai",
"download_url": "https://files.pythonhosted.org/packages/03/bf/f67d6f8dffd6a62f1f03ead2272294bd2c2fe2c2448b884f581188b66d21/swarmalator-0.0.1.tar.gz",
"platform": null,
"description": "# Swarmalator \n\nSwarmalators are a hybrid swarm oscillator system, combining features of both swarming (particles that align their spatial motion) and oscillators (units that synchronize their phase). This repository provides an implementation of the swarmalator model in a 3D environment using PyTorch.\n\n\n# Install\n\n```bash\n\n\n\n```\n\n## Overview\n\nAt the heart of the model are two main components for each swarmalator: \n1. **Spatial Position (`xi`)**: Represents where the swarmalator is in a 3D space.\n2. **Phase/Orientation (`sigma_i`)**: Defines the state or phase of the swarmalator.\n\nThe dynamics of each swarmalator are driven by interactions with its neighbors. These interactions are based on their relative spatial distances and differences in their phases.\n\n## Dynamics Explained\n\nThe dynamics of the swarmalators are governed by two main equations:\n\n1. For the spatial position (`xi`):\n - Swarmalators are attracted or repelled based on the difference in their phases.\n - They also experience a self-propelling force and a damping on high velocities.\n \n2. For the phase/orientation (`sigma_i`):\n - The phase changes based on the relative spatial positioning of the swarmalators.\n - There's also an intrinsic phase precession and a nonlinearity which can cause the phase to wrap around.\n\nUsing the Runge-Kutta 4th order method (RK4), the system numerically integrates these dynamics over time, leading to the emergent behaviors of the swarmalators.\n\n## Visualization\n\nIn the visualization, you will witness:\n- A 3D cube that encapsulates the world of swarmalators.\n- `N` points inside this 3D space, each representing a swarmalator. The movements and dynamics of these swarmalators are based on the aforementioned interactions.\n- A mesmerizing dance of points as they evolve over time, showcasing various patterns, clusters, or scattered behaviors.\n\n## Parameters\n\nThe behavior of swarmalators can be fine-tuned using several parameters:\n- `N`: Number of swarmalators.\n- `J, alpha, beta, gamma, epsilon_a, epsilon_r, R`: Parameters that govern the strength and nature of interactions and dynamics.\n- `D`: Dimensionality of the phase/orientation.\n\n## Usage\n\nTo simulate the swarmalators, adjust the parameters as desired and run the provided script. Post-simulation, the final positions and phases of the swarmalators are printed, and the visualization can be observed.\n\n```python\nN = 100\nJ, alpha, beta, gamma, epsilon_a, epsilon_r, R = [0.1]*7\nD = 3\nxi, sigma_i = simulate_swarmalators(N, J, alpha, beta, gamma, epsilon_a, epsilon_r, R, D)\nprint(xi[-1], sigma_i[-1])\n```\n\n## Conclusion\n\nSwarmalators provide a unique and intriguing insight into systems that exhibit both swarming and synchronization behaviors. By studying and visualizing such models, we can gain a better understanding of complex systems in nature and potentially apply these insights to engineering and technological domains.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "swarmalator - Pytorch",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://github.com/kyegomez/swarmalator",
"Repository": "https://github.com/kyegomez/swarmalator"
},
"split_keywords": [
"artificial intelligence",
"deep learning",
"optimizers",
"prompt engineering"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "21c65e33ae53ec2fcc8d63eab221fb03cb7bf645a6bfd53389f2ff6ea0905595",
"md5": "4e8899773e9d6dfd5ebafb9ae443271c",
"sha256": "235c1871a366a33f1ca539f662ad9ada06e3757ee1a7d787a1495b1b0eec3471"
},
"downloads": -1,
"filename": "swarmalator-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4e8899773e9d6dfd5ebafb9ae443271c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6,<4.0",
"size": 7071,
"upload_time": "2023-10-22T17:23:07",
"upload_time_iso_8601": "2023-10-22T17:23:07.409033Z",
"url": "https://files.pythonhosted.org/packages/21/c6/5e33ae53ec2fcc8d63eab221fb03cb7bf645a6bfd53389f2ff6ea0905595/swarmalator-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "03bff67d6f8dffd6a62f1f03ead2272294bd2c2fe2c2448b884f581188b66d21",
"md5": "3d852b3da42e15878c7ed298dcec23f6",
"sha256": "4e9f7682b6e49272d7ee1fa7cce25d3c1b3b3173b8b8d21a1b1939bf1682ae5e"
},
"downloads": -1,
"filename": "swarmalator-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "3d852b3da42e15878c7ed298dcec23f6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6,<4.0",
"size": 6483,
"upload_time": "2023-10-22T17:23:09",
"upload_time_iso_8601": "2023-10-22T17:23:09.190847Z",
"url": "https://files.pythonhosted.org/packages/03/bf/f67d6f8dffd6a62f1f03ead2272294bd2c2fe2c2448b884f581188b66d21/swarmalator-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-22 17:23:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kyegomez",
"github_project": "swarmalator",
"github_not_found": true,
"lcname": "swarmalator"
}