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

Simplify() doesn't work for solution to linear system #1203

Open
zhiyaooooo opened this issue Aug 1, 2024 · 0 comments
Open

Simplify() doesn't work for solution to linear system #1203

zhiyaooooo opened this issue Aug 1, 2024 · 0 comments

Comments

@zhiyaooooo
Copy link

Hello, I want to generate symbolic solution to a 4d linear system. But when I simplify sol[1], it takes an hour and eventually results in a "DivideError: integer division error". This is unexpected because sol[2], sol[3] and sol[4] are simplified in several seconds. All four solutions should have a similar form.

Here is a minimal example:

using Symbolics
A = Symbolics.@variables(A[1:4, 1:4])[1] |> Symbolics.scalarize
b = Symbolics.@variables(b[1:4])[1] |> Symbolics.scalarize
sol = -(A \ b)
Symbolics.simplify(sol[4])
Symbolics.simplify(sol[3])
Symbolics.simplify(sol[2])
Symbolics.simplify(sol[1]) # takes an hour and returns an error

The reason I want to simplify the solution is that 'sol' returns 'NaN' for some values of 'A' and 'b', but the numerical solution '-A\b' can be computed correctly. Simplifying the solution resolves this problem.

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

1 participant