Name:

function keyword for declaring a procedure-based function or a keyword representing a function type

Usage:

function(procedure) : procedure -> function function : type type

Parameters:

Description:

Example 1:

   > procedure EXP(X,n,p) {
   >   var res, oldPrec;
   >   oldPrec = prec;
   >   prec = p!;
   >   
   >   res = exp(X);
   >   
   >   prec = oldPrec!;
   >   return res;
   > };
   > f = function(EXP);
   > f(1);
   2.71828182845904523536028747135266249775724709369998
   > exp(1);
   2.71828182845904523536028747135266249775724709369998
   > f(x + 3);
   (function(proc(X, n, p)
   {
   var res, oldPrec;
   oldPrec = prec;
   prec = p!;
   res = exp(X);
   prec = oldPrec!;
   return res;
   }))(3 + x)
   > diff(f);
   diff(function(proc(X, n, p)
   {
   var res, oldPrec;
   oldPrec = prec;
   prec = p!;
   res = exp(X);
   prec = oldPrec!;
   return res;
   }))
   > (diff(f))(0);
   1
   > g = f(sin(x));
   > g(17);
   0.382358169993866834026905546416556413595734583420876
   > diff(g);
   (diff(function(proc(X, n, p)
   {
   var res, oldPrec;
   oldPrec = prec;
   prec = p!;
   res = exp(X);
   prec = oldPrec!;
   return res;
   })))(sin(x)) * cos(x)
   > (diff(g))(1);
   1.25338076749344683697237458088447611474812675164344
   > p = remez(f,3,[-1/2;1/2]);
   > p;
   0.9996712090142519365811043588840936667986880903378 + x * (0.99973702983570053280233869785694438940067223265505 + x * (0.51049729360256555535800202052281444451304355667385 + x * 0.1698143246071767617700502198641549152447429302716))
See also: proc, library, procedure, externalproc, boolean, constant, integer, list of, range, string
Go back to the list of commands