Go back to the main page of Sollya

Commands available within Sollya

Help pages

Name:

abs the absolute value.

Library names:

sollya_obj_t sollya_lib_abs(sollya_obj_t) sollya_obj_t sollya_lib_build_function_abs(sollya_obj_t) #define SOLLYA_ABS(x) sollya_lib_build_function_abs(x)

Description:

Go back to the list of commands

Name:

absolute indicates an absolute error for externalplot, fpminimax or supnorm

Library names:

sollya_obj_t sollya_lib_absolute() int sollya_lib_is_absolute(sollya_obj_t)

Usage:

absolute : absolute|relative

Description:

Example 1:

   > bashexecute("gcc -fPIC -c externalplotexample.c");
   > bashexecute("gcc -shared -o externalplotexample externalplotexample.o -lgmp -lmpfr");
   > externalplot("./externalplotexample",absolute,exp(x),[-1/2;1/2],12,perturb);
See also: externalplot, fpminimax, relative, bashexecute, supnorm
Go back to the list of commands

Name:

accurateinfnorm computes a faithful rounding of the infinity norm of a function

Usage:

accurateinfnorm(function,range,constant) : (function, range, constant) -> constant accurateinfnorm(function,range,constant,exclusion range 1,...,exclusion range n) : (function, range, constant, range, ..., range) -> constant

Parameters:

Description:

Example 1:

   > p = remez(exp(x), 5, [-1;1]);
   > accurateinfnorm(p - exp(x), [-1;1], 20);
   4.52055246569216251373291015625e-5
   > accurateinfnorm(p - exp(x), [-1;1], 30);
   4.5205513970358879305422306060791015625e-5
   > accurateinfnorm(p - exp(x), [-1;1], 40);
   4.520551396713923253400935209356248378753662109375e-5

Example 2:

   > p = remez(exp(x), 5, [-1;1]);
   > midpointmode = on!;
   > infnorm(p - exp(x), [-1;1]);
   0.45205~5/7~e-4
   > accurateinfnorm(p - exp(x), [-1;1], 40);
   4.520551396713923253400935209356248378753662109375e-5
See also: infnorm, dirtyinfnorm, supnorm, checkinfnorm, remez, diam
Go back to the list of commands

Name:

acos the arccosine function.

Library names:

sollya_obj_t sollya_lib_acos(sollya_obj_t) sollya_obj_t sollya_lib_build_function_acos(sollya_obj_t) #define SOLLYA_ACOS(x) sollya_lib_build_function_acos(x)

Description:

See also: cos
Go back to the list of commands

Name:

acosh the arg-hyperbolic cosine function.

Library names:

sollya_obj_t sollya_lib_acosh(sollya_obj_t) sollya_obj_t sollya_lib_build_function_acosh(sollya_obj_t) #define SOLLYA_ACOSH(x) sollya_lib_build_function_acosh(x)

Description:

See also: cosh
Go back to the list of commands

Name:

&& boolean AND operator

Library name:

sollya_obj_t sollya_lib_and(sollya_obj_t, sollya_obj_t)

Usage:

expr1 && expr2 : (boolean, boolean) -> boolean

Parameters:

Description:

Example 1:

   > true && false;
   false

Example 2:

   > (1 == exp(0)) && (0 == log(1));
   true
See also: ||, !
Go back to the list of commands

Name:

annotatefunction Annotates a Sollya function object with an approximation that is faster to evaluate

Library names:

sollya_obj_t sollya_lib_annotatefunction(sollya_obj_t, sollya_obj_t,                                          sollya_obj_t, sollya_obj_t, ...); sollya_obj_t sollya_lib_v_annotatefunction(sollya_obj_t, sollya_obj_t,                                            sollya_obj_t, sollya_obj_t,                                            va_list);

Usage:

annotatefunction(f, g, I, d) : (function, function, range, range) -> function annotatefunction(f, g, I, d, x0) : (function, function, range, range, constant) -> function

Parameters:

Description:

Example 1:

   > verbosity=1!;
   > procedure EXP(X,n,p) {
               var res, oldPrec;
               oldPrec = prec;
               prec = p!;
               "Using procedure function exponential with X=" @ X @ ", n=" @ n @ ", and p=" @ p;
               res = exp(X);
               prec = oldPrec!;
               return res;
          };
   > g = function(EXP);
   > p = 46768052394588893382516870161332864698044514954899b-165 + x * (23384026197294446691258465802074096632225783601255b-164 + x * (5846006549323611672948426613035653821819225877423b-163 + x * (3897337699549074448627696490806815137319821946501b-164 + x * (7794675399098148717422744621371434831048848817417b-167 + x * (24942961277114075921122941174178849425809856036737b-171 + x * (8314320425704876115613838900105097456456371179471b-172 + x * (19004160973039701371579356991645932289422670402995b-176 + x * (19004160972669324148912122254449912156003926801563b-179 + x * (33785175062542597526738679493857229456702396042255b-183 + x * (6757035113643674378393625988264926886191860669891b-184 + x * (9828414707511252769908089206114262766633532289937b-188 + x * (26208861108003813314724515233584738706961162212965b-193 + x * (32257064253325954315953742396999456577223350602741b-197 + x * (578429089657689569703509185903214676926704485495b-195 + x * 2467888542176675658523627105540996778984959471957b-201))))))))))))));
   > h = annotatefunction(g, p, [-1/2;1/2], [-475294848522543b-124;475294848522543b-124]);
   > h == g;
   true
   > prec = 24;
   The precision has been set to 24 bits.
   > h(0.25);
   Warning: rounding has happened. The value displayed is a faithful rounding to 24 bits of the true result.
   1.2840254
   > prec = 165;
   The precision has been set to 165 bits.
   > h(0.25);
   Using procedure function exponential with X=[0.25;0.25], n=0, and p=185
   Warning: rounding has happened. The value displayed is a faithful rounding to 165 bits of the true result.
   1.28402541668774148407342056806243645833628086528147
See also: chebyshevform, taylorform, remez, supnorm, infnorm
Go back to the list of commands

Name:

:. add an element at the end of a list.

Library name:

sollya_obj_t sollya_lib_append(sollya_obj_t, sollya_obj_t)

Usage:

L:.x : (list, any type) -> list

Parameters:

Description:

Example 1:

   > [|2,3,4|]:.5;
   [|2, 3, 4, 5|]

Example 2:

   > [|1,2,3|]:.[|4,5,6|];
   [|1, 2, 3, [|4, 5, 6|]|]

Example 3:

   > [||]:.1;
   [|1|]
See also: .:, @
Go back to the list of commands

Name:

~ floating-point evaluation of a constant expression

Library name:

sollya_obj_t sollya_lib_approx(sollya_obj_t)

Usage:

~ expression : function -> constant ~ something : any type -> any type

Parameters:

Description:

Example 1:

   > print(exp(5));
   exp(5)
   > print(~ exp(5));
   148.41315910257660342111558004055227962348766759388

Example 2:

   > autosimplify = off!;

Example 3:

   > print(~sin(5 * pi));
   0

Example 4:

   > print(~exp(x));
   exp(x)
   > print(~ "Hello");
   Hello

Example 5:

   > print(~exp(x*5*Pi));
   exp((pi) * 5 * x)
   > print(exp(x* ~(5*Pi)));
   exp(x * 15.7079632679489661923132169163975144209858469968757)

Example 6:

   > print(~exp(5)*x);
   148.41315910257660342111558004055227962348766759388 * x
   > print( (~exp(5))*x);
   148.41315910257660342111558004055227962348766759388 * x
   > print(~(exp(5)*x));
   exp(5) * x
See also: evaluate, prec, error
Go back to the list of commands

Name:

asciiplot plots a function in a range using ASCII characters

Library name:

void sollya_lib_asciiplot(sollya_obj_t, sollya_obj_t)

Usage:

asciiplot(function, range) : (function, range) -> void

Parameters:

Description:

Example 1:

   > asciiplot(exp(x),[1;2]);
                                                                             xx
                                                                           xx  
                                                                         xx    
                                                                       xx      
                                                                     xx        
                                                                  xxx          
                                                                xx             
                                                             xxx               
                                                           xx                  
                                                        xxx                    
                                                     xxx                       
                                                  xxx                          
                                               xxx                             
                                            xxx                                
                                        xxxx                                   
                                     xxx                                       
                                 xxxx                                          
                             xxxx                                              
                         xxxx                                                  
                     xxxx                                                      
                xxxxx                                                          
           xxxxx                                                               
      xxxxx                                                                    
   xxx                                                                         

Example 2:

   > asciiplot(expm1(x),[-1;2]);
                            |                                                 x
                            |                                                x
                            |                                               x  
                            |                                              x   
                            |                                            xx    
                            |                                           x      
                            |                                          x       
                            |                                        xx        
                            |                                       x          
                            |                                     xx           
                            |                                   xx             
                            |                                 xx               
                            |                               xx                 
                            |                             xx                   
                            |                           xx                     
                            |                        xxx                       
                            |                     xxx                          
                            |                 xxxx                             
                            |             xxxx                                 
                            |         xxxx                                     
                            |   xxxxxx                                         
   ---------------------xxxxxxxx-----------------------------------------------
            xxxxxxxxxxxx    |                                                  
   xxxxxxxxx                |                                                  

Example 3:

   > asciiplot(5,[-1;1]);
   5

Example 4:

   > asciiplot(exp(x),[1;1]);
   2.7182818284590452353602874713526624977572470937
See also: plot, externalplot
Go back to the list of commands

Name:

asin the arcsine function.

Library names:

sollya_obj_t sollya_lib_asin(sollya_obj_t) sollya_obj_t sollya_lib_build_function_asin(sollya_obj_t) #define SOLLYA_ASIN(x) sollya_lib_build_function_asin(x)

Description:

See also: sin
Go back to the list of commands

Name:

asinh the arg-hyperbolic sine function.

Library names:

sollya_obj_t sollya_lib_asinh(sollya_obj_t) sollya_obj_t sollya_lib_build_function_asinh(sollya_obj_t) #define SOLLYA_ASINH(x) sollya_lib_build_function_asinh(x)

Description:

See also: sinh
Go back to the list of commands

Name:

atan the arctangent function.

Library names:

sollya_obj_t sollya_lib_atan(sollya_obj_t) sollya_obj_t sollya_lib_build_function_atan(sollya_obj_t) #define SOLLYA_ATAN(x) sollya_lib_build_function_atan(x)

Description:

See also: tan
Go back to the list of commands

Name:

atanh the hyperbolic arctangent function.

Library names:

sollya_obj_t sollya_lib_atanh(sollya_obj_t) sollya_obj_t sollya_lib_build_function_atanh(sollya_obj_t) #define SOLLYA_ATANH(x) sollya_lib_build_function_atanh(x)

Description:

See also: tanh
Go back to the list of commands

Name:

autodiff Computes the first n derivatives of a function at a point or over an interval.

Library name:

sollya_obj_t sollya_lib_autodiff(sollya_obj_t, sollya_obj_t, sollya_obj_t)

Usage:

autodiff(f, n, x0) : (function, integer, constant) -> list autodiff(f, n, I) : (function, integer, range) -> list

Parameters:

Description:

Example 1:

   > L = autodiff(exp(cos(x))+sin(exp(x)), 5, 0);
   > midpointmode = on!;
   > for f_i in L do f_i;
   0.3559752813266941742012789792982961497379810154498~2/4~e1
   0.5403023058681397174009366074429766037323104206179~0/3~
   -0.3019450507398802024611853185539984893647499733880~6/2~e1
   -0.252441295442368951995750696489089699886768918239~6/4~e1
   0.31227898756481033145214529184139729746320579069~1/3~e1
   -0.16634307959006696033484053579339956883955954978~3/1~e2

Example 2:

   > f = log(cos(x)+x);
   > L = autodiff(log(cos(x)+x), 5, [2,4]);
   > L[0];
   [0;1.27643852425465597132446653114905059102580436018893]
   > evaluate(f, [2,4]);
   [0.45986058925497069206106494332976097408234056912429;1.20787210589964169595901037621103012113048821362855]
   > fprime = diff(f);
   > L[1];
   [2.53086745013099407167484456656211083053393118778677e-2;1.7568024953079282513726390945118290941359128873365]
   > evaluate(fprime,[2,4]);
   [2.71048755415961996452136364304380881763456815673085e-2;1.1091953066394329083739722578862353140555843127995]

Example 3:

   > L = autodiff(sin(x)/x, 0, [-1,1]);
   > L[0];
   [-infty;infty]
   > evaluate(sin(x)/x, [-1,1]);
   [0.5403023058681397174009366074429766037323104206179;1]
See also: diff, evaluate
Go back to the list of commands

Name:

autosimplify activates, deactivates or inspects the value of the automatic simplification state variable

Library names:

void sollya_lib_set_autosimplify_and_print(sollya_obj_t) void sollya_lib_set_autosimplify(sollya_obj_t) sollya_obj_t sollya_lib_get_autosimplify()

Usage:

autosimplify = activation value : on|off -> void autosimplify = activation value ! : on|off -> void autosimplify : on|off

Parameters:

Description:

Example 1:

   > autosimplify = on !;
   > print(x - x);
   0
   > autosimplify = off ;
   Automatic pure tree simplification has been deactivated.
   > print(x - x);
   x - x

Example 2:

   > autosimplify = on !;
   > print(rationalapprox(sin(pi/5.9),7));
   33 / 65
   > autosimplify = off !;
   > print(rationalapprox(sin(pi/5.9),7));
   33 / 65
See also: print, ==, !=, prec, points, diam, display, verbosity, canonical, taylorrecursions, timing, fullparentheses, midpointmode, hopitalrecursions, remez, rationalapprox, taylor
Go back to the list of commands

Name:

bashevaluate executes a shell command and returns its output as a string

Library names:

sollya_obj_t sollya_lib_bashevaluate(sollya_obj_t, ...) sollya_obj_t sollya_lib_v_bashevaluate(sollya_obj_t, va_list)

Usage:

bashevaluate(command) : string -> string bashevaluate(command,input) : (string, string) -> string

Parameters:

Description:

Example 1:

   > bashevaluate("LANG=C date");
   Thu Sep 20 12:34:53 CEST 2018

Example 2:

   > [| bashevaluate("echo Hello") |];
   [|"Hello"|]

Example 3:

   > a = bashevaluate("sed -e 's/a/e/g;'", "Hallo");
   > a;
   Hello
See also: bashexecute
Go back to the list of commands

Name:

bashexecute executes a shell command.

Library name:

void sollya_lib_bashexecute(sollya_obj_t)

Usage:

bashexecute(command) : string -> void

Parameters:

Description:

Example 1:

   > bashexecute("LANG=C date");
   Thu Sep 20 12:34:57 CEST 2018
See also: execute, readfile, parse, bashevaluate
Go back to the list of commands

Name:

binary special value for global state display

Library names:

sollya_obj_t sollya_lib_binary() int sollya_lib_is_binary(sollya_obj_t)

Description:

See also: decimal, dyadic, powers, hexadecimal, display
Go back to the list of commands

Name:

bind partially applies a procedure to an argument, returning a procedure with one argument less

Usage:

bind(proc, ident, obj) : (procedure, identifier type, any type) -> procedure

Parameters:

Description:

Example 1:

   > procedure add(X,Y) { return X + Y; };
   > succ = bind(add,X,1);
   > succ(5);
   6
   > succ;
   proc(Y)
   {
   nop;
   return (proc(X, Y)
   {
   nop;
   return (X) + (Y);
   })(1, Y);
   }

Example 2:

   > procedure add(X,Y) { return X + Y; };
   > succ = bind(add,X,1);
   > five = bind(succ,Y,4);
   > five();
   5
   > five;
   proc()
   {
   nop;
   return (proc(Y)
   {
   nop;
   return (proc(X, Y)
   {
   nop;
   return (X) + (Y);
   })(1, Y);
   })(4);
   }

Example 3:

   > verbosity = 1!;
   > procedure add(X,Y) { return X + Y; };
   > foo = bind(add,R,1);
   Warning: the given procedure has no argument named "R". The procedure is returned unchanged.
   > foo;
   proc(X, Y)
   {
   nop;
   return (X) + (Y);
   }
See also: procedure, proc, function, @
Go back to the list of commands

Name:

boolean keyword representing a boolean type

Library name:

SOLLYA_EXTERNALPROC_TYPE_BOOLEAN

Usage:

boolean : type type

Description:

See also: externalproc, constant, function, integer, list of, range, string, object
Go back to the list of commands

Name:

canonical brings all polynomial subexpressions of an expression to canonical form or activates, deactivates or checks canonical form printing

Library names:

void sollya_lib_set_canonical_and_print(sollya_obj_t) void sollya_lib_set_canonical(sollya_obj_t) sollya_obj_t sollya_lib_canonical(sollya_obj_t) sollya_obj_t sollya_lib_get_canonical()

Usage:

canonical(function) : function -> function canonical = activation value : on|off -> void canonical = activation value ! : on|off -> void

Parameters:

Description:

Example 1:

   > print(canonical(1 + x * (x + 3 * x^2)));
   1 + x^2 + 3 * x^3
   > print(canonical((x + 1)^7));
   1 + 7 * x + 21 * x^2 + 35 * x^3 + 35 * x^4 + 21 * x^5 + 7 * x^6 + x^7

Example 2:

   > print(canonical(exp((x + 1)^5) - log(asin(((x + 2) + x)^4 * (x + 1)) + x)));
   exp(1 + 5 * x + 10 * x^2 + 10 * x^3 + 5 * x^4 + x^5) - log(asin(16 + 80 * x + 160 * x^2 + 160 * x^3 + 80 * x^4 + 16 * x^5) + x)

Example 3:

   > canonical;
   off
   > (x + 2)^9;
   512 + x * (2304 + x * (4608 + x * (5376 + x * (4032 + x * (2016 + x * (672 + x * (144 + x * (18 + x))))))))
   > canonical = on;
   Canonical automatic printing output has been activated.
   > (x + 2)^9;
   512 + 2304 * x + 4608 * x^2 + 5376 * x^3 + 4032 * x^4 + 2016 * x^5 + 672 * x^6 + 144 * x^7 + 18 * x^8 + x^9
   > canonical;
   on
   > canonical = off!;
   > (x + 2)^9;
   512 + x * (2304 + x * (4608 + x * (5376 + x * (4032 + x * (2016 + x * (672 + x * (144 + x * (18 + x))))))))
See also: horner, print, autosimplify
Go back to the list of commands

Name:

ceil the usual function ceil.

Library names:

sollya_obj_t sollya_lib_ceil(sollya_obj_t) sollya_obj_t sollya_lib_build_function_ceil(sollya_obj_t) #define SOLLYA_CEIL(x) sollya_lib_build_function_ceil(x)

Description:

See also: floor, nearestint, round, RU
Go back to the list of commands

Name:

chebyshevform computes a rigorous polynomial approximation

Library name:

sollya_obj_t sollya_lib_chebyshevform(sollya_obj_t, sollya_obj_t,                                       sollya_obj_t);

Usage:

chebyshevform(f, n, I) : (function, integer, range) -> list

Parameters:

Description:

Example 1:

   > TL=chebyshevform(exp(x), 10, [-1,1]);
   > p=TL[0];
   > Delta=TL[2];
   > p; Delta;
   1.00000000000000000000000000000000000000000000000017 + x * (1.0000000002738981919773953471453626764777115166417 + x * (0.50000000002276754368023326882542097365411870042312 + x * (0.166666661190450656168988993421371510533693281444003 + x * (4.1666666211440433973188799509591566161569698904644e-2 + x * (8.3333639749825520034240517636254576844423981913793e-3 + x * (1.38889143636148090706862105537216777944219976325265e-3 + x * (1.98342776066472142284727329700227389403558111865906e-4 + x * (2.47957727598277888282218067965324267955768146489014e-5 + x * (2.8254033440982477266316370012542019511804700836066e-6 + x * 2.8136983333718843135828091163040197490633045592362e-7)))))))))
   [-2.71406412827174505775085010461449926572460824320373e-11;2.71406412827174505775085010461449926572460824320373e-11]
See also: taylorform, diff, autodiff, taylor, remez
Go back to the list of commands

Name:

checkinfnorm checks whether the infinity norm of a function is bounded by a value

Library name:

sollya_obj_t sollya_lib_checkinfnorm(sollya_obj_t, sollya_obj_t,                                      sollya_obj_t)

Usage:

checkinfnorm(function,range,constant) : (function, range, constant) -> boolean

Parameters:

Description:

Example 1:

   > checkinfnorm(sin(x),[0;1.75], 1);
   true
   > checkinfnorm(sin(x),[0;1.75], 1/2); checkinfnorm(sin(x),[0;20/39],1/2);
   false
   true

Example 2:

   > p = remez(exp(x), 5, [-1;1]);
   > b = dirtyinfnorm(p - exp(x), [-1;1]);
   > checkinfnorm(p - exp(x), [-1;1], b);
   false
   > b1 = round(b, 15, RU);
   > checkinfnorm(p - exp(x), [-1;1], b1);
   true
   > b2 = round(b, 25, RU);
   > checkinfnorm(p - exp(x), [-1;1], b2);
   false
   > diam = 1b-20!;
   > checkinfnorm(p - exp(x), [-1;1], b2);
   true
See also: infnorm, dirtyinfnorm, supnorm, accurateinfnorm, remez, diam
Go back to the list of commands

Name:

coeff gives the coefficient of degree n of a polynomial

Library name:

sollya_obj_t sollya_lib_coeff(sollya_obj_t, sollya_obj_t)

Usage:

coeff(f,n) : (function, integer) -> constant

Parameters:

Description:

Example 1:

   > coeff((1+x)^5,3);
   10

Example 2:

   > coeff(sin(x),0);
   0
See also: degree, roundcoefficients, subpoly
Go back to the list of commands

Name:

composepolynomials computes an approximation to the composition of two polynomials and bounds the error

Library name:

sollya_obj_t sollya_lib_composepolynomials(sollya_obj_t, sollya_obj_t)

Usage:

composepolynomials(p,q) : (function, function) -> structure

Parameters:

Description:

Example 1:

   > composepolynomials(1 + 2 * x + 3 * x^2 + 4 * x^3, 5 + 6 * x + 7 * x^2);
   { .radii = [|[0;0], [0;0], [0;0], [0;0], [0;0], [0;0], [0;0]|], .poly = 586 + x * (1992 + x * (4592 + x * (6156 + x * (6111 + x * (3528 + x * 1372))))) }

Example 2:

   > print(composepolynomials(1/5 * x + exp(17) + log(2) * x^2, x^4 + 1/3 * x^2));
   { .radii = [|[-3.5873240686715317015647477332221852960774705712039e-43;3.5873240686715317015647477332221852960774705712039e-43], [0;0], [-2.67276471009219564614053646715148187881519688010505e-51;2.67276471009219564614053646715148187881519688010505e-51], [0;0], [-1.06910588403687825845621458686059275152607875204202e-50;1.06910588403687825845621458686059275152607875204202e-50], [0;0], [-2.13821176807375651691242917372118550305215750408404e-50;2.13821176807375651691242917372118550305215750408404e-50], [0;0], [-1.06910588403687825845621458686059275152607875204202e-50;1.06910588403687825845621458686059275152607875204202e-50]|], .poly = 2.41549527535752982147754351803858238798675673527228e7 + x^2 * (6.6666666666666666666666666666666666666666666666666e-2 + x^2 * (0.2770163533955494788241369023842418408972777927067 + x^2 * (0.46209812037329687294482141430545104538366675624017 + x^2 * 0.69314718055994530941723212145817656807550013436026))) }

Example 3:

   > composepolynomials(sin(x),x + x^2);
   { .radii = [| |], .poly = sin(x * (1 + x)) }
See also: substitute
Go back to the list of commands

Name:

@ concatenates two lists or strings or applies a list as arguments to a procedure

Library name:

sollya_obj_t sollya_lib_concat(sollya_obj_t, sollya_obj_t)

Usage:

L1@L2 : (list, list) -> list string1@string2 : (string, string) -> string proc@L1 : (procedure, list) -> any type

Parameters:

Description:

Example 1:

   > [|1,...,3|]@[|7,8,9|];
   [|1, 2, 3, 7, 8, 9|]

Example 2:

   > "Hello "@"World!";
   Hello World!

Example 3:

   > procedure cool(a,b,c) {
     write(a,", ", b," and ",c," are cool guys.\n");
     };
   > cool @ [| "Christoph", "Mioara", "Sylvain" |];
   Christoph, Mioara and Sylvain are cool guys.

Example 4:

   > procedure sayhello() {
     "Hello! how are you?";
     };
   > sayhello();
   Hello! how are you?
   > sayhello @ [||];
   Hello! how are you?

Example 5:

   > bashexecute("gcc -fPIC -Wall -c externalprocexample.c");
   > bashexecute("gcc -fPIC -shared -o externalprocexample externalprocexample.o");
   > externalproc(foo, "./externalprocexample", (integer, integer) -> integer);
   > foo;
   foo
   > foo @ [|5, 6|];
   11

Example 6:

   > procedure add(L = ...) {
     var acc, i;
     acc = 0;
     for i in L do acc = i + acc;
     return acc;
     };
   > add(1,2);
   3
   > add(1,2,3);
   6
   > add @ [|1, 2|];
   3
   > add @ [|1, 2, 3|];
   6
   > add @ [||];
   0
See also: .:, :., procedure, externalproc, proc, bind, getbacktrace
Go back to the list of commands

Name:

constant keyword representing a constant type

Library name:

SOLLYA_EXTERNALPROC_TYPE_CONSTANT

Usage:

constant : type type

Description:

See also: externalproc, boolean, function, integer, list of, range, string, object
Go back to the list of commands

Name:

cos the cosine function.

Library names:

sollya_obj_t sollya_lib_cos(sollya_obj_t) sollya_obj_t sollya_lib_build_function_cos(sollya_obj_t) #define SOLLYA_COS(x) sollya_lib_build_function_cos(x)

Description:

See also: acos, sin, tan
Go back to the list of commands

Name:

cosh the hyperbolic cosine function.

Library names:

sollya_obj_t sollya_lib_cosh(sollya_obj_t) sollya_obj_t sollya_lib_build_function_cosh(sollya_obj_t) #define SOLLYA_COSH(x) sollya_lib_build_function_cosh(x)

Description:

See also: acosh, sinh, tanh, exp
Go back to the list of commands

Name:

D short form for double
See also: double
Go back to the list of commands

Name:

DD short form for doubledouble
See also: doubledouble
Go back to the list of commands

Name:

DE short form for doubleextended
See also: doubleextended
Go back to the list of commands

Name:

decimal special value for global state display

Library names:

sollya_obj_t sollya_lib_decimal() int sollya_lib_is_decimal(sollya_obj_t)

Description:

See also: dyadic, powers, hexadecimal, binary, display
Go back to the list of commands

Name:

default default value for some commands.

Library names:

sollya_obj_t sollya_lib_default() int sollya_lib_is_default(sollya_obj_t)

Description:

Example 1:

   > p = remez(exp(x),5,[0;1],default,1e-5);
   > q = remez(exp(x),5,[0;1],1,1e-5);
   > p==q;
   true

Example 2:

   > prec;
   165
   > prec=200;
   The precision has been set to 200 bits.
Go back to the list of commands

Name:

degree gives the degree of a polynomial.

Library name:

sollya_obj_t sollya_lib_degree(sollya_obj_t)

Usage:

degree(f) : function -> integer

Parameters:

Description:

Example 1:

   > degree((1+x)*(2+5*x^2));
   3
   > degree(0);
   0

Example 2:

   > degree(sin(x));
   -1
See also: coeff, subpoly, roundcoefficients
Go back to the list of commands

Name:

denominator gives the denominator of an expression

Library name:

sollya_obj_t sollya_lib_denominator(sollya_obj_t)

Usage:

denominator(expr) : function -> function

Parameters:

Description:

Example 1:

   > denominator(5/3);
   3

Example 2:

   > denominator(exp(x));
   1

Example 3:

   > a = 5/3;
   > b = numerator(a)/denominator(a);
   > print(a);
   5 / 3
   > print(b);
   5 / 3

Example 4:

   > a = exp(x/3);
   > b = numerator(a)/denominator(a);
   > print(a);
   exp(x / 3)
   > print(b);
   exp(x / 3)
See also: numerator, rationalmode
Go back to the list of commands

Name:

diam parameter used in safe algorithms of Sollya and controlling the maximal length of the involved intervals.

Library names:

void sollya_lib_set_diam_and_print(sollya_obj_t) void sollya_lib_set_diam(sollya_obj_t) sollya_obj_t sollya_lib_get_diam()

Usage:

diam = width : constant -> void diam = width ! : constant -> void diam : constant

Parameters:

Description:

See also: infnorm, checkinfnorm, accurateinfnorm, integral, findzeros, supnorm
Go back to the list of commands

Name:

dieonerrormode global variable controlling if Sollya is exited on an error or not.

Library names:

void sollya_lib_set_dieonerrormode_and_print(sollya_obj_t) void sollya_lib_set_dieonerrormode(sollya_obj_t) sollya_obj_t sollya_lib_get_dieonerrormode()

Usage:

dieonerrormode = activation value : on|off -> void dieonerrormode = activation value ! : on|off -> void dieonerrormode : on|off

Parameters:

Description:

Example 1:

   > verbosity = 1!;
   > dieonerrormode = off;
   Die-on-error mode has been deactivated.
   > for i from true to false do i + "Salut";
   Warning: one of the arguments of the for loop does not evaluate to a constant.
   The for loop will not be executed.
   > exp(17);
   Warning: rounding has happened. The value displayed is a faithful rounding to 165 bits of the true result.
   2.41549527535752982147754351803858238798675673527224e7

Example 2:

   > verbosity = 1!;
   > dieonerrormode = off!;
   > 5 */  4;
   Warning: syntax error, unexpected /.
   The last symbol read has been "/".
   Will skip input until next semicolon after the unexpected token. May leak memory.
     exp(17);
   Warning: rounding has happened. The value displayed is a faithful rounding to 165 bits of the true result.
   2.41549527535752982147754351803858238798675673527224e7

Example 3:

   > verbosity = 1!;
   > dieonerrormode;
   off
   > dieonerrormode = on!;
   > dieonerrormode;
   on
   > for i from true to false do i + "Salut";
   Warning: one of the arguments of the for loop does not evaluate to a constant.
   The for loop will not be executed.
   Warning: some syntax, typing or side-effect error has occurred.
   As the die-on-error mode is activated, the tool will be exited.

Example 4:

   > verbosity = 1!;
   > dieonerrormode = on!;
   > 5 */  4;
   Warning: syntax error, unexpected /.
   The last symbol read has been "/".
   Will skip input until next semicolon after the unexpected token. May leak memory.
   Warning: some syntax, typing or side-effect error has occurred.
   As the die-on-error mode is activated, the tool will be exited.

Example 5:

   > verbosity = 0!;
   > dieonerrormode = on!;
   > 5 */  4;
See also: on, off, verbosity, error
Go back to the list of commands

Name:

diff differentiation operator

Library name:

sollya_obj_t sollya_lib_diff(sollya_obj_t)

Usage:

diff(function) : function -> function

Parameters:

Description:

Example 1:

   > diff(sin(x));
   cos(x)

Example 2:

   > diff(x);
   1

Example 3:

   > diff(x^x);
   x^x * (1 + log(x))
See also: library, autodiff, taylor, taylorform
Go back to the list of commands

Name:

dirtyfindzeros gives a list of numerical values listing the zeros of a function on an interval.

Library name:

sollya_obj_t sollya_lib_dirtyfindzeros(sollya_obj_t, sollya_obj_t)

Usage:

dirtyfindzeros(f,I) : (function, range) -> list

Parameters:

Description:

Example 1:

   > dirtyfindzeros(sin(x),[-5;5]);
   [|-3.1415926535897932384626433832795028841971693993751, 0, 3.1415926535897932384626433832795028841971693993751|]

Example 2:

   > L1=dirtyfindzeros(x^2*sin(1/x),[0;1]);
   > points=1000!;
   > L2=dirtyfindzeros(x^2*sin(1/x),[0;1]);
   > length(L1); length(L2);
   18
   25
See also: prec, points, findzeros, dirtyinfnorm, numberroots
Go back to the list of commands

Name:

dirtyinfnorm computes a numerical approximation of the infinity norm of a function on an interval.

Library name:

sollya_obj_t sollya_lib_dirtyinfnorm(sollya_obj_t, sollya_obj_t)

Usage:

dirtyinfnorm(f,I) : (function, range) -> constant

Parameters:

Description:

Example 1:

   > dirtyinfnorm(sin(x),[-10;10]);
   1

Example 2:

   > prec=15!;
   > dirtyinfnorm(exp(cos(x))*sin(x),[0;5]);
   1.45856
   > prec=40!;
   > dirtyinfnorm(exp(cos(x))*sin(x),[0;5]);
   1.458528537136
   > prec=100!;
   > dirtyinfnorm(exp(cos(x))*sin(x),[0;5]);
   1.458528537136237644438147455025
   > prec=200!;
   > dirtyinfnorm(exp(cos(x))*sin(x),[0;5]);
   1.458528537136237644438147455023841718299214087993682374094153

Example 3:

   > dirtyinfnorm(x^2, [log(0);log(1)]);
   NaN
See also: prec, points, infnorm, checkinfnorm, supnorm
Go back to the list of commands

Name:

dirtyintegral computes a numerical approximation of the integral of a function on an interval.

Library name:

sollya_obj_t sollya_lib_dirtyintegral(sollya_obj_t, sollya_obj_t)

Usage:

dirtyintegral(f,I) : (function, range) -> constant

Parameters:

Description:

Example 1:

   > sin(10);
   -0.54402111088936981340474766185137728168364301291622
   > dirtyintegral(cos(x),[0;10]);
   -0.54400304905152629822448058882475382036536298356282
   > points=2000!;
   > dirtyintegral(cos(x),[0;10]);
   -0.54401997751158321972222697312583199035995837926893
See also: prec, points, integral
Go back to the list of commands

Name:

dirtysimplify simplifies an expression representing a function

Library name:

sollya_obj_t sollya_lib_dirtysimplify(sollya_obj_t)

Usage:

dirtysimplify(function) : function -> function

Parameters:

Description:

Example 1:

   > print(dirtysimplify(sin(pi * x)));
   sin(3.1415926535897932384626433832795028841971693993751 * x)
   > print(dirtysimplify(erf(exp(3) + x * log(4))));
   erf(20.0855369231876677409285296545817178969879078385544 + x * 1.3862943611198906188344642429163531361510002687205)

Example 2:

   > prec = 20!;
   > t = erf(0.5);
   > s = dirtysimplify(erf(0.5));
   > prec = 200!;
   > t;
   0.520499877813046537682746653891964528736451575757963700058806
   > s;
   0.52050018310546875
See also: simplify, autosimplify, prec, evaluate, horner, rationalmode
Go back to the list of commands

Name:

display sets or inspects the global variable specifying number notation

Library names:

void sollya_lib_set_display_and_print(sollya_obj_t) void sollya_lib_set_display(sollya_obj_t) sollya_obj_t sollya_lib_get_display()

Usage:

display = notation value : decimal|binary|dyadic|powers|hexadecimal -> void display = notation value ! : decimal|binary|dyadic|powers|hexadecimal -> void display : decimal|binary|dyadic|powers|hexadecimal

Parameters:

Description:

Example 1:

   > display = decimal;
   Display mode is decimal numbers.
   > a = evaluate(sin(pi * x), 0.25);
   > a;
   0.70710678118654752440084436210484903928483593768847
   > display = binary;
   Display mode is binary numbers.
   > a;
   1.01101010000010011110011001100111111100111011110011001001000010001011001011111011000100110110011011101010100101010111110100111110001110101101111011000001011101010001_2 * 2^(-1)
   > display = hexadecimal;
   Display mode is hexadecimal numbers.
   > a;
   0x1.6a09e667f3bcc908b2fb1366ea957d3e3adec1751p-1
   > display = dyadic;
   Display mode is dyadic numbers.
   > a;
   33070006991101558613323983488220944360067107133265b-165
   > display = powers;
   Display mode is dyadic numbers in integer-power-of-2 notation.
   > a;
   33070006991101558613323983488220944360067107133265 * 2^(-165)
See also: print, write, decimal, dyadic, powers, binary, hexadecimal, prec
Go back to the list of commands

Name:

div Computes the euclidian division of polynomials or numbers and returns the quotient

Library name:

sollya_obj_t sollya_lib_euclidian_div(sollya_obj_t, sollya_obj_t)

Usage:

div(a, b) : (function, function) -> function

Parameters:

Description:

Example 1:

   > div(1001, 231);
   4
   > div(13, 17);
   0
   > div(-14, 15);
   -1
   > div(-213, -5);
   42
   > div(23/13, 11/17);
   2
   > div(exp(13),-sin(17));
   460177

Example 2:

   > div(24 + 68 * x + 74 * x^2 + 39 * x^3 + 10 * x^4 + x^5, 4 + 4 * x + x^2);
   6 + x * (11 + x * (6 + x))
   > div(24 + 68 * x + 74 * x^2 + 39 * x^3 + 10 * x^4 + x^5, 2 * x^3);
   19.5 + x * (5 + x * 0.5)
   > div(x^2, x^3);
   0

Example 3:

   > div(exp(x), x^2);
   0
See also: gcd, mod, numberroots
Go back to the list of commands

Name:

/ division function

Library names:

sollya_obj_t sollya_lib_div(sollya_obj_t, sollya_obj_t) sollya_obj_t sollya_lib_build_function_div(sollya_obj_t, sollya_obj_t) #define SOLLYA_DIV(x,y) sollya_lib_build_function_div((x), (y))

Usage:

function1 / function2 : (function, function) -> function interval1 / interval2 : (range, range) -> range interval1 / constant : (range, constant) -> range interval1 / constant : (constant, range) -> range

Parameters:

Description:

Example 1:

   > 5 / 2;
   2.5

Example 2:

   > x / 2;
   x * 0.5

Example 3:

   > x / x;
   1

Example 4:

   > 3 / 0;
   NaN

Example 5:

   > diff(sin(x) / exp(x));
   (exp(x) * cos(x) - sin(x) * exp(x)) / exp(x)^2

Example 6:

   > [1;2] / [3;4];
   [0.25;0.66666666666666666666666666666666666666666666666668]
   > [1;2] / 17;
   [5.8823529411764705882352941176470588235294117647059e-2;0.11764705882352941176470588235294117647058823529412]
   > -13 / [4;17];
   [-3.25;-0.76470588235294117647058823529411764705882352941175]
See also: +, -, *, ^
Go back to the list of commands

Names:

double, D rounding to the nearest IEEE 754 double (binary64).

Library names:

sollya_obj_t sollya_lib_double(sollya_obj_t) sollya_obj_t sollya_lib_double_obj() int sollya_lib_is_double_obj(sollya_obj_t) sollya_obj_t sollya_lib_build_function_double(sollya_obj_t) #define SOLLYA_D(x) sollya_lib_build_function_double(x)

Description:

Example 1:

   > display=binary!;
   > D(0.1);
   1.100110011001100110011001100110011001100110011001101_2 * 2^(-4)
   > D(4.17);
   1.000010101110000101000111101011100001010001111010111_2 * 2^(2)
   > D(1.011_2 * 2^(-1073));
   1.1_2 * 2^(-1073)
See also: halfprecision, single, doubleextended, doubledouble, quad, tripledouble, roundcoefficients, implementpoly, round, printdouble
Go back to the list of commands

Names:

doubledouble, DD represents a number as the sum of two IEEE doubles.

Library names:

sollya_obj_t sollya_lib_double_double(sollya_obj_t) sollya_obj_t sollya_lib_double_double_obj() int sollya_lib_is_double_double_obj(sollya_obj_t) sollya_obj_t sollya_lib_build_function_double_double(sollya_obj_t) #define SOLLYA_DD(x) sollya_lib_build_function_double_double(x)

Description:

Example 1:

   > verbosity=1!;
   > a = 1+ 2^(-100);
   > DD(a);
   1.0000000000000000000000000000007888609052210118054
   > prec=50!;
   > DD(a);
   1.000000000000000000000000000000788860905
See also: halfprecision, single, double, doubleextended, quad, tripledouble, roundcoefficients, implementpoly, round
Go back to the list of commands

Names:

doubleextended, DE computes the nearest number with 64 bits of mantissa.

Library names:

sollya_obj_t sollya_lib_doubleextended(sollya_obj_t) sollya_obj_t sollya_lib_doubleextended_obj() int sollya_lib_is_doubleextended_obj(sollya_obj_t) sollya_obj_t sollya_lib_build_function_doubleextended(sollya_obj_t) #define SOLLYA_DE(x) sollya_lib_build_function_doubleextended(x)

Description:

Example 1:

   > display=binary!;
   > DE(0.1);
   1.100110011001100110011001100110011001100110011001100110011001101_2 * 2^(-4)
   > round(0.1,64,RN);
   1.100110011001100110011001100110011001100110011001100110011001101_2 * 2^(-4)

Example 2:

   > D(2^(-2000));
   0
   > DE(2^(-20000));
   0

Example 3:

   > verbosity=1!;
   > f = sin(DE(x));
   > f(pi);
   Warning: rounding has happened. The value displayed is a faithful rounding to 165 bits of the true result.
   -5.016557612668332023557327080330757013831561670255e-20
   > g = sin(round(x,64,RN));
   Warning: at least one of the given expressions or a subexpression is not correctly typed
   or its evaluation has failed because of some error on a side-effect.
See also: roundcoefficients, halfprecision, single, double, doubledouble, quad, tripledouble, round
Go back to the list of commands

Name:

dyadic special value for global state display

Library names:

sollya_obj_t sollya_lib_dyadic() int sollya_lib_is_dyadic(sollya_obj_t)

Description:

See also: decimal, powers, hexadecimal, binary, display
Go back to the list of commands

Name:

== equality test operator

Library name:

sollya_obj_t sollya_lib_cmp_equal(sollya_obj_t, sollya_obj_t)

Usage:

expr1 == expr2 : (any type, any type) -> boolean

Parameters:

Description:

Example 1:

   > "Hello" == "Hello";
   true
   > "Hello" == "Salut";
   false
   > "Hello" == 5;
   false
   > 5 + x == 5 + x;
   true

Example 2:

   > verbosity = 1!;
   > asin(1) * 2 == pi;
   true
   > cos(3)^2 == 1 - sin(3)^2;
   Warning: the tool is unable to decide an equality test by evaluation even though faithful evaluation of the terms has been possible. The terms will be considered to be equal.
   true
   > exp(5) == log(4);
   false

Example 3:

   > autosimplify=off;
   Automatic pure tree simplification has been deactivated.
   > exp(1+x) == exp(x+1);
   false
   > autosimplify=on;
   Automatic pure tree simplification has been activated.
   > exp(1+x) == exp(x+1);
   false
   > (1/3+x)^2 == x^2 + 1/9 + (5-3)*x/3;
   true
   > log(x)/log(10) == log10(x);
   false

Example 4:

   > prec = 12;
   The precision has been set to 12 bits.
   > verbosity = 1!;
   > 16384.1 == 16385.1;
   Warning: Rounding occurred when converting the constant "16384.1" to floating-point with 12 bits.
   If safe computation is needed, try to increase the precision.
   Warning: Rounding occurred when converting the constant "16385.1" to floating-point with 12 bits.
   If safe computation is needed, try to increase the precision.
   true
   > 16384 == 16384.25;
   false
   > 0.1 == 1/10;
   Warning: Rounding occurred when converting the constant "0.1" to floating-point with 12 bits.
   If safe computation is needed, try to increase the precision.
   false
   > 0.1 == round(1/10, prec, RN);
   Warning: Rounding occurred when converting the constant "0.1" to floating-point with 12 bits.
   If safe computation is needed, try to increase the precision.
   true

Example 5:

   > error == error;
   false
   > error != error;
   false
   > @NaN@ == @NaN@;
   false
   > @NaN@ != @NaN@;
   true
   > [@NaN@,@NaN@] == [@NaN@,@NaN@];
   false
   > [@NaN@,@NaN@] != [@NaN@,@NaN@];
   true
   > error == @NaN@;
   false
   > error != @NaN@;
   false
   > a = error;
   > match a with
     @NaN@ : ("a contains @NaN@")
     [@NaN@, @NaN@] : ("a contains [@NaN@, @NaN@]")
     default:("a contains something else");
   error
   > a = @NaN@;
   > match a with
     @NaN@ : ("a contains @NaN@")
     [@NaN@, @NaN@] : ("a contains [@NaN@, @NaN@]")
     default:("a contains something else");
   a contains @NaN@
   > a = [@NaN@, @NaN@];
   > match a with
     @NaN@ : ("a contains @NaN@")
     [@NaN@, @NaN@] : ("a contains [@NaN@, @NaN@]")
     default:("a contains something else");
   a contains [@NaN@, @NaN@]
See also: !=, >, >=, <=, <, in, !, &&, ||, error, prec, autosimplify
Go back to the list of commands

Name:

erfc the complementary error function.

Library names:

sollya_obj_t sollya_lib_erfc(sollya_obj_t) sollya_obj_t sollya_lib_build_function_erfc(sollya_obj_t) #define SOLLYA_ERFC(x) sollya_lib_build_function_erfc(x)

Description:

See also: erf
Go back to the list of commands

Name:

erf the error function.

Library names:

sollya_obj_t sollya_lib_erf(sollya_obj_t) sollya_obj_t sollya_lib_build_function_erf(sollya_obj_t) #define SOLLYA_ERF(x) sollya_lib_build_function_erf(x)

Description:

See also: erfc, exp
Go back to the list of commands

Name:

error expression representing an input that is wrongly typed or that cannot be executed

Library names:

sollya_obj_t sollya_lib_error() int sollya_lib_obj_is_error(sollya_obj_t)

Usage:

error : error

Description:

Example 1:

   > print(5 + "foo");
   error

Example 2:

   > error;
   error

Example 3:

   > error == error;
   false
   > error != error;
   false

Example 4:

   > correct = 5 + 6;
   > incorrect = 5 + "foo";
   > correct == correct;
   true
   > incorrect == incorrect;
   false
   > errorhappened = !(incorrect == incorrect);
   > errorhappened;
   true
See also: void, parse, ==, !=
Go back to the list of commands

Name:

evaluate evaluates a function at a constant point or in a range

Library name:

sollya_obj_t sollya_lib_evaluate(sollya_obj_t, sollya_obj_t)

Usage:

evaluate(function, constant) : (function, constant) -> constant | range evaluate(function, range) : (function, range) -> range evaluate(function, function2) : (function, function) -> function

Parameters:

Description:

Example 1:

   > midpointmode=on!;
   > print(evaluate(sin(pi * x), 2.25));
   0.70710678118654752440084436210484903928483593768847
   > print(evaluate(sin(pi * x), [2.25; 2.25]));
   0.707106781186547524400844362104849039284835937688~4/5~

Example 2:

   > print(evaluate(sin(pi * x), 2));
   [-3.100365765139897619749121887390789523854170596558e-13490;5.3002401585857127605350842426029223241500776302528e-13489]

Example 3:

   > print(evaluate(sin(pi * x), [2, 2.25]));
   [-5.143390272677254630046998919961912407349224165421e-50;0.70710678118654752440084436210484903928483593768866]

Example 4:

   > print(evaluate(sin(pi * x), 2 + 0.25 * x));
   sin((pi) * 2 + x * (pi) * 0.25)

Example 5:

   > print(evaluate(sin(pi * 1/x), 0));
   [-1;1]
See also: isevaluable
Go back to the list of commands

Name:

execute executes the content of a file

Library name:

void sollya_lib_execute(sollya_obj_t)

Usage:

execute(filename) : string -> void

Parameters:

Description:

Example 1:

   > a=2;
   > a;
   2
   > print("a=1;") > "example.sollya";
   > execute("example.sollya");
   > a;
   1

Example 2:

   > verbosity=1!;
   > print("a=1; restart; a=2;") > "example.sollya";
   > execute("example.sollya");
   Warning: a restart command has been used in a file read into another.
   This restart command will be neglected.
   > a;
   2

Example 3:

   > verbosity=1!;
   > print("a=1; quit; a=2;") > "example.sollya";
   > execute("example.sollya");
   Warning: the execution of a file read by execute demanded stopping the interpretation but it is not stopped.
   > a;
   1
See also: parse, readfile, write, print, bashexecute, quit, restart
Go back to the list of commands

Name:

expand expands polynomial subexpressions

Library name:

sollya_obj_t sollya_lib_expand(sollya_obj_t)

Usage:

expand(function) : function -> function

Parameters:

Description:

Example 1:

   > print(expand(x^3));
   x * x * x

Example 2:

   > print(expand((x + 2)^3 + 2 * x));
   8 + 12 * x + 6 * x * x + x * x * x + 2 * x

Example 3:

   > print(expand(exp((x + (x + 3))^5)));
   exp(243 + 405 * x + 270 * x * x + 90 * x * x * x + 15 * x * x * x * x + x * x * x * x * x + x * 405 + 108 * x * 5 * x + 54 * x * x * 5 * x + 12 * x * x * x * 5 * x + x * x * x * x * 5 * x + x * x * 270 + 27 * x * x * x * 10 + 9 * x * x * x * x * 10 + x * x * x * x * x * 10 + x * x * x * 90 + 6 * x * x * x * x * 10 + x * x * x * x * x * 10 + x * x * x * x * 5 * x + 15 * x * x * x * x + x * x * x * x * x)
See also: dirtysimplify, simplify, horner, coeff, degree
Go back to the list of commands

Name:

exp the exponential function.

Library names:

sollya_obj_t sollya_lib_exp(sollya_obj_t) sollya_obj_t sollya_lib_build_function_exp(sollya_obj_t) #define SOLLYA_EXP(x) sollya_lib_build_function_exp(x)

Description:

See also: exp, log
Go back to the list of commands

Name:

expm1 shifted exponential function.

Library names:

sollya_obj_t sollya_lib_expm1(sollya_obj_t) sollya_obj_t sollya_lib_build_function_expm1(sollya_obj_t) #define SOLLYA_EXPM1(x) sollya_lib_build_function_expm1(x)

Description:

See also: exp
Go back to the list of commands

Name:

exponent returns the scaled binary exponent of a number.

Library name:

sollya_obj_t sollya_lib_exponent(sollya_obj_t)

Usage:

exponent(x) : constant -> integer

Parameters:

Description:

Example 1:

   > a=round(Pi,20,RN);
   > e=exponent(a);
   > e;
   -17
   > m=mantissa(a);
   > a-m*2^e;
   0
See also: mantissa, precision
Go back to the list of commands

Name:

externalplot plots the error of an external code with regard to a function

Library names:

void sollya_lib_externalplot(sollya_obj_t, sollya_obj_t, sollya_obj_t,                              sollya_obj_t, sollya_obj_t, ...) void sollya_lib_v_externalplot(sollya_obj_t, sollya_obj_t, sollya_obj_t,                                sollya_obj_t, sollya_obj_t, va_list)

Usage:

externalplot(filename, mode, function, range, precision) : (string, absolute|relative, function, range, integer) -> void externalplot(filename, mode, function, range, precision, perturb) : (string, absolute|relative, function, range, integer, perturb) -> void externalplot(filename, mode, function, range, precision, plot mode, result filename) : (string, absolute|relative, function, range, integer, file|postscript|postscriptfile, string) -> void externalplot(filename, mode, function, range, precision, perturb, plot mode, result filename) : (string, absolute|relative, function, range, integer, perturb, file|postscript|postscriptfile, string) -> void

Description:

Example 1:

   > bashexecute("gcc -fPIC -c externalplotexample.c");
   > bashexecute("gcc -shared -o externalplotexample externalplotexample.o -lgmp -lmpfr");
   > externalplot("./externalplotexample",relative,exp(x),[-1/2;1/2],12,perturb);
See also: plot, asciiplot, perturb, absolute, relative, file, postscript, postscriptfile, bashexecute, externalproc, library
Go back to the list of commands

Name:

externalproc binds an external code to a Sollya procedure

Library names:

  sollya_obj_t sollya_lib_externalprocedure(sollya_externalprocedure_type_t,                                             sollya_externalprocedure_type_t *,                                             int, char *, void *);   sollya_obj_t sollya_lib_externalprocedure_with_data(                                             sollya_externalprocedure_type_t,                                             sollya_externalprocedure_type_t *,                                             int, char *, void *, void *,                                             void (*)(void *));

Usage:

externalproc(identifier, filename, argumenttype -> resulttype) : (identifier type, string, type type, type type) -> void

Parameters:

Description:

Example 1:

   > bashexecute("gcc -fPIC -Wall -c externalprocexample.c");
   > bashexecute("gcc -fPIC -shared -o externalprocexample externalprocexample.o");
   > externalproc(foo, "./externalprocexample", (integer, integer) -> integer);
   > foo;
   foo
   > foo(5, 6);
   11
   > verbosity = 1!;
   > foo();
   Warning: at least one of the given expressions or a subexpression is not correctly typed
   or its evaluation has failed because of some error on a side-effect.
   error
   > a = foo;
   > a(5,6);
   11
See also: library, libraryconstant, externalplot, bashexecute, void, constant, function, range, integer, string, boolean, list of
Go back to the list of commands

Name:

false the boolean value representing the false.

Library names:

sollya_obj_t sollya_lib_false() int sollya_lib_is_false(sollya_obj_t)

Description:

Example 1:

   > true && false;
   false
   > 2<1;
   false
See also: true, &&, ||
Go back to the list of commands

Name:

file special value for commands plot and externalplot

Library names:

sollya_obj_t sollya_lib_file() int sollya_lib_is_file(sollya_obj_t)

Description:

Example 1:

   > savemode=file;
   > name="plotSinCos";
   > plot(sin(x),0,cos(x),[-Pi,Pi],savemode, name);
See also: externalplot, plot, postscript, postscriptfile
Go back to the list of commands

Name:

findzeros gives a list of intervals containing all zeros of a function on an interval.

Library name:

sollya_obj_t sollya_lib_findzeros(sollya_obj_t, sollya_obj_t)

Usage:

findzeros(f,I) : (function, range) -> list

Parameters:

Description:

Example 1:

   > findzeros(sin(x),[-5;5]);
   [|[-3.14208984375;-3.140869140625], [-1.220703125e-3;1.220703125e-3], [3.140869140625;3.14208984375]|]
   > diam=1e-10!;
   > findzeros(sin(x),[-5;5]);
   [|[-3.14159265370108187198638916015625;-3.141592652536928653717041015625], [-1.16415321826934814453125e-9;1.16415321826934814453125e-9], [3.141592652536928653717041015625;3.14159265370108187198638916015625]|]
See also: dirtyfindzeros, infnorm, prec, diam, taylorrecursions, hopitalrecursions, numberroots
Go back to the list of commands

Name:

fixed indicates that fixed-point formats should be used for fpminimax

Library names:

sollya_obj_t sollya_lib_fixed() int sollya_lib_is_fixed(sollya_obj_t)

Usage:

fixed : fixed|floating

Description:

Example 1:

   > fpminimax(cos(x),6,[|32,32,32,32,32,32,32|],[-1;1],fixed);
   0.9999997480772435665130615234375 + x^2 * (-0.4999928693287074565887451171875 + x^2 * (4.163351492024958133697509765625e-2 + x^2 * (-1.338223926723003387451171875e-3)))
See also: fpminimax, floating
Go back to the list of commands

Name:

floating indicates that floating-point formats should be used for fpminimax

Library names:

sollya_obj_t sollya_lib_floating() int sollya_lib_is_floating(sollya_obj_t)

Usage:

floating : fixed|floating

Description:

Example 1:

   > fpminimax(cos(x),6,[|D...|],[-1;1],floating);
   0.99999974816012215939053930924274027347564697265625 + x * (-2.795931796958502334440230695107655659202089892465e-15 + x * (-0.49999286980201401719980935922649223357439041137695 + x * (4.0484539189054105169841244454207387920433372507922e-14 + x * (4.1633515528919168291466235132247675210237503051758e-2 + x * (-4.015858818743733758578949218474363725507386355118e-14 + x * (-1.3382240885483781024645200119493892998434603214264e-3))))))
See also: fpminimax, fixed
Go back to the list of commands

Name:

floor the usual function floor.

Library names:

sollya_obj_t sollya_lib_floor(sollya_obj_t) sollya_obj_t sollya_lib_build_function_floor(sollya_obj_t) #define SOLLYA_FLOOR(x) sollya_lib_build_function_floor(x)

Description:

See also: ceil, nearestint, round, RD
Go back to the list of commands

Name:

fpminimax computes a good polynomial approximation with fixed-point or floating-point coefficients

Library names:

sollya_obj_t sollya_lib_fpminimax(sollya_obj_t, sollya_obj_t, sollya_obj_t,                                   sollya_obj_t, ...) sollya_obj_t sollya_lib_v_fpminimax(sollya_obj_t, sollya_obj_t,                                     sollya_obj_t, sollya_obj_t, va_list)

Usage:

fpminimax(f, n, formats, range, indic1, indic2, indic3, P) : (function, integer, list, range, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, function) -> function fpminimax(f, monomials, formats, range, indic1, indic2, indic3, P) : (function, list, list, range, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, function) -> function fpminimax(f, n, formats, L, indic1, indic2, indic3, P) : (function, integer, list, list, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, function) -> function fpminimax(f, monomials, formats, L, indic1, indic2, indic3, P) : (function, list, list, list, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, function) -> function

Parameters:

Description:

Example 1:

   > P = fpminimax(cos(x),6,[|DD, DD, D...|],[-1b-5;1b-5]);
   > printexpansion(P);
   (0x3ff0000000000000 + 0xbc09fda15e029b00) + x * ((0x3af9eb57163024a8 + 0x37942c2f3f3e3839) + x * (0xbfdfffffffffff98 + x * (0xbbd1693f9c028849 + x * (0x3fa5555555145337 + x * (0x3c7a25f610ad9ebc + x * 0xbf56c138142da5b0)))))

Example 2:

   > P = fpminimax(sin(x),6,[|32...|],[-1b-5;1b-5], fixed, absolute);
   > display = powers!;
   > P;
   x * (1 + x^2 * (-357913941 * 2^(-31) + x^2 * (35789873 * 2^(-32))))

Example 3:

   > P = fpminimax(exp(x), [|3,4|], [|D,24|], [-1/256; 1/246], 1+x+x^2/2);
   > display = powers!;
   > P;
   1 + x * (1 + x * (1 * 2^(-1) + x * (375300225001191 * 2^(-51) + x * (5592621 * 2^(-27)))))

Example 4:

   > f = cos(exp(x));
   > pstar = remez(f, 5, [-1b-7;1b-7]);
   > listpoints = dirtyfindzeros(f-pstar, [-1b-7; 1b-7]);
   > P1 = fpminimax(f, 5, [|DD...|], listpoints, absolute, default, default, pstar);
   > P2 = fpminimax(f, 5, [|D...|], listpoints, absolute, default, default, pstar);
   > P3 = fpminimax(f, 5, [|D, D, D, 24...|], listpoints, absolute, default, default, pstar);
   > print("Error of pstar: ", dirtyinfnorm(f-pstar, [-1b-7; 1b-7]));
   Error of pstar:  7.9048441259903026332577436001060063099817726177425e-16
   > print("Error of P1:    ", dirtyinfnorm(f-P1, [-1b-7; 1b-7]));
   Error of P1:     7.9048441259903026580081299123420463921479618202064e-16
   > print("Error of P2:    ", dirtyinfnorm(f-P2, [-1b-7; 1b-7]));
   Error of P2:     8.2477144579950871737109573536791331686347620955985e-16
   > print("Error of P3:    ", dirtyinfnorm(f-P3, [-1b-7; 1b-7]));
   Error of P3:     1.08454277156993282593701156841863009789063333951055e-15

Example 5:

   > L = [|exp(x), sin(x), cos(x)-1, sin(x^3)|];
   > g = (2^x-1)/x;
   > p = fpminimax(g, L, [|D...|], [-1/16;1/16],absolute);
   > display = powers!;
   > p;
   -3267884797436153 * 2^(-54) * sin(x^3) + 5247089102535885 * 2^(-53) * (cos(x) - 1) + -8159095033730771 * 2^(-54) * sin(x) + 6243315658446641 * 2^(-53) * exp(x)

Example 6:

   > n = 9;
   > T = [|1, x|];
   > for i from 2 to n do T[i] = canonical(2*x*T[i-1]-T[i-2]);
   > g = (2^x-1)/x;
   > PCheb = fpminimax(g, T, [|DD,DE...|], [-1/16;1/16],absolute);
   > display = dyadic!;
   > print(PCheb);
   8733930098894247371b-98 * (9 * x + -120 * x^3 + 432 * x^5 + -576 * x^7 + 256 * x^9) + 15750497046710770365b-94 * (1 + -32 * x^2 + 160 * x^4 + -256 * x^6 + 128 * x^8) + 6467380330985872933b-88 * (-7 * x + 56 * x^3 + -112 * x^5 + 64 * x^7) + 9342762606926218927b-84 * (-1 + 18 * x^2 + -48 * x^4 + 32 * x^6) + 11814521367456461131b-80 * (5 * x + -20 * x^3 + 16 * x^5) + 6405479474328570593b-75 * (1 + -8 * x^2 + 8 * x^4) + 11584457324781949889b-72 * (-3 * x + 4 * x^3) + 16779705312447201161b-69 * (-1 + 2 * x^2) + 18265014280997359319b-66 * x + 117054497448175143902009975397253b-107
See also: remez, dirtyfindzeros, absolute, relative, fixed, floating, default, halfprecision, single, double, doubleextended, doubledouble, quad, tripledouble, implementpoly, coeff, degree, roundcoefficients, guessdegree
Go back to the list of commands

Name:

fullparentheses activates, deactivates or inspects the state variable controlling output with full parenthesising

Library names:

void sollya_lib_set_fullparentheses_and_print(sollya_obj_t); void sollya_lib_set_fullparentheses(sollya_obj_t); sollya_obj_t sollya_lib_get_fullparentheses();

Usage:

fullparentheses = activation value : on|off -> void fullparentheses = activation value ! : on|off -> void

Parameters:

Description:

Example 1:

   > autosimplify = off!;
   > fullparentheses = off;
   Full parentheses mode has been deactivated.
   > print(1 + 2 + 3);
   1 + 2 + 3
   > fullparentheses = on;
   Full parentheses mode has been activated.
   > print(1 + 2 + 3);
   (1 + 2) + 3
See also: print, write, autosimplify
Go back to the list of commands

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

Name:

gcd Computes the greatest common divisor of polynomials or numbers.

Library name:

sollya_obj_t sollya_lib_gcd(sollya_obj_t, sollya_obj_t)

Usage:

gcd(p, q) : (function, function) -> function

Parameters:

Description:

Example 1:

   > gcd(1001, 231);
   77
   > gcd(13, 17);
   1
   > gcd(-210, 462);
   42

Example 2:

   > rationalmode = on!;
   > gcd(6/7, 33/13);
   3 / 91

Example 3:

   > gcd(exp(13),sin(17));
   1

Example 4:

   > gcd(24 + 68 * x + 74 * x^2 + 39 * x^3 + 10 * x^4 + x^5, 480 + 776 * x + 476 * x^2 + 138 * x^3 + 19 * x^4 + x^5);
   4 + x * (4 + x)
   > gcd(1001 * x^2, 231 * x);
   x * 77

Example 5:

   > gcd(exp(x), x^2);
   1
See also: div, mod, numberroots
Go back to the list of commands

Name:

>= greater-than-or-equal-to operator

Library name:

sollya_obj_t sollya_lib_cmp_greater_equal(sollya_obj_t, sollya_obj_t)

Usage:

expr1 >= expr2 : (constant, constant) -> boolean

Parameters:

Description:

Example 1:

   > 5 >= 4;
   true
   > 5 >= 5;
   true
   > 5 >= 6;
   false
   > exp(2) >= exp(1);
   true
   > log(1) >= exp(2);
   false

Example 2:

   > prec = 12;
   The precision has been set to 12 bits.
   > 16384.1 >= 16385.1;
   true
See also: ==, !=, >, <=, <, in, !, &&, ||, prec, max, min
Go back to the list of commands

Name:

getbacktrace returns the list of Sollya procedures currently run

Library name:

sollya_obj_t sollya_lib_getbacktrace();

Usage:

getbacktrace() : void -> list

Description:

Example 1:

   > procedure testA() {
       "Current backtrace:";
       getbacktrace();
     };
   > procedure testB(X) {
       "X = ", X;
       testA();
     };
   > procedure testC(X, Y) {
       "X = ", X, ", Y = ", Y;
       testB(Y);
     };
   > testC(17, 42);
   X = 17, Y = 42
   X = 42
   Current backtrace:
   [|{ .passed_args = [| |], .called_proc = proc()
   {
   "Current backtrace:";
   getbacktrace();
   return void;
   } }, { .passed_args = [|42|], .called_proc = proc(X)
   {
   "X = ", X;
   testA();
   return void;
   } }, { .passed_args = [|17, 42|], .called_proc = proc(X, Y)
   {
   "X = ", X, ", Y = ", Y;
   testB(Y);
   return void;
   } }|]

Example 2:

   > getbacktrace();
   [| |]

Example 3:

   > procedure printnumargs(X) {
       var L, t;
       "number of arguments: ", X;
       L = getbacktrace();
       "Backtrace:";
       for t in L do {
         "  " @ objectname(t.called_proc) @ ", ", t.passed_args;
       };
     };
   > procedure numargs(l = ...) {
       "l[17] = ", l[17];
       printnumargs(length(l));
     };
   > procedure test() {
       numargs @ [|25, 26, 27 ...|];
     };
   > test();
   l[17] = 42
   number of arguments: infty
   Backtrace:
     printnumargs, [|infty|]
     numargs, [|25, 26, 27...|]
     test, [| |]
See also: proc, procedure, objectname, bind, @
Go back to the list of commands

Name:

getsuppressedmessages returns a list of numbers of messages that have been suppressed from message output

Library name:

sollya_obj_t sollya_lib_getsuppressedmessages();

Usage:

getsuppressedmessages() : void -> list

Description:

Example 1:

   > verbosity = 1;
   The verbosity level has been set to 1.
   > 0.1;
   Warning: Rounding occurred when converting the constant "0.1" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   0.1
   > suppressmessage(174);
   > 0.1;
   0.1
   > suppressmessage(407);
   > 0.1;
   0.1
   > getsuppressedmessages();
   [|174, 407|]
   > suppressmessage(207, 196);
   > getsuppressedmessages();
   [|174, 196, 207, 407|]

Example 2:

   > suppressmessage(174, 209, 13, 24, 196);
   > suppressmessage([| 16, 17 |]);
   > suppressmessage(19);
   > unsuppressmessage([| 13, 17 |]);
   > getsuppressedmessages();
   [|16, 19, 24, 174, 196, 209|]
   > unsuppressmessage(getsuppressedmessages());
   > getsuppressedmessages();
   [| |]

Example 3:

   > verbosity = 12;
   The verbosity level has been set to 12.
   > suppressmessage(174);
   > exp(x * 0.1);
   Information: no Horner simplification will be performed because the given tree is already in Horner form.
   exp(x * 0.1)
   > getsuppressedmessages();
   [|174|]
   > verbosity = 0;
   The verbosity level has been set to 0.
   > exp(x * 0.1);
   exp(x * 0.1)
   > getsuppressedmessages();
   [|174|]
See also: getsuppressedmessages, suppressmessage, unsuppressmessage, verbosity, roundingwarnings
Go back to the list of commands

Name:

> greater-than operator

Library name:

sollya_obj_t sollya_lib_cmp_greater(sollya_obj_t, sollya_obj_t)

Usage:

expr1 > expr2 : (constant, constant) -> boolean

Parameters:

Description:

Example 1:

   > 5 > 4;
   true
   > 5 > 5;
   false
   > 5 > 6;
   false
   > exp(2) > exp(1);
   true
   > log(1) > exp(2);
   false

Example 2:

   > prec = 12;
   The precision has been set to 12 bits.
   > 16385.1 > 16384.1;
   false
See also: ==, !=, >=, <=, <, in, !, &&, ||, prec, max, min
Go back to the list of commands

Name:

guessdegree returns the minimal degree needed for a polynomial to approximate a function with a certain error on an interval.

Library names:

sollya_obj_t sollya_lib_guessdegree(sollya_obj_t, sollya_obj_t,                                     sollya_obj_t, ...) sollya_obj_t sollya_lib_v_guessdegree(sollya_obj_t, sollya_obj_t,                                       sollya_obj_t, va_list)

Usage:

guessdegree(f,I,eps,w,bound) : (function, range, constant, function, constant) -> range

Parameters:

Description:

Example 1:

   > guessdegree(exp(x),[-1;1],1e-10);
   [10;10]

Example 2:

   > guessdegree(exp(x),[-1;1],1e-10,default, 9);
   [10;infty]

Example 3:

   > guessdegree(1, [-1;1], 1e-8, 1/exp(x));
   [8;9]
See also: dirtyinfnorm, remez, fpminimax, degree
Go back to the list of commands

Names:

halfprecision, HP rounding to the nearest IEEE 754 half-precision number (binary16).

Library names:

sollya_obj_t sollya_lib_halfprecision(sollya_obj_t) sollya_obj_t sollya_lib_halfprecision_obj() int sollya_lib_is_halfprecision_obj(sollya_obj_t) sollya_obj_t sollya_lib_build_function_halfprecision(sollya_obj_t) #define SOLLYA_HP(x) sollya_lib_build_function_halfprecision(x)

Description:

Example 1:

   > display=binary!;
   > HP(0.1);
   1.100110011_2 * 2^(-4)
   > HP(4.17);
   1.00001011_2 * 2^(2)
   > HP(1.011_2 * 2^(-23));
   1.1_2 * 2^(-23)
See also: single, double, doubleextended, doubledouble, quad, tripledouble, roundcoefficients, fpminimax, implementpoly, round, printsingle
Go back to the list of commands

Name:

hexadecimal special value for global state display

Library names:

sollya_obj_t sollya_lib_hexadecimal() int sollya_lib_is_hexadecimal(sollya_obj_t)

Description:

See also: decimal, dyadic, powers, binary, display
Go back to the list of commands

Name:

honorcoeffprec indicates the (forced) honoring the precision of the coefficients in implementpoly

Library names:

sollya_obj_t sollya_lib_honorcoeffprec() int sollya_lib_is_honorcoeffprec(sollya_obj_t)

Usage:

honorcoeffprec : honorcoeffprec

Description:

Example 1:

   > verbosity = 1!;
   > q = implementpoly(1 - dirtysimplify(TD(1/6)) * x^2,[-1b-10;1b-10],1b-60,DD,"p","implementation.c");
   Warning: at least one of the coefficients of the given polynomial has been rounded in a way
   that the target precision can be achieved at lower cost. Nevertheless, the implemented polynomial
   is different from the given one.
   > printexpansion(q);
   0x3ff0000000000000 + x^2 * 0xbfc5555555555555
   > r = implementpoly(1 - dirtysimplify(TD(1/6)) * x^2,[-1b-10;1b-10],1b-60,DD,"p","implementation.c",honorcoeffprec);
   Warning: the inferred precision of the 2th coefficient of the polynomial is greater than
   the necessary precision computed for this step. This may make the automatic determination
   of precisions useless.
   > printexpansion(r);
   0x3ff0000000000000 + x^2 * (0xbfc5555555555555 + 0xbc65555555555555 + 0xb905555555555555)
See also: implementpoly, printexpansion, fpminimax
Go back to the list of commands

Name:

hopitalrecursions controls the number of recursion steps when applying L'Hopital's rule.

Library names:

void sollya_lib_set_hopitalrecursions_and_print(sollya_obj_t) void sollya_lib_set_hopitalrecursions(sollya_obj_t) sollya_obj_t sollya_lib_get_hopitalrecursions()

Usage:

hopitalrecursions = n : integer -> void hopitalrecursions = n ! : integer -> void hopitalrecursions : integer

Parameters:

Description:

Example 1:

   > hopitalrecursions=0;
   The number of recursions for Hopital's rule has been set to 0.
   > evaluate(log(1+x)^2/x^2,[-1/2; 1]);
   [-infty;infty]
   > hopitalrecursions=1;
   The number of recursions for Hopital's rule has been set to 1.
   > evaluate(log(1+x)^2/x^2,[-1/2; 1]);
   [-2.5225887222397812376689284858327062723020005374411;6.7725887222397812376689284858327062723020005374412]
See also: taylorrecursions, infnorm, findzeros, evaluate
Go back to the list of commands

Name:

horner brings all polynomial subexpressions of an expression to Horner form

Library name:

sollya_obj_t sollya_lib_horner(sollya_obj_t)

Usage:

horner(function) : function -> function

Parameters:

Description:

Example 1:

   > print(horner(1 + 2 * x + 3 * x^2));
   1 + x * (2 + x * 3)
   > print(horner((x + 1)^7));
   1 + x * (7 + x * (21 + x * (35 + x * (35 + x * (21 + x * (7 + x))))))

Example 2:

   > print(horner(exp((x + 1)^5) - log(asin(x + x^3) + x)));
   exp(1 + x * (5 + x * (10 + x * (10 + x * (5 + x))))) - log(asin(x * (1 + x^2)) + x)
See also: canonical, print, coeff, degree, autosimplify, simplify
Go back to the list of commands

Name:

HP short form for halfprecision
See also: halfprecision
Go back to the list of commands

Name:

implementconstant implements a constant in arbitrary precision

Library names:

void sollya_lib_implementconstant(sollya_obj_t, ...); void sollya_lib_v_implementconstant(sollya_obj_t, va_list);

Usage:

implementconstant(expr) : constant -> void implementconstant(expr,filename) : (constant, string) -> void implementconstant(expr,filename,functionname) : (constant, string, string) -> void

Description:

Example 1:

   > implementconstant(exp(1)+log(2)/sqrt(1/10));
                   [ The first 100 lines of the output have been removed ]
       modify or redistribute this generated code itself, or its skeleton,
       you may (at your option) remove this special exception, which will
       cause this generated code and its skeleton and the resulting Sollya
       output files to be licensed under the CeCILL-C licence without this
       special exception.
       
       This special exception was added by the Sollya copyright holders in
       version 4.1 of Sollya.
       
   */
   
   
   #include <mpfr.h>
   
   void
   const_something (mpfr_ptr y, mp_prec_t prec)
   {
     /* Declarations */
     mpfr_t tmp1;
     mpfr_t tmp2;
     mpfr_t tmp3;
     mpfr_t tmp4;
     mpfr_t tmp5;
     mpfr_t tmp6;
     mpfr_t tmp7;
   
     /* Initializations */
     mpfr_init2 (tmp2, prec+5);
     mpfr_init2 (tmp1, prec+3);
     mpfr_init2 (tmp4, prec+8);
     mpfr_init2 (tmp3, prec+7);
     mpfr_init2 (tmp6, prec+11);
     mpfr_init2 (tmp7, prec+11);
     mpfr_init2 (tmp5, prec+11);
   
     /* Core */
     mpfr_set_prec (tmp2, prec+4);
     mpfr_set_ui (tmp2, 1, MPFR_RNDN);
     mpfr_set_prec (tmp1, prec+3);
     mpfr_exp (tmp1, tmp2, MPFR_RNDN);
     mpfr_set_prec (tmp4, prec+8);
     mpfr_set_ui (tmp4, 2, MPFR_RNDN);
     mpfr_set_prec (tmp3, prec+7);
     mpfr_log (tmp3, tmp4, MPFR_RNDN);
     mpfr_set_prec (tmp6, prec+11);
     mpfr_set_ui (tmp6, 1, MPFR_RNDN);
     mpfr_set_prec (tmp7, prec+11);
     mpfr_set_ui (tmp7, 10, MPFR_RNDN);
     mpfr_set_prec (tmp5, prec+11);
     mpfr_div (tmp5, tmp6, tmp7, MPFR_RNDN);
     mpfr_set_prec (tmp4, prec+7);
     mpfr_sqrt (tmp4, tmp5, MPFR_RNDN);
     mpfr_set_prec (tmp2, prec+5);
     mpfr_div (tmp2, tmp3, tmp4, MPFR_RNDN);
     mpfr_set_prec (y, prec+3);
     mpfr_add (y, tmp1, tmp2, MPFR_RNDN);
   
     /* Cleaning stuff */
     mpfr_clear(tmp1);
     mpfr_clear(tmp2);
     mpfr_clear(tmp3);
     mpfr_clear(tmp4);
     mpfr_clear(tmp5);
     mpfr_clear(tmp6);
     mpfr_clear(tmp7);
   }

Example 2:

   > implementconstant(sin(13/17),"sine_of_thirteen_seventeenth.c");
   > bashevaluate("tail -n 30 sine_of_thirteen_seventeenth.c");
   #include <mpfr.h>
   
   void
   const_something (mpfr_ptr y, mp_prec_t prec)
   {
     /* Declarations */
     mpfr_t tmp1;
     mpfr_t tmp2;
     mpfr_t tmp3;
   
     /* Initializations */
     mpfr_init2 (tmp2, prec+6);
     mpfr_init2 (tmp3, prec+6);
     mpfr_init2 (tmp1, prec+6);
   
     /* Core */
     mpfr_set_prec (tmp2, prec+6);
     mpfr_set_ui (tmp2, 13, MPFR_RNDN);
     mpfr_set_prec (tmp3, prec+6);
     mpfr_set_ui (tmp3, 17, MPFR_RNDN);
     mpfr_set_prec (tmp1, prec+6);
     mpfr_div (tmp1, tmp2, tmp3, MPFR_RNDN);
     mpfr_set_prec (y, prec+2);
     mpfr_sin (y, tmp1, MPFR_RNDN);
   
     /* Cleaning stuff */
     mpfr_clear(tmp1);
     mpfr_clear(tmp2);
     mpfr_clear(tmp3);
   }

Example 3:

   > implementconstant(asin(1/3 * pi),default,"arcsin_of_one_third_pi");
                   [ The first 100 lines of the output have been removed ]
       modify or redistribute this generated code itself, or its skeleton,
       you may (at your option) remove this special exception, which will
       cause this generated code and its skeleton and the resulting Sollya
       output files to be licensed under the CeCILL-C licence without this
       special exception.
       
       This special exception was added by the Sollya copyright holders in
       version 4.1 of Sollya.
       
   */
   
   
   #include <mpfr.h>
   
   void
   arcsin_of_one_third_pi (mpfr_ptr y, mp_prec_t prec)
   {
     /* Declarations */
     mpfr_t tmp1;
     mpfr_t tmp2;
     mpfr_t tmp3;
   
     /* Initializations */
     mpfr_init2 (tmp2, prec+8);
     mpfr_init2 (tmp3, prec+8);
     mpfr_init2 (tmp1, prec+8);
   
     /* Core */
     mpfr_set_prec (tmp2, prec+8);
     mpfr_const_pi (tmp2, MPFR_RNDN);
     mpfr_set_prec (tmp3, prec+8);
     mpfr_set_ui (tmp3, 3, MPFR_RNDN);
     mpfr_set_prec (tmp1, prec+8);
     mpfr_div (tmp1, tmp2, tmp3, MPFR_RNDN);
     mpfr_set_prec (y, prec+2);
     mpfr_asin (y, tmp1, MPFR_RNDN);
   
     /* Cleaning stuff */
     mpfr_clear(tmp1);
     mpfr_clear(tmp2);
     mpfr_clear(tmp3);
   }

Example 4:

   > implementconstant(ceil(log(19 + 1/3)),"constant_code.c","magic_constant");
   > bashevaluate("tail -n -9 constant_code.c");
   void
   magic_constant (mpfr_ptr y, mp_prec_t prec)
   {
     /* Initializations */
   
     /* Core */
     mpfr_set_prec (y, prec);
     mpfr_set_ui (y, 3, MPFR_RNDN);
   }

Example 5:

   > bashexecute("gcc -fPIC -Wall -c libraryconstantexample.c -I$HOME/.local/include");
   > bashexecute("gcc -shared -o libraryconstantexample libraryconstantexample.o -lgmp -lmpfr");
   > euler_gamma = libraryconstant("./libraryconstantexample");
   > implementconstant(euler_gamma^(1/3), "euler.c");
   > bashevaluate("tail -n -17 euler.c");
   void
   const_something (mpfr_ptr y, mp_prec_t prec)
   {
     /* Declarations */
     mpfr_t tmp1;
   
     /* Initializations */
     mpfr_init2 (tmp1, prec+1);
   
     /* Core */
     euler_gamma (tmp1, prec+1);
     mpfr_set_prec (y, prec+2);
     mpfr_root (y, tmp1, 3, MPFR_RNDN);
   
     /* Cleaning stuff */
     mpfr_clear(tmp1);
   }
See also: implementpoly, libraryconstant, library, function, bashevaluate
Go back to the list of commands

Name:

implementpoly implements a polynomial using double, double-double and triple-double arithmetic and generates a Gappa proof

Library names:

sollya_obj_t sollya_lib_implementpoly(sollya_obj_t, sollya_obj_t,                                       sollya_obj_t, sollya_obj_t,                                       sollya_obj_t, sollya_obj_t, ...) sollya_obj_t sollya_lib_v_implementpoly(sollya_obj_t, sollya_obj_t,                                         sollya_obj_t, sollya_obj_t,                                         sollya_obj_t, sollya_obj_t, va_list)

Usage:

implementpoly(polynomial, range, error bound, format, functionname, filename) : (function, range, constant, D|double|DD|doubledouble|TD|tripledouble, string, string) -> function implementpoly(polynomial, range, error bound, format, functionname, filename, honor coefficient precisions) : (function, range, constant, D|double|DD|doubledouble|TD|tripledouble, string, string, honorcoeffprec) -> function implementpoly(polynomial, range, error bound, format, functionname, filename, proof filename) : (function, range, constant, D|double|DD|doubledouble|TD|tripledouble, string, string, string) -> function implementpoly(polynomial, range, error bound, format, functionname, filename, honor coefficient precisions, proof filename) : (function, range, constant, D|double|DD|doubledouble|TD|tripledouble, string, string, honorcoeffprec, string) -> function

Description:

Example 1:

   > implementpoly(1 - 1/6 * x^2 + 1/120 * x^4, [-1b-10;1b-10], 1b-30, D, "p","implementation.c");
   1 + x^2 * (-0.166666666666666657414808128123695496469736099243164 + x^2 * 8.3333333333333332176851016015461937058717012405396e-3)
   > bashevaluate("tail -n -29 implementation.c");
   #define p_coeff_0h 1.00000000000000000000000000000000000000000000000000000000000000000000000000000000e+00
   #define p_coeff_2h -1.66666666666666657414808128123695496469736099243164062500000000000000000000000000e-01
   #define p_coeff_4h 8.33333333333333321768510160154619370587170124053955078125000000000000000000000000e-03
   
   
   void p(double *p_resh, double x) {
   double p_x_0_pow2h;
   
   
   p_x_0_pow2h = x * x;
   
   
   double p_t_1_0h;
   double p_t_2_0h;
   double p_t_3_0h;
   double p_t_4_0h;
   double p_t_5_0h;
    
   
   
   p_t_1_0h = p_coeff_4h;
   p_t_2_0h = p_t_1_0h * p_x_0_pow2h;
   p_t_3_0h = p_coeff_2h + p_t_2_0h;
   p_t_4_0h = p_t_3_0h * p_x_0_pow2h;
   p_t_5_0h = p_coeff_0h + p_t_4_0h;
   *p_resh = p_t_5_0h;
   
   
   }

Example 2:

   > implementpoly(1 - 1/6 * x^2 + 1/120 * x^4, [-1b-10;1b-10], 1b-30, D, "p","implementation.c","implementation.gappa");
   1 + x^2 * (-0.166666666666666657414808128123695496469736099243164 + x^2 * 8.3333333333333332176851016015461937058717012405396e-3)

Example 3:

   > verbosity = 1!;
   > q = implementpoly(1 - dirtysimplify(TD(1/6)) * x^2,[-1b-10;1b-10],1b-60,DD,"p","implementation.c");
   Warning: at least one of the coefficients of the given polynomial has been rounded in a way
   that the target precision can be achieved at lower cost. Nevertheless, the implemented polynomial
   is different from the given one.
   > printexpansion(q);
   0x3ff0000000000000 + x^2 * 0xbfc5555555555555
   > r = implementpoly(1 - dirtysimplify(TD(1/6)) * x^2,[-1b-10;1b-10],1b-60,DD,"p","implementation.c",honorcoeffprec);
   Warning: the inferred precision of the 2th coefficient of the polynomial is greater than
   the necessary precision computed for this step. This may make the automatic determination
   of precisions useless.
   > printexpansion(r);
   0x3ff0000000000000 + x^2 * (0xbfc5555555555555 + 0xbc65555555555555 + 0xb905555555555555)

Example 4:

   > p = 0x3ff0000000000000 + x * (0x3ff0000000000000 + x * (0x3fe0000000000000 + x * (0x3fc5555555555559 + x * (0x3fa55555555555bd + x * (0x3f811111111106e2 + x * (0x3f56c16c16bf5eb7 + x * (0x3f2a01a01a292dcd + x * (0x3efa01a0218a016a + x * (0x3ec71de360331aad + x * (0x3e927e42e3823bf3 + x * (0x3e5ae6b2710c2c9a + x * (0x3e2203730c0a7c1d + x * 0x3de5da557e0781df))))))))))));
   > q = implementpoly(p,[-1/2;1/2],1b-60,D,"p","implementation.c",honorcoeffprec,"implementation.gappa");
   > if (q != p) then print("During implementation, rounding has happened.") else print("Polynomial implemented as given.");
   Polynomial implemented as given.
See also: honorcoeffprec, roundcoefficients, double, doubledouble, tripledouble, bashevaluate, printexpansion, error, remez, fpminimax, taylor, implementconstant
Go back to the list of commands

Name:

inf gives the lower bound of an interval.

Library name:

sollya_obj_t sollya_lib_inf(sollya_obj_t)

Usage:

inf(I) : range -> constant inf(x) : constant -> constant

Parameters:

Description:

Example 1:

   > inf([1;3]);
   1
   > inf(0);
   0

Example 2:

   > display=binary!;
   > I=[0.111110000011111_2; 1];
   > inf(I);
   1.11110000011111_2 * 2^(-1)
   > prec=12!;
   > inf(I);
   1.11110000011111_2 * 2^(-1)
See also: mid, sup, max, min
Go back to the list of commands

Name:

infnorm computes an interval bounding the infinity norm of a function on an interval.

Library names:

sollya_obj_t sollya_lib_infnorm(sollya_obj_t, sollya_obj_t, ...) sollya_obj_t sollya_lib_v_infnorm(sollya_obj_t, sollya_obj_t, va_list)

Usage:

infnorm(f,I,filename,Ilist) : (function, range, string, list) -> range

Parameters:

Description:

Example 1:

   > infnorm(exp(x),[-2;3]);
   [20.085536923187667740928529654581717896987907838554;20.0855369231876677409285296545817178969879078385544]

Example 2:

   > infnorm(exp(x),[-2;3],"proof.txt");
   [20.085536923187667740928529654581717896987907838554;20.0855369231876677409285296545817178969879078385544]

Example 3:

   > infnorm(exp(x),[-2;3],[| [0;1], [2;2.5] |]);
   [20.085536923187667740928529654581717896987907838554;20.0855369231876677409285296545817178969879078385544]

Example 4:

   > infnorm(exp(x),[-2;3],"proof.txt", [| [0;1], [2;2.5] |]);
   [20.085536923187667740928529654581717896987907838554;20.0855369231876677409285296545817178969879078385544]

Example 5:

   > infnorm(exp(x),[1;1]);
   [2.7182818284590452353602874713526624977572470936999;2.7182818284590452353602874713526624977572470937]

Example 6:

   > infnorm(exp(x), [log(0);log(1)]);
   [0;infty]
See also: prec, diam, hopitalrecursions, taylorrecursions, dirtyinfnorm, checkinfnorm, supnorm, findzeros, diff, taylorrecursions, autodiff, numberroots, taylorform
Go back to the list of commands

Name:

in containment test operator

Library name:

sollya_obj_t sollya_lib_cmp_in(sollya_obj_t, sollya_obj_t)

Usage:

expr in range1 : (constant, range) -> boolean range1 in range2 : (range, range) -> boolean

Parameters:

Description:

Example 1:

   > 5 in [-4;7];
   true
   > 4 in [-1;1];
   false
   > 0 in sin([-17;17]);
   true

Example 2:

   > [5;7] in [2;8];
   true
   > [2;3] in [4;5];
   false
   > [2;3] in [2.5;5];
   false

Example 3:

   > for i in [|1,...,5|] do print(i);
   1
   2
   3
   4
   5
See also: ==, !=, >=, >, <=, <, !, &&, ||, prec, print
Go back to the list of commands

Name:

integer keyword representing a machine integer type

Library name:

SOLLYA_EXTERNALPROC_TYPE_INTEGER

Usage:

integer : type type

Description:

See also: externalproc, boolean, constant, function, list of, range, string, object
Go back to the list of commands

Name:

integral computes an interval bounding the integral of a function on an interval.

Library name:

sollya_obj_t sollya_lib_integral(sollya_obj_t, sollya_obj_t)

Usage:

integral(f,I) : (function, range) -> range

Parameters:

Description:

Example 1:

   > sin(10);
   -0.54402111088936981340474766185137728168364301291622
   > integral(cos(x),[0;10]);
   [-0.54710197983579690224097637163525943075698599257333;-0.54094015130013183848150540881373370744053741191729]
   > diam=1e-5!;
   > integral(cos(x),[0;10]);
   [-0.54432915685955427101857780295936956775293876382777;-0.54371306401249969508039644221927489010425803173555]
See also: diam, dirtyintegral, prec
Go back to the list of commands

Name:

interpolate computes an interpolation polynomial.

Library names:

sollya_obj_t sollya_lib_interpolate(sollya_obj_t, sollya_obj_t, ...) sollya_obj_t sollya_lib_v_interpolate(sollya_obj_t, sollya_obj_t, va_list)

Usage:

interpolate(X, Y) : (list, list) -> function interpolate(X, Y, D) : (list, list, constant) -> function interpolate(X, Y, D, I) : (list, list, constant, range) -> function interpolate(X, f) : (list, function) -> function interpolate(X, f, D) : (list, function, constant) -> function interpolate(X, f, D, I) : (list, function, constant, range) -> function

Parameters:

Description:

Example 1:

   > p = interpolate([| 1, 2, 3 |], [| 3, 5, 9 |]);
   > write("p = ", p, "\n");
   p = 3 + _x_ * (-1 + _x_)

Example 2:

   > p = interpolate([| 1, 2, 3, 4 |], [| 1, -1, 2, -3 |]);
   > write("p = ", p, "\n");
   p = 21 + _x_ * (-100 / 3 + _x_ * (15.5 + _x_ * -13 / 6))
   > p = interpolate([| 1, 2, 3, 4 |], [| 1, -1, 2, -3 |], 2^-17);
   > write("p = ", p, "\n");
   p = 21 + _x_ * (-33.33333301544189453125 + _x_ * (15.5 + _x_ * (-2.16666662693023681640625)))
   > p = interpolate([| 1, 2, 3, 4 |], [| 1, -1, 2, -3 |], 2^-17, [0; 2^42]);
   > write("p = ", p, "\n");
   p = 21 + _x_ * (-33.33333333333333333347789362299806725786766037345 + _x_ * (15.5 + _x_ * (-2.1666666666666666666666666666666666666666666591931)))

Example 3:

   > p = interpolate([| 1, 2, 3, 4 |], [| 1, -1, 2, -3 |]);
   > q = interpolate([| 1, 2, 3, 4 |], [| 1, -1, 2, -3 |], 2^-17);
   > delta = horner(p - q);
   > write("delta = ", delta, "\n");
   delta = _x_ * (-1 / 3145728 + _x_^2 * -1 / 25165824)
   > Delta = dirtyinfnorm(delta,[1;4]);
   > "Delta = ", Delta, " = 2^(", log2(Delta), ")";
   Delta = 3.814697265625e-6 = 2^(-18)
   > p = interpolate([| 1, 2, 3, 4 |], [| 1, -1, 2, -3 |]);
   > q = interpolate([| 1, 2, 3, 4 |], [| 1, -1, 2, -3 |], 2^-2000);
   > delta = horner(p - q);
   > write("delta = ", delta, "\n");
   delta = _x_ * (1 / 2.7555136686582108581587996828264367616535624850129e603 + _x_^2 * 1 / 2.2044109349265686865270397462611494093228499880103e604)
   > Delta = dirtyinfnorm(delta,[1;4]);
   > "Delta = ", Delta, " = 2^(", log2(Delta), ")";
   Delta = 4.3549049081086083377880977473894361479295518713527e-603 = 2^(-2001)

Example 4:

   > p = interpolate([| 1, 2, 3, 4 |], [| 1, -1, 2, -3 |]);
   > q = interpolate([| 1, 2, 3, 4 |], [| 1, -1, 2, -3 |], 2^-17, [0;2^10]);
   > delta = horner(p - q);
   > write("delta = ", delta, "\n");
   delta = _x_ * (1 / 1610612736 + _x_^2 * -1 / 1688849860263936)
   > Delta = dirtyinfnorm(delta,[0;2^10]);
   > "Delta = ", Delta, " = 2^(", log2(Delta), ")";
   Delta = 2.4471294368728034316556666925301338011322095712879e-7 = 2^(-21.962406251802890453634347359869541271899536019231)
   > p = interpolate([| 1, 2, 3, 4 |], [| 1, -1, 2, -3 |]);
   > q = interpolate([| 1, 2, 3, 4 |], [| 1, -1, 2, -3 |], 2^-2000, [0;2^10]);
   > delta = horner(p - q);
   > write("delta = ", delta, "\n");
   delta = _x_ * (-1 / 1.4108229983530039593773054376071356219666239923266e606 + _x_^2 * 1 / 1.47935513632099947970801742654433984193927471937785e612)
   > Delta = dirtyinfnorm(delta,[0;2^10]);
   > "Delta = ", Delta, " = 2^(", log2(Delta), ")";
   Delta = 2.7936728011019194195581558596099001590721546862147e-604 = 2^(-2004.9624062518028904536343473598695412718995360192)

Example 5:

   > p = interpolate([| 1, 2, 3, 4 |], 17 + _x_ * (42 + _x_ * (23 + _x_ * 1664)));
   > write("p = ", p, "\n");
   p = 17 + _x_ * (42 + _x_ * (23 + _x_ * 1664))

Example 6:

   > p = interpolate([| 1, 2, 3, 4 |], exp(_x_));
   > write("p = ", p, "\n");
   p = -1 * (-2 * (-3 * ((exp(4) - exp(3) - (exp(3) - exp(2))) / 2 - (exp(3) - exp(2) - (exp(2) - exp(1))) / 2) / 3 + (exp(3) - exp(2) - (exp(2) - exp(1))) / 2) + exp(2) - exp(1)) + exp(1) + _x_ * (-1 * (-2 * ((exp(4) - exp(3) - (exp(3) - exp(2))) / 2 - (exp(3) - exp(2) - (exp(2) - exp(1))) / 2) / 3 + -3 * ((exp(4) - exp(3) - (exp(3) - exp(2))) / 2 - (exp(3) - exp(2) - (exp(2) - exp(1))) / 2) / 3 + (exp(3) - exp(2) - (exp(2) - exp(1))) / 2) + -2 * (-3 * ((exp(4) - exp(3) - (exp(3) - exp(2))) / 2 - (exp(3) - exp(2) - (exp(2) - exp(1))) / 2) / 3 + (exp(3) - exp(2) - (exp(2) - exp(1))) / 2) + exp(2) - exp(1) + _x_ * (-1 * ((exp(4) - exp(3) - (exp(3) - exp(2))) / 2 - (exp(3) - exp(2) - (exp(2) - exp(1))) / 2) / 3 + -2 * ((exp(4) - exp(3) - (exp(3) - exp(2))) / 2 - (exp(3) - exp(2) - (exp(2) - exp(1))) / 2) / 3 + -3 * ((exp(4) - exp(3) - (exp(3) - exp(2))) / 2 - (exp(3) - exp(2) - (exp(2) - exp(1))) / 2) / 3 + (exp(3) - exp(2) - (exp(2) - exp(1))) / 2 + _x_ * ((exp(4) - exp(3) - (exp(3) - exp(2))) / 2 - (exp(3) - exp(2) - (exp(2) - exp(1))) / 2) / 3))
   > p = interpolate([| 1, 2, 3, 4 |], exp(_x_), 2^-17);
   > write("p = ", p, "\n");
   p = -7.71721172332763671875 + _x_ * (17.914661407470703125 + _x_ * (-9.77757251262664794921875 + _x_ * 2.298404276371002197265625))
   > p = interpolate([| 1, 2, 3, 4 |], exp(_x_), 2^-17, [0; 2^42]);
   > write("p = ", p, "\n");
   p = -7.71721172332763671875 + _x_ * (17.9146616149694119287522076078289501310791820287704 + _x_ * (-9.777572455021435040741686047095908782922898736377 + _x_ * 2.2984042886523568836092778582480142756017855238293))

Example 7:

   > p = interpolate([| 1, 2, 3, 4 |], exp(_x_));
   > q = interpolate([| 1, 2, 3, 4 |], exp(_x_), 2^-17);
   > delta = horner(p - q);
   > Delta = dirtyinfnorm(delta,[1;4]);
   > "Delta = ", Delta, " = 2^(", log2(Delta), ")";
   Delta = 2.64087128985936026120286087840279073703861406872586e-6 = 2^(-18.5305545798246903139105523606201676108779913563466)
   > p = interpolate([| 1, 2, 3, 4 |], exp(_x_));
   > q = interpolate([| 1, 2, 3, 4 |], exp(_x_), 2^-2000);
   > delta = horner(p - q);
   > Delta = dirtyinfnorm(delta,[1;4]);
   > "Delta = ", Delta, " = 2^(", log2(Delta), ")";
   Delta = 1.4590823977486192906712389246433732155807613636698e-603 = 2^(-2002.5775798592063632271660191460324647977792574035)

Example 8:

   > p = interpolate([| 1, 2, 3, 4 |], exp(_x_));
   > q = interpolate([| 1, 2, 3, 4 |], exp(_x_), 2^-17, [0;2^10]);
   > delta = horner(p - q);
   > Delta = dirtyinfnorm(delta,[0;2^10]);
   > "Delta = ", Delta, " = 2^(", log2(Delta), ")";
   Delta = 4.75462940203480522770747218406076244573282695611e-7 = 2^(-21.0041637691158024834926102190382130962658000640866)
   > p = interpolate([| 1, 2, 3, 4 |], exp(_x_));
   > q = interpolate([| 1, 2, 3, 4 |], exp(_x_), 2^-2000, [0;2^10]);
   > delta = horner(p - q);
   > Delta = dirtyinfnorm(delta,[0;2^10]);
   > "Delta = ", Delta, " = 2^(", log2(Delta), ")";
   Delta = 9.0435150205780172429401306949628326405643331478968e-604 = 2^(-2003.2676856856633076178139050354211927790570412987)

Example 9:

   > f = exp(_x_);
   > I = [-1/2;1/2];
   > n = 17;
   > X = [||]; for i from 0 to n do X = (~(1/2 * (inf(I) + sup(I)) + 1/2 * (sup(I) - inf(I)) * cos(pi * ((2 * i + 1)/(2 * (n + 1)))))) .: X; X = revert(X);
   > p = interpolate(X, f, 2^-110);
   > q = remez(f, n, I);
   > Delta = dirtyinfnorm(p-f,I);
   > "||p-f|| = ", Delta, " = 2^(", log2(Delta), ")";
   ||p-f|| = 4.682282321340942778487515892686081216293095411976e-27 = 2^(-87.464846636624845038438119985399853470805747522283)
   > Delta = dirtyinfnorm(q-f,I);
   > "||q-f|| = ", Delta, " = 2^(", log2(Delta), ")";
   ||q-f|| = 4.5615560104462964431174181483603567519672456911095e-27 = 2^(-87.502532530192383004694428978646385337892102159012)
   > Delta = dirtyinfnorm(horner(p-q),I);
   > "||p-q|| = ", Delta, " = 2^(", log2(Delta), ")";
   ||p-q|| = 1.20729158377808689215008324924110505247080203008044e-28 = 2^(-92.742212500498778529126446648943330421384492990147)

Example 10:

   > interpolate([| 1, 1 + 2^-1000 |], 17 + 42 * x);
   17 + x * 42
   > interpolate([| 1, 1 + 2^-10000 |], 17 + 42 * x);
   17 + x * 42
   > interpolate([| 1, 1 |], 17 + 42 * x);
   error
See also: remez, dirtyinfnorm, supnorm, prec, error
Go back to the list of commands

Name:

isbound indicates whether a variable is bound or not.

Usage:

isbound(ident) : boolean

Parameters:

Description:

Example 1:

   > isbound(x);
   false
   > isbound(f);
   false
   > isbound(g);
   false
   > f=sin(x);
   > isbound(x);
   true
   > isbound(f);
   true
   > isbound(g);
   false

Example 2:

   > isbound(a);
   false
   > { var a; isbound(a); };
   true
   > isbound(a);
   false

Example 3:

   > f=sin(x);
   > isbound(x);
   true
   > rename(x,y);
   > isbound(x);
   false

Example 4:

   > x=1;
   > f=sin(y);
   > rename(y,x);
   > f;
   sin(x)
   > x;
   x
   > isbound(x);
   true
   > rename(x,y);
   > isbound(x);
   true
   > x;
   1
See also: rename
Go back to the list of commands

Name:

isevaluable tests whether a function can be evaluated at a point

Usage:

isevaluable(function, constant) : (function, constant) -> boolean

Parameters:

Description:

Example 1:

   > isevaluable(sin(pi * log(x)), 0.5);
   true
   > print(evaluate(sin(pi * log(x)), 0.5));
   -0.82148283122563882875872566228649962370813607461095

Example 2:

   > isevaluable(sin(pi * log(x)), 0);
   true
   > print(evaluate(sin(pi * log(x)), 0));
   [-1;1]

Example 3:

   > isevaluable(sin(pi * 1/x), 0.5);
   true
   > print(evaluate(sin(pi * 1/x), 0.5));
   [-3.100365765139897619749121887390789523854170596558e-13490;5.3002401585857127605350842426029223241500776302528e-13489]

Example 4:

   > procedure isEvaluableEmulation(f, c) {
       return match evaluate(f, c) with
               NaN : (false)
            [NaN;NaN] : (false)
            default : (true);
     };
   > isEvaluableEmulation(sin(pi * log(x)), 0.5);
   true
   > isEvaluableEmulation(sin(pi * log(x)), 0);
   true
   > isEvaluableEmulation(sin(pi * log(x)), -1);
   false
See also: evaluate
Go back to the list of commands

Name:

<= less-than-or-equal-to operator

Library name:

sollya_obj_t sollya_lib_cmp_less_equal(sollya_obj_t, sollya_obj_t)

Usage:

expr1 <= expr2 : (constant, constant) -> boolean

Parameters:

Description:

Example 1:

   > 5 <= 4;
   false
   > 5 <= 5;
   true
   > 5 <= 6;
   true
   > exp(2) <= exp(1);
   false
   > log(1) <= exp(2);
   true

Example 2:

   > prec = 12;
   The precision has been set to 12 bits.
   > 16385.1 <= 16384.1;
   true
See also: ==, !=, >=, >, <, in, !, &&, ||, prec, max, min
Go back to the list of commands

Name:

length computes the length of a list or string.

Library name:

sollya_obj_t sollya_lib_length(sollya_obj_t)

Usage:

length(L) : list -> integer length(s) : string -> integer

Parameters:

Description:

Example 1:

   > length("Hello World!");
   12

Example 2:

   > length([|1,...,5|]);
   5

Example 3:

   > length([| |]);
   0

Example 4:

   > length([|1,2...|]);
   infty
Go back to the list of commands

Name:

libraryconstant binds an external mathematical constant to a variable in Sollya

Library names:

sollya_obj_t sollya_lib_libraryconstant(char *, void (*)(mpfr_t, mp_prec_t)) sollya_obj_t sollya_lib_build_function_libraryconstant(char *,                                                        void (*)(mpfr_t,                                                                 mp_prec_t)) sollya_obj_t sollya_lib_libraryconstant_with_data(char *,                                                   void (*)(mpfr_t,                                                            mp_prec_t,                                                            void *),                                                   void *,                                                   void (*)(void *)) sollya_obj_t sollya_lib_build_function_libraryconstant_with_data(                                                   char *,                                                   void (*)(mpfr_t,                                                            mp_prec_t,                                                            void *),                                                   void *,                                                   void (*)(void *))

Usage:

libraryconstant(path) : string -> function

Description:

Example 1:

   > bashexecute("gcc -fPIC -Wall -c libraryconstantexample.c -I$HOME/.local/include");
   > bashexecute("gcc -shared -o libraryconstantexample libraryconstantexample.o -lgmp -lmpfr");
   > euler_gamma = libraryconstant("./libraryconstantexample");
   > prec = 20!;
   > euler_gamma;
   0.577215
   > prec = 100!;
   > euler_gamma;
   0.577215664901532860606512090082
   > midpointmode = on;
   Midpoint mode has been activated.
   > [euler_gamma];
   0.57721566490153286060651209008~2/4~
See also: bashexecute, externalproc, externalplot, pi, library, evaluate
Go back to the list of commands

Name:

library binds an external mathematical function to a variable in Sollya

Library names:

sollya_obj_t sollya_lib_libraryfunction(sollya_obj_t, char *,                                         int (*)(mpfi_t, mpfi_t, int)) sollya_obj_t sollya_lib_build_function_libraryfunction(sollya_obj_t, char *,                                                        int (*)(mpfi_t,                                                                mpfi_t, int)) sollya_obj_t sollya_lib_libraryfunction_with_data(                                         sollya_obj_t, char *,                                         int (*)(mpfi_t, mpfi_t, int, void *),                                         void *, void (*)(void *)) sollya_obj_t sollya_lib_build_function_libraryfunction_with_data(                                         sollya_obj_t, char *,                                         int (*)(mpfi_t,                                                 mpfi_t, int, void *),                                         void *, void (*)(void *))

Usage:

library(path) : string -> function

Description:

Example 1:

   > bashexecute("gcc -fPIC -Wall -c libraryexample.c -I$HOME/.local/include");
   > bashexecute("gcc -shared -o libraryexample libraryexample.o -lgmp -lmpfr");
   > myownlog = library("./libraryexample");
   > evaluate(log(x), 2);
   0.69314718055994530941723212145817656807550013436025
   > evaluate(myownlog(x), 2);
   0.69314718055994530941723212145817656807550013436025
See also: function, bashexecute, externalproc, externalplot, diff, evaluate, libraryconstant
Go back to the list of commands

Name:

list of keyword used in combination with a type keyword

Library names:

SOLLYA_EXTERNALPROC_TYPE_CONSTANT_LIST SOLLYA_EXTERNALPROC_TYPE_FUNCTION_LIST SOLLYA_EXTERNALPROC_TYPE_RANGE_LIST SOLLYA_EXTERNALPROC_TYPE_INTEGER_LIST SOLLYA_EXTERNALPROC_TYPE_STRING_LIST SOLLYA_EXTERNALPROC_TYPE_BOOLEAN_LIST SOLLYA_EXTERNALPROC_TYPE_OBJECT_LIST

Description:

See also: externalproc, boolean, constant, function, integer, range, string, object
Go back to the list of commands

Name:

log10 decimal logarithm.

Library names:

sollya_obj_t sollya_lib_log10(sollya_obj_t) sollya_obj_t sollya_lib_build_function_log10(sollya_obj_t) #define SOLLYA_LOG10(x) sollya_lib_build_function_log10(x)

Description:

See also: log, log2
Go back to the list of commands

Name:

log1p translated logarithm.

Library names:

sollya_obj_t sollya_lib_log1p(sollya_obj_t) sollya_obj_t sollya_lib_build_function_log1p(sollya_obj_t) #define SOLLYA_LOG1P(x) sollya_lib_build_function_log1p(x)

Description:

See also: log
Go back to the list of commands

Name:

log2 binary logarithm.

Library names:

sollya_obj_t sollya_lib_log2(sollya_obj_t) sollya_obj_t sollya_lib_build_function_log2(sollya_obj_t) #define SOLLYA_LOG2(x) sollya_lib_build_function_log2(x)

Description:

See also: log, log10
Go back to the list of commands

Name:

log natural logarithm.

Library names:

sollya_obj_t sollya_lib_log(sollya_obj_t) sollya_obj_t sollya_lib_build_function_log(sollya_obj_t) #define SOLLYA_LOG(x) sollya_lib_build_function_log(x)

Description:

See also: exp, log2, log10
Go back to the list of commands

Name:

< less-than operator

Library name:

sollya_obj_t sollya_lib_cmp_less(sollya_obj_t, sollya_obj_t)

Usage:

expr1 < expr2 : (constant, constant) -> boolean

Parameters:

Description:

Example 1:

   > 5 < 4;
   false
   > 5 < 5;
   false
   > 5 < 6;
   true
   > exp(2) < exp(1);
   false
   > log(1) < exp(2);
   true

Example 2:

   > prec = 12;
   The precision has been set to 12 bits.
   > 16384.1 < 16385.1;
   false
See also: ==, !=, >=, >, <=, in, !, &&, ||, prec, max, min
Go back to the list of commands

Name:

mantissa returns the integer mantissa of a number.

Library name:

sollya_obj_t sollya_lib_mantissa(sollya_obj_t)

Usage:

mantissa(x) : constant -> integer

Parameters:

Description:

Example 1:

   > a=round(Pi,20,RN);
   > e=exponent(a);
   > m=mantissa(a);
   > m;
   411775
   > a-m*2^e;
   0
See also: exponent, precision
Go back to the list of commands

Name:

max determines which of given constant expressions has maximum value

Library names:

sollya_obj_t sollya_lib_max(sollya_obj_t, ...) sollya_obj_t sollya_lib_v_max(sollya_obj_t, va_list)

Usage:

max(expr1,expr2,...,exprn) : (constant, constant, ..., constant) -> constant max(l) : list -> constant

Parameters:

Description:

Example 1:

   > max(1,2,3,exp(5),log(0.25));
   148.41315910257660342111558004055227962348766759388
   > max(17);
   17

Example 2:

   > l = [|1,2,3,exp(5),log(0.25)|];
   > max(l);
   148.41315910257660342111558004055227962348766759388

Example 3:

   > print(max(exp(17),sin(62)));
   exp(17)

Example 4:

   > verbosity = 1!;
   > print(max(17 + log2(13)/log2(9),17 + log(13)/log(9)));
   Warning: the tool is unable to decide a maximum computation by evaluation even though faithful evaluation of the terms has been possible. The terms will be considered to be equal.
   17 + log2(13) / log2(9)
See also: min, ==, !=, >=, >, <, <=, in, inf, sup
Go back to the list of commands

Name:

mid gives the middle of an interval.

Library name:

sollya_obj_t sollya_lib_mid(sollya_obj_t)

Usage:

mid(I) : range -> constant mid(x) : constant -> constant

Parameters:

Description:

Example 1:

   > mid([1;3]);
   2
   > mid(17);
   17
See also: inf, sup
Go back to the list of commands

Name:

midpointmode global variable controlling the way intervals are displayed.

Library names:

void sollya_lib_set_midpointmode_and_print(sollya_obj_t) void sollya_lib_set_midpointmode(sollya_obj_t) sollya_obj_t sollya_lib_get_midpointmode()

Usage:

midpointmode = activation value : on|off -> void midpointmode = activation value ! : on|off -> void midpointmode : on|off

Parameters:

Description:

Example 1:

   > a = round(Pi,30,RD);
   > b = round(Pi,30,RU);
   > d = [a,b];
   > d;
   [3.1415926516056060791015625;3.1415926553308963775634765625]
   > midpointmode=on!;
   > d;
   0.314159265~1/6~e1
See also: on, off, roundingwarnings, display, decimal
Go back to the list of commands

Name:

min determines which of given constant expressions has minimum value

Library names:

sollya_obj_t sollya_lib_min(sollya_obj_t, ...) sollya_obj_t sollya_lib_v_min(sollya_obj_t, va_list)

Usage:

min(expr1,expr2,...,exprn) : (constant, constant, ..., constant) -> constant min(l) : list -> constant

Parameters:

Description:

Example 1:

   > min(1,2,3,exp(5),log(0.25));
   -1.3862943611198906188344642429163531361510002687205
   > min(17);
   17

Example 2:

   > l = [|1,2,3,exp(5),log(0.25)|];
   > min(l);
   -1.3862943611198906188344642429163531361510002687205

Example 3:

   > print(min(exp(17),sin(62)));
   sin(62)

Example 4:

   > verbosity = 1!;
   > print(min(17 + log2(13)/log2(9),17 + log(13)/log(9)));
   Warning: the tool is unable to decide a minimum computation by evaluation even though faithful evaluation of the terms has been possible. The terms will be considered to be equal.
   17 + log(13) / log(9)
See also: max, ==, !=, >=, >, <, <=, in, inf, sup
Go back to the list of commands

Name:

- subtraction function

Library names:

sollya_obj_t sollya_lib_sub(sollya_obj_t, sollya_obj_t) sollya_obj_t sollya_lib_build_function_sub(sollya_obj_t, sollya_obj_t) #define SOLLYA_SUB(x,y) sollya_lib_build_function_sub((x), (y)) sollya_obj_t sollya_lib_neg(sollya_obj_t) sollya_obj_t sollya_lib_build_function_neg(sollya_obj_t) #define SOLLYA_NEG(x) sollya_lib_build_function_neg(x)

Usage:

function1 - function2 : (function, function) -> function interval1 - interval2 : (range, range) -> range interval1 - constant : (range, constant) -> range interval1 - constant : (constant, range) -> range - function1 : function -> function - interval1 : range -> range

Parameters:

Description:

Example 1:

   > 5 - 2;
   3

Example 2:

   > x - 2;
   -2 + x

Example 3:

   > x - x;
   0

Example 4:

   > diff(sin(x) - exp(x));
   cos(x) - exp(x)

Example 5:

   > [1;2] - [3;4];
   [-3;-1]
   > [1;2] - 17;
   [-16;-15]
   > 13 - [-4;17];
   [-4;17]

Example 6:

   > -exp(x);
   -exp(x)
   > -13;
   -13
   > -[13;17];
   [-17;-13]
See also: +, *, /, ^
Go back to the list of commands

Name:

mod Computes the euclidian division of polynomials or numbers and returns the rest

Library name:

sollya_obj_t sollya_lib_euclidian_mod(sollya_obj_t, sollya_obj_t)

Usage:

mod(a, b) : (function, function) -> function

Parameters:

Description:

Example 1:

   > mod(1001, 231);
   77
   > mod(13, 17);
   13
   > mod(-14, 15);
   1
   > mod(-213, -5);
   -3
   > print(mod(23/13, 11/17));
   105 / 221
   > print(mod(exp(13),-sin(17)));
   exp(13) + 460177 * sin(17)

Example 2:

   > mod(24 + 68 * x + 74 * x^2 + 39 * x^3 + 10 * x^4 + x^5, 4 + 4 * x + x^2);
   0
   > mod(24 + 68 * x + 74 * x^2 + 39 * x^3 + 10 * x^4 + x^5, 2 * x^3);
   24 + x * (68 + x * 74)
   > mod(x^2, x^3);
   x^2

Example 3:

   > mod(exp(x), x^2);
   exp(x)
   > mod(x^3, sin(x));
   x^3
See also: gcd, div, numberroots
Go back to the list of commands

Name:

* multiplication function

Library names:

sollya_obj_t sollya_lib_mul(sollya_obj_t, sollya_obj_t) sollya_obj_t sollya_lib_build_function_mul(sollya_obj_t, sollya_obj_t) #define SOLLYA_MUL(x,y) sollya_lib_build_function_mul((x), (y))

Usage:

function1 * function2 : (function, function) -> function interval1 * interval2 : (range, range) -> range interval1 * constant : (range, constant) -> range interval1 * constant : (constant, range) -> range

Parameters:

Description:

Example 1:

   > 5 * 2;
   10

Example 2:

   > x * 2;
   x * 2

Example 3:

   > x * x;
   x^2

Example 4:

   > diff(sin(x) * exp(x));
   sin(x) * exp(x) + exp(x) * cos(x)

Example 5:

   > [1;2] * [3;4];
   [3;8]
   > [1;2] * 17;
   [17;34]
   > 13 * [-4;17];
   [-52;221]
See also: +, -, /, ^
Go back to the list of commands

Name:

nearestint the function mapping the reals to the integers nearest to them.

Library names:

sollya_obj_t sollya_lib_nearestint(sollya_obj_t) sollya_obj_t sollya_lib_build_function_nearestint(sollya_obj_t) #define SOLLYA_NEARESTINT(x) sollya_lib_build_function_nearestint(x)

Description:

See also: ceil, floor, round, RN
Go back to the list of commands

Name:

!= negated equality test operator

Library name:

sollya_obj_t sollya_lib_cmp_not_equal(sollya_obj_t, sollya_obj_t)

Usage:

expr1 != expr2 : (any type, any type) -> boolean

Parameters:

Description:

Example 1:

   > "Hello" != "Hello";
   false
   > "Hello" != "Salut";
   true
   > "Hello" != 5;
   true
   > 5 + x != 5 + x;
   false

Example 2:

   > 1 != exp(0);
   false
   > asin(1) * 2 != pi;
   false
   > exp(5) != log(4);
   true

Example 3:

   > sin(pi/6) != 1/2 * sqrt(3);
   true

Example 4:

   > prec = 12;
   The precision has been set to 12 bits.
   > 16384.1 != 16385.1;
   false

Example 5:

   > NaN != NaN;
   true
   > [NaN,NaN] != [NaN,NaN];
   true
   > error != error;
   false

Example 6:

   > p = x + x^2;
   > q = x * (1 + x);
   > autosimplify = on;
   Automatic pure tree simplification has been activated.
   > p != q;
   false
   > autosimplify = off;
   Automatic pure tree simplification has been deactivated.
   > p != q;
   true
See also: ==, >, >=, <=, <, in, !, &&, ||, error, prec, autosimplify
Go back to the list of commands

Name:

nop no operation

Usage:

nop : void -> void nop() : void -> void nop(n) : integer -> void

Description:

Example 1:

   > nop;

Example 2:

   > nop(100);

Example 3:

   > succ = proc(n) { return n + 1; };
   > succ;
   proc(n)
   {
   nop;
   return (n) + (1);
   }
   > succ(5);
   6
See also: proc, time
Go back to the list of commands

Name:

! boolean NOT operator

Library name:

sollya_obj_t sollya_lib_negate(sollya_obj_t)

Usage:

! expr : boolean -> boolean

Parameters:

Description:

Example 1:

   > ! false;
   true

Example 2:

   > ! (1 == exp(0));
   false
See also: &&, ||
Go back to the list of commands

Name:

numberroots Computes the number of roots of a polynomial in a given range.

Library name:

sollya_obj_t sollya_lib_numberroots(sollya_obj_t, sollya_obj_t)

Usage:

numberroots(p, I) : (function, range) -> integer

Parameters:

Description:

Example 1:

   > numberroots(1+x-x^2, [1,2]);
   1
   > findzeros(1+x-x^2, [1,2]);
   [|[1.617919921875;1.6180419921875]|]

Example 2:

   > numberroots((1+x)*(1-x), [-1,1]);
   2
   > numberroots(x^2, [-1,1]);
   1

Example 3:

   > verbosity = 1!;
   > numberroots(x-pi, [0,4]);
   Warning: the 0th coefficient of the polynomial is neither a floating point
   constant nor can be evaluated without rounding to a floating point constant.
   Will faithfully evaluate it with the current precision (165 bits)
   1

Example 4:

   > verbosity = 1!;
   > numberroots(1+x-x^2, [0, @Inf@]);
   Warning: the given interval must have finite bounds.
   Warning: at least one of the given expressions or a subexpression is not correctly typed
   or its evaluation has failed because of some error on a side-effect.
   error
   > numberroots(exp(x), [0, 1]);
   Warning: the given function must be a polynomial in this context.
   Warning: at least one of the given expressions or a subexpression is not correctly typed
   or its evaluation has failed because of some error on a side-effect.
   error
See also: dirtyfindzeros, findzeros, gcd
Go back to the list of commands

Name:

numerator gives the numerator of an expression

Library name:

sollya_obj_t sollya_lib_numerator(sollya_obj_t)

Usage:

numerator(expr) : function -> function

Parameters:

Description:

Example 1:

   > numerator(5/3);
   5

Example 2:

   > numerator(exp(x));
   exp(x)

Example 3:

   > a = 5/3;
   > b = numerator(a)/denominator(a);
   > print(a);
   5 / 3
   > print(b);
   5 / 3

Example 4:

   > a = exp(x/3);
   > b = numerator(a)/denominator(a);
   > print(a);
   exp(x / 3)
   > print(b);
   exp(x / 3)
See also: denominator, rationalmode
Go back to the list of commands

Name:

objectname returns, given a Sollya object, a string that can be reparsed to the object

Library name:

sollya_obj_t sollya_lib_objectname(sollya_obj_t);

Usage:

objectname(obj) : any type -> string

Description:

Example 1:

   > s = "Hello";
   > objectname("Hello");
   s

Example 2:

   > f = exp(x);
   > g = sin(x);
   > [| objectname(exp(x)), objectname(sin(x)), objectname(cos(x)) |];
   [|"f", "g", "cos(x)"|]

Example 3:

   > o = { .f = exp(x), .I = [-1;1] };
   > s1 = o@""; s1;
   { .f = exp(x), .I = [-1;1] }
   > s2 = objectname({ .I = [-1;1], .f = exp(x)}); s2;
   o
   > parse(s1) == parse(s2);
   true
   > write("s2 = \"", s2, "\" parses to ", parse(s2), "\n");
   s2 = "o" parses to { .f = exp(x), .I = [-1;1] }

Example 4:

   > n = 1664;
   > objectname(n);
   n

Example 5:

   > f = exp(x);
   > g = sin(x);
   > procedure test() {
         var f;
         var h;
         f = tan(x);
         h = cos(x);
         [| objectname(exp(x)), objectname(sin(x)), objectname(cos(x)), objectname(tan(x)) |];
     };
   > test();
   [|"exp(x)", "g", "h", "f"|]

Example 6:

   > procedure apply_proc(p, a, b) {
         return p(a, b);
     };
   > procedure show_trace_and_add(n, m) {
         var i, bt;
         bt = getbacktrace();
         write("Procedure stack:\n");
         for i from 0 to length(bt) - 1 do {
          write("   Procedure ", objectname((bt[i]).called_proc), " called with ", length((bt[i]).passed_args), " arguments\n");
         };
         write("\n");
         return n + m;
     };
   > procedure show_and_succ(u) {
       return apply_proc(show_trace_and_add, u, 1);
     };
   > show_and_succ(16);
   Procedure stack:
      Procedure show_trace_and_add called with 2 arguments
      Procedure apply_proc called with 3 arguments
      Procedure show_and_succ called with 1 arguments
   
   17

Example 7:

   > f = exp(three_decker_sauerkraut_and_toadstool_sandwich_with_arsenic_sauce);
   > g = sin(_x_);
   > h = f(g);
   > h;
   exp(sin(three_decker_sauerkraut_and_toadstool_sandwich_with_arsenic_sauce))
   > objectname(_x_);
   three_decker_sauerkraut_and_toadstool_sandwich_with_arsenic_sauce
See also: parse, var, getbacktrace, proc, procedure, @
Go back to the list of commands

Name:

object keyword representing a Sollya object type

Library name:

SOLLYA_EXTERNALPROC_TYPE_OBJECT

Usage:

object : type type

Description:

See also: externalproc, boolean, constant, function, list of, range, string, integer
Go back to the list of commands

Name:

off special value for certain global variables.

Library names:

sollya_obj_t sollya_lib_off() int sollya_lib_is_off(sollya_obj_t)

Description:

Example 1:

   > canonical=on;
   Canonical automatic printing output has been activated.
   > p=1+x+x^2;
   > mode=off;
   > p;
   1 + x + x^2
   > canonical=mode;
   Canonical automatic printing output has been deactivated.
   > p;
   1 + x * (1 + x)
See also: on, autosimplify, canonical, timing, fullparentheses, midpointmode, rationalmode, roundingwarnings, timing, dieonerrormode
Go back to the list of commands

Name:

on special value for certain global variables.

Library names:

sollya_obj_t sollya_lib_on() int sollya_lib_is_on(sollya_obj_t)

Description:

Example 1:

   > p=1+x+x^2;
   > mode=on;
   > p;
   1 + x * (1 + x)
   > canonical=mode;
   Canonical automatic printing output has been activated.
   > p;
   1 + x + x^2
See also: off, autosimplify, canonical, timing, fullparentheses, midpointmode, rationalmode, roundingwarnings, timing, dieonerrormode
Go back to the list of commands

Name:

|| boolean OR operator

Library name:

sollya_obj_t sollya_lib_or(sollya_obj_t, sollya_obj_t)

Usage:

expr1 || expr2 : (boolean, boolean) -> boolean

Parameters:

Description:

Example 1:

   > false || false;
   false

Example 2:

   > (1 == exp(0)) || (0 == log(1));
   true
See also: &&, !
Go back to the list of commands

Name:

parse parses an expression contained in a string

Library name:

sollya_obj_t sollya_lib_parse(sollya_obj_t)

Usage:

parse(string) : string -> function | error

Parameters:

Description:

Example 1:

   > parse("exp(x)");
   exp(x)

Example 2:

   > text = "remez(exp(x),5,[-1;1])";
   > print("The string", text, "gives", parse(text));
   The string remez(exp(x),5,[-1;1]) gives 8.7381909882756203676868315731687604903964388498642e-3 * x^5 + 4.3793696379596015478233171265365272893795005588381e-2 * x^4 + 0.16642465614952768185129433844012193925654065755905 * x^3 + 0.49919698262963614991826575452094101562044819693772 * x^2 + 1.00003834650599815466340068058231011540878088492516 * x + 1.00004475029559502606203712816558243384077522932213

Example 3:

   > verbosity = 1!;
   > parse("5 + * 3");
   Warning: syntax error, unexpected *. Will try to continue parsing (expecting ";"). May leak memory.
   Warning: the string "5 + * 3" could not be parsed by the miniparser.
   Warning: at least one of the given expressions or a subexpression is not correctly typed
   or its evaluation has failed because of some error on a side-effect.
   error
See also: execute, readfile, print, error, dieonerrormode
Go back to the list of commands

Name:

perturb indicates random perturbation of sampling points for externalplot

Library names:

sollya_obj_t sollya_lib_perturb() int sollya_lib_is_perturb(sollya_obj_t)

Usage:

perturb : perturb

Description:

Example 1:

   > bashexecute("gcc -fPIC -c externalplotexample.c");
   > bashexecute("gcc -shared -o externalplotexample externalplotexample.o -lgmp -lmpfr");
   > externalplot("./externalplotexample",relative,exp(x),[-1/2;1/2],12,perturb);
See also: externalplot, absolute, relative, bashexecute
Go back to the list of commands

Name:

pi the constant Pi.

Library names:

sollya_obj_t sollya_lib_pi() int sollya_lib_is_pi(sollya_obj_t) sollya_obj_t sollya_lib_build_function_pi() #define SOLLYA_PI (sollya_lib_build_function_pi())

Description:

Example 1:

   > verbosity=1!; prec=12!;
   > a = 2*pi;
   > a;
   Warning: rounding has happened. The value displayed is a faithful rounding to 12 bits of the true result.
   6.283
   > prec=20!;
   > a;
   Warning: rounding has happened. The value displayed is a faithful rounding to 20 bits of the true result.
   6.28319

Example 2:

   > display=binary;
   Display mode is binary numbers.
   > prec=12!;
   > d = [pi; 5];
   > d;
   [1.1001001_2 * 2^(1);1.01_2 * 2^(2)]
   > prec=20!;
   > d;
   [1.1001001_2 * 2^(1);1.01_2 * 2^(2)]
See also: cos, sin, tan, asin, acos, atan, evaluate, prec, libraryconstant
Go back to the list of commands

Name:

plot plots one or several functions

Library names:

void sollya_lib_plot(sollya_obj_t, sollya_obj_t, ...) void sollya_lib_v_plot(sollya_obj_t, sollya_obj_t, va_list)

Usage:

plot(f1, ... ,fn, I) : (function, ... ,function, range) -> void plot(f1, ... ,fn, I, file, name) : (function, ... ,function, range, file, string) -> void plot(f1, ... ,fn, I, postscript, name) : (function, ... ,function, range, postscript, string) -> void plot(f1, ... ,fn, I, postscriptfile, name) : (function, ... ,function, range, postscriptfile, string) -> void plot(L, I) : (list, range) -> void plot(L, I, file, name) : (list, range, file, string) -> void plot(L, I, postscript, name) : (list, range, postscript, string) -> void plot(L, I, postscriptfile, name) : (list, range, postscriptfile, string) -> void

Parameters:

Description:

Example 1:

   > plot(sin(x),0,cos(x),[-Pi,Pi]);

Example 2:

   > plot(sin(x),0,cos(x),[-Pi,Pi],postscriptfile,"plotSinCos");

Example 3:

   > plot(exp(0), sin(1), [0;1]);
   1
   0.84147098480789650665250232163029899962256306079837

Example 4:

   > plot(sin(x), cos(x), [1;1]);
   0.84147098480789650665250232163029899962256306079837
   0.54030230586813971740093660744297660373231042061792
See also: externalplot, asciiplot, file, postscript, postscriptfile, points
Go back to the list of commands

Name:

+ addition function

Library names:

sollya_obj_t sollya_lib_add(sollya_obj_t, sollya_obj_t) sollya_obj_t sollya_lib_build_function_add(sollya_obj_t, sollya_obj_t) #define SOLLYA_ADD(x,y) sollya_lib_build_function_add((x), (y))

Usage:

function1 + function2 : (function, function) -> function interval1 + interval2 : (range, range) -> range interval1 + constant : (range, constant) -> range interval1 + constant : (constant, range) -> range

Parameters:

Description:

Example 1:

   > 1 + 2;
   3

Example 2:

   > x + 2;
   2 + x

Example 3:

   > x + x;
   x * 2

Example 4:

   > diff(sin(x) + exp(x));
   cos(x) + exp(x)

Example 5:

   > [1;2] + [3;4];
   [4;6]
   > [1;2] + 17;
   [18;19]
   > 13 + [-4;17];
   [9;30]
See also: -, *, /, ^
Go back to the list of commands

Name:

points controls the number of points chosen by Sollya in certain commands.

Library names:

void sollya_lib_set_points_and_print(sollya_obj_t) void sollya_lib_set_points(sollya_obj_t) sollya_obj_t sollya_lib_get_points()

Usage:

points = n : integer -> void points = n ! : integer -> void points : constant

Parameters:

Description:

Example 1:

   > f=x^2*sin(1/x);
   > points=10;
   The number of points has been set to 10.
   > dirtyfindzeros(f, [0;1]);
   [|0, 0.31830988618379067153776752674502872406891929148092|]
   > points=100;
   The number of points has been set to 100.
   > dirtyfindzeros(f, [0;1]);
   [|0, 2.4485375860291590118289809749617594159147637806224e-2, 3.9788735772973833942220940843128590508614911435115e-2, 4.5472840883398667362538218106432674866988470211559e-2, 5.3051647697298445256294587790838120678153215246819e-2, 6.3661977236758134307553505349005744813783858296184e-2, 7.957747154594766788444188168625718101722982287023e-2, 0.106103295394596890512589175581676241356306430493638, 0.15915494309189533576888376337251436203445964574046, 0.31830988618379067153776752674502872406891929148092|]
See also: dirtyinfnorm, dirtyintegral, dirtyfindzeros, plot, diam, prec
Go back to the list of commands

Name:

postscriptfile special value for commands plot and externalplot

Library names:

sollya_obj_t sollya_lib_postscriptfile() int sollya_lib_is_postscriptfile(sollya_obj_t)

Description:

Example 1:

   > savemode=postscriptfile;
   > name="plotSinCos";
   > plot(sin(x),0,cos(x),[-Pi,Pi],savemode, name);
See also: externalplot, plot, file, postscript
Go back to the list of commands

Name:

postscript special value for commands plot and externalplot

Library names:

sollya_obj_t sollya_lib_postscript() int sollya_lib_is_postscript(sollya_obj_t)

Description:

Example 1:

   > savemode=postscript;
   > name="plotSinCos";
   > plot(sin(x),0,cos(x),[-Pi,Pi],savemode, name);
See also: externalplot, plot, file, postscriptfile
Go back to the list of commands

Name:

^ power function

Library names:

sollya_obj_t sollya_lib_pow(sollya_obj_t, sollya_obj_t) sollya_obj_t sollya_lib_build_function_pow(sollya_obj_t, sollya_obj_t) #define SOLLYA_POW(x,y) sollya_lib_build_function_pow((x), (y))

Usage:

function1 ^ function2 : (function, function) -> function interval1 ^ interval2 : (range, range) -> range interval1 ^ constant : (range, constant) -> range interval1 ^ constant : (constant, range) -> range

Parameters:

Description:

Example 1:

   > 5 ^ 2;
   25

Example 2:

   > x ^ 2;
   x^2

Example 3:

   > 3 ^ (-5);
   4.1152263374485596707818930041152263374485596707819e-3

Example 4:

   > (-3) ^ (-2.5);
   NaN

Example 5:

   > diff(sin(x) ^ exp(x));
   sin(x)^exp(x) * ((cos(x) * exp(x)) / sin(x) + exp(x) * log(sin(x)))

Example 6:

   > 2^3^5;
   1.4134776518227074636666380005943348126619871175005e73
   > (2^3)^5;
   32768
   > 2^(3^5);
   1.4134776518227074636666380005943348126619871175005e73

Example 7:

   > [1;2] ^ [3;4];
   [1;16.000000000000000000000000000000000000000000000001]
   > [1;2] ^ 17;
   [1;131072]
   > 13 ^ [-4;17];
   [3.501277966457757081334687160813696999404782745702e-5;8650415919381337933]
See also: +, -, *, /
Go back to the list of commands

Name:

powers special value for global state display

Library names:

sollya_obj_t sollya_lib_powers() int sollya_lib_is_powers(sollya_obj_t)

Description:

See also: decimal, dyadic, hexadecimal, binary, display
Go back to the list of commands

Name:

precision returns the precision necessary to represent a number.

Library name:

sollya_obj_t sollya_lib_precision(sollya_obj_t)

Usage:

precision(x) : constant -> integer

Parameters:

Description:

Example 1:

   > a=round(Pi,20,RN);
   > precision(a);
   19
   > m=mantissa(a);
   > 1+floor(log2(m));
   19

Example 2:

   > a=255;
   > precision(a);
   8
   > m=mantissa(a);
   > 1+floor(log2(m));
   8

Example 3:

   > a=256;
   > precision(a);
   1
   > m=mantissa(a);
   > 1+floor(log2(m));
   1
See also: mantissa, exponent, round
Go back to the list of commands

Name:

prec controls the precision used in numerical computations.

Library names:

void sollya_lib_set_prec_and_print(sollya_obj_t) void sollya_lib_set_prec(sollya_obj_t) sollya_obj_t sollya_lib_get_prec()

Description:

Example 1:

   > display=binary!;
   > prec=50;
   The precision has been set to 50 bits.
   > dirtyinfnorm(exp(x),[1;2]);
   1.110110001110011001001011100011010100110111011011_2 * 2^(2)
   > prec=100;
   The precision has been set to 100 bits.
   > dirtyinfnorm(exp(x),[1;2]);
   1.11011000111001100100101110001101010011011101101011011100110000110011101000111011101000100000011011_2 * 2^(2)
See also: evaluate, diam
Go back to the list of commands

Name:

.: add an element at the beginning of a list.

Library name:

sollya_obj_t sollya_lib_prepend(sollya_obj_t, sollya_obj_t)

Usage:

x.:L : (any type, list) -> list

Parameters:

Description:

Example 1:

   > 1.:[|2,3,4|];
   [|1, 2, 3, 4|]

Example 2:

   > [|1,2,3|].:[|4,5,6|];
   [|[|1, 2, 3|], 4, 5, 6|]

Example 3:

   > 1.:[||];
   [|1|]
See also: :., @
Go back to the list of commands

Name:

printdouble prints a constant value as a hexadecimal double precision number

Library name:

void sollya_lib_printdouble(sollya_obj_t)

Usage:

printdouble(constant) : constant -> void

Parameters:

Description:

Example 1:

   > printdouble(3);
   0x4008000000000000

Example 2:

   > prec=100!;
   > verbosity = 1!;
   > printdouble(exp(5));
   Warning: the given expression is not a constant but an expression to evaluate. A faithful evaluation to 100 bits will be used.
   Warning: rounding down occurred before printing a value as a double.
   0x40628d389970338f
See also: printsingle, printexpansion, double
Go back to the list of commands

Name:

printexpansion prints a polynomial in Horner form with its coefficients written as a expansions of double precision numbers

Library name:

void sollya_lib_printexpansion(sollya_obj_t)

Usage:

printexpansion(polynomial) : function -> void

Parameters:

Description:

Example 1:

   > printexpansion(roundcoefficients(taylor(exp(x),5,0),[|DD...|]));
   0x3ff0000000000000 + x * (0x3ff0000000000000 + x * (0x3fe0000000000000 + x * ((0x3fc5555555555555 + 0x3c65555555555555) + x * ((0x3fa5555555555555 + 0x3c45555555555555) + x * (0x3f81111111111111 + 0x3c01111111111111)))))

Example 2:

   > printexpansion(remez(exp(x),5,[-1;1]));
   (0x3ff0002eec90e5a6 + 0x3c9ea6a6a0087757 + 0xb8eb3e644ef44998) + x * ((0x3ff00028358fd3ac + 0x3c8ffa7d96c95f7a + 0xb91da9809b13dd54 + 0x35c0000000000000) + x * ((0x3fdff2d7e6a9fea5 + 0x3c74460e4c0e4fe2 + 0x38fcd1b6b4e85bb0 + 0x3590000000000000) + x * ((0x3fc54d6733b4839e + 0x3c6654e4d8614a44 + 0xb905c7a26b66ea92 + 0xb598000000000000) + x * ((0x3fa66c209b7150a8 + 0x3c34b1bba8f78092 + 0xb8c75f6eb90dae02 + 0x3560000000000000) + x * (0x3f81e554242ab128 + 0xbc23e920a76e760c + 0x38c0589c2cae6caf + 0x3564000000000000)))))

Example 3:

   > verbosity = 1!;
   > prec = 3500!;
   > printexpansion(pi);
   (0x400921fb54442d18 + 0x3ca1a62633145c07 + 0xb92f1976b7ed8fbc + 0x35c4cf98e804177d + 0x32631d89cd9128a5 + 0x2ec0f31c6809bbdf + 0x2b5519b3cd3a431b + 0x27e8158536f92f8a + 0x246ba7f09ab6b6a9 + 0xa0eedd0dbd2544cf + 0x1d779fb1bd1310ba + 0x1a1a637ed6b0bff6 + 0x96aa485fca40908e + 0x933e501295d98169 + 0x8fd160dbee83b4e0 + 0x8c59b6d799ae131c + 0x08f6cf70801f2e28 + 0x05963bf0598da483 + 0x023871574e69a459 + 0x8000000005702db3 + 0x8000000000000000)
   Warning: the expansion is not complete because of the limited exponent range of double precision.
   Warning: rounding occurred while printing.
See also: printdouble, horner, print, prec, remez, taylor, roundcoefficients, fpminimax, implementpoly
Go back to the list of commands

Name:

print prints an expression

Usage:

print(expr1,...,exprn) : (any type,..., any type) -> void print(expr1,...,exprn) > filename : (any type,..., any type, string) -> void print(expr1,...,exprn) >> filename : (any type,...,any type, string) -> void

Parameters:

Description:

Example 1:

   > print(x + 2 + exp(sin(x)));
   x + 2 + exp(sin(x))
   > print("Hello","world");
   Hello world
   > print("Hello","you", 4 + 3, "other persons.");
   Hello you 7 other persons.

Example 2:

   > print("Hello");
   Hello
   > print([|"Hello"|]);
   [|"Hello"|]
   > s = "Hello";
   > print(s,[|s|]);
   Hello [|"Hello"|]
   > t = "Hello\tyou";
   > print(t,[|t|]);
   Hello you [|"Hello\tyou"|]

Example 3:

   > print(x + 2 + exp(sin(x))) > "foo.sol";
   > readfile("foo.sol");
   x + 2 + exp(sin(x))
   

Example 4:

   > print(x + 2 + exp(sin(x))) >> "foo.sol";

Example 5:

   > display = decimal;
   Display mode is decimal numbers.
   > a = evaluate(sin(pi * x), 0.25);
   > b = evaluate(sin(pi * x), [0.25; 0.25 + 1b-50]);
   > print(a);
   0.70710678118654752440084436210484903928483593768847
   > display = binary;
   Display mode is binary numbers.
   > print(a);
   1.01101010000010011110011001100111111100111011110011001001000010001011001011111011000100110110011011101010100101010111110100111110001110101101111011000001011101010001_2 * 2^(-1)
   > display = hexadecimal;
   Display mode is hexadecimal numbers.
   > print(a);
   0x1.6a09e667f3bcc908b2fb1366ea957d3e3adec1751p-1
   > display = dyadic;
   Display mode is dyadic numbers.
   > print(a);
   33070006991101558613323983488220944360067107133265b-165
   > display = powers;
   Display mode is dyadic numbers in integer-power-of-2 notation.
   > print(a);
   33070006991101558613323983488220944360067107133265 * 2^(-165)
   > display = decimal;
   Display mode is decimal numbers.
   > midpointmode = off;
   Midpoint mode has been deactivated.
   > print(b);
   [0.70710678118654752440084436210484903928483593768845;0.70710678118654949743721782517557347782646274417049]
   > midpointmode = on;
   Midpoint mode has been activated.
   > print(b);
   0.7071067811865~4/5~
   > display = dyadic;
   Display mode is dyadic numbers.
   > print(b);
   [2066875436943847413332748968013809022504194195829b-161;16535003495550825444196237019385936414432675156571b-164]
   > display = decimal;
   Display mode is decimal numbers.
   > autosimplify = off;
   Automatic pure tree simplification has been deactivated.
   > fullparentheses = off;
   Full parentheses mode has been deactivated.
   > print(x + x * ((x + 1) + 1));
   x + x * (x + 1 + 1)
   > fullparentheses = on;
   Full parentheses mode has been activated.
   > print(x + x * ((x + 1) + 1));
   x + (x * ((x + 1) + 1))
See also: write, printexpansion, printdouble, printsingle, printxml, readfile, autosimplify, display, midpointmode, fullparentheses, evaluate, rationalmode
Go back to the list of commands

Name:

printsingle prints a constant value as a hexadecimal single precision number

Library name:

void sollya_lib_printsingle(sollya_obj_t)

Usage:

printsingle(constant) : constant -> void

Parameters:

Description:

Example 1:

   > printsingle(3);
   0x40400000

Example 2:

   > prec=100!;
   > verbosity = 1!;
   > printsingle(exp(5));
   Warning: the given expression is not a constant but an expression to evaluate. A faithful evaluation to 100 bits will be used.
   Warning: rounding up occurred before printing a value as a single.
   0x431469c5
See also: printdouble, single
Go back to the list of commands

Name:

printxml prints an expression as an MathML-Content-Tree

Library names:

void sollya_lib_printxml(sollya_obj_t) void sollya_lib_printxml_newfile(sollya_obj_t, sollya_obj_t) void sollya_lib_printxml_appendfile(sollya_obj_t, sollya_obj_t)

Usage:

printxml(expr) : function -> void printxml(expr) > filename : (function, string) -> void printxml(expr) > > filename : (function, string) -> void

Parameters:

Description:

Example 1:

   > printxml(x + 2 + exp(sin(x)));
   
   <?xml version="1.0" encoding="UTF-8"?>
   <!-- generated by sollya: http://sollya.org/ -->
   <!-- syntax: printxml(...);   example: printxml(x^2-2*x+5); -->
   <?xml-stylesheet type="text/xsl" href="http://sollya.org/mathmlc2p-web.xsl"?>
   <?xml-stylesheet type="text/xsl" href="mathmlc2p-web.xsl"?>
   <!-- This stylesheet allows direct web browsing of MathML-c XML files (http:// or file://) -->
   
   <math xmlns="http://www.w3.org/1998/Math/MathML">
   <semantics>
   <annotation-xml encoding="MathML-Content">
   <lambda>
   <bvar><ci> x </ci></bvar>
   <apply>
   <apply>
   <plus/>
   <apply>
   <plus/>
   <ci> x </ci>
   <cn type="integer" base="10"> 2 </cn>
   </apply>
   <apply>
   <exp/>
   <apply>
   <sin/>
   <ci> x </ci>
   </apply>
   </apply>
   </apply>
   </apply>
   </lambda>
   </annotation-xml>
   <annotation encoding="sollya/text">(x + 1b1) + exp(sin(x))</annotation>
   </semantics>
   </math>
   

Example 2:

   > printxml(x + 2 + exp(sin(x))) > "foo.xml";

Example 3:

   > printxml(x + 2 + exp(sin(x))) >> "foo.xml";
See also: readxml, print, write
Go back to the list of commands

Name:

procedure defines and assigns a Sollya procedure

Usage:

procedure identifier(formal parameter1, formal parameter2,..., formal parameter n) { procedure body } : void -> void procedure identifier(formal parameter1, formal parameter2,..., formal parameter n) { procedure body return expression; } : void -> void procedure identifier(formal list parameter = ...) { procedure body } : void -> void procedure identifier(formal list parameter = ...) { procedure body return expression; } : void -> void

Parameters:

Description:

Example 1:

   > procedure succ(n) { return n + 1; };
   > succ(5);
   6
   > 3 + succ(0);
   4
   > succ;
   proc(n)
   {
   nop;
   return (n) + (1);
   }

Example 2:

   > procedure myprint(L = ...) { var i; for i in L do i; };
   > myprint("Lyon","Nancy","Beaverton","Coye-la-Foret","Amberg","Nizhny Novgorod","Cluj-Napoca");
   Lyon
   Nancy
   Beaverton
   Coye-la-Foret
   Amberg
   Nizhny Novgorod
   Cluj-Napoca
See also: proc, var, bind
Go back to the list of commands

Name:

proc defines a Sollya procedure

Usage:

proc(formal parameter1, formal parameter2,..., formal parameter n) { procedure body } : void -> procedure proc(formal parameter1, formal parameter2,..., formal parameter n) { procedure body return expression; } : void -> procedure proc(formal list parameter = ...) { procedure body } : void -> procedure proc(formal list parameter = ...) { procedure body return expression; } : void -> procedure

Parameters:

Description:

Example 1:

   > succ = proc(n) { return n + 1; };
   > succ(5);
   6
   > 3 + succ(0);
   4
   > succ;
   proc(n)
   {
   nop;
   return (n) + (1);
   }

Example 2:

   > add = proc(m,n) { var res; res := m + n; return res; };
   > add(5,6);
   11
   > add;
   proc(m, n)
   {
   var res;
   res := (m) + (n);
   return res;
   }
   > verbosity = 1!;
   > add(3);
   Warning: at least one of the given expressions or a subexpression is not correctly typed
   or its evaluation has failed because of some error on a side-effect.
   error
   > add(true,false);
   Warning: at least one of the given expressions or a subexpression is not correctly typed
   or its evaluation has failed because of some error on a side-effect.
   Warning: the given expression or command could not be handled.
   error

Example 3:

   > succ = proc(n) { return n + 1; };
   > succ(5);
   6
   > succ(x);
   1 + x

Example 4:

   > hey = proc() { print("Hello world."); };
   > hey();
   Hello world.
   > print(hey());
   Hello world.
   void
   > hey;
   proc()
   {
   print("Hello world.");
   return void;
   }

Example 5:

   > fac = proc(n) { var res; if (n == 0) then res := 1 else res := n * fac(n - 1); return res; };
   > fac(5);
   120
   > fac(11);
   39916800
   > fac;
   proc(n)
   {
   var res;
   if (n) == (0) then
   res := 1
   else
   res := (n) * (fac((n) - (1)));
   return res;
   }

Example 6:

   > myprocs = [| proc(m,n) { return m + n; }, proc(m,n) { return m - n; } |];
   > (myprocs[0])(5,6);
   11
   > (myprocs[1])(5,6);
   -1
   > succ = proc(n) { return n + 1; };
   > pred = proc(n) { return n - 1; };
   > applier = proc(p,n) { return p(n); };
   > applier(succ,5);
   6
   > applier(pred,5);
   4

Example 7:

   > verbosity = 1!;
   > myquit = proc(n) { print(n); quit; };
   > myquit;
   proc(n)
   {
   print(n);
   quit;
   return void;
   }
   > myquit(5);
   Warning: a quit or restart command may not be part of a procedure body.
   The procedure will not be executed.
   Warning: an error occurred while executing a procedure.
   Warning: the given expression or command could not be handled.
   error

Example 8:

   > printsucc = proc(n) { var succ; succ = proc(n) { return n + 1; }; print("Successor of",n,"is",succ(n)); };
   > printsucc(5);
   Successor of 5 is 6

Example 9:

   > makeadd = proc(n) { var add; print("n =",n); add = proc(m,n) { return n + m; }; return add; };
   > makeadd(4);
   n = 4
   proc(m, n)
   {
   nop;
   return (n) + (m);
   }
   > (makeadd(4))(5,6);
   n = 4
   11

Example 10:

   > sumall = proc(L = ...) { var acc, i; acc = 0; for i in L do acc = acc + i; return acc; };
   > sumall;
   proc(L = ...)
   {
   var acc, i;
   acc = 0;
   for i in L do
   acc = (acc) + (i);
   return acc;
   }
   > sumall();
   0
   > sumall(2);
   2
   > sumall(2,5);
   7
   > sumall(2,5,7,9,16);
   39
   > sumall @ [|1,...,10|];
   55
See also: return, externalproc, void, quit, restart, var, @, bind, getbacktrace, error
Go back to the list of commands

Name:

QD short form for quad
See also: quad
Go back to the list of commands

Names:

quad, QD rounding to the nearest IEEE 754 quad (binary128).

Library names:

sollya_obj_t sollya_lib_quad(sollya_obj_t) sollya_obj_t sollya_lib_quad_obj() int sollya_lib_is_quad_obj(sollya_obj_t) sollya_obj_t sollya_lib_build_function_quad(sollya_obj_t) #define SOLLYA_QD(x) sollya_lib_build_function_quad(x)

Description:

Example 1:

   > display=binary!;
   > QD(0.1);
   1.100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001101_2 * 2^(-4)
   > QD(4.17);
   1.000010101110000101000111101011100001010001111010111000010100011110101110000101000111101011100001010001111010111_2 * 2^(2)
   > QD(1.011_2 * 2^(-16493));
   1.1_2 * 2^(-16493)
See also: halfprecision, single, double, doubleextended, doubledouble, tripledouble, roundcoefficients, implementpoly, fpminimax, round, printsingle
Go back to the list of commands

Name:

quit quits Sollya

Usage:

quit : void -> void

Description:

Example 1:

   > quit;
See also: restart, execute, plot, externalplot, return
Go back to the list of commands

Name:

range keyword representing a range type

Library name:

SOLLYA_EXTERNALPROC_TYPE_RANGE

Usage:

range : type type

Description:

See also: externalproc, boolean, constant, function, integer, list of, string, object
Go back to the list of commands

Name:

rationalapprox returns a fraction close to a given number.

Library name:

sollya_obj_t sollya_lib_rationalapprox(sollya_obj_t, sollya_obj_t)

Usage:

rationalapprox(x,n) : (constant, integer) -> function

Parameters:

Description:

Example 1:

   > pi10 = rationalapprox(Pi,10);
   > pi50 = rationalapprox(Pi,50);
   > pi100 = rationalapprox(Pi,100);
   > print( pi10, ": ", dirtysimplify(floor(-log2(abs(pi10-Pi)/Pi))), "bits." );
   3.140625 :  11 bits.
   > print( pi50, ": ", dirtysimplify(floor(-log2(abs(pi50-Pi)/Pi))), "bits." );
   85563208 / 27235615 :  51 bits.
   > print( pi100, ": ", dirtysimplify(floor(-log2(abs(pi100-Pi)/Pi))), "bits." );
   4422001152019829 / 1407566683404023 :  100 bits.

Example 2:

   > a=0.1;
   > b=rationalapprox(a,4);
   > numerator(b); denominator(b);
   1
   10
   > print(dirtysimplify(floor(-log2(abs((b-a)/a)))), "bits.");
   166 bits.
See also: print, numerator, denominator, rationalmode
Go back to the list of commands

Name:

rationalmode global variable controlling if rational arithmetic is used or not.

Library names:

void sollya_lib_set_rationalmode_and_print(sollya_obj_t) void sollya_lib_set_rationalmode(sollya_obj_t) sollya_obj_t sollya_lib_get_rationalmode()

Usage:

rationalmode = activation value : on|off -> void rationalmode = activation value ! : on|off -> void rationalmode : on|off

Parameters:

Description:

Example 1:

   > rationalmode=off!;
   > 19/17 + 3/94;
   1.1495619524405506883604505632040050062578222778473
   > rationalmode=on!;
   > 19/17 + 3/94;
   1837 / 1598

Example 2:

   > rationalmode=off!;
   > exp(19/17 + 3/94);
   3.1568097739551413675470920894482427634032816281442
   > rationalmode=on!;
   > exp(19/17 + 3/94);
   3.1568097739551413675470920894482427634032816281442
See also: on, off, numerator, denominator, simplify, rationalapprox, autosimplify
Go back to the list of commands

Name:

RD constant representing rounding-downwards mode.

Library names:

sollya_obj_t sollya_lib_round_down() int sollya_lib_is_round_down(sollya_obj_t)

Description:

Example 1:

   > display=binary!;
   > round(Pi,20,RD);
   1.1001001000011111101_2 * 2^(1)
See also: RZ, RU, RN, round, floor
Go back to the list of commands

Name:

readfile reads the content of a file into a string variable

Usage:

readfile(filename) : string -> string

Parameters:

Description:

Example 1:

   > print("Hello world") > "myfile.txt";
   > t = readfile("myfile.txt");
   > t;
   Hello world
   

Example 2:

   > verbosity=1!;
   > readfile("afile.txt");
   Warning: the file "afile.txt" could not be opened for reading.
   Warning: at least one of the given expressions or a subexpression is not correctly typed
   or its evaluation has failed because of some error on a side-effect.
   error
See also: parse, execute, write, print, bashexecute, error
Go back to the list of commands

Name:

readxml reads an expression written as a MathML-Content-Tree in a file

Library name:

sollya_obj_t sollya_lib_readxml(sollya_obj_t)

Usage:

readxml(filename) : string -> function | error

Parameters:

Description:

Example 1:

   > readxml("readxmlexample.xml");
   2 + x + exp(sin(x))
See also: printxml, readfile, parse, error
Go back to the list of commands

Name:

relative indicates a relative error for externalplot, fpminimax or supnorm

Library names:

sollya_obj_t sollya_lib_relative() int sollya_lib_is_relative(sollya_obj_t)

Usage:

relative : absolute|relative

Description:

Example 1:

   > bashexecute("gcc -fPIC -c externalplotexample.c");
   > bashexecute("gcc -shared -o externalplotexample externalplotexample.o -lgmp -lmpfr");
   > externalplot("./externalplotexample",absolute,exp(x),[-1/2;1/2],12,perturb);
See also: externalplot, fpminimax, absolute, bashexecute, supnorm
Go back to the list of commands

Name:

remez computes the minimax of a function on an interval.

Library names:

sollya_obj_t sollya_lib_remez(sollya_obj_t, sollya_obj_t, sollya_obj_t, ...) sollya_obj_t sollya_lib_v_remez(sollya_obj_t, sollya_obj_t, sollya_obj_t,                                 va_list)

Usage:

remez(f, n, range, w, quality, bounds) : (function, integer, range, function, constant, range) -> function remez(f, L, range, w, quality, bounds) : (function, list, range, function, constant, range) -> function

Parameters:

Description:

Example 1:

   > p = remez(exp(x),5,[0;1]);
   > degree(p);
   5
   > dirtyinfnorm(p-exp(x),[0;1]);
   1.1295698151096148707171193829266077607222634589363e-6

Example 2:

   > p = remez(1,[|0,2,4,6,8|],[0,Pi/4],1/cos(x));
   > canonical=on!;
   > p;
   0.99999999994393732180959690352543887130348096061124 + -0.49999999571556857768772053063721544670949467222259 * x^2 + 4.1666613233473633009941059480570275870113220089059e-2 * x^4 + -1.3886529147145693651355523880319714051047635695061e-3 * x^6 + 2.4372679177224179934800328511009205218114284220126e-5 * x^8

Example 3:

   > p1 = remez(exp(x),5,[0;1],default,1e-5);
   > p2 = remez(exp(x),5,[0;1],default,1e-10);
   > p3 = remez(exp(x),5,[0;1],default,1e-15);
   > dirtyinfnorm(p1-exp(x),[0;1]);
   1.1295698151096148707171193829266077607222634589363e-6
   > dirtyinfnorm(p2-exp(x),[0;1]);
   1.12956980227478675612619255125474525171079325793124e-6
   > dirtyinfnorm(p3-exp(x),[0;1]);
   1.12956980227478675612619255125474525171079325793124e-6

Example 4:

   > L = [|exp(x), sin(x), cos(x)-1, sin(x^3)|];
   > g = (2^x-1)/x;
   > p1 = remez(g, L, [-1/16;1/16]);
   > p2 = remez(g, 3, [-1/16;1/16]);
   > dirtyinfnorm(p1 - g, [-1/16;1/16]);
   9.8841323829271038137685646777951687620288462194746e-8
   > dirtyinfnorm(p2 - g, [-1/16;1/16]);
   2.54337800593461418356437401152248866818783932027105e-9

Example 5:

   > f = sin(x);
   > I = [-3b-5;-1b-1074];
   > time(popt = remez(1, [|1, 3, 4, 5, 7, 8, 9|], I, 1/f));
   8.8774183000000000000000000000000000007706422098002e-2
   > time(p1 = remez(1, [|1, 3, 4, 5, 7, 8, 9|], I, 1/f, default, [0, 1b-73]));
   6.5226459000000000000000000000000000005765463881518e-2
   > time(p2 = remez(1, [|1, 3, 4, 5, 7, 8, 9|], I, 1/f, default, [3b-72, +@Inf@]));
   7.2436055999999999999999999999999999999862885825022e-2
   > dirtyinfnorm(popt/f-1, I);
   2.06750931454112835098093903810531156576504665659064e-22
   > dirtyinfnorm(p1/f-1, I);
   2.49711266837493110470637913808914046704452778960875e-22
   > dirtyinfnorm(p2/f-1, I);
   5.4567247553615435246376977231253834265248756996947e-22
   > 1b-73;
   1.05879118406787542383540312584955245256423950195312e-22
   > 3b-72;
   6.3527471044072525430124187550973147153854370117187e-22
See also: dirtyinfnorm, infnorm, fpminimax, guessdegree, taylorform, taylor, interpolate
Go back to the list of commands

Name:

rename rename the free variable.

Library name:

void sollya_lib_name_free_variable(const char *)

Usage:

rename(ident1,ident2) : void

Parameters:

Description:

Example 1:

   > f=sin(x);
   > f;
   sin(x)
   > rename(x,y);
   > f;
   sin(y)

Example 2:

   > a=1;
   > f=sin(x);
   > rename(x,a);
   > a;
   a
   > f;
   sin(a)

Example 3:

   > verbosity=1!;
   > f=sin(x);
   > rename(y, z);
   Warning: the current free variable is named "x" and not "y". Can only rename the free variable.
   The last command will have no effect.
   > rename(_x_, z);
   Information: the free variable has been renamed from "x" to "z".

Example 4:

   > verbosity=1!;
   > rename(x,y);
   Information: the free variable has been named "y".
   > isbound(x);
   false
   > isbound(y);
   true
See also: isbound
Go back to the list of commands

Name:

restart brings Sollya back to its initial state

Usage:

restart : void -> void

Description:

Example 1:

   > print(exp(x));
   exp(x)
   > a = 3;
   > restart;
   The tool has been restarted.
   > print(x);
   x
   > a;
   Warning: the identifier "a" is neither assigned to, nor bound to a library function nor external procedure, nor equal to the current free variable.
   Will interpret "a" as "x".
   x

Example 2:

   > print(exp(x));
   exp(x)
   > for i from 1 to 10 do {
     print(i);
     if (i == 5) then restart;
     };
   1
   2
   3
   4
   5
   The tool has been restarted.
   Warning: the tool has been restarted inside a for loop.
   The for loop will no longer be executed.

Example 3:

   > print(exp(x));
   exp(x)
   > a = 3;
   > for i from 1 to 10 do {
     print(i);
     if (i == 5) then {
     restart;
     i = 7;
     };
     };
   1
   2
   3
   4
   5
   The tool has been restarted.
   8
   9
   10
   > print(x);
   x
   > a;
   Warning: the identifier "a" is neither assigned to, nor bound to a library function nor external procedure, nor equal to the current free variable.
   Will interpret "a" as "x".
   x
See also: quit, execute
Go back to the list of commands

Name:

return indicates an expression to be returned in a procedure

Usage:

return expression : void

Parameters:

Description:

Example 1:

   > succ = proc(n) { var res; res := n + 1; return res; };
   > succ(5);
   6
   > succ;
   proc(n)
   {
   var res;
   res := (n) + (1);
   return res;
   }

Example 2:

   > hey = proc(s) { print("Hello",s); };
   > hey("world");
   Hello world
   > hey;
   proc(s)
   {
   print("Hello", s);
   return void;
   }
See also: proc, void
Go back to the list of commands

Name:

revert reverts a list.

Library name:

sollya_obj_t sollya_lib_revert(sollya_obj_t)

Usage:

revert(L) : list -> list

Parameters:

Description:

Example 1:

   > revert([| |]);
   [| |]

Example 2:

   > revert([|2,3,5,2,1,4|]);
   [|4, 1, 2, 5, 3, 2|]
See also: sort, head
Go back to the list of commands

Name:

RN constant representing rounding-to-nearest mode.

Library names:

sollya_obj_t sollya_lib_round_to_nearest() int sollya_lib_is_round_to_nearest(sollya_obj_t)

Description:

Example 1:

   > display=binary!;
   > round(Pi,20,RN);
   1.100100100001111111_2 * 2^(1)
See also: RD, RU, RZ, round, nearestint
Go back to the list of commands

Name:

roundcoefficients rounds the coefficients of a polynomial to classical formats.

Library name:

sollya_obj_t sollya_lib_roundcoefficients(sollya_obj_t, sollya_obj_t)

Usage:

roundcoefficients(p,L) : (function, list) -> function

Parameters:

Description:

Example 1:

   > p=exp(1) + x*(exp(2) + x*exp(3));
   > display=binary!;
   > roundcoefficients(p,[|DD,D,D|]);
   1.010110111111000010101000101100010100010101110110100101010011010101011111101110001010110001000000010011101_2 * 2^(1) + x * (1.110110001110011001001011100011010100110111011010111_2 * 2^(2) + x * (1.010000010101111001011011111101101111101100010000011_2 * 2^(4)))
   > roundcoefficients(p,[|DD,D...|]);
   1.010110111111000010101000101100010100010101110110100101010011010101011111101110001010110001000000010011101_2 * 2^(1) + x * (1.110110001110011001001011100011010100110111011010111_2 * 2^(2) + x * (1.010000010101111001011011111101101111101100010000011_2 * 2^(4)))

Example 2:

   > f=sin(exp(1)*x);
   > display=binary!;
   > f;
   sin(x * (1.0101101111110000101010001011000101000101011101101001010100110101010111111011100010101100010000000100111001111010011110011110001110110001011100111000101100000111101_2 * 2^(1)))
   > roundcoefficients(f,[|D...|]);
   sin(x * (1.0101101111110000101010001011000101000101011101101001010100110101010111111011100010101100010000000100111001111010011110011110001110110001011100111000101100000111101_2 * 2^(1)))

Example 3:

   > p=exp(1) + x*(exp(2) + x*exp(3));
   > verbosity=1!;
   > display=binary!;
   > roundcoefficients(p,[|DD,D|]);
   Warning: the number of the given formats does not correspond to the degree of the given polynomial.
   Warning: the 0th coefficient of the given polynomial does not evaluate to a floating-point constant without any rounding.
   Will evaluate the coefficient in the current precision in floating-point before rounding to the target format.
   Warning: the 1th coefficient of the given polynomial does not evaluate to a floating-point constant without any rounding.
   Will evaluate the coefficient in the current precision in floating-point before rounding to the target format.
   Warning: rounding may have happened.
   1.010110111111000010101000101100010100010101110110100101010011010101011111101110001010110001000000010011101_2 * 2^(1) + x * (1.110110001110011001001011100011010100110111011010111_2 * 2^(2) + x * (1.01000001010111100101101111110110111110110001000001011111001011010100101111011111110001010011011101000100110000111010001110010000010110000101100000111001011100101001_2 * 2^(4)))
See also: halfprecision, single, double, doubleextended, doubledouble, quad, tripledouble, fpminimax, remez, implementpoly, subpoly
Go back to the list of commands

Name:

roundcorrectly rounds an approximation range correctly to some precision

Library name:

sollya_obj_t sollya_lib_roundcorrectly(sollya_obj_t)

Usage:

roundcorrectly(range) : range -> constant

Parameters:

Description:

Example 1:

   > printbinary(roundcorrectly([1.010001_2; 1.0101_2]));
   1.01_2
   > printbinary(roundcorrectly([1.00001_2; 1.001_2]));
   1_2

Example 2:

   > roundcorrectly([-1; 1]);
   NaN
See also: round, mantissa, exponent, precision
Go back to the list of commands

Name:

roundingwarnings global variable controlling whether or not a warning is displayed when roundings occur.

Library names:

void sollya_lib_set_roundingwarnings_and_print(sollya_obj_t) void sollya_lib_set_roundingwarnings(sollya_obj_t) sollya_obj_t sollya_lib_get_roundingwarnings()

Usage:

roundingwarnings = activation value : on|off -> void roundingwarnings = activation value ! : on|off -> void roundingwarnings : on|off

Parameters:

Description:

Example 1:

   > verbosity=1!;
   > roundingwarnings = on;
   Rounding warning mode has been activated.
   > exp(0.1);
   Warning: Rounding occurred when converting the constant "0.1" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   Warning: rounding has happened. The value displayed is a faithful rounding to 165 bits of the true result.
   1.1051709180756476248117078264902466682245471947375
   > roundingwarnings = off;
   Rounding warning mode has been deactivated.
   > exp(0.1);
   1.1051709180756476248117078264902466682245471947375
See also: on, off, verbosity, midpointmode, rationalmode, suppressmessage, unsuppressmessage, showmessagenumbers, getsuppressedmessages
Go back to the list of commands

Name:

round rounds a number to a floating-point format.

Library name:

sollya_obj_t sollya_lib_round(sollya_obj_t, sollya_obj_t, sollya_obj_t)

Usage:

round(x,n,mode) : (constant, integer, RN|RZ|RU|RD) -> constant round(x,format,mode) : (constant, HP|halfprecision|SG|single|D|double|DE|doubleextended|DD|doubledouble|QD|quad|TD|tripledouble, RN|RZ|RU|RD) -> constant

Parameters:

Description:

Example 1:

   > display=binary!;
   > round(Pi,20,RN);
   1.100100100001111111_2 * 2^(1)

Example 2:

   > printdouble(round(exp(17),53,RU));
   0x417709348c0ea4f9
   > printdouble(D(exp(17)));
   0x417709348c0ea4f9

Example 3:

   > display=binary!;
   > a=2^(-1100);
   > round(a,53,RN);
   1_2 * 2^(-1100)
   > round(a,D,RN);
   0
   > double(a);
   0
See also: RN, RD, RU, RZ, halfprecision, single, double, doubleextended, doubledouble, quad, tripledouble, roundcoefficients, roundcorrectly, printdouble, printsingle, ceil, floor, nearestint
Go back to the list of commands

Name:

RU constant representing rounding-upwards mode.

Library names:

sollya_obj_t sollya_lib_round_up() int sollya_lib_is_round_up(sollya_obj_t)

Description:

Example 1:

   > display=binary!;
   > round(Pi,20,RU);
   1.100100100001111111_2 * 2^(1)
See also: RZ, RD, RN, round, ceil
Go back to the list of commands

Name:

RZ constant representing rounding-to-zero mode.

Library names:

sollya_obj_t sollya_lib_round_towards_zero() int sollya_lib_is_round_towards_zero(sollya_obj_t)

Description:

Example 1:

   > display=binary!;
   > round(Pi,20,RZ);
   1.1001001000011111101_2 * 2^(1)
See also: RD, RU, RN, round, floor, ceil
Go back to the list of commands

Name:

searchgal searches for a preimage of a function such that the rounding the image yields an error smaller than a constant

Library name:

sollya_obj_t sollya_lib_searchgal(sollya_obj_t, sollya_obj_t, sollya_obj_t,                                   sollya_obj_t, sollya_obj_t, sollya_obj_t)

Usage:

searchgal(function, start, preimage precision, steps, format, error bound) : (function, constant, integer, integer, HP|halfprecision|SG|single|D|double|DE|doubleextended|DD|doubledouble|QD|quad|TD|tripledouble, constant) -> list searchgal(list of functions, start, preimage precision, steps, list of format, list of error bounds) : (list, constant, integer, integer, list, list) -> list

Parameters:

Description:

Example 1:

   > searchgal(log(x),2,53,15,DD,1b-112);
   [| |]
   > searchgal(log(x),2,53,18,DD,1b-112);
   [|2.0000000000384972054234822280704975128173828125|]

Example 2:

   > f = exp(x);
   > s = searchgal(f,2,53,18,DD,1b-112);
   > if (s != [||]) then {
        v = s[0];
        print("The rounding error is 2^(",evaluate(log2(abs(DD(f)/f - 1)),v),")");
     } else print("No value found");
   The rounding error is 2^( -112.106878438809380148206984258358542322113874177832 )

Example 3:

   > searchgal([|sin(x),cos(x)|],1,53,15,[|D,D|],[|1b-62,1b-60|]);
   [|1.00000000000159494639717649988597258925437927246094|]
See also: round, double, doubledouble, tripledouble, evaluate, worstcase
Go back to the list of commands

Name:

SG short form for single
See also: single
Go back to the list of commands

Name:

showmessagenumbers activates, deactivates or inspects the state variable controlling the displaying of numbers for messages

Library names:

void sollya_lib_set_showmessagenumbers_and_print(sollya_obj_t) void sollya_lib_set_showmessagenumbers(sollya_obj_t) sollya_obj_t sollya_lib_get_showmessagenumbers()

Usage:

showmessagenumbers = activation value : on|off -> void showmessagenumbers = activation value ! : on|off -> void showmessagenumbers : on|off

Parameters:

Description:

Example 1:

   > verbosity = 1;
   The verbosity level has been set to 1.
   > 0.1;
   Warning: Rounding occurred when converting the constant "0.1" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   0.1
   > showmessagenumbers = on;
   Displaying of message numbers has been activated.
   > 0.1;
   Warning (174): Rounding occurred when converting the constant "0.1" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   0.1
   > showmessagenumbers;
   on
   > showmessagenumbers = off!;
   > 0.1;
   Warning: Rounding occurred when converting the constant "0.1" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   0.1

Example 2:

   > showmessagenumbers = on;
   Displaying of message numbers has been activated.
   > verbosity = 1;
   The verbosity level has been set to 1.
   > diff(0.1 * x + 1.5 * x^2);
   Warning (174): Rounding occurred when converting the constant "0.1" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   0.1 + x * 3
   > verbosity = 0;
   The verbosity level has been set to 0.
   > diff(0.1 * x + 1.5 * x^2);
   0.1 + x * 3
   > verbosity = 12;
   The verbosity level has been set to 12.
   > diff(0.1 * x + 1.5 * x^2);
   Warning (174): Rounding occurred when converting the constant "0.1" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   Information (196): formally differentiating a function.
   Information (197): differentiating the expression '0.1 * x + 1.5 * x^2'
   Information (195): expression '0.1 + 2 * 1.5 * x' has been simplified to expression '0.1 + 3 * x'.
   0.1 + x * 3
See also: getsuppressedmessages, suppressmessage, unsuppressmessage, verbosity, roundingwarnings
Go back to the list of commands

Name:

simplify simplifies an expression representing a function

Library name:

sollya_obj_t sollya_lib_simplify(sollya_obj_t)

Usage:

simplify(function) : function -> function

Parameters:

Description:

Example 1:

   > print(simplify((6 + 2) + (5 + exp(0)) * x));
   8 + 6 * x

Example 2:

   > print(simplify((log(x - x + 1) + asin(1))));
   (pi) / 2

Example 3:

   > print(simplify((log(x - x + 1) + asin(1)) - (atan(1) * 2)));
   (pi) / 2 - (pi) / 4 * 2
See also: dirtysimplify, autosimplify, rationalmode, horner
Go back to the list of commands

Names:

single, SG rounding to the nearest IEEE 754 single (binary32).

Library names:

sollya_obj_t sollya_lib_single(sollya_obj_t) sollya_obj_t sollya_lib_single_obj() int sollya_lib_is_single_obj(sollya_obj_t) sollya_obj_t sollya_lib_build_function_single(sollya_obj_t) #define SOLLYA_SG(x) sollya_lib_build_function_single(x)

Description:

Example 1:

   > display=binary!;
   > SG(0.1);
   1.10011001100110011001101_2 * 2^(-4)
   > SG(4.17);
   1.000010101110000101001_2 * 2^(2)
   > SG(1.011_2 * 2^(-1073));
   0
See also: halfprecision, double, doubleextended, doubledouble, quad, tripledouble, roundcoefficients, implementpoly, round, printsingle
Go back to the list of commands

Name:

sinh the hyperbolic sine function.

Library names:

sollya_obj_t sollya_lib_sinh(sollya_obj_t) sollya_obj_t sollya_lib_build_function_sinh(sollya_obj_t) #define SOLLYA_SINH(x) sollya_lib_build_function_sinh(x)

Description:

See also: asinh, cosh, tanh
Go back to the list of commands

Name:

sin the sine function.

Library names:

sollya_obj_t sollya_lib_sin(sollya_obj_t) sollya_obj_t sollya_lib_build_function_sin(sollya_obj_t) #define SOLLYA_SIN(x) sollya_lib_build_function_sin(x)

Description:

See also: asin, cos, tan
Go back to the list of commands

Name:

sort sorts a list of real numbers.

Library name:

sollya_obj_t sollya_lib_sort(sollya_obj_t)

Usage:

sort(L) : list -> list

Parameters:

Description:

Example 1:

   > sort([| |]);
   [| |]
   > sort([|2,3,5,2,1,4|]);
   [|1, 2, 2, 3, 4, 5|]
Go back to the list of commands

Name:

sqrt square root.

Library names:

sollya_obj_t sollya_lib_sqrt(sollya_obj_t) sollya_obj_t sollya_lib_build_function_sqrt(sollya_obj_t) #define SOLLYA_SQRT(x) sollya_lib_build_function_sqrt(x)

Description:

Go back to the list of commands

Name:

string keyword representing a string type

Library name:

SOLLYA_EXTERNALPROC_TYPE_STRING

Usage:

string : type type

Description:

See also: externalproc, boolean, constant, function, integer, list of, range, object
Go back to the list of commands

Name:

subpoly restricts the monomial basis of a polynomial to a list of monomials

Library name:

sollya_obj_t sollya_lib_subpoly(sollya_obj_t, sollya_obj_t)

Usage:

subpoly(polynomial, list) : (function, list) -> function

Parameters:

Description:

Example 1:

   > p = taylor(exp(x),5,0);
   > s = subpoly(p,[|1,3,5|]);
   > print(p);
   1 + x * (1 + x * (0.5 + x * (1 / 6 + x * (1 / 24 + x * 1 / 120))))
   > print(s);
   x * (1 + x^2 * (1 / 6 + x^2 / 120))

Example 2:

   > p = remez(atan(x),10,[-1,1]);
   > subpoly(p,[|1,3,5...|]);
   x * (0.99986632941452949026018468446163586361700915018232 + x^2 * (-0.33030478502455936362667794059988443130926433421739 + x^2 * (0.18015929317818756462894237037824735129130095574422 + x * (2.2845584115424788285112501565358576642429856963072e-9 + x * (-8.5156349064111377895500552996061844977507560037485e-2 + x * (-2.717563409627750199168187692393409435243830189218e-9 + x * (2.08451134307114729373239910549169872454686955895e-2 + x * 1.10889861181129057657199664386826630081793400489512e-9)))))))

Example 3:

   > subpoly(exp(x),[|1,2,3|]);
   0
See also: roundcoefficients, taylor, remez, fpminimax, implementpoly
Go back to the list of commands

Name:

substitute replace the occurrences of the free variable in an expression.

Library name:

sollya_obj_t sollya_lib_substitute(sollya_obj_t, sollya_obj_t)

Usage:

substitute(f,g) : (function, function) -> function substitute(f,t) : (function, constant) -> constant

Parameters:

Description:

Example 1:

   > f=sin(x);
   > g=cos(x);
   > substitute(f,g);
   sin(cos(x))
   > f(g);
   sin(cos(x))

Example 2:

   > a=1;
   > f=sin(x);
   > substitute(f,a);
   0.84147098480789650665250232163029899962256306079837
   > f(a);
   0.84147098480789650665250232163029899962256306079837
See also: evaluate, composepolynomials
Go back to the list of commands

Name:

supnorm computes an interval bounding the supremum norm of an approximation error (absolute or relative) between a given polynomial and a function.

Library name:

sollya_obj_t sollya_lib_supnorm(sollya_obj_t, sollya_obj_t, sollya_obj_t,                                 sollya_obj_t, sollya_obj_t)

Usage:

supnorm(p, f, I, errorType, accuracy) : (function, function, range, absolute|relative, constant) -> range

Parameters:

Description:

Example 1:

   > p = remez(exp(x), 5, [-1;1]);
   > midpointmode=on!;
   > supnorm(p, exp(x), [-1;1], absolute, 2^(-40));
   0.45205513967~0/2~e-4

Example 2:

   > prec=200!;
   > midpointmode=on!;
   > d = [1;2];
   > f = exp(cos(x)^2 + 1);
   > p = remez(1,15,d,1/f,1e-40);
   > theta=1b-60;
   > prec=default!;
   > mode=relative;
   > supnorm(p,f,d,mode,theta);
   0.30893006200251428~5/6~e-13

Example 3:

   > midpointmode=on!;
   > mode=relative;
   > theta=1b-135;
   > d = [-1b-2;1b-2];
   > f = expm1(x);
   > p = x * (1 +  x * ( 2097145 * 2^(-22) + x * ( 349527 * 2^(-21) + x * (87609 * 2^(-21) + x * 4369 * 2^(-19)))));
   > theta=1b-40;
   > supnorm(p,f,d,mode,theta);
   0.98349131972~2/3~e-7
See also: dirtyinfnorm, infnorm, checkinfnorm, absolute, relative, taylorform, autodiff, numberroots, diam
Go back to the list of commands

Name:

suppressmessage suppresses the displaying of messages with a certain number

Library names:

void sollya_lib_suppressmessage(sollya_obj_t, ...); void sollya_lib_v_suppressmessage(sollya_obj_t, va_list);

Usage:

suppressmessage(msg num 1, ..., msg num n) : (integer, ..., integer) -> void suppressmessage(msg list) : list -> void

Parameters:

Description:

Example 1:

   > verbosity = 1;
   The verbosity level has been set to 1.
   > 0.1;
   Warning: Rounding occurred when converting the constant "0.1" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   0.1
   > suppressmessage(174);
   > 0.1;
   0.1
   > suppressmessage(407);
   > 0.1;
   0.1
   > verbosity = 12;
   The verbosity level has been set to 12.
   > showmessagenumbers = on;
   Displaying of message numbers has been activated.
   > diff(exp(x * 0.1));
   Information (196): formally differentiating a function.
   Information (197): differentiating the expression 'exp(x * 0.1)'
   Information (207): no Horner simplification will be performed because the given tree is already in Horner form.
   exp(x * 0.1) * 0.1
   > suppressmessage(207, 196);
   > diff(exp(x * 0.1));
   Information (197): differentiating the expression 'exp(x * 0.1)'
   exp(x * 0.1) * 0.1
   > unsuppressmessage(174);
   > 0.1;
   Warning (174): Rounding occurred when converting the constant "0.1" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   0.1

Example 2:

   > verbosity = 12;
   The verbosity level has been set to 12.
   > showmessagenumbers = on;
   Displaying of message numbers has been activated.
   > diff(exp(x * 0.1));
   Warning (174): Rounding occurred when converting the constant "0.1" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   Information (196): formally differentiating a function.
   Information (197): differentiating the expression 'exp(x * 0.1)'
   Information (207): no Horner simplification will be performed because the given tree is already in Horner form.
   exp(x * 0.1) * 0.1
   > suppressmessage([| 174, 207, 196 |]);
   > diff(exp(x * 0.1));
   Information (197): differentiating the expression 'exp(x * 0.1)'
   exp(x * 0.1) * 0.1
See also: getsuppressedmessages, suppressmessage, unsuppressmessage, verbosity, roundingwarnings
Go back to the list of commands

Name:

sup gives the upper bound of an interval.

Library name:

sollya_obj_t sollya_lib_sup(sollya_obj_t)

Usage:

sup(I) : range -> constant sup(x) : constant -> constant

Parameters:

Description:

Example 1:

   > sup([1;3]);
   3
   > sup(5);
   5

Example 2:

   > display=binary!;
   > I=[0; 0.111110000011111_2];
   > sup(I);
   1.11110000011111_2 * 2^(-1)
   > prec=12!;
   > sup(I);
   1.11110000011111_2 * 2^(-1)
See also: inf, mid, max, min
Go back to the list of commands

Name:

tail gives the tail of a list.

Library name:

sollya_obj_t sollya_lib_tail(sollya_obj_t)

Usage:

tail(L) : list -> list

Parameters:

Description:

Example 1:

   > tail([|1,2,3|]);
   [|2, 3|]
   > tail([|1,2...|]);
   [|2...|]
See also: head, revert
Go back to the list of commands

Name:

tanh the hyperbolic tangent function.

Library names:

sollya_obj_t sollya_lib_tanh(sollya_obj_t) sollya_obj_t sollya_lib_build_function_tanh(sollya_obj_t) #define SOLLYA_TANH(x) sollya_lib_build_function_tanh(x)

Description:

See also: atanh, cosh, sinh
Go back to the list of commands

Name:

tan the tangent function.

Library names:

sollya_obj_t sollya_lib_tan(sollya_obj_t) sollya_obj_t sollya_lib_build_function_tan(sollya_obj_t) #define SOLLYA_TAN(x) sollya_lib_build_function_tan(x)

Description:

See also: atan, cos, sin
Go back to the list of commands

Name:

taylorform computes a rigorous polynomial approximation (polynomial, interval error bound) for a function, based on Taylor expansions.

Library names:

sollya_obj_t sollya_lib_taylorform(sollya_obj_t, sollya_obj_t,                                    sollya_obj_t, ...) sollya_obj_t sollya_lib_v_taylorform(sollya_obj_t, sollya_obj_t,                                      sollya_obj_t, va_list)

Usage:

taylorform(f, n, x0, I, errorType) : (function, integer, constant, range, absolute|relative) -> list taylorform(f, n, x0, I, errorType) : (function, integer, range, range, absolute|relative) -> list taylorform(f, n, x0, errorType) : (function, integer, constant, absolute|relative) -> list taylorform(f, n, x0, errorType) : (function, integer, range, absolute|relative) -> list

Parameters:

Description:

Example 1:

   > TL=taylorform(sin(x)/x, 10, 0, [-1,1], relative);
   > p=TL[0];
   > Delta=TL[2];
   > errors=TL[1];
   > for epsi in errors do epsi;
   [0;0]
   [0;0]
   [0;5.3455294201843912922810729343029637576303937602101e-51]
   [0;0]
   [-3.3409558876152445576756705839393523485189961001313e-52;3.3409558876152445576756705839393523485189961001313e-52]
   [0;0]
   [-1.04404871487976392427364705748104760891218628129103e-53;1.04404871487976392427364705748104760891218628129103e-53]
   [0;0]
   [-1.63132611699963113167757352731413688892529106451724e-55;1.63132611699963113167757352731413688892529106451724e-55]
   [0;0]
   [-1.91171029335894273243465647732125416670932546623114e-57;1.91171029335894273243465647732125416670932546623114e-57]
   > p; Delta;
   1 + x^2 * (-0.16666666666666666666666666666666666666666666666667 + x^2 * (8.3333333333333333333333333333333333333333333333333e-3 + x^2 * (-1.984126984126984126984126984126984126984126984127e-4 + x^2 * (2.7557319223985890652557319223985890652557319223986e-6 + x^2 * (-2.5052108385441718775052108385441718775052108385442e-8)))))
   [-1.6135797443886066084999806203254010793747502812764e-10;1.6135797443886066084999806203254010793747502812764e-10]

Example 2:

   > TL=taylorform(exp(x), 10, 0, [-1,1], absolute);
   > p=TL[0];
   > Delta=TL[2];
   > p; Delta;
   1 + x * (1 + x * (0.5 + x * (0.16666666666666666666666666666666666666666666666667 + x * (4.1666666666666666666666666666666666666666666666668e-2 + x * (8.3333333333333333333333333333333333333333333333333e-3 + x * (1.3888888888888888888888888888888888888888888888889e-3 + x * (1.984126984126984126984126984126984126984126984127e-4 + x * (2.4801587301587301587301587301587301587301587301587e-5 + x * (2.7557319223985890652557319223985890652557319223986e-6 + x * 2.7557319223985890652557319223985890652557319223986e-7)))))))))
   [-2.3114271964118761944124253418268474583253955510297e-8;2.7312660755642474420206278018039434042553645532164e-8]

Example 3:

   > TL1 = taylorform(exp(x), 10, log2(10), [-1,1], absolute);
   > TL2 = taylorform(exp(x), 10, [log2(10)], [-1,1], absolute);
   > TL1==TL2;
   false

Example 4:

   > TL1 = taylorform(exp(x), 3, 0, [0,1], relative);
   > TL2 = taylorform(exp(x), 3, 0, relative);
   > TL1[0]==TL2[0];
   true
   > TL1[1]==TL2[1];
   true
   > length(TL1);
   3
   > length(TL2);
   2

Example 5:

   > f = exp(cos(x)); x0 = 0;
   > TL = taylorform(f, 3, x0);
   > T1 = TL[0];
   > T2 = taylor(f, 3, x0);
   > print(coeff(T1, 2));
   -1.35914091422952261768014373567633124887862354685
   > print(coeff(T2, 2));
   -(0.5 * exp(1))
See also: diff, autodiff, taylor, remez, chebyshevform
Go back to the list of commands

Name:

taylorrecursions controls the number of recursion steps when applying Taylor's rule.

Library names:

void sollya_lib_set_taylorrecursions_and_print(sollya_obj_t) void sollya_lib_set_taylorrecursions(sollya_obj_t) sollya_obj_t sollya_lib_get_taylorrecursions()

Usage:

taylorrecursions = n : integer -> void taylorrecursions = n ! : integer -> void taylorrecursions : integer

Parameters:

Description:

Example 1:

   > f=exp(x);
   > p=remez(f,3,[0;1]);
   > taylorrecursions=0;
   The number of recursions for Taylor evaluation has been set to 0.
   > evaluate(f-p, [0;1]);
   [-0.46839364816268368775174657814112460243249079671039;0.46947781754646820647293019728402934746974652584671]
   > taylorrecursions=1;
   The number of recursions for Taylor evaluation has been set to 1.
   > evaluate(f-p, [0;1]);
   [-0.138131114954063839905475752120786856031651747712954;0.13921528433784835862665937126369160106890747684927]
See also: hopitalrecursions, evaluate, infnorm
Go back to the list of commands

Name:

taylor computes a Taylor expansion of a function in a point

Library name:

sollya_obj_t sollya_lib_taylor(sollya_obj_t, sollya_obj_t, sollya_obj_t)

Usage:

taylor(function, degree, point) : (function, integer, constant) -> function

Parameters:

Description:

Example 1:

   > print(taylor(exp(x),3,1));
   exp(1) + x * (exp(1) + x * (0.5 * exp(1) + x * exp(1) / 6))

Example 2:

   > print(taylor(asin(x),7,0));
   x * (1 + x^2 * (1 / 6 + x^2 * (3 / 40 + x^2 * 5 / 112)))

Example 3:

   > print(taylor(erf(x),6,0));
   x * (2 / sqrt(pi) + x^2 * ((2 / sqrt(pi) * (-2)) / 6 + x^2 * (2 / sqrt(pi) * 12) / 120))
See also: remez, fpminimax, taylorform
Go back to the list of commands

Name:

TD short form for tripledouble
See also: tripledouble
Go back to the list of commands

Name:

time procedure for timing Sollya code.

Usage:

time(code) : code -> constant

Parameters:

Description:

Example 1:

   > t = time(p=remez(sin(x),10,[-1;1]));
   > write(t,"s were spent computing p = ",p,"\n");
   5.1820970000000000000000000000000000003482307034367e-2s were spent computing p = 9.0486898749977990986908851357759191711354777014602e-17 * x^10 + 2.68762595115123596299959320959141640012683406736586e-6 * x^9 + -2.4247978492521313349073232289246205727856268698001e-16 * x^8 + -1.98344863020965929701245606503586461226130937598776e-4 * x^7 + 2.2748214757753544349162426281857910162575492126267e-16 * x^6 + 8.3333037186560980567697821420813799547276481409702e-3 * x^5 + -8.574715198972066974170696130354953131211051121887e-17 * x^4 + -0.166666661386013237076216566493953847771564552744173 * x^3 + 1.05699558969863875841493332282097022580493449058156e-17 * x^2 + 0.99999999973628365676559825181776417246038944720795 * x + (-3.1206530956601883024316320853642604562810646600878e-19)

Example 2:

   > write(time({ p=remez(sin(x),10,[-1;1]); write("The error is 2^(", log2(dirtyinfnorm(p-sin(x),[-1;1])), ")\n"); }), " s were spent\n");
   The error is 2^(log2(2.39601979446524486606649528289933482070294808074097e-11))
   7.8429420000000000000000000000000000003140228774323e-2 s were spent

Example 3:

   > t = time(bashexecute("sleep 10"));
   > write(~(t-10),"s of execution overhead.\n");
   3.49817700000000000000000000000000079155874788710945e-3s of execution overhead.

Example 4:

   > ratio := time(p=remez(sin(x),10,[-1;1]))/time(nop(10));
   > write("This ratio = ", ratio, " should somehow be independent of the type of machine.\n");
   This ratio = 1.3726324294540284382195309171761413410808651617341 should somehow be independent of the type of machine.
See also: timing, nop
Go back to the list of commands

Name:

timing global variable controlling timing measures in Sollya.

Library names:

void sollya_lib_set_timing_and_print(sollya_obj_t) void sollya_lib_set_timing(sollya_obj_t) sollya_obj_t sollya_lib_get_timing()

Usage:

timing = activation value : on|off -> void timing = activation value ! : on|off -> void timing : on|off

Parameters:

Description:

Example 1:

   > verbosity=1!;
   > timing=on;
   Timing has been activated.
   > p=remez(sin(x),10,[-1;1]);
   Information: Remez: computing the quality of approximation spent 6 ms
   Information: Remez: computing the quality of approximation spent 4 ms
   Information: Remez: computing the quality of approximation spent 4 ms
   Information: computing a minimax approximation spent 33 ms
   Information: assignment spent 39 ms
   Information: full execution of the last parse chunk spent 46 ms
See also: on, off, time
Go back to the list of commands

Names:

tripledouble, TD represents a number as the sum of three IEEE doubles.

Library names:

sollya_obj_t sollya_lib_triple_double(sollya_obj_t) sollya_obj_t sollya_lib_triple_double_obj() int sollya_lib_is_triple_double_obj(sollya_obj_t) sollya_obj_t sollya_lib_build_function_triple_double(sollya_obj_t) #define SOLLYA_TD(x) sollya_lib_build_function_triple_double(x)

Description:

Example 1:

   > verbosity=1!;
   > a = 1+ 2^(-55)+2^(-115);
   > TD(a);
   1.00000000000000002775557561562891353466491600711096
   > prec=110!;
   > TD(a);
   1.000000000000000027755575615628913534664916007110955975699724
See also: halfprecision, single, double, doubleextended, doubledouble, quad, roundcoefficients, implementpoly, fpminimax, printexpansion
Go back to the list of commands

Name:

true the boolean value representing the truth.

Library names:

sollya_obj_t sollya_lib_true() int sollya_lib_is_true(sollya_obj_t)

Description:

Example 1:

   > true && false;
   false
   > 2>1;
   true
See also: false, &&, ||
Go back to the list of commands

Name:

unsuppressmessage unsuppresses the displaying of messages with a certain number

Library names:

void sollya_lib_unsuppressmessage(sollya_obj_t, ...); void sollya_lib_v_unsuppressmessage(sollya_obj_t, va_list);

Usage:

unsuppressmessage(msg num 1, ..., msg num n) : (integer, ..., integer) -> void unsuppressmessage(msg list) : list -> void

Parameters:

Description:

Example 1:

   > verbosity = 1;
   The verbosity level has been set to 1.
   > 0.1;
   Warning: Rounding occurred when converting the constant "0.1" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   0.1
   > suppressmessage(174);
   > 0.1;
   0.1
   > suppressmessage(174);
   > 0.1;
   0.1

Example 2:

   > verbosity = 12;
   The verbosity level has been set to 12.
   > showmessagenumbers = on;
   Displaying of message numbers has been activated.
   > diff(exp(x * 0.1));
   Warning (174): Rounding occurred when converting the constant "0.1" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   Information (196): formally differentiating a function.
   Information (197): differentiating the expression 'exp(x * 0.1)'
   Information (207): no Horner simplification will be performed because the given tree is already in Horner form.
   exp(x * 0.1) * 0.1
   > suppressmessage([| 174, 207, 196 |]);
   > diff(exp(x * 0.1));
   Information (197): differentiating the expression 'exp(x * 0.1)'
   exp(x * 0.1) * 0.1
   > unsuppressmessage([| 174, 196 |]);

Example 3:

   > verbosity = 12;
   The verbosity level has been set to 12.
   > showmessagenumbers = on;
   Displaying of message numbers has been activated.
   > suppressmessage(207, 387, 390, 388, 391, 196, 195, 197, 205);
   > getsuppressedmessages();
   [|195, 196, 197, 205, 207, 387, 388, 390, 391|]
   > evaluate(x/sin(x) - 1, [-1;1]);
   [0;0.8508157176809256179117532413986501934703966550941]
   > unsuppressmessage(getsuppressedmessages());
   > getsuppressedmessages();
   [| |]
See also: getsuppressedmessages, suppressmessage, unsuppressmessage, verbosity, roundingwarnings
Go back to the list of commands

Name:

var declaration of a local variable in a scope

Usage:

var identifier1, identifier2,... , identifiern : void

Parameters:

Description:

Example 1:

   > exp(x);
   exp(x)
   > a = 3;
   > {var a, b; a=5; b=3; {var a; var b; b = true; a = 1; a; b;}; a; b; };
   1
   true
   5
   3
   > a;
   3
See also: error, proc
Go back to the list of commands

Name:

verbosity global variable controlling the amount of information displayed by commands.

Library names:

void sollya_lib_set_verbosity_and_print(sollya_obj_t) void sollya_lib_set_verbosity(sollya_obj_t) sollya_obj_t sollya_lib_get_verbosity()

Usage:

verbosity = n : integer -> void verbosity = n ! : integer -> void verbosity : integer

Parameters:

Description:

Example 1:

   > verbosity=0!;
   > 1.2+"toto";
   error
   > verbosity=1!;
   > 1.2+"toto";
   Warning: Rounding occurred when converting the constant "1.2" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   Warning: at least one of the given expressions or a subexpression is not correctly typed
   or its evaluation has failed because of some error on a side-effect.
   error
   > verbosity=2!;
   > 1.2+"toto";
   Warning: Rounding occurred when converting the constant "1.2" to floating-point with 165 bits.
   If safe computation is needed, try to increase the precision.
   Warning: at least one of the given expressions or a subexpression is not correctly typed
   or its evaluation has failed because of some error on a side-effect.
   Information: the expression or a partial evaluation of it has been the following:
   (1.2) + ("toto")
   error
See also: roundingwarnings, suppressmessage, unsuppressmessage, showmessagenumbers, getsuppressedmessages
Go back to the list of commands

Name:

void the functional result of a side-effect or empty argument resp. the corresponding type

Library names:

sollya_obj_t sollya_lib_void() int sollya_lib_is_void(sollya_obj_t) SOLLYA_EXTERNALPROC_TYPE_VOID

Usage:

void : void | type type

Description:

Example 1:

   > print(void);
   void
   > void;

Example 2:

   > hey = proc() { print("Hello world."); };
   > hey;
   proc()
   {
   print("Hello world.");
   return void;
   }
   > hey();
   Hello world.
   > hey(void);
   Hello world.
   > print(hey());
   Hello world.
   void

Example 3:

   > bashexecute("gcc -fPIC -Wall -c externalprocvoidexample.c");
   > bashexecute("gcc -fPIC -shared -o externalprocvoidexample externalprocvoidexample.o");
   > externalproc(foo, "./externalprocvoidexample", void -> void);
   > foo;
   foo
   > foo();
   Hello from the external world.
   > foo(void);
   Hello from the external world.
   > print(foo());
   Hello from the external world.
   void

Example 4:

   > procedure blub(L = ...) { print("Argument list:", L); };
   > blub(1);
   Argument list: [|1|]
   > blub();
   Argument list: [| |]
   > blub(void);
   Argument list: [|void|]
See also: error, proc, externalproc
Go back to the list of commands

Name:

worstcase searches for hard-to-round cases of a function

Library names:

void sollya_lib_worstcase(sollya_obj_t, sollya_obj_t, sollya_obj_t,                           sollya_obj_t, sollya_obj_t, ...) void sollya_lib_v_worstcase(sollya_obj_t, sollya_obj_t, sollya_obj_t,                             sollya_obj_t, sollya_obj_t, va_list)

Usage:

worstcase(function, preimage precision, preimage exponent range, image precision, error bound) : (function, integer, range, integer, constant) -> void worstcase(function, preimage precision, preimage exponent range, image precision, error bound, filename) : (function, integer, range, integer, constant, string) -> void

Parameters:

Description:

Example 1:

   > worstcase(exp(x),24,[1,2],24,1b-26);
   prec = 165
   x = 1.99999988079071044921875 f(x) = 7.3890552520751953125 eps = 4.5998601423446695596184695493764120138001954979037e-9 = 2^(-27.695763)
   x = 2 f(x) = 7.38905620574951171875 eps = 1.44563608749673018122228379395533417878125150587072e-8 = 2^(-26.043720)
   
See also: round, searchgal, evaluate
Go back to the list of commands

Name:

write prints an expression without separators

Usage:

write(expr1,...,exprn) : (any type,..., any type) -> void write(expr1,...,exprn) > filename : (any type,..., any type, string) -> void write(expr1,...,exprn) >> filename : (any type,...,any type, string) -> void

Parameters:

Description:

Example 1:

   > write(x + 2 + exp(sin(x)));
   > write("Hello\n");
   x + 2 + exp(sin(x))Hello
   > write("Hello","world\n");
   Helloworld
   > write("Hello","you", 4 + 3, "other persons.\n");
   Helloyou7other persons.

Example 2:

   > write("Hello","\n");
   Hello
   > write([|"Hello"|],"\n");
   [|"Hello"|]
   > s = "Hello";
   > write(s,[|s|],"\n");
   Hello[|"Hello"|]
   > t = "Hello\tyou";
   > write(t,[|t|],"\n");
   Hello you[|"Hello\tyou"|]

Example 3:

   > write(x + 2 + exp(sin(x))) > "foo.sol";
   > readfile("foo.sol");
   x + 2 + exp(sin(x))

Example 4:

   > write(x + 2 + exp(sin(x))) >> "foo.sol";
See also: print, printexpansion, printdouble, printsingle, printxml, readfile, autosimplify, display, midpointmode, fullparentheses, evaluate, roundingwarnings, autosimplify
Go back to the list of commands

Name:

_x_ universal name for the mathematical free variable.

Library names:

sollya_obj_t sollya_lib_free_variable() sollya_obj_t sollya_lib_build_function_free_variable() #define SOLLYA_X_ (sollya_lib_build_function_free_variable())

Description:

Example 1:

   > verbosity=1!;
   > sin(a);
   sin(a)
   > b;
   Warning: the identifier "b" is neither assigned to, nor bound to a library function nor external procedure, nor equal to the current free variable.
   Will interpret "b" as "a".
   a
   > _x_;
   a

Example 2:

   > verbosity=1!;
   > sin(y);
   sin(y)
   > f = proc(a) {
       return sin(a + _x_);
     };
   > rename(y,z);
   Information: the free variable has been renamed from "y" to "z".
   > f(1);
   sin(1 + z)

Example 3:

   > f = sin(y);
   > match f with
       sin(a) : { print("sin of a with a =", a);
                  match a with
                    _x_ : { print("a turns out to be the free variable"); }
            default : { print("a is some expression"); };
                }
       _x_ : { print("Free variable") ; }
       default: { print("Something else"); };
   sin of a with a = y
   a turns out to be the free variable
See also: rename, isbound, proc
Go back to the list of commands