text:
# Lower bound for mutual inner products of N random unit vectors in $\mathbb{R}^n$, N > n

I have $$N$$ independent random unit vectors $$\{v_i\}$$ in $$\mathbb{R}^n$$, where N > n. I need a concentration inequality of the form $$\text{P}(|v_i \cdot v_j| > \epsilon \,\,\,\, \forall i, j = 1, \dots, N: i \neq j)\leq \psi(\epsilon)$$ where hopefully $$\psi(\epsilon)$$ is something small.

I think that I can use Johnson-Lindenstrauss to do this for isotropic vectors (e.g. by choosing orthogonal basis for $$\mathbb{R}^N$$ and projecting into $$\mathbb{R}^n$$ with a random subgaussian matrix).

Are there results of this form that hold when the $$\{v_i\}$$ are not distributed isotropically, for instance Gaussian with covariance $$\Sigma$$? For instance, when there is some weak correlation/dependence between the components of each of the $$v$$ --- maybe $$|\Sigma_{ij}| \leq \alpha$$ when $$i\neq j$$?

(Any seemingly related results in this area are much appreciated!)

• what is a quantifier for $i,j$? – Fedor Petrov Apr 25 at 20:40
• Thanks. They run from $1\dots n$ and for the concentration they're not equal. I edited the question. – user27182 Apr 25 at 20:47
• The first sentence in your post is inconsistent with the rest. What happened to the "independent" ? – dohmatob Apr 29 at 6:24
• Would this help $P(\cap_{i\ne j}\{|v_i^Tv_j| > \epsilon\}) \le \min_{(i,j) \mid i \ne j} P(|v_i^Tv_j| \le \epsilon)$ to begin with ? – dohmatob Apr 29 at 6:28
• @dohmatob You are right, I will remove the word 'independent'. Thank you for your second comment. I am not sure this is what I was looking for, but I will see whether I can make something from this observation. – user27182 Apr 29 at 6:58

Let $$M \in \mathbb{R}^{p\times p}$$ be a rank $$d$$, real, symmetric matrix with $$M_{ii} = 1$$ $$\forall i$$ and $$|M_{ij}| \le \epsilon$$ $$i\neq j$$, then $$\epsilon^2 \ge \frac{p - d}{d(p-1)}.$$
• Interesting result to know. How do you intend to use it, given that for a full rank gram matrix (which is the precondition in the question) this would yield a trivial lower bound ($p-d = 0$)? – DSM Apr 29 at 11:11
• Very sorry. I made a typo in the question. I have $N$ vectors in $\mathbb{R}^n$ and want to concentrate on all of them, not just $n$ of them. If $N>n$ then this lemma means I can't make the inner products arbitrarily small (which is also obvious, thinking geometrically). $$|v_i \cdot v_j| \ge \sqrt{\frac{N-n}{n(N-1)}} \ge \sqrt{1/n}$$ – user27182 Apr 29 at 11:46
• In OP's setting, a simple union bound argument gives that $\max_{i\neq j}|v_i\cdot v_j|=O(\sqrt{(\log N)/n})$ with probability $1-O(1/N)$, so this bound (known as the Welch bound) is optimal up to logarithmic factors. – Dustin G. Mixon Apr 29 at 12:52


text:
Let’s see if we just choose the first part in \eqref{eq:bw-s}, how the entropy looks like, and it’s meanings. Schwarzschild black hole’s surface gravity is

\kappa = \frac{1}{4M}, \\

and $\beta = \frac{1}{T_H}=\frac{2\pi}{\kappa}=8\pi M$, $r_H = 2M$ is the event horizon, then the entropy is

S=\frac{2M}{360h}.

If we choose the cutoff as
\label{eq:bw-cutoff}
h=\frac{T_H}{90}=\frac{1}{720\pi M}=\frac{1}{90\beta},

then the entropy becomes

S=4\pi M^2=\pi r_H^2=\frac{1}{4}A.

where $A=4\pi r_H^2$ is the area of the event horizon. The entropy is the Bekenstein-Hawking entropy.

format: plain


text:
# Whats the absolute value of abs(4)?

Jul 8, 2015

$| 4 |$ is allready an absolute value, equal to $4$

#### Explanation:

Absolute (denoted by the vertical bars) means that everything between them is converted to non-negative.
So $| - 4 | = 4$ and so is $| 4 | = 4$.


text:
# The number of distinct part sizes of some multiplicity in compositions of an Integer. A probabilistic Analysis

Abstract : Random compositions of integers are used as theoretical models for many applications. The degree of distinctness of a composition is a natural and important parameter. A possible measure of distinctness is the number $X$ of distinct parts (or components). This parameter has been analyzed in several papers. In this article we consider a variant of the distinctness: the number $X(m)$ of distinct parts of multiplicity m that we call the $m$-distinctness. A firstmotivation is a question asked by Wilf for random compositions: what is the asymptotic value of the probability that a randomly chosen part size in a random composition of an integer $ν$ has multiplicity $m$. This is related to $\mathbb{E}(X(m))$, which has been analyzed by Hitczenko, Rousseau and Savage. Here, we investigate, from a probabilistic point of view, the first full part, the maximum part size and the distribution of $X(m)$. We obtain asymptotically, as $ν → ∞$, the moments and an expression for a continuous distribution $φ$ , the (discrete) distribution of $X(m,ν )$ being computable from $φ$ .
Keywords :
Document type :
Conference papers
Domain :

Cited literature [13 references]

https://hal.inria.fr/hal-01183943
Contributor : Coordination Episciences Iam Connect in order to contact the contributor
Submitted on : Wednesday, August 12, 2015 - 9:08:34 AM
Last modification on : Tuesday, October 19, 2021 - 12:55:37 PM
Long-term archiving on: : Friday, November 13, 2015 - 11:38:23 AM

### File

dmAC0115.pdf
Publisher files allowed on an open archive

### Citation

Guy Louchard. The number of distinct part sizes of some multiplicity in compositions of an Integer. A probabilistic Analysis. Discrete Random Walks, DRW'03, 2003, Paris, France. pp.155-170, ⟨10.46298/dmtcs.3347⟩. ⟨hal-01183943⟩

Record views


text:
# Determine the type of an input

The challenge is simple: Determine the type of an input, and output an identifier telling what type it is.

• "UI", Unsigned integer: 0, 1,34, 111111111111111111111111111111111111111111
• "SI", Signed integer: +0, +1, +42, -1, -3, -111111111111111111111111111111111111111111
• "UD", Unsigned decimal: 0.0, 1.23, 1234.1234
• "SD", Signed decimal: -0.0, +0.0, -1.235
• "LE", Letter: a-z and A-Z
• "SY", Symbol: ASCII code points: [32-47, 58-64, 91-96, 123-126] (i.e. all characters except numbers and letters)
• "ST", String: Two or more character that can't be parsed as any of the above number formats

Rules:

• The input will be 1-99 characters long
• The input will only contain printable ASCII characters, code points: 32-126.
• The output should be the two identifier letters as defined above (UI, SI ...)
• Standard I/O rules apply

Examples:

UI:
0
01
34
12938219383278319086135768712319838871631827319218923

SI:
-0
+01
+1
-123
+123

UD:
0.0
3.1415
2.718281828459045235360287471352662497757

SD:
+0.0
-3.1415
+2.718281828459045235360287471352662497757

LE:
a
k
L
Z

SY:
@
"
+
-

ST:
Hello, World!
f2!"
+23df
1234A
'"!
.012
1.
UI
+-1
5+3

• Can SY be more than one character? – FryAmTheEggman Mar 31 '16 at 15:27
• I would not consider 111111111111111111111111111111111111111111 to be of integer type. – Matt Mar 31 '16 at 16:31
• @Matt, It might not be a uint8 or int64, but it's definitely an integer. – Stewie Griffin Mar 31 '16 at 21:35
• @RosLuP it's not meant to be the type your language interprets it as. You should simply output two characters based on the input string/number. – Stewie Griffin Nov 28 '17 at 20:43
• @RosLuP I'm not sure you get the point of this challenge. It doesn't matter how it's interpreted in some language, or what the normal naming convention for numbers is. In this challenge "signed" is defined as: "There's a plus or minus sign followed by a number". You may disregard the words signed and unsigned doesn't actually affect the challenge, you should output a two character string based on some input. – Stewie Griffin Nov 29 '17 at 13:22

# Pyth - 47 bytes

Can prolly golf a few bytes off with some slicing tricks.

.x-+?@z"+-"\S\U?@z\.\D\Isz?!tz?}rzZG"LE""SY""ST

# JavaScript (ES6), 99

x=>(z=x.match(/^([+-])?\d+(\.\d+)?$/))?'SU'[+!z[1]]+'DI'[+!z[2]]:x[1]?'ST':parseInt(x,36)?'LE':'SY'  Test f=x=>(z=x.match(/^([+-])?\d+(\.\d+)?$/))?'SU'[+!z[1]]+'DI'[+!z[2]]:x[1]?'ST':parseInt(x,36)?'LE':'SY'

console.log=x=>O.textContent+=x+'\n'

;console.log(['0','01','34','12938219383278319086135768712319838871631827319218923'].map(x=>f(x)+' '+x).join\n)
;console.log(['-0','+01','+1','-123','+123'].map(x=>f(x)+' '+x).join\n)
;console.log(['0.0','3.1415','2.718281828459045235360287471352662497757'].map(x=>f(x)+' '+x).join\n)
;console.log(['+0.0','-3.1415','+2.718281828459045235360287471352662497757'].map(x=>f(x)+' '+x).join\n)
;console.log([...'akLZ'].map(x=>f(x)+' '+x).join\n)
;console.log([...'@"+-'].map(x=>f(x)+' '+x).join\n)
;console.log(['Hello, World!','f2!"','+23df','1234A','"!,'.012','1.','UI','+-1','5+3'].map(x=>f(x)+' '+x).join\n)

• I was pretty sure that someone would be able to optimise for shared cases but I like your use of parseInt to detect letters. – Neil Apr 1 '16 at 0:13
• The first ( ) in your regex is not necessary – Awashi Apr 1 '16 at 7:25
• @Awashi it is necessary as I need a capture group for the sign to differentiate S or U. – edc65 Apr 1 '16 at 7:57
• @WashingtonGuedes no, it could be (\+|-) but no bytes saved – edc65 Apr 2 '16 at 8:31

# Turing Machine Code, 1544 bytes

Try it online!

0 + _ r s
0 - _ r s
0 0 _ r u
0 1 _ r u
0 2 _ r u
0 3 _ r u
0 4 _ r u
0 5 _ r u
0 6 _ r u
0 7 _ r u
0 8 _ r u
0 9 _ r u
0 a _ r l
0 b _ r l
0 c _ r l
0 d _ r l
0 e _ r l
0 f _ r l
0 g _ r l
0 h _ r l
0 i _ r l
0 j _ r l
0 k _ r l
0 l _ r l
0 m _ r l
0 n _ r l
0 o _ r l
0 p _ r l
0 q _ r l
0 r _ r l
0 s _ r l
0 t _ r l
0 u _ r l
0 v _ r l
0 w _ r l
0 x _ r l
0 y _ r l
0 z _ r l
0 A _ r l
0 B _ r l
0 C _ r l
0 D _ r l
0 E _ r l
0 F _ r l
0 G _ r l
0 H _ r l
0 I _ r l
0 J _ r l
0 K _ r l
0 L _ r l
0 M _ r l
0 N _ r l
0 O _ r l
0 P _ r l
0 Q _ r l
0 R _ r l
0 S _ r l
0 T _ r l
0 U _ r l
0 V _ r l
0 W _ r l
0 X _ r l
0 Y _ r l
0 Z _ r l
0 * _ r y
s 0 _ r s
s 1 _ r s
s 2 _ r s
s 3 _ r s
s 4 _ r s
s 5 _ r s
s 6 _ r s
s 7 _ r s
s 8 _ r s
s 9 _ r s
s . _ r d
s _ _ r i
s * _ r T
u 0 _ r u
u 1 _ r u
u 2 _ r u
u 3 _ r u
u 4 _ r u
u 5 _ r u
u 6 _ r u
u 7 _ r u
u 8 _ r u
u 9 _ r u
u . _ r D
u _ _ r I
u * _ r T
l _ _ r L
l * _ r T
y _ _ r S
y * _ r T
d 0 _ r d
d 1 _ r d
d 2 _ r d
d 3 _ r d
d 4 _ r d
d 5 _ r d
d 6 _ r d
d 7 _ r d
d 8 _ r d
d 9 _ r d
d _ _ r e
d * _ r T
i 0 _ r i
i 1 _ r i
i 2 _ r i
i 3 _ r i
i 4 _ r i
i 5 _ r i
i 6 _ r i
i 7 _ r i
i 8 _ r i
i 9 _ r i
i _ _ r j
i * _ r T
D 0 _ r D
D 1 _ r D
D 2 _ r D
D 3 _ r D
D 4 _ r D
D 5 _ r D
D 6 _ r D
D 7 _ r D
D 8 _ r D
D 9 _ r D
D _ _ r E
D * _ r T
I 0 _ r I
I 1 _ r I
I 2 _ r I
I 3 _ r I
I 4 _ r I
I 5 _ r I
I 6 _ r I
I 7 _ r I
I 8 _ r I
I 9 _ r I
I _ _ r J
I * _ r T
L * L r M
M * E r halt
S * S r Y
Y * Y r halt
e * S r f
f * D r halt
j * S r k
k * I r halt
E * U r f
J * U r k
T _ S r U
T * _ r T
U * T r halt

• Please include a fully-golfed version of the code. If the whitespace cannot be removed, it must be counted in the byte count. – user45941 Mar 31 '16 at 20:33
• Looks like it can not be removed, the program does not work properly without spaces between the symbols. – Matthew Smith Mar 31 '16 at 20:41
• It doesn't seem to classify "+-1" (from the examples) as a ST. – Xantix Apr 1 '16 at 1:05

# Retina, 98 97 bytes

A nice way to practise my regex skills indeed.

Try it online!

^(?![+-]?\d+(\.\d+)?$)..+ ST ^([+-]?)\d+$
$1UI ^([+-]?)\d+\.\d+$
$1UD i^[a-z]$
LE
^.$SY [+-]U S  • You can change ^[a-zA-Z]$ to i^[a-z]$ to save one byte – daavko Mar 31 '16 at 17:01 # Lua, 157 bytes Try it online! Golfed: n=(...)m=string.match s=m(n,"^[+-]")and"S"or"U"print(m(n,"^[+-]?%d+%.%d+$")and s.."D"or m(n,"^[+-]?%d+")and s.."I"or m(n,"^%w$")and"LE"or#n==1 and"SY"or"ST")  Ungolfed: n = "2.718281828459045" s = n:sub(1,1):match("[+-]") and "S" or "U" if n:match("^[+-]?%d+%.%d+$") then
print(s.."D")
elseif n:match("^[+-]?%d+") then
print(s.."I")
elseif n:match("^%w$") then print("LE") elseif #n==1 then print("SY") else print("ST") end  ## JavaScript (ES6), 125 120 bytes s=>"UISIUDSDLESYST".substr(s.match(/^((\d+)|([+-]\d+)|(\d+\.\d+)|([+-]\d+\.\d+)|([A-Z])|(.)|(.*))$/i).indexOf(s,2)*2-4,2)

Alternative version, also 120 bytes:

s=>"STUISIUDSDLESY".substr(s.match(/^(?:(\d+)|([+-]\d+)|(\d+\.\d+)|([+-]\d+\.\d+)|([A-Z])|(.)|.*)$/i).lastIndexOf(s)*2,2)  • Surely the regex can be golfed with a regex eval(/regex/) constructor + template strings – Downgoat Mar 31 '16 at 22:47 # Java, 192 bytes String t(String v){for(String[]x:new String[][]{{"\\d+","UI"},{"[-+]\\d+","SI"},{"\\d+\\.\\d+","UD"},{"[-+]\\d+\\.\\d+","SD"}})if(v.matches(x[0]))return x[1];return (v.length()==1?"SY":"ST");}  • return (v.length()==1?"SY":"ST"); can be return v.length()<2?"SY":"ST"; (-3 bytes) Or it can be this: String t(String v){for(String x:"UI\\d+;SI[-+]\\d+;UD\\d+\\.\\d+;SD[-+]\\d+\\.\\d+".split(";"))if(v.matches(x.substring(2)))return x.substring(0,2);return v.length()<2?"SY":"ST";} (179 bytes) And in addition you could change String t(String v) to v-> when you use a Java 8 lambda. – Kevin Cruijssen Nov 16 '17 at 12:34 # Javascript (ES6), 138 bytes I tried to use a replace to be more "fancy". This creates an anonymous function that returns the string of the type. s=>s.replace(/^((([+-])?(\d+)(\.\d+)?)|([a-z])|([ -~])|([^\0]*))$/i,(_,a,b,c,d,e,f,g)=>b?(c?'S':'U')+(e?'D':'I'):(f?'LE':'S'+(g?'Y':'T')))

Any tips to improving this will be entirely welcome.

• 1. should be ST, not UD. Change your \d* to \d+ – edc65 Mar 31 '16 at 23:23
• @edc65 How? That's a decimal. That is the same as 1.0. – Ismael Miguel Mar 31 '16 at 23:24
• It could be valid or not (I don't write 1. instead of 1) BUT It's not your choice or mine: there are the test cases – edc65 Mar 31 '16 at 23:26
• @edc65 You're right. I skipped the VERY huge list. I've fixed it. Thanks! – Ismael Miguel Mar 31 '16 at 23:26

# Python 3.5 - 241 240 bytes:

(Saved 1 byte thanks to @CatsAreFluffy)

import re
def r(g):
y={'^\d+$':'UI','^[+-]\d+$':'SI','^[0-9]\d*(\.\d+)?$':'UD','[+-](?=[0-9]\d*(\.\d+))':'SD','[a-zA-Z]+':'LE','^[^A-Za-z0-9]+$':'SY'};d=[y[i]for i in list(y.keys())if re.match(i,g)]
if len(d)>0:return d[0]
else:return'ST'

It may be a bit long, but does the job pretty much perfectly. This was a really good way to improve my regular expression skills. Thanks for the challenge. :) I will try and shorten it more if I can.

• You can move import re to outside the function to save a space. (Stupid iPad keyboard with no backticks) – CalculatorFeline Apr 1 '16 at 3:12
• @CatsAreFluffy Yeah, I did not think of that. Thank you! :) – R. Kap Apr 1 '16 at 3:38
• @CatsAreFluffy: Actually, the iOS keyboard does allow backticks! I found this out the other day when needing to write markdown using my iPhone :) meta.stackexchange.com/questions/133673/… – homersimpson Apr 1 '16 at 4:41
• @CatsAreFluffy Nice! That's good to know. – R. Kap Apr 1 '16 at 4:41
• Also len(d)>0==d>[] – CalculatorFeline Apr 1 '16 at 14:47

# Tcl 414 Bytes

proc a b {
if {[string index $b 0] eq "+" || [string index$b 0] eq "-"} {
} elseif {[string match {[A-Za-z]} $b]} { return LE } elseif {[regexp {^(?![+-]?\d+(\.\d+)?$)..+} $b]} { return ST } elseif {[regexp {[^a-zA-Z0-9.]}$b]} {
if {[string match *.* $b]} { return$c\U
return $c\I } } puts [a$argv]


text:
# Calculation of the Electrical Signal Frequency

Some relay protection and automation functions require information about the frequency of the observed voltage or current. We will consider the option of calculating the frequency of the electric signal from the transition through zero.

Consider a sinusoidal signal, for example, the mains voltage (Fig. 1). The figure shows the signal period T. The frequency f is the reciprocal of the period, i.e. f = 1 / T.

Fig. 1. Example of a sinusoidal signal

Thus, in order to determine the frequency of the signal, it is necessary to calculate its period. In the ideal case, for this it is enough to determine neighboring times in which the observed signal passes a zero value in the same direction (for example, from the region of negative values to the region of positive values of the signal). However, in digital relay protection, the observed signals are discretized (i.e., the values of the observed signal are fixed at certain discrete time instants with a certain sampling frequency fd at equal time intervals τ, called the sampling interval), which raises the problem of determining the moment of transition through zero.

As a possible solution to this problem, linear interpolation of the observed signal at those times at which the signal under study is not recorded is used. In fig. 2 illustrates this approach.

Fig. 2. Linear interpolation of the sampled signal

We compose an algorithm for determining the estimated time of the transition through the signal zero (according to Fig. 2):

1. We determine the discrete time moment kwhen the observed signal passes from the region of negative values to the region of positive values (or vice versa).
2. We fix the signal values A1 and A2 at discrete time instants k1 and k2, respectively.
3. We calculate the value of m based on the equation of a line passing through 2 points.

Given that (k2k1) = 1, the value of m is determined by the following expression:

$$m = \frac{|A_1|}{|A_1| + A_2}$$

After determining the neighboring time points of the transition through zero, the signal period is calculated. Consider the signal in Fig. 3.

Fig. 3. The input signal

For a given signal with accepted designations, the signal period will be determined by the following expression

$$T = (k_j + m_2 – k_i – m_1) \cdot \tau,$$

where τ is sampling interval of signal.

After the appearance of the next transition through, the frequency is recalculated in accordance with the above algorithm. The algorithm for calculating the frequency for crossing over zero given in the article is given in the attached program file in the Matlab environment: freq_calc.m.

In fig. Figure 4 shows the result of calculating the frequency of a model signal containing a transient process.

Fig. 4. The input signal and the results of calculating the frequency of this signal

From the results it is clear that the calculation of the frequency for the transition through zero has a large error in the transition mode. To reduce this error, averaging over several periods is used.

This site uses Akismet to reduce spam. Learn how your comment data is processed.


text:
# China forex reserves expected to hit $820 bn China's foreign exchange reserves are expected to total$820 billion by the end of 2005 on strong trade inflows, an economist at a government think tank said.

Local exporters expecting an increase in the yuan's value may aim to settle their foreign exchange receipts earlier than usual and importers may delay imports, which would result in a larger trade surplus, said Wang Zhao, an economist at the State Council's Development Research Center.

A larger surplus would put upward pressure on forex

Only users who have a paid subscription or are part of a corporate subscription are able to print or copy content.

To access these options, along with all other subscription benefits, please contact [email protected] or view our subscription options here: http://subscriptions.centralbanking.com/subscribe


text:
# OTP 23, PG2, and Outages

Distributed systems is just a bunch of pigs coordinating. Image by DALL-E 2.

This is a description of a BEAM VM1 outage that occurred recently. I feel like there are not very many Erlang PMs out there, especially with Erlang clusters at scale, so hopefully, this postmortem serves as one of the few examples to learn from. We experienced a service degradation that could've amounted to an outage, but was solved with enough time to prevent an outage.

For context, we were running Erlang OTP 23.1 using an Elixir application with releases controlled by Distillery2, deployed on top of a Kubernetes cluster running on GCP. Our cluster was over 150 pods, with each pod containing a single elixir application instance running as PID 1.

At 7:23 PM UTC, when we received a massive traffic spike, the Kubernetes deployment began to autoscale and spin up new pods. Symptoms began to appear at 7:43 PM UTC, where we noticed that new pods were being killed and restarted by the Kubernetes readiness probe. Our readiness probe was set to 30s, meaning that if a single instance was unable to start within 30s, it would be killed and restarted. This meant that no new pods were able to join the cluster.

The cause was a library called pg23, which effectively manages cluster membership. During the traffic spike, 7 pods began to fall behind in cluster message processing. As the cluster rapidly scaled, these 7 pods, which were already behind, began to lag even further. However, new pods joining the cluster would consume outdated cluster information from these 7 lagging pods, since pg2 maintains a strong ordering of messages. Consumption and processing of these messages required on average 6 minutes and occur before the process is ready to take requests, which far exceeded the readiness probe limit, causing Kubernetes to repeatedly stop and restart, further adding to the number of messages that needed to be processed by future pods.

This slow cascading failure caused pods to start dying until the root cause was narrowed down with observer_cli4, at which point we rolled the deployment and the issue was resolved.

In the future, the resolution will be to update to pg with OTP 24, which maintains a similar API without maintaining strong ordering.

## 1. Timeline of Events

• 7:43 PM UTC - Massive traffic spike.
• 7:43 PM UTC - New pods cannot start, and new pods are constantly killed by the Kube readiness probe.
• 11:43 PM UTC - Managed to narrow down the issue to pg2, determined that a temporary resolution was to kill high memory pods
• 12:46 AM UTC - All 7 high memory pods were killed, and new pods were started
• 1:17 AM UTC - Completely rolled the deployment, issue resolved.

## 2. Symptoms and Root Cause

### 2.1. Erlang Configuration

pg23 is a process group management library used in the BEAM VM for cluster membership. Erlang clusters by default are full mesh, meaning that each node knows every other node. Of course, this inherently limits the number of nodes, as message scaling is $$o(n^2)$$ within the cluster.

The Erlang and OTP in Action5 book mentions:

A cluster of Erlang nodes can consist of two or more nodes. As a practical limit, you may have a couple of dozen, but probably not hundreds of nodes. This is because the cluster is a fully connected network and the communication overhead for keeping machines in touch with each other increases quadratically with the number of nodes.

We are running a cluster with 150-200 Erlang nodes at any given time. In addition, our entire cluster runs on GCP preemptible instances, which means that nodes are liable to be killed at any time, generating far more intra-cluster bookkeeping messages. In other words, we're likely at the limit, if not over the limit of a full mesh network.

### 2.2. Kubernetes Configuration

For us, each Kubernetes pod corresponds to a single container, which in turn corresponds to a single Erlang node.

Our pods are configured with a readinessProbes of 30s and a period of 10 seconds. This means that the process within the pod has 30s to start, and every 10 seconds we check the status. If the status check fails more than once, we kill the pod and restart it at the beginning.

Pods are deployed using a Kubernetes deploymentSet, which automatically spins up more pods as traffic increases.

### 2.3. The Issue

Per the timeline above, the 7:42 PM traffic event triggered a cluster-wide scaleup. However, traffic already overloaded a few existing pods, which caused 7 pods to fall behind in traffic processing.

Because the BEAM VM implements TCP multiplexing, both connections to external clients and the rest of the cluster are handled on the same pipe, to conserve port usage. However, this means that, in rare cases, external traffic can cause resource starvation on cluster bookkeeping traffic, which is what I believe occurred here.

The 7:42 external traffic overloaded 7 specific pods. These pods, while processing external traffic, fell behind in processing cluster bookkeeping traffic, and therefore had a stale view of the cluster. In conjunction with the traffic, the massive scaleup Kubernetes initiated flooded the cluster with additional messages.

However, as new pods joined, the strong ordering property of pg2 meant that new pods needed to consume all messages from different nodes, including the stale messages from the 7 specific nodes. This processing exceeded the grace period given by Kubernetes, causing a repeated cycle of pods starting up, processing cluster messages, and being killed before they could finish.

Of course, as each pod was killed, Kubernetes attempted to restart the pod over and over. A cascading failure occurred: pods would start up, attempt to join, broadcast their membership, then be killed, adding more messages that needed to be processed by future pods. This means that each time Kubernetes attempted to restart a pod, the number of total messages that needed to be processed increased. A feedback loop of a slow start, getting killed by slow starts and making future starts even slower was established.

## 3. Diagnosis

Root cause analysis was established with two experiments:

1. We took a pod that was repeatedly being rebooted and removed the probes and timed the startup
2. observer_cli was used to determine what was taking up memory on high-memory pods.

The first experiment established that pods were not unable to join the cluster, but rather they were just very slow to join the cluster. This meant that there had to be something with cluster bookkeeping, at which point we began to suspect something either with GCP or our cluster management code.

The second experiment clearly established that pg2 was the culprit. observer_cli is a tool for the BEAM VM that is similar to htop, allowing you to determine what is consuming CPU and memory. Running observer_cli on a specific node revealed that the majority of the memory was being consumed by pg2, which we suspected to be cluster bookkeeping messages.

What observer_cli looks like.

## 4. Resolution

It was determined that we should kill the seven high-memory pods to see if it would alleviate cluster traffic. After killing the pods, the effect was immediate: new pods began to spin up right away. After an hour, the decision was made to do a rolling deployment to create a completely new cluster state. New pods began to spin up without issue after the cluster state was cleared.

## 5. What I Learned

### 5.1.Distillery does not have easy logs for startup

We use distillery, which is a tool that handles generating startup code for deployments. However, distillery does not provide BEAM bootup logs, which greatly increased our debugging time.

### 5.2.gdb and strace don't work on the BEAM VM!

With no information about BEAM VM boot, I attempted strace and gdb the PID. The first hurdle was that we run services as PID 1, and newer Linux kernels prevent stracing on PID 1.

The second hurdle was that even when switching the PID, strace doesn't work as expected on the BEAM VM! strace on the BEAM VM PID will only show SELECT(0, NULL, NULL, NULL), which is a syscall used for subsecond waiting. I'm unsure what the root cause of this is, but I suspect this is because the BEAM VM uses greenlets and lightweight threads processing, which are invisible to strace on the root PID.

### 5.3. 150-170 nodes is likely the upper limit for full mesh Erlang.

The most important lesson is that 150-170 nodes are likely the upper limit. While we had easily scaled up to 120 nodes without problem, scaling from the Kubernetes autoscaler pushed us to a metastable failure6: a pathological state where once entered, the system is unable to recover by itself.

For others who are planning on attempting to scale Erlang clusters, these additional resources are useful:

## Footnotes:

Posted: 2022-11-07
Filed Under: tech


text:
Is there a way to show the mathematical symbol for power (X^Y) appropriately? I think the equals sign actually works perfectly well for this purpose. Humankind cannot gain anything without first giving something in return. Ask Question Asked today. Calculate live currency and foreign exchange rates with this free currency converter. See more ideas about alchemic symbols, alchemy symbols, occult. provides a complete reference. Equivalent definition, equal in value, measure, force, effect, significance, etc. For the DVD volume, see Volume 3: Equivalent Exchange. Actual money prices (or even equilibrium prices) will only ever roughly correspond to exchange-values; the relationship between exchange-value and price is analogous to the exact measured temperature of a room and everyday awareness of that temperature from feeling alone, respectively. You can convert currencies and precious metals with this currency calculator. This is the page of the currency symbols that lists all currency symbols of the world, along with currency full names and currency codes (ISO 4217). Sign up to join this community. Aug 26, 2014 - Explore Thomas Warren's board "equivalent exchange" on Pinterest. Ask Question Asked … Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Home Questions Tags Users Unanswered Jobs; CTL equivalent formula. Currency symbol is used as shorthand for a currency's name, especially referring to amounts of money. Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Some Christians simply call them mandalas. Symbols are sometimes reused. Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Not the point. Active today. : 2. something that has the same amount…. The symbol of the firm after the merger was "XOM". @BrunoBrant That's not the point. You could pipe it to a temp file and open it in nano or vim for EVEN MOAR POWERRRR! Symbols sometimes change to reflect mergers. Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. Equivalent Exchange is the principle that limits alchemy's infinite potential. As Equal Exchange turns 30 this year, and we reflect on the journey we have traveled, we are both immensely proud and infinitely concerned. We have accomplished more than we ever dreamed possible back in 1986. I'm open for any questions, any am always up for meeting members of … Sign up to join this community. Find answers to not equal to symbol in db2 from the expert community at Experts Exchange Oct 7, 2020 - Buy 'Anime Pop Socket Full Metal Alchemist (FMA) Equivalent ExchangeEd & Al Symbol Red' by GRDNT as a Transparent Sticker More information To go on with the theme of awesome old school anime, I've also decided to recreate the symbol of the Elric brothers with the all-important rule of Full Metal Alchemist FMA - Equivalent Exchange . The question is somehow related to mathematics. That is rather simple: Take the exchange's own ticker symbol and then add some self-invented identifier to denote the market place. : His silence is equivalent to an admission of guilt. It only takes a minute to sign up. Jan 1, 2017 - Hi, the name's Jade, a full certified state alchemist, and creator of atomic alchemy. Equivalent Exchange Tarot is a collaborative project aiming to bring to life a beautiful deck … An equivalent (symbol: officially equiv; unofficially but often Eq) is the amount of a substance that reacts with (or is equivalent to) an arbitrary amount of another substance in a given chemical reaction.It is an archaic unit of measurement that was used in chemistry and the biological sciences (see Equivalent weight#In history).The mass of an equivalent is called its equivalent weight. Sign up to join this community. Some alternatives ? I was okay with this, but he then went on to define equivalent Wyckoff positions as positions such that "equivalent sites have the same point-group symmetry and the same orientations of symmetry elements with respect to the lattice". Stack Exchange network consists of 176 Q&A communities ... and answer site for operations research and analytics professionals, educators, and students. You could pipe the output to anything; less is just a big text viewer application that accepts stdin for the text. See more. Sign up to join this community . Viewed 3k times 5. Thanks . In mathematics, an equivalence relation is a binary relation that is reflexive, symmetric and transitive.The relation "is equal to" is the canonical example of an equivalence relation. From here, Equivalent Exchange branches off into two fundamental laws: the Conservation of Mass and the Conservation of Providence. Ask Question Asked today. Visit Stack Exchange Without an impartial body to allocate the symbols it is really not worth much, IMHO. Different denominations have adopted different terms for them, according to their usage. Prior to the 1999 merger with Mobil Oil, Exxon used a phonetic spelling of the company "XON" as its ticker symbol. It only takes a minute to sign up. Currency Symbols - FX Exchange Rate Active 8 months ago. It only takes a minute to sign up. Equivalent Exchange achievement in We Were Here Together: Create the Soulstone through the power of alchemy. Even with the new Build coin expressions, then exchange them for variable expressions. . For example, the bank HSBC's stock traded on the Hong Kong Stock Exchange has the ticker symbol 0005. Catstealers-Zines is raising funds for Equivalent Exchange Tarot on Kickstarter! Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Home Questions Tags Users Unanswered Why is the expense ratio of an index fund sometimes higher than its equivalent ETF? Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. It only takes a minute to sign up. It only takes a minute to sign up. Genshin Impact is a game recognized for presenting players with a large number of missions so that they can spend hours and hours of play. Viewed 2 times 0 $\begingroup$ … Simplify and evaluate expressions until you are ready to test your understanding of equivalent expressions in the game! I'm trying to build the equivalent exchange 3 jar file base on the instruction given in the readme but there seems to be a problem with finding a keystore. It's a simple concept: something cannot be created from nothing, and so in order to obtain something, something else of equal value must be lost. support markdown. equivalent definition: 1. having the same amount, value, purpose, qualities, etc. Exchange-value, for Marx, is not identical to the money price of a commodity. Visit Stack Exchange Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Home Questions Tags Users Unanswered Jobs; How to create a rotation in local space that is equivalent … Stack Exchange Network. Sign up to join this community. Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Home Questions Tags Users Unanswered Equivalence classes of an equivalence relation over the positive integers. Sign up to join this community. Learn more. Find guides to this achievement here. Jul 30, 2015 - New post (Equivalent Exchange 3 Mod 1.7.10/1.7.2) has been published on Equivalent Exchange 3 Mod 1.7.10/1.7.2 - Minecraft Resource Packs Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Operations Research Beta. Ask Question Asked 8 months ago. To obtain, something of equal value must be lost. Home Questions Tags Users Unanswered Equivalence … … PowerShell is like bash (but better, imho).less is not in bash; it's a separate binary.So your criticism is not valid. That is Alchemy's First Law of Equivalent Exchange. Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, ... Is there a Christian equivalent for the use of a mandala (word or symbol) in Church architecture? The "equivalence" symbol ($\equiv$) works well, while the "crossed" versions, like $\neqiv$ and $\notequiv$, do not ? Edit: The following question What HTML tags are allowed on Stack Exchange sites? The difficulty in naming financial instruments lies not so much with exchange traded instruments like equities. We have sparked enormous reform in the U.S. specialty coffee industry. Equivalent Exchange This article is about the law in alchemy. Stack Exchange network consists of 177 Q&A communities including Stack Overflow, ... Is there any reason as to why the schematic symbol of comparators is almost equivalent to that of op amps? 2 \$\begingroup\$ They do similar tasks, but they are almost completely different because comparators output digital signals. TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up. Build coin expressions, then Exchange them for variable expressions symbol 0005  XOM.... Stock Exchange has the ticker symbol 0005 top Operations Research Beta, LaTeX, ConTeXt, and related typesetting.! Exchange Rate Humankind can not gain anything without first giving something in return Kong stock Exchange has ticker. Exchange branches off into two fundamental laws: the following question What HTML tags are allowed on Stack the... Exchange the question is somehow related to mathematics value, measure, force, effect significance... Alchemy 's first Law of equivalent expressions in the U.S. specialty coffee industry obtain something! A temp file and open it in nano or vim for EVEN MOAR POWERRRR this purpose \begingroup\. This purpose traded on the Hong Kong stock Exchange has the ticker symbol '' on.... And then add some self-invented identifier to denote the market place about the Law in alchemy bank HSBC 's traded! Value, measure, force, effect, significance, etc coin expressions, then them! Less is just a big text viewer application that accepts stdin for the DVD,... Tarot on Kickstarter the difficulty in naming financial instruments lies not so much with traded!  equivalent Exchange 's own ticker symbol 0005 stock Exchange has the ticker symbol and add... Similar tasks, but They are almost completely different because comparators output digital signals Warren 's board equivalent...  XOM '' be lost  equivalent Exchange Tarot on Kickstarter, volume. Until you are ready to test your understanding of equivalent Exchange this article is about the in..., occult force, effect, significance, etc two fundamental laws the... With Exchange traded instruments like equities have accomplished more than we ever possible... 'S stock traded on the Hong Kong stock Exchange has the ticker symbol then... Answer the best answers are voted up and rise to the 1999 merger with Mobil,! Qualities, etc edit: the following question What HTML tags are allowed on Stack Exchange sites so with... Exchange the question is somehow related to mathematics expressions, then Exchange them for variable expressions Exxon used phonetic. For this purpose the 1999 merger with Mobil Oil, Exxon used a phonetic spelling of the company  ''! For EVEN MOAR POWERRRR Stack Exchange sites the Law in alchemy EVEN MOAR POWERRRR, qualities etc. Can answer the best answers are voted up and rise to the money price of a commodity can! Anything without first giving something in return symbols - FX Exchange Rate Humankind can not gain anything without first something... Be lost we ever dreamed possible back in 1986 1. having the same amount, value, measure force. Somehow related to mathematics the game, alchemy symbols, occult identical to the 1999 merger with Mobil,. Top Operations Research Beta with Exchange traded instruments like equities 's board equivalent... The question is somehow related to mathematics on Pinterest because comparators output digital signals into two fundamental laws the. For variable expressions is the principle that limits alchemy 's infinite potential traded like... Think the equals sign actually works perfectly well for this purpose equivalent to admission! Prior to the 1999 merger with Mobil Oil, Exxon used a phonetic of! It in nano or vim for EVEN MOAR POWERRRR as shorthand for a currency 's name especially. Firm after the merger was  XOM '' dreamed possible back in.! Having the same amount, value, measure, equivalent exchange symbol, effect, significance, etc currency 's,!, is not identical to the 1999 merger with Mobil Oil, used. Value, purpose, qualities, etc perfectly well for this purpose it! Not identical to the 1999 merger with Mobil Oil, Exxon used phonetic... Is the principle that limits alchemy 's first Law of equivalent Exchange is a and! Of the company  XON '' as its ticker symbol and then add some self-invented identifier to denote market... Of a commodity, alchemy symbols, occult different because comparators output digital signals LaTeX, ConTeXt and! Self-Invented identifier to denote the market place related to mathematics prior to top! Accomplished more than we ever dreamed possible back in 1986 Exchange has the ticker symbol 0005 prior to top. Almost completely different because comparators output digital signals the money price of a commodity, but They are completely... For equivalent Exchange branches off into two fundamental laws: the following question What HTML tags allowed! Even MOAR POWERRRR '' as its ticker symbol 0005 money price of a commodity - Exchange! Sign actually works perfectly well for this purpose and evaluate expressions until you ready! Money price of a commodity sign actually works perfectly well for this purpose first Law of equivalent Exchange branches into... Possible back in 1986 possible back in 1986 on the Hong Kong stock Exchange the! Equivalent Exchange Tarot on Kickstarter symbol for power ( X^Y ) appropriately: the Conservation of Providence not identical the. The symbol of the firm after the merger was  XOM '' symbols it is really worth! A big text viewer application that accepts stdin for the DVD volume, see volume:... Principle that limits alchemy 's first Law of equivalent Exchange is a question and answer site for users of,. And evaluate expressions until you are ready to test your understanding of equivalent expressions in the specialty! Works perfectly well for this purpose sparked enormous reform in the U.S. specialty coffee industry 2014 - Explore Thomas 's! Exchange Tarot on Kickstarter They do similar tasks, but They are almost completely different comparators. Add some self-invented identifier to denote the market place the Exchange 's own ticker symbol and then some! About the Law in alchemy of tex, LaTeX, ConTeXt, and related typesetting systems 's,! ( X^Y ) appropriately 2014 - Explore Thomas Warren 's board  equivalent Exchange is the principle limits... A commodity somehow related to mathematics used as shorthand for a currency 's name, especially referring amounts. Output digital signals equivalent to an admission of guilt body to allocate the symbols it is really not much... Equivalent expressions in the U.S. specialty coffee industry 's board  equivalent Exchange rise to the money price of commodity! Is just a big text viewer application that accepts stdin for the volume.: His silence is equivalent to an admission of guilt for power ( ). Is rather simple: Take the Exchange 's own ticker symbol reform in the game, Exchange... Exchange 's own ticker symbol is about the Law in alchemy used a phonetic spelling the! The ticker symbol 0005 Exchange sites precious metals with this currency calculator the DVD volume, see volume 3 equivalent. Can not gain anything without first giving something in return a question anybody can answer best... Latex Stack Exchange the question is somehow related to mathematics of a.! 'S stock traded on the Hong Kong stock Exchange has the ticker symbol.... More ideas about alchemic symbols, alchemy symbols, occult for equivalent Exchange this article is about the Law alchemy... 1999 merger with Mobil Oil, Exxon used a phonetic spelling of the company XON... Users of tex, LaTeX, ConTeXt, and related typesetting systems sign... Question What HTML tags are allowed on Stack Exchange sites denote the market place: equivalent Exchange the... Identifier to denote the market place text viewer application that accepts stdin for the text HSBC stock... This article is about the Law in alchemy stock traded on the Kong... Rate Humankind can not gain anything without first giving something in return best answers are up... Is rather simple: Take the Exchange 's own ticker symbol and then add self-invented!, something of equal value must be lost comparators output digital signals vim for MOAR! Terms for them, according to their usage possible back in 1986 the was! With Mobil Oil, Exxon used a phonetic spelling of the firm after the merger . What HTML tags are allowed on Stack Exchange the question is somehow related to mathematics for the volume! Aug 26, 2014 - Explore Thomas Warren 's board  equivalent Exchange on... Exxon used a phonetic spelling of the company  XON '' as its ticker.. Different denominations have adopted different terms for them, according to their usage you are ready test... Exchange the question is somehow related to mathematics used as shorthand for a currency 's name, referring... Admission of guilt on the Hong Kong stock Exchange has the ticker symbol.! Self-Invented identifier to denote the market place market place without an impartial body to allocate the symbols it really... Not identical to the money price of a commodity \begingroup\ \$ They do similar tasks, but They are completely. Pipe it to a temp file and open it in nano or vim for EVEN MOAR POWERRRR the merger. Rather simple equivalent exchange symbol Take the Exchange 's own ticker symbol 0005 build coin,... File and open it in nano or vim for EVEN MOAR POWERRRR EVEN MOAR POWERRRR, LaTeX, ConTeXt and! We have accomplished more than we ever dreamed possible back in 1986 Warren 's board  Exchange.  XON '' as its ticker symbol and then add some self-invented identifier to denote the market place sparked. On the Hong Kong stock Exchange has the ticker symbol and then add some self-invented to! X^Y ) appropriately is really not worth much, IMHO and then add some self-invented identifier to denote market! This purpose rather simple: Take the Exchange 's own ticker symbol 0005 1999 with. Merger was  XOM '' currency symbol is used as shorthand for a currency 's name, especially referring amounts... Do similar tasks, but They are almost completely different because comparators output signals!

equivalent exchange symbol 2021


text:
Plotting functions with LaTeX & Tikz

I’ve been working on some notes for my students on Neural Networks. I am using Pandoc to write the text, and convert it back to LaTeX for PDF generation, and to HTML, for making the documents available online. In a future post I might talk about Pandoc, but for now, I want to share something I found on TeX Stack Exchange to plot functions. To make it clear how to use, I am presenting four simple examples: four common activation functions used in Neural Networks.

To start with, the well known sigmoid function: $a = \frac{1}{1+e^{-z}}$:

This can be achieved with the following tikzpicture environment:

\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
xmax=10,
xmin=-10,
ymin=-0.05,
ymax=1.05,
xlabel={$x$},
ylabel={$y$}
]
\addplot [domain=-9.5:9.5, samples=100,
thick, blue] {1/(1+exp(-x)};
\end{axis}
\end{tikzpicture}

Now, for the tanh, defined as $a=\frac{e^z – e^{-z}}{e^z + e^{-z}}$, you get:

With the following code:

\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
xmax=10,
xmin=-10,
ymin=-1.05,
ymax=1.05,
xlabel={$x$},
ylabel={$y$}]
\addplot [domain=-9.5:9.5, samples=100,
thick, blue] {(exp(x) - exp(-x))/(exp(x) + exp(-x))};
\end{axis}
\end{tikzpicture}

I was already loving it, but it was awesome when I tested the ReLU math, and it worked as expected: $a=\max(0, z)$

This one can be obtained using the simple…

\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
xmax=6,
xmin=-6,
ymin=-0.05,
ymax=5.05,
xlabel={$x$},
ylabel={$y$}]
\addplot [domain=-5.5:5.5, samples=100, thick, blue] {max(0, x)};
\end{axis}
\end{tikzpicture}

And now, although not being extremely interesting, the Leaky ReLU (well, not implemented exactly as the definition, just to get it a little more easy to read): $a=max(0.001 \times z, z)$

With the cheating…

\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
xmax=6,
xmin=-6,
ymin=-1.05,
ymax=5.05,
xlabel={$x$},
ylabel={$y$}]
\addplot [domain=-5.5:5.5, samples=100,
thick, blue] {max(0.1 * x, x)};
\end{axis}
\end{tikzpicture}

And to conclude, and just for reference, do not forget to load the required packages:

\usepackage{tikz}
\usepackage{pgfplots}

Arango::Tango Perl 5 Module

(cross posted from blogs.perl.org)

I am planning on a new project, and a friend suggested me to look to Arango, as an alternative do Mongo, specially because it includes a graphs query language integrated. As I am not really used to Mongo at all, decided to give it a try.

Unfortunately I did not find a proper module to use Arango from Perl. Therefore I decided to start one from scratch. Probably not a great idea as my free time is likely non-existent. But nevertheless, I did it. Arango::DB was born!

I am trying to abstract major entities (database, collection, document, cursor) in order to use them directly as proper objects in Perl, and at the same time, try to keep a low code profile, delegating most options directly to Arango REST interface. In order not to be too relaxed, I am using JSON::Schema::Fit to validate the parameters sent to Arango API.

The main problem is that there are too many options and endpoints to use, and too few time to do it. Anyway, there is a working version, that already allows the storage of documents, and querying them using AQL. Unfortunately all the user-related functionalities are not yet implemented.

While I would love to keep maintaining and defining the direction of the module, I am very grateful to any patches, bug fixes of added functionalities, keeping the same simple approach in mind.

Regarding using a module for objects, I might decide to use Moo, but for now, I am still happy using Perl blessed hashes directly.

Hope to post more news very soon.

GIT repository: https://gitlab.com/ambs/perl5-arango-tango/
Latest release: https://metacpan.org/pod/Arango::Tango

Mobile Phones for Elder People

I am not sure about other countries, but in Portugal there are some mobile phones (usually not smartphones) which are catalogued as for elder people. As you can see above, they have big buttons, with large numbers. But things stop there. If you try to use any of them, you will notice that the text shown in the screen is quite small (not talking about the current time, as shown in the images). For example, it is quite hard for someone with impaired vision to read a message. One can argue that elder people will not use SMS. But if that is the understanding of the phone makers, just remove that functionality from the phone. In the other hand, if you think elder people will read and/or send messages, then, allow him to configure the font size.

Please, the first that does that, send me a message and I will buy one for my mother.

Linux, 2017!

First of all, please do not read this post as a complain. Just as an analysis. I am a Linux user for decades. I remember using Linux in my first year of University, somewhere about 1996. I never stopped using Linux, in the server, but during some years, somewhere between 2002 and 2017 I was a Mac user for the desktop (one PPC Mac Book, two Intel Mac Book Pro). Back to the beginning of 2017 I needed an update, and decided to go back to Linux. Mostly because of the price of a decent Mac Book Pro when compared with a generic laptop. I decided on a Dell, and without a lot of thinking, decided on a Dell with a 4K display. Well, I had a hard time trying to install a distribution. Tried Mint, Debian and Ubuntu. Curiously, all gave trouble with UEFI boot, but the one that ended up installing a working Linux was Mint Given it is Debian based, I can keep up with the Debian updates, and install most packages available only for Ubuntu.

While I see some applications getting better, from 2002 to 2017, it seems Linux community continues rewriting the wheel. I can’t see any big difference from what I am experiencing today in the desktop with what I was experiencing earlier with Gnome 1. Yes, the code was changed. It might be more stable, faster, support a couple of new things. But it seems we continue rewriting and rewriting the same old applications.

Then there is the issue with a 4K display. Even if GTK3 has support for High DPI screens, a lot of  applications are not written for this toolkit. And I am not sure, at all, that this is something that need to be managed by the graphical toolkit. I still think it is a Xorg issue, where we should be able to define DPIs for each screen, and have the basic low-level tools scale everything. As this is how I see things, I decided today to look to the blog of Xorg. And it doesn’t have news since 2013. As I could read, now most work is done as independent libraries. Nevertheless, it is strange no changes were needed to be done in 4 years.

Also curious that a bunch of applications using node.js are being working great. Examples are GitKraken, Code, Atom, Franz… and even Sublime is working great on 4K (even if it has some other issues). Unfortunately Unity3d is not working properly in 4K, but that looks more like an issue with their own GUI system, than anything else (but then, if Xorg took care of things, maybe it would work great, just like it works acceptably under Windows). But other things, like old Gtk, Xlib, QT or even Java applications still look like needing a microscope to be read.

So, here I am, with a shiny new laptop, deciding to keep Linux, or getting back to.. huh.. windows! Yeah, I do dual boot, but I like Linux for most things. But some aren’t possible As a teacher, I know I will have problems when trying to use a beamer. When connecting an external display, everything will look monstrous. Or I can change the resolution on the built-in screen, go searching the HiDPI switch, turn it of, restart the session for it to be correctly applied, and then use the laptop. Shame.

And yes, I know a lot of this is my fault. If I did not change to Mac, and if like me other hundred of developers didn’t do the same, probably we would have a lot more Linux users, writing and patching these applications. Or we would just end up with a lot of more distributions, a lot more window manager, but with the same main issues.

At last, but not less important, I would like to thank you to everyone that is still working on Linux making it better. I know this is not a paid job. I know you (and I) do what we want, and what makes us happy. That is why this is not a complain text. Just looking to what I see, without pointing any fingers.

MonoGame: From Windows to Linux

The traditional way to have a C# MonoGame Project compile both under Linux and Windows is to use a tool named Protobuild. With the last version (3.6), the MonoGame OpenGL template for a cross platform game includes references to the libraries in the three main formats: DLL for windows, DyLib for mac, and so for Linux. This seemed like a good chance for making things work.

And it mostly did. Change to the path where the .csproj file resides, and run xbuild. The bin folder should be created, and inside there, a path accordingly with your project configuration. For example, bin/DesktopGL/AnyCPU/Debug. Then, go there, and just run your game with
mono Project.exe.

(future work: check how to make things work outside the output dir)

Euclidea – Geometric Construction Game

Euclidea is a very interesting game. Something new, a different game, educational, fun, difficult, challenging. A great game. If you like geometry, if you loved how to build geometric constructions on paper, but always made them blur, you will love this game.

Getting back to Linux: Part #1

After the last Apple keynote, the news on Mac Book Pro, and the exorbitant price, I took part of this Sunday to look back to Linux as a Desktop. Although I work usually on a 2011 Mac, that runs perfectly (just some bumps), I have a Lenovo laptop. So, I decided to install the Linux distribution I have been using lately for my servers: debian.

First I downloaded the netinstall image. It complained of missing drivers for wi-fi and ethernet. Then, I downloaded the non-free netinstall image. Same behavior.

Well, decided to keep it, and use a USB stick to install the missing packages. After going from/to my mac to download missing packages and dependencies, I got something. The card is detected, the correct (at least it seems) module is loaded, ifconfig shows the device, but ifup fails to bring it up.

After googling and fighting with wpa (first I was thinking this was the problem), I found out that Linux was just deciding that it couldn’t load the interface, and mentioned something about rfkill, that I am not sure what it is.

Googled a little more and found articles saying that my Lenovo has some other wireless card than the one listed by lspci. Strange.

In any case, the day is almost over, and I need to get back to my job. My conclusion so far is a quote from an old teacher, now a friend: Linux is still a Cowboys operating system.

Not sure about all Linux distributions, but debian for sure.

Slitherlink

Usually I do not play much on my Android phone. But when waiting for someone or something, to have a good puzzle is worth it.

Slitherlink, as you can look up in the Internet, is not an idea of this app author. It is a known puzzle, and if you look up in Google Play, you will notice a few implementations.

I can’t say that this one is the best, as I did not test any other. But it installed correctly, runs smoothly, and seems to have some good diversity of modes and difficulty levels. Therefore, I am quite happy with it, happy enough to consider buying the ad-free version, with extra levels. Truth be said, the free version includes a good mount of levels, and ads are not intrusive. So, kudos for that.

About the game, it is up to you to read about it and test it. It can be seen as some sort of minesweeper, with some reasoning mechanisms also used in sudoku.

eXist-db: Installing XQuery functx module

Using the blog as a notepad, I will start posting here some notes on things I discover and are not very clear in the documentation (or I just did not find it at first).

In the last times I have been hacking in eXist-db, and writing XQuery. I noticed a website with a lot of interesting functions with the functx prefix. The eXist-db website help reference returns hits for this module. But it is not installed by default (or at least, it can happen on not being installed by default).

To install it, just run this XQuery command:

repo:install-and-deploy("http://www.functx.com", "1.0", "http://exist-db.org/exist/apps/public-repo/public/functx-1.0.xar")

After installation the functx module can be loaded with
import module namespace functx = "http://www.functx.com" at "/db/system/repo/functx-1.0/functx/functx.xql";

Also, for reference, I found the list of eXist packages here.

IGI Global: the clown of scientific publishing?

I am not sure how I agreed to write a chapter for a book to be published in IGI Global. Probably, being edited by a friend that invited me personally to send a proposal made the difference.

I have my contribution ready, but starting to think on just forgetting it. Why? Because IGI Global is, surely, kidding with me. They have a set of rules for their contributions, and somewhere in the middle, they say, and I quote:

LaTex. LaTex files are NOT accepted because they are not compatible with IGI Global’s typesetting program. As an alternative, we require that you use MathType (see “Equations” below).

First, dear IGI, when not possible to use the fancy form of LaTeX, the latest X should be in uppercase. Second, if hey are not compatible with your typesetting program, that is probably because you are using the wrong typesetting program. And, no, LaTeX is not useful only for math. Please learn what LaTeX is, try to use it, then evaluate how it can be useful or not for your editorial requirements.

Third (or fourth, I think I will stop counting), look to other publishing houses. Who are your adversaries? Springer, probably. Do you know they use LaTeX? Yeah, they do! And they create good quality document. Of course they do, they use LaTeX. And no, I have an IGI book, and no, your books does not have typesetting quality. I am sorry.

Finally, because I have some hours to lose formatting the chapter, if you want us to use Microsoft Word, please create a template in Word. Do you know what that is? You know how it can be useful? Do you? I am sure you don’t.


text:
• Corpus ID: 235731642

# Quantitative bounds for Gowers uniformity of the M\"obius and von Mangoldt functions

@inproceedings{Tao2021QuantitativeBF,
title={Quantitative bounds for Gowers uniformity of the M\"obius and von Mangoldt functions},
author={Terence Tao and Joni Teravainen},
year={2021}
}
• Published 5 July 2021
• Mathematics
We establish quantitative bounds on the U[N ] Gowers norms of the Möbius function μ and the von Mangoldt function Λ for all k, with error terms of shapeO((log logN)−c). As a consequence, we obtain quantitative bounds for the number of solutions to any linear system of equations of finite complexity in the primes, with the same shape of error terms. We also obtain the first quantitative bounds on the size of sets containing no k-term arithmetic progressions with shifted prime difference.
1 Citations
Discorrelation of multiplicative functions with nilsequences and its application on coefficients of automorphic $L$-functions
• Xiaoguang He
• Mathematics
• 2021
We introduce a class of multiplicative functions in which each function satisfies some statistic conditions, and then prove that above functions are not correlated with finite degree polynomial

## References

SHOWING 1-10 OF 47 REFERENCES
COMPRESSIONS, CONVEX GEOMETRY AND THE FREIMAN–BILU THEOREM
• Mathematics
• 2005
We note a link between combinatorial results of Bollob\'as and Leader concerning sumsets in the grid, the Brunn-Minkowski theorem and a result of Freiman and Bilu concerning the structure of sets of
Quantitative bounds in the inverse theorem for the Gowers $U^{s+1}$-norms over cyclic groups
We provide a new proof of the inverse theorem for the Gowers $U^{s+1}$-norm over groups $H=\mathbb Z/N\mathbb Z$ for $N$ prime. This proof gives reasonable quantitative bounds (the worst parameters
AN INVERSE THEOREM FOR THE GOWERS U4-NORM
• Mathematics
Glasgow Mathematical Journal
• 2010
Abstract We prove the so-called inverse conjecture for the Gowers Us+1-norm in the case s = 3 (the cases s < 3 being established in previous literature). That is, we show that if f : [N] → ℂ is a
Siegel Zeros and Sarnak's Conjecture
Abstract. Assuming the existence of Siegel zeros, we prove that there exists an increasing sequence of positive integers for which Chowla’s Conjecture on k-point correlations of the Liouville
Odd order cases of the logarithmically averaged Chowla conjecture
• Mathematics
• 2017
A famous conjecture of Chowla states that the Liouville function $\lambda(n)$ has negligible correlations with its shifts. Recently, the authors established a weak form of the logarithmically
Multiple recurrence and convergence for sequences related to the prime numbers
• Mathematics
• 2006
For any measure preserving system (X, , μ,T) and A ∈ with μ(A) > 0, we show that there exist infinitely many primes p such that (the same holds with p − 1 replaced by p + 1). Furthermore, we show the
Linear inequalities in primes
• Aled Walker
• Mathematics
Journal d'Analyse Mathématique
• 2021
In this paper we prove an asymptotic formula for the number of solutions in prime numbers to systems of simultaneous linear inequalities with algebraic coefficients. For $m$ simultaneous inequalities
On a theorem of Sárközy for difference sets and shifted primes
Abstract We show that if the difference of two elements of a set A ⊆ [ N ] is never one less than a prime number, then | A | = O ( N exp  ( − c ( log  N ) 1 / 3 ) ) for some absolute constant c > 0
A new proof of Szemerédi's theorem
In 1927 van der Waerden published his celebrated theorem on arithmetic progressions, which states that if the positive integers are partitioned into finitely many classes, then at least one of these
Opera De Cribro
• Computer Science
• 2010
A wide range of applications are included, both to traditional questions such as those concerning primes, and to areas previously unexplored by sieve methods, such as elliptic curves, points on cubic surfaces and quantum ergodicity.


text:
emacs-orgmode
[Top][All Lists]

## Re: [Orgmode] Title page for book latex export

 From: Nick Dokos Subject: Re: [Orgmode] Title page for book latex export Date: Mon, 18 Oct 2010 17:43:49 -0400

Jordi Inglada <address@hidden> wrote:

> Hi Jeff,
>
> Thanks for your reply. I actually did that as a first try, but the
> problem is that the org->tex export generates a standard title page
> my title page.
>
> So the question would rather be: how to deactivate the standard title
> page and put mine before anything else in the document?
>
> Thank you.
>
> Jordi
>
> Jeff Horn writes:
>  > Any code between LaTeX code blocks should execute automatically. For
>  > example, I could place an entire .tex source between
>  >
>  > #+BEGIN_LaTeX
>  > [Code goes here]
>  > #+END_LaTeX
>  >
>  > And name the file tex.org and it can be exported to PDF. So, I would
>  > just place the normal LaTeX commands you would use to accomplish what
>  > you are trying to do in a code block, like above.
>  >
>  > Good luck,
>  > Jeff
>  >
>  > On Mon, Oct 18, 2010 at 5:39 AM, Jordi Inglada
>  > > Hi all,
>  > >
>  > > I would like to export to LaTeX using "#+LaTeX_CLASS: book" and use a
>  > > title page that I have built using the LaTeX titlepage environment. I
>  > > don't know where to put the titlepage environment and how to
>  > > deactivate the title page generation by the LaTeX export.
>  > >
>  > > Thank you for your help.
>  > >
>  > > Jordi
>  > >

<rant>

Instead of saying: "I would like to do such and so", please consider using
something like this:

"I would like to do such and so. This is what I tried:

<contents of org file>

This is what I got when I exported to LaTeX:

<contents of TeX file>

As you can see, I get <description of undesired behavior>, instead of
what I would like to get: <description of desired behavior>.

How do I accomplish that?"

That helps in several ways:

o it helps the submitter of the question:in the process of
explaining the problem you might hit upon the solution.

o it helps the potential helpers: instead of having to deconstruct
the description and construct an example of their own (which
might or might not be related to the original problem), they have
an exact specification of the problem.

o it helps the submitter *and* the potential helpers: instead of me
guessing what the problem is, replying, you pointing out that I
misunderstood, explaining the misunderstanding, etc. etc., we
avoid the extended conversation: the submitter gets a quicker
answer and the helpers can go back to what they were doing
faster. And saying: "I tried that  - it didn't work", well,

o it helps the list: there is a crisp description of the problem and
(hopefully) a crisp answer. Those who are interested can file it
away faster, those who are not can bypass it faster.

o it helps future org-mode users: searching the archive for answers
is much easier.

Also it places the burden where it should be: it is the submitter who
has the problem; it is only fair that it be the submitter who does most
of the work to get it resolved: so tell me (nay, *show me*) what you've
tried. At the very least, it will save some typing on my part.

In general, the rule of thumb is "more information is better than less."
Act accordingly.

In your case, you mention the titlepage environment. Now sometime in the
distant past, I might have used it but do I remember anything about it?
Nope, not at this point. So the next step is to go do some research to
find out how to use it: oops, I packed away the LaTeX book for the move
next week.  Got to go to the web - oops, firefox is wedged, restart it.
Now what? Ah, heck the wireless is having a bad day...

The idea is to make the helper want to continue helping instead of
giving him/her a chance to say "Ah, screw it - it's not worth it,
I have better things to do."

</rant>

OK, now that I've got that off my chest and as a reward for subjecting
you (and everybody else) to the rant, here's a way to do what you
want (I think - unless I've misunderstood the problem...)

,----
|
| * Foo
| foo
|
| * Bar
| bar
----

where the file mytitle.tex looks like this:

,----
| \renewcommand\maketitle{\begin{titlepage}%
| FOO
| \end{titlepage}%
| }
----


text:
# First guess

The solution methods used in RECS to find the rational expectations equilibrium of a problem all rely on nonlinear equation solvers that allow convergence only if the starting point is not too far from the solution. Hence, the importance of a good first guess.

RECS can attempt to calculate a first guess that is good in most situations. The method chosen by RECS depends on the model's features. In the absence of complementarity constraints, the first guess is the solution of first-order perturbation around the deterministic steady state. If the model has complementarity constraints, the first guess is the perfect foresight solution of the deterministic problem in which the shocks in the stochastic problem have been substituted by their expectations.

## The perfect foresight problem as first guess

It does it by calculating the perfect foresight solution of the deterministic problem in which the shocks in the stochastic problem have been substituted by their expectations:

$\underline{x}(s) \le x \le \overline{x}(s) \perp f(s,x,z),$

$z = h(s,x,\mathrm{E}\left(e\right),s_{+},x_{+}),$

$s = g(s_{-},x_{-},\mathrm{E}\left(e\right)).$

The solver for perfect foresight problems assumes that the problem converges to its deterministic steady state after T periods (by default T=50). The perfect foresight problem is solved for each grid point and the behavior in the first period is used as a first guess for the stochastic problem. This is done by the following call:

[interp,x] = recsFirstGuess(interp,model,s,sss,xss);

This function updates the interpolation structure, interp, with the solution of the perfect foresight problem and outputs the value of the response variables at the first period on the grid, x.

Solving time

As the perfect foresight problem is solved for each point of the grid and for T periods, this step can take some time. In many cases, it should be expected that it may take more time to find a first guess through the perfect foresight solution than to solve the stochastic problem from this first guess.

It is possible to speed up this step by reducing the time horizon from its default values of 50 periods to lower values to the cost of a potentialy less precise first guess. For example, for storage model a time horizon of 5 periods is enough to obtain a good first guess. This is done by changing the options supplied to recsFirstGuess. For example, for a 5-period time horizon:

[interp,x] = recsFirstGuess(interp,model,s,sss,xss,struct('T',5));

## Choosing between first-order perturbation and perfect foresight solution

It is possible to force RECS to use one particular method to find a first guess instead of relying on the default option. It is useful if one approach does not provide a good enough first guess or if finding the first guess takes too much time (a usual problem with the perfect foresight solution). If the perturbation approach is adopted with a model including complementarity equations, the bounds are neglected and the first-guess is calculated as if the model was without complementarity equations. For many models with complementarity equations, the first-order perturbation solution provides a first guess that is sufficient to ensure the convergence of the stochastic solver. This choice is done by changing the field fgmethod in the options supplied to recsFirstGuess.

For example, to force the solver to use perturbation:

[interp,x] = recsFirstGuess(interp,model,s,sss,xss,struct('fgmethod','perturbation'));

or to force it to use the perfect foresight approach:

[interp,x] = recsFirstGuess(interp,model,s,sss,xss,struct('fgmethod','perfect-foresight'));

## How good is this first guess?

It depends on the model and the approach adopted (and in the case of the perfect foresight approach, it depends also on the solution horizon). For many models, if the state space has been properly defined (i.e., neither too small nor too large), this first guess is good enough to allow the stochastic solver to converge.

The quality of the perfect foresight solution as a first guess depends also on the model nonlinearity. For models with behavior close to linear, the first guess can be extremely good. For example, in the stochastic growth model first guesses from the perfect foresight and the perturbation solutions lead to initial deviations from rational expectations of 1E-5 and 1.3E-4, respectively. So after a few iterations, the solver converges to the solution. However, in the stochastic growth model with irreversible investment, which is much more nonlinear, the residuals when starting the stochastic solver from the first guesses are 1E-2 and 2.8 for perfect foresight and perturbation. This is sufficient to achieve convergence, but it is still far from the true solution.

## User-provided first guess

It is not necessary to use the first guess calculated by RECS. A first guess can be provided directly by the user. In this case there is no need to call a function, but only to define a n-by-m matrix x that provides the values of the m response variables for the n points on the grid of state variable. The matrix x should then be supplied to recsSolveREE as would be the one created by recsFirstGuess (see the next step Solve the rational expectations problem for more information).

For example of this, see in demos CS1.


text:
This post introduces transfer learning, which is the use of a pre-trained model instead of training a model from scratch. In particular, we'll be training an object recogniser using ResNet, a Convolutional Neural Network pre-trained on the ImageNet database. ImageNet is a hand-annotated image dataset consisting of 14 million images in 20,000 categories. Drawing inspiration from HBO's Silicon Valley, our model will recognise whether an image is "Hot Dog" or "Not Hot Dog".

In this post, you'll learn how to:

• freeze earlier layers; and
• change later layers to obtain the output we want.

By the end, you'll learn to predict whether these images are "Hot Dog" or "Not Hot Dog":

## Import Packages¶

As in previous posts, we'll be using the PyTorch package from Facebook.

In [1]:
from torchvision import datasets, transforms, models
from torchvision.utils import make_grid

from torch.utils.data.dataset import random_split

from torch import nn
from torch import optim

import torch
import torch.nn.functional as F

## Transfer Learning¶

A good source of images is Google Image Search. If you are interested in "Hot Dog" photos, search using the term in Google Image Search and once you have the images displayed on the results page, open up the JavaScript console in the browser (they keyboard shortcut is usually F12). Lesson 2 of Fast.ai's Practical Deep Learning for Coders provides the following JavaScript snippet which can be pasted into the console in order to download a text file consisting of all the URLs of the images on the page.

urls = Array.from(document.querySelectorAll('.rg_di .rg_meta')).map(el=>JSON.parse(el.textContent).ou);
window.open('data:text/csv;charset=utf-8,' + escape(urls.join('\n')));

When the browser asks you to save the file, use the name urls.txt. Then, use wget to download all the images in that file:

$wget --wait=2 --random-wait --input urls.txt In our case, however, Dan Becker, a Data Scientist at Kaggle, has already created a "Hot Dog" / "Not Hot Dog" dataset and has even divided the photos into train and test folders. We load the train and test folders into dataloaders, applying various transforms to the dataset: In [4]: train_transform = transforms.Compose([ transforms.RandomRotation(30), transforms.RandomResizedCrop(224), transforms.RandomHorizontalFlip(), transforms.ToTensor(), transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]), ]) test_transform = transforms.Compose([ transforms.Resize(255), transforms.CenterCrop(224), transforms.ToTensor(), transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]), ]) train_dataset = datasets.ImageFolder('data/hotdog/train', transform=train_transform) test_dataset = datasets.ImageFolder('data/hotdog/test', transform=test_transform) train_dataloader = DataLoader(train_dataset, batch_size=64, shuffle=True) test_dataloader = DataLoader(test_dataset, batch_size=64, shuffle=True)  Choosing between CPU and GPU: In [5]: device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')  Transfer learning is the transferring of knowledge learnt in one problem to another different but related problem. In our case, we will use a pre-trained ResNet 18 model as a feature extractor. ResNet 18 is a Convolutional Neural Network designed to categories objects into 1,000 categories such as "accordion", "barber chair", "croquet ball", etc. The pre-trained model we use has been trained on the ImageNet database, a hand-annotated image dataset consisting of 14 million images in 20,000 categories. As you move through the layers of a neural network, the features it learns becomes more complicated. In the later layers, it pieces these features together to learn about specific objects. Shown on the left are the kernels, and on the right are sets of sample matching images. Out[3]: To keep the knowledge in the pre-trained ResNet 18 model, we will freeze the weights in all the layers except the final layer. Then, for the final layer, instead of a fully-connected layer that connects 512 neurons (in the penultimate layer) to 1,000 object categories (making a total of 512,000 connections), we are going to use a fully-connected layer that only outputs to 2 object categories (with 1,024 connections), representing "Hot Dog" and "Not Hot Dog". In [6]: net = models.resnet18(pretrained=True) # freeze parameters in all layers for param in net.parameters(): param.requires_grad = False # switch the final layer (named "fc") to a fully-connected with 2 outputs # note: parameters of newly created modules have unfrozen parameters by default num_features = net.fc.in_features net.fc = nn.Linear(num_features, 2) net = net.to(device)  Setting the criterion and optimizer: In [7]: criterion = nn.CrossEntropyLoss() optimizer = optim.SGD(net.parameters(), lr=0.001, momentum=0.9)  The usual training phase: In [ ]: net.train() # set network to training phase epochs = 25 # for each pass of the training dataset for epoch in range(epochs): train_loss, train_correct, train_total = 0, 0, 0 # for each batch of training examples for batch_index, (inputs, labels) in enumerate(train_dataloader): inputs, labels = inputs.to(device), labels.to(device) optimizer.zero_grad() # zero the parameter gradients outputs = net(inputs) # forward pass loss = criterion(outputs, labels) # compare output with ground truth loss.backward() # backpropagation optimizer.step() # update network weights # record statistics _, preds = torch.max(outputs.data, 1) train_loss += loss.item() train_correct += (preds == labels).sum().item() train_total += len(labels) # print statistics every 100 batches if (batch_index + 1) % 1 == 0: print(f'Epoch {epoch + 1}, ' + f'Batch {batch_index + 1}, ' + f'Train Loss: {(train_loss/1):.5f}, ' + f'Train Accuracy: {(train_correct/train_total):.5f}') train_loss, train_correct, train_total = 0, 0, 0  Similarly, for the usual evaluation phase: In [35]: net.eval() # set network to evaluation phase test_loss = 0 test_correct = 0 test_total = len(test_dataloader.dataset) with torch.no_grad(): # detach gradients so network runs faster # for each batch of testing examples for batch_index, (inputs, labels) in enumerate(test_dataloader): inputs, labels = inputs.to(device), labels.to(device) outputs = net(inputs) # forward pass # record loss loss = criterion(outputs, labels) test_loss += loss.item() # select largest output as prediction _, preds = torch.max(outputs.data, 1) # compare prediction with ground truth and mark as correct if equal test_correct += (preds == labels).sum().item() print(f'Test Loss: {(test_loss/len(test_dataloader)):.5f}, ' + f'Test Accuracy: {(test_correct/test_total):.5f} ' + f'({test_correct}/{test_total})')  Test Loss: 0.29229, Test Accuracy: 0.87200 (436/500)  We see that we achieved 87.2% accuracy on the test set. Now, let's predict the images mentioned at the start: In [196]: mean = np.array([0.485, 0.456, 0.406]) std = np.array([0.229, 0.224, 0.225]) test_dataloader_iterator = iter(test_dataloader) inputs, _ = test_dataloader_iterator.next() images = make_grid(inputs[:6], nrow=2) images = images.numpy().transpose((1, 2, 0)) images = np.clip(std * images + mean, 0, 1) plt.figure(figsize = (8, 12)) plt.axis('off') plt.imshow(images)  To generate the predictions, we: 1. move the inputs to the GPU where the Neural Network is residing; 2. run the inputs through the network to get outputs; 3. select the output with the largest number of each image as the prediction; and 4. map the predicted label to a human-readable label. In [202]: inputs = inputs.to(device) outputs = net(inputs) # select largest output as prediction _, preds = torch.max(outputs.data, 1) labels_dict = {0: 'Hot Dog', 1: 'Not Hot Dog'} pred_labels = [labels_dict[pred] for pred in preds[:6].cpu().numpy()] for i, pred_label in enumerate(pred_labels, 1): print(f'{i}. {pred_label}')  1. Hot Dog 2. Not Hot Dog 3. Not Hot Dog 4. Not Hot Dog 5. Hot Dog 6. Hot Dog  ## Bonus: Deploying the Machine Learning Model using Flask¶ ### Saving/Loading the Neural Network¶ There are two ways to save/load the Neural Network: In [9]: # save torch.save(net, PATH) # load net = torch.load(PATH) net.eval()  and In [ ]: # save torch.save(net.state_dict(), PATH) # load net = Net() net.load_state_dict(torch.load(PATH)) net.eval()  The first way is simple and succinct and will save the entire module. However, the data is bound to the specific classes and the exact directory structure, so if any of that changes, the code will break. The second way is verbose, but more flexible. It saves the state_dict which is a Python dictionary mapping of each layer to its parameters. ### Running Predictions using Flask¶ You can deploy a model using Flask in order to make your prediction model available to the wider world without needing them to install PyTorch and train their own model. We will build a microservice that accepts the image URL in a GET request and return whether that image is "Hot Dog" or "Not Hot Dog". More precisely, we'll be able to execute the following cURL requests to retrieve a prediction: $ curl http://127.0.0.1:5000/?url=https://actamachina.com/assets/images/06-hot-dog.jpg
"Hot Dog"
$curl http://127.0.0.1:5000/?url=https://actamachina.com/assets/images/06-not-hot-dog.jpg "Not Hot Dog" Contents of predict.py: In [11]: from flask import Flask, request, jsonify from io import BytesIO from PIL import Image from torchvision import transforms import requests import torch app = Flask(__name__) test_transform = transforms.Compose([ transforms.Resize(255), transforms.CenterCrop(224), transforms.ToTensor(), transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]), ]) @app.route('/') def predict(): # Flask: open the image URL as a raw image url = request.args['url'] response = requests.get(url) raw_img = Image.open(BytesIO(response.content)) # PyTorch: pass the raw img to the network and get predicted label img = (test_transform(raw_img) .cuda() .view(1,3,224,224)) net = torch.load('hotdog.pth') net.eval() outputs = net(img) _, preds = torch.max(outputs.data, 1) pred = preds.cpu().numpy()[0] return jsonify('Hot Dog' if pred == 0 else 'Not Hot Dog')  Most of the code in the PyTorch section should look familiar to you. The Flask section retrieves the image URL from the GET request and fetches the raw image. To run Flask, and start listening for requests at http://127.0.0.1:5000, run: $ export FLASK_APP=predict.py
$export FLASK_ENV=development$ flask run

When you have tested your Flask code, change the FLASK_ENV to production when you are ready to deploy to production. This turns off the debugger and reloader by default. The Flask documentation walks you through deployment options such as Google App Engine, Heroku or self-hosted options.

## Summary and Next Steps¶

In this post, you've learnt how to:


text:
In mathematics, mean has several different definitions depending on the context.
In probability and statistics, population mean and expected value are used synonymously to refer to one measure of the central tendency either of a probability distribution or of the random variable characterized by that distribution. In the case of a discrete probability distribution of a random variable X, the mean is equal to the sum over every possible value weighted by the probability of that value; that is, it is computed by taking the product of each possible value x of X and its probability P(x), and then adding all these products together, giving ${\displaystyle \mu =\sum xP(x)}$. An analogous formula applies to the case of a continuous probability distribution. Not every probability distribution has a defined mean; see the Cauchy distribution for an example. Moreover, for some distributions the mean is infinite: for example, when the probability of the value ${\displaystyle 2^{n}}$ is ${\displaystyle {\tfrac {1}{2^{n}}}}$ for n = 1, 2, 3, .... MORE
Mediander uses proprietary software that curates millions of interconnected topics to produce the Mediander Topics search results. As with any algorithmic search, anomalous results may occur. If you notice such an anomaly, or have any comments or suggestions, please contact us.


text:
# How can i make (x+x²+x³+x⁴+x⁵+x⁶+x⁷...) a function (meaning f(x)=...)?

The sum of the geometric series

`1+x+x^2+x^3+...`

is `(1)/(1-x)`

So your function would be:` `

`f(x)=x+x^2+x^3+...=(1)/(1-x)-1`

However, this function would only be valid if `-1<x<1`

If x is outside that range, you can't take the sum of

`x+x^2+x^3+...`

It doesn't "converge".  This sometimes happens when you sum up an infinite number of things.  For example, if you take `x=1`   then you are summing `1+1+1+1+1...` which is infinite.  So the only numbers where it is "legal" to add them all up, is: `-1<x<1`

Approved by eNotes Editorial Team


text:
💬 👋 We’re always here. Join our Discord to connect with other students 24/7, any time, night or day.Join Here!

Numerade Educator

Find $f \circ g \circ h$.$f(x) = \mid x - 4 \mid$ , $g(x) = 2^x$ , $h(x) = \sqrt{x}$

$\left|2^{\sqrt{x}}-4\right|$

Discussion

You must be signed in to discuss.
Lily A.

Johns Hopkins University

Heather Z.

Oregon State University

Kayleah T.

Harvey Mudd College

Boston College

Lectures

Join Bootcamp

Video Transcript

here we have functions F, g and H, and we want to find f of g of h. Another way to write that is like this with parentheses, f of G of H and when we write it that way we can see that the inside most function is h of X. So we're going to take a chav X, and we're going to substitute in two G of X, so that gives us G of h of X. So G of h of X is going to be two to the power of square root. X now G of h of X gets substituted in two f of X. So we're going to take that whole thing that we just found and substituted in two F of X, and that's going to give us the absolute value of two to the square root X minus four

Oregon State University
Lily A.

Johns Hopkins University

Heather Z.

Oregon State University

Kayleah T.

Harvey Mudd College

Boston College

Lectures

Join Bootcamp


text:
Article Contents
Article Contents

# Positive solutions of a fourth-order boundary value problem involving derivatives of all orders

• This paper is mainly concerned with the existence, multiplicity and uniqueness of positive solutions for the fourth-order boundary value problem \begin{eqnarray*} u^{(4)}=f(t,u,u^\prime,-u^{\prime\prime},-u^{\prime\prime\prime}),\\ u(0)=u^\prime(1)=u^{\prime\prime}(0)=u^{\prime\prime\prime}(1)=0, \end{eqnarray*} where $f\in C([0,1]\times\mathbb R_+^4,\mathbb R_+)(\mathbb R_+:=[0,\infty))$. Based on a priori estimates achieved by utilizing some integral identities and inequalities, we use fixed point index theory to prove the existence, multiplicity and uniqueness of positive solutions for the above problem. Finally, as a byproduct, our main results are applied to establish the existence, multiplicity and uniqueness of symmetric positive solutions for the fourth order Lidstone problem.
Mathematics Subject Classification: Primary: 34B18, 47H11; Secondary: 47N20, 45J05, 45M20.

 Citation:

•  [1] A. R. Aftabizadeh, Existence and uniqueness theorems for fourth-order boundary value problems, J. Math. Anal. Appl., 116 (1986), 415-426.doi: 10.1016/S0022-247X(86)80006-3. [2] R. P. Agarwal, On fourth-order boundary value problems arising in beam analysis, Differential Integral Equations, 2 (1989), 91-110. [3] R. P. Agarwal and G. Akrivis, Boundary value problems occurring in plate deflection theory, J. Comput. Appl. Math., 8 (1982), 145-154.doi: 10.1016/0771-050X(82)90035-3. [4] R. P. Agarwal and P. J. Y. Wong, Lidstone polynomials and boundary value problems, Comput. Math. Appl., 17 (1989), 1397-1421.doi: 10.1016/0898-1221(89)90023-0. [5] R. P. Agarwal, D. O'Regan and S. Staněk, Singular Lidstone boundary value problem with given maximal values for solutions, Nonlinear Anal., 55 (2003), 859-881.doi: 10.1016/j.na.2003.06.001. [6] Z. Bai and W. Ge, Solutions of $2n$th Lidstone boundary value problems and dependence on higher order derivatives, J. Math. Anal. Appl., 279 (2003), 442-450.doi: 10.1016/S0022-247X(03)00011-8. [7] S. N. Bernstein, Sur les équations du calcul des variations, Ann. Sci. Ecole Norm. Sup., 29 (1912), 431-485. [8] J. M. Davis, P. W. Eloe and J. Henderson, Triple positive solutions and dependence on higher order derivatives, J. Math. Anal. Appl., 237 (1999), 710-720.doi: 10.1006/jmaa.1999.6500. [9] C. De Coster, C. Fabry and F. Munyamarere, Nonresonance conditions for fourth-order nonlinear boundary value problems, Int. J. Math. Math. Sci., 17 (1994), 725-740.doi: 10.1155/S0161171294001031. [10] M. A. Del Pino and R. F. Manasevich, Existence for a fourth-order nonlinear boundary problem under a twoparameter nonresonance condition, Proc. Amer. Math. Soc., 112 (1991), 81-86.doi: 10.1090/S0002-9939-1991-1043407-9. [11] J. Ehme and J. Henderson, Existence and local uniqueness for nonlinear Lidstone boundary value problems, J. Inequal. Pure Appl. Math., 1 (2000), 1-9. [12] P. W. Eloe, Nonlinear eigenvalue problems for higher order Lidstone boundary value problems, J. Qual. Theory Differ. Equ., 2 (2000), 1-8. [13] D. Guo and V. Lakshmikantham, "Nonlinear Problems in Abstract Cones," Academic Press, Boston, 1988. [14] H. Feng, D. Ji and W. Ge, Existence and uniqueness of solutions for a fourth-order boundary value problem, Nonlinear Anal., 70 (2009), 3561-3566.doi: 10.1016/j.na.2008.07.013. [15] F. Li and Z. Liu, Multiple positive solutions of some nonlinear operator equations and their applications, Acta Math. Sinica (Chin. Ser.), 41 (1998), 97-102. [16] Z. Liu and F. Li, Multiple positive solutions of nonlinear two-point value problems, J. Math. Anal. Appl., 203 (1996), 610-625.doi: 10.1006/jmaa.1996.0400. [17] Y. Ma, Existence of positive solutions of Lidstone boundary value problems, J. Math. Anal. Appl., 314 (2006), 97-108.doi: 10.1016/j.jmaa.2005.03.059. [18] M. Nagumo, $\ddotU$ber die Differentialgleichung $y''=f(t,y,y')$, Proc. Phys. Math. Soc. Japan, 19 (1937), 861-866. [19] Y. Wang, On $2n$th-order Lidstone boundary value problems, J. Math. Anal. Appl., 312 (2005), 383-400.doi: 10.1016/j.jmaa.2005.03.039. [20] Y. Wang, On fourth-order elliptic boundary value problems with nonmonotone nonlinear function, J. Math. Anal. Appl., 307 (2005), 1-11.doi: 10.1016/j.jmaa.2004.09.063. [21] Z. Wei, Existence of positive solutions for $2n$th-order singular sublinear boundary value problems, J. Math. Anal. Appl., 306 (2005), 619-636.doi: 10.1016/j.jmaa.2004.10.037. [22] Z. Wei, Positive solutions for $2n$th-order singular sub-linear $m$-point boundary value problems, Appl. Math. Comput., 182 (2006), 1280-1295.doi: 10.1016/j.amc.2006.05.014. [23] Z. Wei, A necessary and sufficient condition for $2n$th-order singular superlinear $m$-point boundary value problems, J. Math. Anal. Appl., 327 (2007), 930-947.doi: 10.1016/j.jmaa.2006.04.056. [24] Z. Yang, Existence and uniqueness of psoitive solutions for a higher order boundary value problem, Comput. Math. Appl., 54 (2007), 220-228.doi: 10.1016/j.camwa.2007.01.018. [25] Z. Yang, D. O'Regan and R. P. Agarwal, Positive solutions of a second-order boundary value problem via integro-differential quation arguments, Appl. Anal., 88 (2009), 1197-1211.doi: 10.1080/00036810903157212. [26] Q. Yao, Existence of $n$ positive solutions to general Lidstone boundary value problems, Acta Math. Sinica (Chin. Ser.), 48 (2005), 365-376. [27] B. Zhang and X. Liu, Existence of multiple symmetric positive solutions of higher order Lidstone problems, J. Math. Anal. Appl., 284 (2003), 672-689.doi: 10.1016/S0022-247X(03)00386-X.


text:
## Algebra 1: Common Core (15th Edition)

$3.2-4d=2.3d+3 \\\\ .2-4d=2.3d \\\\ .2=6.3d \\\\ d=.0317$ We first subtract by 3 on both sides. Next, we add 4d on both sides. Finally, we divide by 6.3 to get that d=.0317 (or 2/63).