Skip to content

Commit

Permalink
fix import in matrix2latex
Browse files Browse the repository at this point in the history
  • Loading branch information
friendly committed Aug 4, 2024
1 parent 101a49d commit 3d53ab4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions R/matrix2latex.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#' @param ... additional arguments passed to \code{xtable::xtableMatharray()}
#' @importFrom xtable xtableMatharray
#' @importFrom dplyr case_when
#' @importFrom utils capture.output
#' @author Phil Chalmers
#' @export
#' @examples
Expand Down
7 changes: 6 additions & 1 deletion man/symbolicMatrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions vignettes/linear-equations.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ all.equal( R(A), R(cbind(A,b)) ) # consistent?
```
You can see this in the result of reducing $\mathbf{A} | \mathbf{b}$ to echelon form, where the
last row indicates the inconsistency.
```{r}
```{r echelon}
echelon(A, b)
```
`Solve()` shows this more explicitly:
Expand All @@ -116,15 +116,15 @@ Solve(A, b, fractions=TRUE)


An approximate solution is sometimes available using a generalized inverse.
```{r}
```{r ginv}
x <- MASS::ginv(A) %*% b
x
```


Plot the equations. You can see that each pair of equations has a solution,
but all three do not have a common, consistent solution.
```{r}
```{r plotEqn4}
par(mar=c(4,4,0,0)+.1)
plotEqn(A,b, xlim=c(-2, 4))
points(x[1], x[2], pch=15)
Expand All @@ -139,7 +139,7 @@ have a unique solution if all planes intersect in a point.

### Three consistent equations

```{r}
```{r three-eqn}
A <- matrix(c(2, 1, -1,
-3, -1, 2,
-2, 1, 2), 3, 3, byrow=TRUE)
Expand Down Expand Up @@ -171,7 +171,7 @@ echelon(A, b, verbose=TRUE, fractions=TRUE)

Plot them. `plotEqn3d` uses `rgl` for 3D graphics. If you rotate the figure, you'll see an orientation
where all three planes intersect at the solution point, $\mathbf{x} = (2, 3, -1)$
```{r plotEqn1, webgl=TRUE}
```{r plotEqn3, webgl=TRUE}
plotEqn3d(A,b, xlim=c(0,4), ylim=c(0,4))
```

Expand Down

0 comments on commit 3d53ab4

Please sign in to comment.