reference request – Choice of splitting in domain decomposition algorithms

When solving a PDE numerically by domain decomposition methods, what is the “optimal way” to split the domain? Are there any results stating that a particular partition of the domain yields “better” convergence than other partitions?

For concreteness, let us consider the classical Poisson equation $-Delta u = f(x)$ with homogeneous Dirichlet boundary conditions.

algebraic number theory – How can I prove this claim about splitting of prime ideals in real cyclotomic fields?

Let $L_k = mathbb{Q}(zeta_{2^k} + zeta_{2^k}^{-1})$ be the maximal real subfield of the cyclotomic field of conductor $2^k, k ge 2$ and $f_k(x)$ be the minimal polynomial of $zeta_{2^k} + zeta_{2^k}^{-1}$.

Define $L = L_{k+1}, K = L_{k}$ so $L/K$ has degree 2. Assume a prime ideal $mathfrak{p} subset mathcal{O}_K$ above $p$ splits in $mathcal{O}_L$ as $mathfrak{p}mathcal{O}_L = mathfrak{p}_1 mathfrak{p}_2$. Then I suspect that $pmathcal{O}_L$ totally splits (in which case $pmathcal{O}_K$ totally splits as well). How can I prove this?

I believe this is equivalent to showing that if $f_{k+1}(x)$ has 2 roots over $mathbb{F}_p$ then it factors completely over $mathbb{F}_p$. I’m not sure how that can be shown. Are there any general approaches to take here?

real analysis – Bounding an integral by splitting the interval of integration

My question concerns a method that was used to prove the following statement
$$
lim_{Atoinfty} frac{1}{A}int_1^A A^{frac{1}{x}} dx = 1.
$$

The method is as follows. First we obtain the easy lower bound
$$
frac{1}{A}int_1^A A^{frac{1}{x}} dx > 1 – frac{1}{A}, A > 1
$$

and then to get a tight upper bound, we show that for every $delta > 0$ and for every $K > 0$ there exists $A_0(delta, K) > 1$ such that for all $A > A_0$, $1 + delta < Klog A < A$ and
$$
frac{1}{A}int_1^A A^{frac{1}{x}} dx < delta + A^{-frac{delta}{1+delta}}log A + e^{frac{1}{K}}.
$$

We prove the last statement by dividing the interval of integration into $3$ pieces $(1, 1+delta), (1+delta, Klog A), (Klog A, A)$ and estimating the integrand on each piece. First sending $Atoinfty$ and then Sending $delta to 0$ and $K to infty$, we obtain
$$
1 le liminf frac{1}{A}int_1^A A^{frac{1}{x}} dx le limsup frac{1}{A}int_1^A A^{frac{1}{x}} dx le 1.
$$

My questions are: what motivates the division of the region of integration into $3$ pieces? Is there an intuitive explanation as to why separate bounds on the different regions are effective? Is this a general method that works in other situations as well? If so, I would love to see a sketch of an example and/or a general principle on splitting up regions of integration to obtain desired bounds.

design – Colleague balks at splitting one table in to two

My mid-size workplace has a small IT department and I work with one other programmer, who has been there much longer than I have. The colleague had long previously built a simple Inventory Asset system to keep track of the computer equipment we have, it is not for managing sales or consumable items. This original system has one table with about 20 columns, and so when there is something like a computer with monitors etc., attached to it, some of the rows have redundant info.

I was tasked with designing a new, web-based application, and my first design decision was to create two tables: one with the info about the location and person who uses the computer and so on, and another table with the identifying information about each piece of hardware. In this way, a piece of equipment can be moved from a supply closet to a desk or to another location very simply, by updating a single foreign key column.

My colleague thought that this would be ‘confusing’ for users, but I had to ask, how would the users have any idea how the database is structured? The design I created does exactly what the previous design does, it just makes database updates simpler. This is the first step of Normalization and should be reasonable.

Is there something I am missing? Does my colleague have a point, or perhaps just needs time to absorb the purpose of this design change? I am building an entirely new system, so it is not like any existing code needs to be modified. Is this a common experience when creating a new data system?

python – splitting very large csv file into hundred of thousands csv files based on colulm values

I would like to split a very big csv file with hundreds of millions of row into small hundred of thousand files based on column value.

I have tried many options:

  • I have tried opening file and not closing but there is a limit for the number of opened file at the same time, by using this function from this post
def split_csv_file(f, dst_dir, keyfunc):
    csv_reader = csv.reader(f)
    csv_writers = {}
    for row in csv_reader:
        k = keyfunc(row)
        if k not in csv_writers:
            csv_writers(k) = csv.writer(open(os.path.join(dst_dir, k),
                                             mode='w', newline=''))
        csv_writers(k).writerow(row)
  • I have tried using a simple algorithm with iterating through the files and appending the row to the corresponding file but it is very very slow
with open(filename, 'r') as f:
    with line in f:
        filename_w = line.split(',')(1) + '.csv'
        if os.path.exists(filename_w):
             with open(filename_w, 'a') as fw:
                  fw.write(line)
        else:
             with open(filename_w, 'w') as fw:
                  fw.write(line)

with open

  • I have tried using pyspark using the partition option, same
df.coalesce(1).write.partitionBy(colname).format("csv").option("header", "true").mode("overwrite").save(out_dir)
  • I have tried using awk, same
awk -F, '{print >$2".csv"}' something.csv

Thank you

webgoat – What is happening to second response in HTTP Splitting?

Doing the webgoat HTTP splitting exercise. I feel like I’m doing something wrong or there is something that I don’t understand.

The idea is that since we can control the referer parameter, we can split the request into 2 and have the server sends us another response (This could later on be used to trick victims into caching our 2nd response with the expires parameter).

The thing is: I am not seeing anything. On the browser or on Burp suite.

I am trying the following payload (By intercepting the POST request after clicking “Search!” and replacing the sent string inside the html form box with the following):

test%0aContent-Length:%200%0a%0aHTTP/1.1%20200%20OK%0aContent-Type:%20text/html%0aContent-Length:%2017%0a<html>pwnd</html>

On Burpsuite I see the 302 and the following 200 with the payload appearing at the end of the path and that’s it. Supposedly based on what I am reading on the solution tab, I should be redirected to a site with the html I injected.

Any idea what I might be doing wrong or what’s happening?

symbolic – Splitting product of $gamma$-matrices into symmetric and anti-symmetric part

The $gamma$-matrices satisfy the relation
$$gamma^mu gamma^nu +gamma^nugamma^mu=2eta^{munu}mathrm{id},$$
where $eta$ is the Minkowski metric. Consider now the following process
$$begin{align*}
gamma^mugamma^nu
&= frac{1}{2!}(gamma^mugamma^nu +gamma^mugamma^nu)
= frac{1}{2}(gamma^mugamma^nu + (2eta^{munu}-gamma^nugamma^mu))\
&= frac{1}{2}(gamma^mugamma^nu-gamma^nugamma^mu)+eta^ {munu}\
&=:frac{1}{2}varepsilon^{munu}+eta^{munu}.tag{1}
end{align*}$$

One can now repeat this process and obtain
$$begin{align*}
gamma^mugamma^nugamma^sigma &= frac{1}{6}varepsilon^{munusigma}+ eta^{munu}gamma^sigma- eta^{musigma}gamma^nu+dots
end{align*}$$

where $varepsilon^{munusigma}$ is the anti-symmetrization of $gamma^mugamma^nugamma^sigma$.

Is it possible to obtain this result in Mathematica for an arbitrary product of $gamma$-matrices, i.e.
$$gamma^{mu_1}dots gamma^{mu_r}qquad text{for }rinmathbb{N}?$$
(Realisticly speaking, I only need it for $r<8$.)

Edit:
It’s probably worth pointing out that one can create the antisymmetric part quite easily using

Symmetrize((Epsilon), Antisymmetric({1,...,r}))

galois theory – If all roots of $f$ generate a splitting field, is $f$ irreducible?

Recently I had to prove the existence of some irreducible polynomial. I wanted to use the following statement, but I do not know if it is true:

The Statement:

Let $F$ be a field. If $fin F[X]$ is such that for all roots $alpha$ of $f$ $F[alpha]$ is a splitting field for $f$, then $f$ is irreducible.

My Question:

Is this true? Cyclotomic polynomials have this property and are irreducible. Would the answer change depending on the characteristic of the field?

go – Golang – Splitting a string by a separator not prefixed by an escape string

I need to split a string by a separator but don’t want to split if the separator is prefixed by the escape string.

For example:

"This works\ but it\ isn't pretty." with " " as the separator and "\" as the escape string should produce the following: ()string{"This", "works but", "it isn't", "pretty."}

I wrote the following code for it:

func SplitWithEscaping(s string, separator string, escapeString string) ()string {
    untreated := strings.Split(s, separator)
    toReturn := make(()string, 0, len(untreated))
    for i := 0; i < len(untreated); i++ {
        next, ii := t(untreated, i, separator, escapeString)
        i = ii - 1
        toReturn = append(toReturn, strings.ReplaceAll(next, escapeString+separator, separator))
    }
    return toReturn
}

func t(stringSlice ()string, i int, seperator, escapeString string) (string, int) {
    if !strings.HasSuffix(stringSlice(i), escapeString) {
        return stringSlice(i), i + 1
    }
    next, ii := t(stringSlice, i+1, seperator, escapeString)
    return stringSlice(i) + seperator + next, ii
}

This is the playground link for my code: https://play.golang.org/p/jfHFt9_vtE7

performance tuning – Splitting balls over sized bins

This is strongly related to Splitting a set of integers over a set of bins, but a much simpler case.

If we have $N$ indistinguishable balls and $k$ arbitrarily large distinguishable bins, we know the number of ways to distribute the balls over the bins (allowing for empty bins) is given by a binomial coeffcient

binCounts(balls_, bins_) :=
  Binomial(balls + bins - 1, balls);

and if we want the actual splits, those are given by taking all permutations of integer partitions of $N$ of length $k$

binSplits(balls_, bins_) :=
  Apply(
   Join,
   Permutations(PadRight(#, bins)) & /@
    IntegerPartitions(balls, bins)
   );

Just to show this indeed works

Table(
   Length(binSplits(n, k)) == binCounts(n, k),
   {n, 1, 20},
   {k, 1, 10}
   ) // Flatten // Apply(And)

True

This breaks down, though, when we have sized bins, i.e. each of our $k$ bins has some max number of allowed balls $c_i$. From this math.SE question I’m not expecting there to be a nice closed-form solution for the number of partitions. That doesn’t mean we can’t write an algorithm to generate them.

The naive approach would be to just filter our prior list of solutions

binSplitsSized(balls_, binSizes_) :=
 Block({bins = Length(binSizes), splits},
  splits = Apply(
    Join,
    Permutations(PadRight(#, bins)) & /@
     IntegerPartitions(balls, bins)
    );
  Select(splits, Min(binSizes - #) >= 0 &)
  )

binSplitsSized(10, ConstantArray(3, 5))

{{3, 3, 3, 1, 0}, {3, 3, 3, 0, 1}, {3, 3, 1, 3, 0}, {3, 3, 1, 0, 3}, {3, 3, 0, 
  3, 1}, {3, 3, 0, 1, 3}, {3, 1, 3, 3, 0}, {3, 1, 3, 0, 3}, {3, 1, 0, 3, 3}, {3,
   0, 3, 3, 1}, {3, 0, 3, 1, 3}, {3, 0, 1, 3, 3}, {1, 3, 3, 3, 0}, {1, 3, 3, 0, 
  3}, {1, 3, 0, 3, 3}, {1, 0, 3, 3, 3}, {0, 3, 3, 3, 1}, {0, 3, 3, 1, 3}, {0, 3,
   1, 3, 3}, {0, 1, 3, 3, 3}, {3, 3, 2, 2, 0}, {3, 3, 2, 0, 2}, {3, 3, 0, 2, 
  2}, {3, 2, 3, 2, 0}, {3, 2, 3, 0, 2}, {3, 2, 2, 3, 0}, {3, 2, 2, 0, 3}, {3, 2,
   0, 3, 2}, {3, 2, 0, 2, 3}, {3, 0, 3, 2, 2}, {3, 0, 2, 3, 2}, {3, 0, 2, 2, 
  3}, {2, 3, 3, 2, 0}, {2, 3, 3, 0, 2}, {2, 3, 2, 3, 0}, {2, 3, 2, 0, 3}, {2, 3,
   0, 3, 2}, {2, 3, 0, 2, 3}, {2, 2, 3, 3, 0}, {2, 2, 3, 0, 3}, {2, 2, 0, 3, 
  3}, {2, 0, 3, 3, 2}, {2, 0, 3, 2, 3}, {2, 0, 2, 3, 3}, {0, 3, 3, 2, 2}, {0, 3,
   2, 3, 2}, {0, 3, 2, 2, 3}, {0, 2, 3, 3, 2}, {0, 2, 3, 2, 3}, {0, 2, 2, 3, 
  3}, {3, 3, 2, 1, 1}, {3, 3, 1, 2, 1}, {3, 3, 1, 1, 2}, {3, 2, 3, 1, 1}, {3, 2,
   1, 3, 1}, {3, 2, 1, 1, 3}, {3, 1, 3, 2, 1}, {3, 1, 3, 1, 2}, {3, 1, 2, 3, 
  1}, {3, 1, 2, 1, 3}, {3, 1, 1, 3, 2}, {3, 1, 1, 2, 3}, {2, 3, 3, 1, 1}, {2, 3,
   1, 3, 1}, {2, 3, 1, 1, 3}, {2, 1, 3, 3, 1}, {2, 1, 3, 1, 3}, {2, 1, 1, 3, 
  3}, {1, 3, 3, 2, 1}, {1, 3, 3, 1, 2}, {1, 3, 2, 3, 1}, {1, 3, 2, 1, 3}, {1, 3,
   1, 3, 2}, {1, 3, 1, 2, 3}, {1, 2, 3, 3, 1}, {1, 2, 3, 1, 3}, {1, 2, 1, 3, 
  3}, {1, 1, 3, 3, 2}, {1, 1, 3, 2, 3}, {1, 1, 2, 3, 3}, {3, 2, 2, 2, 1}, {3, 2,
   2, 1, 2}, {3, 2, 1, 2, 2}, {3, 1, 2, 2, 2}, {2, 3, 2, 2, 1}, {2, 3, 2, 1, 
  2}, {2, 3, 1, 2, 2}, {2, 2, 3, 2, 1}, {2, 2, 3, 1, 2}, {2, 2, 2, 3, 1}, {2, 2,
   2, 1, 3}, {2, 2, 1, 3, 2}, {2, 2, 1, 2, 3}, {2, 1, 3, 2, 2}, {2, 1, 2, 3, 
  2}, {2, 1, 2, 2, 3}, {1, 3, 2, 2, 2}, {1, 2, 3, 2, 2}, {1, 2, 2, 3, 2}, {1, 2,
   2, 2, 3}, {2, 2, 2, 2, 2}}

but if the number of bins or balls get even moderately large, this quickly becomes unworkable, since we’re generating the entire Binomial(balls + bins - 1, balls) solution set.

So how can we do better? The easiest initial approach is to just filter our IntegerPartitions off the bat to exclude any unworkable solutions

binSplitsSized2(balls_, binSizes_) :=
 Block({bins = Length(binSizes), max = Max(binSizes), splits},
  splits = Apply(
    Join,
    Permutations(PadRight(#, bins)) & /@
     
     Select(IntegerPartitions(balls, bins), Max(#) <= max &)
    );
  Select(splits, Min(binSizes - #) >= 0 &)
  )

and this can give a significant boost

binSplitsSized(10, ConstantArray(3, 5)) // Length // RepeatedTiming

{0.0018, 101}

binSplitsSized2(10, ConstantArray(3, 5)) // Length // RepeatedTiming

{0.00022, 101}

but can also be very easily stymied

binSplitsSized(10, ConstantArray(10, 1)~Join~ConstantArray(1, 4)) // 
  Length // RepeatedTiming

{0.0019, 16}

binSplitsSized2(10, ConstantArray(10, 1)~Join~ConstantArray(1, 4)) // 
  Length // RepeatedTiming

{0.0018, 16}

So what good approaches are there do better?