Behavior of absolute value, under, and complex numbers #261
                  
                    
                      Omnikar
                    
                  
                
                  started this conversation in
                Language Development
              
            Replies: 2 comments
-
| Fixed in  | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
| It will work with  | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There is an intuitive behavior of using
⌵ absolute valueand⍜ undertogether on a real number; that is, applying the function given tounderto the positive version of the number, but then leaving it with its original sign. I think the sensible analogue of this for complex numbers would be to maintain the direction of the original complex number, while scaling it to fit the new magnitude outputted by the function given tounder. Whatever the case, however, the current behavior of combiningunder,absolute value, and complex numbers is certainly nonsensical.For example, pass
∘ identityas the second function to⍜ under:This code will output
5+¯5ito the stack. As demonstrated,⍜⌵∘maintains the sign of each component of the complex number, but replaces both components with the magnitude of the original number.Beta Was this translation helpful? Give feedback.
All reactions