Go back to the main page of Sollya

Commands available within Sollya

Help pages

Go back to the list of commands

Name:

abs the absolute value.

Description:

Go back to the list of commands

Name:

absolute indicates an absolute error for externalplot, fpminimax or supnorm

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.520552107578623690642416477203369140625e-5
   > accurateinfnorm(p - exp(x), [-1;1], 40);
   4.5205521043867324948450914234854280948638916015625e-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.5205521043867324948450914234854280948638916015625e-5
See also: infnorm, dirtyinfnorm, supnorm, checkinfnorm, remez, diam
Go back to the list of commands

Name:

acos the arccosine function.

Description:

See also: cos
Go back to the list of commands

Name:

acosh the arg-hyperbolic cosine function.

Description:

See also: cosh
Go back to the list of commands

Name:

&& boolean AND operator

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:

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

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

Usage:

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

Parameters:

Description:

Example 1:

   > print(exp(5));
   exp(5)
   > print(~ exp(5));
   1.48413159102576603421115580040552279623487667593878e2

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 * 1.57079632679489661923132169163975144209858469968757e1)

Example 6:

   > print(~exp(5)*x);
   1.48413159102576603421115580040552279623487667593878e2 * x
   > print( (~exp(5))*x);
   1.48413159102576603421115580040552279623487667593878e2 * 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

Usage:

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

Parameters:

Description:

Example 1:

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

Example 2:

   > asciiplot(expm1(x),[-1;2]);
                            |                                                 x
                            |                                                x
                            |                                               x  
                            |                                              x   
                            |                                             x    
                            |                                           xx     
                            |                                          x       
                            |                                         x        
                            |                                       xx         
                            |                                     xx           
                            |                                   xx             
                            |                                 xx               
                            |                                x                 
                            |                             xxx                  
                            |                           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.71828182845904523536028747135266249775724709369998
See also: plot, externalplot
Go back to the list of commands

Name:

asin the arcsine function.

Description:

See also: sin
Go back to the list of commands

Name:

asinh the arg-hyperbolic sine function.

Description:

See also: sinh
Go back to the list of commands

Name:

atan the arctangent function.

Description:

See also: tan
Go back to the list of commands

Name:

atanh the hyperbolic arctangent function.

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.

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.75680249530792825137263909451182909413591288733649]
   > evaluate(fprime,[2,4]);
   [2.71048755415961996452136364304380881763456815673085e-2;1.10919530663943290837397225788623531405558431279949]

Example 3:

   > L = autodiff(sin(x)/x, 0, [-1,1]);
   > L[0];
   [-@Inf@;@Inf@]
   > 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

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));
   0.5
   > autosimplify = off !;
   > print(rationalapprox(sin(pi/5.9),7));
   1 / 2
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

Usage:

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

Parameters:

Description:

Example 1:

   > bashevaluate("LANG=C date");
   Mon May 23 17:51:41 CEST 2011

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.

Usage:

bashexecute(command) : string -> void

Parameters:

Description:

Example 1:

   > bashexecute("LANG=C date");
   Mon May 23 17:51:46 CEST 2011
See also: execute, readfile, parse, bashevaluate
Go back to the list of commands

Name:

binary special value for global state display

Description:

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

Name:

boolean keyword representing a boolean type

Usage:

boolean : type type

Description:

See also: externalproc, constant, function, integer, list of, range, string
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

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.

Description:

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

Name:

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

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

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:

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

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:

   > 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, proc
Go back to the list of commands

Name:

constant keyword representing a constant type

Usage:

constant : type type

Description:

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

Name:

cos the cosine function.

Description:

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

Name:

cosh the hyperbolic cosine function.

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

Description:

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

Name:

default default value for some commands.

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.

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

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.

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.

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 of the true result.
   2.41549527535752982147754351803858238798675673527224e7

Example 2:

   > verbosity = 1!;
   > dieonerrormode = off!;
   > 5 */  4;
   Warning: syntax error, unexpected DIVTOKEN.
   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 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 DIVTOKEN.
   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

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.

Usage:

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

Parameters:

Description:

Example 1:

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

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.

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.458528537135
   > prec=100!;
   > dirtyinfnorm(exp(cos(x))*sin(x),[0;5]);
   1.458528537136237644438147455024
   > 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.

Usage:

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

Parameters:

Description:

Example 1:

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

Name:

display sets or inspects the global variable specifying number notation

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;
   0xb.504f333f9de6484597d89b3754abe9f1d6f60ba88p-4
   > 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:

/ division function

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.8823529411764705882352941176470588235294117647058e-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).

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.

Description:

Example 1:

   > verbosity=1!;
   > a = 1+ 2^(-100);
   > DD(a);
   1.0000000000000000000000000000007888609052210118054
   > prec=50!;
   > DD(a);
   Warning: double rounding occurred on invoking the double-double rounding operator.
   Try to increase the working precision.
   1
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.

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 of the true result.
   -5.0165576126683320235573270803307570138315616702549e-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

Description:

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

Name:

== equality test operator

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:

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

Example 3:

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

Example 4:

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

Example 5:

   > error == error;
   false

Example 6:

   > a = "Biba";
   > b = NaN;
   > a == a;
   true
   > b == b;
   false
See also: !=, >, >=, <=, <, in, !, &&, ||, error, prec
Go back to the list of commands

Name:

erfc the complementary error function.

Description:

See also: erf
Go back to the list of commands

Name:

erf the error function.

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

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

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));
   [-1.72986452514381269516508615031098129542836767991679e-12715;7.5941198201187963145069564314525661706039084390067e-12716]

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 + 0.25 * x))

Example 5:

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

Name:

execute executes the content of a file

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

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: simplify, simplifysafe, horner, coeff, degree
Go back to the list of commands

Name:

exp the exponential function.

Description:

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

Name:

expm1 shifted exponential function.

Description:

See also: exp
Go back to the list of commands

Name:

exponent returns the scaled binary exponent of a number.

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

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

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(integer, integer) -> integer
   > 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.

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

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.

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

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

Usage:

floating : fixed|floating

Description:

Example 1:

   > fpminimax(cos(x),6,[|D...|],[-1;1],floating);
   0.99999974816012948686250183527590706944465637207031 + x * (5.5210044061222495131782035802443168321913900126185e-14 + x * (-0.4999928698019768802396356477402150630950927734375 + x * (-3.95371609372064761555136192612768146546591008227978e-13 + x * (4.16335155285858099505347240665287245064973831176758e-2 + x * (5.2492670395835122748014980938834327670386437070249e-13 + x * (-1.33822408807599468535953768366653093835338950157166e-3))))))
See also: fpminimax, fixed
Go back to the list of commands

Name:

floor the usual function floor.

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

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 + 0xbc09fda20235c100) + x * ((0x3b29ecd485d34781 + 0xb7c1cbc97120359a) + x * (0xbfdfffffffffff98 + x * (0xbbfa6e0b3183cb0d + x * (0x3fa5555555145337 + x * (0x3ca3540480618939 + x * 0xbf56c138142d8c3b)))))

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.9048441305459735102879831325718745399379329453102e-16
   > print("Error of P1:    ", dirtyinfnorm(f-P1, [-1b-7; 1b-7]));
   Error of P1:     7.9048441305459735159848647089192667442047469404883e-16
   > print("Error of P2:    ", dirtyinfnorm(f-P2, [-1b-7; 1b-7]));
   Error of P2:     8.2477144579950871061147021597406077993657714575238e-16
   > print("Error of P3:    ", dirtyinfnorm(f-P3, [-1b-7; 1b-7]));
   Error of P3:     1.08454277156993282593701156841863009789063333951055e-15
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

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

Usage:

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

Parameters:

Description:

Example 1:

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

Name:

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

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:

> greater-than operator

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.

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;@Inf@]

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).

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

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

Usage:

honorcoeffprec : honorcoeffprec

Description:

Example 1:

   > verbosity = 1!;
   > q = implementpoly(1 - simplify(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 - simplify(TD(1/6)) * x^2,[-1b-10;1b-10],1b-60,DD,"p","implementation.c",honorcoeffprec);
   Warning: the infered 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.

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]);
   [-@Inf@;@Inf@]
   > 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.52258872223978123766892848583270627230200053744108;6.7725887222397812376689284858327062723020005374411]
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

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, simplifysafe
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

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));
   #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");
   > readfile("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");
   #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");
   > readfile("constant_code.c");
   #include <mpfr.h>
   
   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));
   #include <mpfr.h>
   
   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
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

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.3333333333333332176851016015461937058717012405395e-3)
   > readfile("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.3333333333333332176851016015461937058717012405395e-3)

Example 3:

   > verbosity = 1!;
   > q = implementpoly(1 - simplify(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 - simplify(TD(1/6)) * x^2,[-1b-10;1b-10],1b-60,DD,"p","implementation.c",honorcoeffprec);
   Warning: the infered 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, readfile, printexpansion, error, remez, fpminimax, taylor
Go back to the list of commands

Name:

inf gives the lower bound of an interval.

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.

Usage:

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

Parameters:

Description:

Example 1:

   > infnorm(exp(x),[-2;3]);
   [2.00855369231876677409285296545817178969879078385537e1;2.00855369231876677409285296545817178969879078385544e1]

Example 2:

   > infnorm(exp(x),[-2;3],"proof.txt");
   [2.00855369231876677409285296545817178969879078385537e1;2.00855369231876677409285296545817178969879078385544e1]

Example 3:

   > infnorm(exp(x),[-2;3],[| [0;1], [2;2.5] |]);
   [2.00855369231876677409285296545817178969879078385537e1;2.00855369231876677409285296545817178969879078385544e1]

Example 4:

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

Example 5:

   > infnorm(exp(x),[1;1]);
   [2.71828182845904523536028747135266249775724709369989;2.71828182845904523536028747135266249775724709369998]

Example 6:

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

Name:

in containment test operator

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

Usage:

integer : type type

Description:

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

Name:

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

Usage:

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

Parameters:

Description:

Example 1:

   > sin(10);
   -0.54402111088936981340474766185137728168364301291621
   > integral(cos(x),[0;10]);
   [-0.54710197983579690224097637163525943075698599257332;-0.54094015130013183848150540881373370744053741191728]
   > 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:

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
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 * 1/x), 0.75);
   true
   > print(evaluate(sin(pi * 1/x), 0.75));
   -0.86602540378443864676372317075293618347140262690518

Example 2:

   > isevaluable(sin(pi * 1/x), 0.5);
   true
   > print(evaluate(sin(pi * 1/x), 0.5));
   [-1.72986452514381269516508615031098129542836767991679e-12715;7.5941198201187963145069564314525661706039084390067e-12716]

Example 3:

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

Name:

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

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.

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...|]);
   @Inf@
Go back to the list of commands

Name:

libraryconstant binds an external mathematical constant to a variable in Sollya

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.577215664901532860606512090~0/1~
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

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.69314718055994530941723212145817656807550013436024
   > evaluate(myownlog(x), 2);
   0.69314718055994530941723212145817656807550013436024
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

Description:

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

Name:

log10 decimal logarithm.

Description:

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

Name:

log1p translated logarithm.

Description:

See also: log
Go back to the list of commands

Name:

log2 binary logarithm.

Description:

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

Name:

log natural logarithm.

Description:

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

Name:

< less-than operator

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.

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

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));
   1.48413159102576603421115580040552279623487667593878e2
   > max(17);
   17

Example 2:

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

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: maximum computation relies on floating-point result that is faithfully evaluated and different faithful roundings toggle the result.
   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.

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.

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

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: minimum computation relies on floating-point result that is faithfully evaluated and different faithful roundings toggle the result.
   17 + log(13) / log(9)
See also: max, ==, !=, >=, >, <, <=, in, inf, sup
Go back to the list of commands

Name:

- subtraction function

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:

* multiplication function

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.

Description:

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

Name:

!= negated equality test operator

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:

   > error != error;
   false
See also: ==, >, >=, <=, <, in, !, &&, ||, error, prec
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

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.

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
Go back to the list of commands

Name:

numerator gives the numerator of an expression

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:

off special value for certain global variables.

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.

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

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

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 1.00004475029055070643077052482053398765426158966754 + x * (1.00003834652983970735244541124504033817544233075356 + x * (0.49919698262882986492168824494240374771969012861297 + x * (0.166424656075155194415920597322727380932279602909199 + x * (4.37936963873280470271257566207183496659575464236489e-2 + x * 8.7381910388065551140158420278330960479960476713376e-3))))

Example 3:

   > verbosity = 1!;
   > parse("5 + * 3");
   Warning: syntax error, unexpected MULTOKEN. 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

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.

Description:

Example 1:

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

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

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

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.

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.318309886183790671537767526745028724068919291480918|]
   > points=100;
   The number of points has been set to 100.
   > dirtyfindzeros(f, [0;1]);
   [|0, 2.4485375860291590118289809749617594159147637806224e-2, 3.97887357729738339422209408431285905086149114351147e-2, 4.54728408833986673625382181064326748669884702115589e-2, 5.3051647697298445256294587790838120678153215246819e-2, 6.3661977236758134307553505349005744813783858296183e-2, 7.9577471545947667884441881686257181017229822870229e-2, 0.106103295394596890512589175581676241356306430493638, 0.159154943091895335768883763372514362034459645740459, 0.318309886183790671537767526745028724068919291480918|]
See also: dirtyinfnorm, dirtyintegral, dirtyfindzeros, plot, diam, prec
Go back to the list of commands

Name:

postscriptfile special value for commands plot and externalplot

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

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

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.1152263374485596707818930041152263374485596707818e-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;1.60000000000000000000000000000000000000000000000007e1]
   > [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

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.

Usage:

precision(x) : constant -> integer

Parameters:

Description:

Example 1:

   > a=round(Pi,20,RN);
   > precision(a);
   19
   > m=mantissa(a);
   > ceil(log2(m));
   19
See also: mantissa, exponent, round
Go back to the list of commands

Name:

prec controls the precision used in numerical computations.

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.

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

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 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

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]));
   (0x3ff0002eec908ce9 + 0xbc7df99eb225af5b + 0xb8d55834b08b1f18) + x * ((0x3ff0002835917719 + 0x3c6d82c073b25ebf + 0xb902cf062b54b7b6 + 0x35b0000000000000) + x * ((0x3fdff2d7e6a9c5e9 + 0xbc7b09a95b0d520f + 0xb915b639add55731 + 0x35a8000000000000) + x * ((0x3fc54d67338ba09f + 0x3c4867596d0631cf + 0xb8ef0756bdb4af6e) + x * ((0x3fa66c209b825167 + 0x3c45ec5b6655b076 + 0xb8d8c125286400bc) + x * (0x3f81e55425e72ab4 + 0x3c263b25a1bf597b + 0xb8c843e0401dadd0 + 0x3540000000000000)))))

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);
   0xb.504f333f9de6484597d89b3754abe9f1d6f60ba88p-4
   > 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.70710678118654752440084436210484903928483593768844;0.70710678118654949743721782517557347782646274417048]
   > 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

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 will be used.
   Warning: rounding down occurred before printing a value as a simple.
   0x431469c5
See also: printdouble, single
Go back to the list of commands

Name:

printxml prints an expression as an MathML-Content-Tree

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.gforge.inria.fr/ -->
   <!-- syntax: printxml(...);   example: printxml(x^2-2*x+5); -->
   <?xml-stylesheet type="text/xsl" href="http://sollya.gforge.inria.fr/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
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, @, 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).

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

Usage:

range : type type

Description:

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

Name:

rationalapprox returns a fraction close to a given number.

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, ": ", simplify(floor(-log2(abs(pi10-Pi)/Pi))), "bits." );
   22 / 7 :  11 bits.
   > print( pi50, ": ", simplify(floor(-log2(abs(pi50-Pi)/Pi))), "bits." );
   90982559 / 28960648 :  50 bits.
   > print( pi100, ": ", simplify(floor(-log2(abs(pi100-Pi)/Pi))), "bits." );
   4850225745369133 / 1543874804974140 :  101 bits.

Example 2:

   > a=0.1;
   > b=rationalapprox(a,4);
   > numerator(b); denominator(b);
   1
   10
   > print(simplify(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.

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.15680977395514136754709208944824276340328162814418
   > rationalmode=on!;
   > exp(19/17 + 3/94);
   3.15680977395514136754709208944824276340328162814418
See also: on, off, numerator, denominator, simplifysafe, rationalapprox, autosimplify
Go back to the list of commands

Name:

RD constant representing rounding-downwards mode.

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

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

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.

Usage:

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

Parameters:

Description:

Example 1:

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

Example 2:

   > p = remez(1,[|0,2,4,6,8|],[0,Pi/4],1/cos(x));
   > canonical=on!;
   > p;
   0.99999999994393749280444571988532724907643631727381 + -0.49999999571557467737204931630836834563663039748203 * x^2 + 4.16666132335010905188253972212748718651775241902969e-2 * x^4 + -1.38865291475286141707180658383176799662601691348739e-3 * x^6 + 2.437267919111162694221738667927916761689966804242e-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.12956984638214536849843017679626063762687501534126e-6
   > dirtyinfnorm(p2-exp(x),[0;1]);
   1.12956980227478687332174207517728389861926659249056e-6
   > dirtyinfnorm(p3-exp(x),[0;1]);
   1.12956980227478687332174207517728389861926659249056e-6
See also: dirtyinfnorm, infnorm, fpminimax, guessdegree, taylorform, taylor
Go back to the list of commands

Name:

rename rename the free variable.

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.

Example 4:

   > rename(x,y);
   > isbound(x);
   false
   > isbound(y);
   true
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.

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|]
Go back to the list of commands

Name:

RN constant representing rounding-to-nearest mode.

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.

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

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.

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 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
Go back to the list of commands

Name:

round rounds a number to a floating-point format.

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.

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.

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

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^( -1.12106878438809380148206984258358542322113874177832e2 )

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:

simplifysafe simplifies an expression representing a function

Usage:

simplifysafe(function) : function -> function

Parameters:

Description:

Example 1:

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

Example 2:

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

Example 3:

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

Name:

simplify simplifies an expression representing a function

Usage:

simplify(function) : function -> function

Parameters:

Description:

Example 1:

   > print(simplify(sin(pi * x)));
   sin(3.14159265358979323846264338327950288419716939937508 * x)
   > print(simplify(erf(exp(3) + x * log(4))));
   erf(2.00855369231876677409285296545817178969879078385544e1 + x * 1.3862943611198906188344642429163531361510002687205)

Example 2:

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

Names:

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

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.

Description:

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

Name:

sin the sine function.

Description:

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

Name:

sort sorts a list of real numbers.

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.

Description:

Go back to the list of commands

Name:

string keyword representing a string type

Usage:

string : type type

Description:

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

Name:

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

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 / 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.99986632946591986997581285958052433296267358727229 + x^2 * (-0.330304785504861260596093435534236137298206064685038 + x^2 * (0.180159294636523467997437751178959039617773054107393 + x * (-1.21704858321866028906175835649390114311877360260197e-14 + x * (-8.5156350833702702996505336803770858918120961566741e-2 + x * (1.39681284176342339364451388757935358048374878126733e-14 + x * (2.0845114175434561643018447784809880955983412532269e-2 + x * (-5.6810131012579436265697622426011349460288598691964e-15))))))))

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.

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
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.

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.452055210438~2/7~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:

sup gives the upper bound of an interval.

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.

Usage:

tail(L) : list -> list

Parameters:

Description:

Example 1:

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

Name:

tanh the hyperbolic tangent function.

Description:

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

Name:

tan the tangent function.

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.

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.98412698412698412698412698412698412698412698412698e-4 + x^2 * (2.75573192239858906525573192239858906525573192239859e-6 + x^2 * (-2.50521083854417187750521083854417187750521083854419e-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.1666666666666666666666666666666666666666666666667e-2 + x * (8.3333333333333333333333333333333333333333333333333e-3 + x * (1.38888888888888888888888888888888888888888888888889e-3 + x * (1.98412698412698412698412698412698412698412698412698e-4 + x * (2.4801587301587301587301587301587301587301587301587e-5 + x * (2.75573192239858906525573192239858906525573192239859e-6 + x * 2.7557319223985890652557319223985890652557319223986e-7)))))))))
   [-2.31142719641187619441242534182684745832539555102969e-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.35914091422952261768014373567633124887862354684999
   > print(coeff(T2, 2));
   -(0.5 * exp(1))
See also: diff, autodiff, taylor, remez
Go back to the list of commands

Name:

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

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.46839364816303627522963565754743169862357620487739;0.46947781754667086491682464997088054443583003517779]
   > taylorrecursions=1;
   The number of recursions for Taylor evaluation has been set to 1.
   > evaluate(f-p, [0;1]);
   [-0.13813111495387910066337940912697015317218647208804;0.13921528433751369035056840155041899898444030238844]
See also: hopitalrecursions, evaluate, infnorm
Go back to the list of commands

Name:

taylor computes a Taylor expansion of a function in a point

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 * (9 / 120 + x^2 * 225 / 5040)))

Example 3:

   > print(taylor(erf(x),6,0));
   x * (1 / sqrt((pi) / 4) + x^2 * ((sqrt((pi) / 4) * 4 / (pi) * (-2)) / 6 + x^2 * (sqrt((pi) / 4) * 4 / (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");
   0.14229400000000000001913053049307222863717470318079s were spent computing p = -3.3426550293345171908513995127407122194691200059639e-17 + x * (0.99999999973628359955372011464713121003442988167693 + x * (7.8802751877302786684499343799047732495568873819693e-16 + x * (-0.166666661386013037032912982196741385680498698107285 + x * (-5.3734444911159112186289355138557504839692987221233e-15 + x * (8.3333037186548537651002133031675072810009327877148e-3 + x * (1.33797221389218815884112341005509831429347230871284e-14 + x * (-1.98344863018277416493268155154158924422004290239026e-4 + x * (-1.3789116451286674170531616441916183417598709732816e-14 + x * (2.6876259495430304684251822024896210963401672262005e-6 + x * 5.0282378350010211058128384123578805586173782863605e-15)))))))))

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.39602467695631727848641768186659313738474584992648e-11))
   0.248156000000000000009752615381941609484783839434385 s were spent

Example 3:

   > t = time(bashexecute("sleep 10"));
   > write(~(t-10),"s of execution overhead.\n");
   2.45499999999999884980894648833782412111759185791016e-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 = 3.73952158631904736942211379919425684937321681904859 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.

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 matrix spent 2 ms
   Information: Remez: computing the quality of approximation spent 12 ms
   Information: Remez: computing the matrix spent 1 ms
   Information: Remez: computing the quality of approximation spent 7 ms
   Information: Remez: computing the matrix spent 1 ms
   Information: Remez: computing the quality of approximation spent 7 ms
   Information: computing a minimax approximation spent 146 ms
   Information: assignment spent 146 ms
   Information: full execution of the last parse chunk spent 146 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.

Description:

Example 1:

   > verbosity=1!;
   > a = 1+ 2^(-55)+2^(-115);
   > TD(a);
   1.00000000000000002775557561562891353466491600711096
   > prec=110!;
   > TD(a);
   Warning: double rounding occurred on invoking the triple-double rounding operator.
   Try to increase the working precision.
   1.000000000000000027755575615628913
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.

Description:

Example 1:

   > true && false;
   false
   > 2>1;
   true
See also: false, &&, ||
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.

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.19999999999999999999999999999999999999999999999999) + ("toto")
   error
Go back to the list of commands

Name:

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

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(void) -> void
   > 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

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