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

Innocent looking expression does not simplify #285

Closed
jw3126 opened this issue Apr 21, 2021 · 3 comments
Closed

Innocent looking expression does not simplify #285

jw3126 opened this issue Apr 21, 2021 · 3 comments

Comments

@jw3126
Copy link

jw3126 commented Apr 21, 2021

The following should be zero:

using SymbolicUtils

@syms a1::Real a2::Real B12::Real B13::Real B23::Real


zero1 = a1*( B12+ 1)*a2 +
        a2*(-B12*a1 - a1)

@show zero1
@show simplify(zero1)
zero1 = a2*(-a1 - (B12*a1)) + a1*a2*(1 + B12)
simplify(zero1) = a2*(-a1 - (B12*a1)) + a1*a2*(1 + B12)
@david-pl
Copy link
Contributor

Try simplify(zero1,expand=true).

@jw3126
Copy link
Author

jw3126 commented Apr 21, 2021

Thanks @david-pl this works for me! Do you know why expand=false is the default?

@david-pl
Copy link
Contributor

Not in detail, but IIUC using expand=true can be computationally expensive so it should only be used when needed. Hence the default expand=false.

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

No branches or pull requests

3 participants