text:
# Examples and counterexamples in mathematics/Real-valued functions of one real variable

## Polynomials

### Polynomial with infinitely many roots

The zero polynomial ${\displaystyle P(x)=0;}$ every number is a root of P. This is the only polynomial with infinitely many roots. A non-zero polynomial is of some degree n (n may be 0,1,2,...) and cannot have more than n roots since, by a well-known theorem of algebra, if ${\displaystyle P(a_{1})=\dots =P(a_{m})=0}$ (for pairwise different ${\displaystyle a_{1},\dots ,a_{m}}$), then necessarily ${\displaystyle P(x)=(x-a_{1})\dots (x-a_{m})Q(x)}$ for some non-zero polynomial Q of degree ${\displaystyle n-m\geq 0.}$

### Integer values versus integer coefficients

Every polynomial P with integer coefficients is integer-valued, that is, its value P(k) is an integer for every integer k; but the converse is true only for first degree polynomials (linear functions). For example, the polynomial ${\displaystyle \textstyle P_{2}(x)={\frac {1}{2}}x^{2}-{\frac {1}{2}}x={\frac {1}{2}}x(x-1)}$ takes on integer values whenever x is an integer. That is because one of x and x-1 must be an even number. The values ${\displaystyle \textstyle P_{2}(k)={\binom {k}{2}}}$ are the binomial coefficients.

More generally, for every n=0,1,2,3,... the polynomial ${\displaystyle \textstyle P_{n}(x)={\frac {1}{n!}}x(x-1)\dots (x-n+1)}$ is integer-valued; ${\displaystyle \textstyle P_{n}(k)={\binom {k}{n}}}$ are the binomial coefficients. In fact, every integer-valued polynomial is an integer linear combination of these Pn.

### Polynomial mimics cosine: interpolation

The cosine function, ${\displaystyle f(x)=\cos x,}$ satisfies ${\displaystyle f(0)=1,}$ ${\displaystyle f(\pi /6)={\sqrt {3}}/2,}$ ${\displaystyle f(\pi /4)={\sqrt {2}}/2,}$ ${\displaystyle f(\pi /3)=1/2,}$ ${\displaystyle f(\pi /2)=0;}$ also ${\displaystyle f(-x)=f(x)}$ and ${\displaystyle f(x+\pi )=-f(x)}$ for all x, which gives infinitely many x such that ${\displaystyle f(x)}$ is one of the numbers ${\displaystyle \pm 1,\pm {\sqrt {3}}/2,\pm {\sqrt {2}}/2,\pm 1/2,0;}$ that is, infinitely many points on the graph. A polynomial cannot satisfy all these conditions, because ${\displaystyle |P(x)|\to \infty }$ as ${\displaystyle x\to \pm \infty }$ for every non-constant polynomial P; can it satisfy a finite portion of them?

Let us try to find P that satisfies the five conditions ${\displaystyle P(0)=1,}$ ${\displaystyle P(\pi /6)={\sqrt {3}}/2,}$ ${\displaystyle P(\pi /4)={\sqrt {2}}/2,}$ ${\displaystyle P(\pi /3)=1/2,}$ ${\displaystyle P(\pi /2)=0.}$ For convenience we rescale x letting ${\displaystyle \textstyle P(x)=Q{\big (}{\frac {12}{\pi }}x{\big )}}$ and rewrite the five conditions in terms of Q: ${\displaystyle Q(0)=1,}$ ${\displaystyle Q(2)={\sqrt {3}}/2,}$ ${\displaystyle Q(3)={\sqrt {2}}/2,}$ ${\displaystyle Q(4)=1/2,}$ ${\displaystyle Q(6)=0.}$ In order to find such Q we use Lagrange polynomials.

Using the polynomial ${\displaystyle \ell (x)=x(x-2)(x-3)(x-4)(x-6)}$ of degree 5 with roots at the given points 0, 2, 3, 4, 6 and taking into account that ${\displaystyle \ell '(0)=(-2)\cdot (-3)\cdot (-4)\cdot (-6)=144}$ (check it by differentiating the product) we consider the so-called Lagrange basis polynomial ${\displaystyle \textstyle {\frac {\ell (x)}{\ell '(0)x}}={\frac {1}{144}}(x-2)(x-3)(x-4)(x-6)}$ of degree 4 with roots at 2, 3, 4, 6 (but not 0); the division in the left-hand side is interpreted algebraically as division of polynomials (that is, finding a polynomial whose product by the denominator is the numerator ${\displaystyle \ell (x)}$) rather than division of functions, thus, the quotient is defined for all x, including 0. Its value at 0 is 1. Think, why; see the picture; recall that ${\displaystyle \textstyle \ell '(0)=\lim _{x\to 0}{\frac {\ell (x)}{x}}}$.

Similarly, the second Lagrange basis polynomial ${\displaystyle \textstyle {\frac {\ell (x)}{\ell '(2)(x-2)}}=-{\frac {1}{16}}x(x-3)(x-4)(x-6)}$ takes the values 0, 1, 0, 0, 0 (at 0, 2, 3, 4, 6 respectively). The third one ${\displaystyle \textstyle {\frac {\ell (x)}{\ell '(3)(x-3)}}={\frac {1}{9}}x(x-2)(x-4)(x-6)}$ takes the values 0, 0, 1, 0, 0. And so on (calculate the fourth and fifth). It remains to combine these five Lagrange basis polynomials with the coefficients equal to the required values of Q:

{\displaystyle {\begin{aligned}Q(x)&=\textstyle Q(0){\frac {\ell (x)}{\ell '(0)x}}+Q(2){\frac {\ell (x)}{\ell '(2)(x-2)}}+Q(3){\frac {\ell (x)}{\ell '(3)(x-3)}}+Q(4){\frac {\ell (x)}{\ell '(4)(x-4)}}+Q(6){\frac {\ell (x)}{\ell '(6)(x-6)}}\\&=\textstyle {\frac {1}{144}}(x-2)(x-3)(x-4)(x-6)-{\frac {\sqrt {3}}{2}}\cdot {\frac {1}{16}}x(x-3)(x-4)(x-6)+\\&\qquad +\textstyle {\frac {\sqrt {2}}{2}}\cdot {\frac {1}{9}}x(x-2)(x-4)(x-6)-{\frac {1}{2}}\cdot {\frac {1}{16}}x(x-2)(x-3)(x-6).\end{aligned}}}

Finally, ${\displaystyle \textstyle \cos x\approx P(x)=Q{\big (}{\frac {12}{\pi }}x{\big )}.}$ As we see on the picture, the two functions are quite close for ${\displaystyle 0 in fact, the greatest ${\displaystyle |P(x)-\cos x|}$ for these x is about 0.00029.

A better approximation can be obtained via derivative. The derivative of ${\displaystyle f(x)=\cos x}$ being ${\displaystyle f'(x)=-\sin x,}$ we have ${\displaystyle f'(0)=0,}$ ${\displaystyle f'(\pi /6)=-1/2,}$ ${\displaystyle f'(\pi /4)=-{\sqrt {2}}/2,}$ ${\displaystyle f'(\pi /3)=-{\sqrt {3}}/2,}$ ${\displaystyle f'(\pi /2)=-1.}$ The corresponding derivatives ${\displaystyle P'(x)}$ are close but different; for instance,

{\displaystyle {\begin{aligned}P'{\big (}{\tfrac {\pi }{2}}{\big )}&={\tfrac {12}{\pi }}Q'(6)={\tfrac {12}{\pi }}\cdot {\big (}{\tfrac {1}{144}}\cdot 4\cdot 3\cdot 2-{\tfrac {\sqrt {3}}{2}}\cdot {\tfrac {1}{16}}\cdot 6\cdot 3\cdot 2+{\tfrac {\sqrt {2}}{2}}\cdot {\tfrac {1}{9}}\cdot 6\cdot 4\cdot 2-\\&\quad -{\tfrac {1}{2}}\cdot {\tfrac {1}{16}}\cdot 6\cdot 4\cdot 3{\big )}={\tfrac {2}{\pi }}-{\tfrac {27{\sqrt {3}}}{2\pi }}+{\tfrac {32{\sqrt {2}}}{\pi }}-{\tfrac {27}{\pi }}\approx -0.9956\neq -1.\end{aligned}}}

In order to fix the derivative without spoiling the values we replace ${\displaystyle Q(x)}$ with ${\displaystyle Q(x)+\ell (x)R(x)}$ where ${\displaystyle R(x)}$ is a polynomial of degree 4 such that the derivative of ${\displaystyle Q{\big (}{\tfrac {12}{\pi }}x{\big )}+\ell {\big (}{\tfrac {12}{\pi }}x{\big )}R{\big (}{\tfrac {12}{\pi }}x{\big )}}$ is equal to ${\displaystyle f'(x)}$ for ${\displaystyle x=0,{\tfrac {\pi }{6}},{\tfrac {\pi }{4}},{\tfrac {\pi }{3}},{\tfrac {\pi }{2}};}$ it means, ${\displaystyle {\tfrac {12}{\pi }}Q'{\big (}{\tfrac {12}{\pi }}x{\big )}+{\tfrac {12}{\pi }}\ell '{\big (}{\tfrac {12}{\pi }}x{\big )}R{\big (}{\tfrac {12}{\pi }}x{\big )}=f'(x),}$ since ${\displaystyle \ell {\big (}{\tfrac {12}{\pi }}x{\big )}=0}$ for these x; so,

${\displaystyle R(x)={\frac {{\frac {\pi }{12}}f'{\big (}{\frac {\pi }{12}}x{\big )}-Q'(x)}{\ell '(x)}}}$ for ${\displaystyle x=0,2,3,4,6.}$

We find such R as before:

${\displaystyle R(x)=\textstyle R(0){\frac {\ell (x)}{\ell '(0)x}}+R(2){\frac {\ell (x)}{\ell '(2)(x-2)}}+R(3){\frac {\ell (x)}{\ell '(3)(x-3)}}+R(4){\frac {\ell (x)}{\ell '(4)(x-4)}}+R(6){\frac {\ell (x)}{\ell '(6)(x-6)}},}$

and get a better approximation ${\displaystyle \textstyle P_{2}(x)=P(x)+\ell {\big (}{\frac {12}{\pi }}x{\big )}R{\big (}{\frac {12}{\pi }}x{\big )};}$ in fact, ${\displaystyle \max _{0 If you still want a smaller error, try second derivative and ${\displaystyle Q(x)+\ell (x)R(x)+\ell ^{2}(x)S(x).}$

### Polynomial mimics cosine: roots

The cosine function, ${\displaystyle f(x)=\cos x,}$ satisfies ${\displaystyle f(0)=1}$ and has infinitely many roots: ${\displaystyle f(\pm 0.5\pi )=f(\pm 1.5\pi )=f(\pm 2.5\pi )=\dots =0.}$ A polynomial cannot satisfy all these conditions; can it satisfy a finite portion of them?

It is easy to find a polynomial P such that ${\displaystyle P(0)=1}$ and ${\displaystyle P(\pm 0.5\pi )=0,}$ namely ${\displaystyle P_{1}(x)=-{\frac {4}{\pi ^{2}}}(x^{2}-0.25\pi ^{2})}$ (check it). What about ${\displaystyle P(0)=1}$ and ${\displaystyle P(\pm 0.5\pi )=P(\pm 1.5\pi )=0\,?}$

The conditions being insensitive to the sign of x, we seek a polynomial of ${\displaystyle x^{2},}$ that is, ${\displaystyle P(x)=Q(x^{2})}$ where Q satisfies ${\displaystyle Q(0)=1}$ and ${\displaystyle Q(0.25\pi ^{2})=Q(2.25\pi ^{2})=0.}$ It is easy to find such Q, namely, ${\displaystyle Q(x)={\frac {16}{9\pi ^{4}}}(x-0.25\pi ^{2})(x-2.25\pi ^{2})}$ (check it), which leads to

${\displaystyle P_{2}(x)={\frac {16}{9\pi ^{4}}}(x^{2}-0.25\pi ^{2})(x^{2}-2.25\pi ^{2}).}$ As we see on the picture, the two functions are rather close for ${\displaystyle -0.5\pi in fact, the greatest ${\displaystyle |P_{2}(x)-\cos x|}$ for these x is about 0.028, while the greatest ${\displaystyle |P_{1}(x)-\cos x|}$ (for these x) is about 0.056.

The next step in this direction: ${\displaystyle \textstyle P_{3}(x)=-{\frac {64}{225\pi ^{6}}}(x^{2}-0.25\pi ^{2})(x^{2}-2.25\pi ^{2})(x^{2}-6.25\pi ^{2})}$ ${\displaystyle \textstyle ={\Big (}1-{\frac {4x^{2}}{\pi ^{2}}}{\Big )}{\Big (}1-{\frac {4x^{2}}{9\pi ^{2}}}{\Big )}{\Big (}1-{\frac {4x^{2}}{25\pi ^{2}}}{\Big )};}$ ${\displaystyle \quad \max _{-0.5\pi

And so on. For every ${\displaystyle n=1,2,\dots }$ the polynomial

${\displaystyle P_{n}(x)={\Big (}1-{\frac {4x^{2}}{\pi ^{2}}}{\Big )}{\Big (}1-{\frac {4x^{2}}{9\pi ^{2}}}{\Big )}\dots {\Big (}1-{\frac {4x^{2}}{(2n-1)^{2}\pi ^{2}}}{\Big )}=\prod _{k=1}^{n}{\Big (}1-{\frac {4x^{2}}{(2k-1)^{2}\pi ^{2}}}{\Big )}}$

satisfies ${\displaystyle P_{n}(0)=1}$ and ${\displaystyle P_{n}(\pm 0.5\pi )=P_{n}(\pm 1.5\pi )=\dots =P_{n}(\pm (n-0.5)\pi )=0,}$ which is easy to check. It is harder (but possible) to prove that ${\displaystyle P_{n}(x)\to \cos x}$ as ${\displaystyle n\to \infty ,}$ which represents the cosine as an infinite product

${\displaystyle \cos x={\Big (}1-{\frac {4x^{2}}{\pi ^{2}}}{\Big )}{\Big (}1-{\frac {4x^{2}}{9\pi ^{2}}}{\Big )}\dots =\prod _{k=1}^{\infty }{\Big (}1-{\frac {4x^{2}}{(2k-1)^{2}\pi ^{2}}}{\Big )}.}$

On the other hand, the well-known power series ${\displaystyle \cos x=1-{\frac {x^{2}}{2}}+{\frac {x^{4}}{24}}-\cdots =\sum _{k=0}^{\infty }{\frac {(-1)^{k}x^{2k}}{(2k)!}}}$ gives another sequence of polynomials ${\displaystyle Q_{n}(x)=1-{\frac {x^{2}}{2}}+{\frac {x^{4}}{24}}-\dots +{\frac {(-1)^{n}x^{2n}}{(2n)!}}=\sum _{k=0}^{n}{\frac {(-1)^{k}x^{2k}}{(2k)!}}}$ converging to the same cosine function. See the picture for Q3; ${\displaystyle \quad \max _{-0.5\pi

Can we check the equality ${\displaystyle \textstyle {\big (}1-{\frac {4x^{2}}{\pi ^{2}}}{\big )}{\big (}1-{\frac {4x^{2}}{9\pi ^{2}}}{\big )}\dots =1-{\frac {x^{2}}{2}}+{\frac {x^{4}}{24}}-\cdots }$ by opening the brackets? Let us try. The constant coefficient: just 1=1. The coefficient of x2: ${\displaystyle \textstyle -{\frac {4}{\pi ^{2}}}-{\frac {4}{9\pi ^{2}}}-\dots =-{\frac {1}{2}},}$ that is, ${\displaystyle \textstyle 1+{\frac {1}{3^{2}}}+{\frac {1}{5^{2}}}+\dots ={\frac {\pi ^{2}}{8}};}$ really? Yes, ${\displaystyle \textstyle 1+{\frac {1}{3^{2}}}+{\frac {1}{5^{2}}}+\dots =\textstyle (1+{\frac {1}{2^{2}}}+{\frac {1}{3^{2}}}+\dots )-({\frac {1}{2^{2}}}+{\frac {1}{4^{2}}}+{\frac {1}{6^{2}}}+\dots )=(1+{\frac {1}{2^{2}}}+{\frac {1}{3^{2}}}+\dots )-{\frac {1}{2^{2}}}(1+{\frac {1}{2^{2}}}+{\frac {1}{3^{2}}}+\dots )={\frac {3}{4}}\cdot {\frac {\pi ^{2}}{6}}={\frac {\pi ^{2}}{8}};}$ the well-known series of reciprocal squares is instrumental.

Such non-rigorous opening of brackets can be made rigorous as follows. For every polynomial P, the constant coefficient is the value of P at zero, P(0); the coefficient of x is the value at zero of the derivative, P '(0); and the coefficient of x2 is one half of the value at zero of the second derivative, ½P''(0). Clearly, ${\displaystyle Q_{n}(0)=1=f(0),}$ ${\displaystyle Q'_{n}(0)=0=f'(0)}$ and ${\displaystyle Q''_{n}(0)=-1=f''(0)}$ for all ${\displaystyle n\geq 1}$ (as before, ${\displaystyle f(x)=\cos x}$). The calculation above shows that ${\displaystyle P''_{n}(0)\to -1=f''(0)}$ as n tends to infinity. What about higher derivative, ${\displaystyle P_{n}^{(k)}(0),}$ does it converge to ${\displaystyle f^{(k)}(0)\,}$? It is tedious (if at all possible) to generalize the above calculation to k=4,6,...; fortunately, there is a better approach. Namely, ${\displaystyle P_{n}(z)\to f(z)}$ for all complex numbers z, and moreover, ${\displaystyle \max _{|z|\leq R}|P_{n}(z)-f(z)|\to 0}$ for every R>0. Using Cauchy's differentiation formula one concludes that ${\displaystyle \max _{|z|\leq R}|P_{n}^{(k)}(z)-f^{(k)}(z)|\to 0}$ (as ${\displaystyle n\to \infty }$) for each k, and in particular, ${\displaystyle P_{n}^{(k)}(0)\to f^{(k)}(0).}$

### Limit of derivatives versus derivative of limit

${\displaystyle P_{n}(x)=x(1-x^{2})^{n}\,.}$

For ${\displaystyle -1\leq x\leq 1}$ we have ${\displaystyle P_{n}(x)\to 0}$ (think, why) as ${\displaystyle n\to \infty .}$ Nevertheless, the derivative at zero does not converge to 0; rather, it is equal to 1 (for all n) since, denoting ${\displaystyle Q_{n}(x)=(1-x^{2})^{n},}$ we have ${\displaystyle P'_{n}(x)=(xQ_{n}(x))'=1\cdot Q_{n}(x)+x\cdot Q'_{n}(x);}$ ${\displaystyle P'_{n}(0)=Q_{n}(0)=1.}$

Thus, the limit of the sequence of functions ${\displaystyle (P_{1},P_{2},\dots )}$ on the interval ${\displaystyle [-1,1]}$ is the zero function, hence the derivative of the limit is the zero function as well. However, the limit of the sequence of derivatives ${\displaystyle (P'_{1},P'_{2},\dots )}$ fails to be zero at least for ${\displaystyle x=0.}$ What happens for ${\displaystyle 0<|x|\leq 1\,}$? Here the limit of derivatives is zero, since ${\displaystyle P'_{n}(x)={\big (}1-(2n+1)x^{2}{\big )}(1-x^{2})^{n-1}\to 0}$ (check it; the exponential decay of the second factor outweighs the linear grows of the first factor). Thus,

${\displaystyle 0={\big (}\lim _{n\to \infty }P_{n}(x){\big )}'\neq \lim _{n\to \infty }P'_{n}(x)=f(x)={\begin{cases}0&{\text{for }}-1\leq x<0,\\1&{\text{for }}x=0,\\0&{\text{for }}0

It is not always possible to interchange derivative and limit.

Note the two equivalent definition of the function f; one is piecewise (something for some x, something else for other x, ...), but the other is a single expression ${\displaystyle f(x)=\lim _{n\to \infty }{\big (}1-(2n+1)x^{2}{\big )}(1-x^{2})^{n-1}}$ for all these x.

The function f is discontinuous (at 0), and nevertheless it is the limit of continuous functions ${\displaystyle P'_{n}.}$ This can happen for pointwise convergence (that is, convergence at every point of the considered domain), since the speed of convergence can depend on the point.

Otherwise (when the speed of convergence does not depend on the point) convergence is called uniform; by the uniform convergence theorem, the uniform limit of continuous functions is a continuous function.

It follows that convergence of ${\displaystyle P'_{n}}$ (to f) is non-uniform, but this is a proof by contradiction.

A better understanding may be gained from a direct proof. The derivatives ${\displaystyle P'_{n}}$ fail to converge uniformly, since ${\displaystyle P'_{n}(x)}$ fails to be small (when n is large) for some x close to 0; for instance, try ${\displaystyle \textstyle x={\sqrt {\frac {c}{n-1}}}\,:}$

${\displaystyle \max _{0

for all ${\displaystyle c>0;}$ and ${\displaystyle (1-2c)e^{-c}}$ is not zero (unless ${\displaystyle c=0.5}$).

In contrast, ${\displaystyle P_{n}\to 0}$ uniformly on ${\displaystyle [-1,1],}$ that is, ${\displaystyle \max _{-1\leq x\leq 1}|P_{n}(x)|\to 0}$ as ${\displaystyle n\to \infty ,}$ since the maximum is reached at ${\displaystyle \textstyle x=\pm {\frac {1}{\sqrt {2n+1}}}}$ (check it by solving the equation ${\displaystyle P'_{n}(x)=0}$) and ${\displaystyle \textstyle 0\leq P_{n}{\big (}{\frac {1}{\sqrt {2n+1}}}{\big )}\leq {\frac {1}{\sqrt {2n+1}}}\to 0.}$ And still, it appears to be impossible to interchange derivative and limit. Compare this case with a well-known theorem:

If ${\displaystyle (f_{n})}$ is a sequence of differentiable functions on ${\displaystyle [a,b]}$ such that ${\displaystyle \lim _{n\to \infty }f_{n}(x_{0})}$ exists (and is finite) for some ${\displaystyle x_{0}\in [a,b]}$ and the sequence ${\displaystyle (f'_{n})}$ converges uniformly on ${\displaystyle [a,b]}$, then ${\displaystyle f_{n}}$ converges uniformly to a function ${\displaystyle f}$ on ${\displaystyle [a,b]}$, and ${\displaystyle f'(x)=\lim _{n\to \infty }f'_{n}(x)}$ for ${\displaystyle x\in [a,b]}$.

Uniform convergence of derivatives ${\displaystyle f'_{n}}$ is required; uniform convergence of functions ${\displaystyle f_{n}}$ is not enough.

Complex numbers, helpful in Sect. "Polynomial mimics cosine: roots", are helpless here, since for ${\displaystyle z=\pm ci}$ we have ${\displaystyle |P(z)|=c(1+c^{2})^{n}\to \infty }$ for all ${\displaystyle c>0.}$


text:
# PureBasic Forum

 It is currently Sat Oct 19, 2019 1:49 pm

 All times are UTC + 1 hour

 Page 1 of 1 [ 12 posts ]
 Print view Previous topic | Next topic
Author Message
 PureBasic Protozoa

Joined: Fri Apr 25, 2003 3:08 pm
Posts: 4493
Location: Not Sydney!!! (Bad water, no goats)
I found the following code in the forum to subclass a listicongadget so that I can colour the heading area but after I managed to modify it to colour 3 gadgets, it appeared that I was doing something wrong ans any gadgets after 3 wouldn't colour.

Code:
; Subclass ListIcon so we can customdraw the header text and colour the header area
;============================================================================================================================

Procedure SubclassedListIcon(hwnd, msg, wparam, lparam)
Protected hdi.hd_item
result = CallWindowProc_(form\oldListIconCallback, hwnd, msg, wparam, lparam)
Select msg
Case #WM_NOTIFY
*pnmh.NMHDR = lparam    ;--> Get handle to ListIcon header control
If *pnmh\code = #NM_CUSTOMDRAW
*pnmcd.NMCUSTOMDRAW = lparam ;--> Determine drawing stage
Select *pnmcd\dwDrawStage
Case #CDDS_PREPAINT
result = #CDRF_NOTIFYITEMDRAW
Case #CDDS_ITEMPREPAINT ; Get header text.
text$= Space(100) hdi\mask = #HDI_TEXT hdi\psztext = @text$
hdi\cchtextmax = Len(text$) SendMessage_(form\hHeader, #HDM_GETITEM, *pnmcd\dwItemSpec, hdi) ; Check button state. If *pnmcd\uItemState & #CDIS_SELECTED DrawFrameControl_(*pnmcd\hdc, *pnmcd\rc, #DFC_BUTTON, #DFCS_BUTTONPUSH | #DFCS_PUSHED) ; Offset text because of the selected button. InflateRect_(*pnmcd\rc, -1, -1) Else DrawFrameControl_(*pnmcd\hdc, *pnmcd\rc, #DFC_BUTTON, #DFCS_BUTTONPUSH) EndIf ; Draw background. ; Here we alternate red text on blue background. InflateRect_(*pnmcd\rc, -1, -1) SetBkMode_(*pnmcd\hdc, #TRANSPARENT) ;If *pnmcd\dwItemSpec & 1 FillRect_(*pnmcd\hdc, *pnmcd\rc, form\brush) SetTextColor_(*pnmcd\hdc,$000000)
;Else
;  FillRect_(*pnmcd\hdc, *pnmcd\rc, Colour)
;  SetTextColor_(*pnmcd\hdc, $000000) ;EndIf DrawText_(*pnmcd\hdc, @text$, Len(text$), *pnmcd\rc, #DT_CENTER | #DT_VCENTER | #DT_END_ELLIPSIS) result = #CDRF_SKIPDEFAULT EndSelect EndIf EndSelect ProcedureReturn result EndProcedure These are the two lines to invoke the colouring of a single gadget and I was wondering if there is a simple way to use a linked list to subclass and colour as many gadget headings that I want without resorting to a library with features I don't need? Code: ;------------------------------------------------------------------------------------------------ ; Sublcass ListIconGadget to allow header to be painted ;------------------------------------------------------------------------------------------------ form\hHeader = SendMessage_(GadgetID(#Gadget_ebackup_items), #LVM_GETHEADER, 0, 0) ; Subclass ListIcon so we can customdraw the header text form\oldListIconCallback = SetWindowLong_(GadgetID(#Gadget_ebackup_items), #GWL_WNDPROC, @SubclassedListIcon()) Give me 30 years and I' might get betetr with the API but I doubt it _________________ Amateur Radio, D-STAR/VK3HAF Top  Post subject: Posted: Thu Jun 07, 2007 6:26 pm  PureBasic Expert Joined: Wed Oct 29, 2003 4:35 pm Posts: 10525 Location: Beyond the pale... fangles, I reckon the problem is your 'form' structure variable which I presume is global. The thing is, that the code you're using was written for PB 3.94. With PB 4, we can easily get the header text and so there is no need to store the handle of the header control etc. In fact, we never needed to store it anyhow ... but that's another story! The following is very rough and ready (but is all I have time for!) with the colouring routine being simplified over the version you're currently using: Code: ;Coloured header control. ;By srod. ;Purebasic 4. ;Windows. #LVM_GETHEADER = #LVM_FIRST + 31 ; Globals Global oldListIconCallback, redbrush, bluebrush redbrush=CreateSolidBrush_(#Yellow) bluebrush=CreateSolidBrush_(#Yellow) ; Proc for subclassed ListIconGadget Procedure SubclassedListIcon(hwnd, msg, wparam, lparam) Protected hdi.hd_item result = CallWindowProc_(oldListIconCallback, hwnd, msg, wparam, lparam) Select msg Case #WM_NOTIFY *pnmh.NMHDR = lparam ;--> Get handle to ListIcon header control If *pnmh\code = #NM_CUSTOMDRAW *pnmcd.NMCUSTOMDRAW = lparam ;--> Determine drawing stage Select *pnmcd\dwDrawStage Case #CDDS_PREPAINT result = #CDRF_NOTIFYITEMDRAW Case #CDDS_ITEMPREPAINT ;Get header text. text$=GetGadgetItemText(GetDlgCtrlID_(hWnd),-1,*pnmcd\dwItemSpec)
;Check button state.
If *pnmcd\uItemState & #CDIS_SELECTED
DrawFrameControl_(*pnmcd\hdc, *pnmcd\rc, #DFC_BUTTON, #DFCS_BUTTONPUSH|#DFCS_PUSHED)
;Offset text because of the selected button.
InflateRect_(*pnmcd\rc,-1,-1)
Else
DrawFrameControl_(*pnmcd\hdc, *pnmcd\rc, #DFC_BUTTON, #DFCS_BUTTONPUSH)
EndIf
;Draw background.
*pnmcd\rc\bottom-2 : *pnmcd\rc\right-2
SetBkMode_(*pnmcd\hdc,#TRANSPARENT)
If *pnmcd\dwItemSpec&1
FillRect_(*pnmcd\hdc, *pnmcd\rc, redbrush)
SetTextColor_(*pnmcd\hdc, #Blue)
Else
FillRect_(*pnmcd\hdc, *pnmcd\rc, bluebrush)
SetTextColor_(*pnmcd\hdc, #Red)
EndIf
*pnmcd\rc\top+2
InflateRect_(*pnmcd\rc,-5,0)
If *pnmcd\rc\right>*pnmcd\rc\left
DrawText_(*pnmcd\hdc, @text$, Len(text$), *pnmcd\rc, #DT_CENTER|#DT_VCENTER|#DT_END_ELLIPSIS)
EndIf
result = #CDRF_SKIPDEFAULT
EndSelect
EndIf
EndSelect
ProcedureReturn result
EndProcedure

; ************************************************
; Main Window
; ************************************************
If OpenWindow(0, 100, 100, 415, 400, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
ListIconGadget(0, 5, 5, 405, 80, "col 0", 50, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
ListIconGadget(1, 5, 90, 405, 80, "col 0", 50, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
ListIconGadget(2, 5, 175, 405, 80, "col 0", 50, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
ListIconGadget(3, 5, 250, 405, 80, "col 0", 50, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
;Subclass ListIcon so we can customdraw the header text

For j = 0 To 3
For i = 1 To 10
Next
next
For b=0 To 99; Add 100 rows.
Next
For i = 0 To 99
For j = 0 To 50
Next j
Next i

Repeat
EventID = WaitWindowEvent()
Until EventID = #PB_Event_CloseWindow

DeleteObject_(redbrush)
DeleteObject_(bluebrush)

EndIf
End

I see no need for linked lists etc. If you really need to store info on each listicon then consider using a Window's property to store a pointer to whatever data you need to store.

_________________
I may look like a mule, but I'm not a complete ass.

Top

 Post subject: Thank youPosted: Fri Jun 08, 2007 1:06 am
 PureBasic Protozoa

Joined: Fri Apr 25, 2003 3:08 pm
Posts: 4493
Location: Not Sydney!!! (Bad water, no goats)
I can see that I am going to have to sell my children to pay you. I still don't know bugger alla bout manipulating the api which is why I can't figure these things out myself. Normal pb code I can bugger up and hopefully fix but this stuff???

Thanks for that.. Hope things are going okay for you.

_________________

Top

 Post subject: Re: Colouring ListIconGadget headersPosted: Sat Apr 28, 2012 2:50 pm
 PureBasic Protozoa

Joined: Fri Apr 25, 2003 3:08 pm
Posts: 4493
Location: Not Sydney!!! (Bad water, no goats)
Really old post but as this question is related, I'll put it here.

The above code works fine if I do this for every code in the main openwindow statement

However, if I do this inside a PROCEDURE that opens another window on top of the main one, my program will either crash at the opening of that window when encountering that statement or when I exit that window.

I can reproduce it at will. Simply commenting out that statement fixes my problem immediately.

_________________

Top

 Post subject: Re: Colouring ListIconGadget headersPosted: Sat Apr 28, 2012 3:40 pm

Joined: Tue Feb 22, 2011 1:16 pm
Posts: 1482
In one of the PureBasic blog posts, they said to change all SetWindowLong_() to SetWindowLongPtr_() now. Try that. And the same for GetWindowLong_() to GetWindowLongPtr_().

_________________
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!

Top

 Post subject: Re: Colouring ListIconGadget headersPosted: Sat Apr 28, 2012 11:40 pm
 PureBasic Protozoa

Joined: Fri Apr 25, 2003 3:08 pm
Posts: 4493
Location: Not Sydney!!! (Bad water, no goats)
Thanks for that MachineCode, fingers crossed.

**EDIT** Just did it in 8 places in my program, tested, works like a charm. I'll go read the blog post, not that i'll understand it but I'll read it:):)

Thanks again.

_________________

Top

 Post subject: Re: Colouring ListIconGadget headersPosted: Sat Apr 28, 2012 11:56 pm
 PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10525
Location: Beyond the pale...
If you are using PB x64 (or writing code to compile on both x86 and x64) then yes you want to be using SetWindowLongPtr_() etc. fangles.

_________________
I may look like a mule, but I'm not a complete ass.

Top

 Post subject: Re: Colouring ListIconGadget headersPosted: Sun Apr 29, 2012 2:56 am
 PureBasic Protozoa

Joined: Fri Apr 25, 2003 3:08 pm
Posts: 4493
Location: Not Sydney!!! (Bad water, no goats)
srod wrote:
If you are using PB x64 (or writing code to compile on both x86 and x64) then yes you want to be using SetWindowLongPtr_() etc. fangles.

No, I'm not. Could not shell out the buckaroonies for the x64 version of win7, especially when I could not get x64 versions of all my needed hardware drivers so I never bothered.

Just used PSPad text editor to do a search and replace on ALL my code and no more problems.

So glad it was an easy fix, too many other dramas going on around here :):)

_________________

Top

 Post subject: Re: Colouring ListIconGadget headersPosted: Sun Apr 29, 2012 4:43 am

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3402
Location: New Zealand
Fangbeast wrote:
Really old post but as this question is related, I'll put it here.

The above code works fine if I do this for every code in the main openwindow statement

However, if I do this inside a PROCEDURE that opens another window on top of the main one, my program will either crash at the opening of that window when encountering that statement or when I exit that window.

I can reproduce it at will. Simply commenting out that statement fixes my problem immediately.

I don't think you can't use it like that, not with multiple windows since the address stored in OldListIconCallBack
will always refer to the last opened windows procedure resulting in an IMA in your callback

Top

 Post subject: Re: Colouring ListIconGadget headersPosted: Sun Apr 29, 2012 8:21 am
 PureBasic Protozoa

Joined: Fri Apr 25, 2003 3:08 pm
Posts: 4493
Location: Not Sydney!!! (Bad water, no goats)
idle wrote:
Fangbeast wrote:
Really old post but as this question is related, I'll put it here.

The above code works fine if I do this for every code in the main openwindow statement

However, if I do this inside a PROCEDURE that opens another window on top of the main one, my program will either crash at the opening of that window when encountering that statement or when I exit that window.

I can reproduce it at will. Simply commenting out that statement fixes my problem immediately.

I don't think you can't use it like that, not with multiple windows since the address stored in OldListIconCallBack
will always refer to the last opened windows procedure resulting in an IMA in your callback

Seems to work at the moment. Since I changed Get/SetWindowLong to Get/SetWindowLongPtr, it's no longer crashing, which it was before, all the time.

So much to do, I need a holiday!

_________________

Top

 Post subject: Re: Colouring ListIconGadget headersPosted: Sun Apr 29, 2012 9:37 am
 PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10525
Location: Beyond the pale...
If you are not using PB x64 then SetWindowLongPtr_() will make no difference.

_________________
I may look like a mule, but I'm not a complete ass.

Top

 Post subject: Re: Colouring ListIconGadget headersPosted: Sun Apr 29, 2012 11:35 am
 PureBasic Protozoa

Joined: Fri Apr 25, 2003 3:08 pm
Posts: 4493
Location: Not Sydney!!! (Bad water, no goats)
srod wrote:
If you are not using PB x64 then SetWindowLongPtr_() will make no difference.

Well, it made a difference here, apparently. Whether that's due to something else is decidedly unclear to me. Once I had changed from Get/SetWindowLong to Get/SetWindowLongPtr, no more crashes at all.

If that change is not the reason, I don't know why. As you well know, API isn't my forte.

_________________

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 12 posts ]

 All times are UTC + 1 hour

#### Who is online

Users browsing this forum: No registered users and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forum

Search for:
 Jump to:  Select a forum ------------------ PureBasic    Coding Questions    Game Programming    3D Programming    Assembly Programming    The PureBasic Editor    The PureBasic Form Designer    General Discussion    Feature Requests and Wishlists    Tricks 'n' Tips Bug Reports    Bugs - Windows    Bugs - Linux    Bugs - Mac OSX    Bugs - Documentation OS Specific    AmigaOS    Linux    Windows    Mac OSX Miscellaneous    Announcement    Off Topic Showcase    Applications - Feedback and Discussion    PureFORM & JaPBe    TailBite

format: plain


text:
Biodiversity - Which is the most diverse animal or plant?

1. Nov 29, 2007

wolram

Which is the most diverse animal or plant, if one classes any thing living that is not a plant an animal.

Last edited: Nov 29, 2007
2. Nov 29, 2007

Mk

How can one organism be more diverse than another?

3. Nov 29, 2007

Chris Hillman

Which measure of diversity?

Come again? Are you restricting competitors to "plants and animals", or excluding "plants and animals"? (Define plant, animal.) And do you mean morphological diversity? Genetic diversity? Behavioral diversity?

In ecology and systematics, "diversity" usually refers to a more or less vaguely motivated quantity which alleges to compare "diversity" of ecosystems or genomes in a population of breeding organisms. One of the simplest measures of "diversity" of an ecosystem was proposed by George Gaylord Simpson:
$$D = 1 - \sum_{j=1}^n p_j^2, \; \rm{where} \; \sum_{j=1}^n p_j = 1 \; \rm{and} \; 0 \leq p_j \leq 1, \; {\rm for} \; 1 \leq j \leq n$$
See http://www.tiem.utk.edu/~mbeals/simpsonDI.html [Broken] from M. Bealls (Institute for Environmental Modeling, University of Kentucky), which uses a different and nonstandard form of Simpson's diversity index, but has the virtue of giving some data you can play with.

Last edited by a moderator: May 3, 2017
4. Nov 29, 2007

Andre

If i understand the question correctly, it seems that you are looking for the species with the most variation in appearance. my guess would be Canis domesticus

5. Nov 29, 2007

Chris Hillman

I think Wolram intended to ask an unanswerable question to promote... discussion.

See a recent issue of American Scientist for the diverse appearance of the dog. But what about the diverse appearance of diatoms? http://www.ucmp.berkeley.edu/chromista/diatoms/diatommm.html

Last edited: Nov 29, 2007
6. Nov 29, 2007

moe darklight

forsooth!

http://www.eminemitalia.it/images/hiphoptimeline/snoop_dogg.jpg [Broken]

http://s.yottamusic.com/i/akGc.2Vs7 [Broken]

EDIT: you know, now that this thread made me think about it... humans all look ridiculously similar. I mean, take away haircuts, makeup, etc.. and I'd say, as far as geometric variety goes, we're quite monotonous and boring when compared to other species.

I think it's fascinating that we can tell each other apart so well, considering how freakishly similar our faces are.

Last edited by a moderator: May 3, 2017
7. Nov 29, 2007

Andre

Diatoms are a class (Diatomacea) in the Phylum Chrysophyta of the Kingdom Protista.
Another single species candidate could be Poecillia reticulata, (Peters 1859)

How does a cat recognise a person? When I used to come home after work, I would be very silent. Eventually the cat, who regretfully past away last year, would stop monitoring the Poecillia reticulata's and would stare at me, wondering who I might be. That is, until I said something, then immediate the spark of recognition and an affectionate greeting ceremony would follow.

Last edited: Nov 29, 2007
8. Nov 29, 2007

wolram

Life has split two ways, plant and animal, one grows from the soil (environment) the animal lives from the other and procreates, that is the best distinction i can give.

Last edited: Nov 29, 2007
9. Nov 29, 2007

out of whack

So did you mean to ask "which is the most diverse animal or plant?" or "which is the more diverse, animal or plant?"

Behold the power of punctuation, among other things...

Last edited: Nov 29, 2007
10. Nov 29, 2007

wolram

11. Nov 29, 2007

Chris Hillman

Wolfram never specified "single species", in fact his statement of the challenge is not even self-consistent.

[EDIT: :rofl: one guppy does not belong with the others!]

Have you read Desmond Morris's book on the behavior of the "domestic" cat?

12. Nov 29, 2007

JasonRox

Overweight people look quite different naked!


text:
GMAT Question of the Day - Daily to your Mailbox; hard ones only

 It is currently 16 Oct 2019, 10:44

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

# If x and y are consecutive integers and x < y, then y^2 - x^2 must be

Author Message
TAGS:

### Hide Tags

Senior RC Moderator
Joined: 02 Nov 2016
Posts: 4106
GPA: 3.39
If x and y are consecutive integers and x < y, then y^2 - x^2 must be  [#permalink]

### Show Tags

04 Mar 2019, 14:13
1
00:00

Difficulty:

25% (medium)

Question Stats:

80% (01:16) correct 20% (01:21) wrong based on 40 sessions

### HideShow timer Statistics

If x and y are consecutive integers and $$x < y$$, then $$y^2 - x^2$$ must be

A. a prime number.
B. an odd number.
C. an even number.
D. the square of an integer.
E. $$(y-x)^2$$.

_________________
e-GMAT Representative
Joined: 04 Jan 2015
Posts: 3074
Re: If x and y are consecutive integers and x < y, then y^2 - x^2 must be  [#permalink]

### Show Tags

04 Mar 2019, 22:55

Solution

Given:
• The numbers x and y are consecutive integers
• Also x < y

To find:
• Which of the given options is always true, regarding the value of $$y^2 – x^2$$

Approach and Working:
As x < y and x, y are consecutive integers, we can say that
• If x = n, then y = n + 1
• Therefore, $$y^2 – x^2 = (n + 1)^2 – n^2 = n^2 + 2n + 1 – n^2 = 2n + 1$$, which is always an odd integer.

Alternatively, we can assume values also to determine the answer.
• If x = 2 and y = 3, then $$y^2 – x^2 = 9 – 4 = 5$$
o Therefore, $$y^2 – x^2$$ can be either a prime or an odd number, we can rule out the other possibilities.

• If x = 7 and y = 8, then $$y^2 – x^2 = 64 – 49 = 15$$, which is odd but not a prime number.

Hence, the correct answer is option B.

_________________
##### General Discussion
VP
Joined: 31 Oct 2013
Posts: 1469
Concentration: Accounting, Finance
GPA: 3.68
WE: Analyst (Accounting)
Re: If x and y are consecutive integers and x < y, then y^2 - x^2 must be  [#permalink]

### Show Tags

04 Mar 2019, 14:23
If x and y are consecutive integers and $$x < y$$, then $$y^2 - x^2$$ must be

A. a prime number.
B. an odd number.
C. an even number.
D. the square of an integer.
E. $$(y-x)^2$$.

x and y are consecutive integers. Thus, one of them must be odd and one of them must be even.

even - odd = odd.

Result must be an odd integer.

Manager
Joined: 21 Feb 2019
Posts: 125
Location: Italy
Re: If x and y are consecutive integers and x < y, then y^2 - x^2 must be  [#permalink]

### Show Tags

04 Mar 2019, 17:05
1
$$x < y$$ and $$x$$ and $$y$$ are consecutive.

Hence we can rewrite $$y$$ as: $$y = x +1$$

Thus: $$y^2 - x^2 = (y - x) (y + x) = (x + 1 - x) (x + 1 + x) = 2x + 1$$,

which is an odd number.

_________________
If you like my post, Kudos are appreciated! Thank you.

MEMENTO AUDERE SEMPER
GMAT Club Legend
Joined: 18 Aug 2017
Posts: 5008
Location: India
Concentration: Sustainability, Marketing
GPA: 4
WE: Marketing (Energy and Utilities)
Re: If x and y are consecutive integers and x < y, then y^2 - x^2 must be  [#permalink]

### Show Tags

06 Mar 2019, 02:19
difference of square of two consective no will always result in an odd no
IMO B

If x and y are consecutive integers and $$x < y$$, then $$y^2 - x^2$$ must be

A. a prime number.
B. an odd number.
C. an even number.
D. the square of an integer.
E. $$(y-x)^2$$.
Target Test Prep Representative
Status: Founder & CEO
Affiliations: Target Test Prep
Joined: 14 Oct 2015
Posts: 8069
Location: United States (CA)
Re: If x and y are consecutive integers and x < y, then y^2 - x^2 must be  [#permalink]

### Show Tags

08 Mar 2019, 08:00
If x and y are consecutive integers and $$x < y$$, then $$y^2 - x^2$$ must be

A. a prime number.
B. an odd number.
C. an even number.
D. the square of an integer.
E. $$(y-x)^2$$.

Since x and y are consecutive integers and x < y, then y = x + 1. Thus, y^2 - x^2 = (x + 1)^2 - x^2 = x^2 + 2x + 1 - x^2 = 2x + 1, which is always an odd number, regardless of what integer x is.

_________________

# Scott Woodbury-Stewart

Founder and CEO

Scott@TargetTestPrep.com
122 Reviews

5-star rated online GMAT quant
self study course

See why Target Test Prep is the top rated GMAT quant course on GMAT Club. Read Our Reviews

If you find one of my posts helpful, please take a moment to click on the "Kudos" button.

Re: If x and y are consecutive integers and x < y, then y^2 - x^2 must be   [#permalink] 08 Mar 2019, 08:00
Display posts from previous: Sort by


text:
# efficient MPI collective non-blocking communication

I am facing a problem with MPI (Fortran). I have a really big matrix at each node and they differ at different nodes. At some point of my calculations, each node needs the matrix from all other nodes, so that the MPI communication is between every node. Each node is a sender at the same time it is also a receiver. The matrix size is already too big to allow me to simply collect data from all other nodes. Currently what I am doing is to combine MPI_ISEND with MPI_RECV, but I think this might not be the best solution, thus, I would like to consult you experts.

To be more specific, the matrix on each node is of same size, but they are not replica of each other, their elements are different at different nodes. At some point of time, each node needs the matrix from all other nodes. Thus, each node shall send its own matrix at the same receive data from all other nodes.

I would be really grateful to you valuable suggestions and maybe solutions.

• Using Isend and Recv is typically the way to do this. Why exactly do you think this may be insufficient? Trying to optimize something that may not need to be optimized is a common mistake, and the old adage "premature optimization is the root of all evil" applies. If using Isend/Recv is not sufficient, then you will find out about this during benchmarking -- but not by just thinking that it might. – Wolfgang Bangerth Feb 8 '16 at 6:18
• You have not made it at all clear what communication pattern you are trying to implement. Code or equations would help. – Jeff Hammond Feb 9 '16 at 3:38
• I think this is not an MPI problem, but an algorithm problem. Using isend and recv is the way to go. But When to call them, how, etc. could make a difference. But you need to explain better what are doing. What algorithm are you using? what problem? what equations? some code would help too. – jbcolmenares Feb 11 '16 at 12:36
• I would focus on bypassing the "each node needs the matrix from all other nodes". This is not usually the way that things work, especially in very big problems. If you really want to do that, then maybe you should try shared-memory parallelization. If you want to investigate your communication patterns deeper, you should use a tracing tool, like Vampir. – MakisH Nov 9 '16 at 8:43
• With a lack of specifics on your particular problem, it's a bit difficult to offer suggestions. But on the off-chance that you're performing some kind of a distributed matrix-vector product A.x, you should really be distributing segments of x and operating on them with the local submatrices rather than communicating enormous arrays – sssssssssssss Dec 4 '17 at 14:57

What you're describing (each node needs every other node's data) is exactly implemented by MPI_Allgather:
You might expect MPI_Allgather to be more efficient than numerous MPI_ISEND/MPI_IRECV pairings since making MPI aware of your intended communication pattern could allow it to optimize information flow.
On the other hand, if you have wide variation in per-node calculation time, the MPI_ISEND/MPI_IRECV pairings would allow you to begin transferring information immediately as the nodes complete their operations, which might reduce latency.


text:
Statistics
| Revision:

## root / tmp / org.txm.statsengine.core / src / org / txm / statsengine / core / messages / messages.properties @ 1368

 1 #Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)  #TXM messages generated by the PluginMessagesManager class  #Mon Nov 12 17:18:22 CET 2018  aZerobasedIndexCannotBeInf0OrSupToTheNumberOfIndexedElements = ** A zero-based index cannot be < 0 or > to the number of indexed elements.  allTheInnerArrayDoNotHaveTheSameLength = ** All the inner array do not have the same length.  anInnerArrayCannotBeNull = ** An inner array cannot be null.  cannotDeleteANonexistingObject = ** Cannot delete a non-existing object.  cannotDeleteAllLines = Cannot delete all lines.  colIndex = Col index ({0}) too big (max {1}).  columnIndex = Column index (  columnNamesOfAContingencyTableCannotBeNull = Column names of a contingency table cannot be null.  error_statsEngineNotReadyCancelingCommand = Statistics Engine is not ready, canceling command.  failedToGetRowNames = Failed to get row names.  innerArraysMustBeOfDimensionSup0 = ** Inner arrays must be of dimension > 0.  matrixColonFailedToGetNrowColon = Matrix: failed to get nrow: {0}.  matrixImplColonErrorColonColumnSizeDiffersColonOriginal = MatrixImpl: Error: column sizes differ: original {0}, imported {1}.  mode = mode  notImplemented = ** Not implemented  nothingToDoWithAnEmptyMatrix = ** Nothing to do with an empty matrix  rObjectEvaluatedToNull = R object evaluated to null.  rowIndex = Row index ({0}) too big (max {1}).  rowNamesOfAContingencyTableCannotBeNull = Row names of a contingency table cannot be null.  theIndexArrayCanNotBeNullOrEmpty = ** The index array can not be null or empty.  unknownTypeColon = Unknown type: {0}.


text:
Infoscience

Conference paper

# Architecture and characterization of a calibrator for PMUs operating in power distribution systems

In recent years, the Phasor Measurement Unit (PMU) technology is rapidly evolving towards the potential deployment also in power distribution systems (DSs). In general, this specific field of applications requires PMUs whose accuracy levels are beyond those required by the IEEE Std. C37.118. Additionally, there is the need to define the architecture of an associated calibration system capable to assess the metrological performances of these devices. In this paper, we first analyse the impact of the uncertainties (in term of phase and magnitude) introduced by arbitrary PMUs on a state estimation (SE) process performed on the IEEE 13-bus distribution test feeder. The outcomes of this analysis are used to infer the most stringent steady-state performances of PMUs for DSs monitoring and, consequently, to define the requirements and the hardware archi- tecture of a PMU calibrator presently developed at the Author’s laboratories. A preliminary metrological characterization of the proposed calibrator is presented in the paper.


text:
Answer
Comment
Share
Q)

# Equipotential surfaces

$\begin{array}{1 1} \text{are closer in regions of large electric fields compared to regions of lower electric fields } \\ \text{will be more crowed near sharp edges of a conductor } \\ \text{will be more crowded near regions of large charge densities } \\ \text{All of the above}\end{array}$

## 1 Answer

Comment
A)
Solution :
Equipotential surfaces are closer in regions of large electric fields compared to regions of lower electric fields, it will be more crowed near sharp eges of a conductor . It will be more crowed near regions of large charge densities


text:
## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
• Create your own community
##### Activity
• 22:06
whutabarat-sheffield starred sympy/sympy
• 21:14
eagleoflqj commented #23495
• 20:42
oscarbenjamin commented #23510
• 20:29
oscarbenjamin commented #23499
• 19:45
ThePauliPrinciple commented #23499
• 19:45
FranzAtGithub commented #8871
• 19:36
ThePauliPrinciple commented #23499
• 18:15
agryman commented #23510
• 17:44
oscarbenjamin commented #23510
• 15:54
sohithkumar starred sympy/sympy
• 15:48
agryman commented #23510
• 13:59
oscarbenjamin commented #23495
• 12:23
gxyd edited #23505
• 11:33
saleiro starred sympy/sympy
• 11:13
gxyd commented #23495
• 11:13
gxyd commented #23495
• 11:10
gxyd commented #23495
• 11:00
gxyd commented #23505
• 08:44
oscarbenjamin labeled #23510
• 08:44
oscarbenjamin labeled #23510
Ayushman Koul
@ayushmankoul
Okay I will start with maplotlib to know about its functionality.Thank You @jksuom
Aaron Meurer
@asmeurer
@Juanlu001 Google Code-In was a lot different back then. They've made a ton of changes to the program since then.
I will say when we participated it was a lot of effort on the mentors. Don't do it unless you have multiple mentors who can commit time to it during the contest period.
I think it's not as bad as 2011 because of some of the changes they've made, but as far as I can tell it's still a lot of work.
Aaron Meurer
@asmeurer
And also remember that the program is for kids (13-17 year olds).
If you do have the time to put into it I would say it's worth it, though. You can get some very smart kids out of the program.
ronanpaixao
@ronanpaixao
Hi guys! I'm having some trouble using display() in the Jupyter notebook:

import sympy
from sympy.core.evaluate import evaluate
from sympy import latex
from IPython.display import display
sympy.init_printing(use_latex='mathjax')

X, mu, sigma, n = sympy.symbols("\bar{X} \mu \sigma n")
with evaluate(False):
eq = (X-mu)/(sigma/sympy.sqrt(n))
display(eq)

import sympy
from sympy.core.evaluate import evaluate
from sympy import latex
from IPython.display import display
sympy.init_printing(use_latex='mathjax')

X, mu, sigma, n = sympy.symbols("\bar{X} \mu \sigma n")
with evaluate(False):
eq = (X-mu)/(sigma/sympy.sqrt(n))
display(eq)
More like it...
This gives a RecursionError
ronanpaixao
@ronanpaixao
Any ideas on where the problem is?
yashraj-code
@yashraj-code
Hi everyone my name is Yashraj Dhanuka pursuing B.tech in CSE 3rd year. I would like to contribute in the community .I know basic Python,c++,and Machine Learning. and yes particularly interested in maths too. Can anyone guide me on how to contribute to this community. ThankYou
yashraj-code
@yashraj-code
any mentors ?
Kalevi Suominen
@jksuom
@yashraj-code This should help you getting started: https://github.com/sympy/sympy/wiki/Introduction-to-contributing.
Arnav
@nigamarnav
Hello guys! can anyone help me to find out the way how to contribute in this era as I am a newcomer.
Bunnyyyyy
@Bunnyyyyy
Hey guys, Please someone help me in better understanding of GSoC !
Aaron Meurer
@asmeurer
@ronanpaixao hard to say without seeing the traceback. Can you open an issue with the traceback (trim down the repeated lines first)
ronanpaixao
@ronanpaixao
@asmeurer Filed #15182
Bunnyyyyy
@Bunnyyyyy
Any mentor up here ?.....Please help me in better understanding of GSoC !
Bunnyyyyy
@Bunnyyyyy
Malkhan Singh
@Malkhan52
Bunnyyyyy
@Bunnyyyyy
Thanks, So how can I contribute to sympy ?.... Please help me !
Malkhan Singh
@Malkhan52
@Bunnyyyyy I gave a talk in my institute (NITR) last week on How to start contributions in open source projects, ping me I can provide link of that slide.
Bunnyyyyy
@Bunnyyyyy
@Malkhan52 Sir, what do you mean by ping ?

@Bunnyyyyy there is a link attached to the top of this chat with information for people new to contributing: https://github.com/sympy/sympy/wiki/Introduction-to-contributing

"ping" means attract one's attention and in this case probably suggests that you send a private message to the person

Bunnyyyyy
@Bunnyyyyy
Thank you :)
Jason K. Moore
@moorepants
Is there something similar as @doctest_depends_on for normal test functions?, i.e. @test_depends_on('numpy') or something like that?
Kalevi Suominen
@jksuom
I don't think that there is. The issue is handled in code as e.g. in test_sympify:
numpy = import_module('numpy')

def test_issue_10295():
if not numpy:
skip("numpy not installed.")
Jason K. Moore
@moorepants
@jksuom Thanks. We should turn that into a decorator.
Ayushman Koul
@ayushmankoul
Hello @jksuom I hope you are doing well. As asked by you to go through how matplotlib works I went through it to know how to write code for plotting line segments.Now coming back to issue, if I am not wrong I need to write a new method for plotting line segment and triangles inside class Plot in plotting/plot module ? Please guide me so that I can proceed further to it.Thanks
Kalevi Suominen
@jksuom
It seems that most objects to be plotted are subclasses of BaseSeries.
Micah
@micahscopes
Hi there, I'd like to understand how best to compose multilinear maps of symbolic elements in sympy
so far I've been doing it the hard way
which is to make lists of multivariate polynomials, iterating over them and substituting, then sorting
I'm still a kindergartner at tensor algebra
but I'm learning
it seems like some kind of tensor representation would be ideal for this
so the specific objects I'm interested in currently are finite k-algebras, which I'm "harvesting" from sage
the core of each finite k-algebra is its product, which is a "bilinear map" $V \times V \rightarrow V$
so in sympy, I'm representing these as lists of multivariate expressions
Micah
@micahscopes
this is a very simple way of representing these products, but when I want to compose these functions, it makes things difficult
Micah
@micahscopes
An example: say I have a (real) vector space $M$, whose vectors represent matrices in some finite dimensional real matrix algebra, and a (real) vector space $C$, whose members represent complex numbers, then I have a map $f:M \times M \rightarrow M$, the matrix algebra product, and another map $g:C\times C \rightarrow C$, the product of complex numbers.
Now, I'd like to compose these products to make a matrix algebra over the complex numbers
Micah
@micahscopes
so I know from wikipedia that formally, what I'm trying to do is some kind of tensor product... I think a "tensor product of algebras" (https://en.wikipedia.org/wiki/Tensor_product_of_algebras). but while it's easy enough to comprehend a tensor product of vector spaces, I'm still trying to understand how to apply this in sympy
Micah
@micahscopes
ahh, I'm reading now that this is also called "base change"
Kalevi Suominen
@jksuom
@micahscopes How are you planning to represent the (bilinear?) map $f: M \times M \to M$?
Bjorn
@bjodah
Micah
@micahscopes
@jksuom currently I've just been making a list of symbolic multivariate polynomial expressions. The symbols are the components of the two input vectors, E. G. f([u_1, u_2,... , u_n], [v_1, v_2,... , v_n]) would return a list of polynomials of terms from the u and v lists.


text:
# Why does freezing point decrease on adding impurities?

It is a well known fact that freezing point decreases on adding impurities. I feel that it should increase on adding impurities.

Reason: I have watched this video on supercooled water. It says that when ice forms, it needs some nucleation points. If water is pure and left undisturbed, then there would be no nucleation points and water won't freeze even below $0^o$C.

So, my reasoning is that when impurities are added, they provide additional nucleation points where water crystals can gather. This would cause water to freeze faster.

But it doesn't happen. Why?

• It depends on the "impurity." If the impurity dissolves then that is one kind of impurity. If the impurity doesn't dissolve, then it could provide nucleation sites at the freezing point of water. – MaxW Dec 15 '15 at 17:57
• The kinetics (nucleation sites) is very different from the thermodynamics (Gibbs free energy) of the situation. Whether nucleation occurs quickly or slowly does not impact whether a particular phase is thermodynamically stable. Thermodynamically, adding impurities will always reduce the melting point (enthalpy change is linear/polynomially influenced by impurity concentration, while entropy is logarithmically related). – Jon Custer Dec 15 '15 at 18:17
• In a hypothetical case that the impurity is more soluble in solid ice than in liquid, then would the freezing point increase? – Curt F. Dec 16 '15 at 2:44

No, but good question. Freezing is a thermodynamic process. Nucleation is a kinetic process.

Kinetic Explanation: At the freezing point of water, water wants to become ice (thermodynamically driven). In order for freezing to initiate and ice to form a temperature dependent minimum number of water molecules must arrange them selves in a crystal or else the particle will dissolve and no freezing will occur. Impurities or containers with rough surfaces can help arrange and hold molecules which allows freezing to occur with a fewer number of molecules.

Thermodynamic Explanation: Freezing is a thermodynamic process dictated by $\Delta G_f = 0 = \Delta H_f -T\Delta S_f$. When water freezes it must dispel the impurities to form an ice crystal (reverse mixing). Since mixing increases entropy, this means that for water to freeze the negative change in entropy ($\Delta S_f$) is larger than that of pure water. This must be compensated by a lower temperature ($T$) neglecting and differences in ethalphy. The enthalpy ($\Delta H_f$) of mixing will contribute as well to the freezing temperature of water and must be accounted for. In the case of Sodium chloride though the enthalpy mixing is positive which would favor a higher melting point, but the entropy contribution is large and magnified by the temperature such that entropy dominates and reduces the temperature of freezing.

If you look at the phase diagram of water and salt you will see that the mixing of the salt and water depresses the melting temperature due to the increased change in entropy from mixing water and salt to make brine from ice and salt.

• Nice answer. This makes sense. But is the kinetic part less dominant or is it completely irrelevant? – Yashbhatt Dec 16 '15 at 5:26
• There is a molecular process for water to become ice and the kinetic part perimts the water to undergo that process. Even if the water were to be at -30C, without the kinetic process to form ice, the water can not freeze. – A.K. Dec 16 '15 at 15:59
• So, if I were to add some salt to this water at $-30^oC$ it would freeze above that temperature, right? – Yashbhatt Dec 17 '15 at 4:59
• no it would freeze immediately as the salt surface would provide nucleation sites for freezing. – A.K. Dec 17 '15 at 10:26
• No. What I meant was that if I were to take that sample of water, heat it to normal temperature and then add salt, then would it freeze below or above $-30^0C$? – Yashbhatt Dec 18 '15 at 6:01

Think in terms of needing to remove the dissolved substance: the water that crystallizes is (fairly) pure $\ce{H2O}$, and the remainder is a concentrated solution (e.g. brine, if the solute is $\ce{NaCl}$. Work is done to separate the water from brine, so it takes more "effort" to freeze than does pure water.

There are many good explanation for the phenomenon on the web, e.g. Physics Animations.

BTW, some bacteria nucleate water freezing, such as Pseudomonas syringae. The protein from these bacteria is used in artificial snow-making. The water still has to be below 0 C to freeze, but supercools less.


text:
# Find the principal values of each of the following:

Question:

Find the principal values of each of the following:

(i) $\operatorname{cosec}^{-1}(-\sqrt{2})$

(ii) $\operatorname{cosec}^{-1}(-2)$

(iii) $\operatorname{cosec}^{-1}\left(\frac{2}{\sqrt{3}}\right)$

(iv) $\operatorname{cosec}^{-1}\left(2 \cos \frac{2 \pi}{3}\right)$

Solution:

(i) Let $\operatorname{cosec}^{-1}(-\sqrt{2})=y$

Then,

cosec $y=-\sqrt{2}$

We know that the range of the principal value branch is $\left[-\frac{\pi}{2}, \frac{\pi}{2}\right]-\{0\}$.

Thus,

$\operatorname{cosec} y=-\sqrt{2}=\operatorname{cosec}\left(-\frac{\pi}{4}\right)$

$y=-\frac{\pi}{4} \in\left[-\frac{\pi}{2}, \frac{\pi}{2}\right], y \neq 0$

Hence, the principal value of $\operatorname{cosec}^{-1}(-\sqrt{2})$ is $-\frac{\pi}{4}$.

(ii)

Let $\operatorname{cosec}^{-1}(-2)=y$

Then,

cosec $y=-2$

We know that the range of the principal value branch is $\left[-\frac{\pi}{2}, \frac{\pi}{2}\right]-\{0\}$.

Thus,

$\operatorname{cosec} y=-2=\operatorname{cosec}\left(-\frac{\pi}{6}\right)$

$y=-\frac{\pi}{6} \in\left[-\frac{\pi}{2}, \frac{\pi}{2}\right], y \neq 0$

Hence, the principal value of $\operatorname{cosec}^{-1}(-2)$ is $-\frac{\pi}{6}$.

(iii) Let $\operatorname{cosec}^{-1}\left(\frac{2}{\sqrt{3}}\right)=y$

Then,

$\operatorname{cosec} y=\frac{2}{\sqrt{3}}$

We know that the range of the principal value branch is $\left[-\frac{\pi}{2}, \frac{\pi}{2}\right]-\{0\}$.

Thus,

$\operatorname{cosec} y=\frac{2}{\sqrt{3}}=\operatorname{cosec}\left(\frac{\pi}{3}\right)$

$\Rightarrow y=\frac{\pi}{3} \in\left[-\frac{\pi}{2}, \frac{\pi}{2}\right], y \neq 0$

Hence, the principal value of $\operatorname{cosec}^{-1}\left(\frac{2}{\sqrt{3}}\right)$ is $\frac{\pi}{3}$.

(iv)

Let $\operatorname{cosec}^{-1}\left(2 \cos \frac{2 \pi}{3}\right)=y$

Then,

$\operatorname{cosec} y=2 \cos \frac{2 \pi}{3}$

We know that the range of the principal value branch is $\left[-\frac{\pi}{2}, \frac{\pi}{2}\right]-\{0\}$.

Thus,

$\operatorname{cosec} y=2 \cos \frac{2 \pi}{3}=2 \times \frac{-1}{2}=-1=\operatorname{cosec}\left(-\frac{\pi}{2}\right)$

$\Rightarrow y=-\frac{\pi}{2} \in\left[-\frac{\pi}{2}, \frac{\pi}{2}\right], y \neq 0$

Hence, the principal value of $\operatorname{cosec}^{-1}\left(2 \cos \frac{2 \pi}{3}\right)$ is $-\frac{\pi}{2}$.


text:
## Catalyst

$K = \frac{k_{forward}}{k_{reverse}}$

Frances Relampagos 1J
Posts: 9
Joined: Fri Sep 25, 2015 3:00 am

### Catalyst

How do you determine the catalyst in a multi-step reaction?

Christina Quigg 4G
Posts: 20
Joined: Fri Sep 25, 2015 3:00 am

### Re: Catalyst

In a multi-step reaction, a catalyst is something that is used up earlier in the reaction and reappears later. For example, catalysts usually appear on the reactants side of the equation first and then reappear in the products side in a later step.

Example:
A+E->G
A+B->C
C->B+D
D+E->F
F->G
In this example, B is the catalyst because it does not appear in the overall reaction and it appears in a early set before being reformed again.

I hope this helps!


text:
## Creating pgfgantt Calendars for 2013 with Excel

The pgfgantt package is a great tool to create Gantt charts, that are quite useful in the management of projects since one can visualize task dependencies with their help.

To get to know this package a little better I have –with the help of stackexchange— created a calendar for 2013 (PDF), showing the 365 days with SAT & SUN highlighted.

To add an entry to the calendar however I need to calculate the number of the day for the start and end date — a task Excel is quite good at. I played a little and finally came up with an Excel file that allows me to enter the start and end dates plus the name of the Gantt-bar and puts then together the string for the Gantt-bar.

The first columns are pretty self-explaining, the „description“ column is not exported to the LaTeX code. All the magic happens in the final column, let’s look at some example (Excel file):

 ="\ganttbar" & WENN([@Color]<>"";"[bar/.style={fill=" & [@Color] &"}]";) &"{" &[Name] & "}{"& C3-41274&"}{"&D3-41274&"}" & WENN([@Name]=B4;"";"\\")

It is basically just a concatenation of strings with some IF („WENN“ in German) and date calculation. The first WENN is used to determine if the color has been set. If it is set, some brackets need to be printed with the bar/fill stuff. The Name of the bar is printed, then I calculate the differences from the first date and the number 41274 (corresponds to Deember 31st in Excel number format) and the second date and the number 41274. Since I can have more than one bar in one line I check if the line below has the same name. If it has, no „\\“ shall be printed, if it is different I want to finish this line. I can then copy the generated code directly into my LaTeX file:

\documentclass{article} \usepackage[paperwidth=160cm, paperheight=50cm, left=1cm,right=1cm,top=5cm,bottom=5cm]{geometry} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{pgfgantt} \usetikzlibrary{calendar}   \protected\def\zzz#1{% \pgfcalendarifdate{2012-12-31+#1}{weekend}% Test if it's a weekend {\textcolor{red}{\pgfcalendarifdateday}}% Typeset with red color {\pgfcalendarifdateday}% Or just the number }   \begin{document}   \begin{ganttchart}[hgrid, vgrid, x unit=0.425cm]{365} \gantttitle{Projektplan}{365} \\ \gantttitlelist[ title list options={var=\y, evaluate=\y as \x using {"\zzz{\y}"}} ]{1,...,365}{1} \\ \ganttbar[bar/.style={fill=yellow}]{public holiday}{8}{8}\\ \ganttbar{some conference}{65}{67}\\ \ganttbar[bar/.style={fill=blue}]{some date}{36}{49} \ganttbar[bar/.style={fill=green}]{some date}{51}{55}\\ \end{ganttchart}   \end{document}

Deutsche Zusammenfassung: Die Erstellung von Einträgen für pgfgantt-basierte Kalender kann man deutlich vereinfachen, wenn man in einer Excel-Datei die notwendigen Informationen zusammenbaut.

### Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.


text:
# Lab 4: Gas Chromatography

Gas chromatography is a physical method of separation in which the components to be separated are distributed between two phases, one being a stationary bed of large surface area, and the other a gas that percolates through the stationary bed. When the stationary phase is a solid, the separation process is more precisely called gas-solid chromatography.

### Introduction

This technique is generally used to separate gases in a gaseous solution. The more common technique is gas-liquid chromatography in which the stationary phase is a porous solid covered with an absorbing liquid. Gas-liquid chromatography or GLC is used to separate a wide variety of organic compounds. The basic requirements for GLC are that the sample be volatile and that it not decompose in the vaporization process. Since the vaporization occurs in an inert atmosphere, decomposition of the sample is generally not a problem.

A basic chromatograph consists of the following:

1. A sample port or injector for introduction and vaporization of the sample
2. A separating column, consisting of metal tubing packed with a solid material coated with a stationary absorbing liquid
3. A carrier gas, usually N2 or He, to sweep the sample through the column
4. Flow control equipment to maintain a constant flow of carrier gas through the column
5. The detector for measuring the quantity of a separated component
6. Ovens and heaters for temperature control of the column, detector and injector
7. An integrator or integrator/strip chart recorder combination to provide permanent record of the analysis

Separation of a mixture into its components depends on the solubility differences of the sample vapor in a liquid (stationary phase). The stationary phase is coated in a thin layer on solid particles (solid support) of large surface area and then packed uniformly into a column. A constant flow of an inert carrier gas passes through the column and transports solute molecules in the gas phase. The column is enclosed by an oven for precise temperature control.

A sample of the analyte is introduced by syringe injection into the heated injector tube, where it is vaporized and mixed with the carrier gas. As the sample vapor/carrier gas mixture flows onto the column, the analyte partitions between the gas and liquid phases according to the analyte component's solubility in the liquid at the column operating temperature. This equilibrium partitioning continues as the sample is moved through the column by the carrier gas. The rate at which the sample travels through the column is determined by the sample solubility in the stationary phase, the carrier gas flow rate, and the temperature gradient (temperature program) applied. Each component travels at a characteristic rate, and if the column has sufficient length and resolving power, the sample will be completely separated by the time it reaches the detector.

The Thermal Conductivity Detector (TCD), located at the column exit, senses any change in the physical or chemical properties of the column effluent compared to the reference column effluent. The deflection from the baseline observed indicates the presence and concentration of a component, but does not identify it. A detailed description of how the TCD works can be found in section 27-B4 of your text, Principles of Instrumental Analysis.

Each component is identified by comparing its "retention time", the length of time that it remains in the column, to that of a standard. The retention time of a vapor depends on the column temperature limits and ramp rate, the column length, type of stationary phase, and carrier gas velocity. If these variables are kept constant, the retention time of a component will remain constant, and therefore a component may be tentatively identified by the measurement of its retention time which is compared to the retention time of a known standard run under identical operating conditions.

Retention time is reported on the processed data file print out following the chromatogram on the integrator chart. The sample components are represented as peaks on the chromatogram. The detector produces an electrical output that is proportional to vapor concentration which results in pen deflection on the integrator chart recorder. The chart paper on the integrator moves at a constant speed, providing a plot of time versus the composition of the column effluent. The distance between two successive peaks is a measure of the difference in retention time of the analyte components.

If the response of the detector is linear, the area under a peak accurately represents the quantity of the component present. If it is not, calibration for detector response to the types of components expected to be in the analyte yields a set of response factors that convert the reported area percentages to quantitative weight percentages. This is necessary for TCD use. The flame ionization detector (FID), (see McNair and Bonelli) has a linear response to a homologous series of components but also requires response factors for accurate quantitation when different types of components are present.

For a given gas chromatography column, the Van Deemter theory is useful for determining the flow rate which gives optimum efficiency at a given column temperature for a particular compound. The Van Deemter equation is

$HETP = A + \dfrac{B}{v} + C_v \; \; (1)$

where A, B, and C are constants and v is the carrier gas flow rate. HETP is the "height equivalent to a theoretical plate", and results from the treatment of gas chromatographic separations in terms of repeated equilibrations between a moving and a stationary phase. HETP for a particular gas flow rate is calculated from the total number of theoretical plates (N) and column length (L), i.e.

$HETP = \dfrac{L}{N} \; \; (2)$

where

$N = 16 \left( \dfrac{t_r}{w} \right)^2 \label{3}$

where tr is the retention of the component and w is the width of the elution peak at its base. The first term in the Van Deemter equation accounts for eddy diffusion, the second term accounts for molecular diffusion, and the third term accounts for non equilibrium effects due to flow of the mobile phase. For a particular column at constant temperature, the optimum carrier gas flow rate is that for which the HETP is a minimum. By measuring the HETP at several linear gas velocities (flow rates), the parameters A, B, and C in Equation $$\ref{1}$$ can be determined and the optimum velocity defined.

If the sample contains materials with a wide range of boiling points, separation of all components isothermally is not practical. When the column is operated at low temperatures, the more volatile components will be distributed between the gas and liquid phases and will pass rapidly through the column giving sharp well resolved peaks. The high boiling components, however, will remain dissolved in the stationary phase and will be eluted very slowly, if at all. Since the vapor pressure of the latter solutes is low, partitioning will occur over a large bands of stationary phase resulting in broad poorly resolved peaks.

If the column is operated at a temperature that gives well defined peaks for the less volatile components, the low boiling fraction will pass through the column with very little partitioning into the liquid phase. As a result, it will appear as one or two sharp yet poorly resolved peaks, often with retention volumes approaching the dead space of the column.

Although temperature programming will not be performed in this laboratory, it is a useful feature that allows all the compounds to be eluted at temperatures approximating the ideal temperature for separation from adjacent solutes. By employing a low initial temperature, the low boiling components will be distributed between both phases in the column and will appear at the detector as sharp, well-resolved bands. The higher boiling fractions will remain 'frozen' at the injection point. As the column temperature is raised, the vapor pressure of the less volatile components will increase and they will distribute themselves between the two phases and, as a result, move down as well-defined bands, eluting at characteristic temperatures. By careful choice of the temperature ramp rate and carrier gas flow rate, each component can be eluted at a temperature approximating the optimum for separation from adjacent solutes. Although the resolution of closely spaced peaks cannot be improved over that obtained at a single optimum temperature, the resolution of widely spaced peaks can be improved considerably.

### The Instrumentation

The instrument used in this experiment is an Agilent 6890N gas chromatograph equipped with with an Automatic Liquid Sampler (ALS) that will allow the injection to be controled by automation through the software. Inside the GC oven in position #2 is a high efficiency J&W CP-Sil 5 CB fused silica column containing a 100% dimethylpolysiloxane phase. This 15 m column has an 0.25 mm internal diameter and with a 0.25 µm thick internal coating. PLEASE, Do not use the front column.

Temperature control for the injector, detector, and column is set through software. You will only need to change the column temperature for this experiment. The flow is built into the method and is included in the method name. Do not edit or alter a method’s flow rate, instead switch methods and choose a method with flow rate desired. Pressing ‘status’ button on GC front panel will indicate flow rates and other instrument equilibrium activities like temperature and flame status.

### Experimental

#### 1. Isothermal Gas Chromatography of an Homologous Series

Run an isothermal (100 °C) gas chromatogram of each of the C6 to C11 n-alkanes (2-3 uL sample) at varying flow rates. Make sure ALS in above port 2. Record carefully the retention time of each compound.

Plot log r vs carbon number and log r vs boiling point of the n-alkanes. (Why use log r?) (Be sure to look up the boiling points before you do the experiment). Which plot provides the best straight-line relationship?

Run a GC of 2,2,4-trimethylpentane under the same conditions. Compare its retention time and boiling point with n-octane. On the basis of boiling point data, predict retention times for the two other isomers in this series - 2,2-dimethylhexane and 2-methylheptane. Comment on whether these would or would not be expected to resolve using the instrument settings in this section.

#### 2. Effects of Column Temperature

Do a combined injection (see your TA for the technique) of C7, C9, C11 and C6, C8, C10 mixture at 60, 100, and 140°C.

Discuss the expected and observed effects that temperature has on gas chromatographic behavior. Is one temperature suitable for separation of this mixture?

For each component plot log r vs 1/T where T is temperature in K. Briefly discuss this plot.

#### 3. Effects of Carrier Gas Flow Rate

In this experiment you will investigate the effect of the gas flow rate on the retention time. Run isothermal chromatograms of n-heptane at flow rates of (approximately) 1.0, 1.5 and 2.0 mL/min (you need not get these values exactly but you must know the flow rate precisely. Use the temperature that gave you the best resolution of all 5 alkanes determined in parts 1 and 2). In each case calculate N and HETP. Tabulate and plot your results. Also run n-hexane at flow rates of 2.0 and 4.0 mL/min and measure N and HETP as before.  Ask your TA or Paul for help if you have any questions.

#### 4. The Unknown

In parts 1-3 of this experiment you determined the optimum conditions for the separation of the C6-C11n-alkanes. Now use these conditions to identify the unknown mixture of these alkanes. Run your C6-C11 n-alkane standards under your best conditions. You can run them in 2 or 3 batches as mixtures.  Then run the unknown sample under the same conditions. Identify the components of the unknown mixture by comparison with the standards.

### References

1. H. M. McNair and E. J. Bonelli, "Basic Gas Chromatography", Varian Instruments, Palo Alto, CA., March 1969, pp. 91-99.
2. D.A. Skoog, F.J. Holler and T.A. Nieman, "Principles of Instrumental Analysis, Fifth Edition", Harcourt Brace and Company, Philadelphia, PA, 1998, pp 701- 724.


text:
The Community for Technology Leaders

# Guest Editors' Introduction: Special Section on Computer Arithmetic

Javier Bruguera, IEEE
Marius Cornea, IEEE
Debjit Das Sarma, IEEE

Pages: pp. 145-147

COMPUTATION is as old as recorded human history. Even floating-point computation can be traced back that long: Sumerian and then Babylonian sexagesimal numbers of more than 4000 years ago did not show trailing zeros, and could thus be considered floating-point values with just the significand represented explicitly and the exponent inferred from the context. The word “computation” itself comes from Latin (computare), and is more than 2000 years old.

Computer Arithmetic is one of the first subfields of Computer Architecture. It has evolved considerably since the early days of modern computers 40 or 50 years ago, when arithmetic-logic units (ALUs) processed only integer numbers and represented a significant fraction of a CPU's hardware. Floating-point arithmetic was added later and gradually, first according to rules established by each manufacturer. A major milestone was represented by the adoption of the IEEE Standard 754-1985 for Floating-Point Arithmetic.

For almost four decades now, many of the best ideas in computer arithmetic have been presented at, and recorded in the proceedings of the IEEE Symposia on Computer Arithmetic, more commonly known as the ARITH Conferences. A total of 19 ARITH conferences have taken place so far, alternating every two years between Europe and the United States, with one exception (ARITH 14, which was held in Australia). It has also become a tradition lately to dedicate a special section of the Transactions on Computers to Computer Arithmetic following each conference.

In the beginning, ARITH conferences were focused on studies and innovations concerning hardware and software designs and algorithms for integer and floating-point calculations. The latter was initially aimed mostly at scientific and engineering applications, but in recent years multimedia and graphics applications increased in importance as well. Because of the compute-intensive nature of encryption/decryption algorithms, cryptography has emerged as a distinct focus area of computer arithmetic as well.

While there are still advances to be made in integer arithmetic, most of the computer arithmetic research today is in the floating-point domain. A catalyst in this direction was and still is the IEEE Standard 754-2008 for Floating-Point Arithmetic, which replaced the old IEEE 754-1985 after a lengthy revision process. Another important factor that influences computer arithmetic research is the extraordinary increase in performance and complexity of processors that we are witnessing today, and will for the foreseeable future. Multi-core CPUs, many-core CPUs, multiple floating-point units, vector floating-point units, the need to lower cost and power while increasing performance and maintaining simplicity and programmability are all placing constraints on today's computer architecture solutions.

Efficient computer arithmetic algorithms, fast implementations, reliable designs utilizing the best-suited number systems and representations, thorough verification and validation, are all necessary for any modern computing device. The computer arithmetic field remains a fertile and interesting area for research and innovation. The present issue of the Transactions on Computers is proof of this fact.

This special section hosts 11 high quality research papers in computer arithmetic. They are the result of a selection from more than 50 submitted manuscripts, in response to an open call for papers that followed the 19th IEEE International Symposium on Computer Arithmetic which took place in Portland, Oregon in June 2009. The papers selected through a peer review process represent a wide range of the topics, and all received positive evaluations from expert referees. The papers in this special section are grouped into three categories: Basic Arithmetic Operations and Number Systems; Polynomial Evaluation and Elementary Functions; and Cryptography.

Basic Arithmetic Operations and Number Systems. The first paper from this category is “Reducing the Computation Time in (Short Bit-Width) Two's Complement Multipliers”, authored by Fabrizio Lamberti, Nikos Andrikos, Elisardo Antelo, and Paolo Montuschi. The authors present a technique to reduce the maximum height of the modified booth encoder-generated radix-4 partial product array by one, without increasing the delay of the partial product generation stage. This may allow for a faster compression of the partial product array and regular layouts, a technique of particular interest in all multiplier designs, but especially in short bit-width two's complement multipliers for high-performance embedded cores.

The second paper is “Exact and Approximated Error of the FMA”, by Sylvie Boldo and Jean-Michel Muller. The fused multiply-add operation (FMA), was introduced in the IEEE Standard 754-2008 for Floating-Point Arithmetic. The paper is an extension of earlier work on the computation of the exact error of the FMA, now based on more general conditions, and providing a formal proof. A new algorithm is also presented, that computes an approximation as well as bounds to the error of an FMA.

The third paper is “Improved Division by Invariant Integers”, by Niels Möller and Torbjörn Granlund. The problem of dividing a two-word integer by a single-word integer is solved as a multiplication using a pre-computed single-word approximation of the reciprocal of the divisor, followed by a couple of adjustment steps, all while using cheaper multiplication operations than before. The algorithm gives a speedup of roughly 30 percent on AMD and Intel processors in the x86_64 family.

The fourth paper of this group is “Simulation-Based Verification of Floating-Point Division”, by Elena Guralnik, Merav Aharoni, Ariel J. Birnbaum, and Anatoly Koyfman. The authors present a simulation-based method for verification of division - an operation with an exceptionally wide array of corner cases. FPgen, a test generation framework targeted at the floating-point datapath was created and has been successfully used in the verification of a variety of hardware designs. The relevant verification tasks supplied with FPgen and the underlying algorithms used to target them are presented.

The fifth paper is “Area-Efficient Multipliers Based on Multiple-Radix Representations”, authored by Vassil S. Dimitrov, Kimmo U. Järvinen, and Jithra Adikari. New algorithms for integer multiplication are introduced, that are based on a specific multiple-radix representation of one of the multiplicands. Theoretical analysis and experimental results are provided for such multipliers in the 0.18 m CMOS technology, showing the advantages of the new method in 64-bit hardware implementations - better area and power consumption compared to reference multipliers.

The sixth and last paper of this set is “A Real/Complex Logarithmic Number System ALU”, by Mark G. Arnold and Sylvain Collange. The paper shows how to reuse the real Logarithmic Number System (LNS) hardware for the complex CLNS (which represents complex values in log-polar form), with specialized hardware, including a novel logsin that overcomes singularity problems and is smaller than the real-valued LNS ALU to which it is attached. FPGA synthesis shows the new CLNS ALU is smaller than prior fast CLNS units. Accuracy trade-offs are also considered.

Polynomial Evaluation and Elementary Functions. The first paper of this group is “Computing Floating-Point Square Roots via Bivariate Polynomial Evaluation”, by Claude-Pierre Jeannerod, Hervé Knochel, Christophe Monat, and Guillaume Revy. The authors show how to reduce the computation of correctly rounded square roots of binary floating-point values to fixed-point evaluation of some particular integer polynomials in two variables. This leads to high instruction-level parallelism and potentially low-latency implementations. Experiments carried out on an integer processor (ST231) demonstrated low latency, as expected.

The second paper of this group is “Midpoints and Exact Points of Some Algebraic Functions in Floating-Point Arithmetic”, by Claude-Pierre Jeannerod, Nicolas Louvet, Jean-Michel Muller, and Adrien Panhaleux. When implementing a function $\bf f$ in floating-point arithmetic with correct IEEE rounding and good performance, it is important to know if there are input floating-point values $\bf x$ such that $\bf f(x)$ is either the middle of the interval between two consecutive floating-point numbers, or a floating-point number. The paper proves whether or not there are such midpoints or exact points, for some usual algebraic functions and for various floating-point formats. The points are listed or characterized whenever possible. The results and techniques presented can be used with both the binary and the decimal formats defined in the IEEE Standard 754-2008 for floating-point arithmetic.

The third and last paper of the group is “Certifying the Floating-Point Implementation of an Elementary Function Using Gappa”, by Florent de Dinechin, Christoph Lauter, and Guillaume Melquiond. Certifying floating-point programs by hand is tedious and error-prone. The paper presents the Gappa tool, a proof assistant designed to make this task easier and more secure by automating the evaluation of rounding errors using interval arithmetic. Its input format is very close to the actual code that needs to be validated. It generates a formal proof of the results, which can be checked independently by a lower level proof assistant such as Coq. Examples are chosen from a widely used class of floating-point programs - elementary functions in a mathematical library.

Cryptography. The first paper from this last category is “Hybrid Binary-Ternary Number System for Elliptic Curve Cryptosystems“, by Jithra Adikari, Vassil S. Dimitrov, and Laurent Imbert. Single and double scalar multiplications are the most computational intensive operations in elliptic-curve-based cryptosystems. The hybrid binary-ternary number system provides both short representations and small density. The authors present three novel algorithms for both single and double scalar multiplication. A detailed theoretical analysis is provided, together with timings and fair comparisons over both tripling-oriented Doche-Ichart-Kohel curves and generic Weierstrass curves. Experiments show that the new algorithms are almost always faster than their widely used counterparts.

The second paper of this group and also the closing one of the special section on Computer Arithmetic is “Fast Architectures for the $\eta$ T Pairing over Small-Characteristic Supersingular Elliptic Curves”, by Jean-Luc Beuchat, Jérémie Detrey, Nicolas Estibals, Eiji Okamoto, and Francisco Rodríguez-Henríquez. The paper is devoted to the design of fast parallel accelerators for the cryptographic $\eta$ T pairing on supersingular elliptic curves over finite fields of characteristics two and three. A novel hardware implementation of Miller's algorithm is proposed, based on a parallel pipelined Karatsuba multiplier. The authors present the careful choice of algorithms for the tower field arithmetic associated with the $\eta$ T pairing. A final exponentiation is still required to obtain a unique value, and the pairing accelerators are supplemented with a coprocessor responsible for this task. According to place-and-route results on Xilinx FPGAs, these designs improve both the computation time and the area-time trade-off compared to previous coprocessors.

Javier Bruguera

Marius Cornea

Debjit Das Sarma

Guest Editors

## About the Authors

Javier Bruguera received the graduated degree and the PhD degree in physics from the University of Santiago de Compostela, Spain in 1984 and 1989, respectively. Currently, he is a professor in the Department of Electronics and Computer Science at the University of Santiago de Compostela. Previously, he was an assistant professor at the University of Oviedo, Spain, from 1984 to 1986, and an assistant professor at the University of A Corunna, Spain, from 1996 to 1990. In 1990, he joined the Department of Electronic and Computer Science at the University of Santiago de Compostela, as an associate professor from 1990 to 1997 and a full professor since 1997. Dr. Bruguera has been serving as chair of the department between November 2006 and November 2010. He was a research visitor in the Application Center of Microelectronics at Siemens, Munich, Germany, in 1993, for five months, and in the Department of Electrical Engineering and Computer Science at the University of California, Irvine, from October 1993 to December 1994, and several more times between 1997 and 2004, for shorter periods of time. His primary research interests are in the area of computer arithmetic, processor design, digital design for signal and image processing and computer architecture. He is author/coauthor of nearly 150 research papers published in journals or presented at conferences. Dr. Bruguera has served on program committees for several IEEE, and other meetings; in particular he has been in the program Committee of the IEEE Symposium on Computer Arithmetic (ARITH) since 2003, program cochair of the ARITH19 in 2009 and local arrangements and financial chair of the ARITH16 in 2003. He also has been program chair of the eighth Real Numbers and Computers Conference in 2008 and local program chair of the Europar 2008. Dr. Bruguera is member of the IEEE, the IEEE Computer Society and ACM.
Marius Cornea received a MSc degree in Electrical Engineering from the Polytechnic Institute of Cluj, Romania and a PhD degree in Computer Science from Purdue University in West Lafayette, Indiana. He joined Intel Corporation in 1994, and is now a principal engineer and leader of a team of engineers and mathematicians architecting mathematical libraries and floating-point software for Intel® Architecture processors. His work has spanned many aspects of scientific computation, design and development of numerical algorithms, floating-point emulation, exception handling, and also definition and analysis of new floating-point instructions. He has published numerous papers, including some in computer arithmetic, and holds several US patents. He was a program committee member for recent ARITH conferences, and program cochair of the 19th IEEE Symposium of Computer Arithmetic held in Portland, Oregon in 2009. He is also one of the coauthors of the IEEE Standard 754-2008 for Floating-Point Arithmetic. He is a member of the IEEE.
Debjit Das Sarma received the BS degree in computer science and engineering from Jadavpur University, Kolkata, India, in 1988, and MS and PhD degrees in computer science and engineering from Southern Methodist University, Dallas, Texas, in 1990 and 1995, respectively. Currently he is a Fellow at Advanced Micro Devices (AMD) in Sunnyvale, California. He is a lead architect there, responsible for the micro-architecture and design of AMD x86 processor cores. He was previously the lead architect of the Floating Point and Multimedia units of various AMD processors. He has been involved in microprocessor architecture and design for the last eighteen years, including the last ten years at AMD, and had worked at Texas Instruments and Cyrix Corporation prior to joining AMD. He has a number of patents in the area of microprocessor core and arithmetic unit design. Dr. Das Sarma has contributed significantly in the research in the area of computer arithmetic. He has published a number of papers in prestigious conference proceedings and journals, including IEEE Symposia on Computer Arithmetic and IEEE Transactions on Computers. He has attended all IEEE Computer Arithmetic meetings since 1993, and has served on the program committee for the 14th, 17th, 18th, and 19th symposiums. He also served as the program cochair for the 19th IEEE Symposium on Computer Arithmetic held in Portland, May 2009. His other professional activities include participation in several panel discussions, and as referee for many journals and conferences. Dr. Das Sarma was recently honored as one of the five distinguished alumni in the last 40 years by the Computer Science and Engineering Department of his Alma mater, Southern Methodist University. He is a member of the IEEE.