text stringlengths 1 1.11k | source dict |
|---|---|
The unit circle has parametric representation $x=\cos t$, $y=\sin t$. Applying the affine transformation to this unit circle gives the parametric representation $x=\frac{4}{3}(1-\cos t-\sqrt{3}\sin t)$, $y=1-\cos t+\sqrt{3}\sin t$ for the desired ellipse.
edit: Looking at Moron's answer, his choice of x and y coordinates are swapped relative to mine, and as he said, his right triangle is translated to have its centroid at the origin, but accounting for these differences, my parametric equations satisfy his equation. That is, based on his equation, an equation in x and y alone for the ellipse with parametric equations as I specified is $9x^2+12xy+16y^2-36x-48y=0$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9783846640860382,
"lm_q1q2_score": 0.8195145264575997,
"lm_q2_score": 0.8376199633332891,
"openwebmath_perplexity": 606.2243796917801,
"openwebmath_score": 0.8889537453651428,
"tags": null,
"url": "http://math.stackexchange.com/questions/3531/minimal-ellipse-circumscribing-a-right-triangle"
} |
for the volume of a sphere to solve problems involving volume and capacity. So, here we are going to solve for a spherical balloon. Volume Formula: Volume is defined as the space occupied within a 3-dimensional solid object. The starting point represents the analytical solution of the spherical gradiometric. The radius of the balloon, in feet, is modeled by a twice-differentiable function r of time t, where t is measured in minutes. The balloon is inflated at a constant rate of 10 cm^3 s^-1. To calculate the volume of a sphere, use the formula v = ⁴⁄₃πr³, where r is the radius of the sphere. (a)What is the volume formula for a sphere? (b)How fast does the volume of a spherical balloon change with respect to its radius? (c)How fast does the volume of the balloon change with respect to time? (d)If the radius is increasing at a constant rate of 0. 1) A balloon has a volume of 1. Showing 1 - 200 of 6,038 resources. The truncated icosahedron is an Archimedean solid. 45 grams per meter. If | {
"domain": "rakumanu.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9888419690807408,
"lm_q1q2_score": 0.8303641861309318,
"lm_q2_score": 0.839733963661418,
"openwebmath_perplexity": 448.4237867004272,
"openwebmath_score": 0.8477767109870911,
"tags": null,
"url": "http://wfab.rakumanu.it/spherical-balloon-volume-formula.html"
} |
newtonian-gravity, symmetry, planets, distance
The only exception to this is the gravity due to a sphere...in this case we can use the distance from the center of the sphere to compute the force due to gravity. But this is a very special result that comes about from the "breaking apart" that I described above...it just so happens that things work out the same as if we had just used the center of the sphere. For example, see here. | {
"domain": "physics.stackexchange",
"id": 97367,
"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-gravity, symmetry, planets, distance",
"url": null
} |
c++, error-handling, c++20, exception
std::string msg = (char const*)buf;
::LocalFree(buf);
throw std::runtime_error(msg);
}
}
}
} | {
"domain": "codereview.stackexchange",
"id": 45311,
"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++, error-handling, c++20, exception",
"url": null
} |
ros, catkin, libraries, catkin-package
Originally posted by William with karma: 17335 on 2013-07-05
This answer was ACCEPTED on the original site
Post score: 5
Original comments
Comment by Thiemo on 2013-07-07:
Thanks for the answer. I looked into it and I will try to adapt it. | {
"domain": "robotics.stackexchange",
"id": 38608,
"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, catkin, libraries, catkin-package",
"url": null
} |
kinematics, acceleration, mathematics, displacement
% qaaiaaigdaaeaacaaIYaGaaiyiaaaacqGHRaWkdaWcaaqaaiaaigda
% aeaacaaIZaGaaiyiaaaacqGHRaWkdaWcaaqaaiaaigdaaeaacaaI0a
% GaaiyiaaaacqGHRaWkdaWcaaqaaiaaigdaaeaacaaI1aGaaiyiaaaa
% cqGHRaWkcaGGUaGaaiOlaiaac6cacqGH9aqpcaaIXaGaey4kaSIaaG
% ymaiabgUcaRmaalaaabaGaaGymaaqaaiaaikdaaaGaey4kaSYaaSaa
% aeaacaaIXaaabaGaaGOnaaaacqGHRaWkdaWcaaqaaiaaigdaaeaaca
% aIYaGaaGinaaaacqGHRaWkdaWcaaqaaiaaigdaaeaacaaIXaGaaGOm
% aiaaicdaaaGaey4kaSIaaiOlaiaac6cacaGGUaaaaa!69B7!
$ | {
"domain": "physics.stackexchange",
"id": 71843,
"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, acceleration, mathematics, displacement",
"url": null
} |
quantum-field-theory, particle-physics, mass, charge
Title: Why cannot massless particles carry charges? How to show that massless particles do not carry charges from QFT's point of view? Massless particles can carry and do carry confined charges (gluon in QCD) and they may carry charges under spontaneously broken generators (photon is transforming e.g. under the generators of $SU(2)$ associated with the W-bosons) but they cannot carry charges under unconfined $U(1)$ force like electromagnetism.
The reason may be explained in different ways. One of them is using "running couplings". Renormalization implies that the electromagnetic coupling constant "runs". The dimensionless value of $e$, while naively constant in classical physics, has a subtle dependence on $\log E$ according to quantum mechanics thanks to the shielding by polarized particle-antiparticle pairs. | {
"domain": "physics.stackexchange",
"id": 24043,
"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, particle-physics, mass, charge",
"url": null
} |
newtonian-mechanics, forces, inertial-frames, definition
Unrelated sidenote:
I had posted this exact same question on physicsforums a while back, but I was accused of being a troll (and was banned) for signing up with my completely legitimate and verified cock.li email address. Also, a so-called mentor edited some of my replies after I had posted them. It was a very upsetting experience. Your statements starting with "in an inertial reference frame" are indeed trivially true, because of the definition of the inertial frame: inertial frame is a frame where the first and the second law are true. You're using modern formulations here that are not the original Newton laws. | {
"domain": "physics.stackexchange",
"id": 93945,
"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, inertial-frames, definition",
"url": null
} |
classical-mechanics, lagrangian-formalism, hamiltonian-formalism, phase-space, poisson-brackets
Title: Is it possible to obtain an analogous of Liouville's Theorem in terms of the Configuration Space? Is it possible to obtain an analogous of Liouville's Theorem in terms of the Configuration Space (or the tangent space thereof)?
If not, why is this result obtainable only in the Hamiltonian formulation? According to several books some of the results in classical mechanics are only possible, or at least obvious, due to the Hamiltonian and Phase Space properties, but the reason has never been clear to me. What are the fundamental differences between the Configuration and Phase Spaces, besides the obvious distinction between the set of variables used by them. No, not in general. For starter, unlike the cotangent space $T^{\ast}M$, which has a canonical volume form
$$\Omega~=~\frac{1}{n!}\omega^{\wedge n},\tag{1}$$ where
$$\omega~=~\sum_{i=1}^n \mathrm{d}p_i\wedge \mathrm{d}q^i \tag{2}$$ | {
"domain": "physics.stackexchange",
"id": 43253,
"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": "classical-mechanics, lagrangian-formalism, hamiltonian-formalism, phase-space, poisson-brackets",
"url": null
} |
quantum-mechanics, hilbert-space, probability, observables, quantum-states
\begin{equation}
\text{Prob}(R=r|\rho) = \langle r_n |\rho | r_n \rangle
\end{equation}
with $r_n$ expressing the (non-degenerate) eigenstates belonging to specific eigenenergies of the operator $R$. My question is; is the method for determining the probability of each state using coefficients equivalent to using the state operator? The short answer is: Yes these two ways are equivalent. Let's look at the reason for why that is:
Let's assume we have some Observable $A$ with a discrete spectrum and a basis of eigenvectors $| a_n \rangle$ where the eigenvector $|a_n\rangle$ has the eigenvalue $a_n$. Let's also assume that our system is described by a pure state $|\psi\rangle$. Then we can write
\begin{equation}
|\psi\rangle = \sum_{n} c_n |a_n\rangle
\end{equation} | {
"domain": "physics.stackexchange",
"id": 97546,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, hilbert-space, probability, observables, quantum-states",
"url": null
} |
Nothing wrong with Anurag's answer. I just feel like pointing out a slightly different recursive approach. The proof will be by induction on $$n$$, but before we get to that part we need to build a conjecture of what the answer might be.
Consider the $$r$$-subsets of $$\{1,2,\ldots,n\}$$, so obviously $$r\le n$$. There are $$\binom n r$$ such sets. Let us split them into two subcollections according to whether the maximum, $$n$$, is included. There are $$\binom {n-1} r$$ ways of choosing $$r$$ numbers without including $$n$$, and $$\binom {n-1} {r-1}$$ ways of choosing $$r$$ numbers including $$n$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.976310532836284,
"lm_q1q2_score": 0.8114537057924728,
"lm_q2_score": 0.8311430415844384,
"openwebmath_perplexity": 349.7637264254024,
"openwebmath_score": 0.8971453905105591,
"tags": null,
"url": "https://math.stackexchange.com/questions/3303126/problem-to-find-arithmetic-mean-of-the-largest-elements-of-r-subsets-of-1-2"
} |
general-relativity, black-holes, relativity, spherical-harmonics
So those are equivalent to your Newtonian approximations to a non perfect earth. Although much more complex the same is done in General Relativity.
For two Black Holes merging it is also more complex because in the strong field regime you need to integrate solutions numerically for the two body problem, so more complex than the Newtonian reduction to a one body problem. | {
"domain": "physics.stackexchange",
"id": 40754,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, black-holes, relativity, spherical-harmonics",
"url": null
} |
pressure, ideal-gas, stellar-physics
As a special case, if you take $n\rightarrow\infty$ in the polytropic equation, essentially giving the ideal gas equation itself, with the assumption of constant temperature throughout the star, the solution is called an "isothermal sphere" - but this does not model the sun very well.
For the general case, knowing this radius $R$ (assuming you want the experimental value), you can plug in the integration constants to get $\rho(r)$, and the mass is simply
$$M = \int_{0}^{R}4\pi r^2\rho(r)dr$$
Also note that you will need one of the total mass or the radius of the star to find the other. | {
"domain": "physics.stackexchange",
"id": 21551,
"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": "pressure, ideal-gas, stellar-physics",
"url": null
} |
andrewkirk
Homework Helper
Gold Member
I like your analysis. It had not occurred to me that a function is a special case of a relation. I had thought of them as completely separate beasts.
I think the statement that starts 'When we find the inverse function of a function ...' causes trouble. The 'the' needs to be 'an', because a function that is not injective will have many inverse functions. An inverse function is a function that, when composed with the original in either order, gives the identity function on the relevant domain. It follows that any function that is non-injective on a subset of its domain that has an image of infinite cardinality has infinitely many different inverse functions. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9553191284552529,
"lm_q1q2_score": 0.8119937281871696,
"lm_q2_score": 0.849971181358171,
"openwebmath_perplexity": 584.2387796509345,
"openwebmath_score": 0.8378942012786865,
"tags": null,
"url": "https://www.physicsforums.com/threads/inverse-functions-vs-inverse-relations.950182/"
} |
plastic, welding
Thank you very much for advises ! It's not yet an answer but that's useful hints! So consider it as an interim solution.
I have just made some experiments and I can tell when holes appear in stretch film while heating it with heat gun and when they don't : actually it depends on whether the film is already stretched (even slightly) or not.
So one solution would be to make the walls aside from the walls (apart, eg on the floor) and then gently put it on the frame. That's not easy but as soon as the film is stretched it's very hard to avoid holes when "welding" two sheets together. Whereas without tension the sheets can melt and merge together before holes appear. | {
"domain": "engineering.stackexchange",
"id": 5142,
"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": "plastic, welding",
"url": null
} |
machine-learning, reinforcement-learning, markov-decision-process
Is my understanding correct? Your understanding is right!
Using a probabilistic transition function allows the model to explore a bigger search space before making a decision. One of the most important use cases of MDP is in POS tagging in NLP using a Hidden Markov Model.
In case of a deterministic model, search space is limited by the number of transitions and hence at each step, a definite decision is made. This does not take into regard the possibility of relationship between the previous states, rather only deals with the current and next state. These model are good for solving a certain range of tasks like decision trees etc.
When it come to tasks such as weather prediction, there is significance to the historical weather data. In such cases, we cannot make use of a deterministic approach. You always predict the chance of rainfall etc. | {
"domain": "ai.stackexchange",
"id": 1188,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, reinforcement-learning, markov-decision-process",
"url": null
} |
beginner, scala, caesar-cipher
for-comprehensions instead of repeated concatenation to an empty string
pattern matching instead of if-else.
object SimpSub {
private val alphabet = ('A' to 'Z').toList
def encipher(key: String, text: String): String = {
// Build the cipher alphabet by concatenating the key to
// the alphabet and removing duplicate letters
val cipherAlphabet = (key.toUpperCase.toList ::: alphabet).distinct
val cipherText = for (c <- text.toUpperCase) yield c match {
case ' ' => ' '
case _ => cipherAlphabet(alphabet.indexOf(c))
}
return cipherText.mkString
}
def main(args: Array[String]) {
val Array(text, key) = args
println("Plaintext: " + text)
println("Key: " + key)
println("Ciphertext: " + encipher(key, text))
}
} | {
"domain": "codereview.stackexchange",
"id": 14554,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, scala, caesar-cipher",
"url": null
} |
c#, asp.net-web-api
<Button Grid.Row="1" Grid.Column="0" Content="Get All Shares" Command="{Binding GetAllSharesCommand,Mode=TwoWay}"/>
<Button Grid.Row="1" Grid.Column="1" Content="Get My Shares" Command="{Binding GetSharePerUserCommand,Mode=TwoWay}"/>
<DataGrid Grid.Row="2" ItemsSource="{Binding Shares}"> | {
"domain": "codereview.stackexchange",
"id": 26394,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, asp.net-web-api",
"url": null
} |
(xxviii) “Uncle Fred in the Springtime”, by P.G. Wodehouse.
(xxix) “The Tempest”, by W. Shakespeare.
(xxx) “The 1926 Zürich International Checkers Tournament, containing all games transcribed and annotated according to a new system”, by S. Higgs.
(xxxi) “A day at the Oval”, by G.H. Hardy.
(xxxii) “Harmonices Mundi”, by J. Kepler, initialed I.N on the second page.
(xxxiii) “Stories of cats and gulls”, by G. Lagaffe.
(xxxiv) “Traité sur la possibilité d’une monarchie générale en Italie”, by N. Faria; loose handwritten manuscript on silk.
(xxxv) “Broke Down Engine”, 78 rpm LP record, interpreted by Blind Willie McTell.
(xxxvi) “Les plages de France, Belgique et Hollande”, by A. Unepierre.
(xxxvii) “La Légende du Cochon Voleur et de l’Oiseau Rageur”, traditional folktale, translated from the Arabic by P. Teilhard de Chardin. | {
"domain": "ethz.ch",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307684643189,
"lm_q1q2_score": 0.8106838084510738,
"lm_q2_score": 0.8333245973817158,
"openwebmath_perplexity": 2721.254008989967,
"openwebmath_score": 0.7639570236206055,
"tags": null,
"url": "http://blogs.ethz.ch/kowalski/page/3/"
} |
matlab, fft, phase, bandpass, amplitude
lower frequency's wavelengths, and 32 of the higher frequencies, or some greater multiplesv when you take the DFT, the frequencies should be adequately centered on their respective bins. Then you can get a good read on the phase and amplitude directly from their respective bin values. They should be far enough apart that leakage or harmonics will not significantly interfere with your results. | {
"domain": "dsp.stackexchange",
"id": 5975,
"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": "matlab, fft, phase, bandpass, amplitude",
"url": null
} |
java, stack
Title: Checking if a Stack is sorted in ascending order
Write a method isSorted that accepts a stack of integers as a parameter and returns true if the elements in the stack occur in
ascending (non-decreasing) order from top to bottom, and false
otherwise. That is, the smallest element should be on top, growing
larger toward the bottom. For example, passing the following stack to
your method should cause it to return true:
bottom [20, 20, 17, 11, 8, 8, 3, 2] top
The following stack is not sorted (the 15 is out of place), so passing it to your method should return a result of false:
bottom [18, 12, 15, 6, 1] top
An empty or one-element stack is considered to be sorted. When your method returns, the stack should be in the same state as when it
was passed in. In other words, if your method modifies the stack, you
must restore it before returning.
Obey the following restrictions in your solution: | {
"domain": "codereview.stackexchange",
"id": 28501,
"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, stack",
"url": null
} |
c++, performance, numerical-methods, neural-network, eigen
Timing Information
---------------------------------------------
| n_x | command-line arg | SGE? | Time |
---------------------------------------------
| 2 | 1 | no | 6 s |
---------------------------------------------
| 2 | 1 | yes | 30 s |
---------------------------------------------
| 100 | 1 | no | 10 m 16 s |
---------------------------------------------
| 100 | 1 | yes | 53 m 5 s |
--------------------------------------------- If you skim the relevant part of the paper which this analysis is attempting to replicate (cf. the link in the Round 1 question), you'll see that my code saves an intermediate result on the way to the final result that is plotted in Figure 1. Figure 1 plots sigma_N, whereas I'm saving V here. | {
"domain": "codereview.stackexchange",
"id": 16229,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, performance, numerical-methods, neural-network, eigen",
"url": null
} |
np-complete, np-hard, np, decision-problem
Is it NP hard?
Is it NP complete? Recognizing that a path is a Hamiltonian path is easy. Finding one in the first place may be hard (the number of candidates is large).
The defining property of problems in NP is that verifying a solution is "easy" (in P). Your problem is one part of verifying a solution of a Hamiltonian path problem. (You also have to verify that the path is a subgraph of the input graph.) | {
"domain": "cs.stackexchange",
"id": 18212,
"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": "np-complete, np-hard, np, decision-problem",
"url": null
} |
homework-and-exercises, electric-circuits, electric-current, voltage, weight
Depending on how the motor is controlled, if weight reduces by half, then
either I or U need to be reduced by half.
If you want to reduce I or U by connecting resistor R2 in sequence to the motor, then you need, at the very least, to know I and U, and calculate the dissipation power. You might be surprised.
Small resistors are between 0.1W to 1W only. What is power of your motor. Motor can be kilowatts.
Resistors are good for several watts only. Above that, resistor will be huge size, it might overheat, and it will waste energy.
Resisters are not how bigger motors are controlled!
Better methods of controlling big AC motor are transformer or semiconductor circuit, not resistors. | {
"domain": "physics.stackexchange",
"id": 677,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, electric-circuits, electric-current, voltage, weight",
"url": null
} |
By taking imaginary parts, we deduce that
$$\int_0^{+\infty}\frac{\ln(x)}{(1+x^2)^2}\ dx=-\frac\pi4$$
• In the third line of evaluating the integral, should it not be this: $$\int_0^{+\infty}\frac{[\ln(x)]^2-[\ln(x)]^2-4\pi i\ln(x)+4\pi^2}{(1+x^2)^2}\ dx$$? And if so, does this change the answer, or was this a typo (or am I missing something)? – John Doe May 21 '17 at 11:58
• @JohnDoe Ah yes, missed a negative, though it does not change the end result. – Simply Beautiful Art May 21 '17 at 12:02
Try the following integration by parts: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138190064204,
"lm_q1q2_score": 0.808287543311331,
"lm_q2_score": 0.8267117919359419,
"openwebmath_perplexity": 918.0222006236005,
"openwebmath_score": 0.9978640675544739,
"tags": null,
"url": "https://math.stackexchange.com/questions/2290308/is-this-definite-integral-possible-to-evaluate-int-0-infty-frac-log-x1x/2290340"
} |
complexity-theory, np-complete, reductions, partitions
Is this reduction polynomial? I mean, the choice of $A'$ is arbitrary and itself is a correct instance for the problem of SUBSET-SUM for A with target value equal to $2m/3$ which is hard to compute. If this computation plays a part in the transformation then the latter can't be polynomial, right? I guess that this question should not be left floating around unanswered.
The reasoning in (b) can't be used to prove that this problem is NP-complete because, at best, it implies the reduction from 3PARTITION to PARTITION which is of no use. Any problem in NP can be reduced to PARTITION.
The proper way of doing this (after showing that the problem is in NP) is to:
i) Start from an arbitrary instance of PARTITION | {
"domain": "cs.stackexchange",
"id": 8430,
"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-complete, reductions, partitions",
"url": null
} |
quantum-mechanics, wavefunction, potential-energy, integration
I looked up all terms : $\hbar$ is of course the reduced Planck constant, $e$ is the elementary charge, $a$ is the Bohr radius I guess, $\epsilon_0$ the vacuum permittivity, and $m$ the mass.
But I just don't see how they go from $(-\frac{e^2}{4\pi \epsilon_0})$ to $(-\frac{\hbar ^2}{ma})$ ? Even after searching for several hours on the internet, I couldn't find how the two terms are related.
Any help/ hint would be appreciated. Thank you. Simply, it is just a matter of definitions. Being
$$
a=\frac{\hbar^24\pi\epsilon_0}{me^2},
$$
a constant generally called Bohr's radius, you can invert this formula to obtain $e^2/4\pi\epsilon_0$ instead. Then, put it in your equation and you are done. | {
"domain": "physics.stackexchange",
"id": 62236,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, wavefunction, potential-energy, integration",
"url": null
} |
vba, excel, join
Public varScreenUpdating As Variant
Public varEnableEvents As Variant
Public varCalculation As Variant
Public Function IsWorkbookOpen(ByVal strTargetName As String) As Boolean
On Error Resume Next
Workbooks(strTargetName).Activate
IsWorkbookOpen = (ActiveWorkbook.Name = strTargetName)
On Error GoTo 0
End Function
Public Sub PutSheetDataInArray(ByRef wbCurrentWorkbook As Workbook, ByRef wsCurrentWorksheet As Worksheet, ByRef arrCurrentArray As Variant, Optional ByVal strTopLeftCellIdentifier As Variant, _
Optional ByVal lngStartRow As Long = 1, Optional ByVal lngEndRow As Long = 10, _
Optional ByVal lngStartColumn As Long = 1, Optional ByVal lngEndColumn As Long = 10) | {
"domain": "codereview.stackexchange",
"id": 15420,
"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": "vba, excel, join",
"url": null
} |
general-relativity, special-relativity, relativity, twin-paradox
At their meeting A's clock indicates $n$ ticks after the synchronized "pre agreed upon start time", and B's clock indicates $n \sqrt{ 1 - \beta^2 }$ ticks after the synchronized "pre agreed upon start time";
or almost, approximately, as far as the "acceleration phase" B is of negligible duration compared to the "drift phase".
The important point is: B's duration from indicating the "pre agreed upon start time" (and starting to accelerate towards A) until indicating the meeting and passing of A is shorter by a factor of $\sqrt{ 1 - \beta^2 }$ than A's duration from indicating the "pre agreed upon start time" until indicating the meeting and passing of B.
The following sketch illustrates the case of $\beta = 0.6$, therefore with mutual blueshift factor $\sqrt{ \frac{1 + \beta}{1 - \beta} } = 2$:
When B decelerates and enters A's reference frame would he observe A spontaneously age? | {
"domain": "physics.stackexchange",
"id": 17698,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, special-relativity, relativity, twin-paradox",
"url": null
} |
organic-chemistry, terminology
Thinking about the situation mechanistically, the Markovnikov rule basically just says that the less electronegative atom in the polar reagent $\ce{RX}$ ends up bound to the end of the alkene (or alkyne) most able to stabilise a developing positive charge (i.e. the most hindered end of the alkene/alkyne).
In terms of labelling the products of reactions, as discussed in your question, its perfectly valid to describe the products as those of Markovnikov addition (as stated previously, the term itself is saying nothing directly about mechanism, even if implied). | {
"domain": "chemistry.stackexchange",
"id": 8245,
"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, terminology",
"url": null
} |
c#, entity-framework, finance, asp.net-web-api
You should have your database handle the concurrency when possible. If using SQL you should use the rowversion field or timestamp field if older SQL. Then configure your entity with the TimeStampAttribute or if using fluent then the isconcurrencytoken method. This value will change automatically by SQL every time a field has been changed. Entityframe work will use this and throw an OptimisticConcurrencyException if you update and that value has changed. You can trap for that error and know that the data has changed since you have retrieved that data. | {
"domain": "codereview.stackexchange",
"id": 24114,
"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#, entity-framework, finance, asp.net-web-api",
"url": null
} |
openni, openni-kinect
Originally posted by Hansg91 with karma: 1909 on 2012-01-08
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by Jong H Kim on 2012-01-11:
Thank you I was confused. I was thinking I need to follow 3.1 and 3.2 as well. Thank you for you answer. | {
"domain": "robotics.stackexchange",
"id": 7818,
"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": "openni, openni-kinect",
"url": null
} |
python, python-3.x
def tabular(table, widths):
def sandwich(delim, contents):
return delim + delim.join(contents) + delim
def cell(value, width):
return ' ' + str(value).ljust(width - 2)
def cells(row):
return sandwich('|', (cell(col, w) for col, w in zip(row, widths))) + '\n'
horiz_rule = sandwich('+', ('-' * (w - 1) for w in widths)) + '\n'
return sandwich(horiz_rule, (cells(row) for row in table))
# In Python 3.7, this should be a @dataclass instead:
class Item(namedtuple('Item', 'name price')):
def __new__(cls, name, price):
return super().__new__(cls, name, Decimal(price))
def main():
menu_items = OrderedDict(zip(ascii_uppercase, [
Item('The "Big Boy" Burger', '16.99'),
Item('French Fries', '5.99'),
Item('Currie sauce', '19.99'),
Item('Napkins with Chokolates', '10.50'),
Item('Juice Box', '89.01'),
Item('Takeout', '18.99'),
])) | {
"domain": "codereview.stackexchange",
"id": 32194,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x",
"url": null
} |
digital-communications, ofdm, multi-channel
However, what we can see is that because the symbol period is now longer for each subcarrier, the signal switched less frequently, and so the bandwidth of the pulse shaped signal is less that 10Hz, so a 10Hz subcarrier spacing no longer makes sense. So I ask:
Should pulse shaping be used with non-orthogonal multicarrier modulation, and if so, what subcarrier spacing should be used?
Thanks! Yes, if we are not using orthogonal frequency multiplexing and concerned about interference in adjacent channels (specifically if we want to constrain the total spectral occupancy for one channel) then pulse shaping is a good solution. In fact, this is the only reason I am aware of for doing any pulse shaping at all- minimizing the spectral occupation of the signal. | {
"domain": "dsp.stackexchange",
"id": 11086,
"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": "digital-communications, ofdm, multi-channel",
"url": null
} |
-
EDIT : The case (1) in my answer has a big mistake. The case (2) is true.
$(x,y)=(0,0)$ is one of the solutions. In the following, suppose that $(x,y)\not=(0,0).$
We have $$x(x+1)(x^2+1)=y^2.$$ First, we know that $x$ and $x+1$ are coprime, and that $x$ and $x^2+1$ are coprime, too. This leads that there is an integer $k$ such that $x=k^2.$ (see the right hand side)
In the following, we break up the answer into two cases.
(1) The case that $x+1$ and $x^2+1$ are not coprime.
Letting $$x+1=ps,x^2+1=pt\ \ (\text{p is a prime number, s,t\in\mathbb Z})$$ we have $$(ps-1)^2+1=pt\iff p(t-ps^2+2s)=2\Rightarrow p=2.$$ So, we know we only have the following possibilities : $$x+1=0,\pm1, \pm2^k\Rightarrow x=-1,0,-2,-1\pm2^k.$$ However, we have $x\not=-1, x\not=0, x\not=-2$, because $x$ has to be a square of an integer (and $x\not=0$). So, we have $$x=-1\pm2^k.$$ In the same argument, we have $$x^2=-1\pm2^l.$$ Note that $k,l\ge1\in\mathbb Z.$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806472775278,
"lm_q1q2_score": 0.8315007733806027,
"lm_q2_score": 0.8479677583778258,
"openwebmath_perplexity": 218.59380045892868,
"openwebmath_score": 0.9599784016609192,
"tags": null,
"url": "http://math.stackexchange.com/questions/624792/find-all-integer-solutions-x4x3x2x-y2/626372"
} |
python, algorithm, memory-optimization
if __name__ == '__main__':
print(unique_paths(7, 3)) # = 28 - test case
Edit:
lru_cache is really amazing:
from functools import lru_cache
@lru_cache(128)
def numberOfPaths(m, n):
if m == 1 and n == 1: # border case
return 1
if m != 1 and n != 1:
return numberOfPaths(m - 1, n) + numberOfPaths(m, n - 1)
if m != 1 and n == 1:
return numberOfPaths(m - 1, n)
if m == 1 and n != 1:
return numberOfPaths(m, n - 1)
if __name__ == '__main__':
print(numberOfPaths(100, 100)) # 22750883079422934966181954039568885395604168260154104734000
``` Solution: recursion with memoization works really well! Many thanks to Samwise and vnp.
With the help of python lru_cache decorator:
@lru_cache(128)
def number_of_paths(m, n):
if m == 1 and n == 1: # border case
result = 1
elif m != 1 and n != 1:
result = number_of_paths(m - 1, n) + number_of_paths(m, n - 1) | {
"domain": "codereview.stackexchange",
"id": 38053,
"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, algorithm, memory-optimization",
"url": null
} |
error-correction, fault-tolerance
Title: Reference on MITxPRO Applications of Quantum Computing Professional Certificate Program Recently I found out the Applications of Quantum Computing Professional Certificate Program that MITxPRO is offering for people interested in quantum computing. I saw that it is consisted of four courses that can be done independently or as a whole program. This is the link for the course.
I am especially interested in just the last one of such four courses, but I do not know if it would be necessary to take the other ones so that I could do such course. | {
"domain": "quantumcomputing.stackexchange",
"id": 1111,
"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-correction, fault-tolerance",
"url": null
} |
Note: The base unit of \$N is kgm/s^2, which needs to be converted too.
Your mistake/discrepancy was caused by terminating the conversion too early before getting to the bottom of it.
Check:
$$EI = 8*10^{11} N-mm^2 = \dfrac{8*10^{11}kgm-mm^2}{s^2}*\dfrac{10^3mm}{m} = \dfrac{8*10^{14}kg-mm^3}{s^2}$$
$$\omega = \sqrt{\dfrac{15*8*10^{14}kg-mm^3}{250kg*(2500mm)^3*s^2}} = 55.42Hz$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.975576914916509,
"lm_q1q2_score": 0.8171626937694236,
"lm_q2_score": 0.8376199572530448,
"openwebmath_perplexity": 378.35914425502875,
"openwebmath_score": 0.8583199381828308,
"tags": null,
"url": "https://engineering.stackexchange.com/questions/51013/natural-frequency-of-a-shear-frame/51021"
} |
forces, energy
Thanks The gravitational potential energy released during your fall through the atmosphere shows up as an increase in your velocity and hence your kinetic energy as you accelerate downwards. As your speed through the air increases, so does the viscuous drag being applied to your body by the air through which you are moving.
Terminal velocity is reached when the rate of release of gravitational energy during your fall is exactly balanced by the rate of energy loss because of air friction. Ignoring for now the increase in air density with decreasing altitude, at that point your velocity and hence your kinetic energy remains constant for the remainder of your descent and all the "extra" gravitational potential energy being released beyond that point is being continuously dissipated by air friction.
That dissipated energy shows up as sound waves (noise) and heat in the air. | {
"domain": "physics.stackexchange",
"id": 49495,
"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": "forces, energy",
"url": null
} |
quantum-algorithms, deutsch-jozsa-algorithm
Let us suppose we have two pure states: $|\phi\rangle$ and $|\psi\rangle$, where
$$
|\phi\rangle = \frac{1}{\sqrt{N}}\sum_{i=1}^N |x_i\rangle
$$
and $|\psi\rangle$ is similar to $|\phi\rangle$ but with a few of the coefficients tweaked in some way. Notice that we're fixing just two states, and even if you're promised that you're given one of these two states it will not be possible to determine which one you're given with high probability, under the assumption that $|\phi\rangle$ and $|\psi\rangle$ are close together. (As DaftWullie has suggested, a variant of this problem where $|\phi\rangle$ is fixed and $|\psi\rangle$ is not known ahead of time is certainly no easier than the case in which $|\psi\rangle$ is known ahead of time.) | {
"domain": "quantumcomputing.stackexchange",
"id": 455,
"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-algorithms, deutsch-jozsa-algorithm",
"url": null
} |
python, python-3.x, html
return User_Name
But what if we want to force the user to give us an input we can use as a name? We can keep asking indefinite number of times until we get an answer?
Here is a straightforward function that will keep querying a user until a valid response is recieved. it will allow special characters/numbers in input.
def askUser(question):
response = '' #start with an empty string
while response == '': #until we get a non empty response
response = input(question) #keep asking the user
return response #when we get an answer return it | {
"domain": "codereview.stackexchange",
"id": 27422,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x, html",
"url": null
} |
php, mvc, codeigniter, twig
$data = $this->Static_model->get_static_data()
+ [
'base_url' => $baseUrl,
'pages' => $this->Pages_model->get_pages(),
'categories' => $this->Categories_model->get_categories(),
'posts' = $this->Posts_model->get_posts(...$rangeParameters)
];
$this->twig->addGlobal('maincss', base_url('themes/caminar/assets/css/main.css'));
$this->twig->addGlobal('pagination', $this->pagination->create_links());
$this->twig->display('themes/caminar/layout', $data);
}
...
} | {
"domain": "codereview.stackexchange",
"id": 39996,
"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, mvc, codeigniter, twig",
"url": null
} |
kobuki
I understand I need the "crimp pins" and a "crimp tool", but I don't know exactly what to do and don't know how to connect it with a DC male plug.. Please help!
I'm trying to power a small external LCD screen like https://www.ebay.com.au/itm/New-7-inch-HD-HDMI-LCD-Display-Screen-Monitor-VGA-HDMI-AV-Audio-Black-/143404057545
Comment by ahendrix on 2019-11-24:
Instead of buying crimp pins and a crimper, you can also buy pre-crimped wires with the micro-fit crimp pins from digikey: https://www.digikey.com/product-detail/en/molex/0430300001-12-B0/0430300001-12-B0-ND/5962941 . Digikey sells these in a variety of lengths and colors. Then you just stick these in the two-pin housing, and hook the other end up to the DC plug for your screen.
Comment by danie11am on 2019-11-24: | {
"domain": "robotics.stackexchange",
"id": 24867,
"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": "kobuki",
"url": null
} |
ros, rosdep, rosgraph, homebrew, osx
Originally posted by Yeison Rodriguez with karma: 103 on 2013-03-25
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by joq on 2013-03-25:
Thanks! That is the intended solution for problems like this one. | {
"domain": "robotics.stackexchange",
"id": 13523,
"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, rosdep, rosgraph, homebrew, osx",
"url": null
} |
quantum-mechanics, general-relativity, black-holes, photons
More than that, from the energy that gets to the mirror before the horizon the fraction that could actually get back to outside observers, is also decreasing and drops to zero as the mirror approaches the horizon. This is due to two effects. Fist, the normal component of photons momentum is redshifted if reflected from the mirror moving away from it. Second, a photon may be able to escape the near-horizon region only if it does not have too large angular momentum to energy ratio. In other words, the photon momentum must be within an "escape cone" around a radial normal to the mirror, which gets narrower the closer to horizon the mirror gets (for example for $\frac{r-r_s}{r_s}=10^{-5}$ the angle would be about $1^\circ$). Since reflection does not change the angular momentum of a photon but lowers its energy for a mirror near the horizon only photons moving near radially would reflect on the trajectory escaping the black hole and their energy (as measured by a static observer) would be | {
"domain": "physics.stackexchange",
"id": 50723,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, general-relativity, black-holes, photons",
"url": null
} |
performance, php, datetime, mysqli
This should give you an array of rows, each row would have inactive_days holding the number of days between today and last seen day, and num_rows holding the number of records that were grouped into that row. The result set is also ordered with the fewest inactive days first. Your PHP script could then use that result as needed. If you fetch the array and call it $result, you could do
foreach($result as $row):
echo "$row[num_rows] users where last seen $row[inactive_days] days ago";
endforeach;
Quick notes:
Be sure to test! I may have a bug in my code, but you get the gist. If you find a bug, leave a comment asking me to fix it.
Don't do anything you don't understand. Take the time to learn what each line of code does, so you can get better, catch errors and even improve upon it.
If the order of the results doesn't matter to your logic, don't use the ORDER BY clause; sorting is computationally expensive and should only be used when needed | {
"domain": "codereview.stackexchange",
"id": 20515,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, php, datetime, mysqli",
"url": null
} |
particle-physics, standard-model, neutrinos, weak-interaction
$|\nu_e>$ and $|\nu_\mu>$. One can write one set of states as a linear combination of the other one (mixing):
\begin{align}
|\nu_e> &= \cos(\theta) |\nu_1> + \sin(\theta) |\nu_2> \\
|\nu_\mu> &= -\sin(\theta) |\nu_1> + \cos(\theta) |\nu_2>
\end{align}
This is a simple two-state system.
Let's say we prepare a state as $|\psi(0)> = |\nu_e>$, then this state will propagate according to
\begin{equation}
|\psi(\vec{x}, t)> = \cos(\theta) |\nu_1> e^{-ip_1 \cdot x} + \sin(\theta) e^{-ip_2 \cdot x} |\nu_2>
\end{equation}
where the evolution in the propagation eigenbasis is given by plane waves. | {
"domain": "physics.stackexchange",
"id": 70896,
"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": "particle-physics, standard-model, neutrinos, weak-interaction",
"url": null
} |
newtonian-mechanics, forces, everyday-life, continuum-mechanics, stress-strain
What this means is that it's easy to curve paper extrinsically but very hard to curve it intrinsically.
And now I will wave my hands a bit: if you curve paper into a 'U' shape as you have done, then you are curving it only extrinsically: it's still intrinsically flat. So it doesn't mind this, at all. But if it starts curving in the other direction as well, then it will have to curve intrinsically: it will have to stretch or compress. It's easy to see this just be looking at the paper: when it's curved into a 'U' then to curve it in the other direction either the top of the 'U' is going to need to stretch or the bottom is going to need to compress.
And this is why curving paper like that makes it rigid: it 'uses up' the ability to extrinsically curve the paper so that any further extrinsic curvature involves intrinsic curvature too, which paper does not like to do.
Why all this is important
As I said at the start, this is quite a deep question. | {
"domain": "physics.stackexchange",
"id": 58045,
"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, everyday-life, continuum-mechanics, stress-strain",
"url": null
} |
waves, simulations, interference
Title: Is there a name for this wave effect? So I was using this wave simulation (https://phet.colorado.edu/sims/html/wave-on-a-string/latest/wave-on-a-string_en.html) when this happened; using the settings: Oscillator, High tension, no damping. Any frequency or amplitude will do as long as it's divisible by 5 I think it's because of calculations.
After sometime, the wave form would collapse on itself leaving a plain rope and restarting. (It has to be with the settings since the beginning)
Is there a name for this?;
Could it happen in the real world or is it purely hypothetical since there's no system like that;
Why with low tension doesn't happen?;
Was it purely coincidental? That's a pretty neat effect! It's not a bug in the simulation, it is correctly solving the equation. | {
"domain": "physics.stackexchange",
"id": 53863,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "waves, simulations, interference",
"url": null
} |
c, multithreading, pthreads
Functions that are Declared but not Defined
The code contains a static declaration for the function print_info(), but the function is never defined and never used. A good suggestion is to always compile with warnings during development, this will help to eliminate bugs. | {
"domain": "codereview.stackexchange",
"id": 21326,
"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, multithreading, pthreads",
"url": null
} |
catkin, boost, roscpp, cmake
Title: boost 1.60 with ROS Jade
I'd like to use boost 1.55 or later with ROS Jade.
How can I do it correctly ? If possible, I'd like to use boost installed locally.
As I show later, roscpp depends on boost 1.54.0 and it seems to lead to serious problem.
What I've done is like the follows.
Installed boost 1.60 locally (into ~/Libs/boost). Now header files and .a and .so files are in ~/Libs/boost/incude and ~/Libs/boost/lib respectively
In CMakeLists.txt,
set(LIB_ROOT "~/Libs")
set(Boost_INCLUDE_DIR ${LIB_ROOT}/boost/include)<br>
set(Boost_LIBRARY_DIR ${LIB_ROOT}/boost/lib)
find_package(Boost 1.60 REQUIRED)
include_directories(${Boost_INCLUDE_DIR})<br>
link_directories(${Boost_LIBRARY_DIR})
Removed build and devel directories in catkin_ws and catkin_make
As a result, I have warnings as the follows:
link library [libboost_\*\*\*\*.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in: <path-to-~/Libs>/boost/lib | {
"domain": "robotics.stackexchange",
"id": 23401,
"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, boost, roscpp, cmake",
"url": null
} |
Therefore a simple brute-force algorithm, which enumerates all numbers from $1$ to $n \log C$ and checks if it doesn't divide any element of $S$, is polynomial and has time complexity $O(n^2 \log C)$.
The other way to solve the problem is to compute all factors for every element of $S$ and use them in brute-force algorithm to check if $x$ is an answer in $O(1)$ time. This algorithm has time complexity $O(n \cdot \min (\sqrt{C}, n \log C) + n \log C)$ and uses $O(n \log C)$ memory, because we don't need to compute and store factors greater than $n \log C$. For small $n$ and $C$ it performs better.
In detail, the algorithm consists of two parts: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9740426412951848,
"lm_q1q2_score": 0.813796589243864,
"lm_q2_score": 0.8354835350552604,
"openwebmath_perplexity": 283.3928032011191,
"openwebmath_score": 0.7876458168029785,
"tags": null,
"url": "https://cs.stackexchange.com/questions/48338/least-common-non-divisor"
} |
python, performance, algorithm, python-3.x, k-sum
if result:
return [i, result[0]]
return []
I strives hours for this solution but found that answer accepted but not passed Score 60.
Runtime: 60 ms, faster than 46.66% of Python3 online submissions for Two Sum.
Memory Usage: 16.1 MB, less than 5.08% of Python3 online submissions for Two Sum.
I want to refactor the codes so that to achieve at least faster than 60%.
Could you please provide hints? First some stylistic points
nums_d.setdefault(nums[i], []).append(i)
The setdefault is unnecessary here, you can assign a list normally
nums_d[nums[i]] = [i]
When you need both the index and the element use enumerate see PEP279
nums_d = {}
for i in range(len(nums)):
nums_d.setdefault(nums[i], []).append(i)
nums_d = {}
for i, e in enumerate(nums):
nums_d[e] = [i]
Use comprehension when possible (They use the C style looping and is considered to be faster)
nums_d = { e: [i] for i, e in enumerate(nums) } | {
"domain": "codereview.stackexchange",
"id": 33919,
"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, algorithm, python-3.x, k-sum",
"url": null
} |
# To prove being not isomorphic via connectivity of vertices of certain degrees
I'm reading Richard J. Trudeau's book "Introduction to Graph Theory", in ch 2 there's an example
Example. The graphs of Figure 35
are not isomorphic, even though they share the four properties: in each v = 8 and e = 10; each has four vertices of degree 2 and four of degree 3; and they are both in one piece. The structural difference is that the vertices of degree are not related in the same way in the two graphs. In the first graph the vertices of degree 2 come in adjacent pairs: B is adjacent to H and D is adjacent to F. But in the second graph they are completely separated from one another by vertices of degree 3: no vertex of degree is adjacent to any other vertex of degree 2. To see how this prevents the graphs from being isomorphic, we shall systematically try to construct an isomorphism in all possible ways. We begin by noticing that B, being of degree 2, would have to correspond to 1, 3, 6, or 8. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9912886168290836,
"lm_q1q2_score": 0.8127509309051124,
"lm_q2_score": 0.8198933359135361,
"openwebmath_perplexity": 210.91315802543252,
"openwebmath_score": 0.9288966655731201,
"tags": null,
"url": "https://math.stackexchange.com/questions/3390955/to-prove-being-not-isomorphic-via-connectivity-of-vertices-of-certain-degrees"
} |
terminology, asymptotics, landau-notation
Textbook writers don't want to assume that their readers know calculus.
The Landau-style definition for $f = \Theta(g)$ is more awkward: $\lim\inf f/g > 0$, $\lim\sup f/g < \infty$. | {
"domain": "cs.stackexchange",
"id": 1153,
"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": "terminology, asymptotics, landau-notation",
"url": null
} |
np-complete, np-hard, satisfiability, decision-problem
This runs a PTIME algorithm a polynomial number of times ($2 poly(m')+1$, where $m'$ is polynomial wrt $m$), so we indeed solve SAT in PTIME.
To generate all the needed $\varphi'$, we note that the "longest" variable name in $\varphi$ can't more than $m$ bit long for obvious size reasons. Hence if we take $p$ to be any variable whose name has size $m+1$ bits it is surely fresh, and this makes $\varphi'$ to have size $m' = m+(m+1)+O(1)$. Further, we have $2^{m+1}$ choices of such $p$, which is (asymptotically) a large enough space to choose $2 poly(m')+1$. | {
"domain": "cs.stackexchange",
"id": 10045,
"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": "np-complete, np-hard, satisfiability, decision-problem",
"url": null
} |
python, beginner, algorithm, python-3.x, programming-challenge
Iterate over the keys in indegrees directly
In this piece of code:
for i in range(n):
for j in range(n):
if f'{i}-{j}' or f'{j}-{i}' in indegrees[i]:
...
What you are basically saying is: for every possible pair of integers, check if it's in indegrees, and if so, do something with it. That's very inefficient if there only few elements in indegrees. Why not just iterate over the keys of indegrees instead? You can do it with strings, but then you have to parse each key back into two values, if you store tuples instead it becomes really simple:
for i, j in indegrees:
... | {
"domain": "codereview.stackexchange",
"id": 39570,
"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, beginner, algorithm, python-3.x, programming-challenge",
"url": null
} |
python, object-oriented, multithreading, socket, server
Notes
-----
Has already checked that there is a message waiting.
"""
hostname = hostname[0]
reply = []
sock = self.servers[hostname]
while True:
try:
readbuffer = sock.recv(buff_size)
if not readbuffer:
break
temp = readbuffer.split("\n")
readbuffer = temp.pop()
for line in temp:
line = line.rstrip().split()
if (line[0] == "PING"):
self.ping_pong(sock, line[1])
else:
line = " ".join(line)
reply.append(line)
except socket.error:
break | {
"domain": "codereview.stackexchange",
"id": 18328,
"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, multithreading, socket, server",
"url": null
} |
computer-networks
Multimedia applications often need a minimum throughput and maximum latency to work.
Multimedia applications benefit from maximum throughput and minimum latency.
To further confuse matters, the following sentence means the same thing as 2.
Multimedia applications benefit from a maximum of throughput and a maximum of latency.
Isn't English grand? | {
"domain": "cs.stackexchange",
"id": 16410,
"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": "computer-networks",
"url": null
} |
reference-request, randomized-algorithms, property-testing
Edit: Following the answer below, I guess I should have been clearer: in the above (and particularly in the asymptotics for the lower bound), $n$ is the "main" quantity seen as going to infinity, while $\varepsilon$ is an (arbitrarily small) constant. Here are the lower bounds I can show. I conjecture that for a fixed $\epsilon$, the right lower bound is $\Omega( \log n)$, but naturally I might be wrong.
I am going to use a decreasing sequence (just for convenience). The basic mechanism is breaking the sequence into $L$ blocks. In the $i$th block there are going to be $n_i$ elements (i.e., $\sum_i n_i = n$).
In the following, we want the algorithm to succeeds with probability $\geq 1-\delta$, for some parameter $\delta >0$.
First lower bound: $\displaystyle \Omega\left( \frac{1}{\epsilon} \log \frac{1}{\delta} \right)$. | {
"domain": "cstheory.stackexchange",
"id": 3012,
"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": "reference-request, randomized-algorithms, property-testing",
"url": null
} |
quantum-mechanics, wavefunction, hilbert-space, harmonic-oscillator, normalization
$$
| \alpha(t) \rangle = \sum_n c_n(t)| n \rangle \tag{1}
$$
Now is a matter of finding the coefficients $c_n$. To do that note that
\begin{eqnarray}
i\hbar \frac{{\rm d}}{{\rm d}t}| \alpha(t) \rangle &=& i\hbar\sum_n \dot{c}_n(t) | n \rangle \\
H| \alpha(t) \rangle &=& \sum_n c_n(t) H | n \rangle = \sum_n c_n(t) E_n | n \rangle \\
\Rightarrow i\hbar\sum_n \dot{c}_n(t) | n \rangle &=& \sum_n c_n(t) E_n | n \rangle
\end{eqnarray}
with $E_n = \hbar \omega(n + 1/2)$. Multiplying both sides by a state $| m\rangle$, and recalling that $\langle m | n \rangle = \delta_{nm}$
$$
i\hbar \dot{c}_m(t) = c_n(t)E_n
$$
whose solution is
$$
c_n(t) = c_n(0)e^{-iE_n t/\hbar} \tag{2}
$$
The coefficients $c_n(0)$ are easily obtained from Eq. (1):
$$
\langle m | \alpha(0)\rangle = \sum_n c_n(0)\langle m | n\rangle = c_m(0)
$$
That is
$$
c_n(0) = \langle n | \alpha(0)\rangle \tag{3}
$$ | {
"domain": "physics.stackexchange",
"id": 40514,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, wavefunction, hilbert-space, harmonic-oscillator, normalization",
"url": null
} |
algorithms, algorithm-analysis
And given these terms:
A "Win" is defined as RS > RA.
A "Loss" is defined as RA > RS.
Note: Due to the impossibility of tie games, every game will either be a Win or a Loss for "our" team.
My goal is to design an algorithm that will redistribute whole RS values from one game to another until a maximum number of possible Wins is found for our team. A single game's RS value can be substituted for another game's RS value, but the algorithm cannot take "partial" amounts of RS from one game and distribute them among multiple games.
In the process of "donating" game A's RS (in its entirety) to another game B, you must then decide:
Which other game C should donate its RS to game A?
Which other game D should receive the original RS from game B?
In intuitive terms, the goal is to distribute the scores so that games are won by the narrrowest of margins, and lost by the widest of margins.
The algorithm cannot stop until every game meets one of the following conditions: | {
"domain": "cs.stackexchange",
"id": 11307,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, algorithm-analysis",
"url": null
} |
c++, recursion, c++20
The used is_iterable concept is as below. I keep it in order to get nicer error messages if user accidentily try to apply this recursive_count_if() on something that can not be iterated over.
template<typename T>
concept is_iterable = requires(T x)
{
*std::begin(x);
std::end(x);
};
Some test cases are as below. With this version recursive_count_if, you can always use auto keyword in the input lambda parameter.
// std::vector<std::vector<int>> case
std::vector<int> test_vector{ 1, 2, 3, 4, 4, 3, 7, 8, 9, 10 };
std::vector<decltype(test_vector)> test_vector2;
test_vector2.push_back(test_vector);
test_vector2.push_back(test_vector);
test_vector2.push_back(test_vector);
// use a lambda expression to count elements divisible by 3.
int num_items1 = recursive_count_if<2>(test_vector2, [](auto& i) {return i % 3 == 0; });
std::cout << "#number divisible by three: " << num_items1 << '\n'; | {
"domain": "codereview.stackexchange",
"id": 39947,
"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++, recursion, c++20",
"url": null
} |
python, algorithm, game, dice
for oppClaim in reversed(range(self.sides+1)):
if oppClaim < self.sides:
node = self.claimNodes[oppClaim, rollAfterAcceptingClaim[oppClaim]]
actionProb = node.strategy
node.u = 0.0
for myClaim in range(oppClaim+1, self.sides+1):
actionIndex = myClaim - oppClaim - 1
nextNode = self.responseNodes[oppClaim, myClaim]
childUtil = - nextNode.u
regret[actionIndex] = childUtil
node.u += actionProb[actionIndex] * childUtil
for a in range(len(actionProb)):
regret[a] -= node.u
node.regretSum[a] += node.pOpponent * regret[a]
node.pPlayer = node.pOpponent = 0 | {
"domain": "codereview.stackexchange",
"id": 32980,
"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, algorithm, game, dice",
"url": null
} |
beginner, image, go
newColor := color.RGBA{
uint8(r),
uint8(g),
uint8(b),
uint8(a),
}
// to HERE
In Go, readability is paramount. I would write:
// Part to improve from HERE
rr := float64(r >> 8)
gg := float64(g >> 8)
bb := float64(b >> 8)
aa := a >> 8
newColor := color.RGBA{
R: uint8(math.Min(.393*rr+.769*gg+.189*bb, 255)),
G: uint8(math.Min(.349*rr+.686*gg+.168*bb, 255)),
B: uint8(math.Min(.272*rr+.534*gg+.131*bb, 255)),
A: uint8(aa),
}
// to HERE | {
"domain": "codereview.stackexchange",
"id": 35553,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, image, go",
"url": null
} |
ros, transform, tf2
Get:5 http://packages.ros.org/ros/ubuntu/ trusty/main ros-indigo-genpy amd64 0.5.10-0trusty-20160627-155125-0700 [48.9 kB]
Get:6 http://packages.ros.org/ros/ubuntu/ trusty/main ros-indigo-message-generation amd64 0.2.10-0trusty-20160627-161830-0700 [4,238 B]
Get:7 http://packages.ros.org/ros/ubuntu/ trusty/main ros-indigo-cpp-common amd64 0.5.7-0trusty-20160321-175122-0700 [19.0 kB]
Get:8 http://packages.ros.org/ros/ubuntu/ trusty/main ros-indigo-rostime amd64 0.5.7-0trusty-20160321-181638-0700 [50.4 kB]
Get:9 http://packages.ros.org/ros/ubuntu/ trusty/main ros-indigo-roscpp-traits amd64 0.5.7-0trusty-20160321-181946-0700 [9,504 B]
Get:10 http://packages.ros.org/ros/ubuntu/ trusty/main ros-indigo-roscpp-serialization amd64 0.5.7-0trusty-20160321-182157-0700 [12.3 kB]
Get:11 http://packages.ros.org/ros/ubuntu/ trusty/main ros-indigo-message-runtime amd64 0.4.12-0trusty-20160627-161852-0700 [4,312 B] | {
"domain": "robotics.stackexchange",
"id": 26696,
"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, transform, tf2",
"url": null
} |
a 35
b 40
c 45
d 50
e 55
$$average \ speed=\frac{total \ distance \ covered}{total \ time}$$;
Total distance covered = 30 + 30 = 60 miles;
Total time = 30/30 + 30/60 = 3/2 hours;
$$average \ speed=\frac{total \ distance \ covered}{total \ time}=\frac{60}{\frac{3}{2}}=40$$.
but i think av should be closer to the 60
Math Expert
Joined: 02 Sep 2009
Posts: 50007
Re: Susan drove an average speed of 30 miles per hour for the [#permalink]
### Show Tags
26 Feb 2018, 23:14
robu1 wrote:
Bunuel wrote:
anilnandyala wrote:
susan drove an average speed of 30 miles per hour for the first 30 miles of a trip & then at a average speed of 60 miles/hr for the remaining 30 miles of the trip if she made no stops during the trip what was susan's avg speed in miles/hr for the entire trip
a 35
b 40
c 45
d 50
e 55
$$average \ speed=\frac{total \ distance \ covered}{total \ time}$$;
Total distance covered = 30 + 30 = 60 miles;
Total time = 30/30 + 30/60 = 3/2 hours; | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9626731105140616,
"lm_q1q2_score": 0.8257502897305753,
"lm_q2_score": 0.8577681049901037,
"openwebmath_perplexity": 3477.940370827138,
"openwebmath_score": 0.8038458228111267,
"tags": null,
"url": "https://gmatclub.com/forum/susan-drove-an-average-speed-of-30-miles-per-hour-for-the-104126.html"
} |
c++, interview-questions
auto res = true;
while (i < s3.length())
{
if (!(res = processIfCharNew(s3[i], s3Inc)))
break;
++i;
} | {
"domain": "codereview.stackexchange",
"id": 43417,
"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++, interview-questions",
"url": null
} |
randomness, random-number-generator
Yes.
Let $T$ be the threshold of the process you describe. In a uniform (i.e. non-biased) distribution, the sequence $\mathtt{0}^{T+1}$ would have the probability $2^{-(T+1)}$, like any other sequence of length $T+1$. But the process you describe will flip the last bit, since the threshold of excess $\mathtt{0}$ bits was exceeded, and thus this sequence has the probability $0$. That's a bias. Note that this bias exists regardless of the distribution of the original generator, i.e. the process always makes the generator somewhat worse.
It's pretty apparent if you take this to an extreme. With $T=1$, the output of the process would be an alternating sequence, either $\mathtt{01010101\ldots}$ or $\mathtt{10101010\ldots}$, which is obviously hardly random at all. | {
"domain": "cs.stackexchange",
"id": 10395,
"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": "randomness, random-number-generator",
"url": null
} |
complexity-theory, non-locality
$$\vert \psi_0 \rangle = \vert b_0 \rangle \otimes \vert b_1 \rangle \otimes ... \otimes \vert b_{n-1} \rangle \in (\mathbb{C}^2)^{\otimes n},$$
where $\vert b_i \rangle \in \mathbb{C}^2$.
A transformation that preserves the tensor structure of $\vert \psi_0 \rangle$, i.e. does not induce entanglement, takes the form
$$U = U_0 \otimes U_1 \otimes , ... , \otimes U_{n-1} \in U(2)^{\otimes n} \subset U(2^n).$$
Hamiltonians of this form are regularly employed in both theory and practice, where any given $U_i$ can act trivially or non-trivially.
However, generally in practice only a discrete set of single qubit transformations are available. By the Solovay-Kitaev theorem $U_i$ can be approximated to precision $\epsilon$ using $\Theta(\log^c(\tfrac{1}{\epsilon}))$ gates from a fixed discrete set, where $c$ is a constant between 1 and 2 (as far as I know its exact value is still an open problem). | {
"domain": "quantumcomputing.stackexchange",
"id": 1017,
"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, non-locality",
"url": null
} |
$$\frac{5^4}{4^4}*x=5^4*10$$ --> $$x=4^4*10=2,560$$. Answer: D. If the question were "if all of the trees thrived and there were 6250 trees in the orchard at the end of 15 year period, how many trees were in the orchard at the beginning of the 4 year period", then we would have that: $$(\frac{5}{4})^{15}*x=6,250$$ --> $$x\neq{integer}$$, so it would be a flawed question. Hope it's clear. Isn't the question quite ambiguous, though? I mean the first scentence could be interpreted as "for the first year we have (4/4)x and for the second year (5/4)x and for the third..." etc.. With that reasoning one would have (5/4)^3 * x + x and then your approach doesnt work. Obviously, I understand that this was a flaw in my reasoning but I cannot understand how they - with that wording - will assume that we totally understand that at the end of year one he has (5/4)x.. Is there a straightforward "word translation" way in knowing how to interpret wordings like this? Actually, it is not ambiguous. Read | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 1,
"lm_q1q2_score": 0.8577681049901036,
"lm_q2_score": 0.8577681049901036,
"openwebmath_perplexity": 1384.2064824380445,
"openwebmath_score": 0.570276141166687,
"tags": null,
"url": "https://gmatclub.com/forum/each-year-for-4-years-a-farmer-increased-the-number-of-trees-in-a-135487.html"
} |
algorithm, functional-programming, combinatorics, f#
let rec mapinsert (a: 't) (ps: List<List<'t>>) : List<List<'t>> =
if ps.Length = 0 then List.empty<List<'t>>
else insert a ps.Head ps.Head (mapinsert a ps.Tail)
// x: a list of elements
// returns a list of permutations
let rec permute1 (x: List<'t>) : List<List<'t>> =
if x.Length = 0 then [x]
else mapinsert x.Head (permute1 x.Tail)
Here is a usage example
permute1 [1;2;3] |> List.iter (printf "%A ")
// [1; 2; 3] [2; 1; 3] [2; 3; 1] [1; 3; 2] [3; 1; 2] [3; 2; 1] | {
"domain": "codereview.stackexchange",
"id": 29318,
"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": "algorithm, functional-programming, combinatorics, f#",
"url": null
} |
cc.complexity-theory, soft-question, complexity-classes
2)What are the consequences of a Polynomial Time Algorithm for $\mathsf{A}$?
a)Does it put $\mathsf{B}$ in $\mathsf{P}$ as well?
b)Since $\mathsf{P} \subseteq \mathsf{UP} \subseteq \mathsf{FewP} \subseteq \mathsf{A}$ we will have $\mathsf{P} = \mathsf{UP} = \mathsf{FewP} = \mathsf{A}$ . Then can it still be the case $\mathsf{P}$ does not equal $\mathsf{NP}$?
c)Does it also show that $\mathsf{NP} \subseteq \mathsf{RP}$ since now $\mathsf{RP}^\mathsf{UP} = \mathsf{RP}$? 1a) yes by the inclusion.
b) Not sure what you mean by "it". If P=PSPACE then A and B are both in P.
2a) Not necessarily, A could be much easier than B.
b) There are relativized worlds where P=FewP<>NP.
c) No, RP^UP does not necessarily contain NP. Don't confuse UP with Promise-UP. | {
"domain": "cstheory.stackexchange",
"id": 1481,
"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": "cc.complexity-theory, soft-question, complexity-classes",
"url": null
} |
• @ryan Dynamic programming is not needed. There are nine moves to be made, four of which are RIGHT. Thus simple combinatorics will solve the question. – Hendrik Jan Apr 18 at 8:10
• @HendrikJan yes combinatorics will get it, but I feel the DP formulation gives more intuition behind it in my opinion. I could've also just linked here. The DP formulation is also just Pascal's Triangle in grid form. – ryan Apr 18 at 16:12 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9820137926698566,
"lm_q1q2_score": 0.814029345125914,
"lm_q2_score": 0.8289388104343893,
"openwebmath_perplexity": 416.31054902978696,
"openwebmath_score": 0.7314860224723816,
"tags": null,
"url": "https://cs.stackexchange.com/questions/107135/how-many-possible-ways-to-go-right-and-up-in-an-array"
} |
python, programming-challenge, python-3.x, time-limit-exceeded
challenge_229(3) # <-- Change this value.
Which works great for the example input of \$3\$, which results in the output \$10,787\$. However, it does not scale very well at all. To reach the goal requiring 10^11 will not be practical.
I figured the worst part of my program was the int(str(x)[::-1]) % 7 == 0 bit I used to reverse the number, but I'm unsure how I would go about making it more efficient. Does anyone have any ideas how I can optimize my program or think of a way I could solve it with relatively condense code that doesn't use brute force? There is a better way to implement the design you seem to be using. Rather than generating numbers and storing them in a list, just generate the numbers:
def generate_numbers(power):
for x in range(0, 10**power, 7):
if x % 7 == 0 and int(str(x)[::-1]) % 7 == 0:
yield x
Then do what you want with the generated sequence; e.g.
print( sum(generate_numbers(3)) ) | {
"domain": "codereview.stackexchange",
"id": 15491,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, programming-challenge, python-3.x, time-limit-exceeded",
"url": null
} |
electromagnetism
Consider a thin wall cylinder(concentric with the hole), with radius $r>R$, wall thickness $dr$, in the conductor. In this cylinder we consider a ring, with the cross-sectional area $dz\cdot dr$.
At this ring let $B_n$ be a coponent of $\overrightarrow B$, perpendicular to the wall of the cylinder. Then the magnitude of the electromotive force(emf) induced in the ring is:
$$E=\frac{v_t}{c}B_n2\pi r$$ Conductance of the ring:
$$dg=\frac{\gamma drdz}{2\pi r}$$ where $\gamma$ is the electrical conductivity of the conductor. Thus, the current induced in the ring:
$$I=Edg=\frac{v_t}{c}B_n\gamma drdz$$ Power, released in the ring:
$$dW=\frac{I^2}{dg}=E^2dg=\frac{v_t^2}{c^2}\gamma B_n^22\pi r drdz$$ The only thing that has yet to be found is $B_n$. It comes from the expression of $\overrightarrow B$ above. Because this is a pure math i skip this step and write down the final formula for $dW$: | {
"domain": "physics.stackexchange",
"id": 1746,
"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",
"url": null
} |
ros, python, ros-kinetic, message, topic
Title: Read /rosout/msg with seperate Python script
Hello!
I am currently working on a project where I navigate a TurtleBot3 to several positions in a room. The TB3 navigation is triggered by publishing messages to a specific topic (/tb3_hsc/command). These messages are published through a seperate Python script. By seperate I mean that it is not a ROS package, but a .py file that I run from a terminal.
When a position has been reached, a message appears on /rosout/msg that says "Goal reached". What I want to do, is capture the output from /rosout/msg from the moment I send the navigation command (so any messages published to that topic from before the navigation command, should not be included). Then, once the output contains the string "Goal reached", I want the Python script to trigger a new command.
Does anyone have an idea how I can do this?
Thanks in advance! | {
"domain": "robotics.stackexchange",
"id": 35051,
"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, python, ros-kinetic, message, topic",
"url": null
} |
you get to what was once the end vertex now has an edge taking you back to the starting point. graph G which are required if one is to traverse the graph in such a way as to visit each line at least once. In fact, we can find it in O (V+E) time. A graph is said to be Eulerian, if all the vertices are even. Fortunately, we can find whether a given graph has a Eulerian Path or not in polynomial time. Make sure the graph has either 0 or 2 odd vertices. Gambar 2.3 semi Eulerian Graph Dari graph G, tidak terdapat path tertutup, tetapi dapat ditemukan barisan edge: v1 ! Like the graph 2 above, if a graph has ways of getting from one vertex to another that include every edge exactly once and ends at another vertex than the starting one, then the graph is semi-Eulerian (is a semi-Eulerian graph). Graf yang mempunyai lintasan Euler dinamakan juga graf semi-Euler (semi-Eulerian graph). The above graph is Eulerian since it has a cycle: 0->1->2->3->0 In this assignment you are to address two | {
"domain": "techaffect.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668668053619,
"lm_q1q2_score": 0.8176304761220029,
"lm_q2_score": 0.8333245891029457,
"openwebmath_perplexity": 656.9268830313274,
"openwebmath_score": 0.48969700932502747,
"tags": null,
"url": "http://techaffect.com/we-will-gmrs/semi-eulerian-graph-00427c"
} |
python, machine-learning
data_in = read_data(train_file, test_file)
network_simple_rnn(data_in, out_dim, optim_type, b_size, save_file, num_classes, epochs, default_val) This i going to be a style-review only, because after that the actual review becomes that much easier.
Use a consistent number of spaces. Currently you have 8 spaces in your functions, but 4 spaces per tab in your if __name__ = "__main__": part (which is a good thing to have). PEP8, Python's official style-guide, recommends using 4 spaces per tab.
Use tuple unpacking.
X_train = data_in[0]
dummy_y = data_in[1]
X_test = data_in[2]
dummy_y_test = data_in[3]
Can be more succinctly written as:
X_train, dummy_y, X_test, dummy_y_test = data_in
Use better names. dummy_y_test, s_in, optim_use are all not very descriptive names. Try to come up with better ones.
Use str.format to build your save file name.
save_file = "{save_file}{l_in}{m_in}{d_in}{n_in}{epochs}.txt".format(**locals()) | {
"domain": "codereview.stackexchange",
"id": 24685,
"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, machine-learning",
"url": null
} |
general-relativity, boundary-conditions, ads-cft
Title: Brown-Henneaux Boundary Conditions I am trying to reproduce the Brown-Henneaux boundary conditions stated in this paper (http://srv2.fis.puc.cl/~mbanados/Cursos/TopicosRelatividadAvanzada/BrownHenneaux.pdf).
The paper constructs a set of asymptotically $AdS_3$ metrics and the identifications of $AdS_3$ given by metric (4.2) should belong to this set, since it is locally $AdS$ everywhere. We also want that the asymptotic symmetry group (ASG) of $AdS$ is contained in the ASG of this set of metrics. Therefore if we act on the metric (4.2) with Killing vectors of $AdS_3$ we should get a metric with coefficients given as (4.3) and (4.4). | {
"domain": "physics.stackexchange",
"id": 74101,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, boundary-conditions, ads-cft",
"url": null
} |
Furthermore, you can show that $a$ is the solution to the quadratic equation in $a$:
$$\frac{1}{a} + a = \frac{1}{b} \left( \frac{\sigma^2_{\epsilon}}{\sigma^2_\eta} + 1 \right) + b$$
One way to obtain the above equation is by equating the autocovariance function based upon the two representations of process $\{\zeta_t\}$ and solving for the root where $|a|< 1$.
This might be a bit imprecise, and there might be additional regularity conditions. (Also above I used that for $|a| < 1$ we have $(1 + a)^{-1} = 1 - a + a^2 - a^3 + a^4 - a^5 \ldots$.)
### Some takeaways:
• Process $\zeta_t = \epsilon_t + \eta_t - \phi \eta_{t-1}$ can be written as an MA(1) process $\zeta_t = u_t + a u_{t-1}$ where $a$ and $u_t$ are related to $\phi$, $\epsilon_t$, and $\eta_t$ by the above formulas.
• The same time-series can be written in multiple ways. (Note the Wold representation is unique though.) | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9711290922181331,
"lm_q1q2_score": 0.8254317417639347,
"lm_q2_score": 0.849971181358171,
"openwebmath_perplexity": 1122.8461920629352,
"openwebmath_score": 0.9838799834251404,
"tags": null,
"url": "https://stats.stackexchange.com/questions/257590/writing-process-zeta-t-epsilon-t-eta-t-phi-eta-t-1-as-a-moving-aver"
} |
inorganic-chemistry
'Hard' applies to species which are small, have high charge states (the charge criterion applies mainly to acids, to a lesser extent to bases), and are weakly polarizable.
'Soft' applies to species which are big, have low charge states and are strongly polarizable. The concept is a way of applying the notion of orbital overlap to specific chemical cases.
Pearson evidently had revised values in the paper (which is behind a firewall):
Pearson, Ralph G. "Absolute Electronegativity and Hardness: Application to Inorganic Chemistry." Inorganic Chemistry, volume 27, number 4, 1988, pp 734–740. https://doi.org/10.1021/ic00277a030
The data from that paper is on this webpage: http://www.knowledgedoor.com/2/elements_handbook/chemical_hardness.html
\begin{array}{|c|c|} \hline
Ion & Chemical\ Hardness\ (eV) \\ \hline
\ce{Li+} & 2.39\\ \hline
\ce{Na+} & 2.30 \\ \hline
\ce{K+} & 1.92 \\ \hline
\ce{Rb+} & 1.85 \\ \hline
\ce{Cs+} & 1.71 \\ \hline
\end{array} | {
"domain": "chemistry.stackexchange",
"id": 13715,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inorganic-chemistry",
"url": null
} |
time-complexity, summation
Title: Efficiently Taking the Sums of all Pairs of Elements from a Set I have a set of numbers and I want to find the sums of all possible pairs of elements. With the set $\{1, 2, 3\}$ for example, I would want $\{1+2, 1+3, 2+3\}$ as my answer. I could do that in n^2 time complexity by starting at the first element and adding all the other elements to it one-by-one and then moving to the second element, but is there an algorithm that would compute all the sums in a better time complexity? Since the output could be of size $\Omega(n^2)$ for a set of size n, I doubt there is a better algorithm for the general case.
For example, consider $S = \{1, 2, 4, …, 2^{n-1}\}$. For $\{i, j\} \neq \{k, \ell\}$, $2^i+2^j \neq 2^k+2^{\ell}$, so the output will be of size $\frac{n(n-1)}{2}$. | {
"domain": "cs.stackexchange",
"id": 19414,
"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": "time-complexity, summation",
"url": null
} |
sql, sql-server, stackexchange
I am particularly interested to know whether the rolling average can be computed in a more SQL Server friendly way. There does not appear to be a performance problem, but the CTE and self join seem.... ugly.
Any other observations? There is a simple way to calculate rolling averages in SQL, with a caveat.
SELECT CreationDate
, Score
, avg(CAST(Score AS FLOAT)) OVER (
ORDER BY CreationDate
ROWS BETWEEN ##RollingAvg:INT?10## PRECEDING AND CURRENT ROW
) AS RollingAvg
FROM Posts
WHERE PostTypeId = 2 AND OwnerUserId = ##UserId:INT##; | {
"domain": "codereview.stackexchange",
"id": 9394,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sql, sql-server, stackexchange",
"url": null
} |
parallel-computing, concurrency, nondeterminism
Title: Why doesn't parallelism necessarily imply non-determinism? I'm a student reading a book on threads. And I got when I got to non-deterministic and parallel programs, I got a bit confused. I hope you can help me out.
I understand the difference between concurrency and parallelism. I get that concurrent programs are non-deterministic depending on the precise timing of events. "But parallelism doesn't necessarily imply non-determinism" - as said in the book. Why is that?
Does that imply that it's all dependent on the languages that support parallelism. Which implies that these languages should execute parallel programs in a deterministic manner? | {
"domain": "cs.stackexchange",
"id": 4532,
"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": "parallel-computing, concurrency, nondeterminism",
"url": null
} |
genetics, human-genetics, population-genetics
So, detecting ancestry is a non-trivial task. Given your genome sequence, you would need to compare some "informative" regions of the genome with the homologous sequences of some population (say, of a database with other genomes). These informative regions are usually some parts of the genome that vary across individuals (variation is used because differences are informative: some populations vary on particular sites, distinct from other populations). At the core, this is a question on how to compare "character strings" (DNA is composed of 4 characters, namely, A, T, C, and G). But these strings exist in a complicated structure: a human genome is partitioned in 23 pairs of chromosomes, within each individual. However, the question of ancestry is not about individual sequences really, but about population-level changes in DNA composition. So, in fact, you need to consider population-level factors: size of the populations to consider, the rates of recombination (DNA exchange across | {
"domain": "biology.stackexchange",
"id": 10717,
"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, human-genetics, population-genetics",
"url": null
} |
• Was not familiar with the fundamental theorem of arithmetic! Thank you for adding to my toolkit ! :) – Rafael Vergnaud Jun 10 '18 at 17:18
• It's quite a strong statement so for many questions over $\mathbb{N}$, even if they don't seem to have anything to do with factorization. It guarantees both that every number can be expressed as a product of increasing primes, and also that the decomposition is unique. Both are used in the argument above. Without uniqueness there could be some number in more than one $P_i$. Without existence, there would be some number that doesn't fall into any of the sets. – user1390 Jun 10 '18 at 17:24
Let $$A_1 = \{1, 2, 4, 6, 8, \ldots\}$$ $$A_2 = \{3,6,9,12, \ldots\} \setminus A_1$$ $$A_3 = \{5,10,15,20, \ldots\} \setminus (A_1\cup A_2)$$
In general $A_n = \{k \cdot p_n : k \in \mathbb{N}\} \setminus (A_1 \cup \cdots \cup A_{n-1})$ where $p_n$ is the $n$-th prime number.
The sets are pairwise disjoint by construction, and are infinite because | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9766692339078751,
"lm_q1q2_score": 0.8159910681258462,
"lm_q2_score": 0.8354835391516132,
"openwebmath_perplexity": 334.4184983928116,
"openwebmath_score": 0.8203248977661133,
"tags": null,
"url": "https://math.stackexchange.com/questions/2814852/produce-an-infinite-collection-of-sets-a-1-a-2-a-3-with-the-property-tha"
} |
javascript, performance, html, css, animation
ctx.font = bB.font;
ctx.fillStyle = stl.font;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(bB.text, w / 2, bB.height / 2);
// reset transform if you render other content at absolute coords
ctx.setTransform(1, 0, 0, 1, 0, 0);
// Note that you can use
// ctx.resetTransform(); // but check for support
}
} | {
"domain": "codereview.stackexchange",
"id": 31477,
"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, performance, html, css, animation",
"url": null
} |
quantum-mechanics, quantum-field-theory, causality
Title: Probability of finding a particle outside it's light cone Say we just created a particle (high probability of one-particle state), is the probability of a very far away detector getting triggered at the time of creation (probability of finding a particle outside of its light cone) zero according to QFT?
Since we can detect particles and make histograms of the positions where they're found using detectors, this seems like a reasonable question to ask. I hope that QFT says that detector cannot detect particles outside its lightcone because if that's not the case, we can imagine an experiment where information can be sent FTL:
Consider a ridiculous amount of hydrogen atoms/electrons near person A and a very far away B measuring the rate of particles he detects. So when A makes some movement, if the probability outside light cone changes immediately, B's rate of detection immediately changes and hence this can be used for communication. | {
"domain": "physics.stackexchange",
"id": 80004,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-field-theory, causality",
"url": null
} |
acid-base, aqueous-solution
Edit:
Given the example, I do believe it's because the reactions happen in the presence of water, but honestly, I'm not sure.
Edit 2:
Another possible reason to mention dilute acids would be in case it's necessary to consider the concentration of a medium-strength acid. In dilute solutions, those can be considered completely dissociated, which makes calculations a lot easier, if that's the case. | {
"domain": "chemistry.stackexchange",
"id": 3073,
"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": "acid-base, aqueous-solution",
"url": null
} |
performance, c, reinventing-the-wheel, matrix
reduce the number of stores and loads, making the code consist as much as possible/reasonable of mulps and addps
juggle at least 4 independent dependency chains of additions, to avoid bottlenecking on their latency (not a problem in the original code, but it will be when rearranging the code so that stores are avoided in the inner loop)
no horizontal sums (which are not SIMD-friendly)
do not exceed the number of vector registers (spill/reload would conflict with the first design goal) | {
"domain": "codereview.stackexchange",
"id": 43741,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, c, reinventing-the-wheel, matrix",
"url": null
} |
ruby, primes
0 is not a prime number, and negative numbers aren't either.
Maybe I would also adapt the test to check these cases.
brevity
if <condition> then <statement> end
can be written
<statement> if <condition>
, so you could write
return false if number == 1
and
return false if number % i == 0 | {
"domain": "codereview.stackexchange",
"id": 1181,
"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": "ruby, primes",
"url": null
} |
electromagnetism, magnetic-fields
The volume of the ball. This is easy enough to figure out.
The magnetic susceptibility of the material of the ball. This is harder to determine; while the above-linked Wikipedia article gives a number for this, it is perhaps an over-simplification. To illustrate this, take a look at the table for the magnetic permeability of various materials; the permeability $\mu$ is related to the susceptibility by $\chi_m = \mu/\mu_0 - 1$. From this, we can see that permeability of the iron depends strongly on its purity, so this may be difficult to determine. (And I assume that when you say "iron" you mean "iron" rather than "steel"; steel is even harder to figure out.) | {
"domain": "physics.stackexchange",
"id": 83517,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, magnetic-fields",
"url": null
} |
You can always let an element do two jobs at once in this sense unless you’re checking a statement that explicitly rules out the possibility, and here you are not. Here, for instance, you have to check a requirement that $d(x,z)\le d(x,y)+d(y,z)$ whenever $x,y,z\in X$; there is no implication here that $x,y$, and $z$ must be distinct points. Indeed, the triangle inequality must hold whether they are distinct of not. The same goes for the other clauses of the definition.
This would be another examples in which you can see @Brian's remarks are ruling again. Let $X\ne\emptyset$ and $$d(a,b) = \left\{ \begin{array}{ll} 0 & \quad a=b \\ 1 & \quad a\ne b \end{array} \right.~~~~~~\text{or}~~~~~~d(a,b) = \left\{ \begin{array}{ll} 2 & \quad a\neq b \\ 0 & \quad a= b \end{array} \right.$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9875683498785865,
"lm_q1q2_score": 0.8250970920198232,
"lm_q2_score": 0.8354835309589074,
"openwebmath_perplexity": 222.59495714056933,
"openwebmath_score": 0.8778718709945679,
"tags": null,
"url": "http://math.stackexchange.com/questions/410729/singleton-subset-of-a-metric-space"
} |
home-experiment
Is this reaction sensitive to age of the reactants? Ambient temperature? Humidity? What could cause the reaction to not work normally?
P.S. In spite of the home-experiment tag, the chemicals used here are lab-grade (from Sigma-Aldrich), though I'd be interested in how the purity might affect the reaction as well. Capsules of potassium permanganate injected with ethylene glycol are used as aerial ignition devices in bush and forest firefighting. They are considered a reasonably safe option because of the delayed reponse prior to ignition. They are sometimes known as dragon eggs or fireballs. The rate of chemical reaction is very much dependent upon | {
"domain": "chemistry.stackexchange",
"id": 2098,
"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": "home-experiment",
"url": null
} |
ros-kinetic
(and so on)
I thought of putting a counter at the start of the node, but everytime the node will start I will reinitialize the counter, so it won't work. I also thought of starting another node at the same time that the listener will start and the other node will count the messages of the listener, but I doubt this will work, so I am looking for a faster way if this is possible.
Thanks for answering and for your time in advance,
Chris
Originally posted by patrchri on ROS Answers with karma: 354 on 2016-10-08
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 25928,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-kinetic",
"url": null
} |
ros, packages, dependencies
48) libvtk5-dev [Not Installed]
49) libvtk5-qt4-dev [Not Installed]
50) libxft-dev [Not Installed]
51) libxml2-dev [Not Installed]
52) ros-hydro-base-local-planner [Not Installed]
53) ros-hydro-camera-calibration [Not Installed]
54) ros-hydro-carrot-planner [Not Installed]
55) ros-hydro-clear-costmap-recovery [Not Installed]
56) ros-hydro-collada-urdf [Not Installed]
57) ros-hydro-compressed-depth-image-transport [Not Installed]
58) ros-hydro-compressed-image-transport [Not Installed]
59) ros-hydro-costmap-2d [Not Installed]
60) ros-hydro-cv-bridge [Not Installed]
61) ros-hydro-depth-image-proc [Not Installed] | {
"domain": "robotics.stackexchange",
"id": 16327,
"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, packages, dependencies",
"url": null
} |
deep-rl, testing
Title: How to test the robustness of an agent in a custom reinforcement learning environment? I have used the stable-baseline3 implementation of the SAC algorithm to train policies in a custom gym environment. So far the results look promising. However, I would like to test the robustness of the results. What are common ways to test robustness? So far, I have considered testing different seeds. Which other tests are recommended? This depends on your definition of robust.
Robust to what exactly?
Testing different random seeds will test the robustness of the algorithm on stochasticity of the environment and the algorithm's optimization procedure.
Trying different hyperparameters would test the robustness of the algorithm to hyperparameter changes.
Some RL benchmarks have their own definition of robustness: | {
"domain": "ai.stackexchange",
"id": 2863,
"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": "deep-rl, testing",
"url": null
} |
Therefore we can rewrite Case 2, commuting $$x$$ and $$y$$ in its quantifiers, as:
$$\forall F,y,x F(y,x)$$ (Case 2b)
However, now Case 2b is the same as Case 1 (by substituting $$x=y$$ and $$y=x$$ at the same time), therefore showing that we only need to prove Case 1.
Therefore the key to WOLOG is changing the order of the quantified variables so that multiple $$\vee$$ cases are identical. Is this correct? | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9566341975270266,
"lm_q1q2_score": 0.816882134065064,
"lm_q2_score": 0.8539127455162773,
"openwebmath_perplexity": 276.1485252013364,
"openwebmath_score": 0.8598872423171997,
"tags": null,
"url": "https://math.stackexchange.com/questions/4579626/formalizing-without-loss-of-generality"
} |
newtonian-mechanics, rotational-dynamics, torque
Title: Would the rod translate in this case, or only purely rotate? If you have a rigid rod in space and apply an instantaneous upward force perpendicular to the very right of the surface so that it is a pure torque of 10Nm, will it only rotate or will it also translate? I say that as the line of force does not go through the center of mass, there will only be instantaneous rotation about the center of mass and no translation.
Now let's say that we also apply a pure torque of 5Nm (force going downward so that the torques vectors on both side are in same direction) to the left side. Will the rod only rotate or will it also translate? Once again, I say that the lines of force do not go through the center of mass so there is only rotation. It does not matter if the torques are "unbalanced", they simply add to be 5Nm of rotation. | {
"domain": "physics.stackexchange",
"id": 64200,
"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, torque",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.