updated arg, re, im, conj, sign (now working also with Lists and Units)#1666
Closed
mipa83 wants to merge 1 commit intoc3d:stablefrom
Closed
updated arg, re, im, conj, sign (now working also with Lists and Units)#1666mipa83 wants to merge 1 commit intoc3d:stablefrom
mipa83 wants to merge 1 commit intoc3d:stablefrom
Conversation
Owner
|
Thanks @mipa83. As a general rule, changing the style locally is not a good idea.
|
c3d
added a commit
that referenced
this pull request
Apr 2, 2026
Implementing the kind of cases identified in PR #1666. Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Owner
|
Thanks a lot @mipa83. I've used your test cases but I implemented the changes using a slightly different approach that takes advantage of existing DB48x infrastructure a bit more efficiently. Closing this PR for now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposal - functions work also with units, lists, vectors, matrix:
{ 230∡0° V 230∡120° V 230∡-120° V } re --> { 230 V -115 V -115 V }
{ 230∡0° V 230∡120° V 230∡-120° V } im --> { 0 V 199.18584 287 V -199.18584 287 V }
{ 230∡0° V 230∡120° V 230∡-120° V } arg --> { 0 ° 120 ° -120 ° }
{ 230∡0° V 230∡120° V 230∡-120° V } abs --> { 230 V 230 V 230 V }
{ 230∡0° V 230∡120° V 230∡-120° V } conj --> { 230∡0° V 230∡-120° V 230∡120° V }
{ 1+2ⅈ V 3+4ⅈ V -5+6ⅈ V -7-8ⅈ V } re --> { 1 V 3 V -5 V -7 V }
{ 1+2ⅈ V 3+4ⅈ V -5+6ⅈ V -7-8ⅈ V } im --> { 2 V 4 V 6 V -8 V }
{ 1+2ⅈ V 3+4ⅈ V -5+6ⅈ V -7-8ⅈ V } arg --> { 63.4349 ° 53.1301 ° 129.8056 ° -131.1859 ° }
{ 1+2ⅈ V 3+4ⅈ V -5+6ⅈ V -7-8ⅈ V } abs --> { 2.2361 V 5.0000 V 7.8102 V 10.6301 V }
{ 1+2ⅈ V 3+4ⅈ V -5+6ⅈ V -7-8ⅈ V } conj --> { 1-2ⅈ V 3-4ⅈ V -5-6ⅈ V -7+8ⅈ V }
[ 230∡0° V 230∡120° V 230∡-120° V ] re --> [ 230 V -115 V -115 V ]
[ 230∡0° V 230∡120° V 230∡-120° V ] im --> [ 0 V 199.18584 287 V -199.18584 287 V ]
[ 230∡0° V 230∡120° V 230∡-120° V ] arg --> [ 0 ° 120 ° -120 ° ]
[ 230∡0° V 230∡120° V 230∡-120° V ] abs --> 0.0000 V
[ 230∡0° V 230∡120° V 230∡-120° V ] conj --> [ 230∡0° V 230∡-120° V 230∡120° V ]
[ 1+2ⅈ V 3+4ⅈ V -5+6ⅈ V -7-8ⅈ V ] re --> [ 1 V 3 V -5 V -7 V ]
[ 1+2ⅈ V 3+4ⅈ V -5+6ⅈ V -7-8ⅈ V ] im --> [ 2 V 4 V 6 V -8 V ]
[ 1+2ⅈ V 3+4ⅈ V -5+6ⅈ V -7-8ⅈ V ] arg --> [ 63.4349 ° 53.1301 ° 129.8056 ° -131.1859 ° ]
[ 1+2ⅈ V 3+4ⅈ V -5+6ⅈ V -7-8ⅈ V ] abs --> 5.0856+7.8653ⅈ V
[ 1+2ⅈ V 3+4ⅈ V -5+6ⅈ V -7-8ⅈ V ] conj --> [ 1-2ⅈ V 3-4ⅈ V -5-6ⅈ V -7+8ⅈ V ]
[[ 1+2ⅈ V 3+4ⅈ V][ -5+6ⅈ V -7-8ⅈ V ]] re --> [[ 1 V 3 V ] [ -5 V -7 V ]]
[[ 1+2ⅈ V 3+4ⅈ V][ -5+6ⅈ V -7-8ⅈ V ]] im --> [[ 2 V 4 V ] [ 6 V -8 V ]]
[[ 1+2ⅈ V 3+4ⅈ V][ -5+6ⅈ V -7-8ⅈ V ]] arg --> [[ 63.4349 ° 53.1301 ° ] [ 129.8056 ° -131.1859 ° ]]
[[ 1+2ⅈ V 3+4ⅈ V][ -5+6ⅈ V -7-8ⅈ V ]] abs --> 5.0856+7.8653ⅈ V
[[ 1+2ⅈ V 3+4ⅈ V][ -5+6ⅈ V -7-8ⅈ V ]] conj --> [[ 1-2ⅈ V 3-4ⅈ V ] [ -5-6ⅈ V -7+8ⅈ V ]]
The bolded text shows the inconsistance of abs for vectors and matrixes.
Just a proposal form my side: split/introduce a new function:
https://en.wikipedia.org/wiki/Matrix_norm
https://www.mathworks.com/help/symbolic/sym.norm.html
The propsed functions are programmed with switch-case.
Is it preferable to code the proposed functions with switch-case rather than if(should_be_symbolic(xt))?