Solve: Solve and Display Solutions for Systems of Linear...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/Solve.R

Description

Solve the equation system Ax = b, given the coefficient matrix A and right-hand side vector b, using link{gaussianElimination}. Display the solutions using showEqn.

Usage

1
Solve(A, b, verbose = FALSE, simplify = TRUE, fractions = FALSE, ...)

Arguments

A,

the matrix of coefficients of a system of linear equations

b,

the vector of constants on the right hand side of the equations

verbose,

logical; show the steps of the Gaussian elimination algorithm?

simplify

logical; try to simplify the equations?

fractions

logical; express numbers as rational fractions?

...,

arguments to be passed to link{gaussianElimination} and showEqn

Value

the function is used primarily for its side effect of printing the solution in a readable form, but it invisibly returns the solution as a character vector

Author(s)

John Fox

See Also

gaussianElimination, showEqn

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  A1 <- matrix(c(2, 1, -1,
               -3, -1, 2,
               -2,  1, 2), 3, 3, byrow=TRUE)
  b1 <- c(8, -11, -3)
  Solve(A1, b1) # unique solution
  
  A2 <- matrix(1:9, 3, 3)
  b2 <- 1:3
  Solve(A2,  b2, fractions=TRUE) # underdetermined
  
  b3 <- c(1, 2, 4)
  Solve(A2, b3, fractions=TRUE) # overdetermined

matlib documentation built on May 30, 2017, 1:49 a.m.