text stringlengths 1 1.11k | source dict |
|---|---|
astrophysics, n-body-simulations, modeling
But $10^7\,M_\odot$ is only the upper limit of the mass range of the molecular clouds from which stars are born, so how can you ever simulate star formation, which is important not only if you're interested in stellar populations and galaxy luminosities, but actually also affects the galaxy masses through their feedback which may push gas out of the galaxies?
The answer is that you use results from observations, analytical models, and lower-volume, higher-resolution simulations that teach you how stars are formed and how they affect the gas around them. From these you know for instance that gas needs to be 1) dense and 2) cold, in order to form a star. In your huge simulation you can then say "If the density of gas particles exceeds a certain threshold, and their temperature is below some threshold, and if they have a negative velocity gradient, then (a fraction of) the gas particles should be converted to star particles." | {
"domain": "astronomy.stackexchange",
"id": 7099,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astrophysics, n-body-simulations, modeling",
"url": null
} |
particular, $$X^{\ast\ast}$$ would be isomorphic to $$(X^{\ast\ast}/X)\oplus X$$), and thus $$Y$$ would also be isomorphic to a (complemented) subspace of the separable dual space $$X^{\ast\ast}$$ - a contradiction. | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9825575173068326,
"lm_q1q2_score": 0.8078481108423109,
"lm_q2_score": 0.8221891305219504,
"openwebmath_perplexity": 234.97518500385408,
"openwebmath_score": 0.9333131313323975,
"tags": null,
"url": "https://mathoverflow.net/questions/404226/banach-spaces-whose-second-conjugates-are-separable"
} |
php
Title: Conditionally separate array keys and values into separate arrays Actually, I don't like to write for/foreach.
I had to write a loop. I would like to replace it with array_map/array_walk.
The code:
foreach ($data as $key => $value) {
if(isset(static::$specialKeywords[$value])) {
unset($data[$key]);
$check['specialKeys'][] = $key;
$check['specialValues'][] = $value;
continue;
}
$check['keys'][] = $key;
$check['values'][] = $value;
} Mapping is basically walking on an element set (array) and manipulating it. Your case is a filtering. I would prefer using foreach since it's more readable, but if you don't want to use foreach try using array functions then. Find the intersect stack then get a diff to generate your clean array. And just getting keys and values to generate the ultimate array you want.
<?php | {
"domain": "codereview.stackexchange",
"id": 20479,
"lm_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
} |
homework-and-exercises, electrostatics, potential
The pattern where a plate connected to ground has no charge on its outside surface is because of this property of ground.
When there is an electric field in a region of space, there is energy stored in that space with an energy density proportional to the square of that electric field. That is the reason why like charges want to spread out: they want to reduce the strength of the field they produce.
When a plate is not connected to ground, charge collects on its outside surface. This charge produces an electric field that fills space. When it is connected to ground, however, a new lower energy configuration becomes available: The charges that formerly lived on the outside surface can flow to ground at a very low energy cost. And the energy gain is quite large: all the energy that used to be stored in the electric field around the plate has been released.
You should be able to solve many problems of this type by keeping the following three principles in mind: | {
"domain": "physics.stackexchange",
"id": 51244,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, electrostatics, potential",
"url": null
} |
java, sorting
ArrayList<BudgetItem> organizableList = new ArrayList<BudgetItem>();
public OrganizeRegister(ArrayList<BudgetItem> organizableList) {
this.organizableList = organizableList;
}
public ArrayList<BudgetItem> dateOldestToNewest() {
for(int i = 0; i<organizableList.size(); i++) {
for(int j = 1; j<organizableList.size(); j++) {
GregorianCalendar g1 = organizableList.get(j-1).getDateOfTransaction();
GregorianCalendar g2 = organizableList.get(j).getDateOfTransaction();
if(g1.after(g2)) {
BudgetItem temp = organizableList.get(j-1);
organizableList.set(j-1, organizableList.get(j));
organizableList.set(j, temp);
}
}
}
return organizableList;
} | {
"domain": "codereview.stackexchange",
"id": 6804,
"lm_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, sorting",
"url": null
} |
homework-and-exercises, tensor-calculus, special-relativity, stress-energy-momentum-tensor
if you have repeated indices on the tensor, then you will end up with a scalar - and maybe that that scalar will be zero.
Contracting indices on a tensor does not necessarily give you a scalar and if it does that scalar is not necessarily zero. An important example is given by the contractions of the Riemann tensor:
$$ \begin{array}{lcl}
R_{\mu\nu} &\equiv& R^\alpha_{\ \mu\alpha\nu} \\
R &\equiv& R^\mu_\mu = g^{\mu\nu} R_{\mu\nu} = g^{\mu\nu} R^\alpha_{\ \mu\alpha\nu}
\end{array}$$
neither of which necessarily vanish. (They are physically important because they enter into Einstein's field equation of general relativity: $ R_{\mu\nu} - \frac{1}{2} g_{\mu\nu} R = 8\pi G T_{\mu\nu}$).
I think that $g_{\nu\sigma}g^{\mu\sigma} = \delta^\nu_\mu$ and $\frac{p^\mu n_\nu + p_\nu n^\mu}{p \cdot n}$ I think, is simplified as far as it can go.
I think you mean $\delta^\mu_\nu$, which is numerically equal to $\delta^\nu_\mu$, but still different. :) Otherwise you're correct. | {
"domain": "physics.stackexchange",
"id": 6822,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, tensor-calculus, special-relativity, stress-energy-momentum-tensor",
"url": null
} |
fft, phase, radar, linear-phase
Title: FMCW radar: Linear phase change determination with sinusoidal decomposition I am struggling to understand how linear phase shift can be determined with a transform whose main purpose is to determine frequencies rather than rate of change of a function.
In FMCW radar, received signal corresponding to a chirp is passed through a mixer and the resulting beat frequency is sampled by means of ADC. The samples are stored in a row of a matrix. Similarly, samples from other chirps are stacked up in corresponding rows. Different objects at different locations produce different frequencies (thanks to Doppler). So a FFT of each row yields dominant frequency bins. The frequency bins directly relate to object range. Absolutely fine so far. | {
"domain": "dsp.stackexchange",
"id": 8731,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fft, phase, radar, linear-phase",
"url": null
} |
ros, ros-melodic, service
bool AddTwo::client_call(int a, int b)
{
ROS_INFO("Calling Server...");
this->sc_.waitForExistence();
beginner_tutorials::TwoIntsCustom srv;
srv.request.a = a;
srv.request.b = b;
if (this->sc_.call(srv))
{
ROS_INFO("SC: Sum: %ld", (long int)srv.response.sum);
}
else
{
ROS_ERROR("SC: Failed to call service add_two_ints");
return 1;
}
}
bool AddTwo::spin_server()
{
this->ss_ = nh_.advertiseService("add_two_ints", &AddTwo::add, this);
ROS_INFO("Ready to add two ints.");
ros::spin();
return 0;
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "add_two_ints_server");
ros::NodeHandle nh, private_nh("~");
AddTwo at = AddTwo(&nh, &private_nh);
at.ss_thread_ = new boost::thread(
boost::bind(&AddTwo::spin_server, &at));
ros::Rate r (3.0);
for (int ia=0, ib=0 ; ia < 10 && ib < 10 ; ia++, ib++)
{
ROS_INFO("Main calling server with: a=%d, b=%d ....", ia,ib);
at.client_call(ia,ib);
r.sleep();
}
return 0;
} | {
"domain": "robotics.stackexchange",
"id": 34711,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-melodic, service",
"url": null
} |
c#, linq
foreach (DataItem add in added)
{
diffList.Add(new DiffItem(add.Data, "Add", null, add.Value));
}
foreach (DataItem rem in removed)
{
diffList.Add(new DiffItem(rem.Data, "Remove", rem.Value, null));
}
foreach (DataItem pre in diffPre)
{
DataItem post = diffPost.First(x => x.Data == pre.Data);
diffList.Add(new DiffItem(pre.Data, "Diff", pre.Value, post.Value));
}
} | {
"domain": "codereview.stackexchange",
"id": 26530,
"lm_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#, linq",
"url": null
} |
robotic-arm
Title: ARM raring nmea_navsat_driver rosdep
I am using a parallella embedded system that uses a cortex A9 ARMHF architecture and am trying to get nmea_navsat_driver to work. I can download the source for from github and rosmake it without any problems. When i catkin_make my project, no errors show up. But when i try to run nmea_navsat_driver, nothing show up when tabbing for rosrun/roslaunch. So i tried to install the debian package for nmea_navsat_driver through sudo apt-get install, but i am getting a rosdep error saying: "ros-hydro-nmea-navsat-driver : Depends: python-serial but it is not installable". I tried to find and install python-serial from source, but had no luck in finding where the source is located. If i try to do "rosdep install python-serial" it tells me "ERROR: Rosdep cannot find all required resources to answer your query. Missing resource python-serial" and then lists my ROS path [0] = /opt/ros/hydro .... and so forth. | {
"domain": "robotics.stackexchange",
"id": 19096,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "robotic-arm",
"url": null
} |
graphs, data-structures, computability, reductions
Title: edge-coloring and vertex-coloring reduction problem I study complexity and computation independently.
I have a problem that I can not solve.
That's the problem: | {
"domain": "cs.stackexchange",
"id": 18739,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "graphs, data-structures, computability, reductions",
"url": null
} |
programming-languages, proof-techniques, formal-methods
Title: How to prove that replacing a character in a string in both C and JavaScript is equivalent? I would like to try some different proofs, specifically in proving equivalence of the implementation of some feature in two different programming languages (C and JS in this question).
This is about proving that replacing one character in a string is equivalent in C and JS.
In JS, for example, strings are immutable, while in C, strings are mutable. So in JS you might have to do this:
functioni replaceAt(string, index, replacement) {
return string.substr(0, index) + replacement + string.substr(index + replacement.length)
}
While in C you might just do something like this:
#include<stdio.h>
int
main() {
char string[11] = "hello world";
string[1] = 'i';
printf("%s", string);
return 0;
} | {
"domain": "cs.stackexchange",
"id": 16274,
"lm_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-languages, proof-techniques, formal-methods",
"url": null
} |
mechanical-engineering, electrical-engineering, motors
Title: Running 220V single phase motor on 240V, and did I burn it? I have a motor thats rated for 220V single phase. My house has 240V single phase. Im trying to run this motor but it doesn't budge and I don't even hear a hum. I know power is getting to it from checking with a multimeter. Could it possibly have burned from too high of voltage?
Secondly, if wired improperly, say, ground was accidentally switched with one of the hot wires running to the motor, could this somehow burn the motor?
Not sure whats going on with this thing, and I don't see any reset buttons either or fuses either.
Thanks. for short periods, 240VAC will not burn out a 220VAC motor. furthermore, switching the polarity of the wires will not blow up the motor. here are the things to check: | {
"domain": "engineering.stackexchange",
"id": 3595,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mechanical-engineering, electrical-engineering, motors",
"url": null
} |
ros, opencv, ros-electric
Originally posted by Stephan with karma: 1924 on 2012-03-27
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 8632,
"lm_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, opencv, ros-electric",
"url": null
} |
thermodynamics, statistical-mechanics, pressure, work, reversibility
However, the author does not give any explanation for how he figured out that the difference between $p_{gas}$ and $p_{piston}$ results in a irreversible process. In other words, I was given this question without the solution, how should I suppose to identify that there is a nonzero contribution to the entropy production coming from the work done by the pressure difference? The difference between the two pressures integrates to a residual force whose work is invested in accelerating the piston. However, at the end of the process the piston is static, so there must exist additional resisting forces acting during the process in the opposite sense, and it must hold that work done by the resisting forces must be equal to (minus) the work done by the residual force, as their sum results in zero change in the total kinetic energy. | {
"domain": "physics.stackexchange",
"id": 65523,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, statistical-mechanics, pressure, work, reversibility",
"url": null
} |
qiskit, simulation
Title: In qiskit, doing 2 subsequent measurements of a Hadamard gate on the same qubit always gives 0 on the 2nd one When I execute the following circuit, I expect that in both classical registers, the content is identical.
q = QuantumRegister(1)
c = ClassicalRegister(2)
circuit = QuantumCircuit(q, c)
circuit.h(q[0])
circuit.measure(q[0], c[0])
circuit.measure(q[0], c[1])
backend = BasicAer.get_backend('qasm_simulator')
job = execute(circuit, backend, shots=100)
result = job.result()
counts = result.get_counts(circuit)
print(counts) | {
"domain": "quantumcomputing.stackexchange",
"id": 1051,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "qiskit, simulation",
"url": null
} |
optics, visible-light, water, lenses, microscopy
So if we use the magnification of ~4-5 I mentioned above, something that is acutally ~0.055-0.075 mm in size would appear to be ~0.22-0.30 mm through an ideal water droplet. To put it another way, assuming the above and ideal conditions, the smallest resolvable objects through a water droplet would be ~0.011-0.015 mm.
With all that in mind, I note that the size range of single-celled organisms is rather large. There are bacteria that have cell diameters of less than a micron while some protozoans can be more than 100 microns.
Thus, in principle, it is possible that a large, single-celled organism was magnified and visible to your naked eye through the water droplet and your glass lense. However, I still maintain the more likely explanation is that there were some micro-animal-like critters on your glasses that were magnified by the water droplet.
Side Note | {
"domain": "physics.stackexchange",
"id": 80376,
"lm_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, visible-light, water, lenses, microscopy",
"url": null
} |
fourier-transform, python, window-functions, stft
Elapsed real time is always noisy since it highly depends on what else is going on on the system, that interrupts are happening and how long it takes to serve them, who the processes and threads are time sliced etc. | {
"domain": "dsp.stackexchange",
"id": 11181,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fourier-transform, python, window-functions, stft",
"url": null
} |
True Fact. If $$f\in C^\alpha$$ there exist $$g\in C^\alpha$$ and constants $$c_{\epsilon,A}$$ such that $$H_{\epsilon, A}f(x)-c_{\epsilon, A}\to g(x)$$ for every $$x$$.
I'm not going to show that $$g\in C^\alpha$$ here; that's contained in my previous answer. But I will show that the limit $$g(x)$$ exists (and is finite) for every $$x$$; this resolves the contradiction given by supinf: If he'd defined $$Hf=g$$ then he would not have obtained $$Hf=-\infty$$.
Define $$H=\int f(x-y)\frac{dy}y=\int_{-\infty}^{-1}+\int_{-1}^1+\int_1^\infty=H^{-}+H^0+H^+.$$
First, $$H^0$$ is no problem. If we say $$H_\epsilon^0=\int_{\epsilon<|y|<1}$$ then $$H^0f(x)-H_\epsilon^0f(x)=\int_0^\epsilon (f(x-y)-f(x+y)\frac{dy}y;$$since $$f(x-y)-f(x+y)=O(y^\alpha)$$ this shows that in fact $$H_\epsilon^0 f\to H^0f$$ uniformly. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9748211553734217,
"lm_q1q2_score": 0.8398456709831067,
"lm_q2_score": 0.8615382076534742,
"openwebmath_perplexity": 342.0821256858989,
"openwebmath_score": 0.9600426554679871,
"tags": null,
"url": "https://math.stackexchange.com/questions/3108648/h%C3%B6lder-norm-of-the-hilbert-transform"
} |
2. ## Re: Possible mathematical induction problem
Course: Foundations of Higher MAth
Prove that $24|(5^{2n} -1)$ for every positive integer n.
This is a question from my final exam today.
P(n): $24|(5^{2n}-1)$
P(1): $24|(5^2 -1)$ is a true statement.
Assume P(k) is true. Then $5^{2k}-1 = 24a$ for some integer a.
Then $5^{2k}= 24a + 1$
P(k+1): $24|(5^{2(k+1)}-1)$
$5^{2(k+1)}-1=5^{2k+2}-1=5^{2k}*5^2-1$
$=(24a + 1)*25 -1$
$=(24a)(25)+25 -1$
$=(24a)(25)+24$
$=24(25a+1)$
$=24b$
Therefore, $24|(5^{2(k+1)}-1)$. By PMI, P(n) is true for every positive integer n.
None of my friends used this method though. Is this a correct way to do it?
A strict grader may like to have seen more grouping symbols.
However, the argument is correct. | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9875683491468141,
"lm_q1q2_score": 0.8632110170177555,
"lm_q2_score": 0.8740772400852111,
"openwebmath_perplexity": 1136.2313487223958,
"openwebmath_score": 0.5691136121749878,
"tags": null,
"url": "http://mathhelpforum.com/discrete-math/224780-possible-mathematical-induction-problem.html"
} |
ising-model, majorana-fermions, integrable-systems, spin-models, spin-chains
Title: Zero modes $a_j\sim e^{-\kappa j}$ in a semi-infinite quantum Ising chain? As a way of analyzing the performance of quantum annealing, I've been studying quantum diffusion in fermionizable lattice models with zero modes.
In particular, the 1+1D quantum Ising model, semi-infinite in the spatial direction, is the simplest possible example of a fermionizable lattice model with a zero mode just outside of its paramagnetic phase. However, I've been having trouble producing these modes in ab initio calculations. I have that the semi-infinite quantum Ising model is dual to the non-interacting fermion model
$$H=i\sum_{j\geq 1}\left(B\gamma_{2j-1}\gamma_{2j}+J\gamma_{2j}\gamma_{2j+1}\right)\in \mathfrak{spin}_\infty$$ | {
"domain": "physics.stackexchange",
"id": 34939,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ising-model, majorana-fermions, integrable-systems, spin-models, spin-chains",
"url": null
} |
c++, game-of-life, opengl
}
//will look for 3 neighbors of the SAME species to ressurect a dead cell
//return the species that has 3 neighbors to this cell OR return 0 if condition not met
int Grid::Reproduce(int x, int y) {
int xStart = std::max(x - 1, 0);
int xFinish = std::min(x + 1, WIDTH - 1);
int yStart = std::max(y - 1, 0);
int yFinish = std::min(y + 1, HEIGHT - 1);
for (int i = 1; i <= species; i++) {
int numOfLivingNeighbors = 0;
for (int curY = xStart; curY <= xFinish; curY++) {
for (int curX = yStart; curX <= yFinish; curX++) {
if (checkCell(curY, curX) != 0) {
//check if same species and ignore itself
if (checkCell(curY, curX) == i && !(curY == x && curX == y)) {
numOfLivingNeighbors++;
}
}
}
}
if (numOfLivingNeighbors == 3) {
return i;
}
}
return 0;
} | {
"domain": "codereview.stackexchange",
"id": 22349,
"lm_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++, game-of-life, opengl",
"url": null
} |
java, algorithm, primes
System.out.println("Conducted search in " + (System.currentTimeMillis() - start)/1000 + " seconds.");
}
I've optimized everything I can think of, but I wanted to get a second opinion. Answer by janos is good, but is more about style. Here are some functional/performance observations related to your stated goal of efficiency. | {
"domain": "codereview.stackexchange",
"id": 16505,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, algorithm, primes",
"url": null
} |
is associated with two distinct arrangements in the circular setup. Thus, we separate the arrangement into two cases. The first is when all the non-empty bins are placed in inner gaps and the second is when one non-empty bin is placed in the outer gap. This gives the total number of ways as, $$\left[\binom{m-n}{n}-\binom{m-n-1}{n}\right]\times2 +\binom{m-n-1}{n} =2\times\binom{m-n}{n}-\binom{m-n-1}{n}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363540453381,
"lm_q1q2_score": 0.8286395844512893,
"lm_q2_score": 0.8418256432832333,
"openwebmath_perplexity": 124.90835940836189,
"openwebmath_score": 0.7750139832496643,
"tags": null,
"url": "https://math.stackexchange.com/questions/1549648/number-of-ways-to-place-n-balls-in-m-bins-such-that-no-two-balls-are-placed"
} |
thermodynamics, entropy
Edit: I have another question related to equation 2; the textbooks have substituted TdS for dQ in the first law of thermodynamics. However, dQ is equal to TdS only for reversible processes. So how does equation 2 make sense in the context of irreversible processes? (Such as free expansion) The ideal gas equation only applies to an ideal gas in a thermodynamic equilibrium state, and not to one that is rapidly deforming. The 2nd equation you wrote applies only to two closely neighboring thermodynamic equilibrium states of a system, and describes the relationship between the differential changes in U, S, and V between these adjacent states. Neither equation describes the intermediate changes along an irreversible path between two widely separated thermodynamic equilibrium states. So how do you determine the change in entropy between these two end states that are connected in practice by an irreversible path? | {
"domain": "physics.stackexchange",
"id": 29265,
"lm_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, entropy",
"url": null
} |
classification, dataset, unsupervised-learning, supervised-learning, class-imbalance
Title: Why will the accuracy of a highly unbalanced dataset reduce after oversampling? I have created a synthetic dataset, with 20 samples in one class and 100 in the other, thus creating an imbalanced dataset. Now the accuracy of classification of the data before balancing is 80% while after balancing (i.e., 100 samples in both the classes) it is 60%. What are the possible reasons for this? Imagine that your data is not easily separable. Your classifier isn't able to do a very good job at distinguishing between positive and negative examples, so it usually predicts the majority class for any example. In the unbalanced case, it will get 100 examples correct and 20 wrong, resulting in a 100/120 = 83% accuracy. But after balancing the classes, the best possible result is about 50%. | {
"domain": "datascience.stackexchange",
"id": 2672,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classification, dataset, unsupervised-learning, supervised-learning, class-imbalance",
"url": null
} |
4. ## The Partition Problem
This question is equivalent to finding all possible partitions of N, restricting the number of terms to 9.
Start with $N = n_1+2n_2+3n_3+4n_4+5n_5+6n_6+7n_7+8n_8+9n_9$
Define $m_i=n_i+n_{i+1}+...+n_8+n_9$ And you can see that $N=m_1+m_2+m_3+m_4+m_5+m_6+m_7+m_8+m_9$. In other words, all possible partitions of the number N with no more than 9 terms. By construction, $n_i=m_{i} - m_{i+1} \geq 0$ .
Example. Let N=8.
$m_1+m_2+m_3+m_4+m_5+m_6+m_7+m_8+m_9$
8
7 + 1
6 + 2
6 + 1 + 1
5 + 3
5 + 2 + 1
5 + 1 + 1 + 1
4 + 4
4 + 3 + 1
4 + 2 + 2
4 + 2 + 1 + 1 $\rightarrow n_1=4-2=2, n_2=2-1=1, n_3=1-1=0, n_4=1-0=1$ $\rightarrow 1(2)+2(1)+3(0)+4(1)=8$
4 + 1 + 1 + 1 + 1
3 + 3 + 2
3 + 3 + 1 + 1
3 + 2 + 2 + 1
3 + 2 + 1 + 1 + 1
3 + 1 + 1 + 1 + 1 + 1
2 + 2 + 2 + 2
2 + 2 + 2 + 1 + 1
2 + 2 + 1 + 1 + 1 + 1
2 + 1 + 1 + 1 + 1 + 1 + 1
1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9884918512747192,
"lm_q1q2_score": 0.8104578901653987,
"lm_q2_score": 0.8198933447152498,
"openwebmath_perplexity": 121.56147963114039,
"openwebmath_score": 0.5167189240455627,
"tags": null,
"url": "http://mathhelpforum.com/number-theory/88621-generating-combinations.html"
} |
electricity, capacitance
Now split the disk through the middle, i.e. turn it into the two plates of a capacitor, and connect a wire between the two outside faces, then switch on the external electric field again. Once more the disk gets polarised, but this time you get a transient current flowing from one side of the (now split) disk to the other through the wire. You end up with the same charge separation as before, but the electrons flowed through the piece of wire instead of through the body of the disk.
Finally, connect a battery in the middle of the piece of wire. This produces an electric field between the two sides of our split disk (i.e. capacitor), and just like the externally applied field it will polarise the disk and electrons will flow through the wire from one face of the disk to the other.
That's why when you connect a battery to a capacitor you get a transient current as the capacitor polarises. | {
"domain": "physics.stackexchange",
"id": 2650,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electricity, capacitance",
"url": null
} |
homework-and-exercises, statistical-mechanics, entropy, harmonic-oscillator
My gut tells me to do something like this to calculate the number of states,
$\frac{E}{N}=(\frac{1}{2}+\frac{N_E}{N})\hbar\omega$
from which, if I'm reading incorrectly that all having the same vibrational frequency means all vibrating at the same frequency and instead that if they vibrate they vibrate at the same frequency, I would extract that the fraction of particles vibrating to produce a system with a certain energy E would be given by $\frac{N_E}{N}=\frac{E}{N}-\frac{\hbar\omega}{2}$. The term subtracted from $\frac{E}{N}$ would represent a ground energy for each atom. The number of states that would satisfy this would be $N\choose N_E$, though I don't think this reduces to a nice number. The energy levels of a system of $N$ independent oscillators, all with the same frequency $\omega$, have the form
$$
E(n_1,\dots,n_N) = \sum_{i=1}^N \hbar\omega\left(n_i+\frac12\right),
$$
where $n_i$ is the number of quanta of energy in $i$-th oscillator. Hence, in your formula,
$$ | {
"domain": "physics.stackexchange",
"id": 57362,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, statistical-mechanics, entropy, harmonic-oscillator",
"url": null
} |
quantum-mechanics, condensed-matter, superconductivity
In a Josephson junction, current is related to phase difference between the two superconductors, again we need $\nabla\theta$, however London equations tell us current should be only related to vector potential $\vec{A}$. How can we make sense of this? The main point here is that the London equation in the form $\vec J(\vec r)=-\frac{\hbar}{m}\rho(\vec r)\vec A(\vec r)$ is not gauge invariant, hence it is valid only in a specific gauge, where you can set an homogeneous electric potential $\nabla\phi(\vec r)=0$. This is possible when you consider a simply connected superconductor domain in a magnetic field, but it is inappropriate when you describe multi-connected domains, like superconducting rings. In the latter case, you have indeed to use the more general expression | {
"domain": "physics.stackexchange",
"id": 52549,
"lm_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, condensed-matter, superconductivity",
"url": null
} |
electricity
If you now turn up the voltage, i.e. create a pressure gradient along the tube, gas will now start flowing just as electric current flows in a wire. The gas molecules are still whizzing around like crazy, but now there is a net flow along the tube just as you get a net flow of electrons in the wire.
Actually my analogy isn't so weird. Electrons in a metal can indeed be approximated as a free electron gas. The equivalent of the gas molecule velocities is the Fermi velocity of the electrons. | {
"domain": "physics.stackexchange",
"id": 3480,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electricity",
"url": null
} |
concentration, notation, units
Unit standardization
The dosage of biocide required was previously provided in ppm by weight for Biobor® JF and by ppm by volume for Kathon® FP 1.5.
There is now industry-wide agreement to use mL/L unit for both Biobor® JF and Kathon® FP 1.5 biocides.
Airbus maintenance procedures for all Airbus aircraft, the AMM for
A300/A310/A320/A330/A340/A380, MP for A350 aircraft and AMP for A220
aircraft, were updated accordingly by removing the use of the ppm unit.
Luckily, the plane managed to land safely and there were no human casualties.
This accident made the aircraft manufacturer to take action against using ppm notation in the future versions of technical documentation, and include transparent definitions for the “parts-per” notations still used in the current service manuals [4, p. 105].
References | {
"domain": "chemistry.stackexchange",
"id": 11766,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "concentration, notation, units",
"url": null
} |
# Simple integration question.
integrate
$$\int \sin(x) \cos(x)\; dx$$
using $u$-substitution.
If i take $u = \sin(x)$ I get final answer to be $\sin^2(x) / 2 + c$
But If i take $u = \cos(x)$ I get final answer to be $-\cos^2(x) / 2 + c$
Are they equal? They should be, otherwise it does not make sense. But how are they equal?
-
Do they differ by a constant? – David Mitra Dec 16 '12 at 3:08
Note that the $c$ in the first answer need not be the same as the $c$ in the second answer. – asmeurer Dec 16 '12 at 6:39
The symbol $\int f(x) dx$ does not denote a function, but rather the set of all functions $F(x)$ that satisfy $F'(x)=f(x)$. Hence, any two functions in this set may differ by a constant. In your particular example, note that $\sin^2(x)/2 -(-\cos^2(x)/2)=1/2$.
Remember that for two derivable functions $\,f(x)\,,\,g(x)\,$ on some open interval $\,I\,$, we have that
$$\forall\,x\in I\;\;,\;f'(x)=g'(x)\Longleftrightarrow f(x)=g(x)+C\,\,,\,C=\,\text{ a constant}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9859363731633717,
"lm_q1q2_score": 0.8216050352915261,
"lm_q2_score": 0.8333246015211008,
"openwebmath_perplexity": 105.09044041164795,
"openwebmath_score": 0.9463697075843811,
"tags": null,
"url": "http://math.stackexchange.com/questions/259692/simple-integration-question"
} |
python, numpy, pandas, cython, matplotlib
# Run the game
##############
start = time.time()
# Clear previous results if they exist
if os.path.exists(c.store_path):
os.system('rm ' + c.store_path)
# Create new store
store = pd.HDFStore(c.store_path)
# Randomly place `1`s throughout the map
Z = np.random.randint(0, 2, (c.rows, c.cols)).astype(np.int32)
Z[0, :] = 0 # Clear boarders-- will act as a boundary
Z[-1, :] = 0
Z[:, 0] = 0
Z[:, -1] = 0
for i in range(c.n_chunks):
print 'Chunk', i
# Initialize Z_chunk
lbls_iter = ['iter%05i'%(k) for k in range(c.chunk_size * i,
c.chunk_size * i + c.chunk_size)]
columns = pd.MultiIndex.from_product([lbls_iter, c.lbls_col], names=['iter', 'col'])
Z_chunk = DataFrame(index=c.lbls_row, columns=columns, dtype=np.int32)
for j in range(c.chunk_size):
Z_chunk.loc[:, lbls_iter[j]] = iterate(Z, c)
store['chunk%03i'%i] = Z_chunk
print 'Life lasted: ', time.time() - start
# View results
############## | {
"domain": "codereview.stackexchange",
"id": 15177,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, numpy, pandas, cython, matplotlib",
"url": null
} |
awk
Running that on your file returns:
1 736689 . T A 0/0:37:1.224:2.367:0.054:0.0:108:0.00:4.75:0.53:0.00:T,37,2.367:37,0 1/0:33:1.099:3.320:0.091:358.5:359:0.59:4.34:0.59:0.08:A,15,1.149,T,18,2.171:18,15 0|0:30:0.999:1.314:0.033:0.0:87:0.00:1.16:0.00:0.00:T,30,1.314:30,0 0|1:31:1.032:2.299:0.065:211.5:212:2.61:0.48:0.07:0.43:A,12,0.124,C,1,0.010,T,18,2.165:18,12 0|1:37:1.232:2.374:0.054:263.2:263:1.47:8.69:0.06:0.05:A,16,1.160,T,21,1.214:21,16 0|0:43:1.423:2.447:0.047:0.0:98:0.20:0.83:0.45:0.00:A,1,0.010,T,42,2.437:42,1 0|1:40:1.323:3.393:0.075:280.5:281:1.95:2.36:3.47:0.27:A,17,1.175,T,23,2.219:23,17 | {
"domain": "bioinformatics.stackexchange",
"id": 1118,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "awk",
"url": null
} |
javascript, optimization, jquery, performance
//CONTACT PANEL---------------------------------------------------
var fadeInContact = function() {
$('#contact').animate({width: 'toggle'});
};
$(".contact_btn").click(function () {
if($('#about').css("display") == "block") {
$('#about').fadeOut(10);
fadeInContact();
} else if($('#submit').css("display") == "block") {
$('#submit').fadeOut(10);
fadeInContact();
} else {
fadeInContact();
}
});
$(".contactclose").click(function () {
fadeInContact();
});
//---------------------------------------------------------------
}); I have a few suggestions.
1. Always cache your jquery objects if you are going to select the same thing more than once.
For example:
if($('#submit').css("display") == "block") {
$('#submit').fadeOut(10); | {
"domain": "codereview.stackexchange",
"id": 7654,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, optimization, jquery, performance",
"url": null
} |
fluid-dynamics, fluid-statics, geophysics, oceanography
I must admit I'm not sure about the last of these as it seems to me it would be a very small effect. Finally, another longer term effect I've seen mentioned in some discussions is that land rises as it's freed from the weight of the ice. The north of the UK is still rising, and the south still sinking, after the ice melted at the end of the last ice age. | {
"domain": "physics.stackexchange",
"id": 55682,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, fluid-statics, geophysics, oceanography",
"url": null
} |
Suppose that the sum of the two left digits is some number $S$, with $S < 10$. How can you write $S$ as a sum of two 1-digit numbers, $S = a + b$, if $a$ represents the first digit of your number and $b$ the second? Well, the only restrictions are $1 \leq a \leq 9, 0 \leq b \leq 9$. Also, as soon as you fix the value for $a$, the value for $b$ becomes determined: $b = S - a$ hence one can only think of the possible values for $a$. But given that $S < 10$, $a$ can take any value in $1, 2, \cdots, S$. So if the sum is $S, S < 10$, there are $S$ possible arrangements for the left side of the number. What about the right side? Well, using a similar argument, but because the rightmost digit can be $0$, you see there are $S+1$ arrangements for the right hand side. Thus we know that part of our result is $\sum_{S=1}^{9} S(S+1) = 330$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9678992951349231,
"lm_q1q2_score": 0.8023292944197182,
"lm_q2_score": 0.8289388146603364,
"openwebmath_perplexity": 247.82483107765515,
"openwebmath_score": 0.8675252795219421,
"tags": null,
"url": "https://math.stackexchange.com/questions/2075664/in-how-many-4-digit-numbers-the-sum-of-two-right-digits-is-equal-to-the-sum-of"
} |
roslaunch, rosnode
Original comments
Comment by Felix_N on 2017-06-28:
This is strange, because your node clearly is assigned to your package.
Can you try only typing
just to test if that works?
I'm fairly new to ROS, but I launch all my executables that way.
I managed to solve the problem. For some reason (build related or my own doing some time earlier), there was a broken symlink to the executable file inside my src folder. Once I deleted that, the launch file started working fine. I guess the important take-away here is that when you launch a node from a launch file, it does actually look inside your src folder for the executable before moving onto the devel/lib folder.
Originally posted by Ali250 with karma: 41 on 2017-06-29
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 28222,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "roslaunch, rosnode",
"url": null
} |
I understand we can select one pair out of 10 in $\binom{10}{1}$ ways. We select both shoes from this pair. Then we can select six pairs out of remaining nine in $\binom{9}{6}$ ways. We can select any one out of two shoes of each of six pairs in $2^6$ ways. But I dont understand from where $\frac{8!}{2!}$ came.
Edit
The solution given at the back of the book is $0.4268$. But books solution manual solves it as $\frac{\binom{10}{1}\binom{9}{6}\color{red}{\frac{8!}{2!}}2^6}{20\times19\times18\times17\times16\times15\times14\times13}$ which I just checked to be equal to $0.2133$. This pdf gives the solution as $\frac{\binom{10}{1}\binom{9}{6}\times 2^6}{\binom{20}{8}}$ which matches with $0.4268$. So now I am guessing what is correct answer and how can I get the answer for problem 2 by following same approach as I followed for problem 1.
Your text is in error. There should be no $8!/2!$ factor. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9381240177362488,
"lm_q1q2_score": 0.8366293556127367,
"lm_q2_score": 0.8918110396870288,
"openwebmath_perplexity": 467.2160849108258,
"openwebmath_score": 0.8354537487030029,
"tags": null,
"url": "https://math.stackexchange.com/questions/2821613/understanding-solution-to-the-probability-problem-from-sheldon-ross-book"
} |
statistical-mechanics, dirac-delta-distributions, partition-function
Title: How come that $\int \delta(H(p,q)-E)dpdq=\Omega(E)$ not infinity? In microcanonical ensembles we have (for one particle in 1 dimension)
$$\int \delta(H(p,q)-E)dpdq=\Omega(E)$$
I am not convinced and believe that this integral diverges. Take for example a harmonic oscillator in one dimension, with $H(p,q)=p^2/2+q^2/2=E$ ($m=k=1$ for simplicity). One can write the above integral as
$$\int f(p,q)dpdq$$
The integrand is $f(p,q)=\infty$ for all points $(p,q)$ with $H(p,q)=E$. Thus, one can think of $f(p,q)$ as a distribution with infinitely many (uncountably infinite) Dirac functions sprinkled around every point $(p,q)$ on the circle $H(p,q)=p^2/2+q^2/2=E$ (see figure). Each Dirac function will contribute 1 to the integral, but there are infinitely many of them on the circle so the integral will diverge. This argument is generalizable to higher dimensions. | {
"domain": "physics.stackexchange",
"id": 78768,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statistical-mechanics, dirac-delta-distributions, partition-function",
"url": null
} |
ros, kinect, rxbag
Original comments
Comment by darshb34 on 2020-05-13:
https://answers.ros.org/question/98611/rosbag-record-with-kinect-facing-a-disk-memory-space-problem/
I ran into similar issues when trying to record Kinect data. I'm not sure what's causing it - I assumed that the data was just too much. 10 seconds of data ended up in the gigabyte range if I recall correctly.
I ended up switching to the openni_camera_unstable driver, which is nodelet based. You can record the data at the image level, before it gets expanded to a 3D PointCloud beast.
The launch files (when I last looked) were a little confusing. I created a working set of record / playback launch files for that driver, which I can share if there's interest.
EDIT:
Here are some launch files for the unstable driver. They are mostly based on the existing launch files, but I've broken them up to allow modular recording:
http://robotics.ccny.cuny.edu/data/kinect/launch_modular/ | {
"domain": "robotics.stackexchange",
"id": 6122,
"lm_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, kinect, rxbag",
"url": null
} |
We can observe that $$2^{\lfloor a/2 \rfloor}$$ and $$2^{\lceil a/2 \rceil}$$ are simply powers of $$2$$ which are either equal or consecutive. Hence: $$2^{\lfloor a/2 \rfloor} \leqslant 2^{\lceil a/2 \rceil} \leqslant 2 \cdot 2^{\lfloor a/2 \rfloor}$$ Taking these bounds in our expression shows that any rational expressed in the given form must be between $$\frac{1}{2}$$ and $$1$$. Now, we will show that all rationals in $$[\frac{1}{2},1]$$ can be expressed in the given form by inducting over the size of the denominator.
The result holds good when the denominator is $$1$$ or $$2$$, by expressing $$1$$ and $$\frac{1}{2}$$ as they are. Now, assume that we are to show that $$\frac{x}{y}$$ can be expressed in the given form. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.98615138856342,
"lm_q1q2_score": 0.8362245823813034,
"lm_q2_score": 0.8479677583778257,
"openwebmath_perplexity": 308.5680885861725,
"openwebmath_score": 0.9254079461097717,
"tags": null,
"url": "https://math.stackexchange.com/questions/4080410/representing-all-rational-numbers-between-dfrac12-and-1"
} |
r
"Sonia Floyd", "Michael Kucuk", "Michael Kucuk"), FT1 = c("Stella Bowen",
"Stella Bowen", "Stella Bowen", "Stella Bowen", "Bethany Romero",
"Bethany Romero", "Bethany Romero", "Bethany Romero", "Bethany Romero",
"Bret Newton", "Bret Newton", "Bret Newton", "Bret Newton", "Bret Newton",
"Robin Clark", "Robin Clark", "Robin Clark", "Cristina Williamson",
"Cristina Williamson", "Cristina Williamson", "Cristina Williamson",
"Cristina Williamson", "Cristina Williamson", "Rosemary Warner",
"Rosemary Warner", "Rosemary Warner", "Rosemary Warner", "Yvette Morton",
"Yvette Morton", "Yvette Morton", "Yvette Morton", "Oscar Clarke",
"Oscar Clarke", "Oscar Clarke", "Oscar Clarke", "Oscar Clarke",
"Milton Mccormick", "Milton Mccormick", "Santos Sims", "Santos Sims",
"Santos Sims", "Santos Sims", "Santos Sims", "Bob Erickson",
"Bob Erickson", "Bob Erickson", "Connie Drake", "Connie Drake",
"Connie Drake", "Connie Drake", "Connie Drake", "Kristen Parsons", | {
"domain": "codereview.stackexchange",
"id": 32530,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "r",
"url": null
} |
• Do you have a specific example? You're generalising too much when there are a lot of limits you could simplify with L'Hopital's or Taylor series. – Toby Mak Dec 9 '18 at 5:29
• @TobyMak, I meant the limits where L'Hospital Rule cannot be applied. I'll add an example in a few minutes. I just wanted to know if there are certain situations where we should use Taylor Expansions. – Harshil Bhatt Dec 9 '18 at 5:34
• My point still holds. Generally speaking, if there are trigonometric functions such as $\sin x, \cos x, \ln x$, or exponential functions such as $e^x$ and $\ln x$, then the Taylor expansions will be easier. – Toby Mak Dec 9 '18 at 5:36
• Have a look to this small nightmare : math.stackexchange.com/questions/925916/… – Claude Leibovici Dec 9 '18 at 6:30 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9648551556203814,
"lm_q1q2_score": 0.8433579299241769,
"lm_q2_score": 0.8740772384450967,
"openwebmath_perplexity": 512.6000803160377,
"openwebmath_score": 0.8086636662483215,
"tags": null,
"url": "https://math.stackexchange.com/questions/3032030/when-should-i-use-taylor-series-for-limits"
} |
python, object-oriented, abstract-factory
class FootballPlayerFactory(PlayerFactory):
def create_goalkeeper(self):
return FootballGoalkeeper()
def create_defender(self):
return FootballDefender()
class HockeyPlayerFactory(PlayerFactory):
def create_goalkeeper(self):
return HockeyGoalkeeper()
def create_defender(self):
return HockeyDefender()
Football players
class FootballPlayer:
def __init__(self, uses_hands):
self.uses_hands = uses_hands
def play(self):
print("I'm playing football!")
class FootballGoalkeeper(FootballPlayer):
def __init__(self):
super(FootballGoalkeeper, self).__init__(uses_hands=True)
class FootballDefender(FootballPlayer):
def __init__(self):
super(FootballDefender, self).__init__(uses_hands=False)
Hockey players (my creativity stopped here, so I didn't include any difference between goalkeepers and defenders)
class HockeyPlayer:
def play(self):
print("I'm playing hockey!") | {
"domain": "codereview.stackexchange",
"id": 39115,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, object-oriented, abstract-factory",
"url": null
} |
thermodynamics, non-equilibrium, critical-phenomena
As a rule of thumb, anything 'critical' is interesting. This is because critical systems are strongly correlated and display emergent properties such as universality. You can't guess the collective behaviour by looking at single particles. Universality is not only fascinating, it is also really useful. Once you have identified your universality class, you can use a toy model for calculations and get accurate experimentally measurable predictions. | {
"domain": "physics.stackexchange",
"id": 47263,
"lm_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, non-equilibrium, critical-phenomena",
"url": null
} |
complexity-theory, formal-languages, reference-request
Finally I learned the notions of a prefix code and a bifix code (formerly biprefix code in Berstel's book), which allowed me to come up with the reasonable3 categories described above.
It may be hard to appreciate those (code related) categories, without having seen some issues of the more obvious categories. A general issue is that closure under composition can make it hard to define a nicely restricted class of partial functions. Another issue is related to the fact that addition of one (or multiplication by a constant) is an "easy to compute function" if the digits of the number are given in low-endian order, but not if the digits are given in big-endian order. | {
"domain": "cs.stackexchange",
"id": 4806,
"lm_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, formal-languages, reference-request",
"url": null
} |
python, python-3.x, database, django, role-playing-game
class Characteristics(models.Model):
class Meta:
abstract = True
VIRTUE_CHOICES = (('prudence', 'Prudence'), ('justice', 'Justice'),
('temperance', 'Temperance'), ('fortitude', 'Fortitude'), ('faith', 'Faith'),
('hope', 'Hope'), ('charity', 'Charity'))
VICE_CHOICES = (('lust', 'Lust'), ('gluttony', 'Gluttony'), ('greed', 'Greed'),
('sloth', 'Sloth'), ('wrath', 'Wrath'), ('envy', 'Envy'), ('pride', 'Pride'))
power_level = IntegerRangeField(min_value=1, max_value=10)
energy_trait = IntegerRangeField(min_value=1, max_value=10)
virtue = models.CharField(choices=VIRTUE_CHOICES, max_length=50)
vice = models.CharField(choices=VICE_CHOICES, max_length=50)
morality = IntegerRangeField(min_value=0, max_value=10)
size = IntegerRangeField(min_value=1, max_value=10, default=5)
def resistance_attributes():
res = [ATTRIBUTE_CHOICES[i][-1][-1] for i in range(len(ATTRIBUTE_CHOICES))]
return res | {
"domain": "codereview.stackexchange",
"id": 12121,
"lm_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, database, django, role-playing-game",
"url": null
} |
for the box that require the least amount of material. Stewart: Cengage Learning: 5318 questions available 4 under development. Application of Calculus in Electrical Engineering(School Proj) Applications of Differential Calculus to Civil Engineering Calculus - Differential Equation Example An example of a differential equation with an exponential function as a solution A fairly. Calculus II. Calculus - differentiation and integration 3. I will assume that the reader has had a post-calculus course in probability or statistics. University of Michigan Department of Mechanical Engineering January 10, 2005. 1 Parametric Curves 9. For this reason, an online calculus course may be a necessary component to most online college programs in math, engineering, physics, and more. Statisticians use calculus to evaluate survey data to help develop business plans for different companies. Mathematics for Electrical Engineering and Computing embraces many applications of modern mathematics, such as | {
"domain": "rivoliccr.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9780517514031507,
"lm_q1q2_score": 0.8253730772942013,
"lm_q2_score": 0.8438950966654774,
"openwebmath_perplexity": 791.5377248847301,
"openwebmath_score": 0.5360766649246216,
"tags": null,
"url": "http://olml.rivoliccr.it/application-of-calculus-in-engineering-examples.html"
} |
temperature, atomic-physics, atoms, density
for a closed system, where $G$ is a flavor of energy (specifically, the Gibbs free energy), $S$ is the entropy, $T$ is the temperature, $p$ is the pressure, $\sigma$ is the surface tension, $A$ is the surface area, $E$ is the electric field, $P$ is the polarization, $B$ is the magnetic field strength, and $M$ is the magnetic moment. For different geometries and conditions, you could replace $-p\,dV$ with $f dL$ (where $f$ is a force and $L$ is the length of a bar or rod) or $s\,d(V\epsilon)$ (where $s$ is the stress and $V\epsilon$ is the volumetric strain).
What this equation says is that there are various ways to add energy to a system and that these mechanisms will generally affect the volume as well. Since $V=(\partial G/\partial p)_{X\neq p}$ by inspection of (2), inequality (1) becomes | {
"domain": "physics.stackexchange",
"id": 39946,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "temperature, atomic-physics, atoms, density",
"url": null
} |
redox
The change in oxidation number between periodate ion and iodine molecule is $7\times 2=14$ (as we have two atoms in iodine molecule).
So, the first step is to multiply $\ce{NaIO4 }$ by $2$.
The change in oxidation number between $\ce{SO2}$ and sulfate ion is $2$.
As the changes must be equal, we have to multiply $\ce{SO2}$ by $7$ and $\ce{H2SO4}$ by
$6$. (As you have already a sulfate ion in $\ce{Na2SO4}$.
Now, as you have $12$ hydrogen atoms in the right side, you add $6$ molecules of water to the left side:
$$\ce{2NaIO4 + 7SO2 +6H2O ->Na2SO4 +6H2SO4 +I2}$$
The equation is balanced.
I hope it's clear now. | {
"domain": "chemistry.stackexchange",
"id": 2846,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "redox",
"url": null
} |
time-complexity, asymptotics, landau-notation, notation
For instance, you will often see the running time of depth-first search expressed as $O(n+m)$, where $n$ is the number of vertices and $m$ is the number of edges in the graph. This is perfectly valid. The meaning of this is there exists a constant $c$ and numbers $n_0,m_0$ such that the running time of the algorithm is at most $c \cdot (n+m)$, for all $n>n_0,m>m_0$. In other words, if the exact running time is $f(n,m)$, we say that $f(n,m) = O(n+m)$ if there exists $c,n_0,m_0$ such that $n>n_0$ and $m>m_0$ implies $f(n,m) \le c \cdot (n+m)$.
Yes, it is perfectly appropriate and acceptable to say that the first stage takes $O(n)$ time and the second stage takes $O(m)$ time. | {
"domain": "cs.stackexchange",
"id": 3317,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "time-complexity, asymptotics, landau-notation, notation",
"url": null
} |
Demon Max Vs Demand Cs, \$1,200 Apartment For Rent, Ratnadurg Fort Cave, 2008 Dodge Avenger Turn Signal Fuse, Remax Awards 2020, Crime Stoppers Most Wanted Mississippi, Dollar To Moroccan Dirham, Wholesale Embroidery Kits, 45 Degree Leg Press Sled Weight, Walsh County Nd Jail Roster, Lg Cx Ir Sensor, | {
"domain": "lesprofessionnelsdelaprofession.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9683812345563904,
"lm_q1q2_score": 0.8269130913070633,
"lm_q2_score": 0.8539127585282744,
"openwebmath_perplexity": 1120.6802485515173,
"openwebmath_score": 0.6550716757774353,
"tags": null,
"url": "http://lesprofessionnelsdelaprofession.com/f3gzc/adjacency-matrix-linear-algebra-cf9d6e"
} |
c, console, to-do-list, markdown
/* Like string_list_for_each() but also passes the index of the string to
* func().
*/
void string_list_for_each_index(StringList *sl, void (*func)(char *str, size_t i));
/* Like string_list_for_each_index() but calls func() only if test() returns
* true.
*/
void string_list_for_each_index_if(StringList *sl,
bool (*test)(const char *str),
void (*func)(char *str, size_t i));
/* Calls test() once for each string in sl: if test() returns true, frees and
* removes that string from the list.
*/
void string_list_for_each_remove_if(StringList *sl, bool (*test)(const char *str));
/* For each index in indices, frees and removes the string at that index.
* indices array will be sorted. Indices contained in indices are assumed to be
* unique and less then sl->length.
* n is the number of elements in indices.
*/
void string_list_remove_multiple(StringList *sl, size_t *indices, size_t n); | {
"domain": "codereview.stackexchange",
"id": 32432,
"lm_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, console, to-do-list, markdown",
"url": null
} |
particle-physics, mass
Title: What is the smallest non-zero mass in physics? I saw a previous similar question that seemed ill-defined with wish-washy answers, so I'll just ask here. What is the smallest known mass of a particle; is there a limit as to how far we can go? Or is the answer to either of these questions non-sensical in the same way in which talking about Newtonian mechanics at a particle level is non-sensical; why? In the Standard Model, the smallest mass is zero. Photons have zero mass, as do gluons.
You might quip that this answer is based on theory, and you really want an experimental result. In this case, we can say that the photon mass is bounded to be less than $1\times 10^{-18} {\rm eV}$, using the headline result in the particle data book. Even if the photon had exactly this mass, it would be by far the lightest particle in the Standard Model. | {
"domain": "physics.stackexchange",
"id": 76684,
"lm_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, mass",
"url": null
} |
ros, gazebo, ros-control, gazebo-ros-control
Connecting the simple robot with a fixed joint to the word seems to be a bit of a problem.
I tried searching everywhere on the internet, but there's nothing on spawning different robots. Just the usual multirobot system, where there's one URDF, one robot, that's being spawned multiple times in different namespaces.
I found a post about two different things (an arm and a hand) being put together, but that uses a fixed joint (and system where there's an arm, and a tool at the end of it is quite common).
Is there a way to do this?
Thank you. | {
"domain": "robotics.stackexchange",
"id": 25316,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, gazebo, ros-control, gazebo-ros-control",
"url": null
} |
python, python-3.x, web-scraping
Title: Scraping current day Counter-Strike match results from a website As a fan of competitive Counter-Strike, I like to keep up with who is currently winning and who is losing. There is a website that provides me with just that. I thought it would be cool if I could display the results in a way different than visiting the website.
Here is an example result from the source of the website.
<div class="result-con" data-zonedgrouping-entry-unix="1499867767000"><a href="/matches/2312610/penta-vs-kinguin-esea-premier-season-25-europe" class="a-reset">
<div class="result">
<table>
<tr>
<td class="team-cell">
<div class="line-align team1">
<div class="team ">PENTA</div>
<img alt="PENTA" src="https://static.hltv.org/images/team/logo/5395" class="team-logo" title="PENTA"></div>
</td> | {
"domain": "codereview.stackexchange",
"id": 26446,
"lm_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, web-scraping",
"url": null
} |
java, chess
/**
* {@inheritDoc}
*/
@Override
public List<Position> posMoves(ChessBoard board, Position pos) {
List<Position> result = new LinkedList<Position>();
int x = pos.getX();
int y = pos.getY();
for (int[] posMove : posMoves) {
int posX = x + posMove[0];
int posY = y + posMove[1];
if (board.inSize(posX) && board.inSize(posY)) {
Position possibleMove = new Position(x, y);
if (isSafe(board, pos, possibleMove)) {
result.add(possibleMove);
}
}
}
return result;
} | {
"domain": "codereview.stackexchange",
"id": 12548,
"lm_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, chess",
"url": null
} |
python, performance, memory-optimization, cyclomatic-complexity
print("Error ls: intervals are expected to be represented by two integers, not more or less.")
break
elif inter1[0] >= inter1[1] or inter2[0] >= inter2[1]:
print("Error ls: the first integer representing an interval should be lesser than the second.")
break
else:
# determine whether there is overlap
if inter1[0] >= inter2[0] and inter1[0] <= inter2[1]:
overlap += 1
break
elif inter1[1] >= inter2[0] and inter1[1] <= inter2[1]:
overlap += 1
break
elif inter1[0] < inter2[0] and inter1[1] > inter2[1]:
overlap += 1
break
# determine the maximum of the lengths of list1 and list2
maxlen = max(len(list1), len(list2))
# compute the similarity (ls) | {
"domain": "codereview.stackexchange",
"id": 44633,
"lm_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, memory-optimization, cyclomatic-complexity",
"url": null
} |
inorganic-chemistry, enthalpy, ionic-compounds
The Born-Lande and Kaputinskii equations give some numeric estimates, e.g. (Born-Landé)
$E = \frac{N_AMz^+z^- e^2 }{4 \pi \epsilon_0 r_0}\left(1-\frac{1}{n}\right)$
where:
$N_A$ = Avogadro constant;
M = Madelung constant
$z^+$ = charge number of cation
$z^−$ = charge number of anion
e = charge on an electron (elementary charge)
$\epsilon_0$ = permittivity of free space
$r_0$ = distance to closest ion
n = Born exponent, typically a number between 5 and 12, determined experimentally or derived theoretically.
(Note that I've inverted the formula from Wikipedia's version to match your reaction.)
None of these can give you a negative lattice enthalpy.
How could it happen? Well, you'd need something where the solid is less stable than the gas-phase ions. Consider that in an ionic solid, the electrostatic attraction between anion and cation is always favorable. Since gas-phase ions aren't stable by themselves, I don't see how this is possible. | {
"domain": "chemistry.stackexchange",
"id": 3675,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inorganic-chemistry, enthalpy, ionic-compounds",
"url": null
} |
An irrational number is a number which cannot be expressed in a ratio of two integers. Integers and rational numbers. As it can be written without a decimal component it belongs to the integers.
It is a rational number because it can be written as: $$\frac{4}{1}$$ or $$\frac{8}{2}$$ All rational numbers belong to the real numbers. If you look at a numeral line. Describe the main differences among integers, rational numbers, real number Can you use my old paper and just change the numbers to get different answe do problem 6 please explain why lcm(x,y,z) can not be true.
Explain the main differences among integers rational numbers real numbers and irrational numbers
Rated 0/5 based on 34 review | {
"domain": "mi-centre.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9820137879323496,
"lm_q1q2_score": 0.8074010603213849,
"lm_q2_score": 0.8221891283434876,
"openwebmath_perplexity": 304.1454141753458,
"openwebmath_score": 0.7531353235244751,
"tags": null,
"url": "http://jabedajoletupeke.mi-centre.com/explain-the-main-differences-among-integers-rational-numbers-real-numbers-and-irrational-numbers-6376263762.html"
} |
c++, playing-cards
namespace {
int as_int(Value value){
switch(value){
case Value::Two : return 2;
case Value::Three : return 3;
case Value::Four : return 4;
case Value::Five : return 5;
case Value::Six : return 6;
case Value::Seven : return 7;
case Value::Eight : return 8;
case Value::Nine : return 9;
case Value::Ten : return 10;
case Value::Jack : return 11;
case Value::Queen : return 12;
case Value::King : return 13;
case Value::Ace : return 14;
}
}
int as_int(Color color){
switch(color){
case Color::Dimonds : return 1;
case Color::Clubs : return 2;
case Color::Hearts : return 3;
case Color::Spades : return 4;
}
}
}
class Card {
public:
Card(Value value, Color color);
Color getColor() const; | {
"domain": "codereview.stackexchange",
"id": 30792,
"lm_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++, playing-cards",
"url": null
} |
Fact E.1
Let $X$ be a compact Hausdorff space. Let $O_1,O_2,O_3,\cdots$ be a sequence of non-empty open subsets of $X$ such that $\overline{O_{n+1}} \subset O_n$ for each $n$. Then the intersection $\bigcap_{i=1}^\infty O_i$ is non-empty.
Fact E.2
Any compact Hausdorff space is Baire space.
Fact E.3
Let $X$ be a Baire space. Let $Y$ be a dense $G_\delta$-subset of $X$ such that $X-Y$ is a dense subset of $X$. Then $Y$ is not a $\sigma$-compact space.
Since $X=[0,1]^\omega$ is compact, it follows from Fact E.2 that the product space $X=[0,1]^\omega$ is a Baire space.
Fact E.4
Let $X=[0,1]^\omega$ and $Y=(0,1)^\omega$. The product space $Y=(0,1)^\omega$ is a dense $G_\delta$-subset of $X=[0,1]^\omega$. Furthermore, $X-Y$ is a dense subset of $X$.
It follows from the above facts that the product space $(0,1)^\omega$ cannot be a $\sigma$-compact space.
$\text{ }$
$\text{ }$
$\text{ }$
$\text{ }$
$\text{ }$
$\text{ }$
Proofs of Key Steps for Exercise 2.A | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9881308807013051,
"lm_q1q2_score": 0.8032193009079215,
"lm_q2_score": 0.8128673201042492,
"openwebmath_perplexity": 93.63191003546632,
"openwebmath_score": 0.9769114851951599,
"tags": null,
"url": "https://dantopology.wordpress.com/2019/07/11/lindelof-exercise-2/"
} |
physical-chemistry, kinetic-theory-of-gases
Setting $\alpha = m/2kT$,
$$\begin{align}
\langle v \rangle &= 4\pi\left(\frac{m}{2\pi kT}\right)^{3/2} \frac{4k^2T^2}{2m^2} \\
&= \sqrt{\frac{8kT}{\pi m}} \\
\end{align}$$
$m$ here refers to the mass of one molecule, whereas $M$ in your question refers to the molar mass of the compound. They are related by $M = N_\mathrm{A}m$, where $N_\mathrm{A}$ is the Avogadro constant. Since $R = N_\mathrm{A}k$, you can multiply top and bottom by $N_\mathrm{A}$ to obtain the desired result
$$\langle v \rangle = \sqrt{\frac{8RT}{\pi M}}$$ | {
"domain": "chemistry.stackexchange",
"id": 4698,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry, kinetic-theory-of-gases",
"url": null
} |
• Jan 16th 2013, 04:07 AM
Imonars
Re: Pyramid
Sorry about the mistake, we have rearranged the equation to be: (x + 100)tan(46.27) = (x + 200)tan(40.3) we are trying to find the height
• Jan 16th 2013, 04:14 AM
emakarov
Re: Pyramid
Yes, this gives x(tan(46.27) - tan(40.3)) = 200 * tan(40.3) - 100 * tan(46.27), i.e., | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806501150427,
"lm_q1q2_score": 0.8016977026662417,
"lm_q2_score": 0.8175744673038222,
"openwebmath_perplexity": 7196.979940380719,
"openwebmath_score": 0.935497522354126,
"tags": null,
"url": "http://mathhelpforum.com/trigonometry/211396-pyramid-print.html"
} |
energy, particle-physics, experimental-physics, particle-detectors
where $D^{\pm} = \frac{1}{2}\left[\left|D_0\right\rangle\pm\left|D_1\right\rangle\right]$
So, had there been no interaction, the qubit would have returned to the initial state $\left|0\right\rangle$ but now we end up with an entangled state of the qubit and the particle such that there is now a finite probability of finding the qubit in the state $\left|1\right\rangle$, despite the fact that the collision with the particle happened in a purely elastic way such that it did not affect the physical state of the qubit in any way at the time of the collision. The probability of finding the qubit in the state $\left|1\right\rangle$ is $\frac{1}{2}\left[1-\operatorname{Re}\left\langle D_0\right|D_1\left.\right\rangle\right]$, so it depends on the overlap between the two particle states corresponding to scattering off the qubit in the two states of the superposition. | {
"domain": "physics.stackexchange",
"id": 42170,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "energy, particle-physics, experimental-physics, particle-detectors",
"url": null
} |
electromagnetism, particle-physics, parity
However I think the more correct way to see this is from the relativistic formulation of electrodynamics. Introduce the electromagnetic field tensor $$F_{\mu\nu} =\begin{pmatrix} 0 & E_x & E_y & E_z \\ -E_x & 0 & -B_z & B_y \\ -E_y & B_z & 0 & -B_x \\ -E_z & -B_y & B_x & 0 \end{pmatrix}$$ and note that the purely spatial part $F_{ij}$, $1 \le i, j \le 3$ is equivalent to the magnetic field. Since there are two indices, the components are invariant under parity transformations. The electric field is given by $E_i = F_{0i}$, so it changes sign under parity, it is a vector.
The more sophisticated yet way to see this decomposition is that if there is timelike 1-form $dt$ we can decompose the field strength 2-form as $$F = E\wedge dt + B.$$ We see that $E$ is a 1-form (equivalent to a vector after raising the index), but $B$ is a 2-form (often called pseudovector, because not enough people know about the wonders of differential forms). | {
"domain": "physics.stackexchange",
"id": 14268,
"lm_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, particle-physics, parity",
"url": null
} |
c#, .net, linq
What follows is another possible implementation using nested if statements instead of multiple return statements.
ExpandoObject model = GetExpandoObject();
ExpandoObject someExpandoObject;
KeyValuePair<string, object> kvp;
IList<object> ilo;
object finalResult;
if ((someExpandoObject = model.FirstOrDefault<ExpandoObject>("node")) != null)
{
if (!(kvp = someExpandoObject.FirstOrDefault<KeyValuePair<string, object>>("children")).Equals(default(KeyValuePair<string, object>)))
{
if ((ilo = kvp.Value as IList<object>) != null)
{
if ((someExpandoObject = ilo.FirstOrDefault() as ExpandoObject) != null)
{
if ((someExpandoObject = someExpandoObject.FirstOrDefault<ExpandoObject>("node")) != null)
finalResult = someExpandoObject.FirstOrDefault<object>("stuff");
}
}
}
} | {
"domain": "codereview.stackexchange",
"id": 6395,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, .net, linq",
"url": null
} |
python, beginner, python-3.x, playing-cards
def suitname(self, suit):
if self.suit == "hearts":
self.sname = '♥'
return '♥'
if self.suit == "spades":
self.sname = '♠'
return '♠'
if self.suit == "clubs":
self.sname = '♣'
return '♣'
if self.suit == "diamonds":
self.sname = '♦︎'
return '♦︎'
def cardname(self):
return f'{self.sname}{self.vname}{self.sname}'
#All Decks
class Deck:
def __init__(self):
self.cards = []
self.create()
def create(self):
for d in range(decks):
for suit in ["hearts", "spades", "clubs", "diamonds"]:
for val in [2,3,4,5,6,7,8,9,10,11,12,13,14]:
self.cards.append(Card(val,suit)); d+=1 | {
"domain": "codereview.stackexchange",
"id": 33637,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, python-3.x, playing-cards",
"url": null
} |
# Using the identity theorem: can there be an analytic function $f$ with $f\left(\frac{1}{n^2}\right) = \frac{1}{n}$
As Conway states it the theorem is as follows:
Let $G$ be an open connected set and let $f:G\rightarrow \mathbb{C}$ is analytic on $G$. Then the TFAE:
1. $f\equiv0$
2. $\{z\in G: f(z)=0 \}$ has a limit point in $G$.
I get confused when I have to use this to solve problems. My understanding on this is sort of like "if $f$ goes to zero along a certain sequence" then the function must be identically zero. Is this thinking correct? Even if I am I want some good explanation on this. Also, if any of you could give a good reference to this that would help too.
For example what can we say about an analytic function $f:\mathbb C\rightarrow \mathbb C$, such that $f\left(\frac{1}{n^2}\right) = \frac{1}{n}$. Can such a function exist? Can we even use the identity theorem to answer this question? Thanks so much for your time. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9799765587105448,
"lm_q1q2_score": 0.8057260790078009,
"lm_q2_score": 0.822189134878876,
"openwebmath_perplexity": 100.02217341362868,
"openwebmath_score": 0.92320716381073,
"tags": null,
"url": "http://math.stackexchange.com/questions/270755/using-the-identity-theorem-can-there-be-an-analytic-function-f-with-f-left"
} |
newtonian-mechanics, classical-mechanics, mathematical-physics, complex-numbers
Title: Prove: Conformal map $w(z)$ transforms a trajectory in potential $U(z)=|dw/dz|^2$ to one in potential $V(z)=-|dz/dw|^2$ This is a conclusion given without proof in the Chinese version of Arnold's Methematical Methods in Classical Mechancs.
Contents related to this conclusion are missing from the English version (I guess they were added by the Chinese translator).
Years ago, I have found a proof (on page 121) of a special case:
for the trajectory in the force field of power $a$ (i.e. $\mathbf F\propto\hat{\mathbf r}r^a$),
if we regard it as a curve in the complex plane and find the $\alpha$th power of the it,
we get a trajectory in the force field of power $A$, where $(a+3)\,(A+3)=4$, and $\alpha=(a+3)/2$.
The proof utilizes the conservation of energy and a new time parameter $\tau$ with the relation to the old time $t$ being $\mathrm d\tau/\mathrm d t=|z|^{a+1}$. | {
"domain": "physics.stackexchange",
"id": 99205,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, classical-mechanics, mathematical-physics, complex-numbers",
"url": null
} |
homework-and-exercises
Now I am having problems with part c
So I first solved for the net force as a whole:
$$F = a(m_1+m_2+m_3)$$
$$a = \frac{F}{m_1+m_2+m_3}$$
Now I have found acceleration, which will be the same throughout this example.
So I move on to finding the net force on each block
I will start with block 1:
$$net force = F - (Force of m_2 + Force of m_3)$$
$$netforce = F - \frac{(m_2 + m_3)F}{m_1+m_2+m_3}$$
So that means that what is left is the force of
$$netforce = \frac{m_1F}{m_1+m_2+m_3}$$
But now to get the net force of the second box is where I get confused:
$$netforce_2 = Force_1 + Force_2 - Force_3$$
I was thinking I would have to add the forces of box 1 + box 3 and subtract the force of box 3.
So I did and I got:
$$netforce = \frac{(m_1F + m_2F) - m_3F}{m_1+m_2+m_3}$$
However the book tells me the answer is:
$$netforce = \frac{m_2F}{m_1+m_2+m_3}$$ | {
"domain": "physics.stackexchange",
"id": 35563,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises",
"url": null
} |
frequency, string, oscillators, normal-modes
Hope it helps | {
"domain": "physics.stackexchange",
"id": 83801,
"lm_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, string, oscillators, normal-modes",
"url": null
} |
special-relativity, angular-momentum, quantum-spin, group-representations, poincare-symmetry
Why isn't $p^2$ sufficient? - it's a Casimir invariant, and so it should give us all the classification information (i.e. tell us if reps are diffeomorphic)!
Now, suppose that we do things correctly (i.e. discard $\mathbf J^2$) and use $p^2$ to classify representations.
Are there “fermions” or “bosons” corresponding to $m$ taking on half or whole integer values in this case?
Finally, the representation $m^2=3$ is not isomorphic to $m^2=\pi$ (because $p^2$ is a Casimir invariant). Same with $m^2=2$ and $m^2=2.00000001$. However, in most field theory textbooks, $m>0$ is treated as one case. It's all a blob to them. What?!!! The Poincare group has two Casimir Invariants - namely $p^2$ and $W^2$ where
$$
W_\mu = \frac{1}{2} \epsilon_{\mu\nu\rho\sigma} J^{\nu\rho} p^\sigma
$$
is the Pauli-Lubanski pseudo-vector. Thus, representations of the Lorentz group are labelled by the eigenvalues of both $p^2$ and $W^2$. | {
"domain": "physics.stackexchange",
"id": 17351,
"lm_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, angular-momentum, quantum-spin, group-representations, poincare-symmetry",
"url": null
} |
php, api
The name of the function says what you want to get and the body shows how you do it.
3, Change
for ($offset = 0; $offset <= $counted - 1; ...
to
for ($offset = 0; $offset < $counted;
It's more common.
4, In the inner for loop the $result loop variable is a little bit confusing, it's easy to mix up with $results. $resultIndex would be better.
for ($resultIndex = 0; $resultIndex < $limit; $resultIndex++) {
array_push($all_results, $results['Entries'][$resultIndex]);
}
Finally, I agree with @Yannis Rizos, the whole logic would be better as a class. | {
"domain": "codereview.stackexchange",
"id": 864,
"lm_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, api",
"url": null
} |
deep-learning, tensorflow, rnn
The model.summary() is below:
Layer (type) Output Shape Param #
=================================================================
simple_rnn (SimpleRNN) (3, 32) 1152
_________________________________________________________________
dense (Dense) (3, 3) 99
=================================================================
Total params: 1,251
Trainable params: 1,251
Non-trainable params: 0
_________________________________________________________________
The shape is (3,3) with 1st index being the batch size (the network is an RNN). I need to set weighted loss for each of the outputs. I tried the argument weighted_losses on tf.keras.models.Model but the error returned:
ValueError: When passing a list as loss_weights, it should have one entry per model output. The model has 1 outputs | {
"domain": "datascience.stackexchange",
"id": 5323,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning, tensorflow, rnn",
"url": null
} |
machine-learning, backpropagation
Title: Finding an optimum back propagation algorithm I recently started working on very simple machine learning codes in Python and I came across a big problem: teaching the system to improve on its guesses.
So this is what the code is about:
I will have a list of organisms with their features stated in numerical values. I want to write a code that identifies that whether the organism is a cat or a fish or neither based on their characteristics. (For example an organism with a high fur value and 4 legs is more probable to be a cat.)
My idea for the neural network is to have five input nodes(for the five characteristics) and 2 output nodes (one for how cat it is and one for how fish it is). The input nodes are multiplied by a weight value and then all summed together to produce one of the output nodes. This repeats itself for the other output. How much the system got wrong is just the difference between the value of the output nodes and how cat/fish the being actually is. | {
"domain": "ai.stackexchange",
"id": 334,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, backpropagation",
"url": null
} |
python, python-3.x, validation, iterator
def get_non_repeated_numbers(n: int) -> Iterator[float]:
"""
Yields n float values to return Iterator
:param n: int
:return: Iterator[float]
"""
numbers = deque()
for i in range(n):
while True:
try:
number = atof(
input(f'Enter the {i + 1}º number:\n-> ')
)
if number not in numbers:
numbers.append(number)
yield number
break
else:
raise ValueError
except ValueError:
print('Invalid number! Try again...\n') Overall pretty reasonable.
Use a set() instead of a deque() so that you have O(1) amortised time complexity for insertion and membership checks. | {
"domain": "codereview.stackexchange",
"id": 43804,
"lm_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, validation, iterator",
"url": null
} |
definition for an acute angle. If any angle becomes 90 degrees or more, it … We'll start by drawing a sketch of a right triangle and by definition, a right triangle as 1 90 degree angle, which is also referred to as the right angle and it's designated by a box. It is acute, with angles 36°, 72°, and 72°, making it the only triangle with angles in the proportions 1:2:2. The circumradius in a triangle so close to each other? based! 2 acute angles ( less than 90 degrees intersect at the orthocenter and other! Formed by the intersection point of the angles formed by the intersections of its interior angles of the side!, 87 ) their product any triangle the triple acute angle triangle identity states that the sum from 180° rational... Triangle whose all interior angles of the vertex of interest from 180° the opposite vertex can be into. A median of a triangle with one obtuse angle the 3rd side only the extensions of the triangle, rc! How to remember the smallest integer-sided triangle with | {
"domain": "cuuquoc.org",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.982287697148445,
"lm_q1q2_score": 0.8120688306939026,
"lm_q2_score": 0.8267118004748677,
"openwebmath_perplexity": 866.0185112507646,
"openwebmath_score": 0.5003151893615723,
"tags": null,
"url": "http://cuuquoc.org/bohemian-knotweed-inzvvoe/acute-angle-triangle-088e8a"
} |
cc.complexity-theory, decision-trees
I am even more interested in results about when $f$ is given in another way, by a polynomial over some field, or by a Turing-machine computing it.
Is there anything known about this?
Are there any hardness results? If you have an oracle for $f$, you can compute the optimal decision tree for $f$ in $O(3^nn)$ time and $O(3^n)$ space. Consider a function $g$ that takes as input a partition of the variables into three sets $T$, $F$, $S$ and outputs the size of the smallest decision tree for $f$ when the variables in $T$ are restricted to $1$ and the ones in $F$ are restricted to $0$ (and the remaining ones, in $S$, are unset). The following recurrence holds for $g$:
$$g(T,F,S) = 1 + \min_{v \in S} g(T \cup {v},F,S\setminus \{v\}) + g(T,F \cup {v},S\setminus \{v\}).$$ | {
"domain": "cstheory.stackexchange",
"id": 2941,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cc.complexity-theory, decision-trees",
"url": null
} |
operators, hilbert-space, hamiltonian, linear-algebra, density-operator
Title: Why $\sum_n|E_n \rangle \operatorname{exp}(-\beta\mathcal{H})\langle E_n| = \operatorname{exp}(-\beta \mathcal{H})$? (Quantum statistics) I am reading James P. Sethna, Statistical Mechanics : Entropy, Order Parameters, and Complexity, p.137 and stuck at some equality. I think that this question is like homework-question ( In fact this is more of a mathematical question ) but even if I think about it alone, I can't really understand why that equality is true. So please understanding.
Let me present his argument in p.137 about Canonical distribution.
Canonical Distribution. The canonical distribution is a mixture of the energy eigenstates $|E_n\rangle$ with Boltzmann weights $\operatorname{exp}(-\beta E_n)$. Hence the (canonical) density matrix $\rho_{\operatorname{canon}}$ is diagonal in the energy basis :
$$\rho_{\operatorname{canon}}=\sum_{n} \frac{\operatorname{exp}(-\beta E_n)}{Z}|E_n\rangle \langle E_n|. $$ | {
"domain": "physics.stackexchange",
"id": 96690,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "operators, hilbert-space, hamiltonian, linear-algebra, density-operator",
"url": null
} |
navigation, ros-melodic, ubuntu, robot-localization, tf-tree
However it didn't work.
Following my previous posts here and here no answer was provided. Unfortunately I am still stuck with this problem and no urdf model is moving according to the moving frame.
The odometry does not show any particular uncertainty and in fact the arrow is still pointed in the middle of the urdf model.
On official documentation there is the presence of a dual EKF example and in fact it is possible to launch it from here /opt/ros/melodic/share/robot_localization/launch/dual_ekf_navsat_example.launch and exactly here it was provided the duality "fixed frame" and "moving frame".
I did it exactly as it said the example but still no luck
UPDATES on tf_tree
My tf_tree is the following
Finally the small python script that does the transformation can be seen below:
from geometry_msgs.msg import PoseWithCovarianceStamped
from sensor_msgs.msg import NavSatFix
from nav_msgs.msg import Odometry | {
"domain": "robotics.stackexchange",
"id": 33318,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, ros-melodic, ubuntu, robot-localization, tf-tree",
"url": null
} |
c#, beginner, object-oriented
Title: Nested Classes in C# I wondered how nested classes in C# work as I often use them when I write native C# code (like Woods.Tree.Add(new Tree).Leaf.Color) so i tried it by my self with a Navigation example. There is a Position integer which declares a point on a line. To move left the position will be subtracted by 1, to move right the position will added by 1.
I think its quite pedantic and much code to write for such a 'simple' task. Is this the right way or is there an easier, smaller way to archive this?
using System; | {
"domain": "codereview.stackexchange",
"id": 27320,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, beginner, object-oriented",
"url": null
} |
quantum-mechanics, photons, electrons, standard-model
Title: Upper limit on electron radius vs photon radius Both electrons and photons are defined in the SM as point-like particles. The electron does have rest mass while the photon is massless.
Now if I search for the upper limit on the size of the electron, I find a lot of questions, experiments, and even the official Particle Data Group list the upper limit on the electron radius (page 109).
http://pdg.lbl.gov/2015/download/rpp2014-Chin.Phys.C.38.090001.pdf
https://en.wikipedia.org/wiki/Classical_electron_radius
The only official looking paper I have found on photon radius is this:
https://arxiv.org/ftp/arxiv/papers/1604/1604.03869.pdf | {
"domain": "physics.stackexchange",
"id": 69953,
"lm_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, photons, electrons, standard-model",
"url": null
} |
electrostatics, electric-fields, gauss-law
$$
\Phi_c=-2\pi R\int_a^b dr\frac{Q}{4\pi\epsilon_0}\frac{1}{r^2}\frac{R}{r}=\pi R^2\frac{Q}{4\pi\epsilon_0}\left.\frac{1}{r^2}\right|_a^b=\pi R^2\frac{Q}{4\pi\epsilon_0}\frac{1}{b^2}-\pi R^2\frac{Q}{4\pi\epsilon_0}\frac{1}{a^2}$$
$\Phi_a+\Phi_b+\Phi_c=0$. Gauss' law is satisfied... of course it is. It always is. | {
"domain": "physics.stackexchange",
"id": 99508,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics, electric-fields, gauss-law",
"url": null
} |
deseq2, normalization, microarray, geoquery, geo
ILMN_3167890 13839.88 3.68E-38 23507.06 3.68E-38 22345.25 3.68E-38 20482.31 3.68E-38 21419.25 3.68E-38
ILMN_3167526 5.875 0.4577177 105.0625 0.03279042 8.25 0.4117529 -29.6875 0.683706 11.25 0.3604082
ILMN_3167209 82.875 0.06708142 182.0625 0.0007096 60.25 0.05167192 9.3125 0.4403947 72.25 0.01086376 | {
"domain": "bioinformatics.stackexchange",
"id": 2462,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deseq2, normalization, microarray, geoquery, geo",
"url": null
} |
oceanography, lakes
So back to these 2 bodies of water in question. Some people consider the Caspian sea to be a lake and others consider it to be a sea. While historically, it might have been part of a sea, it is landlocked now so it would be more suited to call this the Caspian Salt Lake, thus making it the largest lake on Earth and also the largest saline lake.
The Great Lakes are also in question, to me at least. While the majority of the world considers them lakes and they were historically a lake (really, the rivers and small lakes in that area connecting them are so small in comparison that it is basically 1 body of water), the Erie canal has since then connected the lakes to the St. Lawrence River. So it would be more suited to call this the Great Freshwater Sea. I have no idea how this would rank up to other seas like the Mediterranean Sea in area but it would be one of the world's few freshwater seas (Joining the Sea of Galilee). | {
"domain": "earthscience.stackexchange",
"id": 1775,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "oceanography, lakes",
"url": null
} |
javascript, jquery, css, html5, jquery-ui
In order to offer the best possible interface you have to provide the same or similar experience in all browsers, simply listing something isn't supported, in my mind, is lazy and not a great UX/UI option. I'd look into webshims or a similar polyfill. Basically, you should provide a fallback or functional date picker in browsers that don't support the HTML5 feature. Check the caniuse.com and html5please.com to see support levels and polyfill options for all these HTML5 features.
There is no mobile optimized content or media queries. There is an increasing number of movie goers that are utilizing mobile devices in order to purchase tickets. Not providing mobile optimized layout is a huge draw back to the UX for half the people that would utilize this tool. (source)
I'd look into Flying Focus to provide tabbed and arrow key users the ability to see where they are going when tabbing through fields. | {
"domain": "codereview.stackexchange",
"id": 8135,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, css, html5, jquery-ui",
"url": null
} |
geology, mining, economic-geology
Apatite is slowly soluble in neutral or alkaline waters, and its solubility increases with increasing acidity.
The PO4 content of most river and lake waters ranges from about 0.01 to 0.5 part per million (ppm), but may be much higher in soft acid waters and highly saline alkaline lakes. About one-sixth of the phosphate carried to the sea by runoff is in dissolved form. The ocean as a whole is nearly saturated with phosphate, but its distribution within the ocean is not uniform; deep cold waters contain nearly 0.3 ppm PO*, but warm surface waters contain only 0.01 ppm or less. Oceanic circulation brings phosphate- rich water to the surface in several environments, and phosphate may be precipitated either inorganically or biochemically, as the pH and temperature increase near the surface. | {
"domain": "earthscience.stackexchange",
"id": 2020,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "geology, mining, economic-geology",
"url": null
} |
molecular-biology, gene-expression, synthetic-biology, gene-regulation
What I also don't understand is whether or not $P_{RM}$ promoter is inducible or constitutive (e.g. in the absence of bound transcription factors, how leaky is it)? There's no rule that says a transcription factor must be either a repressor or an activator. The lambda repressor (CI) is in fact a repressor and activator of transcription, depending on where it is bound and to what promoter you are referring to. I know your question isn't directly about lambda phage, but I think this mechanism may be best explained in the context of where it was first invented: nature. So, I will try to briefly explain how the lambda repressor's dual role allows regulation of its own expression and controls lysogenic induction. | {
"domain": "biology.stackexchange",
"id": 2087,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "molecular-biology, gene-expression, synthetic-biology, gene-regulation",
"url": null
} |
python, beginner, python-3.x, calculator, tkinter
label_display = tk.Label(self, textvariable=self.txt, font=15, bg="#bebebe", relief="groove", bd=5, height=5)
label_display.grid(row=0, column=0, sticky="nsew")
def update_text_display(self, text):
self.text_display.set(text)
New frame_botoes.py:
import tkinter as tk
import calculadora
class ButtonsContainer(tk.Frame):
def __init__(self):
super().__init__()
self.configure(bg="yellow")
self.screen = calculadora.Press(self.master)
self.master.bind("<Key>", self.key_handler)
self.master.bind("<Return>", self.screen.equal)
for x in range(0, 5):
self.rowconfigure(x, weight=1)
if x < 4:
self.columnconfigure(x, weight=1) | {
"domain": "codereview.stackexchange",
"id": 34311,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, python-3.x, calculator, tkinter",
"url": null
} |
performance, php, mysql
Title: SQL to find users that the current user hasn't liked/disliked I have this really long query, which in my opinion looks ugly next to all the tidy code in my project. I was wondering if there was a way to optimize it or make it shorter at least:
$query = <<<SQL
SELECT * FROM users
WHERE NOT EXISTS (
SELECT id
FROM profile_likes
WHERE profile_id = users.id
AND viewer_id = $my_user->id
)
AND NOT EXISTS (
SELECT id
FROM profile_dislikes
WHERE profile_id = users.id
AND viewer_id = $my_user->id
)
AND id != $my_user->id
SQL | {
"domain": "codereview.stackexchange",
"id": 29399,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, php, mysql",
"url": null
} |
quantum-field-theory, antimatter, spin-statistics, cpt-symmetry, charge-conjugation
Under $PT$, $\epsilon^{\mu\nu\sigma\rho}$ is unchanged, but $\phi \leftrightarrow \phi^\dagger$ because $PT$ is anti-linear. Thus we need the anti-linear $C$, which also switches $\phi \leftrightarrow \phi^\dagger$, to make $\mathcal L_\text{int}$ invariant. | {
"domain": "physics.stackexchange",
"id": 34299,
"lm_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, antimatter, spin-statistics, cpt-symmetry, charge-conjugation",
"url": null
} |
c#, stream
please, review my code and show all mistakes you've seen. The first thing that springs to mind is that it would probably be better to not create the Stream and StreamReader instances when it can be avoided simply by using the File.ReadAllText method to accomplish the same goal:
public void ProcessFile(string filename)
{
Console.WriteLine(File.ReadAllText(filename));
} | {
"domain": "codereview.stackexchange",
"id": 19346,
"lm_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#, stream",
"url": null
} |
electromagnetism, energy, electromagnetic-radiation, energy-conservation
Finally, as @ThePhoton has pointed out, you can do an approximate calculation so long as your estimation of how much energy would be lost in radiation is low compared to the total mechanical energy in the initial state. | {
"domain": "physics.stackexchange",
"id": 66998,
"lm_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, energy, electromagnetic-radiation, energy-conservation",
"url": null
} |
c++, homework, simulation
// If a non-number was entered
if (std::cin.fail()) {
std::cout << "The price must be a number." << std::endl;
clearcin();
continue;
}
if (fmod(price, 0.25f) != 0.0f) {
std::cout << "The price must be a multiple of 0.25 (one quarter)." << std::endl;
clearcin();
continue;
}
if (price > max_bill) {
std::cout << "The price must be under $" << max_bill << "." << std::endl;
clearcin();
continue;
}
if (price < 0) {
std::cout << "Sure, let's insert a $20 bill and get $" << 20 - price << " back." << std::endl;
clearcin();
continue;
}
if (price == 0) {
std::cout << "<3" << std::endl;
clearcin();
return 0;
}
clearcin();
break;
} | {
"domain": "codereview.stackexchange",
"id": 32068,
"lm_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++, homework, simulation",
"url": null
} |
ros, gazebo, simulation, urdf, spawn
Originally posted by David Lu with karma: 10932 on 2014-10-31
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by Marcus on 2014-11-02:
Thanks David, that worked perfectly. | {
"domain": "robotics.stackexchange",
"id": 19912,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, gazebo, simulation, urdf, spawn",
"url": null
} |
c++, random
std::random_device is intended to be a front-end for a truly random bit source. The major shortcoming is that in many cases it has fairly limited bandwidth, so you'd prefer to avoid calling it every time you need a number.
If you do want to use mt19937 (a perfectly fine idea in many cases) I'd personally use a function-object instead of a function:
class random_in_range {
std::mt19937 rng;
public:
random_in_range() : rng(std::random_device()()) {}
int operator()(int low, int high) {
std::uniform_int_distribution<int> uni(low, high);
return uni(rng);
}
};
This does have some shortcoming though: people may use a temporary of this type in a loop:
for (int i=0; i<10; i++)
std::cout << random_in_range()(0, 1);
...which puts you back where you started. You need to do something like:
random_in_range r;
for (int i=0; i<10; i++)
std::cout << r(0, 1);
...to get the results you want (i.e., seed once, call multiple times). | {
"domain": "codereview.stackexchange",
"id": 15314,
"lm_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++, random",
"url": null
} |
java, algorithm
Title: How can I make my decrypt method more efficient? I am making a simple transposition cipher. I am testing the program with the word "computer" with the secret key "5,2,8,3,7,1,4,6", where the encrypt method will put the 5th letter 'u' in the first position, 2nd letter 'o' in 2nd position, 8th letter 'r' in 3rd position...
So the output would be:
original: computer
encrypted:uormecpt
decrypted:computer
Right now my decrypt method is of O(n^2). How can I make this faster?
Where char[] y would be uormecpt. The z[j] - 1 is the offset as my iterator starts from 0, but my key starts at 1.
public static char[] decrypt(char[] y, int[] z)
{
char[] decrypted = new char[y.length];
for (int i = 0; i < y.length; i++)
{
for (int j = 0; j < y.length; j++)
{
if (i == z[j]-1)
decrypted[i] = y[j];
}
} | {
"domain": "codereview.stackexchange",
"id": 272,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, algorithm",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.