Subversion Repositories wimsdev

Rev

Rev 4384 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<h4> PARI/GP </h4>It is possible to use a program in Pari: for that, put it between parenthesis: for example, the lines
\def{text a=random(0,1)}
\def{integer b=randint(10..100)}
\def{text N=pari((f(n)=local(m) ; m=if(n==0, n, factor(\b)));print(f(\a)))}
<p><tt> 
<br>\\def{text a=random(0,1)}
<br>\\def{integer b=randint(10..100)}
<br>\\def{text N=pari((f(n)=local(m) ; m=if(n==0, n, factor(\\b)));print(f(\\a)))}</tt>
</p>
Example: output  the factorisation of  \b if some random number  a=\a equals 0 et 0 otherwise : 
N=\N (try \reload{<img src="gifs/doc/etoile.gif" alt="rechargez" width="20" height="20">} 
)

The Pari command <tt>random </tt> de Pari/GP is  incompatible with WIMS' one ; so write <tt> random&#92;(125) </tt> in Pari/GP. In this cases,<tt> random </tt> is sent to Pari/GP with no interpretation but "\\" is taken away.

\def{text A=pari(print(matrix(4,5,i,j,random\(257))))}
 Example : define a matrix of size 4,5 with random coefficients between  0 and 256 : 
<center> \(A= [\A])</center>

 
<p><tt> \\def{text A=pari(print(matrix(4,5,i,j,random&#92;(257))))} </tt>
</p>