text stringlengths 1 1.11k | source dict |
|---|---|
plant-physiology, photosynthesis, botany
Title: How do white Caladiums perform enough photosynthesis to support their mass? In some white caladiums, there is less than a square inch of green space spread over the whole leaf. How do these plants perform the photosynthesis necessary to support the large leaves, the roots, the flowers, and build a corm? There are many different kinds of plants that have independently evolved this sort of variegation (non-green areas) in the leaves. However, the mechanisms by which they effect this vary between species.
Some have little or no chlorophyll in the non-green areas, but many others have changed the architecture of their leaf cell layers in the non-green areas, creating refraction effects that make the leaves appear white, but don't significantly change their photosynthetic efficiency (Sheue et al.) In fact, Arum italicum white areas actually have higher efficiency in certain light conditions! (La Rocca et al.) | {
"domain": "biology.stackexchange",
"id": 1184,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "plant-physiology, photosynthesis, botany",
"url": null
} |
php, security, network-file-transfer
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
$uploadOk = 0;
}
}
// Check if file already exists
if (file_exists($target_file)) {
header('Location: files.php?alert=4;');
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
header('Location: files.php?alert=5;');
$uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
header('Location: files.php?alert=3;');
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { | {
"domain": "codereview.stackexchange",
"id": 22903,
"lm_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, security, network-file-transfer",
"url": null
} |
homework-and-exercises, differential-geometry, gauge-theory, path-integral, topological-field-theory
The formal path integral over $\phi$ is indeed simply a Gaussian integral: We can write the action of the BF theory on the r.h.s. as
$$ S_\text{BF}[A,\phi] = \int \mathrm{Tr}(\mathrm{i}\phi f + \phi^2)\mathrm{d}\mu = \int \left(\mathrm{Tr}\left(\left(\phi + \frac{\mathrm{i}}{2}f\right)^2\right) + \mathrm{Tr}\left(\frac{1}{4}f^2\right)\right)\mathrm{d}\mu$$
by completing the square. Now, by the formal analogy between the path integral and usual integrals, $\int \mathrm{e}^{-S_\text{BF}[A,\phi]}\mathcal{D}\phi = c \int \mathrm{e}^{-\frac{1}{4}\int\mathrm{Tr}(f^2)\mathrm{d}\mu}\mathcal{D}\phi$, where $c = \int \mathrm{e}^{\int\mathrm{Tr}((\phi+\mathrm{i}f/2)^2)}\mathcal{D}\phi$ is the constant value of the Gaussian integral, which is independent of $f$. | {
"domain": "physics.stackexchange",
"id": 35613,
"lm_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, differential-geometry, gauge-theory, path-integral, topological-field-theory",
"url": null
} |
# Three Spring Coupled Masses | {
"domain": "chievoveronavalpo.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9744347905312774,
"lm_q1q2_score": 0.8098947037791748,
"lm_q2_score": 0.8311430499496096,
"openwebmath_perplexity": 1713.5631553741566,
"openwebmath_score": 0.3487705886363983,
"tags": null,
"url": "http://chievoveronavalpo.it/mensaje-a-txox/three-spring-coupled-masses.html"
} |
dft
$$W_k(n) = e^{-i2\pi \frac{k}{N}n}, \quad 0\leq n<N$$ where $\frac{k}{N}$ is the discrete frequency used to build a particular function of this set.
For example, the 3rd bin of the DFT of $f(n)$ contains the result of correlating $f(n)$ with a complex exponential of frequency $\frac{3}{N}$.
The higher $k$ is, the higher the base exponential’s frequency is. When the DFT gets to the case where $k = N-1$, it simply means it’s correlating $f(n)$ with the complex exponential of highest frequency allowed by the DFT size $N$. | {
"domain": "dsp.stackexchange",
"id": 12207,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dft",
"url": null
} |
python, algorithm, python-3.x
Title: Dijkstra's algorithm using collections.namedtuple I decided to try out some named tuples by implementing Dijkstra's algorithm to find the cheapest routes in a file like this (where each line represents node_a is connected with node_b with a cost of n):
1 6 14
1 2 7
1 3 9
2 3 1
2 4 15
3 6 2
3 4 11
4 5 6
5 6 9
However, something that caught my attention is that some of the lines got really long:
import sys
from collections import namedtuple
INFINITY = 999999
class UndirectedGraph:
def __init__(self, node_list):
self.Node = namedtuple('Node', ['coming_from', 'cost'])
self.node_dict = self.get_nodes(node_list)
self.create_connections(node_list)
self.size = len(self.node_dict) | {
"domain": "codereview.stackexchange",
"id": 18261,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, algorithm, python-3.x",
"url": null
} |
optics, visible-light, vision, image-processing
Luboš Motl points out some other possible difficulties with interferometry in his answer, primarily that the combination of a polychromatic source and a detector spacing many times larger than the observed wavelength lead to no correlation in the phase of the light entering the two detectors. While true, Legolas may be able to get around this if his eyes (specifically the photoreceptors) are sufficiently sophisticated so as to act as a simultaneous high-resolution imaging spectrometer or integral field spectrograph and interferometer. This way he could pick out signals of a given wavelength and use them in his interferometric processing. | {
"domain": "physics.stackexchange",
"id": 54163,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, visible-light, vision, image-processing",
"url": null
} |
signal-analysis, audio
Programming languages such as C, Python, Julia, MATLAB / Octave and others, have native complex data types. In that case, the output from an fft() kind of function is an array of type complex and each element of that array contains a function (e.g. abs()) to obtain the absolute value of that complex number. If your programming language does not have a complex data type, then the output of your fft() is probably two arrays of real numbers. One for the real part of the complex number and one for the imaginary part. In that case, to obtain the spectrum, all that you have to do is spc[m] = sqrt(real_part[m]^2 + imaginary_part[m]^2) where ^ denotes exponentiation and m is the $m^{th}$ element of your DFT spectrum. | {
"domain": "dsp.stackexchange",
"id": 7069,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "signal-analysis, audio",
"url": null
} |
Part III. – The test is multiple linear regression isThe test is multiple linear regression is H 0 = β 1 = β 2 = … = β p = 00. Root MSE = s = our estimate of σ = 2. This is what regression analysis can do! For example, we'll see (via regression) that Fords. Regression analysis is a statistical process for estimating the relationships among variables. " In the main dialog box, input the dependent variable. txt) or view presentation slides online. Lecture 18: Multiple Logistic Regression Mulugeta Gebregziabher, Ph. Clearly, it is nothing but an extension of Simple linear regression. We expect to build a model that fits the data better than the simple linear regression model. Dummy variables are useful because they enable us to use a single regression equation to represent multiple groups. A multiple regression based model will use the data to build a function that predicts the outcome based on the independent variables. Technically, a regression analysis model is based on the sum of | {
"domain": "hoteleuphoria.ro",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.982013792143467,
"lm_q1q2_score": 0.8616942950070836,
"lm_q2_score": 0.8774767746654974,
"openwebmath_perplexity": 937.9905486025981,
"openwebmath_score": 0.3387893736362457,
"tags": null,
"url": "http://backup.hoteleuphoria.ro/t946mkf/8rgsf.php?ff=multiple-regression-ppt"
} |
ClearAll[f2];
f2 = With[{m = Solve[{a (a - 1)/2 == Length@#, a > 0}, a, Integers][[1, 1, 2]]},
RotateLeft[PadLeft[InternalPartitionRagged[#, Reverse@Range[m - 1]], {m, m}]]] &;
Row[MatrixForm/@ {m1 = f2[Range[6]], Transpose[m1], m1 + Transpose[m1]}]
lst2 = CharacterRange["a", "z"][[;;10]];
Row[MatrixForm /@ {m1 = f2[lst2], Transpose[m1], m1 + Transpose[m1]}] | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9473810496235896,
"lm_q1q2_score": 0.8280842038411372,
"lm_q2_score": 0.8740772302445241,
"openwebmath_perplexity": 4806.340739747306,
"openwebmath_score": 0.2322065383195877,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/55659/populate-an-upper-triangular-matrix-from-a-vector-of-elements/55686#55686"
} |
classical-mechanics, forces, torque, moment
Here is a diagram they have given to help illustrate the problem Since the system is in equilibrium, the net moment acting about $O$ must be $0$. Now, we see that F has no vertical component, hence the moment produced by F about O is the magnitude of F multiplied by the vertical distance of the point of application of F from O (keep in mind that the torque vector is $\tau=r \times F$, that is the product of the force component that is perpendicular to the position vector of the force from the origin). Now the vertical distance can be found from some trigonometry. The same idea applies for B, where as it has only a vertical component, the moment is the product of the horizontal distance between the point of applied force and the origin, which is again found through some trigonometry. | {
"domain": "physics.stackexchange",
"id": 43224,
"lm_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, forces, torque, moment",
"url": null
} |
autocorrelation, cross-correlation, adaptive-algorithms, beamforming
My understanding of cross (or auto) correlation is that for $\phi_{dx} (1)$ you compare one signal with another with a shift of 1 sample (hence a lag of 1).
I understand that a sine is the quadrature of a cosine and understand why these equal zero (as the book describes; "$\phi_{dx} (1) $, is zero because it represents the correlation of (13.3) with its quadrature (sine) component"). My question is why is a sine introduced for a lag of 1?
Diagram for completeness: | {
"domain": "dsp.stackexchange",
"id": 2523,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "autocorrelation, cross-correlation, adaptive-algorithms, beamforming",
"url": null
} |
acid-base, reaction-mechanism, aqueous-solution
SO3 (g) + H2O (l) --> H2SO4 (aq)
I recognize that the polarized nature of the O-H bond in sulfuric acid makes it thermodynamically favorable for H2O to abstract a proton and subsequently form an acidic solution with the formation of H3O+. However, I fail to recognize how reactions like this with a nonmetal oxide proceeds to form an acidic oxide. Namely, I fail to understand the role of the covalent bond in the nonmetal oxide for the mechanism of this reaction. I recognize that metal oxides dissolve in water to form the highly polarizing, high charge density ion O2-, which polarizes the O-H bond in H2O to form hydroxide. Can someone give a similar explanation for nonmetal oxides and their dominant acidic nature in water? Well, in terms of this reaction, sulfur in $\ce{SO3}$ acts as a Lewis acid for an incoming $\ce{OH-}$ nucleophile. The reaction mechanism seems to be any old nucleophilic addition reaction: | {
"domain": "chemistry.stackexchange",
"id": 10905,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "acid-base, reaction-mechanism, aqueous-solution",
"url": null
} |
c#, sql, winforms
//Change Of Tenancy Details
pdv.COT = dr["COT"] == DBNull.Value ? false : Convert.ToBoolean(dr["COT"]);
pdv.TitleCode = dr["TitleCode"].ToString();
pdv.OtherTitle = dr["OtherTitle"].ToString();
pdv.FirstName = dr["FirstName"].ToString();
pdv.MiddleInitials = dr["MiddleInitials"].ToString();
pdv.SurName = dr["SurName"].ToString();
pdv.COTProofType = dr["COTProofType"].ToString();
pdv.COTDate = dr["COTDate"].ToString();
pdv.PropRespMtrRead = dr["PropRespMtrRead"].ToString();
pdv.PropRespMtrBRead = dr["PropRespMtrBRead"].ToString();
pdv.PrevAdd1 = dr["PrevAdd1"].ToString();
pdv.PrevAdd2 = dr["PrevAdd2"].ToString();
pdv.PrevAdd3 = dr["PrevAdd3"].ToString(); | {
"domain": "codereview.stackexchange",
"id": 13955,
"lm_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#, sql, winforms",
"url": null
} |
javascript, html, game, css, collision
Title: Platformer Game: Arrow Key Player Movement and Collision Detection I am in the middle of working on this game and I still need to add some things (e.g. score, coin counters, etc.) but I really feel like there is way too much unneeded code. Could you help me simplify this so I can keep adding things? | {
"domain": "codereview.stackexchange",
"id": 30865,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, html, game, css, collision",
"url": null
} |
# Jacobi's equality between complementary minors of inverse matrices
What's a quick way to prove the following fact about minors of an invertible matrix $A$ and its inverse?
Let $A[I,J]$ denote the submatrix of an $n \times n$ matrix $A$ obtained by keeping only the rows indexed by $I$ and columns indexed by $J$. Then | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9674102561735719,
"lm_q1q2_score": 0.8183733899847258,
"lm_q2_score": 0.8459424373085145,
"openwebmath_perplexity": 629.9995374632687,
"openwebmath_score": 0.9960266947746277,
"tags": null,
"url": "https://mathoverflow.net/questions/87877/jacobis-equality-between-complementary-minors-of-inverse-matrices"
} |
homework-and-exercises, optics, geometric-optics, lenses
And now what about a virtual object being formed beyond focus (region 3)?
From the graph, I think it will be real but magnified for some region and diminished for some.So as to get some clarity I used Newtonian Thin Lens Equation
$$x_1\cdot x_2=f^2$$
where
$x_1$ is the distance of object from the focus
$x_2$ is the distance of the image from the focus
Now since $x_1$ is greater than 2f $x_2$ should be less than f/2 which will result in the formation of a virtual image and not a real image, which is conflicting from the result we obtained from the graph.
To summarize, my question is as follows: | {
"domain": "physics.stackexchange",
"id": 39680,
"lm_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, optics, geometric-optics, lenses",
"url": null
} |
php, performance, unit-testing, database
I don't see you using/mentioning fixtures, and you extend what is obviously a DB test from the generic PHPUnit_Framework_TestCase class.
If you are testing DB-related code, use the correct test-cases
There is this aptly named PHPUnit_Extensions_Database_TestCase that better fits your requirements. For obvious reasons. Use it, to create an abstract base test-case class. This abstract test class should handle the connection stuff, and enforce all the child classes to load actual fixtures.
Just like in coding, in tests, you should keep your logic and your data separated. The test data can be generated during the build process, for example, or written manually. Either way, it shouldn't be mixed in with the testing code. | {
"domain": "codereview.stackexchange",
"id": 8985,
"lm_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, performance, unit-testing, database",
"url": null
} |
ros, gazebo, simulation, ros-melodic
<width>320</width>
<height>240</height>
</image>
<clip>
<near>0.1</near>
<far>100</far>
</clip>
</camera>
<always_on>1</always_on>
<update_rate>30</update_rate>
<visualize>1</visualize>
<plugin name='camera_controller' filename='libgazebo_ros_camera.so'>
<alwaysOn>1</alwaysOn>
<updateRate>0.0</updateRate>
<cameraName>test/camera</cameraName>
<imageTopicName>image_raw</imageTopicName>
<cameraInfoTopicName>camera_info</cameraInfoTopicName>
<frameName>left_camera_optical_frame</frameName>
<hackBaseline>0.07</hackBaseline>
<distortionK1>0.0</distortionK1>
<distortionK2>0.0</distortionK2>
<distortionK3>0.0</distortionK3>
<distortionT1>0.0</distortionT1>
<distortionT2>0.0</distortionT2>
</plugin>
</sensor> | {
"domain": "robotics.stackexchange",
"id": 35761,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, gazebo, simulation, ros-melodic",
"url": null
} |
c++, recursion, unit-testing, boost, c++20
Then you have to use it like so:
auto data = test_generator<int, std::deque<int>>(0, 10, 1, 3);
You can also add another requires check for the container type of course.
Consider a non-recursive implementation
Your implementation uses recursion; each recursion builds a list with an element_count of one less than the previous one. It doesn't look very efficient to me; every layer except the outer one builds a list that you discard afterwards. You can instead generate the desired list without using recursion at all, by just writing a cascaded counter (think of how a mechanical tally counter works). Here is a possible implementation:
template<class T, class Container = std::vector<T>>
constexpr auto test_generator(T start, T end, T step, std::size_t element_count)
{
std::list<Container> output;
Container counters;
std::fill_n(std::back_inserter(counters), element_count, start);
while (true) {
output.push_back(counters); | {
"domain": "codereview.stackexchange",
"id": 40061,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, recursion, unit-testing, boost, c++20",
"url": null
} |
GMAT Question of the Day - Daily to your Mailbox; hard ones only
It is currently 17 Oct 2018, 11:33
### GMAT Club Daily Prep
#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.
Customized
for You
we will pick new questions that match your level based on your Timer History
Track
every week, we’ll send you an estimated GMAT score based on your performance
Practice
Pays
we will pick new questions that match your level based on your Timer History
# Within a rectangular courtyard of length 60 feet, a graveled path,
Author Message
TAGS:
### Hide Tags
Intern
Joined: 25 Aug 2018
Posts: 2
Within a rectangular courtyard of length 60 feet, a graveled path, [#permalink]
### Show Tags
24 Sep 2018, 10:25
00:00
Difficulty:
65% (hard)
Question Stats:
58% (03:51) correct 42% (04:22) wrong based on 19 sessions
### HideShow timer Statistics | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 1,
"lm_q1q2_score": 0.851952809486198,
"lm_q2_score": 0.851952809486198,
"openwebmath_perplexity": 3981.3950371136293,
"openwebmath_score": 0.7202662229537964,
"tags": null,
"url": "https://gmatclub.com/forum/within-a-rectangular-courtyard-of-length-60-feet-a-graveled-path-277135.html"
} |
The code as follows:
\documentclass[12pt,a4paper]{book}
\usepackage{boxedminipage}
\newcounter{boxcnt}[chapter]
\renewcommand\theboxcnt{\thechapter.\arabic{boxcnt}}
\newenvironment{boxedtxt}[1]{%
\vskip6pt
\parindent0pt\leftskip0pt
\itemindent0pt\leftmargin0pt
\fboxsep=8pt
\normalfont
\refstepcounter{boxcnt}
\begin{boxedminipage}[0.5pt]{\hsize}
\selectfont
{\bfseries{Box\ \theboxcnt\enspace}#1}
\vskip 6pt plus2pt minus1pt
\par\noindent\ignorespaces
}{%
\end{boxedminipage}%
\vskip6pt\noindent\ignorespacesafterend
}
\begin{document} | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9230391579526934,
"lm_q1q2_score": 0.8350278651949234,
"lm_q2_score": 0.9046505318875316,
"openwebmath_perplexity": 892.22569184927,
"openwebmath_score": 0.9732152819633484,
"tags": null,
"url": "https://tex.stackexchange.com/questions/254396/intended-paragraphs-inside-environment"
} |
// There wasn't any such edge, so this one simply goes into the heap.
if (found == -1) {
edges.Insert(neighbor);
}
// There was an edge in the heap already which also goes to neighbor.to
// This means that we must compare them to determine which is the
// shortest one, so that the one in the heap is the shortest one.
else {
// Obtain the edge from the heap that also goes to neighbor.to
Edge old = edges.Get(found);
// Remove it from the heap for now.
edges.Remove(found);
// Determine if the pre-existing edge is shorter than the new edge
// neighbor which is incident to the edge we just explored.
const Edge &shortest = std::min(
neighbor, old, [&distances, &edge](const auto &n, const auto &o) {
return distances[edge.to] + n.weight < o.weight;
});
// Insert the shorter of the two edges back into the heap.
edges.Insert(shortest);
}
}
}
return distances;
}
void dijkstra(EdgeWeightedDigraph G, int s) {
for (int v = 0; v < G.V(); v++) {
distTo[v] = std::numeric_limits<double>::max();
} | {
"domain": "jip.dev",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9867771759145342,
"lm_q1q2_score": 0.8113174618351043,
"lm_q2_score": 0.8221891239865619,
"openwebmath_perplexity": 1229.7954954713152,
"openwebmath_score": 0.49524566531181335,
"tags": null,
"url": "https://jip.dev/notes/algorithms/"
} |
aqueous-solution
The answer is that we come up with a sort of standard ion, $\ce{H+}$ (really something more like $\ce{ H3O+}$) and we define the free energy of formation of all other ions relative to this one. For example, I can measure the Gibbs energy change when I dissolve HCl in water to form $\ce{H+}$ and $\ce{Cl-}$.
$$\ce{HCl}\text{(g)}\to\ce{H+}\text{(aq)}+\ce{Cl-}\text{(aq)}
\quad\Delta G^0{}_1
$$
I can now just define the Gibbs energy of formation of $\ce{H+}$ as zero and then determine the relative Gibbs energy of formation of $\ce{Cl-}$.
$$\begin{align}&
\Delta G^0{}_1=\Delta G^0_{\mathrm{F}}(\ce{H+})+\Delta G^0_{\mathrm{F}}(\ce{Cl-})-\Delta G^0_{\mathrm{F}}(\ce{HCl})
\\&
\Delta G^0_{\mathrm{F}}(\ce{H+})=0\quad\text{(definition)}\\&
\Delta G^0_{\mathrm{F}}(\ce{Cl-})= \Delta G^0{}_1+\Delta G^0_{\mathrm{F}}(\ce{HCl})
\end{align}
$$ | {
"domain": "chemistry.stackexchange",
"id": 1584,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "aqueous-solution",
"url": null
} |
reference-request, cellular-automata
While this does mean that an exhaustive enumeration and investigation of all CA rules on this neighborhood may be at least somewhat practical, it does also mean that some interesting behaviors found in cellular automata one larger neighborhoods may be missing from small neighborhoods like this simply due to the limited diversity of the rule space.
The small neighborhood — and, in particular, the fact that adjacent cells have disjoint neighborhoods — also limits the behavior of the edges of localized patterns. In particular, it should fairly easy to prove the following lemma (which also holds for the classic four-cell von Neumann neighborhood on the square lattice): | {
"domain": "cs.stackexchange",
"id": 20105,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reference-request, cellular-automata",
"url": null
} |
lo.logic, proof-assistants
more reusable for a wider set of applications
more computationally meaningful | {
"domain": "cstheory.stackexchange",
"id": 3341,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lo.logic, proof-assistants",
"url": null
} |
ros, service, rosjava
public class TestService implements NodeMain {
private Node node;
private static final String SERVICE_NAME = "/add_two_ints";
private static final String SERVICE_TYPE = "test_ros/AddTwoInts";
@Override
public void main(Node node) {
Preconditions.checkState(this.node == null);
this.node = node;
try {
final Log log = node.getLog();
ServiceClient<AddTwoInts.Request, AddTwoInts.Response> client =
node.newServiceClient(SERVICE_NAME, SERVICE_TYPE);
// TODO(damonkohler): This is a hack that we should remove once it's
// possible to block on a connection being established.
Thread.sleep(100);
AddTwoInts.Request request = new AddTwoInts.Request();
request.a = 2;
request.b = 2; | {
"domain": "robotics.stackexchange",
"id": 7154,
"lm_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, service, rosjava",
"url": null
} |
deep-learning, accuracy
Finally to select the best model for my data set, can I calculate the mean Recall and mean Accuracy? For Example: For the precision metric for example you have:
$$
Precision = \frac{TP}{TP+FP},
$$
with TP = True Positive and FP = False Positive.
Imagine you have the following values:
Image 1: $TP = 2, FP = 3$
Image 2: $TP = 1, FP = 4$
Image 3: $TP = 3, FP = 0$
The precision scores as you calculated will be:
Image 1: $2/5$
Image 2: $1/5$
Image 3: $1$
Your average will be: $0.533$
On the other hand if you sum them all up and then calculate the precision value you get:
$P = \frac{6}{6+7} = 0.462$
This proves that averaging the precision scores is not the same as calculating the total precision in one go. | {
"domain": "ai.stackexchange",
"id": 1628,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning, accuracy",
"url": null
} |
c++, design-patterns, linked-list, iterator
Title: Creating linked list data with iterator pattern I've created a linked list to use it in SquareList. I've started to create a linked list based on just that. I want my class to follow the iterator pattern. How can it be improve to use vector iterator?
#ifndef LINKEDLIST_HPP
#define LINKEDLIST_HPP
#include <stdlib.h>
template <typename Object>
class Linkedlist
{
private:
// The basic doubly linked Linkedlist node.
// Nested inside of Linkedlist, can be public
// because the Node is itself private
struct Node
{
Object _data;
Node *_prev;
Node *_next;
Node( const Object & d = Object( ), Node * p = NULL, Node * n = NULL )
: _data( d ), _prev( p ), _next( n ) { }
};
public:
public:
Linkedlist( )
{ init( ); }
~Linkedlist( )
{
clear( );
delete _head;
delete _tail;
} | {
"domain": "codereview.stackexchange",
"id": 5984,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, design-patterns, linked-list, iterator",
"url": null
} |
python, array, numpy
Where
[[r0, Θ0],
[r1, Θ1],
...
[rn, Θn]]
are the coordinates (your phi_slice) and
[φ0, ..., φn]
are np.linspace(0, (2 * np.pi) - dphi, numbins).
So better build surface by repeating phi_slice and the elevations enought time and then concatenating them together rather than copy/pasting them into a blank array.
This is rather simple since numpy provides np.repeat and np.concatenate. But both have their specifics:
np.repeat return a flat array when no axis is given and repeat each element the requested amount of time before starting to repeat the next one. This is exactly what is needed for the elevations:
>>> np.repeat(np.array([φ0, φ1, φ2]), 3)
array([φ0, φ0, φ0, φ1, φ1, φ1, φ2, φ2, φ2])
But not quite so for the coordinates:
>>> np.repeat(np.array([[r0, Θ0], [r1, Θ1], [r2, Θ2]]), 2, axis=0)
array([[r0, Θ0],
[r0, Θ0],
[r1, Θ1],
[r1, Θ1],
[r2, Θ2],
[r2, Θ2]]) | {
"domain": "codereview.stackexchange",
"id": 24541,
"lm_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, array, numpy",
"url": null
} |
c, beginner, memory-management, cryptography
wx create text file for writing with exclusive access.
wbx create binary file for writing with exclusive access.
w+x create text file for update with exclusive access.
w+bx or wb+x create binary file for update with exclusive access.
Opening a file with any of the exclusive modes above fails if the file already exists or cannot be created. Otherwise, the file is created with exclusive (non-shared) access. Additionally, a safer version of fopen() called fopen_s() is also available. That is what I would use in your code if I were you, but I'll leave that up for you to decide and change.
You can cut down on a few lines of code by initializing similar types on one line. This will keep you more organized.
struct stat statbuf;
struct stat keybuf;
char buffer [20];
int key;
int data;
int output;
int count;
char ans;
int * buf;
FILE * keyfile;
FILE * sourcefile;
FILE * destfile; | {
"domain": "codereview.stackexchange",
"id": 6143,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, beginner, memory-management, cryptography",
"url": null
} |
mass, superconductivity, symmetry-breaking, higgs
Title: How come a photon acts like it has mass in a superconducting field? I've heard the Higgs mechanism explained as analogous to the reason that a photon acts like it has mass in a superconducting field. However, that's not too helpful if I don't understand the latter. Why does this occur, and how? A quick answer: "screening" currents in the superconductor are proportional to the vector potential. With an appropriate choice of gauge, the screening current appears as a mass term in the wave equation for the vector potential. From "An Informal Introduction to Gauge Field Theories":
(This excerpt from Google books) | {
"domain": "physics.stackexchange",
"id": 4408,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mass, superconductivity, symmetry-breaking, higgs",
"url": null
} |
c++, mathematics
for(std::size_t k = 0; k < str.length(); k++) {
if(str[k] != ',') {
number = number + str[k];
}
else if(count < dimension) {
if(number.find_first_not_of("0123456789.-") != std::string::npos) {
std::cout << "ERROR: Not only numbers entered.\n";
getUserInput(vect, i, dimension);
break;
}
else if(number.find_first_not_of("0123456789") == std::string::npos) {
vect[i - 1][count] = std::stod(number);
number = "";
count++;
}
else {
std::cout << "ERROR: Not enough numbers entered.\n";
getUserInput(vect, i, dimension);
break;
}
}
else {
std::cout << "ERROR: Too many numbers entered.\n";
getUserInput(vect, i, dimension);
break;
}
}
} | {
"domain": "codereview.stackexchange",
"id": 37360,
"lm_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++, mathematics",
"url": null
} |
python, performance, algorithm, programming-challenge, mathematics
I pasted a running example here, this generates a random 15x15 puzzle and prints out a few timings and the solution to that particular puzzle.
The method performGaussianElimination(toggle, puzzle) takes by far the longest and seems to be the only bottleneck, but I don't see a place where I could use memoization or other shortcuts to save time. I've looked for other pure python linear algebra solvers, but there are only a few (numpy is so much easier) and don't seem to be a lot different.
def performGaussianElimination(toggle, puzzle):
nextFreeRow = 0
n = len(puzzle)
for col in xrange(n):
pivotRow = findPivot(toggle, nextFreeRow, col)
if pivotRow is None:
continue | {
"domain": "codereview.stackexchange",
"id": 10964,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, algorithm, programming-challenge, mathematics",
"url": null
} |
java, programming-challenge
for(int i = 3; i<=Math.sqrt(number); i++){
while(number%i==0){
list.add(i);
number/=i;
}
}
if(number>2){
list.add(number);
}
return findDivisors(list);
}
// Uses HashMap to convert multiples in form of
// 2 2 2 2 4 4 to 2^4 x 4^2
public static int findDivisors(ArrayList<Integer> list){
int result = 1;
HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
for(int i : list){
if(map.containsKey(i))
map.put(i, map.get(i)+1);
else
map.put(i, 1);
}
// Better take a look at [1]
// on why I did this
for(int i : map.keySet()){
result = result * (map.get(i) + 1);
}
// the result is number of divisors
return result;
} | {
"domain": "codereview.stackexchange",
"id": 18286,
"lm_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, programming-challenge",
"url": null
} |
c++, performance, event-handling, windows, graphics
// Copy the current contents of the screen into our DIB section.
BitBlt(hdcDIB, 0, 0, 1, 1, hdcScreen, x, y, SRCCOPY);
GdiFlush();
// Retrieve the RGB color value of the top-left pixel in our DIB section
// (which is actually the only pixel that it contains).
// Note that in a bitmap, the byte order is always RGBA!
return RGB(pDIBBits[2], pDIBBits[1], pDIBBits[0]);
} | {
"domain": "codereview.stackexchange",
"id": 23717,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, performance, event-handling, windows, graphics",
"url": null
} |
machine-learning, cross-validation
It just uses the same best estimator instance when making predictions. So in practise there's no difference between these two unless you specifically only want the estimator instance itself. As a side note, my differences in metrics were unrelated and down to a buggy class weighting function.
[1]: http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html#sklearn.model_selection.GridSearchCV.fit | {
"domain": "datascience.stackexchange",
"id": 1900,
"lm_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, cross-validation",
"url": null
} |
ros
Originally posted by davinci on ROS Answers with karma: 2573 on 2012-11-08
Post score: 1
The best way to manage overlays and .rosinstall is to use rosws instead of doing that manually.
In general, your method also works. The tools only simplify that.
Regarding the rqt_gui_cpp warning: This is probably, because you added the trunk. If you don't need the paramedit rosgui plugin, it is safe to ignore. Otherwise, there is ros-fuerte-rqt, which contains rqt_gui_cpp.
Originally posted by dornhege with karma: 31395 on 2012-11-08
This answer was ACCEPTED on the original site
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 11675,
"lm_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
} |
quantum-mechanics, wavefunction, wavefunction-collapse, quantum-measurements
I can observe the momentum of particles and, even with tremendous measurement uncertainty, not see them immediately delocalized across all space as would be expected if my observation truly collapsed the wave function to a single momentum eigenstate.
This is a misunderstanding in the case of the momentum operator eigen-function, as described above. Unique states can be defined in the solutions of quantum mechanical equations. The wavefunctions of the hydrogen atom which give the unique spectra, are not plane waves. Eigen functions can have cvarious shapes.
Actually plane wave solutions of the quantum mechanical differential equations are used to construct the Quantum Field Theory , which allows us to calculate crossections and decays for particle interactions and on which the standard model of particle physics is built.
QFT needs graduate studies. | {
"domain": "physics.stackexchange",
"id": 65201,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, wavefunction, wavefunction-collapse, quantum-measurements",
"url": null
} |
eigen, ros-electric
Original comments
Comment by dornhege on 2012-11-07:
Did you get any other errors? What is the output of VERBOSE=1 make?
Comment by boFFeL on 2012-11-07:
No, when i do make VERBOSE=1 it's the same. Only this error and after that compilation is terminated.
Comment by dornhege on 2012-11-07:
I'm sure, there is more output than just the error. Please provide the COMPLETE output.
Comment by dornhege on 2012-11-07:
eigen is not added to the include. If it is installed, check the output of the variables that FindEigen produces.
Comment by dornhege on 2012-11-07:
Your fix is not a real fix. You basically manually specified to look in /usr/include/eigen3/Eigen/Core. The original code was correct. The problem lies in the compile setup, which should add /usr/include/eigen3 to the include.
Comment by boFFeL on 2012-11-07: | {
"domain": "robotics.stackexchange",
"id": 11657,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "eigen, ros-electric",
"url": null
} |
c++, beginner, strings, parsing
Now the implementation. When starting out with a language, it is very hard to find direct equivalent to actions in the algorithm. Fortunately, C++ allows coming close to it, though building blocks are in the standard library already. I recommend using some good, up-to-date documentation. I use cppreference.com .
The first step is understanding iterators. I don't really have a good reference for them, but iterators are the glue that binds containers and algorithms in C++. For now, let's assume it is a pointer into the string. Every standard library container has begin() and end(). The former is iterator to the beginning of container, and the latter is one past the end iterator. In case of "word", begin would point to w, and end to whatever is after d.
The algorithm that searches for the occurrence of a sequence in a bigger sequence is std::search(). If "very long string" is std::searched for "string", it will return iterator pointing to s. | {
"domain": "codereview.stackexchange",
"id": 30371,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, beginner, strings, parsing",
"url": null
} |
microcontroller, gazebo, ros-kinetic
Title: controller_spawner node missing
I want to simulate many uavs in gazebo, when I launched 20uavs in gazebo, I found 17th-20th uav can't be controlled. I checked the rqt_graph and found that the node /gazebo had subscribed all uavs' topic (/pose_action) but the last four. So I want to know is there any limitation on topics a node can subscribe?
update1:
I found 17th-20th uavs didn't have the topic "cmd_vel". On the other hand, I checked the rqt_graph and found that the node /gazebo had subscribed all uavs' topic (/command/pose) but the last four. I checked the log and found that the four uavs' log had the following warning:
Controller Spawner couldn't find the expected controller_manager ROS interface.
But other uavs all correctly load controller_manager and upload the controller. I had tried many times and sometimes there were 5 wrong and sometimes 3 and etc. Why some of them can't?
update2:
I also found the four uavs' node (controller_spawner) were not created. | {
"domain": "robotics.stackexchange",
"id": 30593,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "microcontroller, gazebo, ros-kinetic",
"url": null
} |
Let $Y$ be the number of times the dice is rolled. Then $Y$ follows a geometric distribution with parameter $\frac16$.
We have $\mathbb{E}(Y) = 1 + 5 \mathbb{E}(X)$ since for the first $Y-1$ rolls each of the outcomes $1$, $2$, $3$, $4$, $5$ has equal probability.
It follows (using that a geometric distribution with parameter $p$ has mean $\frac{1}{p}$) that $$1 + 5 \mathbb{E}(X) = \mathbb{E}(Y) = 6$$ so $\mathbb{E}(X) = 1$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363485313248,
"lm_q1q2_score": 0.8070508189561819,
"lm_q2_score": 0.8198933425148213,
"openwebmath_perplexity": 359.1947629896162,
"openwebmath_score": 0.848112165927887,
"tags": null,
"url": "https://math.stackexchange.com/questions/1424497/i-roll-a-die-repeatedly-until-i-get-6-and-then-count-the-number-of-3s-i-got-wh/1424516"
} |
gazebo
[rosmaster.master][INFO] 2013-07-26 15:16:22,771: +SERVICE [/gazebo/set_model_configuration] /gazebo http://ROS:59591/
[rosmaster.master][INFO] 2013-07-26 15:16:22,773: +SERVICE [/gazebo/set_joint_properties] /gazebo http://ROS:59591/
[rosmaster.master][INFO] 2013-07-26 15:16:22,773: +SERVICE [/gazebo/set_link_state] /gazebo http://ROS:59591/
[rosmaster.master][INFO] 2013-07-26 15:16:22,774: +SUB [/gazebo/set_link_state] /gazebo http://ROS:59591/
[rosmaster.master][INFO] 2013-07-26 15:16:22,775: +SUB [/gazebo/set_model_state] /gazebo http://ROS:59591/
[rosmaster.master][INFO] 2013-07-26 15:16:22,775: +SERVICE [/gazebo/pause_physics] /gazebo http://ROS:59591/
[rosmaster.master][INFO] 2013-07-26 15:16:22,776: +SERVICE [/gazebo/unpause_physics] /gazebo http://ROS:59591/
[rosmaster.master][INFO] 2013-07-26 15:16:22,777: +SERVICE [/gazebo/apply_body_wrench] /gazebo http://ROS:59591/ | {
"domain": "robotics.stackexchange",
"id": 3396,
"lm_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",
"url": null
} |
c++, beginner, queue
These can both just return begin() and end() respectively.
const_reverse_iterator crend() const noexcept { rend(); }
Missing return.
size_type max_capacity() const noexcept {
return std::numeric_limits<size_type>::max();
}
Standard containers don’t have max_capacity()… but they do have max_size(), which you don’t.
Also, assuming you can hold the max value of size_type seems optimistic. A better estimate would probably be std::numeric_limits<size_type>::max() / sizeof(T). But meh, I’ve never seen anyone actually use max_size().
const_pointer data() const { return m_RawData; }
If you’re providing this, you might as well provide the non-const overload.
void clear() requires(std::is_destructible<value_type>::value) {
for (size_type i = 0; i < size(); i++) {
m_AllocTraits.destroy(m_Alloc, std::addressof(m_RawData[i]));
}
m_Size = 0;
} | {
"domain": "codereview.stackexchange",
"id": 40871,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, beginner, queue",
"url": null
} |
general-relativity, black-holes, kerr-metric
It also looks like you can go from Kansas ($r>r_+$) to the region with $r_-<r<r_+$ then at least touch the surface $r=r_-$ then travel through a region that is directly affected by two singularities until you finally emerge into a region that is directly affected by only one singularity, another Kansas.
Now if you look at the conformal diagram in Hawking and Ellis the entire negative $r$ section is simple with no horizons of any kind at $r=-r_-$ or $r=-r_+$ so maybe I'm reading it badly. In the picture link I give below it doesn't really show anything interesting beyond the disk $r=0$ but even in Hawking and Ellis the picture just looks like the conformal diagram of Minkowski space. | {
"domain": "physics.stackexchange",
"id": 22558,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, black-holes, kerr-metric",
"url": null
} |
c#
You can eliminate the temp variable Text.
Use the increment operator ++ to increment x.
int x = 0;
foreach (SentencePartTextHolder name in compiledSentenceParts)
{
Console.WriteLine(name);
if (name.Type == SentencePartType.NegativeScheduleCalendar ||
name.Type == SentencePartType.ScheduleCalendar)
{
x++;
if (x == 2)
{
name.Text = $"{NegativePositiveScheduleCalendarDelimiter} {name.Text}";
}
}
else
{
x = 0;
}
}
If you are using C# 9.0, you can use pattern matching to simplify the condition:
if (name.Type is SentencePartType.NegativeScheduleCalendar or
SentencePartType.ScheduleCalendar) | {
"domain": "codereview.stackexchange",
"id": 41793,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#",
"url": null
} |
space-telescope
Measuring cosmic ray and gamma ray showers source
For low energy protons and nuclear cosmic rays, there is the Alpha Magnetic Spectrometer aboard the International Space Station.
At what wavelengths and for what particle types have astronomical objects been imaged or at least directionally resolved from the ISS?
At the other end of the electromagnetic spectrum, starting below 20 or 30 MHz the Earth's ionosphere becomes reflective to low frequencies. This is why short wave radio listeners can hear signals from the other side of the Earth. For these lower frequencies radio astronomers must also get above Earth's atmosphere.
What can be learned from low frequency radio astronomy available outside of Earth's ionosphere?
Requirements to resolve position of Jovian Whistlers up to magnitude of Red Spot with amateur radio equipment? | {
"domain": "astronomy.stackexchange",
"id": 5878,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "space-telescope",
"url": null
} |
speed-of-light, faster-than-light, freezing, cold-atoms
Title: speed of freezing vs. moving An idea came to my mind and like to discuss it.
We know that out there in the space the absolute zero (aka. -273 C) is almost reached where all the particles and atoms would freeze up and stop giving the matter its resilience and shape.
We know as well that for instance if water is to be thrown or poured in some freezing parts of the globe (e.g. Atartica or Nordic countries) where temperture is really really low it would freeze on its way or that might take few seconds no more. (even streams get to be frozen!)
So the questions is:
if superman to be real and that a human being is able to travel at speed fast enough or close to speed of light (I know that its mass would be enormous), what temperature would make him freeze instantly on his position before being able to travel or speed up? is absolute zero would make him frozen before being able to take decision of travelling? | {
"domain": "physics.stackexchange",
"id": 55234,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "speed-of-light, faster-than-light, freezing, cold-atoms",
"url": null
} |
projectile
The last part of the question asks to calculate the direction of the ball at B. Assumptions are there is no air resistance and the ball bouncing does not affect the horizontal velocity of the ball. You are also given that the ball takes 0.6 seconds to travel the 24m and the height of B is 0.75m.
I know to solve the problem I need the horizontal and vertical components of the velocity at B and I can use trig to find the angle. The horizontal velocity I have correctly worked out to be 40m/s in a previous part of the question.
For the vertical velocity again in a previous part of the question I calculated the vertical velocity at A (correctly) to be 4.02m/s. I decided to calculate the impact velocity of the tennis ball as a starting point:
\begin{align}
v^2 =& u^2+2as \\
v =& \sqrt(4.02^2+2*9.8*2.8) \\
=& 8.43m/s \, .
\end{align}
My assumption is that this is the initial vertical velocity as the tennis ball rises up off the ground. Working on that assumption:
\begin{align}
v
=& u + at \\ | {
"domain": "physics.stackexchange",
"id": 36681,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "projectile",
"url": null
} |
javascript, functional-programming, ecmascript-6
Next, I'm going to split the for loop into two. You seem to have two independent things going on in that loop anyways. If you're dealing with a refused person, then you update the refused text, and if you're dealing with an admitted person, then you update admitted text. Why not just independently loop over your refusedPeople and admittedPeople arrays instead?
(This code sample assumes two things. 1. Your refusedPeople array won't contain anything that's not also in people. 2. The order of output is not important. If either of these matters to you, I'll let you figure out how to best incorporate those details).
const people = ['Chris', 'Anne', 'Colin', 'Terri', 'Phil', 'Lola', 'Sam', 'Kay', 'Bruce'];
const refusedPeople = ['Lola', 'Phil'];
const admittedPeople = people.filter(name => !refusedPeople.includes(name));
const admitted = document.querySelector('.admitted');
const refused = document.querySelector('.refused'); | {
"domain": "codereview.stackexchange",
"id": 42437,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, functional-programming, ecmascript-6",
"url": null
} |
filters, finite-impulse-response
Title: Question on FIR filter I've been trying to do this problem for the last few hours. Could someone show me the workings on how it is done? Not just the answer.
The figure shows the structure of a FIR filter where $A = 1.5$, $B = 0.69$ and $C = 3.0$.
If $x[n] = u[n]$, what is the value of $y[n]$ for $n = 20$? [EDITED] From left to right, try to find the impulse response. On the bottom branch, delay the unit pulse $d$ and get $d[n-1]$. Add $Ad[n]$. Delay twice and get $d[n-3] +Ad[n-2]$. Add $Bd[n]$. Add $Cd[n-1]$. So the FIR coefficients of the impulse response $h$ will be $[1,A,C,B]$, but in the reverse order (as correctly pointed out by colleagues), because $y[n] = \sum d[k]h[n-k]$. So your system is causal, and $h[0]=B$, $h[1]=C$, $h[2]=A$, $h[3]=1$.
However, at $n=20$, you are in a stabilized region of the signal (all the known samples are equal to $1$, so even if you make a mistake as I did first, the answer will be the same, $1+A+C+B$, as stated before by other colleagues. | {
"domain": "dsp.stackexchange",
"id": 3752,
"lm_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, finite-impulse-response",
"url": null
} |
electricity, electric-circuits, electric-current, batteries, electrochemistry
anode the positive metal ions are produced and need negative electrolyte ions to balance while at the cathode the positive metal ions are reduced leaving their negative counter parts that need to be balanced by positive electrolyte ions. If charge buildup occurs the reaction will stop and no current will flow (this is almost immediate). | {
"domain": "physics.stackexchange",
"id": 64727,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electricity, electric-circuits, electric-current, batteries, electrochemistry",
"url": null
} |
Adding those results together, one can deduce the number $d_n$ of diagonlizable matrices of size $n\times n$ :
$$\begin{array}{|l|l|l|l|} \hline n & d_n & d_n \ \text{when} \ q=2 \\ \hline 2 & q(q^3-q+1) & 14 \\ \hline 3 & q(q^8 - q^7 - 2q^6 + q^4 + 2q^3 - q^2 + 1) & 58 \\ \hline 4 & q(q^{15} - 3q^{14} - 2q^{13} + 4q^{12} + 5q^{11} + 8q^{10} + q^9 - 4q^8 - 4q^7 - 6q^6 + 2q^5 - q^4 - q^3 + 1)& 1362\\ \hline \end{array}$$
-
Ewan, it's your call, but you may want to consider temporarily taking down your answer. This looks like a contest problem: meta.math.stackexchange.com/questions/11034/… I may be wrong though, so I leave it up to you. – Alex Youcis Oct 27 '13 at 10:40
@AlexYoucis You’re right. Deleted now, thanks for warning me. – Ewan Delanoy Oct 27 '13 at 11:36
The deadline has passed for this contest; feel free to undelete. – Arthur Fischer Dec 7 '13 at 11:55 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9632305339244013,
"lm_q1q2_score": 0.8088573941720414,
"lm_q2_score": 0.839733963661418,
"openwebmath_perplexity": 117.63503690764252,
"openwebmath_score": 0.9699845910072327,
"tags": null,
"url": "http://math.stackexchange.com/questions/535205/find-the-number-of-n-by-n-matrices-conjugate-to-a-diagonal-matrix"
} |
arduino, macos, rosserial, macos-lion, osx
Am I grabbing out dated code from the wrong CVS??? This change to Arduino was made a while ago, so I don't understand how I am the first to find it. Thanks!
[UPDATE 1]
I loaded the "hello world" sketch onto my Arduino, but now it crashes with :
[kevin@TARDIS ~]$ rosrun rosserial_python serial_node.py /dev/cu.usbserial-A4001lNd
Traceback (most recent call last):
File "/Users/kevin/ros_sandbox/rosserial/rosserial_python/nodes/serial_node.py", line 40, in <module>
from rosserial_python import SerialClient
File "/Users/kevin/ros_sandbox/rosserial/rosserial_python/src/rosserial_python/__init__.py", line 1, in <module>
from SerialClient import *
File "/Users/kevin/ros_sandbox/rosserial/rosserial_python/src/rosserial_python/SerialClient.py", line 42, in <module>
from serial import *
ImportError: No module named serial
Am I missing a dependency?
[UPDATE 2]
I figured out I needed to do:
pip install pyserial | {
"domain": "robotics.stackexchange",
"id": 8425,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "arduino, macos, rosserial, macos-lion, osx",
"url": null
} |
thermodynamics, phase-transition, equilibrium, adiabatic
This is all basically your attempt. In my judgment, there is not a better way of approaching this. | {
"domain": "physics.stackexchange",
"id": 62958,
"lm_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, phase-transition, equilibrium, adiabatic",
"url": null
} |
statistical-mechanics, entropy, harmonic-oscillator
$$
S = \beta \langle E\rangle + \log(Z)
$$
and
$$
\langle E\rangle = -\frac{d\log(Z)}{d\beta}\;.
$$
All the information you need to answer your questions can be determined directly from the partition function $Z$ given above (and similar expressions for the partition function in 3d). | {
"domain": "physics.stackexchange",
"id": 89246,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statistical-mechanics, entropy, harmonic-oscillator",
"url": null
} |
density-matrix, linear-algebra
$\langle 0,n|\rho|0,n\rangle=\frac{a^2}{\cosh^2(r)}\tanh^{2n}(r)$
$\langle 0,n+1|\rho|0,n+1\rangle=\frac{a^2}{\cosh^2(r)}\tanh^{2n+2}(r)$
$\langle 1,n|\rho|1,n\rangle=\frac{b^2}{\cosh^4(r)}n\tanh^{2n-2}(r)$
$\langle 1,n+1|\rho|1,n+1\rangle=\frac{b^2}{\cosh^4(r)}(n+1)\tanh^{2n}(r)$ | {
"domain": "quantumcomputing.stackexchange",
"id": 4405,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "density-matrix, linear-algebra",
"url": null
} |
c#, .net, rubberduck, wrapper, com
protected static void InvokeMember<T1, T2, T3, T4>(Action<T1, T2, T3, T4> member, T1 param1, T2 param2, T3 param3, T4 param4)
{
try
{
member.Invoke(param1, param2, param3, param4);
}
catch (COMException exception)
{
throw new WrapperMethodException(exception);
}
}
protected static void ThrowIfDisposed(bool isDisposed)
{
if (isDisposed) { throw new ObjectDisposedException("Object has been disposed."); }
}
protected void ThrowIfDisposed()
{
ThrowIfDisposed(_isDisposed);
}
public void Dispose()
{
if (_isDisposed)
{
return;
}
Marshal.ReleaseComObject(_item);
_isDisposed = true;
}
}
} | {
"domain": "codereview.stackexchange",
"id": 22243,
"lm_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, rubberduck, wrapper, com",
"url": null
} |
quantum-mechanics, angular-momentum, operators, hilbert-space, singularities
Strictly speaking, in $d$ spatial dimensions the domain of the operator $r^{-2}$ is the subset of the Hilbert space $L^2 \left( \mathbb{R}^d \right)$ which $r^{-2}$ takes to $L^2 \left( \mathbb{R}^d \right)$, i.e. the set of square-integrable functions $\psi({\bf r})$ such that
$$\left \langle \psi \middle| \left(r^{-2} \right)^\dagger r^{-2} \middle| \psi \right \rangle = \int d^dx\ \frac{|\psi({\bf r})|^2}{r^4} = \int d\Omega \int r^{d-1} dr \frac{|\psi(r, \Omega)|^2}{r^4}$$
is finite. This is the set of functions $\psi({\bf r})$ that go to zero at the origin at least as fast as $r^p$ for some power $p > 4 - d$. In three spatial dimensions, this means that $\psi({\bf r})$ must go to zero faster than $r$ near the origin. | {
"domain": "physics.stackexchange",
"id": 48098,
"lm_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, angular-momentum, operators, hilbert-space, singularities",
"url": null
} |
quantum-mechanics
Title: Rescaling of a wave function Let's suppose we have a hamiltonian that contains a term $\partial_x$ is there some rescaling of the wave function $\psi$ possible so that this term vanishes? I mean something like this $f \psi = \tilde{\psi}$ with
$$\partial_x \left(\frac{1}{f}\tilde{\psi}\right)= A(x) \tilde{\psi} $$
where $A(x)$ does not contain any derivative operators. If you have a lone derivative by itself, then no, this isn't possible.
On the other hand, if you also have a second derivative in your operator (which happens in the overwhelming majority of cases where you'd want to do this), then yes, this is possible: if you consider, say, the reasonably-general combination
$$
\left[\frac12\partial_x^2 - i\alpha \partial_x\right] \psi(x),
$$
then you can define $\psi(x) = e^{i\kappa x}\tilde \psi(x)$ so that
\begin{align}
\left[\frac12\partial_x^2 - i\alpha \partial_x\right] \psi(x)
& =
\left[\frac12\partial_x^2 - i\alpha \partial_x\right] e^{i\kappa x}\tilde \psi(x)
\\ & = | {
"domain": "physics.stackexchange",
"id": 55144,
"lm_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",
"url": null
} |
graph, react.js, typescript
// keep track of search bar input
const [input, setInput] = useState("");
// keep track of nav bar tab state
const [currentNavTab, setCurrentNavTab] = useState<NavTab>(NavTab.Home);
// keep track of whether the context menu is open or closed
const [contextMenuState, setContextMenuState] = useState<ContextMenuState>({
open: false,
type: ContextMenuType.Canvas,
mobile: window.innerWidth < 1100,
x: 0,
y: 0,
});
window.onresize = () => {
if (window.innerWidth < 1100) {
if (!contextMenuState.mobile) {
setContextMenuState({ ...contextMenuState, mobile: true });
}
} else {
if (contextMenuState.mobile) {
setContextMenuState({ ...contextMenuState, mobile: false });
}
}
}; | {
"domain": "codereview.stackexchange",
"id": 44277,
"lm_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, react.js, typescript",
"url": null
} |
biochemistry, proteins, translation
and become GUG or even UUG, coding for valine and leucine respectively. And the twist is, it still codes for methionine or formylmethionine1. In rare cases, such as heat shock, other codons like CUG, ACG, AUA and AUU, are also used for initiation 2. It is so because start codon itself is not sufficient to begin translation, other nearby factors, like the Shine-Dalgarno sequence, or initiation factors, also play a role. One such factor is the initiation tRNA. At the beginning of translation, tRNAMet or tRNAfMet binds to the small subunit of ribosome. So, whatever be the start codon, the first amino acid will be methionine3. | {
"domain": "biology.stackexchange",
"id": 6730,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "biochemistry, proteins, translation",
"url": null
} |
So,
p(x)=17+(22)/(1!)(x-2)+(18)/(2!)(x-2)^2+(6)/(3!)(x-2)^3=17+22(x-2)+9(x-2)^2+(x-2)^3.
So, equivalently polynomial p(x)=x^3+3x^2-2x+1 can be written as p(x)=(x-2)^3+9(x-2)^2+22(x-2)+17.
Thus, Taylor formula for polynomials allows us to rewrite any polynomial in terms of (x-a).
Now, let's see how we can use this idea for any differentiable functions.
Suppose that function y=f(x) has finite derivatives up to n-th order at point a.
Taylor Formula for any Function. For function y=f(x) n-th degree Taylor polynomial at point x=a is T_n(x)=f(a)+(f'(a))/(1!)(x-a)+(f''(a))/(2!)(x-a)^2+...+(f^((n-1))(a))/((n-1)!)(x-a)^(n-1)+(f^((n))(a))/(n!)(x-a)^n.
Of course, T_n(x)!=f(x), but as appeared T_n(x) is a very good approximation for f(x) when x->a. And the higher n (order of polynomial) the better approximation.
Fact. T_n(x)~~f(x) as x->a.
This fact allows us to approximate function by polynomial near point x=a with any precision we want, by taking high degree polynomial. | {
"domain": "emathhelp.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9920620077761346,
"lm_q1q2_score": 0.8040453379370741,
"lm_q2_score": 0.810478913248044,
"openwebmath_perplexity": 5142.053445264883,
"openwebmath_score": 0.9502495527267456,
"tags": null,
"url": "http://www.emathhelp.net/notes/calculus-1/taylor-formula/taylor-polynomial/"
} |
coordinate-systems, velocity
\end {pmatrix}=
\begin{pmatrix}\dot r&r\,\dot\vartheta&r\sin\vartheta\,\dot\varphi
\end {pmatrix}
\begin{pmatrix}
\sin\vartheta\cos\varphi&\sin\vartheta\sin\varphi& \cos\vartheta\\
\cos\vartheta\cos\varphi&\cos\vartheta\sin\varphi&-\sin\vartheta\\
-\sin\varphi&\cos\varphi&0\\
\end {pmatrix}
\begin{pmatrix}\partial_x\\\partial_y\\\partial_z
\end {pmatrix}$$
where we have, suddenly, just a rotation matrix. | {
"domain": "physics.stackexchange",
"id": 95063,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "coordinate-systems, velocity",
"url": null
} |
#### Kenny Lau (Aug 02 2020 at 00:38):
if S doesn't have an LUB, then lub S will be some real number whose value is outside of your knowledge
#### Kenny Lau (Aug 02 2020 at 00:38):
it will behave like an arbiratry real number
#### Patrick Thomas (Aug 02 2020 at 00:40):
I guess it isn't much different than saying t is_lub S then?
#### Patrick Thomas (Aug 02 2020 at 00:40):
That is t : \R and t is_lub S.
#### Patrick Thomas (Aug 02 2020 at 00:41):
Or is it actually safer?
#### Patrick Thomas (Aug 02 2020 at 00:42):
Because the arbitrary number won't have the properties of the lub to use?
#### Patrick Thomas (Aug 02 2020 at 01:16):
How do I get at the properties of lub S? That is, use the fact that it is an ub of S and it is leq to any ub of S in a proof.
#### Patrick Thomas (Aug 02 2020 at 03:34):
I guess I need to prove: example (S : set ℝ) : is_lub S (lub S) := ?
#### Kenny Lau (Aug 02 2020 at 03:36):
that would mean every set has lub | {
"domain": "github.io",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9683812345563902,
"lm_q1q2_score": 0.8306465399943904,
"lm_q2_score": 0.8577681086260461,
"openwebmath_perplexity": 3348.954673009072,
"openwebmath_score": 0.3846169710159302,
"tags": null,
"url": "https://leanprover-community.github.io/archive/stream/113489-new-members/topic/formalizing.20definitions.20for.20real.20analysis.html"
} |
gene-expression, rna, human-genome, histone, splicing
Title: What's the difference between CREs and DHSs? I would like to know what's the difference between cis-regulating elements and DNase I–hypersensitive sites, in order to produce a meaningful segregation of non coding elements affecting gene expression. Cis-regulatory elements are simply DNA regions upstream or downstream of a gene that can affect its expression (basically they have to be in the same chromosome).
DNAse-I hypersensitive sites (DHS) are regions of chromatin that get digested during the DNAse treatment because they are exposed i.e. not protected by a protein (complex). The protein complex can either be a nucleosome or a transcription factor. It should be noted that a DNA region can be DNAse insensitive also because of its conformation. | {
"domain": "biology.stackexchange",
"id": 5337,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gene-expression, rna, human-genome, histone, splicing",
"url": null
} |
c++, template, c++14
template <template <typename...> class P, typename... Ts>
struct alternating_pack<P<>, std::tuple<Ts...>> {
using type = P<Ts...>;
};
}
template <typename...> class VariadicTreeWithComparators;
template <>
class VariadicTreeWithComparators<> {
public:
using value_type = void;
}; | {
"domain": "codereview.stackexchange",
"id": 19972,
"lm_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++, template, c++14",
"url": null
} |
special-relativity, time-dilation
I believe it should be :
$\frac{1}{1+v/c} \times\text{dilated time between ticks} $
$=\frac{1}{1+v/c} \times \ \sqrt{1-v^2/c^2}={\sqrt{\frac{1-v/c}{1+v/c}}}$
but textbooks just mention the dilation factor only.
If I were to look at the clock in a moving spacecraft, And if my clock ticks once every second, then at what rate would his
clock tick? | {
"domain": "physics.stackexchange",
"id": 79084,
"lm_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, time-dilation",
"url": null
} |
ros, visualization, ompl
Originally posted by clee2693 on ROS Answers with karma: 71 on 2012-04-15
Post score: 2
Hello,
OMPL itself does support the functionality you would like to test (In fact, we are just about to push some changes to the OMPL repository that allow outputting GraphML structures for the trees OMPL planners generate).
However, that functionality is not exposed through the ompl_ros_interface package in ROS Electric. This functionality is implemented for Fuerte, part of the upcoming MoveIt project (not yet released).
So.. the way to do this with ROS Electric will require adding some local hacks on your side:
In the ompl_ros_interface package, the file src/ompl_ros_planning_group.cpp contains the call to the solve() function of an OMPL planner:
{{{
bool solved = planner_->solve(request.motion_plan_request.allowed_planning_time.toSec());
}}}
This is Line 446 for me.
After that line, you can do something like this:
{{{
const ompl::base::PlannerData &pd = planner_->getPlannerData(); | {
"domain": "robotics.stackexchange",
"id": 8978,
"lm_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, visualization, ompl",
"url": null
} |
vba, excel
The solution to avoiding these jumps is not necessarily simpler, because you will probably need more steps to connect the flow and overcome the disjointed shortcuts created by the GoTo’s. But these extra steps will help later on when maintaining the code because you’ll always be aware of the context: where the logic is coming from and where it leads, causes and effects, and it makes it a lot easier to spot the issues
Back to your Sub, you are aware the formatting is not ideal but you did try to highlight the main “action” by the use of vertical white space – it makes it quite easy to locate. But there are more issues as well: | {
"domain": "codereview.stackexchange",
"id": 26368,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba, excel",
"url": null
} |
javascript, jquery, underscore.js
// Get the products for the selected date
function getProducts(arrivalDate){
getDayProductsData(arrivalDate, function (data) {
$('#js-day-products')
.empty()
.append(_.template(Templates.dealProducts)({productsData: data}))
.delegate(".reserve-checkout", "click", function() {
var dealProductId = $(this).attr("data-dealProductId");
var checkInDate = $(this).attr("data-checkInDate");
var productQuantityID = $(this).attr("data-dealProductId") + "-product-quantity";
var quantity = $("#" + productQuantityID).val();
var ourl = viewHelpers.orderURL(dealProductId, checkInDate, quantity);
//do stuff with the ourl
})
.delegate(".choose-product", "click", function() {
$('.product-container').removeClass('selected'); | {
"domain": "codereview.stackexchange",
"id": 17265,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, underscore.js",
"url": null
} |
ph
Temperature. I've included this one because it is unclear from your post whether you are measuring the actual solution temperature when you calculate pH from EMF, or just assume that the temperature is some constant value. The Nernst equation may be used to estimate the amount of "noise" (i.e. the difference in EMF) one may expect from the temperature fluctuations: $\Delta E=2.303\frac{R\Delta T}{F}pH$. That is, if we can neglect the temperature dependence of pH itself, i.e. when $\Delta T$ is relatively small (when $\Delta T$ is large we can no longer neglect the temperature dependences of equilibrium constants). If, for some reason, the daily temperature change in the nutrient bath is different than that in the storage solution, you may expect to get slightly different readings. | {
"domain": "chemistry.stackexchange",
"id": 11109,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ph",
"url": null
} |
as fââ ( a ) = 0 write... Then we wan na take the derivative of a function changes from concave ⦠tive for! Generally to a higher partial derivative that involves differentiation with respect to multiple variables all multiple equivalent and. If a function at a point is defined as the derivative of a function may also be shown dydx...  ) â = ( â ) â Related pages for this function by (... General shape of its graph on second derivative notation intervals then wan na take the derivative of function. Na take the derivative of that to get us our second derivative the! Other notations are used, but the above two are the most commonly used List the â¦! Where it is concave down however, mixed partial may also refer generally! | {
"domain": "baroknikrajinou.cz",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429624315189,
"lm_q1q2_score": 0.8129412267577049,
"lm_q2_score": 0.8267117962054048,
"openwebmath_perplexity": 687.9443177457151,
"openwebmath_score": 0.9352886080741882,
"tags": null,
"url": "http://baroknikrajinou.cz/8rofnx/debc88-second-derivative-notation"
} |
java, exception-handling
@Override
public void mouseMoved(MouseEvent m) {
if (!isConnected.get()) {
return;
}
for (int i = 0; i < shipList.size(); i++) {
if (shipList.get(i).isActive()) {
shipList.get(i).moveShip(m.getX(), m.getY());
}
}
}
});
Some discussions about Java Stack traces and exceptions:
Longjumps Considered Inexpensive
How slow are Java exceptions? | {
"domain": "codereview.stackexchange",
"id": 7705,
"lm_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, exception-handling",
"url": null
} |
option to opt-out of these cookies. Example 1. With the increase in the number of congruences, the process becomes more complicated. By subtracting obtained equations we have: It follows: $x – x_0 = 2t, t \in \mathbb{Z}$. In case the modulus is prime, everything you know from linear algebra goes over to systems of linear congruences. If the number $m =p$ is a prime number, and if $a$ is not divisible by $p$, then the congruence $ax \equiv b \pmod p$ always has a solution, and that solution is unique. Linear Congruence Calculator. Since $\frac{m}{d}$ divides $m$, that by the theorem 6. The one particular solution to the equation above is $x_0 = 0, y_0 = -4$, so $3x_0 – 2y_0 = 8$ is valid. Solving the congruence $ax \equiv b \pmod m$ is equivalent to solving the linear Diophantine equation $ax – my = b$. Solving the congruence a x ≡ b (mod m) is equivalent to solving the linear Diophantine equation a x – m y = b. Solve The Linear Congruence Step By Step ; Question: Solve The Linear | {
"domain": "com.br",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.964321448096903,
"lm_q1q2_score": 0.8056746884354071,
"lm_q2_score": 0.8354835309589073,
"openwebmath_perplexity": 422.24327171319595,
"openwebmath_score": 0.7226665616035461,
"tags": null,
"url": "https://jcqueiroz2.blog-dominiotemporario.com.br/ivs9q/solve-linear-congruence-b0f785"
} |
fluid-dynamics, water, surface-tension, flow
Title: Non-determinitric flow of water stream on vertical porcelain surface I noticed several times while washing my hands that accumulated water when starts streaming vertically does not flow vertically in straight line on vertical porcelain surface under the force of gravity. It rather flows in strange zig-zag like path and the flow changes its direction rapidly and erratically from left to right and vice versa. Intuitively, it seems that the straight vertical path for the stream is the most physically economic path. | {
"domain": "physics.stackexchange",
"id": 11467,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, water, surface-tension, flow",
"url": null
} |
hologram
Title: Do some people in 3D holograms doing the same things somewhere else in real life? This question is about 3D holograms.
I watched a few videos about holograms on youtube.On one of them there was a teacher who visits the class via hologram for a few minutes.I know that they made holograms of even dead people like Michael Jackson. But I would like to ask if it technically possible , what people in the real life can be seen as a hologram in somewhere else. It could be like video phone but while person A sees video of the other side, the other side can see person A as a hologram.
(sorry for grammar mistakes, English is not my native language.) First, they are not holograms. They are a modern derivative of an old stage magic trick called Pepper's Ghost | {
"domain": "physics.stackexchange",
"id": 63751,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "hologram",
"url": null
} |
the circle. The total measure of the angle, therefore, is 35°. The entire clock measures 360°. Since there are 60 minutes on a clock, each minute mark is 6 degrees. Please be advised that you will be liable for damages (including costs and attorneys’ fees) if you materially © 2007-2021 All Rights Reserved, SSAT Courses & Classes in San Francisco-Bay Area. Clock Angle Problem: Given time in hh:mm format, calculate the shorter angle between hour and minute hand in an analog clock. University of Massachusetts-Dartmouth, Bachelors, Math. Subject: Clock puzzles Exam Prep: AIEEE, Bank Exams, CAT Job Role: Bank Clerk, Bank PO. A shortcut formula for angles between two hands at 9:37 is much more difficult create tests, we. The answer is 10º ( a ) 100 0 ( B ) 80 0 D. There are 360 total degrees always contains 360 degrees hand has turned through: a 1 ' o clock 15... 30 ) form a right angle, therefore, we can calculate where the hour hand or degrees! 8:15 PM, what angle do the hands of the clock | {
"domain": "newlight2.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9755769078156283,
"lm_q1q2_score": 0.8043260146422785,
"lm_q2_score": 0.8244619242200082,
"openwebmath_perplexity": 806.5166038522535,
"openwebmath_score": 0.41082969307899475,
"tags": null,
"url": "http://newlight2.org/g2qmlh9/babef2-angle-between-hands-of-a-clock-formula"
} |
# Roulette Wheel Selection
As we saw previously, it’s easy to simulate a random coin flip by generating a random decimal $r$ between $0$ and $1$ and applying the following function:
\begin{align*} \textrm{outcome}(r) = \begin{cases} \textrm{heads} & \textrm{ if } r < 0.5 \\ \textrm{tails} & \textrm{ otherwise} \end{cases} \end{align*}
This is a special case of a more general idea: sampling from a discrete probability distribution. Flipping a fair coin is tantamount to sampling from the distribution [0.5, 0.5], i.e. $0.5$ probability heads and $0.5$ probability tails.
More complicated contexts may require sampling from longer distributions that may or may not be uniform. For example, if we wish to simulate the outcome of rolling a die with two red faces, one blue face, one green face, and one yellow face, then we need to sample from the distribution [0.4, 0.2, 0.2, 0.2]. | {
"domain": "justinmath.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9914225133191064,
"lm_q1q2_score": 0.8522900014867285,
"lm_q2_score": 0.8596637559030338,
"openwebmath_perplexity": 291.4495911781642,
"openwebmath_score": 0.8775347471237183,
"tags": null,
"url": "https://www.justinmath.com/roulette-wheel-selection/"
} |
observational-astronomy, amateur-observing, satellite
“No one thought of this... We didn’t think of it. The astronomy community didn’t think of it.”
Now that some time has passed and people have definitely thought of it, is the likely impact on observational astronomy better understood? tldr; some modelling has been done with a lot more to do, but generally the impact of these constellations is fairly negative, but potentially manageable.
Ok, there's a lot to unpack here. First things first, while people have been aware of Starlink and have thought of it, modelling the impacts to observatories hasn't happened as of yet in quite a few places.
The main observatory which has had modelling done, LSST, released this statement; | {
"domain": "astronomy.stackexchange",
"id": 4269,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "observational-astronomy, amateur-observing, satellite",
"url": null
} |
neural-networks, deep-learning, tensorflow, javascript
Often you will see a neural network layer function written in this form or similar:
$$\mathbf{y} = f(\mathbf{W}\mathbf{x} + \mathbf{b})$$
Where $f()$ is the activation function (applied element-wise), $\mathbf{W}$ the weights matrix for the layer and $\mathbf{b}$ is the bias. When written in this form, it is easy to see that $\mathbf{y}$, $\mathbf{W}\mathbf{x}$ and $\mathbf{b}$ must all be vectors of the same size.
This layer design has become so standard that it is possible to forget that other designs and implementations are possible for neural network parameters, and can sometimes be useful. Frameworks like TensorFlow also make it easier to take the standard approach, which is why you need a vector for bias on the example you are using. Whilst you are learning, and probably 99% of the time after that, it will be best to go with what the framework is doing here. | {
"domain": "ai.stackexchange",
"id": 1652,
"lm_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, deep-learning, tensorflow, javascript",
"url": null
} |
asymptotics
Title: How was $T(N)$ derived for this function?
I’m struggling to understand how $T(N)=C_1 \times N + C_2$ was derived
Assuming $C_1$ refers to l <- 0, and $C_2$ refers to return l
Shouldn’t it total $T(N)= C_1 + (N + 1) + N + C_2$, which simplifies to $T(N)= C_1 + 2N + 1 + C_2$ ? Here, $C_1$ and $C_2$ are constants that concern several instructions:
$C_2$ corresponds to instructions executed only once l <- 0, the last executed test of while(A[l]!=NULL) and return l
$C_1$ corresponds to instructions executed several times: each test of while(A[l]!=NULL) but the last, and l<-l+1. Those are executed a total of $N$ times.
We indeed get $T(N) = C_1\times N + C_2$. | {
"domain": "cs.stackexchange",
"id": 18188,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "asymptotics",
"url": null
} |
php, sql
Now you can see that if SELECT * FROM gallery had any meaning, you would have run it using query(), not a prepared statement. But as it is just useless, we won't run this query at all.
All other queries must be run using prepared statements:
$sql = "INSERT INTO topics (category_id, topic_title, topic_creator, topic_date, topic_reply_date, imgFullNameGallery, topic_pris)
VALUES (?,?,?,now(), now(),?,?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param("sssss", $cid, $title, $creator, $imageFullName, $imagePris);
$stmt->execute();
$new_topic_id = mysqli_insert_id($conn); | {
"domain": "codereview.stackexchange",
"id": 37083,
"lm_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, sql",
"url": null
} |
javascript, functional-programming, ecmascript-6, mergesort
return [...merge(sort(fst), sort(snd))];
} I'd move the helper functions into sort's scope. Names like any and merge are very generic, and don't need to be cluttering up the global scope.
I also question the need for some of the functions, especially dropHead. It's just a synonym for Array.shift, so why not just call shift? All you get is a function with side-effects; since shift modifies the receiver, dropHead modifies the passed-in array, but at an extra level of, well, obfuscation almost.
The naming of isSingleton isn't great either. "Singleton" in OO languages usually has precise meaning. In mathematics it refers to a single-element set, but in a programming context I'd expect it to check whether the array object itself is a singleton. | {
"domain": "codereview.stackexchange",
"id": 24891,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, functional-programming, ecmascript-6, mergesort",
"url": null
} |
ros, cmake, c++11
Merely trying to be pragmatic. Using set_target_properties(..) with COMPILE_FLAGS would allow you to do what you want, right now, in Indigo, even with ancient CMake.
Comment by gvdhoorn on 2016-10-25:
Btw, Kinetic has standardised on CMake 3.0.2, see REP-3 - Platforms by Distribution - Kinetic Kame.
Comment by Dirk Thomas on 2016-10-25:
Every package can choose what min. version to use. The versions in REP 3 are the lowest common denominator for all target platforms of a specific ROS distro. Many packages share the same branch for Indigo & Kinetic though. Therefore they have to use the lower CMake version.
Option 0 is not recommended in catkin because if you use catkin_make which builds all packages in a single CMake context one package would override the global flags for all others. Different packages could even set different global flags. Also setting the flags should not overwrite other flags - therefore you should always extend the flags. | {
"domain": "robotics.stackexchange",
"id": 26040,
"lm_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, cmake, c++11",
"url": null
} |
java, algorithm, traveling-salesman
LinkedList<Point> points = new LinkedList<>();
ArrayDeque<Point> collisions = new ArrayDeque<>(graph.length);
// O(n)
System.out.println("Input Graph: ");
for (int t = 0; t < graph.length; ++t) {
Point point = new Point(graph[t][0], graph[t][1]);
points.add(point);
System.out.println(point);
}
// O(nlog(n))
Collections.sort(points);
List<Point> virtualSolution;
// O(n^2)
for (int t = 0; t < points.size(); ++t) {
Point point = points.get(t);
for (int s = t + 1; s < points.size(); ++s) {
Point other = points.get(s);
if (point.getY() == other.getY()) {
collisions.add(other);
points.remove(s);
}
}
virtualSolution = new ArrayList<>(points);
Collections.swap(virtualSolution, t, t == 0 ? points.size() - 1 : t - 1); | {
"domain": "codereview.stackexchange",
"id": 28682,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, algorithm, traveling-salesman",
"url": null
} |
organic-chemistry, nomenclature
Therefore, the correct name for the first example given in the question is ‘2-methylpent-1-en-3-yne’ (not ‘4-methylpent-4-en-2-yne’) since the locant set ‘1,3’ for the multiple bonds is lower than ‘2,4’. | {
"domain": "chemistry.stackexchange",
"id": 5433,
"lm_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, nomenclature",
"url": null
} |
java, performance, hash-map, complexity
Title: Finding the most common character in a string with a hash map I created a method for finding the most common character in a string (using HashMap):
public static char getMaxViaHashmap ( String s) {
HashMap<Character, Integer> map = new HashMap<Character, Integer>();
char maxappearchar = ' ';
for (int i = 0; i < s.length(); i++)
{
if ( map.containsKey(s.charAt(i)))
{
map.put (s.charAt(i), map.get(s.charAt(i)) + 1 );
}
else
{
map.put (s.charAt(i), 1);
}
} | {
"domain": "codereview.stackexchange",
"id": 30411,
"lm_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, performance, hash-map, complexity",
"url": null
} |
scala, validation
exceptions.flatten
}
}
case class StreetSecondary(designator: String, value: Option[String]) {
{
val exceptions: List[RuntimeException] = StreetSecondary.validate(designator, value)
require(exceptions.isEmpty, s"found validation exceptions [${exceptions.mkString(",")}]")
}
} | {
"domain": "codereview.stackexchange",
"id": 14931,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "scala, validation",
"url": null
} |
javascript, php, html
That being said, what you have works, and so long as you do not have a bunch of browsers open and you have your backend scaled appropriately, the number of queries you are making against the database should not be problematic. Since you are loading each component asynchronously now, you might even consider adding a "jitter" to your $.load() calls so as to make the query load less spiky against the database.
For example:
$("#date").load("includes/date.php");
setTimeout(
$("#product").load("includes/product.php"),
1000
);
setTimeout(
$("#output_actual").load("includes/output_actual.php"),
2000
);
// etc. | {
"domain": "codereview.stackexchange",
"id": 24611,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, php, html",
"url": null
} |
electromagnetism, visible-light, speed-of-light, refraction, quantum-optics
Light actually does move slower through transparent media. We don't really know why.
Light actually does move slower through transparent media. The reason is that light's EM effects induce nearby charged particles (electrons and nuclei) to alter the EM field with a harmonic vibration that "cancels out" some of the velocity of the light wave.
Light does not move slower. We don't know why it seems to.
Light does not move slower. It bounces around in the media which causes it to progress more slowly.
Light does not move slower. It is absorbed and emitted by electrons in the media which causes it to progress more slowly.
My thoughts on each of these: | {
"domain": "physics.stackexchange",
"id": 15522,
"lm_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, visible-light, speed-of-light, refraction, quantum-optics",
"url": null
} |
watch. examsolutions. • How to solve modulus equations. h” header files support all the arithmetic. $\endgroup$ – Ritam Bhaumik Nov 23 '16 at 14:04 $\begingroup$ @fgrieu: Yes, well, that distinction is a matter of convention. The theoretical part follows; in this part one tries to devise an argument that gives a conclusive answer to the questions. m or M Physics A quantity that expresses the degree to which a substance possesses a property, such as elasticity. ) Exercise: Prove that. Modulus Inequalities; 15. with the finite part equal to some ideal in the ring of integers 𝒪 K of K, and the infinite part equal to the product of some subcollection of the real primes of K. Physics a coefficient expressing a specified property of a specified substance. Further Maths students please go to the Further Mathematics Page Last updated in April 2020. He has been teaching from the past 9 years. Properies of the modulus of the complex numbers. So I have again tried without the curly brackets: | {
"domain": "fnaarccuneo.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9863631635159684,
"lm_q1q2_score": 0.8282826528650059,
"lm_q2_score": 0.8397339676722393,
"openwebmath_perplexity": 778.9735825241737,
"openwebmath_score": 0.654097318649292,
"tags": null,
"url": "http://fnaarccuneo.it/ybbj/modulus-in-maths.html"
} |
c++, object-oriented
Take advantage of the fact that these are all numbered from 1 to 5.
for (int i = ACCUMULATOR; i <= OPERAND; i++)
registers[i] = 0;
Comparing size_t and int32_t
int32_t has a fixed width of 32.
size_t is either 32 / 64 bits, depending on the platform.
Comparing both of them freely can sometimes be dangerous.
s.memory[opr] = s.temp_str.size();
in32_t = size_t
If size_t (although highly unlikely, possible ) exceeds the max size of int32_t, overflow! What I like to do is to keep a custom macro like _DEBUG_, and then use #ifdef to check for this.
#ifdef _DEBUG_
if ( s.temp_str.size() > INT32_MAX ) // handle it here
#endif // _DEBUG_ | {
"domain": "codereview.stackexchange",
"id": 39874,
"lm_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++, object-oriented",
"url": null
} |
organic-chemistry, nmr-spectroscopy, halides, isotope, spin
Title: Carbon-13 NMR for chloroform I am slightly confused by what the spectrum would show for carbon-13 NMR of $\ce{CHCl3}$.
My initial guess would be that the peak would be split by coupling to both the proton and the 3 chlorines, as both nuclei have a net spin.
If the peak were split by the chlorine only, then as there are three chlorine atoms we would get a quartet peak. However this cannot be correct because the spectrum for CDCl3 shown here has only three peaks:
I also don't understand here why the areas of the three peaks are the same. Should they not be in some other ratio (for the four peaks I expected it would be $1:3:3:1$ are ratio)?
Then I would expect that the presence of the proton would split every one of the four peaks from $\ce{C-Cl}$ coupling further into a doublet, giving a quartet of doublets.
I didn't find any spectra showing this, only showing very tiny peaks for $\ce{CHCl3}$ compared with $\ce{CDCl3}$ which I don't understand: | {
"domain": "chemistry.stackexchange",
"id": 7017,
"lm_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, nmr-spectroscopy, halides, isotope, spin",
"url": null
} |
entropy
$\ce{LiF}$ - 35.7 J/(mol•K) vs. 577 kJ/mol $\Delta H_f$
$\ce{NaCl}$ - 72.1 J/(mol•K) vs. 410 kJ/mol $\Delta H_f$ | {
"domain": "chemistry.stackexchange",
"id": 17058,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "entropy",
"url": null
} |
water, home-experiment, physical-chemistry
A common misconception regarding this experiment is that the consumption of the oxygen inside of the bottle is also a factor in the water rising. Truth is, there is a possibility that there would be a small rise in the water from the flame burning up oxygen, but it is extremely minor compared to the expansion and contraction of the gases within the bottle. Simply put, the water would rise at a steady rate if the oxygen being consumed were the main contributing factor (rather than experiencing the rapid rise when the flame is extinguished).(1) | {
"domain": "physics.stackexchange",
"id": 2148,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "water, home-experiment, physical-chemistry",
"url": null
} |
php, security, image, .htaccess
there is not more than one exclamation mark
The number that follows the exclamation mark is positive and has a number of digits within a certain range (e.g. 1-5)
The extension is within the acceptable list of extensions
Doing this should allow removal of the multiple calls to split the string using explode(). For example:
preg_match('#^([^!\./]+)!(\d+)\.(png|jpg|gif)#i', $req, $matches);
if (!$matches) {
die();
}
[$uri, $name, $size, $ext] = $matches;
^ asserts position at start of the string
1st Capturing Group ([^!\./]+)
Match a single character not present in the list below [^!\./]
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)
Could be changed to ([a-z0-9]+) to only allow alphanumeric characters or (\w+) to allow [A-Za-z0-9_]
! matches the character ! with index 3310 (2116 or 418) literally (case insensitive)
2nd Capturing Group (\d+) | {
"domain": "codereview.stackexchange",
"id": 42570,
"lm_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, security, image, .htaccess",
"url": null
} |
collada
Originally posted by Kalana on Gazebo Answers with karma: 36 on 2014-07-09
Post score: 0
Got it working! Actually missing of <library_controllers> was the major cause. Checked settings for getting it working are as follows. Could be helpful somebody else.
Export Data options: Selection Only, Include Children, Include Armatures
Texture options: Include UV Textures, Include Material Textures, Copy
Collada options: Triangulate, Use Object Instances, Transformation type: Matrix
Originally posted by Kalana with karma: 36 on 2014-07-09
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 3613,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "collada",
"url": null
} |
optics, angular-resolution, hubble-telescope
The UVIS (UV-visual) part of WFC3 has two 2k x 4k CCDs (with, I think, 15 x 15 micron pixels) and a focal ratio of F/31, which works out to 0.0395 arc seconds per pixel.
So in practice, WFC3 will always resolve things better than the WF chips of WFPC2 can, because its pixels can properly sample the telescope resolution and the WF pixels cannot.
You can see the difference in the upper "progenitor" (WFPC2) images, compared with the lower "2015" (WFC3/UVIS) images from the actual paper: | {
"domain": "astronomy.stackexchange",
"id": 2313,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, angular-resolution, hubble-telescope",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.