solutionSpace: returns the solution space (basis and translation vector) for...

View source: R/solutionSpace.r

solutionSpaceR Documentation

returns the solution space (basis and translation vector) for an equation system

Description

returns the solution space (basis and translation vector) for an equation system

Usage

solutionSpace(A, b)

Arguments

A

numeric matrix

b

numeric vector

Details

For a linear equationsystem, Ax = b, the solution space then is

x = A^* b + (I - A^* A) y

where A^* is the Moore-Penrose pseudoinverse of A. The QR decomposition of I - A^* A determines the dimension of and basis of the solution space.

Value

basis

matrix containing the basis of the solution space

translate

translation vector

Examples

A <- matrix(rnorm(21),3,7)
b <- c(1,2,3)
subspace <- solutionSpace(A,b)
dims <- ncol(subspace$basis) # we now have a 4D solution space
## now pick any vector from this space. E.g
y <- 1:dims
solution <- subspace$basis%*%y+subspace$translate # this is one solution for the equation above
A%*%solution ## pretty close

Morpho documentation built on June 22, 2024, 7:19 p.m.