Skip to main content

A state-driven physics model designed to simulate cause and effect within a physical space.

Project description

Fizicks

Project Status

Overview

This library provides a set of classes and methods to simulate physical phenomena in three-dimensional space. It includes representations for vectors, forces, positions, velocities, and the application of Newton's laws of motion.

Classes

Vector

A Vector represents a quantity in three-dimensional space with both magnitude and direction.

Initialization

Vector(x: float, y: float, z: float)
  • x: The x-coordinate of the vector.
  • y: The y-coordinate of the vector.
  • z: The z-coordinate of the vector.

Methods

  • __add__(self, other: Vector) -> Vector: Adds two vectors.
  • __sub__(self, other: Vector) -> Vector: Subtracts one vector from another.
  • __mul__(self, other: float) -> Vector: Multiplies the vector by a scalar.
  • __truediv__(self, other: float) -> Vector: Divides the vector by a scalar.
  • __eq__(self, other: Vector) -> bool: Checks if two vectors are equal.
  • __ne__(self, other: Vector) -> bool: Checks if two vectors are not equal.
  • __repr__(self) -> str: Returns a string representation of the vector.
  • __str__(self) -> str: Returns a string representation of the vector.

Force

A Force is a vector that describes the change in momentum of an object over time. Inherits from Vector.

Initialization

Force(x: float, y: float, z: float)

Position

A Position is a vector that describes the location of an object in space. Inherits from Vector.

Initialization

Position(x: float, y: float, z: float)

Velocity

A Velocity is a vector that describes the speed and direction of an object in space. Inherits from Vector.

Initialization

Velocity(x: float, y: float, z: float)

FirstLaw

Represents Newton's First Law of Motion: An object in motion will remain in motion unless acted on by an external force.

Methods

  • apply(cls, object: Any, force: Vector): Updates the velocity of the object based on the force applied.

SecondLaw

Represents Newton's Second Law of Motion: The acceleration of an object is dependent on the net force acting on the object and the object's mass.

Methods

  • apply(cls, object: Any): Updates the position of the object based on the velocity.

ThirdLaw

Represents Newton's Third Law of Motion: For every action, there is an equal and opposite reaction.

Methods

  • apply(cls, object: Any): Updates the acceleration of the object based on the velocity and mass.

Motion

The Motion class determines the motion of an object based on the sum of its forces and the net force acting on it.

Methods

  • update(cls, object: Any): Updates the object based on the forces applied and its current state.

Usage

To use this library, initialize the vectors and apply the laws of motion to simulate physical phenomena. Here is an example:

# Initialize vectors
position = Position(0.0, 0.0, 0.0)
velocity = Velocity(1.0, 1.0, 1.0)
force = Force(0.5, 0.5, 0.5)

# Create an object with these vectors
object = Any()
object.position = position
object.velocity = velocity
object.debt = [force]

# Update the motion of the object
Motion.update(object)

# Print the updated position and velocity
print(object.position)
print(object.velocity)

This example initializes a position, velocity, and force, applies the force to the object, and updates its motion according to the laws of motion defined in this library.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fizicks-0.1.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

fizicks-0.1.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file fizicks-0.1.0.tar.gz.

File metadata

  • Download URL: fizicks-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for fizicks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bc0d4f42e21dfba79c3c86e554163dc6c72ec98e4112efae978b7c14c5a2ebf0
MD5 6069b63c7f66790add6d3a933cd10ff2
BLAKE2b-256 b667ef1bddfc3dcd5e818c3f5d7c34849680d66638be6885792435793e3887d9

See more details on using hashes here.

File details

Details for the file fizicks-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fizicks-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for fizicks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 790d19f45c745dc2ebb6712b140da43d4df3e4ec08f7a06e0464d68f495cef05
MD5 9fa9ee74e666f2bf37092b7c12393dca
BLAKE2b-256 11459950d27d28b4477cfa3dbf54add10cee00551de52082159d39bd676bb9e5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page