Difference between revisions of "Z^3 Deeper Features"

From ZCubes Wiki
Jump to navigation Jump to search
Line 53: Line 53:
  
 
(60n)!
 
(60n)!
 +
 +
gives
 +
 +
8320987112741390144276341183223364380754172606361245952449277696409600000000000000
 +
 +
SIN(12+34i)
  
 
gives  
 
gives  
  
8320987112741390144276341183223364380754172606361245952449277696409600000000000000
+
-156534884864787.47+246178250600375.44ⅈ

Revision as of 13:58, 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 fn.n 23f5.2
Complex Number x+yi 3+4i
Fractions x%%n/d 23%%5/2

// correct this


(60n)!

gives

8320987112741390144276341183223364380754172606361245952449277696409600000000000000

SIN(12+34i)

gives

-156534884864787.47+246178250600375.44ⅈ