Simplify {lazy.symbolic}R Documentation

Simplify Symbolic Expressions (very primitive version)

Description

Simplify Symbolic Expressions (very primitive version)

Usage

Simplify(exp, all = 0, method = 1:9, markso = 1, debug = 0)

Arguments

exp

Expression (vector or matrix)

all

= 1 to apply Simplify repeatedly

method

How to simplify: default method is 1:4.
= 1 : varname*num -> num*varname
= 2 : processing 1s and 0s, a/a -> 1
= 3 : a-a or -a+a -> 0 or 0*func(x) -> 0
= 4 : remove parens

markso

= 0 not to mark the special opeartors

debug

= 1 to print details

Details

Very primitive version

Repeated use of this function may simplify the result further.
See the examples below where lv() returns .Last.value .
When called from remove_paren, use method=1:3.

Value

Simplified expression

Examples

Simplify("-((a)) - c/c + ((a)-(b)) + (a-b) + 0*a + 1*b - (x-y)*(((z+1)))")
Simplify(.Last.value)
Simplify("-((a)) - c + ((a)-(b)) + (a-b) - (a-b) - (x-y)/(x-y)")
Simplify(.Last.value)
Simplify("-((a)) - c + ((a)-f(b)) + (a-b) + 0/a-1*b - (x-y)*(((z+1)))")
Simplify(.Last.value)

matTimes( demomat(2,2,root="a"), demomat(2,1), simplify=0 )
Simplify(lv())

Simplify(c("1*b","1*(b)","1*f(b)"))
Simplify(lv())
Simplify(c("0*b","0*(b)","0*f(b)"))

dd <- Det(demomat(2,2,root="a"))
Simplify(Expand(dd))
Simplify(lv())


[Package lazy.symbolic version 0.1.3 Index]