Package: vectogebra
vectogebra v 0.0.10 - 29 May 2022Python module for vector algebraeasy 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 functionaleasy to usesupports nearly all vector operationsbeginner friendlyphysics friendlyOpen for modifications🌠 Installpipinstall--upgradevectogebra⭐ Start by importing the vector classimportvectogebra.vectorasvectORfromvectogebraimportvectorasvect⭐ Also import useful utility functionsimportvectogebra.utitliesasvutORfromvectogebraimportutilitiesasvut⭐ import functions for geometry applications :fromvectogebraimportgeometryasgeoORimportvectogebra.geometryasgeo🧾 Description of the modulethis module currently have two components : one isvectogebra.vector, which is the vector class (boject) defination. it contains the basic functionality.
the second component,vectogebra.utilitiescontains useful functions that are defined for the above mentioned vector class like, function to find angle between
two vectors, etc.Create a vector object :importvectogebra.vectorasvectv1=vect(1,2,3)🔢 Algebric operations :1. Additionconsider two(or more) vectors : a,b,...
their sum will be given by :s = a + b + ...sumswill also be a vector object.2. SubtractionVectors can be subtracted using the minus (-) operator.example :s = a - b + c - d + ...resultantswill also be a vector object.3. Dot product / scalar product and scalar multiplicationthe*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*vORv*5is same as "scalar 5 multiplied to vector v".4. Cross product / vector multiplicationthe^operator (XOR operator) will be used for cross product, or vector product.example :p = a^bis same as "p equals a cross b".5. division by a scalarsimply divide a vector by a scalar.
NOTE : division by zero or division vector is not supported.example :p = v / 5is same as "p equals v divided by 5".❌✔️ Logical operations :1. Equalitya == breturnes True when a and b are equal in magnitude and direction. else, it returns False2. Inequalitya != bhave its usual meaning3. grater / lesserthemagnitudeof the vectors can be compared using common logical operators.# a and b are vectorsa>ba<ba>=ba<=bAttributes of the vector objectComponentsfor a vector v1,v1.xORv1.iv1.yORv1.jv1.zORv1.kMagnitudev1.magnitudeORv1.modMagnitude squared (useful when precesion is required)v1.magnitude_squaredORv1.mod_squaredTypev1.typedifferent fromtype(v1)🚀 Vectogebra's Utitlies (vut)important utility functions for the vector object.import:importvectogebra.utilitiesasvutS. no.functionReturn value1.vut.angle(v1,v2)angle between v1 and v2.vut.dot(v1,v2)dot product (or scalar product) of vectors v1 and v23.vut.cross(v1,v2)cross product (or vector product) of v1 and v24.vut.magnitude(v1)magnitude of v1 and v25.vut.is_perpendicular(v1,v2)True when v1 isperpendicularto v2 else it returns False6.vut.is_parallel(v1,v2)True whe v1 is parallel to ve else False7.vut.scalar_component_parallel(v1,v2)Magnitudeofcomponentof v1parallelto v28.vut.scalar_component_perpendicular(v1,v2)Magnitudeofcomponentof v1perpendicularto v29.vut.vector_component_parallel(v1,v2)Vectorcomponentof v1parallelto v210.vut.vector_component_perpendicular(v1,v2)Vectorcompoment of v1 perpendicular to v211.vut.unit_vector(v)ORvut.direction(v)Returns theunit vectorparallel to v12.vut.dot(v1,v2)dotproduct13.vut.cross(v1,v2)crossproduct14.vut.parallelogram_area(v1,v2)parallelogram's area formed by joining v1 and v2 tail to tail15.vut.box(a,b,c)Box product or scalar triple product16.vut.collinear(a,b,c)returns True if a,b,c are collinear⭐Conversions17.vut.vector_to_list(v)a list of the components of v18.vut.vector_to_dict(v)a dictionary of the components of v19.vut.vector_to_tuple(v)a tuple of the components of v20.vut.list_to_vector(l)a vector object from a list of components21.vut.dict_to_vector(d)a vector object from a dictionary of components22.vut.tuple_to_vector(t)a vector object from a tuple of components23.vut.proportional(v1, v2)Trueif two vectors are proportional, otherwise :False(more to come)📈 Geometry related functions :consider vectorsa,bandc:S. no.functionReturn value⚠ Warning📃 Special instructions1.divider(a,b,m,n)a position vector of a point that divides the line segment joiningaandbby in the ratiom:n.atleast one ofmornmust be non-zero2.distance(a,b)distance betweenaandb3.area_line(a,b)signed area under the line segment joiningaandb.x-y plane only (or area under projection of line on x-y plane)4.area_polygon(*args)Signed area of polygon whose vertices are given as inputx-y plane only (or projection on x-y plane)if vertices listed in cyclic manner the area will be +ve else -ve.5.area_triangle(a, b, c)Area of triangle with verticesa,b, andc6.coplanar(*args)True: If all the points are coplanar elseFalseArguments must beposition vectors.Keep in mind the difference between avectorand aposition vectorUseful classes for 3-Dimentional Geometryline :represents a line in a 3D spaceconstruction of a line :Two - point formtwo points (positions vectors) or list/tuple/dict/string-representation of coordinates must be given to the constructorexamples :importvectogebra.vectorasvectimportvectogebra.geometryasgeoline1=geo.line(vect(5,8,9),vect(1,6,3))line2=geo.line((5,8,9),(1,6,3))# can replace tuples whit lists.line3=geo.line('5 8 9','1 6 3')# dict of components can also be used.Point-direction form :one point on the line, and the direction vector can be used to define a line :line1=geo.line(p=(1,5,3),d=(5,2,8))# instead of thuples, list, or string 'x y z' or vectogebra's vector can also be used.Attributes :for direction :dordirordirectionfor point :porptorpointclass line have many useful functions defined. check them in the source code. they will be listed here later.plane :Methods of defining a planeby a point and a normal vector :plane(point=(x,y,z),normal=(a,b,c))vector object or list of componens can also be used instead of tuples.instead ofpoint,porptcan also be used.instead ofnormal,nornormcan also be used.by three points :plane((x1,y1,z1),(x2,y2,z2),(x3,y3,z3))vectorvectogebra.vector(x,y,z)object or lists of components[x,y,z]can also be used instead of tuples.Attributes :position vector of the point on the plane :porptorpointnormal vector of the plane :nornormalAuthor: Mohammad MaasirLicense: MITdate-created: 8th of May, 2022PyPi :https://pypi.org/project/vectogebra/Copyright © 2022 Mohammad Maasir