text stringlengths 1 1.11k | source dict |
|---|---|
c#, game, console, tic-tac-toe
{
prog.box5 = askMove;
moveCount++;
}
else
{
prog.NotVacantError();
}
break;
case 6:
if (prog.box6 == ' ')
{
prog.box6 = askMove;
moveCount++;
}
else
{
prog.NotVacantError();
}
break;
case 7:
if (prog.box7 == ' ')
{
prog.box7 = askMove;
moveCount++;
}
else
{ | {
"domain": "codereview.stackexchange",
"id": 11041,
"lm_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, console, tic-tac-toe",
"url": null
} |
# binomial coefficient explained | {
"domain": "bigsundeal.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9901401441145625,
"lm_q1q2_score": 0.8024877034326464,
"lm_q2_score": 0.8104789086703225,
"openwebmath_perplexity": 816.8920950232223,
"openwebmath_score": 0.7703706622123718,
"tags": null,
"url": "https://bigsundeal.com/ekx3nyiz/article.php?page=65a0d8-binomial-coefficient-explained"
} |
ros, python, rospy, best-practices
Originally posted by joq on ROS Answers with karma: 25443 on 2012-04-25
Post score: 4
They are quite different, with different purposes.
Epydoc is best if you want auto-generated API documentation. It is similar in spirit to Javadoc. Sphinx only does auto-generated if you push and pull it. A downside of Epydoc for Python is that, since it is auto-generated, it often documents too well; common tricks of importing symbols into higher-level modules don't work -- Epydoc will detect the submodule and document it that way instead. This created issues with documenting rospy. | {
"domain": "robotics.stackexchange",
"id": 9129,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, python, rospy, best-practices",
"url": null
} |
plane of two dimensions calculated in figure. Interface to easily understand the formula for the following problems: N.B Solving problems to! 4 cm P = 25 cm Now you just follow these steps area can be calculated in a of! The calculation of trapezoids tutorial supplementary ( add to 180° ) at one. The following problems: N.B how can we calculate the area of trapezoid calculator ( &. Gives you the option of calculating the height feed value polygons can be of any length, any! Length and it has two parallel bases that are supplementary ( add to 180° ) trapezium or trapezoid is to. Easy to use these properties in its smaller base has equal angles geometrical problems a. Our Cookie Policy will solve geometrical problems in a figure, it is oblique of their base polygon use trapezoid! Of any length, at any angle a 4 – sided geometrical which... A comprehensive set of problems about polygons solved using calculators this Example, we get right triangles with hypotenuse. Able to calculate the | {
"domain": "mediawebplace.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9425067244294587,
"lm_q1q2_score": 0.8526392131970199,
"lm_q2_score": 0.9046505357435622,
"openwebmath_perplexity": 1142.8748593455716,
"openwebmath_score": 0.6447550654411316,
"tags": null,
"url": "https://mediawebplace.com/o7jb35t1/252366-trapezoid-base-calculator"
} |
atomic-physics, neutrons
Title: What happens to neutrons when they are stopped by a material such as lead? If neutrons are stopped by a dense material, they are shedding their energy somehow. Does this mean the lead is becoming a heavier isotope (neutron capture), does the neutron embed itself into the material and turn to hydrogen? Is there a probabalistic distribution of reactions?
I would like to know for lead, tungesten, and water. I don't know what to look up but surely for water there are outcomes like deuterium, tritium, hydrogen gas in the water? If there are tables of these reactions, that would be a great resource. A neutron in a block of material can do 3 things each time it passes near a nucleus:
Nothing
Elastic scattering - transfers some of its kinetic energy to the nucleus
Inelastic scattering - the nucleus+neutron turn into several particles, usually liberating several neutrons (fission)
Absorption - transmutes the nucleus into a heavier isotope | {
"domain": "physics.stackexchange",
"id": 38675,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "atomic-physics, neutrons",
"url": null
} |
filters, fourier-transform, frequency-spectrum, filter-design
$$
\mathcal{F}\{\cos(ax)\} = \pi\left(\delta(\omega - a) + \delta(\omega + a)\right)
$$
which assumes a Fourier transform definition of:
$$
\mathcal{F}\{x(t)\} = X(\omega) = \int_{-\infty}^{\infty}x(t) e^{-j\omega t}dt
$$
It looks like you have an extra factor of $0.5$ at the front of your expression that you might have gotten from the transform. Note that different implementations or expressions of Fourier transforms often have arbitrary scaling factors included; what's most important is that if you apply the forward and inverse transforms in sequence, you get the original signal back:
$$
\mathcal{F}^{-1}\left\{\mathcal{F}\{x(t)\}\right\} = \mathcal{F}^{-1}\left\{X(\omega)\right\} = x(t)
$$
or at least to some known scaling factor. | {
"domain": "dsp.stackexchange",
"id": 577,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filters, fourier-transform, frequency-spectrum, filter-design",
"url": null
} |
rogue-planet
For the Milky way excape velocity calculation is larger and more complicated because most of the mass is in the dark matter halo and very much spread out, not localized in the center. The center is still more dense, the mass is far more distributed so the square root of two rule doesn't apply. Using the Sun as an example, the orbital velocity of our sun is about 220 km/s and it's escape velocity is 537 km/s. Source. As objects moves further towards the edge of the Milky way, the escape velocity decreases and the orbital velocity generally increases, so at close to the edge of the Milky way, you'd get something close to the square root of two ratio again. That means an object close to the edge of the Milky way only needs to add 41.4% of it's velocity to escape. | {
"domain": "astronomy.stackexchange",
"id": 1704,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rogue-planet",
"url": null
} |
harmonic-oscillator
Title: How to calculate viscous damping coefficient? The damping of a spring is calculated with:
$$[\zeta] = \frac{[c]}{\sqrt{[m][k]}}$$
Where c is the 'viscous damping coefficient' of the spring, according to Wikipedia. m is the mass, k is the spring constant, and zeta is the damping ratio.
How is the value of c calculated though? Is it a constant for the air through which the spring is moving or does it depend on the spring itself?
What data is required to calculate it and how can it be done?
I'm just looking at the oscillation of a spring vertically, and I have data for its decreasing amplitude, and the velocity of the spring at all points.
I have the value of the damping ratio, and I'm trying to find the value of 'c' in order to prove the above equation in an investigation.
There is almost no information about this online. OK, I will assume you have the under-damped case. | {
"domain": "physics.stackexchange",
"id": 39229,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "harmonic-oscillator",
"url": null
} |
If $\lim_{n\to\infty} a_n = \lim_{n\to\infty} c_n = x$ for some $x$:
$\lim_{n\to\infty} b_n = x$.
Incidentally, the usual proof of the squeeze theorem (which others have already given) essentially proves a more general theorem:
Given any sequences $(a_n)_{n\in\nn}$ and $(b_n)_{n\in\nn}$ such that $a_n \le b_n$ for any $n\in\nn$:
$\limsup_{n\to\infty} a_n \le \liminf_{n\to\infty} b_n$.
This theorem is very useful because it implies the following powerful technique in proving limits:
Given any sequences $(a_n)_{n\in\nn}$ and sequences $(b_{m,n})_{m,n\in\nn}$:
If for any $m \in \nn$ we have $| a_n – b_{m,n} | \le \frac{1}{m}$ for any $n\in\nn$:
$\lim_{n\to\infty} a_n = \lim_{n\to\infty} b_{n,n}$. | {
"domain": "bootmath.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9740426443092216,
"lm_q1q2_score": 0.8008472684501532,
"lm_q2_score": 0.8221891239865619,
"openwebmath_perplexity": 77.09679028742067,
"openwebmath_score": 0.9713578224182129,
"tags": null,
"url": "http://bootmath.com/taking-limits-on-each-term-in-inequality-invalid.html"
} |
remote-sensing, satellites
In a general case, the rendered image will only display varying colors if two or more channels contain different information (i.e. different bands).
As mentioned in the comments, it is important to note that the difference between monocromatic and pancromatic. The former is a general term used to describe images formed by shades of a single color. While the latter is a specific term used in multispectral sensors to denote a band with a wider spectral response, and that usually have also higher spatial resolution. | {
"domain": "earthscience.stackexchange",
"id": 1579,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "remote-sensing, satellites",
"url": null
} |
java, formatting, homework, calculator
do {
System.out.print("HST?: ");
HST = scan.nextDouble();
if (HST < 0) {
System.out.println("Enter A Value Above 0");
} else {
System.out.println(HST);
break;
}
} while (true);
double tax = priceInitial * (HST / 100) + priceInitial;
double PDI = (tax + priceInitial) * PDI_CHARGE;
double AfterPDI = PDI + tax;
String PDI_Print = NumberFormat.getCurrencyInstance().format(PDI);
String tax_Print = NumberFormat.getCurrencyInstance().format(tax);
String priceInitial_Print = NumberFormat.getCurrencyInstance().format(priceInitial);
String tax_Amount = NumberFormat.getPercentInstance().format(HST / 100);
String AfterPDI_Print = NumberFormat.getCurrencyInstance().format(AfterPDI); | {
"domain": "codereview.stackexchange",
"id": 41243,
"lm_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, formatting, homework, calculator",
"url": null
} |
organic-chemistry, physical-chemistry, extraction
The criterion of polarity which Debye employs is the dielectric constant of the saturated aqueous solution of the non-electrolyte relative to water at the same temperature. On this basis if the saturated solution has a dielectric constant less than water, "salting out" occurs in the presence of the added salt. If the dielectric constant of the saturated non-electrolyte solution is above that of water, the non-electrolyte becomes more soluble in the salt solution or is "salted in". This means that the non-electrolyte tends to aggregate around the ions at the expense of the water, and so the nonelectrolyte-water ratio in regions removed from the ions is lowered and the total water present can hold more non-electrolyte in solution. | {
"domain": "chemistry.stackexchange",
"id": 8560,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, physical-chemistry, extraction",
"url": null
} |
terminology, double-slit-experiment
Answers to Comments:
User Steveverrill writes:
While this is interesting, a worked example would be useful. I understood the wavelength of electrons is much less than visible light (approximately 3 orders of magnitude even for electrons accelerated to a handful of eV according to this.) quantummechanics.ucsd.edu/ph130a/130_notes/node72.html. It seems to me the slit would have to be impossibly thin. W< | {
"domain": "physics.stackexchange",
"id": 22878,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "terminology, double-slit-experiment",
"url": null
} |
homework-and-exercises, electromagnetism, electrostatics, electric-circuits, capacitance
it.
Our total system thus consists two capacitors formed by the gaps between the
slab and the plate, one ideal resistor in between them and parallel to this
resistor, the capacitance of the slab.
When the total system is charged there will be a charge
$$\pm q_{gap}=\pm \frac{\epsilon_0 U_0 S}{d-h}$$
on either side of the gap capacitors. The paracitic capacitor will remain
uncharged. After shorting the leads, there initially will be an voltage drop
over some of the wires. Since our wires are ideal, this will be compensated
by charging the paracitic capacitance and slightly discharging the the gap
capacitances. This happens instantaneously and no current flows through the
resistor. This proces stops when there is no longer any voltage drop over
the wires, i.e., when the voltage over the paracitic capacitance matches the
voltage total voltage drop over the gap capacitances.
At that point the gap capacitances will have a charge of | {
"domain": "physics.stackexchange",
"id": 46673,
"lm_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, electromagnetism, electrostatics, electric-circuits, capacitance",
"url": null
} |
errors, ros-humble
I don't know how this occurred and everything was working really fine.
I would try to think back carefully about what changed in this period between when things were working and weren't working as that's likely the best way to find out what was wrong on your system. | {
"domain": "robotics.stackexchange",
"id": 2635,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "errors, ros-humble",
"url": null
} |
navigation, costmap-2d, amcl, transform
Frame: /start_button published by /robot_state_publisher Average Delay: 0.00311848 Max Delay: 0.00710199
Frame: /stop_button published by /robot_state_publisher Average Delay: 0.00312182 Max Delay: 0.00710576
Frame: /top_side published by /robot_state_publisher Average Delay: 0.00312518 Max Delay: 0.00710939
Node: /odometry 16.2818 Hz, Average Delay: 0.0201343 Max Delay: 0.0437646
Node: /robot_state_publisher 16.2618 Hz, Average Delay: 0.00303951 Max Delay: 0.0070183 | {
"domain": "robotics.stackexchange",
"id": 5222,
"lm_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, costmap-2d, amcl, transform",
"url": null
} |
image-processing, filters
Title: Automatically crop out certain region around red objects I have the image seen below and I would like be able to automatically crop out everything around each red section - not enough to overlap but enough that you can see how connected to the green parts they are. Is there an easy way to do this, ideally in python/R? In case it matters, I'll be doing some image recognition on the resulting images.
The top image is an example of what I'd like them to look like, the bottom is what I start with.
Sorry if this is stupidly easy or really general, I've never done any work with images so don't even know where to start. I can't give you a detailed workflow for it right now, but I'll tell you how I'd go about it: | {
"domain": "dsp.stackexchange",
"id": 7440,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "image-processing, filters",
"url": null
} |
where and. 3 form of complex numbers simplify complex expressions using algebraic rules step-by-step this website, blog,,. Rectangular number= x + jy, where x and y are numbers form is.! Find their product or quotient try the free Mathway calculator and problem solver below to practice math... Make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked of math problems where. Video gives the formula for multiplication and division of complex numbers dividing polar form calculator polar page... Addition, and subtract their arguments divide complex numbers may be represented in standard form calculator a. 8 3 form of complex numbers in polar form - calculator label them and. Form, the steps are as follow another polar number of numbers take the! This notation, r ∠ θ can also be expressed in scientific notation of complex. Online tools for general use, i - imaginary part be able to sketch graphs polar... Order to find equivalent impedances in AC circuits, Wordpress, | {
"domain": "cimice.cz",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.947381048137938,
"lm_q1q2_score": 0.805246577880872,
"lm_q2_score": 0.8499711699569787,
"openwebmath_perplexity": 1188.9888814618516,
"openwebmath_score": 0.8129895925521851,
"tags": null,
"url": "http://cimice.cz/extra-large-zvt/dividing-polar-form-calculator-7f8c9b"
} |
php, symfony2
// Calling the external API which multiple errors could occur.
try {
if (!empty($session)) {
$response = $client->request('GET', $url.'/'.$session, [
'headers' => [
'token' => $token
]
]);
} else {
$response = $client->request('GET', $url, [
'headers' => [
'token' => $token
]
]);
}
return new Response($response->getBody(), 200);
} catch (ClientException $e) {
$response = $e->getResponse();
return new Response($response->getBody()->getContents(), $response->getStatusCode());
} catch (ServerException $e) {
$response = $e->getResponse();
return new Response($response->getBody()->getContents(), $response->getStatusCode());
} catch (BadResponseException $e){ | {
"domain": "codereview.stackexchange",
"id": 15808,
"lm_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, symfony2",
"url": null
} |
the coordinates of whose vertices are given by A(x1, y1), B(x2, y2) and C(x3, y3) respectively. circumcentre is the mid-point of AB, i.e (a/2,a/2) centroid is (a/3,a/3), orthocentre is the origin. The centroid divides each median into two segments, the segment joining the centroid to the vertex is twice the length of the length of the line segment joining the midpoint to the opposite side. Register Now. One of our academic counsellors will contact you within 1 working day. Use code VINEETLIVE to unlock free plan. For getting an idea of the type of questions asked, refer the previous year papers. What do we mean by the Circumcentre of a Triangle? La primera se relaciona con el campo de la física, y consiste en que éste punto es el centro de gravedad. Similarly co-ordinates of centre of I2(x, y) and I3(x, y) are, I2(x, y) = (ax1–bx2+cx3/a–b+c, ay1–by2+cy3/a–b+c), I3(x, y) = (ax1+bx2–cx3/a+b–c, ay1+by2–cy3/a+b–c), The coordinates of the excentre are given by, I1 = (-ax1 + bx2 + cx3)/(-a + | {
"domain": "curtisstone.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854164256365,
"lm_q1q2_score": 0.806030410832761,
"lm_q2_score": 0.8311430520409023,
"openwebmath_perplexity": 1579.7517306425304,
"openwebmath_score": 0.5268669724464417,
"tags": null,
"url": "http://curtisstone.com/power-a-wjffvww/properties-of-incentre-circumcentre-orthocentre-centroid-5d43c0"
} |
neural-networks, machine-learning, gradient-descent
The trend is that as the Iteration(cost) increases(cost decreases), the training set accuracy increases as expected, but the CV Set/Test Set Accuracy decreases. My initial thought is that this has to do with precision/bias issue, but I really can't buy it.
Anyone know what this entails? Or any reference? Training scores improving (loss decreasing and accuracy increasing) whilst the opposite happens with cross validation and test data is a sign of overfitting to the training data. Your neural network is getting worse at generalising and no amount of further training will improve it - in fact the situation will get worse the more you train.
This is the main reason you have CV data sets, to show you when this happens before you try to use your model against the test set or real world data. So it is not "peculiar" at all, but the CV set doing its job for you, allowing you notice something has gone wrong. | {
"domain": "ai.stackexchange",
"id": 1215,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-networks, machine-learning, gradient-descent",
"url": null
} |
when the second derivative is greater/less than 0 by first finding when it is 0 or undefined. Find parametric equations for this curve, using a circle of radius 1, and assuming that the string unwinds counter-clockwise and the end of the string is initially at $(1,0)$. The graph of the parametric functions is concave up when $$\frac{d^2y}{dx^2} > 0$$ and concave down when $$\frac{d^2y}{dx^2} <0$$. Stack Exchange Network Stack Exchange network consists of 176 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. [2] becomes Solutions are or Write the equation for a circle centered at (4, 2) with a radius of 5 in both standard and parametric form. Parametric equations are commonly used in physics to model the trajectory of an object, with time as the parameter. How can we write an equation which is non-parametric for a circle? Parametric equations are useful for drawing curves, as the | {
"domain": "juvemedspa.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9863631659211717,
"lm_q1q2_score": 0.8064253509068541,
"lm_q2_score": 0.817574478416099,
"openwebmath_perplexity": 355.1375793835365,
"openwebmath_score": 0.840110719203949,
"tags": null,
"url": "http://www.juvemedspa.com/js/0tlwp08k/parametric-equation-of-circle-cbd045"
} |
gazebo-plugin, joint, errors, px4
</plugin>
<plugin filename="gz-sim-joint-position-controller-system" name="gz::sim::systems::JointPositionController">
<joint_name>left_aileron_joint</joint_name>
<sub_topic>servo_0</sub_topic>
</plugin>
<plugin filename="gz-sim-joint-position-controller-system" name="gz::sim::systems::JointPositionController">
<joint_name>right_aileron_joint</joint_name>
<sub_topic>servo_1</sub_topic>
</plugin>
</model>
</sdf> | {
"domain": "robotics.stackexchange",
"id": 38919,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo-plugin, joint, errors, px4",
"url": null
} |
c#, .net, linq
from winner in MetaData.Winner
join o in MetaData.Objective on winner.ObjectiveID equals o.ObjectiveID
where o.ObjectiveNm == Constants.Promotions.SecVideo1
where winner.Active
where winner.UserID == up.UserID
select winner).Count(),
Quiz1 = (
from winner2 in MetaData.Winner
join o2 in MetaData.Objective on winner2.ObjectiveID equals o2.ObjectiveID
where o2.ObjectiveNm == Constants.Promotions.SecQuiz1
where winner2.Active
where winner2.UserID == up.UserID
select winner2).Count(),
}; It doesn't feel right, because you have a lot of repetitive code.
Notice how each property selector's where statement contains
where objectiveIds.Contains(winner.ObjectiveID)
where winner.Active
where winner.UserID == up.UserID | {
"domain": "codereview.stackexchange",
"id": 210,
"lm_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
} |
node.js
var check = function(username, email) {
console.log('chekc');
db.users.ensureIndex({email:1},{unique:true});
db.users.ensureIndex({uppercase:1},{unique:true});
if(!username.match(/^[A-Za-z0-9_]*$/)) {
errors.push('Username is invalid');
finishedCheck();
} else {
db.users.findOne({uppercase: username}, function(err, val) {
if(val) {
errors.push('Username Taken');
}
finishedCheck();
});
} | {
"domain": "codereview.stackexchange",
"id": 2068,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "node.js",
"url": null
} |
electromagnetism, electrostatics, maxwell-equations, magnetostatics
Title: How would you define electrostatics and magnetostatics starting from Maxwell's equations? I'm reading Griffith's text, and he starts by defining Electrostatics as requiring the source charges don't move. I've seen a few slightly different definitions of electrostatics and magnetostatics. If you wanted to start from the full Maxwell equations in a vacuum, how would you precisely define Electrostatics and Magnetostatics? Would Electrostatics be the condition that $\frac{\partial\vec{B}}{\partial t}=\vec{0}\implies\nabla\cdot\vec{E}=\frac{\rho}{\epsilon_o},$ and $\nabla\times\vec{E}=\vec{0}?$
And would Magnetostatics be the condition that $\frac{\partial\vec{E}}{\partial t}=\vec{0}\implies \nabla\cdot\vec{B}=0,$ and $\nabla\times\vec{B}=\vec{0}?$ | {
"domain": "physics.stackexchange",
"id": 30999,
"lm_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, electrostatics, maxwell-equations, magnetostatics",
"url": null
} |
beginner, c, state-machine
#endif
This is the .c file
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sb_fsm.h"
/**
* Idle state to take commands
* @returns sbTransition - Transition code
*/
sbTransition sbIdleState(void) {
int err = 1;
while(1) {
char *input = malloc(255 * sizeof(char));
printf("Idle State\n");
printf("> ");
scanf("%s", input);
getc(stdin);
if (strcmp(input, "startup") == 0){
return sbStartupTrans;
} else if (strcmp(input, "selftest") == 0) {
return sbSelfTestTrans;
} else if (strcmp(input, "help") == 0) {
printf("<startup> : Initialize the startup procedure\n");
printf("<selftest> : Initialize module check\n");
continue;
}
printf("\ntype 'help' to get the commands\n");
}
} | {
"domain": "codereview.stackexchange",
"id": 40069,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, c, state-machine",
"url": null
} |
- 9 months, 2 weeks ago
Thanks a lot.But can you please give me a your solution to your problem How is this ??!!
- 9 months, 2 weeks ago
Sure. Observe that $\sum_{n=1}^{\infty}e^{-nx}\ =\ \frac{1}{e^{x}-1}$
Using this, we have $\int_{0}^{\infty}\frac{x^{t-1}}{e^{x}-1}dx=\int_{0}^{\infty}\left(\sum_{n=1}^{\infty}x^{t-1}e^{-nx}\right)dx$
Swapping the integral and summation , and using the identity $\int_{0}^{\infty}x^{a}e^{-bx}dx\ =\ \frac{a!}{b^{a+1}}$ we will arrive at the answer.
- 9 months, 2 weeks ago
Mr. Yajat Shamji,if people provides a solution to any problem you must try and appreciate it and not discourage them.Please don't repeat such acts.
- 9 months, 2 weeks ago
I'm not. I.. was thinking of you and I read your profile so I thought I could bring you over. After all, you like to contribute, right?
Also, I wasn't discouraging @Aaghaz Mahajan's solution, I..
- 9 months, 2 weeks ago
- 9 months, 2 weeks ago | {
"domain": "brilliant.org",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9572777975782055,
"lm_q1q2_score": 0.8672839332027289,
"lm_q2_score": 0.9059898134030163,
"openwebmath_perplexity": 3197.5597409053917,
"openwebmath_score": 0.9651675820350647,
"tags": null,
"url": "https://brilliant.org/discussions/thread/helphow-to-slove-this-integral/"
} |
c++, optimization, algorithm, quick-sort
You pass the location of the first and last element in the array.
quicksort(list, low, j-1);
quicksort(list, j+1, high);
It is more C++ like to use first and one past the point you consider end. It also makes the code look neater try it and see. | {
"domain": "codereview.stackexchange",
"id": 5218,
"lm_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++, optimization, algorithm, quick-sort",
"url": null
} |
operating-systems
Title: How synchronous and asynchronous signals are different? A process can receive two kinds of signals classified based on the source and reason.
Synchronous are the one that are generated by illegal memory access or division by zero.
Asynchronous are the one that are generated by another process like SIGKILL and etc.
Quoting from the 9e OSC Book by Prof. Galvin, topic Signal Handling (Section 4.6.2)
A signal may be received either synchronously or asynchronously, depending on the source of and the reason of the event being signaled
...
Examples of synchronous signal incude illegal memory access or and division by zero $0$. ... delivered to the same process that performed the operation that caused the signal.
When signal is generated by an event external to the running process, that process receives the signal asynchronously. Examples of such signal include terminating a process with specific keystrokes (such as CTRL-C) and timer expire (SIGALRM from sleep) | {
"domain": "cs.stackexchange",
"id": 21862,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "operating-systems",
"url": null
} |
thermodynamics, differential-equations, diffusion
$$X(0)T(t)=0$$
Assume $T(t)\neq 0$, then:
$$X(0)=0$$
$$A\sin(\lambda 0)+B\cos(\lambda 0)=0$$
$$\implies B=0$$
And:
$$X(x)=A\sin(\lambda x)$$
With the first BC, $u_x(l)=0$:
$$X'(l)T(t)=0$$
Assume $T(t)\neq 0$:
$$A\cos(\lambda l)=0$$
Assuming $A\neq 0$, then:
$$\lambda l=\frac{n\pi}{2}$$
So our eigenvalues become:
$$\lambda_n=\frac{n\pi}{2l}$$
For $n=1,2,3,...$
The functions $X_n(x)$ are:
$$X_n(x)=A_n\sin\Big(\frac{n\pi x}{2l}\Big)$$
So we have:
$$u_n(x,t)=A_ne^{-\Big(\frac{n\pi}{2l}\Big)^2\alpha t}\sin\Big(\frac{n\pi x}{2l}\Big)$$
And using the superposition principle:
$$u(x,t)=\displaystyle \sum_{n=1}^{\infty}A_ne^{-\Big(\frac{n\pi}{2l}\Big)^2\alpha t}\sin\Big(\frac{n\pi x}{2l}\Big)$$ | {
"domain": "physics.stackexchange",
"id": 44352,
"lm_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, differential-equations, diffusion",
"url": null
} |
graph, scala
mapBFS(adjMap).foreach{println}
This gives me the desired result:
List(i7, i1, i6, i2, i5)
List(i8, i4, i3, i9) | {
"domain": "codereview.stackexchange",
"id": 22984,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "graph, scala",
"url": null
} |
c, memory-management, matlab
for( i = 0, size = rows * cols; i < size; i++){
free_matrix(cell.array[i]);
}
free(cell.array);
}
INLINE Matrix
get_matrix_from_cell(Cell cell, int row, int col){
Matrix matrix;
int rows = cell.rows;
int cols = cell.cols;
ASSERT(cell.array != NULL, FATAL_NULL_POINTER);
ASSERT(rows > 0 && cols > 0, FATAL_NEGATIVE_DIMENSIONS);
ASSERT(row >= 0 && row < rows, FATAL_INDEX_OUT_OF_BOUNDS);
ASSERT(col >= 0 && col < cols, FATAL_INDEX_OUT_OF_BOUNDS);
matrix = cell.array[(row * cols) + col];
return matrix;
}
INLINE void
set_matrix_in_cell(Cell cell, int row, int col, Matrix matrix){
int rows = cell.rows;
int cols = cell.cols;
ASSERT(cell.array != NULL, FATAL_NULL_POINTER);
ASSERT(rows > 0 && cols > 0, FATAL_NEGATIVE_DIMENSIONS);
ASSERT(row >= 0 && row < rows, FATAL_INDEX_OUT_OF_BOUNDS);
ASSERT(col >= 0 && col < cols, FATAL_INDEX_OUT_OF_BOUNDS);
cell.array[(row * cols) + col] = matrix;
} | {
"domain": "codereview.stackexchange",
"id": 1391,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, memory-management, matlab",
"url": null
} |
moment of inertia about perpendicular axis of rotation. I x = I y = moment of inertia about planar axis of rotation. m = mass of the cylinder. r = radius of the cylinder. h = height of the. Moment of inertia of a solid circular cylinder about an axis passing through its centre of mass and perpendicular to its length: Fig. 2. Let us consider a solid circular cylinder of radius r and length l be rotating about an axis CD passing through its centre of mass and perpendicular to its length. Let M be the total mass of the cylinder, then. The Gallons in a Cylinder calculator computes the volume of a right circular cylinder in gallons from the height (h) and radius (r) of the base (see diagram).. The Calculator prov. I am attempting to calculate the moment of inertia of a cylinder of mass M, radius R and length L about the central diameter i.e. perpendicular to the axis of the cylinder. ... Moment of inertia of solid cylinder. 0. How to derive the moment of inertia of a. If ρ is the density of | {
"domain": "real-scan-service.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9825575167960731,
"lm_q1q2_score": 0.8033139405736061,
"lm_q2_score": 0.8175744695262777,
"openwebmath_perplexity": 738.6196054216495,
"openwebmath_score": 0.7087952494621277,
"tags": null,
"url": "https://kmgdl.real-scan-service.de/moment-of-inertia-of-solid-cylinder.html"
} |
ruby, rspec, hash-map
The Code
1 class CashRegister
2 attr_reader :coins
3
4 def coins=(coins=[25,10,5,1])
5 if (
6 coins.class != Array ||
7 coins.map { |coin| coin.class.ancestors.include?(Integer) }.include?(false)
8 )
9 raise Exception
10 end
11
12 @optimal_change = Hash.new do |hash, key|
13 hash[key] =
14 if (key < coins.min)
15 Change.new(coins)
16 elsif (coins.include?(key))
17 Change.new(coins).add(key)
18 else
19 coins.map do |coin|
20 hash[key - coin].add(coin)
21 end.reject do |change|
22 change.value != key
23 end.min { |a,b| a.count <=> b.count }
24 end
25 end
26
27 @coins = coins
28 end
29
30 alias :initialize :coins=
31
32 def make_change(amount)
33 return(@optimal_change[amount])
34 end
35 end
36
37 class Change < Hash
38 def initialize(coins) | {
"domain": "codereview.stackexchange",
"id": 6308,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, rspec, hash-map",
"url": null
} |
python, performance, io, web-scraping, compression
b = download(findLocL[i])
if not getTitle:
print ""
else:
X.append(getAddress)
b = download(findLocL[i])
if not getTitle:
print ""
else:
Y.append(getTitle)
sizeWXY = len(W)
def XReplace(text, dic):
for i, j in dic.iteritems():
text = text.replace(i, j)
XA.append(text)
def YReplace(text2, dic2):
for k, l in dic2.iteritems():
text2 = text2.replace(k, l)
YA.append(text2)
for d in range(0,sizeWXY):
old = str(X[d])
reps = {' ':'-', ',':'', '\'':'', '[':'', ']':''}
XReplace(old, reps)
old2 = str(Y[d])
YReplace(old2, reps)
count = 0
for e in range(0,sizeWXY):
newYPL = "http://www.yellowpages.com/" + XA[e] + "/" + YA[e] + "?order=distance"
v = download(newYPL)
abc = str('<h3 class="business-name fn org">\n<a href="')
dfe = str('" class="no-tracks url "')
findFinal = re.compile(abc + '(.*)' + dfe) | {
"domain": "codereview.stackexchange",
"id": 1043,
"lm_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, io, web-scraping, compression",
"url": null
} |
classical-mechanics, variational-principle, brachistochrone-problem
So my question (and I do have one) is what shape of track give the absolute shortest time? I think it's a calculus of variation problem or something. For simplicity, let's assume a) no friction b) a point mass and c) that the end point is a small delta below the start point. I played around with some MATLAB code and it seemed to give a parabola of depth about 0.4 times the distance between the start and stop point. The value of g and the mass didn't seem to matter. But I don't know if my code was right or wrong and I couldn't figure out the significance of 0.4. I Googled around for an answer but couldn't find one. Thanks for any pointers! This is a special case of the brachistochrone problem, and has been known since at least ancient Greek times.
The solution is a cycloid.
It is most easily found using the calculus of variations and the problem is often chosen as a first example of the technique. | {
"domain": "physics.stackexchange",
"id": 4703,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classical-mechanics, variational-principle, brachistochrone-problem",
"url": null
} |
• When transposing matrix changes its dimensionality, if it's not square. You can't compare for equality matrices that have different dimensionality. – Kaster Jun 24 '13 at 18:10
• Symmetric matrices are matrices that have the property that $A^T = A$, and all such matrices are square anyway (by counting rows and columns). The wikipedia definition is correct. Don't assume that, just because the word "square" is used, there must be non-square examples too - the word is redundant here, and is included just for clarity. – Billy Jun 24 '13 at 18:12 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9473810436809827,
"lm_q1q2_score": 0.8162049629697358,
"lm_q2_score": 0.8615382040983515,
"openwebmath_perplexity": 336.57805009787165,
"openwebmath_score": 0.8088007569313049,
"tags": null,
"url": "https://math.stackexchange.com/questions/428499/non-symmetric-at-a"
} |
visible-light
Title: How can a camera zoom & photograph the sun without damaging the lens? I find Huge images of sun in google images, i doubt that if we zoom the sun's image by using camera, then definitely sunlight will also get intensified leads to lens damage nothing but acting like magnifying glass.
So How can a camera zoom & photograph the sun without damaging the lens? You can buy solar filters (for example) which block out most of the radiation including UV, making it safe to photograph.
You can even make your own really cheaply. Buy a roll of biaxially-oriented polyethylene terephthalate (BoPET), perhaps better known by its brand name Mylar. This will set you back about $15USD:
Cut out a circle, attach it to a rim, and you have a bespoke solar filter:
Then you can get some wonderful shots of the sun including sun spots and the passing of the ISS. | {
"domain": "physics.stackexchange",
"id": 20312,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "visible-light",
"url": null
} |
ros
Title: ROS Answers SE migration: texas_park
I'm trying to find the packages for Texai robot, those were available few years ago, where are there now?
Originally posted by Harry on ROS Answers with karma: 21 on 2012-11-17
Post score: 0
They're probably in one of the graveyard areas of the ros-pkg or wg-ros-pkg repositories.
Originally posted by tfoote with karma: 58457 on 2012-12-21
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 11779,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
Observation 4: For all $$i$$ we have $$d_i\leq7$$.
Suppose toward a contradiction that $$d_i=8$$ for some member $$i$$. To fill these $$d_i=8$$ commissions requires $$9d_i+1=73$$ distinct members, including member $$i$$, leaving $$10$$ members. Each of the remaining $$32$$ commissions has at most $$8$$ members from the $$d_i=8$$ commissions, hence at least $$2$$ members from the remaining $$10$$. Numbering these $$1$$ throught $$10$$ we find that $$\sum_{k=1}^{10}d_k\geq2\times32=64.$$ We distinguish two cases:
Case 1: If $$d_j=8$$ for some $$1\leq j\leq10$$ then $$j$$ shares a commission with at least $$8$$ other of these $$10$$ members, hence they all have $$d_k\leq6$$ by observation $$3$$. To satisfy the inequality there must be one more member $$j'$$ with $$d_{j'}=8$$, and the other $$8$$ have $$d_k=6$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9835969698879862,
"lm_q1q2_score": 0.8771826370558871,
"lm_q2_score": 0.8918110404058913,
"openwebmath_perplexity": 480.8203853774128,
"openwebmath_score": 0.827904999256134,
"tags": null,
"url": "https://math.stackexchange.com/questions/3023032/finding-the-minimal-number-of-members"
} |
image-processing, computer-vision, image-segmentation
% Chop off out of range parts
chop = size(Rf,1) - size(I,1);
chop = ceil(chop/2);
Rf = Rf(chop+1:end-chop,:);
imagesc(Rf); colormap gray(256); pause;
% Negative lines - threshold
Rf(Rf > 0) = 0;
imagesc(Rf); colormap gray(256); pause;
% Plot sum - peaks are angles
Rp = sum(abs(Rf));
plot(Rp);
% Get the peaks sep by at least 15 deg
[p,a] = findpeaks(Rp,'minpeakdistance',15,'sortstr','descend');
hold on;
scatter(a,p,'r*');
hold off;
pause;
% Iterate through peaks and find fequencies
for j = 1:numel(a)
% Get subsection of Radon transform around angle and transpose
vstart = max([a(j)-10,1]);
vend = min([a(j)+10,size(Rf,2)]);
Rsub = Rf(:,vstart:vend).';
imagesc(Rsub); colormap gray(256); pause;
RsubP = sum(abs(Rsub));
plot(RsubP); pause; | {
"domain": "dsp.stackexchange",
"id": 999,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "image-processing, computer-vision, image-segmentation",
"url": null
} |
beginner, powershell
if (-not [System.IO.Path]::IsPathRooted($path)) {
return "$dirRoot/$path"
} else {
return $path
}
As a general rule for if/else in any programming lanuage, it's best to put the positive case first. That makes the code easier to read and think about.
$prodDirName = Default-Parameter "Production" $prodDirName | Fix-Path
$stageDirName = Default-Parameter "Stage" $stageDirName | Fix-Path
$backupDirName = Default-Parameter "Backups/$dateStr" $backupDirName | Fix-Path
As another general rule, it's best not to overwrite parameters, for a few reasons:
When reading the code, you have to think about whether the variable has been overwritten or not. That makes it harder to reason about the code.
A reader of the code may not even notice that the variable gets overwritten.
If you are stopped at a breakpoint in the debugger, you may want to see what the original parameter was, but you can't if is has been overwritten. | {
"domain": "codereview.stackexchange",
"id": 30124,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, powershell",
"url": null
} |
ros
12: (EVAL (SWANK:OPERATE-ON-SYSTEM-FOR-EMACS "" (QUOTE SWANK-IO-PACKAGE::LOAD-OP)))
13: (SWANK:EVAL-FOR-EMACS (SWANK:OPERATE-ON-SYSTEM-FOR-EMACS "" 'SWANK-IO-PACKAGE::LOAD-OP) "COMMON-LISP-USER" 29)
14: (SWANK::PROCESS-REQUESTS NIL)
15: ((LAMBDA ()))
16: ((LAMBDA ()))
17: (SWANK-BACKEND::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA #) {1003060119}>)
18: ((FLET SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK) #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA #) {1003060119}>)
19: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-OUTPUT* . #) (*STANDARD-INPUT* . #) (*TRACE-OUTPUT* . #) (*ERROR-OUTPUT* . #) (*DEBUG-IO* . #) (*QUERY-IO* . #) ...) #<CLOSURE (LAMBDA #) {1003060139}>)
20: (SWANK::HANDLE-REQUESTS #<SWANK::MULTITHREADED-CONNECTION {1003B98CC1}> NIL)
21: ((FLET #:WITHOUT-INTERRUPTS-BODY-[BLOCK414]419))
22: ((FLET SB-THREAD::WITH-MUTEX-THUNK))
23: ((FLET #:WITHOUT-INTERRUPTS-BODY-[CALL-WITH-MUTEX]301))
24: (SB-THREAD::CALL-WITH-MUTEX ..) | {
"domain": "robotics.stackexchange",
"id": 11756,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
fft, signal-analysis, convolution, fading-channel, channel-estimation
Y&=F^By \\
&= p'FCpF'X & F, F' \text{ are symmetric matrices!}\\
&=p'FCF'pX\\
&=p'\underbrace{FCF'}_{\text{IDFT-Channel-DFT}}\underbrace{pX}_{\text{permuted symbols}}
\end{align}
So, all that's really happening here mathematically is that you permute the symbols before transmission, then de-permute them at the receiver. In between, you get normal OFDM. There's no advantage or disadvantage to the permutation w.r.t. to channel diagonalizability, but we've arrived here in your previous question already.
Now, for channel estimation, you'll want to insert pilots such that they make sense for the central $FCF'$ part – in other words, you need to think about where you'd want your normal OFDM system to have these pilots, and then shift these positions according to your $p$. | {
"domain": "dsp.stackexchange",
"id": 10014,
"lm_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, signal-analysis, convolution, fading-channel, channel-estimation",
"url": null
} |
ros, navigation, sbpl-lattice-planner, sbpl, move-base
Originally posted by weiin with karma: 2268 on 2013-07-15
This answer was ACCEPTED on the original site
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 5407,
"lm_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, navigation, sbpl-lattice-planner, sbpl, move-base",
"url": null
} |
java, array, java-8
return data.stream().mapToInt(i -> {
return i;
}).toArray();
}
/*prints contents of arraylist all on 1 line*/
public static void printArrList(ArrayList<Integer> al)
{
System.out.print("[");
/*this could be replaced with a for (each) loop*/
al.stream().forEach((i) -> {
System.out.print(i+", ");
});
System.out.println("]");
} | {
"domain": "codereview.stackexchange",
"id": 9082,
"lm_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, array, java-8",
"url": null
} |
positional-astronomy, ephemeris
Artificial Satellites
Many planetarium programs also include artificial satellites. These are based on Keplerian elements, but quickly go out of date, so a more complex model is used to adapt the positions called SGP4/SDP4 (and SGP8/SDP8). The algorithm was made public as source code from NORAD in the 80's, and code is available in a multitude of programming languages, but the most thourough ones are available at Celestrak. The elements also need to be updated regularly, and Celestrak provides some of those, but Space-Track is the official source. Programs have to update this file on at least a daily basis to stay up to date.
Comets/asteroids | {
"domain": "astronomy.stackexchange",
"id": 6625,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "positional-astronomy, ephemeris",
"url": null
} |
That is exactly what you refere to: considere as a hypothesis [$P(n)$ true and $P(n+1)$ false] and get a contradiction.
So, your method works: $$\left[P(n_0) \land \forall n \geq n_0\color{blue}{\Big(P(n) \land \lnot P(n+1)\implies \text{false}\Big)}\right] \implies \forall n \geq n_0 \Big(P(n)\Big)$$
• Nice typography~ – DanielV Jan 6 '16 at 18:45
• Thanks! I tried to write the most formal justification as I could (as OP method was obviously correct, in terms of logic). – JnxF Jan 6 '16 at 20:26 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9637799410139921,
"lm_q1q2_score": 0.8010390057012622,
"lm_q2_score": 0.8311430562234878,
"openwebmath_perplexity": 400.78534009420974,
"openwebmath_score": 0.9393781423568726,
"tags": null,
"url": "https://math.stackexchange.com/questions/1601944/induction-and-contradiction"
} |
nuclear-physics
Most nuclides can't be produced in bulk quantities, so in most cases, a much easier technique is to measure the lifetimes of the excited states in a rotational band. If you think of the nucleus semiclassically as a rotating electrically charged ellipsoid, then the rate of radiation is proportional to the square of the quadrupole moment. For nuclei created in-beam in an accelerator experiment and studied through gamma-ray spectroscopy, the lifetime can often be inferred from the statistical distribution of the Doppler shifts of the recoiling nuclei, which are recoiling when they are formed by fusion and then slow down inside the target.
Sometimes one might know only the ground-state spin and parity. In many cases, this can be compared with theory to give a good idea of the deformation. | {
"domain": "physics.stackexchange",
"id": 56270,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nuclear-physics",
"url": null
} |
ruby, rust
Title: Chat console using Ruby and Rust One of the exercises I like to program when learning a new language is a chat client for the console. I've programmed it in many languages (Perl, Python, C, C++, JavaScript, ...). One of the versions I like most for its terseness is Ruby:
#!/usr/bin/ruby
require 'socket'
s = TCPSocket.new(ARGV[0], ARGV[1].to_i)
nick = ARGV[2]
# send nick to server
s.puts(nick)
# input thread
kbd = Thread.new {
STDIN.each_line { |line|
s.puts("\033[31m" + nick + "> " + "\033[0m" + line)
}
s.close_write
}
# output thread
con = Thread.new {
s.each_line { |line|
STDOUT.puts(line)
}
}
kbd.join
con.join
The initial Rust equivalent would be something similar to:
use std::os;
use std::io;
use std::io::{TcpStream, BufferedReader};
fn main() {
let args = os::args();
let mut s = TcpStream::connect(args[1], from_str(args[2]));
// send nick to server
nick = args[3];
s.write_line(nick); | {
"domain": "codereview.stackexchange",
"id": 9905,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, rust",
"url": null
} |
Also we can have either ##t^2-9=0## or ##t^2-16=0##
from this we get ##t=3,4,-3,-4##
So putting the obtained values back in ##t=x+4## we get ##x=-9,-8,-7,-1,0,1##
So ordered pairs ##(x,y)## are ##(-9,-12);(-9,12);(-8,0);(-7,0);(-1,0);(0,0);(1,12);(1,-12)##
*Edited the answer to include all values of (x,y)
Yet another edit: I forgot the ##t=-5## cases here.
Edit (iii): I wrote 144 instead of 12 for some reasons.
Last edited:
Mentor
I edited that in my response, sorry I didn't include them initially, it takes a lot of effort for me to type this as I'm still new to this.
In case you will have to write LaTeX more often, here or IRL, it is convenient to download a little script program (I use AutoHotKey), write the script, and run it. It makes LaTeX typing really easy.
Just leave out the keys you need for other purposes like Ctrl+C/V/X/A or Alt+D. But the program allows you to suspend it with a single click in case you need the regular shortcuts. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.959762052772658,
"lm_q1q2_score": 0.8018653965939178,
"lm_q2_score": 0.8354835391516133,
"openwebmath_perplexity": 4714.843212178853,
"openwebmath_score": 0.998621940612793,
"tags": null,
"url": "https://www.physicsforums.com/threads/math-challenge-may-2021.1002626/page-4"
} |
c, linked-list, console, database, edit-distance
printf("Usage: %s -a LAST FIRST NUMBER\n", executable_name);
printf(" %s --add LAST FIRST NUMBER\n", executable_name);
puts("");
printf(" %s -r ID1 ID2 ... IDn\n", executable_name);
printf(" %s --remove ID1 ID2 ... IDn\n", executable_name);
puts("");
printf("(1) %s\n", executable_name);
printf("(2) %s LAST_EXPR\n", executable_name);
printf("(3) %s - FIRST_EXPR\n", executable_name);
printf("(4) %s LAST_EXPR FIRST_EXPR\n", executable_name);
puts("");
puts("Where: -a or --add for adding one new book entry.");
puts(" -r or --remove for removing book entries by their IDs.");
puts("");
puts("(1) List all book entries in order.");
puts("(2) Match by last name and list the closest book entries.");
puts("(3) Match by first name and list the closest book entries.");
puts("(4) Match by both last and first names and list the closest book " | {
"domain": "codereview.stackexchange",
"id": 22181,
"lm_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, linked-list, console, database, edit-distance",
"url": null
} |
condensed-matter, perturbation-theory
\sum_{i,j=1}^{N}\langle\phi^{\text{HF}}_i\phi^{\text{HF}}_j|\hat{V}(1-P_{12})|\phi^{\text{HF}}_i\phi^{\text{HF}}_j\rangle
\ ,
$$
$$
\langle\Phi_{\text{HF}}|\hat{W}|\Phi_{\text{HF}}\rangle=
-\frac{1}{2}
\sum_{i,j=1}^{N}\langle\phi^{\text{HF}}_i\phi^{\text{HF}}_j|\hat{V}(1-P_{12})|\phi^{\text{HF}}_i\phi^{\text{HF}}_j\rangle
\ ,
$$
so indeed
$$
\begin{aligned}
\sum_{i=1}^{N}\varepsilon^{\text{HF}}_i+
\langle\Phi_{\text{HF}}|\hat{W}|\Phi_{\text{HF}}\rangle
&=
\sum_{i=1}^{N}\langle\phi^{\text{HF}}_i|\hat{h}|\phi^{\text{HF}}_i\rangle+
\frac{1}{2}\sum_{i,j=1}^{N}\langle\phi^{\text{HF}}_i\phi^{\text{HF}}_j|\hat{V}(1-P_{12})|\phi^{\text{HF}}_i\phi^{\text{HF}}_j\rangle
\\
&=
E_{\text{HF}} \ .
\end{aligned}
$$ | {
"domain": "physics.stackexchange",
"id": 97640,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "condensed-matter, perturbation-theory",
"url": null
} |
python-3.x, console, escaping
if criteria(input_user):
return input_user
print(input_wrong_msg + len(input_user) * ' ' + a)
if __name__ == '__main__':
from colorama import deinit, init
init()
try:
input_wrong_up_line('Exit? [y/ ] ', lambda input_user: input_user == 'y')
finally:
deinit() Nice, but you’re doing too much work.
\033[J will erase from the cursor position until the end of the screen, which eliminates the need to count characters and print spaces.
(See ANSI escape codes: CSI sequences for additional codes & information.)
So, you just need to move the cursor up one line, clear to end of screen, and not print a newline, leaving the cursor at the “up one line“ position.
print("\033[A\033[J", end='')
Note: if the user input is more than one line of text, moving the cursor up only one line will only result in clearing the last line. Fixing that would require more effort. | {
"domain": "codereview.stackexchange",
"id": 41429,
"lm_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-3.x, console, escaping",
"url": null
} |
Since any real $$x$$ satisfies one of these two conditions, we could also write this as
$$f(x) = \left\{\begin{array}{ll} x+\sin x, & \text{if }x\geq 5\\ x, & \text{else }\end{array}\right.$$
Another, less common notation is that of the Iverson bracket. The Iverson bracket $$[P]$$ for a conditional $$P$$ is defined as $$[P]=\left\{\begin{array}{ll} 1, & \text{if }P\text{ is true}\\ 0, & \text{else }\end{array}\right.$$
This allows us to express piecewise functions with one-line notation, e.g., $$f(x)=x [x<5]+(x\sin x)[x\geq 5].$$ Since $$x\leq 5$$ is the negation of $$x<5$$, we may eliminate the first bracket as $$[x<5]=1-[x\geq 5]$$ and therefore also have \begin{align} f(x)&=x(1-[x\geq 5])+(x+\sin x)[x\geq 5]\\ &=x+(\sin x)[x\geq 5]. \end{align} This captures the intuition that, whether or not $$x\geq 5$$, we start "at minimum" with $$f(x)=x$$; if we $$x\geq 5$$, we add on $$\sin x$$ as well. Of course, we could also have done this with our original notation: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9919380070417538,
"lm_q1q2_score": 0.8753137499435851,
"lm_q2_score": 0.8824278772763472,
"openwebmath_perplexity": 250.9069976355607,
"openwebmath_score": 0.9806784987449646,
"tags": null,
"url": "https://math.stackexchange.com/questions/3987133/how-can-i-describe-a-linear-equation-that-becomes-sinusoidal-after-a-certain-poi"
} |
php, object-oriented, mysql, pdo
But for the rest - I honestly cannot think of any improvement else.
Yes, you'll have to supply the connection credentials manually, but that's actually a good thing - it will make your class reusable. Just include it into another project and instantiate with different credentials! Or you can use another connection in the same project, if required.
So I would strongly suggest such a mini-extension only. Now to the code review.
Constructor. Indeed, I don't really get why you're running $this->connected === true blocks everywhere. Any condition when the result could be anything else? Get rid of them.
Catching exceptions on-site. Exceptions is a great mechanism, allowing clean and sensible error handling and reporting. Your code diminishes them to blunt errors. What if some your application code would expect a certain exception? How it would be possible to catch it? Leave exceptions alone, don't catch them.
Function query(). This one is the biggest flaw, consists of many: | {
"domain": "codereview.stackexchange",
"id": 24580,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, object-oriented, mysql, pdo",
"url": null
} |
algorithms, graphs, shortest-path, graph-traversal, weighted-graphs
In the following I'll assume you are interested in computing the optimal path from a start state $s$ to an arbitrary goal state $t$ ---as you actually mention the "shortest path" at the beginning.
So now, regarding your question: | {
"domain": "cs.stackexchange",
"id": 6530,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, graphs, shortest-path, graph-traversal, weighted-graphs",
"url": null
} |
r, wgcna
plotDendroAndColors(net$dendrograms[[1]], mergedColors[net$blockGenes[[1]]],
"Module colors",
dendroLabels = FALSE, hang = 0.03,
addGuide = TRUE, guideHang = 0.05)
moduleLabels = net$colors
moduleColors = labels2colors(net$colors)
MEs = net$MEs
geneTree = net$dendrograms[[1]]
bwet = blockwiseModules(Th1_h5, maxBlockSize = 8000,
power=6, TOMType = "signed", minModuleSize = 30,
reassignThreshold = 0, mergeCutHeight = 0.25,
numericLabels = TRUE,
saveTOMs = TRUE,
saveTOMFileBase = "Th1_NR_R_TOM-blockwise",
verbose=3)
bwLabels = matchLabels(bwet$colors,moduleLabels)
bwModuleColors = labels2colors(bwLabels) | {
"domain": "bioinformatics.stackexchange",
"id": 1017,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "r, wgcna",
"url": null
} |
special-relativity, reference-frames, inertial-frames
In this case $S'$ sees $S$ moving at speed $-v$, therefore the events are simultaneous for $S'$ but not for $S$.
Here is my question: these two situations are exactly the same situation seen from two different frames of reference, right? $S$ always perceives itself as stationary, therefore it sees $S'$ moving, and viceversa for $S'$.
Therefore I'm wondering: from their own points of view, do they both perceive the events as simultaneous? Who's the one that actually doesn't see the events happening at the same time?
My idea is that $S$ sees the events happening simultaneously, but, from its point of view, $S'$ won't see them being simultaneous. On the other hand, $S'$ actually sees the events happening at the same time, but for him $S$ doens't.
Is this interpretation correct? | {
"domain": "physics.stackexchange",
"id": 96338,
"lm_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, reference-frames, inertial-frames",
"url": null
} |
machine-learning, deep-learning, neural-network, convolutional-neural-network
You don't "concatenate an MLP with a convolutional network", you concatenate their outputs. Specifically, once the output of the last convolutional layer is computed, you normally "flatten" it, meaning you remove the spatial information and just place the output tensor elements in a single-dimension vector. That vector is what you concatenate with the output of the MLP, which is also a single-dimension vector (apart from the minibatch dimension). | {
"domain": "datascience.stackexchange",
"id": 8494,
"lm_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, deep-learning, neural-network, convolutional-neural-network",
"url": null
} |
print myode(Po, 0.34)
-53847.3437818
We can increase the tolerance criteria to get a better answer. The defaults in odeint are actually set to 1.49012e-8.
Vspan = np.linspace(0.334, 4)
Po = Prfh(Vspan[0])
P = odeint(myode, Po, Vspan)
# Plot the EOS
plt.plot(Vr,Pr) # analytical solution
plt.plot(Vspan, P[:,0], 'r.')
plt.ylim([0, 2])
plt.xlabel('$V_R$')
plt.ylabel('$P_R$')
plt.savefig('images/ode-vw-3.png')
plt.show()
>>> ... [<matplotlib.lines.Line2D object at 0x1d4dbf10>]
[<matplotlib.lines.Line2D object at 0x1c6e5550>]
(0, 2)
<matplotlib.text.Text object at 0x1d4e31d0>
<matplotlib.text.Text object at 0x1d9d3710> | {
"domain": "cmu.edu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9546474233166329,
"lm_q1q2_score": 0.8277134572984542,
"lm_q2_score": 0.867035763237924,
"openwebmath_perplexity": 3191.3610989567646,
"openwebmath_score": 0.583218514919281,
"tags": null,
"url": "http://kitchingroup.cheme.cmu.edu/blog/category/ode/2/"
} |
genetics
If there is partial haplosufficiency /partial haploinsufficiency, the phenomenon of incomplete dominance can be explained. (heterozygous individual produces protein not sufficient for a full-blown phenotype but just a partial expression of the phenotype)
Here, "functional" refers to being actually "functional" as in case of flower colour (anthocyanin synthesis) or just performing certain kind of a conversion leading to a particular effect on thephenotype. | {
"domain": "biology.stackexchange",
"id": 1460,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "genetics",
"url": null
} |
botany, plant-physiology, plant-anatomy
the seed coat. The stored food in the endospore or cotyledons begins to break down, and nutrients are made available to the embryo. The food and the presence of oxygen allow cellular respiration to occur, which provides energy to the embryo for growth. The first part of the embryo to appear outside the seed is a structure called the radicle, which starts absorbing water and nutrients from its environment, eventually the radicle develops into the plant’s roots. The hypocotyl is the region of the stem nearest the seed. In many plants, it is the first part of the seedling to appear above the soil. In some dicots, as the hypocotyl grows it pulls the cotyledons and the embryonic leaves out of the soil. Photosynthesis begins as soon as the seedling’s cells that contain chloroplasts are above the ground and exposed to light. In monocots, the cotyledon usually stays in the ground when the stem emerges from the soil. You're not accounting for anything other than "the happy path" here. For | {
"domain": "biology.stackexchange",
"id": 1657,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "botany, plant-physiology, plant-anatomy",
"url": null
} |
harmonic-oscillator, hamiltonian-formalism, phase-space, integrable-systems, integrals-of-motion
Am I right? Yes, your idea of these trajectories is correct. The equations for constant $H_y$ and $H_x$ determine a torus in the same way $x^2+y^2=r^2$ determines a circle.
An interesting point to note about classical mechanics: so long as the system is integrable (meaning we have a complete set of linearly independent conserved quantities at every point in phase space), the trajectories for fixed values of the conserved quantities are locally diffeomorphic to a torus almost everywhere completely independent of the other details of the system.
I believe this theorem was proven by Arnold and some others. But the interesting thing is that once the harmonic oscillator is understood well, the only things left to understands are more global properties of the phase space and non-integrable (essentially, chaotic) systems. | {
"domain": "physics.stackexchange",
"id": 72953,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "harmonic-oscillator, hamiltonian-formalism, phase-space, integrable-systems, integrals-of-motion",
"url": null
} |
c++, pointers, opengl
static const CShader* LoadShader(const char* ID, const char* vs, const char* fs, const char* gs)
{
shaderObjects.insert(std::pair<const char*, std::unique_ptr<CShader>>(ID, std::make_unique<CShader>(
(shaderRootDir + std::string(vs)).c_str(),
(shaderRootDir + std::string(fs)).c_str(),
(shaderRootDir + std::string(gs)).c_str())));
return (shaderObjects.at(ID).get());
}
static CShader* GetShader(const char* ID)
{
return (shaderObjects.at(ID).get());
} | {
"domain": "codereview.stackexchange",
"id": 16516,
"lm_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++, pointers, opengl",
"url": null
} |
In [26]:
print noisy_y
[ 2.64567168 1.77226366 nan 1.49412348 nan 1.28855427
0.58257979 -0.50719229 1.84461177 2.72918637 nan -1.02747374
-0.65048639 3.4827123 2.60910913 3.48086587 3.84495668 3.90751514
4.10072678 3.76322421 4.06432005 4.23511474 4.26996586 4.25153639
4.4608377 4.5945862 4.66004888 4.8084364 4.81659305 4.97216304
5.05915226 5.02661678 5.05308181 5.26753675 5.23242563 5.36407125
5.41827503 5.486903 5.50263105 5.59005234 5.6588601 5.7546482
5.77382726 5.82299095 5.92653466 5.93264584 5.99879722 6.07711596
6.13466015 6.12248799]
In [27]:
# try to polyfit a line
pars = np.polyfit(x,noisy_y,1)
print pars
[ nan nan]
In order to get around this problem, we need to mask the data. That means we have to tell the code to ignore all the data points where noisy_y is nan.
My favorite way to do this is to take advantage of a curious fact: $1=1$, but nan!=nan
In [28]:
print 1 == 1
print np.nan == np.nan | {
"domain": "ipython.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9752018376422666,
"lm_q1q2_score": 0.8018003509745034,
"lm_q2_score": 0.8221891305219504,
"openwebmath_perplexity": 3176.441913635825,
"openwebmath_score": 0.5396174192428589,
"tags": null,
"url": "http://nbviewer.ipython.org/gist/keflavich/4042018"
} |
python, beginner, python-3.x, tic-tac-toe
elif player_choice == '1':
Tic_Tac_Toe.x1 = 1
Tic_Tac_Toe.a1 = ' - '
Tic_Tac_Toe.a2 = '|+|'
Tic_Tac_Toe.a3 = ' - '
elif player_choice == '2' and Tic_Tac_Toe.b2 == ' X ' or player_choice == '2' and Tic_Tac_Toe.b2 == '|+|':
self.already_taken()
elif player_choice == '2':
Tic_Tac_Toe.x2 = 1
Tic_Tac_Toe.b1 = ' - '
Tic_Tac_Toe.b2 = '|+|'
Tic_Tac_Toe.b3 = ' - '
elif player_choice == '3' and Tic_Tac_Toe.c2 == ' X ' or player_choice == '3' and Tic_Tac_Toe.c2 == '|+|':
self.already_taken()
elif player_choice == '3':
Tic_Tac_Toe.x3 = 1
Tic_Tac_Toe.c1 = ' - '
Tic_Tac_Toe.c2 = '|+|'
Tic_Tac_Toe.c3 = ' - '
elif player_choice == '4' and Tic_Tac_Toe.a5 == ' X ' or player_choice == '4' and Tic_Tac_Toe.a5 == '|+|':
self.already_taken()
elif player_choice == '4': | {
"domain": "codereview.stackexchange",
"id": 16212,
"lm_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, tic-tac-toe",
"url": null
} |
c++, hash-map
// key already exists
return true;
}
}
return false;
}
bool HashMap::put(int k, int v) {
std::vector<HashEntry>& bucket = getBucket(k);
if (keyExists(k)) return false;
bucket.push_back(HashEntry(k, v));
return true;
}
bool HashMap::remove(int k) {
std::vector<HashEntry>& bucket = getBucket(k);
if (!(keyExists(k))) return false;
for (auto itr = bucket.begin(); itr != bucket.end(); ++itr) {
HashEntry entry = static_cast<HashEntry>(*itr);
if (entry._k == k) {
bucket.erase(itr);
return true;
break;
}
}
return false;
} | {
"domain": "codereview.stackexchange",
"id": 10206,
"lm_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++, hash-map",
"url": null
} |
thermodynamics, astrophysics, temperature, galaxies, milky-way
Older version of answer concerning the gas within the galaxy:
The hottest regions of the galaxy are most likely heated by supernovae. A classic paper that describes how the three thermal phases of the interstellar medium ("cold," "warm", and "hot") are maintained, and invoking a connection between the hot phase and supernovae, is McKee and Ostriker 1977. See also this page for some helpful visuals. The high-velocity gas ejected in a supernova explosion collides with the gas in the surrounding interstellar medium, shocks, and heats up to millions of Kelvin.
Finally, some of the supernova-heated gas can flow back out of the galaxy and into the CGM, causing it to harbor metals which could only be produced by stellar evolution. | {
"domain": "physics.stackexchange",
"id": 5054,
"lm_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, astrophysics, temperature, galaxies, milky-way",
"url": null
} |
algorithms, computational-geometry
search( Node, segment ) -> MinY
if Node does not overlap segment
return Inf
if Node.MinY >= GlobalMinY
return Inf
if Node is sub-segment
GlobalMinY = Node.MinY
return Node.MinYPoint
return Min( search(Node.Left), search(Node.Right) )
It's easy enough to construct these tree using a modified merge-sort, so construction time is within the bounds. What I'm having a hard time showing is that the search time is within the required bounds.
Search time: Other than the root node, at each node one of the Left or Right nodes will either be included completely or excluded completely. Only one of them can have a partial overlap. If this is correct the time is $2 \log(n)$ -- from root we do two searchs and each follows only a single path through the tree. I'm not even sure the GlobalMinY optimization is needed. | {
"domain": "cs.stackexchange",
"id": 288,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, computational-geometry",
"url": null
} |
If $X_{k} = \bigl((x_{n}^{k})_{n \in \mathbb{N}}\bigr)^{k \in \mathbb{N}}$ converges to $X= (x_{n})_{n \in \mathbb{N}}$ in $\ell^2$, then $\lim_{k\to\infty}x_n^k=x_n$ for all $n$.
Another way is the following. Let $\phi_n\colon\ell^2\to\mathbb{R}$ be the linear functional defined by $\phi_n\bigl((x_{n})_{n \in \mathbb{N}}\bigr)=x_n$. $\phi_n$ is continuous and $M=\bigcap_{n\in\mathbb{N}}\{X\in\ell^2:\phi_{2n}(X)=0\}$.
We know that in a Hilbert space $S^\perp$ is always a closed subspace for any subset $S$ of $\mathcal H.$ It is very easy to see that $$M=\{e_{2i-1};i\geq 1\}^\perp$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806501150427,
"lm_q1q2_score": 0.8254779385198232,
"lm_q2_score": 0.8418256452674008,
"openwebmath_perplexity": 132.20728047459616,
"openwebmath_score": 0.942807674407959,
"tags": null,
"url": "https://math.stackexchange.com/questions/1514744/having-trouble-showing-a-subspace-of-ell2-is-closed"
} |
thermodynamics, enthalpy
Breaking of solute-solute attraction (endothermic)
Breaking solvent-solvent attraction (endothermic), eg. hydrogen bonds, LDF
Forming solvent-solute attraction (exothermic) | {
"domain": "chemistry.stackexchange",
"id": 8004,
"lm_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, enthalpy",
"url": null
} |
atmosphere, geophysics, paleoclimatology, carbon-cycle, oxygen
Effectively, plants in such scenario would have replaced part of the contribution of the weathering sink of $\ce{CO2}$. With the notable difference that the oxygen instead of getting washed to the deep ocean (and eventually subducted), was getting piled into the atmosphere as $\ce{O2}$, thus, slowly rising its atmospheric concentration. | {
"domain": "earthscience.stackexchange",
"id": 1707,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "atmosphere, geophysics, paleoclimatology, carbon-cycle, oxygen",
"url": null
} |
intelligent-agent, chat-bots, emotional-intelligence
Title: Chatbots triggering emotions I’m a researcher and I’m currently conducting a research project. I will conduct a study where I would like to trigger different emotions using chatbots on a smartphone (e.g. on Facebook Messenger).
Are there any existing chatbots which are able to trigger different emotions intentionally (also negative ones)? Emotions can of course be triggered by lots of different things. I think the most rich source could well be socialbots like Mitsuku.com and Zo.ai -- Steve Worswick is the owner of Mitsuku and may be interested in helping you by doing (appropriately filtered) chat log queries. You can get him on Twitter at @Mitsuku. | {
"domain": "ai.stackexchange",
"id": 886,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "intelligent-agent, chat-bots, emotional-intelligence",
"url": null
} |
ros, ur-modern-driver, ros-kinetic, publisher
Originally posted by Miguel Prada with karma: 1071 on 2019-03-28
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 32522,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ur-modern-driver, ros-kinetic, publisher",
"url": null
} |
vba, event-handling, gui
End Sub
What I am not sure (and I did not understand) was how to handle the red X in a way that there is no error after it. Thus, I have decided to use the End, which seems to work fine.
I have put the Excel file on GitHub. It contains the same VBA code as shown above, I encourage you to first inspect it with macros disabled, as a good security practice with Excel files from the Internet. I like how your form is no longer concerned with anything other than being a form.
One More Abstraction Level
I'd go one step further, and encapsulate the controls, so that the presenter class doesn't need to know about the implementation details of the form. For example the ChangeLabelAndCaption method knows that there's a Label control on the form, named lblInfo.
The form could expose a property for it instead:
Public Property Get InformationText() As String
InformationText = lblInfo.Text
End Property | {
"domain": "codereview.stackexchange",
"id": 24202,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba, event-handling, gui",
"url": null
} |
kinematics, velocity
This solution denies the concept of a 'definite' instantaneous velocity at some instant $t$ given by the limit of the ratio $\frac{\Delta s}{\Delta t}$ or $$v(t)= \lim_{\Delta t \to 0} \frac{\Delta s}{\Delta t}.$$
Whatever be the velocity at some instant $t$, how does the above "definition of the instantaneous velocity" or the calculus tell us that the arrow or any other object in motion is moving at an instant? How can something move in a duration-less instant, when it has no time to move? What is the standard modern science solution to understand this logical paradox? Like all paradoxes, there is no contradiction here, just misuse of logic.
How do you define velocity? If you say
the distance traveled in an extended period of time, divided by that time
well then of course there's no such thing as instantaneous velocity. Asking what something's instantaneous velocity is under this definition is logically equivalent to something like | {
"domain": "physics.stackexchange",
"id": 82923,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kinematics, velocity",
"url": null
} |
quantum-mechanics, general-relativity
Title: Life of a photon in gravity? I have a simple thought experiment and I am not sure about the answer:
What would happen to a photon that is emitted by an excited hydrogen in an otherwise empty universe?
Would gravity of the atom pull the photon eventually back? How would the frequency of the photon change on the way?
Let's assume this happens in a non-expanding and flat universe. Is there an obvious answer in general relativity to this question?
edit: Assuming a flat universe besides curvature induced by the gravity of atom and photon I'm assuming you mean the spacetime would be flat except for the gravitational field of the hydrogen atom. Then to good approximation the spacetime outside the atom is the Schwarzschild spacetime with mass parameter $M = m_H$ i.e. the mass of a hydrogen atom. We will assume the photon is emitted approximately one-half Bohr radius $r_H$ from the centre of the atom. | {
"domain": "physics.stackexchange",
"id": 26361,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, general-relativity",
"url": null
} |
@Austin Mohr: Thanks. At any rate, it depends on whether you're sampling with replacement or without replacement (are the probabilities of being broken independent from one calculator to the next?). If you're sampling with replacement (probabilities are independent), then you still use the fact that if $X \sim B(n,p)$, then $E[X] = np = 10\cdot 20/200 = 1$, as below. – Michael Zhao Oct 22 '12 at 19:58 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854164256365,
"lm_q1q2_score": 0.8102397439877452,
"lm_q2_score": 0.8354835309589074,
"openwebmath_perplexity": 384.9504742281189,
"openwebmath_score": 0.9987441897392273,
"tags": null,
"url": "http://math.stackexchange.com/questions/218086/expected-number-of-successes-in-a-sample"
} |
How is $P(A^c \cap B^c)$ the same as $1-P(A \cup B)$?
I don't understand how $$P(A^c \cap B^c) = 1-P(A \cup B)$$ is the same?
If I draw $$P(A^c \cap B^c)$$ as a Venn diagram:
If I draw $$P(A \cup B)$$ as a Venn diagram:
So if I subtract $$P(A \cup B)$$ from 1, wouldn't that mean that I subtract $$P(A \cup B)$$ from the universe $$\Omega$$, which would result int this:
However, that would mean $$P(A^c \cap B^c) \neq 1-P(A \cup B)$$
Edit:
As pointed out by multiple people. My diagram for $$P(A^c \cap B^c)$$ should look like the following and therefore the assumption of $$P(A^c \cap B^c) = 1-P(A \cup B)$$ is valid: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429164804707,
"lm_q1q2_score": 0.8610036002650694,
"lm_q2_score": 0.8740772466456689,
"openwebmath_perplexity": 310.7694330937354,
"openwebmath_score": 0.7335774898529053,
"tags": null,
"url": "https://math.stackexchange.com/questions/3520406/how-is-pac-cap-bc-the-same-as-1-pa-cup-b"
} |
java, android, interview-questions, json
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Book object
public class Book {
private String title;
private String imageURL;
private String author;
public Book(String title, String imageURL, String author)
{
this.title = title;
this.imageURL = imageURL;
this.author = author;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getImageURL() {
return imageURL;
}
public void setImageURL(String imageURL) {
this.imageURL = imageURL;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
} | {
"domain": "codereview.stackexchange",
"id": 16226,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, android, interview-questions, json",
"url": null
} |
I imagine the best you can do is only one rank at a time building up or down to attain the desired sub-matrix portion. To reduce the dimension by one the simple formula is
$$\mathbf{A}^{-1} = E - \frac{\mathbf{f}\mathbf{g}^T}{h}$$
To see this, use the known inverse of the original and larger dimension matrix $$\pmatrix{\mathbf A & \mathbf b\\ \mathbf c^T & d}^{-1} = \pmatrix{\mathbf E & \mathbf f\\ \mathbf g^T & h}$$
to have $$\pmatrix{\mathbf E & \mathbf f\\ \mathbf g^T & h}\pmatrix{\mathbf A & \mathbf b\\ \mathbf c^T & d} = \pmatrix{ \mathbf I & \mathbf 0 \\ \mathbf 0^T & 1}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9609517039189089,
"lm_q1q2_score": 0.8007846877937495,
"lm_q2_score": 0.8333245932423308,
"openwebmath_perplexity": 341.47095689360316,
"openwebmath_score": 0.848666787147522,
"tags": null,
"url": "http://math.stackexchange.com/questions/208001/are-there-any-decompositions-of-a-symmetric-matrix-that-allow-for-the-inversion"
} |
ros, pose, transform
Title: Convert geometry_ msgs/Pose to Point
Hey all!,
i got a Posestd::vector<geometry_msgs::Pose> waypoints and now i would like to transform it to geometry_msgs::Point.
I tried to convert it to Eigen and afterwards in Point. My first step would be something like:
std::vector<geometry_msgs::Pose> m;
m = waypoints;
Eigen::Affine3d e;
tf::poseMsgToEigen(m,e);
and i get an error: no matching function for call to poseMsgToEigen.
Do you have any suggestions ?
Greetings
mutu
Originally posted by mutu on ROS Answers with karma: 25 on 2016-11-30
Post score: 1
Hi Mutu,
A geometry_msgs::Pose actually contains a geometry_msgs::Point as you can read in the documentation.
to get the pose just type:
geometry_msgs::Point pt = waypoints[i].position;
for the index i that you want. Do note that you lose the orientation information that is also contained in the pose.
Originally posted by rbbg with karma: 1823 on 2016-11-30
This answer was ACCEPTED on the original site
Post score: 4 | {
"domain": "robotics.stackexchange",
"id": 26364,
"lm_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, pose, transform",
"url": null
} |
python, python-2.x, file-system
logger.info('Path mapping initializing:\nChanges at local path\n\t%s\nwill be reflected at remote path\n\t%s:%s'
% (local_base, sftp_connection.ssh_prefix, remote_base))
# Create necessary objects for this particular mapping and schedule this mapping on the Watchdog observer as appropriate
remote_control = RemoteControl(sftp_connection = sftp_connection, local_base = local_base, remote_base = remote_base)
event_handler = PytoWatchdogHandler(ignore_patterns = cfg.ignore_patterns, remote_control = remote_control)
observer.schedule(event_handler, path=local_base, recursive=True)
if no_valid_mappings:
logger.error('No valid path mappings were configured, so there\'s nothing to do. Please check your pytograph configuration file.')
sys.exit('Terminating.')
# We have at least one valid mapping, so start the Watchdog observer - filesystem monitoring actually begins here
observer.start() | {
"domain": "codereview.stackexchange",
"id": 1064,
"lm_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-2.x, file-system",
"url": null
} |
newtonian-mechanics
In any kind of motion (of a point particle) you should know that the velocity is always tangent to the trajectory of the object. The case of circular motion is the same.
You may not know this but the right way to express angular velocity is as a vector (just like with regular velocity) that points in the direction of the axis of rotation. The magnitude of the vector gives the instantaneous rate of rotation. | {
"domain": "physics.stackexchange",
"id": 61752,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics",
"url": null
} |
c#, wpf
student2 = new Student(first2.Text, last2.Text, Convert.ToInt32(score2.Text));
student3 = new Student(first3.Text, last3.Text, Convert.ToInt32(score3.Text));
student4 = new Student(first4.Text, last4.Text, Convert.ToInt32(score4.Text));
student5 = new Student(first5.Text, last5.Text, Convert.ToInt32(score5.Text)); | {
"domain": "codereview.stackexchange",
"id": 1758,
"lm_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#, wpf",
"url": null
} |
nextflow
Title: Nextflow: Can I parameterize similar processes inside a for loop? I have set of ~5 processes which perform very similar tasks such that their differences can be parameterized. Rather than putting 5 items through some channel (which seems complicated), or defining 5 separate processes, it appears to be possible in Nextflow to declare the processes in a for loop, and output into an array of channels.
Below is a prototypical example and it seems to work as intended. (I understand this could be done differently with some channel cross product operator but I am just giving this as an example of a process in a for loop.)
Is there anything wrong with doing this? Is there a better way to do it?
Bonus question - the name of the process below is "foo". I would like to have the index reflected in the name i.e. "foo_$i" but this doesn't seem possible by default - any way to do this??
some_inputs = ['prot','dna', 'rna']
some_parameters = [5,3,2,7,1] | {
"domain": "bioinformatics.stackexchange",
"id": 1786,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nextflow",
"url": null
} |
• @iterence: that would not give the probability $\Pr[A\mid -]$, but instead the quantity $\Pr[A^c\mid +] = 1 - \Pr[A\mid +]$. That is, instead of "the probability to have asthma knowing the test says you don't," you would compute "the probability not to have asthma, knowing the test says you do." – Clement C. Apr 29 '15 at 13:38
• In part 2, "if the test comes back negative", it is assumed we know that the result was negative, i.e., the probability of the test returning negative is $100$%, not $3.47$%. The $3.47$% figure arises from the cases where people do have asthma but it is not detected by the test. – David K Apr 29 '15 at 13:41 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9845754492759498,
"lm_q1q2_score": 0.8688168100237815,
"lm_q2_score": 0.8824278633625322,
"openwebmath_perplexity": 647.666591872189,
"openwebmath_score": 0.7334158420562744,
"tags": null,
"url": "https://math.stackexchange.com/questions/1257518/answer-does-not-make-sense-using-conditional-probability"
} |
-
If w ends in 0 then you must have an equal number of 01s and 10s. You can show this by looking at possibilities 1 and 2. This makes case 4 true, too. (Also, I don't think you deal with going from the empty string to a single-letter string. It is obvious, but your 4 cases assume w is non-empty.) – mange Jan 5 '12 at 12:06
Sorry, not "equal number" but rather "no extra 01s". – mange Jan 5 '12 at 12:19
Might I suggest an alternate strategy? Show by induction that a bit string beginning in b and ending in b' must contain the sequence bb'. Then use that to show between any two 01 sequences, there must exist a 10 sequence. – Mike Jan 5 '12 at 13:11
Assuming that the result to be proved is true, it would seem that symmetry would imply that the number of occurrences $N_{01}$ of $01$ and the number of occurrences $N_{10}$ of $10$ must differ by at most $1$: $|N_{01}-N_{10}| \leq 1$. – Dilip Sarwate Jan 5 '12 at 15:05 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9597620585273153,
"lm_q1q2_score": 0.8059448091272865,
"lm_q2_score": 0.8397339756938818,
"openwebmath_perplexity": 503.6171291219662,
"openwebmath_score": 0.6971297264099121,
"tags": null,
"url": "http://math.stackexchange.com/questions/96636/prove-that-in-a-bit-string-the-string-01-occurs-at-most-one-more-time-than-the"
} |
c++, linked-list
obj.search(8) ? printf("Yes"):printf("No");
return 0;
}
As an aside I want to thank everyone who has contributed to improving my generic single linked list, I really appreciate the help and expertise that strengthened my understanding of data structures and C++. I'm not a C++ programmer, take what I say with a grain of salt.
Don't add articles to names. theData should simply be data. You're not writing a novel, you're writing code.
Always use braces around while-loops (the same goes for similar constructs, like if). This avoids particularly nasty bugs in the future.
Single characters (like '\n' and '\t') can be C++ chars, instead of strings:
str << loop->data << '\t';
... and:
str << '\n'
In C++, the '*' / '&' should be part of the type, not of the name. You still missed this in a couple of cases. Here:
bool SingleLinkedLists<T>::search(const T &x) {
... and here:
int main(int argc, const char * argv[]) { | {
"domain": "codereview.stackexchange",
"id": 30767,
"lm_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++, linked-list",
"url": null
} |
ros, catkin, build-package, ros-kinetic
Comment by Cry-A-Lot on 2020-08-04:
it only occur when i add package_a inside
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
# package_a) | {
"domain": "robotics.stackexchange",
"id": 35318,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, catkin, build-package, ros-kinetic",
"url": null
} |
electrostatics, capacitance, fluid-statics
Also how can you calculate this extra pressure we need to balance (without resorting to the 2nd method.) | {
"domain": "physics.stackexchange",
"id": 74696,
"lm_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, capacitance, fluid-statics",
"url": null
} |
homework-and-exercises, thermodynamics, temperature
Edit 2 The exact statement of the problem:
Two thermally insulated cylinders, A and B, of equal volume, both equipped with pistons, are connected by a valve. Initially A has its pistion fully withdrawn and contains a perfect monatomic gas at temperature T, while B has its piston fully inserted, and the valve is closed. Calculate the final temperature of the gas after the following operation. The thermal capacity of the cylinders is to be ignored | {
"domain": "physics.stackexchange",
"id": 44161,
"lm_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, thermodynamics, temperature",
"url": null
} |
is some function f:âAâB that is onto. Uploaded By wanganyu14. This problem has been solved! Proposition 3.2. We say that f is surjective if for all b 2B, there exists an a 2A such that f(a) = b. (AC) The axiom of choice. Notice that this is the same as saying the f is a left inverse of g. Therefore g has a left inverse, and so g must be one-to-one. Testing surjectivity and injectivity Since $$\operatorname{range}(T)$$ is a subspace of $$W$$, one can test surjectivity by testing if the dimension of the range equals the ⦠Thus, to have an inverse, the function must be surjective. 3) Let f:A-B be a function. This is another example of duality. What about a right inverse? (iii) If a function has a left inverse, must the left inverse be unique? If $$MA = I_n$$, then $$M$$ is called a left inverse of $$A$$. Suppose f is surjective. If f:âAâB and g:âBâA, then g is a right inverse of f if fâ
ââ
gâ=âidB. g is a two-sided inverse of f if g is both a left and a right inverse | {
"domain": "hourofscampering.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.969324199175492,
"lm_q1q2_score": 0.8077616939978649,
"lm_q2_score": 0.8333245932423309,
"openwebmath_perplexity": 430.64597870331943,
"openwebmath_score": 0.88918137550354,
"tags": null,
"url": "http://hourofscampering.com/hayley-mclaughlin-ywhy/27990e-right-inverse-if-and-only-if-surjective"
} |
to the variable! Any useful piece of information for graphing the original function ) changes concavity ( f\ ) rate of of! Couple of important interpretations of partial derivatives, what does second derivative tell you if it is the y-value of the derivative: second! ) is a change in concavity derivative '' is also a function comparable! Derivative ( Read about derivatives first if you do n't already know what they are! ). | {
"domain": "co.uk",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9796676514063881,
"lm_q1q2_score": 0.80095127129697,
"lm_q2_score": 0.8175744806385542,
"openwebmath_perplexity": 282.88795831046025,
"openwebmath_score": 0.7630866169929504,
"tags": null,
"url": "http://www.slippercottage.co.uk/8fcub/e17a92-what-does-second-derivative-tell-you"
} |
java, collections
Edit: This is supposed to be a JPanel that contains a list that can be modified by a program and this should reflect those changes on the list display. It's not complete yet, but the ultimate goal is to have a list that can be modified by the user or programmer. It will have some buttons that will be disabled if the list doesn't support the operations, so it might not have add or remove but it might have set.
I've compiled most of the suggestions into this new function: http://pastebin.com/JPWXdFfi Instead of attempting to detect this beforehand, consider providing feedback when adding or removing an element fails due to UnsupportedOperationException, and then disable related actions in your user interface. Or use any domain or prior knowledge available to predict whether these operations will be available.
But to answer your question: | {
"domain": "codereview.stackexchange",
"id": 7306,
"lm_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, collections",
"url": null
} |
php, optimization, object-oriented, design-patterns, pdo
$pdo->bind(':user_id', $this->user_id);
$pdo->execute();
$row = $pdo->single();
if ( empty( $row ) ) {
throw new Exception('No Results');
}
$this->response_array['status'] = 'success';
$this->response_array['last'] = $row['value'];
return $this->response_array;
}
function prepareGraph( Database $pdo ){
$query = "SELECT time, value FROM wp_weight WHERE user_id = :user_id ORDER BY time";
$pdo->query($query);
$pdo->bind(':user_id', $this->user_id);
$pdo->execute();
$row = $pdo->resultset();
if ( empty( $row ) ) {
throw new Exception('No Results');
}
$data = array('cols' => array(array('label' => 'time', 'type' => 'date'), array('label' => 'value', 'type' => 'number')),'rows' => array()); | {
"domain": "codereview.stackexchange",
"id": 6964,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, optimization, object-oriented, design-patterns, pdo",
"url": null
} |
java, properties, hash-map
Putting it all together, how about this method:
private static final String RESOURCE_NODES_2_00 = "nodes2.00.properties";
private static List<String> loadNodes2_00() { | {
"domain": "codereview.stackexchange",
"id": 5890,
"lm_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, properties, hash-map",
"url": null
} |
python, recursion, computational-geometry, divide-and-conquer
if len(xy_arr_y_sorted) > 7:
for i in range(len(xy_arr_y_sorted)-7):
dis_storage = []
for j in range(1,8):
d_i_ipj = two_point_distance(xy_arr_y_sorted[i],xy_arr_y_sorted[i+j])
dis_storage.append(d_i_ipj)
dis_storage_min = min(dis_storage)
if dis_storage_min < dmin_rec:
dmin_rec = dis_storage_min
for k in range(len(xy_arr_y_sorted)-7, len(xy_arr_y_sorted)-1):
dis_storage = []
for l in range(1,len(xy_arr_y_sorted)-k):
d_k_kpl = two_point_distance(xy_arr_y_sorted[k], xy_arr_y_sorted[k+l])
dis_storage.append(d_k_kpl)
dis_storage_min = min(dis_storage)
if dis_storage_min < dmin_rec:
dmin_rec = dis_storage_min
else:
for m in range(0,len(xy_arr_y_sorted)-1):
dis_storage = []
for n in range (1,len(xy_arr_y_sorted)-m): | {
"domain": "codereview.stackexchange",
"id": 31290,
"lm_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, recursion, computational-geometry, divide-and-conquer",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.