gauss_jordan 1.0.1 copy "gauss_jordan: ^1.0.1" to clipboard
gauss_jordan: ^1.0.1 copied to clipboard

outdated

A simple package for finding Gaussian-Jordan style elimination of matrices.

Gauss Jordan #

A simple package for finding Gaussian-Jordan style elimination of matrices.

Takes in a matrix and returns the Reduced Row Echelon Form. This package has no dependencies and only contains one simple method.

Example #

 List<List<double>> matrix = [
                               [3.0, 0.0, -1.0, 0.0, 0.0],
                               [8.0, 0.0, 0.0, -2.0, 0.0],
                               [0.0, 2.0, -2.0, -1.0, 0.0]
                               ];
   print(GaussJordan.solve(matrix).toString());

prints

[[1.0, 0.0, 0.0, -0.25, 0.0], [0.0, 1.0, 0.0, -1.25, 0.0], [0.0, 0.0, 1.0, -0.75, 0.0]]

Full Example #

import "package:gauss_jordan/gauss_jordan.dart";
import 'dart:io';


main(List<String> arguments) {

  print("Enter matrix rows:");
  int rowSize = int.parse(stdin.readLineSync());
  List<List<double>> matrix = List<List<double>>();
  String input = "";
  
  /*Formats input into List<List<double>>
    Example input: 
    2 (matrix rows)
    2.0 0.0 -1.0 0.0
    0.0 2.0 -1.0 0.0
  */ 
  for(int i = 0; i < rowSize; i++){
    String input = stdin.readLineSync();
    List<String> rowString = input.split(" ");
    List<double> rows =  List<double>();
    rowString.forEach((r){
      rows.add(double.parse(r));
    });
    matrix.add(rows);

  }

  List<List<double>> rref = GaussJordan.solve(matrix);
  print(rref.toString());

}

Installation #

Add GaussJordan as a dependency to your dart project.

dependencies:
  gauss_jordan: 1.0.1

and at the top of your dart file add:

import 'package:gauss_jordan/gauss_jordan.dart';

I apologize for any spaghetti code

1
likes
0
pub points
19%
popularity

Publisher

unverified uploader

A simple package for finding Gaussian-Jordan style elimination of matrices.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on gauss_jordan