************************************************************** ***** THE MATHEMATI92 PACKAGE, VERSION 1.1, 7 January 1997 *** ******** Author: Jean-Michel Ferrard ********* ************************************************************** ************************************************************** FOREWORD ************************************************************** First, anyone reading this text will quickly realize that english is not my native language. So I ask for leniency. In fact, I'm a french math teacher, about 40 years old. I teach at college level: my students are about 20 years old and hope to become engineers or (themselves) math teachers. My name is Jean-Michel Ferrard, and my e-mail is . Ten years ago, I started writing books in France about calculators (first HP28 and HP48 -nobody is perfect- and then TI85, TI92, TI83). One of these books (about HP48) was recently present in Educalc catalog (I don't know if it's still true, and it's does not matter). These books gave me some audience among students and teachers in France. Since TI92 release, I became addicted to this powerfull tool and I became a TI animator in France (now I've forgotten my HP life). I take pleasure in programming, especially the TI-92 and I aim to extend mathematical capabilities of this calculator. This package is named MATHEMATI92. ************************************************************** MATHEMATI92: PRESENTATION OF THE PACKAGE ************************************************************** This package is composed of 11 files: 1) README.TXT: this text 2) MAIN.92G: a TI92 group file to be located in main folder 3) ARIT.92G: a TI92 group file to be located in arit folder 4) CALCULUS.92G: a TI92 group file to be located in calculus folder 5) DIFGEO.92G: a TI92 group file to be located in difgeo folder 6) FINSER.92G: a TI92 group file to be located in finser folder 7) GEOMETRY.92G: a TI92 group file to be located in geometry folder 8) POLY.92G: a TI92 group file to be located in poly folder 9) RANDVARS.92G: a TI92 group file to be located in randvars folder 10) SPECFUNC.92G: a TI92 group file to be located in specfunc folder (keeping these names is important because some programs of a given folder call others programs in another folder). The whole prgms and funcs presented here consume about 74000 bytes. So the complete package doesn't fit into a single TI92. But it fits comfortably in a TI92E (with 128K extra RAM). Each group file (from arit.92G to specfunc.92G) contains a namesake program whose part is to give a comfortable access to all the funcs prgms of the corresponding folder. For example, the ARIT.92G contains a program named arit(), which allows to call all the funcs and prgms of the arit folder. A little exception is the program run() (in the MAIN.92G file) whose part is to give a comfortable access to all folders (from arit to specfunc). Suppose the whole package being present in your TI92. You have several possibilities: 1) You are in main folder, and you call the run() program. Then, with a system of menus, you'll be able to call any program in any folder. 2) You are, for example, in arit folder, and you call arit() program. Then you'll be able to call any program in this folder. 3) The third possibility is not to use the run() program, nor the arit() program in folder arit,..., nor the sepcfunc() program in specfunc folder. You'll be able to call all funcs and prgms of the package, but you'll have to remember all their names, and what parameters they need, and in which order... On reason for abandon the "menu-prgms" is they consume many bytes. Indeed, you'll save about 26000 bytes (but you'll don't save your own memory, because of the effort remembering all the names). For those who prefer call directly funcs and prgms, a little description of all routines is given below in this text. ************************************************************** WHAT I PROPOSE, AND WHAT I WANT ************************************************************** All the programs in this package are free of charge and you can use them whenever you want, but for your own use. So noboby is allowed to make commercial use of theses programs. I want to be the only person in charge of updating the package. That's what I don't want this package to be posted in another place (web site, ftp site) without my permission. I'd like the different parts of the package not to be separated (so the necessary updates will be easier). The right place for this package is the official TI page for TI-92. Precisely, the location of the package is: ftp.ti.com/pub/graph-ti/calc-apps/92/ The prgms and funcs presented here were heavily tested. So please don't modify them (I don't want to be responsible for mistakes due to unthinking modifications). I said there is no charge for all these programs. That's not true! what I wait from all users of this work (6 months of hard work) is to make efforts to create themselves new math programs or funcs, and to e-mail me their works. The best ones will be joined to the package, with the name of their authors. So I hope this package will grow regularly! All comments and progs will be mailed to my address: Since I'm very busy, don't wait for a quick answer, above all if you ask for something very easy to answer (with some thought). Now this is a short description of all the prgms and funcs of the package. ************************************************************** MAIN FOLDER ************************************************************** getp(messages,labels) this program is strategic. It's part is to build a box for getting parameters of others programs or functions. Here "labels" is a string or a list of strings. with n strings, the box will have n input lines, each labeled with the corresponding string. "messages" is a string or a list of strings. Each message is displayed before the corresponding input line (an empty string implies no message). If the user quits the box with ESC, the string "" is stored in the variable thetatheta (please imagine the theta character, repeated twice). If the user quits normally, the differents inputs are saved (as expressions) in variables theta1,theta2,.... A string containing all inputs (separated by commas, the whole string being enclosed between parenthesis) is stored in thetatheta. For example, if we want to call the program named foo, with the parameters a (vector) and b (integers), then we can make the following statements: * store the list {"Give a vector","Give an integer"} in thetaM, * store the list {"a","x"} in thetaA, * call getp(thetaM,thetaA). The box is then opened. Imagine the user inputs [1,5,3] and 7. After the user validates the box, * variable theta1 contains [1,5,3] * variable theta2 contains 7 * variable thetatheta contains "([1,5,3],7)". So we can call the program foo evaluating expr("foo"&thetatheta). At first sigth, this system seems complicated. But when you have almost 300 prgms and funcs (like in the following folders), it is a very good idea because it saves many bytes. Indeed, this system allows to call the funcs directly (knowing their names and their arguments) or call them trough an input box (with is more friendly). Writing a box input for every func would consume many bytes (and those funcs would be transformed in prgms). The arit() program in arit folder, the poly() program in poly folder,etc., make a heavy use of this system. The user chooses (in a menu) the function "foo" to be used. In a central loop the program calls getp() to build the input box, and gets back the results in vars thetatheta, theta1,theta2,... The function call is then achieved. One thing to be noticed: the main program in each folder (wich have the same name as the folder itself) replaces the content of the variable thetatheta (as returned by getp) by the result of the function call. A consequence is: in each box builded by getp, one can recall thetatheta (as the previous result) or theta1,theta2,... (as previous arguments). I don't konw if all that stuff is clear or/and convincing. The best is to try the programs or inspect them. setup() This program is designed to give some "home feeling" in a program. Indeed it gives to the user (without exiting the main program) the opportunity to make interactive inputs, like in the Home environment. An empty input (just ENTER) takes back to the main program. run() This program allows dispatching between all the folders of the system. It displays a toolbar with F1,F2,F3,F4,F5 entries. F1 gives choice between arithmetic, polynomials, etc... For example, if we choose polynomials, the program run() makes poly to be the current folder, and calls the program poly(), which allows a more precise choice in the poly folder. If you choose Exit in the program poly(), you return to the toolbar displayed by the program run(). F4 calls the program setup() F5 exits the program run() ************************************************************** ARIT FOLDER ************************************************************** This folder deals with arithmetic. The main program is named arit(). Some of the funcs present here concern "permutations". A permutation is a bijection from En={1,2,...,n} to himself. For example s defined by s(1)=4,s(2)=1,s(3)=2,s(4)=3 is a permutation of E4={1,2,3,4}: this permutation will here be represented by the list {4,1,2,3}. abcxy(a:int,b:int,c:int) gives {x,y} where integers x,y verify ax+by=c arit() program giving access to all funcs and prgms of the arit folder chnx(n:int) rewrite cosh(n*x) in terms of power of cosh(x) compperm(s:list,t:list) computes the composition s(t) where s and t are permutations cosnx(n:int) rewrite cos(n*x) in terms of power of cos(x) cyclotom(n:int) computes the n-th cyclotomic polynomial cytoperm(list) from a list as returned by permtocy, gives the permutation knowing its decomposition into a product of cycles. euler(n:int) gives Phi(n), where Phi is the Euler indicator extgcd(a:int,b:int) gives {u,v,gcd(a,b)}, such that a*u+b*v=gcd(a,b) fromfrac(list) from a list as returned by tofrac(x,n), gives an approximation of a real x fromitoj(expr) converts a complex expression (using j=exp(2i*pi/3)) into a+b*j hlinear(expr) linearize expr, which must be polynomial in cosh(x), sinh(x), exp(x). invperm(list) gives the pairs inversed by a permutation lcchnx from a list {a(n),...,a(O)} representing a(n)cosh(nx)+...+a(1)cosh(x)+a(0), gives the equivalent expression using powers of cosh(x) lccosx(a:list) from a list {a(n),...,a(O)} representing a(n)cos(nx)+...+a(1)cos(x)+a(0), gives the equivalent expression using powers of cos(x) listprim(n:int) gives the list of prime factors of n mobius(n:int) gives Mu(n), where Mu is the Mobius function permpow1(s:list,n:integer) gives the permutation s^n permpow2(s:list,n:integer) gives the permutation s^n permtocy(s:list) expands s in its cycles. The result is a list, where consecutive cycles are separated by a 0. randperm(n:int) returns a random permutation of {1,....,n} reciperm(list) gives the reciprocal permutation roots(z:complex,n:int) returns the list of the nth-roots of z shake(list) randomly reorders the list (with n=dim(list) exchanges) shnx(n:int) rewrite sinh(n*x) in terms of power of sinh(x) or cosh(x) signat1(list) gives the signature of a permutation signat2(list) gives the signature of a permutation signat3(list) gives the signature of a permutation sinnx(n:int) rewrite sin(n*x) in terms of power of sin(x) or cos(x) testperm(list) tests (answer true or false) if the list represents a valid permutation tofrac(x:real,n:int) gives the list of continued fraction representing x, up to order n. triguti1: subroutine used in arit folder triguti2: subroutine used in arit folder ************************************************************** CALCULUS FOLDER ************************************************************** This folder deals with calculus. The main program is named calculus(). calculus() program giving access to all funcs and prgms of the calculus folder convol(x:list,y:list) computes the convolution of the two lists x and y lists x and y must be 2^n long dft(x:list,+1 or -1) gives the fourier transform of the x[i]s (direct if +1, indirect if -1) diffeq() interactive and numeric resolution of y'=f(x,y), using RK4 diffrel(f(x),g(x)) gives a linear differential equation a(x)y"+b(x)y'+c(x)y, satisfied both by f(x) and g(x) extrem(f:expr,x:name,a:real,b:real) gives roots of f'(x) that belong to ]a,b[ The result is {} or a matrix with 3 columns Each result lies in a row, like [x,f(x),f"(x)] fft(x:list,+1 or -1) gives the fast fourier transform of the x[i]s (direct if +1, indirect if -1). List x must be 2^n long fft2(x:list,+1 or -1) gives the fast fourier transform of the x[i]s (direct if +1, indirect if -1). List x must be 2^n long fixpts(f:expr,x:name,a:real,b:real) gives the list of roots of f(x)=x that belong to ]a,b[ fourier(f:expr in var x,a:real,b:real,n:integer) returns the n-th term of the fourier series of f the period is choosen to be equal to T=b-a gensol1({a(x),b(x),c(x)}) gives the general solution of a(x)y'+b(x)y=c(x) gensol2({a:real,b:real,c:real},d(x)) gives a basis of solutions of ay"+by'+cy=d(x) gensolh2({a:real,b:real,c:real}) gives a basis of solutions of ay"+by'+cy=0 inflect(f:expr,x:name,a:real,b:real) gives roots of f"(x) that belong to ]a,b[ The result is {} or a matrix with 3 columns Each result lies in a row, like [x,f(x),f'(x)] interpol(x:list,y:list,x0:real or name) Computes the value in x0 of the interpolation polynomial for the points (x[i],y[i]) interrat(x:list,y:list) Computes a rational interpolation for the points x[i],y[i] jacobm(f:column of exprs,x:row of names) gives the jacobian matrix of f1,f2,..., with respect to x1,x2,.. method2({a(x),b(x),c(x)},d(x),f(x)} f(x) is supposed to be a solution of a(x)y"+b(x)y'+c(x)y=0 the method2 computes the general solution of a(x)y"+b(x)y'+c(x)y=d(x) newton(f:expr,x:name,x0:complex) Uses newton method to approach a zero of f(x), using the guess x0 (PRGM) parsol1({a(x),b(x),c(x)},x0,y0) gives the particular solution of a(x)y'+b(x)y=c(x) that verifies f(x0)=y0 ppcossol({a,b,c},d:list,m:real) returns a particular solution of ay"+by'+cy=P(x)cos(m*x) d is the list of the coefficients of P (using decreasing degrees) ppexsol({a,b,c},d:list,m:scalar) returns a particular solution of ay"+by'+cy=P(x)exp(m*x) d is the list of the coefficients of P (using decreasing degrees) ppsinsol({a,b,c},d:list,m:real) returns a particular solution of ay"+by'+cy=P(x)sin(m*x) d is the list of the coefficients of P (using decreasing degrees) roots(f:expr,x:name,a:real,b:real) gives the lists of roots of f(x) that belong to ]a,b[ sfourier(f:expr in var x,a:real,b:real,n:integer) returns up to the n-th term of the fourier series of f the period is choosen to be equal to T=b-a system(s=column of exprs in {x,y,z},a:row of complex guesses) Uses Newton method to approach a solution of the system in x,y(,z) tangent(f:expr,x:name,x0:real) gives ax+b, where y=ax+b is the tangent to y=f(x), at x=x0 unconvol(z:list,y:list) computes the list x such that the convolution of x and y should give z. lists x and y must be 2^n long varconst({f(x),g(x)},d(x)} if {f,g} is a basis of solutions of ay"+by'+cy=0 (as returned by gensolh2), varconts gives here a function y(x) such that ay"(x)+by'(x)+cy(x)=d(x). ************************************************************** DIFGEO FOLDER ************************************************************** This folder deals with differential geometry. The main program is named difgeo(). In the names below mean the character theta from TI92 keyboard arearo() this prgm computes the area inside an arc ro=ro(theta) areaxyt() this prgm computes the area inside an arc x=x(t),y=y(t) curvfx() this prgm computes the curvature of an arc y=f(x) curvro() this prgm computes the curvature of an arc ro=ro(theta) curvxy() this prgm computes the curvature of an arc x=x(t),y=y(t) curvxyz() this prgm computes the curvature of an arc x=x(t),y=y(t),z=z(t) difgeo() program giving access to all funcs and progs of the difgeo folder divcurl() this prgm computes the divergence and the curl of a vector field envelop() program computing the envolp of a family of straigth lines gradlap() this prgm computes the gradient or the laplacean of a scalar field implicit() this prgm graphs interactively an implicit curve f(x,y)=0 intcurv(n=2 or 3) computes a curvilign integral, in dim 2 or 3 rectfx() this prgm computes the length of an arc y=f(x) rectroz() this prgm computes the length of an arc ro=ro(theta), z=z(theta) restro() this prgm computes the length of an arc ro=ro(theta) rectxyt() this prgm computes the length of an arc x=x(t), y=y(t) uticrb subroutine used by curvature programs ************************************************************** FINSER FOLDER ************************************************************** This folder deals with finite series. The main program is named finser(). For example, ln(1+x)=x-x^2/2+x^3/3-x^4/4+o(x^4) is a finite serie: here it is represented by {0,1,-1/2,1/3,-1/4}. All finite series are represented in this manner (for input and output), and they are considered to be valid near x=0. The Taylor instruction is nice for computing finie series, but often too slow (when the function is not very simple). So finser folder is useful. apowfs(a,fs:list) computes a^fs arccosfs(fs:list) computes arccos(fs) arcsinfs(fs:list) computes arcsin(fs) arctanfs(fs:list) computes arctan(fs) argshfs(fs:list) computes argsinh(fs) argthfs(fs:list) computes argtanh(fs) chfs(fs:list) computes cosh(fs) compfs(fs1:list,fs2:list) computes fs1(fs2) cosfs(fs:list) computes cos(fs) derivfs(fs:list) computes the derivative of fs dimfs(fs:list) computes valuation and order of fs divfs(fs1:list,fs2:list) computes fs1/fs2 expfs(fs:list) computes exp(fs) finser() program giving access to all funcs and progs of the finser folder fsapowx(a:scalar,n:int) computes the fs of a^x, at x=0, up to order n if n<0, gives the fs of a^(-x),up to order -n fsarccos(n:int) computes the fs of arccos(x), at x=0, up to order n fsarctan(n:int) computes the fs of arctan(x), at x=0, up to order n fsargsh(n:int) computes the fs of argsinh(x), at x=0, up to order n fsargth(n:int) computes the fs of argtanh(x), at x=0, up to order n fsch(n:int) computes the fs of cosh(x), at x=0, up to order n fscos(n:int) computes the fs of cos(x), at x=0, up to order n fsexp(n:int) computes the fs of exp(x), at x=0, up to order n if n<0, gives the fs of exp(-x),up to order -n fsinv(n:int) computes the fs of 1/(1+x), at x=0, up to order n if n<0, gives the fs of 1/(1-x),up to order -n fsln(n:int) computes the fs of ln(1+x), at x=0, up to order n if n<0, gives the fs of ln(1-x),up to order -n fspow(a,n:int) computes the fs of (1+x)^a, at x=0, up to order n if n<0, gives the fs of (1-x)^a,up to order -n fssh(n:int) computes the fs of sinh(x), at x=0, up to order n fssin(n:int) computes the fs of sin(x), at x=0, up to order n fstan(n:int) computes the fs of tan(x), at x=0, up to order n fsth(n:int) computes the fs of tanh(x), at x=0, up to order n intpowfs(fs:list,n:int) computes fs^n invfs(fs:list) computes 1/fs lnfs(fs:list) computes ln(fs) mulfs(fs1:list,fs2:list) computes fs1*fs2 powfs(fs:list,a:real) computes fs^a primfs(fs:list) computes a primitive of fs shfs(fs:list) computes sinh(fs) sinfs(fs:list) computes sin(fs) sumfs(fs1:list,fs2:list) computes fs1+fs2 tanfs(fs:list) computes tan(fs) thfs(fs:list) computes tanh(fs) visufs(fs:list) gives an algebraic view of fs xtoax(fs:list,a) replaces fs(x) by fs(a*x) xtoxn(fs:list,n) replaces fs(x) by fs(x^n) ************************************************************** GEOMETRY FOLDER ************************************************************** This folder deals with geometry. The main program is named geometry(). some of the func or prgms present here concern affine mappings. An affine mapping in 2D or 3D space may be represented by a system giving coordinates of MM=f(M) from coordinates of M. This system looks like: xx=ax+by+cz+d, yy=a'x+b'y+c'z+d', zz=a"x+b"y+c"z+d" (in 3D). In this folder, such an affine mapping will be represented by the matrix [[a,b,c,d][a',b',c',d'][a",b",c",d"]]. So affine mappings will be represented, for input or output, by 2x3 matrices (in dim 2) or 3x4 matrices (in dim 3). angl(u,v) here u,v are 2D-vectors or 3D-vectors ([a,b] or [a,b,c]) angl(u,v) computes the angle between u and v, or between the lines or the planes defined by u and v. This angle lies in [0,Pi/2] bisectr(a,u,v) here a,u,v are 2D-vectors this function gives the equation of the angle bisector of [a,u[ and [b,v[ compaff(f:matr,g:matr) gives the composition f(g) eqline(a:vect,b:vect) gives the equation of the straight line defined by a and b the point [x,y] is represented by [x,y,1] the vector [u,v] is represented by [u,v,0] eqplane(m:vect,n:vect,p:vect) gives the equation of the plane defined by m,n,p the point [x,y,z] is represented by [x,y,z,1] the vector [u,v,w] is represented by [u,v,w,0] fixaff(f:matr) gives the affine subspace of points M such that f(M)=M geometry() program giving access to all funcs and progs of the geometry folder idaff(f:matr) this program tries to identify the affine mapping f imageaff(f:matr,m:vect) computes the image f(m) of the point m by the affine mapping f invaff(f:matr) gives the reciprocal of the affine mapping f matrot2(a:vect,j:vect,t:real) gives the rotation around the axis defined by the point a=[x,y] oriented by the vector j=[u,v,w], using angle t matrot3(a:vect,t:real) gives the rotation around the point a=[x,y], using angle t newrep(f:matr,a:vect,p:matr) gives the new representation of the affine mapping f, using the new repair defined by the new origin a and the basechange matrix p perpbis(a:vect,b:vect) gives the equation of the perpendicular bisector of AB perpend(m:vect,expr) gives the equation of the line which is perpendicular to the line defined by its equation expr=0 (ux+vy+w=0) and which comes trough the point m[a,b]. projh(h:vect,p:vect) gives the projection on the hyperplane ax+by(+cz)+d=0 given by h=[a,b(c,),d], along the direction defined by the vector p=[u,v(,w)] projl(M:vect,j:vect,h:vect) gives the projection on the line defined by the point M[x,y(,z)] and the vector j=[a,b(,c)], along the direction defined by the vector h=[u,v(,w)] projoh(h:vect) gives the orthogonal projection on the hyperplane ax+by(+cz)+d=0 given by h=[a,b(c,),d] projol(M:vect,j:vect,h:vect) gives the orthogonal projection on the line defined by the point M[x,y(,z)] and the vector j=[a,b(,c)] projopl(m:vect,expr) gives the orthogonal projection of the point m=[a,b] on the line defined by its equation expr=0 (ux+vy+w=0) symh(h:vect,p:vect) gives the symmetrical over the hyperplane ax+by(+cz)+d=0 given by h=[a,b(c,),d], along the direction defined by the vector p=[u,v(,w)] syml(M:vect,j:vect,h:vect) gives the symmetry over the line defined by the point M[x,y(,z)] and the vector j=[a,b(,c)], along the direction defined by the vector h=[u,v(,w)] symoh(h:vect) gives the orthogonal symmetry over the hyperplane ax+by(+cz)+d=0 given by h=[a,b(c,),d] symol(M:vect,j:vect,h:vect) gives the orthogonal projection on the line defined by the point M[x,y(,z)] and the vector j=[a,b(,c)] symopl(m:vect,expr) gives the orthogonal symmetrical of the point m=[a,b] wiht respect to the line defined by its equation expr=0 (ux+vy+w=0) systaff(f:matr) gives an algebraic view of the affine mapping f translat(u:vect) gives the affine translation defined by the vector u=[a,b(,c)] ************************************************************** MATRICES FOLDER ************************************************************** This folder deals with matrices. The main program is named matrices(). addid(m:matr) augments m with the identity matrix bandmat(n:int,v:list) gives a band matrix of order n, using the coefficients in list v basiseig(m:matr,c:scalar) gives a basis for the eigensubspace corresponding to eigenvalue c charpol(m:matr) gives the characteristic polynomial of m charpol2(m:matr) gives the characteristic polynomial of m circmat(v:list) gives a circulant matrix, using the coefficient in list v circmat2(v:list) gives a circulant matrix, using the coefficient in list v cofact(m:matr,i:int,j:int) computes the cofactor of the matrix m, corresponding to position [i,j] coldel(m:matr,n:int) deletes the n-th column of m coldel2(m:matr,n:int) deletes the n-th column of m colget(m:matr,n:int) gives the n-th column of m colins(m:matr,c:column,n:int) inserts the column c in position n in matrix m colins2(m:matr,c:column,n:int) inserts the column c in position n in matrix m colput(m:matr,c:column,n:int) replaces by c the n-th column of m colput2(m:matr,c:column,n:int) replaces by c the n-th column of m colput3(m:matr,c:column,n:int) replaces by c the n-th column of m colswap(m:matr,a:int,b:int) swaps two columns of m comatr(m:matr) gives the comatrix of m diago(m:matr) tries to diagonalize the matrix m eigenval(m:matr) gives the eigenvalues of m (each repeated according to its multiplicity) eigenvec(m:matr,c:scalar) gives equations for the eigensubspace corresponding to eigenvalue c gauss(m:matr) gauss method for the matrix m hilbert(n:int,f:expr) gives a hilbert matrix of order n, using the expression f jordan(n:int,a:expr) gives a jordan matrix of order n, using the coefficient a kernel(m:matr) gives a basis of the kernel of m makematr(n:int,p:int,f) creates the matrix (n rows, p columns) with the (i,j)-th coefficient equal to f (f is normally an expression using i and j). matrices() program giving access to all funcs and progs of the matrices folder minor(m:matr,i:int,j:int) computes the minor of the matrix m, corresponding to position [i,j] minpol(m:matr) gives the minimal polynomial of m putmat(m:matr,n:matr,i:int,j:int) puts the matrix n into matrix m, starting at position [i,j] randasym(n:int) computes a random antisymmetric matrix of order n randdiag(n:int) computes a random diagonal matrix of order n randsym(n:int) computes a random symmetric matrix of order n randtrig(n:int) computes a random trigonal matrix of order n rank(m:matr) gives the rank of m rowdel(m:matr,n:int) deletes the n-th row of m rowdel2(m:matr,n:int) deletes the n-th row of m rowins(m:matr,r:row,n:int) inserts the row r in position n in matrix m rowins2(m:matr,r:row,n:int) inserts the row r in position n in matrix m rowops(m:matr) operations on the rows of m rowput(m:matr,r:row,n:int) replaces by r the n-th row of m rowput2(m:matr,r:row,n:int) replaces by r the n-th row of m rowput3(m:matr,r:row,n:int) replaces by r the n-th row of m stack(m:matr,n:matr) gives a new matrix, n under m stochmat(n:int) computes a random stochastic matrix of order n subspace(m:matr) gives equations for the subspace generated by the columns of m syst(m:matr,v:column or row) symbolically solves the linear system MX=V systh(m:matr) symbolically solves the linear system MX=0 toeplitz(v:list) gives a toeplitz matrix, using the coefficient in list v tracemat(m:matr) gives the trace of m tridiag(x:list,y:list,z:list) computes a tridiagonal matrix M, using x for coeffs M[i+1,i], y for coefs M[i,i] and z for coefs M[i,i+1) utilsyst this subroutine is used by function syst vandm(v:list) gives a vandermonde matrix, using coeffs in list v vectrel(m:matr) gives linear relations between rows of m visit(m:matr) a matrix editor (useful when called from another program) ************************************************************** POLY FOLDER ************************************************************** This folder deals with polynomials. The main program is named poly(). Here polynomials P=a(n)x^n+a(n-1)x^(n-1)+...+a(1)x+a(0) are often represented by the list {a(n),a(n-1),...,a(1),a(0)} of its coeffs, using decreasing degrees. coeffs(z:list) computes the polynomial whose zeros are z[1],z[2],...,z[n] divip(a:expr,b:expr,v:name,n:int) gives the division a=bq+r, with increasing degrees, at order n the result is {q,r}, where a(x)=b(x)q(x)+x^(n+1)*r(x) and deg(q)<=n a and b are supposed to be polynomial in variable v divipprg(a:list,b:list,n:int) this program gives progressivly the division (with increasing degrees) of a and b (a=bq+x^(n+1)r, and deg(q)<=n) here lists a and b use increasing degrees to represent polynoms foncsym(a:list) gives the list of elementary symetrical functions of a[1],...,a[n] isquasi0 tests if absolute value of x is less than E-11 iszero(x:expr) tests if expr is zero or not (answers true or false. false if unknown) mzeros(p:expr,v:name) gives the list of the zeros of p (supposed to be polynomial in v) each zero is eventually repeated, according to its multiplicity polabcuv(a:list,b:list,c:list) solves the equation a*u+b*v=c, with minimum degrees poladd(p:list,q:list) adds two polynomials polcomp(p:list,q:list) composes two polynomials (the result represents p(q)) polderiv(p:list) computes the derivative of p poldivf(a:list,b:list) gives the euclidean division a=bq+r the result is a list {"q","r"} poldivip(a:list,b:list,n:int) gives the division a=bq+r, with increasing degrees, at order n the result is a list {"q","r"}, where a=bq+x^(n+1)*r and deg(q)<=n here lists a and b use increasing degrees to represent polynoms poldivp(a:list,b:list) this program gives progressivly the euclidean division a=bq+r polexgcd(p:expr,q:expr) gives the extended gcd of two polynomials the result is {u,v,gcd(a,b)}, such that a*u+b*v=gcd(a,b) polgcd(p:list,q:list) gives the gcd of two polynomials polgcd2(p:expr,q:expr) gives the gcd of two polynomials (algebraic version) polint(p:list,a:expr,b:expr) computes the integral of p, from a to b pollagr(x:list,y:list) computes the Lagrange polynomial wich interpolates the points (x[1],y[1]),....,(x[n],y[n]) pollcm(p:list,q:list) gives the lcm of two polynomials pollcm2(p:expr,q:expr) gives the lcm of two polynomials (algebraic version) polmul(p:list,q:list) multiplies two polynomials polpower(p:list,n:int) computes the polynomial p^n polprim(p:list) computes a primitive of p polquo(a:expr,b:expr) gives the quotient of the two polynomials a and b (written as expressions) polreduc(p:list) reduces the list p (representing a polynom) by deleting left coeffs that are zero or quasi-zero. polrem(a:expr,b:expr) gives the remainder r in the division a=bq+r (algebraic version) poltcheb(n:int) computes the n-th polynomial of tchebichev (T[n] if n>0, U[-n] if n<0) poltoseq(p:expr,v:name) transforms the expression p (supposed to be polynomial in variable v) into the list of its coefficients (decreasing degrees) poltran2(p:list,a:expr) gives the polynomial q such that q(x)=p(x+a) poltrans(p:list,a:expr) gives the polynomial q such that q(x)=p(x+a) poly() program giving access to all funcs and progs of the poly folder ************************************************************** RANDVARS FOLDER ************************************************************** This folder deals with random variables. The main program is named randvars(). bino(n) gives the list of binomial coefficients nCr(n,k), from k=0 to k=n bnp(n:int,p:real,k:int) gives p(X=k) where X conforms to binomial distribution B(n,p) dexp(t:real,x:real) gives the density at x, where X conforms to exponential distribution E(t) dkhi2(m:int,x:real) gives density at x, where X conforms to Khi-2 distribution with n degrees of freedom dlognorm(m:real,s:real,x:real) gives density at x, where X conforms to log-normal distribution LN(m,s) (i.e. ln(X) conforms to N(m,s)) dnorm(m:real,s:real,x:real) gives the density at x, where X conforms to normal distribution N(m,s) (m is the mean, and s is the standard deviation) dnorm01(x:real) gives density at x, where X conforms to standard normal distribution N(0,1) fbnp(n:int,p:real,k:int) gives p(X<=k) where X conforms to binomial distribution B(n,p) fexp(t:real,x:real) gives p(X<=x) where X conforms to exponential distribution E(t) fgeo(p:real,k:int) gives p(X<=k) where X conforms to geometric distribution G(p) fhyp(n:int,a:int,p:real,k:int) gives p(X<=k) where X conforms to hypergeometric distribution H(n,a,p) fjrp(r:int,p:real,k:int) gives p(X<=k) where X conforms to negative binomial distribution J(r,p) fkhi2(n:int,x:real) gives p(X<=x), where X conforms to Khi-2 distribution with n degrees of freedom flognorm(m:real,s:real,x:real) gives p(X<=x), where X conforms to log-normal distribution LN(m,s) (i.e. ln(X) conforms to N(m,s)) fnorm(m:real,s:real,x:real) gives p(X<=x), where X conforms to normal distribution N(m,s) (m is the mean, and s is the standard deviation) fnorm01(x:real) gives p(X<=x), where X conforms to standard normal distribution N(0,1) fpois(t:real,k:int) gives p(X<=k) where X conforms to Poisson distribution P(t) fprp(r:int,p:real,k:int) gives p(X<=k) where X conforms to Pascal distribution P(r,p) geo(p:real,k:int) gives p(X=k) where X conforms to geometric distribution G(p) hyp(n:int,a:int,p:real,k:int) gives p(X=k) where X conforms to hypergeometric distribution H(n,a,p) inorm(m:real,s:real,q:real) gives x such that p(X<=x)=q, where X conforms to normal distribution N(m,s) (m is the mean, and s is the standard deviation) inorm01(q:real) gives x such that p(X<=x)=q, where X conforms to standard normal N(0,1) jrp(r:int,p:real,k:int) gives p(X=k) where X conforms to negative binomial distribution J(r,p) pois(t:real,k:int) gives p(X=k) where X conforms to Poisson distribution P(t) randvars() program giving access to all funcs and progs of the randvars folder prp(r:int,p:real,k:int) gives p(X=k) where X conforms to Pascal distribution P(r,p) ************************************************************** SPECFUNC FOLDER ************************************************************** This folder deals with special functions. The main program is named specfunc(). besseli(n:int,x:real) Bessel function In (n>=0,x>0) besseli0(x:real) Bessel function I0 (x>0) besseli1(x:real) Bessel function I0 (x>0) besselj(n:int,x:real) Bessel function Jn (n>=0,x>0) besselj0(x:real) Bessel function J0 (x>0) besselj1(x:real) Bessel function J1 (x>0) besselk(n:int,x:real) Bessel function Kn (n>=0,x>0) besselk0(x:real) Bessel function K0 (x>0) besselk1(x:real) Bessel function K1 (x>0) bessely(x:real) Bessel function Yn (x>0) bessely0(x:real) Bessel function Y0 (x>0) bessely1(x:real) Bessel function Y1 (x>0) beta(z:complex,w:complex) beta function (re(z)>0, re(w)>0) ci(x:real) Integral cosinus (x>0) cnp(n:complex,p:complex) computes n!/p!/(n-p)! dawson(x:real) dawson function ei(x:real) integral exponential EI(x), x>0 erf(x:real) error function erfc(x:real) 1-erf(x) fact(z:complex) factorial function at z (re(z)>-1) fresnelc(x:real) fresnel integral C(x) fresnels(x:real) fresnel integral S(x) fresnelz subroutine used by fresnels and fresnelc gamma(z:complex) gamma function at z (z complex, but not a negative integer) incbeta(a:real,x:real,y:real) incomplete beta (0<=a<=1, x>0,y>0) incgamma(a:real,x:real) incomplete gamme (a>0, x>0) lngamma(z:complex) log-gamma function at z (re(z)>0) pnp(n:complex,p:complex) computes n!/(n-p)! psi(z:complex) psi function at z (re(z)>0) si(x:real) Integral sinus (x>0) specfunc() program giving access to all funcs and progs of the specfunc folder utilsci subroutine used by Ci and Si