text:
Copied to
clipboard

## G = C7×C4.D4order 224 = 25·7

### Direct product of C7 and C4.D4

direct product, metabelian, nilpotent (class 3), monomial, 2-elementary

Series: Derived Chief Lower central Upper central

 Derived series C1 — C22 — C7×C4.D4
 Chief series C1 — C2 — C4 — C2×C4 — C2×C28 — C7×M4(2) — C7×C4.D4
 Lower central C1 — C2 — C22 — C7×C4.D4
 Upper central C1 — C14 — C2×C28 — C7×C4.D4

Generators and relations for C7×C4.D4
G = < a,b,c,d | a7=b4=1, c4=b2, d2=b, ab=ba, ac=ca, ad=da, cbc-1=b-1, bd=db, dcd-1=b-1c3 >

Smallest permutation representation of C7×C4.D4
On 56 points
Generators in S56
(1 27 17 53 16 45 35)(2 28 18 54 9 46 36)(3 29 19 55 10 47 37)(4 30 20 56 11 48 38)(5 31 21 49 12 41 39)(6 32 22 50 13 42 40)(7 25 23 51 14 43 33)(8 26 24 52 15 44 34)
(1 3 5 7)(2 8 6 4)(9 15 13 11)(10 12 14 16)(17 19 21 23)(18 24 22 20)(25 27 29 31)(26 32 30 28)(33 35 37 39)(34 40 38 36)(41 43 45 47)(42 48 46 44)(49 51 53 55)(50 56 54 52)
(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 29 30 31 32)(33 34 35 36 37 38 39 40)(41 42 43 44 45 46 47 48)(49 50 51 52 53 54 55 56)
(1 4 3 2 5 8 7 6)(9 12 15 14 13 16 11 10)(17 20 19 18 21 24 23 22)(25 32 27 30 29 28 31 26)(33 40 35 38 37 36 39 34)(41 44 43 42 45 48 47 46)(49 52 51 50 53 56 55 54)

G:=sub<Sym(56)| (1,27,17,53,16,45,35)(2,28,18,54,9,46,36)(3,29,19,55,10,47,37)(4,30,20,56,11,48,38)(5,31,21,49,12,41,39)(6,32,22,50,13,42,40)(7,25,23,51,14,43,33)(8,26,24,52,15,44,34), (1,3,5,7)(2,8,6,4)(9,15,13,11)(10,12,14,16)(17,19,21,23)(18,24,22,20)(25,27,29,31)(26,32,30,28)(33,35,37,39)(34,40,38,36)(41,43,45,47)(42,48,46,44)(49,51,53,55)(50,56,54,52), (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,29,30,31,32)(33,34,35,36,37,38,39,40)(41,42,43,44,45,46,47,48)(49,50,51,52,53,54,55,56), (1,4,3,2,5,8,7,6)(9,12,15,14,13,16,11,10)(17,20,19,18,21,24,23,22)(25,32,27,30,29,28,31,26)(33,40,35,38,37,36,39,34)(41,44,43,42,45,48,47,46)(49,52,51,50,53,56,55,54)>;

G:=Group( (1,27,17,53,16,45,35)(2,28,18,54,9,46,36)(3,29,19,55,10,47,37)(4,30,20,56,11,48,38)(5,31,21,49,12,41,39)(6,32,22,50,13,42,40)(7,25,23,51,14,43,33)(8,26,24,52,15,44,34), (1,3,5,7)(2,8,6,4)(9,15,13,11)(10,12,14,16)(17,19,21,23)(18,24,22,20)(25,27,29,31)(26,32,30,28)(33,35,37,39)(34,40,38,36)(41,43,45,47)(42,48,46,44)(49,51,53,55)(50,56,54,52), (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,29,30,31,32)(33,34,35,36,37,38,39,40)(41,42,43,44,45,46,47,48)(49,50,51,52,53,54,55,56), (1,4,3,2,5,8,7,6)(9,12,15,14,13,16,11,10)(17,20,19,18,21,24,23,22)(25,32,27,30,29,28,31,26)(33,40,35,38,37,36,39,34)(41,44,43,42,45,48,47,46)(49,52,51,50,53,56,55,54) );

G=PermutationGroup([[(1,27,17,53,16,45,35),(2,28,18,54,9,46,36),(3,29,19,55,10,47,37),(4,30,20,56,11,48,38),(5,31,21,49,12,41,39),(6,32,22,50,13,42,40),(7,25,23,51,14,43,33),(8,26,24,52,15,44,34)], [(1,3,5,7),(2,8,6,4),(9,15,13,11),(10,12,14,16),(17,19,21,23),(18,24,22,20),(25,27,29,31),(26,32,30,28),(33,35,37,39),(34,40,38,36),(41,43,45,47),(42,48,46,44),(49,51,53,55),(50,56,54,52)], [(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,29,30,31,32),(33,34,35,36,37,38,39,40),(41,42,43,44,45,46,47,48),(49,50,51,52,53,54,55,56)], [(1,4,3,2,5,8,7,6),(9,12,15,14,13,16,11,10),(17,20,19,18,21,24,23,22),(25,32,27,30,29,28,31,26),(33,40,35,38,37,36,39,34),(41,44,43,42,45,48,47,46),(49,52,51,50,53,56,55,54)]])

C7×C4.D4 is a maximal subgroup of   C23.3D28  C23.4D28  M4(2).19D14  D28.1D4  D281D4  D28.2D4  D28.3D4

77 conjugacy classes

 class 1 2A 2B 2C 2D 4A 4B 7A ··· 7F 8A 8B 8C 8D 14A ··· 14F 14G ··· 14L 14M ··· 14X 28A ··· 28L 56A ··· 56X order 1 2 2 2 2 4 4 7 ··· 7 8 8 8 8 14 ··· 14 14 ··· 14 14 ··· 14 28 ··· 28 56 ··· 56 size 1 1 2 4 4 2 2 1 ··· 1 4 4 4 4 1 ··· 1 2 ··· 2 4 ··· 4 2 ··· 2 4 ··· 4

77 irreducible representations

 dim 1 1 1 1 1 1 1 1 2 2 4 4 type + + + + + image C1 C2 C2 C4 C7 C14 C14 C28 D4 C7×D4 C4.D4 C7×C4.D4 kernel C7×C4.D4 C7×M4(2) D4×C14 C22×C14 C4.D4 M4(2) C2×D4 C23 C28 C4 C7 C1 # reps 1 2 1 4 6 12 6 24 2 12 1 6

Matrix representation of C7×C4.D4 in GL6(𝔽113)

 106 0 0 0 0 0 0 106 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1
,
 112 0 0 0 0 0 0 112 0 0 0 0 0 0 0 1 0 0 0 0 112 0 0 0 0 0 0 0 0 1 0 0 0 0 112 0
,
 1 0 0 0 0 0 112 112 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 112 0 0 0 0 0 0 1 0 0
,
 1 2 0 0 0 0 112 112 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 112 0 0 0

G:=sub<GL(6,GF(113))| [106,0,0,0,0,0,0,106,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1],[112,0,0,0,0,0,0,112,0,0,0,0,0,0,0,112,0,0,0,0,1,0,0,0,0,0,0,0,0,112,0,0,0,0,1,0],[1,112,0,0,0,0,0,112,0,0,0,0,0,0,0,0,112,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0],[1,112,0,0,0,0,2,112,0,0,0,0,0,0,0,0,0,112,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0] >;

C7×C4.D4 in GAP, Magma, Sage, TeX

C_7\times C_4.D_4
% in TeX

G:=Group("C7xC4.D4");
// GroupNames label

G:=SmallGroup(224,49);
// by ID

G=gap.SmallGroup(224,49);
# by ID

G:=PCGroup([6,-2,-2,-7,-2,-2,-2,336,361,3363,2530,88]);
// Polycyclic

G:=Group<a,b,c,d|a^7=b^4=1,c^4=b^2,d^2=b,a*b=b*a,a*c=c*a,a*d=d*a,c*b*c^-1=b^-1,b*d=d*b,d*c*d^-1=b^-1*c^3>;
// generators/relations

Export

׿
×
𝔽


text:
# American Institute of Mathematical Sciences

January  2021, 14(1): 1-24. doi: 10.3934/krm.2020046

## Kinetic modelling of colonies of myxobacteria

 1 University of Vienna, Faculty for Mathematics, Oskar-Morgenstern-Platz 1, 1090 Wien, Austria 2 University College London, Dept. of Mathematics, 25 Gordon Street, WC1H 0AY London, UK

* Corresponding author: Christian Schmeiser

Received  January 2020 Revised  August 2020 Published  September 2020

A new kinetic model for the dynamics of myxobacteria colonies on flat surfaces is derived formally, and first analytical and numerical results are presented. The model is based on the assumption of hard binary collisions of two different types: alignment and reversal. We investigate two different versions: a) realistic rod-shaped bacteria and b) artificial circular shaped bacteria called Maxwellian myxos in reference to the similar simplification of the gas dynamics Boltzmann equation for Maxwellian molecules. The sum of the corresponding collision operators produces relaxation towards nematically aligned equilibria, i.e. two groups of bacteria polarized in opposite directions.

For the spatially homogeneous model a global existence and uniqueness result is proved as well as exponential decay to equilibrium for special initial conditions and for Maxwellian myxos. Only partial results are available for the rod-shaped case. These results are illustrated by numerical simulations, and a formal discussion of the macroscopic limit is presented.

Citation: Sabine Hittmeir, Laura Kanzler, Angelika Manhart, Christian Schmeiser. Kinetic modelling of colonies of myxobacteria. Kinetic & Related Models, 2021, 14 (1) : 1-24. doi: 10.3934/krm.2020046
##### References:

show all references

##### References:
Graphic illustration of the collision rules. (a): Alignment collisions with two-step geometric algorithm to regularize it. (b): Already invertible reversal collisions
Support of two group data (solid lines, purple)
Two group initial conditions with the same mass in $\mathbb{T}^1_{+}$ and $\mathbb{T}^1_{-}$; rod shaped bacteria. Left: uniform distributions within $\mathbb{T}^1_{+}$ and $\mathbb{T}^1_{-}$. Right: vacuum around $\pm\pi/2$
Left: initial condition with uniform distribution in $\mathbb{T}^1_{+}$ and vacuum everywhere else. Right: initially two concentrated patches at a distance somewhat bigger than $\pi/2$ (yellow at the left end). Outer stripes created by reversal, then fill-in by alignment, followed by concentration towards opposite directions. The mean angles $\bar \varphi_+$ (red line) and $\bar \varphi_-$ (dotted red line) in the two groups change significantly
Instability of constant positive steady states. Left: random initial perturbation, leading to an unpredictable equilibrium direction. Right: initial perturbation at one direction, which eventually becomes the equilibrium direction. Note that this differs from the simulations in Figure 4, left, by the fact that a positive state is perturbed, and therefore reversal collisions are active
Left: The evolution of the inverse square root of the variance $V[f]$ from the simulation depicted on the left side of Figure 4, supporting the validity of Haff's law for rod shaped myxos. Right: Semi-log plot of $V[f]$ for a simulation with the same initial data, but for Maxwellian myxos, demonstrating exponential decay to equilibrium as shown in Lemma 4.2 a)
 [1] Junichi Minagawa. On the uniqueness of Nash equilibrium in strategic-form games. Journal of Dynamics & Games, 2020, 7 (2) : 97-104. doi: 10.3934/jdg.2020006 [2] Alina Chertock, Alexander Kurganov, Mária Lukáčová-Medvi${\rm{\check{d}}}$ová, Șeyma Nur Özcan. An asymptotic preserving scheme for kinetic chemotaxis models in two space dimensions. Kinetic & Related Models, 2019, 12 (1) : 195-216. doi: 10.3934/krm.2019009 [3] Thomas Alazard. A minicourse on the low Mach number limit. Discrete & Continuous Dynamical Systems - S, 2008, 1 (3) : 365-404. doi: 10.3934/dcdss.2008.1.365 [4] Jon Aaronson, Dalia Terhesiu. Local limit theorems for suspended semiflows. Discrete & Continuous Dynamical Systems - A, 2020, 40 (12) : 6575-6609. doi: 10.3934/dcds.2020294 [5] Elena Bonetti, Pierluigi Colli, Gianni Gilardi. Singular limit of an integrodifferential system related to the entropy balance. Discrete & Continuous Dynamical Systems - B, 2014, 19 (7) : 1935-1953. doi: 10.3934/dcdsb.2014.19.1935 [6] Naeem M. H. Alkoumi, Pedro J. Torres. Estimates on the number of limit cycles of a generalized Abel equation. Discrete & Continuous Dynamical Systems - A, 2011, 31 (1) : 25-34. doi: 10.3934/dcds.2011.31.25 [7] Raz Kupferman, Cy Maor. The emergence of torsion in the continuum limit of distributed edge-dislocations. Journal of Geometric Mechanics, 2015, 7 (3) : 361-387. doi: 10.3934/jgm.2015.7.361 [8] Emma D'Aniello, Saber Elaydi. The structure of $\omega$-limit sets of asymptotically non-autonomous discrete dynamical systems. Discrete & Continuous Dynamical Systems - B, 2020, 25 (3) : 903-915. doi: 10.3934/dcdsb.2019195 [9] Jan Prüss, Laurent Pujo-Menjouet, G.F. Webb, Rico Zacher. Analysis of a model for the dynamics of prions. Discrete & Continuous Dynamical Systems - B, 2006, 6 (1) : 225-235. doi: 10.3934/dcdsb.2006.6.225 [10] Johannes Kellendonk, Lorenzo Sadun. Conjugacies of model sets. Discrete & Continuous Dynamical Systems - A, 2017, 37 (7) : 3805-3830. doi: 10.3934/dcds.2017161 [11] Didier Bresch, Thierry Colin, Emmanuel Grenier, Benjamin Ribba, Olivier Saut. A viscoelastic model for avascular tumor growth. Conference Publications, 2009, 2009 (Special) : 101-108. doi: 10.3934/proc.2009.2009.101 [12] Ondrej Budáč, Michael Herrmann, Barbara Niethammer, Andrej Spielmann. On a model for mass aggregation with maximal size. Kinetic & Related Models, 2011, 4 (2) : 427-439. doi: 10.3934/krm.2011.4.427 [13] Martin Bohner, Sabrina Streipert. Optimal harvesting policy for the Beverton--Holt model. Mathematical Biosciences & Engineering, 2016, 13 (4) : 673-695. doi: 10.3934/mbe.2016014 [14] Juan Manuel Pastor, Javier García-Algarra, Javier Galeano, José María Iriondo, José J. Ramasco. A simple and bounded model of population dynamics for mutualistic networks. Networks & Heterogeneous Media, 2015, 10 (1) : 53-70. doi: 10.3934/nhm.2015.10.53 [15] Chin-Chin Wu. Existence of traveling wavefront for discrete bistable competition model. Discrete & Continuous Dynamical Systems - B, 2011, 16 (3) : 973-984. doi: 10.3934/dcdsb.2011.16.973 [16] Michael Grinfeld, Amy Novick-Cohen. Some remarks on stability for a phase field model with memory. Discrete & Continuous Dynamical Systems - A, 2006, 15 (4) : 1089-1117. doi: 10.3934/dcds.2006.15.1089 [17] Alba Málaga Sabogal, Serge Troubetzkoy. Minimality of the Ehrenfest wind-tree model. Journal of Modern Dynamics, 2016, 10: 209-228. doi: 10.3934/jmd.2016.10.209 [18] Paula A. González-Parra, Sunmi Lee, Leticia Velázquez, Carlos Castillo-Chavez. A note on the use of optimal control on a discrete time model of influenza dynamics. Mathematical Biosciences & Engineering, 2011, 8 (1) : 183-197. doi: 10.3934/mbe.2011.8.183 [19] Martial Agueh, Reinhard Illner, Ashlin Richardson. Analysis and simulations of a refined flocking and swarming model of Cucker-Smale type. Kinetic & Related Models, 2011, 4 (1) : 1-16. doi: 10.3934/krm.2011.4.1 [20] Ronald E. Mickens. Positivity preserving discrete model for the coupled ODE's modeling glycolysis. Conference Publications, 2003, 2003 (Special) : 623-629. doi: 10.3934/proc.2003.2003.623

2019 Impact Factor: 1.311

format: plain


text:
## Found 139 Documents (Results 1–100)

100
MathJax

Full Text:

### Generalized Keller-Osserman conditions for fully nonlinear degenerate elliptic equations. (English. Russian original)Zbl 07542523

J. Math. Sci., New York 260, No. 4, 469-479 (2022); translation from Sovrem. Mat., Fundam. Napravl. 64, No. 1, 74-85 (2018).
Full Text:

Full Text:

Full Text:

Full Text:

### Biological population management based on a Hamilton-Jacobi-Bellman equation with boundary blow up. (English)Zbl 1484.92085

MSC:  92D25 49L25 60H30
Full Text:

Full Text:

### Some elliptic problems involving the gradient on general bounded and exterior domains. (English)Zbl 1473.35284

MSC:  35J91 35J25 35A01
Full Text:

Full Text:

Full Text:

Full Text:

### On the problem of maximal $$L^q$$-regularity for viscous Hamilton-Jacobi equations. (English)Zbl 1467.35155

MSC:  35J62 35B65
Full Text:

Full Text:

### Ergodic pairs for degenerate pseudo Pucci’s fully nonlinear operators. (English)Zbl 1466.35206

MSC:  35J70 35J75
Full Text:

Full Text:

### Precise blowup rate near the boundary of boundary blowup solutions to $$k$$-Hessian equation. (English)Zbl 1465.35265

MSC:  35J96 35B44
Full Text:

### Second order boundary estimate of boundary blowup solutions to $$k$$-Hessian equation. (English)Zbl 1465.35264

MSC:  35J96 35B44 35B40
Full Text:

### Singular solutions of a Lane-Emden system. (English)Zbl 1459.35141

MSC:  35J57 35J91 35A01
Full Text:

### Large solutions to quasilinear problems involving the $$p$$-Laplacian as $$p$$ diverges. (English)Zbl 1459.35218

MSC:  35J92 35J25 35B44
Full Text:

### Normalized concentrating solutions to nonlinear elliptic problems. (English)Zbl 1455.35119

MSC:  35J91 35B09 35A01
Full Text:

MSC:  91B64
Full Text:

Full Text:

Full Text:

Full Text:

### On dynamic programming principle for stochastic control under expectation constraints. (English)Zbl 1447.93374

MSC:  93E20 90C39 91G10
Full Text:

Full Text:

### Singular solutions of a $$p$$-Laplace equation involving the gradient. (English)Zbl 1440.35177

MSC:  35J92 35B09 35A01
Full Text:

Full Text:

### Exact boundary behavior of large solutions to semilinear elliptic equations with a nonlinear gradient term. (English)Zbl 1437.35364

MSC:  35J62 35J67
Full Text:

Full Text:

### An elliptic partial differential equation and its application. (English)Zbl 1430.35073

MSC:  35J15 35J62
Full Text:

### Entire solutions of a nonlinear diffusion system. (English)Zbl 1423.35197

Dutta, Hemen (ed.) et al., Applied mathematical analysis: theory, methods, and applications. Cham: Springer. Stud. Syst. Decis. Control 177, 459-485 (2020).
MSC:  35K57 35A01
Full Text:

### Ergodic pairs for singular or degenerate fully nonlinear operators. (English)Zbl 1437.35370

MSC:  35J70 35J75
Full Text:

Full Text:

Full Text:

### An ODE approach for fractional Dirichlet problems with gradient nonlinearity. (English)Zbl 1436.35315

MSC:  35R11 35A24
Full Text:

### Time-dependent focusing mean-field games: the sub-critical case. (English)Zbl 1408.35076

MSC:  35K55 49N70 35Q84
Full Text:

Full Text:

### Concentration of ground states in stationary mean-field games systems. (English)Zbl 1404.35155

MSC:  35J47 35J50
Full Text:

Full Text:

### Liouville theorems for elliptic systems with nonlinear gradient terms. (English)Zbl 1404.35074

MSC:  35B53 35J57 35J61
Full Text:

### Separable infinity harmonic functions in cones. (English)Zbl 1392.35150

MSC:  35J62 35B09
Full Text:

### Necessary and sufficient conditions for existence of blow-up solutions for elliptic problems in Orlicz-Sobolev spaces. (English)Zbl 1387.35280

MSC:  35J62 35B44
Full Text:

Full Text:

### Singular solutions of elliptic equations involving nonlinear gradient terms on perturbations of the ball. (English)Zbl 1387.35303

MSC:  35J75 47H10
Full Text:

### Existence and regularity of nonlinear advection problems. (English)Zbl 1379.35058

MSC:  35J05 35J62 35B09
Full Text:

### Large solutions to the Monge-Ampère equations with nonlinear gradient terms: existence and boundary behavior. (English)Zbl 1379.35157

MSC:  35J96 35A02 35B44
Full Text:

### A Fourier analysis approach to elliptic equations with critical potentials and nonlinear derivative terms. (English)Zbl 1383.35087

MSC:  35J60 35R11
Full Text:

Full Text:

### Boundary blow-up solutions to nonlocal elliptic equations with gradient nonlinearity. (English)Zbl 1375.35596

MSC:  35R11 35B44 35R06
Full Text:

### On the radial solutions of a system with weights under the Keller-Osserman condition. (English)Zbl 1356.35109

MSC:  35J47 35B09 35J61
Full Text:

### Boundary behavior of large solutions to $$p$$-Laplacian elliptic equations. (English)Zbl 1352.35064

MSC:  35J92 35B40
Full Text:

Full Text:

MSC:  35J61
Full Text:

Full Text:

Full Text:

MSC:  35J62
Full Text:

Full Text:

Full Text:

Full Text:

Full Text:

Full Text:

### On the inequality $$F(x,D^2u)\geq f(u) +g(u)| Du|^q$$. (English)Zbl 1342.35116

MSC:  35J87 35D40
Full Text:

### Boundary behavior of large solutions for semilinear elliptic equations with weights. (English)Zbl 1354.35049

MSC:  35J61 35B44
Full Text:

### Entire solutions of fully nonlinear elliptic equations with a superlinear gradient term. (English)Zbl 1338.35170

MSC:  35J60 35B08 35D40
Full Text:

### Large solutions for a class of semilinear integro-differential equations with censored jumps. (English)Zbl 1334.35372

MSC:  35R09 45P05 35B40
Full Text:

Full Text:

Full Text:

### Global continuation beyond singularities on the boundary for a degenerate diffusive Hamilton-Jacobi equation. (English. French summary)Zbl 1359.35091

MSC:  35K20 49L25 53C44 35B50 35B05
Full Text:

MSC:  35J05
Full Text:

Full Text:

### Wiener criteria for existence of large solutions of quasilinear elliptic equations with absorption. (English)Zbl 1314.31013

MSC:  31C15 35J92
Full Text:

Full Text:

### Viscosity solutions of general viscous Hamilton-Jacobi equations. (English)Zbl 1327.35058

MSC:  35D40 35B51
Full Text:

Full Text:

Full Text:

Full Text:

Full Text:

Full Text:

MSC:  35J47
Full Text:

Full Text:

Full Text:

Full Text:

### Blow-up rates and uniqueness of large solutions for elliptic equations with nonlinear gradient term and singular or degenerate weights. (English)Zbl 1268.35033

MSC:  35J25 35B09 35B44
Full Text:

### Isoperimetric inequalities for an ergodic stochastic control problem. (English)Zbl 1260.49081

MSC:  49Q20 35B44 93E20
Full Text:

### Existence and uniqueness of solutions of nonlinear elliptic equations without growth conditions at infinity. (English)Zbl 1308.35102

MSC:  35J62 35A01 35A02
Full Text:

### Boundary singularities of solutions to elliptic viscous Hamilton-Jacobi equations. (English)Zbl 1260.35059

MSC:  35J62 35J25
Full Text:

Full Text:

### Null controllability of viscous Hamilton-Jacobi equations. (English)Zbl 1244.93027

MSC:  93B05 93C20 35Q35
Full Text:

### Stochastic homogenization of Hamilton-Jacobi and degenerate Bellman equations in unbounded environments. (English. French summary)Zbl 1246.35029

MSC:  35B27 60K37 35F21
Full Text:

### Large solutions for nonlinear parabolic equations without absorption terms. (English)Zbl 1246.35116

MSC:  35K92 35K20
Full Text:

Full Text:

Full Text:

### Gradient bounds for elliptic problems singular at the boundary. (English)Zbl 1255.35116

MSC:  35J75 35R60 35Q93
Full Text:

### Large solution to nonlinear elliptic equation with nonlinear gradient terms. (English)Zbl 1231.35068

MSC:  35J60 35J25 35B40
Full Text:

Full Text:

### Keller-Osserman type conditions for differential inequalities with gradient terms on the Heisenberg group. (English)Zbl 1223.35308

MSC:  35R45 35R03 35B50
Full Text:

Full Text:

Full Text:

### On the large time behavior of solutions of the Dirichlet problem for subquadratic viscous Hamilton-Jacobi equations. (English)Zbl 1209.37069

MSC:  37K05 35F21 70H20
Full Text:

all top 5

all top 5

all top 5

all top 3


text:
# When do gauge theories have protected gapless excitations?

Goldstone's theorem states that a system in which a continuous symmetry is spontaneously broken necessarily has gapless excitations. (A hand-waving "proof" of Goldstone's theorem can be given by noting that very large wavelength spatial variations in the order parameter should have very small energy cost).

On the other hand, there appears to be another way to obtain protected gapless excitations, namely by having a (possibly emergent) local gauge invariance where the gauge group is continuous, so that there is a gapless gauge boson. What is the most general statement that one can make in this case, analogous to Goldstone's theorem? Clearly, the gauge charges must remain deconfined, since we know that confined/Higgs phases of gauge theories are gapped. Is the existence of deconfined gauge charges (for a continuous gauge group) a sufficient condition to ensure gaplessness, and if so, how would one prove this?

Is the existence of deconfined gauge charges a sufficient condition to ensure gaplessness?

I think the answer is NO, such as the $Z_2$ gauge theory in 2+1D and 3+1D.

I believe that the existence of deconfined gauge charges of a continuous gauge group is a sufficient condition to ensure gaplessness?

Hastings and I have a paper (http://arxiv.org/abs/cond-mat/0503554 ) arguing for a "Goldstone's theorem" for gauge theory: Gapless gauge boson is robust agianst any local perturbations. In other words, the gaplessness of gauge boson is topological, no local perturbation can gap them.

But the gaplessness is not protected by gauge symmetry. In a lattice gauge theory, with gapless gauge boson, even a local perturbation that break the lattice gauge symmetry cannot give the gauge boson a mass (or a gap).

Both gauge symmetry and gaplessness are results of long range many-body entanglement.

• Dear Prof. Wen, thanks for your answer. Indeed I should have said "continuous gauge group". It was reading your paper with Hastings that inspired me to ask this question, but in that paper you just argue that the gapless phase is stable to small perturbations. My question is, does there exist ANY phase in which there are deconfined gauge charges (for continuous gauge group) but not gapless excitations, and if not, why not? – Dominic Else Aug 19 '15 at 16:24

Here is a partial answer that depends on a particular choice of local gauge constraint. In a U(1) gauge theory, the usual gauge constraint is just Gauss' Law, $$\nabla \cdot \mathbf{E} = \rho.$$ This in turn implies Coulomb's Law $\mathbf{E} \sim 1/r$ for the electric field surrounding a deconfined point charge. Such a long-range interaction ought to be mediated by a gapless photon. Hence, we conclude that deconfined gauge charges implies gaplessness in U(1) gauge theory, at least for this choice of gauge constraint.


text:
# How To Check If A Variable Is Not Null in Python

If you are having trouble with the “How to check if a variable is not Null in python” problem and don’t know how to do it, don’t miss our article. We will give you some solutions for checking if a variable is not Null. Read on it.

## How to check type of any variable in python?

In Python, we can check the type of any variable by the following command:

type(variable_name)

Example

Input:

integer = 1
print(type(integer))

Output:

<class 'int'>

Input

myDict = {
"sky": "blue",
"tree": "green",
"sun": "yellow"
}

print(type(myDict))

Output

<class 'dict'>

## To check if a variable is not Null

First, keep your mind that there is no “Null Type” in python, it is “None Type” instead. Now, let’s dive into our article to get some methods to verify whether a variable’s type is None or not

### Using “is not” or “ïs” keyword

The result of this method is a boolean type. Look at the following example:

Input:

obj = 'This is a string'
print(type(obj) is not None)

Output:

True

Input:

obj = 'This is a string'
print(obj is None)

Output:

False

### Using “==” and “!=” operator

The result of this method also is boolean type:

Input:

obj = 'This is a string'
print(type(obj) == None)

Output:

False

Input:

obj = 'This is a string'
print(obj != None)

Output:

True

### Using “if”, “if not” and else statement

The last method to check if a variable is not Null is using if, if not and else statement.

Input:

obj1 = None
obj2 = "String"

if obj1:
print("obj1 is not None")
else:
print("obj1 is None")

if not obj1:
print("obj2 is not None")
else:
print("obj2 is None")

Output:

obj1 is None
obj2 is not None

## Summary

To sum up, in Python, it is None type instead Null type and the condition to check if a variable is not Null is quite simple by using is, is not keyword, operator like != or == and if, if not, else statement.

Maybe you are interested:


text:
Physics Help Forum Water flows into a pool how long will it take to fill?

 Thermodynamics and Fluid Mechanics Thermodynamics and Fluid Mechanics Physics Help Forum

 Feb 2nd 2018, 06:53 PM #1 Junior Member   Join Date: Feb 2018 Posts: 1 Water flows into a pool how long will it take to fill? Water flows through a 2.3-cm-diameter hose at 4 m/s. How long, in minutes, will it take to fill a 750 L kiddie pool?
 Feb 2nd 2018, 08:07 PM #2 Senior Member   Join Date: Apr 2017 Posts: 305 First find the volume of a 4 meter length of the pipe V= phi x Radius x Radius x 400 (Radius is half the diameter) We are using cm ... (4m =400 cm) so the answer will be in cc ... it will be more than 1200cc .... and this is how much water enters the pool every second. remember 1000cc is a liter , (L)
 Feb 3rd 2018, 04:44 AM #3 Senior Member   Join Date: Aug 2010 Posts: 321 Surely you mean "pi" ($\pi$), not "phi" ($\phi$).
 Feb 3rd 2018, 08:07 AM #4 Senior Member   Join Date: Jun 2010 Location: NC Posts: 388 Hey Cooter Hey Cooter... Here are two more "Mass Equation" problems. Refill the Pool | THERMO Spoken Here! Dig Suez | THERMO Spoken Here! Good Luck, jp
Feb 3rd 2018, 07:09 PM   #5
Senior Member

Join Date: Apr 2017
Posts: 305
 Originally Posted by HallsofIvy Surely you mean "pi" ($\pi$), not "phi" ($\phi$).
Sure ... that's what I said ..phi pronounced pie ...apple pie

Fie is pronounced Fie

 Tags 23cmdiameter, fill, flows, hose, long, pool, water

 Thread Tools Display Modes Linear Mode

 Similar Physics Forum Discussions Thread Thread Starter Forum Replies Last Post tucnasam Thermodynamics and Fluid Mechanics 1 Feb 11th 2017 08:42 AM beermaker Advanced Thermodynamics 5 Feb 27th 2015 02:40 PM mp0wrd Advanced Mechanics 0 Jan 30th 2011 09:45 AM alternative Thermodynamics and Fluid Mechanics 2 Oct 7th 2010 08:50 AM cherry_t Kinematics and Dynamics 2 Apr 8th 2010 10:19 PM


text:
# Talking I2C

## How to communicate with sensors and low-level chips

Reading datasheets for fun and profit, or how I learned to stop worrying and convert analog signals into elixir terms.

## Watering My Plants

I want to have a plant on my desk at work, but each time I bring one to the office it promptly dies. Technology is clearly the solution to my problem. I need to be told when to water my plants, or even better, have them water themselves. We’ll start with a soil moisture sensor.

## Analog Sensors

This sensor has 3 wires. GND and VCC provide power to the device and the SIG wire will carry a voltage between 0 and 3 volts depending on how much moisture is around the sensor. This is known as an analog interface and is a very simple concept, but if you are using a raspberry pi, it turns out to be a a little tricky to read that value.

All of the pins on the raspberry pi are digital pins meaning that they can only be read as 0 or 1 depending on whether the voltage is closer to 0 or 3.3 volts. We will need something that converts the analog signal into a digital signal that the raspberry pi can read.

## Analog to Digital

Analog to digital converters take in an analog signal like the 0-3 volt signal described above, and turn it into a digital signal. I’m using an ADS1115 chip which uses an i²c interface so that you can read 4 different analog signals with just one pair of wires. This allows you to read each of the analog signals as a 2-byte value, a number between -32,768 and 32,767. The raspberry pi has built-in support for talking to I2C devices, so this is a great option for my use-case.

## Eye to See

The I2C protocol allows you to have multiple devices connected to the same pair of wires that act as a message bus. The raspberry pi acts as a master, meaning that it initiates communication. Each device on the bus has an address, and you always use that address when sending or receiving data.

Because the protocol is so basic, many devices implement a register-based protocol. Each time you want to send a message to the device, you send a first byte that identifies which register you are writing to and the rest of the bytes are the information you want to write into that register. If you want to ask for some information you write 1 byte to identify what you are asking about, and then you read a certain number of bytes from that address to get the data you want.

## Checking the Soil

The first thing we’ll do is check the configuration of the device. To do this well send 1 byte telling the chip which register we want to sent and then read back 2 bytes (the size of the configuration register).

{:ok, bus} = Circuits.I2C.open("i2c-1")
:ok = Circuits.I2C.write(bus, 72, <<1>>)
{:ok, <<133, 131>>} = Circuits.I2C.read(bus, 72, 2)
# I2C also has a convenience method for this
{:ok, <<133, 131>>} = Circuits.I2C.write_read(bus, 72, <<1>>, 2)

We’re getting back some data, but what do those bytes mean? We’ll need to take a look at the datasheet for the ADS1115 chip. These 16 bits of data tell us 9 different things about how the chip is currently operating. That’s a lot of information packed into the space of just two ascii characters.

Luckily, we can use Elixir’s binary pattern matching syntax to pull out this information. Binary pattern matching allows us to ask for information by expressing how we expect the information to be laid out across the bytes. No bit-shifting required.

<< status::size(1), mux::size(3), _other_stuff::size(12) >> = <<133, 131>>

We can also similarly build a new binary to write new configuration to the register.

config_bytes = << status::size(1), mux::size(3), other_stuff::size(12) >>
config_register = 1
Circuits.I2C.write(bus, 72, <<config_register, config_bytes::binary>>)

## Sharing What We’ve Learned

The binary pattern matching syntax is really helpful for parsing binary data, but learning which bits do which things still requires some squinting and a datasheet. So I went ahead and published the ADS1115 package on hex.pm so that other people can deal with a struct of config data.

{:ok, bus} = Circuits.I2C.open("i2c-1")
performing_conversion: false,
mux: {:ain0, :ain1},
gain: 2048,
mode: :single_shot,
data_rate: 128,
comp_polarity: :active_low,
comp_latch: false,
comp_queue: :disabled
}}

The package also gives you an easy way to read the sensor. Now I’m ready to check my soil moisture sensors.

## Will This Plant Live?

Technology is no guarantee of success, but this is the best chance I have at keeping a plant alive. I’ll be doing some basic experiments around how much moisture different plants need and whether they like to have dry cycles, but here’s a simplistic example of to monitor and water a plant.

defmodule Seedling do
use GenServer

@check_interval 1_000 # wait 1000ms between checking the sensor
@pump_control_pin 4 # the GPIO pin we are using to control our water pump
@sensor_threshold 23_989 # a little experimenting showed that I get this reading or lower when soil is wet

def init do
{:ok, bus} = Circuits.I2C.open("i2c-1")
{:ok, pump} = Circuits.GPIO.open(@pump_control_pin, :output, initial_value: 0)
{:ok, {bus, pump}, @check_interval} # check the moisture in 1 second
end

def handle_info(:timeout, {bus, pump}) do


text:
# M_2(k) as a central extension

Does there exist a field $k$ and a subring $R$ of $S = M_2(k)$ such that $R$ is not finitely generated over its center, $S=kR$ and $1_R = 1_S$? ($S$ is the algebra of $2 \times 2$ matrices over $k$.)

-

## 2 Answers

I think the answer is "yes". Let $A$ be a non-Noetherian integral domain (for example a polynomial ring in infinitely many variables over a field), let $I$ denote a non-finitely-generated ideal, and let $k$ be the field of fractions of $A$. Let $R$ denote the ring of $2\times 2$ matrices with coefficients in $A$ and with bottom left hand entry in $I$.

I think this ticks all the boxes. For example $kR=M_2(k)$ because I can scale any element of $M_2(k)$ until it's in $M_2(R)$ and then again so that all entries are in $I$.

However, I don't think $R$ can be finitely-generated over its centre (which is easily checked to be $A$). For if $r_1,r_2,\ldots,r_n$ are finitely many elements of $R$ then the ring they generate over $A$ will be contained in the $2\times 2$ matrices with coefficients in $A$ and bottom left hand entry in $J$, the finitely-generated ideal generated by the bottom left hand entries of the $r_i$, and this is a proper subset of $I$.

-
Nice example, thanks. –  iravan Nov 20 '10 at 0:59

This question has been explored in the context of polynomial identity rings (PI-rings). Your hypothesis implies that $R$ is a prime PI-ring of PI-degree 2 (see below). However, the main structure theorems of PI-theory, Kaplansky's Theorem, Posner's Theorem, Artin-Procesi Theorem and central polynomials, are in the opposite direction. They show that if a ring $R$ satisfies a polynomial identity plus a suitable further hypothesis, then $R$ is, or almost is, a finite module over its center, or at least has a large center.

One example is the strong form of Posner's theorem using central polynomials: Let $R$ be a prime PI-ring with center $C$, and let $T = C - \{0\}$. Then for some integer $n$, $T^{-1}R$ is a central simple algebra of finite dimension $n^2$ over its center $T^{-1}C$.

The theory of central simple algebras says that if $A$ is finite dimensional central simple over a field $L$, then its dimension over $L$ is a square $n^2$, and there is a unit preserving $L$-algebra embedding into $M_n(k)$ for some extension field $k$ of $L$.

Combining this theory with Posner's theorem gives: A ring $R$ (with unit) is a prime PI-ring if and only if there is a field $k$, an integer $n$, and a unit preserving ring embedding $R \to M_n(k)$ such that $kR = M_n(k)$, where $R$ is identified with its image in $M_n(k)$.

The field $k$ is not unique, but the integer $n$ is. It is called the PI-degree of $R$. Thus your hypothesis: "$R$ is a subring of $S = M_2(k)$, where $k$ is a field, $S = kR$, and $1_R = 1_S$", implies that $R$ is a prime PI-ring of PI-degree 2.

One result showing that a prime PI-ring is close to being a finite module over its center is a theorem of mine (p. 174 in Drensky-Formanek, "Polynomial Identity Rings"): If $R$ is a prime PI-ring of PI-degree $n$ with center $C$, then there is a $C$-module embedding of $R$ into a free $C$-module of rank $n^2$.

As for your question, there is an example due to Cauchon (p. 228 in Rowen, "Polynomial Identities in Ring Theory") of a Noetherian prime PI-ring of PI-degree 2 which is not a finite module over its center. Cauchon also proved that if a prime PI-ring has the ascending chain condition on two-sided ideals, then it has the ascending chain condition on left and right ideals. In other words, left Noetherian, right Noetherian, and ACC on two-sided ideals are equivalent for prime PI-rings.

-


text:
# Spring Constant Formula

According to Hooke’s law, the force required to compress or extend a spring is directly proportional to the distance it is stretched.

## Spring Constant Formula

The formula of spring constant is given as:

 Formula F=-kx SI unit N.m-1

Where,

• F is the restoring force of the spring directed towards the equilibrium
• k is the spring constant in N.m-1
• x is the displacement of the spring from its equilibrium position

In other words, the spring constant is the force applied if the displacement in the spring is unity. If a force F is considered that stretches the spring so that it displaces the equilibrium position by x.

## Spring Constant Dimensional Formula

We know that,

F=-kx

Therefore, $k=\frac{F}{x}$

Dimension of F=[MLT-2]

Dimension of x= [L]

Therefore, dimension of k=$k=\frac{[MLT^{-2}]}{[L]}=[MT^{-2}]$

The Spring Constant Formula is given as, $k=\frac{F}{x}$ where,

• F = Force applied,
• x = displacement by the spring

It is expressed in Newton per meter (N/m).

### Solved Examples

Example 1 A spring with load 5 Kg is stretched by 40 cm. Determine its spring constant.
Solution:
Given:
Mass m = 5 Kg

Displacement x = 40 cm

We know that,

Force F = m a = 5 × 0.4 = 2 N

The spring constant is given as:
$k=\frac{F}{x}$

= – 2 / 0.4= – 5 N/m

Example 2 A boy weighing 20 pounds stretches a spring by 50 cm. Determine the spring constant of the spring.
Solution:
Given:
Mass m = 20 lbs = 20 / 2.2 = 9.09 Kg

Displacement x = 50 cm

The force F = ma = 9.09 × 9.8 = 89.082 N

The spring constant formula is given by:
$k=\frac{F}{x}$

= – 89.082 / 0.5 = – 178.164 N/m.


text:
## Sunday, October 14, 2018

### Faculty position at Rice - theoretical biological physics

Faculty position in Theoretical Biological Physics at Rice University

As part of the Vision for the Second Century (V2C2), which is focused on investments in research excellence, Rice University seeks faculty members, preferably at the assistant professor level, starting as early as July 1, 2019, in all areas of Theoretical Biological Physics. Successful candidates will lead dynamic, innovative, and independent research programs supported by external funding, and will excel in teaching at the graduate and undergraduate levels, while embracing Rice’s culture of excellence and diversity.  This search will consider applicants from all science and engineering disciplines. Ideal candidates will pursue research with strong intellectual overlap with physics, chemistry, biosciences, bioengineering, chemical and biomolecular engineering, or other related disciplines. Applicants pursuing all styles of theory and computation integrating the physical and life sciences are encouraged to apply.

For full details and to apply, please visit https://jobs.rice.edu/postings/17099.  Applicants should please submit the following materials: (1) cover letter (2) curriculum vitae, (3) research statement, (4) statement of teaching philosophy, and the names and contact information for three references. Application review will commence no later than November 30, 2018 and continue until the positions are filled. Candidates must have a PhD or equivalent degree and outstanding potential in research and teaching. We particularly encourage applications from women and members of historically underrepresented groups who bring diverse cultural experiences and who are especially qualified to mentor and advise members of our diverse student population.

Rice University, located in Houston, Texas, is an Equal Opportunity Employer with commitment to diversity at all levels, and considers for employment qualified applicants without regard to race, color, religion, age, sex, sexual orientation, gender identity, national or ethnic origin, genetic information, disability, or protected veteran status.

## Friday, October 12, 2018

### Short items

A few interesting things I've found this past week:

• The connection between particle spin and quantum statistics (fermions = half-integer spin, bosons = integer spin) is subtle, as I've mentioned before.  This week I happened upon a neat set of slides (pdf) by Jonathan Bain on this topic.  He looks at how we should think about why a pretty restrictive result from non-interacting relativistic quantum field theories has such profound, general implications.  He has a book on this, too.
• There is a new book about the impact of condensed matter physics on the world and why it's the comparatively unsung branch of the discipline.   I have a copy on the way; once I read it I'll post a review.
• It's also worth reading about why mathematics as a discipline is viewed the way it is culturally.
• This is a really well-written article about turbulence, and why it's hard even though it's "just $\mathbf{F} = m\mathbf{a}$" for little blobs of fluid.
• Humanoid robots are getting more and more impressive.  I would really like to know the power consumption of one of those, though, given that the old ones used to have either big external power cables or on-board diesel engines.  The robot apocalypse is less scary if they have to recharge every ten minutes of operating time.
• I always wondered if fidget spinners were good for something.

## Sunday, October 07, 2018

### A modest proposal: Congressional Science and Technology Office, or equivalent

I was in a meeting at the beginning of the week where the topic of science and technology in policy-making came up.  One person in the meeting made an off-hand comment that one role for university practitioners could be to "educate policy-makers".  Another person in the meeting, with a lot of experience in public policy, pointed out that from the perspective of policy-makers, the previous statement often comes across as condescending and an immediate turn-off (regardless of whether policy-makers actually have expert knowledge relevant to their decisions).

At the same time, with the seemingly ever-quickening pace of technological change, it sure seems like Congress lacks sources of information and resources for getting legislators (and perhaps more importantly their staffs) up to speed on scientific and technological issues.  These include issues of climate, election security, artificial intelligence, robots coming to take our jobs, etc.  The same could be said for the Judiciary, from the federal district level all the way up to the Supreme Court.   Wouldn't it be a good idea for at least the staffs of the federal judges to have some non-partisan way to get needed help in understanding, e.g., encryption?   The National Academies do outstanding work in their studies and reports, but I'm thinking of a non-partisan information-gathering and coaching office specifically to support Congress and perhaps the Judiciary.  The Congressional Budget Office serves a somewhat similar role in terms of supporting budgeting and appropriations.  The executive branch (nominally) has the Office of Science and Technology Policy.   I could be convinced that the Academies could launch something analogous, but it's not clear that this is a reasonable expectation.

Realistically, now is not the best time to bring this up in the US, given the level of political dysfunction and the looming financial challenges facing the government.   There used to be a congressional Office of Technology Assessment, but that was shut down ostensibly to save money in 1995.  Attempts to restart it such as Bill Foster's this past spring have failed.  Still, better to keep pushing for something to play this role, rather than simply being content with the status quo level of technical knowledge of Congress (and federal judges).  Complex scientific and technological issues are shaping the world around us, and I have to hope that decision-makers want to know more about these topics.


text:
# Fine-tuning 20B LLMs with RLHF on a 24GB consumer GPU

We are excited to officially release the integration of trl with peft to make Large Language Model (LLM) fine-tuning with Reinforcement Learning more accessible to anyone! In this post, we explain why this is a competitive alternative to existing fine-tuning approaches.

Note peft is a general tool that can be applied to many ML use-cases but it’s particularly interesting for RLHF as this method is especially memory-hungry!

If you want to directly deep dive into the code, check out the example scripts directly on the documentation page of TRL.

## Introduction

### LLMs & RLHF

LLMs combined with RLHF (Reinforcement Learning with Human Feedback) seems to be the next go-to approach for building very powerful AI systems such as ChatGPT.

Training a language model with RLHF typically involves the following three steps:

1- Fine-tune a pretrained LLM on a specific domain or corpus of instructions and human demonstrations

2- Collect a human annotated dataset and train a reward model

3- Further fine-tune the LLM from step 1 with the reward model and this dataset using RL (e.g. PPO)

Overview of ChatGPT's training protocol, from the data collection to the RL part. Source: OpenAI's ChatGPT blogpost

The choice of the base LLM is quite crucial here. At this time of writing, the “best” open-source LLM that can be used “out-of-the-box” for many tasks are instruction finetuned LLMs. Notable models being: BLOOMZ, Flan-T5, Flan-UL2, and OPT-IML. The downside of these models is their size. To get a decent model, you need at least to play with 10B+ scale models which would require up to 40GB GPU memory in full precision, just to fit the model on a single GPU device without doing any training at all!

### What is TRL?

The trl library aims at making the RL step much easier and more flexible so that anyone can fine-tune their LM using RL on their custom dataset and training setup. Among many other applications, you can use this algorithm to fine-tune a model to generate positive movie reviews, do controlled generation or make the model less toxic.

Using trl you can run one of the most popular Deep RL algorithms, PPO, in a distributed manner or on a single device! We leverage accelerate from the Hugging Face ecosystem to make this possible, so that any user can scale up the experiments up to an interesting scale.

Fine-tuning a language model with RL follows roughly the protocol detailed below. This requires having 2 copies of the original model; to avoid the active model deviating too much from its original behavior / distribution you need to compute the logits of the reference model at each optimization step. This adds a hard constraint on the optimization process as you need always at least two copies of the model per GPU device. If the model grows in size, it becomes more and more tricky to fit the setup on a single GPU.

Overview of the PPO training setup in TRL.

In trl you can also use shared layers between reference and active models to avoid entire copies. A concrete example of this feature is showcased in the detoxification example.

### Training at scale

Training at scale can be challenging. The first challenge is fitting the model and its optimizer states on the available GPU devices. The amount of GPU memory a single parameter takes depends on its “precision” (or more specifically dtype). The most common dtype being float32 (32-bit), float16, and bfloat16 (16-bit). More recently “exotic” precisions are supported out-of-the-box for training and inference (with certain conditions and constraints) such as int8 (8-bit). In a nutshell, to load a model on a GPU device each billion parameters costs 4GB in float32 precision, 2GB in float16, and 1GB in int8. If you would like to learn more about this topic, have a look at this blogpost which dives deeper: https://huggingface.co/blog/hf-bitsandbytes-integration.

If you use an AdamW optimizer each parameter needs 8 bytes (e.g. if your model has 1B parameters, the full AdamW optimizer of the model would require 8GB GPU memory - source).

Many techniques have been adopted to tackle these challenges at scale. The most familiar paradigms are Pipeline Parallelism, Tensor Parallelism, and Data Parallelism.

Image Credits to this blogpost

With data parallelism the same model is hosted in parallel on several machines and each instance is fed a different data batch. This is the most straight forward parallelism strategy essentially replicating the single-GPU case and is already supported by trl. With Pipeline and Tensor Parallelism the model itself is distributed across machines: in Pipeline Parallelism the model is split layer-wise, whereas Tensor Parallelism splits tensor operations across GPUs (e.g. matrix multiplications). With these Model Parallelism strategies, you need to shard the model weights across many devices which requires you to define a communication protocol of the activations and gradients across processes. This is not trivial to implement and might need the adoption of some frameworks such as Megatron-DeepSpeed or Nemo. It is also important to highlight other tools that are essential for scaling LLM training such as Adaptive activation checkpointing and fused kernels. Further reading about parallelism paradigms can be found here.

Therefore, we asked ourselves the following question: how far can we go with just data parallelism? Can we use existing tools to fit super-large training processes (including active model, reference model and optimizer states) in a single device? The answer appears to be yes. The main ingredients are: adapters and 8bit matrix multiplication! Let us cover these topics in the following sections:

### 8-bit matrix multiplication

Efficient 8-bit matrix multiplication is a method that has been first introduced in the paper LLM.int8() and aims to solve the performance degradation issue when quantizing large-scale models. The proposed method breaks down the matrix multiplications that are applied under the hood in Linear layers in two stages: the outlier hidden states part that is going to be performed in float16 & the “non-outlier” part that is performed in int8.

Efficient 8-bit matrix multiplication is a method that has been first introduced in the paper LLM.int8() and aims to solve the performance degradation issue when quantizing large-scale models. The proposed method breaks down the matrix multiplications that are applied under the hood in Linear layers in two stages: the outlier hidden states part that is going to be performed in float16 & the “non-outlier” part that is performed in int8.

In a nutshell, you can reduce the size of a full-precision model by 4 (thus, by 2 for half-precision models) if you use 8-bit matrix multiplication.

### Low rank adaptation and PEFT

In 2021, a paper called LoRA: Low-Rank Adaption of Large Language Models demonstrated that fine tuning of large language models can be performed by freezing the pretrained weights and creating low rank versions of the query and value layers attention matrices. These low rank matrices have far fewer parameters than the original model, enabling fine-tuning with far less GPU memory. The authors demonstrate that fine-tuning of low-rank adapters achieved comparable results to fine-tuning the full pretrained model.

The output activations original (frozen) pretrained weights (left) are augmented by a low rank adapter comprised of weight matrics A and B (right).

This technique allows the fine tuning of LLMs using a fraction of the memory requirements. There are, however, some downsides. The forward and backward pass is approximately twice as slow, due to the additional matrix multiplications in the adapter layers.

### What is PEFT?

Parameter-Efficient Fine-Tuning (PEFT), is a Hugging Face library, created to support the creation and fine tuning of adapter layers on LLMs.peft is seamlessly integrated with 🤗 Accelerate for large scale models leveraging DeepSpeed and Big Model Inference.

The library suppord many state of the art models and has an extensive set of examples, including:

• Causal language modeling
• Conditional generation
• Image classification
• 8-bit int8 training
• Low Rank adaption of Dreambooth models
• Semantic segmentation
• Sequence classification
• Token classification

The library is still under extensive and active development, with many upcoming features to be announced in the coming months.

## Fine-tuning 20B parameter models with Low Rank Adapters

Now that the prerequisites are out of the way, let us go through the entire pipeline step by step, and explain with figures how you can fine-tune a 20B parameter LLM with RL using the tools mentioned above on a single 24GB GPU!

Loading a model in 8-bit precision can save up to 4x memory compared to full precision model

A “free-lunch” memory reduction of a LLM using transformers is to load your model in 8-bit precision using the method described in LLM.int8. This can be performed by simply adding the flag load_in_8bit=True when calling the from_pretrained method (you can read more about that here).

As stated in the previous section, a “hack” to compute the amount of GPU memory you should need to load your model is to think in terms of “billions of parameters”. As one byte needs 8 bits, you need 4GB per billion parameters for a full-precision model (32bit = 4bytes), 2GB per billion parameters for a half-precision model, and 1GB per billion parameters for an int8 model.

So in the first place, let’s just load the active model in 8-bit. Let’s see what we need to do for the second step!

### Step 2: Add extra trainable adapters using peft

You easily add adapters on a frozen 8-bit model thus reducing the memory requirements of the optimizer states, by training a small fraction of parameters

The second step is to load adapters inside the model and make these adapters trainable. This enables a drastic reduction of the number of trainable weights that are needed for the active model. This step leverages peft library and can be performed with a few lines of code. Note that once the adapters are trained, you can easily push them to the Hub to use them later.

### Step 3: Use the same model to get the reference and active logits

You can easily disable and enable adapters using the peft API.

Since adapters can be deactivated, we can use the same model to get the reference and active logits for PPO, without having to create two copies of the same model! This leverages a feature in peft library, which is the disable_adapters context manager.

### Overview of the training scripts:

We will now describe how we trained a 20B parameter gpt-neox model using transformers, peft and trl. The end goal of this example was to fine-tune a LLM to generate positive movie reviews in a memory constrained settting. Similar steps could be applied for other tasks, such as dialogue models.

Overall there were three key steps and training scripts:

1. Script - Fine tuning a Low Rank Adapter on a frozen 8-bit model for text generation on the imdb dataset.
2. Script - Merging of the adapter layers into the base model’s weights and storing these on the hub.
3. Script - Sentiment fine-tuning of a Low Rank Adapter to create positive reviews.

We tested these steps on a 24GB NVIDIA 4090 GPU. While it is possible to perform the entire training run on a 24 GB GPU, the full training runs were untaken on a single A100 on the 🤗 reseach cluster.

The first step in the training process was fine-tuning on the pretrained model. Typically this would require several high-end 80GB A100 GPUs, so we chose to train a low rank adapter. We treated this as a Causal Language modeling setting and trained for one epoch of examples from the imdb dataset, which features movie reviews and labels indicating whether they are of positive or negative sentiment.

Training loss during one epoch of training of a gpt-neox-20b model for one epoch on the imdb dataset

In order to take the adapted model and perform further finetuning with RL, we first needed to combine the adapted weights, this was achieved by loading the pretrained model and adapter in 16-bit floating point and summary with weight matrices (with the appropriate scaling applied).

Finally, we could then fine-tune another low-rank adapter, on top of the frozen imdb-finetuned model. We use an imdb sentiment classifier to provide the rewards for the RL algorithm.

Mean of rewards when RL fine-tuning of a peft adapted 20B parameter model to generate positive movie reviews.

The full Weights and Biases report is available for this experiment here, if you want to check out more plots and text generations.

## Conclusion

We have implemented a new functionality in trl that allows users to fine-tune large language models using RLHF at a reasonable cost by leveraging the peft and bitsandbytes libraries. We demonstrated that fine-tuning gpt-neo-x (40GB in bfloat16!) on a 24GB consumer GPU is possible, and we expect that this integration will be widely used by the community to fine-tune larger models utilizing RLHF and share great artifacts.

We have identified some interesting directions for the next steps to push the limits of this integration

• How this will scale in the multi-GPU setting? We’ll mainly explore how this integration will scale with respect to the number of GPUs, whether it is possible to apply Data Parallelism out-of-the-box or if it’ll require some new feature adoption on any of the involved libraries.
• What tools can we leverage to increase training speed? We have observed that the main downside of this integration is the overall training speed. In the future we would be keen to explore the possible directions to make the training much faster.


text:
# BC Calculus: Review for Chapter 8 Worksheet

• Class: 5H: BC Calculus
• Author: Peter Atlas
• Text: Calculus Finney, Demana, Waits, Kennedy

# Evaluate the following without a calculator:

1. $$\displaystyle \int_{0}^{2\sqrt{2}} \frac{x^3}{x^2 + 1} \, dx$$
2. Hint long divide, then u-substitute. Should lead to a ln.
Solution $$4 - \ln{3}$$
3. $$\displaystyle \int_{1}^{3} \frac{dy}{y^2 - 2y + 5}$$
4. Hint complete the square, u-sub, then use a reference triangle. Should lead to $$\tan^{-1}$$.
Solution $$\frac{\pi}{8}$$
5. $$\displaystyle \int_{\frac{1}{2}}^{1} \frac{\sqrt{1 - x^2}}{x^2} \, dx$$
6. Hint use a reference triangle. Should lead to $$\cot^2$$. Change to $$csc^2 - 1$$ (Pythagorean relationship) and integrate termwise.
Solution $$\sqrt{3} - \frac{\pi}{3}$$
7. $$\displaystyle \int_{1}^{4} \frac{dy}{y^2 - 2y + 10}$$
8. Hint complete the square, u-sub, and use a reference triangle. Should lead to an $$tan^{-1}$$.
Solution $$\frac{\pi}{12}$$
9. $$\displaystyle \int_{-2}^{2} \frac{x + 2}{\sqrt{x^2 + 4x + 13}} \, dx$$
10. Hint complete the square, u-sub, v-sub, then use the power rule.
Solution 2
11. $$\displaystyle \int_{0}^{5} \sqrt{25 - x^2} \, dx$$
12. Hint referemce triangle, then use the half angle formula. (Or, if you prefer to do it without calculus, it's just a quarter circle with radius = 5.)
Solution $$\frac{25 \pi}{4}$$
13. $$\displaystyle \int \frac{dx}{ \left( 4 - x^2 \right) ^{\frac{3}{2}}}$$
14. Hint use a reference triangle, reduce, and rewrite as secant sqaured. Then integrate.
Solution $$\frac{\frac{1}{4}x}{\sqrt{4 - x^2}} + C$$
15. $$\displaystyle \int \frac{dx}{\sqrt{x^2 + 2x}}$$
16. Hint complete the square, u-sub, then use a reference triangle. Should lead to integral of secant.
Solution $$\ln { \left| x + 1 + \sqrt{x^2 + 2x} \right| } + C$$
17. $$\displaystyle \int_{\frac{1}{\sqrt{3}}}^{1} \frac{2}{z\sqrt{4z^2 - 1}} \, dz$$
18. Hint use a reference triangle. Should lead to inverse secant.
Solution $$\frac{\pi}{3}$$
19. $$\displaystyle \int_{-1}^{-\frac{1}{2}} \frac{dx}{\sqrt{-2x - x^2}}$$
20. Hint complete the square, u-sub, then recognize it as the form of the inverse sine (or use a reference triangle.)
Solution $$\frac{\pi}{6}$$


text:
What I have

\documentclass{article}
\usepackage{pdftexcmds}
\makeatletter
\newcommand\foo[2]{%
\ifnum\pdf@strcmp{\unexpanded{#2}}{}=0 %
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{TRUE}
{FALSE}%
}
\makeatother
\begin{document}

\foo{1}{}

\end{document}

It results True if and only if \foo{someargument}{} is called. What I need: It should return True if and only if \foo{someargument} is called (so someone left the second parameter out). In the end I will replace True and False with two different function calls.

How can I do this?

• TeX always grabs two arguments if you set up a macro with two parameters: are you trying to make an 'optional group' argument? That's not really recommended (it's not in line with how TeX works in general), but it is doable. Jul 13 at 11:20
• I am trying to do something like this: \entry{x}{y} registers glossary entry (x,y). \entry{x} prints the glossary entry. It has some advantages for me if I can implement it like this since I got used to using the command in the way it was used before (I decided to use the glossary package) Jul 13 at 14:04
• but if you declare mandatory arguments it is not possible to omit them \entry{X} \entry{Y} then #2 of the first \entry is not missing, it is the second \entry. Jul 13 at 15:47
• in your example, if you delete the {} then the second argument is not missing it is \par (from the blank line) Jul 13 at 15:50
• Thanks @DavidCarlisle this gives me a deeper understanding on why my attempt has failed. I personally thought it was a null "" error, but your explanation really helped. Jul 13 at 16:01

You can trick TeX into doing something like this, but I strongly discourage from it. This isn't common (La)TeX syntax and in the long run it will likely cause more problems than it solves.

\documentclass{article}

\usepackage{amsgen}% for \new@ifnextchar

\makeatletter
\newcommand\foo[1]{%
\new@ifnextchar\bgroup{\fooB{#1}}{\fooA{#1}}%
}
\newcommand{\fooA}[1]{Only one: #1'.}
\newcommand{\fooB}[2]{You've got two: #1' and #2'.}
\makeatother

\begin{document}

\foo{1}

\foo{a}{b}

However: \foo{a}{}

\foo{a} {\bfseries This shouldn't do any harm.}

\end{document}

• this is basically what the deprecated xparse g parameter does. Jul 13 at 15:49
• @DavidCarlisle I know, but since I don't use xparse I do it the dumb way ;-) Jul 13 at 18:29

If you declare a command with arguments, you can omit the {} but you can not omit the argument.

\documentclass{article}
\usepackage{pdftexcmds}
\makeatletter
\newcommand\foo[2]{%
\ifnum\pdf@strcmp{\detokenize{#2}}{\noexpand\par}=0 %
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{TRUE}
{FALSE}%
}
\makeatother
\begin{document}

\foo{1}{2}

\foo34

\foo{1}

\end{document}

In the third call here, the second argument is not missing, it is the blank line, which is reported as \par.

If you omit the blank line the second argument is \end then latex will typeset document and wait at the * prompt for you to type \end{document} to stop the run.

You could of course detect \end in your macro and return \end to the input in that case, but input such as {\foo{1}} will always give a low level error

! Argument of \foo has an extra }.

You could avoid the issue by not declaring the command has two arguments, as shown in the other answer, but this is taking you a long way from standard LaTeX syntax, where optional arguments are delimited by [] not {}`.


text:
# 2.4.3 Thermoelectric Effects

So far we have only considered one conducting material; the unavoidable contacts between conductors, implicitly always required, were seemingly devoid of special properties.

• We know that this is not true for many other contacts; e.g. combinations of
• semiconductor - semiconductor.
• semiconductor - conductor.
• ionic conductor - conductor.
• What about metal - metal contacts?

We routinely solder wires of different conductors together or join them in any way, and do not worry about the contacts. Besides, maybe, a certain (usually small) contact resistance which is a property of the interface and must be added to the resistance of the two materials, there seems to be no other specific property of the contact.

• But that is only true as long as the temperature is constant in the whole system of at least two conductors.
• The reason for this is that we always get a contact voltage, as in the case of semiconductors, but the extension of the charged layers at the interface (the Debye lengths) is so short that no specific phenomena result from this.
• Consider the band diagrams before and after joining two metals

We have a dipole layer of charges at the interface which, owing to the large carrier density, is extremely thin and does not hinder current flow (it is easy for electrons to tunnel through the potential barrier).

• We also have a contact potential, which is called the Volta potential. Since in any closed circuit (containing, e.g., the wires to the voltmeter), the sum of the Volta potentials must be zero in thermal equilibrium, it therefore can not be measured directly.
• If, however, one of the at least two contacts needed for a closed circuit is at a temperature T2 that is different from the temperature T1 of the first contact, we have non-equilibrium and now a voltage may be measured. We observe the Seebeck effect, one of several thermoelectric effects.

We will not go into details here (consult the link for this) but will only mention some applications and related effects.

### Seebeck Effect

The Seebeck effect is the base for thermoelements or thermocouples, the standard device for measuring temperatures (the good old mercury thermometer is virtually nonexistent in technical applications, especially at high temperatures).

 Lets look at a typical situation: We have a thermocouple mader with a material 1 and a material 2. It's "contacted" by whatever (material 3, black lines). The junction of material1 and material 2 is hot, the rest is cold (and has the same temperature). The voltmeter will show a thermovoltage that depends on ∆T and the two materials forming the thermocouple.
• Generally, the thermovoltage should be larger for couples of conductors with very different Fermi energies or carrier densities, since then the Volta potential is larger.
• Being more specific, the Volta potential should follow Nernsts law. But here we are only interested in the practical aspects of thermocouples.

For technically important materials, it is convenient to construct a voltage scale for thermocouples given in mV/100K.

• The voltage measured for a temperature difference of 100 K is then the difference of the two values given on that scale for the two materials joined in a thermocouple. The zero point was arbitrarily chosen for Pt.
 Bi Ni Pd Pt Hg PtRh Cu Mo Fe NiCr Sb -7,7 -1,5 -0,3 0 0 0,7 0,77 1,2 1,92 2,6 4,8
• Useful couples are, e.g. Ni/NiCr, with a thermovoltage of ca. 4 mV/100K and a usable temperature range up to 1000 K.

The Seebeck effect, for many years extensively used for measuring temperatures, can also be used to convert heat energy directly into electrical energy. Thermoelectric generators are becoming an exciting field of materials science, because optimized materials, based on a thorough understanding of the requirements for power generation and the concomitant requirements for the materials, are becoming available.

### Other Thermoelectric Effects

There are several thermoelectrical effects which are deeply routed in non-equilibrium thermodynamics. Essentially, there is a "reciprocating" coupling of gradients in driving forces and currents of any kind (not just electrical currents but also, e.g. particle currents, heat currents, or even entropy currents).

• Reciprocating means, that if a gradient - e.g. in the temperature - induces an electric current across a junction (the Seebeck effect), than an electric current induced by some other means must produce a temperature gradient. And this does not address the heating simply due to ohmic heating!
• The "reversed" Seebeck effect does indeed exist, it is called the Peltier effect. In our schematic diagram it looks like this:
 An electrical current, in other words, that is driven through the system by a battery, would lead to a "heat" current, transporting thermal energy from one junction to the other one. One junction then goes down in temperature, the other one goes up. This effect would also occur in hypothetical materials with zero resistivities (we do not mean superconductors here). If there is some resistance R , the current will always lead to some heating of the wires everywhere which is superimposed on the Peltier effect.
• The temperature difference T between the two junctions due to the external current density j induced by the battery and the Peltier effect then is approximately given by

$\Delta T\approx\text{const,}\cdot j$

• The removal of heat or thermal energy thus is linear with the current density
• But there is always heating due to by ohmic losses, too. This is proportional to j2, so it may easily overwhelm the Peltier effect and no net cooling is observed in this case.

The Peltier effect is not useful for heating - that is much easier done with resistance heating - but for cooling!

• With optimized materials, you can lower the temperature considerably at one junction by simply passing current through the device! The Peltier effect actually has been used for refrigerators, but now is mainly applied for controlling the temperature of specimens (e.g. chips) while measurements are being made.

One can do a third thing with thermoelements: Generate power. You have a voltage coupled to a temperaturr difference, and that can drive a current through a load in the form of a resistor.

 Invariably the question of the efficiency η of power generation comes up. How much of the thermal energy in the system is converted to electrical energy? This is not easy to calculate in detail. It is, however, very easy to guess to what parameters η will be proportional: η ∝ 1/κ; κ = thermal conductivity.. η ∝ σ; σ = electrical conductivity η ∝ S; S = Seebeck coefficient

If the thermal conductivity κ is large, you cannot maintain a thermal gradient for very long. If the electrical conductivity σ is small, you loose energy by heating the resistor. It is thus clear that the efficiency is proportional to σ/κ. The Seebeck coefficient S, finally, simply characterizes the materials to be used. Unfortunately, for most materials, a large σ implies a large κ - think of any metal, for example!

There is one more effect worthwhile to mention: If you have an external current and an external temperature gradient at the same time, you have the Thomson effect. But we mention that only for completeness; so far the Thomson effect does not seem to be of technical importance. Again, more information is contained in the link.


text:
# Solved - Combo Clear Only Selection String

## Recommended Posts

Hi I'm struggling to clear the display text of of a GUI control combo selection string.

I would like to clear the selection like it is clear after it is populated, but not remove any items from the list.

Here is a small example.

```#include <GuiComboBox.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>

; Create GUI
\$hgui= guicreate("Clear ComboBox Edit Text", 320, 200)
\$control_combo= guictrlcreatecombo("", 10, 10, 250, 20, \$CBS_DROPDOWNLIST)
\$control_clear_button= guictrlcreatebutton("Reset Blank Combo Selection String", 10, 40, 200, 20)
guisetstate()
guictrlsetdata(\$control_combo, "a|b|c"); Populate Combo

while 1
switch guigetmsg()
case \$control_clear_button
guictrlsetdata(\$control_combo, ""); This clears the entire list frustrating me

case \$gui_event_close
exitloop
endswitch;guigetmsg()
wend;main loop```
Does anyone one know how I can reset the selection to "", clear, empty set?

I've tried SetEditText but doesn't work CBS_DROPDOWNLIST.

SOLVED:

Sorry I thought I had tried this: _GUICtrlComboBox_SetCurSel(\$control_combo, -1) is the solution.

Edited by Xandy

## Create an account

Register a new account

• ### Similar Content

• By Miliardsto
I got that func
Func makeHelpImgGUI(\$title,\$width,\$height,\$img) \$img = GUICtrlCreatePic("",20,40,\$width,\$height) _ResourceSetImageToCtrl(\$img, "HERE") EndFunc and I call this func like that
makeHelpImgGUI("Image",1190, 800,\$SETTINGS_JPG)
so what is the problem in the parameter where is - "HERE" I need value of img but passed as string
so \$img = \$SETTINGS_JPG and how make it "SETTINGS_JPG"

I tried something like that but not work
Func makeHelpImgGUI(\$title,\$width,\$height,\$img) \$name_str = String(\$img) \$name_str = StringTrimLeft (\$name_str, 1 ) \$img = GUICtrlCreatePic("",20,40,\$width,\$height) _ResourceSetImageToCtrl(\$img, \$name_str) EndFunc
• By liagason
Hello everyone,
How can I display in ascending  sequence some numbers stored in a string variable?
\$str = "18,03,48,23" MsgBox(0,"test",\$str) I would like it to display "03,18,23,48"
• By Rskm
Hi, I have the following line in a text file 'input.txt'. I know the line number - say '6'. I wish to replace the text 'WWW' in the below line with a random number (I can generate that with random()).
WERIS  WWWJP   3.83  8.330  1.000                1097.RAXX
The WWW is a 3 digit integer (could be any number between 0 to 999), I can use stringtrimleft and get the numerical value of WWW in this file
so, basically, I know the string to replace (ie; WWW stored in a variable), I know the line number to work on and the file location/name and the replacement variable (through random()). My requirement is to fill that 3 spaces with my random number (which Is a integer between 1 and 999)

• By nacerbaaziz
Hello Members of this best Forum
for example if i have a long string
and i want to extract a text between two tag
what i can do to make that?
note :
i know that there is a
StringRegExp function
it's do that work
but it result is be as an array
i want the result to be a string
is there any function on autoit can do that?
• By mistersquirrle
Hello!

I wrote myself a script to follow Google Maps Polyline encoding steps: https://developers.google.com/maps/documentation/utilities/polylinealgorithm, and that works (although I think that it's a bit janky), but now I'm having issues getting the output.

When I run the script, all the points come out correctly in the console, and even when they're the only things that I log, it displays them fine. However, I'm adding each point into a variable to return all of them at once at the end, fully formatted, and it's only taking the very first point. I can't figure out what I'm doing wrong, as it seems fine.

When run with the default value, it should output this at the end: Custom Polygon: _p~iF~ps|U_ulLnnqC_mqNvxq`@
But instead I'm just getting this: Custom Polygon: _p~iF

I know that it's reaching the string combination lines because it's logging the data before it (and even if a put log AFTER the \$sPolygon &= \$aPoints[0], it's logged fine).

Here's my full code (problem is lines ~209 - 234, search "\$sPolygon &= \$aPoints[1]"):
I've tried:
\$sPolygon &= \$aPoints[0] & \$aPoints[1] ;---- \$sPolygon = \$sPolygon & \$aPoints[0] & \$aPoints[1] ;---- \$sPolygon = \$sPolygon & String(\$aPoints[0] & \$aPoints[1]) ;---- \$sPolygon = String(\$sPolygon) & String(\$aPoints[0]) & String(\$aPoints[1]) ;---- \$sPolygon &= \$aPoints[1] \$sPolygon &= \$aPoints[0] ;----
I'm sure it's something basic that I'm overlooking, but I don't understand why it's not combining the strings.
Also, unrelated, why doesn't \$LogFile = FileOpen(\$File, 9) create the directory/ file if they don't exist? 9 should be \$FO_CREATEPATH (8) + \$FO_APPEND (1)?
Thanks!
×

• Wiki

• Back

• Git


text:
# v18Wild double battles: 1v2 does not become 2v2 if Revive if used

This thread pertains to v18 of Pokémon Essentials.

#### darthmohawk1

##### Rookie
Member
Short version: If I force a wild double battle while the player has only 1 non-fainted Pokemon, and then use the first turn of the battle to revive a second one, the game does not give a prompt to add the newly-revived Pokemon to the battle at the end of the turn.

Detailed version:
I downloaded a fresh copy of Essentials 18.1 to test a script to make all wild encounters into double battles.
I made two edits. The first: in the section "PField_Field", I removed the clause "$Trainer.ablePokemonCount>1" (around line 389), so that the game would initialize a double battle even if the player has 1 able Pokemon in their team: Code:  if$PokemonEncounters.pbCanEncounter?(encounter,repel)
if !$PokemonTemp.forceSingleBattle && !pbInSafari? && ($PokemonGlobal.partner ||
(PBTerrain.isDoubleWildBattle?(pbGetTerrainTag)))

Second, I went into the "PBTerrain" script section and added terrain types to the definition of "isDoubleWildBattle?" (starting on line 90), so that double encounters occur not just in tall grass, but in any grass:
Code:
  def self.isDoubleWildBattle?(tag)
return tag==PBTerrain::Grass ||
tag==PBTerrain::TallGrass
end

Somewhat to my surprise, this change does not cause Essentials to crash when entering a battle with only 1 active Pokemon in the party (as per this resource). (I'm guessing v18 reorganized the battle system to fix that.)
However, the problem is, Essentials then loads the battle as a 1v2 fight, rather than as a 2v2 with only 1 Pokemon on the player's side. Thus, if the player uses the first turn of the fight to revive a second Pokemon, the game does not give a prompt to add the newly-revived Pokemon to the battle at the end of the turn.
How do I fix this behavior to work properly?
Thanks to any who offer help or solutions.

#### NettoHikari

##### Cooltrainer
Member
It seems like a really difficult task to try to change the side sizes mid-battle. It's true that v18 made it easier to define side sizes before the battle starts, but once the battle's initialized all the variables associated with each side, I think you would need to take all of those into account to try to modify the side sizes during battle.

That said, I remember that Vendily made an SOS battle script for v18: https://reliccastle.com/resources/444/. You can see here that this script manages to add an extra foe to the enemy's side during battle, so in your case, you could potentially take inspiration from the script to make it add an extra partner to the player's side.

#### darthmohawk1

##### Rookie
Member
So I tried a few things this week. Some worked, some didn't.
I feel like I'm most of the way there (or at least above half?) but would appreciate a little extra guidance from someone who knows the code better than I do after only a week of investigation.

EDIT 3/21/21: I got something to work more properly. I'll post the code later; feel free to remind me if i don't post it this week.

I figured the easiest way to tackle the problem of fixing a 1v2 into a pseudo-2v2, followed by a "normal" 2v2, would be to edit the battle parameters immediately after the battle setup is done, but before the first turn starts. So I added a couple more code segments. First, under "Battle_StartAndEnd", starting on line 32 immediately after the line defining "side2counts":
Code:
    side1recounts = pbTotalTeamCounts(0)

# Increase a 1v2 battle to a 2v2 battle if player's party is 2+
if side1counts[0]==1 && side2counts[0]>=2 && side1recounts[0]>=2
side1counts[0] = 2
end
This code adds an extra "slot" to the player's team if it only has 1.

Naturally we have to define "side1recounts" - this is basically just a clone of "side1counts" but modified slightly to also count fainted Pokemon. That code is under "PokeBattle_Battle"; I put it on line 361, just after the block for "pbAbleTeamCounts":
Code:
  # For the given side of the field (0=player's, 1=opponent's), returns an array
# containing the total number of Pokémon in each team.
def pbTotalTeamCounts(side)
party = pbParty(side)
partyStarts = pbPartyStarts(side)
ret = []
idxTeam = -1
nextStart = 0
party.each_with_index do |pkmn,i|
if i>=nextStart
idxTeam += 1
nextStart = (idxTeam<partyStarts.length-1) ? partyStarts[idxTeam+1] : party.length
end
next if !pkmn
ret[idxTeam] = 0 if !ret[idxTeam]
ret[idxTeam] += 1
end
return ret
end

Then I added one more segment in "Battle_StartAndEnd" - the objective is to add one of the player's fainted Pokemon to "fill" the second "slot" created by the first code block earlier in the starting procedure, so that when the player revives one of his other 'Mons, the game will trigger a "Use next Pokemon?" prompt as per normal when it runs pbEORSwitch and, hopefully, add the revived Pokemon to the battle without me having to do any real heavy lifting:
Code:
    # If the battle has been set up as a 1v2 but there are fainted Pokemon
# in the party, increase the size to 2v2, then set one of the
# fainted Pokemon into the new slot
side1origcount = pbAbleTeamCounts(0)
side1recount = pbTotalTeamCounts(0)
if side1origcount[0]==1 && @sideSizes[0]=2>=2 && side1recount[0]>=2
@sideSizes[0]=2 # this line is redundant but it's OK to include as a reminder

# For each trainer in turn, find the needed number of Pokémon for them to
# send out, and initialize them
ret = [[],[]]
trainer = @player
battlerNumber = 1
requireds = []
# Find out how many Pokémon each trainer on side needs to have
for i in 0...@sideSizes[0]
idxTrainer = pbGetOwnerIndexFromBattlerIndex(i*2+0)
requireds[idxTrainer] = 0 if requireds[idxTrainer].nil?
requireds[idxTrainer] += 1
end
trainer.each_with_index do |_t,idxTrainer|
ret[0][idxTrainer] = []
count = 0
eachInTeam(0,idxTrainer) do |pkmn,idxPkmn|
count += 1
next if pkmn.able? || count==1
idxBattler = 2
pbCreateBattler(idxBattler,pkmn,idxPkmn)
ret[0][idxTrainer].push(idxBattler)
battlerNumber += 1
break # if ret[0][idxTrainer].length>=requireds[idxTrainer]
end
end
end
There's probably an easier way to write this, but I'm shooting for function before I try to make this mish-mash of copypasta "look nice".

What actually happens when the code is run?
Well, if the player enters some tall grass with exactly 1 able Pokemon and at least 1 fainted Pokemon and gets a double battle, the game will put that lone able Pokemon into the left slot of a double-battle team, leaving the right slot empty. So far so good.
Then we can use our Pokemon's turn to use a Max Revive. The wild Pokemon use their moves as normal, and at the end of the turn, the game gives us a "Use next Pokemon?" prompt. Also good. But when we select the revived Pokemon to toss out into battle, we get this error:
Code:
[Pokémon Essentials version 18.1]
Exception: NoMethodError
Message: undefined method setPokemonBitmap' for nil:NilClass

Backtrace:
PokeBattle_Scene:323:in pbChangePokemon'
Scene_Animations:100:in pbSendOutBattlers'
Scene_Animations:98:in each_with_index'
Scene_Animations:98:in each'
Scene_Animations:98:in each_with_index'
Scene_Animations:98:in pbSendOutBattlers'
Battle_Action_Switching:296:in pbSendOut'
Battle_Action_Switching:288:in pbReplace'
Battle_Action_Switching:231:in pbRecallAndReplace'
Battle_Action_Switching:199:in pbEORSwitch'`
...and while this doesn't crash the game outright, a host of bad things follow the initial error.

Based on the error message I'm getting back, I'm betting there's something wrong with the initial definition of the "blank" slot that's supposed to be "filled" with one of the player's fainted Pokemon. I'm not sure what the exact problem is yet, though. Another pair of eyes on it would be helpful - thanks in advance!

Last edited:

#### NettoHikari

##### Cooltrainer
Member
Just from first glance, I think the error you're getting is from not setting up the PokeBattle_Battler object in addition to setting up the new "slot", even though that PokeBattle_Battler object would just be empty (have default values) to start with. But yeah, post your new code since it seems like you have a better version.