User:Coderjoe/Sandbox2: Difference between revisions

no edit summary
(begin testing for busted geshi language)
 
No edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1:
<lang ActionScriptparigp>function compose(f:Function, g:Function):Function ={
return function( x:Number) {return-> f(g(x));};
};
var functions:Array = [Math.cos, Math.tan, function(x:Number){return x*x;}];
var inverse:Array = [Math.acos, Math.atan, function(x:Number){return Math.sqrt(x);}];
 
fcf()={
function test() {
my(A,B);
for (var i:uint = 0; i < functions.length; i++) {
A=[x->sin(x), x->cos(x), x->x^2];
trace(compose(functions[i], inverse[i])(0.5));
B=[x->asin(x), x->acos(x), x->sqrt(x)];
}
for(i=1,#A,
}</lang>
trace print(compose(functionsA[i], inverseB[i])(0.5));
)
};</lang>
Usage note: In Pari/GP 2.4.3 the vectors can be written as
<lang parigp> A=[sin, cos, x->x^2];
B=[asin, acos, x->sqrt(x)];</lang>
Anonymous user