text stringlengths 1 1.11k | source dict |
|---|---|
We now cite a useful theorem for computing the order of cyclic subgroups of a cyclic group:
The proof of this theorem is left to the reader.
To compute the order of $\langle 18 \rangle$ in $\mathbb{Z}_{30}\text{,}$ we first observe that 1 is a generator of $\mathbb{Z}_{30}$ and $18= 18(1)\text{.}$ The greatest common divisor of 18 and 30 is 6. Hence, the order of $\langle 18 \rangle$ is 30/6, or 5.
At this point, we will introduce the idea of a fast adder, a relatively modern application (Winograd, 1965) of an ancient theorem, the Chinese Remainder Theorem. We will present only an overview of the theory and rely primarily on examples. | {
"domain": "discretemath.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9919380101400315,
"lm_q1q2_score": 0.8200468456171953,
"lm_q2_score": 0.8267117876664789,
"openwebmath_perplexity": 1615.108769389095,
"openwebmath_score": 0.9999842643737793,
"tags": null,
"url": "https://discretemath.org/ads/s-cyclic-groups.html"
} |
Manager
Joined: 27 Feb 2010
Posts: 105
Location: Denver
Followers: 1
Kudos [?]: 328 [0], given: 14
What is the average (arithmetic mean) of eleven consecutive [#permalink]
### Show Tags
23 Apr 2010, 18:05
21
This post was
BOOKMARKED
00:00
Difficulty:
25% (medium)
Question Stats:
67% (01:44) correct 33% (00:39) wrong based on 407 sessions
### HideShow timer Statistics
What is the average (arithmetic mean) of eleven consecutive integers?
(1) The average of the first nine integers is 7
(2) The average of the last nine integers is 9
[Reveal] Spoiler: OA
Manager
Joined: 27 Feb 2010
Posts: 105
Location: Denver
Followers: 1
Kudos [?]: 328 [1] , given: 14
Re: Average ( arithmetic mean ) of eleven consecutive integers? [#permalink]
### Show Tags
23 Apr 2010, 18:11
1
KUDOS
Some how i got E
1. (63+ X10 + X11) / 11 = ?? ..sitill missing two numbers? so insuff??
2. (X1+X2 +81)/ 11 = ?? Still missing two numbers so Insuff??? | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 1,
"lm_q1q2_score": 0.8519527963298947,
"lm_q2_score": 0.8519527963298947,
"openwebmath_perplexity": 2902.9624508058323,
"openwebmath_score": 0.6749594211578369,
"tags": null,
"url": "http://gmatclub.com/forum/what-is-the-average-arithmetic-mean-of-eleven-consecutive-93188.html#p717074"
} |
${\bf Theorem\ 3\,\ }$ Let $R\,$ be an algebra over $F$ in which every element not in $F$ is a zero-divisor. Then $R$ is a subdirect product of extension fields of $F,\,$ and every $\,x\in R\,$ which is not in $\,F\,$ is transcendental over $F$, except if $\,F = \Bbb F_2$ and $\,x\,$ is idempotent. Moreover, if $R$ has finite dimension over $F$ then either $R=F$ or $R\,$ is a Boolean algebra.
In any boolean ring (with identity), the only unit is the identity.
So in particular, $\prod_{i\in I} F_2$ for any nonempty index set $I$, and the field of two elements $F_2$. In fact, any subring (with identity) of such a ring will work.
• This is actually (isomorphic to) the set of functions $I \to F_2$ mentioned by Gregory. – Paŭlo Ebermann Mar 10 '15 at 21:03
• @PaŭloEbermann wrong way around: his construction is a special case of mine. – rschwieb Mar 11 '15 at 3:44 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.975201841245846,
"lm_q1q2_score": 0.8040167928456962,
"lm_q2_score": 0.8244619306896955,
"openwebmath_perplexity": 276.00798087618386,
"openwebmath_score": 0.9005923271179199,
"tags": null,
"url": "https://math.stackexchange.com/questions/1184152/an-example-of-a-ring-with-many-zero-divisors"
} |
electromagnetism, maxwell-equations, history
In electromagnetism, one of the fundamental fields of physics, the introduction of Maxwell's equations (mainly in "A Dynamical Theory of the Electromagnetic Field") was one of the most important aggregations of empirical facts in the history of physics. It took place in the nineteenth century, starting from basic experimental observations, and leading to the formulations of numerous mathematical equations, notably by Charles-Augustin de Coulomb, Hans Christian Ørsted, Carl Friedrich Gauss, Jean-Baptiste Biot, Félix Savart, André-Marie Ampère, and Michael Faraday. The apparently disparate laws and phenomena of electricity and magnetism were integrated by James Clerk Maxwell, who published an early form of the equations, which modify Ampère's circuital law by introducing a displacement current term. He showed that these equations imply that light propagates as electromagnetic waves. | {
"domain": "physics.stackexchange",
"id": 22887,
"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, maxwell-equations, history",
"url": null
} |
orbital-mechanics, solar-eclipse
Title: Orbit of the moon so that there are no eclipses Theoretically speaking, what orbit should the earth's moon must take so that there are never any eclipses - solar or lunar? Is it mathematically possible to construct such an orbit? Answer: yes, a no-eclipse orbit is possible
The plane of the Earth-Sun orbit (the ecliptic) and the plane of the Earth-Moon orbit must intersect each other because they both contain at least one point in common: the CM of Earth. Two planes always intersect in a line, so there will always be two POTENTIAL positions for the three bodies to be aligned, as illustrated below.
However, that doesn’t mean the bodies MUST align: if a “month” was a proper fraction of a year, the Moon could always be above (or below) the ecliptic at times of potential eclipse.
For instance, consider an idealized Earth/Moon system with the Moon in a circular orbit of period 1/12 of a sidereal year and the Moon’s orbital inclination is 5* with respect to the ecliptic. | {
"domain": "astronomy.stackexchange",
"id": 7031,
"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": "orbital-mechanics, solar-eclipse",
"url": null
} |
general-relativity, differential-geometry, acceleration, coordinate-systems, differentiation
We cannot derive any other tensor field along the curve, though, because we would not know how to "move" the tensor from one point on the curve to another nearby, to take their difference, which is necessary if we are considering a derivative. This is also true of the vector field $\pmb{u}$ defined above. In flat space this is done by moving the tensor keeping it parallel to itself, but in a generic manifold there is no notion of parallelism. To move the tensor we must therefore introduce a notion of "nearby parallelism", which is not unique. This is embodied in the choice of a connection. The directional covariant derivative $\nabla_{\pmb{u}}$ expresses the result of infinitesimally moving a tensor along the direction of the vector $\pmb{u}$, keeping the tensor parallel to itself according to the connection chosen, and then taking the difference with the tensor at the end place. We can in particular apply this to $\pmb{u}$ itself: $\nabla_{\pmb{u}}\pmb{u}$. | {
"domain": "physics.stackexchange",
"id": 79507,
"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, differential-geometry, acceleration, coordinate-systems, differentiation",
"url": null
} |
np-hard, approximation, greedy-algorithms, number-theory
Let us prove this statement. At any stage of the algorithm, let $U' \subseteq U$ be the set of uncovered elements. Here $U$ is the initial set of elements. Let $S_1,S_2,\dotsc,S_k$ be the optimal solution. In other words, $S_1,S_2,\dotsc,S_k$ cover all elements from $U$. Suppose that after $t$ iterations, the algorithm has picked $p$ sets from $S_1,S_2,\dotsc,S_k$ for some $0 \leq p\leq t$. Without loss of genrality, suppose these sets are $S_1,\dotsc,S_p$. Note that $S_{p+1},\dotsc,S_{k}$ covers $U'$. Therefore, there exists a set in the collection that covers at least $1/(k-p)$ fraction of $|U'|$. Since $1/(k-p) \geq 1/k$, we have that at least $1/k$ fraction of uncovered elements are covered in any iteration. This completes the proof of the statement. Now, we will apply this statement. | {
"domain": "cs.stackexchange",
"id": 19393,
"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-hard, approximation, greedy-algorithms, number-theory",
"url": null
} |
quantum-computing
Title: How is Grover's Algorithm useful? I am at a loss when it comes to understanding how Grover's Algorithm gives any useful information. Suppose we have a 4-qubit states (|0⟩ to |15⟩), and we are searching for the state |3⟩. The oracle would thus be
O=I−2|3⟩⟨3|
And then, at the end, after all the amplitude amplification steps, we would get the state |3⟩ with a high probability, but does this give any new information, since we already used |3⟩ inside the oracle?
I know I am missing out something crucial, but I absolutely cannot put my finger on it.
Please help. Thank you. The thing you're missing is that you aren't search for $|3\rangle$, you're searching for "the input that makes $f$ return true" where $f$ is some function. | {
"domain": "cs.stackexchange",
"id": 8918,
"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-computing",
"url": null
} |
python, embedded, websocket, cherrypy, raspberry-pi
def signal_handler(signal, frame):
global pollStatus
pollStatus=False
cherrypy.engine.stop()
cherrypy.engine.exit()
print('You pressed Ctrl+C!')
if __name__ == '__main__':
import logging
from ws4py import configure_logger
configure_logger(level=logging.DEBUG)
signal.signal(signal.SIGINT, signal_handler)
pollStatus=True
thread = threading.Thread(target = stpoll, args = (10, ))
thread.daemon = True
thread.start()
parser = argparse.ArgumentParser(description='Echo CherryPy Server')
parser.add_argument('--host', default='127.0.0.1')
parser.add_argument('-p', '--port', default=9000, type=int)
parser.add_argument('--ssl', action='store_true')
args = parser.parse_args()
cherrypy.config.update({'server.socket_host': args.host,
'server.socket_port': args.port,
'tools.staticdir.root': os.path.abspath(os.path.join(os.path.dirname(__file__), 'static'))}) | {
"domain": "codereview.stackexchange",
"id": 14569,
"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, embedded, websocket, cherrypy, raspberry-pi",
"url": null
} |
navigation, turtlebot2, turtlebot, costmap
Thanks,
Caroline
UPDATE : yaml file
max_obstacle_height: 0.60
obstacle_range: 2.5
raytrace_range: 3.0
robot_radius: 0.18
inflation_radius: 0.50
observation_sources:
scan
bump
scan: {data_type: LaserScan, topic: /scan, marking: true, clearing: true}
bump: {data_type: PointCloud2, topic: mobile_base/sensors/bumper_pointcloud, marking: true, clearing: false}
Where would you add the min_height parameter ? I tried with "scan: {data_type: LaserScan, topic: /scan, marking: true, clearing: true, min_obstacle_height:0.30}" but the costmap is not existing anymore in rviz. | {
"domain": "robotics.stackexchange",
"id": 13358,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, turtlebot2, turtlebot, costmap",
"url": null
} |
c#
And I call it like this:
Airport airport = new Airport(data);
Do you think this is a good way to do the mapping from the elements of the array to the properties of the class or is there a better way. I couldn't really find anything online.
Obviously I haven't done all of the safety checks etc. This is just a small experiment. Basically this looks good but it can be improved. | {
"domain": "codereview.stackexchange",
"id": 11522,
"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#",
"url": null
} |
(LP) and Operations Research (OR) with solved exercises for students. Quick-access build box lets you draw basic circuit primitives quickly, while allowing access to a wide assortment of non-linear elements, feedback elements, digital / mixed-mode components, and. Linear Programming Calculator is a free online tool that displays the best optimal solution for the given constraints. By browsing this website, you agree to our use of cookies. Complete, detailed, step-by-step description of solutions. One of the reasons that linear programming is so useful is because it can be used in so many different areas of life, from economic puzzles and social problems to industrial issues and military matters. Hosted by the Wisconsin Institute for Discovery at the University of Wisconsin in Madison, the NEOS Server provides access to more than 60 state-of-the-art solvers in more than a dozen optimization categories. Linear programming - Linear programming (LP) (also called linear optimization)is the | {
"domain": "valoreterritorio.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464485047916,
"lm_q1q2_score": 0.8174722323678324,
"lm_q2_score": 0.8376199673867852,
"openwebmath_perplexity": 808.1264268448064,
"openwebmath_score": 0.39217397570610046,
"tags": null,
"url": "http://gjuy.valoreterritorio.it/linear-programming-solver.html"
} |
algorithms
That's a lot of formalism to get out of the way before we even talk about the problem, but it's important to be rigorous.
Showing Bubblesort is correct
To show Bubblesort is correct, we should show that the post-conditions follow assuming the pre-conditions hold. Total correctness will follow since Bubblesort trivially halts.
Loop Invariants
This is something you see everywhere in proofs of correctness that have loops. Instead of talking about the whole algorithm "at once", it's useful to come up with something that will be true for each iteration of the loop. This often lends itself to an inductive argument. The loop invariant you want to come up with is something that will help you conclude what you want to conclude at the end of the day - that A[1...n] is sorted once we terminate.
Here's what I came up with to that end. For any iteration $i$ of the outer loop: For any $a \in \{1,...,n\}$: | {
"domain": "cs.stackexchange",
"id": 17276,
"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",
"url": null
} |
The reason it's cool to write the exponents $\nu_p(r)$ explicitly as a function of $r$ is that this makes it easier to state the very important observation that when you multiply two rational numbers together, the exponents in their unique prime factorizations add:
$$\nu_p(rs) = \nu_p(r) + \nu_p(s).$$
In particular,
$$\boxed{ \nu_p(r^2) = 2 \nu_p(r) }.$$
That is, if $r^2$ is the square of a rational number, then the exponents in its prime factorization must all be even. So why can't $2$ be the square of a rational number? Because one of the exponents in its prime factorization - namely the exponent of $2$ - is odd. And why doesn't $4$ succumb to this argument? Because $4 = 2^2$, so all of the exponents in its prime factorization are even. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936370890583,
"lm_q1q2_score": 0.8258399808395923,
"lm_q2_score": 0.8376199572530449,
"openwebmath_perplexity": 169.02589547593166,
"openwebmath_score": 0.8642460107803345,
"tags": null,
"url": "https://math.stackexchange.com/questions/1251974/where-does-the-proof-of-sqrt-2-is-irrational-break-down-when-trying-to-prove"
} |
php
//If no errors
if (empty($errors)) {
$formOK = true;
$mail = new PHPMailer(true);
try {
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = MAIL_HOST;
$mail->Port = MAIL_PORT;
$mail->Username = MAIL_USER;
$mail->Password = MAIL_PASS;
$mail->SetFrom($contact_Email, $contact_Name);
$mail->Subject = "$contact_Subject";
$mail->Body = "Your received the following message from $contact_Mame ($contact_Foretag) <$contact_Email>:\r\n\r\n$contact_Message";
$mail->AddAddress(MAIL_ADDR);
$mail->Send();
} catch (PHPMailerException $e) {
header("HTTP/1.1 500 Internal Server Error");
echo "Exception occurred: ".$e->errorMessage();
exit();
}
}
else {
$formOK = false;
} | {
"domain": "codereview.stackexchange",
"id": 3619,
"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",
"url": null
} |
• Let $\mathbb{N}=\left\{ 0,1,2,\ldots\right\}$.
• For every $n\in\mathbb{N}$, we let $\left[ n\right]$ denote the set $\left\{ 1,2,\ldots,n\right\}$.
• Fix $n\in\mathbb{N}$.
• Let $S_{n}$ denote the $n$-th symmetric group (i.e., the group of permutations of $\left[ n\right]$). | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9702399094961359,
"lm_q1q2_score": 0.8529832786061683,
"lm_q2_score": 0.8791467659263148,
"openwebmath_perplexity": 159.26366793194484,
"openwebmath_score": 0.9742786884307861,
"tags": null,
"url": "https://mathoverflow.net/questions/87877/jacobis-equality-between-complementary-minors-of-inverse-matrices"
} |
quantum-mechanics, classical-mechanics
Title: counting normal modes I'm not sure if my confusion is substantive or merely semantic. So here's the most naïve way to frame it: A free $N$-atom molecule has $3N-6$ vibrational normal modes, with each mode having fixed energy for a given molecule. Classically, the state of the molecule (in the harmonic approximation) can be expanded on the basis of its vibrational modes. In quantum mechanics, the Hamiltonian can similarly be reduced to a sum of $3N-6$ harmonic oscillators. But each of these oscillators has its own spectrum of fixed-energy stationary states. These too are normal modes, since they do not evolve into one another. But they're clearly not the $3N-6$ referred to classically (although they do set the scales for the $3N-6$ quantum spectra). So how does one understand how a finite number of fixed-energy classical normal modes becomes an infinity of qm modes of different energies? If you consider the classical system then the analysis gives us a set of normal modes, but it | {
"domain": "physics.stackexchange",
"id": 31942,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, classical-mechanics",
"url": null
} |
particle-physics
You can see that Majorana neutrinos violate lepton number conservation by $2$ units from the mass term. The mass term,
$$
\mathcal{L} = \frac12 m \psi^T C^{-1}\psi,
$$
is not invariant under the $U(1)$ lepton number symmetry, $\psi\to\exp(iL\theta)\psi$. It picks up a phase of twice the lepton number of the neutrino, i.e. $\Delta L=2$ rather than $\Delta L=0$. A Majorana neutrino cannot be charged under a $U(1)$ symmetry.
Because there is not a lepton number $U(1)$ symmetry, there is no conserved Noether charge corresponding to lepton number. | {
"domain": "physics.stackexchange",
"id": 37744,
"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",
"url": null
} |
c++
Title: Wrapper for dynamically-allocated memory block I have built a single header-only memory class (just a C++ wrapper around a dynamically-allocated pointer and a size) that supports copy and move semantics (I hope I implemented them correctly) for a game I'm building. Its use case is to wrap the raw contents of assets imported (from any source) before processing them. So there is:
#include <cstdint>
#include <algorithm>
class Memory
{
uint8_t *ptr;
size_t size;
public:
inline Memory() : ptr(nullptr), size(0) {}
inline Memory(size_t size) : ptr(new uint8_t[size]), size(size) {}
inline Memory(const Memory &other) : Memory(other.size)
{
std::copy(other.ptr, other.ptr+size, ptr);
}
inline Memory(Memory &&other) : Memory() { swap(*this, other); }
inline Memory& operator=(Memory other)
{
swap(*this, other);
return *this;
}
inline ~Memory() { delete[] ptr; } | {
"domain": "codereview.stackexchange",
"id": 22334,
"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++",
"url": null
} |
synthesis, stability, history-of-chemistry, decomposition
Gold(II) complexes has been intensly studied previously. They have been trying to synthesize a stable complex but failed miserably. The stable ones are only present in low temperature and only one was found to be stable in room temperature. So, although gold(II) complexes were previously discovered and (synthesized?), why scientists at University of Mainz and those who discovered it in 2017 claims to have synthesized gold(II) complexes for the first time? You are correct in noting that there are a number of Au (II) small molecule species synthesized prior to the report of Professor Katja Heinze in 2017.
The heart of the Au (II) claim by Professor Katja Heinze and team as stated in the article you referenced, see reference 1 given below, has to do with the a) relative stability of the mono-nuclear gold-porphyrin complexes compared to other Au (II) systems and b) that the molecule does not have a Au-Au bond. The latter point being the more important. | {
"domain": "chemistry.stackexchange",
"id": 14638,
"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": "synthesis, stability, history-of-chemistry, decomposition",
"url": null
} |
thermodynamics, fluid-dynamics, diffusion
Title: Confusion about Fick's first law Consider a binary system of mass transport (A, B). Some of mass transfer books (Skelland and Welty) say that the relation $$J_A= -C D_{AB} \frac{dx_A}{dz} \tag{I}$$ is more general than $$J_A= -D_{AB} \frac{dc_A}{dz} \tag{II}$$ Where $C$ is the total concentration of system.
Now we know that $J_A+J_B=0$. Regarding this equality, I say that the first equation $(I)$ always gives $D_{AB}=D_{BA}$ since $dx_A=-dx_B$.
Second equation $(II)$ gives $D_{AB}=D_{BA}$ under the condition that $C$ is constant.
So Fick says that if $C$ is constant then $D_{AB}=D_{BA}$.
Skelland says that under specific operational conditions for a binary system $D_{AB}=D_{BA}$ and so Fick's relation is true if $C$ is constant. | {
"domain": "physics.stackexchange",
"id": 44846,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, fluid-dynamics, diffusion",
"url": null
} |
microbiology, bacteriology, terminology, anatomy
I tried to figure it out, going by the smattering of Greek I picked up as a Bio. student ( Cephalos = Something to do with the head ; Lophos = something to do with a peak/protuberance ), I arrived at:
Hmm... so cephalotrichous probably means you find the tuft on one "end" (so arrangement A), and ipso facto lophotrichous is arrangement B.
But I guess, I ended up putting a little too much thought into it...
Cephalotrichous is probably used to indicate you have a tuft on the "head" in addition to another tuft on the "tail" (so arrangement B), and ipso facto lophotrichous is arrangement A.
At this stage I'm not sure what's more serious: my inability to find an authoritative answer to my question... or my tendency to overthink stuff | {
"domain": "biology.stackexchange",
"id": 7980,
"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": "microbiology, bacteriology, terminology, anatomy",
"url": null
} |
• @Adayah: My reply to Henning was meant as an agreement. I first posted only the telescoping series, but then added an integral approach to satisfy the first part of the question. In any approach where one breaks up the summand using partial fractions, it could be said that, at that point, the answer could be computed as a telescoping sum. – robjohn Nov 4 '14 at 20:48 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9736446463891303,
"lm_q1q2_score": 0.8607401138697173,
"lm_q2_score": 0.8840392817460333,
"openwebmath_perplexity": 633.7219715032601,
"openwebmath_score": 0.9224899411201477,
"tags": null,
"url": "https://math.stackexchange.com/questions/1004081/is-it-possible-to-write-a-sum-as-an-integral-to-solve-it"
} |
ros, gazebo, ros-kinetic
</collision>
<visual name="front_link_left_wheel_visual">
<origin rpy="0 1.5707 1.5707" xyz="0.15 -0.15 0"/>
<geometry>
<cylinder length="0.06" radius="0.1"/>
</geometry>
</visual>
</link>
<!-- <joint name="front_joint_left_wheel" type="continuous"> -->
<joint name="front_joint_left_wheel" type="fixed">
<origin rpy="0 0 0" xyz="0.15 -0.15 0"/>
<child link="front_link_left_wheel"/>
<parent link="link_chassis"/>
<axis rpy="0 0 0" xyz="0 1 0"/>
<limit effort="10000" velocity="1000"/>
<joint_properties damping="1.0" friction="1.0"/>
</joint>
</robot>
Originally posted by bob-ROS with karma: 525 on 2020-04-16
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 34770,
"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, gazebo, ros-kinetic",
"url": null
} |
ii) What is the probability of getting $n$ heads (i.e. $N=n$)?
This is what I did:
$\mathbb{P}(N=n) = \frac{1}{3} \begin{pmatrix}10 \\ n \end{pmatrix}(0.7^n 0.3^{10-n} + 0.5^{n}0.5^{10=n} + 0.3^{n}0.7^{10-n})$.
(iii) Is the distribution of $N$ binomial?
I said:
No. Because even though the sum of binomials is binomial, we have a constant dividing this binomial. A binomial divided by a constant is not necessarily binomial.
Are these all corect and if so/not, how would I do this/do this better?
Thanks! | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.974434788304004,
"lm_q1q2_score": 0.8033843784906058,
"lm_q2_score": 0.8244619220634456,
"openwebmath_perplexity": 161.0624168075199,
"openwebmath_score": 0.8751632571220398,
"tags": null,
"url": "https://math.stackexchange.com/questions/2328215/probability-and-binomial-distributions-picking-coins"
} |
4
This has been an open problem for some years until a negative answer was given indenpendtly by Redko [4] and Conway [1, pp. 105-118]): every complete system of identities for the regular expressions is necessarily infinite. Conway [1, pp. 116-119] conjectured a "good" complete system and this conjecture was ultimately proved by Krob [2, 3]. Interestingly, ...
4
One way is to take it in pieces. Clearly your automaton accepts $0^*$. What else gets it back to state $a$? Only $11^*00$, after which you can have any number of zeroes again. Thus, $0^*(11^*000^*)^*$ almost does the trick. However, like your automaton, it misses the possibility that an acceptable string can end in $1$ or $10$ if no $0$ immediately precedes ...
4 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9766692298333416,
"lm_q1q2_score": 0.8117518363481158,
"lm_q2_score": 0.8311430436757312,
"openwebmath_perplexity": 230.7564990045687,
"openwebmath_score": 0.9002066850662231,
"tags": null,
"url": "http://math.stackexchange.com/tags/regular-expressions/hot"
} |
geology, geophysics, plate-tectonics, models, earth-history
I would expect then a new supercontinent to form in some million years, but this implies Atlantic or Pacific Ocean, both with ocean-ridges and divergent margins, to disappear.
Wich one will be closed and wich one will survive to Supercontinent Cycle? The pacific has already lost part its spreading center, north america has been pushed over it.. A few tiny non-contiguous plates like the Juan de fuca plate is all that is left of the east pacific plate. in places like the san-andreas the north american plates has complete overridden the spreading center. | {
"domain": "earthscience.stackexchange",
"id": 1734,
"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": "geology, geophysics, plate-tectonics, models, earth-history",
"url": null
} |
structural-engineering, structural-analysis, beam, structures
The diagonal braces in options A and B appear to have the most eccentric connections. Options C and D are more concentric to the tree and the timber members. The TAB bolts however are eccentrically loaded and will be required to resist shear, bending and possibly withdrawal forces. Your intuition is correct in that keeping these TAB bolts as short as possible is desirable. However, TAB bolts are proprietary products. As such they have a specified strength. This strength can vary depending upon the species of the tree. They are specifically manufactured for the construction of treehouses with the apparent purpose of reducing or eliminating eccentricity by acting as an artificial limb wherever you need one.
So, if you are able to determine the forces acting on the TAB bolt, it can simply be compared to the manufacturer specified strength. Use of these products has an added advantage in that companies that manufacture them often provide technical support at no charge. | {
"domain": "engineering.stackexchange",
"id": 5016,
"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": "structural-engineering, structural-analysis, beam, structures",
"url": null
} |
cc.complexity-theory, randomized-algorithms, space-bounded
represent distinct eventually-periodic strings
and
for each such eventually-periodic string, the left entry of its triple
is the probability of the automaton outputting that string
and
each of those probabilities is greater than $1/j$
and
for each string x, if the probability of the automaton outputting $x$ is greater than $1/j$ then
$x$ is eventually-periodic and represented by the right two entries of one of the triples
. (In light of this paper, I suspect Lemma 6.1 can be improved to put its problem in TC1.
If so, then TC1 can also do everything relevant to this answer that NC2 can do.)
Applying that to the OP's problem: | {
"domain": "cstheory.stackexchange",
"id": 3673,
"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, randomized-algorithms, space-bounded",
"url": null
} |
machine-learning, classification, naive-bayes-classifier
If try to predict whether Harry will play golf on a sunny day (which I have no data for).
Would it be correct to exclude the person attribute and use the remaining outlook attribute to calculate the probability of this happening? Or could that potentially cause problems with a larger data set that I'm unaware of? Among Naive Bayes assumptions the main one is that features are conditionally independent. For our problem we would have:
$$P(Play|Outlook,Person) \propto P(Play)P(Outlook|Play)P(Name|Play)$$
To address question is Harry going to play on a sunny day?, you have to compute the following:
$$P(Yes|Sunny,Harry) = P(Yes)P(Sunny|Yes)P(Harry|Yes)$$
$$P(No|Sunny,Harry) = P(No)P(Sunny|No)P(Harry|No)$$
and choose the probability with bigger value. | {
"domain": "datascience.stackexchange",
"id": 512,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, classification, naive-bayes-classifier",
"url": null
} |
c++, beginner, error-handling, calculator, i18n
void hypotenuse() {
double a, b;
output("\nEnter the first length: ", "\nEntrez la premiere longueur : ");
cin >> a;
intcheck(a);
output("Enter the second length: ", "Entrez la seconde longueur : ");
cin >> b;
intcheck(b);
cout << "\nx^2 = " << a << "^2 + " << b << "^2" << endl;
cout << "x^2 = " << a*a << " + " << b*b << endl;
cout << "x^2 = " << a*a + b*b << endl;
cout << "x = sqrt(" << a*a + b*b << ")" << endl;
cout << "x = " << sqrt(a*a + b*b) << endl;
output("\nThe length of the hypotenuse is ", "\nLa longueur de l'hypotenuse est ");
cout << sqrt(a*a + b*b) << "." << endl;
} | {
"domain": "codereview.stackexchange",
"id": 23022,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, beginner, error-handling, calculator, i18n",
"url": null
} |
sql, database, postgresql, stored-procedure
-- load the media and universe ids in one go
SELECT
med_unv_id,
med_id,
mt_uses_actors
INTO md_unv_id, lk_med_id, mt_actors
FROM v_medias
WHERE LOWER(p_med_title) = LOWER(med_title);
-- we require the universe id before we can get the character id
SELECT
chr_id,
chr_unv_id
INTO lk_chr_id, cr_unv_id
FROM characters
WHERE LOWER(p_chr_name) = LOWER(chr_name);
IF mt_actors IS TRUE AND lk_act_id IS NULL
THEN
RAISE EXCEPTION
'Selected media has actors must not be null: actor = %', p_act_name;
END IF;
IF lk_med_id IS NULL
THEN
RAISE EXCEPTION 'Media Not Found, name = %', p_med_title;
END IF;
IF lk_chr_id IS NULL
THEN
RAISE EXCEPTION 'Character Not Found, name = %', p_chr_name;
END IF;
IF md_unv_id <> cr_unv_id
THEN
RAISE EXCEPTION 'Character and Media must be in same universe';
END IF;
INSERT INTO character_media_actors (cma_act_id, cma_chr_id, cma_med_id) VALUES
(lk_act_id, lk_chr_id, lk_med_id); | {
"domain": "codereview.stackexchange",
"id": 25765,
"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, database, postgresql, stored-procedure",
"url": null
} |
laserscan, pointcloud
Title: Laser Scan publisher
I have written a laser scan filter based off of geometric correction. It is doing well, so I'd like to try mapping with it. After the scan is filtered, it is stored in a pcl::PointCloud<pcl::PointXYZ> PointCloud. I need to take this and convert it to a laser scan for gmapping. Any helpful hints as to how I go about this?
Originally posted by allenh1 on ROS Answers with karma: 3055 on 2012-04-11
Post score: 0
Have a look at point_cloud_to_laserscan.
All you need to do is publish your pcl::PointCloud use the point_cloud_to_laserscan node to get the corresponding laser scan. In the ros package turtlebot_bringup you'll find an example launch file that converts Kinect point clouds to laser scans.
Originally posted by Lorenz with karma: 22731 on 2012-04-11
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 8939,
"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": "laserscan, pointcloud",
"url": null
} |
energy, capacitance
Title: Why does a capacitor discharge a percentage of the original energy in the same time? If I charge a capacitor ($220\mu{F}$) using a 6V battery, and then measure the time it takes to discharge 90% of the initial energy over a resistor (${100k}\Omega$), and then charge the same capacitor using a 12V battery and measure the time it takes to discharge 90% of its initial energy again (over the same resistor).
Why are both times the same? Especially given that the second time there is 4 times more starting energy that the first time. ($E=\frac{1}{2}CV^2$.)
Why are both times the same? | {
"domain": "physics.stackexchange",
"id": 5935,
"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": "energy, capacitance",
"url": null
} |
python, pandas
Title: Dataframe looks the same but the structure is different when loop I am generating a dataframe from a JSON file, this JSON file can come from 2 different sources, so the internal structure is slightly different, so what I am doing is first detecting the source and from there I do a set of operations that gives me a Dataframe
Everything is good until here (I thought), as when I print it in jupyter it shows me the way I wanted they look the same (structure), the problem goes when I loop through them,
I get completely different results (this df have each same number of columns, 7 columns)
When I loop:
In 1 I have only 2 columns in the other one I get all the columns.
I am looping:
for i, (index, row) in enumerate(df_trans.iterrows()):
print(row) | {
"domain": "datascience.stackexchange",
"id": 3611,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, pandas",
"url": null
} |
newtonian-mechanics
More generally, one can consider phase space $\{ (\mathbf{r, p}) \}$ of your system. Periodic motion corresponds to an orbit in phase space parametrized by time.
So while the position will come back on itself, the momentum never will. Hence the trajectory in phase space is not an orbital. | {
"domain": "physics.stackexchange",
"id": 54599,
"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",
"url": null
} |
When you’re up, your friends know who you are. When you’re down, you know who your friends are.
800Score ONLY QUANT CAT1 51, CAT2 50, CAT3 50
GMAT PREP 670
MGMAT CAT 630
KAPLAN CAT 660
Manager
Joined: 20 Jan 2017
Posts: 60
Location: United States (NY)
Schools: CBS '20 (A)
GMAT 1: 750 Q48 V44
GMAT 2: 610 Q34 V41
GPA: 3.92
Re: Tom, working alone, can paint a room in 6 hours. Peter and John [#permalink]
### Show Tags
03 Feb 2017, 07:26
T-1/6
P-2/6
J-3/6
1*1/6+1*(1/6+2/6)+x(1/6+2/6+3/6)=1
4/6+x*1=1
x=2/6=1/3
P=2/6+2/6*1/3=2/6+2/18=8/18=4/9
Posted from my mobile device
Intern
Joined: 09 Oct 2016
Posts: 35
Re: Tom, working alone, can paint a room in 6 hours. Peter and John [#permalink]
### Show Tags | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. YES\n2. YES\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9713473306904066,
"lm_q1q2_score": 0.8136199096107576,
"lm_q2_score": 0.8376199572530448,
"openwebmath_perplexity": 3428.7840795199704,
"openwebmath_score": 0.7501006126403809,
"tags": null,
"url": "https://gmatclub.com/forum/tom-working-alone-can-paint-a-room-in-6-hours-peter-and-john-126629.html"
} |
newtonian-mechanics, forces, friction
Title: Why is it harder to walk on sand as opposed to a flat floor although the former has a higher friction coefficient? It is a common experience that it is harder to walk on sand as opposed to walking on a sleek flat floor, even though it is evident that the former is more abrasive than the latter? Because of Newton’s third law, for every action there is an equal but opposite reaction. When your feet push on the ground, the ground pushes back. The force that your foot exerts on a flat ground is mainly determined by friction. The higher the friction, the more efficiently you can walk. If the frictional force is decreased, the harder it will be to walk. And the loose sand under your feet results in a diminished frictional force as compared to a flat floor, because the sand can move easily.
Since the frictional force is now smaller, the reaction force of your feet in the sand is also smaller and it will require more effort on your part to walk a similar distance on hard ground. | {
"domain": "physics.stackexchange",
"id": 76598,
"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, friction",
"url": null
} |
positional-astronomy
Title: What positional accuracy (ie, arc seconds) is necessary to view Saturn, Uranus, beyond? My son and I are building an azimuth/elevation controller to point the telescope at planets using servos and a microcontroller. Assuming that our device is calibrated (that is, we tell our device to point at a specific RA/Dec and points in the right direction):
How accurate must positioning be (in arcseconds?) to point directly at a planet like Uranus and have it show up in the eyepiece? In case it matters, we are using a Celestron 70EQ with our own az/el hardware.)
(Perhaps another way to ask is this: if we have an outer planet in view, how many arc seconds need to pass before the object leaves the telescope's view?)
We are both new to astronomy, so our terminology or understanding could be off a bit, correct me where necessary. | {
"domain": "astronomy.stackexchange",
"id": 6860,
"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": "positional-astronomy",
"url": null
} |
vba, rubberduck
MsgBox "TestPassed"
End Sub
Sub TestMonitoringDatesDirectly()
Dim dTestResult As String
dTestResult = ReportRepository.MonitoringDates(DateValue("January 3, 2022"), DateValue("January 14, 2022"))
If dTestResult <> "03 - 14 January 2022" Then
MsgBox "Test Failed"
Exit Sub
End If
MsgBox "TestPassed"
End Sub | {
"domain": "codereview.stackexchange",
"id": 42719,
"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, rubberduck",
"url": null
} |
If you only care about the numbers, then you can use the Orbit-Stabilizer theorem to conclude that $|\Gal(K/F)| = |S||\Gal(K/F(\alpha))|$.
Edit: If you'd rather have something more concrete, the bijection between cosets and conjugates is given by $\sigma\Gal(K/F(\alpha)) \mapsto \sigma\alpha$. You can check this is a bijection in the same way you would check the stuff about group actions above.
• If $\sigma\alpha = \sigma'\alpha$ then $\sigma^{-1}\sigma\alpha = \alpha$ and thus $\sigma^{-1}\sigma'$ fixes alpha and is therefore in $\text{Gal}(K/F(\alpha))$, which means that $\sigma$ and $\sigma'$ are in the same coset. – user263190 May 23 '17 at 2:23
• I think this plus the last 3 lines should be your answer (and that $Gal(K/F(\alpha))$ is naturally a subgroup of $Gal(K/F)$) – reuns May 23 '17 at 2:32 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9873750477464142,
"lm_q1q2_score": 0.8372621983285994,
"lm_q2_score": 0.8479677506936878,
"openwebmath_perplexity": 152.02036993815992,
"openwebmath_score": 0.9048479795455933,
"tags": null,
"url": "https://math.stackexchange.com/questions/2292604/counting-the-number-of-galois-conjugates/2292759"
} |
You have changed your question, now it is easy.
Note that $n^n-1$ divides $n^2-1$ whenever $2 | n$. Hence, if $n$ is even, the answer is $0$, since $\frac{n^n-1}{(n+1)(n-1)}$ will be an integer.
Suppose that $n$ is odd. Note that $n \equiv -1 \mod n+1$. Hence, it is legitimate to replace $n$ by $-1$ in the modular expression, and this gives $$\frac{n^n-1}{n-1} = \sum_{i=0}^{n-1} n^i \equiv \sum_{i=0}^{n-1} (-1)^i \equiv 1 \mod n+1$$
because one factor of $1$ gets left out as $n$ is odd, so $n-1$ is even.
Hence, the answer is zero for even $n$, and $1$ for odd $n$.
Edit: You can multiply and check that $$(n-1) (1 + n + n^2 + \ldots + n^{n-1}) = n^n-1$$
it's the same as the equivalance class of $n^n+1$ by definition of modulars
• I had the wrong value up - please reconsider! – Cisplatin Oct 27 '16 at 0:38
The left-hand side is the sum of powers of $n$. Each power $n^a$ is equivalent to $(-1)^a\pmod{n+1}$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9711290955604489,
"lm_q1q2_score": 0.8437429680037208,
"lm_q2_score": 0.8688267830311354,
"openwebmath_perplexity": 170.69421665905384,
"openwebmath_score": 0.87685227394104,
"tags": null,
"url": "https://math.stackexchange.com/questions/1986883/how-to-simplify-fracnn-1n-1-mod-n-1"
} |
observational-astronomy, telescope, amateur-observing, exoplanet
phenomena such as comets or supernovae were spotted by amateurs. This was possible because the bottleneck in making discoveries was the human eye and brain. You needed eyes to look at the sky, or pictures of the sky. Computers couldn't process images well enough to find new transient objects. Only humans could do that. Professionals would be no better than amateurs at looking around the sky trying to spot new stars in galaxies or fuzzy stars that are not known nebulae. So amateurs with eyes, brains, and time had an advantage. | {
"domain": "astronomy.stackexchange",
"id": 5137,
"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": "observational-astronomy, telescope, amateur-observing, exoplanet",
"url": null
} |
python, performance, python-3.x, numpy
About seven times slower. However, when I raised depth to 700, the times were almost equal, and when I raised depth to 7000, the times were
3.6607714939891594
2.716483567011892
So the numpy-centric version does better as depth increases (FWIW).
Update 2
Using bitwise ops I was able to get better performance:
# Neighborhood pre-computation for get_free5. This is a one-time thing - the
# neighborhoods will never change as long as the rows,cols stay the same.
# NOTE however that these arrays are TRANSPOSED, because that's what free5
# does. | {
"domain": "codereview.stackexchange",
"id": 27597,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, python-3.x, numpy",
"url": null
} |
#define Domain(ftype) typename ftype::DomainType
#define requires(...)
#define DistanceType(ftype) std::size_t
template<typename A, typename B, typename C>
using triple = std::tuple<A,B,C>;
template<typename F>
requires(Transformation(F))
DistanceType(F) distance(Domain(F) x, Domain(F) y, F f)
{
// Precondition: y is reachable from x under f
typedef DistanceType(F) N;
N n(0);
while(x != y) {
x = f(x);
n = n + N(1);
}
return n;
}
template <typename T>
struct Transformation {
typedef T DomainType;
typedef T ReturnType;
typedef std::function<T(T)> FuncType;
Transformation(FuncType fn) {
this->fn = fn;
}
FuncType fn;
ReturnType operator()(DomainType x) {
return fn(x);
};
};
template<typename F>
requires(Transformation(F))
Domain(F) collision_point_nonterminating_orbit(const Domain(F)& x, F f) {
Domain(F) slow = x;
Domain(F) fast = f(x);
while(fast != slow) {
slow = f(slow);
fast = f(fast);
fast = f(fast);
}
return fast;
// Postconditon: return value is a collision point
} | {
"domain": "tobilehman.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806512500486,
"lm_q1q2_score": 0.8254779394753002,
"lm_q2_score": 0.8418256452674008,
"openwebmath_perplexity": 7426.21936086845,
"openwebmath_score": 0.45936593413352966,
"tags": null,
"url": "https://tobilehman.com/elem-prog.html"
} |
general-relativity, metric-tensor, curvature
must hold. This leads to
$$ \frac{\partial f}{\partial r} \enspace = \enspace \sqrt{\frac{1-a(r)}{a^2(r)}} \enspace = \enspace \sqrt{\frac{\tfrac{2m}{r}}{\big(1-\tfrac{2m}{r} \big)^2}} \quad ,$$
where $a(r) = 1 - \tfrac{2m}{r}$. The solution for this integral is
$$ f \enspace = \enspace 2m \cdot \bigg( 2\sqrt{\tfrac{r}{2m}} + \ln \Big( \big| 1 - \sqrt{\tfrac{r}{2m}} \big| \Big) - \ln \Big( 1 + \sqrt{\tfrac{r}{2m}} \Big) \bigg)$$
up to some constant. The hypersurface is now the set of points with coordinates $(t,r,\theta,\phi) = (f(r), r, \theta, \phi)$, where $f$ is the above function. | {
"domain": "physics.stackexchange",
"id": 84236,
"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, metric-tensor, curvature",
"url": null
} |
fluid-dynamics, diffusion
that distribute material. This again is generally an isotropic constant that has to be set before starting a numerical simulation: Similarly one may introduce an additional turbulent Schmidt number $Sc_t = \frac{\nu_t}{D_t}$ that for any fluid is of order $\mathcal{O}(1)$ and use it for determining the additional turbulent diffusion. Thus, for high Reynolds numbers the effects of turbulent diffusion are likely to clearly dominate over molecular diffusion in areas of convective transport and you might even be able to neglect molecular diffusion. In areas of dead waters where the velocity is close to zero, molecular diffusion is still the main mechanism of mass transport. In case you are interested in how precisely the eddy diffusivity emerges in RANS models you could have a look at "Turbulent diffusion" by P.J.W. Roberts and D.R. Webster. | {
"domain": "physics.stackexchange",
"id": 64165,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, diffusion",
"url": null
} |
javascript, optimization, object-oriented
var params = getParameters();
Then, you can fetch an individual parameter anytime from the params object. In fact, you won't even need to store them all in globals since there already stored in this one variable.
var Query_MenuTiles = params["menutiles"];
Working demo: http://jsfiddle.net/jfriend00/pj5ocazd/ | {
"domain": "codereview.stackexchange",
"id": 9167,
"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, optimization, object-oriented",
"url": null
} |
1 12. What are assymptodes in conics? There is no such thing. 4 Procedure for tracing curves in parametric form x = f(t) and y = (t) 4. Recall that with functions, it was very rare to come across a vertical tangent. There are many ways to find these problematic points ranging from simple graph observation to advanced calculus and beyond, spanning. Proof: Let P (r, θ) be any arbitrary point on the provided curve. In our application, we had to display the output of a multichannel ECG (Electro Cardiograph) device. You may edit these files before you print them. Procedure to find the asymptotes parallel to axes is explained in detail with an example. 2 Domain, Vertical Horizontal Asymptotes with Graphing. A free graphing calculator - graph function, examine intersection points, find maximum and minimum and much more This website uses cookies to ensure you get the best experience. Fay, Temple H. This is called the. Give the equations of any asymptotes or state that the graph has no | {
"domain": "deboragemin.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.976310525254243,
"lm_q1q2_score": 0.8317704857465571,
"lm_q2_score": 0.8519528000888386,
"openwebmath_perplexity": 731.363038185709,
"openwebmath_score": 0.8129591345787048,
"tags": null,
"url": "http://deboragemin.it/lxoc/asymptotes-of-polar-curves.html"
} |
javascript
var totTodayPositive = todayPositive.reduce((a, b) => a + b, 0);
var totYesterdayPositive = yesterdayPositive.reduce((a, b) => a + b, 0);
var totPositivi = totTodayPositive - totYesterdayPositive;
var totTodayRecovered = todayRecovered.reduce((a, b) => a + b, 0);
var totYesterdayRecovered = yesterdayRecovered.reduce((a, b) => a + b, 0);
var totRecovered = totTodayRecovered - totYesterdayRecovered;
var totTodayDeaths = todayDeaths.reduce((a, b) => a + b, 0);
var totYesterdayDeaths = yesterdayDeaths.reduce((a, b) => a + b, 0);
var totDeaths = totTodayDeaths - totYesterdayDeaths;
var totTodayConfirmed = todayConfirmed.reduce((a, b) => a + b, 0);
var totYesterdayConfirmed = yesterdayConfirmed.reduce((a, b) => a + b, 0);
var totConfirmed = totTodayConfirmed - totYesterdayConfirmed; | {
"domain": "codereview.stackexchange",
"id": 37825,
"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",
"url": null
} |
php, mvc, controller, codeigniter
public function create() {
// Only logged in users can create posts
if (!$this->session->userdata('is_logged_in')) {
redirect('login');
}
$data = $this->Static_model->get_static_data();
$data['pages'] = $this->Pages_model->get_pages();
$data['tagline'] = "Add New Post";
$data['categories'] = $this->Categories_model->get_categories();
$data['posts'] = $this->Posts_model->sidebar_posts($limit=5, $offset=0);
if ($data['categories']) {
foreach ($data['categories'] as &$category) {
$category->posts_count = $this->Posts_model->count_posts_in_category($category->id);
}
} | {
"domain": "codereview.stackexchange",
"id": 34802,
"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, controller, codeigniter",
"url": null
} |
python
tcp_results = filter_by_protocol(all_user_activity_load, 6)
udp_results = filter_by_protocol(all_user_activity_load, 17)
update_index(filter_id_from_data(tcp_results))
update_index(filter_id_from_data(udp_results))
db.close() | {
"domain": "codereview.stackexchange",
"id": 34061,
"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",
"url": null
} |
algorithms, algorithm-analysis, data-structures, hash-tables
I'm trying to use induction, but I don't know if this is the best method to go about proving this.
The worst case to probe $1$ array location would be when all $n$ element are stored in the first table, and we get probability $\frac{n}{2n} = \frac{1}{2} = O(\frac{1}{\sqrt{2}})$ for insertion.
The worst case to probe $2$ array locations would be when all $n$ elements are stored in the first table, we hit the first table, and we succeed in the second table. This has the same probability as it does to probe $1$ array location. | {
"domain": "cs.stackexchange",
"id": 3690,
"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, data-structures, hash-tables",
"url": null
} |
from Points in QGIS. https://mathworld.wolfram.com/BoundaryPoint.html. To get a tighter fit, all you need to do is modify the rejection criteria. In the case of open sets, that is, sets in which each point has a neighborhood contained within the set, the boundary points do not belong to the set. k = boundary(x,y) returns a vector of point indices representing a single conforming 2-D boundary around the points (x,y). BORDER employs the state-of-the-art database technique - the Gorder kNN join and makes use of the special property of the reverse k-nearest neighbor (RkNN). We de ne the closure of Ato be the set A= fx2Xjx= lim n!1 a n; with a n2Afor all ng consisting of limits of sequences in A. Unlike the convex hull, the boundary can shrink towards the interior of the hull to envelop the points. Mathematics Foundation 8,337 views You can set up each boundary group with one or more distribution points and state migration points, and you can associate the same distribution points and state | {
"domain": "basaknakliyateryaman.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9835969670030071,
"lm_q1q2_score": 0.8109382480722632,
"lm_q2_score": 0.8244619242200082,
"openwebmath_perplexity": 337.0517532069376,
"openwebmath_score": 0.7350977659225464,
"tags": null,
"url": "http://www.basaknakliyateryaman.com/km8a7/c77507-boundary-points-of-a-set"
} |
ros, slam, navigation, mapping, depth
Originally posted by Phelipe on ROS Answers with karma: 74 on 2015-07-10
Post score: 2
Original comments
Comment by Po-Jen Lai on 2015-07-10:
Why is the map built from LSD-SLAM not enough? The output map is point cloud.
Comment by Phelipe on 2015-07-10:
Thanks for your response! Is this choice the better one since i need a 3D map to navigate through? I'm looking for more options to consider. (PS.: This package works for ROS indigo and fuerte, i'm using the hydro version, is that a problem?)
Yeah, since you want to navigate, the map is quite important.
tum_ardrone is a good starting point, but instead of PTAM, you can try ORB SLAM. ORB SLAM works for ROS Hydro, so it might be a good choice.
Originally posted by Po-Jen Lai with karma: 1371 on 2015-07-10
This answer was ACCEPTED on the original site
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 22140,
"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, slam, navigation, mapping, depth",
"url": null
} |
electrochemistry, redox, notation
That is, ultimately, aren't redox potentials associated with redox couples/electrodes, not reactions? Your question is a valid question, and ignore downvotes. They don't mean anything.
Your understanding is very good and that you realized that the electrode potential is a property of the electrode and it really does not care how the reaction is written. However, a equation is $needed$ to keep track of the electrons lost or gained in the Nernst equation. So as a tradition and a matter of convenience, electrode potentials are quoted along with a balanced half-cell. | {
"domain": "chemistry.stackexchange",
"id": 13398,
"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": "electrochemistry, redox, notation",
"url": null
} |
java, file, escaping
read()
Should this method be private? Should it just throw an UncheckedIOException?
it’s easier to read positive checks than negative checks - switch the if and else when checking nextCharEquals.
declare variables in as low a scope as possible. isEscaping belongs inside the synchronized block.
you can get rid of the outer loop by using while ((this.bufferPosition < this.numCharsRead) || this.fillBuffer()) {
read - you don’t need the special case for the next character. It’s just additional complexity.
the process you’re describing isn’t "escaping". Escaping indicates that the next character contains an instruction or some other special character. What you want is to ignore CR-LF bounded by quotes, or some other special quoting character. | {
"domain": "codereview.stackexchange",
"id": 31458,
"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, file, escaping",
"url": null
} |
ros
nav_msgs::Odometry odometry;
odometry.header.frame_id = "odom";
odometry.child_frame_id = "base_link";
odometry.header.stamp = msg.header.stamp;
odometry.pose = msg.pose;
// set starting point
theta = msg.pose.pose.orientation.z;
x = msg.pose.pose.position.x;
y = msg.pose.pose.position.y;
// publish initial postion
odom_broadcaster.sendTransform(odom_trans);
pubOdometry.publish(odometry);
// start sync'd joint state callbacks
j1_sub.reset(new Subscriber<control_msgs::JointControllerState>(n, "/rrbot/joint1_position_controller/state", 10));
j2_sub.reset(new Subscriber<control_msgs::JointControllerState>(n, "/rrbot/joint2_position_controller/state", 10));
sync.reset(new TimeSynchronizer<control_msgs::JointControllerState, control_msgs::JointControllerState>(*j1_sub, *j2_sub, 10));
sync->registerCallback(boost::bind(&PublishOdometry::handelerOdometry, this, _1, _2));
} | {
"domain": "robotics.stackexchange",
"id": 15782,
"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",
"url": null
} |
cosmic-microwave-background, gravitational-redshift
Title: When the Cosmic Microwave Background radiation cools, where does the energy go? I understand how photons can change wavelength via gravitational redshifting, but that doesn't seem to be what's going on with the CMB radiation. I've heard it explained as happening because of the expanding universe, but I'm thinking that would have to imply that as the universe expands, lower wavelengths have higher energy, so to conserve energy, the CMB would have to redshift. Is that the case, or is something else going on? The energy goes nowhere. It needs to go nowhere, since energy conservation only holds for systems which are time translation invariant, and conversation of energy then follows by Noether's theorem. | {
"domain": "physics.stackexchange",
"id": 15500,
"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": "cosmic-microwave-background, gravitational-redshift",
"url": null
} |
c++, performance, algorithm, recursion, io
Here's the full header file:
ReverseHasher2.h
#ifndef REVERSE_HASHER2_H
#define REVERSE_HASHER2_H
#include <iostream>
#include <string>
class ReverseHasher {
public:
explicit ReverseHasher(char first, char last, char len, int hashval);
ReverseHasher& operator++();
bool isMax() const { return !more; }
friend std::ostream& operator<<(std::ostream& out, const ReverseHasher& fh);
private:
bool more{true};
const char first;
const char last;
const char characters;
std::string values;
};
#endif // REVERSE_HASHER2_H
And finally the full implementation of this, as mostly already listed above:
ReverseHasher2.cpp
#include "ReverseHasher2.h"
#include <iostream>
#include <iterator>
#include <algorithm>
#include <string> | {
"domain": "codereview.stackexchange",
"id": 36428,
"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, algorithm, recursion, io",
"url": null
} |
When you calculate the number of handshakes done by the Indian wives, $\binom{10}2$ also picks up the handshakes done between all the American wives. There are ten of those. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9688561694652216,
"lm_q1q2_score": 0.8115332711063172,
"lm_q2_score": 0.8376199653600372,
"openwebmath_perplexity": 297.94882970348516,
"openwebmath_score": 0.3071213960647583,
"tags": null,
"url": "https://math.stackexchange.com/questions/2534861/number-of-handshakes-exclusion-apporach"
} |
quantum-mechanics, hilbert-space, unitarity, quantum-states
$$L|A'⟩=\alpha_i|\lambda_i⟩$$
$$L|B'⟩=\beta_j|\lambda_j⟩$$
Where $|\lambda_i⟩$ are the Eigen vectors of the observable $L$. Now on measurement, this would lead to the state to collapse into one of the Eigen vectors, and as there is no condition that none of the Eigen vectors that represents state $|A'⟩$ also represent $|B'⟩$ (this is the important part, make sure you understand this) it means that there is a possibility that the observation of both states might lead to the same state. | {
"domain": "physics.stackexchange",
"id": 69736,
"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, unitarity, quantum-states",
"url": null
} |
fourier-transform, signal-processing
One piece of intuition
Convolutions occur whenever you have a two-stage process where the stages combine linearly and independently.
Suppose that I kick an initially still mass on a spring at time $t = 0$, and the subsequent trajectory of the spring is $x(t)$. If I apply the same kick at time $t = 1$, then by time translational invariance, the subsequent trajectory is $x(t-1)$. Now suppose that I kick both at $t = 0$ and $t = 1$, with strengths $f(0)$ and $f(1)$. Then by linearity, the subsequent trajectory is
$$f(0) x(t) + f(1) x(t-1).$$
This is like the "reversing and shifting" structure of a convolution. So more generally, if I apply a continuous force $f(t)$, then the trajectory is
$$\int dt' \, f(t') x(t-t')$$ | {
"domain": "physics.stackexchange",
"id": 68002,
"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": "fourier-transform, signal-processing",
"url": null
} |
game, rust
(result as f32 * SCORE_MERGE_FACTOR).round() as u64
}
I would love a general review with respect to Rust's paradigms, but I feel especially uncomfortable for not using iterators and having to use mutable variables all over the place.
I also find these explicit casts quite cumbersome, are they really necessary? With both scoring and merging
Oops! I did indeed neglect to include merging. This is my mistake; I'm not a big fan of returning values via mutable parameters, so I think my brain shut off. Fortunately, while working on the merging logic, I made the scoring logic shorter.
// Comment #1
fn compress_zeroes(line: [u8, ..4]) -> (u8, u8, u8, u8) {
let mut nums: Vec<_> = line.iter().map(|x| *x).filter(|x| *x != 0).collect();
nums.resize(4, 0);
(nums[0], nums[1], nums[2], nums[3])
}
// Comment #2
fn score_line(line: [u8, ..4]) -> u64 {
let line = compress_zeroes(line);
let line = (line.0 as u64, line.1 as u64, line.2 as u64, line.3 as u64); | {
"domain": "codereview.stackexchange",
"id": 11343,
"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": "game, rust",
"url": null
} |
c++, image, template, classes, c++20
Why a new review is being asked for?
Please review Cube template class implementation and all suggestions are welcome. Lots of small issues
Missing checks for overflow of width * height * depth.
Inconsistent types for coordinates: one constructor uses std::size_t for the dimensions, another int, and at() takes unsigned ints.
Sometimes you use size_t instead of std::size_t.
Unnecessary copies, for example in:
auto image = input[z];
Unnecessary return statement in the last constructor.
Why have both getSizeX() and getWidth()?
Why not use std::ranges::transform(), like so:
std::ranges::transform(data, rhs.data, std::ranges::begin(data), std::plus<>{}); | {
"domain": "codereview.stackexchange",
"id": 45266,
"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++, image, template, classes, c++20",
"url": null
} |
electricity, electric-circuits, electrons, charge
Positive current in AC Circuit
When applied to current, +ve and -ve refer to the direction of flow, not the sign of the charge carriers. It is like +x and -x directions on the co-ordinate axes. You can be going in the -x direction even when x > 0.
Current is measured in Amps. When you talk about +120V you are taking about potential difference (PD), not current.
PD tells you how much driving force (or electro-motive force) there is between two points in the circuit. The signs again refer to direction : a PD of +120V from left to right is the same as a PD of -120V from right to left. The sign here tells you whether you are going uphill (+) or downhill (-). | {
"domain": "physics.stackexchange",
"id": 32431,
"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": "electricity, electric-circuits, electrons, charge",
"url": null
} |
linked-lists
Title: How To Merge Together Two Circular Doubly-Linked Lists In O(1) Time? I'm implementing a Fibonacci Heap, where the lists are stored as a circular doubly-linked lists. What I'm trying to do is given a pointer to a random node in one linked list, and a random node in another, I want to merge them together in O(1) time. I tried drawing this out, but I couldn't seem to figure out how to do this. Here is my first idea, in pseudocode:
union(Node one, Node two) {
if other = nil
return
p1 = one
p2 = one.right
p3 = two
p4 = two.right
p1.right = p4
p4.left = p1
p2.right = p3
p3.left = p2
} | {
"domain": "cs.stackexchange",
"id": 15823,
"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": "linked-lists",
"url": null
} |
electrostatics, potential, voltage, boundary-conditions
Now my question is: if we legitimately guess a solution that has no foundation in any physical deduction, and it just so happens to satisfy the Laplace equation and fulfill the boundary conditions, is it the solution? I know there are no other equations $f_n(x)$ that satisfy Laplace's equation and take on the value $Q_1/R_1$ when $x=R_1$ (there's the canonical proof by contradiction), but this confuses me since it suggests that I can always "guess" that $\phi(x)=\phi_{\text{boundary}} \, \forall x$ and that this is correct because it satisfies the Laplace equation. But surely this wouldn't work. Why not?
if we legitimately guess a solution that has no foundation in any physical deduction, and it just so happens to satisfy the Laplace equation and fulfill the boundary conditions, is it the solution? | {
"domain": "physics.stackexchange",
"id": 54111,
"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": "electrostatics, potential, voltage, boundary-conditions",
"url": null
} |
classification
Title: How to refit a model? I have built a classification model that I have to refit.
New instances have been added to the former data set on which the model was build.
I was thinking to proceed that way :
split my new data set in 3 sub data sets : ( train , test_01 ) data sets to refit the model , ( test_02 ) test data set to compare the original model and the refitted one ( on the metric formerly used ). | {
"domain": "datascience.stackexchange",
"id": 7274,
"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": "classification",
"url": null
} |
fluid-dynamics, time, measurements
$$\pi R^2 \propto v\\
R \propto \sqrt{\frac{\alpha A}{2\rho}\left(\sqrt{1+\frac{8gh\rho^2}{(\alpha A)^2}}-1\right)}$$
When the viscosity is very small, this reduces to the equation we had before; when it is very large, it tells us that the radius is proportional to $\sqrt{h}$ instead of $\sqrt[4]{h}$. In between - it's something in between. Obviously, if viscous terms matter, this clock will lose accuracy as the viscosity changes - and that's a pretty big problem. From 10 to 30 C, viscosity changes a lot:
T(C) mu (mPa s)
10 1.308
20 1.002
30 0.7978 | {
"domain": "physics.stackexchange",
"id": 27568,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, time, measurements",
"url": null
} |
quantum-mechanics, wavefunction, harmonic-oscillator, complex-numbers, time-evolution
When a state is an eigenstate of the Hamiltonian, such as the ground state, it is called a stationary state. This is because its time evolution is entirely given by a phase factor: $\psi(x,t)=e^{-iEt/\hbar}\psi(x,0)$, where $\psi(x,0)$ is an eigenfunction with energy eigenvalue $E$. Notably, when you take the squared norm, the time dependence vanishes, since $\lvert e^{-iEt/\hbar}\rvert^2=1$, meaning the probability distributions for measurements are the same at any time. Therefore, it does not make sense to think of a particle in a quantum harmonic oscillator as moving back and forth, analogous to a classical harmonic oscillator. In particular, the particle effectively does not change if it is in an energy eigenstate. However, if the particle is not in an energy eigenstate (instead being in a superposition of states with different energies), then the expectation values of the position and momentum will oscillate similar to the classical case. | {
"domain": "physics.stackexchange",
"id": 80216,
"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, harmonic-oscillator, complex-numbers, time-evolution",
"url": null
} |
java, socket, server, client
@Override
protected void finalize() throws Throwable {
close();
super.finalize();
}
private void handleClient(final JSONClient client) {
Thread clientThread = new Thread(new Runnable() {
@Override
public void run() {
try {
clients.remove(client);
clients.add(client);
client.setSoTimeout(5000);
while (connected) {
JSONPacket request = client.readPacket();
if (request == null) {
break;
}
JSONPacket response;
if (onRequest != null) {
response = onRequest.onRequest(request);
} else {
response = new JSONPacket(new JSONObject());
}
client.writePacket(response); | {
"domain": "codereview.stackexchange",
"id": 6497,
"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, socket, server, client",
"url": null
} |
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. (included forhigher-level course) 30. 31. 32. 33. (included forhigher-level course) 34. (included forhigher-level course) 35. (included forhigher-level course) 36. (included forhigher-level course) 37. (included forhigher-level course) 38. (included forhigher-level course) 39. 40. (included forhigher-level course) 41. (included forhigher-level course) 42. 43ab. 43cd. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53ab. 53cd. 54. 55. 56. (included forhigher-level course) 57. (included forhigher-level course) 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. (included forhigher-level course) 70. 71. 72. 73. 74. 75. 76. 77. (included forhigher-level course) 78. 79. 80. 81. 82. 83. 84. 85. 86. (included forhigher-level course) 87. (included forhigher-level course) 88. (included forhigher-level course) 89.
# Index Card Titles/Concepts | {
"domain": "onemathematicalcat.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9748211604938802,
"lm_q1q2_score": 0.8246425941273466,
"lm_q2_score": 0.8459424431344437,
"openwebmath_perplexity": 7656.413418323592,
"openwebmath_score": 0.7073012590408325,
"tags": null,
"url": "https://www.onemathematicalcat.org/NAU/Calc1_MAT136/CalculusIndexCards.htm"
} |
satisfiability, formal-methods, first-order-logic, automated-theorem-proving, c
An additional complication is that it sounds like you want to quantify over all graphs of all sizes.
It sounds like you want to verify the following property: for all graphs, if C1 is true, then C2 and C3 are true.
The standard approach is to use assume and assert statements. You first write some assume statements that capture the assumption that the input graph satisfies C1. You then write some assert statements that capture the requirement that the C2 and C3 had better be true. The model checker checks whether there are any inputs that satisfy all the assume statements, and make at least one of the assertions false. | {
"domain": "cs.stackexchange",
"id": 8393,
"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": "satisfiability, formal-methods, first-order-logic, automated-theorem-proving, c",
"url": null
} |
I also attached 2D function plots for both latitude and longitude. Clearly the functions look almost identical. What's interesting is that the results follow the intuition: assigning bigger weight to the better model (RF) results in better RMSE compared to assigning a bigger weight to the weaker model (XGBoost). This can be seen in plots below.
The best weights were found to be as follows:
Now, my question is - is that a valid approach from a statistical/machine learning point of view? If not, are there any approaches of combining model results (apart from model ensembles) which I could try?
Code for analysis:
weight_rf <- seq(0, 1, by = 0.01)
weight_xgb <- seq(0, 1, by = 0.01)
len_rf <- length(weight_rf)
len_xgb <- length(weight_xgb)
lat_grid <- matrix(nrow = len_rf, ncol = len_xgb)
lon_grid <- lat_grid
pb <- txtProgressBar(min = 0, max = len_rf * len_xgb, style = 3)
iter = 1 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9553191271831558,
"lm_q1q2_score": 0.8194422825949234,
"lm_q2_score": 0.8577681104440172,
"openwebmath_perplexity": 2103.740607295768,
"openwebmath_score": 0.5321919918060303,
"tags": null,
"url": "https://stats.stackexchange.com/questions/226555/averaging-predictions-from-two-different-models"
} |
navigation, filter, costmap-2d, message, update
[ERROR] [1390551865.937278526]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ WARN] [1390551865.937817439]: The /scan observation buffer has not been updated for 5.19 seconds, and it should be updated every 5.00 seconds.
[ERROR] [1390551866.019037569]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ WARN] [1390551866.019541493]: The /scan observation buffer has not been updated for 5.27 seconds, and it should be updated every 5.00 seconds.
[ERROR] [1390551866.098517770]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!!
[ WARN] [1390551866.099021746]: The /scan observation buffer has not been updated for 5.35 seconds, and it should be updated every 5.00 seconds.
[ WARN] [1390551866.178367975]: The /scan observation buffer has not been updated for 5.43 seconds, and it should be updated every 5.00 seconds.
[ERROR] [1390551866.185031563]: SIMULATION COMPLETED, SEARCHING FOR NEW GOALS !!! | {
"domain": "robotics.stackexchange",
"id": 16725,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, filter, costmap-2d, message, update",
"url": null
} |
### Solutions to the Above Questions
• Part 1
According to the definition of the inverse matrix, if $A B = B A = I$ where $I$ is the identity matrix, then matrices $A$ and $B$ are inverses of each other.
According to property 6 above, if $A$ is a lower triangular matrix then its inverse $B$ is also a lower triangular matrix and if $B$ is a lower triangular its inverse $A$ is also a lower triangular.
• Part 2
A matrix is invertible if its determinant is not equal to zero.
$Det(AB) = Det (A) Det (B) = (x^2-1)(x)(y)(y^2-4)$
Matrix $A B$ is not invertible if any of the factors of $Det(AB)$ is equal to zero.
$x^2 - 1 = 0$ gives the solutions $x = 1$ and $x = - 1$
$y^2 - 4 = 0$ gives the solutions $y = 2$ and $y = - 2$
Hence matrix $A B$ is not invertible for any of these values of $x$ or $y$: $x = 0, x = - 1 , x = 1 , y = 0 , y = - 2 , y = 2$ | {
"domain": "analyzemath.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9933071490757152,
"lm_q1q2_score": 0.8121025765201408,
"lm_q2_score": 0.8175744806385543,
"openwebmath_perplexity": 156.52815957096396,
"openwebmath_score": 0.9260660409927368,
"tags": null,
"url": "https://www.analyzemath.com/linear-algebra/matrices/triangular.html"
} |
trigonometric functions. The following graph shows the function. A quadratic function is an equation in the form y = ax2 + bx + c, where a, b, and c are real numbers and a 0. 3 The Sine and Cosine Laws 4. Pre Calculus 12 - Graphing Trig Functions Test Answer Section MULTIPLE CHOICE 1. Trigonometry demonstrate an understanding of angles in standard position, expressed in degrees and radians develop and apply the equation of the unit circle solve problems, using the six trigonometric ratios for angles expressed in radians and degrees graph and analyze the trigonometric functions sine, cosine, and tangent to solve problems. 18 of the sine, cosine packet. be glad to know that right now trigonometry 10th edition lial ebook PDF is If you are looking for Maths Aptitude Test Questions And Answers, our library is free. as practice for her midterm test. Polynomial and rational functions covers the algebraic theory to find the solutions, or zeros, of such functions, goes over some graphs, and | {
"domain": "kamp-kommunikation.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9881308761574286,
"lm_q1q2_score": 0.8255670775092602,
"lm_q2_score": 0.8354835350552604,
"openwebmath_perplexity": 1038.9104651137295,
"openwebmath_score": 0.5665236711502075,
"tags": null,
"url": "http://ohpm.kamp-kommunikation.de/graphing-trig-functions-test-pdf.html"
} |
algorithms, approximation, greedy-algorithms
Title: Optimal solution for Weighted points problem Problem:
Fix a constant $k$. Given a set of $2d$-dimensional points $N = \{N_1, N_2, N_3, \dots, N_n\}$, each associated with an arbitrary weight, find a set of points $X = \{X_1, X_2, X_3, \dots, X_k\} \subseteq N$ such that the pairwise distance between any two points in $X$ is at least $D$, and $\sum_{i=1}^k \mathit{Weight}(X_i)$ is maximized. | {
"domain": "cs.stackexchange",
"id": 14853,
"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, approximation, greedy-algorithms",
"url": null
} |
python, beginner, parsing, csv
^ The loop above may need other modifications to your code before working properly (not tested).
Possibly, you may stop using the
class Article(object):
fulltxt = ""
Title = ""
Publication = ""
Date = ""
Year = ""
Author = ""
ID = ""
And just go for a plain dict, that sure would make the loop simple to implement.
Use with
txtFile = open(name, 'a')
txtFile.write(Article.Title)
txtFile.write(Article.fulltxt)
txtFile.close()
Should become
with open(name, 'a') as f:
f.write(Article.Title)
f.write(Article.fulltxt)
As it automatically closes the file.
Boring == possibly wrong
if line == '____________________________________________________________':
^^ Counting that the above has the correct number of underscores is boring so I will not do it (which is the correct number anyway?) you should do
if line == '_' * NUMBER_OF_UNDERSCORES_NEEDED: | {
"domain": "codereview.stackexchange",
"id": 15859,
"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, parsing, csv",
"url": null
} |
c#, asp.net-core, .net-core, entity-framework-core, asp.net-core-webapi
Title: .Net Core 6.0 : Entity Framework - Either Or / Neither Nor / Both in Where clause I am building a .Net Core 6.0 application that uses Entity Framework.
I have situation where I need to apply the filter(Where clause) based on two properties (eg: Guid? skillType, string skillName). These properties may or may not have values, means that
Neither of the property will have value
Either of the property will have value
Both properties will have value | {
"domain": "codereview.stackexchange",
"id": 43658,
"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-core, .net-core, entity-framework-core, asp.net-core-webapi",
"url": null
} |
programming-challenge, rust
impl Instruction {
fn try_many_from<'a>(s: &'a str) -> impl Iterator<Item = Result<Self>> + 'a {
s.split(", ").map(str::parse)
}
}
impl FromStr for Instruction {
type Err = Error;
fn from_str(s: &str) -> Result<Self> {
let mut chars = s.chars();
let turn = match chars.next() {
Some('L') => Turn::Left,
Some('R') => Turn::Right,
Some(_) => return Err("Turn character invalid"),
None => return Err("Instruction string is empty"),
};
let blocks = try!(chars.as_str().parse().map_err(|_| "Could not parse blocks"));
Ok(Instruction {
turn: turn,
blocks: blocks,
})
}
}
#[cfg(test)]
mod test {
use super::*; | {
"domain": "codereview.stackexchange",
"id": 23603,
"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": "programming-challenge, rust",
"url": null
} |
...however, this is not correct, since the variance is as follows:
$$Var(X) = Var(x_1) + Var(x_2) + \cdots + Var(x_n)$$ $$Var(X) = p(1-p) + p(1-p) + \cdots + p(1-p)$$ $$Var(X) = np(1-p)$$
I'm not seeing in my derivation where I'm missing the mark mathematically, and resulting in the incorrect "n" in the parentheses.
• The problem is that $(x_1+ x_2 + \cdots x_n)^2 \neq x_1^2 + x_2^2 + \cdots + x_n^2$. – Antoine May 9 '15 at 19:28
• You can use $$X^2 = \{X_1 ^2 + X_2 ^2 + \cdots + X_n ^2\} + 2{n\choose k}\sum_{i \neq j}(X_I X_J)$$, then calculate expectations using linearity and independence of random variables. – Tamojit Maiti Jun 19 '18 at 4:39
$E [X_i X_j] = p^2$. ${}{}{}{}{}{}{}{}{}$
So $E X^2 = \sum_{i=1}^n E X_i^2 + \sum_{i \neq j} E[X_i X_j] = np +(n^2-n)p^2$, and so $\operatorname{var} X = np(1-p)$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.960361159764527,
"lm_q1q2_score": 0.8023659386568258,
"lm_q2_score": 0.8354835371034368,
"openwebmath_perplexity": 233.8820254912789,
"openwebmath_score": 0.9668898582458496,
"tags": null,
"url": "https://math.stackexchange.com/questions/1274576/deriving-the-variance-of-a-binomial-distribution"
} |
slam, navigation, ros-electric, ros-fuerte, rosmake
graph_manager.cpp:(.text._ZN3g2o11BlockSolverINS_17BlockSolverTraitsILi6ELi3EEEE5solveEv[g2o::BlockSolver<g2o::BlockSolverTraits<6, 3> >::solve()]+0x1176): undefined reference to `g2o::globalStats'
graph_manager.cpp:(.text._ZN3g2o11BlockSolverINS_17BlockSolverTraitsILi6ELi3EEEE5solveEv[g2o::BlockSolver<g2o::BlockSolverTraits<6, 3> >::solve()]+0x1199): undefined reference to `g2o::globalStats'
CMakeFiles/rgbdslam.dir/src/graph_manager.o:graph_manager.cpp:(.text._ZN3g2o15LinearSolverPCGIN5Eigen6MatrixIdLi6ELi6ELi0ELi6ELi6EEEE5solveERKNS_17SparseBlockMatrixIS3_EEPdS9_[g2o::LinearSolverPCG<Eigen::Matrix<double, 6, 6, 0, 6, 6> >::solve(g2o::SparseBlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6> > const&, double*, double*)]+0xc92): more undefined references to `g2o::globalStats' follow
collect2: ld returned 1 exit status
make[3]: *** [../bin/rgbdslam] Error 1 | {
"domain": "robotics.stackexchange",
"id": 12123,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam, navigation, ros-electric, ros-fuerte, rosmake",
"url": null
} |
beginner, c, unit-conversion
float F_to_C(float input_temp)
{
return (5.0 / 9.0) * (input_temp - 32);
}
float C_to_F(float input_temp)
{
return (9.0 / 5.0) * (input_temp)+32;
} Firstly, I don't quite understand why are you declaring so much functions that consist of a single line dedicated to printing a string. They are only used once and in one file, so there's no need to use a function or constant. I suggest you to get rid of them and replace calls to these functions with their bodies. Also, put break; inside default case (Here you can learn more about the reason why you should do this):
switch (option) {
case F_TO_C:
printf("Celsius: %f\n", F_to_C(input_temp));
break;
case C_TO_F:
printf("Fahrenheit: %f\n", C_to_F(input_temp));
break;
case OFF:
printf("OFF\n");
break;
default:
printf("Incorrect input, try again\n");
break;
} | {
"domain": "codereview.stackexchange",
"id": 21703,
"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, c, unit-conversion",
"url": null
} |
# write data file (data.csv)
data = t.T # transpose to column vector
# specify MV / CV
apm_info(s,a,'MV','p')
apm_info(s,a,'CV','v')
# configuration parameters
apm_option(s,a,'nlc.imode',6)
apm_option(s,a,'nlc.nodes',3)
# turn on MV / CV
apm_option(s,a,'v.status',1)
apm_option(s,a,'p.status',1)
# tune controller
apm_option(s,a,'p.lower',0)
apm_option(s,a,'p.upper',100)
apm_option(s,a,'v.tau',5)
apm_option(s,a,'v.sphi',26)
apm_option(s,a,'v.splo',24)
# solve and retrieve results
output = apm(s,a,'solve')
print(output)
# open web-viewer
apm_web(s,a) | {
"domain": "apmonitor.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9773707979895381,
"lm_q1q2_score": 0.8123349500606454,
"lm_q2_score": 0.8311430541321951,
"openwebmath_perplexity": 1917.5450721011614,
"openwebmath_score": 0.3040389120578766,
"tags": null,
"url": "http://apmonitor.com/pdc/index.php/Main/ModelPredictiveControl"
} |
quantum-field-theory, general-relativity, quantum-gravity, dimensional-analysis, wavelength
Title: Why do quantum effects of gravity become important at the Planck scale? The standard heuristic argument for why quantum effects of gravity become important at the Planck scale is to consider the length scales at which both quantum field theory (QFT) and general relativity (GR) become crucial in order to explain physical phenomena.
For QFT this is when the length scale is of order the Compton wavelength of a particle, $$l_{c}=\frac{h}{mc},$$ since if one attempts to confine a particle within this length then it is possible for pair creation to occur and so the concept of a particle breaks down and QFT is required.
For GR, this is when the length scale is of order the Schwarzschild radius of a particle, $$l_{s}=\frac{2Gm}{c^{2}},$$ since compressing the mass of a particle to within this radius results in the formation of a black hole which requires GR to understand its behaviour. | {
"domain": "physics.stackexchange",
"id": 44296,
"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, general-relativity, quantum-gravity, dimensional-analysis, wavelength",
"url": null
} |
$$V(w, \pi) = \max \left\{ \frac{w}{1 - \beta}, \, c + \beta \int V(w', \pi') \, h_{\pi}(w') \, dw' \right\} \quad \text{where} \quad \pi' = q(w', \pi) \tag{3}$$
Notice that the current guess $\pi$ is a state variable, since it affects the worker’s perception of probabilities for future rewards.
### Parameterization¶
Following section 6.6 of [LS18], our baseline parameterization will be
• $f$ is $\operatorname{Beta}(1, 1)$ scaled (i.e., draws are multiplied by) some factor $w_m$
• $g$ is $\operatorname{Beta}(3, 1.2)$ scaled (i.e., draws are multiplied by) the same factor $w_m$
• $\beta = 0.95$ and $c = 0.6$
With $w_m = 2$, the densities $f$ and $g$ have the following shape
In [2]:
using LinearAlgebra, Statistics
using Distributions, Plots, QuantEcon, Interpolations, Parameters
gr(fmt=:png);
w_max = 2
x = range(0, w_max, length = 200)
G = Beta(3, 1.6)
F = Beta(1, 1)
plot(x, pdf.(G, x/w_max)/w_max, label="g")
plot!(x, pdf.(F, x/w_max)/w_max, label="f")
Out[2]: | {
"domain": "quantecon.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.983342958526322,
"lm_q1q2_score": 0.823667684892912,
"lm_q2_score": 0.8376199552262967,
"openwebmath_perplexity": 5116.472105525923,
"openwebmath_score": 0.614210307598114,
"tags": null,
"url": "https://julia.quantecon.org/dynamic_programming/odu.html"
} |
performance, sql, mysql
SELECT
c.ID_COURIER,
c.NAME,
c.NICKNAME,
c.AREA_CODE,
c.PHONE_NUMBER,
-- This will return NULL if ID_GEOLOCATION is NULL
(SELECT MAX(ID_GEOLOCATION) FROM GEOLOCATIONS) AS 'ID_GEOLOCATION',
d.DESCRIPTION,
-- This will return NULL if START_DATE is NULL
(SELECT MAX(START_DATE) FROM ORDERS) AS 'START_DATE',
d.END_DATE,
d.CANCELED,
r.LAT,
r.LNG,
-- Subquery JOIN moved to FROM and WHERE statements
COUNT(ID_ORDER) AS 'REMAINING ORDERS'
FROM COURIER AS c
LEFT JOIN DELIVERY AS d ON c.ID_DELIVERY = d.ID_DELIVERY
LEFT JOIN GEOLOCATIONS AS r ON r.ID_DELIVERY = d.ID_DELIVERY
LEFT JOIN ORDERS AS o ON d.ID_DELIVERY = o.ID_DELIVERY
WHERE c.DISABLED = false
AND o.DELIVERY_DATE IS NULL AND o.CANCELED = false
GROUP BY c.ID_COURIER
ORDER BY d.START_DATE DESC; | {
"domain": "codereview.stackexchange",
"id": 7643,
"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, sql, mysql",
"url": null
} |
So what is the "right" way to do this, i.e., what method inserts an element into an ordered list without wasting resources?
• Do a binary search. – ciao Jun 18 at 23:00
• "but this is inefficient" - true, perhaps, but sorting algorithms are very optimized and typically very fast. Have you verified that this is really a problem in your application with some timings? – MarcoB Jun 18 at 23:01
• maybe Nearest + ReplacePart/MapAt/...? – kglr Jun 18 at 23:01
• Are you on v12.1? You could use a priority queue which stays sorted. You can make one with ds=CreateDataStructure["PriorityQueue"]; You then push all your elements in (see docs) and then when you're done, get them in list form like this: lst = {}; While[! ds["EmptyQ"], AppendTo[lst, ds["Pop"]]]; – flinty Jun 18 at 23:20
If you have v12.1, there's no need to ever call Sort if you can incrementally add your values to a "PriorityQueue" data structure. It always stays sorted as you add/remove elements. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9449947055100817,
"lm_q1q2_score": 0.8354124349387352,
"lm_q2_score": 0.8840392756357327,
"openwebmath_perplexity": 1817.5296656725438,
"openwebmath_score": 0.22831417620182037,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/224249/best-way-to-insert-element-into-an-ordered-list-at-the-correct-position/224251"
} |
circuits, digital-circuits
An arbitrary n-variable function $f(x_1,x_2,...,x_n)$ can be represented using the positive polarity Reed-Muller form (PPRM)
$f(x_1,x_2,...,x_n) = a_0\oplus a_1x_1\oplus a_2x_2\oplus\ldots\oplus a_{12}x_1x_2\oplus a_{13}x_1x_3\oplus\ldots\oplus a_{n-1,n}x_{n-1}x_n\oplus\ldots\oplus a_{12\ldots n}x_1x_2\ldots x_n$.
For each function $f$, the coefficients $a_i$ are determined uniquely, so PPRM is a canonical form. If we used either only the positive literal ($x_i$) or only the negative literal ($\overline{x_i}$) for each variable in Eq. (4)1, we get the FPRM. There are $2^n$ possible combinations of polarities and as many FPRMs for any given logical function. | {
"domain": "cs.stackexchange",
"id": 6394,
"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": "circuits, digital-circuits",
"url": null
} |
homework-and-exercises, quantum-field-theory, angular-momentum, quantum-spin
How to go from this to show that this integral is in fact a surface term and therefore it vanishes?. Do we have to use here some sort of the Stokes' theorem?.
It is probably a very simple question, but I am stuck at this point. I just do not see it. Hope somebody can help me. The fact that your integral is a surface term is indeed due to Stokes theorem:
$$
\int d^3x\ (x^1\partial^2 -x^2\partial^1)(\overline\Psi(x) \gamma^0\ e^{ipx^3})\\
=\int d^3x\ \partial^2\left(x^1 \overline\Psi(x) \gamma^0\ e^{ipx^3}\right)-(1\leftrightarrow 2)\\
=\int dx_1 dx_3 \left(\int dx_2 \partial^2\left(x^1 \overline\Psi(x) \gamma^0\ e^{ipx^3}\right)\right)-(1\leftrightarrow 2)\\
=\int dx_1 dx_3 \left(\left.x^1 \overline\Psi(x) \gamma^0\ e^{ipx^3}\right|_{x_2=-\infty}^{x_2=\infty}\right)-(1\leftrightarrow 2)
$$ | {
"domain": "physics.stackexchange",
"id": 19322,
"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, quantum-field-theory, angular-momentum, quantum-spin",
"url": null
} |
Inverse Trig Functions Intro to Limits Overview Definition One-sided Limits When limits don't exist Infinite Limits Summary Limit Laws and Computations Limit Laws Intuitive idea of why these laws work Two limit theorems How to algebraically manipulate a 0/0? Indeterminate forms involving fractions Limits with Absolute Values Limits involving. There are many types of limits. Find limits of trigonometric functions by rewriting them using trigonometric identities. Patricia Edmonds: Math 1. More important identities Less important identities Truly obscure identities About the Java applet. Printable in convenient PDF format. | bartleby. One-Sided Limits – A brief introduction to one-sided limits. Sines and cosines are two trig functions that factor heavily into any study of trigonometry; they have their own. Some important formulas of limit and continuity are as follows:-1. The most basic fact about a plane triangle is that the sum of its angles is a straight angle, or 180°. more trig gifs. | {
"domain": "oeey.pw",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9888419700672151,
"lm_q1q2_score": 0.8344789015634632,
"lm_q2_score": 0.8438951084436077,
"openwebmath_perplexity": 749.2805916628034,
"openwebmath_score": 0.8569939732551575,
"tags": null,
"url": "http://tlpd.oeey.pw/fundamental-trigonometric-limit.html"
} |
ros, rviz, moveit, youbot
Title: Show Manipulation Trajectory in Rviz
Hello!
I use MoveIt! to control a Kuka Youbot arm in Rviz. Apparently i used the computecartesianpath() to move the arm from point A to B. Afterwards i wanted to display the trajetory from A -> B and tried to use the Trajectory Addon in Rviz but it did not work. Do u have any ideas how i can, at least, prove that the youbot operates in a straight line?
At least i know, that the computed cartesian path has 144 points and my terminal shows any jointangle for each point when i display the trajectory. | {
"domain": "robotics.stackexchange",
"id": 26268,
"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, rviz, moveit, youbot",
"url": null
} |
python, datetime
Title: Python date formatter I'd like to find the best way to format date to YYYY, YYYYMM or YYYYMMDD.
Here is what I've got so far:
# gets the position of a character in the format
def get_pos(format, letter, number):
it_number = 0
it_pos = 0
for char in format:
if char == letter:
it_number += 1
if it_number == number:
return(it_pos)
it_pos += 1
return(-1)
# loops through all the characters forming a number
def format_loop(string, old_format, letter):
new = ''
pos = -2
it = 1
while(pos != -1):
pos = get_pos(old_format, letter, it)
if(pos >= 0):
new += string[pos]
it += 1
return(new) | {
"domain": "codereview.stackexchange",
"id": 32706,
"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, datetime",
"url": null
} |
python, python-3.x, sorting, reinventing-the-wheel
When you search for an element using a for loop and break when you find the element of interest, if you don't find the element, the for loop will execute an optional else: clause, so you don't need to preset the insertion_index:
for index, elem_sorted in sorted_array:
if elem_sorted > elem:
insertion_index = index
break
else:
insertion_index = len(sorted_array)
Biggest inefficiency
sorted_array is in sorted order. You could use a binary search to find the insertion location, \$O(\log N)\$, instead of a linear search \$O(N)\$. | {
"domain": "codereview.stackexchange",
"id": 38070,
"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, sorting, reinventing-the-wheel",
"url": null
} |
c#, .net, socket, async-await, tcp
Event Notification
In the spirit of asynchronicity, I would rather expose some events which would notify interested parties that something has been sent/received than making them wait on ManualResetEvents. Later I noticed that you also use events. In this case, why did you use the ManualResetEvent? As for the delegate type of the events, using EventHandler<> specializations makes the code more idiomatic.
Single Responsibility Principle
A short look upon StreamSecurityClient and one immediately notices that this class is doing a lot. For example, the client shouldn't be concerned in how a command is handled. | {
"domain": "codereview.stackexchange",
"id": 21398,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, .net, socket, async-await, tcp",
"url": null
} |
ros, network, topic, bandwidth, topics
Title: Bandwith use of ros topic
Hi,
I'm going to run my ros system on multiple computers, connected only by a wifi link of (possibly) bad quality. However I want to use data from multiple usb web cams.
I'm wondering how ros distributes the various message on the network and if it makes a difference where roscore is located.
Example Scenario:
Machine 1:
Node 1:
outgoing topics:
camera1/image_raw
camera1/image_compressed
Machine 2:
Node 2:
outgoing topics:
camera2/image_raw
camera2/image_compressed
Machine 3:
Node 3.1:
incoming topics:
camera1/image_raw
camera2/image_raw
outgoing topics:
control/steering
control/debug
Node 3.1:
incoming topics:
camera1/image_raw
control/steering
Which messages are actually send?
Do the camera*/image_compressed topics take up bandwith, even though they are never subscribed to?
is camera1/image_raw send twice over the network? | {
"domain": "robotics.stackexchange",
"id": 8757,
"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, network, topic, bandwidth, topics",
"url": null
} |
as $P(\text{lives >2 miles from work} | \text{drives to work})$ ???
Why shouldnt it be (0.9 x 0.75 ) = 0.675 ??
7. ## Re: probability
Originally Posted by xl5899
Why do you inteperet Find the probability of that an employee who travels to work by car more than 2 miles from work
as $P(\text{lives >2 miles from work} | \text{drives to work})$ ???
Why shouldnt it be (0.9 x 0.75 ) = 0.675 ??
Because an employee "who travels to work by car" has a 100% chance of travelling to work by car, not a 90% chance as you used in your calculation. So, I thought, what is the problem asking? It is asking, among employees who drive to work by car, what is the probability that they live more than 2 miles from work?
8. ## Re: probability | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429634078179,
"lm_q1q2_score": 0.8471875307071224,
"lm_q2_score": 0.8615382040983515,
"openwebmath_perplexity": 771.0324243939665,
"openwebmath_score": 0.6243986487388611,
"tags": null,
"url": "http://mathhelpforum.com/statistics/277210-probability.html"
} |
video-compression, quantization
How to generate a universal codebook for a large number of images.
How to scale the codebook for various rate-distortion requirements.
How much storage space is reasonable for storing the codebook in memory.
All this practical constraints make it difficult for VQ to force through standardization process. | {
"domain": "dsp.stackexchange",
"id": 3425,
"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": "video-compression, quantization",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.