| [Top] | [Contents] | [Index] | [ ? ] |
TRIP is a general computer algebra system dedicated to celestial mechanics.
Authors :
With the contributions of E. Paviot, F. Thire, D. Acheroff, M. To, A. Ceyrac, G. Rouault, V. Kelsch.
This software includes a library developped by the NetBSD fundation and its contributors.
This software includes the libraries LAPACK and 'SCSCP C Library'.
This software is dynamically linked to the libraries LTDL, GMP, MPFR et MPC. The source of these libraries could be downloaded from the web site specified in the Chapter References (see section References).
TRIP version 1.1.18
Copyright ©TRIP 1988-2011 J.Laskar/ASD/IMCCE/CNRS
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to execute TRIP, you must
You will see on screen :
|
TRIP is ready to receive your commands. TRIP has a case sensitive interpreter.
In order to compute S=(X+Y)^2, you must just enter :
|
Use the up-arrow key, you could bring back the previous command. Command-line input can be edited using arrow keys.
To exit TRIP, you enter quit or exit.
The reserved keywords for TRIP language are specified in the Annexes. TRIP contains several keyword categories :
When TRIP starts or the commands reset or @@ are executed, it reads these files in the following order :
'$TRIPDIR/etc/trip.ini' | where $TRIPDIR is the installation directory of TRIP. |
'$HOME/.trip' | where $HOME is the user home directory. |
'trip.ini' | in the current directory. |
These file may contain any valid instructions.
Recommendations :
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 2.1 expression | ||
| 2.2 object identifier |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
An expression can contain all defined operators on object identifiers and can call functions or commands.
An expression must be always ended with ; or $ . The character ; implies the execution of the expression and displays the result. The character$ implies only the execution of the expression.
Several instructions separated with the character ; or $ could follow. They will be executed sequentially.
A comment on one or more lines is defined as /* .... */, like in the C language. A single-line comment starts with the characters //, like in the C++ language.
Example :
> s=1+t; /* calcule 1+t et affiche le resultat */
s(t) = 1 + 1*t
> s1=(1+x+y)^2$ /*calcule mais n'affiche pas le resultat. */
> s1; // affiche le contenu de s1
s1(x,y) =
1
+ 2*y
+ 1*y**2
+ 2*x
+ 2*x*y
+ 1*x**2
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
An object identifier must begin with a letter and must contain only letters (lower-case or upper-case) and/or number (09) and the characters _ or ' .
By default, an object identifier is global, so it will be viewed by any instruction. An object identifier could be local to a macro, so it will be only viewed from this macro and it will be destroy each time the execution of this macro finished. A TRIP reserved keyword can't be used as the name of an object identifier.
The object identifier can have the following type :
Example : > ch="file1"$ > s=1+x$ > dim t[1:2]; > z=1+2*i; z = (1+i*2) > bilan; ch CHAINE s SERIE t TAB x VAR |
| 2.2.1 Visibility | ||
| 2.3 serie |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
private <object identifier> x ,...;
The specified object identifiers will be locals to the macro or to the loop (for, while, sum) or at the end of each iteration of loop (for, while, sum).
If a local object identifier has the same name as a global object identifier, then the local object identifier will be used. In this case, the local object identifier hides the global object identifier during the execution of the macro.
Example :
> macro least_ab[TX,TY,a,b] {
private S, SY, SXY, SXX, DEL; /* identificateurs locaux */
S=size(TX)$
SX=sum(TX)$
SY=sum(TY)$
SXY=sum(TX*TY)$
SXX=sum(TX*TX)$
DEL=S*SXX-SX*SX$
a = (S*SXY-SX*SY)/DEL$
b = (SXX*SY-SX*SXY)/DEL$
};
tx=1,10;
ty=3*tx;
%least_ab[tx,ty,[a],[b]];
bilan;
> tx Tableau de reels : nb reels =10
> ty Tableau de reels : nb reels =10
> > SX CONST
a CONST
b CONST
tx TABNUMREEL
ty TABNUMREEL
>
>
macro detval[T]
{
private T2; /* identificateurs locaux */
dim T2[1:3,1:3]$
T2[:,::]=0$
T2[1,1]=T**2$
T2[2,2]=1-T$
T2[3,3]=T$
return det(T2);
};
> %detval[5];
-500
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A serie is a polynomial of degree n (n is an integer). It depends on one or more variables.
Example : > s=1+x; s(x) = 1 + 1*x > s2=(1+x+y); s2(x,y) = 1 + 1*y + 1*x > bilan; s SERIE s2 SERIE x VAR y VAR |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A constant is an integer, a real, a complex, a rational number or an interval.
In rational numerical mode (_modenum = NUMRAT or _modenum = NUMRATMP), the input of 0.5 creates a floating-point number and not the rational number 1/2.
Example :
>x = 2;
2
>y = 2.25;
9/4
>z = 1+2*i;
(1+i*2)
>bilan;
x CONST
y CONST
z CONST
> _modenum=NUMDBLINT;
_modenum = NUMDBLINT
> s = <1|2>;
s = [+1.00000000000000E+00,+2.00000000000000E+00]
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It's a list of characters surrounded with " ". It's used to specify the _path, to define the name of the files, to display messages, ... . There is no limit on the size. But, for the global variable _path, it's length is truncated to 256 (this value depends on the system). To produce a double-quotes (") in a string, two double-quotes must be used.
Example : >vi "toto"; > ch = "file" + "1"; ch = "file1" > sch = "../" + ch; sch = "../file1" > sch1 = sch + "." + str(12); sch1 = "../file1.12" > ch3="nomsuivide""fin"; ch3 = "nomsuivide"fin" |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
<nom> = <real> ;
A real floating-point number is always displayed or inputed in base 10. The symbol d, e, E or D is the exponentiation symbol.
Example : > a=2.125E6; a = 2125000 > q=3D2; q = 300 > r=0.123554545; r = 0.123554545 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
<nom> = <real> + i * <real> ;
A complex number is allowed. The lower-case i or upper-case I specifies the imaginary part of the complex number.
Example : > x=2+i*3; x = (2+i*3) > y=-5+4*i; y = (-5+i*4) |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It's a string of characters. This string must be surrounded with " " if the string contains the character space " [ ] { } () or more than one points.
A file name could be the content of an object identifier of type string.
These file names are relative to the variable _path, excepted for the file names build with the function file_fullname (see section file_fullname).
Example :
> read("fichier.1.dat",T);
> s="ell."+str(10)+".asc";
s = "ell.10.asc"
> read(s,T);
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It's an object identifier which specifies a file, which is opened in reading or writing mode.
Example :
> f = file_open("fichier.1.dat",read);
> file_close(f);
|
The definition of the function, subroutines and variables use the following types :
<object identifier> | object identifier |
<integer> | natural integer number or an operation which returns an integer |
<real> | real floating-point number or an operation which returns a real floating-point number |
<complex> | complex number or an operation which returns a complex number |
<variable> | variable |
<constant> | an operation which returns an integer, a real number or a complex number |
<serie> | serie |
<operation> | an operation which returns a number (constant) or a serie |
<array> | array of series |
<array of variables> | tableau de variables |
<num. vec.> | numerical vector |
<real vec.> | numerical vector of real numbers |
<complex vec.> | numerical vector of complex numbers |
<array of real vec.> | array of numerical vectors of real numbers |
<array of complex vec.> | array of numerical vectors of complex numbers |
<array of num. vec.> | array of numerical vectors |
<(array of) real vec.> | (array of) numerical vectors of real numbers |
<(array of) num. vec.> | (array of) numerical vectors |
<constant or num. vec.> | a constant or a numerical vector |
<real or real vec.> | real floating-point number or numerical vector of real numbers |
<filename> | filename |
<file> | file |
<dimension of an array> | two integers separated with the character : |
<list of dimension> | list of <dimension of an array> separated with a comma |
<condition> | comparison between two operations |
<string> | an operation which returns a string of characters |
<(array of) string> | an operation which returns a string of characters or an array of string of characters |
<list of variables> | list of variables or an array of variables |
<list of parameters> | list of parameters of a macro |
<body> | list of trip expression |
<scscp client> | connection to a SCSCP server |
<remote object> | object stored on a remote SCSCP server |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The content of a global variable is performed by entering its name followed with ; .
The content of all global variables is displayed with the command vartrip (see section vartrip).
All global variables, containing a real number, are stored in a double-precision real number.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_affc = {1, 2, 3, 4, 5, 6, 7, 8, 9};
Set the format to display the numerical coefficients of series or constants.
Default value = 4.
Example :
> _affc=1;
_affc = 1
> 1/3;
0.333333
> _affc=2;
_affc = 2
> 1/3;
0.33333333
> _affc=3;
_affc = 3
> 1/3;
0.3333333333
> _affc=4;
_affc = 4
> 1/3;
0.333333333333333
> _affc=5;
_affc = 5
> 1/3;
1/3
> _affc=6;
_affc = 6
> 1/3;
1/3
> _affc=7;
_affc = 7
> 1/3;
1/3
> _affc=8;
_affc = 8
> 1/3;
3.333333E-01
> _affc=9; _modenum=NUMDBLINT;
_affc = 9
_modenum = NUMDBLINT
> 1/3;
[+3.333333333333333E-1,+3.333333333333334E-1 ( 5.551115E-17)]
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_affdist = {0, 1, 2, 3, 4, 5, 6, 7};
Set the format to display the series
Default value = 2.
_affvar.
_affvar.
Remarks : if _affvar is empty, then the format of _affdist = 6, respectively 7,
is the same as _affdist=1, respectively 2.
Example : >_affdist = 2; >x = 1+y; x(y) = 1 + 1*y |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_comment {on,off};
Enable or disable the display of comments.
Default value = off.
Example : > _comment; _comment OFF > /* série à deriver : /* s=1+x */ : */; > _comment on; > /* série à deriver : /* s=1+x */ : */; série à deriver : s=1+x : > _comment off; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_cpu = <integer> ;
Specify the number of processors which will be used for later computations.
The specified value can't be greater than the number of available processors or cores on the computer.
Default value : number of active processors or cores on the computer.
Example :
> _mode=POLP;
_mode = POLP
> _cpu=1;
_cpu = 1
> time_s; s=(1+x+y+z+t+u)^30$ time_t(usertime, realtime);
03.321s - ( 99.44% CPU)
> msg("the real time is %g\n", realtime);
the real time is 3.33976
> _cpu=4;
_cpu = 4
> time_s; s=(1+x+y+z+t+u)^30$ time_t(usertime, realtime);
03.339s - (322.89% CPU)
> msg("the real time is %g\n", realtime);
the real time is 1.03414
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_echo = {0, 1};
_echo {on,off};
Enable or disable the display of the echo of the executed commands.
Default value = off.
Example : >_echo = 1; >msg "exemple"; exemple cde>> msg "exemple"; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_endian = {little , big};
Specify the byte order (big-endian or little-endian) in binary files.
Default value = endianness in the computer.
Example :
> _endian=big;
_endian = big
> vnumR ieps;
> readbin(file1.dat,"%u",ieps);
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_graph = gnuplot;
_graph = grace;
Specify if the plot, replot, plotps, plotf commands will use the grace or gnuplot (see section Graphics) software to display graphics.
Default value = gnuplot.
Example :
> _graph = grace;
_graph = grace
> _graph = gnuplot;
_graph = gnuplot
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_hist {on,off};
Specify if the file ‘history.trip’ is opened or not.
If the file is opened, all commands are stored in this file.
Default value = on.
Example : >_hist; _hist = ON |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_history = <string> ;
Specify the folder where the file ‘history.trip’ will be written.
Default value = "".
Example :
> _history="/users/toto/";
_history = /users/toto/
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_info {on,off};
Enable or disable the display of the message information.
Default value = on.
Example :
> _modenum=NUMQUAD;
_modenum = NUMQUAD
> x1=0,2*pi,2*pi/59$
> x2=0,3,0.5$
> _info off;
_info off
> sl=interpol(LINEAR,x1,cos(x1),x2)$
> _info on;
_info on
> sl=interpol(LINEAR,x1,cos(x1),x2)$
Information : interpol effectue l'interpolation numerique en double-precision.
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_language = {fr, en };
Select the language to display messages.
Default value =
Example :
> _language = en ;
_language = en
> Exp(x, y);
TRIP[ 3 ] : This parameter must be an integer
Command :' Exp(x, y);'
^
> _language = fr;
_language = fr
> Exp(x, y);
TRIP[ 3 ] : Cet argument doit etre un entier
Commande :'Exp(x, y);'
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_mode = {POLY, POLP };
Specify the internal representation of the series for their storage in the memory and during the computations.
The internal representation could be changed during the computations.
Default value = POLY.
Example :
> _mode=POLY;
_mode = POLY
> s1=(1+x)^100$
> s2=1+x^100$
> bilan mem;
Nom Memoire (octets) Nb de termes
-------------------- -------------------- --------------------
s1 4848 101
s2 96 2
-------------------- -------------------- --------------------
4944 103
Memoire physique utilisee = 7118848 octets
Memoire maximale utilisee = 2783817728 octets
> _mode=POLP;
_mode = POLP
> s1=(1+x)^100$
> s2=1+x^100$
> bilan mem;
Nom Memoire (octets) Nb de termes
-------------------- -------------------- --------------------
s1 3232 101
s2 3232 2
-------------------- -------------------- --------------------
6464 103
Memoire physique utilisee = 7208960 octets
Memoire maximale utilisee = 2784210944 octets
> _mode=POLY$ time_s; s1=(1+x)^100$ time_t;
00.240s - ( 47.74% CPU)
> _mode=POLP$ time_s; s1=(1+x)^100$ time_t;
00.013s - ( 40.57% CPU)
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_modenum = {NUMDBL, NUMRAT, NUMRATMP, NUMQUAD, NUMFPMP};
Specify the representation of the numerical coefficients in the series and the precision of the floating point numbers in the numerical vectors.
This mode could be changed during the session.
Default value = NUMDBL.
The numerical coefficients are encoded as followed :
The absolute value for the numerator and denomiator is between 0 et 2**62 on most computers. If the numerator or denomiator becomes too large, rational number is converted in a double precision floating-point.
The real numbers are stored in double precision format. For example, the coefficient "2.0" will be stored as a double precision floating-point while the coefficient "2" is stored as a rational number.
The absolute value for the numerator and denomiator don't have any limits.
The real numbers are stored in double precision format. For example, the coefficient "2.0" will be stored as a double precision floating-point while the coefficient "2" is stored as a rational number.
This numerical representation uses the GMP library (type mpz_t or mpq_t). On the 64 bit operating systems, integers smaller than 2^63-1 (in absolute value) use the hardware instructions instead of the GMP library.
The number of number of digits of precision is specified by the global variable _modenum_prec (see section _modenum_prec).
This numerical representation uses the MPFR and the MPC library.
In the mode NUMRAT and NUMRATMP, numerical vectors contain always double precision floating-points (real or complex numbers).
Example :
> _affc=4;
_affc = 4
> _modenum=NUMDBL;
_modenum = NUMDBL
> s=1/11;
s = 0.0909090909090909
> _modenum=NUMRAT;
_modenum = NUMRAT
> s=1/11;
s = 1/11
> _modenum=NUMFPMP;
_modenum = NUMFPMP
> pi;
3.1415926535897932384626433832795028841971693993751058209749445924
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_modenum_prec = <integer> ;
Variable used if _modenum = NUMFPMP (see section _modenum).
Specify the number of significant decimal digits for the multiprecision real numbers.
Default value = 64.
Example : > _modenum=NUMFPMP; _modenum = NUMFPMP > _modenum_prec= 20; _modenum_prec = 20 > pi; 3.14159265358979323846 > _modenum_prec= 40; _modenum_prec = 40 > pi; 3.1415926535897932384626433832795028841975 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_naf_dtour = <real> ;
Variable used by naf (see section Frequency analysis).
Specify the "length of the dial turn ".
Default value = 2*pi.
Example : > _naf_dtour=360; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_naf_icplx = {0, 1};
Variable used by naf (see section Frequency analysis).
Specify if the function is real or complex.
Default value = 1.
The available values are :
Example : > _naf_icplx=0; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_naf_iprt = {-1 , 0, 1, 2};
Variable used by naf (see section Frequency analysis).
Specify the verbosity to display messages in the commands naf and naftab. Intermediate results are stored in a file.
Default value = -1.
The available values are :
Example : > _naf_iprt = 2; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_naf_isec = {0, 1};
Variable used by naf (see section Frequency analysis).
Specify if the algorithm "secantes" is used or not in the commands naf and naftab.
Default value = 1.
The available values are :
Example : > _naf_isec=1; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_naf_iw = <integer> ;
Variable used by naf (see section Frequency analysis).
Specify if a window filter is set.
Default value = 1.
The available values are :
avec CE= 0.22199690808403971891E0
Example : > _naf_iw=-1; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_naf_nulin = <integer> ;
Variable used by naf (see section Frequency analysis).
Specify the number of lines to be ignored at the beginning of the data file.
Default value = 1.
Example : > _naf_nulin=0; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_naf_tol = <real> ;
Variable used by naf (see section Frequency analysis).
Specify the tolerance to check if two frencuencies are equal.
Default value = 1E-10.
Example : > _naf_tol=1E-4; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_path = <string> ;
_path = "chemin du repertoire";
Specify the folder used to save or load files. All TRIP commands or functions writing or reading files will prepend the filename with this path. loading trip programs (include), creating psotscript files(plotps) and plotting files (plotf) will use this path.
Default value = "" (current folder).
Remarque :
Example : _path = "/u/gram/trip/"; /* UNIX */ _path = "\u\gram\trip\"; /* WINDOWS */ |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
_time {on, off};
enable or disable display of partial time after each executed command.
When the command _time on is performed, an implicit call to time_s and the time 0.00s is always displayed after it.
Default value = off.
Example :
> macro temps
{
s=(1+x+y+z)**20$
_time on;
s=(1+x+y+z)**20$
q=s$
_time off;
};
> %temps;
00.0s
08.10s
00.12s
>
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
i^2 = -1
Example : >z = x + y*i; z(x,y) = (0+i*1)*y+1*x |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The mathematical symbol pi
Example : >z = pi; 3.14159265358979 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 4.1 crevar |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
crevar (<chaine ou nom> radical, <integer> indice1, <integer> indice2,...);
Create and return a variable with the name radical+"_"+ indice1 + ... + "_" + indicen.
crevar (<chaine ou nom> radical);
Create and return a variable with the name radical. This function allow to create variables with a non-standard name.
Example :
>dimvar t[1:3];
>t[1]:=crevar("t",1);
>t[3]:=crevar("tab",3,2,1);
>afftab(t);
t[1] = t_1 = 1*t_1
t[2] =
t[3] = tab_3_2_1 = 1*tab_3_2_1
> dimvar u[1:2];
> u[1]:=crevar("\bar{X}");
> u[1];
u[1] = \bar{X} = 1*\bar{X}
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 5.1 Operators | ||
| 5.2 Standard functions | ||
| 5.3 Differentiation and integration | ||
| 5.4 Euclidian division | ||
| 5.5 Selection | ||
| 5.6 Evaluation |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
TRIP performs the addition (or unary plus), the subtraction (or unary minus), multiplication, or division between series, , variables, numbers and expressions.
To perform the addition, multiplication, subtraction and division of the arrays, the operators are +, *, - and /.
The operators +, *, -, / could be applied on numerical vectors.
The unary + or - could be applied to any type.
Remark : The division by a serie isn't available.
You should use the function div to perform the euclidian division.
Example : > s=1+x-y*z+t/2; s(x,y,z,t) = 1 + 1/2*t - 1*y*z + 1*x > _modenum=NUMRATMP; _modenum = NUMRATMP > p=5/3; p = 5/3 > _modenum=NUMQUAD; _modenum = NUMQUAD > p=5/3; p = 1.6666666666666666666666666666666667 |
<serie> **<real>
It performs the exponentiation.
It supports integer powers.
The exponentation **-1 on an array, with 2 same dimensions, performs the matrix inversion.
Remarks : The exponentiation, term by term, on arrays isn't available.
Example : > u=2**3; 8 > z=(1+i)**3; (-2+i*2) > s=(1+x+y)**2; s(y,x) = 1 + 2*x + 1*x**2 + 2*y + 2*y*x + 1*y**2 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| • size : sizeserie |
size(<serie> s )
It returns the number of terms in the serie s.
Example :
> s=1+x*y+z*t-i*p;
s(x,y,z,t,p) = 1 + (-0-i*1)*p + 1*t*z + 1*y*x
> size(s);
4
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| • deriv | ||
| • integ |
deriv(<serie> , <variable> )
It computes the total derivative of the serie with respect to one variable .
Example :
> s=(1+x+y)**2;
s(x,y) = 1 + 2*y + 1*y**2 + 2*x + 2*x*y + 1*x**2
> deriv(s,x);
2 + 2*y + 2*x
|
integ(<serie> , <variable> )
It integrates the serie with respect to one variable .
Example :
> s=(1+x+y)**2;
s(x,y) = 1 + 2*y + 1*y**2 + 2*x + 2*x*y + 1*x**2
> integ(s,x);
1*x + 2*x*y + 1*x*y**2 + 1*x**2 + 1*x**2*y + 1/3*x**3
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
div(<serie> f, <serie> g, <object identifier> q, <object identifier> r )
It computes the quotient and the remainder of f divided by g such that f=q\times g +r and degree(r)<degree(g). The quotient is stored in q and the remainder in r.
Example :
> div(x^3+x+1, x^2+x+1, q,r);
> q;
q(x) =
- 1
+ 1*x
> r;
r(x) =
2
+ 1*x
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 5.5.1 coef_ext |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
coef_ext(<serie> , (<variable> ,<integer> ),...)
Return the coefficient of the variable raised to the specified value from the serie.
coef_ext(S,(X,n),(Y,m)) returns the coefficient of X^n*Y^m in the serie S.
Example : > S= (1+x+y+z)**4 $ > coef_ext(S,(x,1),(y,2)); 12 + 12*z |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 5.6.1 coef_num | ||
| 5.6.2 evalnum |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
coef_num(<serie> , (<variable> ,<constant> ),...)
Substitute in a serie one (or more) variable(s) by one (or more) numerical value(s).
Example :
> S= (1+x+y+z)**4 $
> coef_num(S,(x,0.1),(y,2));
923521/10000 + 29791/250*z + 2883/50*z**2 + 62/5*z**3 + 1*z**4
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
evalnum(<serie> , {REAL/COMPLEX} , (<variable> ,<num. vec.> ),...)
Evaluates the serie with substituting all variables by their value in the associated numerical vectors.
The function returns a numerical vector of real numbers if REAL is specified
or else a numerical vector of complex numbers COMPLEX is specified.
All numerical vectors must have the same size.
Example : > serie=sin(x+y)-2*y; serie(y,_EXy1,_EXx1) = (-0+i*1/2)*_EXy1**-1*_EXx1**-1 + (0-i*1/2)*_EXy1*_EXx1 - 2*y > TABX=0,pi,pi/6; TABX Tableau de reels : nb reels =7 > TABY=-pi,0,pi/6; TABY Tableau de reels : nb reels =7 > TABRES=evalnum(serie,REAL,(x,TABX),(y,TABY)); TABRES Tableau de reels : nb reels =7 > writes(TABRES); +6.283185307179586E+00 +4.369962352198550E+00 +3.322764801001953E+00 +3.141592653589793E+00 +2.960420506177634E+00 +1.913222954981037E+00 +1.224646799147353E-16 > writes(TABX); +0.000000000000000E+00 +5.235987755982988E-01 +1.047197551196598E+00 +1.570796326794897E+00 +2.094395102393195E+00 +2.617993877991494E+00 +3.141592653589793E+00 > TABRES=evalnum(serie,COMPLEX,(x,TABX),(y,TABY)); > writes(TABRES); +6.283185307179586E+00 +0.000000000000000E+00 +4.369962352198550E+00 +0.000000000000000E+00 +3.322764801001953E+00 -5.551115123125783E-17 +3.141592653589793E+00 +0.000000000000000E+00 +2.960420506177634E+00 +0.000000000000000E+00 +1.913222954981037E+00 +0.000000000000000E+00 +1.224646799147353E-16 +0.000000000000000E+00 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 6.1 Standard functions | ||
| 6.2 Input/output on real numbers |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Most of the functions are described in (see section Numerical vectors).
| 6.1.1 factorial | factoriel. |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
fac( <integer> n);
Return n! (factorial function).
Example : :
> fac(3);
6
> n=5;
n = 5
> fac(n+1);
720
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions perform the sequential writing and reading of a text file containing only real values.
ecriture(<filename> );
Open a file in writing mode in the folder specified by _path.
If the file doesn't exist, it will be automatically created.
Example : :
> ecriture("fichier1.dat");
|
lecture(<filename> );
Open a file in reading mode in the folder specified by _path.
Example : :
> lecture("fichier1.dat");
|
print(<real> );
Write a double-precision floating-point number in the file opened (with the command ecriture).
Example : :
> ecriture("fichier1.dat");
> print(atan(1)); /* on écrit pi/4 dans fichier1.dat */
|
read;
Read a floating-point number in the file opened (with the command lecture) and return a double-precision floating-point number.
Example : :
> ecriture("fichier1.dat");
> print(atan(1));
> close;
> lecture("fichier1.dat");
> s=read;
s = 0.785398163397448
> close;
|
close;
Close the file of real numbers if it has been opened (for reading or writing).
Example : :
> ecriture("fichier1.dat");
> print(atan(1));
> close;
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 7.1 Declaration and assignment | ||
| 7.2 Concatenation | ||
| 7.3 Repetition | ||
| 7.4 Comparaison | ||
| 7.5 Conversion from an integer or a real to a string | Convert an integer or a real to a string. | |
| 7.6 Conversion from a list of integers or reals to a string | Convert a list of integers or reals to a string. | |
| 7.7 Length of a string | Length of the strings. |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Character string's declaration is implicit. It will be realized when assignment are performed. To produce double-quote (") in a string, you must double it.
<nom> = <string> ;
Example : /* L'exemple suivant declare les chaines ch et ch2. */ > ch="file"; ch = "file" > ch2=ch+".txt"; ch2 = "file.txt" |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
<nom> = <string> + <string> ;
Operator + concatenates two character strings. Length of string isn't limited.
Example : > ch = "file" + "1"; ch = "file1" > sch = "../" + ch; sch = "../file1" > sch1 = sch + "." + str(12); sch1 = "../file1.12" |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
<string> * <integer>
<integer> * <string>
Operator * takes an character string and duplicate it as many times as specified by the integer. The integer must be positive or nul. If the integer is 0, then an empty string is returned.
Example : > s=" %g"; s = " %g" > format=4*s+"\n"; format = " %g %g %g %g\n" > t=1,10$ > writes(format, t,t**2, t**3, t**4); |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
<string> == <string>
The Operator == returns true if the strings of characters are equal else it returns false.
Example :
> s="monchemin";
s = "monchemin"
> if (s=="monchemin") then { msg "true"; } else { msg "false"; };
true
|
<string> != <string>
The Operator != returns false if the strings of characters are equal else it returns true.
Example :
> s="monchemin";
s = "monchemin"
> if (s=="MON") then { msg "true"; } else { msg "false"; };
false
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
str( <integer> );
str( <real> );
str( <string> format, <real> );
Convert an integer or a real number in a character string. If format is specified, then the integer or real number is converted to this format. The format specification is similar to that for the printf function of the C-language.
The conversion specifiers are
The length modifier aren't supported. For example, the format "%lg" will be rejected and produce an error.
If the numerical mode NUMRAT or NUMRATMP is selected, then the rational numbers as written as "numerator/denominator" if no format are specified.
Example :
> ch= str(1235);
ch = "1235"
> ch=str(int(2*pi));
ch = "6"
> s=str(2E3);
s = "2000"
> s=str("%.4g",pi);
s = "3.142"
> _modenum=NUMRATMP;
_modenum = NUMRATMP
> s=str("%d", 3/2);
s = "3/2"
> s=str("%g", 3/2);
s = "1.5"
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
msg(<string> textformat, <real> x, ... );
Create a string using the format with the real constants.
The format is the same as the command printf in language C (see section Conversion from an integer or a real to a string, for the valid conversion specifiers). This format must be a string and could be on several lines.
To create a double-quotes, two double-quotes must be used.
Example :
> ch = msg("pi=%g pi=%.8E",pi,pi);
ch = "pi=3.14159 pi=3.14159265E+00"
> _modenum=NUMRATMP;
_modenum = NUMRATMP
> s=msg("%d %g", 1/11, 1/11);
s = "1/11 0.0909091"
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
size( <string> );
it computes the length of the string, that is to compute the number of characters.
Example : > ch = "1235"; ch = "1235" > size(ch); 4 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
TRIP has 3 types of arrays :
Matrix are arrays of series and constants. For the numerical vectors, see the appropriate chapter.
| 8.1 Declaration of array of series | Declaration de tableaux de series. | |
| 8.2 Initialization of an array of series | ||
| 8.3 Declaration of array of variables | Declaration de tableaux de variables. | |
| 8.4 Generation of an array of variables | Generation d'un tableau de variables. | |
| 8.5 Assignment to an array | ||
| 8.6 Size of an array | ||
| 8.7 Display an array | Affichage d'un tableau. | |
| 8.8 Extract an element | ||
| 8.9 Operations on array of series | ||
| 8.10 Conversion |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
dim <name> [ <list of dimension> ], ...;
Define one or more array of series with the specified dimensions.
Each dimension is separated with a comma. A dimension is defined with two integers which specifiy the index of the first element and the index of the last element for this dimension.
This type of array can contain series, constants, truncatures, strings of characters... but no variables.
Example : /*Ici, on déclare un tableau tl à deux dimensions de séries ou de constantes*/ > dim tl [1:22,-2:6]; /* on déclare 3 tableaux t1, t2 , t3 avec des dimensions différentes */ > dim t1[1:4], t2[5:6], t3[-1:3]; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
<name> = [<serie> ,... : <serie> , ...];
Create and intialize an array of series with the specified series and constants.
The symbol : specifies a new line and the symbol , separates the colmuns. It must have the same number of columns on each line.
Example :
/*declare un tableau de series a 2 dimensions contenant des series*/
> tab=[1,2+2*x:(1+x)**2,(2+2*x)**2];
tab [1:2, 1:2] nb elements = 4
> stat(tab);
Tableau de series
tab [ 1:2 , 1:2 ]
...
/*declare un tableau de series a 2 dimensions contenant des constantes*/
> tab2=[1,2,3:4,5,6];
tab2 [1:2, 1:3] nb elements = 6
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
dimvar <name> [ <list of dimension> ], ...;
Define one or more array of variables with the specified dimensions.
Each dimension is separated with a comma. A dimension is defined with two integers which specifiy the index of the first element and the index of the last element for this dimension.
To assign a existing variable to an array of variables, you should the symbol := instead of = .
Example : /*Ici, on declare un tableau t2 de variables a une dimension */ >dimvar t2[1:5]; /* Maintenant, si on fait:*/ >t2[1,0] := x; > deriv(S,t[1,0]); /* on aura la derivee de S par rapport a x. */ /* on declare 2 tableaux de variables tv1 et tv2 */ > dimvar tv1[1:2], tv2[1:3]; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
tabvar( <array of variables> );
Generate automatically the variables inside the specified array. The name of variables use the name of the array as radical and its indice.
Example : > dimvar t[0:3]; > tabvar(t); > afftab(t); t[0] = t_0 = 1*t_0 t[1] = t_1 = 1*t_1 t[2] = t_2 = 1*t_2 t[3] = t_3 = 1*t_3 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
<name> = <array> ;
Assign the array (operation between arrays) to the specified object identifier.
<array> [<integer> , ...] = <operation> ;
Assign a value to an element of an array. This operation can be a serie, a constant, a numerical vector, a truncature but not an array.
<array> [ <integer> binf : <integer> bsup : <integer> pas ,...]= <operation> ;
<array> [ <integer> binf : <integer> bsup ,...]= <operation> ;
Assign a value to a part of an array.
If the operation is a serie, a constant, a numerical vector, a truncature then the value is copied to each element of this part of array. If the operation is an array then each element of this array will be assigned to the corresponding element. In this case, it verifies that the number of elements and dimension is compatible.
If the lower bound is omitted then its value is assumed to be 1. If the upper bound is omitted then its value is assumed to be the size of the array. If the step is omitted then its value is assumed to be 1.
Remarks : any combination of omission are permitted.
Example : > dim t[1:4,7:25]; > t[1,7]=1+x; t[1,7] = 1 + 1*x > r=t; r [1:4, 7:25] nb elements = 76 > dim t[1:4,7:25]; > dim t2[1:4]; > t2[:]=5; > t[:,8]=t2; > t[:,::2]=1+x; |
<array> [...] := <variable> ;
Assign a variable to an array of variables.
Example :
> dimvar X[1:4];
> X[1]:=crevar(e,1,1);
> X[1];
X[1] = e_1_1 = 1*e_1_1
> deriv(1+2*e_1_1,X[1]);
2
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
size(<array> );
size(<array> ,<integer> );
Return the number of elements in the first dimension of the array or in the specified dimension by the integer.
If the specified dimension doesn't exist in the array then the function returns -1.
Example :
> dim t[1:4,7:25];
> size(t,2);
19
> size(t);
4
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
afftab(<array> );
Display the content of the arrays of series or variables.
Example :
> dim t[1:4];
> t[1]=1+x$
> t[2]=2*i$
> t[3]=({(x,y),2})$
> afftab(t);
t[1] = 1 + 1*x
t[2] = (0+i*2)
t[3] = ( { (x,y), 2 } )
t[4] =
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
<array> [<integer> ,...];
Return the value of the element specified by the indexes.
<num. vec.> [ <integer> binf : <integer> bsup : <integer> pas,.. ];
<num. vec.> [ <integer> binf : <integer> bsup, .. ];
Return an array containing only the elements located between the lower and uper bounds with the specified step.
If the lower bound is omitted then its value is assumed to be 1. If the upper bound is omitted then its value is assumed to be the size of the array. If the step is omitted then its value is assumed to be 1.
Remarks : any combination of omission are permitted.
Example : > dim t[1:4]; > t[1]=1+x$ > s=t[1]; s(x) = 1 + 1*x > t1=t[3:]; t1 [3:4] nb elements = 2 > dim t[1:4,5:10]; > v2=t[:,6:]; v2 [1:4, 6:10] nb elements = 20 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Most of the functions are described in (see section Numerical vectors). The following functions could be applied on the arrays of series (as on the series) to avoid the loops for :
| 8.9.1 Matrix product | ||
| 8.9.2 Matrix determinant | ||
| 8.9.3 Matrix inversion | ||
| 8.9.4 Eigenvalues | ||
| 8.9.5 Eigenvectors | ||
| 8.9.6 Arithmetic |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
<array> &* <array>
Compute the matrix product of the arrays (with 1 or 2 dimensions).
If the array has only one dimension then it's considered as an column-vector.
Remark : the number of columns of the first array must be same as the number of lines of the second array.
Example : > t=[x,y:x-y,x+y]; > t2=[x+y,x-y:x,y]; > r=t&*t2; > afftab(r); r[1,1] = 2*y*x + 1*x**2 r[1,2] = 1*y**2 - 1*y*x + 1*x**2 r[2,1] = -1*y**2 + 1*y*x + 2*x**2 r[2,2] = 2*y**2 - 1*y*x + 1*x**2 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
det( <array> )
Computes the determinant of a matrix. The array must have two dimensions.
Remarks : When computations are performed in double precision, the Lapack Library is used. The LU algorithm is used in all numerical precision.
Example :
> t=[9,0,7
:1,2,3
:4,5,6];
t [1:3, 1:3] nb elements = 9
> det(t);
-48
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
<array> **-1
Computes the inverse of a matrix. The array must have two dimensions.
Remarks : When computations are performed in double precision, the Lapack Library is used. The LU algorithm is used in all numerical precision.
Example : > t=[9,0,7:1,2,3:4,5,6]; t [1:3, 1:3] nb elements = 9 > r=t**-1; r [1:3, 1:3] nb elements = 9 > afftab(r); r[1,1] = 1/16 r[1,2] = -35/48 r[1,3] = 7/24 r[2,1] = -1/8 r[2,2] = -13/24 r[2,3] = 5/12 r[3,1] = 1/16 r[3,2] = 15/16 r[3,3] = -3/8 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
eigenvalues(<array> )
Compute the eigenvalues of the 2-dimensional array (square matrix) using a QR algorithm (lapack library).
Example : > t=[9,0,7:1,2,3:4,5,6]; t [1:3, 1:3] nb elements = 9 > l=eigenvalues(t); l [1:3] nb elements = 3 > afftab(l); l[1] = 13.7691504189573 l[2] = 4.08436203480944 l[3] = -0.853512453766754 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
eigenvectors(<array> MAT, <array> TVECT, <array> TVAL)
eigenvectors(<array> MAT, <array> TVECT)
Compute the eigenvectors of the 2-dimensional array MAT (square matrix) using a QR algorithm (lapack library). It stores the eigenvectors in the array TVECT and the eigenvalues in the array TVAL.
Example : > t=[9,0,7:1,2,3:4,5,6]; t [1:3, 1:3] nb elements = 9 > eigenvectors(t,vectp,valp); > afftab(vectp); vectp[1,1] = -0.808169038149443 vectp[1,2] = -0.75057699194462 vectp[1,3] = -0.484663855953733 vectp[2,1] = -0.209021306608322 vectp[2,2] = 0.398522441432627 vectp[2,3] = -0.547409412438461 vectp[3,1] = -0.550611386696964 vectp[3,2] = 0.527080679628786 vectp[3,3] = 0.682234477218675 > afftab(valp); valp[1] = 13.7691504189573 valp[2] = 4.08436203480944 valp[3] = -0.853512453766754 > /* 1er vecteur */ p=vectp[:,1]; p [1:3] nb elements = 3 > afftab(p); p[1] = -0.808169038149443 p[2] = -0.209021306608322 p[3] = -0.550611386696964 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The arrays must have the same number of elements on each dimension and the number of dimension must be the same.
<array> + <array>
Add term by term two arrays of series.
<array> + <serie>
<serie> + <array>
Add a serie with each element of the array of series.
<array> * <array>
Multiply term by term two arrays of series.
<array> * <serie>
<serie> * <array>
Multiply a serie with each element of the array of series.
<array> - <array>
Substract term by term two arrays of series.
<array> - <serie>
<serie> - <array>
Subtract a serie with each element of the array of series.
<array> / <array>
Divide term by term two arrays of series.
<array> / <serie>
<serie> / <array>
Divide a serie with each element of the array of series.
Example : > t2=[x+y,x-y:x,y]; t2 [1:2, 1:2] nb elements = 4 > t=[x,y:x-y,x+y]; t [1:2, 1:2] nb elements = 4 > r=t*t2*i-t*x; r [1:2, 1:2] nb elements = 4 > afftab(r); r[1,1] = (0+i*1)*x*y + (-1+i*1)*x**2 r[1,2] = (-0-i*1)*y**2 + (-1+i*1)*x*y r[2,1] = (1-i*1)*x*y + (-1+i*1)*x**2 r[2,2] = (0+i*1)*y**2 + (-1+i*1)*x*y - 1*x**2 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For the convertion to numerical vectors, (see section Conversion).
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 9.1 Declaration | ||
| 9.2 Initialization | ||
| 9.3 Display | Affichage. | |
| 9.4 Size | ||
| 9.5 Resize | ||
| 9.6 Data retrieval | ||
| 9.7 Input/Output | ||
| 9.8 Input/Output low level | ||
| 9.9 Standard functions | ||
| 9.10 Conditions | ||
| 9.11 Conversion |
The numerical values stored in vectors are always real or complex double-precision, quadruple-precision or multiprecision numbers depending on the current numerical mode.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| • vnumR | ||
| • vnumC |
Explicit declaration for numerical vectors are only required before call to read , readbin (see section Input/Output) and resize .
Explicit declaration for array of numerical vectors are always required.
vnumR <name> , ... ;
vnumR <name> [ <dimension of an array> ] , ... ;
It declares a real vector or an array of real vectors.
The dimension specifies the number of elements in the array of real vectors.
The real vector's size is dynamic. After the declaration, the real vectors are empty.
To set their sizes, the command resize must be used.
Example : > vnumR T; > vnumR TAB[1:10]; > vnumR A, C, T[1:10]; |
vnumC <name> , ... ;
vnumC <name> [ <dimension of an array> ] , ... ;
It declares a complex vector or an array of complex vectors.
The dimension specifies the number of elements in the array of complex vectors.
The complex vector's size is dynamic. After the declaration, the complex vectors are empty.
To set their sizes, the command resize must be used.
Example : > vnumC T; > vnumC TABZ[2:10]; > vnumC A, C, T[1:10]; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
<name> = <real> binf , <real> bsup , <real> step ;
It declares and initializes a real vectors such that all elements are initialized by a loop (from binf to bsup with the step bstep):
for (j=1, valeur=binf) to valeur<=bsup step (j=j+1, valeur=valeur+bstep) <name> [j]=valeur
The step bstep is optional; By default, its value is 1.
Example : > tab=-pi, 6, pi/100; tab Tableau de reels : nb reels =291 > writes([::30],tab); -3.141592653589793E+00 -2.199114857512855E+00 -1.256637061435917E+00 -3.141592653589789E-01 +6.283185307179591E-01 +1.570796326794897E+00 +2.513274122871835E+00 +3.455751918948773E+00 +4.398229715025711E+00 +5.340707511102648E+00 > t=0,10; t Tableau de reels : nb reels =11 > writes(t); +0.000000000000000E+00 +1.000000000000000E+00 +2.000000000000000E+00 +3.000000000000000E+00 +4.000000000000000E+00 +5.000000000000000E+00 +6.000000000000000E+00 +7.000000000000000E+00 +8.000000000000000E+00 +9.000000000000000E+00 +1.000000000000000E+01 > |
<name> = vnumR [ <real> ou <real vec.> ou <array of real vec.> , ... : <real> ,... ] ;
It declares and initializes a real vector or an array of real vectors with the specified reals or real vectors.
The character : separates the lines and the character , separates the columns.
All columns must have the same line counts.
Example : > /*declare un tableau de 3 tableaux de 2 reels */ tab3=vnumR[1,2,3:4,5,6]; tab3 [1:3] nb elements = 3 > writes(tab3); +1.000000000000000E+00 +2.000000000000000E+00 +3.000000000000000E+00 +4.000000000000000E+00 +5.000000000000000E+00 +6.000000000000000E+00 > t=7,8; t Tableau de reels : nb reels =2 > tab4=vnumR[t,tab3]; tab4 [1:4] nb elements = 4 /*declare un tableau de 5 reels */ > t2=vnumR[1:2:4:8:9]; t2 Tableau de reels : nb reels =5 > writes(t2); +1.000000000000000E+00 +2.000000000000000E+00 +4.000000000000000E+00 +8.000000000000000E+00 +9.000000000000000E+00 |
<name> = vnumC [ <complex> ou <complex vec.> ou <array of complex vec.> , ... : <complex> ,... ] ;
It declares and initializes a complex vector or an array of complex vectors with the specified complexs or complex vectors.
The character : separates the lines and the character , separates the columns .
All columns must have the same line counts.
Example :
/*declare un tableau de 4 complexes*/
> tab3=vnumC[1:1+i:2+2*i:3+3*i];
tab3 Tableau de complexes : nb complexes =4
> writes(tab3);
+1.000000000000000E+00 +0.000000000000000E+00
+1.000000000000000E+00 +1.000000000000000E+00
+2.000000000000000E+00 +2.000000000000000E+00
+3.000000000000000E+00 +3.000000000000000E+00
> vnumC ti;
> resize(ti,5,3-5*i);
> tab4=vnumC[tab3 : 5+7*i : ti];
tab4 Tableau de complexes : nb complexes =10
/*declare un tableau de 2 tableaux de 2 complexes*/
> z4=vnumC[5,2+i:4,9+3*i];
z4 [1:2] nb elements = 2
> writes("%g %g %g %g\n",z4[1],z4[2]);
5 0 2 1
4 0 9 3
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
writes([ <integer> : <integer> : <integer> ], <string> , <(array of) num. vec.> , ...);
writes( <string> , <(array of) num. vec.> , ...);
writes( <(array of) num. vec.> , ...);
equivalent to
writes( { [binf:{bsup}:{step}], } {format,} <(array of) num. vec.> ,...).
It prints, to the screen, numerical vectors or the array of numerical vectors in columns form.
format is optional. This format is similar to the C format (cf. printf) and must be between double quotes ("). To display a double quote (") as a character, you must double it :
For example, if the C format is " %g \"titi\" %g", you must write " %g\""titi\"" %g"
A complex vector will be printed on two columns (the first for the real part and the second for the imaginary part).
Example :
Ecriture de tous les éléments de T et de X.
La première colonne correspondra à T.
La deuxième colonne correspondra à la partie réelle de X.
La troisième colonne correspondra à la partie imaginaire de X.
...
> stat(X);
Tableau numérique X de 6 complexes.
taille en octets du tableau: 96
> stat(T);
Tableau numérique T de 6 réels.
taille en octets du tableau: 48
> writes(T,X);
+9.999993149794888E-02 +1.000000000456180E-01 +1.095970178673141E-06
-2.000000944035095E-01 +9.999999960679056E-03 +1.312007532388499E-07
+3.000000832689856E-01 +1.000000314882390E-03 -1.403292661135361E-08
-4.000000970924361E-01 +9.999995669530993E-05 +1.695880029074994E-09
+4.999999805039361E-01 +1.000003117384769E-05 +3.216502329016007E-11
-5.999999830866213E-01 +9.999979187109419E-07 -1.796078221829677E-12
>
Ecriture du 2 au 4 elements de T et de X
avec un format "%.1g\t(%.5g+i*%.5E)\n".
> writes([2:4],"%.1g\t(%.5g+i*%.5E)\n",T,X);
-0.2 (0.01+i*1.31201e-07)
0.3 (0.001+i*-1.40329e-08)
-0.4 (0.0001+i*1.69588e-09)
Ecriture du 1 au 5 elements de T et de X avec un pas de 2 sans format.
> writes([1:5:2],T,X);
+9.999993149794888E-02 +1.000000000456180E-01 +1.095970178673141E-06
+3.000000832689856E-01 +1.000000314882390E-03 -1.403292661135361E-08
+4.999999805039361E-01 +1.000003117384769E-05 +3.216502329016007E-11
Ecriture des elements de T et de X avec un pas de 5 sans format.
> writes([::5],T,X);
+9.999993149794888E-02 +1.000000000456180E-01 +1.095970178673141E-06
-5.999999830866213E-01 +9.999979187109419E-07 -1.796078221829677E-12
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
size( <num. vec.> )
Return the number of elements in the numerical vector.
Example :
> t=1,10;
t Tableau de reels : nb reels =10
> size(t);
10
> p=-pi,pi,pi/400;
p Tableau de reels : nb reels =800
> size(p);
800
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
resize(<(array of) num. vec.> , <integer> );
resize(<(array of) num. vec.> , <integer> , <constant> );
Change the size of the numerical vector or of the array of numerical vectors.
If a constant isn't specified then all elements will be initialized to 0 else all elements will initialized with this constant.
Example : > vnumR t; > resize(t,3); > vnumR t2; > resize(t2,3,5); > writes(t,t2); +0.000000000000000E+00 +5.000000000000000E+00 +0.000000000000000E+00 +5.000000000000000E+00 +0.000000000000000E+00 +5.000000000000000E+00 > vnumC t[1:3]; > resize(t[2],2,1-5*i); > writes(t[2]); +1.000000000000000E+00 -5.000000000000000E+00 +1.000000000000000E+00 -5.000000000000000E+00 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| • select | ||
| • operateurs d'extraction |
select ( <condition> , <num. vec.> );
Return a numerical vector which only contains the elements of the numerical vector where the condition is true.
The condition and the numerical vector must have the same number of elements.
Example : /*retourne les éléments qui sont multiples de 3*/ > t=1,10; t Tableau de reels : nb reels =10 > r=select((t mod 3)==0, t); r Tableau de reels : nb reels =3 > writes(r); +3.000000000000000E+00 +6.000000000000000E+00 +9.000000000000000E+00 |
<num. vec.> [ <real vec.> ];
Return a numerical vector which only contains the elements of the numerical vector located at the indexes stored in the real vector.
Remark : The real vector must be an object identifier and not be a operation result.
Example :
> r=vnumR[1:5:7:9];
> t=20,30;
> b=t[r];
b Tableau de reels : nb reels =4
> writes("%g\n",b);
20
24
26
28
|
<num. vec.> [ <integer> binf : <integer> bsup : <integer> pas ];
<num. vec.> [ <integer> binf : <integer> bsup ];
Return a numerical vector which contains only the elements located between the lower bound and the upper bound with the specified step.
If the lower bound isn't specified, then the lower bound is assumed to be 1. If the upper bound isn't specified, then the upper bound is assumed to be the size of the numerical vector. If the step isn't specified, then the step is assumed to be 1.
Remark : All missing combinations are allowed.
Example :
> t=1,10;
t Tableau de reels : nb reels =10
> r=t[::2];
r Tableau de reels : nb reels =5
> v=t[7:9];
v Tableau de reels : nb reels =3
> y=t[5:10:2];
y Tableau de reels : nb reels =3
> writes("%g %g\n",v,y);
7 5
8 7
9 9
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 9.7.1 read | ||
| 9.7.2 readappend | ||
| 9.7.3 write | ||
| 9.7.4 readbin | ||
| 9.7.5 writebin |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
read(<filename> ,[ <integer> : <integer> : <integer> ],
,... ,
(<(tableau de) tab. num.>, <integer> ), ...
(<(tableau de) tab. num.>, <integer> , <integer> ), ...);
equivalent to
read(fichier.dat, [binf:bsup:step], T, (T1,n1), (T3,n2,n3));
read(fichier.dat, T, (T1,n1), (T3,n2,n3));
Read in a text file the specified columns and store them to numerical vectors.
If the file contains the strings NAN or NANQ, then it assumes to be the value "Not A Number".
If the file contains the strings INF, Inf ou Infinity, then it assumes to be the value "infinite".
Example :
Lecture dans le fichier tessin.out de la ligne 2 à ligne 100
avec un pas de 3.
Le tableau T contiendra la première colonne,
la partie réelle de X contiendra la deuxième colonne,
la partie imaginaire de X contiendra la troisième colonne,
TAB[1] contiendra la 4eme colonne,
TAB[2] contiendra la 5eme colonne,
TAB[3] contiendra la 6eme colonne.
> vnumR T;
vnumC X;
vnumR TAB[1:3];
read(tessin.out,[2:100:3],T,X,TAB);
stat(T);
stat(X);
stat(TAB);
T nb elements reels =0
>
X nb elements complexes =0
>
TAB [1:3] nb elements = 3
> > Tableau numerique T de 33 reels.
taille en octets du tableau: 264
> Tableau numerique X de 33 complexes.
taille en octets du tableau: 528
> Tableau de series
TAB [ 1:3 ]
liste des elements du tableau :
TAB [ 1 ] =
Tableau numerique de 33 reels.
taille en octets du tableau: 264
TAB [ 2 ] =
Tableau numerique de 33 reels.
taille en octets du tableau: 264
TAB [ 3 ] =
Tableau numerique de 33 reels.
taille en octets du tableau: 264
>
Lecture dans le fichier tessin.out de la ligne 2 a ligne 100.
Le tableau T contiendra la premiere colonne,
la partie reelle de X contiendra la 4eme colonne,
la partie imaginaire de X sera nulle,
TAB[3] contiendra la 5eme colonne.
> read(tessin.out,[2:100],T,(X,4),(TAB[3],5));
Lecture dans le fichier tessin.out de l'ensemble des lignes.
Le tableau T contiendra la 2eme colonne,
la partie reelle de X contiendra la 3eme colonne,
la partie imaginaire de X contiendra la 4eme colonne,
TAB[3] contiendra la 5eme colonne.
> read(tessin.out,(T,2),(X,3,4),(TAB[3],5));
Lecture dans le fichier tessin.out a partir de la ligne 1000.
Le tableau T contiendra la 2eme colonne,
la partie reelle de X contiendra la 3eme colonne,
la partie imaginaire de X contiendra la 4eme colonne,
TAB[3] contiendra la 5eme colonne.
> read(tessin.out,[1000:],(T,2),(X,3,4),(TAB[3],5));
Lecture dans le fichier tessin.out avec un pas de 50 lignes.
Le tableau T contiendra la 2eme colonne,
la partie reelle de X contiendra la 3eme colonne,
la partie imaginaire de X contiendra la 4eme colonne,
TAB[3] contiendra la 5eme colonne.
> read(tessin.out,[::50],(T,2),(X,3,4),TAB[3]);
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
readappend(<filename> ,[ <integer> : <integer> : <integer> ],
,... ,
(<(tableau de) tab. num.>, <integer> ), ...
(<(tableau de) tab. num.>, <integer> , <integer> ), ...);
equivalent to
readappend(fichier.dat, [binf:bsup:step], T, (T1,n1), (T3,n2,n3));
readappend(fichier.dat, T, (T1,n1), (T3,n2,n3));
This function is similar to the function read (see section read) but it stores read data to the end of the numerical vectors (with an automatic growing step)
instead of overwriting their contents.
Example : > t1=1,5; t1 Tableau de reels double-precision : nb reels =5 > write(temp001, t1); > write(temp002, t1**2); > vnumR w; > readappend(temp001,w); > readappend(temp002,w); > writes(w); +1.0000000000000000E+00 +2.0000000000000000E+00 +3.0000000000000000E+00 +4.0000000000000000E+00 +5.0000000000000000E+00 +1.0000000000000000E+00 +4.0000000000000000E+00 +9.0000000000000000E+00 +1.6000000000000000E+01 +2.5000000000000000E+01 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
write( <filename> , [ <integer> : <integer> : <integer> ], <string> , <(array of) num. vec.> , ...);
write( <filename> , <string> , <(array of) num. vec.> , ...);
write( <filename> , <(array of) num. vec.> , ...);
equivalent to
write( fichier.dat, [binf:bsup:step], "format", T, T1, T2).
write( fichier.dat, "format", T, T1, T2).
write( fichier.dat, T, T1, T2).
write( fichier.dat, [binf:bsup:step], T, T1, T2).
Write to a file the numerical vector or the arrays of numerical vectors as columns of numbers.
The format is optional. The format is the format of C language (See printf) and surrounded with double-quotes ("). To obtain a double-quotes, two double-quotes must be used :
For example : if the C format is " %g \"titi\" %E", it must be written as, " %g \""titi\"" %E"
A numerical vector of complex numbers uses two columns (the first one for the real part and the second one for the imaginary part).
Example :
Ecriture de tous les elements de T et de X dans le fichier tx.out.
La pemiere colonne correspondra a T.
la deuxieme colonne correspondra a la partie reelle de X.
la troisieme colonne correspondra a la partie imaginaire de X.
> vnumR T;
vnumC X;
...
stat(T);
stat(X);
> Tableau numerique T de 33 reels.
taille en octets du tableau: 264
> Tableau numerique X de 33 complexes.
taille en octets du tableau: 528
> write(tx.out,T,X);
>
Ecriture de 10 au 20 éléments de T et de X dans le fichier tx.out avec
un format "%g\t(%8.4E+i*%e)\n".
La pemiere colonne correspondra à T.
la deuxième colonne correspondra à la partie réelle de X.
la troisieme colonne correspondra à la partie imaginaire de X.
> write(tx.out,[10:20],"%g\t(%8.4E+i*%e)\n",T,X);
Ecriture de 1 au 20 éléments de T et de X avec un pas de 2 dans le
fichier tx.out sans format.
La pemiere colonne correspondra à T.
la deuxième colonne correspondra à la partie réelle de X.
la troisieme colonne correspondra à la partie imaginaire de X.
> write(tx.out,[1:20:2],T,X);
Ecriture des éléments de T et de X avec un pas de 5 dans le fichier
tx.out sans format.
La pemiere colonne correspondra à T.
la deuxième colonne correspondra à la partie réelle de X.
la troisieme colonne correspondra à la partie imaginaire de X.
> write(tx.out,[::5],T,X);
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
readbin(<filename> ,[ <integer> : <integer> : <integer> ], <string> , <(array of) real vec.> , ...);
readbin(<filename> , <string> , <(array of) real vec.> , ...);
equivalent to
readbin(fichier.dat, [binf:bsup:step], format, T, T2, T3);
readbin(fichier.dat, format, T, T2, T3);
Read in a binary file the data with the specified format and store them to numerical vectors.
The allowed format to define a record are :
The number of format must be the same as the number of vectors. If the provided object identifier is an array of real vectors, then it must have the same number of format as the number of elements in the array.
The data are previously converted if the global variable _endian (see section _endian) isn't the same as its default value.
Example : Lecture dans le fichier binaire test1.dat d'entiers signés sur 4 octets et stockés dans le tableau de réels T1. vnumR T1; readbin(test1.dat,"%4d",T1); Lecture dans le fichier binaire test1.dat des 30 premiers entiers signés sur 4 octets et stockés dans le tableau de réels T1. vnumR T1; readbin(test1.dat,[:30],"%4d",T1); Lecture dans le fichier binaire test2.dat dont chaque enregistrement est composé de 2 réels et stockés dans le tableau de réels T1 et T2. vnumR T1,T2; readbin(test2.dat,[:30],"%g%g",T1,T2); Lecture dans le fichier binaire test3.dat dont chaque enregistrement est composé de 4 réels et stockés dans le tableau T3. vnumR T3[1:4]; readbin(test3.dat,"%g%g%g%g",T3); est équivalent à readbin(test3.dat,"%g%g%g%g",T3[1],T3[2],T3[3],T3[4]); |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
writebin(<filename> ,[ <integer> : <integer> : <integer> ], <string> , <(array of) real vec.> , ...);
writebin(<filename> , <string> , <(array of) real vec.> , ...);
equivalent to
writebin(fichier.dat, [binf:bsup:step], format, T, T2, T3);
writebin(fichier.dat, format, T, T2, T3);
Write the numerical vectors to a binary file the data with the specified format.
The allowed format to define a record are :
The number of format must be the same as the number of vectors. If the provided object identifier is an array of real vectors, then it must have the same number of format as the number of elements in the array.
If the numerical vectors doesn't have the same size, then the missing data are completed with 0.
The data are previously converted if the global variable _endian (see section _endian) isn't the same as its default value.
Example : Ecriture du tableau de réels T1 dans le fichier binaire test1.dat sosu la forme d'entiers signés sur 4 octets. vnumR T1; T1=1,10; writebin(test1.dat,"%4d",T1); Ecriture des 30 premiers éléments du tableau de réels T1 dans le fichier binaire test1.dat sous la forme d'entiers signés sur 4 octets. vnumR T1; T1=1,100; writebin(test1.dat,[:30],"%4d",T1); Ecriture des 30 premiers éléments du tableau de réels T1 et de T2 dans le fichier binaire test2.dat dont chaque enregistrement est composé de 2 réels. vnumR T1,T2; T1=1,100; T2=-100,-1; writebin(test2.dat,[:30],"%g%g",T1,T2); Ecriture des tableaux de réels de T3 dans le fichier binaire test3.dat dont chaque enregistrement est composé de 4 réels. vnumR T3[1:4]; T3[:]=1,10; writebin(test3.dat,"%g%g%g%g",T3); est équivalent à writebin(test3.dat,"%g%g%g%g",T3[1],T3[2],T3[3],T3[4]); |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 9.8.1 file_open | ||
| 9.8.2 file_close | ||
| 9.8.3 file_write | ||
| 9.8.4 file_read | ||
| 9.8.5 file_readappend | ||
| 9.8.6 file_writemsg |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
file_open(<filename> , read);
file_open(<filename> , write);
It opens a file in reading or writing mode depending on the value of the secund parameter. It returns an object identifier of type file.
Example :
> f=file_open("sim2007.dat",read);
f = fichier "sim2007.dat" ouvert en lecture
> vnumR t;
> file_read(f,t);
> file_close(f);
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
file_close(<file> );
It closes a file previously opened with the function file_open.
Example :
> f=file_open("sim2007.dat",read);
f = fichier "sim2007.dat" ouvert en lecture
> vnumR t;
> file_read(f,t);
> file_close(f);
> stat(f);
fichier f = "sim2007.dat" ferme
Aucune erreur en lecture/ecriture
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
file_write( <file> , [ <integer> : <integer> : <integer> ], <string> , <(array of) num. vec.> , ...);
file_write( <file> , <string> , <(array of) num. vec.> , ...);
file_write( <file> , <(array of) num. vec.> , ...);
equivalent to
file_write( fichier, [binf:bsup:step], "format", T, T1, T2).
file_write( fichier, "format", T, T1, T2).
file_write( fichier, T, T1, T2).
file_write( fichier, [binf:bsup:step], T, T1, T2).
This function is similar as the function write (see section write) but this function requires an object identifier of type file instead of a filename.
The function writes data in the file from the current position.
Example : > f=file_open(sim2007.dat, write); f = fichier "sim2007.dat" ouvert en ecriture > t1=1,10; t1 Tableau de reels double-precision : nb reels =10 > t2=-t1; t2 Tableau de reels double-precision : nb reels =10 > file_write(f,t1); > file_write(f,t2); > file_close(f); |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
file_read(<file> ,[ <integer> : <integer> : <integer> ],
,... ,
(<(tableau de) tab. num.>, <integer> ), ...
(<(tableau de) tab. num.>, <integer> , <integer> ), ...);
equivalent to
file_read(fichier, [binf:bsup:step], T, (T1,n1), (T3,n2,n3));
file_read(fichier, T, (T1,n1), (T3,n2,n3));
This function is similar as the function read (see section read) but this function requires an object identifier of type file instead of a filename.
The function reads data from the file from the current position.
Example : > f=file_open(sim2007.dat, read); f = fichier "sim2007.dat" ouvert en lecture > vnumR t; > file_read(f,[:5],t); > vnumR t2; > file_read(f,t2); > writes(t); +1.0000000000000000E+00 +2.0000000000000000E+00 +3.0000000000000000E+00 +4.0000000000000000E+00 +5.0000000000000000E+00 > writes(t2); +6.0000000000000000E+00 +7.0000000000000000E+00 +8.0000000000000000E+00 +9.0000000000000000E+00 +1.0000000000000000E+01 -1.0000000000000000E+00 -2.0000000000000000E+00 -3.0000000000000000E+00 -4.0000000000000000E+00 -5.0000000000000000E+00 -6.0000000000000000E+00 -7.0000000000000000E+00 -8.0000000000000000E+00 -9.0000000000000000E+00 -1.0000000000000000E+01 > file_close(f); |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
file_readappend(<file> ,[ <integer> : <integer> : <integer> ],
,... ,
(<(tableau de) tab. num.>, <integer> ), ...
(<(tableau de) tab. num.>, <integer> , <integer> ), ...);
equivalent to
file_readappend(fichier, [binf:bsup:step], T, (T1,n1), (T3,n2,n3));
file_readappend(fichier, T, (T1,n1), (T3,n2,n3));
This function is similar as the function readappend (see section readappend) but this function requires an object identifier of type file instead of a filename.
The function reads data from the file from the current position.
Example : > f=file_open(sim2007.dat, read); f = fichier "sim2007.dat" ouvert en lecture > vnumR t; > file_readappend(f,[:5],t); > file_readappend(f,[10:15],t); > writes(t); +1.0000000000000000E+00 +2.0000000000000000E+00 +3.0000000000000000E+00 +4.0000000000000000E+00 +5.0000000000000000E+00 -5.0000000000000000E+00 -6.0000000000000000E+00 -7.0000000000000000E+00 -8.0000000000000000E+00 -9.0000000000000000E+00 -1.0000000000000000E+01 > file_close(f); |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
file_writemsg(<file> , <string> textformat);
file_writemsg(<file> , <string> textformat, <real> x, ... );
Write formatted messages to a file with(out) real constants.
The real constants must be formatted. The format is the same as the command printf in language C (see section Conversion from an integer or a real to a string, for the valid conversion specifiers). This message must a be string or a text between double-quotes. The messages could be on several lines.
To display double-quotes, two double-quotes must be used.
Example :
> f=file_open("temp001", write);
f = fichier "temp001" ouvert en ecriture
> x=4;
x = 4
> file_writemsg(f," resultat=%g\n", x);
> file_writemsg(f," termine\n");
> file_close(f);
> !"cat temp001";
resultat=4
termine
> f=file_open("data1.txt",write);
f = fichier "data1.txt" ouvert en ecriture
> file_writemsg(f,"%d\n",3/2);
> file_writemsg(f,"%4.2E\n",3/2);
> file_close(f);
> !"cat data1.txt";
3/2
1.50E+00
>
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 9.9.1 minimum and maximum | ||
| 9.9.2 addition and product | ||
| 9.9.3 sort | ||
| 9.9.4 transposevnum | ||
| 9.9.5 standard math function |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| • imin | ||
| • imax | ||
| • MIN : MINterme | ||
| • MAX : MAXterme | ||
| • min : minelt | ||
| • max : maxelt |
imin( <real vec.> )
Return the index of the minimal value of the numerical vector of real numbers. If more than one elements have the minimal value, then this function returns the index of the first element. If the numercial vector is empty then it returns 0.
Example :
> t=-5,5;
> imin(t);
1
|
imax( <real vec.> )
Return the index of the maximal value of the numerical vector of real numbers. If more than one elements have the maximal value, then this function returns the index of the first element. If the numercial vector is empty then it returns 0.
Example :
> t=-5,5;
> imax(t);
10
|
MIN( <real vec.> , ...)
Return a numerical vector of real numbers such that its elements have the minimal value term by term of each numerical vector.
The numerical vectors must have the same size.
For an array of numerical vector of real numbers, the operation is performed on each oelement.
Example : > t=0,pi,pi/6$ > a=MIN(cos(t),sin(t))$ > c=MAX(t,cos(t),sin(t))$ > writes(a,c)$ +0.0000000000000000E+00 +1.0000000000000000E+00 +4.9999999999999994E-01 +8.6602540378443871E-01 +5.0000000000000011E-01 +1.0471975511965976E+00 +6.1232339957367660E-17 +1.5707963267948966E+00 -4.9999999999999978E-01 +2.0943951023931953E+00 -8.6602540378443849E-01 +2.6179938779914940E+00 -1.0000000000000000E+00 +3.1415926535897931E+00 > vnumR cs[1:2]$ > cs[1]=cos(t)$ > cs[2]=sin(t)$ > b=MIN(cs)$ > d=MAX(t,cs)$ > writes(b,d); +0.0000000000000000E+00 +1.0000000000000000E+00 +4.9999999999999994E-01 +8.6602540378443871E-01 +5.0000000000000011E-01 +1.0471975511965976E+00 +6.1232339957367660E-17 +1.5707963267948966E+00 -4.9999999999999978E-01 +2.0943951023931953E+00 -8.6602540378443849E-01 +2.6179938779914940E+00 -1.0000000000000000E+00 +3.1415926535897931E+00 |
MAX( <real vec.> , ...)
Return a numerical vector of real numbers such that its elements have the maximal value term by term of each numerical vector.
The numerical vectors must have the same size.
For an array of numerical vector of real numbers, the operation is performed on each oelement.
Example : > t=0,pi,pi/6$ > a=MIN(cos(t),sin(t))$ > c=MAX(t,cos(t),sin(t))$ > writes(a,c)$ +0.0000000000000000E+00 +1.0000000000000000E+00 +4.9999999999999994E-01 +8.6602540378443871E-01 +5.0000000000000011E-01 +1.0471975511965976E+00 +6.1232339957367660E-17 +1.5707963267948966E+00 -4.9999999999999978E-01 +2.0943951023931953E+00 -8.6602540378443849E-01 +2.6179938779914940E+00 -1.0000000000000000E+00 +3.1415926535897931E+00 > vnumR cs[1:2]$ > cs[1]=cos(t)$ > cs[2]=sin(t)$ > b=MIN(cs)$ > d=MAX(t,cs)$ > writes(b,d); +0.0000000000000000E+00 +1.0000000000000000E+00 +4.9999999999999994E-01 +8.6602540378443871E-01 +5.0000000000000011E-01 +1.0471975511965976E+00 +6.1232339957367660E-17 +1.5707963267948966E+00 -4.9999999999999978E-01 +2.0943951023931953E+00 -8.6602540378443849E-01 +2.6179938779914940E+00 -1.0000000000000000E+00 +3.1415926535897931E+00 |
min( <real or real vec.> , ...);
Return the minimum value of the parameters which could be real constants or real vectors.
Example :
>min(1.5,2.5);
3/2
>x=1.5;
>y=2.5;
>min(x,y);
3/2
> t=-10,10;
> p=abs(t);
> min(-5,t,p,20);
-10
|
max( <real or real vec.> , ...);
Return the maximum value of the parameters which could be real constants or real vectors.
Example :
>max(1.5,2.5);
5/2
>x=1.5;
>y=2.5;
>max(x,y);
5/2
> t=-10,10;
> p=abs(t);
> max(p,t,8);
10
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| • sum | ||
| • prod | ||
| • accum |
sum( <num. vec.> )
Return the sum of elements in the numerical vector.
Example :
> r=-10,10;
> sum(r);
0
> p=0,100;
> sum(p);
5050
> sum(abs(r)+i*p);
(110+i*5050)
|
prod( <num. vec.> )
Return the product of elements in the numerical vector.
Example :
> p=1,10;
p Tableau de reels : nb reels =10
> prod(p);
3628800
> c=p+2*i*p;
c Tableau de complexes : nb complexes =10
> prod(c);
(860025600-i*11307340800)
|
accum( <num. vec.> )
Return the partial sum of elements in the numerical vector. Y=accum(X) alors Y[N] = sum(X[1:N])
Example : > tx=1,10; tx Tableau de reels : nb reels =10 > ty=accum(tx); ty Tableau de reels : nb reels =10 > writes(accum(tx)); +1.000000000000000E+00 +3.000000000000000E+00 +6.000000000000000E+00 +1.000000000000000E+01 +1.500000000000000E+01 +2.100000000000000E+01 +2.800000000000000E+01 +3.600000000000000E+01 +4.500000000000000E+01 +5.500000000000000E+01 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| • reversevnum | ||
| • sort |
reversevnum (<num. vec.> )
Reverse the order of elements in the numerical vector.
Example : > p=1,10; p Tableau de reels : nb reels =10 > writes(p, reversevnum(p)); +1.000000000000000E+00 +1.000000000000000E+01 +2.000000000000000E+00 +9.000000000000000E+00 +3.000000000000000E+00 +8.000000000000000E+00 +4.000000000000000E+00 +7.000000000000000E+00 +5.000000000000000E+00 +6.000000000000000E+00 +6.000000000000000E+00 +5.000000000000000E+00 +7.000000000000000E+00 +4.000000000000000E+00 +8.000000000000000E+00 +3.000000000000000E+00 +9.000000000000000E+00 +2.000000000000000E+00 +1.000000000000000E+01 +1.000000000000000E+00 |
sort ( <real vec.> )
Sort in ascending order the elements in the real vector.
sort ( <real vec.> , <(array of) num. vec.> , ...);
Sort the elements in the (array of) numerical vectors according to the ascending sort of the first real vector.
Remarks : If you call ‘sort(TX,TY,TZ);’, the vector TY et TZ are sorted but TX isn't sorted.
Example : > p=vnumR[5:2:-3:7:1:6]; p Tableau de reels : nb reels =6 > sort(p); > writes(p); -3.000000000000000E+00 +1.000000000000000E+00 +2.000000000000000E+00 +5.000000000000000E+00 +6.000000000000000E+00 +7.000000000000000E+00 > T=vnumC[1+i:2+2*i:3+3*i:4+4*i:5+5*i:7+7*i]; T Tableau de complexes : nb complexes =6 > vnumR TAB[1:2]; > TAB[1]=abs(T); > TAB[2]=-real(T); > sort(-p,T,TAB); |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
transposevnum ( <array of num. vec.> )
Transpose the array of numerical vectors.
The array must have only one dimension and its numerical vectors must have the same size.
Example :
> t=1,5;
t Tableau de reels : nb reels =5
> vnumR TSRC[1:2];
> TSRC[1]=t;
> TSRC[2]=reversevnum(t);
> writes("%g %g\n",TSRC);
1 5
2 4
3 3
4 2
5 1
> TRES=transposevnum(TSRC);
TRES [1:5] nb elements = 5
> writes("%g %g %g %g %g\n",TRES);
1 2 3 4 5
5 4 3 2 1
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
abs( <constant or num. vec.> )
Return the absolute value of the constant if the value is a constant.
Return a numerical vector containing the absolute value of each element if the value is a numerical vector.
Example :
> abs(-2.3);
2.3
> x = 2.3;
> abs(x);
2.3
> t=-pi,pi,pi/100;
> at=abs(t);
at Tableau de reels : nb reels =200
> abs(1+i);
1.4142135623731
|
arg( <constant or num. vec.> )
Return the argument (also called phase angle) of the constant if the value is a constant.
Return a numerical vector containing the argument (also called phase angle) of each element if the value is a numerical vector.
Example :
> arg(i);
1.5707963267949
> arg(1+i);
0.785398163397448
> t=0,pi,pi/6;
t Tableau de reels : nb reels =7
> writes(arg(exp(i*t)));
+0.000000000000000E+00
+5.235987755982987E-01
+1.047197551196598E+00
+1.570796326794897E+00
+2.094395102393195E+00
+2.617993877991494E+00
+3.141592653589793E+00
|
real( <constant or num. vec.> )
Return the real part of the constant if the value is a constant.
Return a numerical vector containing the real part of each element if the value is a numerical vector.
Example :
> real(i);
0
> real(2+3*i);
2
> t=0,pi,pi/6;
t Tableau de reels : nb reels =7
> writes(real(exp(i*t)));
+1.000000000000000E+00
+8.660254037844387E-01
+5.000000000000000E-01
-0.000000000000000E+00
-4.999999999999998E-01
-8.660254037844385E-01
-1.000000000000000E+00
> real(4);
4
|
imag( <constant or num. vec.> )
Return the imaginary part of the constant if the value is a constant.
Return a numerical vector containing the imaginary part of each element if the value is a numerical vector.
Example :
> imag(i);
1
> imag(2+3*i);
3
> t=0,pi,pi/6;
> writes(real(exp(i*t)));
+1.000000000000000E+00
+8.660254037844387E-01
+5.000000000000000E-01
-0.000000000000000E+00
-4.999999999999998E-01
-8.660254037844385E-01
-1.000000000000000E+00
> imag(4);
0
|
conj( <constant or num. vec.> )
Return the conjugate of the constant if the value is a constant.
Return a numerical vector containing the conjugate of each element if the value is a numerical vector.
Example :
> conj(1+i);
(1-i*1)
> conj(3);
3
> z=vnumC[1+i:3-5*i:i];
z Tableau de complexes : nb complexes =3
> writes(conj(z));
+1.000000000000000E+00 -1.000000000000000E+00
+3.000000000000000E+00 +5.000000000000000E+00
+0.000000000000000E+00 -1.000000000000000E+00
|
erf( <real or real vec.> )
Return the error function of the constant if the value is a real.
Return a numerical vector containing the error function of each element if the value is a numerical vector of real numbers.
The error function is defined by : erf(x) = (2/sqrt(pi) * integral from 0 to x of exp(-t*t) dt)
Example :
> erf(1);
0.842700792949715
> erf(0.5);
0.520499877813047
> t=-2,2;
t Tableau de reels : nb reels =5
> r=erf(t);
r Tableau de reels : nb reels =5
> writes(t,r);
-2.0000000000000000E+00 -9.9532226501895271E-01
-1.0000000000000000E+00 -8.4270079294971478E-01
+0.0000000000000000E+00 +0.0000000000000000E+00
+1.0000000000000000E+00 +8.4270079294971478E-01
+2.0000000000000000E+00 +9.9532226501895271E-01
|
erfc( <real or real vec.> )
Return the complementary error function of the constant if the value is a real.
Return a numerical vector containing the complementary error function of each element if the value is a numerical vector of real numbers.
The complementary error function is defined by : erfc(x) = 1 - (2/sqrt(pi) * integral from 0 to x of exp(-t*t) dt)
Example :
> erf(1);
0.842700792949715
> erf(0.5);
0.520499877813047
> t=-2,2;
t Tableau de reels : nb reels =5
> r=erf(t);
r Tableau de reels : nb reels =5
> writes(t,r);
-2.0000000000000000E+00 -9.9532226501895271E-01
-1.0000000000000000E+00 -8.4270079294971478E-01
+0.0000000000000000E+00 +0.0000000000000000E+00
+1.0000000000000000E+00 +8.4270079294971478E-01
+2.0000000000000000E+00 +9.9532226501895271E-01
|
exp( <constant or num. vec.> )
Return the base-e exponential of the constant if the value is a constant.
Return a numerical vector containing the base-e exponential of each element if the value is a numerical vector.
Example :
> exp(1.2);
3.32011692273655
> x = 1.2;
> exp(x);
3.32011692273655
> exp(2*i);
(-0.416146836547142+i*0.909297426825682)
> t=-2,2;
t Tableau de reels : nb reels =5
> r=exp(t);
r Tableau de reels : nb reels =5
> writes(t,r);
-2.000000000000000E+00 +1.353352832366127E-01
-1.000000000000000E+00 +3.678794411714423E-01
+0.000000000000000E+00 +1.000000000000000E+00
+1.000000000000000E+00 +2.718281828459045E+00
+2.000000000000000E+00 +7.389056098930650E+00
|
sqrt( <constant or num. vec.> )
Return the square root of the constant if the value is a constant.
Return a numerical vector containing the square root of each element if the value is a numerical vector.
Example : > x = 4; > sqrt(x); 2 > sqrt(1+i); (1.09868411346781+i*0.455089860562227) > t=0,5; t Tableau de reels : nb reels =6 > ts=sqrt(t); ts Tableau de reels : nb reels =6 > writes(t,ts); +0.000000000000000E+00 +0.000000000000000E+00 +1.000000000000000E+00 +1.000000000000000E+00 +2.000000000000000E+00 +1.414213562373095E+00 +3.000000000000000E+00 +1.732050807568877E+00 +4.000000000000000E+00 +2.000000000000000E+00 +5.000000000000000E+00 +2.236067977499790E+00 |
cos( <constant or num. vec.> )
Return the cosine of the constant if the value is a constant.
Return a numerical vector containing the cosine of each element if the value is a numerical vector.
Example : > cos(0.12); 0.992808635853866 > x=0; x = 0 > cos(x); >t=-pi,pi,pi/100; > at=cos(t); > cos(1+i); (0.833730025131149-i*0.988897705762865) |
sin( <constant or num. vec.> )
Return the sine of the constant if the value is a constant.
Return a numerical vector containing the sine of each element if the value is a numerical vector.
Example : > sin(0.12); 0.119712207288912 > x = 0.12; > sin(x); 0.119712207288912 > t=-pi,pi,pi/100; > s=sin(t); > sin(4*i); (0+i*27.2899171971277) |
tan( <constant or num. vec.> )
Return the tangent of the constant if the value is a constant.
Return a numerical vector containing the tangent of each element if the value is a numerical vector.
Example : > x = 1.2; > tan(x); 2.57215162212632 > t=-pi,pi,pi/100; > at=tan(t); > tan(-1+i); (-0.271752585319512+i*95227/87854) |
acos( <real or real vec.> )
Return the principal value of the arc cosine of the real number if the value is a real number.
Return a real vector containing the principal value of the arc cosine of each element if the value is a real vector.
Example : > acos(0.12); 1.4505064440011 > x = 0.12; > acos(x); 1.4505064440011 > t=-pi,pi,pi/100; > at=acos(t); |
asin( <real or real vec.> )
Return the principal value of the arc sine of the real number if the value is a real number.
Return a real vector containing the principal value of the arc sine of each element if the value is a real vector.
Example : > asin(0.12); 0.120289882394788 > x = 0.12; > asin(x); 0.120289882394788 > t=-pi,pi,pi/100; > at=asin(t); |
atan( <real or real vec.> )
Return the principal value of the arc tangent of the real number if the value is a real number.
Return a real vector containing the principal value of the arc tangent of each element if the value is a real vector.
Example : > atan(2); 1.10714871779409 > x = 2; > atan(x); 1.10714871779409 > t=-pi,pi,pi/100; > at=atan(t); |
cosh( <constant or num. vec.> )
Return the hyperbolic cosine of the constant if the value is a constant.
Return a numerical vector containing the hyperbolic cosine of each element if the value is a numerical vector.
Example : > cosh(0.12); 1.0072086414827 > x = 0.12; > cosh(x); 1.0072086414827 > t=-pi,pi,pi/100; > at=cosh(t); > cosh(1+i); (0.833730025131149+i*0.988897705762865) |
sinh( <constant or num. vec.> )
Return the hyperbolic sine of the constant if the value is a constant.
Return a numerical vector containing the hyperbolic sine of each element if the value is a numerical vector.
Example : > sinh(1.2); 1.50946135541217 > x = 1.2; > sinh(x); 1.50946135541217 > t=-pi,pi,pi/100; > s=sinh(t); > sinh(-1+3*i); (1.16344036370325+i*0.217759551622152) |
tanh( <constant or num. vec.> )
Return the hyperbolic tangent of the constant if the value is a constant.
Return a numerical vector containing the hyperbolic tangent of each element if the value is a numerical vector.
Example : > x = 1.2; > tanh(x); 0.833654607012155 > tanh(1+i); (95227/87854+i*0.271752585319512) > t=0,10; t Tableau de reels : nb reels =11 > tanh(t); |
acosh( <constant or num. vec.> )
Return the inverse of the hyperbolic cosine of the constant if the value is a constant.
Return a numerical vector containing the inverse of the hyperbolic cosine of each element if the value is a numerical vector.
Example :
> acosh(1.2);
0.6223625037147786
> t=1,2,0.1;
t Tableau de reels double-precision : nb reels =11
> acosh(t);
Tableau de reels double-precision : nb reels =11
|
asinh( <constant or num. vec.> )
Return the inverse of the hyperbolic sine of the constant if the value is a constant.
Return a numerical vector containing the inverse of the hyperbolic sine of each element if the value is a numerical vector.
Example :
> asinh(1.2);
1.015973134179692
> t=1,2,0.1;
t Tableau de reels double-precision : nb reels =11
> asinh(t);
Tableau de reels double-precision : nb reels =11
|
asinh( <constant or num. vec.> )
Return the inverse of the hyperbolic tangent of the constant if the value is a constant.
Return a numerical vector containing the inverse of the hyperbolic tangent of each element if the value is a numerical vector.
Example :
> atanh(0.2);
0.2027325540540822
> t=0,1,0.1;
t Tableau de reels double-precision : nb reels =11
> atanh(t);
Tableau de reels double-precision : nb reels =11
|
atan2( <real or real vec.> , <real or real vec.> )
Return the principal value of the arc tangent of the first argument divided by the second argument using the signs of both arguments to determine the quadrant of the return value.
Example : > y = 11.5; > x = 14; > atan2(y,x); 0.68767125603875 |
mod( <real or real vec.> , <real or real vec.> )
<real or real vec.> mod <real or real vec.>
Return the modulo of the first and second value. The result has the same sign as the first argument nd magnitude less than the magnitude of the second argument.
Example : > mod(4,2); 0 > x=4$ > y=2$ > mod(x,y); 0 > t=21,30; > r=1,10; > f=mod(t,r); > g=mod(t,3); |
int( <real or real vec.> )
Return the integer part of the real number if the value is a real.
Return a real vector containing the integer part of each element if the value is a real vector.
Example : >x=1.23; >int(x); 1 > t=-pi,pi,pi/100; > at=int(t); |
log( <constant or num. vec.> )
Return the neperian logarithm of the constant if the value is a constant.
Return a numerical vector containing the neperian logarithm of each element if the value is a numerical vector.
Example : > log(3); 1.09861228866811 > x = 3; > log(x); 1.09861228866811 > r=1,10; > at=log(r); > log(2+i); (0.80471895621705+i*0.463647609000806) |
log10( <constant or num. vec.> )
Return the decimal logarithm (base 10) of the constant if the value is a constant.
Return a numerical vector containing the decimal logarithm of each element if the value is a numerical vector.
Example : > log(3); 1.09861228866811 > x = 3; > log(x); 1.09861228866811 > r=1,10; > at=log(r); > log(2+i); (0.80471895621705+i*0.463647609000806) |
nint( <real or real vec.> )
Return the nearest integer of the real number if the value is a real.
Return a real vector containing the nearest integer of each element if the value is a real vector.
Example :
> x=1.23;
x = 1.23
> nint(x);
1
> nint(1.78);
2
> t=-1,1,0.1;
t Tableau de reels : nb reels =21
> nint(t);
|
sign( <real or real vec.> )
Return the sign of the real number if the value is a real.
Return a real vector containing the sign of each element if the value is a real vector.
The function is defined with the following rules :
Example :
> sign(3);
1
> sign(-3);
-1
> sign(0);
0
> t=-3,3;
t Tableau de reels : nb reels =7
> writes(t,sign(t));
-3.0000000000000000E+00 -1.0000000000000000E+00
-2.0000000000000000E+00 -1.0000000000000000E+00
-1.0000000000000000E+00 -1.0000000000000000E+00
+0.0000000000000000E+00 +0.0000000000000000E+00
+1.0000000000000000E+00 +1.0000000000000000E+00
+2.0000000000000000E+00 +1.0000000000000000E+00
+3.0000000000000000E+00 +1.0000000000000000E+00
|
histogram(<real vec.> TY, <real vec.> TX)
Return the histogram of TY with the specified ranges TX :
TZ=histogram(TY,TX) : TZ[N] contains the number of elements in TY such that TX[N]<=TY[j]<TX[N+1].
For the last range TX, the relation is : TX[N]<=TY[j]<=TX[N+1]
Example :
> TY=vnumR[0:1:4:5:6:9:10:11:-1:-2:-5]$
> TX=-3,9,2$
> writes("%g\n",TX);
-3
-1
1
3
5
7
9
> TZ=histogram(TY,TX)$
> writes("%g\n",TZ);
1
2
1
1
2
1
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
?(<condition>)
Return a numerical vector which contains only the numbers 0 or 1. For each element of the array : if the condition at index j is true then <name> [j]=1 else <name> [j]=0
?(<condition>): <constant or num. vec.> tabvrai : <constant or num. vec.> tabfaux
Return a numerical vector which contains only the numbers 0 or 1. For each element of the array : if the condition at index j is true then <name> [j]=tabvrai[j] else <name> [j]=tabfaux[j]
All vectors must have the same size.
Example : > t=0,5; t Tableau de reels : nb reels =6 > r=5-t; r Tableau de reels : nb reels =6 > q=?(t<=r); q Tableau de reels : nb reels =6 > writes(q); +1.000000000000000E+00 +1.000000000000000E+00 +1.000000000000000E+00 +0.000000000000000E+00 +0.000000000000000E+00 +0.000000000000000E+00 > l= ?(t<=r):i:5; l Tableau de complexes : nb complexes =6 > writes(l); +0.000000000000000E+00 +1.000000000000000E+00 +0.000000000000000E+00 +1.000000000000000E+00 +0.000000000000000E+00 +1.000000000000000E+00 +5.000000000000000E+00 +0.000000000000000E+00 +5.000000000000000E+00 +0.000000000000000E+00 +5.000000000000000E+00 +0.000000000000000E+00 > m = ?(t>2):r:t; m Tableau de reels : nb reels =6 > writes(m); +0.000000000000000E+00 +1.000000000000000E+00 +2.000000000000000E+00 +2.000000000000000E+00 +1.000000000000000E+00 +0.000000000000000E+00 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| • dimtovnumR | ||
| • dimtovnumC | ||
| • vnumtodim |
dimtovnumR( <array> )
Return a numerical vector of real numbers from the array of series.
The array of series must contain only real numbers. The array must have only one dimension.
Example : > dim ts[1:3]; > ts[1]=1$ > ts[2]=4$ > ts[3]=6$ > tr=dimtovnumR(ts)$ > writes(tr); +1.000000000000000E+00 +4.000000000000000E+00 +6.000000000000000E+00 > ltr=log(dimtovnumR(ts)); ltr Tableau de reels : nb reels =3 |
dimtovnumC( <array> )
Return a numerical vector of complex numbers from the array of series.
The array of series must contain only complex numbers. The array must have only one dimension.
Example : > dim ts[1:3]; > ts[1]=1+i$ > ts[2]=3*i$ > ts[3]=-5+i$ > tc=dimtovnumC(ts)$ > writes(tc); +1.000000000000000E+00 +1.000000000000000E+00 +0.000000000000000E+00 +3.000000000000000E+00 -5.000000000000000E+00 +1.000000000000000E+00 > ltc=exp(dimtovnumC(ts)); ltc Tableau de complexes : nb complexes =3 |
vnumtodim( <(array of) num. vec.> )
Return an array of series (constants) from the array of numerical vectors or from the numerical vector.
Example : > tr=1,4; tr Tableau de reels : nb reels =4 > tsr=vnumtodim(tr); tsr [1:4] nb elements = 4 > afftab(tsr); tsr[1] = 1 tsr[2] = 2 tsr[3] = 3 tsr[4] = 4 > vnumC tc[1:2]; > tc[1]=i*tr$ > tc[2]=tr+i*tr**2$ > tsc=vnumtodim(tc); tsc [1:4, 1:2] nb elements = 8 > afftab(tsc); tsc[1,1] = (0+i*1) tsc[1,2] = (1+i*1) tsc[2,1] = (0+i*2) tsc[2,2] = (2+i*4) tsc[3,1] = (0+i*3) tsc[3,2] = (3+i*9) tsc[4,1] = (0+i*4) tsc[4,2] = (4+i*16) |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
TRIP requires the following versions of gnuplot to work :
TRIP requires the following versions of grace to work :
The commands plot, replot, plotf, plotps, plotps_end and plotreset use grace or gnuplot depending on the global variable _graph (see section _graph).
| 10.1 plot | ||
| 10.2 replot | ||
| 10.3 plotf | ||
| 10.4 plotps | ||
| 10.5 plotps_end | ||
| 10.6 plotreset | ||
| 10.7 gnuplot | ||
| 10.8 grace |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
plot(<(array of) real vec.> TX, <(array of) real vec.> TY);
plot(<(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) string> options);
Executes gnuplot or grace and plots the contents of the numerical vector TY function of TX.
The string options is directly sent to gnuplot or grace as an argument of the command plot.
If the string options contains double-quotes, two double-quotes must be used.
Remarks : Temporary files are created and will be destroyed at the end of the session.
plot(<(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ);
plot(<(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ, <(array of) string> options);
Executes gnuplot or grace and plots in 3D the contents of the numerical vector TZ function of TY and TX.
plot(<string> cmd, <(array of) real vec.> TX, <(array of) real vec.> TY);
plot(<string> cmd, <(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) string> options);
It executes gnuplot or grace if necessary. It sends to gnuplot or grace the command cmd and plots the contents of the numerical vector TY function of TX.
plot(<string> cmd, <(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ);
plot(<string> cmd, <(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ, <(array of) string> options);
It executes gnuplot or grace if necessary. It sends to gnuplot or grace the command cmd and plots in 3D the contents of the numerical vector TZ function of TY and TX.
plot( (<(array of) real vec.> TX, <(array of) real vec.> TY), ... );
plot( (<(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) string> options), ...);
Executes gnuplot or grace and overlays all draws of each couplet with plotting the contents of the numerical vector TY function of TX.
plot( (<(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ), ...);
plot( (<(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ, <(array of) string> options), ...);
Executes gnuplot or grace and overlays all draws of each triplet with plotting in 3D the contents of the numerical vector TZ function of TY and TX. session.
plot(<string> cmd, ( <(array of) real vec.> TX, <(array of) real vec.> TY), ...);
plot(<string> cmd, ( <(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) string> options), ...);
It executes gnuplot or grace if necessary. It sends to gnuplot or grace the command cmd and plots the contents of each couplet of the numerical vector TY function of TX.
plot(<string> cmd, ( <(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ), ...);
plot(<string> cmd, ( <(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ, <(array of) string> options), ...);
It executes gnuplot or grace if necessary. It sends to gnuplot or grace the command cmd and plots in 3D the contents of each triplet of the vectors TZ function of TY and TX.
Example :
Tracer cos(x) pour x=-pi à pi avec un pas de pi/100.
> x=-pi,pi,pi/100;
x Tableau de reels : nb reels =200
> y=cos(x);
y Tableau de reels : nb reels =200
> plot(x,y);
> plot(x,y,cos(x));
> plot(x,y,"notitle w points pt 5");
> plot(x,y,"title ""x,cos(x)"" ");
> t=1,10;
t Tableau de reels : nb reels =10
> plot("set xrange[2:5]",t,log(t));
> t=0,pi,pi/100;
> vnumR ta[1:3];
> ta[1]=cos(t);
> ta[2]=sin(t);
> ta[3]=cosh(t);
> dim nom[1:3];
> nom[1]="title 'cos' w l";
> nom[2]="title 'sin' w l";
> nom[3]="title 'cosh' w l";
> plot((t,ta,nom));
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
replot(<(array of) real vec.> TX, <(array of) real vec.> TY);
replot(<(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) string> options);
replot(<(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ);
replot(<(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ, <(array of) string> options);
replot(<string> cmd, <(array of) real vec.> TX, <(array of) real vec.> TY);
replot(<string> cmd, <(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) string> options);
replot(<string> cmd, <(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ);
replot(<string> cmd, <(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ, <(array of) string> options);
replot( (<(array of) real vec.> TX, <(array of) real vec.> TY), ... );
replot( (<(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) string> options), ...);
replot( (<(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ), ...);
replot( (<(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ, <(array of) string> options), ...);
replot(<string> cmd, ( <(array of) real vec.> TX, <(array of) real vec.> TY), ...);
replot(<string> cmd, ( <(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) string> options), ...);
replot(<string> cmd, ( <(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ), ...);
replot(<string> cmd, ( <(array of) real vec.> TX, <(array of) real vec.> TY, <(array of) real vec.> TZ, <(array of) string> options), ...);
This command is very similar to the command plot but it overlays the draws on the previous draws.
It uses the same arguments as the command plot (see section plot).
replot;
Executes gnuplot or grace and send a command to redraw all graphics.
Example : Tracer cos(x) et sin(x) pour x=-pi à pi avec un pas de pi/100 dans la même fenêtre. > x=-pi,pi,pi/100; x Tableau de reels : nb reels =200 > y=cos(x); y Tableau de reels : nb reels =200 > y1=sin(x); y1 Tableau de reels : nb reels =200 > plot(x,y); > replot(x,y1); > plot(x,y,y1); > replot(x,y,sin(2.*x)); > replot(x,sin(x),"notitle"); > replot(x,y,"w points pt 5"); |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
plotf(<filename> filename, <integer> ncolTX, <integer> ncolTY);
It executes gnuplot or grace and plots the contents of the column ncolTY function of ncolTX in the file filename.
plotf(<filename> filename, <integer> ncolTX, <integer> ncolTY, <integer> ncolTZ);
It executes gnuplot or grace and plots the contents of the column ncolTZ function of ncolTY and ncolTX in the file filename.
gnuplot will ignore lines beginning by the character #.
Example : Afficher la troisieme colonne en fonction de la première colonne du fichier tab.out > plotf(tab.out,1,3); Afficher la troisieme colonne en fonction de la première et deuxième colonne du fichier tab.out > plotf(tab.out,1,2,3); |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
plotps <filename> ;
It executes gnuplot or grace and set the terminal of gnuplot or grace in postscript.
All graphics will be stored in the specified postscript file.
This file will be located in the folder specified by _path.
To close the postscript file, the command plotps_end must be executed.
Example : Tracer cos(x) pour x=-pi à pi avec un pas de pi/100 et le stocker dans le fichier res.ps. > x=-pi,pi,pi/100; x nb elements réels =200 > y=cos(x); y nb elements réels =200 > plotps res.ps; > plot(x,y); > plotps_end; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
plotps_end;
Close the file created by plotps.
For gnuplot, it sets the terminal to its default value.
Remarks :
Example : Tracer cos(x) pour x=-pi à pi avec un pas de pi/100 et le stocker dans le fichier res.ps. > x=-pi,pi,pi/100; x nb elements réels =200 > y=cos(x); y nb elements réels =200 > plotps res.ps; > plot(x,y); > plotps_end; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
plotreset;
Send a command to reinitialize gnuplot or grace.
For gnuplot, it sends the command reset.
For grace, it sends the command new followed with redraw.
Example :
> _graph=grace;
_graph = grace
> t=0,10;
t Tableau de reels : nb reels =11
> plot(t,t);
> plotreset;
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gnuplot;
<commande gnuplot>
<commande gnuplot>@<string> @<commande gnuplot>
%<commande trip> \
<commande trip>
end;
TRIP takes the gnuplot commands and sends them to gnuplot (line after line). Gnuplot is executed if it wasn't started. The prompt becomes ‘gnuplot>’ when the user could enter the gnuplot commands.
When the first character is %, then the end of this line is one or more commands trip. This trip command could follow on several lines : the last character must be \ to indicates that the command follows on the next line.
Strings declared in trip could be send to gnuplot by surrounding with the character @.
Example : > gnuplot; gnuplot> plot 'tftf' using 1:3 gnuplot> set xrange[1:10] gnuplot> replot gnuplot> end$ > > > gnuplot; gnuplot> set terminal macintosh singlewin Terminal type set to 'macintosh' Options are 'nogx singlewin novertical' gnuplot> %plot(t,log(t),"notitle"); gnuplot> %replot(t,exp(t),"notitle \ w points pt 5"); gnuplot> set terminal macintosh multiwin Terminal type set to 'macintosh' Options are 'nogx multiwin novertical' > ch="title 'sinus'"; ch = "title 'sinus'" > gnuplot; gnuplot> plot sin(x) @ch@ gnuplot> end; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
grace;
<commande grace>
<commande grace>@<string> @<commande grace>
%<commande trip> \
<commande trip>
end;
TRIP takes the grace commands and sends them to grace (line after line). Grace is executed if it wasn't started. The prompt becomes ‘grace>’ when the user could enter the grace commands.
WHen the first character is %, then the end of this line is one or more commands trip. This trip command could follow on several lines : the last character must be \ to indicates that the command follows on the next line.
Strings declared in trip could be send to grace by surrounding with the character @.
Example : > grace; grace> grace> with g0 grace> read block "/USER/toto" grace> block xy "1:2" grace> read block "/USER/toto" grace> block xy "1:3" grace> redraw grace> title "2courbes" grace> %t=1,10; t Tableau de reels : nb reels =10 grace> %msg "deux lignes\ fin deligne"; deux lignesfin deligne grace> end; > > |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
TRIP have different communication tools :
| 11.1 Maple | ||
| 11.2 Communications with other computer algebra systems | ||
| 11.3 Dynamic library |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
TRIP communicates with other computer algebra systems on the same computer. These computer algebra systems must be able to import and export computations using the MathML 2.0 protocol.
Now, TRIP communicates with Maple(1) on all operating systems which could run maple.
The required version of maple must be equal or greater than 7.
| 11.1.1 maple_put | ||
| 11.1.2 maple_get | ||
| 11.1.3 maple |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
maple_put( <object identifier> id);
Send the object identifier to the maple session. This starts maple if it isn't running.
Example :
> s=1+x;
s(x) = 1 + 1*x
> maple_put(s);
> maple;
maple>
maple> s;
x + 1
maple> end;
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
maple_get( <object identifier> id);
Get the value of an object identifier from the maple session.
Example :
> maple;
maple>
maple> s:=1+y;
s := 1 + y
maple> end;
> maple_get(s);
> s;
1 + 1*y
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
maple;
<commande maple>
%<commande trip> \
<commande trip>
end;
TRIP accepts maple commands and send them to maple (line after line). maple will be started if it's not already started. The prompt becomes ‘maple>’ when you could enter maple commands.
If the first character is a %, then the end of the line will be considered as a TRIP command and not as a maple command. This TRIP command could continue on several lines : To continue the command on a new line, the last character of the line must be a \ .
The function maple_get retrieves objects (series, vectors, ...) from maple.
The command maple_put sends objects to maple.
Example :
> maple;
maple>
maple> s:=gcd((x+1)*(x-1),(x-1));
s := x - 1
maple> %maple_get(s);
maple> %s;
s(x) = -1 + 1*x
maple> end;
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
TRIP communicates with other computer algebra systems on the same or remote computer. These computer algebra systems must be able to compatible with the "Symbolic Computation Software Composability Protocol" (SCSCP) version 1.3 (http://www.symbolic-computation.org/). It supports the OpenMath symbols from the scscp1 content dictionary (http://www.win.tue.nl/SCIEnce/cds/scscp1.html) and from the scscp2 content dictionary (http://www.win.tue.nl/SCIEnce/cds/scscp2.html). The list of OpenMath content dictionary is given in the appendice (see section Supported OpenMath Content Dictionaries).
Multiple connections could be opened at the same time. TRIP could run in client or server mode.
Before using any functions from this module, you must execute the following command in the TRIP session. This command defines many subroutines which contain the definition of the Openmath symbols.
|
| 11.2.1 SCSCP server | ||
| 11.2.2 SCSCP client |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to start the SCSCP server of TRIP, you should execute the following command in a TRIP session :
|
The value of the variable of port may be changed. The default is 26133 for SCSCP servers.
The global variables of TRIP, such as _modenum, could be modified before starting the SCSCP server.
The file libscscpserver.t exports some symbols from the standard OpenMath content dictionaries.
New symbols could be exported to add new functionalities to the SCSCP server.
The function scscp_map_macroassymbolcd, defined in the file libscscpserver.t, must be used.
scscp_map_macroassymbolcd(<string> macroname, <string> cdname, <string> symbolname );
Associate the symbol symbolname of the content dictionary cdname with the macro macroname. When this symbol is found by theSCSCP server or the SCSCP client in a exchanged message, then this macro is executed.
Example :
include libscscpserver.t;
_modenum=NUMRATMP;
macro myscscp_evalmul[P1, P2, value]
{
t=value,value;
q=evalnum(P1*P2,REAL, (x,t));
return q[1];
};
scscp_map_macroassymbolcd("myscscp_evalmul",
"SCSCP_transient_1","scscp_muleval");
%scscp_runserver[26133];
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
TRIP communicates with other computer algebra systems providing a SCSCP server.
| 11.2.2.1 scscp_connect | ||
| 11.2.2.2 scscp_close | ||
| 11.2.2.3 scscp_put | ||
| 11.2.2.4 scscp_get | ||
| 11.2.2.5 scscp_delete | ||
| 11.2.2.6 scscp_execute |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
scscp_connect(<string> computername, <integer> port );
Connect to the computer algebra system on the remote computer using the specified port. This function returns an scscp client object which manages that connection.
Example :
> include libscscpserver.t;
Loading the SCSCP client/server library...
Registering the OpenMath CD...
> port=26133;
port = 26133
> sc=scscp_connect("localhost", port);
sc = client SCSCP connecte au serveur SCSCP localhost
> scscp_close(sc);
> stat(sc);
client SCSCP sc : deconnecte
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
scscp_close(<scscp client> sc );
Close the connection to the computer algebra system specified by sc.
Example :
> include libscscpserver.t;
Loading the SCSCP client/server library...
Registering the OpenMath CD...
> port=26133;
port = 26133
> sc=scscp_connect("localhost", port);
sc = client SCSCP connecte au serveur SCSCP localhost
> scscp_close(sc);
> stat(sc);
client SCSCP sc : deconnecte
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
scscp_put( <scscp client> sc, <operation> x );
scscp_put( <scscp client> sc, <operation> x, <string> storeoption );
Send the object identifier x to the computer algebra system using the scscp client sc, previously opened with scscp_connect.
This function returns a remote object.
If storeoption isn't specified, then its value is "persistent".
The string storeoption must be one of the following values :
Example :
> include libscscpserver.t;
Loading the SCSCP client/server library...
Registering the OpenMath CD...
> port=26133;
port = 26133
> sc=scscp_connect("localhost", port);
sc = client SCSCP connecte au serveur SCSCP localhost
> r=1+x;
r(x) =
1
+ 1*x
> remoter=scscp_put(sc, r);
remoter = objet distant "TempOID1@localhost:26133"
> scscp_close(sc);
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
scscp_get( <remote object> remoteobjectid );
Get the value of the object identifier from the remote computer algebra system using the object remoteobjectid, previously returned by scscp_put.
Example :
> include libscscpserver.t;
Loading the SCSCP client/server library...
Registering the OpenMath CD...
> port=26133;
port = 26133
> sc=scscp_connect("localhost", port);
sc = client SCSCP connecte au serveur SCSCP localhost
> s=(1+x+y)**2;
s(x,y) =
1
+ 2*y
+ 1*y**2
+ 2*x
+ 2*x*y
+ 1*x**2
> remoteS = scscp_put(sc, s);
remoteS = objet distant "TempOID1@localhost:26133"
> q=scscp_get(remoteS);
q(x,y) =
1
+ 2*y
+ 1*y**2
+ 2*x
+ 2*x*y
+ 1*x**2
> scscp_close(sc);
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
scscp_delete( <remote object> remoteobjectid );
Destroy the value of the object identifier from the remote computer algebra system using the object remoteobjectid, previously returned by scscp_put.
Example :
> include libscscpserver.t;
Loading the SCSCP client/server library...
Registering the OpenMath CD...
> port=26133;
port = 26133
> sc=scscp_connect("localhost", port);
sc = client SCSCP connecte au serveur SCSCP localhost
> s=(1+x+y)**2;
s(x,y) =
1
+ 2*y
+ 1*y**2
+ 2*x
+ 2*x*y
+ 1*x**2
> remoteS = scscp_put(sc, s);
remoteS = objet distant "TempOID1@localhost:26133"
> delete(remoteS);
> scscp_close(sc);
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
scscp_execute( <scscp client> sc, <string> returnoption , <string> CDname , <string> remotecommand , <operation> , ... );
It executes the command remotecommand of the OpenMath CD CDname on the remote computer algebra system specified by sc. The parameters are specified just after the name of the command.
The string returnoption must be one of the following values :
Example :
> include libscscpserver.t;
Loading the SCSCP client/server library...
Registering the OpenMath CD...
> port=26133;
port = 26133
> sc=scscp_connect("localhost", port);
sc = client SCSCP connecte au serveur SCSCP localhost
> q = scscp_execute(sc,"return", "SCSCP_transcient_1", "SCSCP_MUL", 1+7*x,2+3*x);
q(x) =
2
+ 17*x
+ 21*x**2
> qr = scscp_execute(sc,"cookie", "SCSCP_transcient_1", "SCSCP_MUL", 1+7*x,2+3*x);
qr = objet distant "TempOID6@localhost:26133"
> scscp_close(sc);
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
TRIP can load a dynamic library and execute functions of this library. The dynamic libraries have the extensions .so, .dll, .dylib depending on the operating system. The function prototypes is required in order to perform the conversion of the parameters.
| 11.3.1 extern_function | ||
| 11.3.2 extern_lib | ||
| 11.3.3 extern_type | ||
| 11.3.4 extern_display |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
extern_function( <filename> filelib, <string> declfunc);
extern_function( <filename> filelib, <string> declfunc, <string> declinout);
It loads the dynamic library filelib. It adds the specific extension (.dll, .so, .dylib) of the operating system. It checks the availability of the function in this library. The function could be called as any other standard function of TRIP.
It checks the validity of the prototype of the function specified by declfunc. The prototype must be written in C language. The implementation function could be written in another language (fortran, ...).
If the dynamic library depends on other libraries , then it requires to load the other libraries with the command extern_lib.
By default, all arguments are input only. To specify that arguments are input-output, it must be specified in the string declinout. This string must conatin the same number of elements as the number of parameter of the function. Each element are separated with a comma. An element could have the following values :
For output arguments, an object identifier must be given to the function to get the value.
Remarks : the function could not have structure or derived type.
Example :
> extern_function("libm", "double j0(double);");
> r = j0(0.5);
r = 0.9384698072408129
|
Example :
/* Appel de sa propre librairie libtest1 contenant test1.c */
> !"cat test1.c";
#include <math.h>
double mylog1p(double x)
{
return log1p(x);
}
void mylog1parray(double tabdst[], double tabsrc[], int n)
{
int i;
for(i=0; i<n; i++) tabdst[i]=log1p(tabsrc[i]);
}
>
> extern_function(libtest1,"double mylog1p(double x);");
> mylog1p(10);
2.39789527279837
> log(11);
2.39789527279837
> extern_function(libtest1,
"void mylog1parray(double tabdst[], double tabsrc[], int n);",
"inout,in,in");
> t=1,10;
t Tableau de reels : nb reels =10
> vnumR res; resize(res,10);
> mylog1parray(res,t,10);
> writes(t,res);
+1.0000000000000000E+00 +6.9314718055994529E-01
+2.0000000000000000E+00 +1.0986122886681098E+00
+3.0000000000000000E+00 +1.3862943611198906E+00
+4.0000000000000000E+00 +1.6094379124341003E+00
+5.0000000000000000E+00 +1.7917594692280550E+00
+6.0000000000000000E+00 +1.9459101490553132E+00
+7.0000000000000000E+00 +2.0794415416798357E+00
+8.0000000000000000E+00 +2.1972245773362196E+00
+9.0000000000000000E+00 +2.3025850929940459E+00
+1.0000000000000000E+01 +2.3978952727983707E+00
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
extern_lib( <filename> filelib);
Load the dynamic library filelib. It adds the specific extension (.dll, .so, .dylib) of the operating system. This function is used to load librairies required by other librairies.
Example :
> extern_lib("libm");
> extern_function("libm", "double j0(double);");
> r = j0(0.5);
r = 0.9384698072408129
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
extern_lib( <string> type);
Declares an external type type. The external functions can use or return pointer to objects of this type.
Example :
> extern_type("t_calcephbin");
> extern_function("libcalceph",
"t_calcephbin* calceph_open(const char *filename);");
> eph = calceph_open("inpop06c_m100_p100_littleendian.dat");
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
extern_display;
Display the list of external types or functions previously loaded with the command extern_function or extern_type.
Example :
> extern_function("libm", "double j0(double);");
> extern_function("libm", "double j1(double);");
> extern_display;
Liste des fonctions externes :
j1
j0
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 12.1 Declaration | ||
| 12.2 Execution | ||
| • return | ||
| 12.3 List of macros | ||
| 12.4 Display the body | Affichage du code. | |
| 12.5 Deletion | ||
| 12.6 How to redefine a macro ? | ||
| 12.7 How to save a macro ? |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
macro <name> [ <list of parameters> ] { <body> };
macro <name> { <body> };
MACRO <name> [ <list of parameters> ] { <body> };
MACRO <name> { <body> };
Define a macro with 0 or more parameter and a body of trip code.
The list of parameters are separated by a comma. The parameter must a name. There is no limitation with the number of parameters. The macros support recursivity but a limit exists (often 70 times).
The last parameter could be ... to specify that this macro could receive one or more optional argument when it's called.
To access to each optional argument, the keyword macro_optargs[] is used.
To acces to the optional argument of index j, you just write macro_optargs[j].
To know the number of provided optional argument, the function size(macro_optargs) must be used.
The execution of the macro could be immediately stopped using the stop command (see section stop).
The macro may define local object identifiers, See section Visibility.
The following example shows the definition of a macro a which assigns to r the sum of x and y. x and y are transmitted by arguments. The macro b displays the contents of the current directory.
Example :
> macro a [x,y]
{r = x+y;};
> macro b { ! "ls";};
> macro macvar[x,y,...]
{
s=x+y;
l = size(macro_optargs);
msg("number of optional argument %g\n", l);
for j=1 to l { msg("The optional argument %g :", j); macro_optargs[j]; };
};
> %macvar[P1,P2];
s(P1,P2) =
1*P2
+ 1*P1
l = 0
number of optional argument 0
> %macvar[P1,P2,"arg1", 3,5, 7];
s(P1,P2) =
1*P2
+ 1*P1
l = 4
number of optional argument 4
The optional argument 1 :macro_optargs[1] = "arg1"
The optional argument 2 :macro_optargs[2] = 3
The optional argument 3 :macro_optargs[3] = 5
The optional argument 4 :macro_optargs[4] = 7
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
% <name> [ <list of parameters> ];
% <name> ;
Execute a macro. The list of parameters is a list of parameters separated by a comma.
The parameters can be object identifier, series (result of a computation), strings of characters, arrays or numerical vectors.
The parameter can be transmitted by value or reference.
Parameters given by value can only be a result of a computation, strings of characters, arrays or numerical vectors.
Parameters given by reference can be any object identifier or an element of array. To give a parameter by reference, it must be surrounded with additional brackets []. In this case, the object identifier can be modified or created during the execution of the macro.
The execution of the macro returns a value if the command return has been called in the body of the macro.
The execution of the macro could be immediately stopped using the stop command (see section stop).
Execution of the macro a and b:
Example :
> %a[1,5+3*6];
/*ou si S = x + y*/
> %a[S,5];
>%b;
>%c[[t],[u[5]],1+x];
Usage des chaines de caractères:
> macro nomfichier[name,j] {msg name + str(j);};
> %nomfichier["file_",2];
file_2
> ch="file_1.2.";
ch = "file_1.2."
> %nomfichier[ch,3];
file_1.2.3
>
|
Remarks : The parameters (x,y,...) keep their values. To give an expression, it mustn't be surrounded with brackets [].
Example :
- Si x vaut z et que l'on applique la macro a, une fois la macro
exécutée, x vaudra z. Alors que si x n'est pas défini, sa valeur
sera celle qu'il avait à la fin de l'exécution de la macro.
Example :
Si on veut ajouter à 'S' la variable 'x':
> %a[S,[x]];
et on aura r(x,y) = 1*y + 2*x
- Déclaration d'une matrice. L'identificateur R1 n'existe pas.
/*creation d'une matrice */
>macro matrix_create[_nom, _nbligne, _nbcol]
{
dim _nom[0:_nbligne, 0: _nbcol];
for iligne=1 to _nbligne {
for icol=1 to _nbcol {_nom[iligne,icol]=0$};};
/*met le nb de ligne en 0,0 et met le nb de col en 0,1 */
_nom[0, 0]=_nbligne$
_nom[0, 1]=_nbcol$
};
>%matrix_create[[R1],n,3];
Le tableau sera alors crée et initialise.
En sortie de la macro, _nom, _nbligne, _nbcol n'existeront plus.
|
return (<operation> );
return <operation> ;
Return the result of an operation when the macro is executed.
Example :
>macro a {x=1+y;};
>b=%a;
1 + 1*y
TRIP[1]:return absent dans la macro.
maintenant si on fait:
>macro a {x=1+y; return(x);};
>b=%a;
1 + 1*y
b(y) = 1 + 1*y
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
@;
Display the list of the defined macros.
Example : > @; Voici le nom des macros que je connais: a [x ,y ] b |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
affmac <macro>;
Display the body (trip code) of the macro.
Example : > affmac b; mon nom est : b !"ls"; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| • effmac | ||
| • effmacros |
effmac <macro>;
Delete a macro.
Example :
> macro a[x] { return (x*2);};
> @;
Voici le nom des macros que je connais :
a [ x]
> effmac a;
> @;
je ne connais aucune macro
|
effmacros;
Remove all defined macros.
Example :
> macro a[x] { return (x*2);};
> macro b {!"ls";};
> @;
Voici le nom des macros que je connais :
a [ x]
b []
> effmacros;
> @;
je ne connais aucune macro
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We write a new macro using the command
macro.
Example :
> macro a [n] {n;};
> @;
Voici le nom des macros que je connais:
a [n ]
> affmac a;
mon nom est : a
n;
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To save the macros on disk, the best solution is to use a text editor such as vi, emacs or nedit. The name of the file which contains trip code should be ended with .t .
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 13.1 Loops | ||
| 13.2 condition |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 13.1.1 while | ||
| 13.1.2 for | ||
| 13.1.3 sum | ||
| 13.1.4 stop |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
while (<condition> ) do { <body> };
Execute the body loop while the condition is true.
The while loop is more yielding than for loop because condition could be sophisticated.
A while loop could be immediately stopped using the stop command.
For the condition description, See section condition.
The loop may define local object identifiers, See section Visibility. They will destroyed at the end of each iteration.
Example :
On veut afficher tous les nombres de 1 à n:
> p=1$
> while(p<=5) do {p;p=p+1$};
p = 1
p = 2
p = 3
p = 4
p = 5
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
for <nom> = <real> to <real> { <body> };
for <nom> = <real> to <real> step <real> { <body> };
Execute the loop "for ... until ..." (similar to the for loop in pascal, C or fortran languages).
The argument after step is the loop step.
A for loop could be immediately stopped using the stop command.
The loop may define local object identifiers, See section Visibility. They will destroyed at the end of each iteration.
Remarks :
Example :
>for p = 1 to 5 step(2) {p;};
1
3
5
>for p = 5 to -1 step(-2) {p;};
5
3
1
-1
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
sum <nom> = <real> to <real> { <body> };
sum <nom> = <real> to <real> step <real> { <body> };
Execute the loop "sum ... until ...". It replacesthe for loop statement "s=0$ for j=1 to n { s=s+...$}".
The value returned by the statement return is used for the summation.
The argument after step is the loop step.
A sum loop could be immediately stopped using the stop command.
The loop may define local object identifiers, See section Visibility. They will destroyed at the end of each iteration.
Remarks :
Example :
> s=sum j=1 to 5 { return j; };
s = 15
> s=sum j=1 to 10 step 2 {
a=3*j$
if (mod(j,2)==0) then { return a; } else { return -a; };
};
s = -75
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
stop;
Immediately stops the execution of a for or while loop or of a macro.
Remarks : if stop is used outside a for or while loop or macro statement, a warning message is displayed but the execution continues.
Example :
for p = 1 to 5 { if (p>3) then {stop;} fi; p;};
1
2
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 13.2.1 if | ||
| 13.2.2 Comparison operators | ||
| 13.2.3 switch |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
if (<condition>) then { <body> };
if (<condition>) then { <body> } else { <body> };
if (<condition>) then { <body> } fi; (obsolete statement)
Execute the first body (after the then statement) if the condition is true. The second body is executed if the condition is false.
Example :
> if (n == 2) then {msg "VRAI";} else {msg"FAUX";};
FAUX
> n=2;
2
> if (( n >= 0) && (n < 3)) then {msg "VRAI";} else
{msg "FAUX";};
VRAI
|
Remarks : All object identifiers should be intialized before the execution of the condition. Because otherwise, uninitialized object identifiers will be created as variables and the condition will return false.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
<operation> != <operation>
This test returns true if the two operations are not equal.
Remarks : the test could be performed on polynomials.
<real vec.> != <real vec.>
This test could be used with the operator ?:: (see section Conditions) or the command select (see section Data retrieval). It returns a numerical vector which contains only 0 or 1.
It compares each element of the two vectors. The numerical vector of real numbers must have the same size.
Example :
>if(n != 2) then {} else {};
Condition entre deux tableaux
> t = 0,10;
> r = 10,0,-1;
> q = ?(t!=r);
> q = ?(t!=5);
|
<operation> == <operation>
This test returns true if the two operations are equal.
Remarks : the test could be performed on polynomials.
<real vec.> == <real vec.>
This test could be used with the operator ?:: (see section Conditions) or the command select (see section Data retrieval). It returns a numerical vector which contains only 0 or 1.
It compares each element of the two vectors. The numerical vector of real numbers must have the same size.
Example :
>if(n == 2) then {} else {};
Condition entre deux tableaux
> t = 0,10;
> r = 10,0,-1;
> q = ?(t==r);
> q = ?(t==5);
|
<real> < <real>
This test returns true if the first real number is less than the second number.
<real vec.> < <real vec.>
This test could be used with the operator ?:: (see section Conditions) or the command select (see section Data retrieval). It returns a numerical vector which contains only 0 or 1.
It compares each element of the two vectors. The numerical vector of real numbers must have the same size.
Example :
>n=3$
>if(n < 2) then {} else {};
Condition entre deux tableaux
> t = 0,10;
> r = 10,0,-1;
> q = ?(t<r);
> q = ?(t<5);
|
<real> > <real>
This test returns true if the first real number is greater than the second number.
<real vec.> > <real vec.>
This test could be used with the operator ?:: (see section Conditions) or the command select (see section Data retrieval). It returns a numerical vector which contains only 0 or 1.
It compares each element of the two vectors. The numerical vector of real numbers must have the same size.
Example :
>n=3$
>if(n > 2) then {} else {};
Condition entre deux tableaux
> t = 0,10;
> r = 10,0,-1;
> q = ?(t>r);
> q = ?(t>5);
|
<real> <= <real>
This test returns true if the first real number is less or equal than the second number.
<real vec.> <= <real vec.>
This test could be used with the operator ?:: (see section Conditions) or the command select (see section Data retrieval). It returns a numerical vector which contains only 0 or 1.
It compares each element of the two vectors. The numerical vector of real numbers must have the same size.
Example :
>n=3$
>if(n <= 2) then {} else {};
Condition entre deux tableaux
> t = 0,10;
> r = 10,0,-1;
> q = ?(t<=r);
> q = ?(t<=5);
|
<real> >= <real>
This test returns true if the first real number is greater or equal than the second number.
<real vec.> >= <real vec.>
This test could be used with the operator ?:: (see section Conditions) or the command select (see section Data retrieval). It returns a numerical vector which contains only 0 or 1.
It compares each element of the two vectors. The numerical vector of real numbers must have the same size.
Example :
>n=3$
>if(n >= 2) then {} else {};
Condition entre deux tableaux
> t = 0,10;
> r = 10,0,-1;
> q = ?(t>=r);
> q = ?(t>=5);
|
(<condition>) && ( <condition> )
This test returns true if the two conditions are true.
This test could be apply on numerical vectors when the operator ?:: (see section Conditions) or the command select (see section Data retrieval) are used. It returns a numerical vector which contains only 0 or 1.
It compares each element of the two vectors. The numerical vector of real numbers must have the same size.
Example :
>if ((x==2)&&(y==3)) then {} else {};
Exemple sur des tableaux numériques
> t=0,10;
t Tableau de reels : nb reels =11
> r=10,0,-1;
r Tableau de reels : nb reels =11
> q=?((t>r) && (t!=5));
q Tableau de reels : nb reels =11
|
(<condition>) || ( <condition>)
This test returns true if at least one condition is true.
This test could be apply on numerical vectors when the operator (see section Conditions) or the command select (see section Data retrieval) are used. It returns a numerical vector which contains only 0 or 1.
It compares each element of the two vectors. The numerical vector of real numbers must have the same size.
Example :
>if ((x==2)||(y==3)) then {} else {};
Exemple sur des tableaux numériques
> t=0,10;
t Tableau de reels : nb reels =11
> r=10,0,-1;
r Tableau de reels : nb reels =11
> q=?((t>r) || (t!=5));
q Tableau de reels : nb reels =11
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
switch ( <operation> expr )
{
case <operation> : { <body> };
case <operation> , ..., <operation> : { <body> };
else { <body> }
};
The instruction switch control complex conditional on the same value and branching operations.
expr can be a string, a serie or a constant. The value of expr are tested successively with each value of the case statements with the operator ==.
When expr is equal to one of the values of a case statement, the body statement after this case is executed.
The statement else is executed if no caseÊconstant-expression is equal to the value of expr. The statement else { <body> } is optional and has no semi-column after its body.
Example :
n=0;
z=0;
j=5;
switch( j )
{
case -1 : { n=n+1; };
case 0,1 : { z=z+1; };
case "mystring" : { msg "j is a string"; };
else { msg "j is invalid"; }
};
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 14.1 Frequency analysis | ||
| 14.2 Fourier Transform | Transformee de Fourier. | |
| 14.3 Inverse Fourier Transform | Transformee de Fourier Inverse. | |
| 14.4 Numerical integration | Integration numerique. | |
| 14.5 Integral | ||
| 14.6 Numerical iteration | Iteration. | |
| 14.7 Interpolation |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 14.1.1 naf | ||
| 14.1.2 naftab | ||
| 14.1.3 freqa | ||
| 14.1.4 freqareson | ||
| 14.1.5 sertrig |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
naf(KTABS, fichiersource, fichierresultat, XH, T0, NTERM, CX, CY);
with :
It performs the frequency analysis of the data in the source file and stores the found frequencies to the file fichierresultat.sol. It uses KTABS+1 values.
KTABS is rounded to the nearest least value such that KTABS = 6n with n positive integer.
The used parameters are stored to the file fichierresultat.par.
The intermediate results are stored to the file fichierresultat.prt if _naf_iprt>=0.
It uses the global variables _naf_nulin, _naf_iprt, _naf_isec, _naf_iw, _naf_dtour, _naf_icplx.
The file fichierresultat.sol contains:
Example :
Le fichier "tessin.out" contient des données
sur 32996 lignes avec une ligne d'entete.
tels que la colonne 2 contient la partie réelle des données.
la colonne 3 contient la partie imaginaire des données.
la première ligne du fichier est à ignorer.
Le temps initial est 0 et le pas est de 0.01.
Nous recherchons 10 frequences.
Le fichier resultat à pour nom "tesnaf".
> _naf_nulin=1;
> naf(32996,tessin.out, tesnaf, 0.01, 0, 10, 2, 3);
Le premier argument de naf n'est pas multiple de 6.
Le premier argument de naf devient 32994.
Les frequences trouvees sont sauves dans le fichier :tesnaf.sol
Les paramètres employees sont sauves dans le fichier :tesnaf.par
Le fichier tesnaf.par contient :
NOMFPAR = tesnaf.par
NOMFOUT =
NOMFDAT = tessin.out
NOMFSOL = tesnaf.sol
DTOUR = 6. 83185307179586E+00
T0 = 0.000000000000000E+00
XH = 1.000000000000000E-02
KTABS = 32994
DNEPS = 1.000000000000000E+100
NTERM = 10
ICPLX = 1
IW = 1
ISEC = 1
NULIN = 1
ICX = 2
ICY = 3
IPRNAF = -1
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
naftab(TX, TY, A, F, KTABS, XH, T0, NTERM);
naftab(TX, TY, A, F, KTABS, XH, T0, NTERM, TRESX, TRESY);
naftab(TX, TY, A, F, KTABS, XH, T0, NTERM, TRESX, TRESY, (FMIN1, FMAX1, NTERM1),...);
with :
It performs the frequency analysis of the dat in the vectors (TX+i*TY) and store the found frequencies to F and the complex amplitudes to A.
KTABS is rounded to the nearest least value such that KTABS = 6n+1 with n positive integer.
It uses the global variables_naf_isec, _naf_iw, _naf_dtour, _naf_icplx
.
It finds an approximation of TX+iTY in the form of sum from l=0 to size(F) { A[l]*exp(i*F[l]*t) }
In this case, A is a numerical vector of complex numbers ( <complex vec.> ).
The triplets (FMINx, FMAXx, NTERMx) define the windows. Only the frequencies in the window are searched if a window is specified.
Example :
Le fichier "tessin.out" contient des données
sur 32998 lignes avec une ligne d'entete.
tels que la colonne 2 contient la partie réelle des données.
la colonne 3 contient la partie imaginaire des données.
Le temps initial est 0 et le pas est de 0.01.
Nous recherchons 10 frequences.
> vnumR X,Y,F;
vnumC A;
read(tessin2.out, [1:32000],(X,2),(Y,3));
naftab(X,Y,A,F,32000,0.01, 0, 10);
B=abs(A);
Le premier argument de naf n'est pas multiple de 6.
Le premier argument de naf devient 31998.
CORRECTION DE IFR = 1 AMPLITUDE = 8.72192e-07
B Tableau de reels : nb reels =6
> writes(F,B,A);
+9.999993149794888E-02 +1.000000E-01 +1.000E-01 +1.095970178673141E-06
-2.000000944035095E-01 +9.999999E-03 +9.999E-03 +1.312007532388499E-07
+3.000000832689856E-01 +1.000000E-03 +1.000E-03 -1.403292661135361E-08
-4.000000970924361E-01 +9.999995E-05 +9.999E-05 +1.695880029074994E-09
+4.999999805039361E-01 +1.000003E-05 +1.000E-05 +3.216502329016007E-11
-5.999999830866213E-01 +9.999979E-07 +9.999E-07 -1.796078221829677E-12
>
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
freqa(TFREQ, TFREQREF, TABCOMBI, TINDIC, ORDREMAX, EPSILON, TFREQRESIDU)
with :
For each frequency in the vector TFREQ, it finds the integer combination of the fundamental frequencies stored in TFREQREF with the accuracy EPSILON and the maximal order ORDREMAX. For each frequency in the vector TFREQ, the searching will be stop as soon as a valid integer combination is found. The searching is performed by increasing the total order.
If a combination is found, then
If a combination isn't found, then alors
On exit, TABCOMBI is an array of size(TFREQREF) numerical vectors of size(TFREQ) integers,
TINDIC is a numerical vector of size(TFREQ) integers (0/1),
TFREQRESIDUis a numerical vector of size(TFREQ) reals.
On exit, all elements of the array TABCOMBI verify
1<=sum(abs(TABCOMBI[i][]))<=ORDREMAX.
Example : > freqfond=1,5; > freqfond[1]=3.1354; > freqfond[2]=5.452; > freqfond[3]=7.888; > freqfond[4]=11.111; > freqfond[5]=19.777; > freq=1,5; > freq=freq*freqfond[1]+freq*freqfond[2]+freq*freqfond[3]+ > freq*freqfond[4]+freq*freqfond[5]; > freqa(freq,freqfond,tabcomb, tabind,20,1E-6, freqres); > %writesfreqa[[freq],[freqfond],[tabcomb],[tabind] , [freqres]]; > freqfond[1] = 15677/5000 > freqfond[2] = 1363/250 > freqfond[3] = 986/125 > freqfond[4] = 11111/1000 > freqfond[5] = 19777/1000 Frequence Frequence residuelle combinaison ------------------------------------------------------------------- 4.736340000000000E+01 +0.000000000000000E+00 1 1 1 1 1 9.472680000000000E+01 +0.000000000000000E+00 2 2 2 2 2 1.420902000000000E+02 +0.000000000000000E+00 3 3 3 3 3 1.894536000000000E+02 +0.000000000000000E+00 4 4 4 4 4 2.368170000000000E+02 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
freqareson(FREQ, TFREQREF, TABCOMBI, ORDREMAX, EPSILON, TFREQRESIDU)
with :
For the frequency FREQ, it finds all integer combinations of the fundamental frequencies TFREQREF with the accuracyn EPSILON and the maximal order ORDREMAX.
On exit, for each found combination,
On exit, TABCOMBI is an array of size(TFREQREF) numerical vectors of integers.
On exit, all elements of the array TABCOMBI verify
sum(abs(TABCOMBI[i][]))<=ORDREMAX.
Example :
>vnumR freqfond;
>resize(freqfond,5);
>freqfond[1]=3.1354;
>freqfond[2]=5.452;
>freqfond[3]=2*freqfond[3];
>freqfond[4]=11.111;
>freqfond[5]=19.777;
>freq=2*freqfond[1]+freqfond[2]-freqfond[3]+freqfond[4]-freqfond[5];
>freqareson(freq,freqfond,tabcomb, 8,1E-6, freqres);
>writes("%+-g\t%+-g\t%+-g\t%+-g\t%+-g\n",tabcomb);
+2 -1 +0 +1 -1
+2 +1 -1 +1 -1
+2 -3 +1 +1 -1
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
sertrig(<tab. complexes> TAMP, <real vec.> TFREQ, <variable> VAR)
sertrig(<tab. complexes> TAMP, <real vec.> TFREQ, <variable> VAR, <real> FACT )
with :
The vector TAMP et TFREQ must have the same size.
It computes the sum : for each element j of the vectors : TAMP[j]*exp(i*TFREQ[j]*VARIABLE) or for each element j of the vectors : TAMP[j]*exp(i*2*pi*TFREQ[j]*VARIABLE/FACT)
The part exp(i*...)is represented as an angular variable where the argument is the frequency and the phase is null. The amplitude is the coefficient of this variable. All angular variables have the prefix _Ex. There will be the same number of angular variables as the frequencies' one. The serie will contain the same number of terms as the size of the numerical vectors.
Example : Le F contient les frequences et le tableau A contient les amplitudes. > writes(F,A); +9.999993149794888E-02 +1.000000000456180E-01 +1.095970178673141E-06 -2.000000944035095E-01 +9.999999960679056E-03 +1.312007532388499E-07 +3.000000832689856E-01 +1.000000314882390E-03 -1.403292661135361E-08 -4.000000970924361E-01 +9.999995669530993E-05 +1.695880029074994E-09 +4.999999805039361E-01 +1.000003117384769E-05 +3.216502329016007E-11 -5.999999830866213E-01 +9.999979187109419E-07 -1.796078221829677E-12 > s=sertrig(A,F,t); s(_EXt1,_EXt2,_EXt3,_EXt4,_EXt5,_EXt6) = (9.99997918710942E-07-i*1.79607822182968E-12)*_EXt6 + (1.00000311738477E-05+i*3.21650232901601E-11)*_EXt5 + (9.99999566953099E-05+i*1.69588002907499E-09)*_EXt4 + (0.00100000031488239-i*1.40329266113536E-08)*_EXt3 + (0.00999999996067906+i*1.3120075323885E-07)*_EXt2 + (0.100000000045618+i*1.09597017867314E-06)*_EXt1 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
fft (TX, TY, TAMP, TFREQ, XH, T0, DTOUR, IW)
with :
It computes the Fast Fourier Transform of TX+i*TY and stores the amplitudes and frequencies to the vectors TAMP et TFREQ.
It keeps only the first "N" elements of TX and TY such that "N" is the greatest power of 2 less than the size of the vector TX.
Remarks: TX and TY must have the same size.
Example : >vnumC z; vnumR freq; xin=vnumR[7.:5.:6.:9.]; yin=vnumR[0:0:0:0]; fft(xin,yin,z,freq,1,0,pi,0); writes(z,freq); > -2.500000000000000E-01 +0.000000000000000E+00 -1.570796326794897E+00 +2.499999999999993E-01 -1.000000000000000E+00 -7.853981633974483E-01 +6.750000000000000E+00 +0.000000000000000E+00 +0.000000000000000E+00 +2.500000000000007E-01 +1.000000000000000E+00 +7.853981633974483E-01 -2.500000000000000E-01 +0.000000000000000E+00 +1.570796326794897E+00 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ifft (TAMP, TX, TY, XH, T0)
with :
It computes the Inverse Fast Fourier Transform of TAMP and stores the results to TX+i*TY.
TAMP is a numerical vector of 2**N+1 complex numbers. On exit, TX and TY contains 2**N numbers.
Example : >vnumC z; vnumR freq; xin=vnumR[7.:5.:6.:9.]; yin=vnumR[0:0:0:0]; fft(xin,yin,z,freq,1,0,pi,0); ifft(z,xout,yout,1,0); writes(xout,yout); > +7.000000000000000E+00 +0.000000000000000E+00 +5.000000000000000E+00 +0.000000000000000E+00 +6.000000000000000E+00 +0.000000000000000E+00 +9.000000000000000E+00 +0.000000000000000E+00 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
integnum( T0, TF, PAS, PREC, DOPRIMAX, PASDOPRI, FICHIER,
{ REAL ,(VAR1, SER1, VI1),...},
{ COMPLEX ,(VAR2, SER2, VI2),...});
with :
It performs the numerical integration of the series in the list with the initial conditions and store the results to the file FICHIER.
The equations are triplets of integrated variable, serie and intial condition.
Example :
Nous souhaitons integrer le système : { dx/dt = -y , dy/dt= x }
avec les valeurs initiales x=1 et y=0
entre 0 et 2*pi avec un pas de pi/10 et une précision de 1E-12.
Le pas de dopri sera pi/20 et le pas mximum de dopri sera pi/10.
Les resultats seront stockes dans le fichier icossin.out
La solution est : x = cos(t) et y = sin(t)
>integnum(0,2*pi, pi/10, 1E-12, pi/10, pi/20,
icossin.out, REAL, (x, -y, 1),(y,x, 0));
Le fichier icossin.out contient :
time x y
+0.000000000000000E+00 +1.000000000000000E+00 +0.000000000000000E+00
+3.141592653589793E-01 +9.510565162951542E-01 +3.090169943749471E-01
+6.283185307179586E-01 +8.090169943749489E-01 +5.877852522924729E-01
+9.424777960769379E-01 +5.877852522924752E-01 +8.090169943749478E-01
+1.256637061435917E+00 +3.090169943749500E-01 +9.510565162951550E-01
+1.570796326794897E+00 +2.567125951231441E-15 +1.000000000000003E+00
+1.884955592153876E+00 -3.090169943749455E-01 +9.510565162951576E-01
+2.199114857512855E+00 -5.877852522924724E-01 +8.090169943749527E-01
+2.513274122871834E+00 -8.090169943749485E-01 +5.877852522924791E-01
+2.827433388230814E+00 -9.510565162951568E-01 +3.090169943749536E-01
+3.141592653589793E+00 -1.000000000000005E+00 +5.403107187863445E-15
+3.455751918948772E+00 -9.510565162951610E-01 -3.090169943749436E-01
+3.769911184307752E+00 -8.090169943749564E-01 -5.877852522924716E-01
+4.084070449666731E+00 -5.877852522924830E-01 -8.090169943749488E-01
+4.398229715025710E+00 -3.090169943749571E-01 -9.510565162951583E-01
+4.712388980384690E+00 -8.301722685091165E-15 -1.000000000000008E+00
+5.026548245743669E+00 +3.090169943749417E-01 -9.510565162951644E-01
+5.340707511102648E+00 +5.877852522924709E-01 -8.090169943749602E-01
+5.654866776461628E+00 +8.090169943749494E-01 -5.877852522924867E-01
+5.969026041820607E+00 +9.510565162951601E-01 -3.090169943749604E-01
+6.283185307179586E+00 +1.000000000000011E+00 -1.085302505620242E-14
|
Example :
Nous souhaitons integrer le système :
{ dz/dt = 1 , dZ/dt= Z+i*z*Z } avec Z=expi(z,1,0)
avec les valeurs initiales x=1 et y=0
entre 0 et 2*pi avec un pas de pi/10 et une précision de 1E-12.
Le pas de dopri sera pi/20 et le pas mximum de dopri sera pi/10.
Les resultats seront stockes dans le fichier icossin.out
La solution est : z=t et Z=t*exp(i*t)
> Z=expi(z,1,0);
1*Z
> integnum(0,2*pi, pi/10, 1E-12, pi/10, pi/20, spirale,
REAL,(z, 1,0),COMPLEX,(Z,Z+i*z*Z,0));
>
Le fichier spirale contient :
time z Re(Z) Im(Z)
+0.000000000000000E+00 +0.000000000000000E+00 +0.000000000000000E+00 +0.0...
+3.141592653589793E-01 +3.141592653589793E-01 +2.987832164741556E-01 +9.7...
+6.283185307179586E-01 +6.283185307179585E-01 +5.083203692315260E-01 +3.6...
+9.424777960769379E-01 +9.424777960769378E-01 +5.539745491471372E-01 +7.6...
+1.256637061435917E+00 +1.256637061435917E+00 +3.883222077450937E-01 +1.1...
+1.570796326794897E+00 +1.570796326794896E+00 +6.887946983297801E-16 +1.5...
+1.884955592153876E+00 +1.884955592153876E+00 -5.824833116176390E-01 +1.7...
+2.199114857512855E+00 +2.199114857512855E+00 -1.292607281343319E+00 +1.7...
+2.513274122871834E+00 +2.513274122871834E+00 -2.033281476926103E+00 +1.4...
+2.827433388230814E+00 +2.827433388230813E+00 -2.689048948267399E+00 +8.7...
+3.141592653589793E+00 +3.141592653589793E+00 -3.141592653589793E+00 +1.5...
+3.455751918948772E+00 +3.455751918948772E+00 -3.286615381215711E+00 -1.0...
+3.769911184307752E+00 +3.769911184307751E+00 -3.049922215389156E+00 -2.2...
+4.084070449666731E+00 +4.084070449666730E+00 -2.400556379637595E+00 -3.3...
+4.398229715025710E+00 +4.398229715025709E+00 -1.359127727107829E+00 -4.1...
+4.712388980384690E+00 +4.712388980384689E+00 -3.135465452360846E-15 -4.7...
+5.026548245743669E+00 +5.026548245743668E+00 +1.553288830980370E+00 -4.7...
+5.340707511102648E+00 +5.340707511102647E+00 +3.139189111833773E+00 -4.3...
+5.654866776461628E+00 +5.654866776461627E+00 +4.574883323083731E+00 -3.3...
+5.969026041820607E+00 +5.969026041820606E+00 +5.676881113008954E+00 -1.8...
+6.283185307179586E+00 +6.283185307179585E+00 +6.283185307179584E+00 -3.5...
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
integral(<num. vec.> TY, <real> XH, <integer> ORDRE, <object identifier> N)
with :
It computes the integral, using Newton-Cotes formulas, of order ORDRE, of the numerical vector TY where data are equally spaced of XH.
It returns in N the index of the last element used to compute the integral. The value of N verifies : N=int((size(TY)-1)/ORDRE)*ORDRE+1
For Newton-Cotes formulas, see the book "Introduction to Numerical Analysis", chapter integration, of Stoer and Burlisch.
Example :
> t=0,10000;
t Tableau de reels : nb reels =10001
> t=t*pi/10000;
> X=-cos(t)+1;
> for j=1 to 6 { s=integral(sin(t),pi/10000,j,N); delta=s-X[N];};
s = 1.99999998355066
delta = -1.64493392240672E-08
s = 1.99999999999999
delta = -7.54951656745106E-15
s = 1.99999995065198
delta = 5.55111512312578E-15
s = 2
delta = -4.44089209850063E-16
s = 2
delta = 8.88178419700125E-16
s = 1.99999921043176
delta = 5.77315972805081E-15
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
iternum( nbiteration, passortie, fichierresultat ,
REAL ,( variable1, serie1, valeurinitiale1),...},
COMPLEX ,( variable2, serie2, valeurinitiale2),...});
with :
It performs nbiteration iterations on the equations specified in lists. it writes results to file every passortie iterations.
The equations are triplets of the iterated variable, serie and initial value.
The initial value could be a real or a complex number.
Example :
> iternum(10,1,sortie.txt,REAL,(un,un+2,3));
Le fichier "sortie.txt" contient :
time un
+0.000000000000000E+00 +3.000000000000000E+00
1 +5.000000000000000E+00
2 +7.000000000000000E+00
3 +9.000000000000000E+00
4 +1.100000000000000E+01
5 +1.300000000000000E+01
6 +1.500000000000000E+01
7 +1.700000000000000E+01
8 +1.900000000000000E+01
9 +2.100000000000000E+01
10 +2.300000000000000E+01
> iternum(5,1,sortie.txt,REAL,(vn,un-1,3),(un,vn+un,2));
Le fichier "sortie2.txt" contient :
time vn un
+0.000000000000000E+00 +3.000000000000000E+00 +2.000000000000000E+00
1 +1.000000000000000E+00 +5.000000000000000E+00
2 +4.000000000000000E+00 +6.000000000000000E+00
3 +5.000000000000000E+00 +1.000000000000000E+01
4 +9.000000000000000E+00 +1.500000000000000E+01
5 +1.400000000000000E+01 +2.400000000000000E+01
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
interpol(LINEAR , TX, DTX, TY)
interpol(QUADRATIC , TX, DTX, TY)
interpol(SPLINE , TX, DTX, TY)
interpol(HERMITE , TX, DTX, TY, DEG)
with :
It performs the linear, spline, quadratic or hermitian interpolation. It returns a numerical vector of interpolated values at the time TY from the known data (TX, DTX).
Remarks : it assumes that TX et TY are sorted in ascending or descending order.
If TY[i] isn't in the interval [ TX[0], TX[size(TX)] ], then DTY[i] is extrapolated.
The algorithm of the hermitian interpolation is described in the Stoer and Burlish's book, 1993, "Introduction to Numerical Analysis, Chap 2, pages 52-57".
Example :
> x1=0,2*pi,2*pi/59;
> x2=0,3,0.5;
> sl=interpol(LINEAR,x1,cos(x1),x2);
> writes("%.2E %.4E %.4E\n",x2, cos(x2), sl);
0.00E+00 1.0000E+00 1.0000E+00
5.00E-01 8.7758E-01 8.7652E-01
1.00E+00 5.4030E-01 5.3958E-01
1.50E+00 7.0737E-02 7.0719E-02
2.00E+00 -4.1615E-01 -4.1576E-01
2.50E+00 -8.0114E-01 -8.0001E-01
3.00E+00 -9.8999E-01 -9.8920E-01
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
help;
?;
Display help.
On Unix and MacOS X operating systems, the help program uses the software info (provided by Texinfo) to display help. On Windows operating systems, the help file (chm format) is displayed.
help <motreserve>;
? <motreserve>;
It displays the help in the reference manual for the keyword of TRIP. On Unix and MacOS X operating systems, this function calls the program info (provided by Texinfo).
Example : > ? vartrip; |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
quit;
exit;
Stop the execution of TRIP.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
cls;
Clear the current screen (similar to the Unix command clear).
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
pause;
Display a message, suspend execution until the user hits the key <RET>.
pause(<integer> x);
Suspend execution for x seconds.
Example :
> for j=1 to 3 { j; pause; time_s; pause(2); time_t; };
1
Appuyez sur la touche return pour continuer...
02.000s
2
Appuyez sur la touche return pour continuer...
02.000s
3
Appuyez sur la touche return pour continuer...
02.000s
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
msg <string> ;
msg(<string> textformat);
Display unformatted messages to the screen.
This message must a be string or a text between double-quotes. The messages could be on several lines.
msg(<string> textformat, <real> x, ... );
Display formatted messages to the screen with(out) real constants.
The real constants must be formatted. The format is the same as the command printf in language C (see section Conversion from an integer or a real to a string, for the valid conversion specifiers). This message must a be string or a text between double-quotes. The messages could be on several lines.
To display double-quotes, two double-quotes must be used.
Under the numerical mode NUMRATMP only, the integers or rational numbers are converted to double-precision floating-point numbers before they are displayed if the format is '%g', '%e' or '%f'. if the format is '%d' or '%i', the integers or rational numbers are written without any conversion.
The function msg (see section msg) has the same behavior but writes the result into a string of characters.
Example :
> file="fichier1.dat"$
> msg"écriture du fichier "+file;
écriture du fichier fichier1.dat
> msg "je vais faire un guillemet :
""cette chaine est encadre par des guillemets"".";
je vais faire un guillemet :
"cette chaine est encadre par des guillemets".
> msg("pi=%g pi=%.8E\n",pi,pi);
pi=3.14159 pi=3.14159265E+00
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
delete( <object identifier> );
Delete any object (serie, variable, array, ...).
Remarks :
Example : > file="fichier1.dat"; file = "fichier1.dat" > X=expi(x,1,0); 1*X > delete(file); > delete(x); La variable angulaire X est convertie en variable polynomiale. |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
reset;
Reinitialize TRIP : TRIP global variables are set to default values and delete all object identifiers in memory.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
include <filename> ;
include <string> ;
It loads the file "fichier" and run it.
This file must be located in the current directory or in the directory specified by the variable _path.
The file extension could have any value. The recommanded file extension is .t .
Remarks : If the file is an object identifier of type string, then it loads the file which its name is the contents of the string.
Example : >include ellip; >include fct.t; > file="fperplanumH"; file = "fperplanumH" > include file; /*exécute le fichier "fperplanumH" */ |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
@@;
Reinitialize TRIP. Then it loads and executes the last file executed by the command include.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
vartrip;
Displays the status of all TRIP global variables.
Example :
> vartrip;
Etat des variables globales de Trip :
_affc = 6
_affdist = 0
_affhomog = 0
_echo = 0
_path = /exemples/
_history = /unixfiles/
_hist = ON
_naf_iprt = -1
_naf_icplx = 1
_naf_iw = 1
_naf_isec = 1
_naf_dtour = 6.283185307179586E+00
_naf_nulin = 1
_naf_tol = 1.000000000000000E-10
_time = OFF
_comment = OFF
_affvar = ( )
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
bilan;
Displays all object identifiers in memory with their type :
SERIE | the object is a serie. |
VARIABLE | the object is a variable. |
CONST | the object is a constant. |
TAB | the object is an array. |
TABVAR | the object is a array of variables. |
VECNUM | the object is a numerical vector of real or complex numbers. |
CHAINE | the object is a string. |
EXTERNAL STRUCTURE | the object is an external strcuture. |
FILE | the object is a file. |
REMOTE OBJECT | the object is a remote object stored on a SCSCP server. |
SCSCP client | the object is a connection to a SCSCP server. |
bilan mem;
For each serie or array of series, it displays the memory used and the number of terms.
The total number of terms and total memory used for series are displayed.
Example :
> bilan;
A VAR
ASR SERIE
ASRp SERIE
RSA SERIE
X VAR
_AsR SERIE
_CosE SERIE
_Expiv SERIE
_RsA SERIE
_RsASinv SERIE
_SinE SERIE
e VAR
ep VAR
g VAR
ga VAR
lp VAR
tr2 TRONC
tr3 TRONC
tr4 TRONC
tr5 TRONC
x VAR
> bilan mem;
Nom Memoire (octets) Nb de termes
-------------------- -------------------- --------------------
ASR 1704 64
ASRp 1704 64
RSA 2136 81
_AsR 1704 64
_CosE 2112 80
_Expiv 1728 64
_RsA 2136 81
_RsACosv 2112 80
_RsAExpiv 1728 64
_RsASinv 2112 80
_SinE 2112 80
-------------------- -------------------- --------------------
21288 802
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
stat;
It displays all series in memory. It displays truncation level for variables in a serie. It displays dependancies between angular and polynomial variables.
stat( <object identifier> );
Depending on the object type, it displays information on number of terms, number of homogeneous blocks, number of Fourier and memory used by the object.
Example :
> stat(_SinE);
serie _SinE ( e , X )
ser->descripteur.ordre = 2
ser->descripteur.odval = 1
ser->descripteur.flist = 1
ser->descripteur.modenum = 0
nombre de variables : 2 taille du descripteur : 32 octets
nombre de termes : 24 taille : 920 octets
nombre de blocs Homogenes : 0
nombre de blocs de Fourier : 0
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
save_env;
Save TRIP global variables to a stack.
Example :
> _mode;
_mode = POLP
> save_env;
> _mode=POLH;
_mode = POLH
> rest_env;
> _mode;
_mode = POLP
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
rest_env;
Restore the TRIP global variables saved by save_env from a stack.
Example :
> _path="/users/";
_path = /users/
> save_env;
> _path="/users/toto/";
_path = /users/toto/
> /*instructions utilisant le chemin specifique */;
> rest_env;
> _path;
_path = /users/
> |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
random(<integer> x)
Return a pseudo-random number in the range from 0 and x-1.
Example :
> random(10);
1
> random(10);
7
> random(10);
0
> random(10);
9
> random(10);
8
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
file_fullname(<string> name)
It builds an absolute file name. All later usage of the returned string will ignore the variable _path.
Example :
> _path;
_path = /users/guest/data/
> vnumR t;
> fn=file_fullname("/tmp/mydata.txt");
fn = nom de fichier '/tmp/mydata.txt'
> read(fn,t);
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| • time_s | ||
| • time_t | ||
| • time_l |
time_s;
Initialize the starting time for computations in functions time_l and time_t.
time_l;
Displays the consumed user CPU time, the elapsed real time, and the consumed system CPU time, since the last call to time_l.
If no previous call to time_l was performed, then it displays the user time used since the last call to time_s.
Example :
> time_s; for j=1 to 3 { (1+x+y+z+t+u+v)**18$ time_l; };
utilisateur 00.313s - reel 00.183s - systeme 00.057s - (202.43% CPU)
utilisateur 00.307s - reel 00.170s - systeme 00.055s - (213.11% CPU)
utilisateur 00.311s - reel 00.173s - systeme 00.055s - (211.93% CPU)
|
time_t;
Displays the consumed user CPU time, the elapsed real time, and the consumed system CPU time, since the last call to time_s.
time_t(<object identifier> usertime , <object identifier> realtime );
Displays the consumed user CPU time, the elapsed real time, and the consumed system CPU time, since the last call to time_s.
usertime will contain the sum of the user and system CPU time and realtime the elapsed real time.
Example :
> time_s; for j=1 to 3 { (1+x+y+z+t+u+v)**18$ time_t; };
time_t(usertime, realtime);
utilisateur 00.310s - reel 00.178s - systeme 00.055s - (205.29% CPU)
utilisateur 00.615s - reel 00.347s - systeme 00.111s - (209.44% CPU)
utilisateur 00.928s - reel 00.519s - systeme 00.168s - (211.23% CPU)
utilisateur 00.928s - reel 00.519s - systeme 00.168s - (211.20% CPU)
> usertime;
usertime = 1.097452
> realtime;
realtime = 0.5196029999999999
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |