A simple complex vector package.
Project description
Cvectors
Cvectors is a Python package for 2D vectors. It provides a class,
Vector, which uses complex internally.
Usage is as follows:
>>> from cvectors import Vector
>>> foo = Vector(4, 3)
>>> foo
Vector(4.0, 3.0)
>>> foo.x
4.0
>>> foo.y
3.0
>>> foo.r
5.0
>>> bar = Vector(4, 5)
>>> foo + bar
Vector(8.0, 8.0)
>>> foo.dot(bar)
31.0
>>> import math
>>> foo.rotate(math.pi / 2)
Vector(-2.9999999999999996, 4.0)
>>> Vector.from_polar(r=3, theta=5) - Vector.from_polar(r=5, theta=2)
Vector(2.9317207391253906, -7.423259958117824)
>>> Vector(5, 6).perp_dot(Vector(-6, 1))
41.0
>>> abs(foo)
5.0
>>> Vector(1, -9).rec()
(1.0, -9.0)
>>> Vector(1, -9).pol()
(9.055385138137417, -1.460139105621001)
>>> Vector(3, 2).perp()
Vector(-2.0, 3.0)
>>> Vector(3.142, 2.718).round()
(3, 3)
>>> Vector(3.142, 2.718).round(1)
(3.1, 2.7)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cvectors-9.1.2.tar.gz
(18.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
cvectors-9.1.2-py3-none-any.whl
(15.5 kB
view details)
File details
Details for the file cvectors-9.1.2.tar.gz.
File metadata
- Download URL: cvectors-9.1.2.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7ddbd0294b704b32ead7a4e37c5071065f90e214aafc2c3868d5f365ed1dc09
|
|
| MD5 |
0b4bafca299a2fcfad869c60edd1e241
|
|
| BLAKE2b-256 |
dd267701949d33d29014ac24ecb4d980947ed82e25e24999c5c582e9dfa9287f
|
File details
Details for the file cvectors-9.1.2-py3-none-any.whl.
File metadata
- Download URL: cvectors-9.1.2-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5e2f01d9bf6e334d4db7684228dd38b0f43d10f72bcec8fdcea2215f397f309
|
|
| MD5 |
6c20aeced14d3b40750a7dfa6476a38d
|
|
| BLAKE2b-256 |
f9135ad0b59174de6fa3ea1fdd80c03bd2edbb13a53475311a074aa3c0df9fef
|