Difference between revisions of "Z^3 Deeper Features"

From ZCubes Wiki
Jump to navigation Jump to search
Line 42: Line 42:
 
| BigInt || n|| (60n)!
 
| BigInt || n|| (60n)!
 
|-
 
|-
| Floating Point|| fn.n || 23f5.2
+
| Floating Point|| dn || SQRT(2d300)
 
|-
 
|-
 
| Complex Number || x+yi || 3+4i
 
| Complex Number || x+yi || 3+4i
 
|-
 
|-
| Fractions|| x%%n/d || 23%%5/2
+
| Fractions|| x.n%%nd || 1.4%%3 gives 2 1/3
 
|}
 
|}
  
Line 63: Line 63:
  
 
-156534884864787.47+246178250600375.44ⅈ
 
-156534884864787.47+246178250600375.44ⅈ
 +
 +
SQRT(2d300)
 +
 +
gives
 +
 +
1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147010955997160597027453459686201472851741864088919860955232923048430871432145083976260362799525140799

Revision as of 14:21, 5 January 2024

Function Composition

Functions can be composed using the @ operator. A chain of functions can also be composed using the same technique. Composed function works left to right.

a=(x=>x/3)@(x=>x+2);
a(3)

gives 3.

First 3 is divided by 3, and then 2 is added to yield 3 as result.

a=(x=>x+2)@(x=>x/3);
a(3)

gives 1.6666666666666667

a=(SIN@COS@TAN);
a(45)

gives 0.7749904090605793


Computation with Large Numbers, Decimals of Arbitrary Length, Fractions, Complex Numbers, etc.

Often the accuracy provided by the usual computational language is insufficient to handle more complex computations as well as type specific computations.

The following notations are used to indicate advanced numerical types in Z.

Advanced Types
Type Notation Example
BigInt n (60n)!
Floating Point dn SQRT(2d300)
Complex Number x+yi 3+4i
Fractions x.n%%nd 1.4%%3 gives 2 1/3

// correct this


(60n)!

gives

8320987112741390144276341183223364380754172606361245952449277696409600000000000000

SIN(12+34i)

gives

-156534884864787.47+246178250600375.44ⅈ

SQRT(2d300)

gives

1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147010955997160597027453459686201472851741864088919860955232923048430871432145083976260362799525140799