Expand {lazy.symbolic} R Documentation

## Expand Expressions by Distributing a Multiplicative Factor

### Description

Expand Expressions by Distributing a Multiplicative Factor

### Usage

```Expand(exp, all = 0, method = 1:2, simplify = 1, verify = 1, debug = 0)
```

### Arguments

 `exp` A vector or list of symbolic expressions `all` = 1 to apply Expand repeatedly `method` = 1 to expand a*(...) = 2 to expand (...)*a `simplify` = 0 to skip the simplification of the result `verify` = 0 not to check the result by `is_valid` `debug` = 1 to print intermediate result

### Details

This function expands a single occurence of
`a*(b+c)` and `(a+b)*c`
to
`a*b+a*c` and `a*c+b*c`, resp.,
where `a` is a single multiplicative factor and `b` and `c` are additive terms.

Matrix multiplications such as %*% and %@% can be used.

Repeated use may expand it further.

### Value

Expanded expression

### Examples

```Expand(c("a*(b+c)","-a*(b+c)"))

Expand("(a+b)*(F(x)-G(y))")
Expand(.Last.value)

Expand("-a*(b-c)*(d+e)")
Expand(.Last.value)

Expand( "((+a*(b-c*d)*e+f)*g)*h - (((+a*b-c*d)*e+f)*g)*h" )
Expand(.Last.value)

Expand("-t(A)%*%(B-C)%*%D")

Expand("-inv(A)%*%(A-B)")
Expand("-inv(A)%*%(A-B)", simplify=0)

Expand("-(A-B)%*%(C-D)+E")
Expand("-(A-B)%*%(C-D)+E", all=1)

```

[Package lazy.symbolic version 0.1.3 Index]