Name:

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

Library names:

sollya_obj_t sollya_lib_procedurefunction(sollya_obj_t, sollya_obj_t) sollya_obj_t sollya_lib_build_function_procedurefunction(sollya_obj_t,                                                          sollya_obj_t) SOLLYA_EXTERNALPROC_TYPE_FUNCTION

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.7182818284590452353602874713526624977572470937
   > exp(1);
   2.7182818284590452353602874713526624977572470937
   > 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.38235816999386683402690554641655641359573458342088
   > 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.99967120901420646830315493949039176881764871951833 + x * (0.99973702983571140134762682913614052309208076875596 + x * (0.510497293602826249216227216546435103583073053437 + x * 0.169814324607133287588897694747370380479108785868016))
See also: proc, library, procedure, externalproc, boolean, constant, integer, list of, range, string, object
Go back to the list of commands