text stringlengths 1 1.11k | source dict |
|---|---|
c++, beginner, programming-challenge, array
The visit vector grows “indefinitely” – until the program aborts with
a memory failure.
Fortunately, this can be fixed easily: It is irrelevant for the flood-fill
algorithm which room a field belongs to, only if it has been visited or not.
So instead of assigning the counter value, assign some character (different
from '.' and '#'). Even better, use constants
const char emptyField = '.';
const char visitedField = 'X';
and use them like
if (house[row][column] == emptyField) {
house[row][column] = visitedField;
// ...
}
Some simplifications
You are using a “vector of vectors” to store the list of row/column pairs
of fields which still have to be visited. A “vector of pairs” would be more
appropriate, and requires less memory allocations.
Use an auto variable instead of casting the return value of vector::size():
for (auto i = 0; i < visit.size(); i++) { ... | {
"domain": "codereview.stackexchange",
"id": 31351,
"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++, beginner, programming-challenge, array",
"url": null
} |
javascript, php, html, sql
<?php
$host = "localhost";
$user = "user";
$pass = "pass";
$db = "db";
$mysqli = new mysqli($host, $user, $pass, $db);
if (mysqli_connect_errno()) {
die("Unable to connect.");
}
$show_all = "select Name, PhoneNumber, PhoneType, person.PersonID from person,phone where person.PersonID = phone.personID";
$listquery = $show_all;
msg_info("Displaying all entries.");
$name = trim($_POST["name"]);
$phone = trim($_POST["phone"]);
$phonetype = trim($_POST["phonetype"]);
$action = trim($_POST['actions']);
if ($btn = $_POST['btn']) {
switch ($action) {
case ('viewall'):
$listquery = $show_all;
msg_info("Displaying all entries.");
break;
/* --------------------------------------------------------------- */
case ('add'):
if (! ($name or $phone)) {
msg_warn("Enter a name and/or number to add.");
break;
} | {
"domain": "codereview.stackexchange",
"id": 39831,
"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, php, html, sql",
"url": null
} |
filter-design, infinite-impulse-response, finite-impulse-response
Title: Is there a way to derive an FIR filter using an IIR filter? I know there's a thread similar to this one here, but the OP is asking the reverse of what I'm trying to find here. I've done some research on the web with very few sources coming up with actual solutions to this problem. What techniques are used to give an approximation of an FIR filter given one or more IIR filters with say the same order? Approximating the frequency response of an IIR filter or physical process using an FIR filter is useful in learning control. It is quite common to do FIR filter design based on frequency response specifications. You probably want to check out two standard papers on the subject:
[1] J. H. McClellan, T. W. Parks, and L. R. Rabiner, “A computer program for designing optimum FIR linear phase digital filters,” IEEE Trans. Audio Electroacoust., vol. 21, no. 6, pp. 506–526, 1973. | {
"domain": "dsp.stackexchange",
"id": 4496,
"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": "filter-design, infinite-impulse-response, finite-impulse-response",
"url": null
} |
c++, memory-management, thread-safety, c++17
Alignment problems
Your test case appeared to work because you didn't actually test the problem. Bar is supposed to be 64-bit aligned. You never actually tested whether it was. And it isn't. See here: http://cpp.sh/8w5ti (Note, the function push() there should really be called emplace().)
Normally a type's size is >= its alignment. But it is possible to create types whose alignment is >= their size. If you try to put those objects in one of your pools, it will "work", but you're in undefined behaviour territory. Who knows what will happen next: an access violation or corrupted memory are both likely possibilities.
Using sizeof(T) will work for most objects. But to be really safe, you should probably use max(sizeof(T), alignof(T)). I have edited the notes above to take into account every edge case I can think of.
Forward ref problems | {
"domain": "codereview.stackexchange",
"id": 30871,
"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++, memory-management, thread-safety, c++17",
"url": null
} |
reinforcement-learning, q-learning, python, intelligent-agent, state-spaces
If you can come up with a model that has only very few (say ~50) parameters, IMO just throw it at CMA-ES.
The question here is again how to represent the agent's inputs. Now you have the advantage that the agent can have any state/memory it wants, for example for tracking the other agent's history. (In the MDP setup, only the environment can have state/memory.) You could use a neural network, RNN, or even add a few to-be-optimized parameters that decide what goes into the memory, and what is taken out.
You may also be able to use a policy gradient (reinforcement learning) method, especially if you use a NN, and thus avoid black-box optimization and instead do gradient descent (usually faster, if applicable). | {
"domain": "ai.stackexchange",
"id": 3529,
"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": "reinforcement-learning, q-learning, python, intelligent-agent, state-spaces",
"url": null
} |
species-identification, entomology, species, arachnology
Title: What kind of spider is this and is it dangerous? Found this spider on my couch the other day in Steubenville, Ohio. The spider is about 1 - 1.5'' (2.5 - 4 cm) long. The spider looks brownish in the image, but tends to a pale yellow color in reality. That's a nice female Nursery Web Spider, related to the Fishing Spiders. They're rather pretty animals, and like almost all spiders, quite harmless to anything that's too big to eat. The very rectangular cephalothorax ('head' end) pattern and the simple wavy line down the abdomen are the key clues for this one. They also like to sit with the front legs arranged in pairs.
https://bugguide.net/node/view/2919/bgimage | {
"domain": "biology.stackexchange",
"id": 8042,
"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": "species-identification, entomology, species, arachnology",
"url": null
} |
Case 1: $U\cap D=\emptyset$. Since $D$ is open, we also have that $\bar{U}$ is disjoint from $D$.
By the basic observation, the boundary of $U$ is contained in $E$, hence, $\bar{U}\cap E\ne\emptyset$, thus, $\bar{U}\cup E$ is connected and disjoint from $D$. Thus, $\bar{U}\subset E$ (since $E$ was a component of $D^c$). This is a contradiction since $U\cap E=\emptyset$.
Case 2: $D\subset U$, hence, the boundary of $D$ is contained in the closure of $U$. Hence, $U$ contains the boundary of $\Omega$ and, thus, $\Omega\cap U\ne\emptyset$ and, therefore, $\Omega\cup U$ is connected and is disjoint from $E$. Since $U$ was a component of $E^c$, it follows that $\Omega\subset U$ and, therefore, $U$ is unbounded.
Thus, we conclude that all components of $E^c$ are unbounded. qed | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429125286726,
"lm_q1q2_score": 0.8030389834883267,
"lm_q2_score": 0.8152324871074608,
"openwebmath_perplexity": 143.31200551530904,
"openwebmath_score": 0.9633830189704895,
"tags": null,
"url": "https://math.stackexchange.com/questions/2415064/bounded-components-of-complement-of-bounded-planar-domain-are-simply-connected"
} |
# square root of a real matrix
I want to compute the square root of a real symmetric positive definite matrix $S\in \mathcal{M}_{m,m}$ such that $S^{1/2}S^{1/2}=S$ and it's well known that this decomposition is unique.
My question is if I have $S$ a real matrix will its square root be real too or it could be a complex matrix. In case that it could be complex then $S$ could have infinitely many square roots.
• Note that the answer by user1551 shows that the statement above needs the requirement that $S^{1/2}$ is positive (semi-)definite in order for the uniqueness claim to hold. If you are asking about possible complex positive definite square roots, then you should first make precise what exactly that means (usually "positive definite" implies real symmetric, but allowing complex Hermitian matrices is a possibility). If you don't want the positive definite requirement, infinitely many real and complex solutions may exist. Apr 4, 2013 at 5:11 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9683812327313545,
"lm_q1q2_score": 0.8090665795703942,
"lm_q2_score": 0.8354835391516133,
"openwebmath_perplexity": 152.0680003525417,
"openwebmath_score": 0.9148877263069153,
"tags": null,
"url": "https://math.stackexchange.com/questions/313564/square-root-of-a-real-matrix"
} |
fluid-dynamics, flow, turbulence
To address a subtlety in your question: laminar flow becomes turbulent with an increase in distance from the leading edge because the effect of fluid viscosity is progressive. Imagine the passing fluid being comprised of three adjacent layers - inner, middle and outer. The three layers in the stream reach the edge simultaneously. As the inner layer begins to flow over the surface, viscous forces slow it. However, the effect is not instantaneous; it must interact with the surface over some distance before it reaches its lowest velocity. The middle layer is then affected by viscous forces from the relative difference of the velocities of the two layers, inner and middle. Once again, the effect is not instantaneous. Finally, the outer layer is affected by viscous forces due to its difference with the middle. The result of these interactions is a boundary layer with a parabolic profile, compact at the end and broadening the further it travels from the leading edge. By comparison, a pipe | {
"domain": "physics.stackexchange",
"id": 31603,
"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": "fluid-dynamics, flow, turbulence",
"url": null
} |
-
So, the better the book sells, the less helpful it will be? – DJohnM Aug 14 '13 at 22:21
@User58220 LOL, well, the harder it will be to find the constraints that will maintain your low sharing probability – Schollii Aug 15 '13 at 14:31
I think the source of the confusion is that human intuition lends itself to some very fallacious reasoning when it comes to probability (and large numbers). The fallacy is this, your intuition groups numbers into two categories: "nice" numbers, and not-so-nice numbers. Suppose we call a "nice number" any number that is just a full sequence of repeated digits. By all means, the probability of getting a nice number is far smaller than the probability of getting a not-so-nice number. Extend this to any number that "stands out" to our perception, and they're still outnumbered by numbers that don't.
The problem with that is, we're not choosing between $2$ "categories", but in fact $10^7$ outcomes.
-
Your feeling is incorrect, but there is more to it. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9678992905050948,
"lm_q1q2_score": 0.818787088638337,
"lm_q2_score": 0.8459424411924673,
"openwebmath_perplexity": 691.0271739476518,
"openwebmath_score": 0.6561347842216492,
"tags": null,
"url": "http://math.stackexchange.com/questions/467575/should-i-put-number-combinations-like-1111111-onto-my-lottery-ticket?answertab=active"
} |
knowrob
Originally posted by moritz with karma: 2673 on 2011-10-21
This answer was ACCEPTED on the original site
Post score: 3
Original comments
Comment by moritz on 2011-12-07:
Update: These components have been released as part of knowrob-0.2.0 and are now publicly available in the official KnowRob distribution. | {
"domain": "robotics.stackexchange",
"id": 7042,
"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": "knowrob",
"url": null
} |
c++, statistics
Don't forget to default your constructor:
number_bag() = default;
Don't do this please:
size_t m_size;
FloatingPoint m_sum;
FloatingPoint m_square_sum;
It may look nice, but if you ever add more members, or remove one, it can possibly become a maintenance problem.
That private is unnecessary, the default access specifier for a class is already private:
class number_bag {
/*private*/
size_t m_size;
FloatingPoint m_sum;
FloatingPoint m_square_sum;
Mark functions that should not throw noexcept. This helps the compiler optimize if you compile with exceptions.
Use std::move to avoid unnecessary copies:
number_bag(size_t size, FloatingPoint sum, FloatingPoint square_sum) :
m_size{size},
m_sum{std::move(sum)},
m_square_sum{std::move(square_sum)} {} | {
"domain": "codereview.stackexchange",
"id": 25392,
"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++, statistics",
"url": null
} |
Question : It seemed like a rather hard exercise to me so I am not sure if my proof/approach is definitely correct or rigorous enough. Any insight will be very helpful !
• from the inequality $\| T(x) \|_Y \leq \sum_{k=1}^{n} |a_k| \| T(e_k) \|_Y$ the proof is almost done because clearly $\|T(x)\|_Y<\infty$, so you have a linear operator that map bounded sets to bounded sets, what is the definition of bounded linear operator. – Masacroso Nov 3 '18 at 16:22
• @masacroso True ! I just tried to finish it to have the standard bounded form. – Rebellos Nov 3 '18 at 16:32
• @Masacroso: "bounded" is not a magical word. The notion of "bounded" depends on a metric. It is not obvious that different metrics will give you the same bounded sets. It does work for metrics given by norms on a finite-dimensional space, because of the nontrivial fact that all norms are equivalent, as used by the OP. – Martin Argerami Nov 4 '18 at 19:14 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9861513926334711,
"lm_q1q2_score": 0.8108029474791474,
"lm_q2_score": 0.822189121808099,
"openwebmath_perplexity": 484.679915022091,
"openwebmath_score": 0.9999325275421143,
"tags": null,
"url": "https://math.stackexchange.com/questions/2983050/every-linear-operator-tx-to-y-on-a-finite-dimensional-normed-space-is-bounde"
} |
u1 +u2 +u3 +… + un. 2.The magnitude of position vector and direction . Show that the magnitude of their resultant is : r = a 2 + b 2 + 2 a b cos. . The vector from their tails to the opposite corner of the parallelogram is equal to the sum of the original vectors. Vector spaces have two specified operations: vector addition and scalar multiplication. Commutative law of addition. Your diagram should look like a … You can utilize this Addition Of Vectors formula sheet while doing your homework and board exams preparation. = tan-1 [A sinθ/(B+A cosθ)] The sum of several vectors u1, u2, u3,… is called the vector w resulting from the sequential addition of these vectors. Triangular law of vector addition. So, we have. Statement “When two vectors are represented by two sides of a triangle in magnitude and direction were taken in the same order then the third side of that triangle represents in magnitude and direction the resultant of the vectors.” 3. Vector Formulas Components Magnitude or | {
"domain": "umb.sk",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9693241956308277,
"lm_q1q2_score": 0.8180079414804768,
"lm_q2_score": 0.8438951025545426,
"openwebmath_perplexity": 575.4111837278356,
"openwebmath_score": 0.7423794269561768,
"tags": null,
"url": "http://www.etap.umb.sk/vzq70p/2c73f1-vector-addition-formula"
} |
complexity-theory, graphs
Since this seems like a homework problem, I don't want to actually give the solution here. What you need to do is find a way of transforming the Stable-Set problem into the Vertex-Cover problem. That way, any solution to Vertex-Cover would be a solution to Stable-Set, so VC is at least as hard as SS. After that, you need to show that VC (note that you need to work with the decision version of VC and SS, which asks does there exists a VC/SS of size k) is in NP by showing that given a witness, you can check if it's correct or not. | {
"domain": "cs.stackexchange",
"id": 1395,
"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": "complexity-theory, graphs",
"url": null
} |
of a parabola. State the vertex, State the y-intercept, Indicate if there is a maximum or minimum value and give the value. The coordinates are: (-1, -4) If the vertex is the maximum point as shown in the graph of , you only need to change one step. How to use vertex in a sentence. Then, use your calculator to find the time it will take for the ball to hit the ground (check). Scleral Lens Options; Presbyopic Options; Special Lens Options; Single Vision Options; Fitting Tools. Because we had two $$x$$-intercepts for this parabola we already have at least one point on either side of the vertex and so we don't really need to find any more points for our graph. Using the Graphing Calculator to Find the Vertex and Solve Quadratics. It can be in any orientation in its plane and approximately U-shaped. So I have three points and I would like matlab to plot them as a parabola. com; Thesaurus. Our quadratic equations calculator lets you find the roots of a quadratic equation. The vertex of any | {
"domain": "psychotherapie-im-schloss.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822877012965885,
"lm_q1q2_score": 0.8206852011205793,
"lm_q2_score": 0.8354835350552603,
"openwebmath_perplexity": 483.2046075812748,
"openwebmath_score": 0.43395131826400757,
"tags": null,
"url": "http://yiob.psychotherapie-im-schloss.de/parabola-vertex-calculator.html"
} |
filters, filter-design, finite-impulse-response, least-squares, parks-mclellan
A very high dynamic range filter is another example where the least squares algorithm (at least for the implementation in Python and Octave I could not get a stop band rejection lower than -180 dB; well surpassing this was no issue with a filter designed with the Kaiser window). This led me to further questions as detailed here. I agree that the windowing filter design method is not one of the most important design methods anymore, and it might indeed be the case that it is overrepresented in traditional textbooks, probably due to historical reasons. | {
"domain": "dsp.stackexchange",
"id": 10792,
"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": "filters, filter-design, finite-impulse-response, least-squares, parks-mclellan",
"url": null
} |
java, design-patterns, android
Use Strings.xml also in the checkForInput method. You're using it at other places, but you should use it everywhere possible (Except for Log.d stuff)
Use an ENUM type instead of unitName.equals(...)
public enum UnitType {
AREA, ANGLE, LENGTH, SPEED, TEMPERATURE, TIME, VOLUME, WEIGHT;
}
Remember that enums can have constructors and methods in Java! Look at Oracle's Planet example. Take a look at Oracle's tutorial for an example on how enums can be used.
Then you can use a switch on the enum, or compare using ==.
It's unclear how the ratio is being used. It looks like a whole bunch of magic numbers to me.
Consider adding a comment where you're initializing it to explain it better. | {
"domain": "codereview.stackexchange",
"id": 8134,
"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, design-patterns, android",
"url": null
} |
javascript, node.js, promise
Title: NodeJS promise loop through all files in directory I am trying to re-organise my mp3 collection based on its id3 meta data into folders based on the artist. I'm new to nodeJs and more importantly promises. I was hoping I could get some feedback on my script. I can manage the creating of folders and copying of files quite easily, but I'm a little unsure on the async reading and looping part (shown below).
It does run, but almost crashes my computer when I run it on the full directory.
Thanks in advance for any suggestions or advice.
const fs = require('fs');
const NodeID3 = require('node-id3-promise')
const util = require("util");
const testFolder = '/home/james/Music';
const reorderedFolder = '/home/james/Music/reordered'; | {
"domain": "codereview.stackexchange",
"id": 40316,
"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, promise",
"url": null
} |
electromagnetism, magnetic-fields, terminology, vector-fields, visualization
This particular example is taken from Why iron filings sprinkled near a bar magnet aggregate into separated chunks? The iron filings line up in the direction of the magnetic field and this nicely shows us what the field looks like.
Your magnetic field viewing film works in a similar way. It contains flakes of nickel that line up with the field in the same way as the iron filings, and this produces a pattern that shows us what the field looks like.
The magnetic field is certainly real, and it has a direction at every point in space, but the field lines are just lines that trace out the direction of the field. They are no more real than contour lines on a map are real. | {
"domain": "physics.stackexchange",
"id": 89658,
"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, terminology, vector-fields, visualization",
"url": null
} |
python, game, python-3.x, pyqt
used
for key in {Qt.Key_Left, Qt.Key_Right,
Qt.Key_Up, Qt.Key_Down}:
xy = self.prepareGoto(exceptColours, key, obstacles, squares)
which is self explanatory inside code)
4) Yet again beautiful dictionary mapping in def prepareGoto():
x, y = self.xy
moves_map = {Qt.Key_Up: (x, y-1),
Qt.Key_Down: (x, y+1),
Qt.Key_Left: (x-1, y),
Qt.Key_Right: (x+1, y)
}
xy = moves_map[key]
5) And the second part of def prepareGoto() also looks more readable since try: except statements handle exactly one operation:
# Prevent movement outside the field bounds
try:
target_square = squares[xy]
except KeyError:
return None
# Prevent movement in other players. Can be replaced with
# or statement, but that looks ugly and might be a bit slower that elif.
if xy in obstacles:
xy = None
elif target_square.colour in exceptColours:
xy = None
return xy | {
"domain": "codereview.stackexchange",
"id": 22242,
"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, game, python-3.x, pyqt",
"url": null
} |
Let $X_1, X_2, \ldots, X_{n-1}$ be standard normal random variables (mean zero, variance one). Let $$X_n = - \sum_{i=1}^{n-1} X_i.$$ Note that $X_n$ is normally distributed with mean zero and variance $n-1$. We have $$\sum_{i=1}^n X_i = 0$$ Exponentiating both sides, we have $$\exp\left(\sum_{i=1}^n X_i\right) = \prod_{i=1}^n e^{X_i} = 1$$ Let $Y_i = e^{X_i}$, and we have $$\prod_{i=1}^n Y_i = 1$$ as requested. The variables $Y_i$ are log-normally distributed.
This is the simplest way to get your desired result, but there are other ways too. For example, you could subtract off $\tfrac{1}{n} \sum_{j=1}^n X_j$ from each $X_i$, which would yield identically distributed (but not independent) variables that sum to zero. More precisely, let $$X'_i = X_i - \frac{1}{n} \sum_{j=1}^n X_j$$ then we have $$\sum_{i=1}^n X'_i = \sum_{i=1}^n X_i - n\left(\frac{1}{n} \sum_{j=1}^n X_j\right) = 0$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9678992923570262,
"lm_q1q2_score": 0.8001737666628275,
"lm_q2_score": 0.8267118004748677,
"openwebmath_perplexity": 257.7359674920499,
"openwebmath_score": 0.8082589507102966,
"tags": null,
"url": "https://stats.stackexchange.com/questions/224278/which-distribution-has-an-expected-product-equal-to-one"
} |
java, reflection, lookup
6) Set up a logger instead of System.out -> That way you can keep the debug level logs for later use if they needed.
7) JPA does not require that each field is annotated. This might cause some trouble on the long run. You could check how OpenJPA deals with this. They have their own FieldMetaData implementation that has a method setManagement that is used to signal if the field is persistent, transactional or not managed. This value is later used in ClassMetaData to return only those field that are managed. I actually got bored before finding the right place where setManagement is called but that it shouldn't be too hard to google.
8) I assume you have made an intentional decision not to think about the ability to use annotated getters instead of fields.
Disclaimer None of the code is tested | {
"domain": "codereview.stackexchange",
"id": 616,
"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, reflection, lookup",
"url": null
} |
python, inheritance
This setup is meant to allow Derived to inherit, without code duplication, the functionality provided by Base.
I designed the LibWrapper and ExtendedLibWrapper as an independent hierarchy of classes because there are multiple Base/Derived pairs.
Example:
#!/usr/bin/env python3 | {
"domain": "codereview.stackexchange",
"id": 37489,
"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, inheritance",
"url": null
} |
javascript, html, css
It should highlight the current page link in the navigation bar. querySelectorAll
Here's another approach, if you don't mind older browsers. You can use querySelectorAll instead of document.links. That way, you end up with a smaller result set rather than all links, and save you CPU cycles for running the loop.
In this case, we get only those links that have the same href value as the current document url:
var links = document.querySelectorAll('a[href="'+document.URL+'"]'); | {
"domain": "codereview.stackexchange",
"id": 5523,
"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, css",
"url": null
} |
quantum-gate, density-matrix
Title: how to know the appropriate time to know the SWAP gate operation in dipole interaction Consider dipole-dipole interaction between two qubits,$H_{int} = g \boldsymbol\sigma_{1}\cdot\boldsymbol\sigma_{2}=g(X_1X_2+Y_1Y_2+Z_1Z_2)$. How can I show that by turning on this interaction for an appropriate time, $U = \exp(−iH_{int}t_s)$, obtains a SWAP gate. And how we can find the value of $t_s$ in terms of $g$. I will suppose that you meant: $H_{\rm int}=g(X_1X_2+Y_1Y_2+Z_1Z_2)$ (it is unclear as you did not define your notation).
If you want to calculate:
$$U(t)=\exp[-i g t (X_1X_2+Y_1Y_2+Z_1Z_2)],$$
in that case note that $[X_1X_2,Y_1Y_2]=[Y_1Y_2,Z_1Z_2]=[X_1X_2,Z_1Z_2]=0$, so we can separate the exponential as
$$U(t)=\exp[-i g t X_1X_2]\exp[-i g t Y_1Y_2]\exp[-i g t Z_1Z_2]=R_{xx}(2tg)R_{yy}(2tg)R_{zz}(2tg)$$
where $R_{ii}$ are the Ising rotation gates. From Wikipedia Quantum logic gates iSWAP you know that
$$i\mathrm{SWAP}=R_{xx}(-\pi/2)R_{yy}(-\pi/2),$$ | {
"domain": "quantumcomputing.stackexchange",
"id": 3180,
"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-gate, density-matrix",
"url": null
} |
java, object-oriented, statistics, data-mining
if (length % 2 == 0) {
return (double) (numbers[length / 2] + numbers[(length / 2) + 1]) / 2;
} else {
return numbers[(length + 1) / 2];
}
}
/**
* Work like {@link #median(int...)}
*/
public static double median(float... numbers) {
Objects.requireNonNull(numbers, "numbers must not be null");
int length = numbers.length;
if (length == 0) {
return Double.NaN;
}
Arrays.sort(numbers);
if (length % 2 == 0) {
return (double) (numbers[length / 2] + numbers[(length / 2) + 1]) / 2;
} else {
return numbers[(length + 1) / 2];
}
}
// after consider feedbacks
// https://codereview.stackexchange.com/questions/172184/general-java-class-to-find-mode | {
"domain": "codereview.stackexchange",
"id": 26833,
"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, object-oriented, statistics, data-mining",
"url": null
} |
# Dyalog APL, 15 bytes
(+/÷⍴)∘∊1=⍳∘.∨⍳
Pretty straightforward. It's a monadic function train. Iota is the numbers from 1 to input, so we take the outer product by gcd, then count the proportion of ones.
# Octave, 49 47 bytes
Just calculating the gcd of all pairs and counting.
@(n)mean(mean(gcd(c=kron(ones(n,1),1:n),c')<2))
The kronecker product is awesome.
• kron! Good idea! – Luis Mendo Dec 27 '15 at 4:22
• I first used meshgrid, but then I noticed I could do the same with kron inline! (->anonymous function) – flawr Dec 27 '15 at 9:31
## Sage, 55 bytes
lambda a:n((sum(map(euler_phi,range(1,a+1)))*2-1)/a**2)
Thanks to Sage computing everything symbolically, machine epsilon and floating-point issues don't crop up. The tradeoff is, in order to follow the output format rule, an additional call to n() (the decimal approximation function) is needed.
Try it online | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9664104967684475,
"lm_q1q2_score": 0.8135491362002469,
"lm_q2_score": 0.8418256412990657,
"openwebmath_perplexity": 3691.9333193422767,
"openwebmath_score": 0.5103477835655212,
"tags": null,
"url": "https://codegolf.stackexchange.com/questions/67773/co-primality-and-the-number-pi/71027"
} |
a path from $$w$$ to $$v$$. Web into a graph, we will treat a page as a vertex, and the hyperlinks LEVEL: Medium, ATTEMPTED BY: 418 away from the CS home page. are similar on some level. The strongly connected components will be recovered as certain subtrees of this forest. is, if there is a directed edge from node A to node B in the original the Internet and the links between web pages. graph then $$G^T$$ will contain and edge from node B to node A. This is the program used to find the strongly connected components using DFS algorithm also called Tarjan’s Algorithm. Sign up. components are identified by the different shaded areas. ACCURACY: 83% Hi All. In the mathematical theory of directed graphs, a graph is said to be strongly connected if every vertex is reachable from every other vertex. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. Notice that the graph in Figure 31: | {
"domain": "brandhome.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9736446448596305,
"lm_q1q2_score": 0.845928542955405,
"lm_q2_score": 0.8688267813328976,
"openwebmath_perplexity": 682.6030261600721,
"openwebmath_score": 0.4783529043197632,
"tags": null,
"url": "https://museum.brandhome.com/pros-and-kbh/e70454-strongly-connected-components-example-problems"
} |
python, numpy, pandas, machine-learning
Title: Set of one-hot encoders in Python In the absence of feature-complete and easy-to-use one-hot encoders in the Python ecosystem I've made a set of my own. This is intended to be a small library, so I want to make sure it's as clear and well thought out as possible.
I've implemented things from a previous question concerning only the base encoder, but also expanded it to two separate use cases. Also, let me know if this is not a place for such lengthy code and I'll narrow it down.
I would especially like to know if this is publishable code. So any criticism, on functionality, style or anything is greatly appreciated. Make it harsh too.
import numpy as np
import pandas as pd
class ProgrammingError(Exception):
"""
Error caused by incorrect use or sequence of routines.
"""
class OneHotEncoder:
"""
Simple one-hot encoder. | {
"domain": "codereview.stackexchange",
"id": 33201,
"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, pandas, machine-learning",
"url": null
} |
slam, navigation, eigen, rosdep, ros-fuerte
Title: rgbdslam with ROS fuerte installed
Hi, I am using rgbdslam on a Ubuntu 11.10 machine, with ROS fuerte installed. I follow the tutorial(http://www.ros.org/wiki/rgbdslam),
but when I type:
dong@dong-Inspiron-N5110:~/fuerte_workspace/sandbox$ rosdep install rgbdslam
there is a bug:
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
rgbdslam: Missing resource eigen
ROS path [0]=/opt/ros/fuerte/share/ros
ROS path [1]=/home/dong/fuerte_workspace/sandbox
ROS path [2]=/home/dong/ros
ROS path [3]=/home/dong/ros
ROS path [4]=/opt/ros/fuerte/share
ROS path [5]=/opt/ros/fuerte/stacks
Is rgbdslam not available for fuerte? How can I make it work?
By following Allenh1's answer, I solved a question but encounter another question:
dong@dong-Inspiron-N5110:~$ rosdep install rgbdslam | {
"domain": "robotics.stackexchange",
"id": 10227,
"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": "slam, navigation, eigen, rosdep, ros-fuerte",
"url": null
} |
College Trigonometry Version bˇc Corrected Edition by Carl Stitz, Ph.D. Je Zeager, Ph.D. Lakeland Community College Lorain County Community College July 4, 2013. ii Acknowledgements While the cover of this textbook lists only two names, the book as it stands today would simply not exist if not for the tireless work and dedication of several people. Trigonometry; Term 1 Revision; Algebraic Functions; Trigonometric Functions; Euclidean Geometry (T2) Term 2 Revision; Analytical Geometry; Finance and Growth; Statistics; Trigonometry; Euclidean Geometry (T3) Measurement; Term 3 Revision; Probability; Exam Revision; Grade 11. Introduction to Sin, Cos and Tan This video covers the fundamental definitions of the trigonometry. 0000001523 00000 n Choose the best answer. Version 575 Download 163.33 KB File Size 1 File Count June 17, 2020 Create Date June 17, 2020 Last Updated File Action; Gr 11 Aug 2018 Toets Trig HS Hermanus.pdf: Download : Grade 11 Test & Memo Term 1 Quadratic equations Grade | {
"domain": "statesindex.org",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9715639636617015,
"lm_q1q2_score": 0.8277266356549429,
"lm_q2_score": 0.8519527963298947,
"openwebmath_perplexity": 5287.249423826645,
"openwebmath_score": 0.4615281820297241,
"tags": null,
"url": "https://statesindex.org/ek-niranjan-yhftk/trigonometry-test-pdf-cbf37a"
} |
type-theory, calculus-of-constructions
As far as sane variable rules go, the one you quoted works well when variables are symbols and contexts are maps taking symbols to their types. If you indent to use de Bruijn indices, then you should use different variable rules (note that contexts are just lists of types because variable names are just natural numbers):
$$
\frac{ }{\Gamma, A \vdash \mathtt{var}_0 : A}
\qquad
\frac{\Gamma \vdash \mathtt{var}_k : B}{\Gamma, A \vdash \mathtt{var}_{\mathtt{succ}(k)} : B}$$ | {
"domain": "cstheory.stackexchange",
"id": 5114,
"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": "type-theory, calculus-of-constructions",
"url": null
} |
newtonian-mechanics, rotational-dynamics, simulations, moment-of-inertia
The situation might look something like this now:
Note that the motor joint has a different angle, because the motor moved in the meantime. The static joint has a different angle as well, because the motor applies a force to both rods it is attached to. But before and after the motor movement, all velocities are zero.
Now, given α, β, γ' and all the mass information, how can I calculate α' (or β')?
It's fine if the formula assumes that the difference between γ and γ' is very small.
I already tried to figure this out on my own with derivations of the double pendulum formulas on the internet, but I don't know how to deal with the motor joint in those formulas.
I also implemented that situation in a 2D physics engine (box2d) and tried to deduce the formula in that simulation "experimentally", but couldn't figure it out. You would not be able to find an analytic formula for the angles for this highly dynamic system. | {
"domain": "physics.stackexchange",
"id": 91012,
"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": "newtonian-mechanics, rotational-dynamics, simulations, moment-of-inertia",
"url": null
} |
fluid-dynamics, shock-waves
Title: Unsteady Rankine-Hugoniot relations. Is it applicable? For a unsteady normal shock moving in a medium, the Rankine-Hugoniot relations can be derived, by converting the problem into a steady by fixing the frame of reference on the shock.
This idea is easy to follow, given the shock is uniform and steady, meaning the shock strength ($\rho_2/\rho_1$) does not change with time.
Recently, I came across a relation for density and velocity as a function of time for a shock whose pressure jump decays exponentially with time. How can one derive this?
\begin{align}
\rho(t)&=\rho_0\frac{(\gamma+1)p(t)+2\gamma p_0}{(\gamma-1)p(t)+2\gamma p_0} \\
u(t)&=\sqrt{\frac{2}{\gamma p_0}}\frac{a_0p(t)}{\sqrt{(\gamma+1)p(t)+2\gamma p_0}}
\end{align} Background
The link to the dissertation you provided gives a derivation in Appendix A through the following steps.
First, start with the general Rankine-Hugoniot relations for a simple normal incidence hydrodynamic shock wave, where:
$$ | {
"domain": "physics.stackexchange",
"id": 26669,
"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": "fluid-dynamics, shock-waves",
"url": null
} |
A variant of the same basic idea is to let $\mathscr{I}$ be the set of open intervals that are subsets of $U$. For $I,J\in\mathscr{I}$ define $I\sim J$ iff there are $I_0=I,I_1,\dots,I_n=J\in\mathscr{I}$ such that $I_k\cap I_{k+1}\ne\varnothing$ for $k=0,\dots,n-1$. Then $\sim$ is an equivalence relation on $\mathscr{I}$. For $I\in\mathscr{I}$ let $[I]$ be the $\sim$-class of $I$. Then $\left\{\bigcup[I]:I\in\mathscr{I}\right\}$ is a decomposition of $U$ into pairwise disjoint open intervals.
Both of these arguments generalize to any LOTS (= Linearly Ordered Topological Space), i.e., any linearly ordered set $\langle X,\le\rangle$ with the topology generated by the subbase of open rays $(\leftarrow,x)$ and $(x,\to)$: if $U$ is a non-empty open subset of $X$, then $U$ is the union of a family of pairwise disjoint open intervals. In general the family need not be countable, of course. | {
"domain": "mathzsolution.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9902915217993689,
"lm_q1q2_score": 0.8315814227949403,
"lm_q2_score": 0.8397339616560072,
"openwebmath_perplexity": 63.86023884268071,
"openwebmath_score": 0.9187157154083252,
"tags": null,
"url": "https://mathzsolution.com/any-open-subset-of-bbb-r-is-a-countable-union-of-disjoint-open-intervals/"
} |
biochemistry, enzymes
Unfair to the Instructor?
Bringing in the monophosphate, glucose 6-phosphate seems rather a pretext to introduce a story about glyoxal. But perhaps I am being unfair. Let us presume he is well aware of the need for two molecules of triose phosphate and is taking it for granted that the triose resulting from the “top” half of the hexose (C1 to C3) will be phosphorylated after an appropriate aldolase reaction. I am not going to say this would be unviable or inferior (although that is possible) but if such a strategy had been developed, surely the triose phosphate formed would no longer be suitable for conversion to glyoxal.
Don’t ask questions in answers | {
"domain": "chemistry.stackexchange",
"id": 16844,
"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": "biochemistry, enzymes",
"url": null
} |
javascript, node.js, promise, express.js
var getUser = function(token) {
return new Promise(function(resolve, reject) {
jwt.verify(token, req.app.config.api.secret, function(err, decoded) {
if (err) return reject(err);
else resolve(decoded);
});
});
};
var getEvents = function(user) {
return new Promise(function(resolve, reject) {
req.app.db.getConnection(function(err, connection) {
if (err) return reject(err);
connection.query(EVENT_QUERY, user.id, function(err, events) {
if (err) return reject(err);
else resolve(events);
});
connection.release();
});
});
};
validateEmptyFields()
.then(getUser)
.then(getEvents)
.then(function(events) {
results.events = events;
}, function(err) {
errors.push(err);
})
.finally(function() {
res.json({
results: results,
errors: errors
});
});
}; | {
"domain": "codereview.stackexchange",
"id": 18139,
"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, promise, express.js",
"url": null
} |
fluid-dynamics, friction
Some interesting background reading are
http://en.wikipedia.org/wiki/Rayleigh_flow (this is where the pipe loses heat to the surroundings and the temperature of the air is constant over the length of the pipe) and also http://en.wikipedia.org/wiki/Fanno_flow (the pipe is insulated, so the temperature of the air rises along the length of the pipe).
Understanding Rayleigh and Fanno flow will give you lots of interesting insightsand will tell you about the qualitative nature of the effects (e.g. in Fanno flow, the Mach number of the air will be 1.0 along the entire length of the pipe, the temperature will rise, the velocity will rise, and the pressure and density will fall). But if you want to know specifically what the friction is, that will depend on additional items (surface roughness, etc) and it might be hard to find engineering data that is applicable to your regime of interest. | {
"domain": "physics.stackexchange",
"id": 1971,
"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": "fluid-dynamics, friction",
"url": null
} |
python, object-oriented
if user_choice == "1":
account.display_balance()
elif user_choice == "2":
account.withdraw_money()
elif user_choice == "3":
account.deposit_money()
elif user_choice == "4":
break
else:
continue | {
"domain": "codereview.stackexchange",
"id": 36670,
"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, object-oriented",
"url": null
} |
botany, ecology, digestion, climate-change
Regarding methane production of cows and rates of release of greenhouse gasses, please see my other recently-answered BIO.SE post: Would fewer cows mean less methane emission?
Regarding carbon storage:
As stated above, understanding the carbon cycle requires both an understanding of residence times and flux rates. To determine the carbon storage ability of one biome or environment vs another, we typically measure the biomass of the organic matter (with interest in determining the C:N ratio) as well as flux rates in/out of our target carbon reservoir (e.g., plants such as crops or trees). Regarding flux rates, of particular interest are rates of carbon sequestration.
Ultimately, any community of plants that is capable of sequestering more carbon into large amounts of high-C:N biomass will result in larger carbon storage. The longer-lived those plants (i.e., the less labile their carbon), the longer that community of plants acts as a carbon sink. | {
"domain": "biology.stackexchange",
"id": 12156,
"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, ecology, digestion, climate-change",
"url": null
} |
population-genetics, theoretical-biology, molecular-evolution
This last sentence (my emphasis) is not obvious to me based on what I've read.
I am having trouble following this logic. Here is what I understand of it:
1) Muller-Haldane asserts that $s$ has very little impact on $L$, such that to a close approximation $L \approxeq u$ (for a haploid; shown on p.153 and elsewhere), in other words the load is mostly unrelated to $s$ because $s$ only has an effect if $q_{e}$ is not close to zero, which is rarely true for new mutants.
2) At very low $s$ there is a higher chance that the mutant will go to fixation (e.g. reach the $q_{e} = 1$ equilibrium) due to the lesser action of selection.
3) From (2), I think that this means that $s$ is then part of the load formulation again at low $s$.
4) So as $s$ goes to zero the contribution of such variants still goes to zero. | {
"domain": "biology.stackexchange",
"id": 10886,
"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": "population-genetics, theoretical-biology, molecular-evolution",
"url": null
} |
php, object-oriented
Calling it from inside the other method (valid from current, or validateData from create/update) just to make sure that the first method returns true and throw exception otherwise is also wrong because it will get called twice (redundantly) for whoever used the interface correctly.
Although many (especialy PHP) devs may argue that it is better to always throw exception to make sure the dev notices this as soon as possible. I personaly think that you should just write it into the interface's doc comments to state very explicitly that calling create/update without validating the data first is undefined behaviour. How many consumer classes will there be for CrudInterface anyway? One? Two? You make sure that these are correct and then everyone is going to use them, right? So... | {
"domain": "codereview.stackexchange",
"id": 37183,
"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, object-oriented",
"url": null
} |
c++, parsing, circular-list
#include <string>
#include <iostream>
#include <iomanip>
#include <cassert>
// handling for embedded Ctrl-Z in stream
#if defined(WIN32)
#include <io.h>
#include <fcntl.h>
#endif
// forward declares
size_t get_payload_size(const char* stream, size_t length);
void print_line(const char* line, const size_t length, const size_t protocol_header_length);
void handle_line(ring_buffer& data, const bool print_all, const size_t protocol_header_length);
std::string get_timestamp(double timestamp, char date_delimeter = '/', char time_delimiter = ':');
size_t get_payload_size(const char* stream, size_t length) {
unsigned payload_size = 0;
for (size_t i = 0; i < length; ++i) {
payload_size += ((stream[i] & 0xFF) << i * 8);
}
return payload_size;
}
void print_line(const char* line, const size_t length, const size_t protocol_header_length) {
const int timestamp_length = 8;
const int data_length = 4; | {
"domain": "codereview.stackexchange",
"id": 27375,
"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++, parsing, circular-list",
"url": null
} |
vqe, nisq
Then they proceed to show you a single qubit Hamiltonian as a 2x2 matrix, and go through the VQE algorithm to get the ground state energy (the smaller of the two eigenvalues).
Cool, but as devil's advocate, I could have just pulled out my high school maths to analytically get the smaller of the two eigenvalues. And with larger matrices, a classical computer will do the job well (which afaik is not a hard problem).
My question then is at what point does a Hamiltonian's matrix representation become so large, that even though we know it, we'd go to the trouble of probing the quantum system itself rather than solving for the eigenvalues on a classical computer? And how does that relate to the current and near future statuses of classical and quantum computing? | {
"domain": "quantumcomputing.stackexchange",
"id": 1576,
"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": "vqe, nisq",
"url": null
} |
quantum-field-theory, perturbation-theory, unitarity
Some very specific (lower dimensional) QFTs have been constructed rigorously, from where the perturbative expansion can be derived. The canonical example is Glimm & Jaffe's Quantum physics: A functional Integral point of view. Here the authors deal with two-dimensional (Euclidean) $\phi^4$ theory, which has the key property that normal-ordering is all you need to render it finite. Therefore, you cannot really hope to draw general conclusions from this example but, sadly, we don't have many more rigorous (interacting) QFTs that can be analysed explicitly. | {
"domain": "physics.stackexchange",
"id": 58147,
"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, perturbation-theory, unitarity",
"url": null
} |
c++, file-system, c++20, dynamic-loading
Use EXIT_SUCCESS and EXIT_FAILURE for exit codes
It is a bit nicer to use EXIT_SUCCESS and EXIT_FAILURE instead of numeric exit codes.
Make even more use of C++
You already improved on the original code, but there are still a lot of things where you use the plain old C way of doing things, but where you should use C++ features, as C++ provides much better (type) safety than C.
In particular, string manipulation is an area where C++ is much better, especially C++17. If you have a C string and want to find, say, the last '/' in it, you can use std::string_view to efficiently do that:
FILE* fopen(const char* path, const char* mode)
{
svType path_view(path);
auto last_slash = path_view.find_last_of('/');
auto filename = (last_slash == path_view.npos) ? path_view : path_view.substr(last_slash + 1);
...
} | {
"domain": "codereview.stackexchange",
"id": 43231,
"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++, file-system, c++20, dynamic-loading",
"url": null
} |
measurements, observers
Everett's plan is laid out in a section called Observation, and here is a condensed version. He wants to create "a system representing an observer quantum mechanically." He says "the mathematical model seeks to treat the interaction of such an observer with other physical systems" as a physical process. The observer is a machine inside the model "possessing sensory equipment and coupled to recording devices capable of registering past sensory data and machine configurations." "These configurations can be regarded as punches in a paper tape, impressions on a magnetic reel, configurations of a relay switching circuit, or even the configurations of brain cells." Everett proposes a novel technique to derive predictions from the model, by "making deductions about the appearance of phenomena to observers" based on the observer's memory.
What exactly does all that mean?
This animation and explanation seems to clarify how you put an internal observer into a model. | {
"domain": "physics.stackexchange",
"id": 11080,
"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": "measurements, observers",
"url": null
} |
Here is a simple proof for the geometric convergence:
Suppose we have the finite sum:
$$1+r+r^2+r^3+r^4+\dots+r^k$$ with $r\neq 1$
Since this is a finite sum, it will converge to some unknown quantity: $S$
So: $$\begin{array}{lrl} S & =& 1+r+r^2+r^3+r^4+\dots+r^k\\ r\cdot S & =& ~~~~~~~ r+r^2+r^3+r^4+r^5+\dots+r^{k+1}\\ S-r\cdot S& = & 1 - r^{k+1}\\ S & = & \frac{1-r^{k+1}}{1-r}\end{array}$$
If $r=1$ then clearly $S = k+1$
Using this information for infinite series, it follows that $\sum\limits_{i=0}^\infty r^i = \lim\limits_{k\to\infty}\sum\limits_{i=0}^k r^i = \lim\limits_{k\to\infty} \frac{1-r^{k+1}}{1-r}$
In the case that $|r|>1$ this clearly diverges, and when $|r|<1$ then the $r^{k+1}$ term is insignificant, so this will converge. The case where $r=1$ followed the other form where $S = k+1$ and will clearly diverge, the case where $r=-1$ will also diverge since the sequence of partial sums will alternate between 1 and 0. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9740426428022032,
"lm_q1q2_score": 0.8030610757582142,
"lm_q2_score": 0.8244619285331332,
"openwebmath_perplexity": 141.67931925286697,
"openwebmath_score": 0.9183456897735596,
"tags": null,
"url": "https://math.stackexchange.com/questions/1210267/does-this-series-sum-i-0n-frac43n-diverge-or-converge"
} |
c#, beginner, object-oriented, winforms, playing-cards
public static MoneySecond MoneySecondAchievement = //..
public static PlayedHands PlayedHandsAchievement = //..
Two things: Your lines are significantly too long, or rather broken up in unuseful places. Also that's probably better off in a class dedicated to handling achievements.
public static Bot Bot1 = new Bot(10000, AnchorStyles.Left, "Bot 1", 2, (int)UsersProperties.CUser.Bot1,
new Point(15, 420), false, new Tuple<int?, int>(Player.Chips, 6));
public static Bot Bot2 = new Bot(10000, AnchorStyles.Left, "Bot 2", 4, (int)UsersProperties.CUser.Bot2,
new Point(75, 65), true, new Tuple<int?, int>(Player.Chips, 6));
public static Bot Bot3 = new Bot(10000, AnchorStyles.Left, "Bot 3", 6, (int)UsersProperties.CUser.Bot3,
new Point(590, 25), true, new Tuple<int?, int>(Player.Chips, 6));
// ... | {
"domain": "codereview.stackexchange",
"id": 18928,
"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#, beginner, object-oriented, winforms, playing-cards",
"url": null
} |
slam, navigation, mapping, hector-slam, hector-mapping
Originally posted by Jochen on ROS Answers with karma: 11 on 2012-06-04
Post score: 1
Original comments
Comment by Messi on 2013-06-08:
could you share your launch file?
The problem is that there is a map->odom in the datasets we uploaded, from the online mapping phase. If postprocessing, the map->odom transform gets estimated by hector_mapping again, resulting in artifacts as tf tries to interpolate between the old and new transforms. To get rid of this problem you can filter the old transform out of the bagfiles like so:
rosbag filter Team_Hector_MappingBox_RoboCup_2011_Rescue_Arena.bag Team_Hector_MappingBox_RoboCup_2011_Rescue_Arena_filtered.bag 'topic != "/tf" or "map" not in m.transforms[0].header.frame_id'
After doing that and playing back the filtered bagfile as described in the 'Mapping using logged data' tutorial, laser scans should be visualized correctly aligned if decay time is set to a value >0. | {
"domain": "robotics.stackexchange",
"id": 9646,
"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": "slam, navigation, mapping, hector-slam, hector-mapping",
"url": null
} |
logic, satisfiability
Similar construction works for OR-compression, when
at least one $x_i$ must be satisfiable.
The newly introduced variable are uniquely determined
by the original variables.
OR gate in CNF 3 := 1 \/ 2 : [[1 2 -3],[-1 3],[-2 3]]
AND gate in CNF 3 := 1 /\ 2 : [[-1 -2 3],[1 -3],[2 -3]] The confusion arises from a misunderstanding of what being polynomial in the size of the largest instance means. It does not mean that polynomial growth of the compressor's output is allowed as the number of instances ($t$) increases. Rather it means the compressor's output is allowed to grow only as the maximum instance size grows, independent of $t$, and then only within a fixed polynomial of that value. | {
"domain": "cs.stackexchange",
"id": 2983,
"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": "logic, satisfiability",
"url": null
} |
java, benchmarking
String renderedDifference = renderReadable(difference);
System.out.println(fastestProcedure + " has shown better performance: it is faster than " +
slowestProcedure + " by " + percentage + "% (" + renderedDifference + ")");
}
}
} | {
"domain": "codereview.stackexchange",
"id": 44757,
"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, benchmarking",
"url": null
} |
tree, apl
h Merge s
┌→─────────────────────────────────────────────────────────────┐
│ ┌→────────────────────────────────────┐ ┌→─────────────┐ │
│ 2 2 │ ┌→────────────┐ ┌→────────────┐ │ │ ┌⊖┐ ┌⊖┐ │ │
│ │ 2 3 │ ┌⊖┐ ┌⊖┐ │ │ ┌⊖┐ ┌⊖┐ │ │ │ 1 10 │0│ │0│ │ │
│ │ │ 1 6 │0│ │0│ │ │ 1 9 │0│ │0│ │ │ │ └~┘ └~┘ │ │
│ │ │ └~┘ └~┘ │ │ └~┘ └~┘ │ │ └∊─────────────┘ │
│ │ └∊────────────┘ └∊────────────┘ │ │
│ └∊────────────────────────────────────┘ │
└∊─────────────────────────────────────────────────────────────┘ I think your code generally looks good.
Comments
I recommend annotating functions with what the structure of their argument(s) and result are, especially when not just simple arrays, at the top of the function, rather than relying on code comments to reveal this.
Take benefit of dyadic functions | {
"domain": "codereview.stackexchange",
"id": 37850,
"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": "tree, apl",
"url": null
} |
genetics, immunology, pathology, hiv
I'm simplifying matters a bit — you should just read the en.Wikipedia article for your own research — but that's a rundown of some of the reasons why. | {
"domain": "biology.stackexchange",
"id": 7004,
"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": "genetics, immunology, pathology, hiv",
"url": null
} |
python, pandas
# This code harmonises the game column e.g. "Talleres (R.E) - Defensores Unidos" should be as "Talleres - "Defensores Unidos" removing any brackets and its values and removes any date values in the column
df['game'] = df['game'].astype(str).str.replace('(\(\w+\))', '', regex=True)
df['game'] = df['game'].astype(str).str.replace('(\s\d+\S\d+)$', '', regex=True)
# This code removes any numerical values in the league column. Many times the league column has years concatenated which is what we don't want e.g "Brazil Copa do Nordeste 2020" should be "Brazil Copa do Nordeste"
df['league'] = df['league'].astype(str).str.replace('(\s\d+\S\d+)$', '', regex=True)
# This part splits the game column into two competing teams i.e. home team and away team by the delimiter "-"
df[['home_team', 'away_team']] = df['game'].str.split(' - ', expand=True, n=1)
# This part splits the score column into two competing teams i.e. home score and away score by the delimiter ":" | {
"domain": "codereview.stackexchange",
"id": 42350,
"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, pandas",
"url": null
} |
botany, plant-physiology
If it seems that Epipremnum aureum does only need water, maybe the plant gets its nutrients from a place you don't expect. Maybe the water is contaminated. Are there leafs falling into the water for example? Another possibility could be that Epipremnum aureum stored a lot of nutrients before it got only water but this won't last for ever.
I read your comment, thats why i think the nutrients have to come from the water. Additionally I found this publication about Calcium Deficiency Symptoms of Epipremnum aureum
I think you know that tap water or rain water isn't pure H2O. We just measured the tap water in Cologne, by ICP-MS. This is no official measurement, and we measured only once but I think its nice to see whats else in tap water. Unfortunately we couldn't measure nitrogen, because normally the machine is used for plant extracts and there would be to much nitrogen. | {
"domain": "biology.stackexchange",
"id": 5546,
"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",
"url": null
} |
java, performance, hash-map
@Test
void testGetValBeforeAndAfterSetAll() { // values assigned before setAll
setAllMap.put(1, "1");
setAllMap.setAll("all");
setAllMap.put(2, "2");
assertTrue(setAllMap.get(1).equals("all"));
assertTrue(setAllMap.get(2).equals("2"));
}
} The obvious solution, replacing all values, is \$O(n)\$ - the trick is to do it in \$O(1)\$. With that in mind, your approach makes sense - store the new 'all' value, and customize get so it knows whether it should return the actual value for a key or the 'all' value.
I wouldn't use insertion time for that, however - that'll lead to hacks like Thread.sleep. A counter field that is only incremented when you call setAll should work just fine.
I would also wrap V in a custom class that stores both V and the last-modified-counter-value, so get doesn't need to perform two hash-map lookups in the worst case. | {
"domain": "codereview.stackexchange",
"id": 32522,
"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, performance, hash-map",
"url": null
} |
filters, filter-design
Title: Minimum signal length for notch filter? I'm back again with another probably very basic question, but I searched a lot about the minimum length of signal for a filter to work, and mine seems to satisfy this (from filtfilt requirement in MATLAB), but still the filter doesn't seem to work. Please help.
Context : Dealing with an encoder signal for angular velocity measurements. The measurement is noisy due to 2 reasons : Eccentricity error of encoder (has a period equal to one revolution), and other errors (position error, state width error etc, which I assume as random). I have tried to remove the influence of random errors by averaging "n" samples, to get a new signal which seems to have worked in cancelling the high frequency noise (after lowpass filtering). However, the eccentricity error still remains. | {
"domain": "dsp.stackexchange",
"id": 11835,
"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": "filters, filter-design",
"url": null
} |
organic-chemistry, electronegativity, electron-affinity
If two atoms have different sizes (down the periodic table), the larger atom has electrons more spread out and thus is more stable. Example: fluoride vs iodide anion
Generally true as well. Flouride anion is less stable than iodide anion due to the repulsion of electrons in the outermost octet of fluoride. But this rule is not absolute as chloride has the highest stability (in the gaseous state) though it is above bromine and iodine.
Edit:
Considering some confusion in the comments I shall put this here.
The electronegativity is generally not compared based on inter-electron repulsion because the shared pair doesn't completely enter the orbits of the electronegative atom but is shared and so electron density is between the two atoms and not concentrated on one atom for repulsion to take much effect. | {
"domain": "chemistry.stackexchange",
"id": 5684,
"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, electronegativity, electron-affinity",
"url": null
} |
string-theory, gauge-theory, coordinate-systems, gauge
Title: Light-cone coordinates to quantize strings? Zweibach, in A First Course in String Theory said: "We now discuss a coordinate system that will be extremely useful in our study of string theory, the light-cone coordinate system", then he mentioned that this coordinate system will be used to quantize strings.
My question: What's so special about light-cone coordinates/gauge, so they have used them to quantize strings? Why are they "extremely useful"? Light-cone (LC) coordinates appear in bosonic string theory in two places: | {
"domain": "physics.stackexchange",
"id": 33213,
"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": "string-theory, gauge-theory, coordinate-systems, gauge",
"url": null
} |
quantum-field-theory, mathematical-physics, research-level
holds, that is there is a Type I factor $\mathfrak{N}$ such that $\mathfrak{A}(\mathcal{O}) \subset \mathfrak{N} \subset \mathfrak{A}(\widehat{\mathcal{O}})$ for some region $\mathcal{O} \subset \widehat{\mathcal{O}}$, a slightly weaker property is available: a state can be prepared in $\mathcal{O}$ irregardless of the state in $\widehat{\mathcal{O}}'$. An illustration of the consequences can be found in the article above. | {
"domain": "physics.stackexchange",
"id": 3288,
"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, mathematical-physics, research-level",
"url": null
} |
java, programming-challenge, time-limit-exceeded, mathematics
Note that apart from the factorization, no trial divisions are required anymore, only
multiplications.
First we need a function to get the distinct prime factors of a given number,
e.g. the function in Finding out the prime factors of a number,
modified slightly to return only distinct prime factors:
// List of all distinct prime factors of n.
static List<Long> primeFactors(long n) {
List<Long> factors = new ArrayList<Long>();
long md = 2;
if (n % md == 0) {
factors.add(md);
do {
n /= md;
} while (n % md == 0);
}
md = 3;
while (md <= java.lang.Math.sqrt(n) + 1) {
if (n % md == 0) {
factors.add(md);
do {
n /= md;
} while (n % md == 0);
}
md += 2;
}
if (n > 1) {
factors.add(n);
}
return factors;
} | {
"domain": "codereview.stackexchange",
"id": 25113,
"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, programming-challenge, time-limit-exceeded, mathematics",
"url": null
} |
Therefore: . $\displaystyle \frac{1}{a} + \frac{1}{b} + \frac{1}{c} + \frac{1}{d} \;=\;-\frac{2}{3}$
Get the idea?
5. Originally Posted by arze
For the second, I worked out the equivalent for cubic equations
$\sum\alpha^2\beta^2=(\sum\alpha\beta)^2-2\alpha\beta\gamma(\sum\alpha)$
Problem is it doesn't work.
$(0)^2-2(3)(-1)=6$ answer is 10.
Thanks!
You haven't got the formula for $\sum\alpha^2\beta^2$ quite right. It should be $\sum\alpha^2\beta^2=(\sum\alpha\beta)^2-2(\sum\alpha\beta\gamma)(\sum\alpha) +2\alpha\beta\gamma\delta = 0^2 -2(-2)(1) +2(3) = 10.$ | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9585377272885903,
"lm_q1q2_score": 0.8147294371542109,
"lm_q2_score": 0.8499711737573762,
"openwebmath_perplexity": 527.1400623829834,
"openwebmath_score": 0.973603367805481,
"tags": null,
"url": "http://mathhelpforum.com/pre-calculus/156200-roots-polynomial-equation.html"
} |
computational-physics, simulations, diffusion
Where the 14 is needed as the upper bound because of Python's semantics.
More complicated initial conditions (e.g., two droplets, existing background, etc) would benefit from a double loop over the whole domain, but this is simple enough to not do for this problem.
The stopping condition is effectively when the droplet has diffused off the domain, represented by finding the total concentration to be less than some value. This could be implemented as a simple sum over the whole domain:
if np.sum(n)<threshold: break
Or it could be implemented as $N$ minus the total concentration removed from the domain, which is probably more complicated to implement than a simple sum, but YMMV. (Another alternative would be to use the average concentration per cell vs some threshold, but that's not what the problem states). | {
"domain": "physics.stackexchange",
"id": 46422,
"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": "computational-physics, simulations, diffusion",
"url": null
} |
special-relativity, symmetry
Title: Time dilation and symmetry in special relativity Trying to grasp special relativity concepts, I thought in the following experiment.
Imagine Alice took a trip in a spaceship to another star. Now, she is returning close to light speed. When she passes by Pluto, she is no longer accelerating. In this exact moment, she starts her chronometer at 0:00:00.
Meanwhile, on Earth, Bob has a telescope pointing to Pluto. The moment he sees Alice's spaceship passing Pluto, he also starts his chronometer, but instead of starting at 0:00:00, he compensates for the time light took to travel from Pluto to Earth.
Alice isn't aiming exactly at Earth, so she is not slowing down. When she passes by Earth, she takes a Picture from Bob's chronometer, while Bob takes a picture from her chronometer.
Question: which chronometer will be late? The two observers should perceive each other's time running slow. Which one is correct?
Considerations: | {
"domain": "physics.stackexchange",
"id": 27387,
"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, symmetry",
"url": null
} |
php, optimization, object-oriented, controller
$class = explode('\\', get_class($this));
$class = '\Views\\' . $class[count($class) - 1];
$this->view = new $class();
}
}
AccountController
namespace Controllers;
use \Libraries\Validator\Validator;
use \Libraries\Validator\Rules\MaxChars;
use \Libraries\Validator\Rules\Alpha;
use \Libraries\Validator\Rules\Email;
use \Libraries\Validator\Rules\Match;
use \Libraries\Validator\Rules\MinChars;
use \Libraries\CryptoCharGen;
class Account extends Controller
{
public function signUp()
{
// if the session is new, create a token and tie it to the session just once.
// (only for forms)
if (!$this->cookie->getParameter('sid')) {
$this->session->setParameter('csrfToken', CryptoCharGen::alnum());
} | {
"domain": "codereview.stackexchange",
"id": 8492,
"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, optimization, object-oriented, controller",
"url": null
} |
ros, release
Title: Info source in new package release e-mail summary
Out of curiousity, e.g. New Packages for Jade and Kinetic 2016-12-15,
Where are "contributors" taken from? Doesn't look like all the maintainers listed for moveit metapackage for Kinetic are enlisted.
How is package categorized as "added" or "updated"? MoveIt! for Kinetic has never been publicly synced until this time of sync IMO, but it's in "updated package" category.
UPDATE: thanks for taking a look @ahendrix, but in any previous release note moveit has not been included for kinetic (2016-10-24, 2016-10-04). And now I'm the one of a few who run bloom for moveit so I've been paying attention :) . During soak period we bumped versions a few times.
Originally posted by 130s on ROS Answers with karma: 10937 on 2016-12-15
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 26495,
"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, release",
"url": null
} |
For a smooth $$f:\mathbb{R}^n\to\mathbb{R}^m$$, you have $$df:\mathbb{R}^n\to\mathcal{L}(\mathbb{R}^n,\mathbb{R}^m)$$
Being differentiable is equivalent to: $$f(x+h)=f(x)+df(x)\cdot h+o(\|h\|)$$
In your case, $$f(x)=\langle x,x \rangle_G$$ and $$m=1$$, hence differential at $$x$$, $$df(x)$$ is in $$\mathcal{L}(\mathbb{R}^n,\mathbb{R})$$. It's a linear form.
Let's be more explicit: \begin{align*} f(x+h)=& \langle x+h,x+h \rangle_G \\ =& \underbrace{\langle x,x \rangle_G}_{f(x)} + \underbrace{2\langle x,h \rangle_G }_{df(x)\cdot h}+ \underbrace{\langle h,h \rangle_G}_{\in o(\|h\|)}\\ \end{align*}
Hence your differential is defined by $$df(x)\cdot h = 2\langle x,h \rangle_G = (2x^tG)h$$ where $$2x^tG=\left(\partial_{x_1} f,\dots,\partial_{x_n} f\right)$$ is your "row" vector.
Note that, because $$m=1$$, you can also use a vector $$\nabla f(x)$$ to represent $$df(x)$$ using the canonical scalar product. This vector is by definition the gradient of $$f$$: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9845754479181588,
"lm_q1q2_score": 0.8026578955710992,
"lm_q2_score": 0.8152324915965392,
"openwebmath_perplexity": 201.07555357760486,
"openwebmath_score": 0.9901923537254333,
"tags": null,
"url": "https://math.stackexchange.com/questions/3019859/derivative-of-inner-product"
} |
error-correcting-codes
A convolutional code is decoded by finding the sequence of input bits that is most likely to have produced the observed sequence of output bits (which includes any errors). For small values of $k$, this is done with a widely used algorithm developed by Viterbi (Forney, 1973). The algorithm walks the observed sequence, keeping for each step and for each possible internal state the input sequence that would have produced the observed sequence with the fewest errors. The input sequence requiring the fewest errors at the end is the most likely message. | {
"domain": "cs.stackexchange",
"id": 16195,
"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": "error-correcting-codes",
"url": null
} |
By (well-known) properties of mollification, $u*\rho_\epsilon\rightarrow u$ in $W^{1,p}$ as $\varepsilon \rightarrow 0$. Since $u*\rho_\epsilon = c_\varepsilon$ is a constant for each $\varepsilon$, and $u*\rho_\epsilon\rightarrow u$, $u$ is the limit of constant functions and must be constant as well (e.g. because convergence in $L^p$ implies convergence a.e.).
you should note that
i) this is only true for each connected component of $U$
ii) strictly speaking $u*\rho_\epsilon$ is only defined on $U_\varepsilon = \{x\in U: d(x,\mathbb{R}^n\backslash U)>\varepsilon\}$, so you first get the result for any such domain, but then it it true for $U$ if $\varepsilon$ tends to $0$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668695588647,
"lm_q1q2_score": 0.8067047268298045,
"lm_q2_score": 0.822189121808099,
"openwebmath_perplexity": 243.8495989098854,
"openwebmath_score": 0.9688162207603455,
"tags": null,
"url": "https://math.stackexchange.com/questions/958969/weak-derivative-zero-implies-constant-function"
} |
complexity-theory, np-hard
Even worse, we believe this can't be done for NP. See Bogdanov Trevisan, where it is shown that if an NP complete problem has a worst to average case reduction then the hierarchy collapses. Your problem is not exactly worst to average case reduction, but reducing an NP hard problem to inverting a one way function. However, these are related and Trevisan's paper also rules out such non-adaptive reductions.
More directly related to your question is AGGM, which also rules out adaptive reductions for the case where the size of the inverse image is easy to compute. You might also want to check out this paper. These results are 10-15 years old (STV is around 20), I have no idea if anything stronger was proven since. | {
"domain": "cs.stackexchange",
"id": 17420,
"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": "complexity-theory, np-hard",
"url": null
} |
javascript, jquery
It's the same as:
<script> /* chunk of code 1 */ </script>
<script> /* chunk of code 2 */ </script>
<script> /* chunk of code 3 */ </script>
Which, in turn is the same as:
<script src="chunk1.js"></script>
<script src="chunk2.js"></script>
<script src="chunk3.js"></script>
From the browser's point of view, all JS - whether part of the HTML or in a separate file - is just part of one big JS file. So in you case, that file starts with all of jQuery's code, then the code from "example.js" and then the code in the HTML.
So when you say "externally-held" and "internally-held", I say "same difference". Functions, where ever they're defined, have their own internal scope (and access to any "outer" scope) - files do not automatically constitute a scope.
To answer your questions directly:
In the above examples, am I using the various global variables and global jQuery objects correctly (in both the internal and external cases)? | {
"domain": "codereview.stackexchange",
"id": 10590,
"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",
"url": null
} |
catkin, rosbuild
Title: rosbuild migration - mixing workspaces?
Hi,
we're in the process of migration to catkin, but have a lot of packages that we won't migrate all at once.
Keeping track of overlays, and which package is migrated in two rosinstall files, one for the rosbuild workspace, and one for the catkin workspace seems a bit tedious...
Can we just put all packages (rosbuild + catkin) into the src folder of the catkin workspace, add src to ROS_PACKAGE_PATH and create CATKIN_IGNORE / ROS_NOBUILD files in the packages according to their migration status? Or will that just create more problems?
Thanks!
Markus
Originally posted by Markus Achtelik on ROS Answers with karma: 390 on 2013-09-16
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 15543,
"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": "catkin, rosbuild",
"url": null
} |
domain, this is the square of the FFT's magnitude. The phase of the complex numbers represent phase vs. Solved Problems. Learn more about gaussian 3d, gaussian 2d, fft, 2d-fft, phase fourier transform 2d I'm trying to plot the Spectrum of a 2D Gaussian pulse. Under the Hilbert transform, sin(kx)is converted to cos(kx), and cos(kx) is converted to –sin(kx). When is a fixed value, equation (3) represents a relation between the variables and. Parameters dat: array. Because this velocity is related to a phase value, it is called the phase velocity: as just stated, it is the velocity of the entire wave. The Fourier series is named in honour of Jean-Baptiste Joseph Fourier (1768-1830), who made important contributions to the study of trigonometric series, after preliminary investigations by Leonhard Euler, Jean le Rond d'Alembert, and Daniel Bernoulli. Lecture 7: Summary Of How To Find The Fourier Series; Lecture 8: How To Find The Fourier Series: Ex. magnitude and phase for DTFT, etc. 01 | {
"domain": "citreagiancarlo.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9865717436787543,
"lm_q1q2_score": 0.8178076034440476,
"lm_q2_score": 0.828938806208442,
"openwebmath_perplexity": 841.7845465568142,
"openwebmath_score": 0.8453619480133057,
"tags": null,
"url": "http://citreagiancarlo.it/vyph/magnitude-and-phase-spectrum-of-fourier-series.html"
} |
operating-systems, threads
Title: How can context switch affect the modification of a variable? float myTotalAmount=0;
void update(float amt){
myTotalAmount+= amt;
}
Task A called update(10);
Calculated myTotalAmount+= amt;
Didn't store the value for myTotalAmount; -------X
Task B called update(5);
Can we say X didn't happen due to context switch? or is Task B able to call update method because context switch happened due to some reason before the X?
Overall I am trying to understand race condition. A context switch is simply the operating system pausing the execution of one process and starting another. As such, context switches are required for any concurrency problem since, if there are no context switches, there's only one process executing so there is no concurrency.
In your example, the race condition occurs because what the function update really does is:
Read the value of myTotalAmount from memory;
Add amt to this value;
Store the result back in the memory. | {
"domain": "cs.stackexchange",
"id": 8408,
"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": "operating-systems, threads",
"url": null
} |
java, android
LayoutParams lparams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
ImageView imgView = new ImageView(getActivity());
imgView.setImageResource(R.drawable.ic_arrowforblue2x);
imgView.setLayoutParams(lparams);
imgView.setPadding(0, 15, 50, 0);
linearLayout.addView(imgView);
lparams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
lparams.addRule(RelativeLayout.CENTER_VERTICAL);
lparams.setMargins(20, 20, 20, 20);
formD.addView(linearLayout);
}
}
return view;
} | {
"domain": "codereview.stackexchange",
"id": 20379,
"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, android",
"url": null
} |
java, mvc, swing, static
public static void main(String[] args) {
new Model();
}
} First I must apologise for calling it MVC in my answer to your original question. After reading gervais.b's answer I realised that what I call "MVC" isn't the usual way to implement it. After some searching I found out that what I tried to explain is better known as MVA (model view adapter).
The main difference is that I take a "view" as the GUI (in your case the Browser class). I have the History as the "model" (which in MVA is NOT coupled directly to the View). And finally I have some binding class that provides the coupling between a View and the Model (which I "wrongly" called the Controller and from which you probably got confused). So let's fix it while providing more tips to improve your design.
First step: renaming the Model class to something different. My first thought would be something like BrowserHistoryBinding but this name is open for suggestions. | {
"domain": "codereview.stackexchange",
"id": 29332,
"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, mvc, swing, static",
"url": null
} |
To prove this, we will show that the size of a conjugacy class of a, $cl(a)$ is the index of the centralizer of $a$, $C(a)$.
Suppose $x$ and $y$ both make the same conjugate of $a$, or $xax^{-1} = yay^{-1}$. Then multiplying on the left by $y^{-1}$ and on the right by $x$ we can see that $y^{-1}xa = ay^{-1}x$ and hence, $y^{-1}x \in C(a)$. Thus we can also see that $x\in yC(a)$ and hence $xC(a) = yC(a)$.
Similarly, suppose $xC(a) = yC(a)$ then it follows that $x \in yC(a)$ and hence $x = yz$ for some $z\in C(a)$. Thus $xax^{-1} = (yz)a(yz)^{-1} = yzaz^{-1}y^{-1}$. But we know that $z\in C(a)$ so we can rewrite this as $yazz^{-1}y^{-1}$, or $yay^{-1}$. Thus $x$ and $y$ make the same conjugate of $a$.
Thus we have shown that the number of cosets of $C(a)$ equals the number of elements in $cl(a)$, or
$(G : C(a)) = |cl(a)|$
Since $C(a)$ is a subgroup of $G$, clearly $(G : C(a))$ divides $|G|$ and hence, $|cl(a)|$ divides $G$. $\Box$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9830850902023109,
"lm_q1q2_score": 0.8432590366540819,
"lm_q2_score": 0.8577681068080749,
"openwebmath_perplexity": 91.4053543208808,
"openwebmath_score": 0.9257936477661133,
"tags": null,
"url": "https://math.stackexchange.com/questions/64371/showing-group-with-p2-elements-is-abelian/64374"
} |
condensed-matter, many-body, quantum-hall-effect
Title: Neutralizing Background and Fractional Quantum Hall ground state The idealized many-body Hamiltonian describing FQH is given by
$$
H = \sum_i \left\{\frac{[\vec{p}_i -e/c \vec{A}(\vec{r}_i)]^2}{2m}+V(\vec{r}_i)\right\} + \frac{1}{2}\sum_{i\neq j} \frac{e^2}{|\vec{r}_i-\vec{r}_j|}
$$
where $V(\vec{r}_i)$ is the neutralizing background potential. In a small number of charges case, we discard the background potential. In this case (zero background) with the three main assumptions one can find the form of (F)QH ground state. These assumptions are
Weak repulsive core: If the magnetic field is strong enough and $e$ (the charge) small enough one can treat the charge-charge Coloumb interaction as a perturbation.
Temperature low enough so the Lowest Landau level is the host of the ground state.
The ground state is an eigenstate of total angular momentum. | {
"domain": "physics.stackexchange",
"id": 25441,
"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": "condensed-matter, many-body, quantum-hall-effect",
"url": null
} |
organic-chemistry, grignard-reagent
Title: Why do orthoesters react with Grignard reagents, but acetals and ketals don't? My book mentions the synthesis of aldehydes and ketones using alkyl ortho esters. It's called Bodroux-Chichibabin aldehyde synthesis.
Now, later, the book mentions this:
R- displaces EtO-, giving an acetal or ketal, which are unreactive with Grignard reagents, so a secondary alcohol is not formed.
Why do orthoesters react with grignard reagents, but acetals and ketals don't? They have essentially the same functional groups, just two instead of three. Grignard reactions are performed in ether or THF.
There you have only one -OR group on a carbon and, since it is the solvent, it is not reacting with it.
This shows that not always a -OR group is substituted in a Grignard reaction.
When you have three -OR's on one carbon, the formal positive charge ($\delta+$) on it is higher than when there are only two -OR's.
Therefore, the reaction proceeds on orthoesters and not on acetals or ketals. | {
"domain": "chemistry.stackexchange",
"id": 9338,
"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, grignard-reagent",
"url": null
} |
sql, logging, t-sql
Title: SQL trigger to log when employee records are updated I am learning TSQL (SQL in general for that matter), and I wrote this trigger that inserts logs about updated employees into the tblEmployeeAudit table.
When I was looking at the end result my eyes hurt.
The trigger was super simple, yet super long (for something which is so simple), it seemed as if a 10-year-old rascal wrote it. Does anyone know if I can make this any better/shorter, and/or How to avoid repeating same line of code 100 times? Here's the code.
Alter TRIGGER tr_tblEmployee_ForUpdate
ON tblEmployee
FOR UPDATE
AS
declare @id int
declare @Name nvarchar(50)
declare @GenderID int
declare @Salary int
declare @City nvarchar(50)
declare @DepartmentID int
declare @ManagerID int
declare @DateOfBirth datetime
declare @Nameol nvarchar(50)
declare @GenderIDol int
declare @Salaryol int
declare @Cityol nvarchar(50)
declare @DepartmentIDol int
declare @ManagerIDol int
declare @DateOfBirthol datetime | {
"domain": "codereview.stackexchange",
"id": 28609,
"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, logging, t-sql",
"url": null
} |
quantum-field-theory, lagrangian-formalism, renormalization, feynman-diagrams, dimensional-analysis
How does the superficial degree of divergence say anything about the amplitude? I thought it only describes the rate of divergence of the diagram.
It should stressed be that Peskin & Schroeder are here using the old Dyson definitions of renormalizability. For a more general derivation of eq. (10.13), see e.g. this Phys.SE post, which also answers several of OP's questions. | {
"domain": "physics.stackexchange",
"id": 100210,
"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, lagrangian-formalism, renormalization, feynman-diagrams, dimensional-analysis",
"url": null
} |
thermodynamics, fluid-dynamics, diffusion
Title: What is the maximum flux in Fick's diffusion? Solving the Fick's second law with common boundary conditions and applying to the first law will result in a common expression of one-dimensional diffusion as
$$J_{(x=0)} = D\frac{\partial c(x,t)}{\partial t} = \frac{C^\infty\sqrt{D}}{\sqrt{\pi t}}$$
This equation says that the flux decreases by time as the concentration gradient weakens.
However, how much is the maximum flux? When $t \to 0$ (at very short times) then $J \to \infty$. It doesn't make sense. In general, Fick's first law states that the flux $\vec j$ is given by,
$$\vec j = -D \nabla \phi$$
where $\phi$ is the concentration, showing a concentration gradient sets up a flow, and as the gradient increases, the flux increases as well, in magnitude. | {
"domain": "physics.stackexchange",
"id": 42620,
"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, fluid-dynamics, diffusion",
"url": null
} |
newtonian-mechanics, forces, reference-frames, acceleration, centrifugal-force
An object acted on by no net external force remains in equilibrium, i.e. has a constant velocity (which my be zero) and zero acceleration. | {
"domain": "physics.stackexchange",
"id": 84569,
"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": "newtonian-mechanics, forces, reference-frames, acceleration, centrifugal-force",
"url": null
} |
ros-melodic
Title: Rviz doesn't link laser scanner with robot model
Hi, I'm using ROS melodic on Ubuntu 18 and I want to perform SLAM using rviz.
I have got a dual drive robot controlled by Arduino via Serial. I have a node that reads/writes data from serial and publish/subscribe them as topic.
This is the topic list:
/clicked_point
/cmd_vel
/cmd_vel_mux/input/navi
/diagnostics
/horizontal_servo_pos
/initialpose
/joint_states
/joy
/joy/set_feedback
/left_encoder
/left_motor_speed
/left_velocity
/left_wheel_target
/make_scan
/map
/map_metadata
/map_updates
/move_base/current_goal
/move_base/goal
/move_base_simple/goal
/odom
/right_encoder
/right_motor_speed
/right_velocity
/right_wheel_target
/rosout
/rosout_agg
/scan
/serial_msg
/slam_gmapping/entropy
/tf
/tf_static
/ultrasonic_distance
/ultrasonic_scan
/vertical_servo_pos
This is my file .urdf
<robot name="robot">
<link name="odom">
</link> | {
"domain": "robotics.stackexchange",
"id": 33678,
"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-melodic",
"url": null
} |
kinematics, velocity, rotation
$$mgh=\frac{mv^2}{2}+\frac{I\omega^2}{2},$$
where $I$ is the moment of inertia and $\omega={v}/{R}$. Substitution then allows to isolate $v^2$.
Now let's briefly look at the case where $\mu=0$, then $F_f=0$.
In the case where there was no slippage, $F_f$ provided a moment (torque) around the centre of the object and the equation of rotation is:
$$I\dot{\omega}=F_fR,$$
where $\dot{\omega}=\frac{d \omega}{dt}$ is the angular acceleration. With $F_f=0$, $\dot{\omega}=\frac{d \omega}{dt}=0$. In plain English this means that there is no angular acceleration and if the object wasn't rotating to begin with, it will not start to do so. In that case the motion is purely translational and there is no rotation.
It also means that when there's no friction the energy balance is reduced to:
$$mgh=\frac{mv^2}{2},$$
and this means that a purely sliding object will gain more translational speed than a rotating one. | {
"domain": "physics.stackexchange",
"id": 26235,
"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": "kinematics, velocity, rotation",
"url": null
} |
quantum-field-theory, hilbert-space, field-theory, hamiltonian, vacuum
Title: Vacuum fluctuations of quantum scalar field Consider a free scalar quantum field
$$ H = \int d^3 x \left( \, \Pi(x)^2+(\nabla\phi(x))^2 \right). $$
Introducing the creation and annihilation operators we find the "vacuum catastrophe"
$$ H = \int d^3p \, \big(\omega_p a^\dagger(p)a(p) +\frac{1}{2}[a(p),a^\dagger(p)] \big),$$
a diverging energy of the vacuum ground state. No problem, this is just an unobservable constant energy shift, as is argued for example in Peskin Schröder and claimed all over the place when discussing this issue.
However, what is glossed over in this explanation is that the variance of the field at any given point is also infinite:
$$ \Delta\phi^2=\langle0|\phi^2|0\rangle=\langle0| \int d^3p \int d^3q \frac{1}{2\sqrt{\omega_q \omega_p}}(a(p)e^{ipx}+a^\dagger(p)e^{-ipx})(a(q)e^{iqx}+a(q)e^{-iqx})|0\rangle \\ =\int d^3p \frac{1}{2\omega_p}=\infty $$ | {
"domain": "physics.stackexchange",
"id": 73982,
"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, hilbert-space, field-theory, hamiltonian, vacuum",
"url": null
} |
$$\def\fitch#1#2{\quad\begin{array}{|l}#1\\\hline#2\end{array}}$$ $$\fitch{}{~\vdots\\\fitch{\lnot q\qquad \text{Assumption raised for the subproof.}}{~\vdots\qquad\quad\text{Derivations made in the context of the assumption}\\\lnot p\qquad\text{Conclusion reached within the context of the assumption}}\\\lnot q\to\lnot p\quad\text{Conditional statement deduced by the subproof}}$$
$$\fitch{}{~\vdots\\\fitch{\text{Assuming you are French}}{\text{Then your native country is in Europe}\\\text{Thus you are European}}\\\text{If you are French, then you are European}}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9621075711974104,
"lm_q1q2_score": 0.8017478964409152,
"lm_q2_score": 0.8333245891029457,
"openwebmath_perplexity": 422.9010112242656,
"openwebmath_score": 0.8021683692932129,
"tags": null,
"url": "https://math.stackexchange.com/questions/3101098/scope-of-assumptions-in-propositional-logic"
} |
the-moon, earth, the-sun
Title: Is it a coincidence that both the Sun and the Moon look of same size from the Earth? The Sun is huge, when compared to the Moon. Despite the huge difference in their size and distance from Earth, is it purely coincidental that they both look almost the same from Earth? The coincidence isn't so much that they appear very similar sizes from Earth, but that we are alive to see them at the point in time in which they appear very similar sizes. The moon is slowly moving away from the Earth, and at some point in the future the moon will be unable to totally eclipse the sun and conversely, if you could step far into prehistory, you would be able to see the moon with a much greater angular diameter than you see it now.
Most research I've found on the topic seem to be unavailable through my institute, however I did find one paper, "Outcomes of tidal evolution", which references results from Goldreich's research on the subject. | {
"domain": "astronomy.stackexchange",
"id": 3259,
"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": "the-moon, earth, the-sun",
"url": null
} |
python, performance, python-2.x, image, multiprocessing
I spent a lot of time streamlining the code and improving its performance. When I started writing the code it took over an hour to load a few sections, now I can load 5 whole classes in a little less than 5 minutes, which was a relief to me as a scheduler that takes hours for a few sections is not useful at all. The main reason it takes so long is due to the fact that saving an image using PIL takes about 0.7 seconds per save and the process I use to build the image used to take 10 seconds but now takes about 0.5 seconds, making the total process 1.4 seconds per image, which really isn't that bad, but when you make 100 images it does take an uncomfortably long time. Now I can't think of any way of lowering this time any farther.
The area that takes the most time (Not including the image saving area which, again, takes 0.7 seconds per image) : | {
"domain": "codereview.stackexchange",
"id": 26996,
"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, performance, python-2.x, image, multiprocessing",
"url": null
} |
So it's a homomorphism, but we need to show it is an isomorphism. Clearly $ab \mapsto (cd)(d^{-1}) = c$, and $b^{-1} \mapsto (d^{-1})^{-1} = d$, so it's surjective. But showing injectivity is a pain. Informally, we can use the reasoning above to show that $abab^{-1} \mapsto c^2 d^2$, and those are both zero in their respective groups. In this case it works, but in more complicated presentations, that might not suffice.
If you want a more formal argument, consider these as quotients of the free group on two generators, $F_2 = \langle a,b \mid ~ \rangle$. We consider two subgroups, $K_1 = \langle abab^{-1} \rangle$ and $K_2 = \langle a^2 b^2 \rangle$. By definition, $G \cong F_2/K_1$, and $H \cong F_2/K_2$. We wish to show $F_2/K_1 \cong F_2/K_2$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822876992225168,
"lm_q1q2_score": 0.8076262650664138,
"lm_q2_score": 0.8221891261650248,
"openwebmath_perplexity": 135.29942882790493,
"openwebmath_score": 0.9281421899795532,
"tags": null,
"url": "https://math.stackexchange.com/questions/725555/showing-that-left-langle-a-b-mid-abab-1-right-rangle-cong-pi-1k-cong"
} |
catkin, dynamic-reconfigure
make[1]: *** [tradr-payload/optris_camera/CMakeFiles/optris_camera_gencfg.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Built target std_srvs_generate_messages_lisp
[ 1%] [ 1%] Built target std_srvs_generate_messages_cpp
Built target _optris_camera_generate_messages_check_deps_AutoFlag
make: *** [all] Error 2
Invoking "make" failed | {
"domain": "robotics.stackexchange",
"id": 19805,
"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": "catkin, dynamic-reconfigure",
"url": null
} |
radiation
I guess my confusion is due to a lack of an intuitive understanding of this concept and I would be grateful if anyone could provide me with one. Imagine you have a solar collector measuring one square meter, which can directly measure the power (energy per unit time) striking it. If there are layers of atmosphere above the collector, some of the incoming light is absorbed or reflected by particles in the atmosphere, so you won't measure as much power as if you place the collector in space at the distance of Earth's orbit, with no atmosphere between you and the Sun. But if you place the collector in the upper atmosphere of the Earth, the density of atmospheric particles above you is so small that they absorb/reflect only a negligible amount of power. Orientation is also an issue--you'll get the maximum power if you orient the plane of the collector so that it's perpendicular to the direction of the incoming rays. If it's not perpendicular, then if you approximate the incoming radiation | {
"domain": "astronomy.stackexchange",
"id": 1497,
"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": "radiation",
"url": null
} |
The Buffalo Way
Imgur
The Buffalo Way is a plug-and-bash method used to solve olympiad inequalities. It is usually applied to symmetric inequalities, where we can assume WLOG that the variables are in a specific order; that is, $x_1 \le x_2\le \cdots \le x_n$.
To illustrate this method, we shall prove $AM-GM$ for two variables using the method.
Prove that $\dfrac{x+y}{2}\ge \sqrt{xy}$ for non-negative reals $x,y$.
First, assume WLOG that $x\le y$. Thus, we can represent $x$ and $y$ by: $x=a$ $y=a+b$ where $a,b$ are non-negative reals. Make sure you see why this is true.
Thus, we want to prove $\dfrac{a+a+b}{2}\ge \sqrt{a(a+b)}\implies a+\dfrac{b}{2}\ge \sqrt{a^2+ab}$
Squaring both sides gives $a^2+ab+\dfrac{b^2}{4}\ge a^2+ab\implies \dfrac{b^2}{4}\ge 0$ which is true by the trivial inequality.
In general, if we have variables satisfying $x_1 \le x_2\le \cdots \le x_n$, then we substitute $x_1=y_1$$x_2=y_1+y_2$ $\vdots$ $x_n=y_1+y_2+\cdots +y_n$ | {
"domain": "brilliant.org",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9559813501370535,
"lm_q1q2_score": 0.8356015448044861,
"lm_q2_score": 0.8740772450055545,
"openwebmath_perplexity": 967.5580293420969,
"openwebmath_score": 0.9674453735351562,
"tags": null,
"url": "https://brilliant.org/discussions/thread/the-buffalo-way/?sort=top"
} |
thermodynamics, statistical-mechanics, differential-geometry, entropy, reversibility
Another version of this question could be thought of when looking at the book on Mechanical Foundations of Thermodynamics by Campisi, where the 2nd law is stated as
$$
dS \geq \delta Q / T ,
$$
although here the author seems to admit from the outset on using a definition of an order relation of forms.
The second question actually stems from the statement, already given, that the second law depends on the nature of the process.
If so, it even seems this form would even no longer be exact whilst also being path-dependent, in such a way that we would prefer to write it as $\delta S(\gamma_\text{gen})$, and reduce it to $dS = \delta S(\gamma_\text{rev})$, for a path $\gamma$. As far as I'm understanding, this is also a different statement from the path-dependence on the integral of an inexact form. | {
"domain": "physics.stackexchange",
"id": 87606,
"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, statistical-mechanics, differential-geometry, entropy, reversibility",
"url": null
} |
expressions for the gradient, divergence, curl, and Laplacian operators in spherical coordinates. The Curl(F) command computes the curl of the vector field F in R^3. 2 can be carried out using coordinate systems other than the rectangular Cartesian coordinates. To get dS, the infinitesimal element of surface area, we use cylindrical coordinates to parametrize the cylinder: (6) x = acosθ, y = asinθ z = z . Either r or rho is used to refer to the radial coordinate and either phi or theta to the azimuthal coordinates. To calculate the scalar Laplacian pieces just put in the indicated vector component as if it were a scalar function. Fall’2013’ Physics’435 120 Cylindrical’coordinates:’(HW5,’problem’3)’ Remember’thatwe’are’ignoring’any’ zLdependence,’to’simplify’the Sep 26, 2020 · In other coordinate systems, such as cylindrical and spherical coordinates, the Laplacian also has a useful form. NOTE: write any greek letters using similar standard characters - i. Solution: This calculation is | {
"domain": "menubuddy.sg",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.992422760300897,
"lm_q1q2_score": 0.8204475964078123,
"lm_q2_score": 0.8267117898012105,
"openwebmath_perplexity": 683.347574851877,
"openwebmath_score": 0.8974097967147827,
"tags": null,
"url": "http://menubuddy.sg/ls-swap-p4psh/lkgvx---curl-in-cylindrical-coordinates-calculator---du3s.html"
} |
phylogenetics, phylogeny, hidden-markov-models, nucleotide-models
Advice. My advice is if you are building a basic tree and haven't assigned a root/outgroup, obviously using GTR which is a good move, then you don't to worry about the intananeous matrix because it might not be meaningful. If you are running a molecular clock/dating/rate estimate type model and a very clear what the root/outgroup is and that is specified in the input, then the instananeous matrix becomes important. | {
"domain": "bioinformatics.stackexchange",
"id": 1461,
"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": "phylogenetics, phylogeny, hidden-markov-models, nucleotide-models",
"url": null
} |
ros, answers.ros.org
Title: Problem in my ROS answers profile
I cannot see the option "post a comment" in most of the places. For example, I posted a question few mins ago. I got two answers for that but I am unable to see the option post a comment below the answers. But I can see the comment option below my question. So, I would like to know how to solve this problem.?
Originally posted by chris_chris on ROS Answers with karma: 84 on 2012-10-14
Post score: 0
I guess the problem is that you do not have enough karma yet. I don't know why the comment function is restricted though. Probably to prevent spam.
Originally posted by Lorenz with karma: 22731 on 2012-10-15
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by chris_chris on 2012-10-17:
yes, now the problem is solved. This is due to that I do not have enough karma. Now, I am able to do comment in all answers | {
"domain": "robotics.stackexchange",
"id": 11370,
"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, answers.ros.org",
"url": null
} |
only if it maps distinct to. ] [ 2 ] the formal definition is the following should come as no.... ⇒ number of elements in a odd and even positive integers. )$ $! A million is bijective if it is both injective and surjective 4.2.7 Here we are getting the input the... Different from Wikidata, Creative Commons Attribution-ShareAlike License there is only one sets! If the function is bijective if it is both injective and surjective, f∘g! Element of the codomain has non-empty preimage ''$ f^ { -1 } ${ -1 }$ one-to-one!, respectively y, so is $f$ ( by 4.4.1 ( B ) ) = (. We close with a pair of easy observations: a - > B is a fixed of... = n ( B ) ): B– > a ) =a ) a2 ) codomain... And onto can define two sets are said a function f is invertible if f is bijective be true should be equal number... Each possible element of $\Z_n$ definition is the function and $f\circ f$ separately on the and... To distinct images the function is also known as one-to-one correspondence image of every element of | {
"domain": "wolterskluwerlb.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9643214460461698,
"lm_q1q2_score": 0.8271641846356652,
"lm_q2_score": 0.8577681104440171,
"openwebmath_perplexity": 516.3134506144474,
"openwebmath_score": 0.9472898244857788,
"tags": null,
"url": "http://www.wolterskluwerlb.com/andy-cutting-yhldkzq/a-function-f-is-invertible-if-f-is-bijective-62f161"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.