Simplification
The following functions are used to simplify expressions.
Base.float
— Function.float(expr)
Convert rational numbers into floating point numbers in expression.
Examples
julia> float(m"1/3*x")
0.3333333333333333 x
Maxima.demoivre
— Function.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
Maxima.expand
— Function.expand(expr)
Expand expression.
Examples
julia> expand(m"(a + b)^2")
2 2
b + 2 a b + a
Maxima.exponentialize
— Function.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
Maxima.factor
— Function.factor(expr::T) where 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)
Maxima.gfactor
— Function.gfactor(expr::T) where T
Factorize complex polynomial expression
Examples
julia> gfactor(:(z^2 + 2*im*z - 1))
:((z + im) ^ 2)
Maxima.imagpart
— Function.imagpart(expr)
Find the imaginary part of a complex expression.
Examples
julia> realpart(MExpr("a + %i*b"))
b
Maxima.logcontract
— Function.logcontract(expr::T) where T
Contract logarithms in expression
Maxima.logexpand
— Function.logexpand(expr::T) where T
Expand logarithm terms in an expression
Maxima.makefact
— Function.makefact(expr::T) where T
Convert expression into factorial form.
Maxima.makegamma
— Function.makegamma(expr::T) where T
Convert factorial to gamma functions in expression
Maxima.polarform
— Function.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
Maxima.radcan
— Function.radcan(expr::T) where 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)
Maxima.ratsimp
— Function.ratsimp(expr::T) where 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
Maxima.realpart
— Function.realpart(expr)
Find the real part of a complex expression
Examples
julia> realpart(MExpr("a + %i*b"))
a
Maxima.rectform
— Function.rectform(expr)
Put complex expression in rectangular form
Examples
julia> rectform(:(R*e^(im*θ)))
:(R * im * sin(θ) + R * cos(θ))
Maxima.subst
— Function.subst(a, b, expr)
Replace a
with b
in expr
.
Examples
julia> subst(:b, :a, :(a^2 + b^2))
:(2 * b ^ 2)
Maxima.trigexpand
— Function.trigexpand(expr)
Expand out trig functions in expression
Maxima.trigrat
— Function.trigrat(expr)
Convert expression into a canonical trigonometric form
Examples
julia> trigrat(:(exp(im*x) + exp(-im*x)))
:(2 * cos(x))
Maxima.trigreduce
— Function.trigreduce(expr)
Contract trigonometric functions
Maxima.trigsimp
— Function.trigsimp(expr::T) where T
Simplify trigonometric expression
Examples
julia> trigsimp(m"sin(x)^2 + cos(x)^2")
1