Skip to main content

A Python 3.x package that implements and represents basic functionalities of Vectors.

Project description

vectorise

A Python package that implements and represents basic functionalities of Vectors.

It is also available on GitHub

Installation

Note :- Requires Python Version 3.x

If there are 2 or more versions of Python installed in your system (which mostly occurs in UNIX/Linux systems) then please run any one of the commands in the BASH/ZSH Shell :-

pip3 install vectorise
python3 -m pip install vectorise

If there is only Python 3.x installed in your system like in Windows systems then please run any one of commands in the Command Prompt :-

pip install vectorise
python -m pip install vectorise

Quick Guide

Please Read till the End

  • Import the Package using import vectorise as vr

  • vr.Vector creates a vector object.

    • By Default it creates a null vector.

    • It is Mutable i.e after its creation the vector object can be changed by <Vector object>.{x, y, z} = value.

  • Direction Ratios of a Vector can be retrieved by any of the following methods :-

    • <Vector object>.x returns the direction ratio on the X-axis unit vector i.

    • <Vector object>.y returns the direction ratio on the Y-axis unit vector j.

    • <Vector object>.z returns the direction ratio on the Z-axis unit vector k.

    • <Vector object>.directionRatios() returns a tuple of the direction ratios of i, j, k respectively.

  • <Vector object>.directionCosines() returns a tuple of the direction cosines of i, j, k respectively.

  • <Vector object>.directionAngles() returns a tuple of the direction angles of i, j, k respectively.

  • Magnitude of a Vector can be retrieved by any of the following methods:-

    • <Vector object>.magnitude() returns the exact magnitude of the Vector.

    • len(<Vector object>) returns the approximate magnitude of the Vector. Please Note :- This is specific to this version and the upcoming versions.

  • <Vector object>.toUnit() converts the given Vector to unit vector and returns it.

  • All the Arithmetic Operations (including Unary Negation), except Multiplication; can be done using their usual symbols.

    • <Vector object>.dot(<Vector object>) returns the Dot Product of the given 2 Vectors, which would be a Scalar i.e either an integer or a floating point number.

    • <Vector object>.cross(<Vector object>) returns the Cross Product of the given 2 Vectors, which would be another instance of Vector.

    • - <Vector object> returns a Vector which is in the opposite direction to the given Vector. Please Note :- This is specific to this version and the upcoming versions.

  • <Vector object>.makesAngleWith(<Vector object>) returns the angle between the given 2 Vectors.

  • <Vector object>.projectionOn(<Vector object>) returns the projection of the self Vector over the Vector passed in.

  • <Vector object>.projectionVectorOn(<Vector object>) returns the projection Vector of the self Vector over the Vector passed in.

Please Note :- All the Returned Angles are in DEGREES, NOT IN RADIANS; so as to make calculations and understandability effortless.

Have Fun Learning!!!

A Sample Implementation

from vectorise import Vector

v1 = Vector(-3, 4, 5)
v2 = Vector(21, -54, -101)
v3 = Vector(-3, 4, 5)

print("V1 :", v1, "\nV2 :", v2, "\nV3 :", v3)

print("\nV1 == V2 :", v1 == v2)
print("V1 == V3 :", v1 == v3)

print("\nDirection Angles of V1 :", v1.directionAngles())
print("Direction Angles of V2 :", v2.directionAngles())

print("\nDirection Ratios of V1 :", v1.directionRatios())
print("Direction Ratios of V2 :", v2.directionRatios())

print("\nDirection Cosines of V1 :", v1.directionCosines())
print("Direction Cosines of V2 :", v2.directionCosines())

print("\n|V1| :", v1.magnitude(), "\n|V2| :", v2.magnitude())

print("\nUnit Vector of V1 :", v1.toUnit(), "\nUnit Vector of V2 :", v2.toUnit())

print("\nV1 + V2 :", v1+v2)
print("V1 - V2 :", v1-v2)

print("\nV1 * 2 :", v1*2)
print("V2 * 3 :", v2*3)

print("\n-V1 :", -v1)
print("-V2 :", -v2)

print("\nV1 . V2 :",  v1.dot(v2))
print("V1 X V2 :", v1.cross(v2))
print("V2 X V1 :", v2.cross(v1))

print("\nAngle between V1 and V2 :", v1.makesAngleWith(v2))

print("\nProjection Vector of V1 on V2 :", v1.projectionVectorOn(v2))
print("Projection Vector of V2 on V1 :", v2.projectionVectorOn(v1))

print("\nProjection of V1 on V2 :", v1.projectionOn(v2))
print("Projection of V2 on V1 :", v2.projectionOn(v1))

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

vectorise-0.0.6.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

vectorise-0.0.6-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file vectorise-0.0.6.tar.gz.

File metadata

  • Download URL: vectorise-0.0.6.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.3

File hashes

Hashes for vectorise-0.0.6.tar.gz
Algorithm Hash digest
SHA256 7f21e36a7048260e746dc31ac558a954e658aba4b49854c316fba4e3737dc3de
MD5 edb71afd1c406a61db21b3ebe1150b39
BLAKE2b-256 bf0fc14bd69864bbb11974b0bb71e24370a9ae4fb4c04d2201e2563cae3c5d13

See more details on using hashes here.

File details

Details for the file vectorise-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: vectorise-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.3

File hashes

Hashes for vectorise-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 084ad2b7995348ba778260ac04d3cc268bd25c699da7ce05399b3cfee2717824
MD5 19b73c5134eac02e54006be5c6863c45
BLAKE2b-256 54124868cdd12d06c83afc9a8482a7e9dbdee00bd7b33ed45124bca07e65d070

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