text stringlengths 1 1.11k | source dict |
|---|---|
dynamic-programming, tiling
So we have
$\quad\quad W_2[m] = W_1[m - 1] + W_2[m - 3]. $
Using the above three recurrence equations, now we can compute all $W_0[i],W_1[i],W_2[i]$, in order of increasing $i$, starting from $i=3$, given the following initial conditions,
$$ \begin{aligned}
W_0[0] &= W_0[1] = W_0[2] = 1,\\
W_1[0] &= W_1[1] = 0\quad \text{ and }\quad W_1[2] = 1,\\
W_2[0] &= W_2[1] = W_2[2] = 0.
\end{aligned}$$
Here are the first 20 values for $W_0(\cdot)$.
m: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
W_0: 1 1 2 3 4 8 13 19 35 58 89 154 256 405 681 1131 1822 3025 5012 8156
The above approach is fast enough for both the problem at codechef and the same problem at codingame. | {
"domain": "cs.stackexchange",
"id": 15822,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dynamic-programming, tiling",
"url": null
} |
c, linux, windows, networking, framework
Conn* conn_make(void) {
for (int i = 0; i < CONNMAX; ++i) {
if (0 == conns[i].typ) {
return &conns[i]; // found a free entry
}
}
assert(0 && "conn array full");
return NULL;
}
void client_open(Conn* obj, const char* hostname, const char* port) {
assert(obj >= &conns[0] && obj < &conns[CONNMAX]);
assert(port != NULL);
assert(hostname != NULL);
printf("II %s: port=%s hostname=%s\n", FUNCTION, port, hostname);
FD_ZERO(&obj->fds);
obj->typ = CONN_CLIENT;
strcpy_s(obj->port, sizeof obj->port, port);
strcpy_s(obj->hostname, sizeof obj->hostname, hostname);
void client_open1(Conn* obj);
client_open1(obj);
}
void client_open1(Conn* obj) {
assert(obj >= &conns[0] && obj < &conns[CONNMAX]);
struct addrinfo hints;
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; | {
"domain": "codereview.stackexchange",
"id": 43458,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, linux, windows, networking, framework",
"url": null
} |
ros, ros-melodic, installation
The following NEW packages will be installed:
docutils-common libfreetype6 libjbig0 libjpeg-turbo8 libjpeg8 liblcms2-2 libpaper-utils libpaper1
libpng16-16 libtiff5 libwebp6 libwebpdemux2 libwebpmux3 multiarch-support python3-catkin-pkg-modules
python3-dateutil python3-docutils python3-olefile python3-pil python3-pkg-resources python3-pygments
python3-pyparsing python3-roman python3-six sgml-base tzdata ucf xml-core
0 upgraded, 28 newly installed, 0 to remove and 16 not upgraded.
Need to get 41.8 kB/3179 kB of archives.
After this operation, 15.7 MB of additional disk space will be used.
Get:1 http://packages.ros.org/ros/ubuntu bionic/main amd64 python3-catkin-pkg-modules all 0.4.18-1 [41.8 kB]
Fetched 41.8 kB in 6s (7383 B/s) | {
"domain": "robotics.stackexchange",
"id": 34973,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-melodic, installation",
"url": null
} |
python, pathfinding, dijkstra
The core of the algorithm stays logically the same: We adjust some names to be more speaking (e.g. u -> node, v -> neighbour). We use the prepared neighbours instead of the lengthy expression.
def dijkstra_search(graph, distances, prev_nodes, unvisited):
while unvisited:
node = dijkstra_get_min(unvisited, dist)
unvisited.remove(node)
for neighbour in neighbours(node):
if neighbour not in unvisited:
continue
alt = distances[node[0]][node[1]] + graph[neighbour[0]][neighbour[1]]
if alt < distances[neighbour[0]][neighbour[1]]:
distances[neighbour[0]][neighbour[1]] = alt
prev_nodes[neighbour[0]][neighbour[1]] = node | {
"domain": "codereview.stackexchange",
"id": 39286,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, pathfinding, dijkstra",
"url": null
} |
python, image, iteration, signal-processing
for i in range(len(data)):
for j in range(len(data[0])):
temp = []
# ... | {
"domain": "codereview.stackexchange",
"id": 30163,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, image, iteration, signal-processing",
"url": null
} |
performance, r, rcpp
Example call:
# Simple case
x <- pnorm(rnorm(100))
joe_density(x, tau = 2)
# Longer performance time when looping, d=2
expand.grid(x = seq(-5,5,by=0.1), y = seq(-5,5,by=0.1)) %>%
apply(.,1,function(z){
x <- pnorm(z)
joe_density(x, tau = 2)
}) | {
"domain": "codereview.stackexchange",
"id": 37849,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, r, rcpp",
"url": null
} |
We have the form $$\frac{9}{(x-1)(x+2)^2}=\frac{A}{(x-1)}+\frac{B}{(x+2)}+\frac{C}{(x+2)^2}\qquad\qquad(\ast)$$ and the only problem is how to find the constants $A$, $B$, $C$.
Here's the quick way. First multiply both sides of $(\ast)$ by $(x+2)^2$ and then let $x=-2$. The instant result is that $C=-3$ (don't take my word for it, try it for yourself!). Next multiply $(\ast)$ through by $x-1$ and let $x=1$. The instant result is that $A=1$. The hard one to find is $B$, so let's do that one by cheating. Since we know that $(\ast)$ is an identity, i.e., is true for all values of $x$, let's choose an easy value of $x$, say $x=0$, and substitute that value of $x$ into $(\ast)$. Since we know $A$ and $C$, we find at once that $B=-1$.
-
A simple way is
$$A=f(x)(x-1)\bigg|_{x=1}=1$$ $$C=f(x)(x+2)^2\bigg|_{x=-2}=-3$$ $$0=\lim_{x\to\infty}xf(x)=A+B\Rightarrow B=-A=-1$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464464059648,
"lm_q1q2_score": 0.81953537971893,
"lm_q2_score": 0.8397339656668287,
"openwebmath_perplexity": 421.67084735796277,
"openwebmath_score": 0.9508964419364929,
"tags": null,
"url": "http://math.stackexchange.com/questions/729350/find-constants-of-function"
} |
beginner, haskell, interpreter, brainfuck
Also note that I changed next argument. It's a lot harder to use a Int wrong compared to a Int -> Int. While we're at it, let's reorder some parts and get ri of the ' after xs:
splitOnLoopEnd :: String -> (String, String)
splitOnLoopEnd = go 0
where
go _ "" = error "No matching ] found"
go 0 (']':xs) = ([], xs)
go n (x:xs) = let (ys, zs) = go (n + l) xs in (x:ys, zs)
where
l = case x of
']' -> (-1)
'[' -> 1
_ -> 0 | {
"domain": "codereview.stackexchange",
"id": 30084,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, haskell, interpreter, brainfuck",
"url": null
} |
slide on the surface. Rolling contains rotational motion and translational motion(straight line motion) Suppose a car is moving and suddenly applies brakes and it starts sort of skidding. If the ball starts at an initial height h above the bottom of the loop, what is the minimum value for h such that the ball just completes the loop-the-loop?. A rod of mass is attached to a spring of stiffness. no slipping) vR cm 2 2 2 2 11 22 cm 2 m I R v h v R m. The wheel will slide forward without turning. Physics 111 Lecture 21 (Walker: 10. Let represent the downward displacement of the center of mass of the cylinder parallel to the surface of the plane, and let represent the angle of rotation of the cylinder about its symmetry axis. What is the minimum value µ 0 of the coefficient of static friction between ball and incline so that the ball will roll down the incline without slipping? Solution by Michael A. naturally it accelerates downward. If the object rolls without slipping, determine if it | {
"domain": "fian-intern.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357237856482,
"lm_q1q2_score": 0.8597913633963247,
"lm_q2_score": 0.8757869786798663,
"openwebmath_perplexity": 406.11801210474823,
"openwebmath_score": 0.5616315007209778,
"tags": null,
"url": "http://csvh.fian-intern.de/rolling-motion-without-slipping.html"
} |
special-relativity, spacetime, reference-frames, coordinate-systems, observers
Another way to think about it is like this; suppose you print out frames of a movie and stack them in order, like you'd stack plates, to form a block (or a flip-book) that contains the entire movie. If you slice it somewhere in the middle, you'll get a particular frame. But if you slice it at an angle, you'll get a new image composed of strips of different frames. The Lorentz transformation is not exactly like that, there are some details that differ, but the simultaneity aspect is similar.
First of all I don't understand what it means that "the moment in the middle of my quarter of an hour can be considered simultaneus to your answer". | {
"domain": "physics.stackexchange",
"id": 82156,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, spacetime, reference-frames, coordinate-systems, observers",
"url": null
} |
php, mysql, pdo
//$Conf is secundary conection data
public function InsertData($Query, $Conf = '') {
try {
$DB_R = [];
$DB = [];
$val = [];
$prefix = '';
$cT = 0;
if (USEPREFIX == True) {
$prefix = DB_PRE;
}
$conn = new PDO("mysql:host=" . DB_HOST . ";dbname=" . $prefix . "" . DBSYS . "", DB_USER, DB_PASS);
if (isset($Conf['CONF']['ChangeServ'])) {
if ($Conf['CONF']['ChangeServ'] == true) {
$conn = new PDO("mysql:host=" . $Conf['CONF']['DB_HOST'] . ";dbname=" . $Conf['CONF']['PREFIX2USE'] . "" . $Conf['CONF']['DB2USE'] . "", $Query['CONF']['DB_USER'], $Query['CONF']['DB_PASS']);
}
}
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->beginTransaction();
$conn->exec("set names utf8");
foreach ($Query as $DB_2USE => $QArr) { | {
"domain": "codereview.stackexchange",
"id": 34564,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, mysql, pdo",
"url": null
} |
Solution to the Model
As mentioned above:
$$\hat{x} = \arg \min_{x} \frac{1}{2} {\left\| x - y \right\|}_{2}^{2} + \frac{\lambda}{2} {\left\| F x - z \right\|}_{2}^{2}$$
This is a strictly convex problem hence the solution is given in the stationary point.
\begin{align*} \frac{\mathrm{d}}{\mathrm{d} \hat{x}} \frac{1}{2} {\left\| \hat{x} - y \right\|}_{2}^{2} + \frac{\lambda}{2} {\left\| F \hat{x} - z \right\|}_{2}^{2} & = 0 && \text{Definition of Stationary Point} \\ & = \hat{x} - y + \lambda {F}^{T} \left( F x - z \right) && \text{} \\ & \Leftrightarrow \left( I + \lambda {F}^{T} F \right) = y + \lambda {F}^{T} z && \text{} \\ & \Leftrightarrow \hat{x} = {\left( I + \lambda {F}^{T} F \right)}^{-1} \left( y + \lambda {F}^{T} z \right) \end{align*}
MATLAB Simulation
The model I chose is using an harmonic signal - sine.
We use Finite Differences as the Derivative Model.
Here are the signals and the estimation using $$\lambda = \frac{ {\sigma}_{v}^{2} }{ {\sigma}_{w}^{2} }$$: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9702399060540358,
"lm_q1q2_score": 0.8021087775552969,
"lm_q2_score": 0.8267117983401363,
"openwebmath_perplexity": 425.0780106666595,
"openwebmath_score": 0.9796276688575745,
"tags": null,
"url": "https://dsp.stackexchange.com/questions/52150/estimating-a-signal-given-a-noisy-measurement-of-the-signal-and-its-derivative/56876"
} |
homework-and-exercises, newtonian-mechanics, work
Title: Work Done by Running Up Stairs This problem is from "the Physics Classroom": During the Powerhouse lab, Jerome runs up the stairs, elevating his 102 kg body a vertical distance of 2.29 meters in a time of 1.32 seconds at a constant speed.
a. Determine the work done by Jerome in climbing the stair case. | {
"domain": "physics.stackexchange",
"id": 58667,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, work",
"url": null
} |
reaction-mechanism, kinetics
To generalize, for a general chemical reaction that comprises $m$ species, we always have
$$ \boxed{\sum_{j = 1}^m \nu_j M_{j} = 0} \tag{7} $$
So, if you solve a system that has at time $t$ an amount of moles of $x_1(t)$, $x_2(t)$, ..., $x_m(t)$, then $M_1x_1(t) + M_2x_2(t) + \dots + M_m x_m(t)$ is constant. It is a good check to see if the code is satisfying the mass balance by calculating this quantity and viewing that it does not deviate, apart from the absolute/relative errors that you specify. | {
"domain": "chemistry.stackexchange",
"id": 17434,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reaction-mechanism, kinetics",
"url": null
} |
thermodynamics, carnot-cycle
The cycle operates from point 1 to 2 to 3 to 4 to 5 to 6 back again to 1.
It differs from the Carnot cycle in the following:
Carnot cycle starts from 1 to 2 to 3 to 4 then it takes the adiabatic path from point 4 to 1. On the other hand, the cycle I described, starts from 1 to 2 to 3 then it isothermally compresses the fluid until it has the same volume it had at the original configuration(at point 5); where $V_1=V_5$. Then it adiabatically expands to point 6 and isothermally contracts to point 1.
The reason/intuition that drives me to say those two cycles are equivalent(which may turn out to be wrong):
1)This cycle utilizes heat to the greatest efficiency; since every single change in temperature was accompanied by change of volume; that is there's no change of temperature owing to heat exchange between two bodies in contact; since this condition is satisfied therefore this cycle achieves maximum work. | {
"domain": "physics.stackexchange",
"id": 25400,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, carnot-cycle",
"url": null
} |
performance, ruby, ruby-on-rails, postgresql
I've looked into the activerecord-import gem but unfortunately it seems to be more geared towards creation of records in bulk and not update as we require.
Any suggestions on how this code can be improved? How would you go about improving this based on your experience?
Many many thanks in advance.
UPDATE:
The database is performing quite well as it should, 500 orders with 10-15 associated objects each is about 5500-8000 queries. This is completed in about a minute, so it's handling roughly 100 queries per seconds.. robust enough. Just hoping there is a way that we can reduce the amount of queries needed to accomplish the creation/update of all that data. You can reduce the amount of queries by putting it into a transaction:
ActiveRecord::Base.transaction do
...
end | {
"domain": "codereview.stackexchange",
"id": 4631,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, ruby, ruby-on-rails, postgresql",
"url": null
} |
solid-state-physics, simulations, biology
What if for instance I wanted to start from the bottom up, creating simulations at the planck scale, particles, atomic structures, cells, microbiology, etc.? | {
"domain": "physics.stackexchange",
"id": 20599,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "solid-state-physics, simulations, biology",
"url": null
} |
# Sequences as Functions
We can represent a sequence in a variety of ways such as on a number line. For example, consider the sequence in example 1 plotted on a number line:
Alternatively, we could represent the sequence as a function whose domain $A := \{ n : n \in \mathbb{N} \}$. For example, the following graph illustrates example 1: | {
"domain": "wikidot.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9954615684098466,
"lm_q1q2_score": 0.8229598170234675,
"lm_q2_score": 0.826711791935942,
"openwebmath_perplexity": 116.73250075630914,
"openwebmath_score": 0.972690224647522,
"tags": null,
"url": "http://mathonline.wikidot.com/sequences"
} |
gt.game-theory, mechanism-design
Considering the case where everyone values each item the same amount, we see that no mechanism can possibly do better than $(\varepsilon,\varepsilon)$-envy-freeness here. (For any $\varepsilon$ -- Because only $\varepsilon n$ agents will get one of their $\varepsilon n$ favorite items.)
On the other hand, it is easy to see that your mechanism, if we order the players uniformly at random, is $(\varepsilon,\varepsilon)$-envy-free for all $\varepsilon$.[3]
I don't pretend that this captures nearly all the interesting questions about this setting or the white elephant mechanism. For example, the $(\varepsilon,\varepsilon)$-envy-free strategy for the second player is to take the first player's gift unless it is the worst of all the gifts. However, I think that this shows that our worst-case solution concepts simply don't capture a lot of what's interesting about these scenarios, so we should maybe think about something else like utility maximization instead.
-- | {
"domain": "cstheory.stackexchange",
"id": 4834,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gt.game-theory, mechanism-design",
"url": null
} |
general-relativity, spacetime, spacetime-dimensions
Title: About space-time and its four dimensions I explained to someone I know about General Relativity (as much as I know).
He said that he didn't see how it could be correct.
He argued:
How is 4-dimensional space-time space different to 3-dimensional space? he doesn't agree that as that because the 4-dimensional space-time is only different to 3-dimensions because of the added time dimension. he doesn't think that the added dimension of time would change the space of the system (so 3-dimensional space therefore wouldn't be different to 4-dimensional) because they both still have 3 spacial dimensions, just space-time has an added dimension of time.
I said there will be an explanation to how an added dimension of time would change the spacial structure. is there? Mark's answer is good.
Let me just try to put it in what might be simpler terms. | {
"domain": "physics.stackexchange",
"id": 3450,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, spacetime, spacetime-dimensions",
"url": null
} |
gazebo
Originally posted by Peter Mitrano with karma: 768 on 2016-10-21
This answer was ACCEPTED on the original site
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 4003,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo",
"url": null
} |
performance, haskell, image
Title: PPM/PGM Image processing library in Haskell I've written a small library for reading and writing PGM/PPM images. The format is described here. I attach the library itself and a small utility to convert binary encoded images to ASCII encoding. Any type of comment will be appriciated. However, these points are most important to me: | {
"domain": "codereview.stackexchange",
"id": 5869,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, haskell, image",
"url": null
} |
electromagnetism, magnetic-fields
For the torus with radial $\vec{M}$ what is its magnetic field. Will it end up having no magnetic field (thus becoming some kind of anapole) due to how the south pole end is a ring buried inside the core of the torus? You can't use magnetization to produce electromagnetic fields that can't also be produced by an arrangement of charges and currents, because magnetization is made, microscopically, from charges and currents. So you haven't made a magnetic monopole. Let's try to figure out what, exactly, you have made; it's interesting.
I think that you can't have have $\vec M = a\hat r$ at the center of the disks, where the direction of $\hat r$ is not defined. So each of your disks is a torus of its own. You could produce such a field by rotating a disk-shaped, charged capacitor about its axis: adjacent, parallel sheets of charge, rotating to produce opposing currents. | {
"domain": "physics.stackexchange",
"id": 35236,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, magnetic-fields",
"url": null
} |
machine-learning, neural-network, convolutional-neural-network, backpropagation
Right. Plus also the gradient of any other neurons on that convolution layer which take as input the topmost rightmost neuron of the pooling layer.
How about the filled green one? I need to multiply together the first column of neurons in the next layer because of the chain rule? Or do I need to add them?
Add them. Because of the chain rule.
Max Pooling
Up to the this point, the fact that it was max pool was totally irrelevant as you can see. Max pooling is just the that the activation function on that layer is $max$. So this means that the gradients for the previous layers $grad(PR_j)$ are:
$grad(PR_j) = \sum_i grad(P_i) f^\prime W_{ij}$.
But now $f = id$ for the max neuron and $f = 0$ for all other neurons, so $f^\prime = 1$ for the max neuron in the previous layer and $f^\prime = 0$ for all other neurons. So:
$grad(PR_{max neuron}) = \sum_i grad(P_i) W_{i\ {max\ neuron}}$,
$grad(PR_{others}) = 0.$ | {
"domain": "datascience.stackexchange",
"id": 1133,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, neural-network, convolutional-neural-network, backpropagation",
"url": null
} |
• "I'm still not entirely sure why ∅∈{a,b,c} ". Well, what are the elements of {a,b,c}? They are a,b,c. Are any of a,b,c the same thing as the empty set? No, none of them are. So the emptyset is not an element of {a,b,c}. NOTHING should be seen as an element unless it actually is an element. Notice $\emptyset \in \{fred, george, \emptyset\}$ because the emptyset is in the set. And $\emptyset \not \in \{fred, george\}$ because the empty set is not in that set. It really is that simple. – fleablood Mar 5 '18 at 20:47
• I understand now why the empty set cannot be a member of {a,b,c}. hHowever, is that fact that the empty set can be included in the set {a,b,c} because every set includes the subset ∅? I.e., ∅⊆{a,b,c} (True) – smiles47 Mar 5 '18 at 20:57 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9407897525789548,
"lm_q1q2_score": 0.8139939505730096,
"lm_q2_score": 0.8652240825770432,
"openwebmath_perplexity": 162.68567632835487,
"openwebmath_score": 0.7191120386123657,
"tags": null,
"url": "https://math.stackexchange.com/questions/2678265/difference-between-membership-and-inclusion/2678293"
} |
relative to the statistical measure describes. Is handy to compare the data set faithful in faithful kurtosis lesson series ‘ peakedness ’ of distribution... That we define the excess kurtosis of eruption waiting period in faithful the R. That we define the excess kurtosis of 0 period in faithful biased kurtosis of eruption waiting period in.. Function kurtosis from the e1071 package to compute the excess kurtosis of eruptions moment '' ! | {
"domain": "motorsports-network.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854120593483,
"lm_q1q2_score": 0.8183971654768525,
"lm_q2_score": 0.8438951084436077,
"openwebmath_perplexity": 1644.9422937220443,
"openwebmath_score": 0.8001015186309814,
"tags": null,
"url": "http://motorsports-network.com/sipp-for-cqsaw/kurtosis-r-tutorial-343f19"
} |
image-processing, python, denoising, deconvolution, wiener-filter
You may try the 2D Median filter which is a classic solution for the Salt and Pepper noise model. You may also use the Bilateral Filter with some tweaking for this kind of noise.
Basically, any Edge Preserving Filter will do much better preserving the details while suppressing noise. | {
"domain": "dsp.stackexchange",
"id": 11155,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "image-processing, python, denoising, deconvolution, wiener-filter",
"url": null
} |
homework-and-exercises, newtonian-mechanics, string
Title: Reaction Force on String Wrapped Around Circular Peg
A massless inextensible string is wrapped around a frictionless circular peg. The string is taut, with tension $T_2$ and $T_1$ at the points where it leaves of the pg as shown. The segment wrapped around the peg exerts a continuum of contact forces on the peg, perpendicular to the tangent to the surface of the peg at each point. As a result the peg exerts a net reaction force $R$ on the segment which is the sum of this continuum of contact forces (with directions reversed).
The section of string wrapped around the peg is in mechanical equilibrium. WITHOUT assuming $T_1 = T_2$ (I am attempting to deduce that based on the direction of $R$), how can I deduce that $R$ must be perpendicular to the surface of the peg where the centre of mass of the segment wrapped around it is? | {
"domain": "physics.stackexchange",
"id": 23650,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, string",
"url": null
} |
algorithms, machine-learning
$$
\begin{align*}
Q(\theta^t|\theta^{t-1}) &= \E\left[\sum_{i=1}^n \sum_{j=1}^k \I[z_i = j] \log \Pr[x_i, z_i = j| \theta]\right]\\
&= \sum_{i=1}^n \sum_{j=1}^k \E[\I[z_i = j]] \log \Pr[x_i, z_i = j| \theta]\\
&= \sum_{i=1}^n \sum_{j=1}^k \Pr[z_i = j | x_i] \log \Pr[x_i, z_i = j| \theta]\\
&= \sum_{i=1}^n \sum_{j=1}^k \underbrace{\Pr[z_i = j | x_i]}_{r_{ij}} \log (\Pr[x_i|\theta_j]\underbrace{\Pr[z_i = j| \theta]}_{\pi_j}).\\
&= \sum_{i=1}^n \sum_{j=1}^k r_{ij} \log \Pr[x_i|\theta_j] + \sum_{i=1}^n \sum_{j=1}^k r_{ij} \log \pi_j.
\end{align*}
$$
Computing $r_{ij}$ for the E-step is done by simple Bayes theorem,
$$ r_{ij} = \frac{\pi_j \Pr[x_i|\theta_j^{t-1}]}{\sum_{j'=1}^k \pi_{j'} \Pr[x_i|\theta_{j'}^{t-1}]}.$$ | {
"domain": "cs.stackexchange",
"id": 2682,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, machine-learning",
"url": null
} |
More generally, we would like to know the number of solutions where the right-hand side is $$r$$ for an arbitrary non-negative integer $$r$$. The generating function for the number of solutions is \begin{align} f(x) &= (x+x^2+x^3+x^4+x^5+x^6)^{10} \\ &= x^{10} (1+x+x^2+x^3+x^4+x^5)^{10} \\ &= x^{10} \left( \frac{1-x^6}{1-x} \right)^{10} \tag{2}\\ &= x^{10} (1-x^6)^{10} (1-x)^{-10} \\ &= x^{10} \cdot \sum_{i=0}^{10}(-1)^i \binom{10}{i} x^{6i} \cdot \sum_{j=0}^{\infty} \binom{10+j-1}{j} x^j \tag{3} \end{align} At $$(2)$$ we applied the formula for the sum of a geometric series, and at $$(3)$$ we applied the Binomial Theorem twice, once for a negative exponent. The coefficient of $$x^r$$ when $$f(x)$$ is expanded is the number of solutions to $$(1)$$ with right-hand side $$r$$.
We are especially interested in the coefficient of of $$x^{30}$$, which we can see from $$(3)$$ is $$[x^{30}]f(x) = \sum_{i=0}^3 (-1)^i \binom{10}{i} \binom{10+20-1-6i}{20-6i} = 2,930,455$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.978712651931994,
"lm_q1q2_score": 0.8046869021907093,
"lm_q2_score": 0.8221891283434876,
"openwebmath_perplexity": 165.19047973714018,
"openwebmath_score": 0.9885644316673279,
"tags": null,
"url": "https://math.stackexchange.com/questions/3174028/find-the-probability-of-rolling-ten-different-standard-6-sided-dice-simultaneou"
} |
-
Is the downvote because of self-answering? – Jayesh Badwaik Feb 1 '13 at 18:08
Probably. Why did you post a question to which you already knew the answer? – Todd Wilcox Feb 1 '13 at 18:09
A few reasons 1. It gives me oppurtunity to verify that the solution is indeed correct. (I self study, so even though I get an answer and I am pretty sure about it, there is no real way to verify the solution completely.) 2. It allows probably other people to offer me better solutions. 3. I can do so on a blog, but then it might not get the same attention on the blog. 4. MSE's editing capabilities are better than almost all other blogging software I have found. – Jayesh Badwaik Feb 1 '13 at 18:10 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.976310532836284,
"lm_q1q2_score": 0.8114537160012286,
"lm_q2_score": 0.8311430520409023,
"openwebmath_perplexity": 887.3516527194131,
"openwebmath_score": 0.9990360736846924,
"tags": null,
"url": "http://math.stackexchange.com/questions/292251/limit-of-s-n-int-limits-01-fracnxn-11x-dx-as-n-to-infty?answertab=active"
} |
python, numpy, neural-network
if __name__ == '__main__':
nn = NeuralNetwork([2,2,1])
X = np.array([[0, 0],
[0, 1],
[1, 0],
[1, 1]])
y = np.array([0, 1, 1, 0])
nn.fit(X, y)
for e in X:
print(e,nn.predict(e))
While this converges well and fast when using the tanh, it does converge much slower when using the sigmoid ( in def __init__(self, layers, activation='tanh') change tanh to sigmoid ).
I cannot find why that is. How do I improve the implementation for the sigmoid? The reasons for the speed discrepancy | {
"domain": "codereview.stackexchange",
"id": 20241,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, numpy, neural-network",
"url": null
} |
nlp, stanford-nlp
$J(\theta) = \displaystyle-\dfrac{1}{T} {\sum_{t=1}^{T} \sum_{-m <= j <=m, \\j\ne0} log(\lambda(w_t,w_{t+j})p(w_{t+j}|w_t))}.$
In the case where $\lambda(x,y) = 1$, we get the formula above, but we could also be free to chose a function that boosts frequent occurrences (pairwise). The formula above could then be seen as a special case when you don't care that words that occur more often together get a boost.
On the other hand, when the formula above already accounts for multiple occurrences, then where is this visible? | {
"domain": "datascience.stackexchange",
"id": 3813,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nlp, stanford-nlp",
"url": null
} |
statistical-mechanics, partition-function
Now, suppose that the system consists of a pair of subsystems $1$ and $2$, then the Hilbert space of the combined system can be written as a tensor product of the Hilbert spaces for the individual subsystems;
\begin{align}
\mathcal H = \mathcal H_1\otimes \mathcal H_2.
\end{align}
Let $H_1$ denote the hamiltonian for subsystem $1$, and let $H_2$ denote the hamiltonian for subsystem $2$. Let $\{|1, s_1\rangle\}$ be an orthonormal basis for $\mathcal H_1$ consisting of eigenvectors of $H_1$, and let $\{|2, s_2\rangle\}$ be an orthonormal basis for $\mathcal H_2$ consisting of eigenvectors of $H_2$, then we have the following basic fact; | {
"domain": "physics.stackexchange",
"id": 13970,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statistical-mechanics, partition-function",
"url": null
} |
# 1983 AIME Problems/Problem 13
## Problem
For $\{1, 2, 3, \ldots, n\}$ and each of its non-empty subsets, an alternating sum is defined as follows. Arrange the number in the subset in decreasing order and then, beginning with the largest, alternately add and subtract succesive numbers. For example, the alternating sum for $\{1, 2, 4, 6,9\}$ is $9-6+4-2+1=6$ and for $\{5\}$ it is simply $5$. Find the sum of all such alternating sums for $n=7$.
## Solution 1
Let $S$ be a non- empty subset of $\{1,2,3,4,5,6\}$.
Then the alternating sum of $S$ plus the alternating sum of $S$ with 7 included is 7. In mathematical terms, $S+ (S\cup 7)=7$. This is true because when we take an alternating sum, each term of $S$ has the opposite sign of each corresponding term of $S\cup 7$.
Because there are $63$ of these pairs, the sum of all possible subsets of our given set is $63*7$. However, we forgot to include the subset that only contains $7$, so our answer is $64\cdot 7=\boxed{448}$. | {
"domain": "artofproblemsolving.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9891815519849906,
"lm_q1q2_score": 0.8017107915219075,
"lm_q2_score": 0.8104789155369047,
"openwebmath_perplexity": 99.7618550404391,
"openwebmath_score": 0.8936639428138733,
"tags": null,
"url": "https://artofproblemsolving.com/wiki/index.php?title=1983_AIME_Problems/Problem_13&direction=prev&oldid=70929"
} |
welding
Make sure if you don't weave that your electrode is running straight down the center of the joint. If you are having trouble seeing, you may need a bright light or an adjustable shade welding hood.
Position the joint to be as favorable to a good weld as you can. If you were welding the inside corner in the orientation photographed, gravity will pull your weld pool from the vertical wall down on to the horizontal wall. If at all possible, rotate the assembly 45 degrees so that both tubes are at an equal 45 degree angle from the earth. This way gravity will help equally on both faces. The orientation of the joint makes such a big difference that in America structural welders aren't allowed to perform welds in a harder orientation than they have taken a qualification test on. | {
"domain": "engineering.stackexchange",
"id": 3663,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "welding",
"url": null
} |
dark-energy, hawking-radiation
theory of Quantum gravity, or at least, a consistent theory (that means with a generic metric) of quantum field theory in curved spacetime. So I guess no one can answer at your question completely at the moment. | {
"domain": "physics.stackexchange",
"id": 49149,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dark-energy, hawking-radiation",
"url": null
} |
lambda-calculus, type-checking, type-inference
See Does there exist a Turing complete typed lambda calculus?) for more information about intersection types. | {
"domain": "cs.stackexchange",
"id": 13555,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lambda-calculus, type-checking, type-inference",
"url": null
} |
java, beginner, mvc, tic-tac-toe
TicTacToe.java
public class TicTacToe {
public static void main(String[] args) {
Game game = new Game();
View view = new View();
Controller controller = new Controller(game, view);
while (!game.isGameOver()) {
try {
Thread.sleep(250);
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
} | {
"domain": "codereview.stackexchange",
"id": 19523,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, mvc, tic-tac-toe",
"url": null
} |
So for example, take "AABB". It's got type $$2^2$$, so we get $$\frac{4!}{(2!)^2 2!} = 3.$$ These are represented by "AABB", "ABAB" and "ABBA".
Your numbers can be found at http://oeis.org/A178867.
Inspired by Bulbasaur, I'll add that the exponential multivariate generating function for your numbers is given by $$\exp\left(\sum_{n=1}^\infty \frac{u_nz^n}{n!}\right) \\ = 1 + \frac{u_1}{1!}z + \frac{u_1^2 + u_2}{2!}z^2 + \frac{u_1^3 + 3u_1u_2+u_3}{3!}z^3 + \frac{u_1^4 + 6u_1^2+4u_1u_3 + 3u_2^2+u_4}{4!}z^4 + \ldots,$$ if you're interested. Here $$u_1, u_2, \ldots$$ are variables marking how many times we use each letter, and $$z$$ marks the total number of letters (we don't really need $$z$$ here). So for the number of non-equivalent permutations of "AABBC", you look up the coefficient of $$u_2u_2u_1z^5$$, meaning two A's, two B's, one C, five total. Then multiply it by $$5!$$ to get $$15$$ as the answer. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9653811651448431,
"lm_q1q2_score": 0.8299031965709915,
"lm_q2_score": 0.8596637541053281,
"openwebmath_perplexity": 867.1547523596731,
"openwebmath_score": 0.7095819115638733,
"tags": null,
"url": "https://math.stackexchange.com/questions/4228192/are-these-permutations-combinations-or-something-in-between-how-many-are-they"
} |
beginner, database, f#
// return one item by item id
member this.GetItemByItemId(itemId : string) =
use db = dbSchema.GetDataContext()
query {
for rows in db.ItemsTable do
where (rows.ItemId = itemId)
select rows
}
|> (fun s ->
if Seq.isEmpty s then
None
else
s |> Seq.head |> this.Record2Item |> Some)
// insert new item
member this.InsertItem (item : Item) =
use db = dbSchema.GetDataContext()
item |> this.Item2Record |> db.ItemsTable.InsertOnSubmit
try
db.DataContext.SubmitChanges()
with
| exn -> printfn "Exception: \n%s" exn.Message
// update item
member this.UpdateItem (item : Item) =
use db = dbSchema.GetDataContext() | {
"domain": "codereview.stackexchange",
"id": 13861,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, database, f#",
"url": null
} |
as spheres and assume the amplitude of the wave from each speakers is the same at the microphone) (a) The speed of waves in the fluids such as air or water is given by v=\sqrt{\frac{B}{\rho}}\ \ where B is the Bulk modulus and \rho is the density of the medium. Therefore $v=\sqrt{\frac{B}{\rho}}=\sqrt{\frac{2.2\times {10}^9}{1000}}=1483\ {\rm m/s}$ (b) Given v of the sound in the water we can find the wavelength of it by $\lambda=\frac{v}{f}=\frac{1483}{1200}=1.24\ {\rm m}$ (c) Fluids exerts a drag force on a small, slowly moving spheres by stock's law as F_d=6\pi \eta rv . in addition to the drag force, there is Buoyancy force, therefore draw a free body diagram and apply Newton's 2{}^{nd} law as $\Sigma F_y=ma=0\ \left(const\ velocity\right)$ $mg-F_B-F_D=0$ $mg=\rho_w\, V_{submerg}\,g+6\pi\eta rv$ \begin{align*} v&=\frac{mg-\frac{4}{3}\pi r^3\rho_w g}{6\pi\eta r}\\ &=\frac{\left(0.015\times {10}^{-3}\times 9.8-\frac{4}{3}\pi\times {\left(1.1\times | {
"domain": "physexams.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9871787872422175,
"lm_q1q2_score": 0.8226403572497651,
"lm_q2_score": 0.8333245891029457,
"openwebmath_perplexity": 553.956733167186,
"openwebmath_score": 0.8573803305625916,
"tags": null,
"url": "http://physexams.com/exam/Waves/4"
} |
java, algorithm, interview-questions
Title: Add one to a number represented as an array of digits I submitted this problem for an interview, and I was wondering if I could have done better. My solution works, and I solved in about 12-15 minutes. I feel like I did a bad job with the code. Please be honest.
Here is the question:
Given a non-negative number represented as an array of digits, plus
one to the number. Also, the numbers are stored such that the most
significant digit is at the head of the list.
In particular, what stumped me was the fact that I'd get the right answer, but have the initial index (at 0) in sometimes empty with the answer on the other half, and couldn't figure out a quick half to shift all the elements to the left without using extra storage.
public int[] plusOne(int[] digits) {
int[] toRet=new int[digits.length+1];
int[] temp=null; | {
"domain": "codereview.stackexchange",
"id": 43587,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, algorithm, interview-questions",
"url": null
} |
c++, performance, php, mysql, comparative-review
if (auto maybe_lastname = row->getField(2)) {
std::string lastname = maybe_lastname.value();
trim(lastname);
strtolower(lastname);
lastnames[std::move(lastname)]++;
}
}
const int n = 10;
report(domains, n, "domains");
report(firstnames, n, "firstnames");
report(lastnames, n, "lastnames");
return EXIT_SUCCESS;
}
``` | {
"domain": "codereview.stackexchange",
"id": 36736,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, performance, php, mysql, comparative-review",
"url": null
} |
sql, sql-server
Title: Counting pending bookings using a subselect Can this query be improved? Is there a way to eliminate the duplicate function call?
-- a Special Group has many Items which have many Bookings
create function f_BookingsForSpecialGroup(@specialGroupId varchar(99))
returns table as
return select * from v_Booking where ITEM_CODE in
(select ITEM_CODE from v_Item i where i.SPECIAL_GROUP_ID = @specialGroupId);
go
create view v_SpecialGroup as
select (NON_BAD_BOOKINGS - PAID_BOOKINGS) as PENDING_BOOKINGS, * from
(
select
(select count(*) from f_BookingsForSpecialGroup(g.SPECIAL_GROUP_ID) where IS_BAD=0) as NON_BAD_BOOKINGS,
(select count(*) from f_BookingsForSpecialGroup(g.SPECIAL_GROUP_ID) where IS_PAID=1) as PAID_BOOKINGS,
*
from SPECIAL_GROUP g
) g
go | {
"domain": "codereview.stackexchange",
"id": 18157,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sql, sql-server",
"url": null
} |
navigation, costmap-2d
Originally posted by Bill Smart with karma: 1263 on 2013-05-28
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 14338,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, costmap-2d",
"url": null
} |
javascript, physics
set angAcc(x) {
this.angMotion[2] = x
}
simulatePhysics(dt) {
function taylor(arr) {
return arr.reduceRight((acc, cur, i) => acc * dt / (i + 1) + cur, 0)
}
for (var dim = 0; dim < this.motion[0].length; dim++) {
for (var deriv = 0; deriv < this.motion.length; deriv++) {
this.motion[deriv][dim] = taylor(this.motion.slice(deriv).map((cur) => cur[dim]))
}
}
for (var deriv = 0; deriv < this.angMotion.length; deriv++) {
this.angMotion[deriv] = taylor(this.angMotion.slice(deriv))
}
}
}
//*DEBUG
var a = new Game2DObject({acc: [-6, 0], angVel: 9})
console.log(a)
console.log(a.dis[0] = 1)
console.log(a.dis[1] = 5)
console.log(a.acc[1] = -2)
console.log(a)
a.simulatePhysics(1)
console.log(a)
a.simulatePhysics(1)
console.log(a)
a.simulatePhysics(1)
console.log(a) | {
"domain": "codereview.stackexchange",
"id": 35846,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, physics",
"url": null
} |
ros-kinetic
import math
from itertools import groupby
from operator import itemgetter
import tf
import rospy
import numpy as np
from geometry_msgs.msg import TransformStamped
from geometry_msgs.msg import PointStamped | {
"domain": "robotics.stackexchange",
"id": 30410,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-kinetic",
"url": null
} |
c#, mysql
l.CreateRunningEntry(3, "LastMovingAverageDate", "The last date pulled for " + companySymbol + " is " + maLastDate.ToString("yyyy-MM-dd"));
return maLastDate;
}
public List<HistoricalClosing> GetHistoricalDateAndClosings(MySqlConnection conn, string companySymbol, DateTime maLastDate)
{
l.CreateRunningEntry(3, "GetHistoricalDateAndClosings", "Getting the list of historical closing data for symbol = " + companySymbol);
List<HistoricalClosing> historicalClosing = new List<HistoricalClosing>(); | {
"domain": "codereview.stackexchange",
"id": 18636,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, mysql",
"url": null
} |
statistical-mechanics, entropy, ideal-gas, low-temperature-physics
EDIT:
The general partition function of the $N$-particle system for arbitrary $T>0$ is the restricted sum
$$Z(\beta,N)=\sum_{\{N=n_0+n_1+...\}}\, x_0^{n_0}\,x_1^{n_1}\,...$$
with $x_i=e^{-\beta \epsilon_i}$, for $i=0,1,2,...$ Note, that $i$ is the quantum number and $\epsilon_i<\epsilon_{i+1}$, for all $i$. First, let's consider the case of distinguishable particles. Consider a two-level system where each of the $N$ particles is either in a state with energy $\epsilon_0$ or $\epsilon_1$. The partition function is
$$
Z = \left(\text{e}^{-\beta \epsilon_0} + \text{e}^{-\beta \epsilon_1}\right)^N
$$
It follows that the free energy is
$$
F = - \beta^{-1} \ln Z = - \beta^{-1} N \ln \left(\text{e}^{-\beta \epsilon_0} + \text{e}^{-\beta \epsilon_1}\right)
$$
and the average internal energy
$$
\bar{E} = - \frac{\partial \ln Z}{\partial \beta} = N \frac{\epsilon_0\text{e}^{\beta \epsilon_1} + \epsilon_1 \text{e}^{\beta \epsilon_0}}{\text{e}^{\beta \epsilon_0} + \text{e}^{\beta \epsilon_1}} | {
"domain": "physics.stackexchange",
"id": 50065,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statistical-mechanics, entropy, ideal-gas, low-temperature-physics",
"url": null
} |
machine-learning, classification, logistic-regression, random-forest
Title: Voting combined results from different classifiers gave bad accuracy I used following classifiers along with their accuracies:
Random forest - 85 %
SVM - 78 %
Adaboost - 82%
Logistic regression - 80% | {
"domain": "datascience.stackexchange",
"id": 496,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, classification, logistic-regression, random-forest",
"url": null
} |
quantum-mechanics, classical-mechanics, commutator
There are many "quantization methods" and even having chosen one such method one usually can't apply it to completely arbitrary classical systems without running into problems or ambiguities. Few of these methods are formulated in a mathematically rigorous manner as being a well defined "map" from "classical systems" to "quantum systems". The idea is to try and guess a quantum theory that has a certain classical limit and obeys the same (or closely related) symmetries as that classical limit (i.e. the system one wants to quantize). It is a problem of modeling: Given some real world phenomenon find its quantum description. Our intuition works fairly well in suggesting a classical description so we usually start from there rather than guessing the quantum system right away. A quantization procedure can be called successfull if it produces a mathematically well-defined quantum theory with predictions that match experiments. | {
"domain": "physics.stackexchange",
"id": 40747,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, classical-mechanics, commutator",
"url": null
} |
waves, acoustics
An interesting effect occurs when you combine two sound waves with similar amplitudes. The alignment of their peaks and troughs varies from being almost exactly in phase to almost exactly out of phase over a time period that is equal to the difference between their frequencies, so you hear their two sounds overlaid by a periodic waxing and waning of volume known as 'beats'. If you know what to listen for you can use the sound of the beats to tune two neighbouring guitar strings, fretting the lower string so that it should play the same note as the higher one. If you tune the strings slightly out at first and pluck them together you can hear the beat, and you can adjust the tension until the period of the beat gets longer and eventually disappears. | {
"domain": "physics.stackexchange",
"id": 61463,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "waves, acoustics",
"url": null
} |
quantum-field-theory, gauge-theory, path-integral, lorentz-symmetry, quantization
I consider the 2nd method of path integral quantization is always equivalent to canonical quantization. So for Scalar QED, are these two kinds of path integral quantization same? How to prove?
For non-abelian gauge theory, there is derivative interaction even in gauge field itself. It seems that all textbooks use $Z_1$ to get the Feynman rules. Are these two kinds of path integral quantization same in non-abelian gauge field? If not same, why we choose the coordinate space path integral? It's the axiom because it coincides with experiment? AccidentalFourierTransform has already given a good answer. Here we will provide more details & justifications for a class of non-gauge derivative interactions. | {
"domain": "physics.stackexchange",
"id": 40358,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, gauge-theory, path-integral, lorentz-symmetry, quantization",
"url": null
} |
javascript, node.js, ecmascript-6, handlebars
<input id="temp" type="checkbox" name="" value="" disabled {{temp}}>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</section> | {
"domain": "codereview.stackexchange",
"id": 39259,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, node.js, ecmascript-6, handlebars",
"url": null
} |
formal-languages, pushdown-automata, stacks, term-rewriting
Title: Is "duplicate" in RPN enough for replacing variable binding in term expressions? I try to work out some consequences of storing (or "communicating"/"transmitting") a rational number by a term expression using the following operators: $0$, $\mathsf{inc}$, $\mathsf{add}$, $\mathsf{mul}$, $\mathsf{neg}$, and $\mathsf{inv}$. Here $\mathsf{add}$ and $\mathsf{mul}$ are binary operators, $\mathsf{inc}$, $\mathsf{neg}$, and $\mathsf{inv}$ are unary operators, and $0$ is a $0$-ary operator (i.e. a constant). Because I want to be able to also store numbers like $(3^3+3)^3$ efficiently, I need some form of variable binding. I will use the notation $(y:=t(x).f(y))$ to be interpreted as $f(t(x))$ in this question. Now I can store $(3^3+3)^3$ as
$$(c3:=(1+1+1).(x:=((c3*c3*c3)+c3).(x*x*x))).$$
If I stick to the operators $0$, $\mathsf{inc}$, $\mathsf{add}$, and $\mathsf{mul}$, this becomes | {
"domain": "cs.stackexchange",
"id": 3526,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "formal-languages, pushdown-automata, stacks, term-rewriting",
"url": null
} |
In order to calculate its area, she would split the problem into double integrals, one for $y-x^{2}-1=0$ and another one for $y-2x^{3}=0$, and find the points where they intersect:
Like this:
$$\iint_{D}dxdy = \iint_{D_{1}}dxdy + \iint_{D_{2}}dxdy$$
Can't I use my formula (1) in this case?
Thank you so much in advance.
• Just to clarify, is it $\sin^3y$, or $\sin(y^3)$ Mar 18, 2018 at 22:19
• It's the latter, I've changed it. Mar 18, 2018 at 22:21
By a double integral in the form
$$\iint_{D}f(x,y)dxdy$$
we are evaluating the (signed) volume between the function $z=f(x,y)$ and the x-y plane.
Then by the following double integral
$$\iint_{D}1\cdot dxdy$$
we are evaluating the volume of a cilinder with base the domain $D$ and height $1$ which correspond (numerically) to the area of the domain $D$.
For the last question, yes the integral is additive thus we can divide it as
$$\iint_{D}dxdy = \iint_{D_{1}}dxdy + \iint_{D_{2}}dxdy$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9621075701109193,
"lm_q1q2_score": 0.8099268222073105,
"lm_q2_score": 0.8418256412990658,
"openwebmath_perplexity": 195.58523201534206,
"openwebmath_score": 0.9404757022857666,
"tags": null,
"url": "https://math.stackexchange.com/questions/2697933/calculating-the-area-with-simple-and-double-integrals"
} |
notation, formal-charge
Can anyone point me to some documentation that might describe/explain the notation convention? TL;DR: $\ce{He^2+}$ is the only preferred notation.
Notations $\ce{He^{++}},$ $\ce{He^{+2}}$ or $\ce{He^{1+}}$ are obsolete and should be avoided. | {
"domain": "chemistry.stackexchange",
"id": 13958,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "notation, formal-charge",
"url": null
} |
quantum-mechanics, homework-and-exercises, schroedinger-equation, gauge-invariance
Somehow the right set of parentheses goes to zero, and I'm wondering what I'm missing.
This is another stack exchange question where the same pattern is used: Gauge Invariance of Schrodinger Equation Your last term $\nabla\Lambda e^{iq\Lambda}\psi)$ in the second line is simply $e^{iq\Lambda}\psi\cdot(\nabla\Lambda)$ and is not the third line where you are acting by nabla on all functions. Maybe you misunderstood the first line where $\nabla\Lambda$ is just a gradient of $\Lambda$. | {
"domain": "physics.stackexchange",
"id": 53937,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, homework-and-exercises, schroedinger-equation, gauge-invariance",
"url": null
} |
botany, plant-physiology, nutrition, plant-anatomy
direction or another. For many plants, by the way, this means a simple strategy of simply growing straight down (a tap root), because that's almost always where they find more water with more of the right stuff dissolved into it. This is similar to the fact that many plants grow as tall as they can because that's where they will find the most sunlight, though the general idea is to grow leaves wherever that light might be captured. | {
"domain": "biology.stackexchange",
"id": 4060,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "botany, plant-physiology, nutrition, plant-anatomy",
"url": null
} |
calibration, ros-kinetic, rgbd
[0, 0, 0, 0;
0, 0, 0, 0;
0, 0, 0, 0]
[ERROR] [1558852802.763309988]: Tried to advertise a service that is already advertised in this node [/calibration/rgbd_offline/set_camera_info]
[ INFO] [1558852802.763406777]: camera calibration URL: file:///home/lhy/.ros/camera_info/rgb_A00362902964053A.yaml
**[ERROR] [1558852802.765104511]: Exception parsing YAML camera calibration:
yaml-cpp: error at line 0, column 0: bad conversion
[ERROR] [1558852802.765185216]: Failed to parse camera calibration from file [/home/lhy/.ros/camera_info/rgb_A00362902964053A.yaml]**
[ WARN] [1558852802.765279760]: Camera calibration file /home/lhy/.ros/camera_info/rgb_A00362902964053A.yaml not found.
[ INFO] [1558852802.846363646]: Getting data...
[ INFO] [1558852813.493671995]: 40 images + point clouds added.
[ INFO] [1558852813.493820898]: Initial transform:
position:
x: 0
y: 0
z: 0
orientation:
x: 0
y: 0
z: 0
w: 1 | {
"domain": "robotics.stackexchange",
"id": 33064,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "calibration, ros-kinetic, rgbd",
"url": null
} |
rqt
Title: where in the rqt source code is the tab handling?
Hi
I would like to know where I can find the rqt perspective tab handling, e.g. where in the source code are they created?
I guess it's somewhere in the qt_gui_core (https://github.com/ros-visualization/qt_gui_core), but I couldn't find anything.
edit: I mean the tabs in the picture below (open rqt and add some plugins over each other):
Explanation of my goal:
I want to add several rqt plugins (mostly my own plugins), add them to a single rqt perspective and create tabs like in the picture above. Then I want do switch between this tabs from a ros node, depending on which tab is most relevant.
Originally posted by sam_123 on ROS Answers with karma: 70 on 2015-07-17
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 22220,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rqt",
"url": null
} |
c#, asp.net-mvc-3, asynchronous
2017
Let's fast-forward five years and six months (which is an agonizingly long time) and examine what language features might make this a different process. I'm just going to post the form that takes advantage of the new language features, then we'll discuss where async/await might help you.
[HttpPost]
public void ConfigureAsync(ConfigureExportInputModel inputModel)
{
if (inputModel == null)
{
throw new ArgumentNullException("inputModel");
}
var arguments = new Dictionary<string, object> { [nameof(inputModel.ExportType)] = inputModel.ExportType };
var wf = new ErrorHandledExportWorkflow();
AsyncManager.OutstandingOperations.Increment();
ThreadPool.QueueUserWorkItem(o =>
{
AsyncManager.Parameters["result"] = WorkflowInvoker.Invoke(wf, arguments)["MvcOutput"] as IDefineMvcOutput;
AsyncManager.OutstandingOperations.Decrement();
});
} | {
"domain": "codereview.stackexchange",
"id": 27013,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, asp.net-mvc-3, asynchronous",
"url": null
} |
Comment:
• In (4) we use the expression (3) and replace $k$ with $k-1$ to represent the $(k-1)$-st derivative of $y(x)$.
• In (5) we apply the product rule to the series.
• In (6) we collect terms of the right-hand series.
• In (7) we shift the index $j$ of the second series by one to prepare merging of both parts.
• In (8) we collect both series and note that for $j=1$ and $j=k$ the summands $a_{k-1,0}=a_{k-1,k}=0$.
Example: $k=1,\ldots,5$
We use the recurrence relation to show polynomials $a_{k,j}$ for small $k$ revealing thereby a regular structure. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9920620051945144,
"lm_q1q2_score": 0.8110845698388939,
"lm_q2_score": 0.817574471748733,
"openwebmath_perplexity": 1715.8238422286124,
"openwebmath_score": 0.9951574206352234,
"tags": null,
"url": "https://math.stackexchange.com/questions/2036881/is-there-a-closed-form-for-displaystyle-fracdnydxn"
} |
c#, .net, multithreading
This negligeable performance difference (in the best case) gets outweight by the many optimisations the .NET team put in for special cases.
Question:
To ease working with multithreaded code, I wanted to implement a version of Parallel.ForEach for .NET 3.5.
We are for the moment stuck with 3.5 and cannot upgrade. We cannot use external libraries like TPL.
I found this via Google, but this threw sporadic exceptions during runtime, and because I couldn't find another Version I decided to roll my own.
I did of course test it, but i am always a bit cautious with multithreaded code.
public class Parallel
{
public static void ForEach<T>(IEnumerable<T> items, Action<T> action)
{
if (items == null)
throw new ArgumentNullException("enumerable");
if (action == null)
throw new ArgumentNullException("action");
var resetEvents = new List<ManualResetEvent>(); | {
"domain": "codereview.stackexchange",
"id": 7378,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, .net, multithreading",
"url": null
} |
electromagnetic-radiation, waves, photons, acoustics
I know this seems controversial like saying that there is no photon and I say it might be not that controversial since there is no particular particle for sound and a waveform only.
Thanks for any insight! There is a difference even in the classical wave framework between sound and light.
Sound propagates on a medium, light propagates in vacuum with no problem. Where would we be if sunlight were like sound - never propagating through vacuum? In the classical framework, before special relativity was posited and proved, in order to make the equivalence you like, people had invented the ether. The Michelson Morley experiment, the first in a series, showed there was no ether.
It is interesting though that sound/vibrations can also be like a particle in the medium it propagates, called a "phonon". | {
"domain": "physics.stackexchange",
"id": 41581,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetic-radiation, waves, photons, acoustics",
"url": null
} |
cosmology, black-holes, dark-energy
But the “dark energy star” (one of black hole proposed alternatives) is expected to have a normal photon sphere up to rather small distance from the would-be horizon. And so the image from the EHT is compatible with black hole and dark energy star and also with other proposed black hole alternatives that are characterized by clear photon sphere.
For an overview of the multitude of exotic compact objects (ECO, the general name for black hole alternatives) and observational prospects for understanding their precise properties see the following (Open Access) review: | {
"domain": "physics.stackexchange",
"id": 67817,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cosmology, black-holes, dark-energy",
"url": null
} |
c++, primes
isprime = true;
for (int primecount=0 ;primes[primecount]<=sqrt(nur);primecount++)
{
if (nur % primes[primecount] == 0)
{
isprime = false;
break;
}
else if (primes[primecount]*primes[primecount]>nur)
{
cout<<nur<<endl;
break;
}
}
if (isprime)
{
cout << nur << endl;
primes.push_back(nur);
// l++;
}
}
cout<<"Finished"<<endl;
// cout<<primes[l];
return 0;
}
primes.push_back(2);
for (int nur = 3;nur!=0;nur+=2)
{
A reasonably simple optimization is to get rid of numbers divisible by 3.
int interval = 4;
primes.push_back(2);
primes.push_back(3);
for (int nur = 5; nur != 0; nur += interval)
{
interval = 6 - interval; | {
"domain": "codereview.stackexchange",
"id": 20384,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, primes",
"url": null
} |
And finally, sin(2018) gives us two primes:
89
890078059172214077866908781516358161827277734319970800477363723960779818810729974998238099333154892009885458973321640841442042739723513347225471340149039460391024770670777037177784685508982613866838293832904866761046669825265135653209394367093522291768886320360545920897111922035021827790766895274726280695701753189405911185099453319400331979946988526902527520607778873012543871813339138882571549068827579760491442082336321409598206489746377828352552073997340874649330911864108558685738003182332758299767812686413014214285003827180623455181083706822164258525158371971877396069605035317998430446771215296978812833752733
We might expect to find more primes when the leading digit is small because each time we select a number with d digits we’re looking lower in the range where primes are more dense. That is consistent with the small number of examples in this post.
## Related posts | {
"domain": "johndcook.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9783846659768266,
"lm_q1q2_score": 0.8110210170274759,
"lm_q2_score": 0.828938806208442,
"openwebmath_perplexity": 433.1194330520366,
"openwebmath_score": 0.8436995148658752,
"tags": null,
"url": "https://www.johndcook.com/blog/2018/09/04/pi-primes/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+TheEndeavour+%28The+Endeavour%29"
} |
Consider maybe the the polynomial ring $$\Bbb Z[X_1,X_2,\dots]$$ with infinitely many indeterminates. This ring is not finitely generated and the only units are $$\pm 1$$.
• Great example. (If I'm not mistaken, you can replace $\mathbb{Z}$ by any reduced ring $R$ whose unit group is finite too.) Nov 22 '19 at 19:03
• @Alex I think it has to be an integral domain. There can probably be polynomials that are units if $R$ has zero divisors. Nov 22 '19 at 19:37 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109520836027,
"lm_q1q2_score": 0.8005206349650179,
"lm_q2_score": 0.8128673155708975,
"openwebmath_perplexity": 155.0183883933339,
"openwebmath_score": 0.8863449692726135,
"tags": null,
"url": "https://math.stackexchange.com/questions/3446886/group-of-units-of-a-non-finitely-generated-ring/3446936"
} |
normally, "$$n$$" is the symbol we use here for discrete-time. if your professor said that:
\begin{align} x[n] &= e^{i10 \pi n} \\ &= e^{i 2 \pi (5n)} \\ \end{align}
is not periodic with a period of $$1$$ (assuming $$n \in \mathbb{Z}$$) or a period of $$\frac15$$ (assuming $$n \in \mathbb{R}$$), then your professor is mistaken.
• More generally, if the frequency is a rational multiple of $pi$, then the sequence is periodic. $10pi$ is a rational multiple of $pi$. – Juancho Feb 1 at 14:46 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9799765581257487,
"lm_q1q2_score": 0.8405926387613859,
"lm_q2_score": 0.857768108626046,
"openwebmath_perplexity": 879.5118918785192,
"openwebmath_score": 0.9972156882286072,
"tags": null,
"url": "https://dsp.stackexchange.com/questions/55212/periodicity-of-constant-discrete-time-signals"
} |
java, strings, android, error-handling, kotlin
public void cancel(){
alertDialog.cancel();
}
public void show(){
alertDialog.show();
}
abstract void ok();
abstract int getLayout();
} Nullable
Your fields are optionals: you put a ? after the type.
This means every time you need to access them, you need to check if it is null...
If you want the fields to be always present, throw the NullPointerException when findViewById doesn't return a view.
Then you can make your field not nullable and you can remove all the (now) redundant checks...
oneline function
override fun getLayout(): Int {
return R.layout.input_text_layout
}
This function doesn't need 3 lines of attention...
Change it to one:
override fun getLayout(): Int = R.layout.input_text_layout
you could remove the return-type as well:
override fun getLayout() = R.layout.input_text_layout | {
"domain": "codereview.stackexchange",
"id": 38161,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, strings, android, error-handling, kotlin",
"url": null
} |
electrons, molecular-orbital-theory, molecular-structure
Title: Does Bent's Rule only apply to molecules where there is hybridisation? I would just like to ask if the pre-requisite for using Bent's Rule is that the bonding in the molecule involves hybridised orbitals. | {
"domain": "chemistry.stackexchange",
"id": 9155,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrons, molecular-orbital-theory, molecular-structure",
"url": null
} |
javascript, html, form, dom
jQuery(allaliases).each(function(l){
var innerAlias = this;
innerAlias.onchange = aliasChange.bind(null,innerAlias,thisAlias,innerAlias.onchange);
thisAlias.onchange = aliasChange.bind(null,thisAlias,innerAlias,thisAlias.onchange);
});
});
jQuery(alloriginals).each(function(j){
var innerOriginal = this;
innerOriginal.onchange = aliasChange.bind(null,innerOriginal,thisOriginal,innerOriginal.onchange);
thisOriginal.onchange = aliasChange.bind(null,thisOriginal,innerOriginal,thisOriginal.onchange);
});
});
});
function aliasChange(o,a,func) {
if (func != null)
func();
a.value = o.value;
if (a.onblur != null)
a.onblur();
}
var radioGroupCounter = 1;
var actions = {}; | {
"domain": "codereview.stackexchange",
"id": 4051,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, html, form, dom",
"url": null
} |
java, multithreading, socket, server
Title: Multi-threaded socket server high load I'm trying to make a backend for QuizUp like application: user connects to a server, sends credentials and gets paired up with another user. After that server handles each pair, periodicaly sending server messages to each user in a pair and also redirecting user's mesages between them.
Server class:
private static class Server{
private static final int NUM_THREADS = 2400;
private ExecutorService executorService;
private ServerSocket serverSocket;
private int listeningPort;
public volatile boolean isRunning;
private Thread mainThread;
private volatile Map<String, Conn> playRequests;
public Server(int port){ | {
"domain": "codereview.stackexchange",
"id": 7208,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, multithreading, socket, server",
"url": null
} |
c++, programming-challenge, time-limit-exceeded
for(long long i = 2; i <= n;i++)
Your algorithm is thus said to be O(t).
To speed it up, you need to fast-forward through entire countdown sequences.
#include <iostream>
int main() {
long long countdown_init, t;
std::cin >> t;
for (countdown_init = 3; t > countdown_init; countdown_init *= 2) {
t -= countdown_init;
}
std::cout << (countdown_init - t + 1) << '\n';
}
This solution would be O(log t), since it only loops once per countdown cycle. We can estimate the amount of work by rounding up t to the last t of each cycle:
$$\begin{align}
t \approx&\ 3\ (\underbrace{1 + 2 + 4 + \ldots + 2^{c}}_{c\ \textrm{cycles}}) \\
\approx&\ 3 \cdot 2^{c+1} \\
=&\ 6 \cdot 2^c
\end{align}$$
The number of cycles \$c\$ is therefore
$$c \approx \log_2 \frac{t}{6} = O(\log t)$$ | {
"domain": "codereview.stackexchange",
"id": 22987,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, programming-challenge, time-limit-exceeded",
"url": null
} |
optics, experimental-physics, soft-question, acoustics, laser
Is this listening in using a laser actually feasible? The only reason I ask this question is because I think it probably is.
Putting tape over the windows to prevent vibration, is this a feasible method to stop the conversation being overheard using the laser? Surely the laser could be tuned accordingly to allow for this?
EDIT As Ernie says below: | {
"domain": "physics.stackexchange",
"id": 51003,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, experimental-physics, soft-question, acoustics, laser",
"url": null
} |
gravity, cosmology, spacetime, space-expansion, dark-energy
At that point, the universe would begin to shrink into itself and given infinite time will inevitably reach the singularity once more...Perhaps only to create a new big bang and start the process again. No, this is not the only possibility, because there are two wrong premises: | {
"domain": "physics.stackexchange",
"id": 48392,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gravity, cosmology, spacetime, space-expansion, dark-energy",
"url": null
} |
$27.076$
$0.550$
$+\:0.004$
$27.630$
(d) $\small 25.65 + 9.005 + 3.7$
$25.650$
$9.005$
$+\:3.700$
$38.355$
(e) $\small 0.75 + 10.425 + 2$
$0.750$
$10.425$
$+\:2.000$
$13.175$
(f) $\small 280.69 + 25.2 + 38$
$280.69$
$25.20$
$+\:38.00$
$343.89$
Exams
Articles
Questions | {
"domain": "careers360.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357221825194,
"lm_q1q2_score": 0.809403726820468,
"lm_q2_score": 0.824461928533133,
"openwebmath_perplexity": 307.4058638105165,
"openwebmath_score": 0.6021542549133301,
"tags": null,
"url": "https://learn.careers360.com/ncert/question-find-the-sum-in-each-of-the-following-a-0-point-007-plus-8-point-5-plus-30-point-08-b-15-plus-0-point-632-plus-13-point-8-c-27-point-076-plus-0-point-55-plus-0-point-004-d-25-point-65-plus-9-point-005-plus-3-point-7/"
} |
php, mysqli
Any more advice?
Initially, with the MySQL, or rather what you are saying is the MySQL as it still mostly looks like MySQLi, the or die() phrase should die. It was never really all that acceptable even though many sites use it to demonstrate. die() is a very inelegant way of terminating execution. The proper way would be to throw an error or render some sort of error page, with the former eventually leading to latter anyways. You especially shouldn't output the error for anyone to see, that should be saved to a log. No need to give potential malicious users more information than necessary.
$var is a very undescriptive variable, and the comment afterwards doesn't really help either. You shouldn't really rely on comments to explain your code anyways. Make your code self-documenting and comments, excluding doccomments, will become unnecessary. Why not just use $user_id, or $uid, or even just $id? | {
"domain": "codereview.stackexchange",
"id": 2896,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, mysqli",
"url": null
} |
mechanical-engineering, beam, mathematics
However when taking a look at the solution provide on Wikipedia: https://en.wikipedia.org/wiki/Timoshenko%E2%80%93Ehrenfest_beam_theory#Example:_Cantilever_beam, I would expect a solution that provides the same values, except in opposite direction, which is not the case. The difference between my solution and the one provided seems to be created in the first part, which finds the solution for $\phi$, but I am unsure what I did wrong. The solution at the extremities is the same, but not the solution throughout the beam itself.
Any help would be highly appreciated. As addressed before, you should formulate the problem with the x-axis pointing from the free end to the fixed end, which is the conventional method, and was used by the wiki example as well.
On wiki example: | {
"domain": "engineering.stackexchange",
"id": 4503,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mechanical-engineering, beam, mathematics",
"url": null
} |
organic-chemistry, everyday-chemistry, food-chemistry
Title: Must lactose-free milk be ultra-pasteurized? In this question I asked why lactose-free milk lasted such a long time. The answer was because it is ultra-pasteurized. This leads naturally to another question: does lactose-free milk have to be ultra-pasteurized?My initial guess is that it does because:Since the lactase added to make the product lactose free breaks down lactose into twice as many sugar molecules, any living bacteria have twice as much nutrients to thrive in.Since the disaccharide lactose has been broken down into the simple monosaccharides glucose and galactose, the bacteria do not need to produce their own lactase to use the sugar; thus any non-lactase producing bacteria can thrive in the milk.And finally, I have been adding lactase to regularly pasteurized milk to produce my own lactose-free milk. However, this milk almost always goes bad a couple of days before the Best-By date stamped on the container.This all leads me to think that lactose-free milk must be | {
"domain": "chemistry.stackexchange",
"id": 14671,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, everyday-chemistry, food-chemistry",
"url": null
} |
optimization, sorting
Here on repl.it is my benchmark program that compares the performance of a version of ordinary heapsort and its corresponding version of double-pop heapsort. Hit the "run" button and see the results. However, the results over there fluctuates too much to be reliable at all, because, I assume, it runs on a shared machine with forceful time-sharing management.
Instead, I use my local compute. My computer is a "2.2 GHz Quad-Core Intel Core i7" with "16 GB 1600 MHz DDR3". Java version is "Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)". I have run the benchmark program for many hours using various parameters. Here are typical results for arrays of integers that are randomly distributed over an interval.
"Array size" is the size of array to be sorted.
"Variations" is the number different arrays.
"repetitions" is the number of times the same array is sorted.
"ordinary total" is the total time used by ordinary heapsort. | {
"domain": "cs.stackexchange",
"id": 15970,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optimization, sorting",
"url": null
} |
A similar problem is formulated here.
• Thank you for your prompt reply and for pointing out the error, I edited the example. I'll check your model in details but it looks like it works! Apr 25 '18 at 23:11
• I've checked it in details and I still don't understand one thing. What's the purpose of the constraint $z_i ≥ y − M \times (1−x_i)$? I can see it holds true, but why that one? Also, does this kind of linearization has a name or was introduced by an author I can cite in a paper? I've read the article on your blog but it only references another of your articles. Apr 28 '18 at 21:29
• The constraint $z_i \ge y - M(1-x_i)$ implements the implication $x_i=1 \Rightarrow z_i = y$. Linearizing a multiplication of a binary variable and a continuous variable is somewhat of a standard thing. I don't think it has a name, Apr 28 '18 at 21:37 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9715639653084244,
"lm_q1q2_score": 0.8218871907008879,
"lm_q2_score": 0.845942439250491,
"openwebmath_perplexity": 1084.1668433921,
"openwebmath_score": 0.8476147055625916,
"tags": null,
"url": "https://math.stackexchange.com/questions/2752558/how-to-linearize-a-weighted-average-with-a-decision-variable"
} |
experimental-chemistry, titration
Title: What effect, if any, would each of the following actions have on the calculated concentration of the NaOH in this experiment? What effect, if any, would each of the following actions have on the calculated concentration of the NaOH in this experiment? (e.g. would the calculated concentration be higher, lower or the same?) Treat each action separately and explain your answer.
1-You overshoot the endpoint.
2-The beaker that you put the NaOH in already had a small amount of distilled water in it.
3-You add a small amount of water to the conical flask containing the KHP.
4-You forget to add indicator.
5-There is an air bubble in the tip of the burette before you start the titration but it isn’t there after the titration. I'm assuming you have the sodium hydroxide in the flask and not in the burette. | {
"domain": "chemistry.stackexchange",
"id": 9928,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "experimental-chemistry, titration",
"url": null
} |
organic-chemistry, nmr-spectroscopy
Using an analogy: let's return to 2018, before the redefinition of the kilogram. At that time, the reference kilogram was defined by a block of metal; so you could say that the reference mass was the mass of that block. This is a quantity that is a fixed constant, and can't be changed. On the other hand, if I had to calibrate a new scale, the scale mass might be said to be the mass that makes the scale show $\pu{1 kg}$. It follows that the scale mass should be the same as the reference mass, for a well-calibrated scale. However, for a poorly-calibrated scale, this may differ. | {
"domain": "chemistry.stackexchange",
"id": 16048,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, nmr-spectroscopy",
"url": null
} |
javascript, jquery, css
Title: Handling multiple click events of sliding divs You are first confronted by three links. Each link triggers divs to slide out.
The divs slide out and up to appear as if unfolding. The slide back in reverse when any other link on the page is clicked. The code works exactly how we want it to. However, the code is very long and needs re-developing into a neater script.
To also help further here is the website this script belongs to demo website
$('#menu').click(function () {
if ( $('#igna-1').css('display') != 'none' ) {
$('#igna-1').slideToggle("fast", function() {
$('#igna-2').animate({ left: 'hide' }, 300, function() {
$('#black, #igna').slideUp("fast", function() {
$('#fatal').animate({ left: 'hide' }, 300);
});
});
});
} else if ( $('#fatal').css('display') == 'none' ) {
$('#fatal').animate({ left: 'toggle' }, 300, function() { | {
"domain": "codereview.stackexchange",
"id": 13856,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, css",
"url": null
} |
python, python-3.x, tkinter, pygame
Never use sleep in the main thread of a GUI
You should never use sleep because it does exactly that: it sleeps the entire application. That includes things like screen updates and the ability to respond to events.
Instead, move the code that you want to run after the sleep into a function, and call that function with after.
For example, instead of something like this:
time.sleep(seconds_to_wait) # Makes the program wait for however many seconds depending on difficulty
controller.show_frame("EnterCharacterScreen") # Displays the "EnterCharacterScreen"
entry_characters.pack(fill=tk.X, padx=10, pady=10) # How many pixels to pad widget, vertically/horizontally
button_submit.pack(fill=tk.X, padx=80, pady=80, side=tk.BOTTOM)
# How many pixels to pad widget, vertically/horizontally
entry_characters.focus_set() # Automatically clicks the entry box | {
"domain": "codereview.stackexchange",
"id": 31552,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x, tkinter, pygame",
"url": null
} |
thermodynamics, energy, entropy
In the end, the ball will have lost all its kinetic energy and will be in thermal balance with the room. It has lost all the entropy it could have lost, and that is the reason why it doesn't keep acting. If it had some entropy to lose, it would definitely keep doing something (everything happens because everything wants to provide entropy to the universe, and it cannot say no until it has completely been robbed of its entropy?). We can consider that the whole system {ball + gas + room} is isolated so that the total energy is constant through time. Even in that case where the total energy remains the same, the system can evolve towards a macrostate of higher entropy than initially. Entropy is to be understood here in the sense of the number of microstates of the system {ball + gas + room} compatible with a given macrostate. Now, the macrostate for such a system will be characterised by the velocity distribution of the center of mass of the ball and the temperature of the whole system | {
"domain": "physics.stackexchange",
"id": 32987,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, energy, entropy",
"url": null
} |
python, file, serialization, tkinter, text-editor
def setBlock(self, data, lineNum):
"""sets a block (same as getBlock but sets)"""
rawData = data.replace(" ","").split("\n")
data = []
for line in rawData:
if not line == "":
data.append(line)
if len(data) < self.height:
extra = len(data)
else:
extra = self.height
for i in range(lineNum,lineNum + extra):
self.lines[i] = data[i - lineNum]
def scrollTextUp(self, event = None):
"""Some may argue 'scrollTextDown' but
this is what happens when you press
the up arrow"""
if not self.lineNumber <= 0:
self.setBlock(self.mainText.get("1.0","end"),self.lineNumber)
self.lineNumber -= 1
self.mainText.delete("1.0","end")
self.mainText.insert("1.0", self.getBlock(self.lineNumber))
def scrollTextDown(self, event = None): | {
"domain": "codereview.stackexchange",
"id": 45362,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, file, serialization, tkinter, text-editor",
"url": null
} |
mark symbols anywhere you like, or you can use their Unicode Hex values on your web page design, or computer programing. If is not a subset of , this is written . " 66 . If the text argument to one of the text-drawing functions (text, mtext, axis, legend) in R is an expression, the argument is interpreted as a mathematical expression and the output will be formatted according to TeX-like rules. From here, you can basically navigate to the checkmark symbol we used before by selecting the Wingdings 2 font and finding the checkmark symbol. But computer can understand binary code only. For example, if A Useful Mathematical Symbols Symbol What it is How it is read How it is used Sample expression + Subset symbol is a subset of Sets A B Sets Use keyboard shortcuts. Bidi The standard way to prove "A is a subset of B" is to prove "if x is in A then x is in B". 2. Q&A for Work. since I am writing blog post that hosted by Github with Editor Atom, and use plugin markdown-preview-plus and | {
"domain": "b2bimpactdata.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9621075766298657,
"lm_q1q2_score": 0.8505408821881333,
"lm_q2_score": 0.8840392725805822,
"openwebmath_perplexity": 1008.1600993666372,
"openwebmath_score": 0.6763939261436462,
"tags": null,
"url": "http://b2bimpactdata.com/nhpcht7s/subset-symbol.html"
} |
homework-and-exercises, lagrangian-formalism, field-theory
$$ = aA^{T}_{\mu}\square A^{T}_{\mu} + aA^{T}_{\mu}\square \partial_{\mu} \pi + a\partial_{\mu}\pi \square A^{T}_{\mu} + a\partial_{\mu}\pi \square (\partial_{\mu} \pi)
+ b[A^{T}_{\mu}\partial_{\mu} \partial_{\nu}A^{T}_{\nu} + A^{T}_{\mu}\partial_{\mu} \partial_{\nu}(\partial_{\nu} \pi) + (\partial_{\mu} \pi)(\partial_{\mu} \partial_{\nu} A^{T}_{\nu}) +
(\partial_{\mu} \pi)(\partial_{\mu}\partial_{\nu} (\partial_{\nu}\pi))]
+ m^{2}[(A^{T}_{\mu})^{2} + A^{T}_{\mu}(\partial_{\mu} \pi) + (\partial_{\mu}\pi)A^{T}_{\mu} +
(\partial_{\mu}\pi)(\partial_{\mu}\pi)] $$
and then we may use $ \partial_{\mu} A^{T}_{\mu}=0$.
And this is a point that I stuck. How can we make further progress?
My question originates from following page (p.133) in the Schwartz's book: | {
"domain": "physics.stackexchange",
"id": 89403,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, lagrangian-formalism, field-theory",
"url": null
} |
ros, ros-melodic, ubuntu, callbackqueue
Let's say that we have initialized 2 different nodes inside 2 different main functions. Also assume that each of these two nodes have one subscriber each, subscribing to the topic topic_a. We also have ros::Spin() at the end of each of these 2 main functions.
In ROS 1, there is a 1-to-1 correspondence between nodes and processes.
So only a single node can "live" in a specific process (or: program).
Programs do not share any of their internal state by default, which would include any (global) variables.
You also -- by default -- cannot have "two different main functions" in a single program. The compiler will not allow you.
In my answer below I've assumed that "two different main functions" therefore means: "two different programs".
Would the callbacks corresponding to each of these 2 subscribers be pushed to the same global queue and ros::spin() call from either of the 2 nodes would spin the oldest callback from this queue? | {
"domain": "robotics.stackexchange",
"id": 37412,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-melodic, ubuntu, callbackqueue",
"url": null
} |
r, collections
Title: R Container for Multiple data.frame with a Brief Description of the Content of the data.frame For a project I have a large dataset with a multitude of variables from different questionnaires. Not all variables are required for all analyses.
So I created a preprocessing script, in which subsets of variables (with and without abbreviations) are created. However it gets confusing pretty fast.
For convenience I decided to create a index_list which holds all data.frames as well as a data.frame called index_df which holds the name of the respective data.frame as well as a brief description of each subversion of the dataset.
######################## Preparation / Loading #####################
# Clean Out Global Environment
rm(list=ls())
# Detach all unnecessary pacakges
pacman::p_unload()
# Load Required Libraries
pacman::p_load(dplyr, tidyr, gridExtra, conflicted) | {
"domain": "codereview.stackexchange",
"id": 41087,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "r, collections",
"url": null
} |
inorganic-chemistry, catalysis, radicals, environmental-chemistry, atmospheric-chemistry
Long answer:
Ozone depleting substance(ODS) are gases that take part in ozone depletion process. Most of the ODS are primarily chlorofluorocarbons(CFC) and halons that contain chlorine and bromine atoms respectively which reach the stratosphere and reacts with ozone and lead to ozone depletion. In this context, the chemical component responsible are chlorine radical (Cl·) and bromine radical (Br·). The ODS travel to the stratosphere without being destroyed in the troposphere due to their low reactivity and once in the stratosphere, the Cl and Br atoms are released from the parent compounds by the action of ultraviolet light, e.g.
$$\ce{CFCl3 ->[UV] Cl· + ·CFCl2}$$
Ozone is a highly reactive molecule that easily reduces to the more stable oxygen form by the catalytic action from the halogen radicals. Cl and Br atoms helps in destruction of ozone molecules through a variety of complex cycles. A simple cycle is as follows:
$$\ce{Cl· + O3 → ClO + O2}$$
$$\ce{ClO + O3 → Cl· + 2 O2}$$ | {
"domain": "chemistry.stackexchange",
"id": 14905,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inorganic-chemistry, catalysis, radicals, environmental-chemistry, atmospheric-chemistry",
"url": null
} |
homework-and-exercises, forces, moment
Title: How to find the shear stress and bending moments of uninform distributed load I can't for the life of me find a way to solve this.
Given is the length of a T girder, which is fixed at one and on rolled support on the other side
Now in the exercises given during class there would be a point load and a evenly distributed one, so making the shear force diagram is easy, calculate Ma and then subtract the point load once you reach it, and for the distributed load divide its force by the length of impact and subtract this for every meter and connect the dots.
For bending moments I integrate the shear force by calculating the area under the curve. Worked fine but | {
"domain": "physics.stackexchange",
"id": 50791,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, forces, moment",
"url": null
} |
c++, opengl
glVertex2i(615, 0);
glVertex2i(595, 0);
glEnd();
//
glColor3f(bc, bc, bc);
glBegin(GL_POLYGON);
glVertex2i(620, 80);
glVertex2i(650, 80);
glVertex2i(650, 0);
glVertex2i(620, 0);
glEnd();
//
glColor3f(bc, bc, bc);
glBegin(GL_POLYGON);
glVertex2i(650, 190);
glVertex2i(690, 195);
glVertex2i(690, 0);
glVertex2i(650, 0);
glEnd();
//
glColor3f(bc, bc, bc);
glBegin(GL_POLYGON);
glVertex2i(650, 190);
glVertex2i(690, 195);
glVertex2i(690, 0);
glVertex2i(650, 0);
glEnd();
//
glColor3f(bc, bc, bc);
glBegin(GL_POLYGON);
glVertex2i(690, 195);
glVertex2i(710, 195);
glVertex2i(710, 0);
glVertex2i(690, 0);
glEnd();
//
glColor3f(bc, bc, bc);
glBegin(GL_POLYGON);
glVertex2i(720, 60);
glVertex2i(760, 60);
glVertex2i(760, 0);
glVertex2i(720, 0);
glEnd();
//
glColor3f(bc, bc, bc);
glBegin(GL_POLYGON);
glVertex2i(762, 90); | {
"domain": "codereview.stackexchange",
"id": 18089,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, opengl",
"url": null
} |
Is $D^\omega$ homeomorphic to $[0,1]^\omega$, when both sets are endowed with the subspace topologies induced by $\mathbb R^\omega$ (in the product topology)?
In this case both spaces are compact ($D^\omega$ is the intersection over all $n\in \mathbb N$ of the compact sets $\{x\mid \sum_{i=1}^n |x_i| \le 1\} \cap [-1,1]^\omega$) and all topological properties I can think of are preserved when we go from $[-1,1]^\omega \cong [0,1]^\omega$ to the subspace $D^\omega$. I have also tried to explicitly construct a homeomorphism, but to no avail.
I hope some of the topologically savvy guys on this site could help me out here! Thanks =)
-
Sorry for going off-topic here: in the question on $A \subset f(B)$ you deleted your answer, but can't you massage it into a full solution using paracompactness and a partition of unity subordinate to a locally finite subcovering of $\{B \smallsetminus A\} \cup \{B_{r(a)}(a)\,:\,a \in A\}$ of $B$? – t.b. May 9 '12 at 13:44 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9859363762626284,
"lm_q1q2_score": 0.8340454230813977,
"lm_q2_score": 0.845942439250491,
"openwebmath_perplexity": 105.14891191285406,
"openwebmath_score": 0.895047664642334,
"tags": null,
"url": "http://math.stackexchange.com/questions/133443/is-0-1-omega-homeomorphic-to-d-omega"
} |
python, programming-challenge, python-3.x
def fetch_names(url):
'''Get a text file with names and return a sorted list
Parameters
----------
url : str
url of a text file at Project Euler.
Returns
-------
alphabetically sorted list of first names
'''
r = requests.get(url)
# r.text is a string with names
# the names are in capital letters, enclosed in double quotes
# and separated by commas
names = [name.strip('"') for name in r.text.split(',')]
return sorted(names)
def calculate_name_score(pos, name):
'''
Calculate the "name sore" of a name at a specific position in a list
Parameters
----------
pos : int
zero-based index of a name in a list
name : str
name in CAPS
Returns
-------
name_score : int
''' | {
"domain": "codereview.stackexchange",
"id": 17653,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, programming-challenge, python-3.x",
"url": null
} |
image-processing, computer-vision, local-features, visual-tracking
Title: Purpose of image feature detection and matching I'm a new guy in image processing and computer vision, so this question might be stupid to you.
I just learned some feature detection and description algorithms, such as Harris, Hessian, SIFT, SURF, they process images to find out those keypoints and then compute a descriptor for each, the descriptor will be used for feature matching.
I've tried SIFT and SURF, found that they are not so robust as I thought, since for 2 images (one is rotated and affined a little), they don't match the features well, among almost 100 feature points, only 10 matches are good.
So I wonder | {
"domain": "dsp.stackexchange",
"id": 1244,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "image-processing, computer-vision, local-features, visual-tracking",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.