Changes

5,126 bytes added ,  10:57, 4 January 2022
no edit summary
Line 1: Line 1: −
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.
+
Following are test cases to try out in ZCubes. Please note that the examples follow z^3 Language. Apart from being simple, z^3 language also give you full programming capability of Javascript and more, as the language enhances and converts to Javascript internally. z^3 runs within browsers, desktops, servers, web-servers, etc., and provides a full scale experience to the users, in all modes, operating systems and platforms of computing.
      Line 38: Line 38:     
b=34
 
b=34
 +
 +
 +
*[[ Z_API_Functions | See Also - Z3 Functions ]]
 +
*[[ Z%5E3_Language_Documentation| See Also - Z3 Language ]]
 +
 +
    
=Object Initialization=
 
=Object Initialization=
Line 50: Line 56:  
=Matrix Operators=
 
=Matrix Operators=
   −
a=|3||*||4|
+
a=|3||*||4| //doesn't work
    
a=|5x5|  
 
a=|5x5|  
Line 73: Line 79:       −
=Combanatorial Arguments and Implicit Looping=
+
*[[ Z%5E3_Language_Documentation | See Also - Z3 Language Documentation ]]
 +
 
 +
=Regular Expressions=
 +
 
 +
a=["cat","dog","rat"];
 +
 
 +
a.filter(
 +
 
 +
x=>x.match(/(o|t)/)
 +
 
 +
)
 +
 
 +
Output: cat dog rat
 +
 
 +
 
 +
 +
a=["cat","dog","rat","rat1"];
 +
 
 +
a.map(
 +
 
 +
x=>x.match(/[0-9]/)
 +
 
 +
)
 +
 
 +
Output: null null null 1
 +
 
 +
 
 +
       
 +
a=["cat","dog","r2iat","rat1"];
 +
 
 +
a.filter(
 +
 
 +
x=>x.match(/[hc]?at/)
 +
 
 +
)
 +
 
 +
Output: cat r2iat rat1
 +
 
 +
 
 +
 +
a=13;
 +
 
 +
b=34;
 +
 
 +
a..b
 +
 
 +
Output: 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
 +
 
 +
 
 +
 
 +
5√(1..34)
 +
 
 +
 
 +
(2..5)√(10..34)
 +
 
 +
 
 +
 
 +
a=45m;
 +
 
 +
c=56cm;
 +
 
 +
a<+>c
 +
 
 +
Output: 4556cm
 +
 
 +
 
 +
=Combinatorial Arguments and Implicit Looping=
    
CHIDIST(1..100,2..3) .graph(1,0)
 
CHIDIST(1..100,2..3) .graph(1,0)
Line 181: Line 253:  
d=#;
 
d=#;
   −
PMT(#1/1/2011,#2/2012) // worked
+
PMT(#1/1/2011,#2/2012) // did not work
    
var a=#a-x;
 
var a=#a-x;
Line 377: Line 449:  
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)
+
PMT(4%, 12, 100000)
    
a=FOR(PMT, 100000,41% ,1..12)
 
a=FOR(PMT, 100000,41% ,1..12)
Line 438: Line 510:     
test()
 
test()
 +
 +
*[[ Array_Manipulation | See Also - Z3 Array Manipulation ]]
 +
*[[ Z_API_Functions | See Also - Z3 API Functions List ]]
 +
 +
 +
 +
=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
 +
 +
 +
 +
SETVALUE(#TABLE1!B2:D5,1100);
 +
 +
// sets into calci such values. TABLE1 needs to be opened through 'New-->Calci'
 +
 +
SETVALUE(#TABLE1!B2:D5,1..100);
 +
 +
 +
 +
 +
1..1100.chunks(3) did not parse.
 +
 +
SETVALUE(#TABLE1!B2:D5,54..100.chunks(2));
 +
 +
SETVALUE(#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
 +
 +
 +
Free Form Calci - Test from forms like:
 +
http://www.tribology-abc.com/calculators/default.htm
 +
 +
 +
 +
*[[ Z_API_Functions| See also - Z3 API Functions List ]]
 +
*[[ Z3 | << Z3 Home ]]
writer
2,661

edits