text:
• ### Measurement of the decay $\eta^{\prime}\to\pi^{0}\pi^{0}\eta$ at MAMI(1709.04230)

June 16, 2018 hep-ex
An experimental study of the $\eta'\to \pi^0\pi^0\eta \to 6\gamma$ decay has been conducted with the best up-to-date statistical accuracy, by measuring $\eta'$ mesons produced in the $\gamma p \to \eta' p$ reaction with the A2 tagged-photon facility at the Mainz Microtron, MAMI. The results obtained for the standard parametrization of the $\eta'\to \pi^0\pi^0\eta$ matrix element are consistent with the most recent results for $\eta'\to\pi\pi\eta$ decays, but have smaller uncertainties. The available statistics and experimental resolution allowed, for the first time, an observation of a structure below the $\pi^+\pi^-$ mass threshold, the magnitude and sign of which, checked within the framework of the nonrelativistic effective-field theory, demonstrated good agreement with the cusp that was predicted based on the $\pi\pi$ scattering length combination, $a_0-a_2$, extracted from $K \to 3\pi$ decays.
• ### High-statistics measurement of the eta->3pi^0 decay at MAMI(1803.02502)

March 7, 2018 hep-ex, nucl-ex
The largest, at the moment, statistics of 7x10^6 eta->3pi^0 decays, based on 6.2x10^7 eta mesons produced in the gamma p -> eta p reaction, has been accumulated by the A2 Collaboration at the Mainz Microtron, MAMI. It allowed a detailed study of the eta->3pi^0 dynamics beyond its conventional parametrization with just the quadratic slope parameter alpha and enabled, for the first time, a measurement of the second-order term and a better understanding of the cusp structure in the neutral decay. The present data are also compared to recent theoretical calculations that predict a nonlinear dependence along the quadratic distance from the Dalitz-plot center.
• ### Measurement of the omega -> pi^0 e^+e^- and eta -> e^+e^-g Dalitz decays with the A2 setup at MAMI(1609.04503)

April 24, 2017 hep-ex, nucl-ex
The Dalitz decays eta -> e^+e^-g and omega -> pi^0 e^+e^- have been measured in the g p -> eta p and g p -> omega p reactions, respectively, with the A2 tagged-photon facility at the Mainz Microtron, MAMI. The value obtained for the slope parameter of the electromagnetic transition form factor of eta, Lambda^{-2}_eta=(1.97+/-0.11_tot) GeV^{-2}, is in good agreement with previous measurements of the eta -> e^+e^-g and eta -> mu^+mu^-g decays. The uncertainty obtained in the value of Lambda^{-2}_eta is lower than in previous results based on the eta -> e^+e^-g decay. The value obtained for the omega slope parameter, Lambda^{-2}_omega_pi^0 = (1.99+/-0.21_tot) GeV^{-2}, is somewhat lower than previous measurements based on omega -> pi^0 mu^+mu^-, but the results for the omega transition form factor are in better agreement with theoretical calculations, compared to earlier experiments.
• ### Measurement of the pi^0 -> e^+e^-gamma Dalitz decay at the Mainz Microtron(1611.04739)

Feb. 18, 2017 hep-ex, nucl-ex
The Dalitz decay pi^0 -> e^+e^-gamma has been measured in the gamma p -> pi^0 p reaction with the A2 tagged-photon facility at the Mainz Microtron, MAMI. The value obtained for the slope parameter of the pi^0 electromagnetic transition form factor, a_pi = 0.030+/-0.010_tot, is in agreement with existing measurements of this decay and with recent theoretical calculations. The uncertainty obtained in the value of a_pi is lower than in previous results based on the pi^0 -> e^+e^-gamma decay.
• ### Measurement of the $p(e,e'\pi^+)n$ reaction close to threshold and at low $Q^2$(1606.00970)

Jan. 23, 2017 nucl-ex
The cross section of the $p(e,e'\pi^+)n$ reaction has been measured for five kinematic settings at an invariant mass of $W = 1094$ MeV and for a four-momentum transfer of $Q^2 = 0.078$ (GeV/$c$)$^2$. The measurement has been performed at MAMI using a new short-orbit spectrometer (SOS) of the A1 collaboration, intended for detection of low-energy pions. The transverse and longitudinal cross section terms were separated using the Rosenbluth method and the transverse-longitudinal interference term has been determined from the left-right asymmetry. The experimental cross section terms are compared with the calculations of three models: DMT2001, MAID2007 and $\chi$MAID. The results show that we do not yet understand the dynamics of the fundamental pion.
• ### Determination of the scalar polarizabilities of the proton using beam asymmetry $\Sigma_{3}$ in Compton scattering(1611.03769)

Jan. 10, 2017 nucl-ex
The scalar dipole polarizabilities, $\alpha_{E1}$ and $\beta_{M1}$, are fundamental properties related to the internal dynamics of the nucleon. The currently accepted values of the proton polarizabilities were determined by fitting to unpolarized proton Compton scattering cross section data. The measurement of the beam asymmetry $\Sigma_{3}$ in a certain kinematical range provides an alternative approach to the extraction of the scalar polarizabilities. At the Mainz Microtron (MAMI) the beam asymmetry was measured for Compton scattering below pion photoproduction threshold for the first time. The results are compared with model calculations and the influence of the experimental data on the extraction of the scalar polarizabilities is determined.
• ### Study of $\eta$ and $\eta'$ photoproduction at MAMI(1701.04809)

Jan. 2, 2017 hep-ph, hep-ex, nucl-ex
The reactions $\gamma p\to \eta p$ and $\gamma p\to \eta' p$ have been measured from their thresholds up to the center-of-mass energy $W=1.96$GeV with the tagged-photon facilities at the Mainz Microtron, MAMI. Differential cross sections were obtained with unprecedented accuracy, providing fine energy binning and full production-angle coverage. A strong cusp is observed in the total cross section and excitation functions for $\eta$ photoproduction at the energies in vicinity of the $\eta'$ threshold, $W=1896$MeV ($E_\gamma=1447$MeV). This behavior is explained in a revised $\eta$MAID isobar model by a significant branching of the $N(1895)1/2^-$ nucleon resonance to both, $\eta p$ and $\eta' p$, confirming the existence and constraining the properties of this poorly known state.
• ### First measurement of proton's charge form factor at very low $Q^2$ with initial state radiation(1612.06707)

Dec. 20, 2016 hep-ex, nucl-ex
We report on a new experimental method based on initial-state radiation (ISR) in e-p scattering, in which the radiative tail of the elastic e-p peak contains information on the proton charge form factor ($G_E^p$) at extremely small $Q^2$. The ISR technique was validated in a dedicated experiment using the spectrometers of the A1-Collaboration at the Mainz Microtron (MAMI). This provided first measurements of $G_E^p$ for $0.001\leq Q^2\leq 0.004 (GeV/c)^2$.
• ### Polarization-transfer measurement to a large-virtuality bound proton in the deuteron(1602.06104)

Feb. 19, 2016 nucl-ex
Possible differences between free and bound protons may be observed in the ratio of polarization-transfer components, $P'_x/P'_z$. We report the measurement of $P'_x/P'_z$, in the $^2\textrm{H}(\vec{e},e^{\prime}\vec{p})n$ reaction at low and high missing momenta. Observed increasing deviation of $P'_x/P'_z$ from that of a free proton as a function of the virtuality, similar to that observed in \hefour, indicates that the effect in nuclei is due to the virtuality of the knock-out proton and not due to the average nuclear density. The measured differences from calculations assuming free-proton form factors ($\sim10\%$), may indicate in-medium modifications.
• ### Measurement of pi^0 photoproduction on the proton at MAMI C(1506.08849)

Aug. 20, 2015 hep-ex, nucl-ex
Differential cross sections for the gamma p -> pi^0 p reaction have been measured with the A2 tagged-photon facilities at the Mainz Microtron, MAMI C, up to the center-of-mass energy W=1.9 GeV. The new results, obtained with a fine energy and angular binning, increase the existing quantity of pi^0 photoproduction data by ~47%. Owing to the unprecedented statistical accuracy and the full angular coverage, the results are sensitive to high partial-wave amplitudes. This is demonstrated by the decomposition of the differential cross sections in terms of Legendre polynomials and by further comparison to model predictions. A new solution of the SAID partial-wave analysis obtained after adding the new data into the fit is presented.
• ### Measurements of Double-Polarized Compton Scattering Asymmetries and Extraction of the Proton Spin Polarizabilities(1408.1576)

March 20, 2015 nucl-ex
The spin polarizabilities of the nucleon describe how the spin of the nucleon responds to an incident polarized photon. The most model-independent way to measure the nucleon spin polarizabilities is through polarized Compton scattering. Double-polarized Compton scattering asymmetries on the proton were measured in the $\Delta(1232)$ region using circularly polarized incident photons and a transversely polarized proton target at the Mainz Microtron. Fits to asymmetry data were performed using a dispersion model calculation and a baryon chiral perturbation theory calculation, and a separation of all four proton spin polarizabilities in the multipole basis was achieved. The analysis based on a dispersion model calculation yields $\gamma_{E1E1} = -3.5 \pm 1.2$, $\gamma_{M1M1}= 3.16 \pm 0.85$, $\gamma_{E1M2} = -0.7 \pm 1.2$, and $\gamma_{M1E2} = 1.99 \pm 0.29$, in units of $10^{-4}$ fm$^4$.
• ### A new measurement of the neutron detection efficiency for the NaI Crystal Ball detector(1502.07317)

Feb. 25, 2015 hep-ex, nucl-ex, physics.ins-det
We report on a measurement of the neutron detection efficiency in NaI crystals in the Crystal Ball detector obtained from a study of single p0 photoproduction on deuterium using the tagged photon beam at the Mainz Microtron. The results were obtained up to a neutron energy of 400 MeV. They are compared to previous measurements made more than 15 years ago at the pion beam at the BNL AGS.
• ### The electric and magnetic form factors of the proton(1307.6227)

July 29, 2014 nucl-ex
The paper describes a precise measurement of electron scattering off the proton at momentum transfers of $0.003 \lesssim Q^2 \lesssim 1$\ GeV$^2$. The average point-to-point error of the cross sections in this experiment is $\sim$ 0.37%. These data are used for a coherent new analysis together with all world data of unpolarized and polarized electron scattering from the very smallest to the highest momentum transfers so far measured. The extracted electric and magnetic form factors provide new insight into their exact shape, deviating from the classical dipole form, and of structure on top of this gross shape. The data reaching very low $Q^2$ values are used for a new determination of the electric and magnetic radii. An empirical determination of the Two-Photon-Exchange (TPE) correction is presented. The implications of this correction on the radii and the question of a directly visible signal of the pion cloud are addressed.
• ### Search for light massive gauge bosons as an explanation of the $(g-2)_\mu$ anomaly at MAMI(1404.5502)

April 22, 2014 hep-ex, nucl-ex
A massive, but light abelian U(1) gauge boson is a well motivated possible signature of physics beyond the Standard Model of particle physics. In this paper, the search for the signal of such a U(1) gauge boson in electron-positron pair-production at the spectrometer setup of the A1 Collaboration at the Mainz Microtron (MAMI) is described. Exclusion limits in the mass range of 40 MeV up to 300 MeV with a sensitivity in the mixing parameter of down to $\epsilon^2 = 8\times 10^{-7}$ are presented. A large fraction of the parameter space has been excluded where the discrepancy of the measured anomalous magnetic moment of the muon with theory might be explained by an additional U(1) gauge boson.
• ### Measurement of the neutron electric to magnetic form factor ratio at Q2 = 1.58 GeV2 using the reaction 3He(e,e'n)pp(1307.7361)

Aug. 29, 2013 nucl-ex
A measurement of beam helicity asymmetries in the reaction 3He(e,e'n)pp has been performed at the Mainz Microtron in quasielastic kinematics in order to determine the electric to magnetic form factor ratio of the neutron, GEn/GMn, at a four momentum transfer Q2 = 1.58 GeV2. Longitudinally polarized electrons were scattered on a highly polarized 3He gas target. The scattered electrons were detected with a high-resolution magnetic spectrometer, and the ejected neutrons with a dedicated neutron detector composed of scintillator bars. To reduce systematic errors data were taken for four different target polarization orientations allowing the determination of GEn/GMn from a double ratio. We find mu_n GEn/GMn = 0.250 +/- 0.058(stat.) +/- 0.017 (sys.).
• ### Accurate Test of Chiral Dynamics in the \boldmath$\vec{\gamma} p \rightarrow \pi^0p$ Reaction(1211.5495)

Aug. 12, 2013 nucl-ex
A precision measurement of the differential cross sections $d\sigma/d\Omega$ and the linearly polarized photon asymmetry $\Sigma \equiv (d\sigma_\perp - d\sigma_\parallel) \slash (d\sigma_\perp + d\sigma_\parallel)$ for the $\vec{\gamma} p \rightarrow \pi^0p$ reaction in the near-threshold region has been performed with a tagged photon beam and almost $4\pi$ detector at the Mainz Microtron. The Glasgow-Mainz photon tagging facility along with the Crystal Ball/TAPS multi-photon detector system and a cryogenic liquid hydrogen target were used. These data allowed for a precise determination of the energy dependence of the real parts of the $S$- and all three $P$-wave amplitudes for the first time and provide the most stringent test to date of the predictions of Chiral Perturbation Theory and its energy region of agreement with experiment.
• ### Reply to Comment on "High-Precision Determination of the Electric and Magnetic Form Factors of the Proton"(1108.3533)

Aug. 17, 2011 nucl-ex
In arXiv:1108.3058v1 [nucl-ex], Arrington criticizes the Coulomb corrections we applied in the analysis of high precision form factor data (see Phys.Rev.Lett.105:242001, 2010, arXiv:1007.5076v3 [nucl-ex]). We show, by comparing different calculations cited in the Comment, that the criticism of the Comment neglects the large uncertainty of "more modern" TPE corrections. This uncertainty has also been seen in recent polarized measurements. We rerun our analysis using one of these calculations. The results show that the Comment exaggerates the quantitative effect at small Q^2.
• ### Search for Light Gauge Bosons of the Dark Sector at the Mainz Microtron(1101.4091)

June 24, 2011 hep-ex, nucl-ex
A new exclusion limit for the electromagnetic production of a light U(1) gauge boson {\gamma}' decaying to e^+e^- was determined by the A1 Collaboration at the Mainz Microtron. Such light gauge bosons appear in several extensions of the standard model and are also discussed as candidates for the interaction of dark matter with standard model matter. In electron scattering from a heavy nucleus, the existing limits for a narrow state coupling to e^+e^- were reduced by nearly an order of magnitude in the range of the lepton pair mass of 210 MeV/c^2 < m_e^+e^- < 300 MeV/c^2. This experiment demonstrates the potential of high current and high resolution fixed target experiments for the search for physics beyond the standard model.
• ### High-precision determination of the electric and magnetic form factors of the proton(1007.5076)

Dec. 13, 2010 nucl-ex
New precise results of a measurement of the elastic electron-proton scattering cross section performed at the Mainz Microtron MAMI are presented. About 1400 cross sections were measured with negative four-momentum transfers squared up to Q^2=1 (GeV/c)^2 with statistical errors below 0.2%. The electric and magnetic form factors of the proton were extracted by fits of a large variety of form factor models directly to the cross sections. The form factors show some features at the scale of the pion cloud. The charge and magnetic radii are determined to be r_E=0.879(5)(stat.)(4)(syst.)(2)(model)(4)(group) fm and r_M=0.777(13)(stat.)(9)(syst.)(5)(model)(2)(group) fm.


text:
# Exterior algebra, Symmetric algebra, Divided power algebra in Characteristic $p>0$.

I am lacking the knowledge of multi-linear algebra while I come up with the following problems.

Suppose $k$ is a field of characteristic $p>0$. Let $E$ and $F$ be two $k$-vector spaces of dimension $r$ and $s$ respectively.

1. How to describe $\bigwedge^n(E \otimes F)$? Direct sum? Filtration?

2. I would like to have explicit answers to the previous question for $n =2, 3$ or even $n = 4$. If $\dim F = 1$, then $\bigwedge^n(E \otimes F) \simeq \bigwedge^n E \otimes \operatorname{T}^n F \simeq \bigwedge^n E \otimes \operatorname{Sym}^n F$. How about $\dim F =2$?

3. Do we have natural map $\bigwedge^n(E \otimes F) \to \bigwedge^n(E) \otimes \operatorname{Sym}^n(F)$?

4. I don't like to confuse the symmetric tensors with symmetric algebra, and alternating tensor with exterior powers. So in my definition, $\operatorname{Sym}^n(E)$ and $\bigwedge^n(E)$ are all quotients of $\operatorname{T}^n(E)$, while the space of symmetric tensors and alternating tensors are subspaces of $\operatorname{T}^n(E)$.

5. It seems that $\operatorname{Sym}(E^\vee)$ is naturally isomorphic to $\Gamma(E)^\vee$, where $\Gamma(E)$ is the divided power algebra. What is correct definition of $\Gamma(E)$? quotient or sub of something? What is the corresponding sub or quotient?

6. How does taking dual behave under these constructions?

7. What is the reference for such problems?

Problem 3 solved. Consider the natural map $\operatorname{T}^n(E \otimes F) \xrightarrow{\sim} (\operatorname{T}^n E) \otimes (\operatorname{T}^n F) \to (\bigwedge^n E) \otimes (\operatorname{Sym}^n F)$. Then we can easily see that $\ker\big(\operatorname{T}^n (E \otimes F)\to \bigwedge^n (E \otimes F)\big)$ goes to zero under this natural map, hence it factors through $\bigwedge^n (E \otimes F)$.

3'. Is $(\bigwedge^n E) \otimes (\operatorname{Sym}^n F)$ a sub/quotient/subquotient of $\wedge^n (E\otimes F)$.

• 3. Yes: it maps $\left( e_1 \otimes f_1 \right) \wedge \left( e_2 \otimes f_2 \right) \wedge \cdots \left( e_n \otimes f_n \right)$ to $\left( e_1 \wedge e_2 \wedge \cdots e_n \right) \otimes \left( f_1 f_2 \cdots f_n\right)$. The proof of well-definedness is not too hard: First check that it is well-defined as a map from the tensor power; then show that it factors through the exterior power because if two adjacent tensorands are equal, the output is zero (caveat: the tensorands might not be pure tensors). – darij grinberg Jun 28 '17 at 10:45
• 6. As you probably know, for finitely-generated free $k$-modules $V$, there is a canonical isomorphism $\left(\wedge^n V\right)^\ast \to \wedge^n \left(V^\ast\right)$ that comes from the non-degenerate bilinear form $\left(\wedge^n V\right) \times \left(\wedge^n \left(V^\ast\right)\right) \to k, \ \left(v_1 \wedge v_2 \wedge \cdots \wedge v_n, f_1 \wedge f_2 \wedge \cdots \wedge f_n\right) \mapsto \det \left( \left( f_i\left(v_j\right) \right)_{1\leq i\leq n,\ 1\leq j\leq n}\right)$. In the same situation, there is also a canonical ... – darij grinberg Jun 28 '17 at 14:40
• ... isomorphism $\left(D^n V\right)^\ast \to \operatorname{Sym}^n \left(V^\ast\right)$, where $D^n V$ stands for the $n$-th divided-powers module of $V$ (which is isomorphic to the $n$-th symmetric-tensors module of $V$, i.e., the $S_n$-invariant subspace of $V^{\otimes n}$). – darij grinberg Jun 28 '17 at 14:41
• 4. If $V$ is a finitely-generated free $k$-module, then the $n$-th "alternating-tensors" module of $V$ is canonically isomorphic to the $n$-th exterior power $\wedge^n V$. In fact, the isomorphism from $\wedge^n V$ to the $n$-th "alternating-tensors" module simply sends each $v_1 \wedge v_2 \wedge \cdots \wedge v_n$ to $\sum\limits_{\sigma \in S_n} \left(-1\right)^\sigma v_{\sigma\left(1\right)} \otimes v_{\sigma\left(2\right)} \otimes \cdots \otimes v_{\sigma\left(n\right)}$. But of course, no such isomorphism exists between "symmetric-tensors" and the symmetric power. – darij grinberg Jun 28 '17 at 14:43
• @darijgrinberg -- That's a lot of comment! I think it should be an answer. – mr_e_man Dec 15 '18 at 6:17

format: plain


text:
# Berge's lemma

In graph theory, Berge's lemma states that a matching M in a graph G is maximum (contains the largest possible number of edges) if and only if there… Expand
Wikipedia

## Papers overview

Semantic Scholar uses AI to extract papers important to this topic.
2018
2018
For a graph $F$, a hypergraph $\mathcal{H}$ is a Berge copy of $F$ (or a Berge-$F$ in short), if there is a bijection \$f : E(F… Expand
Is this relevant?
2017
2017
• Electronic Notes in Discrete Mathematics
• 2017
Abstract Let F = ( U , E ) be a graph and H = ( V , E ) be a hypergraph. We say that H contains a Berge- F if there exist… Expand
Is this relevant?
2015
2015
Let P(K) be a satellite knot where the pattern P is a Berge–Gabai knot (ie a knot in the solid torus with a nontrivial solid… Expand
Is this relevant?
2012
2012
• Jennifer F. Provencher, Anthony J. Gaston, Patrick D. O’Hara, H. G. Gilchrist
• 2012
Seabird diet indicates changing Arctic marine communities in eastern Canada J. F. Provencher*, A. J. Gaston, P. D. O’Hara, H. G… Expand
Is this relevant?
Highly Cited
2008
Highly Cited
2008
There has been significant recent interest in the dynamics of institutional change and e-learning. This paper reports on the… Expand
Is this relevant?
Review
2008
Review
2008
This action research study investigated a marketing plan based on collaboration among a program faculty team and other… Expand
Is this relevant?
Highly Cited
2005
Highly Cited
2005
• Auton. Robots
• 2005
We propose a new cooperative fusion approach between stereovision and laser scanner in order to take advantage of the best… Expand
Is this relevant?
2005
2005
This chapter illustrates how computer-mediated discourse analysis (CMDA) can be used systematically to investigate online… Expand
Is this relevant?
Highly Cited
1997
Highly Cited
1997
Turbulent mixing is an integral aspect of aquatic ecosystems Turbulence affects ecosystem features ranglng from phytoplankton… Expand
Is this relevant?
1979
1979
Ground temperature studies, begun in 1977, revealed the presence of permafrost at the summit of Mont Jacques-Cartier (1270 m), in… Expand
Is this relevant?


text:
## Electronic Journal of Probability

### Tricolor percolation and random paths in 3D

#### Abstract

We study "tricolor percolation" on the regular tessellation of $\mathbb{R}^3$ by truncated octahedra, which is the three-dimensional analog of the hexagonal tiling of the plane. We independently assign one of three colors to each cell according to a probability vector $p = (p_1, p_2, p_3)$ and define a "tricolor edge" to be an edge incident to one cell of each color. The tricolor edges form disjoint loops and/or infinite paths. These loops and paths have been studied in the physics literature, but little has been proved mathematically.

We show that each $p$ belongs to either the compact phase (in which the length of the tricolor loop passing through a fixed edge is a.s. finite, with exponentially decaying law) or the extended phase (in which the probability that an $(n \times n \times n)$ box intersects a tricolor path of diameter at least $n$ exceeds a positive constant, independent of $n$). We show that both phases are non-empty and the extended phase is a closed subset of the probability simplex.

We also survey the physics literature and discuss open questions, including the following: Does $p=(1/3,1/3,1/3)$ belong to the extended phase? Is there a.s. an infinite tricolor path for this $p$? Are there infinitely many? Do they scale to Brownian motion? If $p$ lies on the boundary of the extended phase, do the long paths have a scaling limit analogous to SLE6 in two dimensions? What can be shown for the higher dimensional analogs of this problem?

#### Article information

Source
Electron. J. Probab., Volume 19 (2014), paper no. 4, 23 pp.

Dates
Accepted: 6 January 2014
First available in Project Euclid: 4 June 2016

https://projecteuclid.org/euclid.ejp/1465065646

Digital Object Identifier
doi:10.1214/EJP.v19-3073

Mathematical Reviews number (MathSciNet)
MR3164757

Zentralblatt MATH identifier
1307.60147

Rights

#### Citation

Sheffield, Scott; Yadin, Ariel. Tricolor percolation and random paths in 3D. Electron. J. Probab. 19 (2014), paper no. 4, 23 pp. doi:10.1214/EJP.v19-3073. https://projecteuclid.org/euclid.ejp/1465065646

#### References

• M. Aizenman, and D.J. Barsky. Sharpness of the phase transition in percolation models. Comm. Math. Phys. 108 (1987), no. 3, 489-526.
• R.M. Bradley, P. N. Strenski, and J.-M. Debierre. Surfaces of percolation clusters in three dimensions. Physical Review B, 44 (1991), 76-84.
• R.M. Bradley, J.-M. Debierre, and P.N. Strenski. Anomalous scaling behavior in percolation with three colors. Physical review letters, 68(15) (1992), 2332-2335.
• R. M. Bradley, P.N. Strenski, and J.-M. Debierre. A growing self-avoiding walk in three dimensions and its relation to percolation. Physical Review A, 45(12) (1992), p.8513.
• R.M. Bradley, J.-M. Debierre, and P.N. Stenski. A novel growing self-avoiding walk in three dimensions. Journal of Physics A, 25(9) (1992) p.L541.
• R.M. Burton, and M. Keane. Density and uniqueness in percolation. Comm. Math. Phys. 121 (1989), no. 3, 501-505.
• F. Camia, and C. Newman. Two-dimensional critical percolation: the full scaling limit. Comm. Math. Phys. 268 (2006), no. 1, 1-38.
• D. S. Gaunt, and M. F. Sykes. Series study of random percolation in three dimensions. Journal of Physics A, 16 (1983), 783-799.
• Grimmett, Geoffrey. Percolation. Second edition. Grundlehren der Mathematischen Wissenschaften [Fundamental Principles of Mathematical Sciences], 321. Springer-Verlag, Berlin, 1999. xiv+444 pp. ISBN: 3-540-64902-6
• M. Hindmarsh, and K. Strobl. Statistical properties of strings. Nuclear Physics B, 437(2) (1995), 471-488.
• W.Z. Kitto, A. Vince, and D.C. Wilson. An isomorphism between the $p$-adic integers and a ring associated with a tiling of $N$-space by permutohedra. Discrete Appl. Math. 52 (1994), no. 1, 39-51.
• C.D. Lorenz, and R.M. Ziff. Universality of the excess number of clusters and the crossing probability function in three-dimensional percolation. Journal of Physics A, 31 (1998) 8147-8157.
• A. Nahum, and J.T. Chalker. Universal statistics of vortex lines. Physical Review E, 85(3) (2012).
• A. Nahum, J.T. Chalker, P. Serna, M. Ortuno, and A.M. Somoza. 3d loop models and the cp^n-1 sigma model. Physical Review Letters, 107(11) (2011).
• R.J. Scherrer, and J.A. Frieman. Cosmic strings as random walks. Physical Review D, 33(12) (1986).
• O. Schramm. Scaling limits of loop-erased random walks and uniform spanning trees. Israel J. Math. 118 (2000), 221-288.
• S. Sheffield. Exploration trees and conformal loop ensembles. Duke Math. J. 147 (2009), no. 1, 79-129.
• J.H. Conway, and N.J.A. Sloane. Sphere packings, lattices and groups. Third edition. With additional contributions by E. Bannai, R. E. Borcherds, J. Leech, S. P. Norton, A. M. Odlyzko, R. A. Parker, L. Queen and B. B. Venkov. Grundlehren der Mathematischen Wissenschaften [Fundamental Principles of Mathematical Sciences], 290. Springer-Verlag, New York, 1999. lxxiv+703 pp. ISBN: 0-387-98585-9
• S. Smirnov. Critical percolation in the plane: conformal invariance, Cardy's formula, scaling limits. C. R. Acad. Sci. Paris Sér. I Math. 333 (2001), no. 3, 239-244.
• S. Smirnov, W. Werner. Critical exponents for two-dimensional percolation. Math. Res. Lett. 8 (2001), no. 5-6, 729-744.
• N. Sun. Conformally invariant scaling limits in planar critical percolation. Probab. Surv. 8 (2011), 155-209.
• S. Tsarev. The geometry of a deformation of the standard addition on the integral lattice. ArXiv e-prints, January 2013.
• A. Vilenkin. Cosmic strings. The very early universe (Cambridge, 1982), 163–169, Cambridge Univ. Press, Cambridge, 1983.
• G.M. Ziegler. Lecture on polytopes, volume 152. Springer Verlag, 1995.


text:
# 在纯 hive SQL 中创建时间维度表

Without further ado, here is the full SQL to create a table giving you a table with one row per day, with date, year, mont, day, day and name of the week, day of the year. If you want the hours as well, look at the bottom of this post.

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 set hivevar:start_day=2010-01-01; set hivevar:end_day=2050-12-31; set hivevar:timeDimTable=default.timeDim;   create table if not exists ${timeDimTable} as with dates as ( select date_add("${start_day}", a.pos) as d from (select posexplode(split(repeat("o", datediff("${end_day}", "${start_day}")), "o"))) a ) select     d as d   , year(d) as year   , month(d) as month   , day(d) as day   , date_format(d, 'u') as daynumber_of_week   , date_format(d, 'EEEE') as dayname_of_week   , date_format(d, 'D') as daynumber_of_year   from dates sort by d ;

Note that I use d as date column because date is a reserved keyword.

The biggest issue is to generate one row per day. The trick here is to use a clever combination of posexplode, split and reapeat. This is what the first CTE does:

 1 2 3 4 5 -- just 10 days for the example set hivevar:start_day=2010-01-01; set hivevar:end_day=2010-01-10; select date_add("${start_day}", a.pos) as d from (select posexplode(split(repeat("o", datediff("${end_day}", "${start_day}")), "o"))) a We can break it down in a few parts:  1 2 select datediff("${end_day}", "${start_day}"); -- output: 9 Just computes the difference between start and end day in days.  1 2 select repeat("o", 9); -- output: ooooooooo Will output a string with 9 ‘o’. The actual character does not matter at all.  1 2 select split("ooooooooo", "o"); -- output: ["","","","","","","","","",""] Creates a hive array of 9 (empty) strings.  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 select posexplode(split("ooooooooo", "o")); -- output: -- +------+------+--+ -- | pos | val | -- +------+------+--+ -- | 0 | | -- | 1 | | -- | 2 | | -- | 3 | | -- | 4 | | -- | 5 | | -- | 6 | | -- | 7 | | -- | 8 | | -- | 9 | | -- +------+------+--+ Actually create a row per array element, with the index (0 to 9) and the value (nothing) of each element. That was the tricky part, the rest is easy. The first CTE creates a row with each date, adding the array index (in day) to the start_day:  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 with dates as ( select date_add("${start_day}", a.pos) as d from (select posexplode(split(repeat("o", datediff("${end_day}", "${start_day}")), "o"))) a) select * from dates; -- +-------------+--+ -- | dates.d | -- +-------------+--+ -- | 2010-01-01 | -- | 2010-01-02 | -- | 2010-01-03 | -- | 2010-01-04 | -- | 2010-01-05 | -- | 2010-01-06 | -- | 2010-01-07 | -- | 2010-01-08 | -- | 2010-01-09 | -- | 2010-01-10 | -- +-------------+--+

From there on, you can just create whatever column you feel like. Quarter column? floor(1+ month(d)/4) as quarter. Long name of the week? date_format(d, 'EEEE') as dayname_of_week_long.

As a bonus, I give you the same table but with hours added. The principles are exactly the same, with a cartesian join beween dates and hour:

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 set hivevar:start_day=2010-01-01; set hivevar:end_day=2010-01-02; set hivevar:timeDimTable=default.timeDim;   create table if not exists ${timeDimTable} as with dates as ( select date_add("${start_day}", a.pos) as d   from (select posexplode(split(repeat("o", datediff("${end_day}", "${start_day}")), "o"))) a ), hours as (   select a.pos as h   from (select posexplode(split(repeat("o", 23), "o"))) a ) select     from_unixtime(unix_timestamp(cast(d as timestamp)) + (h * 3600)) as dt   , d as d   , year(d) as year   , month(d) as month   , day(d) as day   , h as hour   , date_format(d, 'u') as daynumber_of_week   , date_format(d, 'EEEE') as dayname_of_week   , date_format(d, 'D') as daynumber_of_year   from dates join hours sort by dt ;
12-21

04-16 1407
04-06 2676
10-09
04-24
07-25 1282
11-09 1793
10-29 1907


text:
## Intensity vs energy

$c=\lambda v$

AJ Manzano 3K
Posts: 16
Joined: Fri Sep 28, 2018 12:25 am

### Intensity vs energy

What exactly is intensity in comparison to energy? I know it’s like making the lights brighter while the type of light stays the same. So how does it become brighter if the energy doesn’t increase? Energy is related to wavelength, but how does intensity relate?

Posts: 96
Joined: Fri Sep 28, 2018 12:16 am
Been upvoted: 2 times

### Re: Intensity vs energy

Intensity is the amount of energy delivered per unit time per unit area.

Erin Kim 2G
Posts: 75
Joined: Fri Sep 28, 2018 12:26 am

### Re: Intensity vs energy

intensity directly relates to the number of photons in the light. So if the number of photons increases, then the intensity increases/ gets brighter even if the type (wavelength or frequency) of photon did not change.

904936893
Posts: 62
Joined: Fri Sep 28, 2018 12:29 am

### Re: Intensity vs energy

Intensity is increasing the amplitude of the wavelength, so making it larger or smaller. When light is acting as a particle, increasing the intensity is just increasing the amount of photons (not the energy per photon). The reason why intensity was significant was because in the photoelectric experiment, the scientists believed increasing the intensity would cause electrons to be excited, because it would be like hitting the metal that they were trying to eject electrons from with a 'large' wave vs. a 'small' wave. However, since light was acting as a particle, increasing the intensity only increased the amount of low-energy photons that were hitting the metal, but each individual photon didn't have enough energy on it's own to eject an electron. Once you have a photon that has enough energy (based on wavelength/frequency), then increasing the amplitude will cause more electrons to be ejected, but they will all still have the same amount of energy.

Brice McKeown 3D
Posts: 35
Joined: Fri Sep 28, 2018 12:25 am

### Re: Intensity vs energy

Just read over this in the book and thought it may ne helpful... intensity is about the number of photons, and when looking at E=hv, the E is the amount of energy of each photon individually.

WilliamNguyen_4L
Posts: 65
Joined: Fri Sep 28, 2018 12:28 am

### Re: Intensity vs energy

Intensity is the amount of photons while the energy of the light described as E=hv is the amount of energy per individual photon.

kimberlyrose1G
Posts: 44
Joined: Fri Sep 28, 2018 12:27 am

### Re: Intensity vs energy

Intensity is the amount of photons, while energy is per photon (smaller scale as it is describing individual photons)


text:
## Algebra: A Combined Approach (4th Edition)

y $\gt$ 9
$\frac{2}{3}y \gt$ 6 Multiply both sides by $\frac{3}{2}$: y $\gt$ 6($\frac{3}{2}$) y $\gt$ 9


text:
tabreturn.github.io

# Processing.py in Ten Lessons – 06: Pixels and Graphics

2019-02-08

Covered in this lesson:
Colour Channels / Halftone / Image Kernels / Filters and Blends / Tint and Transparency

In this tutorial, we will look at a few cool image processing techniques. You are already familiar with the image() function, which you have used in combination with loadImage() to draw image files to the display window. GIF, JPG, and PNG files are all raster graphics formats – that is, digital images comprised of a pixel grid. We will look at reading values off individual- as well as groups of pixels and then manipulating them to create Photoshop-esque filters. To manage these arrays of pixel values, we’ll rely on a number of the techniques that you picked up in lesson 05, in particular, the combining of loops with lists.

Complete list of Processing.py lessons

To begin, we will peek under the hood of some image file formats; this will provide useful insight into how the colours of individual pixels are controlled.

### Image Formats

Each time you run a sketch, Processing generates a new or updated display window. Like a GIF, JPG, or PNG image, the graphic presented in the display window is raster-based. Using the saveFrame() function one can capture the current frame in TIFF (.tif) format. Alternatively, a (filename) argument ending in .gif, .jpg, or .png produces a compressed image file. With TIFF, Processing employs no compression resulting in larger files. TARGA (.tga) is also an option, but these lessons avoid covering it in favour of focussing on the more common web-browser-supported formats.

Below is a screenshot of a sketch. The code is not important. Instead, focus on what the display window renders (a red and white striped pattern) and the file sizes of each version saved.

Before proceeding with an explanation for these differences, here is a 3-point primer on file size:

• you know that computers store digital information as ones and zeroes; you refer to each 1 or 0 as a bit (a binary digit);
• there are 8 bits in a byte, for example, 10110110;
• a kilobyte (KB) is 1000 bytes.

The “bands.tif” file is by far the largest, weighing in at a comparatively hefty 31 kilobytes. Recall that Processing uses no compression when saving TIFF files, so this is no surprise. But how exactly does a TIFF store pixel values, and what is the relation to size? To begin to answer this question, consider the hexadecimal value for red:

#FF0000

Each pair of digits has been coloured according to the RGB primary it controls. Alternatively, we could rewrite this using decimal values:

(255, 0, 0)

Alas, this still isn’t pure ones and zeroes. Information stored digitally requires conversion to binary. It figures, right? Because binary comprises ones and zeroes, and so do bits. To convert from a zero in decimal to a zero in binary is easy – it’s 0 in both systems. The same goes for 1. But what about 2? Binary has only two digits to work with, whereas decimal has ten. Below is an abridged conversion table:

Decimal           Binary
0 0
1 1
2 10
3 11
4 100
5 101

255 11111111

We count on our fingers, so a base-10 (decimal) system is fitting. For instance, suppose you are counting the number of people who pass you in the street. To keep track, you begin by forming a fist with each hand; when the first person passes you, you raise your left thumb. For the second person, you extend your left index finger; and so forth. I know this seems menial but bear with me.

You reach ten people and have run out of fingers. For the eleventh passerby, you ask a friend sitting beside to ‘store’ a one on her fingers. You then close your fists beginning at one again (your left thumb). When you reach twenty, your friend extends her left index finger, and you start at one again. In all, twenty-six people pass you.

To proceed beyond a hundred with this system, you’ll need to find another friend. From this exercise, we gather that for each power of ten you require an additional digit – i.e. 10, 100, 1000.

Now, imagine you had no fingers (or thumbs). Once you’ve counted to two, you run out of ‘stumps’ to count on. When counting in binary (base-2), every time you reach some power of two an additional digit is required. The table below provides binary-to-decimal conversions for powers of two.

Binary           Decimal
0 0
10 2
100 4
1000 8
10000 16
100000 32
...

If you were using your friends to help hold digits, counting to 32 requires five assistants. Don’t worry, though, this conversion process is handled for you by Processing so that you will never need to deal directly with binary.

In lesson 01 you received little explanation for how hexadecimal actually works. You have probably been wondering where those letters from, right? Well, hexadecimal is a base-16 system. Just imagine some alien race with sixteen fingers. To accommodate these extra fingers, we include the letters A to F.

...
8 8
9 9
A 10
B 11
C 12
D 13
E 14
F 15
10 16
11 17
...
FF 255

People have used all sorts of numeral systems. For example, the French use base-10 until seventy, after which point it’s a mixture of base-10 and base-20. The Telefol and Oksapmin speaking people of Papua New Guinea use a Heptavigesimal (base-27) system, where the words for each number are named according to the 27 body parts they use for counting.

If you are wondering, π is irrational in every numeral system. But, on second thought, what if 3.141… were the base? 😕

Binary           Decimal
10000000 128
10000001 129
10000010 130
...
11111111 255
100000000 256

Note how 255 is the highest decimal that can be represented using eight bits. It is no coincidence that you express the brightest red your screen can display as (255, 0, 0). Or that white is (255, 255, 255). At a hardware level, these integers are all converted to binary. As indicated in the table above, eight 1s in binary is equivalent to 255 in decimal. Let us rewrite red in binary:

111111110000000000000000

I have padded the green and blue values with zeroes so that each colour is eight bits in length. White would be a complete string of ones. In all, there are 8 × 3 = 24 bits. Hence, this is 24-bit colour, which can describe a whopping 256 × 256 × 256 = 16,777,216 possible (yet not necessarily distinguishable) colour variations.

Now, back to the sketch. To remind you, this the visual output we are dealing with:

The size of the (uncompressed) TIFF file is 31 KB. Here is why:

• the graphic is 100 pixels wide by 100 pixels high, and therefore comprised of 100 × 100 = 10,000 pixels;
• each pixel contains one 24-bit colour value;
• 10,000 pixels × 24-bit colour values = 240,000 bits;
• there are 8 bits in a byte, so that’s 240,000 bits ÷ 8 = 30,000 bytes.
• 30,000 bytes = 30 kilobytes (KB).

Okay, so we have accounted for 30 KB, but what about the extra 1 KB? I have used Hex Fiend – an open source hex editor – to open and inspect the raw data of the “bands.tif” file. Of course, the data is ultimately stored as binary, but it is easier to make sense of hexadecimal. You can follow along using a hex editor too, but there is no need.

The numbers appear in byte groupings of three (clusters of six 0F numbers). Scrolling through the file reveals alternating stretches of FF0000 and FFFFFF values – that is, red and white respectively; this is what we would expect, after all, the graphic is a pattern of alternating white and red stripes. However, the first three lines contain a bunch of seemingly random numbers; then, there are 000000s (black?) up to byte 768 (as indicated by the count in the left margin).

At the bottom of the window, you can spot the file size in bytes.

That is 768 bytes over our expected 30,000. This accounts for the extra 1 KB, which the file manager has rounded-up to 31 KB. Removing everything up to where the first FF0000 cluster reduces the file size to precisely 30 KB.

So what was stored in bytes 0 to 768? The beginning section of the file contains vital information to identify it as a TIFF and specify parameters for – but not limited to – width, height, bit-depth, and orientation. Leaving this information out will most certainly break the graphic.

Processing generates TIFF files using the format’s most essential features. The TIFF 6.0 specification can support various compression schemes, layers, deep colour (16- as opposed to 8-bits per channel), transparency, pages, and multiple colour models (RGB, CMYK, LAB, etc.). Be aware, though, that many of these extra features are extensions, and reader support will vary. Overall, TIFF is a very versatile format, well suited for working on graphics between different applications and for archiving purposes. Essentially, TIFF rolls all of GIF, JPG, and PNG’s features into a single specification. Nevertheless, it’s not supported on the Web.

### GIF vs JPG vs PNG

If you are looking at an image on a web-page, chances are it’s either a GIF, JPG, or PNG. Scalable Vector Graphic format (SVG) is also popular, but not designed for raster graphics. Size is important to consider when you are transferring files across an internet connection. Smaller equals faster, so all three formats employ compression techniques.

The details of data compression are complicated, mathematical, and beyond the scope of these lessons. Nonetheless, you’ll gain a high-level insight into how compression algorithms operate. The main focus, though, is on why you would elect to use one format over the other. If you are familiar with some raster editing software, such as GIMP or Photoshop, it’s a good idea to play around with the export options to see how the different GIF, JPG, and PNG parameters affect the quality and size of these files.

#### GIF

GIF is the oldest of the three formats. There’s an ongoing war over whether it is pronounced “gif” (with a hard g, like in gift) or as “jiff”. The format utilises the Lempel–Ziv–Welch (LZW) data compression scheme. Our image is a sequence of red and white stripes, and this is just the type of graphic to which GIF is best suited. More specifically, images consisting primarily of areas filled in flat colour. For instance, graphs, diagrams, text, and line art. Unsurprisingly, it outperforms JPG and PNG for our red-white stripy pattern, consuming just 298 bytes. Opening the “bands.gif” file in a hex editor reveals how small it is, and also provides insight into how the format works.

Despite there being thousands of red and white pixels in the graphic, the hex editor contains a single instance of FF0000 and FFFFFF. This pair of colour values makes up the image’s colour table. What precedes the colour table identifies the file as GIF and describes the width, height, and other characteristics. What follows the colour table (after the 2C and terminating with a 3B) is compressed graphics data. Rather than specifying the value of each pixel, the LZW algorithm matches each pixel with one of the two colour table entries. But LZW can take this indexing system one step further. Each red stripe is a continuous string of 100 × 10 = 1000 hexadecimal values. This string can in-turn be stored in a table, so that each time the red stripe reappears, the relevant table entry is repeated.

GIF has its limitations. Most notably, the colour table may not exceed 256 colours. For greater GIF compression one reduces this palette further. The GIF below consists of around sixteen colours and the reduction in range is quite evident. Placing alternating colours in checkerboard-type arrangements – called dithering – helps make up for the limited colour table, but it’s often easy to discern this pattern, and it works against the compressibility. GIF supports transparency, but the level of opacity is either 0% or 100% (nothing between).

GIF also supports animation, which is handy for short loops of cats doing silly things.

#### JPG

JPG (pronounced “jay-peg”; often bearing the extension .jpeg) uses a lossy compression that does not support any type of transparency. Unlike lossless GIFs or PNGs, each time you reopen, perform a minuscule edit, and save a JPG file, the image quality degrades further. The compression algorithm works by taking advantage of the human psychovisual system, disregarding information we are less likely to detect visually. Humans are more sensitive to differences in brightness than differences in colour, a characteristic that JPG leverages. The format works well for images with graduated colour, like photographs, but causes noticeable artefacts to appear wherever there is a sharp contrast.

Most raster software provides some or other of quality ‘slider’ when exporting to JPG format. Less quality equals smaller file size, but you will find that certain photographs/graphics can handle more compression before they begin to look horrible.

#### PNG

PNG – pronounced “pee-en-jee” or “ping” – was developed as a replacement for the proprietary GIF format. Although GIF patents expired in 2004, PNG had introduced a number of compelling improvements. Like GIF, PNG compression is lossless, but the PNG with no 256 colours palette restriction. Moreover, transparency can range from anywhere between 0% to 100%, allowing for semi-opaque pixels. This is accomplished using an additional alpha channel. For instance, an opaque blue (i.e. no alpha) can be expressed as:

0000FF
Or, in binary:
000000000000000011111111

That is 24 bits in all – with 8 bits for each R/G/B channel. A 32-bit hexadecimal value provides room for the additional alpha channel; of course, this consumes more storage/bandwidth too. The same blue with an opacity of around 25% is, hence, stored as:

00000000000000001111111101000001

This alpha feature is especially handy for placing images seamlessly above other background images.

Notably, PNGs do not support animation. The APNG (Animated Portable Network Graphics) specification is an extension to the format, but it has failed to gain traction with some major (Microsoft) web browsers.

When dealing with photographs, JPGs tend to trump PNGs in terms of quality-for-size. PNGs, however, excel when you require transparency or desire GIF-style sharpness with a greater range of colour.

There are a few up-and-coming Web image formats (WEBP, HEIC) that promise comparable quality in smaller files. Whether they gain traction depends largely on support from authoring tools and browsers. To reiterate, though, it’s best to experiment with the different formats to see how they work and which is most appropriate for a given graphic you wish to optimise.

## Colour Channels

Each pixel on your screen is mixed using three primary colours: red, green, and blue. Another way to think of this is three monochrome images (or channels) that control the levels of each primary, combined into one image.

Notice how the whiter areas of Modefenster, such as the foreground woman’s face, appear solid for every channel. Recall that, to produce white, the red, green, and blue channels must combine at full intensity.

Sometimes it is preferable to work with four channels. For instance, you may need an alpha channel for transparency. Another scenario is print design. Colour printers use a four-colour CMYK model: cyan, magenta, yellow, and black. If you have ever replaced ink cartridges in your printer, you have probably noticed this. For CMYK, desktop publishing file formats can handle 32-bit colour values. For instance, a blue mixed with 100% cyan and 50% appears as:

FF800000

Observe Krita’s Channels panel to the lower-right; whiter areas indicate higher values for the respective channel. For instance, the Cyan channel’s bright regions correspond to the blue areas in the wave. The Magenta channel appears like a duller copy of the Cyan channel; the predominant blue is mostly a mix of around 100% cyan and 50% magenta. By manipulating colour channels, you can control the overall hue, saturation, and lightness. If you are familiar with software like GIMP or Photoshop, or perhaps more basic image editing software, you have likely performed such operations before.

Processing has various functions for manipulating colour channels. Experimenting with these reveals the inner workings of applications like Photoshop.

### RGB Channels

Create a new sketch and save it as “colour_channels”. Download this copy of August Macke’s Modefenster and place it your sketch’s “data” sub-directory:

modefenster.png

We will be sampling parts of the painting and placing the processed output in the empty blue area to the right. The first function you need to know is the get(). This is used to read the colours of pixels that lie within the display window. First, grab a section of pixels by adding a get() to the bottom of your code:

The arguments are the same as those of the rect() function; the variable grab is assigned a copy of all the pixels within a rectangular area beginning at the top left (0,0 ...) and extending 200 pixels across and 200 pixels down (... 200,200). Add an image() function to draw the pixels into the empty area on the right:

Alternatively, you can make use of the copy() function which additionally accepts arguments for the destination coordinates and scale.

To retrieve a single pixel’s colour, use a get() function without width and height arguments. If any pixel sampled lies outside of the image window, the get() returns black.

Intriguingly, if you print the singlepixel variable a (negative) integer appears; this is how Processing stores colours in memory. You do not need to understand how this works because there are functions for converting these integer-based data types to standard hexadecimal and RGB.

We can now build a duplicate image on the right by sampling each pixel and placing its clone 500 pixels (half the width of the display window) to the right. Sure, it would be easier to grab the whole area of the painting, but the pixel-by-pixel approach is necessary for the upcoming steps. Add this loop to the end of your code:

You should be quite comfortable with loops now. In this instance, the range is half the display window’s width by the full height. In a pixel-by-pixel, row-by-row manner, the loop gets each pixel and sets its clone accordingly. The set() function accepts three arguments: an x-coordinate, then y-coordinate, then colour. Run the sketch. Your earlier experiments are drawn over with new pixels.

With each iteration, we will now separate the pixel values into the independent R, G, and B channels. Comment out the existing set() line and add a red(), green() and blue() function to extract the three channel values.

With each pixel sampled, variables r, g, and b are each assigned a value between 0 and 255. Excellent! That’s a familiar range, right? Remember, 255 equals FF equals 11111111.

The color() function converts RGB values into the integer types that get() and set() work with (the way Processing stores colours in memory). Add the following lines to the end of your loop:

Run the sketch. The result is the same as before. We have split the colour into its R/G/B constituents then merged them back together using the color() function.

Now, let’s visualise the channels beginning with red. Recall that the Channels panels in both Krita and GIMP (and Photoshop, for that matter) display greyscale thumbnails. Greys are an equal mix of red, green, and blue – therefore, to represent a red channel in greyscale, use the red value for all three color arguments.

If the current iteration’s pixel is bright red, the color(r, r, r) line is equivalent to color(255, 255, 255). This means that the most vivid reds will appear as white, that no red is black, and that everything else is some shade of grey. Run the code.

Note how the red “MODE” sign registers as white; this indicates red values of near 100%. The yellow stripes in the awning over the window are also white; this is because yellow is mixed using 100% red and 100% green. Comment out the red set() line and try a green channel instead.

The green channel confirms the prominence of green in the awning. The sign, however, has very little green – or blue, for that matter. You can try a set() line for blue if you wish to confirm this. Any area in the original image that is grey, white, or black, will possess equal quantities of red, green, and blue.

To convert the image to greyscale, rather than greyscale representations of each channel, average out the three values.

Include the following coefficients to accommodate the greater number of green receptors in the human eye. The yellows will, otherwise, not appear bright enough.

In the image below, the area within the green brackets exhibits the calibrated values. Note how the awning’s bright yellow and darker orange strip appear as the same shade of grey with the straightforward averaged values.

To invert the colours (like a film negative), subtract each r/g/b value from its maximum channel value of 255.

See if you can work out how to create an inverted greyscale version.

### HSB Channels

The very first lesson introduced Processing’s various colour modes. The colour mixing scheme can be switched from RGB to HSB (Hue, Saturation, Brightness) using the colorMode() function. You can think of HSB as an alternative set of channels that may be more appropriate for what you need to accomplish. Switch the colorMode to HSB and add a new loop to the end of your existing “colour_channels” code. If you wish to, you can comment out the previous loop – or instead, not bother and just allow the new loop to draw over what’s there already.

Working in HSB makes it far easier to shift hues, adjust saturation, and alter brightness. The colorMode() arguments have now set Processing to operate like the GIMP colour mixer depicted below.

Use the hue(), saturation(), and brightness() functions to separate the pixel values into three HSB channels.

To create an exact copy of the painting, use a set() line with the h/s/b variables as arguments:

Adjusting the hue involves taking a pixel’s hue value and rotating the GIMP mixer triangle to produce a new rotation value between 0 and 360 degrees. This is akin to shifting a hue slider in GIMP or Photoshop.

But simply adding degrees of rotation to the h variable is problematic. For example, what if the h is 40 and we subtracted 50. The result is 40 - 50 = -10 degrees, which lands outside of the permitted range. Instead, rotating past 0 or 360 should reset the degrees to zero, then subtract/add the remaining difference. This way 40 - 50 = 350 degrees. This is an example of clock arithmetic. The ‘wrap-around’ concept is nothing new to you. If it is currently three AM, and somebody asks what time was it four hours ago, you wouldn’t say “minus one AM”? Clock arithmetic is an application of modular arithmetic – the favourite pastime of our good friend the modulo operator! Add a new set() line that subtracts 50 from the hue and performs a %360 on the result.

To invert the colour, but keep the same brightness, pick the colour on the opposite side of the colour wheel by adding 180°.

For the most vivid colours possible, set the saturation value to maximum (100%) for every pixel.

You are now familiar with colour channel management. You can apply this theory to all sorts of colour adjustment. These principles also lay the foundation for the next sections where we look at filter effects. There are a few other functions for the colour data type that we did not cover. These omissions include:

## Halftone

Suppose that you have an image of continuous tones, i.e. an infinite-like range of blended greys. For this example, we will use a photograph of Elisabet Ney’s Lady Macbeth sculpture (below). The image is to appear in a newspaper printed in black & white, so you convert the image to greyscale and email it off to the publishers.

Of course, in the 1870s it wasn’t this simple. There was no email and, more critically, publishers were still figuring how to print photographs. In spite of this limitation, printers managed to reproduce illustrations. Illustrations were etched into wood then cast into metal plates; which could then be coated in ink and used to transfer the images to paper. The challenge with photographs was continuous tones – or more specifically, how to render solid black ink in a multitude of grey shades. The solution was halftone; tiny dots of varying size that create the illusion of grey when viewed from a sufficient distance. The exact details of the process are not important; suffice to say it is all handled digitally today.

The images below contrast four different halftone techniques. The simplest approach is no halftone (top-left). Here, a brightness threshold is used to determine which shades of grey are rendered black or white. The stochastic halftone (top-right) uses dots of equal size, adjusting their spacing to emulate darker/lighter tones. Such dithering techniques can, therefore, be described as frequency modulated.

Amplitude modulated halftones (bottom-left and bottom-right) rely on varying sized dots in a grid-like arrangement, or evenly-spaced lines of variable weight. These patterns, however, can be formed using various other shapes (squares, ellipses, etc.).

Halftone techniques remain an essential part of printing today. Halftone separations for each CMYK channel create the optical effect of full-colour imagery when overlayed as semi-opaque inks.

Round dots are the most commonly used shapes. If you magnify a print you should be able to spot them.

### Halftone Dots

Create a new sketch and save it as “halftones”. Download this copy of Leonardo da Vinci’s Mona Lisa and place it your sketch’s “data” sub-directory:

mono-lisa.png

As with the previous sketch, we will be rendering a processed version in the empty blue space on the right.

Our first halftone will consist of amplitude-modulated circles. We will begin by adding the global variables and main loop. The image will be divided into ‘cells’. In effect, these cells control the ‘resolution’ of the halftone.

Most of this code should look familiar, although the ceil() function may be new to you. The ceiling function performs a round-up operation on floating point values. For example, ceil(9.1) would return 10. It is necessary to employ it here to prevent any half rows from stopping short of the bottom of the display window. A rect() line is included to visualise the cells. Run the code.

For the halftone effect, we want to sample the pixel a the centre of each cell. To accomplish this, add half the width/height to the x/y coordinate. Also, comment out the rect() line.

Next, using the brightness value of each pixel sampled, we calculate an amplitude (amp) for each halftone dot. The amount, however, must be reduced by a factor of 200 so that the dots are not too large.

Finally, add the relevant stroke and fill properties, then the ellipse/circle function.

You are not limited to circles or white fills. In the next two tasks, you will be challenged to replicate two new halftone effects.

Using the “haltones” sketch you have been working on, recreate the pixelated effect below.

You should be able to comment out the circular-halftone-specific lines and make use of the existing loop.

For ASCII art, you will need to decide on a set of characters to serve as your colour ramp. For ten shades, you can use the following sequence (which begins with a space character). The glyphs range from lightest on the left to darkest at the right.

 .:-=+*#%@

With so few shades, expect substantial posterisation – the “conversion of a continuous gradation of tone to several regions of fewer tones, with abrupt changes from one tone to another” (Wikipedia). The final result should look something like this:

There are many halftone effects to explore. By riffing off the techniques covered here, you can come up with all sorts of interesting results. For example, see what happens when you combine the circular, pixel, and ASCII effects.

## Image Kernels

If you have ever sharpened or blurred a digital image, it’s likely that the software you were using relied on an image kernel to process the effect. Moreover, the fields of computer vision and machine learning utilise image kernels for feature- detection and extraction.

An image kernel, put simply, is a small matrix that passes over the pixels of your image manipulating the values as it moves along. To illustrate, here is a three-by-three blur kernel in action. The kernel (left) begins with its centre placed over the first (top-left) pixel of the source image. A new (first) pixel value is calculated using the centre and eight neighbouring cells sampled in the kernel.

For any edge pixels, though, the kernel ‘hangs’ over the boundary and samples empty cells. One common solution is to extend the borders pixels outward.

This process advances pixel-by-pixel. In this instance, the kernel motion is left-to-right, row-by-row – although, as long as every pixel is processed, the sequence does not matter.

The magic part is how the kernel combines the nine values into one – a form of mathematical convolution, where each pixel is weighted and then added to its local neighbours. In the illustration below, the source pixels are labelled ai and the matrix cells, 19.

a
b
c
d
e
f
g
h
i
×
1
2
3
4
5
6
7
8
9
=

The convolution operation multiplies each cell by its corresponding partner. So, a × 1, then b × 2, and so on through to i × 9. The results of all these multiplications are then added together, producing a blurred colour value.

$\left[\begin{array}{ccc}a& b& c\\ d& e& f\\ g& h& i\end{array}\right]×\left[\begin{array}{ccc}1& 2& 3\\ 4& 5& 6\\ 7& 8& 9\end{array}\right]=\left(a·1\right)+\left(b·2\right)+\dots +\left(i·9\right)$

If you are a math/ML/CV/other nerd – you may point out that that kernel has not been flipped, so this is, in fact, a cross-correlation and not a convolution. You are correct. However, we will be using symmetrical kernels, so correlation and convolution coincide.

The numbers 19 are simply variables. With the theory out of the way, it’s time to program your own image kernels so that you can experiment with different combinations of weightings.

### Roll Your Own Image Kernel

Create a new sketch and save it as “image_kernels”.

mwaash-ambooy-grey.png

Begin with the following code:

The image has been greyscaled prior to loading. A single colour channel will be easier to manage at first.

As with the previous tasks, the processed version will appear in the blue area to the right. To begin, add a loop to your sketch.

Because we are sampling greyscale pixels, it does not matter if you extract the red, green, or blue channel – remember that these are equal for any shade of grey. Add the following line to the loop:

Next, create a new grey color, assign it to a variable named kernel, and use set to draw a corresponding pixel in the right half of the window:

We could use a get(x,y) as the third argument of the set() function and thereby forgo the previous two lines. The visual result is an exact duplicate of the source, anyhow. The purpose of these seemingly unnecessary steps is to verify that everything works for now; we will adapt this code as we go.

With each iteration, we must sample nine pixels for the kernel. The loop begins at the top-left pixel, meaning that, on the first iteration the kernel samples five ‘empty’ pixels that lie beyond the edges. To keep things simple, we will not use the ‘extend’ trick; rather, Processing will record these as black. This will result in slightly darkened border pixels, but nothing too noticeable.

Replace the sample variable with a list. This new list structure grabs the nine pixels at once.

Next, replace the kernel variable with a list that multiplies the sample values by some kernel weightings. To start, we will perform an identity operation – which is math-speak for “returns the same values it was provided”.

To illustrate this operation using the matrix diagram from earlier – we have black left/top edge pixels and a matrix of zeroes with a 1 in the centre.

×
0
0
0
0
1
0
0
0
0

Recall though, that after multiplying, we add-together the products. The Python sum() function makes things easy for you, adding up all the numbers in a list. Replace the existing set line as below.

Run the sketch. The results appear the same as before (an exact duplicate). You are now ready to begin experimenting with different kernel weightings.

#### Box Blur

The box blur is a simple kernel that averages adjacent pixel values. The result is a ‘softer’ image with lower contrast.

$\left[\begin{array}{ccc}0.11& 0.11& 0.11\\ 0.11& 0.11& 0.11\\ 0.11& 0.11& 0.11\end{array}\right]$

#### Edge Detection

As the name implies, edge detection methods aim to identify edge points/boundaries within an image. The lighter the resultant pixel appears, the more pronounced the change is in image brightness.

$\left[\begin{array}{ccc}0& 1& 0\\ 1& -4& 1\\ 0& 1& 0\end{array}\right]$

#### Sharpen

Sharpening makes light pixels lighter and dark pixels darker. The result is an increased contrast and ‘crisper’ edges. The kernel is, effectively, the inverse of an edge detect.

$\left[\begin{array}{ccc}0& -1& 0\\ -1& 5& -1\\ 0& -1& 0\end{array}\right]$

These are a few common kernel types. However, image kernels need not be limited to 3 × 3, symmetric matrices and can operate on whatever channel(s) you feed them (full-colour RGB, HSB, etc.). Like many things matrix-related, this stuff can get very involved. We will not venture any deeper, although the final section of this lesson covers Processing’s filter functions, many of which rely on convolution matrices.

In this task, the challenge is to apply an emboss to a colour image. You may use your existing sketch or create a new one. Download the colour version of the Mwaash aMbooy mask and place it your sketch’s “data” sub-directory:

mwaash-ambooy-colour.png

Do not forget to load the colour image:

The emboss kernel creates the illusion of depth by emphasising contrast in a given direction.

$\left[\begin{array}{ccc}2& 1& 0\\ 1& 1& -1\\ 0& -1& -2\end{array}\right]$

The final result looks like this:

If you have no idea where to start, consider a separate kernel for each R/G/B channel.

## Filters and Blends

If you are a user of raster graphics software, such as GIMP or Photoshop, you have almost certainly encountered filters and blend modes. On a technical level, blend modes – and most filters – operate on colour channels. Processing’s filter and blend functions span a selection of common image processing algorithms. Technically speaking, one can program these effects using the techniques covered thus far. We look at replicating a few of the simpler blend modes.

### Filters

Filters range from utilitarian and understated to hideously gaudy. To be fair, most have their place, but perhaps some users lack an understanding of how much of – and to which parts of an image – a given filter should be applied. Some impressive developments are being made in this area thanks in part to advances in artificial intelligence. For instance, here is a Vincent van Gogh imitation of the Mwaash aMbooy mask created using DeepArt.io’s neural algorithm.

Rather than list all of GIMP’s filters, here are the top-level categories into which they are arranged: blur, enhance, distort, light and shadow, noise, edge detect, generic, combine, artistic, decor, map, render, web, and animation. On average, a category contains around ten items, so that’s a lot of filters! Processing has eight filters in total.

The Processing filter() function requires a predefined filter name as an argument. Depending on the effect, there may be a second argument. If you want to experiment, download this photo of Florentijn Hofman’s Rubber Duck. Alternatively, you may prefer just to read over this section. The tutorial provides an image comparing all of the effects further along.

480px-Rubber_Duck_in_Sydney,_January_5,_2013.jpg

If you have decided to write some code, place the image in the sketch’s “data” sub-directory and add the following code:

To blur the image, add the following line to the end of your code:

For more blurring, BLUR accepts an additional level parameter. For example:

The array of images below compares each of Processing’s filter arguments. The caption beneath lists the corresponding function calls.

You already know how to program a number of these filters manually. If you are wondering how DILATE works, it’s a kernel that replaces the matrix centre pixel with its brightest neighbour; the ERODE, on the other hand, picks the darkest. Note that the effect manipulates everything drawn before the filter() line. Any subsequent code is unaffected. For example:

If you are using animation, the filter effects become cumulative. In other words, a filter(BLUR) placed within a draw() block results in an image that is blurred more and more with each frame.

By combining multiple built-in filters, your own programmed effects, and even some animation, you can create some mesmerising effects. Explore the GIMP/Photoshop/Krita/etc. filters for more inspiration.

### Image Blend Modes

When I began using raster graphics software (Photoshop 5.5 in 1999) I was thrilled with how I could manipulate photographs using a variety of touch-up, filter, and distortion tools. Initially, blend modes were something I seemed to gloss over and never touch again. In time, though, I grew more accustomed to incorporating them in my workflow. Today, I swear by them. Before, I had always found their names confusing and never understood which blend to select for the desired effect. Most of the time I’d simply cycle through them until I struck the right look. When I eventually learnt about the underlying math, everything made sense.

If you have no experience with blend modes, the screenshot below should help explain how they work. Let me begin by stating that layers are an integral component of raster graphic applications. Elements are placed on different layers so that they can be moved, scaled, and reordered to form a desired composition. By default, layers are opaque, obscuring any elements that lie further down the ‘stack’. By adjusting the blending mode, you control how the lower layers are affected. For example, a multiply blend mode has a tint-like effect.

Perhaps you have never used blend modes. Or, maybe you’re that Photoshop whiz who intuitively selects modes but can’t begin to explain how they work? Today, we unravel the mystery.

We will begin by programming our own blend mode, then move onto Processing’s built-in functions. Create a new sketch and save it as “blends”. In the “data” sub-directory, add a copy of the Rubber Duck image file from the last exercise. Add some code to draw a sequence of rainbow bands and place the image.

Run the sketch and confirm that the visual output matches the image below.

As with the previous exercises, a duplicate of the duck will be drawn to the right – in this case, over the rainbow colours. The difference this time will be the blending modes you apply in the process. Start by setting the colorMode’s RGB values so that they range from 01 (as opposed to the default 0255).

In this new mixing scheme, bright red is color(1,0,0)
This will help when it comes to performing blend mode calculations.

Next, use a loop to draw an exact duplicate to the right.

Splitting the layer1 value into its composite channels only to recombine them seems redundant, but structures the code for the upcoming steps. Run the code to confirm the correct visual output.

This is the simplest blend mode, normal, where the upper ‘layer’ completely conceals everything beneath it (the rainbow colours). We may not have actual layers, but can conceptually visualise the idea as such:

From here onward, we will make adjustments to the r/g/b variables to achieve different blends. Let’s try a multiply. Multiply gets its name from the arithmetic involved, whereby the corresponding channel values of the upper and lower layers are multiplied together. Adapt your code:

The result is a rainbow-sequence of colour tints.

I’m sure that you can guess how the add, and subtract modes work? While you can manually program your own blend modes, it’s easier to reach for Processing’s blend() and blendMode() functions. The blend() has a few more options, but blendMode() is the approach recommended by Processing’s developers. Below is a table of the various blendMode() arguments/modes and their calculations on the red channel. Of course, blue and green channels would be likewise affected.

 BLEND the default/normal blend mode ADD r = red(layer0) + red(layer1) DARKEST r = min( red(layer0), red(layer1) ) DIFFERENCE  SUBTRACT that switches operands to always get a positive value EXCLUSION DIFFERENCE with a lower contrast LIGHTEST r = max( red(layer0), red(layer1) ) MULTIPLY r = red(layer0) * red(layer1) REPLACE BLEND with no alpha support SCREEN r = 1-(1-red(layer0)) * (1-red(layer1)) SUBTRACT r = red(layer0) - red(layer1)

The following image compares each of above-listed modes – beginning with BLEND at the top-left, then proceeding left-to-right, row-by-row, ending on SUBTRACT at the bottom-right.

You can replace the entire for loop with this blend() and image() function.

Be aware, though, the blend mode will persist for any subsequent images or shapes that you draw. For example:

To ‘reset’ to the default, use the blendMode argument, BLEND

Graphic designers, VFX artists, and animators rely on blending modes for many neat tricks. For instance, multiply and subtract are handy for extracting logos from white or black backgrounds; darkest is great for sky replacements; while difference is useful for comparing and aligning video footage. With a bottom-up understanding of how blend modes work, you can take full advantage of them in your creative workflows.

In this challenge, you get to fix a partially complete Processing adaptation of Piet Mondrian’s Composition with Red, Blue, and Yellow.

For this task, the smoothing will be disabled; this will result in sharper lines. If you are looking to disable anti-aliasing (default setting), then the noSmooth() function is what you are after. Anti-aliasing makes edges appear smoother by producing intermediate blended pixels that slightly blur the boundary.

Create a new sketch and save it as “mondrian”. Copy-paste in all of the code below.

You should notice that most of the code is commented out using multi-line comments. Now, moving the opening ''' down as you progress, replace each of the ___ arguments with the correct blend mode. To start you off, here is the first solution:

Here is the final result for your reference.

As a reminder, the blending modes are BLEND, ADD, DARKEST, DIFFERENCE, EXCLUSION, LIGHTEST, MULTIPLY, REPLACE, SCREEN, SUBTRACT.

## Tint and Transparency

Processing’s tint() function tints images using a specified colour. This is like taking a sheet of colour transparency film and placing it over a given image. It’s simple enough to use and best explained with few code snippets.

Create a new sketch and save it as “tints”. Download this guardian lion photograph (Forbidden City, Beijing) and place it your sketch’s “data” sub-directory.

guardian-lion.png

Setup the sketch with the following code:

The tint function accepts three 0255 (RGB) values as arguments.

Alternatively, you could use a single argument of the color() data type:

Run the code to confirm that the tint is working.

The tint function can accept a fourth 0255 argument for transparency (alpha). Create a new orange50 variable, with an opacity of 50%, then add a new tint line followed by a second instance of the image.

If you need to affect the image transparency but retain the colour, use a white tint and your desired alpha value. Once you have set a tint it remains in effect for any further images, unless you include a subsequent tint() line or a noTint().

If you are wondering to yourself, “this looks a lot like a multiply blend mode”, you’d be correct. The effect can be replicated manually by using the loop arrangements from the “blend_modes” exercises. This would entail an additional alpha argument in the colorMode() function and some adapted loop code. For example:

The alpha() function is used to separate out an alpha channel from a color value.

## Lesson 07

That concludes another lesson. You now understand how to manage colour on a channel and bit-level, and have gained insights into how popular image formats work along the way.

In the next lesson, you will look at interactivity in Processing. As you will see, Processing is great for mouse, keyboard, and other interaction, but rather clumsy for building user interfaces. If you have any experience with programming interfaces in other languages (perhaps some JavaScript, etc.), you’ll quickly realise what I mean. However, some useful Processing libraries provide an extended set of turnkey GUI features.

Begin Lesson 07: Mouse and Keyboard Interaction

Complete list of Processing.py lessons

## References

• http://setosa.io/ev/image-kernels/
• https://medium.freecodecamp.org/best-image-format-for-web-in-2019-jpeg-webp-heic-avif-41ba0c1b2789
• https://en.wikipedia.org/wiki/Blend_modes
• https://en.wikipedia.org/wiki/Kernel_(image_processing)