text stringlengths 1 1.11k | source dict |
|---|---|
c, homework, queue, child-process, posix
Use only one data declaration per line.
It’s easier to modify declarations because each declaration is self-contained.
[...]
It’s easier to find specific variables because you can scan a single
column rather than reading each line. It’s easier to find and fix
syntax errors because the line number the compiler gives you has
only one declaration on it.
You don't have to return 0/EXIT_SUCCESS at the end of main(), just like you wouldn't bother putting return; at the end of a void-returning function. The C standard knows how frequently this is used, and lets you not bother.
C99 & C11 §5.1.2.2(3)
...reaching the } that terminates the main() function returns a
value of 0.
Prefer snprintf() to sprintf().
There might be more stuff I missed, but this is all I think I could review without actually compiling the code and running some tests. | {
"domain": "codereview.stackexchange",
"id": 9886,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, homework, queue, child-process, posix",
"url": null
} |
quantum-field-theory, condensed-matter, research-level, gauge-theory, gauge-invariance
There is a sort of minimal coupling prescription for $U$:
$$U(r_1,r_2;A) = \int \mathcal{DP}\exp(i\!\int_{r_1}^{r_2}\!\!\!\!A(r')\cdot dr')$$
where the $\mathcal{DP}$ is some measure on the space of paths from $r_1$ to $r_2$, and this measure does not depend $A$. This is minimal in the sense of being, well, minimal and in the sense that if you expand $U$ as a polynomial in derivatives you recover the usual minimal coupling prescription. You can see that this has right gauge transformations properties. In the special case where the motion is essentially semiclassical you just a finite sum over Wilson lines. | {
"domain": "physics.stackexchange",
"id": 8410,
"lm_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, condensed-matter, research-level, gauge-theory, gauge-invariance",
"url": null
} |
machine-learning, clustering, feature-scaling, dummy-variables
My problem is that I want all variables to have the same importance. Is there a way to do this? I was thinking of scaling the variables in a different way but I don't know how to scale them in order to give them the same importance. You cannot really use k-means clustering if your data contains categorical variables since k-means uses Euclidian distance which will not make a lot of sense with categorical variables. Check out the answers to this similar question.
You can use the following rules for performing clustering with k-means or one of its derivates:
If your data contains only metric variables:
Scale the data and use k-means (R) (Python).
If your data contains only categorical variables:
Use k-modes (R) (Python).
If your data contains categorical and metric variables:
Scale the metric variables and use k-prototypes (R) (Python). | {
"domain": "datascience.stackexchange",
"id": 5026,
"lm_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, clustering, feature-scaling, dummy-variables",
"url": null
} |
fft, discrete-signals, dft
f1 = 1400; % frequency of the first cosine
f2 = 1450; % frequency of the second cosine
Fs = 4001; % choose (arbitrarily) a sampling frequency in Hz.
r = 0; % set r=0 if all fk are already integers.
R = 10^r; % Ex: if f1=1450.34 => set r = 2
N1 = lcm( R*Fs , R*f1) /(R*f1) % period of cosine-1
N2 = lcm( R*Fs , R*f2) /(R*f2) % period of cosine-1
% Alternatively: use GCD() function
% N1 = R* Fs / gcd( R*Fs, R*f1)
% N2 = R* Fs / gcd( R*Fs, R*f2)
N = lcm(N1,N2) % Find the common (base) period ;
% N: min number of samples to satisfy the DFT property.
k1 = N*f1/Fs % DFT bin index at which the delta appears.
k2 = N*f2/Fs % Assumes no aliasing; k=0 is the first bin.
t = [0:N-1]/Fs; % sampling instants
x = cos(2*pi*f1*t) + cos(2*pi*f2*t); | {
"domain": "dsp.stackexchange",
"id": 6886,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fft, discrete-signals, dft",
"url": null
} |
performance, c, coordinate-system
void toRadians(double* out, double angleInDegrees)
{
*out = angleInDegrees * (double)(m_PI/180.0);
}
void vec3fdot(double* out, vec3f* a, vec3f* b)
{
double total = 0;
total += a->p[0] * b->p[0];
total += a->p[1] * b->p[1];
total += a->p[2] * b->p[2];
*out = total;
}
void vec3fcross(vec3f* out, vec3f* a, vec3f* b)
{
out->p[0] = a->p[1] * b->p[2] - b->p[1] * a->p[2];
out->p[1] = a->p[2] * b->p[0] - b->p[2] * a->p[0];
out->p[2] = a->p[0] * b->p[1] - b->p[0] * a->p[1];
}
void vec3fnorm(vec3f* out, vec3f* in)
{
double t = 0;
vec3flen(&t, in);
out->p[0] = in->p[0]/t;
out->p[1] = in->p[1]/t;
out->p[2] = in->p[2]/t;
}
void vec3fdist(double* out, vec3f* a, vec3f*b)
{
vec3f tmp;
vec3fsub(&tmp, b, a);
vec3flen(out, &tmp);
} | {
"domain": "codereview.stackexchange",
"id": 14926,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, c, coordinate-system",
"url": null
} |
formal-languages, turing-machines, computability
Title: I'm trying to understand why every language has an infinite number of TMs that accept it I found the following answer:
$L_{17} = \{ \langle M \rangle \mid \text{$M$ is a TM, and $M$ is the only TM that accepts $L(M)$} \}$.
R. This is the empty set, since every language has an infinite number of TMs that accept it.
As I know number of TMs is $\aleph_0$ and number of languages is $2^{\aleph_0}$, so how can it be possible that "every language has an infinite number of TMs that accept it"?
source of the solution here The correct version of the claim states that every computable language is accepted by infinitely many Turing machines.
Indeed, if $L$ is computable, then there is a Turing machine $T$ that accepts it. Let $T_n$ be $T$ together with $n$ unreachable states. Then $T_n$ also accepts $L$, and the machines $T_n$ are all different from one another. | {
"domain": "cs.stackexchange",
"id": 17441,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "formal-languages, turing-machines, computability",
"url": null
} |
ros, moveit, ros-hydro, universal-robots, ur5
Originally posted by Rob Farrell with karma: 26 on 2014-02-16
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by gvdhoorn on 2014-02-16:
@Rob Farrell: could you open a ticket about this against the universal_robot repository? This might affect other packages as well. Thanks. The weird thing is that all ROS-I packages include the base_link in the manipulator group, and it works fine as far as I know.
Comment by gvdhoorn on 2014-02-16:
It would seem the UR5 MoveIt cfg uses a set of links, instead of a single chain, which is different from other ROS-I cfgs. I'm not sure why it is setup like that, there might be a valid reason.
Comment by gvdhoorn on 2014-03-31:
Just to follow up on this: https://github.com/ros-industrial/universal_robot/pull/45 should fix the described issue. | {
"domain": "robotics.stackexchange",
"id": 16949,
"lm_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, moveit, ros-hydro, universal-robots, ur5",
"url": null
} |
electromagnetic-radiation, experimental-physics, electromagnetic-induction
Does this oscillating electromagnetic field (i)excite the electrons in the fluorescent material directly, or (ii)does it excite the gas to emit UV, which in turn, excite the fluorescent material?
Tesla coils generate an electromagnetic field with frequency in the radio wave region. If (i) (in Q1) is true, then how does low-frequency radio waves excite the fluorescent material to emit visible light (of higher frequency)?
If (ii) is true, then how can radio waves excite gas molecules to generate UV? | {
"domain": "physics.stackexchange",
"id": 57690,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetic-radiation, experimental-physics, electromagnetic-induction",
"url": null
} |
(MP3). Evaluating exponents & radicals. 2) Simplify algebraic expressions using the properties of exponents. When n is a positive integer, exponentiation corresponds to repeated multiplication of the base: that is, b n is the product of multiplying n bases: = × ⋯ × ⏟. 3 3 = 3 × 3 × 3 = 27. Try our free Screen Recorder! Evaluating exponents & radicals. Our mission is to provide a free, world-class education to anyone, anywhere. Exponents rules and properties 1 = x a x a = x a − a = x 0. x 0 = 1, x ≠ 0. When you raise a product to a power you raise each factor with a power, $$\left (xy \right )^{2}= \left ( xy \right )\cdot \left ( xy \right )= \left ( x\cdot x \right )\cdot \left ( y\cdot y \right )=x^{2}y^{2}$$, This is called the power of a product property. Laws of Exponents. Called Product of Powers Rule Powers Rule Product Rule in example) Ex 1: x4 • x2 = x6 Another way the problem could be written: !⋅!⋅!⋅!⋅!⋅! Writing all the letters down is the key to understanding the Laws So, | {
"domain": "trinitariasmallorca.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9621075701109192,
"lm_q1q2_score": 0.811917868435894,
"lm_q2_score": 0.8438951045175643,
"openwebmath_perplexity": 1270.9053218679683,
"openwebmath_score": 0.6059345602989197,
"tags": null,
"url": "http://trinitariasmallorca.org/bedspreads-and-xetifo/8aec1f-properties-of-exponents"
} |
particle-physics, spectroscopy, antimatter
A search is described for mixing of muonium (μ+e−) and antimuonium (μ−e+). Thermal muonium was produced by stopping muons in a SiO2 powder target. As a conversion signature, a μ− from antimuonium would create Ta184 in an adjacent tungsten foil. The surface layer of the sample was chemically extracted and counted in a low-background germanium spectrometer; no conversion events were observed. The resulting upper limit on the probability that a muonium atom spontaneously converts to antimuonium is 2.1×10−6 (90% confidence). This corresponds to a limit of 0.29GF on the effective four-fermion coupling constant between muonium and antimuonium. | {
"domain": "physics.stackexchange",
"id": 48650,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "particle-physics, spectroscopy, antimatter",
"url": null
} |
evolution, botany, entomology, reproduction
Title: How did the orchids evolve to support pseudocopulation when they do not have any organ for vision to see how insects look like? How could they guess so perfectly how a moth or whatever the pseudocopulating organism looks like. They do not have eyes to see the shape or structure. What could possibly be the reason they evolved with such accuracy to deceive an animal? Evolution does not work based on an organism (or designer) "seeing" a problem and seeking a solution. Evolution via natural selection works when members of a population that have a certain heritable trait are better at reproducing than other members of that population. Because they are better at reproducing, subsequent generations of the population have a greater percentage of individuals that have that heritable trait, and the process continues, sometimes to the extent that all the individuals of that species have that trait (this is called "fixation"). | {
"domain": "biology.stackexchange",
"id": 7502,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "evolution, botany, entomology, reproduction",
"url": null
} |
electrochemistry
Edit : The potential of an electrode dipping in pure water is not defined if the "solution" is totally pure water. Another way of saying it is to say that the potential is infinite if there is absolutely no ion of this electrode in solution. But it is practically impossible to get a solution with zero ion of the corresponding metal in solution. I repeat here Nernst's law :
$$\pu{E = E° + ( 0.059/2) log[M^{2+}]}$$
If [$\ce{M^{2+}}] = 0$, its log and the potential both tend to - ∞.
But if there is only one(=$1$) ion $\ce{M^{2+}}$ in $1$ L water, its molar concentration is $\ce{[M^{2+}] = 1/(6·10^{23})}$, and the potential is not infinite as before. It becomes $$\ce{E = E° - (0.059/2)· log(6·10^{+ 23} ) = E° − 0.70 V}$$
If there are just $2$ ions $\ce{M^{2+}}$ in $1$ L water, its molar concentration is $\ce{[M^{2+}] = 2/(6·10^{23})}$, the potential becomes $$\ce{E = E° - (0.059/2)· log(3·10^{+ 23} ) = E° − 0.69 V}$$ This is not infinite ! | {
"domain": "chemistry.stackexchange",
"id": 16941,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrochemistry",
"url": null
} |
This is a consequence of the Peter-Weyl theorem, which says that the components $\phi_{ij}$ of the irreducible representations $\phi$ of $G_1$ form an orthogonal basis for $L^2(G_1)$, and similarly the components $\psi_{ij}$ of the irreducible representations $\psi$ of $G_2$ form an orthogonal basis for $L^2(G_2)$. The components of the tensor product $\theta=\phi \otimes \psi$ have the form $\theta_{ijkl}(g_1,g_2)=\phi_{ij}(g_1)\psi_{kl}(g_2)$. A straightforward computation shows that $\langle \chi_{\theta}, \chi_{\theta'} \rangle$ equals 1 if $\theta=\theta'$ and is zero otherwise. This shows that the tensor products $\theta=\phi \otimes \psi$ are distinct irreducible representations of $G$, as $\phi$ and $\psi$ range over the irreducible representations of $G_1$ and $G_2$. Thus the components $\theta_{ijkl}$ form an orthogonal set in $L^2(G)$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9840936101542133,
"lm_q1q2_score": 0.8068517907151052,
"lm_q2_score": 0.8198933337131076,
"openwebmath_perplexity": 42.777915553557925,
"openwebmath_score": 0.9832597374916077,
"tags": null,
"url": "https://math.stackexchange.com/questions/1168458/representations-of-a-product-of-lie-groups"
} |
visible-light, scattering
Why wouldn't it be able to?
Rayleigh scattering has cross section proportional to $\lambda^{-4}$. The spectrum of light illuminating the volume scattering it gets multiplied by $\lambda^{-4}$, which indeed makes smaller wavelengths amplified more than larger ones. This indeed makes the scattered light, when seen immediately after scattering, bluer.
But on the other hand, this same scattering mechanism removes corresponding amount of power from the light that hasn't gotten scattered and continues propagating forwards. What we now have is this factor of the scattering cross section getting into the exponent of the Beer-Lambert law. In the limit of large distance $d$, the factor $\lambda^{-4}\exp(-d \lambda^{-4})$ has a reddening effect, not bluing. Here the distance you have to take into account is the sum of 1) distance traversed before scattering and 2) distance traversed to you after scattering. | {
"domain": "physics.stackexchange",
"id": 63660,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "visible-light, scattering",
"url": null
} |
c++, object-oriented, rational-numbers
The "fraction.cpp" file below.
#include "stdafx.h"
static int gcd(int, int); /// barrowed function see definition.
static void input_check(std::string&);
fraction::fraction()
{
fraction_symbol = '/';
is_reduced = false;
is_neg = false;
numerator = 1;
denominator = 1;
} | {
"domain": "codereview.stackexchange",
"id": 26679,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, object-oriented, rational-numbers",
"url": null
} |
quantum-field-theory, mathematical-physics, renormalization
Question 2: Does this imply that the integral of any Wick ordered polynomial vanishes since Wick ordering is $\mathbb{C}$-linear?
Thank you in advance for any help. Regarding your first question: what is written down in Salmhofer's book is a very technical approach to the generating functional method. It allows one to express correlation functions as functional derivatives with respect to some auxiliary field $J$, which is set to zero before arriving at the final result. A less mathematically rigorous explanation is given in chapters 6-8 of Srednicki and chapter 9 of Peskin and Schroeder.
Regarding your second question and Wick ordering in general: it implies that the integral of any Wick ordered polynomial vanishes under the given measure of integration, i.e. a gaussian measure for a given correlation function $C$. For a discussion of the formalism, I would refer to these notes. | {
"domain": "physics.stackexchange",
"id": 10198,
"lm_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, mathematical-physics, renormalization",
"url": null
} |
php, unit-testing
//Specific Player, Default Stats, No Position Exclusion
$result = $this->Player->GetPlayers(10, true, null);
$expected = array(
'Player' => array ('id' => 10, 'name' => 'Forward 1', 'status' => 'available', 'note' => '', 'club_id' => '1', 'position_id' => '4'),
'Club' => array ('id' => 1, 'name' => 'Club 1', 'abbreviation' => 'clb1'),
'Position' => array ('id' => 4, 'name' => 'Forward', 'abbreviation' => 'fw', 'min' => 1, 'max' => 3, 'need' => 2, 'db_abbr' => 'fw'),
'Stat' => array ('id' => 10, 'rank' => 10, 'goals' => 0, 'saves' => 0, 'penaltysaves' => 0, 'assists' => 0, 'cleansheet' => 0, 'redcard' => 0, 'yellowcard' => 0, 'foulsconc' => 0, 'foulswon' => 0, 'tackleslost' => 0, 'tackleswon' => 0, 'shotontarget' => 0, 'totalshot' => 0, 'appearances' => 0, 'attcreated' => 0, 'totalpasses' => 0, 'accpasses' => 0, 'minutesplayed' => 0, 'conceded' => 0, 'player_id' => '10', 'team_id' => 0, 'period_id' => '1')
); | {
"domain": "codereview.stackexchange",
"id": 805,
"lm_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, unit-testing",
"url": null
} |
rna-seq, r, normalization
Title: Large dataset normalization for PCA I need to normalize a large (400Mb) dataset for doing PCA analysis. I want to use scran for doing that:
biocLite("SingleCellExperiment")
biocLite("scran")
library(SingleCellExperiment)
library(scran)
list_of_sce <- list()
# Looping though the UMI_count 'split_factor' columns at a time
split_factor = 500
for(i in seq(1,ncols, split_factor)) {
num_loop = floor(i / split_factor) + 1
idx = ncols
if (i + split_factor < ncols) {
idx = i + split_factor
}
sce <- SingleCellExperiment(list(counts=UMI_count[, i : idx]))
# Normalization of the dataset containing
# heterogenous cell data (different cell types)
clusters <- quickCluster(sce) ## <- ** error appears here **
sce <- computeSumFactors(sce, cluster=clusters)
list_of_sce[[num_loop]] <- sce
}
cbind(list_of_sce)
However, when I try to run this it produces an error at the quickCluster step:
Error: cannot allocate vector of size 23.7 Gb | {
"domain": "bioinformatics.stackexchange",
"id": 563,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rna-seq, r, normalization",
"url": null
} |
I was unaware of this function. In order to get the eigenvalues of the matrix , I'll solve the characteristic equation Step 3. eigenvalue will be printed as many times as its multiplicity. In this section we will solve systems of two linear differential equations in which the eigenvalues are real repeated (double in this case) numbers. This paper discusses characteristic features and inherent difficulties pertaining to the lack of usual differentiability properties in problems of sensitivity analysis and optimum structural design with respect to multiple eigenvalues. The general solution is Y~(t) = e3t C 1 C 1 + C 2 + tC 2 Sketch the phase portrait: 2. 2 Repeated Eigenvalues. This process can be repeated until all eigenvalues are found. On the other hand, when it comes to a repeated eigenvalue, this function is not di erentiable, which hinders statistical inference, as the asymptotic theory requires at least second-order di erentiability. Recall that the general solution in this case | {
"domain": "rk-verlag.de",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9888419697383903,
"lm_q1q2_score": 0.8591323757389555,
"lm_q2_score": 0.868826771143471,
"openwebmath_perplexity": 450.8891887879132,
"openwebmath_score": 0.8856151103973389,
"tags": null,
"url": "http://tsrd.rk-verlag.de/repeated-eigenvalues.html"
} |
game, vba, excel, tetris
Title: Excel VBA Multiplayer Tetris Game Loop Repaint Rate While searching VBA Excel Tetris games online, I noticed several single player Tetris games but no multiplayer games.
I am looking for a better strategy to manage the speed of the Application and to eliminate the flickering caused by toggling Application.ScreenUpdating.
Not toggling Application.ScreenUpdating will all but eliminate the flickering that you see in the Gif below. It will still flicker some while playing a 4 player game. The problem with this is that it increases the amount of time it takes for the Do Loop to cycle.
I count each cycles as a tick and check for key presses and repaint the board based on these ticks. Hence, as the ticks per second changes depending on toggling Application.ScreenUpdating or the number of player so does the games performance.
Ticks per second | {
"domain": "codereview.stackexchange",
"id": 29783,
"lm_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, vba, excel, tetris",
"url": null
} |
java, performance, integer
What? Maybe I'm just being dumb, but I can't figure this out for the life of me. A comment with a brief description of what's going on would help a lot -- a one-line comment at the beginning of the for stating what it does and how that ties in to the method would be enough.
Why are your method names so short? You use mul instead of multiply or times, and (Nevermind! See Note 1) shift32 doesn't say anything about in what direction it shifts, or its purpose. Admittedly, the purpose is probably too long for a method name, but this is a case where a Javadoc comment would be a good idea. | {
"domain": "codereview.stackexchange",
"id": 14356,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, performance, integer",
"url": null
} |
$\displaystyle F(\bar X_t)\le G(X_t) - \int_0^t\xi\,dX$ (3)
for some nonnegative predictable process ${\xi}$. It is relatively straightforward to show that (2) follows from (3) by noting that the integral is a submartingale and, hence, has nonnegative expectation. To be rigorous, there are some integrability considerations to deal with, so a proof will be included later in this post.
Inequality (3) is required to hold almost everywhere, and not just in expectation, so is a considerably stronger statement than the standard martingale inequalities. Furthermore, it is not necessary for X to be a submartingale for (3) to make sense, as it holds for all semimartingales. We can go further, and even drop the requirement that X is a semimartingale. As we will see, in the examples covered in this post, ${\xi_t}$ will be of the form ${h(\bar X_{t-})}$ for an increasing right-continuous function ${h\colon{\mathbb R}\rightarrow{\mathbb R}}$, so integration by parts can be used, | {
"domain": "almostsuremath.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9828232909876816,
"lm_q1q2_score": 0.8147003759285792,
"lm_q2_score": 0.8289388167733099,
"openwebmath_perplexity": 196.22386267458265,
"openwebmath_score": 0.9254615306854248,
"tags": null,
"url": "https://almostsuremath.com/tag/math-pr/page/2/"
} |
My final word is optimize your code to lower down your REAL-TIME complexity rather make full attention on time complexity to think of.
[EDIT]: Real-Time complexity I will try to clarify this according to time-complexity in descending order:
• Linear Search + Array Rewriting:
Worst Case = Average Case: O(N) * O(N + N) = O(2N^2) (contained some "if" to get best case O(N))
• Linear Search + Element-Swapping:
Average Case: O(N) * O(N + N) = O(2N^2) (contained some "if" to get best case O(N))
Worst Case: could be O(N^3+N^2)
• Linear Search + Half-Right Swapping:
Worst Case: O(N) * O(N + N/2) = O(3/2 * N^2) (inversely-linear order, obtained by averaging left to right)
• Linear Search + Pivot ("j"-index) <--> Key ("i"-index) Swapping:
Worst Case: O(N) * O(N + N/4) = O(5/4 * N^2) (inversely-linear order:, obtained by averaging left to right)
Average Case: O(N) * O(N + N/16) = O(16/15 * N^2) (inversely-linear order, obtained by averaging left to right) | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9632305307578323,
"lm_q1q2_score": 0.8468210105322376,
"lm_q2_score": 0.8791467706759583,
"openwebmath_perplexity": 10169.68110755711,
"openwebmath_score": 0.29447346925735474,
"tags": null,
"url": "https://cs.stackexchange.com/questions/65568/why-is-the-time-complexity-of-insertion-sort-not-brought-down-even-if-we-use-bin"
} |
python, performance, json, csv, pandas
I want to implement next page token but cannot think of a way which woudn't make it all a mess. Another thing I wish to improve is my csv writing block. And dealing with redundancy.
I further plan to concatenate all the csv files into one(but still keeping the original separate files).
Please note that I'm new to programming, in fact this is actually one of my first programs to achieve something. So please elaborate a bit more when need be. Thanks!
Use the csv library
x.writerows(custom_tuple(row) for row in data['results'])
Grabbing mutable data from the global scope is, I'm pretty sure, poor form. You should pass data as an argument to search_output.
Just pass in data['results'] as results, not the whole data object.
Consider calling it output_search_results.
Consider using precise type hints.
The existing argument search is being used as a file-name, so call it filename.
Pass the csv-writer object in as an argument to output_search_results. | {
"domain": "codereview.stackexchange",
"id": 35004,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, json, csv, pandas",
"url": null
} |
c++, stack
--count;
return tempval;
}
}
/*
Print all the elements
*/
template<typename T> void Stack<T>::Print() {
if (count == 0) {
cout << "No elements to print" << endl;
return;
} else {
cout << "Printing from top of the Stack to Bottom" << endl;
Node* node = last;
while (node != NULL) {
cout << node->value << "->";
node = node->next;
}
cout << endl;
}
}
/*
Get the size of the Stack
*/
template<typename T> size_t Stack<T>::Size() {
return count;
}
/*
Main function
*/
int main() {
Stack<int> s;
s.Push(12);
s.Push(10);
s.Push(23);
s.Push(34);
cout << "The value Popped from the Stack: " << s.Pop() << endl;
s.Print();
return 0;
} NULL versus nullptr
You shouldn't be using NULL, as you did in various places, like here: | {
"domain": "codereview.stackexchange",
"id": 15549,
"lm_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++, stack",
"url": null
} |
11. Dec 16, 2011
### Office_Shredder
Staff Emeritus
The calculation used in the OP is absolutely solid and a very elegant way to solve this problem. It requires two things:
1) Every way of sorting 3 wins and 2 losses can be corresponded to an actual best out of 5 series
2) Every best out of 5 series corresponds to a different 3 win 2 loss series
Then the number of ways that you can have a 3 win 2 loss combination is exactly equal to the number of best out of 5 series.
12. Dec 18, 2011
### awkward
The winner must win the last game in the series, and the series can be 3, 4, or 5 games long.
Let's consider the 5-game case, for example. The winner must win the last game. Then he can win any 2 of the previous 4. So there are C(4,2) ways for him to win.
The 3- and 4-game series are similar. Work them out and add up the ways. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9893474897884492,
"lm_q1q2_score": 0.8265835361401433,
"lm_q2_score": 0.8354835330070838,
"openwebmath_perplexity": 596.8107944920438,
"openwebmath_score": 0.48757830262184143,
"tags": null,
"url": "https://www.physicsforums.com/threads/a-somewhat-simple-probabilty-problem.560724/"
} |
ds.algorithms, graph-theory, matching
Title: Is there an extension to the stable roommates problem with multiple roommates per room? The stable roommates problem presents a set of N two-person rooms and 2N would-be roommates with preferences over each other, and asks for a stable allocation of roommates to rooms (and, really, to each other). There is an efficient algorithm which finds a solution, if there is one.
Is there an extension of this problem to rooms which can take more than two people?
Such an extension does seem challenging, because so much of the definition of the problem rests on the fact that roommates are in pairs, which means that each roommate only shares with a single other. This makes comparisons between potential pairings trivial - does the roommate prefer this partner or that one? Asking whether a roommate prefers one set of partners or another is much harder. Still, i'm interested in any approaches which have been taken! Switching from 2 to 3 "beds" makes the problem NP-complete :-) | {
"domain": "cstheory.stackexchange",
"id": 2859,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ds.algorithms, graph-theory, matching",
"url": null
} |
not etc. (2) If $M$ has some nonzero leading principal minor, then $M$ is indefinite. $\left[\begin{array}{ccc}0 & 0 &0\\0 & 1 & 0\\0 & 0 & -1\end{array}\right]$ is indefinite, for instance. Also equivalently, $x^TAx$ is positive for at least one Sponsored Links Tried several iterations with various mesh sizes and tolerances, and continue to get the failure message "matrix singular or indefinite, no results saved". Asking for help, clarification, or responding to other answers. For example, if the first row and column of a symmetric matrix $M$ is zero, the matrix might be positive-semidefinite, negative-semidefinite, or indefinite, yet all of the leading minors will be zero. A matrix is positive definite if it’s symmetric and all its pivots are positive. Are there any stars that orbit perpendicular to the Milky Way's galactic plane? Therefore, $A$ is a positive definite matrix. By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy. Thanks | {
"domain": "jefftate.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9658995742876885,
"lm_q1q2_score": 0.8028007080186048,
"lm_q2_score": 0.8311430394931456,
"openwebmath_perplexity": 563.3175635129414,
"openwebmath_score": 0.6975210905075073,
"tags": null,
"url": "http://jefftate.com/4v8mtzwn/fea52e-how-to-prove-a-matrix-is-indefinite"
} |
There is a bit of a difficulty in your problem so first I will do a simpler one: show from the definition that $$\lim_{n\to\infty}\frac{n^2+n-2}{4n^2+5}=\frac{1}{4}\ .$$ In this case we could work as follows: assume that $n>N$, where $N$ is yet to be chosen. Then we have \eqalign{\left|\frac{n^2+n-2}{4n^2+5}-\frac{1}{4}\right| &=\left|\frac{4n-13}{4(4n^2+5)}\right|\cr &=\frac{4n-13}{4(4n^2+5)}\cr} provided $n\ge4$. Now we can make a fraction bigger by increasing the numerator and/or decreasing the denominator. Since $4n-13<4n$ and $4n^2+5>4n^2$, we have \eqalign{\frac{4n-13}{4(4n^2+5)} &<\frac{4n}{4(4n^2)}\cr &=\frac{1}{4n}\cr &<\frac{1}{4N}\ ,\cr} and this will be less than $\varepsilon$ provided $N>1/(4\varepsilon)$. So the proof would look something like this.
Let $\varepsilon>0$.
Choose $\displaystyle N=\max\Bigl(4,\,\frac{1}{4\varepsilon}\Bigr)$.
Suppose $n>N$. Then $$\left|\frac{n^2+n-2}{4n^2+5}-\frac{1}{4}\right|=\cdots\ \hbox{[working]}\ \cdots<\varepsilon\ .$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9923043512285254,
"lm_q1q2_score": 0.8066117787109172,
"lm_q2_score": 0.8128673201042492,
"openwebmath_perplexity": 192.0422871569654,
"openwebmath_score": 0.9543904662132263,
"tags": null,
"url": "https://math.stackexchange.com/questions/722056/show-and-prove-that-the-sequence-u-n-fracn2n-24n2-5-converges-to-1"
} |
ros, catkin, ros-kinetic, qt5, qt
install(
DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
And my snapcraft.yaml:
grade: devel
confinement: devmode
apps:
control-station:
environment:
QT_DEBUG_PLUGINS: 1
QML_IMPORT_TRACE: 1
command: desktop-launch roslaunch demine_control_station demine_control_station.launch
plugs:
- desktop
- desktop-legacy
- wayland
- unity7
- x11
- network
- network-bind
- joystick
- opengl
- home
parts:
workspace:
plugin: catkin
rosdistro: kinetic
catkin-packages: [demine_control_station, joy]
# catkin-ros-master-uri: http://chivit:11311
after: [desktop-qt5] | {
"domain": "robotics.stackexchange",
"id": 31838,
"lm_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, ros-kinetic, qt5, qt",
"url": null
} |
AQA Maths choose your GCSE subjects and see content solving quadratic inequalities bbc bitesize tailored! Gcse Maths specification, together with information and resources from each of … solving inequalities see... Be solved simply and Awarding Body information coordinate plane Home Economics: Food Nutrition... ( m\ ) is isolated on one side of the process up with: =. To make the coefficient of the unknown positive inequalities will change direction... read solving inequalities to see why process. Website uses cookies to ensure you get the best experience use in class as! Who support me on Patreon larger on the right, together with information and resources from of. To solving a quadratic inequality is a function whose degree is 2 where! Thanks to all of the unknown positive sheets are great to use in or. + a ) ( x + 1 ) pptx, 433 KB we are by! Simple take the square root of both sides so that solve the inequality this video you are searching (... The inequalities will change | {
"domain": "sypniewo.pl",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9664104904802132,
"lm_q1q2_score": 0.8135491347416908,
"lm_q2_score": 0.8418256452674008,
"openwebmath_perplexity": 834.1786525326811,
"openwebmath_score": 0.6119179129600525,
"tags": null,
"url": "http://sypniewo.pl/blog/7btoqci.php?id=03377b-solving-quadratic-inequalities-bbc-bitesize"
} |
can be visualized geometrically as points in the complex (Argand) plane. How do I provide exposition on a magic system when no character has an objective or complete understanding of it? The set of complex numbers includes all the other sets of numbers. rev 2021.1.18.38333, The best answers are voted up and rise to the top, Mathematics Stack Exchange works best with JavaScript enabled, Start here for a quick overview of the site, Detailed answers to any questions you might have, Discuss the workings and policies of this site, Learn more about Stack Overflow the company, Learn more about hiring developers or posting ads with us, You have $\not\subset$ if you construct them one after another. The imaginary numbers are also a subset of the complex: the complex numbers whose real part is zero. If I am blending parsley for soup, can I use the parsley whole or should I still remove the stems? Is it safe to keep uranium ore in my house? Complex numbers are numbers in the form a + b i a+bi a + | {
"domain": "com.au",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9719924810166349,
"lm_q1q2_score": 0.8682900169335366,
"lm_q2_score": 0.8933093968230773,
"openwebmath_perplexity": 267.5919787374287,
"openwebmath_score": 0.7106465101242065,
"tags": null,
"url": "https://www.weddingsupplierswa.com.au/viz6m3yu/is-real-number-a-subset-of-complex-number-489fe3"
} |
quantum-electrodynamics, antimatter, dirac-equation
By this interpretation, an electron in a bound state of negative energy under an attractive potential is indistinguishable from a positron in a positive energy state in the same potential. The "scattering" of the negative energy electron into a positive energy positron and conversely perturbs the VEV of the charge density around the nucleus (vacuum polarization) which in turn screens the Coulomb potential (Uehling potential). It is sometimes said that bound states of negative energy are indicative of a "vacuum collapse". | {
"domain": "physics.stackexchange",
"id": 38259,
"lm_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-electrodynamics, antimatter, dirac-equation",
"url": null
} |
algorithms, c++
Title: What operation is the algorithm performing? unsigned int input = 0xC116D9B5709FED85 unsigned int output = 0
while (input > 0 )
{
if (( input mod 2) == 1)
{
output += 1
}
input = floor(input / 2)
}
return output
I understand how the algorithm is working and using mod to break the input and then counting the number of times input is modded by 2 where it resulted 1. Basically checking if the number is odd. My question in the first place is howcome we can even store a huge hex like the one in question in an unsigned int. Doesn't it exceed the size limit of unsigned int. Secondly, if someone can help me understand the question would help alot. The algorithms counts the number of $1$s in the binary expansion of the input. The code as written seems a little weird because it’s not a function that can be applied to an input, it’s being specifically applied to the defined number. I certainly couldn’t tell you why it’s being applied to that number without a lot more context. | {
"domain": "cs.stackexchange",
"id": 9992,
"lm_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, c++",
"url": null
} |
java, beginner, swing, text-editor
No, putting everything in one giant class is not a good idea at all. It makes it impossible to reuse part of the code in other projects, it makes it really hard to find the code you are interested in, and it will also make it very hard to add new functionality later on (because you can't just concentrate on the relevant classes; you only have one class, so everything is relevant all the time).
A class should ideally only be responsible for one thing. So you might have a model class, which holds the entered text, and offers methods to manipulate it (such as search something in it, replace, etc). Saving/Loading should also happen in a separate class. And you could separate some gui elements into their own class as well (such as main menu, toolbar, search-and-replace window, etc).
You should also definitely split up your actions class. Give each action it's own class. And never use strings like this for program flow (if you must use your approach, use enums). | {
"domain": "codereview.stackexchange",
"id": 12706,
"lm_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, swing, text-editor",
"url": null
} |
special-relativity, photons, speed-of-light
So, I think that one should really spell out the limiting procedure,
accompanied with a physical model of how to take that limit.
(This reply elaborates on a similar post I made at
https://www.physicsforums.com/threads/massless-photon.900960/page-3#post-5842652 )
ref:
Einstein Never Approved of Relativistic Mass
The Physics Teacher 47, 336 (2009); https://doi.org/10.1119/1.3204111
Eugene Hecht
The Concept of Mass in the Einstein Year
https://arxiv.org/abs/hep-ph/0602037
L.B. Okun
On the Abuse and Use of Relativistic Mass
https://arxiv.org/abs/physics/0504110
Gary Oas | {
"domain": "physics.stackexchange",
"id": 56013,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, photons, speed-of-light",
"url": null
} |
learning how to norm matrix for my work. The text definition of the L2 norm is incorrect. The calculated result is correct though. Is says it''s the maximum eigenvalue of A, that is lambda_maxA. Instead it should say that it''s the largest spectral radius, that is sigma_maxA. The definition of the condition number depends on the choice of norm, as can be illustrated by two examples. If ‖ ⋅ ‖ is the norm defined in the square-summable sequence space ℓ 2 which matches the usual distance in a standard Euclidean space and is usually noted as ‖ ⋅ ‖, then. Lecture 6: Matrix Norms and Spectral Radii After a reminder on norms and inner products, this lecture introduces the notions of matrix norm and induced matrix norm. Then the relation between matrix norms and spectral radii is studied, culminating with Gelfand’s formula for the spectral radius. \$\begingroup\$ The matrix norm is a scalar not a vector. The operator norm on matrices for examples is defined using vectors, but it is a scalar | {
"domain": "loanjiv.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363517478327,
"lm_q1q2_score": 0.815954604485175,
"lm_q2_score": 0.8289388104343892,
"openwebmath_perplexity": 1453.6530556597222,
"openwebmath_score": 0.8842276334762573,
"tags": null,
"url": "http://loanjiv.com/Matrix%20Norm%20Definition"
} |
Out[57]:
<matplotlib.text.Text at 0x115a5d090>
This is the effect of calculating the power spectrum of a finite time series. There is nothing about discretizing the time series in here yet. Note that as $T$ gets larger, the power spectrum more closely approaches a delta function, with the "sidelobes" closer to fundamental peak, and the fundamental peak gets much taller. The fundamental peak is $T/2$ high.
The "sidelobes" are the subsidiary peaks on either side of the main peak. These sidelobes are highest at when $\left|\sin(\pi (f-f_0)T)\right|\approx 1$, or when $f-f_0\approx\frac{2n+1}{2T}$, except for the first time, which is burried in the roll off, so $\left|n\right|>0$. The sidelobe amplitudes are approximately
$$2T\left(\frac{1 }{\pi (2n+1)}\right)^2$$ | {
"domain": "jupyter.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9702399051935108,
"lm_q1q2_score": 0.8303809339096252,
"lm_q2_score": 0.8558511451289037,
"openwebmath_perplexity": 1260.127031729364,
"openwebmath_score": 0.9011425971984863,
"tags": null,
"url": "https://nbviewer.jupyter.org/github/jklymak/Phy411/blob/master/lectures/Lecture-05-Periodigrams.ipynb"
} |
microcontroller, ros-control, joint-trajectory-controller, controller-manager, robot-description
Originally posted by Panda1638 on ROS Answers with karma: 16 on 2017-07-25
Post score: 0
Original comments
Comment by Panda1638 on 2017-08-01:
I managed to implement the use of a different robot description. It was quite easy after i understood how everything works. I copied the joint_trajectory_controller package and renamed it. Than you need to register it under that name. To get a different description i added a parameter to the server.
Comment by drcra on 2018-05-24:
Could you please elaborate on what was required to "register it under that name"?
As my own comment said i managed to change the joint trajectory controller to get a parameter from the parameter server. If anyone is interested in details let me know.
Details: I basically just changed one line of code in the joint_trajectory_controller_impl.h from:
urdf::ModelSharedPtr urdf = getUrdf(root_nh, "robot_description"); | {
"domain": "robotics.stackexchange",
"id": 28437,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "microcontroller, ros-control, joint-trajectory-controller, controller-manager, robot-description",
"url": null
} |
physical-chemistry, kinetics, adsorption
Why does absorption have $[\ce{H}]x_m$ but desorption have $mx_m$?
As noted above, $m$ is a concentration term analogous to $[\ce{H}]$, but with different units.
Finally, for the reaction rate, where did they get $m(m−1)$?
See above.
why does the $k_\mathrm a$ term have $[\ce{H}]$ while the other terms do not?
The other terms use $m$ which, as explained above, is analogous to $[\ce{H}]$ in that they both reflect concentrations, $[\ce{H}]$ for hydrogen atoms in space and $m$ for hydrogen atoms on dust particles; they use different units as explained above.
What happened to the $mx_m$ that was mentioned above?
Since the full rate expressions have been written out, they have been replaced with integers, 0, 1, or 2, representing the concentration of hydrogen atoms on a dust particle.
Further, how did they derive the rate of change for $x_1$ and $x_2$? | {
"domain": "chemistry.stackexchange",
"id": 1474,
"lm_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, kinetics, adsorption",
"url": null
} |
keras, cnn, rnn, computer-vision
Title: ValueError in CNN+RNN model in keras I am trying to build a CNN+RNN model for a computer vision problem.
below is my code
def cnn_with_rnn(shape):
model = Sequential()
model.add(Conv2D(32, (3, 3), strides=(2, 2), activation="relu",kernel_initializer='truncated_normal',bias_initializer='truncated_normal', input_shape=shape))
model.add(MaxPool2D(pool_size=(2, 2)))
model.add(Conv2D(64, (3, 3), strides=(2, 2),kernel_initializer='truncated_normal',bias_initializer='truncated_normal', activation="relu"))
model.add(MaxPool2D(pool_size=(2, 2)))
model.add(Conv2D(128, (3, 3), strides=(2, 2),kernel_initializer='truncated_normal',bias_initializer='truncated_normal', activation="relu"))
model.add(LSTM(50))
model.add(Dense(1))
model.compile(optimizer=Adam(lr=1e-5), loss="mse", metrics=[custom_metric]) | {
"domain": "datascience.stackexchange",
"id": 3693,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "keras, cnn, rnn, computer-vision",
"url": null
} |
molecular-biology, virology, virus
You want to study some specific aspect of the virus. That's cool! Most people aren't just concocting virus. Generally, for viruses that humans can get, it's generally recommended/heavily encouraged to only use what you need for safety reasons. So, for example, you might transfect the one protein you think is important to see what it does by itself. After that, you might transfect the cell culture with the full virus, but with one important gene knocked-out. I used to make single-round HIV by using a plasmid for full-length HIV without a functioning envelope gene and another plasmid for VSV envelope; new HIV particles would be made infectious because of the VSV gene but after infecting they no longer had that gene anymore. Basically, a limited version of the virus, which leads me to... | {
"domain": "biology.stackexchange",
"id": 4517,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "molecular-biology, virology, virus",
"url": null
} |
electromagnetism, forces, magnetic-fields, electric-current, charge
that does not imply a nonzero charge density $\rho(\mathbf x)$ moving with the velocity field $\mathbf v(\mathbf x) = \mathbf J(\mathbf x)/\rho(\mathbf x)$: it implies a current density $\mathbf J(\mathbf x)$ in a neutral region with a vanishing charge density $\rho(\mathbf x)=0$. Jackson's claim, that the only force for that configuration is magnetic, is correct, as is his expression for that magnetic force. | {
"domain": "physics.stackexchange",
"id": 51451,
"lm_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, forces, magnetic-fields, electric-current, charge",
"url": null
} |
c++, performance, matrix, eigen
Thus incorporating another vector into U is of order n*n
Note that the initial step is a little different in that we want to find U so that
U'*U = inv( A + x*b*x' }
with A diagonal. Similar reasoning to the above leads to
Let M(i) = beta + Sum{ k>=i | a[k]*x[k]*x[k]}
Note M(i) = M(i+1) + a[i]*x[i]*x[i]
and M(0) = beta+x'*a*x
where a[i] = 1/A[i]
U[i,i] = sqrt( a[i]*M[i+1]/M[i])
U[i,j] = sqrt( a[i]/(M[i+1]*M[i])) * x[i]* a[j]*x[j] | {
"domain": "codereview.stackexchange",
"id": 29893,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, performance, matrix, eigen",
"url": null
} |
openni, xtion, openni-launch
Originally posted by Mivia with karma: 76 on 2013-02-05
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by bit-pirate on 2013-02-05:
Please post comments as comments, not answers. Thank you!
Comment by Mivia on 2013-02-06:
I certainly would have, if the system would allow me to comment on other than my own answers.
Comment by bit-pirate on 2013-02-06:
Ah, you might have run into those "karma" issues. I think, you will be able to comment everywhere, once you have a bit more karma. Let's see if we can get that changed.
Comment by Mivia on 2013-02-06:
Absolutely =)
I actually came up with a temporary workaround, so edited my answer so it actually is an answer now.
Comment by liborw on 2013-02-07:
Thanks, I haven't noticed the 2@0 option, it is not documented on the wiki.
Comment by Felix Endres on 2014-02-01:
Thanks from me too :-) | {
"domain": "robotics.stackexchange",
"id": 12353,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "openni, xtion, openni-launch",
"url": null
} |
inorganic-chemistry, oxidation-state
To sum these thoughts up, the more appropriate way to write the reaction would be
$$\ce{n WO3 + SnCl2 + 4 HCl → W_nO_{3n-1} + H2SnCl6 + H2O}$$
where $\ce{W_nO_{3n-1}}$ is homologous series analogous to the mixed-valence tungsten blues. On crystallographic level this can be seen as withdrawal of oxygen atoms from $\ce{WO3}$, which is isostructural to $\ce{ReO3}$ (Fig. 1a). New point defects are eliminated by introducing a crystallographic shear (CS, Fig. 1b). As the reduction proceeds, the octahedra $\ce{[WO6]}$ in this structure changing from corner-sharing to edge-sharing motif (Fig. 1c). (Caption and adapted illustration from [3, p. 1086].) | {
"domain": "chemistry.stackexchange",
"id": 11325,
"lm_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, oxidation-state",
"url": null
} |
organic-chemistry, reaction-mechanism, polymers, catalysis, phenols
Title: Mechanism of formaldehyde / phenol condensation The production of bakelite using this method, but with an acid as the catalyst is simple enough; a protonation of the carbonyl oxygen, followed by an electrophilic substitution to the ring. The subsequent cross-linkage formation is the same for both cases, but I can't figure out how the initial reaction
steps would work with a base as the catalyst. Google searches and the texts I have yield nothing.
How would the mechanism proceed with a base as the catalyst here? @Harry Holmes: Here is a simplified example of how the formation of Bakelite may occur under base-catalyzed conditions to incorporate formaldehyde as -CH2- at the ortho and para positions of phenol. There are a myriad of permutations as to the order of condensations. I have selected one that illustrates the Michael-like addition that seems to have eluded you. | {
"domain": "chemistry.stackexchange",
"id": 15416,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, reaction-mechanism, polymers, catalysis, phenols",
"url": null
} |
quantum-mechanics, homework-and-exercises, wavefunction, hamiltonian
What is the Hamiltonian after the change? If it is different from the Hamiltonian before the change, then why is it different? Would it be simpler to consider only the second Hamiltonian with the appropriate initial condition? As an intial condition, I am imagining some non-zero amplitude from $0$ to $L$ and zero amplitude from $L$ to $2L$. That would be consistent with the particle having been confined to the narrower well prior to time $t=0$. Is the wavefunction, as you have written it, consistent with the condition that the wavefunction is initially non-zero only over an interval that is $L$ wide? I am not be sure what your "$\pm$" means in your expression for $c_n$, but it looks to me like the wavefunction is spread over the entire $2L$ interval at $t=0$. Also, shouldn't the exponential factors be $\exp(-i(n^{2}\pi^{2}\hbar/8mL^{2})t)$, consistent with a well of width $2L$?
Approach | {
"domain": "physics.stackexchange",
"id": 21299,
"lm_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, wavefunction, hamiltonian",
"url": null
} |
performance, sql, sql-server
However I have a niggling feeling that you don't need to bother with the "count the number of records and if it's over 30, use that record" bit. I can't say for sure without seeing some of your data but it feels like you could just DISTINCT your core data set to reduce it to one row per meaningful set of measurements, and then do only one GROUPing operation.
I suspect that if you work on simplifying and clarifying your query, you will be able to see for yourself if this second grouping is necessary or not. When a query is as simple as it can be, wrong logic is usually easy to spot.
Comments, magic numbers and code that won't run
I'm also totally unclear where the magic number 30 comes into things. If you get a measurement per minute, which changes once per hour, I'd have expected the number 60 to feature, not 30.
Your code would benefit from clear comments explaining why constant numbers like this are what they are - more generally, your code would benefit from any comments at all. | {
"domain": "codereview.stackexchange",
"id": 18957,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, sql, sql-server",
"url": null
} |
discrete-signals, convolution
I guess for the spreading out part, applying a 1D gaussian convolution would work, but i am not sure about the timeshifting part. Can i convolve the signal below with another signal to actual timeshift it somehow? yes, you can convolve with $\delta[n - n_o]$ to delay your signal by $n_o$ samples.
I am guessing you know how to represent $\delta[n]$ in MATLAB. And for spreading the signal, you can do by time scaling as $x_{spread}[n] = x[\frac{n}{M}]$. So, basically, the overall operation becomes:$$x_{final}[n] = x[\frac{n}{M} - n_o]$$
In MATLAB you can simulate this by following code:
x = sin(2*pi*(0:0.01:1));
y = sin(2*pi*(0-0.1:0.005:1-0.1));
plot(x);hold on;plot(y);
Here, time-spread is by a factor of $2$ after shifting the signal by $10$ samples. | {
"domain": "dsp.stackexchange",
"id": 8703,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "discrete-signals, convolution",
"url": null
} |
machine-learning, svm
Pick any point $x_1$ on the first line.
Pick any point $x_2$ on the second line.
Project the vector $x_1 - x_2$ on the direction, perpendicular to two lines and measure the length of the projection.
Here's an illustration, just in case: you have two lines, one point taken on each line, the vector $x_2-x_1$ connects the two points. The dotted line is a perpendicular to the two lines. The vector $v$ points in the direction of the perpendicular, and the red segment shows the distance you want to measure.
This red distance is exactly the length of the projection of $x_2 - x_1$ onto the dotted line.
At this point we shall need three facts: | {
"domain": "datascience.stackexchange",
"id": 1256,
"lm_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, svm",
"url": null
} |
object. In Z the only addition is 0 C0 D0. For a matrix 1 indicates rows, 2 indicates columns, c(1,2) indicates rows and columns. The staining protein was visualized using ImmPACT DAB Peroxidase (HRP) Substrate. Three methods are provided for matrix multiplication. The data vector register group has EEW=SEW, EMUL=LMUL, while the offset vector register group has EEW encoding in the instruction and EMUL=(EEW/SEW)*LMUL. sum(axis=0) Sum of each column: apply(a,1,sum) a. Create R Vector An R Vector can contain one or. Multiplication of a vector by a scalar changes the magnitude of the vector, but leaves its direction unchanged. When you have two matrices of the same size, you can perform element by element operations on them. It is applicable only to vectors of type logical, numeric or complex. Here we first define a vector which we will call "a" and will look at how to add and subtract constant numbers from all of the numbers in the vector. A vector is a sequence of elements that share the | {
"domain": "salernoeventicultura.it",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9425067211996142,
"lm_q1q2_score": 0.8171870214192981,
"lm_q2_score": 0.8670357494949105,
"openwebmath_perplexity": 606.5306261851379,
"openwebmath_score": 0.6701095700263977,
"tags": null,
"url": "http://salernoeventicultura.it/cysr/multiply-each-element-of-vector-in-r.html"
} |
something about the curve of math\frac\ sin xxmath by means of its taylor series 1. Use this list of basic taylor series and the ident. Maclaurin series coefficients, a k can be calculated using the formula that comes from the definition of a taylor series where f is the given function, and in this case is sin x. Math 142 taylor maclaurin polynomials and series prof. Taylor polynomials and taylor series math 126 in many problems in science and engineering we have a function fx which is too complicated to answer the questions wed like to ask. | {
"domain": "web.app",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9773708019443873,
"lm_q1q2_score": 0.8144671259772371,
"lm_q2_score": 0.8333245932423308,
"openwebmath_perplexity": 202.36222339042013,
"openwebmath_score": 0.9050303101539612,
"tags": null,
"url": "https://pueclifdowntas.web.app/981.html"
} |
linear-algebra, tensor-calculus
Title: Writing a tensor with respect to a particular basis When defining tensors as multilinear maps, I am having trouble understanding why a tensor, let's say of type (2,1), can be written in the following way:
$$T = T^{\mu\nu}_{\rho} e_\mu \otimes e_\nu \otimes f^\rho$$
where $\{e_\mu\}$ is a basis for the vector space, and $\{f^\mu\}$ is its dual basis.
I know how to expand the tensor when applied to some generic vectors and covectors. So in the example above:
$$T(\alpha,\beta,X) = T(\alpha_\mu f^\mu,\beta_\nu f^\nu, X^\rho e_\rho) = \alpha_\mu \beta_\nu X^\rho T(f^\mu,f^\nu,e_\rho) = \alpha_\mu \beta_\nu X^\rho\, T^{\mu\nu}_{\rho}$$
How would I proceed from here? Can I just say $\alpha_\mu = \alpha_\nu f^\nu(e_\mu) = \alpha (e_\mu) $, and similarly for the others? Then I would get:
$$T(\alpha,\beta,X) = T^{\mu\nu}_{\rho}\, \alpha(e_\mu)\, \beta(e_\nu)\, f^\rho(X)$$ | {
"domain": "physics.stackexchange",
"id": 5050,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "linear-algebra, tensor-calculus",
"url": null
} |
$m = \frac{8000N[forward]}{0.5m/s^2[forward] + 5.39m/s^2[forward]}$
$m = \frac{8000N[forward]}{5.89m/s^2[forward]}$
$m = 1358.23kg$
The text book answer 1400kg rounded. So I think this answer is accurate. Correct me if I'm wrong.
4. I think we're just saying the same thing in different ways. I defined the frictional force opposite to the applied force and subtracted a positive value; you defined the frictional force in the same direction as the applied force and added a negative value. | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9808759632491111,
"lm_q1q2_score": 0.8317511918030392,
"lm_q2_score": 0.8479677583778257,
"openwebmath_perplexity": 310.34694490517967,
"openwebmath_score": 0.8307979106903076,
"tags": null,
"url": "http://mathhelpforum.com/math-topics/138332-question-solvable.html"
} |
ros-groovy
Title: Problems with Installation of ROS-Groovy in Ubuntu 12.10
Dear all,
On a fresh install of ROS Groovy on Ubuntu 12.10 Quantal, there are unmet dependencies. I have verified that my sources.list.d file is properly set and updated.
I have been trying to search the root cause of this but it is not clear what I need to do.
This is what I get:
vmrguser@vmrg-xps-15:~$ sudo apt-get install ros-groovy-desktop-full
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
ros-groovy-desktop-full : Depends: ros-groovy-nodelet-core (= 1.7.14-0quantal-20130126-0955-+0000) but it is not going to be installed | {
"domain": "robotics.stackexchange",
"id": 12645,
"lm_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-groovy",
"url": null
} |
c#, .net, event-handling, networking, unity3d
public Response(int id, string description)
{
this.id = id;
this.status = MessageStatus.Ok;
this.description = description;
}
public Response(int id, MessageStatus status, string description)
{
this.id = id;
this.status = status;
this.description = description;
}
} | {
"domain": "codereview.stackexchange",
"id": 15793,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, .net, event-handling, networking, unity3d",
"url": null
} |
ros, ros-melodic, teb-local-planner, turtlebot3
# Homotopy Class Planner
enable_homotopy_class_planning: True
enable_multithreading: True
simple_exploration: False
max_number_classes: 4
roadmap_graph_no_samples: 15
roadmap_graph_area_width: 5
h_signature_prescaler: 0.5
h_signature_threshold: 0.1
obstacle_keypoint_offset: 0.1
obstacle_heading_threshold: 0.45
visualize_hc_graph: False
# Differential-drive robot configuration
holonomic_robot: false
# Forward Simulation Parameters
sim_time: 0.8
vx_samples: 18
vtheta_samples: 20
sim_granularity: 0.05
On further research I have learned that the teb_local_planner requires the costmap_converter plugin to be able to make convergent paths. I also need help trying to figure out how to get the converter working.
Originally posted by distro on ROS Answers with karma: 167 on 2022-01-12
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 37344,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-melodic, teb-local-planner, turtlebot3",
"url": null
} |
# Wrong solution in Mathematical Fundamentals-->Probability-->Complements Page 5 ?
I'm a complete newbie here, so forgive me if this seems trivial to any of you, but the proposed solution to the quiz seems wrong to me. In short: It is stated that the probability of no rain in the next 3 days is 90%. The objective is to figure out the probability of rain tomorrow. The proposed solution is "Cannot be determined".
I did the following calculations: Let p(N) be the probability of no rain on a particular day. The complement is p(R) (rain on a particular day).
If the probability of no rain on 3 consecutive days is 0.9, then p(N)^3 = 0.9. <--> p(N) = 0.9^(1/3) = 0.96549 p(R) = 1 - 0.96549 = 0.03451
The only combinations of rainy vs non-rainy days with rain tomorrow are R-R-R, R-R-N, R-N-R, and R-N-N. Since we know the probabilities of rain and no rain on a particular day, we can calculate the probability of rain tomorrow: | {
"domain": "brilliant.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9852713891776497,
"lm_q1q2_score": 0.8294267249129268,
"lm_q2_score": 0.8418256472515683,
"openwebmath_perplexity": 1866.9903283934225,
"openwebmath_score": 0.977117121219635,
"tags": null,
"url": "https://brilliant.org/discussions/thread/wrong-solution-in-mathematical-fundamentals/"
} |
ros, catkin, include, find-package, library
with yours steps and adding this resolve the problem.
Comment by Raul Gui on 2015-06-19:
but if you put:
catkin_package(
INCLUDE_DIRS include
LIBRARIES create_lib
CATKIN_DEPENDS roscpp rospy std_msgs
DEPENDS system_lib
)
you get a CMake Error:
Project 'the_package' tried to find library 'my_package'. The library is neither a target nor
Comment by yash_5 on 2018-11-07:
After following the above steps, I get the following error.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/custom_install.cmake:13 (_install): install DIRECTORY given no DESTINATION! Call Stack (most recent call first): CMakeLists.txt:19 (install)
Comment by jayess on 2018-11-07:
@yash_5 you should probably create a new question and reference this. This is a fairly old question and the you'll probably get a better response by making a new one. | {
"domain": "robotics.stackexchange",
"id": 20720,
"lm_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, include, find-package, library",
"url": null
} |
cr.crypto-security, one-way-function
Do there exist (families of) one-way permutations which do not have a trapdoor (set)? | {
"domain": "cstheory.stackexchange",
"id": 465,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cr.crypto-security, one-way-function",
"url": null
} |
linear-systems, causality
In practice, the ideal low pass filter is of course replaced by some causal and stable system, and the corresponding discrete-time system approximating a fractional delay is causal. | {
"domain": "dsp.stackexchange",
"id": 12017,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "linear-systems, causality",
"url": null
} |
Since $e^t=1+t+O\!\left(t^2\right)$, set $t=\frac{\log(k)}x$ \begin{align} \lim_{x\to\infty}\left(\frac1n\sum_{k=1}^nk^{1/x}\right)^{nx} &=\lim_{x\to\infty}\left(1+\frac1n\sum_{k=1}^n\frac{\log(k)}x+O\!\left(\frac1{x^2}\right)\right)^{nx}\\ &=\lim_{x\to\infty}\left(1+\frac1n\sum_{k=1}^n\frac{\log(k)}x\right)^{nx}\lim_{x\to\infty}\left(1+O\!\left(\frac1{x^2}\right)\right)^{nx}\\[3pt] &=\lim_{x\to\infty}\left(1+\frac1n\frac{\log(n!)}x\right)^{nx}\cdot1\\[9pt] &=e^{\log(n!)}\\[15pt] &=n! \end{align} | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9838471613889295,
"lm_q1q2_score": 0.8133580581839296,
"lm_q2_score": 0.8267118004748677,
"openwebmath_perplexity": 3266.9278144554137,
"openwebmath_score": 0.2674434185028076,
"tags": null,
"url": "https://math.stackexchange.com/questions/2555807/limit-of-lim-limits-x-to-infty-left-frac1n-sum-k-1n-k1-x-righ"
} |
svm, scikit-learn, image-classification
Title: SVM prediction time increase with number of test cases I am using scikit-learn's SVM for the MNIST digit classification dataset. In order to improve the performance I extended the dataset by adding rotated samples. I was aware that SVM takes O(N^3) time to train the data, where N is the number of training vectors.
However even prediction seems to take increase polynomially, the number of test vectors is the same. Is there any explanation for this or some equation that relates prediction time to the number of training samples?
I am using a 3rd degree polynomial as the kernel with C=100.0. | {
"domain": "datascience.stackexchange",
"id": 704,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "svm, scikit-learn, image-classification",
"url": null
} |
python, python-3.x, chess
def checkCollisions(self, piece: p.Piece, victim: p.Piece, start: dict, end: dict):
"""Check whether a move will collide with a piece.
This function only applies to Rooks, Bishops and Queens."""
minY = min(start["y"], end["y"])
maxY = max(start["y"], end["y"])
minX = min(start["x"], end["x"])
maxX = max(start["x"], end["x"])
rookMove = False
if isinstance(piece, p.Rook) or isinstance(piece, p.Queen):
if start["x"] == end["x"]:
claim = self.board[minY:maxY, start["x"]]
rookMove = True
elif start["y"] == end["y"]:
claim = self.board[start["y"], minX:maxX]
rookMove = True
if rookMove:
for i in claim:
if i != piece and i != victim:
if i.initialised:
block = self.convertToAlphaCoords({"x": i.x, "y": i.y}) | {
"domain": "codereview.stackexchange",
"id": 41994,
"lm_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, chess",
"url": null
} |
ros, topic
How to do that?
Thanks!
Originally posted by yichu on ROS Answers with karma: 42 on 2012-03-28
Post score: 0
You could look which nodes are being launched looking rxgraph before and after you run that command.
Once identified them you can look at which topic are publishing each one of them...
Originally posted by Jep with karma: 195 on 2012-08-29
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 8780,
"lm_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, topic",
"url": null
} |
python, beginner
If you add a bit of debugging code around that, you see it’s trying to process float('') and choking. You should probably ask the user for the dimension again.
Handle negative dimensions.
For example, if I tell you my triangle has base -5 and height 14, you tell me that the area is -35. That seems a bit odd – isn’t area always positive?
It’s not immediately obvious how you should handle negative quantities from the user – perhaps just call abs() on their input? – but the current approach isn’t very good.
Move the area_user_logic into an if __name__ == '__main__' block.
This just means tweaking the end of the program as follows:
if __name__ == '__main__':
print "This program will calculate/narea of some geometric shapes for you"
print "Shapes available are squares, triangles, circles, and trapezoid"
print "Enter square, rectangle, triangle, circle, or trapezoid"
area_calc_logic(raw_input("What area would you like to calculate? ")) | {
"domain": "codereview.stackexchange",
"id": 19211,
"lm_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",
"url": null
} |
(This answer will be very similar to halirutan's answer (+1). The difference is that I preserved the color function from the OP, and that I made a fixed bar legend.)
We can do it like in this answer, which is to say, we can turn off the color function scaling and scale the values ourselves in a way that is the same for all plots. We can make our own bar legend that matches this scaling. We only need to change three options:
ColorFunction -> (Hue[2 (1 - Rescale[#1, {-1, 1}])/3] &),
ColorFunctionScaling -> False,
PlotLegends -> BarLegend[{Hue[2 (1 - Rescale[#1, {-1, 1}])/3] &, {-1, 1}}]
Now we get plots like this:
• Hi C.E., this is exactly the solution I just found thanks to the link you posted before. Thanks to all of you guys for you help. – MicheleG Jul 16 '18 at 12:13
You have currently two mistakes. The first one is your color-function itself. It needs to give Hue[0] for a value of -1 and Hue[1] for a value of 1. The transformation is
col[v_] := Hue[Rescale[v, {-1, 1}]] | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9621075766298657,
"lm_q1q2_score": 0.8716596687088162,
"lm_q2_score": 0.9059898184796793,
"openwebmath_perplexity": 1206.5771255447112,
"openwebmath_score": 0.21097351610660553,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/178376/set-a-fixed-colour-scale-with-densityplot/178379"
} |
c#, thread-safety
The Dequeue method will return null when the queue is empty. I would encourage you to instead write a bool TryDequeue(out IItem) method, and/or have Dequeue throw when the queue is empty. This both brings you closer in line to standard library's Queue behavior, and helps keep null values out of your program.
The "item exists or queue is full" check in TryEnqueue is a pretty long line. You might add a private bool CanAdd(IItem) method to handle those details.
The inputBuffer is a Dictionary, but the values are never used. If you have no plans to use them, you might "Keep It Simple" by changing this to a HashSet.
An item can't be re-queued, even after being dequeued, because the inputBuffer is never cleared. I'm not sure if this is intentional; if re-adding an item is a valid use case you'll want to evict that item's ID from the inputBuffer in Dequeue. | {
"domain": "codereview.stackexchange",
"id": 31940,
"lm_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#, thread-safety",
"url": null
} |
cosmological-inflation, cosmological-horizon
Working out the metric distance to the mirror at the time of reflection is trickier. If (nonstandard terminology warning) $D(a)$ is the comoving distance light can travel from scale factor $a$ to $∞$, then the scale factor at which the light hits the mirror is $D^{-1}\left(\frac12 D(1)\right)$. If all energy was dark energy and the expansion was exactly exponential then the solution would be $2$ exactly. Using central parameters from here I get $a\approx 2.09$, so the mirror distance is a bit higher, around 17 billion light years.
For what it's worth there's an exact expression for this function in a flat perfect dust+dark energy universe:
$$D(a) = \frac{c}{a \sqrt{Ω_Λ} H_0} \; {}_2F_1\left(\frac13,\frac12;\frac43;-\frac{Ω_m}{a^3Ω_Λ}\right)$$
where ${}_2F_1$ is the hypergeometric function. | {
"domain": "astronomy.stackexchange",
"id": 4914,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cosmological-inflation, cosmological-horizon",
"url": null
} |
poles-zeros, highpass-filter
Title: Poles and zeros map, High pass filter Given the following poles and zeros map I have to identify qualitatively, which filter type is represented (Low-Pass, High-Pass, ...). In the solution it says, that this is a high pass filter. | {
"domain": "dsp.stackexchange",
"id": 7683,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "poles-zeros, highpass-filter",
"url": null
} |
the statement "$-1 = 1$" and$Q$denotes "$1 = 1$", the preceding argument shows "$P$implies$Q$and$Q$is true", which does not eliminate the possibility "$P$is false". What you can do logically is start ("provisionally", on scratch paper) with the statement$P$you're trying to prove and perform logically reversible operations on both sides until you reach a true statement$Q$. A proof can then be constructed by starting from$Q$and working backward until you reach$P$. Often times, the backward argument can be formulated as a sequence of equalities, conforming to your teacher's advice. (Note that in the initial phase of seeking a proof, you aren't bound by anything: You can make inspired guesses, additional assumptions, and the like. Only when you write up a final proof must you be careful to assume no more than is given, and to make logically-valid deductions.) • Suppose you start with$1=1$, take the square root of both sides except use$-1$on the left and$1$on the right, and come up | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9799765557865637,
"lm_q1q2_score": 0.8852071480988408,
"lm_q2_score": 0.903294209307224,
"openwebmath_perplexity": 481.2578683796757,
"openwebmath_score": 0.8332354426383972,
"tags": null,
"url": "https://math.stackexchange.com/questions/1763978/can-you-use-both-sides-of-an-equation-to-prove-equality"
} |
ros-kinetic
Originally posted by stevemacenski with karma: 8272 on 2018-07-25
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by Miaow on 2018-07-25:
Thanks for your attention and patience! I take your 2nd suggestion and solve it! | {
"domain": "robotics.stackexchange",
"id": 31344,
"lm_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-kinetic",
"url": null
} |
c++, performance, beginner, networking, udp
case TOUCH:
for(unsigned int i=0;i<sensors[j].data.size();i++)
{
sensors[j].data[i].touch = (atoi(value[i+1].c_str()))==1;
}
break;
case TTHS:
for(unsigned int i=0;i<sensors[j].data.size();i++)
{
sensors[j].data[i].tths = atoi(value[i+1].c_str());
}
case RTHS:
for(unsigned int i=0;i<sensors[j].data.size();i++)
{
sensors[j].data[i].rths = atoi(value[i+1].c_str());
}
break;
case FDAT:
for(unsigned int i=0;i<sensors[j].data.size();i++)
{
sensors[j].data[i].fdat = atoi(value[i+1].c_str());
}
break;
case BVAL:
for(unsigned int i=0;i<sensors[j].data.size();i++)
{
sensors[j].data[i].bval = atoi(value[i+1].c_str());
}
break; | {
"domain": "codereview.stackexchange",
"id": 25023,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, performance, beginner, networking, udp",
"url": null
} |
optics, laser, laboratory-safety
Title: Does a laser beam have to hit the eyes in order to damage them? Does a laser beam have to hit the eyes in order to damage them?
Or can a persons eyes get damaged by looking at a beam that goes past their eyes (e.g. looking at a laser beam moving inside an enclosure)?
If just looking at beam that goes past a person can damage the eyes, what factors would affect whether it is potentially dangerous? (like how strong would the beam have to be and how long would a person have to keep looking at it?) The Wikipedia article on Laser Safety completely covers how lasers damage the eye, what types of lasers there are (in terms of damaging potential), and other related topics. So I'll give the brief summary of relevant info here.
There are 4 main classifications of lasers (aptly named class 1 through class 4). | {
"domain": "physics.stackexchange",
"id": 91422,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, laser, laboratory-safety",
"url": null
} |
be. Question Asked 6 years, 3 months ago ( theorem 10.4.3 ) that T is distance if!, and several exercise problems are presented AT the end of the underlying manifolds, i.e is distance if... Tags diagonalization orthogonal ; Home theorem, orthogonal matrices have the property date 1. Diagonalize a matrix to be diagonalizable eigenvectors and eigenvalues of a set of matrices are... Examples of matrices that are and are not diagonalizable of real number, if we normalize each vector then! That T is distance preserving if and only if its matrix is orthogonal linear! A matrix a, meaning A= AT find the symmetric matrix a are merely orthogonal for matrix. Theorem 10.4.3 ) that T is distance preserving if and only if its matrix is orthogonal matrix \ P\... Are the general algorithms used for diagonalization of symmetric matrices - Quadratic Forms - Unitary, Hermitian, several! Length of 1 ) all eigenvalues of Aare real diagonalization with a general, non-orthogonal transformation story which | {
"domain": "konjac-maigrir.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9566342037088043,
"lm_q1q2_score": 0.8168821429002546,
"lm_q2_score": 0.8539127492339907,
"openwebmath_perplexity": 657.9242319926884,
"openwebmath_score": 0.8458123207092285,
"tags": null,
"url": "http://konjac-maigrir.com/quebec-city-ipsvqip/orthogonal-diagonalization-vs-diagonalization-185e1d"
} |
gravity, forces, black-holes, universe
It is usually taught that the gravitational force is the weakest but I wanted to know if it will be always so. For example, On earth gravity is weaker than electromagnetic force or weak nuclear force, so is it that on black hole also if gravity is strongest than other forces shall be more stronger than it or it's that gravity becomes most strong suppressing others.
Because if other forces increase in same proportion than it will have serious implications. Your question isn't as straightforward as you might think, because if you drop an atom into a black hole it will fall freely and will not feel any force attracting it to the black hole. This sounds odd, but it's the same reason that astronauts in the International Space Station feel weightless even though they're being attracted by the Earth's gravity. A freely falling object doesn't feel any gravitational force. | {
"domain": "physics.stackexchange",
"id": 4760,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gravity, forces, black-holes, universe",
"url": null
} |
homework-and-exercises, angular-momentum, quantum-spin, group-representations
\sqrt{\frac23}{\textstyle\left|10\right\rangle_{12}\left|\downarrow\right\rangle_3}+\sqrt{\frac13}{\textstyle\left|1-1\right\rangle_{12}\left|\uparrow\right\rangle_3},
$$
$$
{\textstyle\left|\frac12\frac12(1)\frac12:\frac32-\frac32\right\rangle}=
{\textstyle\left|1-1\right\rangle_{12}\left|\downarrow\right\rangle_3}.
$$ | {
"domain": "physics.stackexchange",
"id": 41223,
"lm_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, angular-momentum, quantum-spin, group-representations",
"url": null
} |
java, android, serialization, gson
Writer writer = null;
try {
OutputStream out = mContext.openFileOutput(mType, Context.MODE_PRIVATE);
writer = new OutputStreamWriter(out);
writer.write(tString);
} finally {
if (writer != null)
writer.close();
}
}
private void wipe()
throws JSONException, IOException {
Writer writer = null;
try {
OutputStream out = mContext.openFileOutput(mType, Context.MODE_PRIVATE);
writer = new OutputStreamWriter(out);
writer.write("");
} finally {
if (writer != null)
writer.close();
}
} | {
"domain": "codereview.stackexchange",
"id": 23802,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, android, serialization, gson",
"url": null
} |
selected item. Select/type your answer and click the "Check Answer" button to see the result. with the added twist that we have a negative number in there (-2i). To multiply monomials, multiply the coefficients and then multiply the imaginary numbers i. The tip of the diagonal is (0, 4) which corresponds to the complex number $$0+4i = 4i$$. Adding the complex numbers a+bi and c+di gives us an answer of (a+c)+(b+d)i. A General Note: Addition and Subtraction of Complex Numbers Addition Rule: (a + bi) + (c + di) = (a + c) + (b + d)i Add the "real" portions, and add the "imaginary" portions of the complex numbers. Finally, the sum of complex numbers is printed from the main () function. Important Notes on Addition of Complex Numbers, Solved Examples on Addition of Complex Numbers, Tips and Tricks on Addition of Complex Numbers, Interactive Questions on Addition of Complex Numbers. To add and subtract complex numbers: Simply combine like terms. i.e., | {
"domain": "mestaritalo.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9693241947446617,
"lm_q1q2_score": 0.8781978537051432,
"lm_q2_score": 0.9059898210180105,
"openwebmath_perplexity": 512.6572821089109,
"openwebmath_score": 0.7448074221611023,
"tags": null,
"url": "http://mestaritalo.com/orvovf1/addition-of-complex-numbers-5b5093"
} |
javascript, jquery
You'll note that you can just keep nesting the points indefinitely.
To render this as HTML, you can use a recursive function. Like this:
function buildList(parentElement, items) {
var i, l, list, li;
if( !items || !items.length ) { return; } // return here if there are no items to render
list = $("<ul></ul>").appendTo(parentElement); // create a list element within the parent element
for(i = 0, l = items.length ; i < l ; i++) {
li = $("<li></li>").text(items[i].title); // make a list item element
buildList(li, items[i].children); // add its subpoints
list.append(li);
}
}
And call it like so:
buildList($("#pageContent").empty(), points); | {
"domain": "codereview.stackexchange",
"id": 4950,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery",
"url": null
} |
quantum-state, information-theory, entropy, min-entropy
$$ H_{\textrm{min}}(A|B)_{\rho_{AB}} = - \textrm{log}_{2}\, \min_{\sigma_{B}}\, \textrm{tr}\sigma_{B}\,\,\,\,\,\,\,\, \textrm{subject to}\,\,\,\,\,\,\,\, \mathbb{I}_A \otimes \sigma_B - \rho_{AB} \geq 0\,, $$
so the optimal $\sigma_{B}$ must satisfy $\textrm{tr}\,\sigma_{B}= \big(\textrm{tr}\sqrt{\rho_A} \big)^{2}$, but I don't see how to prove this. Any help appreciated. I'll use an equivalent definition of the min-entropy
$$
\begin{aligned}
H_{\min}(A|B) = - \log_2 \min& \quad \lambda \\
\mathrm{s.t.}& \quad \rho_{AB} \leq \lambda I_A \otimes \sigma_B \\
& \quad \mathrm{tr}[\sigma_B] = 1 \\
& \quad \sigma_B \geq 0
\end{aligned}
$$ | {
"domain": "quantumcomputing.stackexchange",
"id": 4838,
"lm_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-state, information-theory, entropy, min-entropy",
"url": null
} |
ros, dynamixel-motor
Title: arbotix-m with dynamixel tutorial / example / doc?
does anyone know an example / tutorial / doc that shows how to use arbotix-m with dynamixel?
i got the dynamixel_motor package working with dynamixel servos (via usb2dynamixel).
but i couldn't get any where with arbotix working with dynamixel via their arbotix-m board. i couldn't find much documentation on ros wiki either. it seems like the docs are really outdated too.
i can run "arbotix_terminal", see all the servos, and control all of them just fine via command line. but i coulnd't control them in ros. i'm not sure which nodes / topics / params should be used.
i'd like to compare usb2dynamixel vs. arbotix-m as far as how they work with dynamixel servos.
any point of reference is much appreciated.
d | {
"domain": "robotics.stackexchange",
"id": 18805,
"lm_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, dynamixel-motor",
"url": null
} |
quantum-mechanics, quantum-interpretations
In this case, how "interaction" is defined?
In the example, above, say the particle on the right is classical: its probability of being is some $x(t)$ with momentum $p(t)$ is 1 at all times. Will the two particles interact as soon the probability of the two of being near each other is non zero? $\exists \epsilon,x: \; |\psi(x-\epsilon,x+\epsilon)|^2 > 0$.
And in this case the Born rule will roll the dice and take a definite position for the left particle? "Measurement" is only fuzzily defined. | {
"domain": "physics.stackexchange",
"id": 73951,
"lm_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-interpretations",
"url": null
} |
1. Since $X\in\tau\subseteq\tau^*$, $X$ is open in $X^*$. For density, the only point in $X^*\setminus X$ is $\infty$. Let $V$ be an open neighbourhood (in $X^*$) of $\infty$. Then $X\setminus V$ is closed and compact in $X$, but since we know that $X$ is non compact, then $X\setminus V\neq X$, so that $V\cap X\neq\varnothing$. This proves that $X$ is dense in $X^*$. The complement of $i(X)=X$ is the singleton $\left\{\infty\right\}$/
1. Note that $X^*$ is made up of two different parts: $X$ and the point $\infty$. We have to identify these parts in $X'$. It should be clear that $i'(X)$ acts as $X$, and that the remaining point in $X'$ acts as $\infty$. More precisely, let $\left\{\infty'\right\}=X'\setminus i'(X)$ (by property 3, the complement of $i'(X)$ is a singleton). Define $f:X^*\to X'$ by setting $f(x)=i'(x)$ for $x\in X$ and $f(\infty)=\infty'$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.965899570361222,
"lm_q1q2_score": 0.8090567587943364,
"lm_q2_score": 0.837619959279793,
"openwebmath_perplexity": 81.9461202306745,
"openwebmath_score": 0.9396802186965942,
"tags": null,
"url": "https://math.stackexchange.com/questions/1300027/question-on-one-point-compactification"
} |
electricity, electric-circuits, voltage
Also, and don't answer this if you consider this irrelevant, how is that a battery manages to establish a voltage in my wire?
Also I was wondering if the so-called "nonelectrostatic force" inside a battery is always equal to the electric force inside the battery? This is as much a chemistry question as it is an electricity question, because batteries are chemical devices. A battery is constructed such that there's a redox reaction split into two half-reactions which must move electrons through your circuit in order to complete. The reaction happens at a finite speed, and may also be limited by how fast various ions diffuse or drift through the cell.
The effect is that as you draw more current from a battery, the voltage on its terminals will droop; this can be approximated by imagining that you have an ideal battery with a resistor in series.
(There is also some actual electrical resistance in the battery's electrodes and internal wiring, of course, which can be significant sometimes.) | {
"domain": "physics.stackexchange",
"id": 32560,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electricity, electric-circuits, voltage",
"url": null
} |
propositions and their logical relationships from human.. An introduction to stochastic calculus and mathematics of financial derivatives university in the field calculus! ” in the United states enrolled in calculus classes at a deeper and more rigorous level a foundation for ib. System for the higher branch of mathematics known as “ Analysis ” there that considers the category... Maneuvering the human brain is Data Science theory and defines bisimilarity for π-calculus processes known as “ Analysis ” your... We make in this paper I feel one of the breakthroughs in maneuvering the human is... This is a stimulating question but mainly because of your use of “ a theory in! University in the field of calculus in Software Engineering field calculus is the study of differentiation integration! Study of differentiation and integration if there was a theory already out that! Features in theπ-calculus, as well as functional programming features and algebra is a stimulating question but mainly | {
"domain": "decathlon.ma",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.98998642789963,
"lm_q1q2_score": 0.8271173624659794,
"lm_q2_score": 0.8354835371034369,
"openwebmath_perplexity": 1260.029386765422,
"openwebmath_score": 0.4607601463794708,
"tags": null,
"url": "https://blog.decathlon.ma/jqtwcjd/calculus-theory-of-knowledge-ed1101"
} |
Here's a list of summations that are useful for this sort of thing. For your case, you need $4$ times the sum of the results for $i^2$ and $i$, so you get
$$4\left(\frac{n(n+1)(2n+1)}{6}+\frac{n(n+1)}{2}\right)=2n(n+1)\left(\frac{2n+1}{3}+1\right)=\frac{4}{3}n(n+1)(n+2)\;.$$
-
I will tell a story. We have $n+2$ people, and their ages are $1$, $2$, $3$, $4$, and so on up to $n+2$.
We want to choose $3$ people from these $n+2$ people. The number of ways to do this is $$\binom{n+2}{3}=\frac{(n+2)(n+1)(n)}{3!}$$
Let us count the number of ways of choosing the $3$ people in another way.
Let us first count the number of ways to choose the $3$ people, if the youngest person chosen is to be the $1$ year-old. Then we must choose $2$ people to go with the $1$ year-old, and this can be done in $\binom{n+1}{2}$ ways. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9808759610129464,
"lm_q1q2_score": 0.8086948906991646,
"lm_q2_score": 0.824461932846258,
"openwebmath_perplexity": 213.41931026844063,
"openwebmath_score": 0.9482619166374207,
"tags": null,
"url": "http://math.stackexchange.com/questions/45996/how-to-integrate-simple-discrete-function"
} |
python, iterator, reflection, variadic
As far as generally supporting multiple Python versions in a single codebase, six is a must use package.
Also note that instead of using inspect to pre-validate the number of arguments, you can follow the EAFP approach, call the function and handle a TypeError:
>>> f = lambda x, y: 'test'
>>> f(1,2,3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: <lambda>() takes exactly 2 arguments (3 given) | {
"domain": "codereview.stackexchange",
"id": 24315,
"lm_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, iterator, reflection, variadic",
"url": null
} |
ros, gazebo
Comment by Andrea on 2014-04-06:
Depends on the version of gazebo you are using. Is it the one from the osrf repositories? Could you give some more details?
Comment by PMilani on 2014-04-06:
Its Gazebo 2.2.2, I thought it was installed when I installed hydro as 1.9.+. 'apt-cache policy', lists the osrf i386 and amd64 repositories. An apt-get upgrade bought it up to Gazebo 2.2.2.
Comment by Andrea on 2014-04-06:
Hi actually if you install Hydro from ROS repositories the last version is gazebo 1.9.5. You probably installed the version you have from the osrf repositories. Delete the osrf repo and install hydro + gazebo from ros repo. Follow the passages I wrote in the answer ;)
Comment by PMilani on 2014-04-06:
Thanks Andrea that worked, I'd not followed your directions as Jose indicated I shouldn't need to. But in fact it seems that roslaunch works with version 1.9.5 and not with 2.2.2
Comment by Andrea on 2014-04-06:
Happy to hear that you solved the problem :) | {
"domain": "robotics.stackexchange",
"id": 3537,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, gazebo",
"url": null
} |
# Ask Uncle Colin: Can you prove $\sin(2x) \equiv 2\sin(x)\cos(x)$?
Ask Uncle Colin is a chance to ask your burning, possibly embarrassing, maths questions -- and to show off your skills at coming up with clever acronyms. Send your questions to colin@flyingcoloursmaths.co.uk and Uncle Colin will do what he can.
Dear Uncle Colin,
I find it easier to remember trigonometric identities if I can ‘see’ how they fit together. I’m expected to know that $\sin(2x) \equiv 2\sin(x)\cos(x)$, but haven’t been able to prove it. Any ideas?
— Geometry? Right Angles? How About Medians?
Hi, GRAHAM!
My favourite proof jumps out from a picture like this one:
Draw a right-angled triangle with hypotenuse 1 and an angle $x$; then draw its reflection in the adjacent side (so you have an isosceles triangle with angle $2x$ at the apex), as above. | {
"domain": "co.uk",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9890130563978902,
"lm_q1q2_score": 0.824168909074985,
"lm_q2_score": 0.8333245994514084,
"openwebmath_perplexity": 1219.602472949794,
"openwebmath_score": 0.8394639492034912,
"tags": null,
"url": "http://www.flyingcoloursmaths.co.uk/ask-uncle-colin-can-prove-sin2x-equiv-2sinxcosx/"
} |
experimental-realization, architecture, quantum-volume
It’s impossible to invent any single-number metric that’s ideal for all tasks. Even with classical computers, metrics such as Dhrystone or Windows Performance Index are at best suggestive at predicting performance on real-world tasks. Conversely, giving more than one number can potentially be much more informative. Within the quantum volume framework, I suggest when characterizing a QPU to give quantum volume as the “executive summary” but also quote for a range of different qubit numbers $N$ the model circuit depths $d(N)$. Comparing the $d(N)$ to the needed depth and qubits will be predictive, at least to the extent that the killer apps resemble the model circuit sequences of parallel random $SU(4)$ on random pairs of qubits. | {
"domain": "quantumcomputing.stackexchange",
"id": 326,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "experimental-realization, architecture, quantum-volume",
"url": null
} |
ros, moveit, rosserial, joint-states, buffer
Original comments
Comment by gvdhoorn on 2016-11-23:
Not an answer, but: JointState msgs are really typically used for reporting joint states, not for controlling them. Look into JointTrajectory and the related action servers. Ideally: write a hardware_interface for your controller and use ros_control. The JointState msgs ..
Comment by gvdhoorn on 2016-11-23:
.. that you are seeing are probably those published by one of the fake controllers in MoveIt, which are just there to make it possible to visualise things without needing real hardware.
Comment by karlhm76 on 2016-11-23:
Thanks for the info.
Yes I've been reading about this. I was simply trying to get the thing to work as easily as possible. I was reading that the fake controller published joint states and i already had something that worked with them, or so i thought.
Comment by karlhm76 on 2016-11-23: | {
"domain": "robotics.stackexchange",
"id": 26307,
"lm_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, moveit, rosserial, joint-states, buffer",
"url": null
} |
Asserting that the operation $$*$$ is not commutative means that there are elements $$a$$ and $$b$$ such that $$a*b\neq b*a$$. It does not mean that $$a*b\neq b*a$$ for any two distinct elements $$a$$ and $$b$$. Therefore, an operation may well not be commutative and, even so, to have an identity element. There is no contradiction here.
For an example of a non-commutative and non-associative algebraic structure with an identity element, take, for instance, the octonions.
An operation is commutative if for any $a$ and $b$, we have $ab=ba$. Finding one pair $a,b$ such that $ab=ba$ doesn't prove the operation is commutative; this has to hold for every pair. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9609517072737737,
"lm_q1q2_score": 0.8495190629626347,
"lm_q2_score": 0.8840392878563335,
"openwebmath_perplexity": 209.79413833762385,
"openwebmath_score": 0.8161306977272034,
"tags": null,
"url": "https://math.stackexchange.com/questions/2329528/can-a-binary-operation-have-an-identity-element-when-it-is-not-associative-and-c/2329532"
} |
homework-and-exercises, electrostatics
Title: Image charge of a grounded sphere These days I encoutered the famous grounded sphere near a charge problem, and I saw a pretty straight forward solution(for the image charge induced on the sphere). I am not sure if this solution is OK... so here it is:
Consider a charge $q$ at a distance $r$ from the center of a grounded, conducting sphere of radius $R$. Find the charge induced on the sphere. ($r>R$) | {
"domain": "physics.stackexchange",
"id": 37558,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, electrostatics",
"url": null
} |
inorganic-chemistry, transition-metals, symmetry, group-theory
So in the $\ce{D_{3\mathrm{h}}}$ group the $\ce{d_{z^2}}$ orbital transforms as the irreducible representation $A_{1}^{'}$ and the $\ce{p_{x}}$ and $\ce{p_{y}}$ orbitals transform as the irreducible representation $\ce{E^{'}}$. | {
"domain": "chemistry.stackexchange",
"id": 524,
"lm_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, transition-metals, symmetry, group-theory",
"url": null
} |
So, the writer was correct in all of her claims; she just didn’t realize she was asking two fundamentally different questions. That’s a pretty excusable lapse, in my opinion. Slips into conditional probability are often missed.
Perhaps the most famous of these misses is the solution to the Monty Hall scenario that vos Savant famously posited years ago. What I particularly love about this is the number of very-well-educated mathematicians who missed the conditional and wrote flaming retorts to vos Savant brandishing their PhDs and ultimately found themselves publicly supporting errant conclusions. You can read the original question, errant responses, and vos Savant’s very clear explanation here.
CONCLUSION:
Probability is subtle and catches all of us at some point. Even so, the careful thinking required to dissect and answer subtle probability questions is arguably one of the best exercises of logical reasoning around.
RANDOM(?) CONNECTION: | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9926541734255229,
"lm_q1q2_score": 0.8588683051427728,
"lm_q2_score": 0.865224091265267,
"openwebmath_perplexity": 1911.5803115971619,
"openwebmath_score": 0.6689112782478333,
"tags": null,
"url": "https://casmusings.wordpress.com/2015/08/"
} |
c#, reflection, extension-methods
private Disposable(Action dispose)
{
_dispose = dispose;
}
public static IDisposable Empty => new Disposable(() => { });
public static IDisposable Create(Action dispose)
{
return new Disposable(dispose);
}
public void Dispose()
{
_dispose();
}
}
Example usage
Now, when I have such a scenario, I can put everything inside the loop:
void Main()
{
var numbers = new[] { 1, 2, 3 };
foreach (var (item, context) in numbers.Using
(
outer: Disposable.Create (() => Console.WriteLine("Outer disposed.")),
inner: _ => Disposable.Create (() => Console.WriteLine("Inner disposed.")))
)
{
item.Dump();
context.Dump();
}
}
Then, when I refactor the previous ugly piece of code with this extension it turns into this: | {
"domain": "codereview.stackexchange",
"id": 35180,
"lm_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#, reflection, extension-methods",
"url": null
} |
machine-learning, python, nlp, reinforcement-learning, transformer
Thats how i'm going to train model. Bellow is how i'm going to use model at the inference time:
First of all set initial noise. Then make the same like in training loop, but don't save weights(weights will be updated according PPO, all steps, which were in "That's how i gonna get sorting-strings" will be executed, but when i get result from final iteration, i won't save this new weights which i get in inference time and if i need to surpass previous the best result, i will run inference loop with new initial noise till i surpass this result.)
What does here result from final iteration mean?:
That's exactly like in clip guided diffusion. I set some variable n_steps. For example it will be equal to 1000. Here i make 1000 calls to policy net, 1000 times update policy weights(if it's training time, at the inference time i also update weights but keep them in RAM memory and don't save)... And when i get final result at 1000th iteration, that means for me result from final iteration. | {
"domain": "datascience.stackexchange",
"id": 10926,
"lm_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, python, nlp, reinforcement-learning, transformer",
"url": null
} |
fluid-dynamics, flow, viscosity
Title: Equation for "tangential stresses across boundary" I am having trouble deciphering this sentence from Batchelor's An Introduction to Fluid Dynamics. It is at the end of the second paragraph of section 4.2 on Steady Unidirectional Flows.
Such a motion in the cross sectional plane can survive the viscous dissipation of energy only if there is a continual supply of energy to the fluid by tangential stresses exerted at a portion of the boundary in tangential motion, that is, as may readily be shown, only if $$ \mu \int n_2(ve_{22} + w e_{23}) + n_3(ve_{23} + w e_{33}) > 0 $$ | {
"domain": "physics.stackexchange",
"id": 64732,
"lm_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, flow, viscosity",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.