Z3Help

From ZCubes Wiki
Jump to navigation Jump to search

Introduction

Why another programming language? Don’t we have enough of them? Well, let us try this real world experiment. Go to the best programmer you know. Pick the simplest formula you can think of: E=mc2. Ask how the Energy (E) can be calculated, for a mass (m) of 1kg, 2kg, 3kg,… 10kg and for a constant Speed of Light (3x10^8m/s). Let us just watch the programmer for what happens next. Yes, go ahead and start a stop watch! It is likely that the programmer would pull up a spreadsheet, and type formulae notations into the document such as on the right, and within a minute or so, give you the answers.

C =3*10^8
2 7
M
1 =D5*$E$3^2
=D5+1 =D6*$E$3^2
=D6+1 =D7*$E$3^2
=D12+1 =D13*$E$3^2
=D13+1 =D14*$E$3^2

Or maybe, the programmer would make a program, in some computer language to do this, and will come back to you in about an hour! Today, an ordinary computer can do billions of operations per second! And even with the best techniques, translating from our human language to ZCubes, Inc. 2 computer language takes minutes or hours even for the simplest of equations! This clearly shows the biggest problem with the current state of the art computer human interaction. That is why we created a simple language for you and the machine called:

z^3

The vision behind the z^3 language is specifically to make human interaction with computers convenient, simple and elegant, at any level of complexity, all immersed in a framework of immense power.

What is Z3

z^3 is a general purpose language that is easy to write and natural to read, powered by high performance, scalable, computing constructs which unlimits thinking and expression. z^3 console is launched from ZCubes platform on any HTML5 enabled browser.

FIGURE 1 - FRACTAL PATTERN GENERATED BY USING Z^3.

In the following sections of the document, z^3 specifics will be described in easy to follow examples.

ZCubes Platform

ZCubes is a platform for users to create and manipulate information. The website address is http://www.zcubes.com. To load the application simply click on the Z icon, or directly visit it at http://www.zcubes.com/zspace/zcubes.aspx. z^3 console is launched by clicking the icon on the bottom right of the ZCubes platform. Please refer to Appendix 1 for operators, symbols and notations used in ZOS.

Being an omni-functional platform, ZCubes allows creation of documents with unparalleled power, with almost any imaginable functionality provided at your finger tips. Upon load, the ZCubes Platform looks as below with a simple minimal interface: Menu items can be accessed by clicking the Z button.

The ZOS Console to interact with z^3 can be accessed using the command console button at the extreme right bottom. Commands can now be typed into the Enter ZOS Command area as indicated below.

Entering command like 1..10@SIN and pressing enter gives you the result in the window.

ZCubes Selected Features

ZCubes is a 3D platform, which changes its nature based on the user's perspective.

For example, it can function as a blackboard in one moment, and a presentation tool in another moment, or a spreadsheet in yet another moment.

The platform changes like a chameleon based on the attributes users wish to have anytime. More details on how to work with ZCubes is explained in section 8.

Data Collections

An array is a simple data structure to create, collect and manage data. z^3 transforms conventional arrays into something much more powerful called Sets.

Sets

Sets are new data types used in z^3. These are arrays (not necessarily rectangular) that are flexible in size, shape, types and contents, which make them extremely powerful. The term set is italicized throughout the document for easy identification. The following are notable properties of Sets, compared to conventional arrays:  Sets are unstructured arrays, or varied sizes and types.  Sets may contain other Sets of any complexity.  Sets are enhanced with several member functions1 in z^3. 1 A listing of these are given in Section 8.e Appendix V Member Functions. For example, sets can be printed out with the built-in member function print(), to get the internal representation in z^3. Set-based z^3 resolves complexity and scaling issues, while achieving high-performance, extreme flexibility or natural expressiveness.

Set - Simply a collection of data

Let us start with a simple example. At the ZOS Console, right after the command prompt indicated by $>, enter the command 1..3. Let us use the member function .print() to display the set representation in z^3. 1. $> 1..3 .print() [1,2,3] The “two dots” operator used in 1..3 creates a simple set, with 3 integer elements (1 at index 0, 2 at index 1, and 3 at index 2 positions). Sets have indexes starting at 0, which is a common practice in C-like languages. Once a set is created, various operations can be performed on it. As you shall see later, the results of many of these operations are also sets, which mean we can continuously apply these operations until desired results are achieved. ZCubes, Inc. 10 An interesting point to note is that the set 1..3 can be implicitly declared without any extra word or punctuations unlike most languages2. It is also important to see the use of .. operator as a technique to create a sequenced collection of number values (from lower end 1 to upper end 3 - in this case as a range). To create a set filled with a series, the [ ] operator is not required. Hence, whenever we use [ ] array operator along with .. operator, it indicates a set of set(s). This is effectively a set with index 0 containing three elements (this inside element being similar to the array in Example 1).

Set- Object Representation

Set – Complex Set Layouts

Matrix – as a Set of Set(s)

Matrix Operator(||)

Set input functions

|| Binary Operation

Member functions of set

Applied To Operator

Combinatorial Arguments

Applying Combinatorial Set to Set of Functions

Simple Function Representations

Easy Multi-Line Representation of z^3 Code

Using || as "Such That" Boolean Expressions

Associative Set/Composite Set As Objects

<<< Member Assignment Operator

Global Assignments using <<<

Functions

Set of Functions

Simple Reusable Function Declarations

Combinatorial Arguments

Set $, $$, $$$ and $_ Member Functions

Set Functions and Set Programming

Advanced computation of lists

Series computation

Built-in Functions in z^3

Permutations and Combinations

Common Number Series

Simple Number Stats

Set Operations

z^3 Simple Examples

Sets and Related Structures

Matrices

Matrix Generation
Hilbert Matrix
Hermitian Matrix
Hankel Matrix

Toeplitz matrix

Hadamard Matrix

Vandermonde Matrix

Upper and Lower-Triangular matrix and Symmetric matrix 70

Pascal Matrix

Matrix Sizes

Matrix Operations

Matrix Arithmetic Operations

Vector Operations

Matrix Determinants

Matrix Rotations

Simple Matrix Merging with Functions

Across Matrices Merging with Functions

Quick Multiplication Tables

Puzzles and Other Interesting Computations

Magic Square

N-Queens Puzzle

Birthday Probability

Towers Of Hanoi

Floyds Triangle

Fractals-Mandelbrot

Lissajous

Graphing Data curve

Financial Functions

Statistical Functions:

Appendices

Appendix I Operators

Appendix II: Simple Set and Objects

Set

Associative Set/Objects

Appendix III: Javascript and z^3

Using Set Member Functions

Appendix IV Series Generation

Arithmetic Series

Geometric Series

Prepacked Series

Date Series

Alphabet Series

Appendix V Member Functions

How to work with zcubes