text stringlengths 1 1.11k | source dict |
|---|---|
ros, publish
Title: Empty connection header topic
I am trying to use a driver that reads the name of the incoming topic from the connection header. When I publish data from a C++ node, it is always empty but when I use rostopic pub it works just fine. Is there a way to ensure the connection header is populated?
Thanks,
-Tony
Edit for additional information
OS: Ubuntu 14.04
ROS:indigo 1.11.9
roscpp: 1.11.9-0trusty-20141029-0127-+0000
roscpp_core: 0.5.4-0trusty-20140724-0053-+0000
The subscriber is in C++ and is here
Works with python. Here is the C++ node
Originally posted by tonybaltovski on ROS Answers with karma: 2549 on 2014-12-29
Post score: 1
Was recently fixed in this commit.
Originally posted by tonybaltovski with karma: 2549 on 2015-06-04
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 20448,
"lm_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, publish",
"url": null
} |
and profilers may become distracted from the usual crime scene investigative methods because they ignore or are unaware of the base rate. For example: The base rate of office buildings in New York City with at least 27 floors is 1 in 20 (5%). Base rate fallacy definition: the tendency , when making judgments of the probability with which an event will occur ,... | Meaning, pronunciation, translations and examples … 4. Behavioral finance is a relatively new field that seeks to combine behavioral and cognitive psychological theory with conventional economics and finance to provide explanations for why people make irrational financial decisions. A population of 2,000 people are tested, in which 30% have the virus. It is simply the number of people who actually have colon cancer (500) divided by the number that the test would identify as having colon cancer. Base Rate Fallacy Defined Over half of car accidents occur within five miles of home, according to a report by Progressive Insurance | {
"domain": "senacmoda.info",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9780517430863701,
"lm_q1q2_score": 0.8313157973590329,
"lm_q2_score": 0.8499711832583696,
"openwebmath_perplexity": 1437.6115724276058,
"openwebmath_score": 0.6456455588340759,
"tags": null,
"url": "http://www.senacmoda.info/xrkzhche/archive.php?page=bcaafe-base-rate-fallacy-example"
} |
arduino
Title: RpLidar A1 arduino
Hi guys, I'm trying to connect RpLidar into Arduino Portenta H7 Lite and get the data into Robot Operating System. I trying to use to rplidar_arduino package to read data from lidar and next I'm using rosserial to pass data into ROS, but unfortunately I don't know how to pass it. Have anyone tried to do it?
Originally posted by Heqas on ROS Answers with karma: 13 on 2022-08-21
Post score: 1
I tried at first with Arduino, but found it easier to connect it via USB directly to a Raspberry Pi or the PC your ROS is running, and using http://wiki.ros.org/rplidar
Originally posted by Edyger with karma: 36 on 2022-08-26
This answer was ACCEPTED on the original site
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 37929,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "arduino",
"url": null
} |
spacetime, quantum-gravity, non-commutative-theory
Can anyone explain why a phase shift of the light pulse implies a non-commutative space structure?
It doesn't. It provides an experimental test that can reveal configurations which are incompatible with standard quantum mechanics and which could be explained with a specific modification thereof. (Assuming, of course, that experiments were indeed to coincide with the authors' predictions and fall outside the range explainable with standard QM, which is not the case yet.)
Such an experiment would be the first piece of evidence towards establishing the theoretical framework used by the authors, but it would require a mountain of additional evidence to "imply" a non-commutative space structure. | {
"domain": "physics.stackexchange",
"id": 70406,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "spacetime, quantum-gravity, non-commutative-theory",
"url": null
} |
filters, discrete-signals, finite-impulse-response, z-transform, transfer-function
$$H(e^{j\omega})=A(\omega)e^{j\phi(\omega)}\tag{1}$$
where $A(\omega)$ is a real-valued (or purely imaginary) function that can become positive and negative such that the phase $\phi(\omega)$ is a linear function without jumps. This is the case for the first frequency response in your question. Note that the term $\sin(5\omega /2)\,/\sin(\omega/2)$ takes both signs.
Another way to write the frequency response is
$$H(e^{j\omega})=\big|H(e^{j\omega})\big|e^{j\varphi(\omega)}\tag{2}$$
Now the phase $\varphi(\omega)$ jumps by $\pi$ at all frequencies where the corresponding amplitude function $A(\omega)$ changes sign. Since $|H(e^{j\omega})|$ can't change sign, the phase has to compensate for that and you get a piecewise linear phase with jumps at the zeros (of odd multiplicity) of $H(e^{j\omega})$. | {
"domain": "dsp.stackexchange",
"id": 10852,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filters, discrete-signals, finite-impulse-response, z-transform, transfer-function",
"url": null
} |
javascript, array, sorting, heap, heap-sort
Title: Heap selection sort in Javascript I have (designed and) implemented this fancy sorting algorithm that combines natural runs in the input array with a heap data structure:
function ArrayRangeException(message) {
this.message = message;
this.getMessage = function() { return this.message; }
}
function RangeCheck(arrayLength, fromIndex, toIndex) {
if (fromIndex < 0) {
throw new ArrayRangeException("'fromIndex' is negative: " + fromIndex);
}
if (toIndex > arrayLength) {
throw new ArrayRangeException(
"'toIndex' is too large: " + toIndex + ", array length: " +
arrayLength);
}
if (fromIndex > toIndex) {
throw new ArrayRangeException(
"fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
}
} | {
"domain": "codereview.stackexchange",
"id": 37847,
"lm_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, array, sorting, heap, heap-sort",
"url": null
} |
electromagnetism
The only context where I am familiar with this kind of structure being used is in studies of relativistic quantum fields theories with the possibility of very weakly broken $SO(3,1)$ Lorentz symmetry. The formalism is outlined in V. A. Kostelecký and Matthew Mewes, "Signals for Lorentz violation in electrodynamics," Physical Review D 66, 056005 (2002) (arXiv version). In conventional relativistic electrodynamics, the Lagrangian density is
$$\mathcal{L}_{0}=-\frac{1}{4}F^{\mu\nu}F_{\mu\nu}-j^{\mu}A_{\mu}
=\frac{1}{2}\left(\vec{E}^{2}-\vec{B}^{2}\right)-\rho\Phi+\vec{\jmath}\cdot\vec{A}.$$
To this may be added a term representing a material medium or other source of Lorentz noninvariance,
$$\mathcal{L}=\mathcal{L}_{0}-\frac{1}{4}k_{F}^{\mu\nu\rho\sigma}F_{\mu\nu}F_{\rho\sigma}.$$ | {
"domain": "physics.stackexchange",
"id": 96736,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism",
"url": null
} |
python, gui, tkinter, framework, tk
I know this can probably be fixed by changing the output from a dictionary to a list, so I'll do that soon.
Either way, let me know what you think, or how I can improve this. I wanted to make this as a way of speeding up the rudimentary GUI creation process, and hopefully it can be used to get the ugly stuff out of the way faster.
Thanks in advance! Welcome to CodeReview! Good first post.
Comments
Having comments is great. Your convention is a little odd - there's no need for triple hashes. A single hash at the beginning is more common.
File handling
Your intention was good, but the execution could be improved. Firstly, at this level, don't except Exception. It's too broad. Let exceptions be exceptional. You'll want to instead catch something more specific, in this case FileNotFoundError. | {
"domain": "codereview.stackexchange",
"id": 35653,
"lm_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, gui, tkinter, framework, tk",
"url": null
} |
(2C1)(2C2)(2C0)(2C0)=2
(2C0)(2C2)(2C1)(2C0)=2
(2C0)(2C2)(2C0)(2C1)=2
3) The paired team on the committie is the third team
(2C1)(2C2)(2C0)(2C0)=2
(2C0)(2C2)(2C1)(2C0)=2
(2C0)(2C2)(2C0)(2C1)=2
4) The paired team on the committie is the fourth team
(2C1)(2C0)(2C0)(2C2)=2
(2C0)(2C1)(2C0)(2C2)=2
(2C0)(2C0)(2C1)(2C2)=2
All those two add up to 24. 56-24=32.
Here is my question, please help me answer below
TWO APPROACHES
COMBINATION==========================
Now if I wanted to do find the number of combinations of pair of the same team on the committee using combination.
(4C1)=# of ways to pick one team where we will grab two people from
(1C1)= # of ways to pick the two people from the same two people on the team
(3C1)= # of ways to pick the last person from the other three teams
(2C1)=# of ways to pick the person from the other group
Hence (4C1)(1C1)(3C1)(2C1)=24 . 56-24=32. Is my thinking correct here?
PERMUTATIONS================================ | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes.\n2. Yes.\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9553191220947677,
"lm_q1q2_score": 0.8176109646083459,
"lm_q2_score": 0.8558511451289037,
"openwebmath_perplexity": 1687.7050989561171,
"openwebmath_score": 0.7540875673294067,
"tags": null,
"url": "http://gmatclub.com/forum/a-committee-of-three-people-is-to-be-chosen-from-four-teams-130617.html"
} |
optics, waves, terminology, interferometry
Title: What does quadrature mean in the context of sine waves and resonance? I heard a professor talk about quadrature in a sine wave representing resonance in time. What is the quadrature of the wave, and what does it mean for a quadrature to shift?
To be more specific, a quadrature shift in the wave generated by testing resonance with an interferometer. I have no idea what the quadrature is and why it would shift. Consider a signal $s(t)$ which oscillates at a frequency $f$. In general, such a signal will look like a sine wave offset by an arbitrary phase $\phi$
\begin{equation}
s(t) = A \sin(2\pi f t + \phi)
\end{equation}
You can think of the phase of this signal as a vector in a two dimensional plane, with $\phi$ being the angle between the $x$ axis and the phase vector (phasor), and $A$ being the amplitude.
Using some trig identities, we can decompose the signal into cosine and sine quadratures (sometimes also called in phase and quadrature components), as follows | {
"domain": "physics.stackexchange",
"id": 88489,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, waves, terminology, interferometry",
"url": null
} |
electrochemistry, analytical-chemistry
Now, for your questions:
how would you know that this sensor is working - meaning that only
dissolved oxygen triggers the electrical change in the sensor, and not
other atoms?
This one is a bit tricky. You're right that oxygen isn't the only thing that could produce a signal—amperometry isn't a very selective technique on its own. You can control the redox reactions that occur at the working electrode, to a limited degree, by changing the potential you apply, i.e. different substances require different potentials to be reduced and won't be reduced if an insufficient potential is applied. In the case of this specific type of electrode, selectivity comes mainly from the PTFE membrane. Since it limits diffusion to only a few very small molecules, that greatly increases the selectivity of the electrode, though depending on the solution you're trying to measure, there still may be interferences. | {
"domain": "chemistry.stackexchange",
"id": 2031,
"lm_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, analytical-chemistry",
"url": null
} |
*_*_*_*_*_* MERRY CHRISTMAS*_*_*_*_*_*
If you let $\displaystyle y' = u$, the ODE separates giving
$\displaystyle \frac{-u'}{u^2} = x$.
Integrating, applying the IC and integrating again with the second IC gives the solution
$\displaystyle y = tan^{-1} x$.
6. Originally Posted by danny arrigo
If you let $\displaystyle y' = u$, the ODE separates giving
$\displaystyle \frac{-u'}{u^2} = x$.
Integrating, applying the IC and integrating again with the second IC gives the solution
$\displaystyle y = tan^{-1} x$.
I presume that IC = Initial Condition ?
Also whats the general solution? - is it \frac{u'}{u^2} = x , if not, how do find the general solution ?
Thanks Danny,
tsal15
7. Originally Posted by tsal15
I presume that IC = Initial Condition ?
Also whats the general solution? - is it \frac{u'}{u^2} = x , if not, how do find the general solution ?
Thanks Danny,
tsal15
Yes, IC is the initial condition. Let me provide some more details | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109543125689,
"lm_q1q2_score": 0.8185187781316061,
"lm_q2_score": 0.8311430478583168,
"openwebmath_perplexity": 809.6134669502513,
"openwebmath_score": 0.9623286724090576,
"tags": null,
"url": "http://mathhelpforum.com/differential-equations/65709-2nd-o-d-e.html"
} |
javascript, object-oriented
I don't see that any of that serves any purpose over the much simpler
version here:
var ObjectExt = {inherit: function (Parent, Child) {
// content here
};
Can you give any reason for the existence of this constructor
function, the IIFE, the prototype, etc? It seems to be plain
overhead, and serves only to obfuscate your code.
One other minor point is that you probably should declare your key
variable once in the top of the inherit function.
But the main issue is that you add properties to the parent.prototype object. In this code:
if(Child.uber === undefined) {
Child.uber = Parent.prototype; // (1)
} else {
for(var key in Parent.prototype) {
Child.uber[key] = Parent.prototype[key]; // (2)
}
} | {
"domain": "codereview.stackexchange",
"id": 2015,
"lm_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, object-oriented",
"url": null
} |
programming, qiskit, simulation, qaoa
Title: Statevector Simulation of QAOA always finds exact solution My question is simple: does applying QAOA with a statevector simulation always result in a perfect solution?
I'm trying to calculate the best $\gamma$ & $\beta$ that solve certain problems but my statevector simulation of problem always finds the exact solution with a single stage ($p=1$) of QAOA.
I know that in a in a real quantum device, the entire statevector isn't calculated (the whole point of quantum computing!) but rather multiple 'shots' are processed to build up a statistical picture. | {
"domain": "quantumcomputing.stackexchange",
"id": 2585,
"lm_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, qiskit, simulation, qaoa",
"url": null
} |
thermodynamics, energy, heat-engine
If m represents the amount of mass on the (massless) piston at any stage of the process, then the pressure is related to m by: $$P=\frac{mg}{A}$$where A is the area of the piston. Similarly, if h represents the elevation of the piston at any start of the process, then the volume of gas is related to h by:
$$V=Ah$$. So the mass on the piston is directly related to the pressure, and the elevation of the piston is directly related to the gas volume.
Next, we're going to focus on the changes in potential energy of the surroundings as we add and remove mass from the piston. The change in potential energy of the surroundings when the amount of mass on the piston decreases by a differential amount dm is just $$d(PE)=-ghdm$$But, from the previous equations, this is equal to $$d(PE)=-g\left(\frac{V}{A}\right)\left(\frac{A}{g}dP\right)=-VdP$$ | {
"domain": "physics.stackexchange",
"id": 53445,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, energy, heat-engine",
"url": null
} |
reinforcement-learning, alphazero
The maximum number of moves (512 for chess and 722 for GO) you mention are used when creating training games to train the neural network. The current network is playing against itself and the goal is to create many useful training samples so the games are cut off if they take too long (lots of repetition in chess for example). Note that for chess the actual number of maximum moves is 5899 or an infinite number if draw is not mandatory.
Maybe you will find these illustrations regarding AlphaZero's MCTS search useful:
http://tim.hibal.org/blog/alpha-zero-how-and-why-it-works/ | {
"domain": "ai.stackexchange",
"id": 1244,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reinforcement-learning, alphazero",
"url": null
} |
java, game, swing, snake-game
// Generate our first 'food'
food.createFood();
// set the timer to record our game's speed / make the game move
timer = new Timer(speed, this);
timer.start();
}
// if our snake is in the close proximity of the food..
void checkFoodCollisions() {
if ((proximity(snake.getSnakeX(0), food.getFoodX(), 20))
&& (proximity(snake.getSnakeY(0), food.getFoodY(), 20))) {
System.out.println("intersection");
// Add a 'joint' to our snake
snake.setJoints(snake.getJoints() + 1);
// Create new food
food.createFood();
}
}
// Used to check collisions with snake's self and board edges
void checkCollisions() {
// If the snake hits its' own joints..
for (int i = snake.getJoints(); i > 0; i--) { | {
"domain": "codereview.stackexchange",
"id": 20221,
"lm_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, game, swing, snake-game",
"url": null
} |
astronomy, orbital-motion, history, parallax
This is not surprising, because the epicycle radius is giving you the parallax from the point of view of the Earth's orbit of the different planets. Once you know the absolute size of Earth's orbit, you know the distance to everything else, which is why the Earth's orbit is called the "Astronomical Unit".
This means that just Brahe's observations are sufficient to fix the entire solar system size except for the absolute scale of the Astronomical unit. The location of all the planets in 3 dimensions is completely determined from the assumption that the Earth's orbit is shared between all of them. The fact that the epicycles all are given by a one-year orbital period for the Earth is Baysian-wise extremely compelling evidence for heliocentrism without anything further to say. | {
"domain": "physics.stackexchange",
"id": 4541,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astronomy, orbital-motion, history, parallax",
"url": null
} |
venus, magnetic-field, mercury, core, ions
Mars
Mars used to have a magnetic field. In fact, some analyzations of the crustal fields recently made by robots sent to Mars have shown that Mars may have even had a stronger magnetic field than Earth. Sadly, about 4 bya[according to Wikipedia], either repeated bombardment from large celestrial objects that disrupted the interior, or the solidification of its outer core have caused the degration of such. Consequently, Mars' atmosphere is being constantly stripped away by the Solar Wind, and its atmosphere is drastically thinner that what is started with.
These are obviously some pretty straightforward examples that fit very well with the first statement.
Then, there are two rather contradictory planets.
Venus | {
"domain": "astronomy.stackexchange",
"id": 3508,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "venus, magnetic-field, mercury, core, ions",
"url": null
} |
earth, impact, theia
Through this period the Earth’s rotation would have gradually slowed, until the stalemate was broken and the moon proceeded to travel out towards the sun. This would have caused a righting of the Earth’s axis, and the moon would have oscillated back and forth across the Earth’s ecliptic plane, with these oscillations growing smaller over time as the moon moves further from Earth and energy is dissipated through tides. The moon’s current five-degree tilt of the ecliptic plane is an expression of that continued oscillation. | {
"domain": "astronomy.stackexchange",
"id": 5785,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "earth, impact, theia",
"url": null
} |
#### apple2357
##### New member
So did you prove this result in base 5? in base n?
Not yet! Still thinking about how to put it together!
#### apple2357
##### New member
Not yet! Still thinking about how to put it together!
Is it as simple as replacing 10[SUP]n[/SUP] with 5[SUP]n[/SUP] and breaking up 5[SUP]n[/SUP]with 4 and the extra one? in the way you have with 9 above?
In which this will always work?
#### HallsofIvy
##### New member
Let b be a positive integer. A number written in "base b" is of the form $$\displaystyle a_nb^n+ a_{n-1}b^{n-1}+ \cdot\cdot\cdot+ a_2b^2+ a_1b^1+ a_0b ^0$$. Repeat what Jomo did,
Consider the integer $$\displaystyle x = a_n10^n + a_{n-1}10^{n-1} + ... + a_110^1 + a_010^0$$. Now we can write $$\displaystyle a_k10^k$$ as $$\displaystyle a_k*999...9 + a_k$$. Clearly 9 goes evenly into $$\displaystyle a_k*999...9$$ for each k. So 9 goes evenly into x precisely when 9 goes in $$\displaystyle a_n+a_{n-1}+...a_0$$
using b- 1 instead of 9. | {
"domain": "freemathhelp.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9715639669551474,
"lm_q1q2_score": 0.835218328932713,
"lm_q2_score": 0.8596637559030338,
"openwebmath_perplexity": 761.8883332595514,
"openwebmath_score": 0.7209230661392212,
"tags": null,
"url": "https://www.freemathhelp.com/forum/threads/working-in-other-bases.114430/"
} |
quantum-field-theory, special-relativity, hilbert-space, momentum, normalization
Once we have the little group matrices, we're all set, since we can find how our general states transform!
\begin{align}
U(\Lambda) \Psi_{p,\sigma} &= N(p) U(\Lambda) U(L(k,p)) \Psi_{k,\sigma}\\
&=N(p) U(L(k,\Lambda p)) U(L^{-1}(k,\Lambda p)\Lambda L(k,p)) \Psi_{k,\sigma}\\
&=N(p) U(L(k,\Lambda p)) U(W(\Lambda,p)) \Psi_{k,\sigma} \\
&=N(p) \sum_{\sigma'} D_{\sigma'\sigma}(W(\Lambda,p)) U(L(k,\Lambda p)) \Psi_{k,\sigma'}\\
&= \frac{N(p)}{N(\Lambda p)} \sum_{\sigma'} D_{\sigma'\sigma}(W(\Lambda,p)) \Psi_{\Lambda p, \sigma'},
\end{align}
where we identified the little group element $W(\Lambda,p)=L^{-1}(k,\Lambda p) \Lambda L(k,p)$.
Normalizing standard momentum states
I leave it to you to show the following: if we want the $D$ matrices to furnish a unitary representation of the little group, we require the states to be normalized as
$$
(\Psi_{k,\sigma},\Psi_{p,\sigma'}) = \delta^3(\vec{p}-\vec{k}) \delta_{\sigma\sigma'}.
$$ | {
"domain": "physics.stackexchange",
"id": 68615,
"lm_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, special-relativity, hilbert-space, momentum, normalization",
"url": null
} |
3. ganeshie8
|dw:1439124864364:dw|
4. ganeshie8
we represent common region using "$$\cap$$" and read it out as "$$\text{and}$$"
5. mathmath333
ok
6. ganeshie8
In above venn diagram, we have $P \text{ and } K = R$
7. ganeshie8
therefore a $$R$$hombus is both a $$P$$arallelogram and a $$K$$ite
8. ganeshie8
Rhombus belongs to both the families of Parallelogram and Kite
9. mathmath333
1st option is correct ?
10. mathmath333
???
11. ganeshie8
Yep!
12. mathmath333
great!
13. mathstudent55
Given the Venn diagram in the question, I agree with @ganeshie8, but are we allowed to suspend the correct definitions of the terms used, so the problem works? A kite can never be a rhombus or a parallelogram, and a rhombus can never be a kite using the normal definitions of those quadrilaterals.
14. ganeshie8 | {
"domain": "openstudy.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9609517095103498,
"lm_q1q2_score": 0.836601923692984,
"lm_q2_score": 0.8705972583359805,
"openwebmath_perplexity": 2483.241138523911,
"openwebmath_score": 0.6739774942398071,
"tags": null,
"url": "http://openstudy.com/updates/55c74b0fe4b06d80932f23d2"
} |
vba, excel
End Sub
Public Sub MissingDataHeadingsHandler(ByRef arrCurrentArray As Variant, ByVal strHeading As String)
'/======================================================================================================================================================
'/ Author: Zak Armstrong
'/ Email: zak.armstrong@luminwealth.co.uk
'/ Date: 13/August/2015
'/
'/ Description: Handle instances where a column heading can't be found. Reference against sheet-specific lists to see if the column should be there or not.
'/======================================================================================================================================================
Dim bErrorFound As Boolean
Dim colMissingSheetHeadings As Collection '/ For each sheet, contains the headings that shouldn't be there | {
"domain": "codereview.stackexchange",
"id": 15374,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba, excel",
"url": null
} |
complexity-theory, reductions
So, suppose the value of the parameter is $k$ in some instance $x$ with parameter $p_1=k$. Whether or not $f(x)$ can have parameter $p_2=2^k$ depends entirely on what the parameters are and how big $p_1$ can be.
If $p_1$ is a number represented in unary, we have $p_1\leq |x|$; if it's a number represented in binary or some higher base, then $p_1 = O(2^{|x|})$. If $p_1$ is the size of some object described in $x$, then its size will depend on what kind of object it is (e.g., if $p_1$ is the size of some set of a graph's the vertices, $p_1\leq |x|$; if it's the number of pairs of vertices with some property, $p_1\leq |x|^2$, and so on). | {
"domain": "cs.stackexchange",
"id": 8111,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, reductions",
"url": null
} |
bond
"Jack Straw" Grateful Dead
But seriously now, the most important thing in the Princeton.edu article (which explains at the bottom that its content comes from Wikipedia) is
"The distinction from ordinary covalent bonding is artificial"
Does $\ce{H2}$ come from a hydride and a proton or from two hydrogen atoms? The reason a molecule is stable is independent of a particular path by which it is made.
For $\ce{CO}$, it is only in your mind that oxygen brought more wine (electrons) to the party, but what really matters is that there is enough wine (electrons) at the party for everyone to be satisfied.
$\ce{CO}$ is isoelectronic with $\ce{N2}$ and $\ce{CN-}$; the reason for bonding is the same for each. | {
"domain": "chemistry.stackexchange",
"id": 2608,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bond",
"url": null
} |
fl.formal-languages
Title: Natural examples of context-sensitive languages from practice I am looking for natural examples of context-sensitive languages from practice. For example, reasonable answers could include grammar syntax of a programming language, or encoding of certain properties of a program. In particular, please draw analogy from call-string-based context sensitive interprocedural dataflow analysis where the matching parentheses context-free language is used to encode the matching of calls and returns. That is an example where context-free language is useful in practice, or at least to explain a practical problem in a nice little theoretical way. Now, how can a context-sensitive language be useful in a similar context/scenario? That is my question.
Please note that I am not looking for artificial encoding into CSL (made up just to answer this question). There are two ways your question can be interpreted: the complexity | {
"domain": "cstheory.stackexchange",
"id": 2742,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fl.formal-languages",
"url": null
} |
lagrangian-formalism, field-theory, differential-equations, variational-calculus, effective-field-theory
\equiv C \partial'_{\mu} \left\{ \left( \partial'^{\mu} \phi' \right) \left( \partial'_{\mu} \phi' \right)^2 \right\} \\
= C \partial'_{\mu} \left\{ \partial'^{\mu} \left[ \phi' \left( \partial'_{\mu} \phi' \right)^2 \right] - \phi' \partial'^{\mu}\left[ \left( \partial'_{\mu} \phi' \right)^2 \right] \right\} \\
= C \underline{\partial'_{\mu}} \left\{ \partial'^{\mu} \left[ \phi' \left( \partial'_{\mu} \phi' \right)^2 \right] - 2 \phi' \left[ \left( \partial'^{\mu} \phi' \right) \left( \underline{ \partial'^{\mu} \partial'_{\mu}} \phi' \right) \right] \right\}.\tag{5}
$$
It seems I get a third-order differential equation from the underline part of the above equation. Is my reasoning right?
I think I did not impose any quantization in getting the equation of motion (except effective action from path integrals), since I think the view in the physics today essay is not much about quantization. Or I am not even wrong? | {
"domain": "physics.stackexchange",
"id": 84163,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lagrangian-formalism, field-theory, differential-equations, variational-calculus, effective-field-theory",
"url": null
} |
c#, datetime, wpf
With all that, this is what I would end up with:
public string Header
{
get
{
if (_grid == null)
return null;
var firstDate = _grid.First();
var middleDate = _grid[_grid.Length / 2];
var lastDate = _grid.Last();
// If more than 2 months are displayed, focus only on the middle month:
if (middleDate.Month != firstDate.Month && middleDate.Month != lastDate.Month)
return $"{middleDate:MMMM yyyy}";
if (firstDate.Year != lastDate.Year)
return $"{firstDate:MMMM yyyy} - {lastDate:MMMM yyyy}";
return $"{firstDate:MMMM} - {lastDate:MMMM yyyy}";
}
} | {
"domain": "codereview.stackexchange",
"id": 32841,
"lm_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#, datetime, wpf",
"url": null
} |
iGoogle. The calculator on this page shows how the quadratic formula operates, but if you have access to a graphing calculator you should be able to solve quadratic equations, even ones with imaginary solutions.. Quadratic Formula Calculator: This quadratic formula calculator is a tool that helps to solve a quadratic equation by using a quadratic formula or complete the square method. Every step will be explained in detail. PHP classes for working with, and solving, quadratic equations. We can help you solve an equation of the form "ax2 + bx + c = 0" We don't need to factor or use the quadratic formula (discussed later). This means that every quadratic equation can be put in this form. Visit http://MathMeeting.com for Free videos on the quadratic formula and all other topics in algebra. Quadratic equation solver This calculator solves quadratic equations by completing the square or by using quadratic formula. If a is equal to 0 that equation is not valid quadratic equation. In this | {
"domain": "testzonen.se",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363494503271,
"lm_q1q2_score": 0.8001348437653729,
"lm_q2_score": 0.8128673133042217,
"openwebmath_perplexity": 542.961297589405,
"openwebmath_score": 0.637150764465332,
"tags": null,
"url": "http://testzonen.se/farm-yards-wlnuh/quadratic-formula-solver-7b5cee"
} |
x = 2;
findRoot[x^2 == 2, {x, 1.}, 10^-8]
(* {2 -> 1.41421} *)
As @m_goldberg's answer shows, it's good to have one core routine and have all the interfaces call it. Here's another way but putting the core routine in an "internal" function:
ClearAll[findRoot, iFindRoot];
iFindRoot[fun_, dfun_, init_, \[Epsilon]_] := Module[{xi = init},
While[Abs[fun[xi]] > \[Epsilon],
xi = N[xi - fun[xi]/dfun[xi]]];
xi];
findRoot[fun : _Symbol | _Function, {var_,
init_?NumericQ}, \[Epsilon]_] :=
{var ->
iFindRoot[fun, fun', init, \[Epsilon]]};
findRoot[fun : _Symbol | _Function, {init_?
NumericQ}, \[Epsilon]_] :=
{iFindRoot[fun, fun',
init, \[Epsilon]]};
findRoot[expr_ == val_, {var_, init_?NumericQ}, \[Epsilon]_] :=
Module[{fun},
fun = Function[var, Evaluate[expr - val]];
{var -> iFindRoot[fun, fun', init, \[Epsilon]]}]; | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.934395157060208,
"lm_q1q2_score": 0.8032656401373786,
"lm_q2_score": 0.8596637451167995,
"openwebmath_perplexity": 8469.029038409792,
"openwebmath_score": 0.3316030204296112,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/193905/overloading-a-function-to-pass-in-an-expression-rather-that-the-name-of-a-functi"
} |
It is easy to check. Zero is a solution everywhere (in particular, for $x \leq s$); and $(x-s)^3$ is a solution of the Cauchy problem $$\frac{dy}{dx} = 3 y^{2/3} \quad \text{with} \quad y(s) = 0$$ for $x \geq s$.
Now, if we "glue" zero and $(x-s)^3$, then it will be solution of your problem, except, probably, the point $x = s$. However, at $x = s$ the function $y_s(x)$ is continuously differentiable, and hence, $y_s(x)$ is the correct solution of $$\frac{dy}{dx} = 3 y^{2/3} \quad \text{with} \quad y(0) = 0.$$
Thus, there are infinitely many of solutions, since $s \geq 0$ is arbitrary. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9678992960608886,
"lm_q1q2_score": 0.8265015542785562,
"lm_q2_score": 0.8539127548105611,
"openwebmath_perplexity": 205.05097187285284,
"openwebmath_score": 0.9148373603820801,
"tags": null,
"url": "https://math.stackexchange.com/questions/1015610/numer-of-solutions-for-ivp"
} |
python, tic-tac-toe
Which can be continued by using:
Connect3D(_raw_data='X OOX X OXO O O XXOX OO O XO XXO OX XO XXXXOO O X.1').play()
The code is here (change both values at the bottom to false to see the computer players face off):
import itertools
import operator
import random
import time
from collections import defaultdict
class Connect3DError(Exception):
pass
class Connect3D(object):
"""Class to store the Connect3D game data.
The data is stored in a 1D list, but is converted to a 3D representation for the user.
"""
player_symbols = 'XO'
grid_size_recommended = 4
def __init__(self, grid_size=grid_size_recommended):
"""Set up the grid and which player goes first.
Parameters:
grid_size (int): How long each side of the grid should be.
The game works best with even numbers, 4 is recommended.
""" | {
"domain": "codereview.stackexchange",
"id": 15510,
"lm_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, tic-tac-toe",
"url": null
} |
quantum-mechanics, quantum-information, quantum-entanglement
Title: How are two-qubit states experimentally projected into the Bell basis? To perform Quantum Teleportation, we need state of two entangle qubits in the Bell basis
$$\left(\frac{|00\rangle + \rangle11\rangle}{\sqrt{2}}, \frac{|00\rangle - |11\rangle}{\sqrt{2}}, \frac{|01\rangle + |10\rangle}{\sqrt{2}},\frac{|01\rangle - |10\rangle}{\sqrt{2}} \right).$$
To project in the product basis ($|00\rangle,|10\rangle,|01\rangle,|11\rangle$, or in the product basis along x or y axis (or any other axis)) we can check whether the individual spins are pointing up or down, but I don't know how the state is experimentally projected over a basis of entangled states like the Bell basis. Quantum circuit setup
Since the quantum circuits are all unitary operations, they are reversible too. The circuit that is used to generate Bell basis from the product basis can be used in reverse, just as shown below, to measure in the product basis, for which we already have an understanding. | {
"domain": "physics.stackexchange",
"id": 67355,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-information, quantum-entanglement",
"url": null
} |
linear-systems, electrical-signal
Title: What is the importance of obtaining a linear signal? I am a computer scientist who has started doing some work in the electrical engineering space – in particular, photonics. While reading about interferometric systems, I have noticed that there seems to be a focus on ensuring that the detection signal (obtained using a laser of some kind) is linear. I have not yet studied signal processing (although, I have studied quite a lot of mathematics – just not in the context of electrical engineering), so the importance of ensuring that a signal is linear (for signal processing) is not clear to me. I'm assuming that this focus on obtaining a linear signal is universal to signal processing? What is the importance of obtaining a linear signal? (In mathematics, we like linearity as a property because it makes things much simpler, but I'm more-so looking for a signal processing perspective.) Not sure what you mean by linear signal, so I will assume you are talking about the output of | {
"domain": "dsp.stackexchange",
"id": 10288,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "linear-systems, electrical-signal",
"url": null
} |
cellular-respiration, fermentation
1663 Cowley Verses, to Royal Society iv, All their juyce did .. Ferment into a .. refreshing Wine.
From this, it is clear that the idea of the fermentation process is the conversion of some initial compound (the sugar in the ‘juyce’) to some final compound (the alcohol in the wine). This usage is still current in referring to the process of fermentation, for example a Google search brings up a BBC Science educational page which states:
Beer and wine are alcoholic drinks made by fermentation reactions that use yeast to convert sugars into ethanol. | {
"domain": "biology.stackexchange",
"id": 6618,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cellular-respiration, fermentation",
"url": null
} |
python, performance, python-3.x, dynamic-programming, knapsack-problem
return best_value[capacity], taken
items = [Item(60, 10), Item(100, 20), Item(120, 30)]
capacity = 50
print(knapsack(capacity, items))
print('knapsack() Time: ' + str(
timeit('knapsack(capacity, items)',
setup = 'from __main__ import knapsack, capacity, items')))
This change resulted in a good improvement in runtime. On my machine, it decreased the execution time (1,000,000 iterations) from 37s to 24s. | {
"domain": "codereview.stackexchange",
"id": 34525,
"lm_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, dynamic-programming, knapsack-problem",
"url": null
} |
ros, build, raspberrypi, rasbperrypi, ros-groovy
This is what I got:
[ 84%] Running SIP generator for qt_gui_cpp_sip Python bindings...
sh: 1: /usr/bin/sip: not found
Error: Unable to open
"/opt/ros/groovy/ros_catkin_ws/build_isolated/qt_gui_cpp/sip/qt_gui_cpp_sip/pyqtscripting.sbf"
make[2]: *** [sip/qt_gui_cpp_sip/Makefile] Error 1
make[1]: *** [src/qt_gui_cpp_sip/CMakeFiles/libqt_gui_cpp_sip.dir/all] Error 2
make: *** [all] Error 2
Traceback (most recent call last):
File "./src/catkin/bin/../python/catkin/builder.py", line 717, in build_workspace_isolated
number=index + 1, of=len(ordered_packages)
File "./src/catkin/bin/../python/catkin/builder.py", line 497, in build_package
install, force_cmake, quiet, last_env, cmake_args, make_args + catkin_make_args
File "./src/catkin/bin/../python/catkin/builder.py", line 353, in build_catkin_package
run_command(make_cmd, build_dir, quiet)
File "./src/catkin/bin/../python/catkin/builder.py", line 198, in run_command | {
"domain": "robotics.stackexchange",
"id": 14580,
"lm_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, build, raspberrypi, rasbperrypi, ros-groovy",
"url": null
} |
python, unit-testing, functional-programming, modules
date = int(string)
# if the date is valid for the given month
if date > 0 and date <= monthrange(year, month)[1]:
return date_type(year, month, date)
def extract_range(string: str, month: int, year: int) -> Generator[date_type, None, None]:
"""if the date is a range of numbers, it's a range of days. we identify all the dates in that range, bounds inclusive"""
start, end = map(int, npbc_regex.HYPHEN_SPLIT_REGEX.split(string))
# if the range is valid for the given month
if 0 < start <= end <= monthrange(year, month)[1]:
for date in range(start, end + 1):
yield date_type(year, month, date)
def extract_weekday(string: str, month: int, year: int) -> Generator[date_type, None, None]:
"""if the date is the plural of a weekday name, we identify all dates in that month which are the given weekday"""
weekday = WEEKDAY_NAMES.index(string.capitalize().rstrip('s')) | {
"domain": "codereview.stackexchange",
"id": 43355,
"lm_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, unit-testing, functional-programming, modules",
"url": null
} |
proteins, pharmacology, protein-structure
Title: Why are there so many carbonic anhydrase structures in the Protein Data Bank? I've been looking through PDB — the Protein Data Bank — and I noticed that the protein with the most structures is human carbonic anhydrase II (UniProt: P00918), with over a thousand X-ray structures.
This seems surprising to me, as carbonic anhydrase is a zinc-containing enzyme which catalyses a really simple reaction, and doesn’t seem to be part of any key signalling pathways. In terms of relevance to disease or as a drug target, all I could find was on DrugBank was a few glaucoma drugs which have this as their target (diclofenamide, methazolamide, acetazolamide), and those are really old (60 years). | {
"domain": "biology.stackexchange",
"id": 12057,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "proteins, pharmacology, protein-structure",
"url": null
} |
algorithms, algorithm-analysis, approximation, greedy-algorithms, packing
Title: First-Fit-Decreasing algorithm packs items of size at most 1 into bins of capacity 2 Consider the bin packing problem where we are given item sizes $a_1,\dots, a_n \in (0, 1)$, and all bins have capacity 2. The task is to pack the items in as few bins as possible, such that the total size of items in each bin is at most 2.
Is it possible to show that the First-Fit-Decreasing algorithm computes an asymptotic 3/2-approximation of an optimal solution, using at most $\frac{3}{2}\text{OPT}+1$ bins? The First-Fit-Decreasing algorithm sorts the items in order of non-increasing size, and the next piece is always packed into the first bin in which it fits. | {
"domain": "cs.stackexchange",
"id": 21217,
"lm_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, approximation, greedy-algorithms, packing",
"url": null
} |
performance, sql, sql-server, t-sql
As an example: if my aggregate function is SUM, the data in AggregateData would be:
+--------+----------------------+---------------------+
| Result | StartCaptureTime | EndCaptureTime |
+--------+----------------------+---------------------+
| 13.8 | 2018-04-01 00:00:00 | 2018-04-01 00:00:05 |
| 21.6 | 2018-04-01 00:00:05 | 2018-04-01 00:00:10 |
+--------+----------------------+---------------------+
The best solution that I've come up with uses a loop:
CREATE PROCEDURE [dbo].[spPerformAggregateCalculation]
@UpdateIntervalSeconds INT,
@StartTime DATETIME,
@EndTime DATETIME
AS
BEGIN
SET NOCOUNT ON;
DECLARE @RunningStartTime DATETIME = @StartTime;
DECLARE @RunningEndTime DATETIME = DATEADD(SECOND, @UpdateIntervalSeconds, @RunningStartTime);
DECLARE @AggregateValue FLOAT; | {
"domain": "codereview.stackexchange",
"id": 30377,
"lm_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, sql-server, t-sql",
"url": null
} |
ros-kinetic
Updated Code
using namespace std;
class server {
public:
std_msgs::Float64 joint_position0, joint_position1, joint_position2, joint_position3, joint_position4, joint_position5, joint_position6, joint_position7, joint_position8, joint_position9, joint_position10, joint_position11, joint_velocity0, joint_velocity1, joint_velocity2, joint_velocity3, joint_velocity4, joint_velocity5, joint_velocity6, joint_velocity7, joint_velocity8, joint_velocity9, joint_velocity10, joint_velocity11;
void jointStateCallback(const sensor_msgs::JointState::ConstPtr& msg);
}
void server::jointStateCallback(const sensor_msgs::JointState::ConstPtr& msg) { | {
"domain": "robotics.stackexchange",
"id": 33596,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-kinetic",
"url": null
} |
4. Originally Posted by florx
This is the problem. I am stuck on b). I have concluded that in order to find point A we must set x^n = x^(1/n) equal to each other because that is where they intersect. After finding x we can plug it back in the equation to find y and thus we would have a coordinate. But the problem is I don't know how to find x. Is there a better way to solve this or am I on the right track? Thanks for the help.
In the given graphs, suppose n =2. So, In the parabola $y = x^2$, the coordinate pairs are $(x, x^2)$. You should be able to see that the following points are on the graph: (1, 1), (−1, 1), (2, 4), (−2, 4), and so on.
The graph of the square root function is related to $y = x^2$. The coördinate pairs are $(x,\sqrt{x})$. For example, (1, 1), (4, 2), (9, 3), and so on.
So for any n, the graph of $y=x^{\frac{1}{n}}$ will not be negative.
5. So how would we explain that point A is (1,1)? The back of the book says that is the answer.
6. Hello, florx! | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9877587261496031,
"lm_q1q2_score": 0.8453744368862051,
"lm_q2_score": 0.8558511451289037,
"openwebmath_perplexity": 235.52257178263037,
"openwebmath_score": 0.8115619421005249,
"tags": null,
"url": "http://mathhelpforum.com/pre-calculus/141621-how-solve-x-equation.html"
} |
pharmacology, blood-pressure, dogs
There are quite a few others. (Canine pulmonary hypertension is apparently a popular research topic, so I found it useful to exclude those.) | {
"domain": "biology.stackexchange",
"id": 2888,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pharmacology, blood-pressure, dogs",
"url": null
} |
terminology
http://mathworld.wolfram.com/CombinatorialGeometry.html
Computational geometry.
https://en.m.wikipedia.org/wiki/Computational_geometry | {
"domain": "cs.stackexchange",
"id": 15095,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "terminology",
"url": null
} |
python, performance, python-2.x
if copy_pos < 0:
raise IndexError('There should be {} values in buffer, got {}.'.format(num_copy, len(output)))
to_copy = output[copy_pos:copy_pos + num_copy]
output += to_copy | {
"domain": "codereview.stackexchange",
"id": 12243,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, python-2.x",
"url": null
} |
neural-networks, machine-learning, deep-learning, deep-neural-networks, residual-networks
Of course you could waste your second wish on a decomposition of the solution into an ensemble of networks, and I'm pretty sure the genie would be able to oblige. The reason being that part of the power of a deep network will always come from the ensemble effect.
So it is not surprising that two very successful tricks to train deep networks, dropout and residual networks, have an immediate interpretation as implicit ensemble. Therefore "it's not depth, but the ensemble" strikes me as a false dichotomy. You would really only say that if you honestly believed that you need hundreds or thousands of levels of abstraction to classify images with human accuracy.
I suggest you use the last wish for something else, maybe a pinacolada. | {
"domain": "ai.stackexchange",
"id": 1429,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-networks, machine-learning, deep-learning, deep-neural-networks, residual-networks",
"url": null
} |
javascript, design-patterns, ajax, modules
Title: How are my javascript module pattern and promise pattern? I'm working on an app that downloads some SVG paths from a server and draws them.
Anything in here is open to critique, but specifically I'd like to review my use of a module pattern and my implementation and use of promise objects.
The "modules" are each a file, and the aim is to limit and explicitly declare dependencies. My use of promises is to simplify the use of ajax.
My 3 files are:
init.js - the main application.
promise.js - my implementation of promises
ajax.js - ajax functionality
init.js:
(function (window, document, bigmap, ajax) {
"use strict";
var attr = {
fill: "#fafafa",
stroke: "#505050",
"stroke-width": 1,
"stroke-linejoin": "round"
};
var drawings, svg_canvas;
svg_canvas = bigmap.initialize("map", window.innerWidth - 21, window.innerHeight - 21); | {
"domain": "codereview.stackexchange",
"id": 2709,
"lm_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, design-patterns, ajax, modules",
"url": null
} |
mobile-robot
You can represent each vector as like this:
$$\vec {V}_{direction} = - \phi$$
Since you want to move away from the obstacle.
$$\vec {V}_{magnitute} = c $$
But there is an important part in here. You have 3 policies to choose from when evaluating the sensor values: | {
"domain": "robotics.stackexchange",
"id": 1338,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mobile-robot",
"url": null
} |
python
Title: McDonald's food order system Is there any way I could make this code more efficient?
def processOrder(quantity, item_list):
global total
if quantity > item_list[2]:
print("There is not enough stock!")
pass
else:
total += item_list[1] * quantity
item_list[2] -= quantity
total = 0
A = ["Big Mac", float(2.50), 50], ["Large Fries", float(0.50), 200], ["Vegetarian Burger", float(1.00), 20]
print("Welcome to McDonald's")
print("[1]", A[1][0:2],
"\n[2]", A[1][0:2],
"\n[2]", A[1][0:2])
while True:
choice, quantity = (input("\nWhat would you like?\n")).upper(), int(input("\nHow many would you like?\n"))
if choice == "BIG MAC":
processOrder(quantity, A[0])
elif choice == "LARGE FRIES":
processOrder(quantity, A[1])
elif choice == "VEGETARIAN BURGER":
processOrder(quantity, A[2])
else:
print("Invalid Item") | {
"domain": "codereview.stackexchange",
"id": 27563,
"lm_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
} |
c#, performance, game, opengl
/// <summary>
/// Get the <see cref="Vertex"/> based of index on Array.
/// </summary>
/// <param name="index">Index of <see cref="Vertex"/> in Array.</param>
/// <returns>Selected <see cref="Vertex"/> based specified index.</returns>
public Vertex this[int index]
{
get
{
if (index >= _vertices.Length || index < 0 || _vertices.Length == 0)
return new Vertex();
return _vertices[index];
}
set
{
if (index >= _vertices.Length || index < 0 || _vertices.Length == 0)
return;
_vertices[index] = value;
}
}
/// <summary>
/// Resize the <see cref="VertexArray"/>.
/// </summary>
/// <param name="size">New Size of <see cref="VertexArray"/>.</param>
public void Resize(int size)
{
Array.Resize(ref _vertices, size);
} | {
"domain": "codereview.stackexchange",
"id": 15022,
"lm_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, game, opengl",
"url": null
} |
cr.crypto-security, randomized-algorithms
By partial information, I mean a string $z$, such that given $z$ and a Diffie-Hellman pair, no PPT algorithm can compute $a$, with non-negligible probability.
It's possible to formalize the above question. However, since the amount of notation required is tedious, I try to use an analogy.
A famous, non-standard cryptographic assumption is called Knowledge-of-Exponent (KEA).
For any adversary A that takes input $q$, $g$, $g^a$ and returns $(C,C^a)$, there exists
an "extractor" B, which given the same inputs as $A$ returns $c$ such that $g^c = C$.
Intuitively, it states that, since the adversary cannot solve discrete log to obtain $a$, the only way to output a pair $(C,C^a)$ is to "know" the exponent $c$ where $g^c = C$.
Now, I'm asking a similar question, based on DDH (rather than discrete log): to distinguish "Type 1" and "Type 2" Diffie-Hellman pairs, should we "know" either $a$ or $b$?
A bit more formally (but still not fully formal): | {
"domain": "cstheory.stackexchange",
"id": 1551,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cr.crypto-security, randomized-algorithms",
"url": null
} |
astronomy, orbital-motion, galaxies, galaxy-rotation-curve
Original image courtesy of Wikipedia; color added by me in Paint.
In both cases, you can see the bar clearly dominating the central structure of the galaxy.
The thing is, though, that the spiral arms (and central areas) of a galaxy don't rotate as much as the stuff inside them. According to density wave theory, these structures are just regions of greater density, where there is more gas, dust, and stars. These objects can move in and out of the spiral arms and bars. The spiral arms are just the places where there are more stars, gas, and dust than in other places. Same goes for bars.
The arms do rotate, to a certain extend, at something called the pattern speed. This is greater than the speed of some of the stars and less than the speed of other stars - it depends on just where in the arm the stars are.
I have yet to see "pattern speed" applied to bars, but the same phenomena may be at work.
Have similar movements within galaxies been measured? | {
"domain": "physics.stackexchange",
"id": 21097,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astronomy, orbital-motion, galaxies, galaxy-rotation-curve",
"url": null
} |
thermodynamics, pressure, work
It is the external pressure that determines the work done by the gas. That pressure is initially constant (pressure of stones plus pressure of atmosphere) until you start removing stones in which case the external pressure drops. Now the process is not isobaric.
If you remove one small stone at a time the pressure of the gas will drop very slowly as well and always approximately equal the external pressure. But since the pressure is dropping, the process is not isobaric. | {
"domain": "physics.stackexchange",
"id": 72864,
"lm_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, pressure, work",
"url": null
} |
complexity-theory, np-complete, strings, permutations
Clearly, the restriction to a binary alphabet is irrelevant. One can work with any countable alphabet. Need to be careful though: the item 2 does not hold when the alphabet is unbounded. I can't speak to whether it's a known problem, but it is NP-complete.
It's clearly in NP, so we just have to show NP-hardness. The following reduction is from the strongly NP-hard 3-partition problem, which asks, given a multiset of positive integers $[x_1,\ldots,x_{3m}]$, whether there exists a partition into $m$ submultisets such that the sum of each submultiset is equal to the integer $s=\frac{1}{m}\sum_{i=1}^{3m}x_i$. For each $i\in\{1,\ldots,3m\}$, make a string $a^{x_i}$. Make $m-1$ strings $b$. The target word $w$ is
$$a^sba^sb\cdots ba^s.$$ | {
"domain": "cs.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": "complexity-theory, np-complete, strings, permutations",
"url": null
} |
diffusion, gas
Title: How quickly do farts spread? Basically I started thinking this question in regard to farts. I thought to myself, say Alice and Bob are in a room. If Alice farts, how long would it take for Bob to pick up on the smell? After a bit of thinking, I realised that this could apply to all gases.
Is there a formula for gases spreading? Or some way of deriving a formula? The kinetic energy of a particle of mass $m$ and velocity $v$ is related to the temperature by
$$
\frac{1}{2}mv^2~=~\mu kT,
$$
for $\mu$ a dimensionless constant. The velocity $v~=~dx/dt$ means that the rate of diffusion is related to the mass of the particle
$$
R_\textrm{diff}~\propto~\frac{1}{\sqrt m}.
$$
For a molecule of a gram molecular weight, this determines the rate of diffusion by this formula. | {
"domain": "physics.stackexchange",
"id": 34761,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "diffusion, gas",
"url": null
} |
The $$B$$ and $$C$$ functions will not yield integers if $$\space 2(2n-1)^2\not\mid x^2k^2\space$$ for most values of $$k$$ so that $$F(n,k)$$ is not missing any triples (especially primitives) in the subset where $$\space GCD(A,B,C)\space$$ is an odd square –– and $$F(n,k)$$ is a subset of $$F(m,k)$$.
$$\quad\therefore :\quad$$All primitives are represented by both formulas.
• Great answer which helps me in my investigations too. Mar 7 at 13:20 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9871787879966232,
"lm_q1q2_score": 0.8024453803378045,
"lm_q2_score": 0.8128673246376009,
"openwebmath_perplexity": 417.813260936227,
"openwebmath_score": 0.8929582834243774,
"tags": null,
"url": "https://math.stackexchange.com/questions/4383596/does-the-proof-for-primitive-pythagorean-triples-follow-that-the-formula-x-q2"
} |
php
I hope those file names don't indicate that you are actually using globals... There are much better ways to get "global" scope variables without ever using global. Sessions for instance. Globals, in my opinion, should eventually be deprecated. They are an old feature that has been proven faulty and replaced.
array_push() is another old function. Though there is nothing wrong with it, the preferred way to do it now is like so.
$includes[] = $file;
What you are trying to do is usually done with templates rather than PHP. For instance, you'd have a single HTML file with these includes in it already then dynamically change the contents with PHP. For those files that use the $topic variable, you would just perform a check to make sure it exists before including it via PHP. So a very basic template might look like this.
<html>
<head>
<title></title>
<script type="text/javascript" src="i/globals.js"></script>
<link rel="stylesheet" type="text/css" href="i/globals.css" /> | {
"domain": "codereview.stackexchange",
"id": 2143,
"lm_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
} |
special-relativity, spacetime, metric-tensor, tensor-calculus, covariance
A delta between two events in a 4D space-time written as a quaternion puts all the terms in their correct place:
$$x^2=(x^0 x^0 - x^i \cdot x^i, 2 x^0 x^i)$$
There are no cross-terms for a square since an event always points in the same direction as itself. Only the first term is invariant under a Lorentz transformation, the other three are Lorentz covariant, transforming like $\gamma^2 \beta$. The contraction of 2 4-vectors using a metric produces one value. Squaring a quaternion produces 4. It is simple enough to map where similar components go.
Tensors and differential geometry can work in arbitrary dimensions. Quaternions are restricted to a 4 dimensional space. Until we discover super-symmetric particles, physics too may be constrained to a 4 dimensional space. | {
"domain": "physics.stackexchange",
"id": 20481,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, spacetime, metric-tensor, tensor-calculus, covariance",
"url": null
} |
Take such a subsequence (I will use $\mu_n$ itself for ease of notation) $\mu_n \to \mu$. It is a fact (see for example Durrett 3.2.2) that we may without loss of generality work with a sequence $X_n \to X$ almost surely where the law of $X_n$ is $\mu_n$ and the law of $X$ is $\mu$.
Let $M$ be given and large. By the bounded convergence theorem for each $k$ $EX_{n}^{k}1_{{|X_{n}|\leq M}}\to$$EX^{k}1_{{|X|\leq M}}.$ By the Cauchy-Schwarz and Markov inequalities $E|X_{n}^{k}1_{\{|X_{n}|>M\}}|\leq\sqrt{\frac{EX_{n}^{2k}E|X_{n}|}{M}}$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.964321452198369,
"lm_q1q2_score": 0.8117905249153382,
"lm_q2_score": 0.8418256412990657,
"openwebmath_perplexity": 173.15147761674734,
"openwebmath_score": 0.9172447919845581,
"tags": null,
"url": "https://math.stackexchange.com/questions/127929/moments-and-weak-convergence-of-probability-measures/128541"
} |
c++
test.cpp:(.text+0x216): undefined reference to `KDL::JntArray::JntArray(unsigned int)'
test.cpp:(.text+0x238): undefined reference to `KDL::JntSpaceInertiaMatrix::JntSpaceInertiaMatrix(int)'
test.cpp:(.text+0x258): undefined reference to `KDL::ChainDynParam::JntToMass(KDL::JntArray const&, KDL::JntSpaceInertiaMatrix&)'
test.cpp:(.text+0x271): undefined reference to `KDL::JntSpaceInertiaMatrix::operator()(unsigned int, unsigned int)'
test.cpp:(.text+0x2a6): undefined reference to `KDL::JntSpaceInertiaMatrix::~JntSpaceInertiaMatrix()'
test.cpp:(.text+0x2b5): undefined reference to `KDL::JntArray::~JntArray()'
test.cpp:(.text+0x2c4): undefined reference to `KDL::ChainDynParam::~ChainDynParam()'
test.cpp:(.text+0x2d3): undefined reference to `KDL::Chain::~Chain()'
test.cpp:(.text+0x39b): undefined reference to `KDL::JntSpaceInertiaMatrix::~JntSpaceInertiaMatrix()'
test.cpp:(.text+0x3af): undefined reference to `KDL::JntArray::~JntArray()' | {
"domain": "robotics.stackexchange",
"id": 26232,
"lm_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
} |
c#, beginner, algorithm, pathfinding, unity3d
attempts: everything involving attempts makes no sense: it's not a cost, and it's not timing out! And what is 10000?! Remove it! All of it!
* I don't like referring to hashsets as O(1) lookups; I note that the documentation OptimisedPriorityQueue has some reassuring comments to this effect! Thanks BlueRaja!
** This assumes a monotonically increasing cost and admissible heuristic, which basically means that you never over-estimate the cost of getting anywhere: this means when you sort by the estimated cost, you know that any node that is not the 'best' node can cost no-less than it's estimated cost to get to the end. If it went via the current node, then it would necessarily have an estimated cost (from said node) that is no less than its current estimate, and since it would then have the same heuristic term as your 'best' node, you know it must then have a higher true cost of reaching the 'best' node. | {
"domain": "codereview.stackexchange",
"id": 31048,
"lm_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, algorithm, pathfinding, unity3d",
"url": null
} |
control-engineering, control-theory
Or you could try using Model Identification Adaptive Controller (MIAC). Here the control scheme does system identification in real time and uses an update law for your controller. This one requires the most advanced skill of the three ideas.
Since your system is changing time constants over time, it is no longer LTI. This means you need to either do gain scheduling (pretty easy if you know the range of time constants) or system identification with update law for your PID. | {
"domain": "engineering.stackexchange",
"id": 315,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "control-engineering, control-theory",
"url": null
} |
maxwell-equations
Then, my question is how to get the boundary conditions verified by $\mathbf{\tilde{E}}$ instead of $\mathbf{E}$ ? Does it lead to $\mathbf{\tilde{E}} \times \mathbf{n} = 0$ ?
An additional question would be : what about a non homegenous conditions such as $\mathbf{E} \times \mathbf{n} = f$ ?
I know that's pretty dumb but I can't convice myself.
Thanks in advance. Your boundary condition (I assume you mean that $\Gamma$ is a cylinder centred on $r=0$ in cylindrical co-ordinates and with radius $r_\Gamma$ as you imply that the problem has circular symmetry) is:
$\mathbf{U}(r_\Gamma,\theta,z) \wedge \mathbf{n} = \sum\limits_{\alpha = -\infty}^\infty \tilde{\mathbf{U}}_\alpha(r_\Gamma, z) \wedge \mathbf{n}\, e^{I\,\alpha\,\theta} = \mathbf{0};\;\forall \theta, z \in \mathbb{R}$ | {
"domain": "physics.stackexchange",
"id": 8630,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "maxwell-equations",
"url": null
} |
near-earth-object
Beside that article I did not find anything else. With a slight change of the assumption could the asteroid break up during the flyby? Unlikely.
An asteroid can break up due to tidal forces if it approaches a planet closer than the Roche limit. The exact size of the Roche limit depends on the density of the object and whether it is likely to deform fluidly under tidal stress.
We don't know the physical nature of Apopsis, but if we assume it is a very weakly held-together rubble pile, with a low density, then the Roche limit is still about 20,000 km. That is a lot less than the 40,000 km distance that it is predicted to pass. And since interest in this object has (naturally) been so great, its orbit is very well understood, the closest approach distance is now determined to be 38016 km to within 3.4 km. | {
"domain": "astronomy.stackexchange",
"id": 7054,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "near-earth-object",
"url": null
} |
javascript, stackexchange, userscript
function clearChat() {
var chat = document.getElementById('chat');
while (chat.firstElementChild) {
chat.removeChild(chat.firstElementChild);
}
var starred = document.querySelector('#starred-posts ul');
while (starred.firstElementChild) {
starred.removeChild(starred.firstElementChild);
}
}
function clearSide() {
while (priorityList.firstElementChild) {
priorityList.removeChild(priorityList.firstElementChild);
}
}
function toggleTracking() {
switch (currentStatus) {
case "off":
switchOn();
break;
case "on":
pauseST();
break;
case "chat only":
switchOff();
}
onoff.textContent = 'spamtracker: '+currentStatus;
} | {
"domain": "codereview.stackexchange",
"id": 22885,
"lm_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, stackexchange, userscript",
"url": null
} |
python, algorithm, python-2.x
left_run_index_bound = right_run_index
right_run_index_bound = right_run_index + right_run_length
while left_run_index != left_run_index_bound and right_run_index != right_run_index_bound:
if source[right_run_index] < source[left_run_index]:
target[target_offset] = source[right_run_index]
right_run_index += 1
else:
target[target_offset] = source[left_run_index]
left_run_index += 1
target_offset += 1
while left_run_index != left_run_index_bound:
target[target_offset] = source[left_run_index]
target_offset += 1
left_run_index += 1
while right_run_index != right_run_index_bound:
target[target_offset] = source[right_run_index]
target_offset += 1
right_run_index += 1 | {
"domain": "codereview.stackexchange",
"id": 23350,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, algorithm, python-2.x",
"url": null
} |
species-identification, entomology
Millepedes are mostly harmless to humans. They eat things like dead plant matter or fungi. They sometimes also eat seedlings so they can be considered pests in gardens.
And given the colour, that’s possibly a rusty millipede (https://en.m.wikipedia.org/wiki/Trigoniulus_corallinus). They have a very wide distribution around the Indo-Malayan region. Although there seems to be no recorded observation of it on iNaturalist around your region (https://www.inaturalist.org/observations?place_id=9248&taxon_id=123010). | {
"domain": "biology.stackexchange",
"id": 10811,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "species-identification, entomology",
"url": null
} |
python, scipy
b) Sparse types that support efficient access, arithmetic operations, column or row slicing, and matrix-vector products:
CSR (Compressed Sparse Row): similar to COO, but compresses the row indices. Holds all the nonzero entries of M in left-to-right top-to-bottom ("row-major") order (all elements in the first row, all elements in the second row, and so). More efficient in row indexing and row slicing, because elements in the same row are stored contiguously in the memory.
CSC (Compressed Sparse Column): similar to CSR except that values are read first by column. More efficient in a column indexing and column slicing.
Once the matrices are build using one of the a) types, to perform manipulations such as multiplication or inversion, we should convert the matrix to either CSC or CSR format. | {
"domain": "datascience.stackexchange",
"id": 3776,
"lm_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, scipy",
"url": null
} |
c++, design-patterns, c++14, type-safety
Clarity of intent
I am not well versed in preprocessor metaprogramming so I will spend quite a bit of time understanding what the code in question does. If I am searching for a bug, it might lead me to assume that the bug is somewhere in the preprocessor generated code. My IDE shows a replacement, fortunately, but I believe it is still far from just either including the statements or just removing them completely.
Integration with tools
The piece of usage code shown in question will not be greyed out in release mode, hence it will lead to assumption that it is somehow important either way. Combined with previous point, this leads to a serious problem. With the NDEBUG version, the code will be greyed out and combined with its simplicity it will be clear that the code is really debug only.
Not so lightweight | {
"domain": "codereview.stackexchange",
"id": 42735,
"lm_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++, design-patterns, c++14, type-safety",
"url": null
} |
c++, algorithm, c++11, linked-list, reinventing-the-wheel
void SinglyLinkedList::pop_back () {
// O(n)
if (!head) {
std::cout << "List is empty.\n";
There are many ways to deal with incorrect manipulations, but writing to std::cout
isn't one of them. Writing to std::clog or std::cerr would be a beginning, but you primarily need to
provide a feed-back mechanism: either an exception, or a return value indicating success / failure
return;
}
if (head == tail) {
head = nullptr;
tail = nullptr;
return;
}
std::shared_ptr<ListNode> currNode = head;
while (currNode->next != tail) {
currNode = currNode->next;
}
tail = currNode;
This traversal already appeared twice in your code. It should be encapsulated in its own function
currNode->next = nullptr;
}
void SinglyLinkedList::push_front (int val) {
// O(1)
std::shared_ptr<ListNode> currNode = std::make_shared<ListNode>(val);
currNode->next = head;
head = currNode; | {
"domain": "codereview.stackexchange",
"id": 32742,
"lm_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++, algorithm, c++11, linked-list, reinventing-the-wheel",
"url": null
} |
and the gives the peano arithmetic number or a digits expression.
(p is the function that gives $p(2) = SSZ$ for the first 10 digits for example, that you already mentioned)
-
I think this is on the right track to satisfy me. But I have to define $10$ before applying your process, right? – Git Gud Jan 19 '13 at 22:49
@GitGud, the first part with $f$ is just for intuition - it's not used later. Also I posted a new answer to your question: How to do the reverse operation: Getting a string of digits from a peano number. – user58512 Jan 19 '13 at 22:51
first you must define the "remain" and "quotient" of one natural number to another then you can represent any natural number by its "quotient" and "remain" to the powers of ten
Actually in set theory you don't represent numbers like 10 or 11 or something like that, number 3 in set theory is S(S(S(0))), but because you are already familiar with this representation of natural numbers, you use 3, actually using "3" in set theory is wrong | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.966410494349896,
"lm_q1q2_score": 0.854344849630763,
"lm_q2_score": 0.8840392924390587,
"openwebmath_perplexity": 421.87882062828186,
"openwebmath_score": 0.8927438259124756,
"tags": null,
"url": "http://math.stackexchange.com/questions/282297/how-to-represent-each-natural-number"
} |
exoplanet, space-telescope, angular-resolution, instruments
An interesting question is why this can't be done now with HST? The proposed telescope will spend two years doing this. Even if HST could cut this to months, I am not convinced that detecting a faint smudge around the nearest star has the necessary science pay off to get the time, especially as there is a fair chance of failure. There may not be planets in the habitable zone or there may be sufficient zodiacal dust in the system to make the measurements impossible due to scattered light.
Further research suggests that the coronagraph on the HST ACS camera would only give around 7-8 magnitudes (factors of a thousand) contrast at angular separations of an arcsecond. So nowhere near what is required. This new telescope must have radically improved optics and a more advanced coronagraph. | {
"domain": "astronomy.stackexchange",
"id": 1893,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "exoplanet, space-telescope, angular-resolution, instruments",
"url": null
} |
particle-physics, units, scattering-cross-section
My other confusion is what the actual value of $G_F$ should be? I see here that $G_F/(\hbar c)^3=1.66\cdot10^{-5}$ GeV$^{-2}$, but does this imply I need to multiply by $(\hbar c)^3$ in the equation above, or do I just plug in $1.66\cdot10^{-5}$ GeV$^{-2}$? I believe there is a conversion of $(\hbar c)=0.389$GeV$^{2}$mb that should be plugged in, but when I do that I am getting units of mb$^{3}$ and it isn't immediately clear where that would cancel out to give me just mb. Perhaps answering the first question will help solve the second.
Thanks! You seem to be throwing the baby out with the bathwater. The whole point of natural units is to work all expressions out in powers of GeV, always setting c=1, ℏ=1. Bid them farewell forever and ever! Take advantage of the "luxury": it is the lifeline in this field.
You only need the conversion factor 1 GeV$^{-2}$= 0.389379 mb for the very end. All masses, energies, and widths are in GeV, while you have the Fermi constant in natural units. | {
"domain": "physics.stackexchange",
"id": 96601,
"lm_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, units, scattering-cross-section",
"url": null
} |
quantum-mechanics, hilbert-space, operators, angular-momentum, quantum-spin
$$(\langle\vec r|\otimes\langle\uparrow|)(|\psi\rangle\otimes|\phi\rangle)
=\langle\vec r|\psi\rangle\ \!\langle\uparrow|\phi\rangle$$
The position operator $\hat x$ acts only on ${\cal H}$ (and should now be written $\hat x\otimes\mathbb I$):
$$\eqalign{
\hat x(|\psi\rangle\otimes|\phi\rangle)
&=(\hat x\otimes\mathbb I)|\psi\rangle\otimes|\phi\rangle\cr
&=(\hat x|\psi\rangle)\otimes(\mathbb I|\phi\rangle)\cr
&=(\hat x|\psi\rangle)\otimes|\phi\rangle\cr
}$$
The spin operators $\hat S_i$ act only on ${\cal H}_{1/2}$:
$$\eqalign{
\hat S_i(|\psi\rangle\otimes|\phi\rangle)
&=(\mathbb I\otimes\hat S_i)|\psi\rangle\otimes|\phi\rangle\cr
&=|\psi\rangle\otimes\hat S_i|\phi\rangle\cr
}$$
Some operators may act on both Hilbert state simultanously. It is the case of the spin-orbit interaction $\hat W\sim \vec L.\vec S$ that couples the spin and the angular momentum of the electron in an atom for example:
$$\eqalign{
\vec L.\vec S|\psi\rangle\otimes|\phi\rangle | {
"domain": "physics.stackexchange",
"id": 80898,
"lm_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, operators, angular-momentum, quantum-spin",
"url": null
} |
digital-communications, dsp-core, lte
$$x_{dc}(t) = \frac{\alpha}{2}\cos(0) = \frac{\alpha}{2}$$ | {
"domain": "dsp.stackexchange",
"id": 10782,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "digital-communications, dsp-core, lte",
"url": null
} |
a= cand b= d. 2. Simple Set Theory See also: Simple Statistical Analysis. Friends PDF Preview ; Author and Citation Info ; Back to Top ; Supplement to Set Theory. De ning a set formally is a pretty delicate matter, for now, we will be happy to consider an intuitive de nition, namely: De nition 24. Set Theory: Shading Venn Diagrams Venn diagrams are representations of sets that use pictures. They are used in graphs, vector spaces, ring theory, and so on. The second axiomatization of set theory (see the table of Neumann-Bernays-Gödel axioms) originated with John von Neumann in the 1920s. In other words, we might be tempted to postulate the following rule of formation for sets. Download Set theory Formula in PDF; Summary of Set Theory Formula. Cantor initiated the study of set theory with his investigations on the cardinality of sets of real numbers. In particular, he proved that there are dif-ferent infinite cardinalities: the quantity of natural numbers is strictly smaller than the | {
"domain": "com.au",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9820137879323496,
"lm_q1q2_score": 0.8005695449140764,
"lm_q2_score": 0.815232489352,
"openwebmath_perplexity": 1969.9070901108985,
"openwebmath_score": 0.6487947702407837,
"tags": null,
"url": "https://scaits.com.au/mother-knows-rdhc/set-theory-pdf-4276c2"
} |
software
http://jp-minerals.org/vesta/en/
It is available for both Windows and Linux. It can be used to import any many structural files (pdb included) and get an output in any supported format(which includes SVG). From their website: | {
"domain": "chemistry.stackexchange",
"id": 2964,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "software",
"url": null
} |
python
#Recursively calculates next move
for index_3 in range (len(methods)):
try:
solve(remaining, total= totals[index_3],method= methods[index_3])
except Exception as e:
pass | {
"domain": "codereview.stackexchange",
"id": 35470,
"lm_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, number-theory, mathematical-programming, primes
Title: Algorithm which finds the maxmal solution that satisfies the following constraints I have $a_1, a_2,\dots,a_n$ and $b_1,b_2,\dots,b_n$ and an upper bound $U$ and $n$ linear equations of the form:
$k_1 * a_1 + b_1 = x$
$k_2 * a_2 + b_2 = x$
$\dots$
$k_n * a_n + b_n = x$
Additional info where $r \in \{ 1,2,\dots , n \}$:
$a_r$ is prime
$0 \leq b_r < a_r $
$k_r b_r, U, n, \in N_0$ and $(a_r\in N)$ | {
"domain": "cs.stackexchange",
"id": 9291,
"lm_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, number-theory, mathematical-programming, primes",
"url": null
} |
python, python-3.x, file-system
I propose a slightly longer class docstring, which ends in a period:
"""Renames all files in a given directory by pushing them one level down."""
It doesn't change regex behavior in this case, but I'd prefer compile(r'foo') to the compile('foo') in your ctor. Then your double backwhacks become single ones. A + is probably more appropriate than *.
Recommend you delete this redundant comment: "# Raises an exception if there is no directory", as the code is clear.
Kudos on leading underscore for methods not exposed as part of public API, that's helpful to the Gentle Reader.
Here's the one glaring issue I noticed:
while self._size / 1024 = 1:
Assignment (=) is different from equality test (==) -- I have trouble believing the while does what you intended. | {
"domain": "codereview.stackexchange",
"id": 26849,
"lm_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, file-system",
"url": null
} |
python, python-3.x, design-patterns, unit-testing, interface
return CandidateSet(candidates, fitnesses)
def _updateminmax(self, fidelity, value):
if value > self.max[fidelity]:
self.max[fidelity] = value
elif value < self.min[fidelity]:
self.min[fidelity] = value Type hints
PEP484 type hints, such as ndim: int, will help better-define your interface.
Mutability
Reading your code, the other members of CandidateArchive only make sense if fidelities are immutable. As such, don't make them a list - make them a tuple. One advantage is that you can safely give a default argument of ('fitness',), whereas you can't safely give a default argument that is a mutable list.
lower_camel_case
addcandidates should be add_candidates.
Logic inversion
if tuple(candidate) not in self.data:
self._addnewcandidate(candidate, fit, fid, verbose=verbose)
else:
self._updatecandidate(candidate, fit, fid, verbose=verbose) | {
"domain": "codereview.stackexchange",
"id": 35889,
"lm_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, design-patterns, unit-testing, interface",
"url": null
} |
quantum-mechanics, laser, classical-electrodynamics
Title: Is a classical laser possible? A laser is built on quantum mechanics to create a beam of photons with the same frequency and phase. Someone told me a free electron laser is a based on classical electrodynamics. Is that true?
is classical laser possible?
IMO, the question doesn't make sense. "Classical" and "quantum" are not different options for how a thing can work. They are different options for us to try to understand how it works. LASERs aren't "built on" quantum mechanics, but rather, quantum mechanics is an appropriate tool for understanding stimulated emission. A free electron laser isn't built on classical electrodynamics, but classical electrodynamics offers a sufficient explanation for why it emits light. | {
"domain": "physics.stackexchange",
"id": 64980,
"lm_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, laser, classical-electrodynamics",
"url": null
} |
haskell, memory-management, state, hash-map
type Counter = ([Char], (Char, Integer), (Char, Integer), Map Char Integer)
main :: IO ()
main = do
file <- liftM head getArgs
string <- B.readFile file
let (chars, seldom, often, counter) = execState (countChars string) ([], (' ', 10^12), (' ', 0), M.empty)
mapM_ (\k -> putStrLn ('\'':k:"' " ++ show (fromJust $ M.lookup k counter))) chars
putStrLn $ "minimum occurence: " ++ show (fst seldom) ++ ", " ++ show (snd seldom)
putStrLn $ "maximum occurence: " ++ show (fst often) ++ ", " ++ show (snd often)
putStrLn $ "overal chars : " ++ show (B.length string) | {
"domain": "codereview.stackexchange",
"id": 8045,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "haskell, memory-management, state, hash-map",
"url": null
} |
-
Consider an arithmetic spiral in polar co-ordinates $r=k \theta$ with fixed $k>0>$. For the length $L$ along the spiral we have $dL/d\theta=k \theta.$ – user254665 Jan 31 at 7:04
Wow, Calculus in toilet paper? :D Great idea! – Simple Art Jan 31 at 14:02
Can you add a plot or just say how much of a difference this approach results in to the solution given in the question? Would be interesting to see – WorldSEnder Jan 31 at 15:31
## Use cross-sectional volume to calculate.
Since the initial problem is measured as diameters and a spiral will not have a true final "diameter", we clearly have to use approximation.
We know that the volume of the cross-section of toilet paper is $V = \pi * (R^2 - r^2)$
If we laid out the toilet paper to its full length, the cross-section would be $V=L * T$
Setting these two equal to each other, we get $L*T = \pi * (R^2 - r^2)$
Reducing this to length, we get $L = \pi * (R^2 - r^2) / T$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.982013788985129,
"lm_q1q2_score": 0.8028694091444522,
"lm_q2_score": 0.8175744761936437,
"openwebmath_perplexity": 544.1911105470579,
"openwebmath_score": 0.9622120261192322,
"tags": null,
"url": "http://math.stackexchange.com/questions/1633704/the-length-of-toilet-roll"
} |
quantum-state, entanglement
Title: Given $|\psi\left(t\right)\rangle=\sum_{n=0}^{N}c_{n}\left(t\right)|N_{1}\rangle_{a}|N_{2}\rangle_{b}$, what is the expression for $c_n(t)$? We have:
$$|\psi\left(t\right)\rangle=e^{-iH_{NL}t}|N\rangle_{a}|0\rangle_{b}$$
Also
$$|\psi\left(t\right)\rangle=\sum_{n=0}^{N}c_{n}\left(t\right)|N_{1}\rangle_{a}|N_{2}\rangle_{b}$$
I would like to know whether
$$c_{n}\left(t\right)=\langle N_{2}|\langle N_{1}|e^{-iH_{NL}t}|N_{1}\rangle_{a}|N_{2}\rangle_{b}$$
is the right way to express. If we label the expansion coefficients as $c_{N_1,N_2}(t)$ as suggested in the comments, the correct expression will be
$$c_{N_1,N_2}(t)= \vphantom{a}_a\langle N_1| \vphantom{a}_b\langle N_2|\psi(t)\rangle= \vphantom{a}_a\langle N_1| \vphantom{a}_b\langle N_2|e^{-i H_{NL}t}|N\rangle_a|0\rangle_b.$$
Responding to the comment: some people write their Hilbert spaces in opposite order when using bras, preferring to write this expression as | {
"domain": "quantumcomputing.stackexchange",
"id": 2739,
"lm_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-state, entanglement",
"url": null
} |
9
You can use binary search with Compile. I failed inlining (Compile was complaining endlessly about types mismatch), so I included a binary search directly into Compile-d function. The code for binary search itself corresponds to the bsearchMin function from this answer. Clear[linterp]; linterp = Compile[{{lst, _Real, 2}, {pt, _Real}}, Module[{pos = ...
Only top voted, non community-wiki answers of a minimum length are eligible | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9648551515780319,
"lm_q1q2_score": 0.8181660600429209,
"lm_q2_score": 0.8479677583778257,
"openwebmath_perplexity": 1802.027974990917,
"openwebmath_score": 0.30621030926704407,
"tags": null,
"url": "http://mathematica.stackexchange.com/tags/interpolation/hot"
} |
frequency, sound, pitch
This "what is perceived" (is it a piano? is it an organ? is it a poggo-stick?) is called Timbre.
This modification of the attack phase is sometimes used deliberately.
Here, it is not the delay that is effecting the modification. Notice his hand on the volume knob when the guitar now starts sounding like a violin. It is clearer from 01:43 onwards in the "Without echo" part of the video. Here, he is killing the guitar's distorted "twang" as the string is excited and "brings it in" just a little after that so that you get more of the tone and less of the "twang". It then sounds like a violin. You might also notice on a piano, if you simply play the waveform after the attack, it sounds more like a decaying pipe-organ rather than a piano. | {
"domain": "dsp.stackexchange",
"id": 9121,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "frequency, sound, pitch",
"url": null
} |
regular-languages, finite-automata, proof-techniques, closure-properties
Title: Prove that $L_1$ is regular if $L_2$, $L_1L_2$, $L_2L_1$ are regular Prove that $L_1$ is regular if $L_2$, $L_1L_2$, $L_2L_1$ are regular.
These are the things that I would use to start.
As $L_1L_2$ is regular, then the homomorphism $h(L_1L_2)$ is regular.
Let $h(L_1) = L_2$ and $h(L_2) = L_1$, then $h(L_1L_2) = L_2L_1$ is regular (we already know that) or $h(L_2) = \epsilon$ and we get $L_1$
By reflexing, $L_1L_2 = (L_2L_1)^{R}$, same result.
But i don't know how to, for example, intersect something that gives me $L_1$ in order to preserve closure and finally $L_1$ be regular.
Any help? Here is a counterexample. Let $L_1$ be any language over some alphabet $\Sigma$ containing the empty string, and let $L_2 = \Sigma^*$. Then $L_2 = L_1L_2 = L_2L_1 = \Sigma^*$ are all regular, but $L_1$ need not be, in fact it could even be uncomputable! | {
"domain": "cs.stackexchange",
"id": 1345,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "regular-languages, finite-automata, proof-techniques, closure-properties",
"url": null
} |
food-chemistry
Title: What is the standard industrial method for measuring caffeine content in food and drinks? There are a lot of questions here looking for simple methods to measure caffeine content (or extract it), including one of mine here and on the Coffee site:
Home science optical absorption test for approximate caffeine quantity in coffee?
Are there any ways that coffee consumers can measure the caffeine content of what they are drinking by themselves? | {
"domain": "chemistry.stackexchange",
"id": 16990,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "food-chemistry",
"url": null
} |
neural-network, preprocessing
Andrej Karpathy: The Unreasonable Effectiveness of Recurrent Neural Networks.
Christopher Olah: Understanding LSTM Networks.
Hochreiter, Schmidthuber: Long short-term memory.
Another idea (which I have not tested so far and just came to my mind) is using a histogram approach: You could probably make fixed-size windows, get the data from those windows and make it discrete (e.g. vector quantization, k-means). After that, you can make a histogram of how often those vectors appeared.
You could also use HMMs for recognition of variable length data.
Transformations (e.g. Fourier transform from the time domain in the frequency domain) might also come in handy. | {
"domain": "datascience.stackexchange",
"id": 659,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-network, preprocessing",
"url": null
} |
javascript, random
r = (255 - parseInt(colour.substring(0,2), 16)).toString(16);
g = (255 - parseInt(colour.substring(2,4), 16)).toString(16);
b = (255 - parseInt(colour.substring(4,6), 16)).toString(16);
...
}
You want to create variables and set the values directly if there is nothing else to do in between both actions:
var r = (255 - parseInt(colour.substring(0,2), 16)).toString(16); | {
"domain": "codereview.stackexchange",
"id": 29965,
"lm_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, random",
"url": null
} |
java, primes, junit, guava, bitset
public boolean get(BigInteger index) {
return bitSet.get(calculateIndex(index));
}
public void set(BigInteger index) {
bitSet.set(calculateIndex(index), true);
}
public boolean get(long index) {
return get(BigInteger.valueOf(index));
}
public void set(long index) {
set(BigInteger.valueOf(index));
}
private int calculateIndex(BigInteger index) {
if (getEndIndex().compareTo(index) <= 0
|| getStartIndex().compareTo(index) == 1) {
throw new IndexOutOfBoundsException("Invalid position");
}
// This should not be a problem since we are ensuring that the count
// Is less than MAX_SIZE, which is an integer
return (int) (index.subtract(getStartIndex()).longValue());
}
public void clear() {
bitSet.clear();
}
public int getSize() {
return size;
}
public BigInteger getStartIndex() {
return startIndex;
} | {
"domain": "codereview.stackexchange",
"id": 15066,
"lm_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, primes, junit, guava, bitset",
"url": null
} |
2. Relevant equations
W = F * x
U = mgy
K = 1/2(mv^2)
U1 + K1 + Wother = U2 + K2
3. The attempt at a solution
I think there are some typo errors from the back of the book:
a.) What is the work done on the oven by the force F?
W = F * x
W = 120N * (14.0cos(37)) <<<< (x component)
W = 1341.71 J
(the answer at back of book is 1690J)
b.) What is the work on the oven by the friction force?
Ff = ukn = 0.25(12.0kg)(9.8m/s^2) = 29.4N
Wf = Ff ( x)
Wf = (29.4N * 14.0cos(37))
Wf = 328.72J = 329J
(the answer at back of book is 329J)
c.) Compute the increase in potential energy for the oven.
U2 = mgy2 = (12.0kg)(9.8m/s^2)(14.0sin(37)) = 990.8J = 991J
(the answer at back of book is 991J)
d.) Use your answers to parts (a), (b), and (c) to calculate the increase in the oven's kinetic energy.
U1 + K1 + Wother = U2 + K2
0 + 0 + (WF - Wf ) = U2 + K2
1341.71 J - 329J - 991J = K2
K2 = 21.71J
(the answer at back of book is 360J) | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307747659751,
"lm_q1q2_score": 0.8288059007460586,
"lm_q2_score": 0.8519527982093666,
"openwebmath_perplexity": 3320.424187498014,
"openwebmath_score": 0.47822731733322144,
"tags": null,
"url": "http://www.physicsforums.com/showthread.php?t=182548"
} |
• (1) How "the same holds...", as CS theorem is for sequences? I suppose $\;\theta\;$ is fixed here, so I understand how the extension of CS holds (please do correct me if I'm wrong). (2) Also, why can you deduce unif. continuity? As far as I understand for UC we should evaluate the differences $\;|f(x)-f(y)|\;$ , and here the values of the varialbes are $\;l1\;$ unit away: x,\,x+1\;$...I guess that "approx. 1-periodic" thingy is unclear to me. (3) The last equality with the big "O" is incomprehensible to me, too. – DonAntonio Dec 25 '17 at 10:26 • @DonAntonio: is it clear that a continuous and$1$-periodic function is uniformly continuous? Well, here it is almost the same. We have$\lim_{n\to +\infty}\frac{f(n+\theta)}{n+\theta}=0$for any$\theta\$, we just have to "stick these limits together" by exploiting UC. – Jack D'Aurizio Dec 25 '17 at 10:39 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9879462215484651,
"lm_q1q2_score": 0.8455349014056343,
"lm_q2_score": 0.8558511414521922,
"openwebmath_perplexity": 485.6861347853442,
"openwebmath_score": 0.9024708271026611,
"tags": null,
"url": "https://math.stackexchange.com/questions/2579511/if-f-is-continuous-and-lim-limits-x-to-inftyfx1-fx-0-does-this-mea"
} |
observational-astronomy, supernova, identify-this-object, dust
POSSIBLE NOVA IN NGC 3314
W. C. Keel, University of Alabama; and L. M. Frattare, Space
Telescope Science Institute, on behalf of the Hubble Heritage Team,
report the detection of a possible nova in the overlapping galaxy
pair NGC 3314A and 3314B. HST WFPC2 observations with the F450W,
F555W, and F675W filters on Mar. 10.47-10.57 UT show a new stellar
object that was not present on WFPC2 F450W (to B about 25.5) and
F814W images from 1999 Apr. 4. Standard (approximate)
transformations to the UBV system give magnitudes B = 22.42, V =
21.64, R = 20.87. The new object is located at R.A. =
10h37m12s.82, Decl. = -27o40'51".5 (equinox 2000.0), which is 1".2
west and 10".3 north of the optically brighter foreground nucleus
of NGC 3314A (itself at position end figures 12s.91, 41'01".8). tl;dr No additional data of interest, but I explain how I searched, and I can explain the green color. | {
"domain": "astronomy.stackexchange",
"id": 4610,
"lm_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, supernova, identify-this-object, dust",
"url": null
} |
java, game, number-guessing-game
I would back it up with the actual Java conventions, but for some reason that document has been offline for almost a few weeks by now.
Redundancy
"Please use 'y' for yes or 'n' for no."
"Play again? (y/n)"
This seems a little redundant. I suggest either removing the entire first line or, if you really want to keep it, to remove the "y/n". But people know by now what "y/n" means so I'd prefer to simply remove the first line.
Boolean is boolean
When I look at a variable named playAgain, I expect it to tell me "yes" or "no". I don't expect it to possibly tell me "b".
Therefore I suggest changing it to this:
boolean playAgain = keyboard.NextLine().toLowerCase().startsWith("y");
Notice how I also added toLowerCase() so "Y" is also accounted for, and used startsWith() to make the code more descriptive.
It's ongoing
This is a very minor remark so feel free to ignore the advice it if you think it isn't important.
Your while loop does this:
while (!gameEnded) | {
"domain": "codereview.stackexchange",
"id": 7035,
"lm_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, game, number-guessing-game",
"url": null
} |
c++, beginner, csv
Title: Basic CSV Parser in C++ This was written down solely as a mean to practice basic C++ and isn't meant to serve any production purposes. Clearly, the implementation can't handle all input formats: it always expects the CSV to have a header line, it doesn't treat quoted commas well, the file has to have a newline in the end, hardcoded separator, etc.
I'm mostly interested in what am I doing wrong from the effectiveness and idiomatic perspective. I'm sure there's something wrong even with these 60 lines. For instance, I don't like the mech of filling data, I feel there's too much tossing stuff around.
Do I feel right about it? Can it be done in a more concise and effective way? Anything else, maybe like a forgotten const, or a totally non-idiomatic way to do something?
In short, how can I make this code (and subsequently, my C++) better? Thank you.
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <fstream>
#include <sstream>
#include <stdexcept> | {
"domain": "codereview.stackexchange",
"id": 41437,
"lm_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, csv",
"url": null
} |
### jbriggs444
Yes, that is exactly what I had in mind. Nothing fancy.
However, you may want to check your equations. The integral of $50x$ is not $\frac{5}{2}x^2$
6. Sep 22, 2015
### SteamKing
Staff Emeritus
There are formulas for calculating the area under a parabolic curve, just like there are formulas for calculating the area of a triangle.
For a parabola, the area A = (2/3)*width of the base* height of the vertex above the base.
In your case, the width of the base = 50 units
https://en.wikipedia.org/wiki/Parabola
7. Sep 25, 2015
### Ocata
Thank you jbriggs444 and SteamKing,
I was able to apply your advice and generate the function for the parabola given the x - intercepts and area. Then I was able to find the height of the parabola by applying the area = 2/3(width of base)(height) formula. Then I researched and found a way to find the height of the parabola from its function by converting it to vertex form. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9808759654852756,
"lm_q1q2_score": 0.8639526811889524,
"lm_q2_score": 0.8807970748488297,
"openwebmath_perplexity": 333.6152551508196,
"openwebmath_score": 0.7822003364562988,
"tags": null,
"url": "https://www.physicsforums.com/threads/how-to-create-a-function-such-that-area-under-curve-is-250.833834/"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.