Skip to main content

A small example package

Project description

vectogebra

Python module for vector algebra

easy to use vector algebra library for python, that lets ypu work with vectors in an efficient way. apart from core vector object, many other vector operations are supported. these can be imported from vectogebra.utilities.

this library was made by keeping its applications in Physics in mind (Mechanics, Optics, etc.)

  • does not depend on any external libraries except math library.
  • fully functional
  • easy to use
  • supports nearly all vector operations
  • beginner friendly
  • physics friendly
  • Open for modifications

Author: Mohammad Maasir

License: MIT

date-created: 8th of May, 2022


Install

pip install vectogebra

Start by importing the vector class

import vectogebra.vector as vect

Import useful utility functions

import vectogebra.utitlies as utils


Description of the module

Create a vector object :

v1 = vect(1,2,3)


Algebric operations :

1. Addition

consider two(or more) vectors : a,b,... their sum will be given by : s = a + b + ... sum s will also be a vector object.

2. Subctraction

Vectors can be subtracted using the minus (-) operator.

example :

s = a - b + c - d + ...

resultant s will also be a vector object.

3. Dot product / scalar product and scalar multiplication

the * operator will be used for dot product, or multiplication by a scalar.

example :

p = a * b * c * d * ... is same as "a dot b dot c dot ...".

p = 5*v is same as "scalar 5 multiplied to vector v".

4. Cross product / vector multiplication

the ^ operator will be used for cross product, or vector product.

example :

p = a^b is same as "p equals a cross b".

5. division by a scalar

simply divide a vector by a scalar. NOTE : division by zero or division vector is not supported.

example :

p = v / 5 is same as "p equals v divided by 5".


Logical operations :


1. Equality

a==b returnes True when a and b are equal in magnitude and direction. else, it returns False


Attributes of the vector object


Components

  1. v1.x OR vi.i
  2. v1.y OR vi.j
  3. v1.z OR vi.k

Magnitude

  1. v1.magnitude OR vi.mod

Type

  1. v1.type ==different from type(v1)==

Utitlies


1. utils.angle(v1,v2)

2. utils.dot(v1,v2)

3. utils.cross(v1,v2)

4. utils.magnitude(v1)

5. utils.unit(v1)

6. utils.is_perpendicular(v1,v2)

7. utils.is_parallel(v1,v2)

8. utils.scalar_component_parallel(v1,v2)

9. utils.scalar_component_perpendicular(v1,v2)

10. utils.vector_component_parallel(v1,v2)

11. utils.vector_component_perpendicular(v1,v2)

12. utils.unit_vector(v) OR utils.direction(v) ==Returns the unit vector parallel to v==

13. utils.dot(v1,v2) ==dot product==

14. utils.cross(v1,v2) ==cross product==

15. utils.parallelogram_area(v1,v2) ==returns parallelogram area formed vy joining v1 and v2 tail to tail==

16. utils.box(a,b,c) ==Box product==

17. utils.collinear(a,b,c) ==returns true if a,b,c are collinear==

18. utils.vector_to_list(v) ==returns a list of the components of v==

19. utils.vector_to_dict(v) ==returns a dictionary of the components of v==

20. utils.vector_to_tuple(v) ==returns a tuple of the components of v==


Copyright (c) 2022 Mohammad Maasir

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

vectogebra-0.0.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

vectogebra-0.0.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file vectogebra-0.0.1.tar.gz.

File metadata

  • Download URL: vectogebra-0.0.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for vectogebra-0.0.1.tar.gz
Algorithm Hash digest
SHA256 29cc686a0e4a7122bcc93d6f09279ca99eca65392f9957045e8c5e5c323138bb
MD5 8f9dd196054f0c1d5e4265a128d5cb00
BLAKE2b-256 b4003662664362d07d9296f2d8707d5a7cc3afd38564f610487e1e62eec94379

See more details on using hashes here.

File details

Details for the file vectogebra-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: vectogebra-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for vectogebra-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b05474d9c3869545995b7cc0b306a0840da4b8f2e5e61e5ebd1692ec3fad1bcd
MD5 931be2a63e9bf485c90a92b7f7a2a0b8
BLAKE2b-256 08d4e390252f3851bd5d667fdb404d7bda8f29397931321ae45c74bc20468283

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