Simplification

The following functions are used to simplify expressions.

Base.expandMethod.
expand(expr)

Expand expression.

Examples

julia> expand(m"(a + b)^2")
 
                                 2            2
                                b  + 2 a b + a
source
Base.factorMethod.
factor{T}(expr::T)

Factorize polynomial expression

Examples

julia> factor(:(x^2 + 2x + 1))
:((x + 1) ^ 2)

julia> factor(MExpr("a^2 - b^2"))
 
                                (a - b) (b + a)
source
Base.floatMethod.
float(expr)

Convert rational numbers into floating point numbers in expression.

Examples

julia> float(m"1/3*x")
 
                             0.3333333333333333 x
source
Maxima.demoivreMethod.
demoivre(expr)

Break exponential terms into hyperbolic and trigonometric functions. Roughly the opposite in function to exponentialize

Examples

julia> demoivre(m"exp(a + %i * b)")
 
                             a
                           %e  (%i sin(b) + cos(b))

julia> exponentialize(ans)
 
                         %i b     - %i b     %i b     - %i b
                    a  %e     + %e         %e     - %e
                  %e  (----------------- + -----------------)
                               2                   2

julia> expand(ans)
 
                                    %i b + a
                                  %e
source
exponentialize(expr)

Express expression in terms of exponents as much as possible

Examples

julia> exponentialize(m"sin(x)")
 
                                   %i x     - %i x
                             %i (%e     - %e      )
                           - ----------------------
                                       2
source
Maxima.gfactorMethod.
gfactor{T}(expr::T)

Factorize complex polynomial expression

Examples

julia> gfactor(:(z^2 + 2*im*z - 1))
:((z + im) ^ 2)
source
Maxima.imagpartMethod.
imagpart(expr)

Find the imaginary part of a complex expression.

Examples

julia> realpart(MExpr("a + %i*b"))

                            b
source
Maxima.logcontractMethod.
logcontract{T}(expr::T)

Contract logarithms in expression

source
Maxima.logexpandMethod.
logexpand{T}(expr::T)

Expand logarithm terms in an expression

source
Maxima.makefactMethod.
makefact{T}(expr::T)

Convert expression into factorial form.

source
Maxima.makegammaMethod.
makegamma{T}(expr::T)

Convert factorial to gamma functions in expression

source
Maxima.polarformMethod.
polarform(expr)

Put a complex expression into polarform

Examples

julia> polarform(m"a + %i*b")
 
                              2    2    %i atan2(b, a)
                        sqrt(b  + a ) %e
source
Maxima.radcanMethod.
radcan{T}(expr::T)

Simplify radicals in expression.

Examples

julia> radcan(:(sqrt(x/y)))
:(sqrt(x)/sqrt(y))

julia> radcan(m"sqrt(x/y)")
 
                                    sqrt(x)
                                    -------
                                    sqrt(y)
source
Maxima.ratsimpMethod.
ratsimp{T}(expr::T)

Simplify expression.

Examples

julia> ratsimp("a + b/c")
"(a*c+b)/c"

julia> ratsimp(:(sin(asin(a + b/c))))
:((a * c + b) / c)

julia> ratsimp(m"%e^log(x)")
 
                                       x
source
Maxima.realpartMethod.
realpart(expr)

Find the real part of a complex expression

Examples

julia> realpart(MExpr("a + %i*b"))

                            a
source
Maxima.rectformMethod.
rectform(expr)

Put complex expression in rectangular form

Examples

julia> rectform(:(R*e^(im*θ)))
:(R * im * sin(θ) + R * cos(θ))

source
Maxima.substMethod.
subst(a, b, expr)

Replace a with b in expr.

Examples

julia> subst(:b, :a, :(a^2 + b^2))
:(2 * b ^ 2)
source
Maxima.trigexpandMethod.
trigexpand(expr)

Expand out trig functions in expression

source
Maxima.trigratMethod.
trigrat(expr)

Convert expression into a canonical trigonometric form

Examples

julia> trigrat(:(exp(im*x) + exp(-im*x)))
:(2 * cos(x))
source
Maxima.trigreduceMethod.
trigreduce(expr)

Contract trigonometric functions

source
Maxima.trigsimpMethod.
trigsimp{T}(expr::T)

Simplify trigonometric expression

Examples

julia> trigsimp(m"sin(x)^2 + cos(x)^2")
 
                                       1
source