## Initiate variables with explicit types in Crystal

After skimming through the tutorial at www.crystal-Lang.org, I understand most of the basics but I’m having trouble grasping types. Like everything else they seem to be somewhere between Ruby’s (automatically decided) and C/C++’s (you declare types). Can someone briefly explain how to declare them manually and when it’s necessary to?

## Sending explicit auth fail requests to fail2ban

From what I understand, fail2ban parses the log files for regexps matching like authentication failure. Is there a way an application can explicitly notify auth failure information like via a REST call? This way, if the log format or log file location changes unexpectedly, it doesn’t silently break fail2ban? Are there other tools that can help with this case?

## Explicit examples of Azumaya algebras

I’m trying to understand the Brauer group of a scheme better. I know how to compute $$\text{Br}(X)$$ as an abstract group in some cases, but don’t have a good idea of what the individual Azumaya algebras actually look like (in terms of an explicit trivialisation on an etale open cover). For instance:

• What do the Azumaya algebras on $$\mathbb{P}^n_k$$ look like? (Since $$\text{Br}(\mathbb{P}^n_k)=\text{Br}(k)$$, I imagine there’s an explicit way to get an Azumaya algbera on $$\mathbb{P}^n$$ from a central simple algebra).
• What do the Azumaya algebras on a smooth curve in $$\mathbb{P}^2$$ given by $$f=0$$ look like? (For some $$k$$ not algberaically closed, say $$\mathbb{F}_q$$, since otherwise $$\text{Br}(X)=0$$).
• Are there any other examples like this?

I’m mainly interested in this to compute examples of the Brauer-Manin obstruction, i.e. taking Azumaya algebra $$A$$ and point $$p\in X(k_\nu)$$ and computing $$\text{inv}_\nu(A_{p})$$ where $$A_{p}$$ is the image of Azumaya algebra $$A$$ under $$\text{Br}(X)\to \text{Br}(k_\nu)$$ arising from the inclusion of $$p\hookrightarrow X$$, and $$\text{inv}_\nu$$ is the Hasse invariants map. I’d be interested in seeing this computed in the examples above.

My confusion might just arise from not knowing how to explicitly compute the map $$\text{inv}_\nu:\text{Br}(k_\nu)\to \mathbb{Q}/\mathbb{Z}$$.

## Making explicit the local structure theorem of étale maps in a very simple case

Making explicit the local structure theorem of étale maps in a very simple case.

First I recall the following items from Stacks.

\smallskip \textbf{Lemma 10.141.2.} Any étale ring map is standard smooth. More precisely, if $$R \to S$$ is étale, then there exists a presentation $$S = R[x_1,\dots,x_n]/(f_1,\dots,f_n)$$ such that the image of $$\det(\partial f_j/\partial x_i)$$ is invertible in $$S$$.

\smallskip Given a prime $$Q$$ of S we say that $$R \to S$$ is étale at $$Q$$ if there exists a $$g \in S$$, $$g \notin Q$$ such that $$\varphi:R \to S_g$$ is étale.

\smallskip \textbf{Definition 10.141.13.} Let $$R$$ be a ring. Let $$g, f \in R[x]$$. Assume that $$f$$ is monic and the derivative $$f’$$ is invertible in the localization $$R[x]_g/(f)$$. In this case the ring map $$R \to R[x]_g/(f)$$ is said to be standard étale.

\smallskip \textbf{Proposition 10.141.16.} Let $$R \to S$$ be a ring map. Let $$Q\subset S$$ be a prime. If $$R \to S$$ is étale at $$Q$$, then there exists a $$h \in S$$, $$h \notin Q$$ such that $$R \to S_h$$ is standard étale.

One can deduce easily the following theorem, an equivalent form of 10.141.16, with no prime.

\smallskip \textbf{Theorem.} Let $$R \to S$$ be an étale ring map. Then there exists a covering $$Spec(S)= \cup_i D(g_i)$$ such that each of the ring maps $$R \to S_{g_i}$$ is standard étale.

\smallskip My question is to make explicit this theorem for a very simple example of an étale ring map, given as standard smooth in one variable.

I consider a ring $$R$$, a degree 3 polynomial $$f(X)=aX^3+bX^2+cX+d\in R(X)$$. I assume that $$f'(x)$$ is invertible in $$S=R[x]=R[X]/(f(X))$$. This means that there exist $$u$$ and $$v$$ in $$R[X]$$ such that $$uf+vf’=1$$ in $$R[X]$$. So the natural map $$R\to S$$ is an étale ring map (standard smooth). In order to make the theorem explicit, I have to find some elements $$y_1$$, \dots, $$y_n$$ and $$g_1$$, \dots, $$g_n$$ in $$S$$, such that:

$$\bullet$$ $$(g_1, \dots, g_n)=S$$,

$$\bullet$$ $$y_i$$ is integral over $$R$$, with $$h_i(y_i)=0$$, $$h_i(Y)$$ monic in R[Y], $$R[y_i]\simeq R[Y]/h_i(Y)$$

$$\bullet$$ $$g_i(x)\in R[y_i]$$

$$\bullet$$ the map $$R_{g_i}[y_i] \to S_{g_i}$$ is an isomorphism

Perhaps a good choice for the $$g_i$$‘s is $$g_1=a$$, $$g_2=ax+b$$, $$g_3=ax^2+bx+c$$. $$y_1$$ should be $$ax$$, but I dont find $$y_2$$ and $$y_3$$.

## Explicit description of injective hulls

Let $$k$$ be a field, and let $$R:=k[x_1,\ldots,x_n]$$.
Consider the $$R$$-module $$M:=R/{(x_1,\ldots,x_n)}\cong k$$ with all the $$x_i$$ acting as zero. Then the injective hull of $$M$$ can be described explicitly as follows: $$I_M := k[x_1^{-1},\ldots,x_n^{-1}].$$ Here, a monomial $$\prod x_i^{a_i}\in R$$ acts on a basis element $$x_i^{b_i}\in I_M$$ by the formula $$\textstyle\big(\prod x_i^{a_i}\big)\cdot\big(\prod x_i^{b_i}\big):=\begin{cases} \prod x_i^{a_i+b_i}&\text{if all the a_i+b_i are \le 0 }\ 0&\text{otherwise} \end{cases}$$

There exists a more functorial description of $$I_M$$. Let $$R^\wedge:=R_{(x_1,\ldots,x_n)}^\wedge=k[[x_1,\ldots,x_n]]$$ be the completion of $$R$$ along $$M$$, viewed as a topological ring with its adic topology. Then $$I_M = \mathrm{Hom}_{\mathit{cts}}(R^\wedge,k),$$ where the subscript $$cts$$ means continuous homomorphisms. This 2nd description is superior. For example, it makes it obvious that the group of automorphisms of $$R^\wedge$$ acts on $$I_M$$.

Question. Let $$R$$ be a finitely generated $$k$$-algebra. Let $$\mathfrak p\in \mathrm{Spec}(R)$$ be a closed point, and let $$M:=R/\mathfrak p$$. It is true that $$I_M := \mathrm{Hom}_{\mathit{cts}}(R_{\mathfrak p}^\wedge,k).$$ is the injective hull of $$M$$?

Now let $$\mathfrak p\in \mathrm{Spec}(R)$$ be a prime ideal which is not maximal, and let $$M$$ bethe field of fractions of $$R/{\mathfrak p}$$, viewed as an $$R$$-module. is there a description of the injective hull of $$M$$ along the same lines?

## NDSolve error: Cannot solve to find an explicit formula for the derivatives. Consider using the option Method->{“EquationSimplification”->”Residual”}

I get the above error message when running the following code:

\[Alpha]h = 0.2; \[Alpha]z = 0.2; \[Gamma] = 0.5; ph = 0.01; pf = \ 0.1; pE = 0.05; FC = 0.1; FE = 0.15; tC = 0.01; tE = 0; TC = 0.05; TE \ = -0.05; w = 1; \[Rho] = 0.2; \[Sigma] =   1/(1 - \[Rho]); L = 1; RA = 0.25; \[Mu] = 1;  G = 1; R0 = 0.1; S = 1;  v[s_] := \[Mu] Log[     Exp[(\[Alpha]h ((RC[s] +                ph)^(-(\[Rho]/\[Sigma]))  + (\[Alpha]h/\[Alpha]z)^(-(\ \[Rho]/\[Sigma])))^((           1 - \[Rho])/\[Rho]) (w + G + R0/L - (pf + tC) s - FC -              TC) - \[Gamma]  Integrate[            LogisticSigmoid[              x] ((\[Alpha]h/\[Alpha]z)^(-(\[Rho]/\[Sigma])) + (RC[x] +                   ph)^(-(\[Rho]/\[Sigma])) )/((RC[x] +                   ph)^-\[Sigma]   (w + G + R0/L - (pf + tC) x - FC -                   TC)), {x, s, S}])/\[Mu]] +       Exp[(\[Alpha]h ((RC[s] +                ph)^(-(\[Rho]/\[Sigma]))  + (\[Alpha]h/\[Alpha]z)^(-(\ \[Rho]/\[Sigma])))^((           1 - \[Rho])/\[Rho]) (w + G + R0/L - (pE + tE) s - FE -              TE) - \[Gamma]  Integrate[(1 -                LogisticSigmoid[                x]) ((\[Alpha]h/\[Alpha]z)^(-(\[Rho]/\[Sigma])) + (RC[                   x] + ph)^(-(\[Rho]/\[Sigma])) )/((RC[x] +                   ph)^-\[Sigma]   (w + G + R0/L - (pf + tC) x - FC -                   TC)), {x, s, S}])/\[Mu]]];  sol = FullSimplify[Solve[{D[v[s], s] == 0}, RC'[s]]] solprime = Equal @@@ Flatten[sol]; solND = NDSolve[{solprime[[1]], RC[S] == RA}, RC, {s, 0, S}] 

I have tried to add the proposed method and also Method->{“EquationSimplification”->”Solve”} but got other error messages then after quite some time of computation. Either “NDSolve::idelay: Initial history needs to be specified for all variables for delay-differential equations.” or “StringForm::sfr: Item 2 requested in “Delayed time 1 = 2 computed at 3 = 4 did not evaluate to a real number.” out of range; 1 items available.”

Any advice would be highly appreciated. Thanks!

## Expression simplified for explicit int values, but not with FullSimplify/FunctionExpand and Assuming. What formula does Mathematica use?

I have a $$_4F_3$$ hypergeometric function (Mathematica 11.3)

HypergeometricPFQ[{1, 3/2 + n, 1 + 2 m + n, 1 + 2 m + n}, {2 + n,    2 + n, 3/2 + 2 m + n}, z] 

If I plug in explicit integer values for $$n$$ I get e.g.

In[29]:= HypergeometricPFQ[{1, 3/2 + n, 1 + 2 m + n,     1 + 2 m + n}, {2 + n, 2 + n, 3/2 + 2 m + n}, z] /. {n -> 0}  Out[29]= (-1 - 4 m)/(  4 m^2 z) + ((1 + 4 m) HypergeometricPFQ[{1/2, 2 m, 2 m}, {1,      1/2 + 2 m}, z])/(4 m^2 z)  In[35]:= HypergeometricPFQ[{1, 3/2 + n, 1 + 2 m + n,     1 + 2 m + n}, {2 + n, 2 + n, 3/2 + 2 m + n}, z] /. {n -> 1}  Out[35]= -(((3 + 4 m) (1 + 4 m + 4 m^2 z))/(   3 m^2 (1 + 2 m)^2 z^2)) + ((1 + 4 m) (3 + 4 m) HypergeometricPFQ[{1/     2, 2 m, 2 m}, {1, 1/2 + 2 m}, z])/(3 m^2 (1 + 2 m)^2 z^2) 

and so on. However, passing $$n$$ being an integer as an assumption and using FullSimplify or FunctionExpand leads to nothing

In[33]:= Assuming[{n \[Element] Integers, n >= 0},   FunctionExpand[   HypergeometricPFQ[{1, 3/2 + n, 1 + 2 m + n, 1 + 2 m + n}, {2 + n,      2 + n, 3/2 + 2 m + n}, z]]]  Out[33]= HypergeometricPFQ[{1, 3/2 + n, 1 + 2 m + n,    1 + 2 m + n}, {2 + n, 2 + n, 3/2 + 2 m + n}, z] 

and

In[36]:= Assuming[{n \[Element] Integers, n >= 0},   FullSimplify[   HypergeometricPFQ[{1, 3/2 + n, 1 + 2 m + n, 1 + 2 m + n}, {2 + n,      2 + n, 3/2 + 2 m + n}, z]]]  Out[36]= HypergeometricPFQ[{1, 3/2 + n, 1 + 2 m + n,    1 + 2 m + n}, {2 + n, 2 + n, 3/2 + 2 m + n}, z] 

Ultimately, I want to know what formula does Mathematica use to obtain these simplifications from $$_4F_3$$ to $$_3F_2$$ (I looked at some resources like DLMF, but couldn’t find anything). Also, it would be nice to find a way to get Mathematica to apply whatever formula it is using to the general case with assumptions.

## View still depends on column even after I have removed the explicit (as well as transitive) dependencies?

Assume I have the following table and view:

CREATE TABLE my_table (a int, b text, c text); CREATE VIEW my_view AS SELECT * FROM my_table WHERE b = 'foo'; 

The table has some data:

INSERT INTO my_table VALUES (1, 'foo', 'first'); INSERT INTO my_table VALUES (2, 'foo', 'second'); INSERT INTO my_table VALUES (3, 'foo', 'third'); 

I realise that column b always has the same value 'foo'. I decide that the entire column is unnecessary, and wish to drop it.

Because I like to be explicit about my dependencies, to make sure I don’t accidentally drop more than I should, I avoid using the CASCADE keyword, opting instead to redefine the dependent view manually:

CREATE OR REPLACE VIEW my_view AS SELECT * FROM my_table; 

The view now no longer has any explicit dependency on column b, so the column should be safe to delete.

ALTER TABLE my_table DROP COLUMN b; 

However, as I try to drop column b, I get the following error message

ERROR:  cannot drop table my_table column b because other objects depend on it DETAIL:  view my_view depends on table my_table column b HINT:  Use DROP ... CASCADE to drop the dependent objects too. 

Why does this error message appear even after removing the dependency on the column to be dropped?

## Why isn’t my function evaluating to an explicit number?

I’m just wondering why my function is not evaluating as I think it should. I put in the following:

dp = {{0, 71}, {1, 71}, {2, 71}, {3, 70}, {4, 69}, {5, 67}, {6,65}, {7, 63}, {8, 61}, {9, 60}, {10, 60}, {11, 61}, {12, 63}, {13,65}, {14, 66}, {15, 67}, {16, 67}, {16, 67}, {17, 66}, {18,65}, {19, 63}, {20, 60}, {21, 58}, {22, 56}, {23, 55}}; f = Fit[dp, {1, x, x^2, x^3, x^4, x^5, x^6, x^7}, x]; f[3] 

but as output I get

(71.121 - 1.29633 x + 1.34837 x^2 - 0.504693 x^3 + 0.0700859 x^4 - 0.00447611 x^5 + 0.000134178 x^6 - 1.53469*10^-6 x^7)[3] 

The output I want is the polynomial’s value at x=3.