Skip to content

Need control of simplify #132

@klaff

Description

@klaff
julia> @variables a b c
(a, b, c)

julia> par(x,y) = 1/(1/x+1/y)
par (generic function with 1 method)

julia> ex1 = par(a, par(b,c))
(a^-1 + ((b^-1 + c^-1)^-1)^-1)^-1

julia> simplify(ex1)
(a^-1 + b^-1 + c^-1)^-1

julia> par2(x,y) = x*y/(x+y)
par2 (generic function with 1 method)

julia> ex2 = par2(a, par2(b, c))
a*b*c*((a + b*c*((b + c)^-1))^-1)*((b + c)^-1)

julia> simplify(ex2)
a*b*c*((a + b*c*((b + c)^-1))^-1)*((b + c)^-1)

ex1 and ex2 can be simplified to the same expression but do not.

Also, it seems that a faster version might be ex3 = a*b*c/(a*b+a*c+b*c), so it would be nice to be able to control or direct the simplification process.

This exploration was done in consideration of more complicated expressions representing circuit impedances by phasor representation, in which for example the impedance of an inductor would be represented by im*2π*f*L. The par and par2 are two forms of the same formula for computing impedances in parallel.

┆Issue is synchronized with this Trello card by Unito

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions