Reference manual TRIP
. You can check the current page or check for previous versions at the Internet Archive.
Yahoo! is not affiliated with the authors of this page or responsible for its content.
Reference manual TRIP
Reference manual TRIP
version 0.99.0
21 janvier 2008
Gastineau - Laskar
TRIP is a general computer algebra system dedicated to celestial mechanics.
Authors :
J. Laskar
Astronomie et Syst`
emes Dynamiques
Institut de M´
ecanique C´
eleste
77 avenue Denfert-Rochereau
75014 PARIS
email :
laskar@imcce.fr
M. Gastineau
Astronomie et Syst`
emes Dynamiques
Institut de M´
ecanique C´
eleste
77 avenue Denfert-Rochereau
75014 PARIS
email :
gastineau@imcce.fr
With the contributions of E. Paviot, F. Thire, D. Achero, M. To, A. Ceyrac, G. Rouault.
This software includes a library developped by the NetBSD fundation and its contributors.
This software includes the libraries LAPACK, GMP, MPFR et MPC.
TRIP version 0.99.0
Copyright c TRIP 1988-2008 J.Laskar/ASD/IMCCE/CNRS
Chapter 1: Introduction
1
1 Introduction
In order to execute TRIP, you must
Under Unix or MacOs X, enter trip in a shell window.
Under Windows, click on trip icon for the console version.
Under Windows, click on tripstudio icon for the graphic version.
You will see on screen :
¨
**** BIENVENUE SUR TRIP v0.98.30 ****
Taper help; ou ?; pour obtenir de laide
>
©
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 :
¨
**** BIENVENUE SUR TRIP v0.98.30 ****
Taper help; ou ?; pour obtenir de laide
> S=(X+Y)^2;
S(X,Y) = 1*Y**2 + 2*Y*X + 1*X**2
©
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 specied in the Annexes. TRIP contains
several keyword categories :
TRIP global variables, TRIP constants and mathematic symbol.
Functions : command returns a value
Procedures : command doesnt return a value.
When TRIP starts or the commands reset or @@ are executed, it reads these les 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 le may contain any valid instructions.
Recommendations :
The following environment variables should be set and exported:
TMPDIR : pathname of a directory in which temporary les may be written.
LC MESSAGES : language used to display messages.
2
Reference manual TRIP
Chapter 2: Semantic
3
2 Semantic
2.1 expression
An expression can contain all dened operators on object identiers 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.
Example :
> s=1+t; /* calcule 1+t et affiche le resultat */
s(t) = 1 + 1*t
> s1=deriv(s,t)$ /*derive s mais naffiche pas le resultat. */
> s1; /* affich´
e le contenu de s1 */
s1 = 1
2.2 object identier
An object identier 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 identier is global, so it will be viewed by any instruction. An object
identier 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 nished. A
TRIP
reserved keyword cant be used
as the name of an object identier.
The object identier can have the following type :
variable
serie
constant
array of series
numerical vector
string of characters
Example :
> ch="file1"$
> s=1+x$
> dim t[1:2];
> dimvar bb[1:10];
> z=1+2*i;
z = (1+i*2)
> tr=({x,3})$
> bilan;
bb
TABVAR
ch
CHAINE
s
SERIE
t
TAB
tr
TRMON
x
VAR
4
Reference manual TRIP
2.2.1 Visibility
[Commande]
private
private <object identier> x ,...;
The specied object identiers will be locals to the macro.
The local object identiers are destroyed at the end of the execution of the macro.
If a local object identier has the same name as a global object identier, then the local
object identier will be used. In this case, the local object identier hides the global object
identier during the exeuction 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
Chapter 2: Semantic
5
2.3 serie
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
2.4 constant
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 oating-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]
2.5 string
Its a list of characters surrounded with " ". Its used to specify the _path, to dene the
name of the les, to display messages, ... . There is no limit on the size. But, for the global
variable _path, its 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";
6
Reference manual TRIP
ch3 = "nomsuivide"fin"
2.6 real
<nom> = <real> ;
A real oating-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
2.7 complex
<nom> = <real> + i * <real> ;
A complex number is allowed. The lower-case i or upper-case I species the imaginary part
of the complex number.
Example :
>
x=2+i*3;
x = (2+i*3)
> y=-5+4*i;
y = (-5+i*4)
2.8 lename
Its a string of characters. This string must be surrounded with " " if the string contains the
character space " [ ] { } () or more than one points. A le name could be the content of an
object identier of type string.
Example :
> read("fichier.1.dat",T);
> s="ell."+str(10)+".asc";
s = "ell.10.asc"
> read(s,T);
2.9 le
Its an object identier which species a le, which is opened in reading or writing mode.
Example :
> f = file_open("fichier.1.dat",read);
> file_close(f);
The denition of the function, subroutines and variables use the following types :
<object identier>
object identier
<integer>
natural integer number or an operation which returns an
integer
Chapter 2: Semantic
7
<real>
real oating-point number or an operation which returns a
real oating-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
<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 oating-point number or numerical vector of real
numbers
<lename>
lename
<le>
le
<dimension of an array>
two integers separated with the character :
<list of dimension>
list of <dimension dun tableau> 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