Description Usage Arguments Value Author(s) Examples

View source: R/gaussian-elimination.R

`gaussianElimination`

demonstrates the algorithm of row reduction used for solving
systems of linear equations of the form *A x = B*. Optional arguments `verbose`

and `fractions`

may be used to see how the algorithm works.

Print method for enhancedMatrix objects

1 2 3 4 5 |

`A` |
coefficient matrix |

`B` |
right-hand side vector or matrix. If |

`tol` |
tolerance for checking for 0 pivot |

`verbose` |
logical; if |

`latex` |
logical; if |

`fractions` |
logical; if |

`x` |
matrix to print |

`...` |
arguments to pass down |

If `B`

is absent, returns the reduced row-echelon form of `A`

.
If `B`

is present, returns the reduced row-echelon form of `A`

, with the
same operations applied to `B`

.

John Fox

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
A <- matrix(c(2, 1, -1,
-3, -1, 2,
-2, 1, 2), 3, 3, byrow=TRUE)
b <- c(8, -11, -3)
gaussianElimination(A, b)
gaussianElimination(A, b, verbose=TRUE, fractions=TRUE)
gaussianElimination(A, b, verbose=TRUE, fractions=TRUE, latex=TRUE)
# determine whether matrix is solvable
gaussianElimination(A, numeric(3))
# find inverse matrix by elimination: A = I -> A^-1 A = A^-1 I -> I = A^-1
gaussianElimination(A, diag(3))
inv(A)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.