Difference between revisions of "Z3 Language Tests"

From ZCubes Wiki
Jump to navigation Jump to search
Line 387: Line 387:
  
 
vary...
 
vary...
 +
 +
=Program Code in Any Language=
 
 
 
Θ=3+x;
 
Θ=3+x;
Line 396: Line 398:
 
അത(4)
 
അത(4)
  
+
=Z3 and JS=
 +
 
 +
The can be intermixed, and it works beautifully. There are very few things you need to think about mixing syntax.
 +
 
 
/*Enter Code Here in Z3/Javascript...*/
 
/*Enter Code Here in Z3/Javascript...*/
  

Revision as of 15:53, 30 March 2016

Here are test cases to try out on ZCubes Code Cubes. Please note that all of the below follow the Z3 Language (Enhanced from Javascript), and hence apart from being simple, it gives you full programming capability.


Simple Matrix Creation

a=[1 2; 3]

a=[[1,2],[3]]

a=[1 2; 3 4]

a=[1 20; 2 3]

a=[[1, 20],[2, 3]]

a=[[1, 20],[2, [3 4]]];

a=[[1, 20],[2, [3; 4]]];

a=[[1, 20],[2, [3; 4;]]]; // worked with after 4 nothing was taken. Is that something to change later? with a null?

a=[1 20; 2;[3,4]; 3]

a=[1, (a+b); 2;[3,4]; 3]

a=[1*(a+b); 2;[3,4]; 3]

a=[1*(a+b); 2;[3,4+34]; 3];


Matrix Operators

|a|;

|10|;

a=|44|

b=34

Object Initialization

a=[3,4,2..20]

a={"car":a}

Creating Multi-Dimensional Matrices of Required Sizes

a=|4x3x3|

Matrix Operators

a=|3||*||4|

a=|5x5|

a=|5|

|10x3|

a=a|x+3|b;

a=|5||+||5|

a=|5||\||5| //for INTDIV

a=|5||/\||5| //for DIVPARTS

a=|5||%||5| //for MATRIXMOD

a=|3||CHIDIST||4| // should we make this CHIDIST with MOP? Could decide later for MATRIXOPS

1..100@"x^2"


Combanatorial Arguments and Implicit Looping

CHIDIST(1..100,2..3) .graph(1,0)


[Other]

[1..2,1..4,1..20]@"x^3+y^2+z^3"

FOR 20..30 "det(MAGICSQUARE(x))";

a=FOR 1..100 SIN;

a= FOR 20..30 "det(MAGICSQUARE(x))";


var a=FOR 20..30 "det(MAGICSQUARE(x))";

var a=FOR 20..30 "det(MAGICSQUARE(x))",b=FOR 1..100 COS;

radpiby3

a=SIN(radpiby3)

1..100.fillwith(1..10)

(1..100).fillwith(1..10)

(1..100..10).fillwith(1..10)

1..100.fillwith(10..100).$(CIRCLE)

1..100 .fillwith(10..100).$(CIRCLE)

1..100..130.fillwith(10..100).$(CIRCLE)

SIN@1..100@COS

SIN@1..100

1..100@COS

1..100..10@COS

1..100..10.fillwith(10..100).$(CIRCLE)

1..100.23..1023.1 .fillwith(10..1020).$(CIRCLE)

1..100..10.fillwith(1..10)

FOR 20..30 "det(MAGICSQUARE(x))";

FOR 20..30 "det(MAGICSQUARE(x))";

FOR 20..30 "det(MAGICSQUARE(x))";

1...100.0343..103.fillwith(1..10)


a=[1 (a+b); 2;[3,4]; 3]

Javascript Code & Z3

function z() { if(a<3) { return(false); } }

function () { if(a<3) { return(false) } }

A=(|3x4|@4.3)@SIN

|4|.$i([SUM,SIN,COS]);

|4|.$i(SUM,SIN,COS)

[["cats1","dogs1"],"birds"]<<<[[2,[COS]],[SIN]]

[["cats1","dogs1"],"birds"]<<<<[[2,[COS]],[SIN]]

[["cats1","dogs1"],"birds"]>>>>[[2,[COS]],[SIN]]

Series Comprehension

[#a-z,#A-Z,1..10,4..500]

a=#a-z

a=#1/1/16

var a=#;

b=#;

c=#;

d=#;

PMT(#1/1/2011,#2/2012) // worked

var a=#a-x;

b=#1/1/2011;

a = a < 34 ? 3

Range Referencing

#TABLE3!A3:E6

a=#TABLE3!A3:E6

a=#A3:E6

a=SIN(#D8:E11,#H11:K12)

#TABLE3!A3:E6

a=#TABLE3!A3:E6

a=#A3:E6

#D8:E11

#TABLE3!A3:E6

[1,2,undefined,#].$(SIN)

a=[#1/1/2011,#2/2/2015]

[1,2,undefined].$(SIN)

[1,2,undefined,#].$(SIN)

v:=u+a*t

E=m*c^2;

Simple, Beautiful Notations

a=5!;

b=5%;

a=(a+x)!;

a=(a+x)*!34;

a=(5!)!

a=5!! will not work.

a=34!P!3

a=34!C!3

a=34!P!3!C!3

var a=2;

v:=u+a*t;

var b=3;

var a=2;

var v:=u+a*t;

var b=3;


var a=2;

var v:=u+a*t;

var b=3;

var a=2;

var v:=u+a*t,d=34;

var b=3;

var a=#a-x,d=#1/1/2011;

# means undefined by itself.

ad := a+b

1..3**3.$d (SIN)

(1..3**3).$d (SIN)

PRODUCT(n..1..-3)

a=#,b=#,c=#

FACTTRIPLE=PRODUCT(n..1..-3)

FACTTRIPLE:=PRODUCT(n..1..-3)

Conditional Matrix Projection

1..10|x<4|

1..10|x?x<4|

1..10|x?x<4:u|

1..10|x?x<4:u|1..10

1..10|x?u+x<4:u|1..10


|4||x?x<4:false||34| ;

|4||x?x<4||34|;

|4||x?x<4||34| ;

|4||x?x<4:34+y+z||34|;

|4||x?x<4|;

|4||x<4|;

|1||x<4||x>10|


1..10|x<4&&y>9|2..20

a=3!

a=100..|x+y|3

..100

10..

1..10|x<4|

1..10|x<4|34

1..10|x^3&&x^3<3000?x|w


0..10@"SIN(x^2,1..10)" .graph()

0..10@("SIN(x^2,1..10)" .graph())

0..10@"SIN(x^2,1..23..10)".graph(30).sin()

0..10@"SIN(x^2,1..23..10)".graph(30).sin()

1..1000..100@["x^2",COS] .graph()

0..10@"SIN(x^2,1..10)" .graph()

0..10@("SIN(x^2,1..10)" .graph())

0..10@"SIN(x^2,1..23..10)".graph(30).sin()

0..10@"SIN(x^2,1..23..10)".graph(30).sin()

0..10@"SIN(x^2,1..10)" .graph()

SIN(x^2,1..10)


1..3**3.$d (SIN)

(1..3**3).$d (SIN)


(1..1000..100@["x^2",COS] .$(SIN)) @SIN

0..10@"SIN(x^2)" .graph()

0..10@"SIN(x^2)".graph()

1..10|x<4|34

1..10|(x?x<4)|

var a=FOR 20..30 "det(MAGICSQUARE(x))", b=FOR 1..100 COS;


a=[1*(a+b); 2;[3,4+34]; 3]

|a| |10|

a=[1*(a+b); 2;[3,4+34]; 3]; |a|; |10|

PMT(100000,44%,40)

a=FOR(PMT, 100000,41% ,1..12)


pmt12:=PMT(x,y,12);

PMT(1000,26%)

vary...

Program Code in Any Language

Θ=3+x;

Θ(34)

അത:=34+അതx;

അത(4)

Z3 and JS

The can be intermixed, and it works beautifully. There are very few things you need to think about mixing syntax.

/*Enter Code Here in Z3/Javascript...*/

var a=10;

for(var b=1;b<a;b++)

{

console.log(b)

}


/*Enter Code Here in Z3/Javascript...*/

function test()

{

var a=25;

c=[]

for(var b=1;b<a;b++)

{

c.push(b)

}

return(c);

}

test()