System Function DC: Difference between revisions

From NARS2000
Jump to navigationJump to search
 
(One intermediate revision by the same user not shown)
Line 23: Line 23:
|converts the coefficients of <apll>R</apll> to the datatype indicated by <apll>L</apll>.}}
|converts the coefficients of <apll>R</apll> to the datatype indicated by <apll>L</apll>.}}
{{BoxLine|<apll>R</apll> is a numeric array.}}
{{BoxLine|<apll>R</apll> is a numeric array.}}
{{BoxLine|<apll>L</apll> is a character scalar or one-element vector datatype (<apll>'I'</apll>, <apll>'F'</apll>, <apll>'R'</apll>, or <apll>'V'</apll>) indicating the datatype to which the coefficients should be converted.}}
{{BoxLine|If <apll>L</apll> is a character scalar or one-element vector whose value is one of (<apll>'I'</apll>, <apll>'F'</apll>, <apll>'R'</apll>, or <apll>'V'</apll>), this value indicates the datatype to which the coefficients of <apll>R</apll> should be converted.}}
{{BoxLine|If <apll>L</apll> is a numeric scalar or one-element vector, then its datatype is the datatype to which the coefficients of <apll>R</apll> should be converted.}}
{{BoxEnd|<apll>Z</apll> is <apll>R</apll> where all of the coefficients of each of the values are converted to the datatype indicated by <apll>L</apll>.
{{BoxEnd|<apll>Z</apll> is <apll>R</apll> where all of the coefficients of each of the values are converted to the datatype indicated by <apll>L</apll>.
The shape of <apll>Z</apll> is the same as that of <apll>R</apll>.}}
The shape of <apll>Z</apll> is the same as that of <apll>R</apll>.}}
Line 30: Line 31:
For example,
For example,


<apll>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'R' ⎕DC 1.5<hc>i</hc>3
<apll>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'R' ⎕DC 1.5<_i/>3
3<pn>r</pn>2<hc>i</hc>3
3<_r/>2<_i/>3
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'R' ⎕DC 1.1<hc>i</hc>3
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'R' ⎕DC 1.1<_i/>3
2476979795053773<pn>r</pn>2251799813685248<hc>i</hc>3
2476979795053773<_r/>2251799813685248<_i/>3
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'F' ⎕DC 3<pn>r</pn>2 2476979795053773<pn>r</pn>2251799813685248
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'F' ⎕DC 3<_r/>2 2476979795053773<_r/>2251799813685248
1.5 1.1</apll>
1.5 1.1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0 ⎕DR ⎕←0<_x/> ⎕DC 2<_i/>1
2<_i/>1
Complex Rational (1416):  arbitrary precision numerator and denominator
</apll>
<br/>
<br/>
{{SFDM|DC}}
{{SFDM|DC}}

Latest revision as of 09:49, 9 November 2023

This function is available in both monadic and dyadic forms.

Monadic Function

Z←⎕DC R converts R between the coefficients of a Hypercomplex number and the corresponding Hypercomplex number.
R is a numeric array.
  • For simple numeric (a.k.a. Hypercomplex 1-dimensional — BOOL, INT, APA, FLOAT, RAT, or VFP) R, where the number of columns of R (call that NC) is 1, 2, 4, or 8, Z is the corresponding Hypercomplex array whose Hypercomplex dimension is the same as the number of columns of R, and whose shape is ¯1↓⍴R. That is, the values in the last coordinate of R are treated as the coefficients of a Hypercomplex number and Z is the corresponding Hypercomplex number. This capability has been replaced by the Condense function (<R).
  • For Hypercomplex 2-, 4-, or 8-dimensional R, Z is the corresponding simple array (INT, FLOAT, RAT, or VFP) with a new coordinate on the right consisting of the coefficients of the Hypercomplex numbers in R, and whose shape is (⍴R),NC. That is, Z contains the coefficients of the Hypercomplex number R. This capability has been replaced by the Dilate function (>R).



For example,

      ⎕←a←⎕DC 4 2⍴1 0 ¯1 0 0 1 0 ¯1
1 ¯1 0i1 0i¯1      ⍝  The four units for Complex numbers 
      ⎕DC a 
 1  0 
¯1  0 
 0  1 
 0 ¯1

Dyadic Function

Z←L ⎕DC R converts the coefficients of R to the datatype indicated by L.
R is a numeric array.
If L is a character scalar or one-element vector whose value is one of ('I', 'F', 'R', or 'V'), this value indicates the datatype to which the coefficients of R should be converted.
If L is a numeric scalar or one-element vector, then its datatype is the datatype to which the coefficients of R should be converted.
Z is R where all of the coefficients of each of the values are converted to the datatype indicated by L. The shape of Z is the same as that of R.


For example,

      'R' ⎕DC 1.5i3 3r2i3       'R' ⎕DC 1.1i3 2476979795053773r2251799813685248i3       'F' ⎕DC 3r2 2476979795053773r2251799813685248 1.5 1.1       0 ⎕DR ⎕←0x ⎕DC 2i1 2i1 Complex Rational (1416): arbitrary precision numerator and denominator

Note: ⎕DC is available as both a monadic and dyadic form system function, you cannot assign a value to it.

System Variables (A value may be assigned to these except for ⎕DM)
ALX CT DM DT ELX FC FEATURE FPC IC IO
LR LX PP PR PW RL SA WSID
Niladic System Functions (a value cannot be assigned to these)
A AV EM ET LC NNAMES NNUMS SI SYSID SYSVER
T TC TCBEL TCBS TCESC TCFF TCHT TCLF TCNL TCNUL
TS WA
Monadic or dyadic system functions (a value cannot be assigned to these)
AT CR DC DFT DL DR EA EC ERROR ES
EX FMT FX MF NAPPEND NC NCREATE NERASE NINFO NL
NLOCK NREAD NRENAME NREPLACE NRESIZE NSIZE NTIE NUNTIE STOP TF
TRACE UCS VR
Note that quad functions and variables (except for the ⎕A family of functions) are case insensitive


See Also
System Commands System Variables and Functions Operators


Keyboard
Alt+Shift
Alt ¨ ¯ < > × ÷
Shift ~ ! @ # $ % ^ & * ( ) _ +
Key ` 1 2 3 4 5 6 7 8 9 0 - =
Alt+Shift
Alt ? § π
Shift Q W E R T Y U I O P { } |
Key q w e r t y u i o p [ ] \
Alt+Shift
Alt
Shift A S D F G H J K L : "
Key a s d f g h j k l ; '
Alt+Shift χ
Alt
Shift Z X C V B N M < > ?
Key z x c v b n m , . /
NARS 2000 Lang
Tool
Bar
+ - × ÷ * ! ? |
< = >
~ § π .. ,
/ \ ¨ .
_ ¯
Second Row i j k i j k l g p r v x