<!--<Chapter Label="examples"> <Heading> Examples of use of the <Package>IntPic</Package> package </Heading> <Index> <Package>IntPic</Package> - Examples
</Index>-->
<Section>
<Heading>Other examples of use of the <Package>IntPic</Package> package</Heading>
<Subsection>
<Heading>Varia</Heading>
The following example shows how to produce <C>tikz</C> code for a picture containing the odd integers from <M>801</M> to <M>999</M>. Each line (except the highest) contains <M>15</M> cells.
<Example><![CDATA[
gap> rg := Filtered([801..889],u->(u mod 2)<>0);;
gap> flen := 15;;
gap> twins := Filtered(Primes, p -> p + 2 in Primes);;
gap> arr := [Primes,Union(twins,twins+2),Filtered(rg,u->(u mod 3)=0)];;
gap> tkz := IP_TikzArrayOfIntegers(rg,flen,rec(highlights:=arr));;
]]></Example>
The picture obtained highlights the primes, the twin primes and the multiples of <M>3</M>. As the twins are also primes, a gradient is used to highlight them. In this example the default list of colors is used.
<Alt Only="LaTeX">
\begin{center}
\includegraphics[width=0.95\textwidth]{../images/primesandtwinsamongodd}
\end{center}
</Alt>
<Alt Only="HTML">
<br><center><img src="../images/primesandtwinsamongodd.jpg"></center><br>
</Alt>
The same computations, but defining other color lists.
<Example><![CDATA[
gap> cls := IP_ColorsCompRedTones;;
gap> rg := Filtered([801..889],u->(u mod 2)<>0);;
gap> flen := 15;;
gap> twins := Filtered(Primes, p -> p + 2 in Primes);;
gap> arr := [Primes,Union(twins,twins+2),Filtered(rg,u->(u mod 3)=0)];;
gap> tkz := IP_TikzArrayOfIntegers(rg,flen,rec(colors := cls,highlights:=arr));;
]]></Example>
<Alt Only="LaTeX">
\begin{center}
\includegraphics[width=0.95\textwidth]{../images/primesandtwinsamongodd_comp_red}
\end{center}
</Alt>
<Alt Only="HTML">
<br><center><img src="../images/primesandtwinsamongodd_comp_red.jpg"></center><br>
</Alt>
<Example><![CDATA[
gap> cls := IP_ColorsDGrayTones;;
gap> rg := Filtered([801..889],u->(u mod 2)<>0);;
gap> flen := 15;;
gap> twins := Filtered(Primes, p -> p + 2 in Primes);;
gap> arr := [Primes,Union(twins,twins+2),Filtered(rg,u->(u mod 3)=0)];;
gap> tkz := IP_TikzArrayOfIntegers(rg,flen,rec(colors := cls,highlights:=arr));;
]]></Example>
<Alt Only="LaTeX">
\begin{center}
\includegraphics[width=0.95\textwidth]{../images/primesandtwinsamongodd_dark_gray}
\end{center}
</Alt>
<Alt Only="HTML">
<br><center><img src="../images/primesandtwinsamongodd_dark_gray.jpg"></center><br>
</Alt>
<Example><![CDATA[
gap> cls := ["blue","-blue","black"];;
gap> rg := Filtered([801..889],u->(u mod 2)<>0);;
gap> flen := 15;;
gap> twins := Filtered(Primes, p -> p + 2 in Primes);;
gap> arr := [Primes,Union(twins,twins+2),Filtered(rg,u->(u mod 3)=0)];;
gap> tkz := IP_TikzArrayOfIntegers(rg,flen,rec( colors := cls,highlights:=arr));;
]]></Example>
<Alt Only="LaTeX">
\begin{center}
\includegraphics[width=0.95\textwidth]{../images/primesandtwinsamongodd_other}
\end{center}
</Alt>
<Alt Only="HTML">
<br><center><img src="../images/primesandtwinsamongodd_other.jpg"></center><br>
</Alt>
The following example uses the
<Alt Not='Text'>
<URL
Text='NumericalSgps'>http://www.fc.up.pt/cmup/mdelgado/numericalsgps</URL>
</Alt>
<Alt Only='Text'>
<Package>NumericalSgps</Package>
</Alt>
package.
<Example><![CDATA[
gap> #LoadPackage("numericalsgps");
gap>
gap> ns := NumericalSemigroup(11,19,30,42,59);;
gap> cls := ShuffleIP_Colors([IP_ColorsGreenTones,IP_ColorsCompBlueTones]);;
gap> flen := 20;;
gap> #some notable elements
gap> arr := [SmallElementsOfNumericalSemigroup(ns),
> GapsOfNumericalSemigroup(ns),
> MinimalGeneratingSystemOfNumericalSemigroup(ns),
> FundamentalGapsOfNumericalSemigroup(ns),
> [ConductorOfNumericalSemigroup(ns)],
> PseudoFrobeniusOfNumericalSemigroup(ns)];;
gap>
gap> tkz := IP_TikzArrayOfIntegers(flen,rec(colors := cls,highlights:=arr));;
]]></Example>
<Alt Only="LaTeX">
\begin{center}
\includegraphics[width=0.95\textwidth]{../images/numericalsgp_notable}
\end{center}
</Alt>
<Alt Only="HTML">
<br><center><img src="../images/numericalsgp_notable.jpg"></center><br>
</Alt>
Using the default colors
<Alt Only="LaTeX">
\begin{center}
\includegraphics[width=0.95\textwidth]{../images/numericalsgp_notable_df_colors}
\end{center}
</Alt>
<Alt Only="HTML">
<br><center><img src="../images/numericalsgp_notable_df_colors.jpg"></center><br>
</Alt>
</Subsection>
<Subsection>
<Heading>The banner</Heading>
The code in the following example has been used to produce one possible banner for the homepage of the &IntPic; package. A nice picture to give an idea about the primes less than <M>10000</M>. Of course, other ranges could be chosen. I warn the user that pictures involving a large amount of data may face the problem of exceeding &TeX; capacity...
<Example><![CDATA[
gap> row_length := 200;; # the length of each row
gap> columns := 50;; # the number of columns
gap> n := row_length*columns;
10000
gap>
gap> ##compute the primes less than n
gap> # Primes is a GAP variable representing the list of primes less than 1000
gap> mp := Maximum(Primes);
997
gap> newprimes := [];;
gap> while mp < n do
> mp := NextPrimeInt(mp);
> Add(newprimes, mp);
> od;
gap> small_primes := Union(Primes, newprimes);;
gap> ##compute the first element of each pair of twin primes less than n
gap> twins := Filtered(small_primes, p -> IsPrime(p+2));;
gap>
gap> rg := [1..n];;
gap>
gap> arr := [Intersection(small_primes,rg),[],[],
> Intersection(Union(twins,twins+2),rg),[],[],[],[],[],[],[],
> [],[],[],[],[],[],Difference(rg,small_primes)];;
gap>
gap> tkz:=IP_TikzArrayOfIntegers([1..n],row_length,rec(highlights:=arr,
> cell_width := "6",colsep:="0",rowsep:="0",inner_sep:="2",
> shape_only:=true,line_width:="0",line_color:="black!20" ));;
]]></Example>
<Alt Only="LaTeX">
\begin{center}
\includegraphics[width=0.99\textwidth]{../images/intpic_banner.pdf}
\end{center}
</Alt>
<Alt Only="HTML">
<br><center><img src="../images/intpic_banner.jpg"></center><br>
</Alt>
</Subsection>
</Section> <!--</Chapter>-->
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.