Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying system of linear equation in a curly bracket (R-markdown) using "cases"

How can I automatically display a string like for example this:

zad<-"2x+5y-2z+2p=9; 3x-2y+1z-3p=34; -3x+3y+2z+4p=33; 2x+3y+4z+5p=125"

as a set of linear equations in a curly bracket (in R-markdown)? Something like in the picture, but it should automatically work after we make changes in the zad string: lin_eq

like image 378
Kamil Avatar asked Jan 29 '23 15:01

Kamil


1 Answers

We can define the equation as an expression in a code junk, then in latex code we can refer to it:

---
title: "Untitled"
author: "you"
date: "19 Februar 2018"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

```{r equation}
eq <-  noquote(paste(expression("2x+5y-2z+2p=9\\\\3x-2y+1z-3p=34\\\\-3x+3y+2z+4p=33\\\\2x+3y+4z+5p=125")))
```

$$
\begin{cases} `r eq` \end{cases}
$$

enter image description here

like image 113
jay.sf Avatar answered Jan 31 '23 09:01

jay.sf