Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to expand an expression? #17

Open
GiggleLiu opened this issue Mar 20, 2019 · 1 comment
Open

How to expand an expression? #17

GiggleLiu opened this issue Mar 20, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@GiggleLiu
Copy link

GiggleLiu commented Mar 20, 2019

Great tool!

I wonder how to expand the following expression as 4 * x + 2 * y?

julia> @sym x y;
julia> ex = x+x+2(y+x)
(2 * x + y) * 2

Also, is it possible to simplify the following expression as max(x, y)?

julia> max(max(x, y),x)
max(max(x, y), x)

Or where can I start to add support to these expression simplification rules? An minimum example would be enough, thanks.

@GiggleLiu GiggleLiu changed the title How to expand expression? How to expand an expression? Mar 20, 2019
@MasonProtter MasonProtter added the enhancement New feature or request label Mar 20, 2019
@MasonProtter
Copy link
Owner

Hello, thanks for taking an interest!

Your first question would probably require a function like the Expand function in Mathematica which expands all products and positive integer exponents. We could call it expand or something.

Your second question requires a new simplification rule for max. If you want to try your hand at this, I'd stick the rule in the file simplification.jl and then you just have to add it somewhere in this list here: https://github.com/MasonProtter/Symbolics.jl/blob/master/src/Simplification.jl#L88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants