# Differences

This shows you the differences between two versions of the page.

Both sides previous revision Previous revision Next revision | Previous revision | ||

manual:chapter3:complex [2017/06/17 15:05] smartin [Entering complex numbers] |
manual:chapter3:complex [2019/10/07 16:09] (current) jojo1973 [Commands for complex numbers] Updated output of C→R |
||
---|---|---|---|

Line 9: | Line 9: | ||

''5 3 R→C'' | ''5 3 R→C'' | ||

- | The inverse command to break down a complex number is ''C→R'' ((Note, however, that this command does not remove the complex number from the stack, as occurs in the 50g stock ROM.)). The real or imaginary parts of a complex number can be returned using the commands ''RE'' or ''IM'', respectively. Converting from rectangular to polar representation can be done using the command ''→POLAR''. The inverse conversion, polar to rectangular, is done using the command ''→RECT''. It is also possible to enter complex numbers in different bases, although commands and operations between complex numbers will always return the result in base 10. For example, to enter the above example in base 2: | + | The inverse command to break down a complex number is ''C→R''. The real or imaginary parts of a complex number can be returned using the commands ''RE'' or ''IM'', respectively. Converting from rectangular to polar representation can be done using the command ''→POLAR''. The inverse conversion, polar to rectangular, is done using the command ''→RECT''. It is also possible to enter complex numbers in different bases, although commands and operations between complex numbers will always return the result in base 10. For example, to enter the above example in base 2: |

''#101b #11b R→C'' | ''#101b #11b R→C'' | ||

Line 15: | Line 15: | ||

leads to ''(#101b,#11b)'' on the stack, but taking the complex conjugate (''CONJ'') results in ''(5,-3)''. | leads to ''(#101b,#11b)'' on the stack, but taking the complex conjugate (''CONJ'') results in ''(5,-3)''. | ||

- | System flag -103 formally sets the calculator mode to complex: ''-103 SF''. | + | System flag -103 formally sets the calculator mode to complex: ''-103 SF''. This is important to ensure all input to functions return complex results. For example, without setting flag -103, taking the square root of -1 results an an error (Argument outside domain). Whereas in complex mode, the square root of -1 returns the correct result ''(0,1)''. |

Line 25: | Line 25: | ||

The following table summarizes commands applicable to complex numbers, $z=x+iy=re^{i\theta}$. | The following table summarizes commands applicable to complex numbers, $z=x+iy=re^{i\theta}$. | ||

- | | Command | Purpose | Example | | + | | Command | Purpose | Example ($\theta$ in degrees) | |

- | | ''C→R'' | Break down complex number to two reals | ''(5,3) C→R'' yields ''(5,3)'' ''5'' ''3''| | + | | ''C→R'' | Break down complex number to two reals | ''(5,3) C→R'' yields ''5'' ''3''| |

| ''R→C'' | Combine two numbers to a complex | ''5 3 R→C'' yields ''(5,3)''| | | ''R→C'' | Combine two numbers to a complex | ''5 3 R→C'' yields ''(5,3)''| | ||

| ''IM'' | Imaginary part of a complex number | ''(5,3) IM'' yields ''3'' | | | ''IM'' | Imaginary part of a complex number | ''(5,3) IM'' yields ''3'' | |