Symbolics.jl icon indicating copy to clipboard operation
Symbolics.jl copied to clipboard

Symbolics & left + right inverses?

Open B-LIE opened this issue 1 year ago • 4 comments

I noticed that Symbolics seems to handle A*x=b via x = A\b when A and b are symbolic arrays. However, with x*A=b, x=b/A does not work, and I have to write x=b*inv(A).

Is this the way it should be, or do you plan to include the / operator in the future?

B-LIE avatar Mar 20 '23 15:03 B-LIE

Yeah we should include / in the future...

shashi avatar Mar 20 '23 19:03 shashi

Hello, I'm new to Julia and Symbolics development, but took a shot at implementing this feature here: https://github.com/aravindh-krishnamoorthy/Symbolics.jl/commit/868b93789ffbc2574127aaa13eda23c4d2040409 + https://github.com/aravindh-krishnamoorthy/Symbolics.jl/commit/9b984c396a78553cdf7f64a1e8dded6779cd8b57

Test: https://github.com/aravindh-krishnamoorthy/Symbolics.jl/commit/ecde0b85d6e232bf3a8d16545d209243f8882c64

I still don't understand a few things: (1) Why Symbolics.substitute only works with reshape(b,1,3), (2) Why the reshape trick doesn't work for M in b/M, (3) Why using complex numbers for b and M results in Julia errors. Nevertheless, the simple tests seem to pass.

aravindh-krishnamoorthy avatar Apr 17 '23 20:04 aravindh-krishnamoorthy

@aravindh-krishnamoorthy that's pretty good! :) The reshape functionality is not all there. it uses the generic ReshapedArrays if I remember correctly. I would accept a PR with these changes, and you could open more issues about the reshape and substitute issues.

shashi avatar Apr 24 '23 15:04 shashi

Thank you very much for the positive comment. The PR is #881

I will soon analyse and raise the issues for reshape and substitute.

aravindh-krishnamoorthy avatar Apr 25 '23 11:04 aravindh-krishnamoorthy