Difference between revisions of "Z3 Language Tests"

From ZCubes Wiki
Jump to navigation Jump to search
Line 438: Line 438:
  
 
test()
 
test()
 +
 +
 +
=More Commands and Programs to try=
 +
 +
test:=x!;
 +
 +
test(3);
 +
 +
// NEW
 +
 +
1..67..4@[SIN,COS] .graphin()
 +
 +
1..(160%19)@SIN
 +
 +
a=radpiby3;
 +
 +
c=a@SIN;
 +
 +
c.graphin()
 +
 +
//check
 +
 +
 +
deg222by3
 +
 +
rad2piby3
 +
 +
a=radpiby3 |*| 2
 +
 +
rad2piby3
 +
 +
radpiby3 |*| 2
 +
 +
a=radpiby3 |*| 3
 +
 +
 +
 +
//http://www.tribology-abc.com/calculators/default.htm
 +
//drag-drop calculate.
 +
 +
LOAD("loans")
 +
 +
LOAN(10000,12%,12)
 +
 +
LOAN(10000,12%3, 0)
 +
 +
 +
LOAD("loans")
 +
 +
LOAN(10000,12%,12).PAYMENTS()
 +
 +
 +
LOAD("countries")
 +
 +
COUNTRY(3..23)
 +
 +
LOAD("elements")
 +
 +
ELEMENT(3..23)
 +
 +
THINK "Jaipur"
 +
 +
 +
|10|.fillwith(10..1000) |*| 20
 +
 +
|4|.fillwith(34..200..3).$("2*x^3")
 +
 +
 +
a=radpiby4 |*| 28
 +
 +
a=|5||++||6|
 +
 +
CAL(6..11,2012)
 +
 +
 +
 +
["sunny"]<<<[[1..10]]
 +
 +
SIN(sunny)
 +
 +
 +
morethanthree:=u>3
 +
 +
1..10@morethanthree
 +
 +
 +
1..10|++|2..20
 +
 +
 +
mary=[SIN,COS,TAN]
 +
 +
1..10@mary
 +
 +
["divya"]<<<["SIN(x)+COS(x)+x^2"]
 +
 +
1..10@divya
 +
 +
 +
 +
["sunny","sneha"]<<<[[1..100],[500..1000]]
 +
 +
sunny
 +
 +
sneha
 +
 +
 +
 +
c=1..35@SIN .graphin()
 +
 +
d=1..100;
 +
 +
 +
[49,31,#].$(z^2)
 +
 +
vs.
 +
 +
[49,31,#].$("z^2")
 +
 +
 +
 +
a=#TABLE1!B1:B1*46
 +
 +
a=#TABLE1!B1*46 // has issues.
 +
 +
a=#TABLE1!B1:B1*462
 +
 +
a=#TABLE1!B1*462
 +
 +
a=(#1/1/2012-2/1/2012).length
 +
 +
|4|.fillwith(34..200..3).$("2*x^3")
 +
 +
 +
 +
 +
a=2..9|*|TRANSPOSE(2..9)
 +
 +
 +
 +
(2..3)~ for transpose.
 +
 +
a=2..9|*|(2..9)~; //for transpose.
 +
 +
((2..3)~)*34
 +
 +
(2..3)*~34
 +
 +
//~ for transpose.
 +
 +
 +
a=|3|
 +
 +
a~;
 +
 +
 +
 +
a=(#TABLE1!B1)~*46
 +
 +
 +
 +
 +
/* Showing intermediate output */
 +
 +
a=1..100;
 +
 +
OUTPUT(a);
 +
 +
 +
 +
a=1..25;
 +
 +
OUTPUT(a);
 +
 +
 +
b=SUM(a);
 +
 +
 +
[a,b]
 +
 +
 +
 +
Obi:=z^3;
 +
 +
d=FOR Obi 1..431;
 +
 +
SUM(d)
 +
 +
 +
 +
c8:=u+a*t
 +
 +
c8
 +
 +
 +
 +
SET(#TABLE1!B2:D5,1100);
 +
 +
// sets into calci such values
 +
 +
SET(#TABLE1!B2:D5,1..100);
 +
 +
 +
 +
 +
1..1100.chunks(3) did not parse.
 +
 +
SET(#TABLE1!B2:D5,54..100.chunks(2));
 +
 +
SET(#TABLE1!B2:D5,54..100.chunks(2)~);
 +
 +
 +
 +
 +
1..100.fillwith(1..10)
 +
 +
 +
1..1100.chunks(3)
 +
 +
 +
 +
2Space!zcontrol2
 +
 +
FOR "SUM(1..x)" 1...1000000000...100
 +
 +
 +
 +
b=|4|
 +
 +
b.fillwith(1..123);
 +
 +
SIN(1..34)
 +
 +
a=1..20;
 +
 +
a.fillwith(2..3);
 +
 +
 +
 +
 +
d=13;
 +
 +
SUM(d..10..-1)
 +
 +
 +
 +
b=1..100;
 +
 +
function Jay(x)
 +
 +
{
 +
 +
return(x+34)
 +
 +
}
 +
 +
1..100@Jay
 +
 +
 +
 +
a:=π*r^2;
 +
 +
 +
a=|3|;
 +
 +
α:=π*r^2;
 +
 +
α(39);
 +
 +
 +
 +
 +
Σ(1..100);
 +
 +
 +
r=1..100@"π*r^2";
 +
 +
 +
θ=1..5;
 +
 +
SIN(θ);
 +
 +
 +
 +
ctrl+g type greek name or unicode code and select and press ctrl+g to get the conversion into code.
 +
ctrl+u for uppercase greek etc.
 +
ctrl+space for hints.
 +
 +
 +
 +
sigma select ctrl+u gets Σ and then Σ(1..100).
 +
 +
 +
 +
മോോ=1..100;
 +
 +
ഐങ=2|*|മോോ
 +
 +
 +
 +
a="🍏🍎";
 +
 +
function x(n){return(REPEATCHAR(a,n))}
 +
 +
1..100@x
 +
 +
 +
 +
success="🍤";
 +
 +
1..100.map(()=>success);
 +
 +
 +
 +
ഒട്ടക൦=34;
 +
 +
ഒട്ടക൦=44+ഒട്ടക൦;
 +
 +
 +
 +
Yurttas:=SIN(c..30)
 +
 +
Yurttas(28)
 +
 +
 +
 +
(1..1000..100@["x^2",COS] .$(SIN))@SIN
 +
 +
 +
fx:=SERIESSTR("x*3*_x+",1..x).join("")
 +
 +
1..10@fx
 +
 +
 +
 +
 +
a=|3|;
 +
 +
(a).rotate(45)
 +
 +
 +
 +
function das(x)
 +
 +
{
 +
 +
var adi=3;
 +
 +
return(adi+x)
 +
 +
}
 +
 +
das(4);
 +
 +
 +
 +
function fact(x)
 +
 +
{
 +
 +
return(x<1?1:fact(x-1)*x)
 +
 +
}
 +
 +
fact(19)
 +
 +
 +
 +
তণ=0;
 +
 +
FOR 1..(তণ+4) SIN;
 +
 +
 +
 +
 +
v:=u+a*t;
 +
 +
ARRAYFY(v);
 +
 +
v(1..10,2..3,10..12);
 +
 +
 +
 +
//think of why this is not accurate.
 +
 +
// the matrix comes in incorrectly.
 +
 +
// Seems like it needs v:=u+a[0][0]*t;
 +
 +
 +
 +
v:=u[0]+a*t;
 +
 +
ARRAYFY(v,[0]);
 +
 +
v(1..10,2..3,10..12);
 +
 +
 +
 +
 +
BOTTOMN([[1,2],[3,4],[4,5]],1..2)
 +
 +
TOPN([[1,2],[3,4],[4,5]],1..2)
 +
 +
 +
 +
 +
VLOOKUP(5, [1..10]~, 1,TRUE)
 +
 +
// note ! is required to make it into a 2-D array. Any other tricks we could suggest?
 +
 +
VLOOKUP(21..26,|5|.fillwith(11..50), 1..5,FALSE)
 +
 +
 +
 +
 +
(1..10~)
 +
 +
(1..10)~ // this makes a 2D array to be more accurate.
 +
 +
(1..10)
 +
 +
 +
 +
 +
 +
VLOOKUP(21..26,|5|.fillwith(11..50), 1..5,FALSE)
 +
 +
 +
function x1(x){return(x+34)};x1(304)
 +
 +
 +
 +
 +
todo
 +
 +
 +
a=|4 2 3|
 +
 +
 +
// had issue with VariableExpression.
 +
 +
 +
// when do we var nowmark=Z3SetBookmark(); // when do we unset this?
 +
 +
SELECT * FROM A

Revision as of 11:39, 6 April 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()


More Commands and Programs to try

test:=x!;

test(3);

// NEW

1..67..4@[SIN,COS] .graphin()

1..(160%19)@SIN

a=radpiby3;

c=a@SIN;

c.graphin()

//check


deg222by3

rad2piby3

a=radpiby3 |*| 2

rad2piby3

radpiby3 |*| 2

a=radpiby3 |*| 3


//http://www.tribology-abc.com/calculators/default.htm //drag-drop calculate.

LOAD("loans")

LOAN(10000,12%,12)

LOAN(10000,12%3, 0)


LOAD("loans")

LOAN(10000,12%,12).PAYMENTS()


LOAD("countries")

COUNTRY(3..23)

LOAD("elements")

ELEMENT(3..23)

THINK "Jaipur"


|10|.fillwith(10..1000) |*| 20

|4|.fillwith(34..200..3).$("2*x^3")


a=radpiby4 |*| 28

a=|5||++||6|

CAL(6..11,2012)


["sunny"]<<<1..10

SIN(sunny)


morethanthree:=u>3

1..10@morethanthree


1..10|++|2..20


mary=[SIN,COS,TAN]

1..10@mary

["divya"]<<<["SIN(x)+COS(x)+x^2"]

1..10@divya


["sunny","sneha"]<<<[[1..100],[500..1000]]

sunny

sneha


c=1..35@SIN .graphin()

d=1..100;


[49,31,#].$(z^2)

vs.

[49,31,#].$("z^2")


a=#TABLE1!B1:B1*46

a=#TABLE1!B1*46 // has issues.

a=#TABLE1!B1:B1*462

a=#TABLE1!B1*462

a=(#1/1/2012-2/1/2012).length

|4|.fillwith(34..200..3).$("2*x^3")



a=2..9|*|TRANSPOSE(2..9)


(2..3)~ for transpose.

a=2..9|*|(2..9)~; //for transpose.

((2..3)~)*34

(2..3)*~34

//~ for transpose.


a=|3|

a~;


a=(#TABLE1!B1)~*46



/* Showing intermediate output */

a=1..100;

OUTPUT(a);


a=1..25;

OUTPUT(a);


b=SUM(a);


[a,b]


Obi:=z^3;

d=FOR Obi 1..431;

SUM(d)


c8:=u+a*t

c8


SET(#TABLE1!B2:D5,1100);

// sets into calci such values

SET(#TABLE1!B2:D5,1..100);



1..1100.chunks(3) did not parse.

SET(#TABLE1!B2:D5,54..100.chunks(2));

SET(#TABLE1!B2:D5,54..100.chunks(2)~);



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


1..1100.chunks(3)


2Space!zcontrol2

FOR "SUM(1..x)" 1...1000000000...100


b=|4|

b.fillwith(1..123);

SIN(1..34)

a=1..20;

a.fillwith(2..3);



d=13;

SUM(d..10..-1)


b=1..100;

function Jay(x)

{

return(x+34)

}

1..100@Jay


a:=π*r^2;


a=|3|;

α:=π*r^2;

α(39);



Σ(1..100);


r=1..100@"π*r^2";


θ=1..5;

SIN(θ);


ctrl+g type greek name or unicode code and select and press ctrl+g to get the conversion into code. ctrl+u for uppercase greek etc. ctrl+space for hints.


sigma select ctrl+u gets Σ and then Σ(1..100).


മോോ=1..100;

ഐങ=2|*|മോോ


a="🍏🍎";

function x(n){return(REPEATCHAR(a,n))}

1..100@x


success="🍤";

1..100.map(()=>success);


ഒട്ടക൦=34;

ഒട്ടക൦=44+ഒട്ടക൦;


Yurttas:=SIN(c..30)

Yurttas(28)


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


fx:=SERIESSTR("x*3*_x+",1..x).join("")

1..10@fx



a=|3|;

	(a).rotate(45)


function das(x)

{

var adi=3;

return(adi+x)

}

das(4);


function fact(x)

{

return(x<1?1:fact(x-1)*x)

}

fact(19)


তণ=0;

FOR 1..(তণ+4) SIN;



v:=u+a*t;

ARRAYFY(v);

v(1..10,2..3,10..12);


//think of why this is not accurate.

// the matrix comes in incorrectly.

// Seems like it needs v:=u+a[0][0]*t;


v:=u[0]+a*t;

ARRAYFY(v,[0]);

v(1..10,2..3,10..12);



BOTTOMN([[1,2],[3,4],[4,5]],1..2)

TOPN([[1,2],[3,4],[4,5]],1..2)



VLOOKUP(5, [1..10]~, 1,TRUE)

// note ! is required to make it into a 2-D array. Any other tricks we could suggest?

VLOOKUP(21..26,|5|.fillwith(11..50), 1..5,FALSE)



(1..10~)

(1..10)~ // this makes a 2D array to be more accurate.

(1..10)



VLOOKUP(21..26,|5|.fillwith(11..50), 1..5,FALSE)


function x1(x){return(x+34)};x1(304)



todo


a=|4 2 3|


// had issue with VariableExpression.


// when do we var nowmark=Z3SetBookmark(); // when do we unset this?

SELECT * FROM A