text stringlengths 1 1.11k | source dict |
|---|---|
java, javascript, design-patterns, http, ajax
I settled on a pattern which was sufficient for this goal, but is unlikely to scale well for larger projects. This pattern is illustrated at the bottom of the post, together with my main questions, but I have some more specific minor questions along the way.
The complete code is on github, but hopefully there's enough detail in this post for you to answer my questions without looking at all of it.
Some decisions I took straight away: | {
"domain": "codereview.stackexchange",
"id": 37935,
"lm_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, javascript, design-patterns, http, ajax",
"url": null
} |
c++, c++11, template-meta-programming
template<typename... Ts>
using Indices = MPL::Sizes::List<MPL::Types::IndexOf<TypeList1, Ts>()...>;
using IndicesInTuple = MPL::Types::Rename<Indices, TypeList2>;
// IndicesInTuple contains (0, 2)
template<size_t... Indices>
struct TupleExtractor {
template<typename... Ts>
static auto extract(std::tuple<Ts...> t) {
return std::make_tuple(std::get<Indices>(t)...);
}
};
int main() {
TupleOfList t;
B bValue = std::get<MPL::Types::IndexOf<TypeList1, B>()>(t);
using MyExtractor = MPL::Sizes::Rename<TupleExtractor, IndicesInTuple>;
std::tuple<A, C> newTuple = MyExtractor::extract(t);
}
#pragma once
namespace MPL
{
...
You don't #include <type_traits>, but you do use std::is_same. Add the #include:
#pragma once
#include <type_traits>
namespace MPL
{
...
struct type_list_end{};
template<typename T, typename... Ts>
struct type_list
{
using current = T;
using next = type_list<Ts...>;
}; | {
"domain": "codereview.stackexchange",
"id": 26918,
"lm_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++, c++11, template-meta-programming",
"url": null
} |
particle-physics, electrons, atomic-physics, antimatter, positronium
In quantum electrodynamics, we learn that the electron and positron are really excitations of the same field: a four-component spinor with two charge states and two spin states. In a very real sense, positronium is the simplest “matter-ful” state of electromagnetism, and is mathematically simpler than the more familiar state where there are lots of electrons and not very many positrons. This perspective has important physical consequences. The force-carrying photon can be said to “spend part of its time” as a virtual electron-positron “loop.” The loop corrections to electromagnetism are related to observables like the change in the effective electron charge at short distances (more frequently called the “running of the fine-structure constant” due to “vacuum polarization”), as well as corrections to the magnetic moment of an electron at rest. | {
"domain": "physics.stackexchange",
"id": 85362,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "particle-physics, electrons, atomic-physics, antimatter, positronium",
"url": null
} |
inorganic-chemistry, bond, ionic-compounds, covalent-compounds
Insterstitial carbides only form with large cations (Ti and W), as you might
expect if the anion (very small) to fit in the spaces in the cation crystal
structure. | {
"domain": "chemistry.stackexchange",
"id": 5284,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inorganic-chemistry, bond, ionic-compounds, covalent-compounds",
"url": null
} |
python, scikit-learn, predictive-modeling, decision-trees, classifier
When I input the single symptom like bradycardia, it shows 10 best predictions.
Also when I input a list of 5 symptoms, then it will show 50 best predictions.
Since, a list of symptoms can have common disease/drugs, I want to create a system, that when inputted the list of any number of symptoms, will show the 10 best predictions only. I understand that you have keywords of a sickness and the drug that was given to that patient. Given the quality of the question, I will sincerely recommend you to start not doing any ML and just doing some basic statistics.
If you want to see the top 10 best drugs for bradicardia, probably the best is to do a frequency count of how.
In this way you should be able to find the top most frequent drugs for treating bradicardia | {
"domain": "datascience.stackexchange",
"id": 10257,
"lm_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, scikit-learn, predictive-modeling, decision-trees, classifier",
"url": null
} |
electrostatics, electric-fields, gauss-law, coulombs-law
This is the case of uniformly charged infinite parallel lines and uniformly charged parallel planes. In the former case, two coordinates are enough to specify the position of one of these lines; in the latter, one is enough to specify the position of a plane. Therefore, the dimensionality of the space configuration space is $2$ and $1$, respectively. All the relations and physics dimensions remain the same as in $3D$ dimensional case. In particular, it remains meaningful to speak about point-like charges interacting through the usual Coulomb potential. The interaction laws between infinite parallel charged lines and planes could be derived from the usual Coulomb law, in the limit of continuous line and surface charge densities. Of course, the Gauss theorem still requires a 3D volume and a 3D surface.
Therefore your formula
$$
E(r)=\frac{1}{2\pi \epsilon_0}\frac{Q}{r}
$$
is not correct if $Q$ represents a 3D point-like charge. It should be written as
$$ | {
"domain": "physics.stackexchange",
"id": 77935,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics, electric-fields, gauss-law, coulombs-law",
"url": null
} |
java, game, swing, awt
obstacles.get(j).changeXDirection(tempXDirection);
obstacles.get(j).changeYDirection(tempYDirection);
}
}
public void checkBulletCollision() {
for (Bullet bullet : bullets)
for (Obstacle obstacle : obstacles) {
if (GamePanel.state == GamePanel.stateOfGame.GAME && bullet.isBulletActive() && obstacle.getXObstaclePosition() < bullet.getBulletXPosition() &&
bullet.getBulletXPosition() < obstacle.getXObstaclePosition() + OBSTACLE_RANGE &&
obstacle.getYObstaclePosition() < bullet.getBulletYPosition() &&
bullet.getBulletYPosition() < obstacle.getYObstaclePosition() + OBSTACLE_RANGE) {
bullet.changeBulletActive();
obstacle.changeObstacleActive();
gPanel.addPoints();
}
}
} | {
"domain": "codereview.stackexchange",
"id": 21962,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, game, swing, awt",
"url": null
} |
geophysics, atmospheric-science
The Atmospheric Boundary Layer occupies about the lower 1km of the atmosphere (it can vary depending on latitude) where the atmosphere has the most contact with and is influenced most by the surface, through mainly thermal and mechanical means, explained by the reference above:
The mechanical contact arises from the friction exerted by the wind against the ground
surface; this friction causes the wind to be sheared and creates turbulence. In
the absence of thermal processes, i.e. when the ABL is said to be neutral,
we expect a logarithmic velocity profile.
A diagram of the diurnal and dynamic nature of the atmospheric boundary layer is shown below:
Source (and further information): "Atmospheric Boundary Layer Structure" (Piironen, 1996).
Further information about the above can be found in "Characteristics of air parcels and masses"
So, the breeze you feel may only extend metres to kilometres, depending on the factors discussed above. | {
"domain": "physics.stackexchange",
"id": 9482,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "geophysics, atmospheric-science",
"url": null
} |
general-relativity, gravity, black-holes, gravitational-waves
Title: Do only black holes emit gravitational waves? A friend and I are hobby physicist. We don't really understand that much but at least we try to :) We tried to understand what the recently discovered gravitational waves at LIGO are, how they are created and how they have been measured. If I remember correctly, the information we found was that only large/massive objects, for example colliding black holes or neutron stars, emit these. What about smaller objects, e.g. a basketball hitting the ground or an asteroid hitting the earth? Do they also emit gravitation waves? And if not, at which threshold of mass is this happening? | {
"domain": "physics.stackexchange",
"id": 35338,
"lm_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, gravity, black-holes, gravitational-waves",
"url": null
} |
quantum-mechanics, wavefunction, symmetry, hilbert-space
Title: Existence of representation of symmetry transformation There is a simple fact that we can change our point of view and that physical laws should remain the same, id est, outcomes of our experiments should be the same no matter from which frame of reference we are observing. So, there is a physical state that changes under the change of our point of view and there is a new wave function which describes it. Should there be a representation of this transformation which takes the old wave function into new one? Is there any proof of such a claim? Should there always be transformation of wave function for every transformation of the physical system? Space-time coordinates are transformed of course, but what about the state itself? Is there any proof of this? By Wigner's theorem every symmetry is represented as a unitary or anti-unitary operator upon the Hilbert space of states. | {
"domain": "physics.stackexchange",
"id": 28849,
"lm_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, symmetry, hilbert-space",
"url": null
} |
ros, packages, dependencies
libxdamage-dev{a} libxerces-c3.1{a} libxfixes-dev{a} libxft-dev{a}
libxi-dev{a} libxml2-dev{ab} libxpm-dev{a} libxrandr-dev{a}
libxrender-dev{a} libxss-dev{a} libzzip-0-13{a} libzzip-dev{a}
openni-utils{a} python-epydoc{a} python-jinja2{a} python-kitchen{a}
python-netifaces{a} python-opengl{a} python-psutil{a} python-pydot{a}
python-pyside{a} python-pyside.phonon{a} python-pyside.qtcore{a}
python-pyside.qtdeclarative{a} python-pyside.qtgui{a}
python-pyside.qthelp{a} python-pyside.qtnetwork{a}
python-pyside.qtopengl{a} python-pyside.qtscript{a} python-pyside.qtsql{a}
python-pyside.qtsvg{a} python-pyside.qttest{a} python-pyside.qtuitools{a}
python-pyside.qtwebkit{a} python-pyside.qtxml{a} python-qt4-dev{a}
python-qt4-gl{a} python-qwt5-qt4{a} python-sip-dev{a} python-sphinx{a}
python3.2{a} python3.2-minimal{a} robot-player{a} ros-hydro-actionlib{a}
ros-hydro-actionlib-msgs{a} ros-hydro-actionlib-tutorials{a} | {
"domain": "robotics.stackexchange",
"id": 16327,
"lm_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, packages, dependencies",
"url": null
} |
vba, excel
ElseIf NameIsInRange("Italy", cCell, dCell, eCell) Then
resultRange = "Italy"
End If
i = i + 1
Wend
End Sub
Public Function NameIsInRange(ByVal searchName As String, ByRef range1 As Range, range2 As Range, range3 As Range) As Boolean
Dim result As Boolean
result = InStr(1, range1, searchName) Or InStr(1, range2, searchName) Or InStr(1, range3, searchName)
NameIsInRange = result
End Function
2nd Refactoring
The only things that actually change in the loop are the name to check and the name to output. So, why don't we make those a list? For an iterable list with more than 1 element per line, I'd use an Array.
Let's make a new sheet and give it the codename wsCountryNames. Then a function to get the table and pass it to an Array:
Public Function GetCountryNamesTable() As Variant
With wsCountryNames
Dim topLeftCell As Range
Set topLeftCell = .Cells(1, 1) '/ "A1" | {
"domain": "codereview.stackexchange",
"id": 19287,
"lm_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
} |
reinforcement-learning, algorithm, sutton-barto, reinforce
It seems that the return for the steps after step 1 are just a truncation of the return of the first step. Also, if you look just one page above in the book you find an equation with just 1 discount rate (the one inside the return.)
Why then does the pseudo-code seem to be different? My guess is that I am misunderstanding something:
$$
{\mathbf{\theta}}_{t+1} ~\dot{=}~\mathbf{\theta}_t + \alpha G_t \frac{{\nabla}_{\mathbf{\theta}} \pi \left(A_t \middle| S_t, \mathbf{\theta}_{t} \right)}{\pi \left(A_t \middle| S_t, \mathbf{\theta}_{t} \right)}.
\tag{13.6}
$$ The discount factor does appear twice, and this is correct.
This is because the function you are trying to maximise in REINFORCE for an episodic problem (by taking the gradient) is the expected return from a given (distribution of) start state:
$$J(\theta) = \mathbb{E}_{\pi(\theta)}[G_t|S_t = s_0, t=0]$$ | {
"domain": "ai.stackexchange",
"id": 3400,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reinforcement-learning, algorithm, sutton-barto, reinforce",
"url": null
} |
classical-mechanics, lagrangian-formalism
and so the new Lagrangian now depends on $\ddot{q}$. The only way to avoid the new Lagrangian depending on $\ddot{q}$ is to demand that
$$\frac{\partial F}{\partial \dot q} = 0$$
which brings us back to the case where $F$ depends only on $q$ and $t$. | {
"domain": "physics.stackexchange",
"id": 21040,
"lm_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, lagrangian-formalism",
"url": null
} |
• Welcome to Mathematics Stack Exchange. Here is a MathJax tutorial. $x\not\in B$ and $B\subseteq C$ does not imply $x\not\in C$ – J. W. Tanner Sep 4 '19 at 22:49
• A simple countra example is disjoint A and B. – William Elliot Sep 4 '19 at 23:07
• Try $C$ the set of all integers, $A$ the set of even integers, and $B$ the set of odd integers. Always try to play with concrete examples. Sometimes pictures (like Venn diagrams, in this situation) are instructive. – Ted Shifrin Sep 4 '19 at 23:18 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9626731105140616,
"lm_q1q2_score": 0.8143660430480996,
"lm_q2_score": 0.8459424431344437,
"openwebmath_perplexity": 190.7891979100235,
"openwebmath_score": 0.8413212299346924,
"tags": null,
"url": "https://math.stackexchange.com/questions/3344671/why-is-this-proof-invalid/3344685"
} |
ai-design, emotional-intelligence, knowledge-representation
Title: How could human behavior and relationships be implemented? One of the most compelling issues regarding AI would be in behavior and relationships.
What are some of the methods to address this? For example, friendship, or laughing at joke? The concept of humor? Theory of mind
Relationships and normal social behavior require a human to possess a reasonable "theory of mind", a skill in understanding and modeling the thought processes that happen in the minds of others, and making reasonably accurate predictions on how particular actions will be understood by others. | {
"domain": "ai.stackexchange",
"id": 234,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ai-design, emotional-intelligence, knowledge-representation",
"url": null
} |
oceanography, measurements, ocean-currents, atlantic
I imagine that having a cable across the channel enables an accurate comparison of voltage on either side.
I suspect that this is a large-scale example of the Hall Effect, but that part of my physics is too rusty to say for sure!
1 D. Prandle, "Anomalous results for tidal flow through the Pentland Firth", Nature vol 278, pp 541-542 http://www.homepages.ed.ac.uk/shs/Tidal%20Stream/Prandle%20phase%20anomaly.pdf | {
"domain": "earthscience.stackexchange",
"id": 1217,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "oceanography, measurements, ocean-currents, atlantic",
"url": null
} |
complexity-theory, reductions, np-hard
\begin{align}
x \in L_A \iff f(x) \in L_B.
\end{align}
The function $f$ maps words from one language to words from another language. When speaking of problems, we mean the associated decision problems. Decision problem $A$: Given an word $x \in \Sigma^{\star}$, is it true that $x \in L_A$ (analogous for $B$). Such a word $x \in \Sigma^{\star}$ is also called an instance of the decision problem $A$.
One easy reduction would be the reduction $\mathrm{CLIQUE}$ to $\mathrm{IS}$ (independent set). The languages are defined as follows:
\begin{align}
CLIQUE = \{ (G, k) \mid \text{the graph $G$ contains a complete subgraph with $k$ vertices} \} \\
IS = \{ (G, k) \mid \text{the graph $G$ contains $k$ vertices, that have no edges between each other} \}
\end{align}
The complete subgraph in the first definition is called a k-clique and the set of vertices in the second definition is called an independent set. | {
"domain": "cs.stackexchange",
"id": 3799,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, reductions, np-hard",
"url": null
} |
java, servlets
// methods like: return is the method specific messages. Might as well pass the errors list in, or whatever
List<Message> processWhatever(String[] versions, String[] projects)
Then, for the methods themselves. Basically you always do some outer loop checking projects != null, then an inner loop checking versions != null. If you can live with a different message order (errors first), I suggest you create a preprocessing method first, which will sanitize the input and emit the according warnings. Something along the lines of (attn: untested editor-only code)
// switching to collections while we are at it
List<String> sanitizedProjects = new ArrayList<>();
List<String> sanitizedVersions = new ArrayList<>();
messages.addAll(sanitizeInput(projects, versions, sanitizedProjects, sanitizedVersions));
... | {
"domain": "codereview.stackexchange",
"id": 30347,
"lm_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, servlets",
"url": null
} |
javascript, ecmascript-6, promise, google-maps, data-visualization
const requestSnapToRoads = () => {
let requests = [];
for (let i = 0; i < points.length; i += 100) {
let params = new URLSearchParams();
params.append('interpolate', 'true');
params.append('key', apiKey)
params.append('path', points
.slice(i, i + 100)
.map(point => `${point.lat},${point.lng}`)
.join('|'));
requests.push(fetch(`https://roads.googleapis.com/v1/snapToRoads?${params}`));
}
return Promise.all(requests).then(responses => Promise.all(responses.map(getJSON)));
}; | {
"domain": "codereview.stackexchange",
"id": 22666,
"lm_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, ecmascript-6, promise, google-maps, data-visualization",
"url": null
} |
beginner, bash, linux, shell, installer
/usr/bin/apt install -y vlc vlc-data browser-plugin-vlc mplayer youtube-dl libdvdcss2 libdvdnav4 libdvdread4 smplayer mencoder build-essential
sleep 3
updateSystem || { echo "update system failed"; exit 127; }
sleep 3
fi
} | {
"domain": "codereview.stackexchange",
"id": 32301,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, bash, linux, shell, installer",
"url": null
} |
gravity, acceleration, radiation, relativity, inertia
Certainly there must be, at least in the linearized gravity, since the mathematics is the same. I guess the situation is solved in general relativity somehow? Finally, is the phenomenon connected to the origins of inertia? There is absolutely a gravitational radiation reaction and solving for it is one of the very active fields in classical relativity theory at present. Basically, particles with nontrivial masses distort the spacetime around them; this causes them to not move on geodesics of the "background" spacetime (the spacetime that one would have found had the secondary particle not been there) but instead on some accelerated path. Solving for that path "self-consistently" at all orders is the holy grail of this field. This turns out to be very difficult.
Presently, the so-called "self-force" is understood to first order in the Schwarzschild spacetime. It will perhaps soon be understood to second order there and to first order in Kerr. The calculations are very challenging. | {
"domain": "physics.stackexchange",
"id": 26577,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gravity, acceleration, radiation, relativity, inertia",
"url": null
} |
Now there's something you should note. First and foremost the statements $\color{grey}(A\lor B\color{grey})\implies C$ and $A\implies \color{grey}(B\lor C\color{grey})$ are statements of the kind $P\implies Q$. Only at a later stage does the disjunction come into play. Notice the ghost parentheses.
Now note that they are very, very distinct. One of them will eventually have a goal which is a disjunction while the other has the disjuction as an hypothesis. Above I handled the case where the goal is a disjunction.
When you're hypothesis is a disjuction $P\lor Q$ and you want to prove $R$. You can try proof by cases: sinse you're hypothesis is true then either $P$ is true or $Q$ is true:
1. Suppose $P$ is true, $(\cdots)$, conclude $R$.
2. Suppose $Q$ is true, $(\cdots)$, conclude $R$.
Finally conclude that $\color{grey}(P\lor Q\color{grey})\implies R$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822876997410348,
"lm_q1q2_score": 0.8269149727746807,
"lm_q2_score": 0.8418256412990657,
"openwebmath_perplexity": 294.4978574698505,
"openwebmath_score": 0.9972812533378601,
"tags": null,
"url": "https://math.stackexchange.com/questions/396253/how-to-prove-or-statements/396261"
} |
organic-chemistry, molecular-structure, terminology, structural-formula
which should be methylcyclopentane instead, a completely different thing. | {
"domain": "chemistry.stackexchange",
"id": 12819,
"lm_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, molecular-structure, terminology, structural-formula",
"url": null
} |
ros-electric, boost, rosmake, face-detection, libboost
cvNamedWindow( "video", 1 );
src->origin = 0;
detectFaces( src );
cvWaitKey(1);
}
}
int detectFaces( IplImage* img )
{
int i;
CvSeq *faces = cvHaarDetectObjects(img,cascade,storage,1.1,3,0 /*CV_HAAR_DO_CANNY_PRUNNING*/,
cvSize( 40, 40 ) );
for( i = 0 ; i < ( faces ? faces->total : 0 ) ; i++ )
{
CvRect *r = ( CvRect* )cvGetSeqElem( faces, i );
cvRectangle( img,cvPoint( r->x, r->y ),cvPoint( r->x + r->width, r->y + r->height ), CV_RGB( 255, 0, 0 ), 1, 8, 0 );
}
cvShowImage( "video", img );
return 1;
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "video");
ros::NodeHandle nh;
cvStartWindowThread();
image_transport::ImageTransport it(nh);
image_transport::Subscriber sub = it.subscribe("camera/image_raw", 1, imageCallback);
ros::spin();
}
Originally posted by nandhini with karma: 46 on 2012-03-14
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 8551,
"lm_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-electric, boost, rosmake, face-detection, libboost",
"url": null
} |
Any help / input would be greatly appreciated.
-
One thing pointed out in math chat here by Dominic Michaelis and might help with the problem is that the smaller and larger numbers tend to be at the "end" of the summation, this is because they tend to change less with higher powers; numbers close to zero are still close to zero at high powers and numbers close to one are still close to one. I think this could help in understanding why 2/3 can "afford" to be later in the sum than one might naively think. – Paul Plummer Jun 17 '13 at 8:06
Even though this won't answer your question here is some first input. Vincent Tjeng made and I made some numerics with Mathematica, this was his code (which I used too)
data = Table[someList = RandomReal[{0, 1}, 5];
Ordering@
Ordering@
(Last@SortBy[{N[Total[#^(Range[Length@someList] - 1)]], #} & /@
Permutations[someList], First])[[2]], {i, 1, 300000}]; | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9674102571131692,
"lm_q1q2_score": 0.8019239016010801,
"lm_q2_score": 0.8289388040954684,
"openwebmath_perplexity": 518.8725155772999,
"openwebmath_score": 0.622157096862793,
"tags": null,
"url": "http://math.stackexchange.com/questions/421284/minimizing-appreciating-quantities-vs-maximizing-depreciating-quantities/422599"
} |
Consumer Price Indices: An Ilo Manual
Statistical Treatment of Experimental Data
Maine Education in Perspective 2005-2006 | {
"domain": "bicired.org",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9566342037088041,
"lm_q1q2_score": 0.8259499352081903,
"lm_q2_score": 0.863391599428538,
"openwebmath_perplexity": 4496.482010481515,
"openwebmath_score": 0.32110440731048584,
"tags": null,
"url": "http://hazladetos.bicired.org/?lib/statistics-for-business-data-analysis-and-modeling-duxbury-series-in-business-statistics"
} |
classification, class-imbalance
Title: Why does the test set class imbalance influences my model's performance? Considering a balanced training set, I noticed that the results of a classification primarily depend on the class imbalance of the test set.
As shown in this article, unless the classes are perfectly separable, the performance (precision & recall) of a model for a given class will always decrease based on the imbalance of the class. Ie: the more the test set is imbalanced, the less the model is capable of classifying the minority class.
This means that for any given model, the classification performance will always primarily depend on the balance of the data you are testing it with. | {
"domain": "datascience.stackexchange",
"id": 9921,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classification, class-imbalance",
"url": null
} |
ros, roslaunch, ros-hydro, multiple-machines
Originally posted by lfvm0001 on ROS Answers with karma: 3 on 2020-10-06
Post score: 0
Original comments
Comment by mgruhler on 2020-10-06:
Is SSH not enough?
You cannot directly call a launch file on another machine, but you could use the machine tag to launch the nodes on the other computer: http://wiki.ros.org/roslaunch/XML/machine
Comment by lfvm0001 on 2020-10-07:
Thanks... if I use the machine tag , and I have some nodes that need some .yaml files, those files need to be in the computer where I’m launching the file right ? Even if the node is running in the other machine ?
Thanks to mgruhler for the response! As he commented, what I want (to directly call a launch file from another computer) was not possible. However as recommended I use the tag machine in my launch file to tell to all the nodes to run in computer A and then run the file from computer B. And it’s working as intended.
Thanks | {
"domain": "robotics.stackexchange",
"id": 35601,
"lm_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, roslaunch, ros-hydro, multiple-machines",
"url": null
} |
classical-mechanics, fluid-dynamics, earth
In fact, the geyser would eventually stop, because all the energy is coming from liberating a finite gravitational potential energy source. Then there would be some near-term equilibrium state where the tube's fluid is significantly heated, but the driving force has basically puttered out. As this process happens, the flow rate goes down, and so does the thermal energy of the geyser. Eventually it might just be regular steam that it belches out, and then water, although very hot water. Toward the very end of this process, it'll just be lukewarm water pushed out by a more mild driving force. However, depending on the elevation difference, this could continue to pump a large volume, larger than the volume of the pipe I think. | {
"domain": "physics.stackexchange",
"id": 14939,
"lm_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, fluid-dynamics, earth",
"url": null
} |
time-series, data, experiments, csv, metadata
Title: Recommendations for storing time series data As part of my thesis I've done some experiments that have resulted in a reasonable amount of time-series data (motion-capture + eye movements). I have a way of storing and organizing all of this data, but it's made me wonder whether there are best practices out there for this sort of task.
I'll describe what I've got, and maybe that will help provide some recommendations. So, I have an experiment that requires subjects to use their vision and move their body to complete a task. Each task is one trial, and each subject performs multiple trials to complete the experiment. During a trial I record the movement and the eye tracker (~200 channels) at regularly sampled time points (~100Hz). I store these in a CSV file (one file per trial), with one row per time point, and one column per variable (e.g., left-fingertip-x, left-fingertip-y, left-fingertip-z, etc. for the mocap, and left-eye-x, left-eye-y for the eyes). | {
"domain": "datascience.stackexchange",
"id": 1641,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "time-series, data, experiments, csv, metadata",
"url": null
} |
7. ## Re: chain rule problem, with 2 constants!
I solved the problem but my result is differing from the text book..
I got
${-2a\cos\pi w \sin\pi w + 2b \sin\pi w \cos\pi w}$
The text book has
${-2\pi a\cos\pi w \sin\pi w + 2\pi b \sin\pi w \cos\pi w}$
an extra $\pi$ between 2a and 2b.
8. ## Re: chain rule problem, with 2 constants!
You have only partially applied the chain rule. You must also apply it to the arguments of the trig. functions. This is where the $\pi$ comes from that you are missing.
9. ## Re: chain rule problem, with 2 constants!
this is what I did
$\frac{d}{dw}(\cos \pi w)$
then
$-\sin \pi w$
I should have to applied product rule here? or maybe rewrite $\frac{d}{dw}(\cos \pi w)$ to $\frac{d}{dw}(\cos \pi) \frac{d}{dw}(\cos w)$
is that is my mistake?
10. ## Re: chain rule problem, with 2 constants!
You need in the case from your previous post:
$\frac{d}{dw}(\cos(\pi w))=-\sin(\pi w)\cdot\frac{d}{dw}(\pi w)=-\pi\sin(\pi w)$ | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9770226267447514,
"lm_q1q2_score": 0.8055179527454542,
"lm_q2_score": 0.8244619220634457,
"openwebmath_perplexity": 1323.060523955406,
"openwebmath_score": 0.9360473155975342,
"tags": null,
"url": "http://mathhelpforum.com/calculus/209583-chain-rule-problem-2-constants.html"
} |
special-relativity, coordinate-systems, acceleration, speed-of-light
In an inertial frame (using the $(+,-,-,-)$ convention):
$$
ds^2 = dt^2-dx^2
$$
Being time like means $ds^2>0$, so you do recover:
$$
\left|\frac{dx}{dt}\right|<1
$$
However, this only applies for inertial frames where the metric always has the same expression. In a general coordinate system, the expression of the expression of the metric is more complicated. Geometrically, the light cone is typically distorted and physically, you can interpret it as the speed of light acquiring a space-time dependence as well as a directional dependence in general.
This is what happens for Rindler coordinates. The metric in the new coordinate system is:
$$
ds^2 = dt^2-dx^2 = X^2dT^2-dX^2
$$
At the event $T,X$, the speed of light is:
$$
c=|X|
$$ | {
"domain": "physics.stackexchange",
"id": 100195,
"lm_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, coordinate-systems, acceleration, speed-of-light",
"url": null
} |
classical-mechanics, scattering
$E = \frac{m}{2}(v_1^2 + v_2^2) = m (v_m^2 + \alpha^2\omega^2)$
$p = 2mv_m$
The conservation laws yield:
$v_m = \frac{1}{3}(v_0 + \sqrt{v_0^2 - 3\alpha^2\omega^2})$
$v_b = v_0 - 2v_m$
Since we know that $v_m \geq \frac{1}{2}v_0$ we get
$0 \leq \alpha \leq \frac{v_0}{2\omega}$
I.e., the range in which the amplitude $\alpha$ can vary depends on the spring constant $k$ (which is associated with the frequency by $\omega \propto \sqrt{k/m}$): if the spring constant tends to $\infty$ the amplitude must tend to 0 and the molecule must behave approximately like a rigid rod of mass $2m$, as would have been expected.
In any case, the amplitude $\alpha$ is not determined by the conservation laws, only its range of possible values. (This is analoguous to the case of two colliding point-like particles, see answers to Where do particles go after collision?) | {
"domain": "physics.stackexchange",
"id": 958,
"lm_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, scattering",
"url": null
} |
quantum-field-theory, general-relativity, black-holes, scattering, s-matrix-theory
Without the saddle-point approximation it appears that we have $\hbar = 1$ in the integrand but when we take the approximation by considering $\Phi \to \Phi_{cl}$ then the action is classical (right?) so we have that $\hbar \to 0$. This appears to be quite contradictory. How are they maintaining that $\hbar = 1$? | {
"domain": "physics.stackexchange",
"id": 69764,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, general-relativity, black-holes, scattering, s-matrix-theory",
"url": null
} |
forces, hydrogen, fusion
Title: Does the proportion of strong nuclear force in a star change during nuclear fusion? I read that the SNF accounts for 99.9% of the mass of an atom.
So if 4 hydrogen atoms become 1 helium atom during nuclear fusion does that change the proportion of SNF as we have 4 SNFs becoming 1 SNF and 12 particles becoming 6 particles. Is it now 99.8% or something?
Thanks. (I'm just a curious layman, this question may make no sense :)) If the amount of mass due to strong interactions changed when four hydrogen atoms went through the chain of reactions necessary to form a helium atom, then the mass of four hydrogen atoms would be different from the mass of a helium atom. So let's see if this is the case.
Wikipedia tells us that the mass of a helium atom is 4.002602 atomic mass units. The mass of a hydrogen atom is 1.00782504 amu, so four hydrogen atoms is 4.03130016 amu, and we find that the masses are indeed different. | {
"domain": "physics.stackexchange",
"id": 65588,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "forces, hydrogen, fusion",
"url": null
} |
algorithms, optimization
$$b_{ir}=1 \implies\\ (a_{i-1,\text{wood}} \ge 1 \land a_{i,\text{wood}} = a_{i-1,\text{wood}} - 1 \land a_{i,\text{steel}} = a_{i-1,\text{steel}}+1).$$
Then, convert that to an ILP constraint using the techniques at the link above.
Finally, you can apply an off-the-shelf ILP solver to search for a solution.
Note that the order in which you applies resources matters, because you can never go negative on any material, which complicates the ILP instance a little bit and requires you to have a separate copy of each variable per step. | {
"domain": "cs.stackexchange",
"id": 17024,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, optimization",
"url": null
} |
python, array, pygame, snake-game
def head(self):
"""Return the position of the snake's head."""
return self.segments[0]
def update(self, dt, direction):
"""Update the snake by dt seconds and possibly set direction."""
self.timer -= dt
if self.timer > 0:
# Nothing to do yet.
return
# Moving in the opposite direction of current movement is not allowed.
if self.direction != -direction:
self.direction = direction
self.timer += 1 / self.speed
# Add a new head.
self.segments.appendleft(self.head() + self.direction)
if self.growth_pending > 0:
self.growth_pending -= 1
else:
# Remove tail.
self.segments.pop()
def grow(self):
"""Grow snake by one segment and speed up."""
self.growth_pending += 1
self.speed += SNAKE_SPEED_INCREMENT | {
"domain": "codereview.stackexchange",
"id": 3466,
"lm_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, pygame, snake-game",
"url": null
} |
infrared-radiation
Title: Explaining William Herschels Infrared Discovery First post, and probably a very simple answer that I'm missing, but here goes. Herschel found that red light warmed a thermometer more than blue light, and consequently that the region beyond the red light (infrared) was even warmer. If blue light has a shorter wavelength, and therefore more energy, why does it not have the higher temperature on the thermometer? | {
"domain": "physics.stackexchange",
"id": 21417,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "infrared-radiation",
"url": null
} |
navigation, odometry, turtlebot
Title: Turtlebot Odometry Calculations
Hi, thanks for looking at my question:
I'm writing a class to control a Turtlebot. Within this class, I want to measure how many metres the turtlebot has moved, and how many radians it has turned. To achieve this, I have subscribed to "turtlebot_node/sensor_state" whose callback parameter provides delta values for distance and angle.
There's a problem: this callback parameter provides inconsistent delta values for angle radians at low angular velocities. For example, at 0.1 metres per second around the z-axis (yaw), zero radians are returned. I believe this is because the callback only runs at 10Hz.
What I've done now is subscribe directly to the "odom" topic. My callback function is working, but I don't know how to get from the nav_msgs::Odometry struture to useful delta values.
Can someone please help me with the mathematics here? | {
"domain": "robotics.stackexchange",
"id": 15752,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, odometry, turtlebot",
"url": null
} |
javascript, html, ecmascript-6, event-handling, to-do-list
// Clear Tasks
if(event.target.className == 'clear-tasks btn black'){
clearTasks(event);
};
}
// Get Task Value & Pass to storeTask();
function getTask(e){
let task = this.querySelector('#task').value;
storeTask(task);
e.preventDefault();
};
// Store Task in Local Storage
function storeTask(taskValue){
let task = taskValue;
let tasks;
let displayMessage;
// Check if item exists in localstorage
if(localStorage.getItem('tasks') === null){
tasks = [];
} else {
tasks = JSON.parse(localStorage.getItem('tasks'));
};
// Used to display status message
displayMessage = document.querySelector('#form-message');
// Check if task already exists in the list
if(tasks.includes(task)){
// Update Status Message
displayMessage.innerText = 'Item Already Added';
displayMessage.className = 'message-warning';
} else {
// Update Status Message
displayMessage.innerText = 'Item Added';
displayMessage.className = 'message-success'; | {
"domain": "codereview.stackexchange",
"id": 37786,
"lm_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, ecmascript-6, event-handling, to-do-list",
"url": null
} |
quantum-mechanics, frequency, wavelength, dispersion
Title: Is frequency inversely proportional to wavelength Squared? In our QM intro class our professor was introducing us to concepts of energy, momentum, frequency, wavelength etc of photons an electrons, On one side of the board he had the various expressions for these things and the properties etc. Then on the other side of the board he wrote this equation $\omega=\frac{\hbar\pi}{m}.(\frac{1}{\lambda})^2$ which was confusing, because the left side is frequency so this means $\omega=\text{constant}(\frac{1}{\lambda})^2$ so why is frequency is inversely proportional to wavelength squared, Why it's confusing is because we know of the relation speed$=f\lambda$ so frequency and wavelength are inversely related but this equation says frequency is inversely related to the squared wavelength, 1. I would like to know where this equation comes from and 2. does it mean frequency of photons are sometimes inversely proportional to wavelength squared or just wavelength (is equation wrong with a | {
"domain": "physics.stackexchange",
"id": 87129,
"lm_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, frequency, wavelength, dispersion",
"url": null
} |
c#, converting, extension-methods, .net-datatable
Your variable names while not bad, could be better. For instance props -> properties. Stuff like this makes the code easier to read.
You have the properties, why not use a foreach loop to fill the datatable (you did it in ToDataSet)
the _ prefex should be used for class variables, not local variables.
try using var when declaring obvious variable types var row = t.NewRow()
There is no error checking when you are filling the values in the data table. What happens if it is not a class (int, double, long)? You could force the generic to be a class by adding where T : class.
Why don't you use the ToDataTable method to create the table in the ToDataSet method? This will eliminate duplicate code, and have 1 point of failure/modification as required. As an aside, I would use the code from ToDataSet to create your DataTable, as it is written better. | {
"domain": "codereview.stackexchange",
"id": 34711,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, converting, extension-methods, .net-datatable",
"url": null
} |
@Aryabhata: I agree that the author of the problem probably intended to imply $a_k$ real, but did not succeed in doing that. – Robert Israel Apr 26 '12 at 7:23
Let $b_n = \ln(a_n)$. Then your relation is $b_{n+1} = {b_n + \ln(c) \over 2}$. So $b_{n+1} - \ln(c) = {1 \over 2} (b_n - \ln(c))$. From this it is pretty immediate that $b_n$ converges to $\ln(c)$. And then $a_n = e^{b_n}$ converges to $c$ by continuity of $e^x$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9702399060540358,
"lm_q1q2_score": 0.8064081567296296,
"lm_q2_score": 0.8311430520409023,
"openwebmath_perplexity": 381.480186439905,
"openwebmath_score": 0.9614641070365906,
"tags": null,
"url": "http://math.stackexchange.com/questions/137033/let-a-n-be-a-sequence-such-that-a-n2-ca-n-1-where-c0-a-10"
} |
java, programming-challenge, time-limit-exceeded
@Override public int hashCode() {
return first.hashCode();
}
@Override public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof Pair)) {
return false;
}
Pair otherPair = (Pair) other;
return (first.equals(otherPair.first) && second.equals(otherPair.second))
|| (first.equals(otherPair.second) && second.equals(otherPair.first));
}
}
} Clearly, janos solution is the simplest, but it'd probably break for the input
a b
a b
Moreover, it circumvents the learning effect (I guess, it's about learning to write a class with equals and hashCode).
As often, Lombok makes it trivial:
@EqualsAndHashCode
public static class Pair {
private final String first, second;
}
hashCode
The inefficiency was most probably caused by
@Override public int hashCode() {
return first.hashCode();
} | {
"domain": "codereview.stackexchange",
"id": 13612,
"lm_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, time-limit-exceeded",
"url": null
} |
scala
Title: Getting last or return a default value in a Seq[Either[A, B]] val y: Seq[Either[String, Int]]
case class Response(value: String)
val notFound = Response("Not Found")
val found = Response("Found")
val response: Response = y.lastOption
.map(_.fold(_ => notFound, _ => found))
.getOrElse(notFound)
I am getting a list of Eithers. I want to get the last Either in the list. I then want to get Rightvalue. If the list is empty or the Either is Left, I want to return a default value. The code does this but can this be done more elegantly and clearer in Scala with perhaps cats? I don't use scalaz. Instead of map() - fold() - getOrElse(), you could just use two fold() calls.
val response = Response(y.lastOption
.fold("Not Found")(_.fold(_=>"Not Found", _=>"Found"))) | {
"domain": "codereview.stackexchange",
"id": 32313,
"lm_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",
"url": null
} |
python, performance, ai, chess
# Castling
global king1_moved, king2_moved, rook1_left, rook1_right, rook2_left, rook2_right
if not king_under_attack(board, player):
if player == 1 and not king1_moved:
# 2 castling options
if board[110] == "r-1" and board[111] == " 0 " and board[112] == " 0 " \
and board[113] == " 0 " and board[114] == "k-1" and not rook1_left:
piece_position.append([114, 110])
possible_moves.append([112, 113])
if board[117] == "r-1" and board[116] == " 0 " and board[115] == " 0 " \
and board[114] == "k-1" and not rook1_right:
piece_position.append([114, 117])
possible_moves.append([116, 115])
if player == -1 and not king2_moved:
# 2 castling options
if board[26] == "r-2" and board[27] == " 0 " and board[28] == " 0 " \
and board[29] == " 0 " and board[30] == "k-2" and not rook2_left: | {
"domain": "codereview.stackexchange",
"id": 33362,
"lm_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, ai, chess",
"url": null
} |
javascript, array, constructor
The review part
You got the first two lines...
function Calculator() {
this.calculate = function(sum) {
....and the last two...
}; // the ; not really needed after }
};
...correct. But all the rest is not helping solve the problem.
Step by step.
So lets step through the code
Set result would be undefined
this.summ = 0;
Split and vet numbers. Could have used isNaN() and use local variables rather than object properties var sumArr and var newSum
this.sumArr = sum.split(' ');
this.newSum = this.sumArr.filter(function(number) {
return number > 0;
});
Unneeded loop????
for (var i = 0; i < this.sumArr.length; i++) {
Check operator use === rather than ==
if (this.sumArr[i] == '+') {
Parse number and return result. parseInt need a radix 10
return this.summ = parseInt(this.newSum[0]) + parseInt(this.newSum[1]);
} else if (this.sumArr[i] == '-') {
Parse number and return result | {
"domain": "codereview.stackexchange",
"id": 28727,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, array, constructor",
"url": null
} |
genetics, mutations
When a base undergoes tautomeric shift the DNA does not contain a mutation yet, just an unmatched pair. The mutation will only becomes inscribed into the DNA permanently after the DNA is replicated or wrongly repaired.
In order to reverse the mutation you would need to provoke a chemical change to that specific base using the same or another mutagen and as most of them are unspecific the likelihood of obtaining both the correct mutation to reverse the effect AND at that specific location is extremely low. Just for the location itself (i.e. that base pair), in human you have ~0.000000033% chances (1/3 billions) to mutate that base. This is assuming equal probabilities across the genome and a single modification event which is of course not true but shouldn't modify much the conclusion. I am not even speaking about provoking the chemical modification that will reverse it which will even further reduce that probability. | {
"domain": "biology.stackexchange",
"id": 3682,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "genetics, mutations",
"url": null
} |
quantum-field-theory, hilbert-space, correlation-functions, s-matrix-theory
Title: Different forms of the LSZ reduction formula I'm studying Chapter 7 section 2 of Peskin and Schroeder on the LSZ reduction formula, on page 227 they write the LSZ reduction formula
$$\tag{7.42}\prod_1^n \int d^4x_i e^{ip_i\cdot x_i}\prod_1^m\int d^4y_j e^{-ik_j\cdot y_j}\langle \Omega|T\{\phi(x_1)...\phi(x_n)\phi(y_1)...\phi(y_m)\}|\Omega\rangle\thicksim_{p_i^0\rightarrow E_{p_i}, k_j^0\rightarrow E_{k_j}}\bigg(\prod_{i=1}^n\frac{\sqrt{Z}i}{p_i^2-m^2+i\epsilon}\bigg)\bigg(\prod_{j=1}^n\frac{\sqrt{Z}i}{k_j^2-m^2+i\epsilon}\bigg)\langle p_1...p_n|S|k_1...k_m\rangle.$$
Then Peskin and Schroeder explain that we "compute the appropriate Fourier transformed correlation function, look at the region of momentum space where the external particles are near the mass shell, and identify the coefficient of the multiparticle pole". | {
"domain": "physics.stackexchange",
"id": 90319,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, hilbert-space, correlation-functions, s-matrix-theory",
"url": null
} |
x ) = ( x^2-5x+6 ) ^ ( 1/2 ) annoying, that. To 5 y that are greater than or equal to 0 since you ca n't divide by.... So apologies if I 'm answering the wrong question and y-value of the composition radical elementary functions, as! X^2-5X+6 ) ^ ( 1/2 ) for only positive real numbers such that -- if this was a number... That may exist x^2-1000 ) more examples illustrated definition of domain and range of a function, domain... Say we have g domain of a function y for two input the functions taking into any... 0 then the function is actually only defined for two input into any given equation polynomials, therefore a! Infinity ), 5 is not included in the bag you only have positive 's. Domain step-by-step this website uses cookies to ensure you get the y-output the two. Make an equation true are those which would cause division by zero using our,... All inputs over which the function of domain of a function function on a coordinate plane.Remember that when no base is understood be. Far, | {
"domain": "romanrealty.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.986571747626947,
"lm_q1q2_score": 0.8263721850743451,
"lm_q2_score": 0.8376199572530448,
"openwebmath_perplexity": 407.7996338923654,
"openwebmath_score": 0.7109644412994385,
"tags": null,
"url": "https://www.romanrealty.com/carcassonne-video-jdry/aa437a-domain-of-a-function"
} |
homework-and-exercises, electrostatics, capacitance, dielectric
I've seen some problems that assume a dielectric with a variable electric permittivity of
$$\epsilon=\epsilon_0\left(1+{z\over a}
\right)$$
or something similar (but a function of z) between the plates.
With these variable permittivities, how can we, as usual, apply boundary conditions and also use the potential formula, that we use to solve dielectric problems?:
$$V=\int_{z=0}^{z=a} \vec{E}.d \vec l$$
$$\epsilon_{above}\vec{E}_{above}.\hat n-\epsilon_{below}\vec{E}_{below}.\hat n=\sigma_{free}$$
or equivalently, how can we find the electric field between the plates? Everywhere inside of the dielectric, the following (Gauss's Law inside of meadia) equation holds
$$
\nabla\cdot\mathbf D = \rho_\mathrm{free}, \qquad \mathbf D = \epsilon\mathbf E
$$
Inside of the dielectric, there is no free charge, so we have the equation
$$
\nabla\cdot(\epsilon\mathbf E) = 0, \qquad 0<z<a
$$
Now, we recall the definition of the electric potential;
$$
\mathbf E = -\nabla V
$$ | {
"domain": "physics.stackexchange",
"id": 8902,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, electrostatics, capacitance, dielectric",
"url": null
} |
lagrangian-formalism, entropy, variational-principle, density-operator, constrained-dynamics
So, this logic implies that equation $(7)$ should actually be written as
$$\frac{\partial}{\partial n_j}\left[\ln \Omega_n-\alpha\color{red}{\left(\sum_jn_j-N\right)}-\beta\color{red}{\left(\sum_j\epsilon_jn_j-U\right)}\right]=0 \,\, \forall \, j\tag{8}$$
Which by virtue of the equations in $(6)$, the terms in the parentheses marked in red are zero. Now you may see what I meant when I asked "why do we put factors of zero in the Lagrangian"
To be pedantic, my reasoning for writing what I did in that last paragraph above is because I am simply subtracting $N$ and respectively $U$ from both sides of the respective equations in $(6)$. Hence my reason for suggesting the terms marked red in $(8)$ are zero.
So, either equation $(7)$ is correct or equation $(8)$ is correct. They can't both be correct so which one is it? | {
"domain": "physics.stackexchange",
"id": 94001,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lagrangian-formalism, entropy, variational-principle, density-operator, constrained-dynamics",
"url": null
} |
java, strings, unit-testing, formatting, junit
// add a forgotten column
align.addColumn(3, "Hair Color", "Red", "Brown", "Blue", "Purple", "Orange");
align.output((String s) -> System.out.println(s));
}
Output:
Name Age Address Phone
Alice 32 United States 555-123456
Bob 12 nowhere 555-123456
Carol 78 1080 Maple Court Cape Girardeau, MO 63701 555-123456
Ed 159 Fake Stree, Fakesville - | {
"domain": "codereview.stackexchange",
"id": 9855,
"lm_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, strings, unit-testing, formatting, junit",
"url": null
} |
Here are the solutions with different $$h$$.
In [2]:
%plot -s 400,300
% set parameters, can use different value
a = 1;
y0 = 1;
tspan = 10;
% build function
f_true = @(t) y0*exp(-a*t); % true answer
f_forward = @(k,h) (1-h*a).^k * y0; % forward Euler solution
% plot true result
t_ar = linspace(0, tspan); % for plotting
y_true = f_true(t_ar);
plot(t_ar, y_true)
hold on
% plot Forward Euler solution
for h=[2.5, 1.5, 0.5] % try different step size
kmax = round(tspan/h);
k_ar = 0:kmax;
t_ar = k_ar*h;
% we are not doing Forward Euler iteration here
% since the expression is known, we can directly
% get the entire time series
y_forward = f_forward(k_ar, h);
plot(t_ar, y_forward, '-o')
end
% tweak details
ylim([-1,1]);
xlabel('t');ylabel('y');
legend('true solution', 'h=2.5', 'h=1.5', 'h=0.5' , 'Location', 'Best')
There all 3 typical regimes, determined by the magnitude of $$[1-ha]$$ inside the expression $$y_k= (1-ha)^ky_0$$.
1. Small $$h$$: $$0 \le [1-ha] < 1$$ | {
"domain": "readthedocs.io",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9879462219033657,
"lm_q1q2_score": 0.8780458834814509,
"lm_q2_score": 0.8887587846530937,
"openwebmath_perplexity": 1129.366850515747,
"openwebmath_score": 0.9788032174110413,
"tags": null,
"url": "https://am111.readthedocs.io/en/latest/session8_stabiilty.html"
} |
the unique x∈ Rn that minimizes kAx−yk. Homework set #7 solutions, Math 128A J. M = mean(A,vecdim) computes the mean based on the dimensions specified in the vector vecdim. Here we will look at some transformations which may be used to convert such data so that we may use the least squares method to find the best fitting curve. “Using MATLAB as a Calculator” MTH229 The College of Staten Island Department of Mathematics Using MATLAB as a Calculator 1 Introduction This project is designed to give you a brief introduction to the MATLAB software which will be. Entering vectors In Matlab, the basic objects are matrices, i. i hope this might help u in ur problem. 303? Let's use x = 10 and find out for ourselves. 1- Matlab'de matematikten bildiğimiz doğal logaritma gösterimi ln olarak değil doğrudan log olarak gösterilmektedir. Creating a plot that uses differing line types and data point symbols makes the plot much easier for other people to use. The College of Staten Island uses the Matlab | {
"domain": "new-design-center.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9334308147331958,
"lm_q1q2_score": 0.8041863110937596,
"lm_q2_score": 0.8615382076534742,
"openwebmath_perplexity": 1246.51345888803,
"openwebmath_score": 0.6243621706962585,
"tags": null,
"url": "http://uaor.new-design-center.it/matlab-ln.html"
} |
c++, multithreading, openmp, c++23
using boost::math::tools::differential_evolution;
using boost::math::constants::two_pi;
using boost::math::constants::e;
using std::cbrt;
using std::sqrt;
using std::cos;
using std::exp;
// Taken from: https://en.wikipedia.org/wiki/Test_functions_for_optimization
template<typename Real>
Real ackley(std::array<Real, 2> const & v) {
Real x = v[0];
Real y = v[1];
Real arg1 = -sqrt((x*x+y*y)/2)/5;
Real arg2 = cos(two_pi<Real>()*x) + cos(two_pi<Real>()*y);
return -20*exp(arg1) - exp(arg2/2) + 20 + e<Real>();
} | {
"domain": "codereview.stackexchange",
"id": 45261,
"lm_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++, multithreading, openmp, c++23",
"url": null
} |
php
$question = 'happy birthday';
$questionNGrams = array_map("getNgrams", explode(' ', $question));
$rta = ['today', 'happy', ' tomorrow ', 'monday', 'birthda'];
foreach ($rta as $value) {
$rtaNGram = getNgrams($value);
$rtaNGramCount = count($rtaNGram);
foreach ($questionNGrams as $questionNGram) {
if (count(array_intersect($rtaNGram, $questionNGram)) / $rtaNGramCount >= 0.8) {
echo "{$value}<br>";
break; // prevent further iteration of inner loop after $value qualifies
}
}
}
Output:
happy<br>birthda<br>
I do find my eyes going a bit crossed as I continue to read your code because I don't relate $question and $rta to the data they contain. Perhaps be more accurate/intentional about the variable naming. | {
"domain": "codereview.stackexchange",
"id": 36840,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php",
"url": null
} |
c++, backtracking, n-queens
Title: N Queen Problem C++ Following code is solving n queen problem with c++ using backtracking. I saw other people solution they are very short like 20 to 30 lines. Is there way improve following code?
#include <iostream>
#include <vector> | {
"domain": "codereview.stackexchange",
"id": 32380,
"lm_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++, backtracking, n-queens",
"url": null
} |
quantum-algorithms, error-correction, noise, shors-algorithm
Furthermore, with substantial classical overhead, I get to try many combinations based on my simulated data.
I sense that the strategy sketched above will never work and we need error correction?
But what is the exact reason?
Will the bias be so small that I need exponentially many samples or checks?
Do I need finer control over the noise to make sure that the noise is unbiased? Factoring a 2048 bit number with Shor's algorithm involves performing one billion Toffoli gates under superposition (ref).
Suppose your superposed Toffoli gate error rate is an amazing 0.01%. Note that if you experience a single Pauli error the output is useless. The chance of finishing is $0.9999^{1000000000}$. Which is less than $10^{-40000}$.
So no, you can't make it work. You will never ever in your whole life get a shot without a fatal error. You would be better off just randomly guessing at the factors. | {
"domain": "quantumcomputing.stackexchange",
"id": 5513,
"lm_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-algorithms, error-correction, noise, shors-algorithm",
"url": null
} |
c++, sorting, benchmarking
inline int getBits(SortingBmk::T v, SortingBmk::T i) { return (v >> i)&0b11; }
void radixSort_count(std::vector<SortingBmk::T>& data, std::vector<SortingBmk::T>& buf) {
const int n = data.size();
std::array<int, 8> psum = {0};
constexpr auto sz = sizeof(SortingBmk::T) * 8 - 2;
for (SortingBmk::T i = 0; i < sz; i += 2) {
//count sort
for (int v : data) {
auto bits = getBits(v, i);
++psum[bits];
}
for (int i = 1; i < 8; ++i)
psum[i] += psum[i-1];
for (int j = n - 1; j>= 0; --j) {
auto bits = getBits(data[j], i);
--psum[bits];
assert(psum[bits] < buf.size());
buf[ psum[bits] ] = data[j];
}
swap(buf, data);
psum = {0};
}
}
BENCHMARK_DEFINE_F(SortingBmk, NaiveRadixSort)(benchmark::State& state)
{
const auto n = state.range(0); | {
"domain": "codereview.stackexchange",
"id": 40623,
"lm_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++, sorting, benchmarking",
"url": null
} |
thermodynamics, thermal-radiation
The answer is that any sort of body will, at an intuitive level, have some "density of states" for holding EM waves. The argument that leads to blackbody radiation at any specific wavelength is simply that the amount of radiation is directly proportional to the occupancy of these degrees of freedom at that wavelength in the body. An idealized blackbody such as e.g. a vacuum radiation bath is simply a body where every single such degree of freedom, as permitted by the quantum mechanics of radiation, is available. One cannot create a hypothetical body with more degrees of freedom than a blackbody for EM waves because there simply are not more degrees of freedom available. Thus the blackbody must be the maximally radiative body at a fixed temperature. | {
"domain": "physics.stackexchange",
"id": 92229,
"lm_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, thermal-radiation",
"url": null
} |
performance, beginner, php, object-oriented, array
"BBY" => 0.14,
"CBS" => 0.12,
"CMG" => 0.1,
"MCD" => 0.1,
"GPS" => 0.08,
"HOG" => 0.06,
"AZO" => 0.04,
"EXPE" => 0.02,
),
),
array(
"sector" => "Consumer Staples",
"directory" => "consumer-staples",
"sector_weight" => 0.06,
"sector_coefficient" => 8,
"selected_tickers" => array(
"PEP" => 0.18,
"PM" => 0.16,
"PG" => 0.14,
"MNST" => 0.12,
"TSN" => 0.1,
"CPB" => 0.1,
"HRL" => 0.08,
"SJM" => 0.06,
"CAG" => 0.04,
"KHC" => 0.02,
),
),
array(
"sector" => "Defense", | {
"domain": "codereview.stackexchange",
"id": 34035,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, beginner, php, object-oriented, array",
"url": null
} |
python, converting, hash-map
Title: A function to convert FASTA .txt to a dictionary I'd like feedback on my function to convert FASTA data to a dictionary in Python. Here's an example of FASTA text:
>gi|33112219|sp|O93279.1|A4_TAKRU RecName: Full=Amyloid beta A4 protein; AltName: Full=ABPP; Short=APP; AltName: Full=Alzheimer disease amyloid A4 protein homolog; Contains: RecName: Full=Beta-amyloid protein; AltName: Full=A-beta; AltName: Full=Beta-APP; Flags: Precursor
MGETTAFVLLLVATLTRSSEIPADDTVGLLTEPQVAMFCGKLNMHINVQNGKWESDPSGTKSCLNTKEGI
LQYCQEVYPELQITNVVEANQPVSIQNWCKKGRKQCRSHTHIVVPYRCLVGEFVSDALLVPDKCKFLHQE
RMNQCESHLHWHTVAKESCGDRSMNLHDYGMLLPCGIDRFRGVKFVCCPAETEQETDSSEVEGEESDVWW
GGADPEYSENSPPTPSRATYVAGDAFERDENGDGDEDEEDDEDVDPTDEQESDERTANVAMTTTTTTTTE
SVEEVVRAVCWAQAESGPCRAMLERWYFNPKKRRCVPFLFGGCGGNRNNFESEEYCLAVCSSSLPTVAPS
PPDAVDQYFEAPGDDNEHADFRKAKESLEAKHRERMSQVMREWEEAERQAKNLPRADKKAVIQHFQEKVE
ALEQEAAGERQQLVETHMARVEALLNSRRRLTLENYLGALQANPPRARQVLSLLKKYVRAEQKDRQHTLK | {
"domain": "codereview.stackexchange",
"id": 9263,
"lm_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, converting, hash-map",
"url": null
} |
thermodynamics, experimental-chemistry, free-energy, entropy
Title: Is there a way to experimentally measure entropy? I've been doing thermodynamic chemistry, and recently focusing on Gibbs Free Energy. Whilst doing calculations using, $$\Delta G = \Delta H - T \Delta S$$ I have been given a table of values for $\Delta H$ and $\Delta S$, and a temperature to work with. I was wondering , as the unit for entropy is $\mathrm{J/K}$ or $\mathrm{J\ K^{-1}}$ how exactly one would experimentally measure entropy/change in entropy, or can you? The most common way of measuring $\Delta S^\circ$ for a chemical reaction is probably by making a van't Hoff plot. You measure the equilibrium constant $K$ at different temperatures and plot $\ln K$ vs $T^{-1}$. The $y$-intercept = $R\Delta S^\circ$ and the slope = $-R\Delta H^\circ$.
Another option is to measure $\Delta H^\circ$ by calorimetry and measure $K$ by some other means. Then compute $\Delta G^\circ$ from $K$ and solve for $\Delta S^\circ$ | {
"domain": "chemistry.stackexchange",
"id": 4673,
"lm_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, experimental-chemistry, free-energy, entropy",
"url": null
} |
moveit
Title: How to add multiple objects to MoveIt Planning Scene?
I am unable to add multiple objects to MoveIt planning scene. Using the Move Group C++ API, I do:
moveit::planning_interface::PlanningSceneInterface planning_scene_interface;
moveit_msgs::CollisionObject co, co2;
..
..
Fill in the fields of moveit_msgs co & co2
..
..
co.operation = co.ADD;
co2.operation=co2.ADD;
std::vector<moveit_msgs::CollisionObject> collision_objects;
collision_objects.push_back(co);
collision_objects.push_back(co2) ;
ROS_INFO("Add an object into the world");
planning_scene_interface.addCollisionObjects(collision_objects);
sleep(2.0);
When I run it, only one collision object appears i.e. co2 .
I can not figure out what am I missing. Please help me out. | {
"domain": "robotics.stackexchange",
"id": 25878,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "moveit",
"url": null
} |
structural-engineering
The tension brace provides resistance solely from being present. (i.e. something is better than nothing)
The other brace is in tension so it will provide additional restraint similar to a bow string.
Note: Some codes have requirements that a brace be able to withstand 5% of the axial force in the member being braced. I would think that this would be the lower limit for restraint coming from the tension member.
What is its unbraced length for determining buckling capacity?
AISC defines $L$ as the laterally unbraced length of the member (emphasis mine) (AISC 14th Ed. Steel Construction Manual, Part 16, Section E2).
I can justify to myself that the tension member braces the compression member in one direction (in the plane of the page)
I would agree. | {
"domain": "engineering.stackexchange",
"id": 674,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "structural-engineering",
"url": null
} |
c#, game, mvc, winforms, chess
This is also a second point: the notation in chess is x axes = letters, A - H
and y axis Numbers 1-8.
Why create custom coordinates that then operate on digits only? At least put an abstract layer above it, to hide from the code-reviewer that there is an actual math based coordinate set under the normal notation. This will make it easier to read the code.
Generally switch cases are considered a bad idea, because if you need to add a new type, then you have to revisit all places where that switch case is implemented to correct a change.
This might not be relevant for a chess game? But that doesn't mean you shouldn't think about how you would normally avoid a switch case statement. Especially when it isn't needed.
I will try to rewrite this so it becomes more apparent what I mean during the weekend.
I think I would change the amount of maths you are required to do, into a more readable format also. | {
"domain": "codereview.stackexchange",
"id": 44851,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, game, mvc, winforms, chess",
"url": null
} |
ros-humble, moveit2
#11 0x00007fffd6b8e837 in moveit::core::RobotState::init() ()
from /home/peter/ros2_ws/install/moveit_core/lib/libmoveit_robot_state.so.2.9.0
#12 0x00007fffd6b8e9ef in moveit::core::RobotState::RobotState(std::shared_ptr<moveit::core::RobotModel const> const&) ()
from /home/peter/ros2_ws/install/moveit_core/lib/libmoveit_robot_state.so.2.9.0
#13 0x00007fffd6cd54c1 in planning_scene::PlanningScene::initialize() ()
from /home/peter/ros2_ws/install/moveit_core/lib/libmoveit_planning_scene.so.2.9.0
#14 0x00007fffd6cd5f92 in planning_scene::PlanningScene::PlanningScene() ()
from /home/peter/ros2_ws/install/moveit_core/lib/libmoveit_planning_scene.so.2.9.0
#15 0x00007fffd457dd45 in planning_scene_monitor::PlanningSceneMonitor::initialize(std::shared_ptr<planning_scene::PlanningScene> const&) ()
from /home/peter/ros2_ws/install/moveit_ros_planning/lib/libmoveit_planning_scene_monitor.so.2.9.0 | {
"domain": "robotics.stackexchange",
"id": 39055,
"lm_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-humble, moveit2",
"url": null
} |
turing-machines, computation-models, church-turing-thesis
Title: Church-Turing Thesis - the mechanical model - the turing machine- its limits and its equivalence with a modern digital computer Well in many texts and places I have seen a called statement, which claims it self to the famous "Church Turing Thesis".
I have seen many texts say that based on Church-Turing Thesis :
"Anything that can be done by a digital computer can also be done by Turing Machine".
Peter Linz text roughly says that the thesis is :
"any computation that can be done by "mechanical" means can also be done by TM".
Linz even adds that mechanical term is not well defined. So TM can serve as a definition for mechanical machine.
A look in the Wikipedia says:
It states that a function on the natural numbers can be calculated by an effective method if and only if it is computable by a Turing machine. | {
"domain": "cs.stackexchange",
"id": 18118,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "turing-machines, computation-models, church-turing-thesis",
"url": null
} |
c, macros, bitset
{
BFLAGS_DECLARE_ZERO(bflags_a, 64);
BFLAGS_DECLARE_ZERO(bflags_c, 64);
BFLAGS_FILL(bflags_a, 64);
BFLAGS_AND(bflags_c, bflags_a, bflags_a, 64);
for (size_t i = 0; i != 64; ++i)
mu_assert(BFLAGS_TEST(bflags_c, i));
}
{
BFLAGS_DECLARE_ZERO(bflags_a, 64);
BFLAGS_DECLARE_ZERO(bflags_b, 64);
BFLAGS_DECLARE_ZERO(bflags_c, 64);
for (size_t i = 0; i != 64; ++i)
if (i % 2 == 0)
BFLAGS_SET(bflags_a, i);
for (size_t i = 0; i != 64; ++i)
if (i % 2 != 0)
BFLAGS_SET(bflags_b, i);
BFLAGS_AND(bflags_c, bflags_a, bflags_b, 64);
for (size_t i = 0; i != 64; ++i)
mu_assert(!BFLAGS_TEST(bflags_c, i));
}
return NULL;
}
static char* bflags_or()
{
{
BFLAGS_DECLARE_ZERO(bflags_a, 64);
BFLAGS_DECLARE_ZERO(bflags_b, 64);
BFLAGS_DECLARE_ZERO(bflags_c, 64); | {
"domain": "codereview.stackexchange",
"id": 33765,
"lm_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, macros, bitset",
"url": null
} |
c++, parsing, xml
childNode.strAttributeName._Pop_back_n(childNode.strAttributeName.size());
childNode.strAttributeValue._Pop_back_n(childNode.strAttributeValue.size());
sz = strTagName.size();
if (strInLine.substr(1, sz) == strTagName) {
posLt = strInLine.find_first_of("<");
posGt = strInLine.find_first_of(">");
strOpenTag = strInLine.substr(posLt + 1, posGt - posLt - 1);
if (strOpenTag.size() > sz) {
while (strOpenTag.size() > sz) {
getAttributes(strOpenTag, strAttributeName, strAttributeValue);
childNode.strAttributeName.push_back(strAttributeName);
childNode.strAttributeValue.push_back(strAttributeValue);
}
} | {
"domain": "codereview.stackexchange",
"id": 19018,
"lm_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++, parsing, xml",
"url": null
} |
The conceptual structure that lies at the heart of this simple proof is the ubiquitous order ideal. $\$ See my post here for more on this and the more familiar additive form of a denominator ideal.
More generally $\rm\ gcd(f(m), f(n)) = f(gcd(m,n))\ \ \, if\, \ \ f(n) \equiv f(n\!-\!m)\,\ \ (mod\ f(m)),\,$ and $\rm\, f(0) = 0.\,$ See my post here for a simple inductive proof.
In fact there is a q-analog: the result also holds true for polynomials $\rm \ f(n) = (x^n\!-\!1)/(x\!-\!1),\,$ and $\rm\ x\to 1\$ yields the integer case (Bezout identity) - see my post here for a simple proof. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9736446486833801,
"lm_q1q2_score": 0.804923508064938,
"lm_q2_score": 0.8267117876664789,
"openwebmath_perplexity": 141.19005573073153,
"openwebmath_score": 0.9495658278465271,
"tags": null,
"url": "https://math.stackexchange.com/questions/678730/gcd-number-theory-proof-an-1-am-1-am-n-1/678918"
} |
sampling, image-processing, quantization
Title: For image quantization, is it necessary to sample image? When we want to quantize an image, is it necessary to do sampling? When we know that image is a discrete signal, is it necessary to find the best samples with Nyquist rate? Quantization of a continuous signal is the process of representing an infinite set of input values, $x(t)$, that fall into an interval $I_k=[a_k,b_k]$, with a single level $y_k(t)$, the output, that represents all the inputs to that interval with some optimality criterion.
You can quantize an analog signal without sampling it. (however don't mix this with binarization of its amplitude). To do so, you can pass the analog signal from a set of reference thresholders, whose output will be constant as long as the input signal remains in a given interval. Binarization is not necessary if you do not want to convert this into a digital signal. | {
"domain": "dsp.stackexchange",
"id": 4383,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sampling, image-processing, quantization",
"url": null
} |
• Try it for fewer points than $12$ and see if you can spot a pattern. – saulspatz Dec 12 '18 at 15:08
• The numbers in (A)-(D) are all usually associated with counting certain (possibly ordered) subsets of a 12-element set. Can you tell what type of subsets these numbers count? Which type of subset corresponds to a single intersection point? – Mees de Vries Dec 12 '18 at 15:10
• @saulspatz for 12 points I found the answer to be (1+2+....+9)+(1+2+3+.....+8)+....+(1) and the result multiplied by 2. But I'm getting 296 which is in none of the options – Ayaz S Imran Dec 12 '18 at 15:14
• @MeesdeVries (A) is the number of intersection of 12 points – Ayaz S Imran Dec 12 '18 at 15:16
• You should add your result, and the method you used to obtain it, to the body of the question. (Don't make another comment. Edit the question.) Then we'll be able to tell you where you've gone wrong. – saulspatz Dec 12 '18 at 15:16 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109503004294,
"lm_q1q2_score": 0.8674186181705782,
"lm_q2_score": 0.8807970889295664,
"openwebmath_perplexity": 207.68730723774505,
"openwebmath_score": 0.5485895872116089,
"tags": null,
"url": "https://math.stackexchange.com/questions/3036781/if-12-distinct-points-are-placed-on-a-circle-and-all-the-chords-connecting-the"
} |
python, performance, graph, complexity, community-challenge
def solve(sources, sinks):
src = sorted(copy.deepcopy(sources), key=lambda x: x[1])
snk = sorted(copy.deepcopy(sinks), key=lambda x: x[1])
res = []
while snk:
if src[0][1] > snk[0][1]:
edge = (src[0][0], *snk[0])
src[0][1] -= snk[0][1]
del snk[0]
elif src[0][1] < snk[0][1]:
edge = (src[0][0], snk[0][0], src[0][1])
snk[0][1] -= src[0][1]
del src[0]
else:
edge = (src[0][0], *snk[0])
del src[0], snk[0]
res += [edge]
return res | {
"domain": "codereview.stackexchange",
"id": 36075,
"lm_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, graph, complexity, community-challenge",
"url": null
} |
rosbag, catkin
Originally posted by ahendrix with karma: 47576 on 2017-06-26
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by Cheema on 2017-06-26:
After rosdep command and sourcing.It still gives the following error:
No rule to make target '/home/user/catkin_ws/devel/lib/libgflags.so', needed by '/home/user/catkin_ws/devel/lib/libeigen_checks.so
CMakeFiles/Makefile2:1694: recipe for target 'eigen_checks/CMakeFiles/eigen_checks.dir/all' failed
Comment by ahendrix on 2017-06-27:
Looks like you need to install gflags and eigen too.
Comment by Cheema on 2017-06-27:
I cloned gflags and eigen into my ~/catkin_ws/src. Is it the right way to"install" these packages?
Your help is greatly appreciated.
Comment by ahendrix on 2017-06-27:
No. Install them with apt. | {
"domain": "robotics.stackexchange",
"id": 28218,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rosbag, catkin",
"url": null
} |
ros2, ros-humble, rclcpp, ros-foxy
A wall timer uses RCL_STEADY_TIME:
https://github.com/ros2/rclcpp/blob/0f331f90a99da40f7b7a69b4f55b30b7245d294f/rclcpp/include/rclcpp/timer.hpp#L347
Do realize that if you use a wall_timer in a node that is also used with use_sim_time == true, its timer will run and the timer callback will be triggered irrespective of the simulation time (e.g. also when the simulation is paused). | {
"domain": "robotics.stackexchange",
"id": 38749,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros2, ros-humble, rclcpp, ros-foxy",
"url": null
} |
# 10.2Cohen's Standards for Small, Medium, and Large Effect Sizes
Introductory Business Statistics10.2 Cohen's Standards for Small, Medium, and Large Effect Sizes
Cohen's d is a measure of "effect size" based on the differences between two means. Cohen’s d, named for United States statistician Jacob Cohen, measures the relative strength of the differences between the means of two populations based on sample data. The calculated value of effect size is then compared to Cohen’s standards of small, medium, and large effect sizes.
Size of effect d
Small 0.2
Medium 0.5
Large 0.8
Table 10.2 Cohen's Standard Effect Sizes
Cohen's d is the measure of the difference between two means divided by the pooled standard deviation: $d= x ¯ 1 – x ¯ 2 s pooled d= x ¯ 1 – x ¯ 2 s pooled$ where $s pooled = ( n 1 –1) s 1 2 +( n 2 –1) s 2 2 n 1 + n 2 –2 s pooled = ( n 1 –1) s 1 2 +( n 2 –1) s 2 2 n 1 + n 2 –2$ | {
"domain": "openstax.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9859363741964573,
"lm_q1q2_score": 0.8060764103115298,
"lm_q2_score": 0.817574471748733,
"openwebmath_perplexity": 1164.9135614418783,
"openwebmath_score": 0.3128540813922882,
"tags": null,
"url": "https://openstax.org/books/introductory-business-statistics/pages/10-2-cohens-standards-for-small-medium-and-large-effect-sizes"
} |
signal-analysis, continuous-signals
At every collision, the center of mass has to stop and reverse abruptly and that's where we get "spikes" in an accelerometer's readings that are timed to the walking pace.
I am saying this, about the spikes, because you seem to be filtering with a very narrow bandpass filter to get rid of noise. It's so narrow that the filter is "ringing". Its output appears to be a modulated sinusoid. The sinusoid's fundamental is at the centre frequency of the filter and its envelope is timed to the excitation of the filter by the spikes. It is literally like striking a bell. And in fact, before the bell's ringing has died down (from the previous step), it is hit again, you can see this at the envelope of the filter that looks like a spindle.
With this filter, it will be impossible to study the signal. | {
"domain": "dsp.stackexchange",
"id": 4056,
"lm_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, continuous-signals",
"url": null
} |
navigation, sicklms, realsense-camera, rtabmap-odometry, 2d-mapping
<param if="$(arg subscribe_scan)" name="LccIcp/Type" type="string" value="2"/>
<param if="$(arg subscribe_scan)" name="LccIcp2/CorrespondenceRatio" type="string" value="0.25"/>
</node>
<!-- Visualisation RTAB-Map -->
<node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="$(arg rtabmapviz_cfg)" output="screen" launch-prefix="$(arg launch_prefix)">
<param name="subscribe_depth" type="bool" value="true"/>
<param name="subscribe_laserScan" type="bool" value="$(arg subscribe_scan)"/>
<param name="subscribe_odom_info" type="bool" value="$(arg visual_odometry)"/>
<param name="frame_id" type="string" value="$(arg frame_id)"/>
<param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/>
<remap from="rgb/image" to="$(arg rgb_topic)"/>
<remap from="depth/image" to="$(arg depth_registered_topic)"/> | {
"domain": "robotics.stackexchange",
"id": 25592,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, sicklms, realsense-camera, rtabmap-odometry, 2d-mapping",
"url": null
} |
homework-and-exercises, friction, rotational-kinematics
So, there are two $a_{com}$s here. One is what the car feels it is or what the speedometer measures, and the other what it actually is. Let us say the two are $a_{com}'$ and $a_{com}$ respectively.
Now, since the speedometer measures $a_{com}'$, the final velocity of the car as per it is $27kmph=7.5\frac ms$ at the end of $9$ seconds.
$$\therefore a_{com}'={7.5-0 \over 9}\frac {m}{s^2}=0.83\frac {m}{s^2}$$
Since the 'car' moves $8m$ in $9s$, it essentially means that the COM of the tyre has moved by the same amount.
$$\therefore a_{com}=\frac{2x}{t^2}=\frac{2 \times 8}{9^2} \frac{m}{s^2}= 0.19\frac{m}{s^2}$$
We know however, that $a_{com}' = r\alpha$. Since any point on the periphery of the tyre has a linear acceleration $r\alpha$ with respect to a frame where the COM is stationary, that acceleration is thus also equal to $a_{com}'$. | {
"domain": "physics.stackexchange",
"id": 17471,
"lm_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, friction, rotational-kinematics",
"url": null
} |
c#, beginner, game, winforms
static void Randomize()
{
Random r = new Random();
double s = r.Next(RandoMin, RandoMax); //Uses RandoMin & RandoMax values to randomize the X speed of the ball
Xspeed = ball.IntersectsWith(paddle1) ? Xspeed = s : Xspeed = -s;
if (Yspeed < 0) //If ball is moving upward, (so y speed is negative) the random value assigned
{ //will be changed in sign, so the ball can still go upward
double t = r.Next(RandoMin, RandoMax);
Yspeed = -t;
}
else //Else, directly change the Y speed to a positive value
{ Yspeed = r.Next(RandoMin, RandoMax); }
} //End of PongGame Class
} | {
"domain": "codereview.stackexchange",
"id": 6689,
"lm_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, game, winforms",
"url": null
} |
quantum-mechanics, energy, spacetime, entropy, higgs
Title: What does the Higgs boson have to do with the uncertainty principle and quantum oscillations? I was looking in New Scientist the other day when I saw something to do with the Higgs boson, energy levels, entropy, space/time, quantum oscillations and many other things. It was in a feature to do with symmetry. I have read up about this and I know that the magazine does not accept original works, so I guess that this is mainstream physics.
The above is a diagram of what I'm talking about. This is how it appears in the magazine: | {
"domain": "physics.stackexchange",
"id": 14609,
"lm_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, energy, spacetime, entropy, higgs",
"url": null
} |
php, mysql
<link rel="stylesheet" type="text/css" href="css/mainstyle.css">
<link rel="stylesheet" type="text/css" href="css/showstyle.css">
<script lang="javascript">
function logout(myFrame){
myFram.submit();
}
</script>
</head>
<body>
<div class="wrapper">
<?php headerCode(); ?>
<div class="content" dir="rtl">
<?php showNews(); ?>
</div>
</div>
</body>
</html> Ok, where to start.
mysql_* functions are bad. Burn them, throw them away but don't use them. Use mysqli_ instead or even better PDO.
Ever heard of SQL injections? I think so since you are using mysql_real_escape_string. A simple search on the interwebz for how to bypass mysql_real_escape_string shows its weaknesses.
That being said, let's look at your code. | {
"domain": "codereview.stackexchange",
"id": 4246,
"lm_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, mysql",
"url": null
} |
thermodynamics, elasticity, continuum-mechanics, non-equilibrium
$ \frac{\partial {\bar {\bar F}_{visc}}}{\partial t} = - \frac {1}{\eta}\frac{\partial {A}}{\partial \bar {\bar F}_{visc}}$
So the tensor $\bar {\bar F}_{visc}$ is describing the impact of the dashpot. In a 2d problem (r,z) I would expect this tensor to be a 2x2. I would not need to give any consideration to the theta direction due to symmetry. Interestingly that is not what the paper does. In the implementation there are 5 equations needed for the kinematics. I took this to be each equation to describe an element of the tensor $\bar {\bar F}_{visc}$. The author has a YouTube video that has been helpful in showing how this model can be entered into COMSOL and solved. He sets up these five equations at the 1:50 mark. He sets up the following with $E=\bar {\bar F}_{visc}$
\begin{bmatrix}
E_{11} & 0 & E_{13} \\
0 & E_{22} & 0 \\
E_{31} & 0 & E_{33}
\end{bmatrix}
I would think $E_{22}$ should be zero and thus I need only 4 equations for the dashpot kinematics. | {
"domain": "physics.stackexchange",
"id": 72761,
"lm_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, elasticity, continuum-mechanics, non-equilibrium",
"url": null
} |
more about population standard deviation, or explore other statistical calculators, as well as hundreds of other calculators addressing math, finance, health, fitness, and more. f(x)= 490x x2 +49 on [0,10] 2 Fall 2016, Maya. An open interval like (2, 5) excludes the endpoints. X Values: [a,b] Y Values: / [c,d] Result: [e,f] [1,3] / [2,4] [. In this module you will be asked to calculate the sample size for 6 situations. Therefore, let's consider the function over the closed interval If the maximum value occurs at an interior point, then we have found the value in the open interval that maximizes the area of the garden. Local Extreme Values of a Function Let c be an interior point of the domain of the. (a) Use a graph to estimate the absolute maximum and minimum values of the function to two decimal places. 20 at x = –0. By using this website, you agree to our Cookie Policy. Find the values of f f f at the critical numbers of f f f in (a, b). To find the maximum and/or minimum on an | {
"domain": "rciretedimpresa.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9890130576932457,
"lm_q1q2_score": 0.8520725317968266,
"lm_q2_score": 0.86153820232079,
"openwebmath_perplexity": 373.11161112116935,
"openwebmath_score": 0.6303600668907166,
"tags": null,
"url": "http://hefc.rciretedimpresa.it/absolute-maximum-and-minimum-calculator-on-interval.html"
} |
thermodynamics, black-holes
Even if you would say for example : there is singularity : the well is infinite (is it ?), then still, the light would emerge, after an infinite time.
What concretely means that there is singularity ?
If this means "actually, we don't know", then I don't understand why people say "we know that light does not emerge".
Don't shout on me : I am of course not a specialist of black holes... We don't know for certain that light could never emerge from a black hole, but all our current theories say that it never will. | {
"domain": "physics.stackexchange",
"id": 61592,
"lm_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, black-holes",
"url": null
} |
orbit
*******************************************************************************
Start time : A.D. 2015-May-15 00:00:00.0000 UT
Stop time : A.D. 2015-Jul-15 00:00:00.0000 UT
Step-size : 1440 minutes
*******************************************************************************
Target pole/equ : IAU_MERCURY {East-longitude -}
Target radii : 2439.7 x 2439.7 x 2439.7 km {Equator, meridian, pole}
Center geodetic : 0.00000000,0.00000000,0.0000000 {E-lon(deg),Lat(deg),Alt(km)}
Center cylindric: 0.00000000,0.00000000,0.0000000 {E-lon(deg),Dxy(km),Dz(km)}
Center pole/equ : High-precision EOP model {East-longitude +}
Center radii : 6378.1 x 6378.1 x 6356.8 km {Equator, meridian, pole}
Target primary : Sun
Vis. interferer : MOON (R_eq= 1737.400) km {source: DE-0431LE-0431}
Rel. light bend : Sun, EARTH {source: DE-0431LE-0431} | {
"domain": "astronomy.stackexchange",
"id": 3751,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "orbit",
"url": null
} |
string-theory, spacetime-dimensions, compactification, kaluza-klein, visualization
cylinder was very short--shorter even than the radius of atoms in this universe--then at large scales this universe could be indistinguishable from a 1-dimensional universe (like the "Lineland" that the characters in Flatland pay a visit to). So a similar idea is hypothesized in string theory to account for the fact that we only experience our space as 3-dimensional even though the mathematics of string theory requires more spatial dimensions--the extra dimensions are "curled up" into small shapes known as Calabi-Yau manifolds, which play a role analogous to the circular cross-sections of the 2D cylinder or tube I described (although in brane theory, an extension of string theory, it's possible that one or more extra dimensions may be "large" and non-curled, but particles and forces except for gravity are confined to move in a 3-dimensional "brane" sitting in this higher-dimensional space, which is termed the "bulk"). | {
"domain": "physics.stackexchange",
"id": 21062,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "string-theory, spacetime-dimensions, compactification, kaluza-klein, visualization",
"url": null
} |
After that, I don't see how to proceed...should I conclude that since we need to find $pqrs$ that satisfy both of the inequalities below
$pqrs \le 81$ and $pqrs \ge 81$
$\therefore pqrs=81$ and and obviously the answer would be $p=q=r=s=3$?
It looks as though you have solved this problem. You have shown that either $pqrs\leqslant9$ or $pqrs\geqslant 81$. But the equation $pqrs=27+pq+pr+ps+qr+qs+rs$ shows that $pqrs\geqslant27$, so that rules out the first of those possibilities. We are left with the second one, $pqrs\geqslant 81$. But you have also shown that $pqrs\leqslant 81$. Therefore $pqrs = 81$. That implies that equality occurs in the AM-GM inequality, and that only happens when all four quantities are equal. So $p=q=r=s=3$.
anemone
MHB POTW Director
Staff member
On your second AM-GM inequality, you get $(pqrs-81)(pqrs-9) \ge 0$, with the individual inequalities that you found. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540668504082,
"lm_q1q2_score": 0.8508890366973955,
"lm_q2_score": 0.8688267762381844,
"openwebmath_perplexity": 191.97481109021743,
"openwebmath_score": 0.9253337979316711,
"tags": null,
"url": "https://mathhelpboards.com/threads/determine-p-q-r-and-s.7859/"
} |
quantum-spin, field-theory, klein-gordon-equation
However, maybe there is a more fundamental equation that encodes the spin information of a particle and yields the KG equation. This is the Dirac equation. The Dirac equation necessitates that (what we now call) spin 1/2 particles are represented by the direct sum of Weyl spinors. Specifically a direct sum of the $2$ and $\bar{2}$ representations of the Lorentz group. This precisely means that, say, the electron field necessitates the existence of an anti electron field, which together are described by a spin 1/2 field and an anti spin 1/2 field. | {
"domain": "physics.stackexchange",
"id": 51613,
"lm_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-spin, field-theory, klein-gordon-equation",
"url": null
} |
human-biology
Long back in 1975, the relationship between breast cancer and height had been nearly established.
Breast Cancer Incidence and Nutritional Status with Particular Reference to Body Weight and Height
Author: F. de Waard
Cancer Res 1975;35:3351-3356.
Summary The epidemiological literature on breast cancer is reviewed with particular emphasis on the possible etiological role of
nutritional status as reflected by weight and height. The results of a
prospective study and preliminary results of a population-based
case-control study seem to indicate that body size or body mass rather
than overweight (obesity) is a risk factor. A considerable proportion
of the differences in incidence between the Netherlands and Japan can
be explained by differences in body mass. The biological mechanisms
mediating nutritional status and breast cancer are believed to be of
an endocrinological- metabolic nature. | {
"domain": "biology.stackexchange",
"id": 2447,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-biology",
"url": null
} |
python, beginner, strings, converting, console
# Exception can occur if trying to open some folder whose
# permissions this program does not have.
print 'Error occured. Could not open folder %s\n'\
'Reason: %s' %(parent_dir, e)
return | {
"domain": "codereview.stackexchange",
"id": 485,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, strings, converting, console",
"url": null
} |
physics
Originally posted by nkoenig with karma: 7676 on 2016-03-25
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 3894,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physics",
"url": null
} |
turtlebot, ros-groovy
log file: /home/turtlebot/.ros/log/f6daa71c-7692-11e2-8049-446d57c5292a/camera-camera_nodelet_manager-2*.log
respawning...
[camera/camera_nodelet_manager-2] restarting process
process[camera/camera_nodelet_manager-2]: started with pid [19486]
process[camera/depthimage_to_laserscan_loader-6]: started with pid [19596]
process[camera/follower-7]: started with pid [19762]
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/rosdep2/rospack.py", line 55, in init_rospack_interface
lookup = _get_default_RosdepLookup(Options())
File "/usr/lib/pymodules/python2.7/rosdep2/main.py", line 107, in _get_default_RosdepLookup
verbose=options.verbose)
File "/usr/lib/pymodules/python2.7/rosdep2/sources_list.py", line 501, in create_default
sources = load_cached_sources_list(sources_cache_dir=sources_cache_dir, verbose=verbose)
File "/usr/lib/pymodules/python2.7/rosdep2/sources_list.py", line 419, in load_cached_sources_list
with open(cache_index, 'r') as f: | {
"domain": "robotics.stackexchange",
"id": 12883,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "turtlebot, ros-groovy",
"url": null
} |
equilibrium, biochemistry, surfactants
Because the process of sebum regeneration must be endothermic, this means the body is losing energy in this overall process:
body + (lipids + heat) ⇌ body + oil ⇌ (body · oil)
My questions are:
Are my assumptions correct?
Does removing oil from the body more readily, by means of a stronger detergent/soap, reduce body mass?
Does the temperature of the water bath used in the experiment affect the rate of sebum dissociation? I'm afraid no: you are applying a chemical principle to a complex biological response.
The Le Chatelier principle state:
If a chemical system at equilibrium experiences a change in concentration, temperature, volume, or partial pressure, then the equilibrium shifts to counteract the imposed change and a new equilibrium is established.
We start with the definition of chemical system at equilibrium :
the temperature dependent condition in which chemical species are present at concentrations which have no further tendency to change with time. | {
"domain": "chemistry.stackexchange",
"id": 870,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "equilibrium, biochemistry, surfactants",
"url": null
} |
java, performance, strings, reinventing-the-wheel
Task NumberPad -> RLP: (Unit: MILLISECONDS)
Count : 10000 Average : 0.1866
Fastest : 0.1683 Slowest : 5.9859
95Pctile : 0.2280 99Pctile : 0.4241
TimeBlock : 0.218 0.189 0.193 0.181 0.185 0.185 0.177 0.178 0.179 0.182
Histogram : 9826 165 3 2 2 2 | {
"domain": "codereview.stackexchange",
"id": 13506,
"lm_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, strings, reinventing-the-wheel",
"url": null
} |
electromagnetism, poynting-vector
Poynting's theorem follows directly from Maxwell's equations. So it can be used any time that Maxwell's equations apply. To resolve the issue you mention, simply, use continuous charge and current distributions, $\rho$ and $\vec J$. These are the variables that appear in Maxwell's equations, so applying them makes direct sense. In terms of those variables the Lorentz force density is $\vec f = \rho \vec E + \vec J \times \vec B$ and it can be applied directly. | {
"domain": "physics.stackexchange",
"id": 100242,
"lm_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, poynting-vector",
"url": null
} |
molecular-genetics, dna-sequencing, genomics, human-genome
Edit:
SNPs do not need to be gene specific, but this was for simplicty.
@Artem added nicely to the answer, I'm quoting it here:
"Single Nucleotide Polymorphisms (SNPs) are Single Nucleotide Variants (SNVs) at a population allele frequency greater then 1%. Alleles are any variants of the same position of DNA, which includes SNVs, insertion/deletions, or structural variants and at any frequency." - @Artem | {
"domain": "biology.stackexchange",
"id": 6802,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "molecular-genetics, dna-sequencing, genomics, human-genome",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.