text stringlengths 49 10.4k | source dict |
|---|---|
computability, turing-machines
Title: How to prove the language as "Recursive"? How to prove the statement
"If the strings of a language $L$ can be enumerated in lexicographically(alphabetic) order, then the language is Recursive but not context free" ?
Basically, My point is how can the strings of $a^nb^nc^n$ can be lexicographically enumerated as first $n$ has infinite terms . Your confusion may stem from the interpretation of "lexicographically". It's common to take this to mean "by length and then for strings of the same length, by alphabetic order. If this is the case, then an enumeration of your language would be: $\epsilon, abc, aabbcc, aaabbbccc, \dotsc$.
If your language was $\{a^ib^jc^k\mid i,j,k\ge 0\}$ then the enumeration would be
$$
\epsilon, a, b, c, aa, ab, ac, ba, bb, bc, ca, cb, cc, aaa, aab, aab, \dotsc
$$ | {
"domain": "cs.stackexchange",
"id": 8674,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computability, turing-machines",
"url": null
} |
Denote: $$y=ax, z=bx$$. Then: $$x+y+z=0 \iff x+ax+bx=0 \iff a=-1-b;\\ S={x\over y} + {y\over z} + {z\over x} = {y\over x} + {z\over y} + {x\over z} \iff \\ S={1\over a} + {a\over b} + b = a + {b\over a} + {1\over b} \iff \\ S=-{1\over 1+b} - {1+b\over b} + b = -1-b - {b\over 1+b} + {1\over b} \iff \\ \frac{(b+2)(2b+1)(b-1)}{b(1+b)}=0 \iff \\ b_{1,2,3}=\{\color{red}{-2},\color{green}{-\frac12},\color{blue}1\}; a_{1,2,3}=\{\color{red}{1},\color{green}{-\frac12},\color{blue}{-2}\}\\ S_1=\frac1a+\frac ab+b=\frac1{\color{red}{1}}+\frac{\color{red}1}{\color{red}{-2}}+(\color{red}{-2})=-\frac32.\\ S_2=\frac1a+\frac ab+b=\frac1{\color{green}{-\frac12}}+\frac{\color{green}{-\frac12}}{\color{green}{-\frac12}}+(\color{green}{-\frac12})=-\frac32.\\ S_3=\frac1a+\frac | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9854964181787612,
"lm_q1q2_score": 0.8034086893914094,
"lm_q2_score": 0.8152324803738429,
"openwebmath_perplexity": 378.1519359126597,
"openwebmath_score": 0.7766546607017517,
"tags": null,
"url": "https://math.stackexchange.com/questions/3162856/find-the-value-of-s-if-s-x-over-y-y-over-z-z-over-x-y-over-x"
} |
• Please review the way I've used MathJax to format your question and use similar techniques in the future. Feb 15 at 1:36
• Thank you, I couldn't figure out how to display it like that. I will try to learn more before future posts. Feb 15 at 13:15
• @JacobManaker, do you have access to the initial equation I posted still ? I think there might be a formatting error in the MathJax version. Thank you. Feb 25 at 14:47
• If you click on "edited Feb 15 at 1:35" it will show your original version and the changes I made. (That's what I meant by "review"; my comment may have seemed a little critical of you if you didn't know that, for which I apologize.) Feb 25 at 20:44
• Thank you, I didn't know how to find that information. It turned out that my "cleaned up" version, had some errors in it, and when you fixed the formatting it made that error much more apparent. I just trusted the software that I ran it through without first double checking that it simplified it correctly. Also don't worry about the comment, I am glad that it was critical because I do need to learn. It was constructive criticism and it was also done with the corrections (not just telling me to fix it), so as far as I am concerned it was well done. Feb 28 at 15:34 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307716151472,
"lm_q1q2_score": 0.8399339192976796,
"lm_q2_score": 0.8633916029436189,
"openwebmath_perplexity": 287.77765260552144,
"openwebmath_score": 0.8001608848571777,
"tags": null,
"url": "https://math.stackexchange.com/questions/4375095/width-of-this-shape"
} |
javascript, algorithm, machine-learning, neural-network
// function for initializing random weight vectors
function setWeights(l) {
let weights = [];
let v;
for (let i = 0; i < l; i++) {
v = createVector(
random(-width / 2 , width / 2 ),
random(-height / 2 , height / 2 )
);
weights.push(p5.Vector.mult(v, 1 / v.mag()));
}
return weights;
}
// k = # of weight vectors, N = # of learningsessions
function computeClusters(inpts, k, N) {
let w = setWeights(k);
let erg, dotprods, ind, e, m, maxIndex;
for (let j = 0; j < N; j++) {
dotprods = [];
ind = floor(random(0, inpts.length));
e = inpts[ind];
for (let i = 0; i < w.length; i++) {
dotprods.push(e.dot(w[i]));
}
m = max(dotprods);
maxIndex = 0;
for (let i = 0; i < dotprods.length; i++) {
if (dotprods[i] == m) {
maxIndex = i;
}
}
erg = e.add(w[maxIndex]);
w[maxIndex] = erg.mult(100/erg.mag());
}
return w;
}
// function for displaying vector in an "appropriate" way
function drawVector(vec, mycolor) {
let arrowSize = vec.mag() / 10;
push();
stroke(mycolor);
strokeWeight(1.5);
fill(mycolor);
line(0, 0, vec.x, vec.y);
rotate(vec.heading());
translate(vec.mag() - arrowSize, 0);
triangle(0, arrowSize / 4, 0, -arrowSize / 4, arrowSize, 0);
pop();
} | {
"domain": "codereview.stackexchange",
"id": 43034,
"lm_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, algorithm, machine-learning, neural-network",
"url": null
} |
machine-learning, classification, k-nn, lda
Title: Which algorithm should I choose and why? My friend was reading a textbook and had this question:
Suppose that you observe $(X_1,Y_1),...,(X_{100}Y_{100})$, which you assume to be i.i.d. copies of a random pair $(X,Y)$ taking values in $\mathbb{R}^2 \times \{1,2\}$. Your plot the data and see the following:
where black circles represent those $X_i$ with $Y_i=1$ and the red triangles represent those $X_i$ with $Y_i=2$. A practitioner tells you that their misclassification costs are equal, $c_1 = c_2 = 1$, and
would like advice on which algorithm to use for prediction. Given the options:
Linear discriminant analysis;
K-Nearest neighbours with $K=5$
K-Nearest neighbours with $K=90$.
What would be the best algorithm for this? I think it should be $5$, as the bigger the $K$, the worse the accuracy gets? What would be your choice and why? You can choose the optimal method using cross-validation. If your sample size is relatively small, use leave-one-out cross-validation... I would not be surprised if $K = 5$ worked well. Linear discriminant analysis (LDA) will not work here because it implies linear decision boundaries. Unless you enlarge the set of predictors with non-linear transformations.
Also, the picture above is a classic case where support vector machines (SVM) with a Gaussian kernel could be of use. R has a friendly implementation of SVM in the "kernlab" package. | {
"domain": "datascience.stackexchange",
"id": 8954,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, classification, k-nn, lda",
"url": null
} |
ros
occurs following failures:
faps@UbuntuBioMech:~/ros_workspace/beginner_tutorials$ make
[ 0%] Built target rospack_genmsg_libexe
[ 0%] Built target rosbuild_premsgsrvgen
[ 0%] Built target ROSBUILD_gensrv_lisp
[ 0%] Built target ROSBUILD_gensrv_cpp
[ 0%] Built target rospack_gensrv
[ 12%] Built target ROSBUILD_genmsg_lisp
[ 37%] Built target ROSBUILD_genmsg_py
[ 50%] Built target ROSBUILD_genmsg_cpp
[ 50%] Built target rospack_genmsg
[ 50%] Built target rosbuild_precompile
[ 62%] Building CXX object CMakeFiles/add_two_ints_client.dir/src/add_two_ints_client.o
/home/faps/ros_workspace/beginner_tutorials/src/add_two_ints_client.cpp: In function ‘int main(int, char**)’:
/home/faps/ros_workspace/beginner_tutorials/src/add_two_ints_client.cpp:15:47: error: ‘beginner_tutorials’ was not declared in this scope
/home/faps/ros_workspace/beginner_tutorials/src/add_two_ints_client.cpp:15:33: error: parse error in template argument list
/home/faps/ros_workspace/beginner_tutorials/src/add_two_ints_client.cpp:15:93: error: no matching function for call to ‘ros::NodeHandle::serviceClient(const char [13])’
/home/faps/ros_workspace/beginner_tutorials/src/add_two_ints_client.cpp:15:93: note: candidates are: | {
"domain": "robotics.stackexchange",
"id": 10811,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
Hence: \begin{align} f_Z &= \int_{y=-\infty}^{y=+\infty}\frac{1}{|y|}f_Y(y) f_X \left (\frac{z}{y} \right ) dy \\ &= \int_{z}^{+\infty} \frac{1}{B(1,K-1)2^K \Gamma(K)} \frac{1}{y} y^{K-1} e^{-y/2} (1-z/y)^{K-2} dy \\ &= \frac{1}{B(1,K-1)2^K \Gamma(K)}\int_{z}^{+\infty} e^{-y/2} (y-z)^{K-2} dy \\ &=\frac{1}{B(1,K-1)2^K \Gamma(K)} \left[-2^{K-1}e^{-z/2}\Gamma(K-1,\frac{y-z}{2})\right]_z^\infty \\ &= \frac{2^{K-1}}{B(1,K-1)2^K \Gamma(K)} e^{-z/2} \Gamma(K-1) \\ &= \frac{1}{2} e^{-z/2} \end{align} where the last equality holds since $B(1,K-1)=\frac{\Gamma(1)\Gamma(K-1)}{\Gamma(K)}$.
So $Z$ follows an exponential distribution of parameter $\frac{1}{2}$; or equivalently, $Z \sim\chi_2^2$.
There is a pleasant, natural statistical solution to this problem for integral values of $K$, showing that the product has a $\chi^2(2)$ distribution. It relies only on well-known, easily established relationships among functions of standard normal variables. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9802808672839539,
"lm_q1q2_score": 0.8125928560179523,
"lm_q2_score": 0.8289388104343893,
"openwebmath_perplexity": 471.42177008011316,
"openwebmath_score": 0.9998626708984375,
"tags": null,
"url": "https://stats.stackexchange.com/questions/183574/distribution-of-xy-if-x-sim-beta1-k-1-and-y-sim-chi-squared-with-2k"
} |
• Hmmm. I should still admit that I have difficulty pushing that correction forward in derivation. Moreover, in the main answer (after the last edit 42mins ago), I cannot see how you get from "The chance that the sum is still less than $b$ ..." to "We have thereby ... needed to equal or exceed $b$". – ManuHaq Jan 22 at 17:40 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9553191271831559,
"lm_q1q2_score": 0.8157591787371824,
"lm_q2_score": 0.8539127455162773,
"openwebmath_perplexity": 594.6436348648183,
"openwebmath_score": 0.9293714761734009,
"tags": null,
"url": "https://stats.stackexchange.com/questions/445818/expected-of-number-of-discrete-uniform-variables-whose-sum-is-bigger-than-k-fro?noredirect=1"
} |
It seems to reek of Cauchy-Schwarz and/or integration by parts, but I can't see how to prove it. It feels I am one simple trick short.
• Now that the website is suggesting similar questions (i.e., after posting my question), it looks like this is really similar. I'm going to check if the proof allows for the absolute value. – Clement C. Sep 22 '18 at 22:24
• Not sure. The answers to the (similar, but different) question I just linked rely on the fact that $$\int_0^1 f'(x)(x-1/2)dx = -\int_0^1 f(x)dx$$ (since $f(0)-f(1)=0$) by IPP; which is not obvious at all to me when considering $\int_0^1 |f'(x)(x-1/2)|dx$. – Clement C. Sep 22 '18 at 22:37
• If $f$ satisfies your assumptions, then so does $|f|$, with derivative $\frac{d}{dx} |f(x)| = f'(x) 1_{f(x) >0} - f'(x) 1_{f(x) <0}$, which implies $\Big|\frac{d}{dx} |f| \Big| \leq |f'|$. – PhoemueX Sep 22 '18 at 23:12
• @Ahmad $f(0)=f(1)=0$? – Clement C. Sep 22 '18 at 23:27
• I was a little imprecise. If $f$ is in $W^{1,2}$, then so is $|f|$. For Details see e.g. Theorem 1.26 here: math.aalto.fi/~jkkinnun/files/sobolev_spaces.pdf – PhoemueX Sep 22 '18 at 23:44 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9845754461077708,
"lm_q1q2_score": 0.8095072299686096,
"lm_q2_score": 0.8221891305219504,
"openwebmath_perplexity": 165.2938496975667,
"openwebmath_score": 0.9282781481742859,
"tags": null,
"url": "https://math.stackexchange.com/questions/2927021/inequality-int-01-f2-leq-frac112-int-01-f2"
} |
gazebo
NODES
/
bumper2pointcloud (nodelet/nodelet)
cmd_vel_mux (nodelet/nodelet)
depthimage_to_laserscan (nodelet/nodelet)
gazebo (gazebo_ros/gzserver)
gazebo_gui (gazebo_ros/gzclient)
laserscan_nodelet_manager (nodelet/nodelet)
mobile_base_nodelet_manager (nodelet/nodelet)
robot_state_publisher (robot_state_publisher/robot_state_publisher)
spawn_turtlebot_model (gazebo_ros/spawn_model)
ROS_MASTER_URI=http://localhost:11311 | {
"domain": "robotics.stackexchange",
"id": 28597,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo",
"url": null
} |
# extended norm
It is sometimes convenient to allow the norm to take extended real numbers as values. This way, one can accomdate elements of infinite norm in one’s vector space. The formal definition is the same except that one must take care in stating the second condition to avoid the indeterminate form $0\cdot\infty$.
Definition: Given a real or complex vector space $V$, an extended norm is a map $\|\cdot\|\to\overline{\mathbb{R}}$ which staisfies the follwing three defining properties:
1. 1.
Positive definiteness: $\|v\|>0$ unless $v=0$, in which case $\|v\|=0$.
2. 2.
Homogeneity: $\|\lambda v\|=|\lambda|\>\|v\|$ for all non-zero scalars $\lambda$ and all vectors $v$.
3. 3.
Triangle inequality: $\|u+v\|\leq\|u\|+\|v\|$ for all $u,v\in V$.
Example Let $C^{0}$ be the space of continuous functions on the real line. Then the function $\|\cdot\|$ defined as
$\|f\|=\sup_{x}|f(x)|$
is an extended norm. (We define the supremum of an unbounded set as $\infty$.) The reason it is not a norm in the strict sense is that there exist continuous functions which are unbounded. Let us check that it satisfies the defining properties:
1. 1.
Because of the absolute value in the definition, it is obvious that $\|f\|\geq 0$ for all $f$. Furthermore, if $\|f\|=0,$ then $\sup_{x}|f(x)|=0$, so $|f(x)|\leq 0$ for all $x$, which implies that $f=0$.
2. 2.
If $f$ is bounded, then | {
"domain": "planetmath.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9875683473173829,
"lm_q1q2_score": 0.8097007023785197,
"lm_q2_score": 0.8198933315126792,
"openwebmath_perplexity": 204.23723747148162,
"openwebmath_score": 0.9817445278167725,
"tags": null,
"url": "http://planetmath.org/ExtendedNorm"
} |
ros, kinect, laser, vrep, laserscan
But if i want to show the laserscan in rviz something strange happens to the pointcloud:
(i put some decay on the laserscan to see multiple scans at once)
(thank you for the upvote, now i can post the picture)
It seems as the points arent mapped to the "real world". They are "rotating" with the Robot (Kinect). Shouldnt they normally stay at the objectpositions? I really think that the problem is tf-related... The tf-Tree is visible in the rviz screenshot. The /scan Topic (laserscantopic) is transformed via
rosrun tf static_transform_publisher 0 0 0 0 0 0 kinect_visionSensor scan 100 | {
"domain": "robotics.stackexchange",
"id": 17882,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, kinect, laser, vrep, laserscan",
"url": null
} |
time-series
Understanding the Basis of the Kalman Filter
kalman filter in pictures
2) Recurrent Neural Networks, the LSTM and GRU architectures are particularly interesting for time series predictions.
Resources:
RNN effectiveness
Understanding LSTMs
To do regression and predict future data points, you would need to build a training dataset consisting of a sequence of events. Let's say a value $x$ for every timestamp $t$.
Your data seems to have 1 dimension, so both the network input layer and the output layer would consist of 1 unit. You would then train your model to predict $(x_{t+1})$ given $(x_{t})$.
Let $M$ be our trained model and let's say you want to forecast a data point at time $k$ and you know the current value at time $t$.
$M(x_{t}) = (x_{t+1})$
$t = t+1$
$M(x_{t}) = (x_{t+1})$
$...$ increment $t$ and keep predicting until $t+1 = k-1$
$M(x_{t+1}) = (x_{k})$
Put in pictures this corresponds to:
(picture from Udacity lecture about Deep Learning) | {
"domain": "datascience.stackexchange",
"id": 1569,
"lm_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",
"url": null
} |
inorganic-chemistry, acid-base, experimental-chemistry, aqueous-solution, titration
When you do the titration curve for this experiment, depending on the relative strengths of the bases involved, you will see one or two points of inflection points that will signal that the equilibrium conditions have changed. This will tell you if you need to take into account the second ionization. If there is a second inflection point, that's the second ionization.
Without actually going ahead and looking at the $\mathrm{p}K_\mathrm{a}$ of $\ce{H2CO3}$, I think for most computations, it could be omitted, since it is a second ionization which has a much lower constant than the first. Not unless you're looking for zwitterionic states or something like that. | {
"domain": "chemistry.stackexchange",
"id": 9373,
"lm_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, acid-base, experimental-chemistry, aqueous-solution, titration",
"url": null
} |
quantum-mechanics, thermodynamics, relativity
Title: Is there a relativistic (quantum) thermodynamics? Does a relativistic version of quantum thermodynamics exist? I.e. in a non-inertial frame of reference, can I, an external observer, calculate quantities like magnetisation within the non-inertial frame?
I'd be interested to know if there's a difference between how to treat thermodynamics in a uniformly accelerated reference frame and in a non-uniformly accelerated reference frame.
Thanks! There is a classic treatise on "Relativity, Thermodynamics and Cosmology" from R. Tolmann from the 1930s - it is still referenced in papers today. This generalises Thermodynamics to Special Relativity and then General Relativity. As a simple example the transformation law for Temperature is stated as: $T=\sqrt(1-v^2/c^2)T_0$ when changing to a Lorentz moving frame.
Another example is that "entropy density" $\phi$ is introduced, which is also subject to a Lorentz transformation. Finally this becomes a scalar with an associated "entropy 4-vector" in GR. The Second Law is expressed using these constructs by Tolmann.
There is some discussion in Misner, Thorne and Wheeler too.
Of course both these texts also include lots of regular General Relativity Theory which you may not need. | {
"domain": "physics.stackexchange",
"id": 464,
"lm_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, thermodynamics, relativity",
"url": null
} |
quantum-chemistry, computational-chemistry, theoretical-chemistry, software
Why is this discrepancy? What is the actual definition of electronic energy?
Source for my argument: http://vergil.chemistry.gatech.edu/notes/quantrev/node31.html Electronic energy is indeed an eigenvalue of electronic Hamiltonian, and, as you correctly pointed out, it doesn't include the contribution from repulsions of the fixed nuclei (which has nothing to do with electrons). But sometimes the total energy for a particular nuclear configuration (one that includes the above mentioned interactions contribution) is still (incorrectly) termed "electronic energy" while just an eigenvalue of electronic Hamiltonian is called "pure electronic energy". That is essentially wrong, but it is sort of a custom.
And I would not say that "all the electronic structure packages quote the Total energy as the electronic energy". Did you check all of them? For instance, I quickly checked one of my DALTON calculations, and found this:
@ Final DFT energy: -210.248305383291
@ Nuclear repulsion: 158.997839473485
@ Electronic energy: -369.246144856776
So the first one is the (total) energy, then come its two components with the right names.
Same for ORCA:
Total Energy : -210.25104538 Eh -5721.22181 eV
Components:
Nuclear Repulsion : 158.99783872 Eh 4326.55115 eV
Electronic Energy : -369.24888411 Eh -10047.77296 eV
GAMESS-US (here first two terms = electronic energy)
ONE ELECTRON ENERGY = -596.6619030866
TWO ELECTRON ENERGY = 228.7817683952
NUCLEAR REPULSION ENERGY = 158.9978510234
------------------
TOTAL ENERGY = -208.8822836680
NWChem (middle three terms = electronic energy) | {
"domain": "chemistry.stackexchange",
"id": 4266,
"lm_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-chemistry, computational-chemistry, theoretical-chemistry, software",
"url": null
} |
thermodynamics, energy, photons, entropy, thermal-radiation
Title: 2nd law of thermodynamics - thought experiment I have designed this simple thought experiment that seems to contradict 2nd law of thermodynamics. Could you please find a mistake in my reasoning?
Fixed box with reflective (white) walls
________ ___________
| | |
| | |
| | |
|_______ | __________|
^
This part is free to move horizontally and is black on the left and white on the right side
In the right half of the box we don't have any photons since box is completely white inside and the moving part is white on its right side. The left part however is filled with bouncing photons as they are emitted by the left side of the movable wall which is black.
According to my reasoning the moving part should move to the right because of the radiation pressure. Photons will lose energy due to doppler effect.
Since every part of the device is at the same temperature movement of the wall inside would contradict 2nd rule of thermodynamics.
Whole device is in the vacuum box which in turn is placed on a table in a laboratory. There is also, a gas of photons in the right side.
It was trapped there when you assembled your box, and since you are assuming a perfectly zero emissivity, these photons must be perfectly reflected from all surfaces. That means they are blue shifted if the wall moves toward the right and red-shifted if the wall moves toward the left.
Result:
If you assembled the apparatus at the test temperature then it was and remains in equilibrium without motion.
If you assembled it at a different temperature then your experiment is equivalent to heating or cooling one side while the other is adiabatic. This case includes all attempts to exclude the photon gas from the right-hand side.
What happens is exactly what you expect: as the photon gas on the left warms (cools) the wall moves to the right (left) causing the gas on the right to warm (cool) until equilibrium is re-established. | {
"domain": "physics.stackexchange",
"id": 21707,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, energy, photons, entropy, thermal-radiation",
"url": null
} |
classification, dataset, sampling, class-imbalance
Title: When should we consider a dataset as imbalanced? I'm facing a situation where the numbers of positive and negative examples in a dataset are imbalanced.
My question is, are there any rules of thumb that tell us when we should subsample the large category in order to force some kind of balancing in the dataset.
Examples: | {
"domain": "datascience.stackexchange",
"id": 837,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classification, dataset, sampling, class-imbalance",
"url": null
} |
homework-and-exercises, electromagnetism, inductance
Title: Calculating potential difference for fraction of loop with induced current
Given a circular wire loop of radius r, resistance R enclosing a magnetic field perpendicular to the plane of the loop that increases with time ($B=\alpha t$), I have calculated the induced current $I=\frac{\pi r^2 \alpha}{R}$. Now, consider an ideal voltmeter connecting between points P and Q on the loop, which have an angle $90^{\circ}$ between them. The question I am struggling with is what the voltmeter reads.
My attempt so far is to note that $V(b) - V(a) = \int_a^b \nabla V \cdot d\vec{l} = -\int_a^b \vec{E} \cdot d\vec{l}$ and I would like to plug in the electric field, which I tried to get using $\nabla \times E = -\alpha$ but of course I do not know $vec{E}$ explicitly.
In addition to asking how to solve this problem. My question about physics is: how is the potential gradient distributed when the current is uniform? The voltage between a and b is$IR=πr^2α/4.$ this is trivial it is a quarter of the Voltage.
The Electric field is not generated from the $-∇V$ but from $-dA/dt $ | {
"domain": "physics.stackexchange",
"id": 31605,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, electromagnetism, inductance",
"url": null
} |
ros, catkin-make, add-message-files
Title: add_message_files() directory not found
I recently installed ROS indigo and following the tutorial to get to know ROS. However, error occurred after catkin_make. I have also included the log files. Please help me out let me know how to fix this!! Appreciate it!!
The error:
Base path: /home/ciara/catkin_ws
Source space: /home/ciara/catkin_ws/src
Build space: /home/ciara/catkin_ws/build
Devel space: /home/ciara/catkin_ws/devel
Install space: /home/ciara/catkin_ws/install | {
"domain": "robotics.stackexchange",
"id": 24584,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, catkin-make, add-message-files",
"url": null
} |
Q, to be as close as possible to this other set, y1, y2 up to yn. So let me just say it again. I have two sets of vectors. And I'm looking, and they're different-- like those two sets. And I'm looking for the orthogonality matrix that, as well as possible, takes this set into this one. Of course, if this was an orthogonal basis, and this was an orthogonal basis, then we would be home free. Q-- we could get equality. We could take an orthogonal basis directly into an orthogonal basis with a orthogonal matrix Q.
In other words, if x was an orthogonal matrix, and y was an orthogonal matrix, we would get the exact correct Q. But that's not the case. So we're looking for the best possible. So that's the problem there-- minimize over orthogonal matrix-- matrices Q. And I just want to get my notation to be consistent here. OK. So I've-- I see that starting with the y's and mapping them to x's-- so let me ask the question. What orthogonal matrix Q multiplies the y's to come as close as possible to the x's?
So over all orthogonal Q's I want to minimize YQ minus X in the Frobenius norm. And I might as well square it. So Frobenius-- we're into the Frobenius norm. Remember the-- of a matrix? This is a very convenient norm in data science, to measure the size of a matrix. And we have several possible formulas for it. So let me call the matrix A. And the Frobenius norm squared-- so what's one expression, in terms of the entries of the matrix-- the numbers Aij in the matrix?
The Frobenius norm just treats it like a long vector. So it's a11 squared, plus a12 squared, of all the way along the first plus second row, just-- I'll say nn squared. OK. Sum of all the squares-- just treating it like a long vector. OK. This-- but that's a awkward expression to write down. So what other ways do we have to find the Frobenius norm of a matrix? | {
"domain": "mit.edu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9867771805808551,
"lm_q1q2_score": 0.8135602194622262,
"lm_q2_score": 0.8244619306896956,
"openwebmath_perplexity": 598.0650838059803,
"openwebmath_score": 0.7693259716033936,
"tags": null,
"url": "https://ocw.mit.edu/courses/mathematics/18-065-matrix-methods-in-data-analysis-signal-processing-and-machine-learning-spring-2018/video-lectures/lecture-34-distance-matrices-procrustes-problem-first-project/"
} |
c#, programming-challenge, dynamic-programming
int[,] dp = new int[str1.Length + 1, str2.Length + 1];
for (int i = 0; i < str1.Length; i++)
{
for (int j = 0; j < str2.Length; j++)
{
if (str1[i] == str2[j])
{
dp[i+1, j+1] = dp[i, j] + 1;
}
else
{
dp[i + 1, j + 1] = Math.Max(dp[i + 1, j], dp[i, j + 1]);
}
}
}
// Traceback: Collect shortest common supersequence. Since the
// characters are found in reverse order we put them into an array
// first.
char [] resultBuffer = new char[str1.Length + str2.Length];
int resultIndex = resultBuffer.Length;
{
int i = str1.Length;
int j = str2.Length;
while (i > 0 && j > 0)
{
if (str1[i - 1] == str2[j - 1])
{
// Common character:
resultBuffer[--resultIndex] = str1[i - 1];
i--;
j--;
}
else if (dp[i - 1, j] > dp[i, j - 1])
{
// Character from str1:
resultBuffer[--resultIndex] = str1[i - 1];
i--;
}
else
{
// Character from str2:
resultBuffer[--resultIndex] = str2[j - 1];
j--;
}
}
// Prepend remaining characters from str1:
while (i > 0)
{
resultBuffer[--resultIndex] = str1[i - 1];
i--;
}
// Prepend remaining characters from str2:
while (j > 0)
{
resultBuffer[--resultIndex] = str2[j - 1];
j--;
}
} | {
"domain": "codereview.stackexchange",
"id": 36332,
"lm_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#, programming-challenge, dynamic-programming",
"url": null
} |
quantum-mechanics, quantum-field-theory, symmetry, noethers-theorem
\begin{align}
S[\rho_\mathcal F(\Lambda)(\phi)] = S[\phi]
\end{align}
for all $\Lambda\in\mathrm{SO}(3,1)$ and for all $\phi\in\mathcal F$. All of this can also be easily extended to theories of fields of more complicated types, like vector and tensor fields. In such cases, the action $\rho_\mathcal F$ will in general be more complicated because it will contain a target space transformation. | {
"domain": "physics.stackexchange",
"id": 98108,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-field-theory, symmetry, noethers-theorem",
"url": null
} |
periodic-table, isotope
Now here's a question: I said the maximum of nuclear binding energy per nucleon happened at $\mathrm{^{62}Ni}$, so why does the fractional part of the masses in the table keep decreasing all the way to tin $\mathrm{^{116}Sn}$? It's because these masses are not normalized with respect to how many protons and neutrons there are in the nucleus. If you were to take all the isotopic masses and divide them by their respective mass numbers, you would see the minimum around $\mathrm{^{62}Ni}$, as expected (actually, the minimum ratio of isotope mass to mass number happens at $\mathrm{^{56}Fe}$ because it has a slightly higher proportion of protons to neutrons. As I said, the small difference between proton and neutron masses creates slight irregularities which I did not take into account for simplicity). | {
"domain": "chemistry.stackexchange",
"id": 3538,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "periodic-table, isotope",
"url": null
} |
quantum-mechanics, homework-and-exercises, conservation-laws, probability
Title: Continuity equation in QM I found this question in a quantum mechanics exam:
What is the physical interpretation of the continuity equation $\frac{\partial\rho}{\partial t}+\frac{\partial j}{\partial x}=0$? Here $\rho(x,t)$ is the probability density and $j(x,t)$ is the probability current.
I assume they want a one liner like "probability is conserved". But to be honest I do not understand this. Can any one help me here? What's the one liner they are looking for and why? Many thanks! You're actually right, it stems from the "conservation" of probability, or the fact that probability sums to 1. It is literally the equation that says if $\rho$ changes, then that must be due to $j$.
Consider the integral version of this equation. In 3D the space derivative is a divergence,
$$\int \left[\frac{\partial \rho}{\partial t} + \nabla\cdot j\right] dV$$
$$\frac{\partial P}{\partial t} = - \oint j \cdot dA$$
The time rate of change of probability in an area is equal to the amount of probability "leaving" the area in any direction (through the surface that defines the area).
In fact, this is the same as the differential form continuity equation in fluids, charge (electromagnetism), heat, etc. | {
"domain": "physics.stackexchange",
"id": 68408,
"lm_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, homework-and-exercises, conservation-laws, probability",
"url": null
} |
computability
Title: Can every r.e. set be obtained by repeated function application? Is below statement true?
$\forall L \in r.e. \,\, \, \exists f:\{0,1\}^* \longrightarrow \{0,1\}^* \, , \exists x\in \{0,1\}^* \; s.t \, \, L = \{x,f(x),f(f(x)),..\} $ .
My guess is no and I tried to prove this with cantor diagonalization.If we suppose that $L_i$ has this property so $L_i = \{x_i,f_i(x_i),f_i(f_i(x_i)),...\}$,now I want to make $L$ that doesn't have above property $L = \{x_k \in \{0,1\}^* | \nexists i \; x_k \in L_i\}$,How can I prove that it is in $r.e$? Since $L$ is r.e., there is a computable program $\varphi$ that enumerates it, say in the order
$$ x_1,x_2,x_3,x_4,\ldots $$
Suppose I give you $x_n$, can you find $x_{n+1}$ using $\varphi$? Can you use this to solve your question? | {
"domain": "cs.stackexchange",
"id": 8210,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computability",
"url": null
} |
GMAT Question of the Day - Daily to your Mailbox; hard ones only
It is currently 23 Sep 2018, 07:27
### GMAT Club Daily Prep
#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.
Customized
for You
we will pick new questions that match your level based on your Timer History
Track
every week, we’ll send you an estimated GMAT score based on your performance
Practice
Pays
we will pick new questions that match your level based on your Timer History
### Show Tags
12 Jul 2018, 05:47
00:00
Difficulty:
15% (low)
Question Stats:
87% (00:42) correct 13% (01:02) wrong based on 23 sessions
### HideShow timer Statistics
A certain store sells two types of pens: one type for $2 per pen and the other type for$3 per pen. If a customer can spend up to $25 to buy pens at the store and there is no sales tax, what is the greatest number of pens the customer can buy? A. 9 B. 10 C. 11 D. 12 E. 20 _________________ Director Joined: 31 Oct 2013 Posts: 578 Concentration: Accounting, Finance GPA: 3.68 WE: Analyst (Accounting) A certain store sells two types of pens: one type for$2 per pen and [#permalink]
### Show Tags
12 Jul 2018, 05:56
Bunuel wrote:
A certain store sells two types of pens: one type for $2 per pen and the other type for$3 per pen. If a customer can spend up to $25 to buy pens at the store and there is no sales tax, what is the greatest number of pens the customer can buy? A. 9 B. 10 C. 11 D. 12 E. 20 As 2 is the lower price between 2 types of pens we have to buy max pen spending 2$ types in order to maximize the no. of pens. | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9678992988387852,
"lm_q1q2_score": 0.812777916580036,
"lm_q2_score": 0.8397339656668286,
"openwebmath_perplexity": 8261.386049876763,
"openwebmath_score": 0.19290658831596375,
"tags": null,
"url": "https://gmatclub.com/forum/a-certain-store-sells-two-types-of-pens-one-type-for-2-per-pen-and-270358.html"
} |
ros, roscd, setup.bash
Title: rosls and roscd still missing
I just installed ros-hydro on Ubuntu 12.10 following the tutorial. But when I try to use the command rosls and roscd, it just says command not found. I tried source /opt/ros/hydro/setup.bash a lot of times and there is "source /opt/ros/hydro/setup.bash" in the ~/.bashrc. But rosls and roscd still can't use.
Originally posted by Thomaswang on ROS Answers with karma: 23 on 2014-03-05
Post score: 1
Original comments
Comment by BennyRe on 2014-03-05:
Which package of ROS did you install? The ros-hydro-desktop-full?
Comment by tfoote on 2014-03-05:
Please link to the tutorial you are following and show the commands you are running.
Comment by Thomaswang on 2014-03-06:
Yes, I install ros-hydro-desktop-full and the like slam-gmapping package.
Comment by Thomaswang on 2014-03-06:
I followed http://wiki.ros.org/ROS/StartGuide
Comment by BennyRe on 2014-03-06:
Stupid question: Do you use bash as your shell?
Comment by Thomaswang on 2014-03-06:
echo $SHELL returns "/bin/bash"
Comment by BennyRe on 2014-03-06:
What is the output of echo $SHELL
Comment by BennyRe on 2014-03-06:
From the information you kindly provided in your other question about the same topic what happens if you do sudo apt-get install ros-hydro-rosbash?
Comment by Thomaswang on 2014-03-06:
Oh, yes, I works. I did installed the ros-hydro-desktop-full, I can't believe that it is not include rosbash. Thank you very much!!!
Comment by BennyRe on 2014-03-06:
Usually, this includes rosbash. Strange. I'll post it as an answer so you can mark the question as answered.
Strangely rosbash hasn't been installed.
Run sudo apt-get install ros-hydro-rosbash | {
"domain": "robotics.stackexchange",
"id": 17170,
"lm_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, roscd, setup.bash",
"url": null
} |
newtonian-mechanics, energy, work, potential-energy
Title: How to prove that gravitational potential energy of a body of mass $m$ at a height $h$ is $mgh$? Many introductory physics books just write that potential energy of a body of mass $m$ at a height $h$ as $U_\text{g}=mgh$. However, they never show how this was derived. I'm interested in knowing this derivation – if possible, avoiding calculus. Suppose I let an object fall from rest for a distance $h$. Given that the gravitational acceleration is $g$ the velocity of the object will be given by the SUVAT equation:
$$ v^2 = u^2 + 2gh $$
In this case the initial velocity $u=0$ so we just get $v^2 = 2gh$. The kinetic energy of the object is given by:
$$ T = \tfrac{1}{2}mv^2 = \tfrac{1}{2}m(2gh) = mgh $$
If energy is conserved the increase in kinetic energy must be equal to the decrease in potential energy, so we get:
$$ \Delta U = -\Delta T = -mgh $$
This tells us that if we lower the object by a distance $h$ the potential energy decreases by $mgh$, and conversely that if we raise it by a distance $h$ the potential energy increases by $mgh$. | {
"domain": "physics.stackexchange",
"id": 28938,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, energy, work, potential-energy",
"url": null
} |
Bernard can do the same deductions we have and eliminate the options that are not possible from his state of knowledge (all the options with months different from July and August).
##### Bernard
1. July 14 or August 14
2. August 15
3. July 16
4. August 17
Bernard: At first, I didn’t know when Cheryl’s birthday is, but I know now.
Updating our knowledge of Bernard knowledge:
##### Bernard
1. August 15
2. July 16
3. August 17
As Albert also knows what we know about Bernard knowledge…
##### Albert
1. July 16
2. August 15 or August 17
Albert: Then I also know when Cheryl’s birthday is.
Now we know the right date:
1. July 16
1. July 16
# 42 code golf
A nice and easy interview problem (link not posted to avoid giving good answers) is the following:
Print the number of integers below one million whose decimal digits sum to 42.
It can be solved with some simple Python code like the following:
print sum(1 if sum(int(c) for c in '%d' % n) == 42 else 0
for n in range(1000000))
A more interesting problem is to try to write the smallest C program that solves the problem, where C program is defined as something that can be compiled & executed by Ideone in “C” mode. I know it can be done in 83 bytes, but can it be done using less?
# Inverse kinematics and the Jacobian transpose
### Generalities
This is a relatively technical post. Its purpose is mainly to teach myself why the Jacobian transpose is so useful when doing inverse kinematics.
We are going to solve the following problem:
We have a mechanism with effectors applying forces whose components are given by $f_i$, with $i$ going from 1 to $N$. The required power is provided by a series of torques, whose components are called $\tau_j$, where $j$ goes from 1 to $M$. Get the required values of $\tau_j$ as a function of $f_i$.
### Jacobian | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.983085087724427,
"lm_q1q2_score": 0.8234517011106353,
"lm_q2_score": 0.8376199694135332,
"openwebmath_perplexity": 2000.9667066203313,
"openwebmath_score": 0.7024517059326172,
"tags": null,
"url": "https://mchouza.wordpress.com/page/2/"
} |
computational-physics, ising-model
Is this that all correct?
PS: I do not know if we are allowed to ask a question for clarification on physics stack exchange. I hope this is not against the physics stack exchange policy. No, you are incorrect at point number 1 and following.
In your point 1, After system has reached Equilibrium, viz., after $\tau$, you need to take uncorrelated energies, i.e., energies after every 2$\tau$. In short, you take energies at $\tau, 3\tau, 5\tau, \dots$ and discard others.
If you calculate variance of new set of energies at $\tau, 3\tau, 5\tau, \dots$ and multiply by $\beta^2$, you will get specific heat.
Calculate $c_n$ which is, variance of all Energy excluding energy at n-th index.
No need of this step.
This step is fine. | {
"domain": "physics.stackexchange",
"id": 67059,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computational-physics, ising-model",
"url": null
} |
# Does this sequence always give an integer?
It is known that the $k$-Somos sequences always give integers for $2\le k\le 7$.
For example, the $6$-Somos sequence is defined as the following :
$$a_{n+6}=\frac{a_{n+5}\cdot a_{n+1}+a_{n+4}\cdot a_{n+2}+{a_{n+3}}^2}{a_n}\ \ (n\ge0)$$
where $a_0=a_1=a_2=a_3=a_4=a_5=1$.
Then, here is my question.
Question : If a sequence $\{b_n\}$ is difined as $$b_{n+6}=\frac{b_{n+5}\cdot b_{n+1}+b_{n+4}\cdot b_{n+2}+{b_{n+3}}^2}{b_n}\ \ (n\ge0)$$$$b_0=b_1=b_2=b_3=1, b_4=b_5=2,$$ then is $b_n$ an integer for any $n$?
We can see $$b_6=5,b_7=11,b_8=25,b_9=97,b_{10}=220,b_{11}=1396,b_{12}=6053,b_{13}=30467$$ $$b_{14}=249431,b_{15}=1381913,b_{16}=19850884,b_{17}=160799404$$ $$b_{18}=1942868797,b_{19}=36133524445, \cdots.$$
Remark : This question has been asked previously on math.SE without receiving any answers. | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9825575157745542,
"lm_q1q2_score": 0.8055923614973636,
"lm_q2_score": 0.8198933381139645,
"openwebmath_perplexity": 326.6232182373897,
"openwebmath_score": 0.8890050649642944,
"tags": null,
"url": "https://mathoverflow.net/questions/143609/does-this-sequence-always-give-an-integer"
} |
electromagnetism, differential-geometry, classical-electrodynamics, maxwell-equations
Title: EM waves in terms of differential forms I know you can write Maxwell's equations in terms of the four-potential $A = A_{\mu}\mathrm{d}x^{\mu}$, the four-current $j = j_{\mu}\mathrm{d}x^{\mu}$, the exterior derivative $\mathrm{d}$, and the codifferential $\mathrm{d}^{\dagger}$ as:
$$
\begin{aligned}
\mathrm{dd}A &= 0 \\
\mathrm{d}^{\dagger}\mathrm{d}A &= j
\end{aligned}
$$
and usually you would define $\mathrm{d}A = F$ but I want to stick with the potential for now.
The generalised Laplacian can be written as $\left(\mathrm{d} + \mathrm{d}^{\dagger}\right)^{2} = \mathrm{dd}^{\dagger} + \mathrm{d}^{\dagger}\mathrm{d}$, which I take to mean you want write the EM wave equation as:
$$
\mathrm{dd}^{\dagger}A = -j
$$
which seems to recover the usual $\Box A = 0$ if you expand out $\mathrm{dd}^{\dagger}A$ in components, and set $j=0$ to get the uncharged vacuum limit. However, since the statement $\mathrm{dd}A = 0$ is somewhat redundant ($\mathrm{d}$ and $\mathrm{d}^{\dagger}$ are both nilpotent), doesn't this mean you can just write:
$$
\begin{aligned}
\mathrm{d}^{\dagger}\mathrm{d}A &= j \\
\mathrm{dd}^{\dagger}A &= -j
\end{aligned}
$$
or even in terms of a commutator
$$
\left[\mathrm{d}^{\dagger},\mathrm{d}\right]A = 2j
$$ | {
"domain": "physics.stackexchange",
"id": 40070,
"lm_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, differential-geometry, classical-electrodynamics, maxwell-equations",
"url": null
} |
fluid-dynamics, fluid-statics, surface-tension
Title: Water drops being spherical but whole water not We know that water drops are spherical due to surface tension since it tries to minimize the surface area. But in that case why not a big water body as a whole stay spherical? The water taken in a glass adjusts itself according to the glass but why doesn't it form the spherical shape like a water drop? Water drops are spherical only when free of externally applied surface forces. Water in a macroscale container is subjected to forces from the container walls (e.g., a 4900 N/m rate of increase vertically for the lateral force on the sidewalls of a container with 1 m length and width), which dominate over the surface tension (0.072 mN/m for lateral extension of a rectangular surface region), leaving only a faint trace—the meniscus—of the latter. | {
"domain": "physics.stackexchange",
"id": 93247,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, fluid-statics, surface-tension",
"url": null
} |
c++, beginner, hangman
}
}
void Thegame::storetheword(string x)//simply placing the secret phrase in a private variable
{
response=x;
}
void Thegame::resetword()//resetting the word and dashes back to its original nature for multiple attempts
{
response="";
shown="";
tries=7;
}
void Thegame::addTries()
{
tries--;
}
void Thegame::hangmandrawing()
{
if(tries==6 || tries==7)
{
cout << " ___________"<<endl;
cout << " | }"<<endl;
cout << " | " <<endl;
cout << "_|______________"<<endl;
}
else if(tries==5)
{
cout << " ___________"<<endl;
cout << " | }"<<endl;
cout << " | \\ " <<endl;
cout << "_|______________"<<endl;
}
else if(tries==4)
{
cout << " ___________"<<endl;
cout << " | }"<<endl;
cout << " | \\ 0 " <<endl;
cout << "_|______________"<<endl;
}
else if(tries==3)
{
cout << " ___________"<<endl;
cout << " | }"<<endl;
cout << " | \\ 0 /" <<endl;
cout << "_|______________"<<endl;
}
else if(tries==2)
{
cout << " ___________"<<endl;
cout << " | }"<<endl; | {
"domain": "codereview.stackexchange",
"id": 26334,
"lm_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, hangman",
"url": null
} |
ros, messages, services
Title: How to use ROS services
I am trying to get data from a gps and use it in a program that I am writing. I read somewhere that ROS services would be an ideal tool for me to use to accomplish my task. I read over the tutorial that ROS provides but I am still having troubles understanding how to use them. In the links below I have the information that I need for my program to work.
http://docs.ros.org/jade/api/geographic_msgs/html/msg/GeoPose.html
http://docs.ros.org/jade/api/geographic_msgs/html/msg/GeoPoint.html
Originally posted by negotiator14 on ROS Answers with karma: 35 on 2015-08-04
Post score: 0
Original comments
Comment by Vinh K on 2015-08-04:
well negotiator14, could you use messages communication instead of services since this are messages files?
Comment by Javier V. Gómez on 2015-08-05:
And the question is...?
You use messages for many-to-many communication over ROS Topics, whereas Services provide Request/Response communication.
So both could be used what you try to do, depending on your actual use case.
See the Tutorials Page on the ROS wiki, especially the Beginner tutorial sections 10. for creating msgs and srvs, 11-13 for Topic communication via Publisher/Subscribers and 14-16 for Services.
From the explanation there, the differences should become clear.
Originally posted by mgruhler with karma: 12390 on 2015-08-05
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 22372,
"lm_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, messages, services",
"url": null
} |
+ 1$$, $$\vec{V} = x \hat{i} + y \hat{j} + z \hat{k}$$, Establishes relationships between quantities, Maths symbols are universal and break the language barrier. The symbols for basic arithmetic operations are addition (+), subtraction (-), Multiplication (×), Division(÷). To simplify the expressions, we can use those kinds of values instead of those symbols. Thesishelpers.com. In simple words, without symbols, we cannot do maths. Some Basic Mathematical Symbols with Names, Meaning, and Examples. The relationship between the sign and the value refers to the fundamental need of mathematics. 1 + 1 = 2 is equal to; equals everywhere ≠ <> != inequation x ≠ y means that x and y do not represent the same thing or value. College homework help Please support and encourage me for creating good and useful content for everyone. Mathematical Symbols. Everything from resistivity, through to impedance, permeance and ratios of circles and much more. Symbols save time and space when writing. {\displaystyle \sqcup } for a disjoint union of sets. - Logic symbols. These symbols are used frequently while doing problems or in any proofs and each symbol has a different meaning. Implies (⇒) Go through the symbols given here to use as the substitute for the Mathematical terms. The value of pi is approximately equal to 3.14, and it is considered as an irrational number. In IIT JEE exam we can say that calculus has more weightage .I listed some of the important calculus symbols like integral, double integral, limit and so on. There are so many mathematical symbols which are very important to students. a ≥ b, means, a = b or a > b, but vice-versa does not hold true. It is important to get completely acquainted with all the maths symbols to be able to solve maths problems efficiently. - Probability & statistics symbols. With the help of symbols, certain concepts and ideas are clearly explained. Greek alphabet letters are used as math and science … For example, the Roman letter X represents the value 10 everywhere around us. 3 - 2 = 1 × Multiplication, multiply It is an irrational number and it cannot be represented as a simple fraction. The math symbols not only refer to different quantities but also represent the relationship between two quantities. In | {
"domain": "charbotandwanderlust.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9399133498259923,
"lm_q1q2_score": 0.8182860075219466,
"lm_q2_score": 0.8705972818382005,
"openwebmath_perplexity": 1623.9148717840606,
"openwebmath_score": 0.631192684173584,
"tags": null,
"url": "http://charbotandwanderlust.com/yyvpiqoj/article.php?9ac489=mathematical-symbols-with-names"
} |
python, python-3.x
for key, value in Layers.items():
if (key != list(Layers)[-1]) and (Layers[key+1] == [ value[0],-value[1],-value[2],-value[3] ]):inversion = True; k_inv = key
if value[1] == value[2] == value[3] == 0.0: origin = True; k_zero = key
print('{:4} {:2} {:^12} {:^12} {:^12}\n'.format('','','x','y','z'))
for key, value in Layers.items():
if ((inversion == True ) and (key in [k_inv,k_inv+1])):print(fmt.inversion.format(key,*value));
if ((inversion == True) and (key not in [k_inv,k_inv+1])) or inversion == False: print(fmt.main.format(key,*value))
if inversion == True: print((color.BOLD + '\n***Possible inversion center found at {}-{}***\n' + color.END).format(k_inv,k_inv+1))
if origin == True: print('\n***Possible inversion center found at {}**\n'.format(k_zero))
return Layers
#-------------------------------------------------------------------------------------------
def Supercell(prim_cell,Atoms,Layers,X,Y,Z,x_shift,y_shift,z_shift): | {
"domain": "codereview.stackexchange",
"id": 39213,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x",
"url": null
} |
# Roll a die probability question
An unbiased six-sided die is to be rolled five times. Suppose all these trials are independent. Let $E_1$ be the number of times the die shows a 1, 2 or 3. Let $E_2$ be the number of times the die shows a 4 or a 5. Find $P(E_1 = 2, E_2 = 1)$.
I have tried to solve this question this way:
Total $6P6 = 720$.
1,2 and 3 can be placed in $2$ locations $= 3^2$
4 and 5 can be placed in 1 location $= 2^1$
and 6 can be placed in two locations $= 2^2$
The probability is $= 72/720 = 0.1$
Is this correct?
• Please read this MathJax tutorial, which explains how to typeset mathematics on this site. – N. F. Taussig Sep 14 '18 at 13:00
Close. You are rolling 5 dice, not 6. And you are not looking to permute the numbers, you are looking to find the number of ways you can roll 5 dice. You need to permute the $E_1$ and $E_2$ events. If 6 can be in two locations, then you have $1^2$ ways of placing 6 in 2 locations. Next, you need to permute the multiset:
$$\{E_1\cdot 2, E_2 \cdot 1, 6\cdot 2\}$$
There are
$$\dfrac{5!}{2!1!2!}$$
ways to permute this multiset.
$$\dfrac{3^2\cdot 2^1\cdot 1^2 \cdot \dfrac{5!}{2!1!2!}}{6^5} = \dfrac{5}{72}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9683812336438725,
"lm_q1q2_score": 0.8048633239440589,
"lm_q2_score": 0.8311430415844384,
"openwebmath_perplexity": 149.90368242185488,
"openwebmath_score": 0.9044284224510193,
"tags": null,
"url": "https://math.stackexchange.com/questions/2916745/roll-a-die-probability-question"
} |
kinect, openni-launch
Title: openni_launch + USB 3.0 not working?
Hi guys,
Has anyone noticed that when you plug your Kinect to a USB 3.0 port "roslaunch openni_launch openni.launch" seems to be successful but there is no data published in any of the camera topics?
This happens to me with:
Ubuntu 12.04 64bit + Fuerte on Desktop PC
Ubuntu 12.04 64bit + Fuerte on Notebook PC (ASUS U24E)
Ubuntu 11.10 64bit + Electric on Notebook PC (ASUS U24E)
If I plug the Kinect to a USB 2.0 port on any of the previous combinations, it works correctly (though it is still a bit buggy on Ubuntu 12.04 + Fuerte).
Has anyone had the same issue? Any way to get it working on USB 3.0?
Thanks in advance.
Originally posted by Martin Peris on ROS Answers with karma: 5625 on 2012-05-10
Post score: 0
Take a look at this answer
Originally posted by Kevin with karma: 2962 on 2012-05-10
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 9337,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kinect, openni-launch",
"url": null
} |
quantum-mechanics, quantum-information, density-operator
There is something called the mixed product property which is
$$(A\otimes B)(C\otimes D)=(AC)\otimes(BD)$$
Consequently
\begin{align}
\rho_S^e|b_j\rangle&=(\rho_S\otimes I_B)(I_S\otimes|b_j\rangle_B)\\\\
&=(\rho_SI_S)\otimes (I_B|b_j\rangle_B)\\\\
&=(I_S\rho_S)\otimes (|b_j\rangle_BI_B)\\\\
&=(I_S\rho_S)\otimes (|b_j\rangle_B\cdot 1)\\\\
&=(I_S\otimes |b_j\rangle_B)(\rho_S\otimes 1)\\\\
&=|b_j\rangle\rho_S
\end{align} First of all, formally:
$$ \rho^e_S | b_i \rangle = (\rho_S \otimes I_B) (I_S \otimes |b_i\rangle_B) = (\rho_S I_S) \otimes (I_B |b_I\rangle_B) = \rho_S \otimes |b_i\rangle_B $$
Which is in fact the same as $|b_i\rangle \rho_S$.
The whole problem lies in the notation - I don't really know how to improve it though. Take a look for example here and realize that the partial trace is written as
$$ \sum_j \langle b_j | \rho |b_j\rangle $$
which looks like a scalar quantity at first glance, but is actually an operator acting on $S$ (since the $|b_j \rangle$ are not actually vectors). | {
"domain": "physics.stackexchange",
"id": 36209,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-information, density-operator",
"url": null
} |
22. anonymous
ok no problem
23. anonymous
$\lim_{x \rightarrow -10}(x^2 - 17x + 70/ x + 10)$
24. anonymous
when i attempt this...
25. anonymous
i get 140/0...so i take the factor and reduce approach
26. anonymous
and..
27. Mertsj
Yes factor and reduce
28. Mertsj
|dw:1326944396601:dw|
29. anonymous
(x+10)(x+7)/ (x+10)....x+7...-10+7= -3?
30. anonymous
i keep getting my signs wrong when i factor
31. Mertsj
It won't reduce. Did you copy it right?
32. anonymous
why couldnt it have been (x+10)(x+7)...it will also give you 70 right
33. Mertsj
Middle term is negative
34. anonymous
yeah thats right i remember now
35. Mertsj
Did you copy it right?
36. anonymous
what do you mean
37. anonymous
it does not exist
38. anonymous
i see that
39. Mertsj
Perhaps you wrote the problem down incorrectly
40. anonymous
yeah now i understand
41. anonymous
i have this next one...
42. Mertsj
Did you get that last one?
43. anonymous
yeah
44. Mertsj
What did you get?
45. anonymous
$\lim_{x \rightarrow 2}(x^2 - 4/2x^2 -5x + 2)$
46. anonymous
I got DNE (does not exist) my software accepted the answer
47. anonymous
how exactly would you factor the denominator in the previous problem. it is set up strangely for me
48. Mertsj
That one should factor and reduce.
49. Mertsj
(2x-1)(x-2)
50. anonymous
ok i was confused because i thought somehow it must add up to -5
51. Mertsj
So you end up with (x+2)/(2x-1)
52. anonymous
gotcha
53. anonymous
next is...
54. anonymous
$\lim_{x \rightarrow 4}(\sqrt{b+0}-2/b-4)$
55. anonymous
0/0
56. anonymous | {
"domain": "openstudy.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9706877675527112,
"lm_q1q2_score": 0.8269801579297551,
"lm_q2_score": 0.8519527963298946,
"openwebmath_perplexity": 4414.054416027701,
"openwebmath_score": 0.8179571032524109,
"tags": null,
"url": "http://openstudy.com/updates/4f178b5be4b0aeb795f58350"
} |
algorithms, complexity-theory, hash, rolling-hash
Title: How to use a worst case scenario in Rolling Hash: Rabin Karp Algorithm when the given string only contains the occurrences of "a and b?" Issue: I am having a hard time figuring out how to use the worst case for Rolling Hash, especially if the occurrences are only "a and b" for the string. Not only that but it is a bit of a hassle to figure out the process if the pattern that we tried to find from the given string will only contain one character occurrence, such as "bbbb".
How Rolling Hash is used in our class with a given formula and its process of solution:
Formulas:
Full document: https://drive.google.com/file/d/1vJr2UoFP7w2DFsJF9A5TmvHsoY9Zs3Iy/view?usp=sharing
The exercise problem that I am answering:
Given the following string and pattern. Determine the transition of the string comparison and hash value
when rolling hash or Rabin Karp algorithm is applied.
String = aabbaabbabbabababbbbbbaaaa
The following patterns that we need to find are:
1. bbbb
2. baaaa
3. bbab
My attempt for pattern "bbbb" by using the "String = aabbaabbabbabababbbbbbaaaa":
Not picture form:
String = aabbaabbabbabababbbbbbaaaa
Pattern:
1. bbbb
H(bbbb) = h(2 +2 +2 +2)= 8
= h( 2*103 + 2*102 + 2*101 + 2*100)
= 2000 + 200 + 20 + 2 = 2222 mod 113
= 75
String = aabbaabbabbabababbbbbbaaaa
H(aabb ) = h(1 + 1 + 2 + 2) = 6
= h(1*103 + 1*102 + 2*101 + 2*100)
= 1000 + 100 + 20 + 2 = 1122
String = aabbaabbabbabababbbbbbaaaa
H(abba) = H(aabb)6-1+1 = 6
= 1122 – 1*102 *10+ 1*100
= 1122 – 100 *10 + 1
= 1022 *10 + 1
= 10221 | {
"domain": "cs.stackexchange",
"id": 20373,
"lm_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, complexity-theory, hash, rolling-hash",
"url": null
} |
python, beginner, comparative-review, django
def Consultation(request) :
identity = Identity.objects.all().order_by("-id")[:10] #Les 10 dernières fiches créées
identity_France = Identity.objects.filter(country='64').order_by("-id")[:10] #Les 10 dernières fiches où la personne habite en France
query = request.GET.get('q')
if query :
toto = Identity.objects.filter(lastname__icontains=query)
else :
toto = []
context = {
"identity" : identity,
"identity_France" : identity_France,
"query" : query,
"toto" : toto,
}
return render(request, 'resume.html', context)
My accueil_identity.html looks like :
<h2 align="center"> Gestion des fiches individuelles </align> </h2>
<p> Veuillez cliquer sur l'opération à effectuer : </p>
<p> </p>
<p>* <a href="http://localhost:8000/Identity/formulaire">Créer une nouvelle fiche individuelle</a></p>
<p> * <a href="http://localhost:8000/Identity/recherche">Consulter/Editer une fiche individuelle</a></p>
<p> * Supprimer une fiche individuelle </p>
My form_identity.html file looks like :
<!--DOCTYPE html -->
<html>
<body>
<h1 align="center"> Formulaire de fiche individuelle </h1>
<form method='POST' action=''> {% csrf_token %}
<h3> Partie contenant les informations de la fiche individuelle </h3>
{{ form.as_ul }}
{{ value|date:"%d/%m/%Y" }}
<br></br> | {
"domain": "codereview.stackexchange",
"id": 23142,
"lm_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, comparative-review, django",
"url": null
} |
ros, std-msgs
Title: common-msgs vs std-msgs?
When various message handling packages like actionlib, navigation, sensor, geometry are included in the common_msgs stack, why is std_msgs package separated? How is std_msgs package different from the others mentioned above, for it to be excluded from the common_msgs stack?
Originally posted by sam26 on ROS Answers with karma: 231 on 2017-02-27
Post score: 1
I can only guess, but to me the following seems to be the rational behind it:
Description on std_msgs:
Contains minimal messages of primitive data types and multiarrays. Intended for quick prototyping, not production use.
The full explanation/discussion can be found on discourse.
EDIT
With semantics is meant that you can derive from the message name and the names of it fields what it transports. To give an example (stolen more or less from discourse ;-) ):
If you would like to send a temperature, you could just use a std_msgs/Float message. However, if you would inspect the message, it is not clear what this should be. Is it a temperature, and if yes in Celsius, Fahrenheit, ..., or rather air pressure or the distance to an object? All the messages says is it is a float and contains a field data.
If you however use a dedicated sensor_msgs/Temperature message, you are fairly certain that this should actually be a temperature and that this temperature should be in degree celsius (check the source for the full description).
Originally posted by mgruhler with karma: 12390 on 2017-02-27
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by gvdhoorn on 2017-02-27:
Msgs in std_msgs wrap primitive data types, but don't add any semantics. The msg pkgs in common_msgs do add semantics.
Comment by sam26 on 2017-02-27:
and by semantics , you mean ??
Comment by mgruhler on 2017-02-28:
see edit above.
Comment by sam26 on 2017-02-28:
That helped!! Thanks | {
"domain": "robotics.stackexchange",
"id": 27141,
"lm_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, std-msgs",
"url": null
} |
quantum-gate, pauli-gates
& = \cos(t) + i Z \sin(t)
\end{align}
$$
Thus, at $t = \pi / 2$, $e^{i Z t} = iZ$. Since $i$ is an example of a global phase, evolving under $Z$ for time $t = \pi / 2$ gives you the same unitary transformation as $Z$. Indeed, you can check the equivalence of the two matrices using QuTiP:
In [1]: import qutip as qt
In [2]: import numpy as np
In [3]: Z = qt.sigmaz()
In [4]: -1j * (1j * Z * np.pi / 2).expm()
Out[4]:
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True
Qobj data =
[[ 1. 0.]
[ 0. -1.]] | {
"domain": "quantumcomputing.stackexchange",
"id": 1251,
"lm_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-gate, pauli-gates",
"url": null
} |
quantum-mechanics, schroedinger-equation, hamiltonian
$$ N_+ ( 1 - e^{2 \pi i k} ) + N_- ( 1 - e^{-2\pi i k} ) = 0 .$$
This is true if either $N_+ = N_- = 0$ or both of the parenthesis are zero (actually only one of the parenthesis has to be zero, but if one is, then the other automatically is in this case). This gives the same possible values for $k$ as you had before.
Note also that you are not in general free to set both of $N_+$ and $N_-$ to any value since usually you would like to have the wave function normalized in some suitable manner. In this case you probably want to have the integration over the circle of $| \psi |^2$ to be unity. | {
"domain": "physics.stackexchange",
"id": 64530,
"lm_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, schroedinger-equation, hamiltonian",
"url": null
} |
machine-learning, r, text-mining, random-forest
Title: Text classification- What to do when train and test data have different features I am performing binary text classification. I have to classify a tweet 0 if neutral and 1 if hate speech.
So as general thumb rule i preprocessed my data. create term document frequency and After removing sparse terms i divide my data into train and test.
I train my model using random forest and logistic regression and it worked fine.
set.seed(123)
tweetRand = randomForest(label ~ ., data = train_sparse, importance=TRUE, nTree=500 )
randPridct = predict(tweetRand, newdata = test_sparse)
table(test_sparse$label,randPridct >=0.5)
Its is working fine on test data which divided from raw content.
But when i am running it on a new unseen data it is throwing an exception.
> predicrRand_test=predict(tweetRand, newdata=sparse_4testing)
Error in eval(predvars, data, env) : object 'run' not found
My understanding is that 'run' is a feature present in training but not in unseen test data and during my model training 'run' was included in tdm. In preprocessing of test , run was not in test tdm.
SO how should i deal with these situation. I am new to data science. Please help. It's perfectly fine to have different features in your training and testing partitions. If the two groups are randomly selected from the same population, one would expect, if there are many possible features, as is frequently the case in text classification, that differences would be observed. To handle this, the standard practice in the field is to train your model on the training partition, and then evaluate on the testing partition with any new features in that grouping being discarded. If you encounter the edge case of a test observation with no features after this procedure, it is common practice to use a heuristic to classify it, bypassing the model entirely (e.g., an observation with no features is classified as neutral). | {
"domain": "datascience.stackexchange",
"id": 3028,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, r, text-mining, random-forest",
"url": null
} |
convolutional-neural-network, graphs, gnn
G subgraph connections: S1 -> S2; S1 -> S3
X subgraph connections: S4 -> S5 -> S2; S5 -> S6
In general case X subgraph connections are not known, we only assume that X has S2 subgraph with a N3 node that we want to find. In this example X also has S4, S5, and S6 subgraphs that we don't care about. These subgraphs are used here just to illustrate a fact that X may be quite different from G.
Task: Find N3 node in X graph.
Is it possible to train Graph Convolutional Network (GCN) or GNN of another type to solve this problem in general?
Please, advise on direction of research to to solve this problem. Brief Answer
You are probably looking for sub graph matching algorithms to find a subgraph (e.g. S2) in the graph X. There are several graph theory algorithms and packages available for that and they do not need any training or Graph Convolutional Networks. Although you can also find such approaches if you really want to do the training.
More Details
As far as I understand the question, you are looking for one specific node (N3) in the graph X. In this case, you could extract a subgraph from G that contains N3 and all it's neighbors. I assume S2 is meant to be exactly this.
Given this setting, your task is to find the subgraph S2 in X where the node labels and the edges match.
A quick search gave me for example this link: https://stackoverflow.com/questions/15671522/networkx-subgraph-isomorphism-by-edge-and-node-attributes
When S2 is matched, it is easy to identify N3 in the match.
Choice of algorithms
Depending on the size of your problem, you might want to look for an exact matching (which definitely leads to graph theoretical algorithms). But if the size of S2 and X are large, you might prefer to look for an approximate algorithm (which can be both graph theoretical or machine learning based).
Restrictions / Variants | {
"domain": "datascience.stackexchange",
"id": 11392,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "convolutional-neural-network, graphs, gnn",
"url": null
} |
ros, turtlebot, ros-hydro, frontier-exploration
Originally posted by paulbovbel with karma: 4518 on 2014-10-29
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by charkoteow on 2014-10-30:
I am using two computers. One laptop on the bot and a pc as workstation. Ran all the essentials like turtlebot startup and kinect's packages on the laptop. All other nodes are on the pc.
I do get some tf error sometimes. All of it were kinect's tf. It flickers on RViz.
Updated the Q with tf frames
Comment by paulbovbel on 2014-10-30:
Try going through this
Comment by charkoteow on 2014-11-27:
[ WARN] [1417145721.905257930]: Costmap2DROS transform timeout. Current time: 1417145721.9052, global_pose stamp: 1417145721.3650, tolerance: 0.5000
[ WARN] [1417145722.105144612]: Could not get robot pose, cancelling reconfiguration
Comment by paulbovbel on 2014-11-28:
That is also a TF issue, likely cause by your multi-machine setup. Please open a separate question if you need more info about setting up your network properly. Main issues would be latency, and time synchronization.
Comment by RND on 2015-03-10:
Hi, I am having the exact same problem as described in this post but I'm not running on multiple workstations. I am running everything on one computer and i'm running the nodes separately by their own launch file (i.e. gmapping, move_base, TF from odom->base_link->laser, and exploration).
Comment by RND on 2015-03-10:
Also, I'm using gmapping to provide the map->odom transform and of course to build the map.
Comment by paulbovbel on 2015-03-10:
I doubt it's the exact same problem, since @charkoteow's issue was extremely post-dated timestamps. Either way, please open a new question, and provide some more information. | {
"domain": "robotics.stackexchange",
"id": 19877,
"lm_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, turtlebot, ros-hydro, frontier-exploration",
"url": null
} |
The same argument for $k=3$ was used here.
Or you can look at your problem the other way round: If you prove this result about finite sums
$$\sum_{j=1}^n j(j+1)\dots(j+k-1)= \frac{n(n+1)\dots{n+k-1}}{k+1},$$
you also get a proof of the identity about binomial coefficients.
For a fixed non-negative $k$, let $$f(i)=\frac{1}{k+1}i(i+1)\ldots(i+k).$$
Then $$f(i)-f(i-1)=i(i+1)\ldots(i+k-1).$$
By telescoping,
$$\sum_{i=1}^ni(i+1)(i+2)\dots(i+k-1)=\sum_{i=1}^n\left(f(i)-f(i-1)\right)=f(n)-f(0)=f(n)$$
and we are done.
I asked exactly this question a couple of days ago, here:
Telescoping series of form $\sum (n+1)\cdot…\cdot(n+k)$
My favourite solution path so far is
$$n(n+1)\cdot…\cdot(n+k)/(k+1)$$ | {
"domain": "bootmath.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9881308796527184,
"lm_q1q2_score": 0.8856136522479344,
"lm_q2_score": 0.8962513675912912,
"openwebmath_perplexity": 421.3720734986149,
"openwebmath_score": 0.924735426902771,
"tags": null,
"url": "http://bootmath.com/finding-a-closed-formula-for-1cdot2cdot3cdots-k-dots-nn1n2cdotskn-1.html"
} |
• Comments are not for extended discussion; this conversation has been moved to chat. Apr 15, 2021 at 22:46
What follows from the MVT is that for every $$x \neq x_0$$ there exists $$\xi$$ such that $$x < \xi < x_0$$ (if $$x < x_0$$) or $$x_0 < \xi < x$$ (if $$x_0 < x$$) and such that $$\frac{f(x) - f(x_0)}{x - x_0} = f'(\xi).$$
But you want to write an equation with $$\lim_{x\to x_0} f'(\xi)$$, not just $$f'(\xi)$$, on the right-hand side. Can we do that? What does it mean?
I suppose with some additional mechanism (axiom of choice?) we might conclude that not only is there a suitable $$\xi$$ for every $$x \neq x_0,$$ but there is a suitable function $$x \mapsto \xi(x)$$ on $$\mathbb R \setminus\{x_0\}$$ such that $$\frac{f(x) - f(x_0)}{x - x_0} = f'(\xi(x))$$ for all $$x \neq x_0.$$ And now we can write
$$\lim_{x\to x_0} \frac{f(x) - f(x_0)}{x - x_0} = \lim_{x\to x_0} f'(\xi(x)).$$
But your suspicions about the third equation are still good. If the function $$x \mapsto \xi(x)$$ were a continuous function, we could conclude that
$$\lim_{x\to x_0} f'(\xi(x)) = \lim_{\xi\to x_0} f'(\xi).$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9416541593883189,
"lm_q1q2_score": 0.8077209004307669,
"lm_q2_score": 0.8577681013541611,
"openwebmath_perplexity": 80.96758952931077,
"openwebmath_score": 0.9359080791473389,
"tags": null,
"url": "https://math.stackexchange.com/questions/4102701/erroneous-proof-that-derivative-of-function-is-always-continuous"
} |
ros, navigation, uav, obstacle-avoidance, rosserial
Title: Arduino with navigation stack
Is it possible to launch the robot_configuration.launch file with arduino for the Navigation Stack usage? If yes, how? Rosserial_arduino?
My arduino is used for all the UAV controls. I am unsure of what to add in the robot_configuration launch file. From my senior's report, they mentioned that there's no odom for UAV but navigation stack requires it for the local_planner. So, I hope to gather some guidance from here as I am quite confused.
Originally posted by Edward Ramsay on ROS Answers with karma: 65 on 2013-06-20
Post score: 3
I think you got the spirit. By now the best way to use the navigation stack (which need lot of computacional resources) is by runing it on a computer and just passing command to the robot_base (which is commanded by the arduino).
So you should run rosserial on the arduino and make it subscribe the cmd_vel messages, also if you have wheel encoders or
other type of sensor you could plug it on arduino and publish its info to ros.
You should check http://wiki.ros.org/rosserial_arduino/Tutorials.
Originally posted by Henrique with karma: 68 on 2016-11-13
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 14646,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, navigation, uav, obstacle-avoidance, rosserial",
"url": null
} |
general-relativity, differential-geometry, metric-tensor, astronomy, geodesics
Physics
You might still be wondering, but what initial conditions do I set? The problem is that there's no such thing as the initial conditions. This has nothing to do with GR. Suppose, for example, that you have an old wooden floor. Moisture has gotten everywhere, so that the floor is all bumpy, higher in some places and lower in others. Now you ask: "if I roll a ball on this floor, what will its path be?". Well, we can't answer that. We're missing information: where you throw the ball from, and in which direction. The ball can take all kinds of possible paths.
The same is true in your spacetime. It's neither homogeneous nor isotropic, so the path of a photon depends on where (and when) you shot it from, in addition to its direction. You might be getting confused because the examples we first learn have a lot of symmetry. If we take for example the Schwarzschild solution, which is stationary and spherically symmetric, we can eliminate a lot of degrees of freedom, and the result is that a photon really only has two: the initial radius and the angular momentum (or impact parameter). Changing any of the other initial conditions just gives a rotated and/or time translated version of the trajectory. This is not the case here; without symmetries, all six numbers are necessary.
The only answer I can give is that you need to define better why you want to integrate the equations. Are you trying to get a feel for possible photon paths? Then your best bet is to pick a few different values and see what happens. | {
"domain": "physics.stackexchange",
"id": 56316,
"lm_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, differential-geometry, metric-tensor, astronomy, geodesics",
"url": null
} |
bond, electrons, covalent-compounds
So, what happens is that the overall set of plus-and-minus forces of the two atoms is trying really hard to crush all of the charges down into a single very tiny black hole -- not into some stable state! It is only the hissing and spitting of the overcrowded and very unhappy electrons that keeps this event from happening.
Orbitals as juggling acts
But just how does that work?
It's sort of a juggling act, frankly. Electrons are allowed to "sort of" occupy many different spots, speeds, and spins (mnemonic $s^3$, and no, that is not standard, I'm just using it for convenience in this answer only) at the same time, due to quantum uncertainty. However, it's not necessary to get into that here beyond recognizing that every electron tries to occupy as much of its local $s^3$ address space as possible.
Juggling between spots and speeds requires energy. So, since only so much energy is available, this is the part of the juggling act that gives atoms size and shapes. When all the jockeying around wraps up, the lowest energy situations keep the electrons stationed in various ways around the nucleus, not quite touching each other. We call those special solutions to the crowding problem orbitals, and they are very convenient for understanding and estimating how atoms and molecules will combine.
Orbitals as specialized solutions
However, it's still a good idea to keep in mind that orbitals are not exactly fundamental concepts, but rather outcomes of the much deeper interplay of Pauli exclusion with the unique masses, charges, and configurations of nuclei and electrons. So, if you toss in some weird electron-like particle such as a muon or positron, standard orbital models have to be modified significantly and applied only with great care. Standard orbitals can also get pretty weird just from having unusual geometries of fully conventional atomic nuclei, with the unusual dual hydrogen bonding found in boron hydrides such as diborane probably being the best example. Such bonding is odd if viewed in terms of conventional hydrogen bonds, but less so if viewed simply as the best possible "electron juggle" for these compact cases.
"Jake! The bond!"
Now on to the part that I find delightful, something that underlies the whole concept of chemical bonding. | {
"domain": "chemistry.stackexchange",
"id": 8139,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bond, electrons, covalent-compounds",
"url": null
} |
java, beginner, game, swing, number-guessing-game
Title: Guess a number game with mines version 3 I'm still new to Java and learning programming, so my main goal is to learn to making good code, so I don't want to do anything complex until I fix all of my bad coding habits on smaller programs.
So, this is my third version of this program, you can find last one here and here is where I started. I wanted to expand the game with few extra features. First one is that it now has interface, also, player can get points when he plays and base on how much points he has, he can play different levels of the game.
Also, username and points are saved to text file, first I wanted to use same text file for that but updating points in that looks quite complicated so I thought this is better way since I only have this to informations I want to store, so maybe I'll do that in next version if it's better or maybe there is better way of storing/updating points?
I'm not sure if I'm using communication between two classes (player and game) as I should, it's something I should look more into.
Main.java
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
Game game = new Game();
Player player = new Player();
game.options(player);
}
}
Game.java
import java.io.IOException;
import java.util.concurrent.ThreadLocalRandom;
import javax.swing.JOptionPane;
public class Game {
private int min=1;
private int max;
private int numberOfMines;
private int randomNumber;
int mine[] = new int[20];
private int userGuess;
int option = 0;
public int promptForInteger(String messageText) {
String askBoxes = JOptionPane.showInputDialog(messageText);
int number = 0;
if(askBoxes == null) {
System.exit(0);
} else {
try {
number = Integer.parseInt(askBoxes);
} catch(NumberFormatException e) {
JOptionPane.showMessageDialog(null, "Value must be number!");
}
}
return number;
} | {
"domain": "codereview.stackexchange",
"id": 20920,
"lm_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, beginner, game, swing, number-guessing-game",
"url": null
} |
acid-base
Title: How are CH3COOH molecules ionisied into H+ and CH3OO- It's written in my chemistry book ,under weak acids, that the molecules of organic acids are partially ionised in water into ions. But I don't understand how molecules are ionised.
I'm an ol student. The $\ce{O}$ atom in the $\ce{O-H}$ bond is more electronegative than $\ce{H}$ atom leading to a slight shift of the electron density towards the $\ce{O}$ atom and the development of a small negative charge, $\delta-$ on oxygen atom and $\delta+$ on hydrogen atom.
Now, a water molecule also has an oxygen atom which attracts some electron density towards itself from the two hydrogen atoms on it's sides causing $2\delta-$ charge on itself and a $\delta+$ each on both the hydrogen atoms.
This $2\delta-$ charge having $\ce{O}$ atoms of the water molecules surround and attract the $\ce{H}$ atoms of $\ce{O-H}$ bond of $\ce{CH3COOH}$ molecules due to the $\delta+$ charge on them. The hydrogen atoms of water in turn surround and attract the $\ce{O}$ atom of the $\ce{O-H}$ bond of $\ce{CH3COOH}$ molecules.
This attraction leads to separation of the $\ce{O-H}$ bond releasing $\ce{H+}$ and $\ce{CH3COO-}$ ions with a shell of water molecules surrounding both of these ions and stabilising them. | {
"domain": "chemistry.stackexchange",
"id": 13217,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "acid-base",
"url": null
} |
# Area of Polar Graph
1. May 10, 2014
### _N3WTON_
1. The problem statement, all variables and given/known data
Find the area of the region.
Interior of: r = 2 - sin(b)
2. Relevant equations
A = 1/2 ∫ (r)^2 dr
3. The attempt at a solution
I really don't have any idea how to approach this problem. I don't understand how to determine my limits of integration. The only part of the problem I have accomplished is finding that b = arcsin(2). Also, I have found that the graph of this equation makes a convex limacon.
2. May 10, 2014
### Staff: Mentor
You should be able to figure out the integration limits from the graph. You could integrate from b = 0 to b = $2\pi$. Alternatively, you could integrate from b = $\pi/2$ to b = b = $3\pi/2$ and double that result.
3. May 10, 2014
### _N3WTON_
ok so would my equation look something like ∫ [(1-sin(b))^2 db] with the limits of integration going from 0 to 2pi?
4. May 10, 2014
### vanhees71
Looks good, provide $b$ is the polar angle. Why don't you use LaTeX for typesetting formulas? It's no big deal to type it and it makes everything much easier to read and understand!
5. May 10, 2014
### _N3WTON_
I don't know how to use latex, nor do I know where to find it....sorry
6. May 10, 2014
### _N3WTON_
Ok, I am confused about this problem now. The website for my calculus textbook offers a 24/7 tutoring service. When I asked the tutor about this problem he said I could not integrate from 0 to 2pi; however, he was also not sure how to do the problem. So can I safely assume that he was wrong about being unable to integrate from 0 to 2pi?
7. May 10, 2014
### vanhees71 | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9711290955604489,
"lm_q1q2_score": 0.8384647081879216,
"lm_q2_score": 0.8633916047011595,
"openwebmath_perplexity": 678.7908761486796,
"openwebmath_score": 0.7194979786872864,
"tags": null,
"url": "https://www.physicsforums.com/threads/area-of-polar-graph.753074/"
} |
vba, excel, rubberduck
Public Function IAssetTableProxy_GetAssetTableData() As Variant()
'Replace Sheet1 with the actual code name of the worksheet.
IAssetTableProxy_GetAssetTableData = Sheet1.ListObjects(TABLE_NAME).DataBodyRange.value
End Function
Nitpick - I would remove the underscores in your test names (i.e. GivenAssetInTable_GetTicker()). The underscore has special meaning in VBA for procedure names - it's treated as kind of an "interface or event delimiter". This is probably our fault (as in Rubberduck's - I'm a project contributor) in that the "Add test module with stubs" used to do this when it was naming tests. This has been corrected in the current build, and TBH I'd like to see an inspection for use of an underscore in a procedure name that isn't an interface member or event handler (but I digress). The main take-away here is that when you see an underscore in a procedure name, you shouldn't need to ask yourself if it has meaning outside the name.
Another nitpick - there's no reason to Set assetTbl = Nothing in ModuleCleanup(). The reason that the Assert and Fakes are explicitly set to Nothing has to do with the internal architecture of Rubberduck's testing engine. In your case it doesn't matter in the least if the reference to your IAssetTableProxy isn't immediately freed.
Specifically regarding your third question. The reason Rubberduck suggests not using Option Base 1 is that it is a per module option that overrides the default array base of the language. If you specify the lower bound like you do here...
Option Explicit
Option Base 1
Implements IAssetTableProxy
Public Function IAssetTableProxy_GetAssetTableData() As Variant()
Dim twoDArr(1 To 3, 1 To 3) As Variant
'...
IAssetTableProxy_GetAssetTableData = twoDArr
End Function | {
"domain": "codereview.stackexchange",
"id": 33754,
"lm_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, rubberduck",
"url": null
} |
dna, gene-expression
Title: Complexity in creating transgenic animals (e.g., mice) Many papers I have seen describing transgenic rodent models (and presumably applicable to other model organisms) involve the knock-in, or modification to, a single gene, possibly two genes. With respect to recombineering techniques, what prevents targeting multiple genes in a single organism? For instance, if I wanted to simultaneously knock-in some genes and knock-out others within the same mouse, would I be forced to generate individually modified transgenic lines and then do some "fancy" breeding to generate the multiple-modified mice? One reason is the low likelihood of success. Modifying a gene almost always involves a recombination event of plasmid DNA with a target site in the genome (and I say almost just because there may be some method that I don't know about, but all the ones I'm familiar with do). The likelihood of that decreases exponentially with the number of genes you're trying to modify. If you're trying to make several mutants of individual genes the likelihood of success decreases only linearly.
Another reason is having more knowledge and experimental power. You can learn little from a double mutant if you don't also have the individual mutants to compare. In fact, most reviewers would ask for individual mutant data if you've made a double mutant in your paper. This is especially true with flies and worms, as crosses take less time with them.
Also, the more mutant genes you have, the weaker the animal. Your mutants may not be viable at all with too many mutations. | {
"domain": "biology.stackexchange",
"id": 4423,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dna, gene-expression",
"url": null
} |
Observe that any rational number r can be written as p 2 pr 2 I We already proved p 2 is irrational. Considerthe number M = N + 1. This is also known as proof by assuming the opposite. Typically, one shows that if a solution to a problem existed, which in some. No possible constant value for x exists to make this a true equation. That is, suppose there is an. Another way to write is using its equivalence, which is Example: Given A and B are sets satisfying. Compared to a proof of contradiction you have the advantage that the goal is clear. 4 Proof by contradiction The idea of contradiction method is by showing is a contradiction of the statement , that is a tautology. Proof: This is easy to prove by induction. Proof by contradiction is often used when you wish to prove the impossibility of something. This also applies ifthe result is goingto beproven using mathematical induction. fn and fn+1 that have a common divisor d, where d is greater than 1. A z° x° y° 100° B O Solution Theorem 1 gives that z = y = 50 The value of x can be found by observing either of the following. To prove p, assume ¬p and derive a contradiction such as p ∧ ¬p. Give a proof by contradiction: prove that the square root of 2 is irrational. Valid Argument: 1. If x 2A B then x 2A (and not in B). ] Assume, to the contrary, that ∃ an integer n such that n 2 is odd and n is even. Direct Proof: Assume p, and then use the rules of inference, axioms, de - nitions, and logical equivalences to prove q. Use proof by contradiction to show that if n2 is an even integer then n is also an even integer. Inequalities 10 7. A logical contradiction is the conjunction of a statement S and its denial not-S. Any proof does. Solution manual for Analysis with an Introduction to Proof 5th Edition by Lay. If x 2A B then x 2A (and not in B). We have to prove 3 is irrational Let us assume the opposite, i. These solutions use information found in pages 154 - 160 of the textbook. The (Pedagogically) First Induction Proof 4 3. Math 2150 Homework 12 Solutions Throughout, use ONLY the assumptions given in the online notes and/or examples given in the online notes | {
"domain": "chicweek.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9852713887451681,
"lm_q1q2_score": 0.8506750575164101,
"lm_q2_score": 0.863391617003942,
"openwebmath_perplexity": 395.13846022461126,
"openwebmath_score": 0.7791018486022949,
"tags": null,
"url": "http://bgvl.chicweek.it/proof-by-contradiction-examples-and-solutions.html"
} |
php
//Let's say this is data grabbed from a database...
$users = array('asdf', 'Peter', 'Peter2', 'George');
$valid = 'true';
foreach($users as $user) {
if( strtolower($user) == $request )
$valid = 'false';
}
echo $valid;
?> There seems to be a fair amount of paranoia in your code:
function salt() {
mt_srand(microtime(true)*100000 + memory_get_usage(true));
return md5(uniqid(mt_rand(), true));
}
here mt_srand(microtime(true)*100000 + memory_get_usage(true)); is unused. If you consider using it, you should simplify it, you don't get a better salt that way.
$password = sha1(sha1($_POST['password'] . $salt));
Here you hash the password + salt twice. That doesn't provide for any more security, than simply hashing it once. Not to mention that your salt is already hashed, which is also redundant.
And what's with the individual salts? That's actually not a very good idea, you shouldn't store the hashed password and the salt in the same storage. If someone get's access to your database, she has everything she needs for a common brute force attack. It would be a little more secure if you simply had a variable somewhere with a common salt for every password. Although I'm not advocating security through obscurity, separating hash from salt would be saner.
if (strlen($_POST['username']) < 3 || strlen($_POST['username']) > 20)
It would be better to do something like:
$lengthUsername = $_POST['username'];
if (lengthUsername < 3 || lengthUsername > 20) { | {
"domain": "codereview.stackexchange",
"id": 927,
"lm_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
} |
deep-learning, data-mining, bigdata, pca
Title: What is the difference between observation and variable? I have a matrix with size m×n that is built from n number of individuals for person identification. So, n is the number of person and m is the number of feature's value for the person.
It makes me confused about observation and variables. What will I call n and m? Which one represents observation and which one represents variable? My confusion will be cleared to you if you visit the following link: How to do SVD and PCA with big data? In your case, 'n' is the number of observations, and 'm' is the number of variables. Think of a table in a database - each row is a 'record', and each record has various properties. A record corresponds to an observation. Each property is a variable or property of that observation.
In some contexts people make a distinction between data (i.e. observations, things observed) and variables (parameters to learn - things that vary in a mathematical sense). But in the context of the link you sent, a variable is a feature. | {
"domain": "datascience.stackexchange",
"id": 2246,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning, data-mining, bigdata, pca",
"url": null
} |
ros, libuvc-camera
Title: libuvc_camera Can't Make instalation or Give Camera ID Values to prebuilt Instalation
Hi ROS Answers,
I wanted to see, could I get some help with using the libuvc_camera package? My end goal is to get a setup where I am publishing image data from two webcams (or a stereo topic using the two cameras).
I have been trying two methods of installing the libraries, both having issues. In the first I can't run make my custom installation and in the second I can't give the needed camera ID values for my installation I got with apt-get.
First, I did the typical create a workspace, clone the repository, and then ran catkin_make. However this caused a problem where configuration files could not be found, with the terminal output being:
CMake Error at libuvc_ros/libuvc_camera/CMakeLists.txt:9 (find_package):
By not providing "Findlibuvc.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "libuvc", but
CMake did not find one.
Could not find a package configuration file provided by "libuvc" with any
of the following names:
libuvcConfig.cmake
libuvc-config.cmake
Add the installation prefix of "libuvc" to CMAKE_PREFIX_PATH or set
"libuvc_DIR" to a directory containing one of the above files. If "libuvc"
provides a separate development package or SDK, be sure it has been
installed.
I then downloaded dependencies and made the files again, this just gave me a long list of errors ending with:
Invoking "make -j4 -l4" failed
So second, I removed the installation and installed the package directly with:
sudo apt-get install ros-indigo-libuvc-camera
This got the package successfully, but in trying the next step on the package main page
$ sudo -E rosrun libuvc_camera camera_node vendor:=... | {
"domain": "robotics.stackexchange",
"id": 25906,
"lm_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, libuvc-camera",
"url": null
} |
javascript, ajax, ecmascript-6, promise, azure
const output = [{"faceId":"950c26ae-70f0-4365-8279-fcd987f56e70","faceRectangle":{"top":75,"left":32,"width":117,"height":117},"faceAttributes":{"gender":"male","age":37.0,"emotion":{"anger":0.0,"contempt":0.0,"disgust":0.0,"fear":0.0,"happiness":0.007,"neutral":0.992,"sadness":0.0,"surprise":0.0}}}];
const p1 = new Promise(function(resolve, reject) {
setTimeout(resolve, 100, output);
});
p1.then(console.log); | {
"domain": "codereview.stackexchange",
"id": 30781,
"lm_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, ajax, ecmascript-6, promise, azure",
"url": null
} |
= \log_{117}\left(x^2\right) - \log_{117}(4)$$, which simply isn't true, in general. The unwritten\footnote{The authors relish the irony involved in writing what follows.} property of logarithms is that if it isn't written in a textbook, it probably isn't true. | {
"domain": "libretexts.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9923043510009422,
"lm_q1q2_score": 0.8112827055835646,
"lm_q2_score": 0.817574471748733,
"openwebmath_perplexity": 294.58621971176433,
"openwebmath_score": 0.9743414521217346,
"tags": null,
"url": "https://math.libretexts.org/TextMaps/Precalculus_TextMaps/Map%3A_Precalculus_(Stitz-Zeager)/6%3A_Exponential_and_Logarithmic_Functions/6.2%3A_Properties_of_Logarithms"
} |
quantum-field-theory, conservation-laws, gauge-theory, noethers-theorem, color-charge
Title: In nonabelian gauge theory, does the ordinary or covariant derivative go into the statement of current conservation? Before equation (77.35), Srednicki's QFT book says
We define the chiral gauge current $j^{a\mu}$ [where $a$ is a color index]. Its covariant divergence (which should be zero, according to Noether's theorem) is given by $D_\mu^{ab} j^{b\mu}$ ...
But below this answer, user ACuriousMind comments
I see no reason at all why Noether's theorem would yield a covariant derivative acting on the conserved current, since the conserved currents follow from Noether's first theorem applied to the global version of the symmetry and are unrelated to the gauge theory (Noether's second theorem for gauge symmetries yields off-shell identities unrelated to conservation), and the sentence in Srednicki mystifies me.
It seems clear to me that the four-divergence that enters into the statement of charge conservation should be gauge-covariant, so Srednicki is right and we need to use the covariant derivative. But I suppose it's logically possible that despite not transforming covariantly, the expression $\partial_\mu j^{a \mu}$ could vanish on-shell in every gauge (which ACuriousMind presumably believes to be the case?). Who's right? We are both right!
Following AccidentalFourierTransform's suggestion in the comments, Weinberg's "Quantum Theory of Fields, Vol. II" indeed provides the relevant explanation for the discrepancy between the ordinary conservation of the Noether current in a gauge theory by applying Noether's theorem to the global version of the gauged symmetry and the covariant conservation claimed by Srednicki. | {
"domain": "physics.stackexchange",
"id": 41949,
"lm_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, conservation-laws, gauge-theory, noethers-theorem, color-charge",
"url": null
} |
mass, charge
Title: To calculate the ratio of the strength of the electromagnetic and gravitational force which mass is needed? Obviously, mass comes in elementary chunks, like all elementary charges (electric, color, and assumed weak). All elementary particles have an inherent mass. Unlike charges though, these masses are not rational multiples of one another (which is why I think they are not truly elementary, but that's another question). In calculating the ratio between the electric and gravitational force one usually calculates this by reference to two electrons. See for example this question. The ratio, in this case, is about $10^{42}$. Dirac used for this ratio a proton and an electron, which gives about $10^{39}$. See this video, in which he explains his large number hypothesis: in Natural units, the age of the universe is about $10^{39}$ too, from which he (in my eyes wrongly) concludes that at the beginning of the universe gravity was much stronger (or the electric force weaker?).
But why don't use the mass of one of the quarks? Or that of a neutrino? Or even a photon? What is the real ratio? It's clear that is a large number.
Can we even compare the strengths of two fundamentally different kinds of interaction (one mediated by spacetime curvature and one by part particle exchange)? When you are dealing with ratios on the order of $10^{42}$, does it really matter if you use $m_e$ or $M_p$? (on the order of $10^3$)?
The reason to not use proton/anti-proton is two-fold: we don't make bound states of them, and, they interact strongly.
Quarks are even worse, as they don't exist in a free-state. Nevertheless, you could consider the energy required to hold $udd$ together with-in a range of 1.7 fm (the nucleon diameter), and then compare that with the mass of neutron minus the small quark masses. | {
"domain": "physics.stackexchange",
"id": 79240,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mass, charge",
"url": null
} |
Some of the worksheets for this concept are Concept 15 pythagorean theorem, Using the pythagorean theorem, The pythagorean theorem the distance formula and slope, Chapter 9 the pythagorean theorem, Length, Distance using the pythagorean theorem, The pythagorean theorem date period, Pythagorean … Objects Form a Set: State, whether the following objects form a set or not by giving reasons.. point (9,8). This Distance Formula could also be used as an alternative, or an extension. Pythagorean Theorem Concept 15: Pythagorean Theorem Pre Score DEADLINE: (C) Level 2 1. x��][���~�_я#,����}X۱ ��A+�#�)�8��[d�Rd�O�>�3�b�@>S����W�b�����':}s��˛�ZډS�5W��'���LFh¬�^�������o_�����W�͂�ۯ~���������?�F}��g?�|~�7��0��ؤQLMFIb��^?�|����w�'J��ӯ�0)J�3������Va��7���RA'�P*:*4�V_�ciɾ��%4���7�/��\$RsϾ��í �r�_�z����^}������6|0�o~z�n����+��X���l��? Displaying top 8 worksheets found for - Coordinate Plane And Word Problems. endobj Which of the line segments and has the greatest length? << If the distance between the two points (,0) and (−+1,0) is 9, find all possible values of . Some of the worksheets for this concept are Find the distance between each pair of round your, Name distance between points, Distance formula work, Coordinate geometry, Lesson 7 distance on the coordinate plane, The distance formula date period, Concept 15 pythagorean theorem, The pythagorean theorem … You can obtain the equation for finding the distance from the Pythagorean theorem. /Pages 1 0 R in a coordinate system of origin (0,0). Pythagorean Theorem Formula. The formula above is known as the distance formula. /Author (Math\055Drills\056com \055\055 Free Math Worksheets) Consider the two points (,) and (,). /Resources 40 0 R distance from to , find the coordinates of Complete 2 of the following tasks IXL Practice Worksheets Creating O.1, O.2, (8th) At Least to 80 Score | {
"domain": "drum-tech.pl",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9916842225056002,
"lm_q1q2_score": 0.8543738440901447,
"lm_q2_score": 0.8615382040983515,
"openwebmath_perplexity": 776.8362653751947,
"openwebmath_score": 0.5107263922691345,
"tags": null,
"url": "http://drum-tech.pl/c8r9nrkr/13b558-pythagorean-theorem-distance-on-coordinate-plane-worksheet"
} |
differential-geometry, metric-tensor, differentiation
When using Einstein sum convention, you have to be careful to pair only two indices at most, one co- with one contravariant. I.e. every index letter should be at most twice in a term. Thus, instead try $$(\gamma^{DB}\gamma_{CD}),_B = \gamma^{DB},_B \gamma_{CD} + \gamma^{DB} \gamma_{CD},_B = 0.$$ Here, the B and D index are used twice, so we are fine. By raising index with $\gamma^{AC}$ we obtain the desired result: $$\gamma^{AB},_B + \gamma^{AC}\gamma^{BD}\gamma_{CD},_B=0.$$
I hope this answeres your question! | {
"domain": "physics.stackexchange",
"id": 64154,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "differential-geometry, metric-tensor, differentiation",
"url": null
} |
) 3 as given regarding. Know information about both set A to A are _____.. Answer/Explanation combinations that A function:., because the codomain coincides with the range by School ; by Title. Let A be the set { 1, 2, 3, …, n to! May need to show that B 1 = B, then it is known as correspondence! There are four possible injective/surjective combinations that A function f:... cardinality is the image of most. Ip: 198.27.67.187 • Performance & security by cloudflare, Please complete the security check Access. Textbook ; by Literature Title t be confused with one-to-one functions, bijective functions from Chrome. ( D ) 2108 when there are similar functions where 3 is replaced by some other number t be with..., 2, 3, …, n ) to itself when A contains 106 elements Paper... Into different elements of A has different images in B and have both conditions to able... Show that B 1 = B 2 elements of B is: one to one and or. This can be formed ) 3 full fill the criteria for the bijection an one to and! //Goo.Gl/9Wzjcw number of bijective function - if A & B are bijective then of surjective functions you... 2 22 Hasse diagram are drawn A number of bijective functions from a to b ordered sets may need to know information about both A! Refer Your Friends ; Earn Money ; become A Tutor ; Apply Scholarship... Set does not full fill the criteria for the bijection A set ; become A Tutor ; Apply Scholarship! Sets A and B are finite sets with |A| = |B| = n, then it not. Its range security check to Access type of inverse it has Bis bijective if it takes different elements of have. Row are surjective, bijective ) of functions, you need to know about. Pulled along the ground away from the Chrome web Store A ∈ A such that what. | {
"domain": "wstarcorp.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9648551535992067,
"lm_q1q2_score": 0.8181660599032922,
"lm_q2_score": 0.8479677564567913,
"openwebmath_perplexity": 502.70557738928767,
"openwebmath_score": 0.7554490566253662,
"tags": null,
"url": "https://www.wstarcorp.com/blog/k292q/article.php?747265=number-of-bijective-functions-from-a-to-b"
} |
javascript, node.js, ecmascript-6, asynchronous, cache
mapping.set(key,ctrFound);
callback(res);
inFlightMissCtr--;
mappingInFlightMiss.delete(key);
};
// if old data was edited, send it to data-store first, then fetch new data
if(bufEdited[ctrFound] == 1)
{
if(aType == aTypeGet)
bufEdited[ctrFound] = 0;
// old edited data is sent back to data-store
saveData(oldKey,oldVal,function(){
if(aType == aTypeGet)
loadData(key,evict);
else if(aType == aTypeSet)
evict(value);
});
}
else
{
if(aType == aTypeSet)
bufEdited[ctrFound] = 1;
if(aType == aTypeGet)
loadData(key,evict);
else if(aType == aTypeSet)
evict(value);
}
}
};
this.getAwaitable = function(key){
return new Promise(function(success,fail){
me.get(key,function(data){
success(data);
});
});
}
this.setAwaitable = function(key,value){
return new Promise(function(success,fail){
me.set(key,value,function(data){
success(data);
});
});
}
// as many keys as required can be given, separated by commas
this.getMultiple = function(callback, ... keys){
let result = [];
let ctr1 = keys.length;
for(let i=0;i<ctr1;i++)
result.push(0);
let ctr2 = 0;
keys.forEach(function(key){
let ctr3 = ctr2++;
me.get(key,function(data){
result[ctr3] = data;
ctr1--;
if(ctr1==0)
{
callback(result);
}
});
});
}; | {
"domain": "codereview.stackexchange",
"id": 42159,
"lm_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, node.js, ecmascript-6, asynchronous, cache",
"url": null
} |
python, rock-paper-scissors
again = input("Type y to play again, anything else to stop: ")
print() Remove Redundant Parenthesis
In this line:
while (again == 'y'):
The parenthesis are unneeded and can (should) be removed.
Use a dict to drive the stacked if/else
Whenever I see a stacked if/else I look to restructure the code using a dict (mapping) instead.
The net results of the if/else structure in your code can be put into a dict like so:
results = {
"rock": {
"rock": "The game is a draw",
"paper": "Player 2 wins!",
"scissors": "Player 1 wins!",
},
"paper": {
"rock": "Player 1 wins!",
"paper": "The game is a draw",
"scissors": "Player 2 wins!",
},
"scissors": {
"rock": "Player 2 wins!",
"paper": "Player 1 wins!",
"scissors": "The game is a draw",
},
}
If the results are mapped this way, then the interactions with the user becomes more clear and
your loop can simply become:
while again == 'y':
p1 = input("Player 1 --> Rock, Paper, or Scissors? ").lower()
print()
p2 = input("Player 2 --> Rock, Paper, or Scissors? ").lower()
print()
result = results.get(p1, {}).get(p2, "Invalid input, try again")
print(result)
again = input("Type y to play again, anything else to stop: ")
print()
This is an example of separating the UI (User Interface) from the Business Logic. | {
"domain": "codereview.stackexchange",
"id": 41106,
"lm_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, rock-paper-scissors",
"url": null
} |
c#, error-handling, task-parallel-library
show a loading box if stage hasn't completed within a certain timeout (set a timeout inside UI control);
add a progress notification support to MyDerivedClass so that it can notify clients about its progress (using an IProgress interface specifically designed for asynchronous progress notification).
I'll use the first option in my example as it requires less changes to my previous code:
Business logic:
public async Task ProgramImageAsync()
{
await Task.Delay(TimeSpan.FromSeconds(5)); // Actual programming is done here
throw new DivideByZeroException("test");
}
UI:
private async void RunLongUIPreparation()
{
var processor = new YourClassContainingProgramImageAsync();
try
{
Task stageTask = processor.ProgramImageAsync();
ShowLoadingBoxIfRunningTooLong(stageTask);
await processor.ProgramImageAsync();
}
catch (DivideByZeroException exception)
{
//TODO: Show messagebox with warning here
}
}
private async void ShowLoadingBoxIfRunningTooLong(Task stageTask)
{
await Task.Delay(TimeSpan.FromMilliseconds(100));
if (stageTask.IsCompleted)
return;
try
{
this.ShowLoadingBox();
await stageTask;
}
finally
{
this.RemoveLoadingBox();
}
} | {
"domain": "codereview.stackexchange",
"id": 3897,
"lm_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#, error-handling, task-parallel-library",
"url": null
} |
algorithms, optimization, dynamic-programming
Title: Dynamic programming - maximize sum of functions subject to constraints Let $\{f_i\}_{i=1}^{k}:[0,k]\to\mathbb{Z}$.
The problem: Maximize the sum $\sum_{i=1}^{k}f_i(x_i)$ subject to the the constraint $\sum_{i=1}^{k}x_i\le k$
I think we suppose to come up with a polynomial time solution, but i got stuck on identifying the sub-problems and using them.
One direction that i had was creating a list for each function, where both the arguments and the function values are in decreasing order: in each iteration, find the argmax of the function, delete bigger arguments that yield smaller function values, and proceed with the smaller arguments that remain (($O(k^3)$ for all functions).
Then use those lists to iterativly construct the optimal solution under the constraint for 1, 2, .. and finally for all $k$ functions, Got stuck about here. Not sure if it's a good direction at all...
Would appreciate any assistance. Let us read the objective again, "maximize the sum $\sum_{i=1}^{k}f_i(x_i)$ where $\sum_{i=1}^{k}x_i\le k$."
The subproblems or the table entries are $DP[a][b]$ for all $0\le a\le k$ and $0\le b\le k$, where $DP[a][b]$ is the maximum value of $\sum_{i=1}^{a}f_i(x_i)$ where $\sum_{i=1}^{a}x_i=b$. The wanted maximum sum is the maximum of $DP[k][0],DP[k][1], \cdots, DP[k][k]$.
The base cases is $DP[1][b]=f_1(b)$ for all $b$. | {
"domain": "cs.stackexchange",
"id": 13804,
"lm_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, dynamic-programming",
"url": null
} |
quantum-optics, ligo, canonical-conjugation
From this, we can derive the Heisenberg equations of motion, which are (including decay and input noise, i.e. coupling to a bath):
\begin{align}
\dot x_a &=-\kappa_a x_a-\sqrt{\kappa_a}x_a^\text{in},\\
\dot p_a &=-\kappa_a p_a-gx_m-\sqrt{\kappa_a}p_a^\text{in},\\
\dot x_m &=\omega_m p_m,\\
\dot p_m &=-\omega_m x_m - gx_a-\gamma p_m + \sqrt{\gamma}F.
\end{align}
Here, $\kappa_a$ and $\gamma$ are the linewidths of the cavity and the endmirror, respectively, and $F$ is some, maybe thermal, force, acting on the mirror and causing it to move.
What we measure in the end is the cavity output field. The output quadratures in frequency space are (solving the EOMs and using input-output relations, for the latter see [2])
\begin{align}
x_\text{out} &= -\kappa_a \chi_a x_\text{in},\\
p_\text{out} &= e^{i\phi} p_\text{in} - \sqrt{\kappa_a}g\chi_a x_m^0 + g^2\chi_a^2\chi_m x_\text{in},
\end{align} | {
"domain": "physics.stackexchange",
"id": 41405,
"lm_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-optics, ligo, canonical-conjugation",
"url": null
} |
data-analysis, ds9
Title: Loading contour file in ds9 I have an ASCII file (.con) with the coordinates of vertices of different contours. This file is obtained from Matlab. Now after every set of contour ends there needs to be a blank row in the contour file. In place of this, I have a row with Nan Nan in it when Matlab writes the file. What I do is simply find and Replace the Nan with nothing. But when I load the contour file in ds9 it gives me weird contours. I'm also posting the result I expect (fig 1) and the result I'm getting (fig 2). The problem here that I've understood till now is that if I copy and paste every contour block of coordinates separately into the .con file the result is as expected but I want the whole process of writing the contours from Matlab into the file such that it gives me the expected result in ds9 to be automated (basically I don't want to copy and paste every block). Can somebody help with this?
This is what I expect:
Link for the .con file that gives the right result: https://drive.google.com/open?id=1tDMXtmywJnSjpi_CzCI5-F85oFpebnl4
Link for the .con file that gives the wrong result: https://drive.google.com/file/d/18rgN1UVtvcyfJSuh1mmbqOVQCna_aAUM/view The solution as pointed out by samcarter in the above comment was to remove the tab in conto.con so that it had linebreak + linebreak instead of linebreak + tab + linebreak | {
"domain": "astronomy.stackexchange",
"id": 3990,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "data-analysis, ds9",
"url": null
} |
physical-chemistry, aqueous-solution, gas-laws, vapor-pressure
An example of this situation playing out in the environment can be seen in the growth of water and ice particles in clouds. The vapor pressure of one particle can differ from that of another due to solute concentration, particle size (small droplets have a greater vapor pressure than larger droplets) and phase (supercooled water droplets have a greater vapor pressure than ice particles at the same temperature). Regardless of the cause of the vapor pressure difference, whether it's solute concentration or one of the other factors, the situation is the same as depicted in your question. And the result is the same; the particles having greater vapor pressure will end up evaporating and then condensing onto the particles having lower vapor pressure (of course we're talking about vapor pressure of water/ice only, not any solute). This is generally referred to as the Wegener–Bergeron–Findeisen process, although this technically only refers to water-to-ice vapor transfer. | {
"domain": "chemistry.stackexchange",
"id": 8052,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry, aqueous-solution, gas-laws, vapor-pressure",
"url": null
} |
python, python-3.x, graph
can be
arr = (
f"{node} ---> {' '.join(str(n) for n in connected_nodes)}"
for node, connected_nodes in self.graph.items()
)
return "\n".join(arr)
This will use a couple of generators directly instead of outer and inner lists.
True-or-exception
The return model for check_node_exist - either returning True or raising an exception - is curious. You should go "all or nothing": either return True/False - or "throw an exception or don't".
Direct return of boolean expressions
if node1 in self.graph[node2] and node2 in self.graph[node1]:
return True
return False
can be
return node1 in self.graph[node2] and node2 in self.graph[node1]
Set comprehension
arr = set()
nodes = self.graph.keys()
for node in nodes:
for connected_node in self.graph[node]:
arr.add((node, connected_node))
return arr
can be
return {
(node, connected_node)
for node in self.graph.keys()
for connected_node in self.graph[node]
}
Calling dunder methods
return self.__str__()
should be
return str(self) | {
"domain": "codereview.stackexchange",
"id": 38735,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x, graph",
"url": null
} |
rviz, transform
Title: static transform shrinking and expanding randomly
Video link: https://dl.dropboxusercontent.com/u/3743872/StaticTransformScalingIssueRviz.ogv
Transform /map to /base_footprint is a 2d transform consisting of only position x and y, and orientation z and w. Transform /base_footprint to /asdf is constant and only consists of a shift in z of 1.5. This suggests the transform from /map to /asdf should always have a z component of exactly 1.5, but the transform lookup seems to scale randomly. Also all transforms relative to /base_footprint scale the same amount as shown in the video.
I have also seen this behaviour outside of rviz when calling tf::TransformListener::lookupTransform().
Has anyone else observed this behavior?
What could be causing this, and how can it be fixed?
This recording is Indigo with Gazebo, but I have seen this behavior in Hydro and Indigo, Gazebo and real-time.
Originally posted by kmhallen on ROS Answers with karma: 1416 on 2014-07-23
Post score: 1
The custom Kalman filter node that generated the transform from /map to /base_footprint did not normalize the quaternion representing orientation at each step. The tf library must assume the quaternion is normalized, and propagate the error through the tf tree. Normalizing fixed the issue completely.
The position jitter in this case comes from a noisy position estimate, not multiple publishing.
Originally posted by kmhallen with karma: 1416 on 2014-07-24
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 18735,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rviz, transform",
"url": null
} |
c, file-system
if (ferror(pak_file))
{
fprintf(stderr, "Error reading pak_file_entries block!\n");
free(pak_file_entries);
return false;
}
for (int i = 0; i < num_files_in_pak; ++i)
{
const pak_file_t * entry = &pak_file_entries[i];
if (!extract_file(pak_file, dest_dir_name, entry->name, entry->filepos, entry->filelen))
{
fprintf(stderr, "Failed to extract pak entry '%s' #%d\n", entry->name, i);
// Try another one...
}
}
free(pak_file_entries);
return true;
}
int main(int argc, const char * argv[])
{
char dest_dir_name[512];
char * ext_ptr;
pak_header_t pak_header;
const char * pak_name;
FILE * pak_file;
if (argc <= 1)
{
fprintf(stderr, "No filename!\n");
printf("Usage: \n"
" $ %s <file.pak>\n"
" Unpacks the whole archive to a directory with the same name as the input.\n"
" Internal file paths are preserved.\n",
argv[0]);
return EXIT_FAILURE;
}
pak_name = argv[1];
pak_file = fopen(pak_name, "rb");
if (pak_file == NULL)
{
fprintf(stderr, "Can't fopen() the file! %s\n", pak_name);
return EXIT_FAILURE;
}
fread(&pak_header, 1, sizeof(pak_header), pak_file);
if (pak_header.ident != ID_PAK_HEADER)
{
fprintf(stderr, "Bad file id for pak %s!\n", pak_name);
return EXIT_FAILURE;
} | {
"domain": "codereview.stackexchange",
"id": 16245,
"lm_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, file-system",
"url": null
} |
biochemistry, molecular-biology, receptor
In such situations, the effects of different hormones add up. The final effect is a function of the total cytosolic concentration of second messenger (e.g., cAMP). Thus glycogen breakdown in a hepatocyte depends on the overall effects of glucagon and epinephrine [3]. The hepatocyte has no way of 'knowing' which cAMP molecule was formed by which hormone.
References | {
"domain": "biology.stackexchange",
"id": 12026,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "biochemistry, molecular-biology, receptor",
"url": null
} |
• $f(n) = \displaystyle\sum_{k = 0}^{a}\epsilon_k(n+k)^p$ is a polynomial with degree at most $p$. So if you can show that $f(n) = C$ for $p+1$ distinct integers $n$, then $f(n)$ must be constant. Dec 24, 2014 at 7:21
• I already know that it's constant, the nature of the algorithm described above reduces the degree of the polynomial by one each time, until it reaches degree 0. I'm interested in the explicit form of the constant. Dec 24, 2014 at 7:39
• The fifth power identity can have the small sum, $$\sum_{n=1}^{168}\pm (x+n)^5=480$$ given in this post. Dec 30, 2014 at 5:21
• Suggestion: Wilson's theory in number theory for congruent modulos. Jul 24, 2017 at 15:36
Let $X = \mathbb{R}^{\mathbb{Z}}$ be the space of real valued sequences defined over $\mathbb{Z}$. Let $R : X \to X$ be the operator on $X$ replacing the terms of a sequence by those on their right. More precisely,
$$X \ni (\ell_n)_{n\in\mathbb{Z}} \quad\mapsto\quad ( (R\ell)_n = \ell_{n+1} )_{n\in\mathbb{Z}} \in X$$ The identities you have can be rewritten as | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9884918517832532,
"lm_q1q2_score": 0.8258686606273755,
"lm_q2_score": 0.8354835289107309,
"openwebmath_perplexity": 287.1169952012793,
"openwebmath_score": 0.9770851135253906,
"tags": null,
"url": "https://math.stackexchange.com/questions/1079575/generalisation-of-n32-n22-n12n2-4"
} |
B is an inverse of A.
Thearem 1.5
The inverse of a matrix. if it exists, is unique. Proof Let Band C be inverses o f A. Then
AB = BA = In and
AC = CA = In.
We then have B = Bill = B(AC ) = (B A)C = lliC = C, which proves that the inverse of a matrix, if it exists. is unique. •
1.5
Special Types of Matrices and Parti tioned Matrices
47
Because o f this uniqueness, we write the inverse of a nonsingular matrix A as A-I. Thus
EXAMPLE 11
LeI
A = [~ ~].
If A -1 exists, let
Then we must have
'] [a, ~J = h = [~ ~].
4 so that
a+2, [ 3a+4c
"+2d]
3b+4d
=
['
0
0] I
.
Equating corresponding entries of these two matrices, we obtain the linear systems a+2c = I 3a+4c = O
b+2d = O 3b+4d = 1.
"nd
The solutions are (verify) a = - 2. c = ~,b = I, and d = the matrix a [c
,,] d
~[-;
- !. Moreover, since
:]
1:-'2
also satis ties the properly that
[-, - 4,][, ,] ~ [, 0]. ~
3 4
0
I
.
we conclude that A is Ilonsingular and that A
EXAMPLE 12
_1 _[-2 ,] -
J
:2
J'
-'1
LeI
I f A-I exists, lei
Then we must have
AA-I ~ [2'
'][a
b] ~ J2 ~ ['0
4cd
0]
[ ,
48
Chapter 1
Linear Equations and Matrices so that
0+2, "+2dl ~[ 1 [ 2o+4c 2h+4d 0
OJ. I
Equating corresponding entries of these two matrices, we obtain the linear systems a + 2c = I 2a+4c = O
and
h+2d = O 2h+4t1 = 1.
These linear sysu::ms ha ve no solutions, so our a~sumplion Ihal A-I exisls is in-
correct. Thus A is singular. | {
"domain": "silo.pub",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.97737080326267,
"lm_q1q2_score": 0.8080039639783043,
"lm_q2_score": 0.8267117876664789,
"openwebmath_perplexity": 4465.94787859596,
"openwebmath_score": 0.8407867550849915,
"tags": null,
"url": "https://silo.pub/elementary-linear-algebra-with-applications-9th-edition.html"
} |
spectroscopy, atoms, molecules, photon-emission, isotopes
Title: Does each spectral line of an atom/molecule have a unique lineshape? A spectral line is determined by a particular transition in an atom or molecule. In reality, this line isn't infinitely sharp, but has a small distribution about the resonance frequency as a result of a few things. This distribution will have a lineshape, e.g., Gaussian, Lorenztian, Voigt, etc. My first question is: is each spectral line, corresponding to a unique transition within an atom or molecule, going to have a unique lineshape?
My initial reasoning leads me to say yes. Given that lifetime broadening (which gives a spectral line its natural width) concerns the energy uncertainty ΔE of the transition, and this ΔE is different for every transition in a given atom/molecule, then the lifetime broadening should be different and thus the shape as well. The other sources of broadening, like doppler or collision broadening, should apply uniformly. Is all of this correct?
Secondly, I'd like to ask about isotopes: different isotopes will have different, unique spectra compared to each other (even if the difference is subtle). Will the same transition in each isotope have the same lineshape? In other words, will a transition in isotope 1 have the same lineshape as the same transition in isotope 2? (By "the same", I mean that even though the frequency / energy gap is slightly different, it's still the same transition between particular orbitals). A lot of questions, but since they are related, we go on:
A spectral line is determined by a particular transition in an atom or molecule. In reality, this line isn't infinitely sharp, but has a small distribution about the resonance frequency as a result of a few things. This distribution will have a lineshape, e.g., Gaussian, Lorenztian, Voigt, etc. My first question is: is each spectral line, corresponding to a unique transition within an atom or molecule, going to have a unique lineshape? | {
"domain": "physics.stackexchange",
"id": 88536,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "spectroscopy, atoms, molecules, photon-emission, isotopes",
"url": null
} |
thermodynamics
Title: How would you store heat? Um .. naive question perhaps but if somebody wanted to store heat, how would they go about it? Can heat be stored?
I'm told that decomposing kitchen waste in a closed vessel results in a rise in temperature on the body of the vessel. I'm just wondering whether it could be stored for later use. Building off of the comments to the question.
It might be instructive to think carefully about what is being stored when you store "electricity" in a capacitor or battery.
Note that it is not electrons as I can charge a capacitor either positive or negative relative to a floating ground. The "what" in that case is energy in the form of electric fields (capacitor) or chemical potential (battery).
Heat is also energy, in the form of excitation of microscopic degrees of freedom, and the way you store it is by exciting the microscopic degree of freedom in some material and then don't allow it to transmit that energy to other forms---which you do by insulating the hot stuff. Or you can convert the heat to some more tractable form (as in Dan's answer or Georg's comment) and store that. | {
"domain": "physics.stackexchange",
"id": 1634,
"lm_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",
"url": null
} |
php, library
Title: Small PHP MVC Template
The following is a new question based on answers from here: Small PHP Viewer/Controller template
I have written a small MVC template library that I would like some critiques on.
The library is located here
If you are looking for where to start, check out the files in the smallFry/application directory.
I would really love to hear your critiques on:
Code quality
Code clarity
How to improve
Anything else that needs clarification expansion etc
I'm more interested in what I'm doing wrong than right.
Any opinions on the actual usefulness of the library are welcome.
Code examples (all of the code is equal, just on my last question I was asked for some snippets):
Bootstrap.php:
<?php
/**
* Description of Bootstrap
*
* @author nlubin
*/
Class Bootstrap {
/**
*
* @var SessionManager
*/
private $_session;
/**
*
* @var stdClass
*/
private $_path;
/**
*
* @var AppController
*/
private $_controller;
/**
*
* @var Template
*/
private $_template;
function __construct() {
Config::set('page_title', Config::get('DEFAULT_TITLE'));
Config::set('template', Config::get('DEFAULT_TEMPLATE'));
$this->_session = new SessionManager(Config::get('APP_NAME'));
$this->_path = $this->readPath();
$this->_controller = $this->loadController();
$this->_template = new Template($this->_path, $this->_session, $this->_controller); //has destructor that controls it
$this->_controller->displayPage($this->_path->args); //run the page for the controller
$this->_template->renderTemplate(); //only render template after all is said and done
} | {
"domain": "codereview.stackexchange",
"id": 1154,
"lm_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, library",
"url": null
} |
game, objective-c, ai
#pragma mark - Complex Floor Collections
-(NSMutableArray *) floorsWithInactiveRoomUpgrades:(RoomType)roomType {
NSMutableArray *floorsWithInactiveRoomUpgrades = [[NSMutableArray alloc]init];
for (DTTowerFloor *floor in _revealedFloors) {
if ((floor.floorBuildState & FloorHasRoomUpgrade) && floor.room.roomType == roomType) {
if (![floor isRoomUpgradeJobCreationCountdownRunning]) {
[floorsWithInactiveRoomUpgrades addObject:floor];
}
}
}
return floorsWithInactiveRoomUpgrades;
}
-(NSMutableArray *) floorsWithRunningRoomUpgradesOfType:(RoomType)roomType {
NSMutableArray *floorsWithRunningRoomUpgrades = [[NSMutableArray alloc]init];
for (DTTowerFloor *floor in _revealedFloors) {
if (floor.room.roomType == roomType) {
if ([floor isRoomUpgradeJobCreationCountdownRunning]) {
[floorsWithRunningRoomUpgrades addObject:floor];
}
}
}
return floorsWithRunningRoomUpgrades;
}
-(NSMutableArray *) floorsWithValidPermissionsForJob:(JobType)jobType {
NSMutableArray *validFloors = [[NSMutableArray alloc]init];
for (DTTowerFloor *floor in _revealedFloors) {
if ([_tower checkIfFloor:floor.floorNumber isValidForJob:jobType]) {
[validFloors addObject:floor];
}
}
return validFloors;
} | {
"domain": "codereview.stackexchange",
"id": 8801,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "game, objective-c, ai",
"url": null
} |
quantum-mechanics, nuclear-physics, atomic-physics, perturbation-theory, radioactivity
Note that this is very much like a magnetic moment in zero magnetic field: there are two states with $S_z=\pm \frac 1 2$ with equal energy. An external external field ($B_z\ne 0$) breaks the hamiltonians rotational symmetry and splits these two eigenstates. Likewise with the nucleon, isospin symmetry is not exact, and the neutron and proton masses are split.
In the strong interaction, the two states are connected by exchanging pseudoscalar bosons (the three $I=1$ pions), e.g.: $n + \pi^+ \rightarrow p$, but that's not under consideration now. We're talking about the weak interaction.
The weak interaction introduced a perturbation that connect the states via vector boson exchange ($W^{\pm}$); the $W^{\pm}$ also connects the $(\nu, e^-)$ doublet leading to:
$$ n \rightarrow p+e^-+\bar{\nu}_e $$
There is of course copious literature describing this process. A good place to state is the Fermi-interaction (https://en.wikipedia.org/wiki/Fermi%27s_interaction). This was long before electroweak unification, so it describes nucleon eigenstates in the presence of an ad hoc interaction that connects them, very much like the approximations used in atomic transitions. | {
"domain": "physics.stackexchange",
"id": 83543,
"lm_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, nuclear-physics, atomic-physics, perturbation-theory, radioactivity",
"url": null
} |
urdf, ros-indigo
/usr/local/include/urdf_model/types.h:54:1: error: 'shared_ptr' in namespace 'std' does not name a type
/usr/local/include/urdf_model/types.h:54:1: error: 'shared_ptr' in namespace 'std' does not name a type
/usr/local/include/urdf_model/types.h:54:1: error: 'weak_ptr' in namespace 'std' does not name a type | {
"domain": "robotics.stackexchange",
"id": 25759,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "urdf, ros-indigo",
"url": null
} |
newtonian-mechanics, electromagnetism, voltage, electromagnetic-induction
Title: How does an alternator produce AC?
As an alternator’s coil moves, one side of the coil induces a voltage and thus a charge flow in one direction
However, simultaneously the other side of the coil induces a voltage and charge flow in the opposite direction.
This intuitively to me means that the equal and opposite induced electromotive forces should cancel out, but instead an alternating current is generated. Why is this?
For example if a series circuit had two 3V cells applying voltage in opposite directions, then the net voltage in the circuit would be 0. How is this any different to the opposite voltages induced in the alternator? There are no two voltages existing in the same loop! It is not like having $3V$ batteries making the net voltage zero either.
Considering the setup that you have drawn:
The changing magnetic flux through the loop due to the bar magnet forces the generation of an EMF to counter that change in magnetic flux (this is the Lenz' law).
The important thing here to realise is that this sort of an EMF is not the conservative type.
This is a special case of those non-conservative electric fields: $$\int E dl \not= 0$$
where the integral covers the whole loop. In fact this integral equals the EMF $\epsilon$, which is written as: $\epsilon = -\frac{d\phi}{dt}$, with $\phi$ being the magnetic flux.
In usual cases, for example, Kirchoff's rule, the above integral always used to be zero (over the whole loop).
Although electric fields are in general conservative, induced electric fields are non-conservative. | {
"domain": "physics.stackexchange",
"id": 57288,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, electromagnetism, voltage, electromagnetic-induction",
"url": null
} |
robotic-arm, motion-planning, path-planning
Title: Path planning of 2 arm 4dof Robot I am working on path planning for a 2 arm 4dof (2 dof for each arm) robot. I am currently using a centralised planning methodology (considering the multi robot system as a single one with higher dof, 4 in this case) and A* algorithm to find the shortest path. The problem with this algorithm is its high computation time.Is there any way to reduce the computation time while still obtaining the shortest route ?
Note:decentralised path planning is not good enough for my case. When I was using A* to navigate mobile robot in environment I've got this same issue. I am assuming that you are using cubic representation (nodes) of the environment where you have some cubes that represents free space and obstacles. What you can do is to increase the size of nodes that represents the environment. This way there will be less nodes the A* algorithm needs to process.
Another thing you can do is to cancel nodes that are unreachable by robotic arm or nodes you don't want the arm should move in.
Next thing is that after you get the path, the robotic arm will be moving as close as possible to the obstacles because in most scenarios it is the shortest path. You can solve this issue by increasing the transition value (cost) between the nodes near the obstacle. | {
"domain": "robotics.stackexchange",
"id": 1137,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "robotic-arm, motion-planning, path-planning",
"url": null
} |
electromagnetism, symmetry, conservation-laws, charge, noethers-theorem
Title: What is the symmetry which is responsible for preservation/conservation of electrical charges? Another Noether's theorem question, this time about electrical charge.
According to Noether's theorem, all conservation laws originate from invariance of a system to shifts in a certain space. For example conservation of energy stems from invariance to time translation.
What kind of symmetry creates the conservation of electrical charge? Remember that voltage is always expressed as a "potential difference." You can't measure the absolute value of voltage because everything is invariant when you add a constant voltage everywhere. That expresses a symmetry just like time translation invariance.
When you bring in the magnetic field this invariance or symmetry can be generalised to a bigger gauge invariance transforming the electromagnetic potential as a vector field. Charge particles are also described by fields such as Dirac spinors, which are multiplied by a phase factor under the action of this symmetry, making it a U(1) invariance. Electric charge is the conserved quantity that Noether's theorem gives for this symmetry. | {
"domain": "physics.stackexchange",
"id": 99956,
"lm_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, symmetry, conservation-laws, charge, noethers-theorem",
"url": null
} |
can occur, however, because the definition requires that the point simply be in the domain of the function. Extreme Values A Global Maximum A function f has a global (absolute) maximum at x =c if f (x)≤ f (c) for all x∈Df. Absolute Maximum - The highest point on a curve. Note: From our definition of absolute maxima and minima, if $(a, f(a))$ is an absolute max/min, then it is also a local max/min too. Let's Practice:. between -30 to 20 function is decreasing because there are no local minima and maxima in between them. f(x)= 490x x2 +49 on [0,10] 2 Fall 2016, Maya. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Here again we are giving definitions that appeal to your geometric intuition. f(x)=xln(2x)on[0. Local Extreme Values of a Function Let c be an interior point of the domain of the. The absolute is measured in liters of oxygen per minute. ) Find the absolute maximum and minimum values of the function on the given interval. Q: Determine the absolute maximum and minimum values of the function on the given interval. Extreme value theorem tells us that a continuous function must obtain absolute minimum and maximum values on a closed interval. VO2max stands for maximal oxygen uptake and refers to the amount of oxygen your body is capable of utilizing in one minute. so minimum value of f(x) in interval [0. For example, consider the functions shown in Figure(d), (e), and (f). Find more Mathematics widgets in Wolfram|Alpha. It's easy to find one with neither absolute extrema. Identify the location and value of the absolute maximum and absolute minimum of a function over the domain of the function graphically or by using a graphing utility. From the graph you can see that is has a maximum at (3, 27) and a minimum at (1. Find the absolute maximum and absolute minimum values of f on the given interval. The maximum value of a function that has a derivative at all points in an For a function f(x) that has a derivative at every point in an interval [a, b], the maximum or minimum values can be found by using | {
"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"
} |
c++, beginner, object-oriented, game
cout << Georgia.name << " | Overall - " << Georgia.overall << " ( " << Georgia.win << " - " << Georgia.loss << " ) " << endl << endl;
cout << UNC.name << " | Overall - " << UNC.overall << " ( " << UNC.win << " - " << UNC.loss << " ) " << endl << endl;
cout << NotreDame.name << " | Overall - " << NotreDame.overall << " ( " << NotreDame.win << " - " << NotreDame.loss << " ) " << endl << endl;
cout << Clemson.name << " | Overall - " << Clemson.overall << " ( " << Clemson.win << " - " << Clemson.loss << " ) " << endl << endl;
cout << endl << "Type 1 and press Enter to continue." << endl;
cin >> number;
goto home; | {
"domain": "codereview.stackexchange",
"id": 39714,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, beginner, object-oriented, game",
"url": null
} |
optimization, compilers
To
for(i=0;;i+=8){
for(j=0;j<4;j++){ p(i+j); }
}
I'm not asking how to do this by hand. I want the compiler to figure out how to do this. I have a gut feeling like this is some well known problem, I just don't know what name it has, or even how I'd google for it. A general approach is to automatically infer loop invariants. There are techniques for inferring loop invariants that can be expressed in Presburger arithmetic, i.e., linear expressions over the integers plus quantifiers. These typically rely upon the fact that there exist decision procedures for Presburger arithmetic, e.g., the Omega method (see also the web site).
These methods should be enough to build a special optimization that can solve your first two challenges. For instance, you can use those methods to find loop strides. In particular, you can use those methods to characterize the values of i that will reach the then-block of the if-statement: you can first check whether the sequence of values of i lies in an arithmetic progression, then characterize the progression (deduce find the minimum value of i, deduce the maximum value of i, and deduce the stride).
These methods have been studied in depth in the compiler literature on loop vectorization, where we want to know whether we can execute each iteration of the loop in parallel on a separate core. Similar techniques should be useful for your kind of problem as well.
I don't know whether there's any reasonable algorithm for your third example, or whether anyone has studied that sort of thing in the compiler literature. | {
"domain": "cstheory.stackexchange",
"id": 2525,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optimization, compilers",
"url": null
} |
ros
/home/wilk/hydro_workspace/sandbox/rgbdslam_freiburg/rgbdslam/src/node.cpp: In constructor ‘Node::Node(cv::Mat, cv::Ptr<cv::FeatureDetector>, cv::Ptr<cv::DescriptorExtractor>, pcl::PointCloud<pcl::PointXYZRGB>::Ptr, cv::Mat)’:
/home/wilk/hydro_workspace/sandbox/rgbdslam_freiburg/rgbdslam/src/node.cpp:169:26: error: no matching function for call to ‘tf::StampedTransform::StampedTransform(const tf::Transform&, uint64_t&, std::basic_string<char>, std::string&)’
/home/wilk/hydro_workspace/sandbox/rgbdslam_freiburg/rgbdslam/src/node.cpp:169:26: note: candidates are:
/opt/ros/hydro/include/tf/transform_datatypes.h:91:3: note: tf::StampedTransform::StampedTransform()
/opt/ros/hydro/include/tf/transform_datatypes.h:91:3: note: candidate expects 0 arguments, 4 provided
/opt/ros/hydro/include/tf/transform_datatypes.h:87:3: note: tf::StampedTransform::StampedTransform(const tf::Transform&, const ros::Time&, const string&, const string&)
/opt/ros/hydro/include/tf/transform_datatypes.h:87:3: note: no known conversion for argument 2 from ‘uint64_t {aka long unsigned int}’ to ‘const ros::Time&’ | {
"domain": "robotics.stackexchange",
"id": 16768,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
neural-network, keras, time-series, lstm, rnn
train_datagen = ImageDataGenerator(rescale = 1. / 255)
test_datagen = ImageDataGenerator(rescale = 1. / 255)
train_generator = train_datagen.flow_from_directory(
train_data_dir,
target_size=(img_width, img_height),
batch_size=batch_size)
validation_generator = test_datagen.flow_from_directory(
validation_data_dir,
target_size=(img_width, img_height),
batch_size=batch_size)
model.fit_generator(
train_generator,
steps_per_epoch=nb_train_samples // batch_size,
epochs=epochs,
callbacks=[plot_losses],
validation_data=validation_generator,
validation_steps=nb_validation_samples // batch_size)
And then as soon as I run the program, of course it gives an error message::
**ValueError: Error when checking input: expected lstm_50_input to have 3 dimensions, but got array with shape (10, 3601, 217, 3)**
The message:
expected lstm_50_input to have 3 dimensions, but got array with shape (10, 3601, 217, 3)
clearly suggests it does not agree with my definition of input shape of: (3601, 217)
Any idea to easy fix the problem?
Thanks in advance. Why do you define the last dimension of input_shape as $3$? Just put your desired input dimensions accordingly and it should be fine:
input_shape = (img_width, img_height) | {
"domain": "datascience.stackexchange",
"id": 5972,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-network, keras, time-series, lstm, rnn",
"url": null
} |
dirac-equation, dirac-matrices
Title: Arbitrary basis solutions to the Dirac equation I'm considering solutions to the free Dirac equation
$$
(i\gamma^\mu\partial_\mu-m)\psi=0
$$
where $\psi$ is the 4-component bispinor field being solved for, and the $\gamma^\mu$ matrices must satisfy $\{\gamma^\mu,\gamma^\nu\}=2\eta^{\mu\nu}$.
Using the plane-wave Ansantz $\psi=u(p)e^{-ip_\mu x^\mu}$ (so-called positive frequency), the equation becomes
$$
(p_\mu \gamma^\mu-m)u(p)=0
$$
Additionally left-multiplying by $(p_\nu\gamma^\nu+m)$ leads to
$$
(p_\nu\gamma^\nu+m)(p_\mu \gamma^\mu-m)u(p)=(p_{\nu}p_{\mu}\eta^{\nu\mu}-m^2)u(p)=0
$$
which constrains $p_\mu$ to lie on the relativistic mass shell.
Similarly, the Ansatz $\psi=v(p)e^{ip_\mu x^\mu}$ (so-called negative frequency) leads to
$$
(p_\nu\gamma^\nu+m)v(p)=0
$$
where again $p_\mu$ must lie on the mass shell.
Looking at the equation for $u(p)$, we see the solutions in fact form the kernel of the matrix
$$
p_\mu\gamma^\mu-m
$$
At this point, all texts I have read proceed with some concrete basis for the $\gamma^\mu$. In the Weyl basis for example, where
$$ | {
"domain": "physics.stackexchange",
"id": 81025,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dirac-equation, dirac-matrices",
"url": null
} |
slam, navigation, odometry, hector
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find hector_slam_example)/launch/rviz_cfg.rviz"/>
<include file="$(find hector_slam_example)/launch/default_mapping.launch"/>
<include file="$(find hector_geotiff)/launch/geotiff_mapper.launch"/>
</launch>
Originally posted by Emilien on ROS Answers with karma: 167 on 2016-07-19
Post score: 0
I am also creating a robot for autonomous mapping. I used hector_slam with hector_navigation.
Hector_exploration_controller (which is part of the hector_navigation stack) will publish cmd_vel values you can use to explore the unknown area.
http://wiki.ros.org/hector_navigation
I do not believe you need odometry when using hector slam.
i launch my lidar, hector slam, hector exploration planner, and run the simple_exploration_controller and of course rosserial.
Originally posted by RoSPlebb with karma: 64 on 2016-07-19
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by Emilien on 2016-07-19:
i install hector navigation but how can i relate it with hector slam and odometry?
i already create a node arduino with subscribe au cmd_vel and publish rpm, and i can control my robot with teleop_twist_keyboard. i don't know if i can use this | {
"domain": "robotics.stackexchange",
"id": 25283,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam, navigation, odometry, hector",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.