Vectors

Vectors is a Ruby gem that provides essential functions for vector arithmetic and geometric computations. It includes methods for calculating determinants, scalar products, and cross products, making it a handy tool for projects that require linear algebra operations.

Installation

Installation via Git: Add this line to your application's Gemfile:

gem 'Vectors', git: 'https://github.com/inaidE/projectAVOCADOS'

Then run: bundle install

Installation via RubyGems: Install the gem and add to the application's Gemfile by executing:

bundle add Vectors

If bundler is not being used to manage dependencies, install the gem by executing:

gem install Vectors

Usage

Determinant Calculation

Determinant(matrix)

input: matrix - Array of arrays size of nxn

output: res[Int] - simple Integer

matrix = [ [1, 2], [3, 4] ]

result = Vectors.Determinant(matrix)

puts result # Output: -2

Scalar Product

scalar_prod(a, b)

input: a[Array], b[Array]- vectors a and b

output: res[Int] - simple Integer as a result of scalar prod

a = [1, 2, 3]

b = [4, 5, 6]

result = Vectors.scalar_prod(a, b)

puts result # Output: 32

Cross Product

cross_prod(a, b)

input: a[Array], b[Array] - vectors a and b with dimension n = 3;

output: res[Array] - vector with the size = 3 (its dimension) as a result of cross prod

a = [1, 2, 3]

b = [4, 5, 6]

result = Vectors.cross_prod(a, b)

puts result.inspect # Output: [-3, 6, -3]

Help function

help()

output: String with info about gem funcs

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/inaidE/projectAVOCADOS.

License

The gem is available as open source under the terms of the MIT License.