real analysis: algebraically define the relationship $ R $ in $ mathbb {R} times mathbb {R} $ defined by $ (x, y) R (w, z) $

I want to verify if my solutions are correct and how to solve iv, please.

Define family $ mathcal A $ of subsets of $ mathbb {R} times mathbb {R} $ as follows. For each $ b in mathbb {R} $, define the set $ L_b subseteq mathbb {R} times mathbb {R} $ by
$$ L_b = {(x, y) in mathbb {R} times mathbb {R} colon y = x + b }. $$
In other words, $ L_b $ is the line in $ mathbb {R} times mathbb {R} $ with slope $ 1 $ Y $ and $-intercept $ b $. Define
$$ { mathcal A} = {L_b colon b in mathbb {R} }. $$
In other words, $ { mathcal A} $ is the collection of all the lines in $ mathbb {R} times mathbb {R} $ with slope $ 1 $.

Test it $ mathcal A $ it is a partition of $ mathbb {R} times mathbb {R} $. Prove the following three facts.

I. Show that to everyone $ b in mathbb {R} $, $ L_b ne emptyset $.

Solution: leave $ b in mathbb {R}. $ So, $ b = 0 + b. $ So, $ (0, b) in mathbb {R} times mathbb {R} $ Y $ b = 0 + b. $ Thus, $ (0, b) in L_b $. Therefore for all $ b in mathbb {R}, L_b ne emptyset $.

ii) Prove that to everyone $ a, , b in mathbb {R} $Yeah $ L_a cap L_b ne emptyset $ so $ L_a = L_b $.

Solution: leave $ (x, y) in L_a cap L_b $. So $ (x, y) in L_a $ Y $ (x, y) in L_b $. So $ y = x + a $ Y $ y = x + b $ and implies $ y-x = a $ Y $ y-x = b. $ So, $ a = b $ Y $ L_a = L_b $.

iii) Prove that for everyone $ (x, y) in mathbb {R} times mathbb {R} $, exists $ b in mathbb {R} $ such that $ (x, y) in L_b $.

Solution: leave $ (x, y) in mathbb {R} times mathbb {R} $ Y $ y-x = b in mathbb {R} $ as $ x in mathbb {R} $ Y $ y in mathbb {R}. $ So $ y = x + b $ so $ (x, y) in L_b $. Therefore there is $ b in mathbb {R} $ such that $ (x, y) in L_b. $

iv. Algebraically define the relationship. $ R $ in $ mathbb {R} times mathbb {R} $ defined by $ (x, y) R (w, z) $ yes and only if it exists $ b in mathbb {R} $ such that both $ (x, y) $ Y $ (w, z) $ they are elements of $ L_b $.
Essentially, write an equation in the variables $ x $, $ and $, $ w $Y $ z $ that is true if and only if $ (x, y) R (w, z) $. Why does this equation work?

cluster – Connection wait times when scaling above more than 1 instance of pod in Kubernetes

Execution of flanged Kubernetes on a local ESXI server with 3 virtual machines, a master and two nodes. On all nodes, I have Kubernetes 1.15.5, Ubuntu 18.04 and Docker 18.09.7. A green field facility.

Nginx works fine with a single pod on any of the nodes, but when scaled to two pods, random connection timeouts begin to occur after a long pause from the curl.

kubectl apply -f nginx.yaml

  deployment.apps/nginx configured
  service/nginx unchanged

cat nginx.yaml

  apiVersion: apps/v1beta2
  kind: Deployment
    name: nginx
        app: nginx
    replicas: 1
          app: nginx
        - name: nginx
          image: nginx:1
          - name: http
            containerPort: 80

  apiVersion: v1
  kind: Service
    name: nginx
    - name: http
      nodePort: 32000
      port: 80
      protocol: TCP
      targetPort: 80
      app: nginx
    type: NodePort

kubectl gets services, pods, implementations, daemon sets -o wide

  NAME                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE     SELECTOR
  service/kubernetes   ClusterIP               443/TCP        6d17h   
  service/nginx        NodePort           80:32000/TCP   45m     app=nginx

  NAME                         READY   STATUS    RESTARTS   AGE   IP          NODE          NOMINATED NODE   READINESS GATES
  pod/nginx-6d4fbdf4df-q7jdt   1/1     Running   0          45m   kubernetes3              

  deployment.extensions/nginx   1/1     1            1           45m   nginx        nginx:1   app=nginx

curl http: // kubernetes3: 32000 returns the nginx page

curl http: // kubernetes2: 32000 returns a connection timeout.

Expanding two two pods

kubectl scale – replicas = 2 nginx implementation

  deployment.extensions/nginx scaled

kubectl gets services, pods, implementations, daemon sets -o wide

  NAME                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE     SELECTOR
  service/kubernetes   ClusterIP               443/TCP        6d17h   
  service/nginx        NodePort           80:32000/TCP   48m     app=nginx

  NAME                         READY   STATUS    RESTARTS   AGE   IP          NODE          NOMINATED NODE   READINESS GATES
  pod/nginx-6d4fbdf4df-q7jdt   1/1     Running   0          48m   kubernetes3              
  pod/nginx-6d4fbdf4df-zg2n5   1/1     Running   0          42s   kubernetes2              

  deployment.extensions/nginx   2/2     2            2           48m   nginx        nginx:1   app=nginx

curl http: // kubernetes3: 32000 works half the time and curl http: // kubernetes2: 32000 works almost half the time. The other half, I have a connection timeout. If I execute the commands on node 3 or 2, I get the same. Telnet also gets random timeouts, although ports listen on all nodes and I have full connectivity between all nodes.

   url: (7) Failed to connect to kubernetes2 port 32000: Connection timed out

telnet -d kubernetes3 32000

Trying ...
setsockopt (SO_DEBUG): Permission denied

kubernetes3: ~ $ netstat -tulpn | grep 3200

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::32000                :::*                    LISTEN      -

Why do I get these wait times when I scale up to two or more instances?

Transgender youth are six times more likely to commit suicide than young cis. How can conservatives agree with this?

Researchers at the University of Pittsburgh analyzed data from an online survey of 2,020 youth ages 14 to 18 to explore suicide idealization rates and attempts at transgender teenagers.

But why can't they understand that VETS commit suicide is much older than anyone else? 20 veterinarians die by suicide a day. So let's do math

20×365 = 7,300 per year.

I think that regardless of whether you think you are trans or veterinarian, the problem is people like you.

Yes, we have a mental problem here. Start by stop being a stalker

python – Graph times for a range of MkII inputs

To celebrate the questions by earning more reputation points per positive vote, I thought about revisiting my previous question, Graphing times for a range of entries.

From the moment of the original question (more than two years!), This code has undergone many changes. I incorporated some of the advice given in the @ MaartenFabré response, but I also added multiprocessing To the mix to make the times in parallel, some flags of convenience were added and the minimum time recorded as a value was used, instead of the average.


from __future__ import print_function
from functools import partial
from itertools import product, count
import matplotlib.pyplot as plt
import multiprocessing
import numpy as np
import pandas as pd
import timeit
from uncertainties import ufloat, unumpy as unp

N_CPU = multiprocessing.cpu_count()
DEBUG = False

def get_time(func, *x):
    """Run a timer for `func` five times with the given input."""
    timer = timeit.Timer(partial(func, *x))
    t = timer.repeat(repeat=5, number=1)
    if DEBUG:
        print(func.__name__, np.min(t))
    return ufloat(np.min(t), np.std(t) / np.sqrt(len(t)))

def flatten_once(it):
    """For passing multiple arguments to functions, flatten each inner list."""
    for x in it:
        yield (x(0), *x(1))

def identity(x):
    """The identity function."""
    return x

def get_timings_df(funcs, inputs, key=identity, star=False, doc=False):
    """Use multiprocessing to time all `funcs` using the `inputs`.

       key:    Function that is called once on each input to determine the
               x-value. Default: identity
       star:   If the functions take multiple argument, and `inputs` contains
               tuples of arguments, splat them out. Default: False
       doc:    Use `func.__doc__` as plotting label instead of `func.__name__`.
               Default: False
    df = pd.DataFrame(list(map(key, inputs)), columns=("x"))
    labels = (func.__name__ for func in funcs)
    if doc:
        labels = (func.__doc__ for func in funcs)
    y = product(funcs, inputs)
    if star:
        y = flatten_once(y)
    with multiprocessing.Pool(processes=N_CPU-1) as pool:
        times = np.array(pool.starmap(get_time, y)).reshape(len(funcs), -1)
    for label, t in zip(labels, times):
        df(label) = t
    return df

def plot_times(funcs, inputs, key=identity, xlabel="x", ylabel="Time (s)", 
               logx=False, logy=False, star=False, ratio=False, doc=False):
    """Plot timings of `funcs` using `inputs`.

       key:    Function that is called once on each input to determine the
               x-value. Default: identity.
       xlabel: Label of x-axis. Default: 'x'.
       ylabel: Label of y-axis (may be overwritten for some flags). 
               Default: 'Time (s)'.
       logx:   Make x-axis logarithmic. Default: False.
       logy:   Make y-axis logarithmic. Default: False.   
       star:   If the functions take multiple argument, and `inputs` contains
               tuples of arguments, splat them out. Default: False
       ratio:  Plot timings relative to time of first function. Default: False.
       doc:    Use `func.__doc__` as plotting label instead of `func.__name__`.
               Default: False
    df = get_timings_df(funcs, inputs, key, star, doc)
    for label in df.columns(1:):
        x, y = df("x"), df(label)
        if ratio:
            y = y / df.T.iloc(1)
        plt.errorbar(x, unp.nominal_values(y), unp.std_devs(y),
                     fmt='o-', label=label)
    if ratio:
        ylabel = "{} / Time of {} (s)".format(ylabel, df.columns(1))
    if logx:
    if logy:

For now I want to maintain compatibility with Python 2, so unfortunately not f-strings. I'm also not a big fan of typography suggestions, and I don't think they help much here, but I'm willing to convince myself otherwise.

If you can find a way to simplify any of the functions (or get rid of them effectively), I'd love to hear it. The same is true to simplify the interface of plot_times. All other recommendations are welcome too.

Example Uses:

This function is quite flexible. It allows the normal use of timing a lot of single argument functions with a lot of inputs:

import time 
from timing import plot_times

def linear(x):

def quadratic(x):

if __name__ == "__main__":
    x = np.arange(0, 1, 0.1)
    plot_times((linear, quadratic), x, doc=True)

enter the description of the image here

To synchronize functions of multiple arguments and plot them in relation to the first function:

if __name__ == "__main__":
    x = np.arange(0.1, 1, 0.1)
    plot_times((linear, quadratic), x, doc=True, ratio=True)

enter the description of the image here

To use a different function to assign values ​​to the x-axis and the semi or log-log path:

import string
import random
import numpy as np
from timing import plot_times

def count_digits(x):
    return sum(c.isdigit() for c in x)

def count_digits2(x):
    return sum(1 for c in x if c.isdigit())

if __name__ == "__main__":
    alpha_num = string.ascii_letters + string.digits
    x = ("".join(random.choices(alpha_num, k=n))
         for n in np.logspace(1, 5, dtype=int))
    plot_times((count_digits, count_digits2), x, key=len, xlabel="len(s)",
               logx=True, logy=True)

enter the description of the image here

Post X times per domain

this works for ex. 10 successful shipments or p. 10 of any presentation (failed, etc.)?
Thank you!
more specifically, I am interested if with this setting set to once per domain I will not skip some domains because it already failed once in a different URL of this domain

document library: our hierarchy of terms cannot be created and reused, error "Terms cannot be shared multiple times in the same set of terms"

We want to build our terms store to represent how our folder structure is managed. Currently, our folder structure within the main document library has the following hierarchy:

1) HR Dept
  - General Document
     * External 
     * Internal
  - Policies
     * External
     * Internal
     * Private

2) IT
  - General Document
    * Outlook 
    * SharePoint
        * Admin
        * Development
    * Office 365
  - Policies
    * Private

Now I want to create our store of terms to represent the previous hierarchy, for example, when users load a document into the "IT >> General Document >> Outlook" folder, to select the term as follows, etc .: –

enter the description of the image here

In addition, when users want to know all documents that are "Private" (added under a folder called Private), they can do so by filtering the documents using the term "Private", which should obtain all documents that are Private under any Department.

But I face the following problem, I can't reuse the terms shared more than once within the same set of terms.
For example, I created a set of terms that represent the shared terms (I call it Template), as follows:

enter the description of the image here

But I cannot reuse the terms of the Template more than once, for example, as shown in the image above, if I want to reuse the terms called "Private" and "Public" under the terms "IT" and "Human Resources" , I will get this error: –
enter the description of the image here

So, can anyone advise on this subject? As I mentioned, I want to reuse the same term within different departments, so that users can filter documents according to the term, such as obtaining all documents that are private throughout the department. Now if I create 2 terms called "Private" and add them within 2 departments, then I will not be able to filter the documents under different departments using the same term.

Performance: Accelerate the Python program to calculate the shortest routes more than 100 times

This code enters a list of weighted edges, initial positive and negative feeling words and an objective word. The program calculates the sum of the weights along the shortest routes from the initial words to the objective and from the objective to the initial words, since it generates 9 output values.

The program is very slow. Running large border list files takes days, instead of minutes or seconds.

How can this program be accelerated?

from tkinter import Tk, X, Y, TOP, BOTTOM, LEFT, RIGHT, BOTH, END
from tkinter import filedialog, messagebox
from tkinter.ttk import Frame, Button, Entry, Label, Progressbar
import os, glob, time
import pandas as pd

root = Tk()

def read_edge_list(filename):
    edges = {}
    words = set()

    with open(filename) as fp:
        lines = fp.readlines()

        for line in lines:
            token = line.split()

            if len(token) != 3:

            word1 = token(0)
            word2 = token(1)
            freq = token(2)

            words = words | {word1, word2}

            if not word1 in edges.keys():
                edges(word1) = {}

            if not word2 in edges(word1):
                edges(word1)(word2) = {}

            edges(word1)(word2) = freq

    return edges, words

def read_sentiment(filename):
    with open(filename, encoding='utf-8-sig') as fp:
        lines = fp.readlines()

    words = {line.strip() for line in lines}

    return words

def read_target_word():
    word = input("Please input target word: ")
    return word

def run_shortest_path_algorithm(edges, positive, negative, target):
    positivedict = {}
    negativedict = {}

    for source in positive:
        dist1 = dijkstra(edges, source, target)
        dist2 = dijkstra(edges, target, source)
        if dist1 and dist2:
            positivedict(source) = dist1 + dist2

    for source in negative:
        dist1 = dijkstra(edges, source, target)
        dist2 = dijkstra(edges, target, source)
        if dist1 and dist2:
            negativedict(source) = dist1 + dist2

    return positivedict, negativedict

def calculate_statistics_summary(positivedict, negativedict, 
positivewords, negativewords):
    numpositive = len(positivedict)
    numnegative = len(negativedict)

    actualnumpositive = len(positivewords)
    actualnumnegative = len(negativewords)

    sumpositive = sum(positivedict.values())
    sumnegative = sum(negativedict.values())

    if actualnumpositive == 0:
        s1 = 0
        s1 = sumpositive / actualnumpositive

    if actualnumnegative == 0:
        s2 = 0
        s2 = sumnegative / actualnumnegative

    if numnegative == 0:
        s3 = 0
        s3 = s1 * numpositive / numnegative

    if s2 == 0:
        s4 = 0
        s4 = s3 / s2

    if numpositive == 0:
        s5 = 0
        s5 = sumpositive / numpositive

    if numnegative == 0:
        s6 = 0
        s6 = sumnegative / numnegative

    if numnegative == 0:
        s7 = 0
        s7 = s5 * numpositive / numnegative

    if s6 == 0:
        s8 = 0
        s8 = s7 / s6

    s9 = s3 - s2

    return (s1, s2, s3, s4, s5, s6, s7, s8, s9)

def write_output_file():

def dijkstra(graph, start, end):
    shortest_paths = {start: (None, 0)}
    current_node = start
    visited = set()

    while current_node != end:

        if current_node not in graph:
            destinations = ()
            destinations = graph(current_node).keys()

        weight_to_current_node = shortest_paths(current_node)(1)

        for next_node in destinations:
            weight = int(graph(current_node)(next_node)) + 
            if next_node not in shortest_paths:
                shortest_paths(next_node) = (current_node, weight)
                current_shortest_weight = shortest_paths(next_node)(1)
                if current_shortest_weight > weight:
                    shortest_paths(next_node) = (current_node, weight)

        next_destinations = {node: shortest_paths(node) for node in 
shortest_paths if node not in visited}
        if not next_destinations:
            return None

        current_node = min(next_destinations, key=lambda k: 

    #path = ()
    #while current_node is not None:
        #next_node = shortest_paths(current_node)(0)
        #current_node = next_node

    #path = path(::-1)
    #return path

    return shortest_paths(end)(1)

class SentimentWindow(Frame):
    def __init__(self):


        self.initPositiveDir = None
        self.initNegativeDir = None
        self.initSaveDir = None

        self.summary = pd.DataFrame(columns=('S1', 'S2', 'S3', 'S4', 
'S5', 'S6', 'S7', 'S8', 'S9'))

    def initUI(self):
        self.pack(fill=BOTH, expand=True, padx=15, pady=15)

        frmEdges = Frame(self)
        frmEdges.pack(fill=X, expand=True)

        lblEdges = Label(frmEdges, text="Select the directory of edge 
        lblEdges.pack(expand=True, fill=X, side=TOP, pady=2)

        frmEdgesPath = Frame(frmEdges)
        frmEdgesPath.pack(expand=True, fill=X, side=BOTTOM, pady=2)

        self.entEdgesPath = Entry(frmEdgesPath, width=60)
        self.entEdgesPath.pack(expand=True, fill=X, side=LEFT)

        btnEdgesPath = Button(frmEdgesPath, width=20, text="Load 
Edges", command=self.loadEdges)
        btnEdgesPath.pack(expand=True, side=RIGHT)

        frmPositive = Frame(self)
        frmPositive.pack(fill=X, expand=True)

        lblPositive = Label(frmPositive, text="Select the positive 
        lblPositive.pack(expand=True, fill=X, side=TOP, pady=2)

        frmPositivePath = Frame(frmPositive)
        frmPositivePath.pack(expand=True, fill=X, side=BOTTOM, pady=2)

        self.entPositivePath = Entry(frmPositivePath, width=60)
        self.entPositivePath.pack(expand=True, fill=X, side=LEFT)

        btnPositivePath = Button(frmPositivePath, width=20, text="Load 
Positive", command=self.loadPositive)
        btnPositivePath.pack(expand=True, side=RIGHT)

        frmNegative = Frame(self)
        frmNegative.pack(fill=X, expand=True)

        lblNegative = Label(frmNegative, text="Select the negative 
        lblNegative.pack(expand=True, fill=X, side=TOP, pady=2)

        frmNegativePath = Frame(frmNegative)
        frmNegativePath.pack(expand=True, fill=X, side=BOTTOM, pady=2)

        self.entNegativePath = Entry(frmNegativePath, width=60)
        self.entNegativePath.pack(expand=True, fill=X, side=LEFT)

        btnNegativePath = Button(frmNegativePath, width=20, text="Load 
Negative", command=self.loadNegative)
        btnNegativePath.pack(expand=True, side=RIGHT)

        frmTarget = Frame(self)
        frmTarget.pack(fill=X, expand=True)

        lblTarget = Label(frmTarget, text="Input the target word.")
        lblTarget.pack(expand=True, fill=X, side=TOP, pady=2)

        self.entTarget = Entry(frmTarget)
        self.entTarget.pack(fill=X, expand=True, pady=2)

        frmRun = Frame(self)
        frmRun.pack(fill=X, expand=True, pady=20)

        self.proRun = Progressbar(frmRun, value=0)
        self.proRun.pack(fill=X, expand=True, side=LEFT)

        btnRun = Button(frmRun, text = "Run", width=20,
        btnRun.pack(side=RIGHT, padx=20)

    def loadEdges(self):
        edgesFolderName = filedialog.askdirectory()

        if edgesFolderName:
            self.entEdgesPath.delete(0, END)
            self.entEdgesPath.insert(0, edgesFolderName)

    def loadPositive(self):
        if self.initPositiveDir is None:
            self.initPositiveDir = "/"

        positiveFileName = 
title="Open Positive File", filetypes=(("Text file", "*.txt"),))

        if positiveFileName:
            self.initPositiveDir = positiveFileName
            self.entPositivePath.delete(0, END)
            self.entPositivePath.insert(0, positiveFileName)

    def loadNegative(self):
        if self.initNegativeDir is None:
            self.initNegativeDir = "/"

        negativeFileName = 
title="Open Positive File", filetypes=(("Text file", "*.txt"),))

        if negativeFileName:
            self.initNegativeDir = negativeFileName
            self.entNegativePath.delete(0, END)
            self.entNegativePath.insert(0, negativeFileName)

    def run(self):
        edgesFolderName = self.entEdgesPath.get()
        if not os.path.isdir(edgesFolderName):
            messagebox.showerror("Invalid Path", "The directory of 
edge list is invalid.")

        positiveFileName = self.entPositivePath.get()
        if not os.path.isfile(positiveFileName):
            messagebox.showerror("Invalid Path", "The positive 
filename is invalid.")

        negativeFileName = self.entNegativePath.get()
        if not os.path.isfile(negativeFileName):
            messagebox.showerror("Invalid Path", "The negative 
filename is invalid.")

        targetWord = self.entTarget.get()
        if targetWord is None or len(targetWord) <= 0:
            messagebox.showerror("No Target", "Please input the target 

        edgefiles = glob.glob("*.pr")

        if len(edgefiles) <= 0:
            messagebox.showerror("No Edge File", "Cannot find the edge 

        positivewords = read_sentiment(positiveFileName)

        negativewords = read_sentiment(negativeFileName)

        self.summary.drop(self.summary.index, inplace=True)
        self.proRun("value") = 0.0

        for index, edgefile in enumerate(edgefiles):
            edges, words = read_edge_list(edgefile)

            if targetWord not in words:
                messagebox.showerror("Invalid Target", "Target does 
not exist in " + edgefile)
                possiblepositive = positivewords & words
                possiblenegative = negativewords & words

                positivedict, negativedict = 
possiblepositive, possiblenegative, targetWord)

                statistics_summary = 
calculate_statistics_summary(positivedict, negativedict, 
positivewords, negativewords)
                self.summary.loc(edgefile) = statistics_summary
            self.proRun("value") = 100 * (index + 1) / len(edgefiles)


        if self.summary.shape(0) > 0:
            self.summary.loc('mean') = self.summary.mean()
            self.summary.loc('std') = self.summary.std()

            if self.initSaveDir is None:
                self.initSaveDir = "/"

            outputFile = 
filedialog.asksaveasfilename(initialdir=self.initSaveDir, title="Save 
Summary File", filetypes=(("Text file", "*.txt"),))
            self.initSaveDir = outputFile

            if outputFile:
                with open(outputFile, 'w') as outfp:

app = SentimentWindow()

Here are small border lists:

Here is a large file that will run for days!

Here is the negative seed file:

The positive seed file:

Set the target word to: bp.

Here is the code in a file:

Counter example for $ (A times B) cup (C times D) subset (A cup C) times (B cup D) $

For sets A, B, D, C:

$ (A times B) cup (C times D) subset (A cup C) times (B cup D) $

Try to give a counterexample where this statement is not true. I know that an empty set could be a valid counterexample. But how exactly?

How can I find a closed form of the following integral equation $ int xe ^ {A / B times x ^ {a}} (1-e ^ {A / B times | Mx | ^ {a}}) dx $

I want to find the closed form of the following equation.

$ int x e ^ {A / B times x ^ a} (1-e ^ {A / B times | M-x | a}} dx $

$ A, B, a, $ Y $ M $ they are only variables

I executed this equation in wolfram alpha, but it could not be solved.

If it can't be resolved, why?

7 – The "Drupal is initializing" rule is triggered several times

I am using the Rules module and the "Drupal is initializing" event in a rule to verify if a user has clicked on their confirmation link in their email that Drupal has sent them to verify their account. This rule is called with each page loaded several times.

Should this be?
And is there a way to achieve this without the need to trigger this rule?