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

safe_unwrap does not work on Complex{Num} #20

Open
aplund opened this issue Nov 3, 2023 · 1 comment
Open

safe_unwrap does not work on Complex{Num} #20

aplund opened this issue Nov 3, 2023 · 1 comment

Comments

@aplund
Copy link

aplund commented Nov 3, 2023

The safe_unwrap function leaves complex defined variables wraped. This can lead to breakages if the terms are assumed to be unwraped. (e.g. the use of operation in the chain_flatten_array_variables function). Below is a simple test.

using Symbolics
using PDEBase

@variables r c::Complex

println(typeof(r))
println(typeof(PDEBase.safe_unwrap(r)))
println()
println(typeof(c))
println(typeof(PDEBase.safe_unwrap(c)))

The output I get is

Num
SymbolicUtils.BasicSymbolic{Real}

Complex{Num}
Complex{Num}

The unwrap function in Symbolics returns a ComplexTerm.

@aplund
Copy link
Author

aplund commented Nov 9, 2023

It would seem that safe_unwrap is mostly unnecessary. The current implementation of unwrap applies a catch-all method which is just the identity, the same as what happens with safe_unwrap.

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