Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418346<?xml version="1.0" encoding="UTF-8"?>12<!--<Chapter Label="examples">3<Heading>4Examples of use of the <Package>IntPic</Package> package5</Heading>6<Index>7<Package>IntPic</Package> - Examples8</Index>-->9<Section>10<Heading>Other examples of use of the <Package>IntPic</Package> package</Heading>1112<Subsection>13<Heading>Varia</Heading>1415The 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.16<Example><![CDATA[17gap> rg := Filtered([801..889],u->(u mod 2)<>0);;18gap> flen := 15;;19gap> twins := Filtered(Primes, p -> p + 2 in Primes);;20gap> arr := [Primes,Union(twins,twins+2),Filtered(rg,u->(u mod 3)=0)];;21gap> tkz := IP_TikzArrayOfIntegers(rg,flen,rec(highlights:=arr));;22]]></Example>23The 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.24<Alt Only="LaTeX">25\begin{center}26\includegraphics[width=0.95\textwidth]{../images/primesandtwinsamongodd}27\end{center}28</Alt>29<Alt Only="HTML">30<br><center><img src="../images/primesandtwinsamongodd.jpg"></center><br>31</Alt>32The same computations, but defining other color lists.33<Example><![CDATA[34gap> cls := IP_ColorsCompRedTones;;35gap> rg := Filtered([801..889],u->(u mod 2)<>0);;36gap> flen := 15;;37gap> twins := Filtered(Primes, p -> p + 2 in Primes);;38gap> arr := [Primes,Union(twins,twins+2),Filtered(rg,u->(u mod 3)=0)];;39gap> tkz := IP_TikzArrayOfIntegers(rg,flen,rec(colors := cls,highlights:=arr));;40]]></Example>41<Alt Only="LaTeX">42\begin{center}43\includegraphics[width=0.95\textwidth]{../images/primesandtwinsamongodd_comp_red}44\end{center}45</Alt>46<Alt Only="HTML">47<br><center><img src="../images/primesandtwinsamongodd_comp_red.jpg"></center><br>48</Alt>49<Example><![CDATA[50gap> cls := IP_ColorsDGrayTones;;51gap> rg := Filtered([801..889],u->(u mod 2)<>0);;52gap> flen := 15;;53gap> twins := Filtered(Primes, p -> p + 2 in Primes);;54gap> arr := [Primes,Union(twins,twins+2),Filtered(rg,u->(u mod 3)=0)];;55gap> tkz := IP_TikzArrayOfIntegers(rg,flen,rec(colors := cls,highlights:=arr));;56]]></Example>57<Alt Only="LaTeX">58\begin{center}59\includegraphics[width=0.95\textwidth]{../images/primesandtwinsamongodd_dark_gray}60\end{center}61</Alt>62<Alt Only="HTML">63<br><center><img src="../images/primesandtwinsamongodd_dark_gray.jpg"></center><br>64</Alt>65<Example><![CDATA[66gap> cls := ["blue","-blue","black"];;67gap> rg := Filtered([801..889],u->(u mod 2)<>0);;68gap> flen := 15;;69gap> twins := Filtered(Primes, p -> p + 2 in Primes);;70gap> arr := [Primes,Union(twins,twins+2),Filtered(rg,u->(u mod 3)=0)];;71gap> tkz := IP_TikzArrayOfIntegers(rg,flen,rec( colors := cls,highlights:=arr));;72]]></Example>73<Alt Only="LaTeX">74\begin{center}75\includegraphics[width=0.95\textwidth]{../images/primesandtwinsamongodd_other}76\end{center}77</Alt>78<Alt Only="HTML">79<br><center><img src="../images/primesandtwinsamongodd_other.jpg"></center><br>80</Alt>81The following example uses the82<Alt Not='Text'>83<URL84Text='NumericalSgps'>http://www.fc.up.pt/cmup/mdelgado/numericalsgps</URL>85</Alt>86<Alt Only='Text'>87<Package>NumericalSgps</Package>88</Alt>89package.90<Example><![CDATA[9192gap> #LoadPackage("numericalsgps");93gap>94gap> ns := NumericalSemigroup(11,19,30,42,59);;95gap> cls := ShuffleIP_Colors([IP_ColorsGreenTones,IP_ColorsCompBlueTones]);;96gap> flen := 20;;97gap> #some notable elements98gap> arr := [SmallElementsOfNumericalSemigroup(ns),99> GapsOfNumericalSemigroup(ns),100> MinimalGeneratingSystemOfNumericalSemigroup(ns),101> FundamentalGapsOfNumericalSemigroup(ns),102> [ConductorOfNumericalSemigroup(ns)],103> PseudoFrobeniusOfNumericalSemigroup(ns)];;104gap>105gap> tkz := IP_TikzArrayOfIntegers(flen,rec(colors := cls,highlights:=arr));;106]]></Example>107<Alt Only="LaTeX">108\begin{center}109\includegraphics[width=0.95\textwidth]{../images/numericalsgp_notable}110\end{center}111</Alt>112<Alt Only="HTML">113<br><center><img src="../images/numericalsgp_notable.jpg"></center><br>114</Alt>115Using the default colors116<Alt Only="LaTeX">117\begin{center}118\includegraphics[width=0.95\textwidth]{../images/numericalsgp_notable_df_colors}119\end{center}120</Alt>121<Alt Only="HTML">122<br><center><img src="../images/numericalsgp_notable_df_colors.jpg"></center><br>123</Alt>124</Subsection>125<Subsection>126<Heading>The banner</Heading>127The 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...128<Example><![CDATA[129gap> row_length := 200;; # the legth of each row130gap> columns := 50;; # the number of colums131gap> n := row_length*columns;13210000133gap>134gap> ##compute the primes less than n135gap> # Primes is a GAP variable representing the list of primes less than 1000136gap> mp := Maximum(Primes);137997138gap> newprimes := [];;139gap> while mp < n do140> mp := NextPrimeInt(mp);141> Add(newprimes, mp);142> od;143gap> small_primes := Union(Primes, newprimes);;144gap> ##compute the first element of each pair of twin primes less than n145gap> twins := Filtered(small_primes, p -> IsPrime(p+2));;146gap>147gap> rg := [1..n];;148gap>149gap> arr := [Intersection(small_primes,rg),[],[],150> Intersection(Union(twins,twins+2),rg),[],[],[],[],[],[],[],151> [],[],[],[],[],[],Difference(rg,small_primes)];;152gap>153gap> tkz:=IP_TikzArrayOfIntegers([1..n],row_length,rec(highlights:=arr,154> cell_width := "6",colsep:="0",rowsep:="0",inner_sep:="2",155> shape_only:=" ",line_width:="0",line_color:="black!20" ));;156]]></Example>157<Alt Only="LaTeX">158\begin{center}159\includegraphics[width=0.99\textwidth]{../images/intpic_banner.pdf}160\end{center}161</Alt>162<Alt Only="HTML">163<br><center><img src="../images/intpic_banner.jpg"></center><br>164</Alt>165166</Subsection>167</Section>168<!--</Chapter>-->169170171172