Subversion Repositories wimsdev

Rev

Rev 6097 | 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)))}
<pre>
<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)))}</span>
</pre>
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="reload" width="20" height="20"/>}
)

The Pari command <span class="tt wims_code_words">random </span> de Pari/GP is incompatible with WIMS' one ;
so write <span class="tt wims_code_words"> random&#92;(125) </span> in Pari/GP. In this cases, <span class="tt wims_code_words">random</span> 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 :
\(A= [\A])
<p class="tt wims_code_words">\\def{text A=pari(print(matrix(4,5,i,j,random&#92;(257))))} </p>