text
stringlengths
1
1.11k
source
dict
Let $g(x)=xf(x)$. we want to calculate $$\lim_{h\to 0}\frac{g(x+h)-g(x)}{h}.$$ Substituting, we find that we want $$\lim_{h\to 0} \frac{(x+h)f(x+h)-xf(x)}{h}.$$ Expand. We want $$\lim_{h\to 0} \left(\frac{xf(x+h)-xf(x)}{h}+f(x+h)\right).$$ This is $$x\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}+\lim_{h\to 0} f(x+h).$$ To finish, note that since $f$ is differentiable at $x$, it is continuous at $x$, so $\lim_{h\to 0}f(x+h)=f(x)$. • I don't understand what do you mean on "note that since $f$ is differentiable at $x$ ... so ...", how the limit $x lim_{h -> 0} ...$ (forth equation) becomes to $lim_{h->0}$ (last equation)? – auraham Nov 2 '13 at 5:53 • In the last display, we have $x\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$, which I left to you to recognize as $xf'(x)$. Then $\lim_{h\to 0}f(x+h)$ remains to be evaluated. Thus our answer will be $xf'(x)+f(x)$. I can prove the $\lim_{h\to 0}f(x+h)$ part if you wish. Probably this has been done in your course. – André Nicolas Nov 2 '13 at 5:59
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.98409360595565, "lm_q1q2_score": 0.8091110619452642, "lm_q2_score": 0.8221891261650248, "openwebmath_perplexity": 454.81532333691524, "openwebmath_score": 0.9517504572868347, "tags": null, "url": "https://math.stackexchange.com/questions/548712/derivative-using-limit-definition" }
the-sun, planet, earth what will the last few decades of Earth's life be like? Will the planet be heated to the point where its surface is like Mercury's sun-side? Will the sun's output drop low enough that it instead cools, like Mars? Will the sun expand and engulf the planet, or will the planet continue to orbit an expanded sun as a lifeless ball? Will the sun's expansion be gradual or rapid? How will this expansion affect the rocky planets nearest to it?
{ "domain": "astronomy.stackexchange", "id": 976, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "the-sun, planet, earth", "url": null }
snp, haplotypes Might someone know of a tool for this inference of known haplotypes from SNP data? It would be helpful even if someone could give me a name for this problem, as I'm not sure of the right term to search. It depends on the scale of the data (i.e. number of individuals, number of SNPs). Generally this can be done by matching up individual SNP genotypes to haplotype tag SNPs. The specific combination of genotyped SNPs is used to determine the underlying haplotype, based on tag SNP frequencies for each haplotype. More details of the process of identifying tag SNPs can be found here: https://www.broadinstitute.org/haploview/tagger
{ "domain": "bioinformatics.stackexchange", "id": 1704, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "snp, haplotypes", "url": null }
quantum-operation, unitarity Unitary representation. An isometric representation of the channel is \begin{equation} |0\rangle_{A} \rightarrow \sqrt{1-p}|0\rangle_{A}\otimes|0\rangle_{E}+\sqrt{p}|0\rangle_{A}\otimes|1\rangle_{E} \end{equation} \begin{equation} |1\rangle_{A} \rightarrow \sqrt{1-p}|1\rangle_{A}\otimes|0\rangle_{E}+\sqrt{p}|1\rangle_{A}\otimes|2\rangle_{E} \end{equation} In this case, unlike the depolarizing channel, qubit $A$ does not make any transitions in the $\left\{|0\rangle,|1\rangle\right\}$ basis. Instead, the environment "scatters" of the qubit occasionally (with probability $p$), being kicked into the state $|1\rangle_E$ if $A$ is in the state $|0\rangle_A$ and into the state $|2\rangle_E$ if $A$ is in the state $|1\rangle_A$. Furthermore, also unlike the depolarizing channel, the channel picks out a preferred basis for qubit $A$; the basis $\left\{|0\rangle,|1\rangle\right\}$ is the only basis in which bit flips never occur.
{ "domain": "quantumcomputing.stackexchange", "id": 5034, "lm_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-operation, unitarity", "url": null }
[cf, terml]; end; pet_cycleind_rel := proc(n) option remember; local dsjc, flat, p, cyc1, cyc2, l1, l2, res; if n=0 then return 1; fi; if n=1 then return a[1] fi; res := 0; for dsjc in pet_cycleind_symm(n) do flat := pet_flatten_term(dsjc); p := 1; for cyc1 in flat[2] do l1 := op(1, cyc1); for cyc2 in flat[2] do l2 := op(1, cyc2); p := p * a[lcm(l1,l2)]^(l1*l2/lcm(l1, l2)); od; od; res := res + flat[1]*p; od; res; end; gf := proc(n) option remember; local gf; gf := pet_varinto_cind(1+z, pet_cycleind_rel(n)); expand(gf); end;
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9854964186047326, "lm_q1q2_score": 0.8190884949516316, "lm_q2_score": 0.8311430457670241, "openwebmath_perplexity": 505.2541397078272, "openwebmath_score": 0.6827992796897888, "tags": null, "url": "https://math.stackexchange.com/questions/356995/counting-non-isomorphic-relations" }
The same procedure applies to higher dimensional n-D grids with $n\ge 2$ and requires computing cross-derivatives along all possible cross-directions. Therefore, 'makima' is supported not only in interp1, but also in interp2, interp3, interpn, and griddedInterpolant. Here's how 2-D 'makima' interpolation compares with 2-D 'spline' interpolation on gridded data generated with the peaks function: [X1,Y1,V1] = peaks(5); [Xq1,Yq1] = meshgrid(-3:0.1:3,-3:0.1:3); Vqs1 = interp2(X1,Y1,V1,Xq1,Yq1,'spline'); surf(Xq1,Yq1,Vqs1) axis tight title('2-D ''spline''') snapnow Vqm1 = interp2(X1,Y1,V1,Xq1,Yq1,'makima'); surf(Xq1,Yq1,Vqm1) axis tight title('2-D ''makima''') Notice the smaller undulations (or wiggles) generated by 'makima'. Finally, let's try 'makima' on an example with a few 2-D peaks where the data has sharp edges and steps:
{ "domain": "mathworks.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9865717432839349, "lm_q1q2_score": 0.8156104916575622, "lm_q2_score": 0.8267117898012104, "openwebmath_perplexity": 5639.307774254711, "openwebmath_score": 0.7745044231414795, "tags": null, "url": "https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/?s_tid=blogs_rc_2" }
cosmology, newtonian-gravity, symmetry, thought-experiment, observable-universe Hence my spaceship should start accelerating toward ×. By choosing the sphere large enough, I should be able to make it accelerate arbitrarily fast, and by choosing the location of × I can make it accelerate in any direction.
{ "domain": "physics.stackexchange", "id": 99163, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "cosmology, newtonian-gravity, symmetry, thought-experiment, observable-universe", "url": null }
forces, mass, water, weight Since the two points $A$ and $B$ are at the same altitude in the same fluid in a connected vessel, the pressure at both points is the same: $$P_A=P_B.$$ The pressure at point $A$ is the weight above it divided by the cross sectional area $A_1$ (ignoring the atmospheric pressure since it acts uniformly everywhere): $$P_A=\dfrac{W}{A_1}.$$ At point $B$, there is the hydrostatic pressure: $$P_B=\rho gh.$$ Let $\Delta h_1$ and $\Delta h_2$ represent the change in elevation of water level in the two vessels starting from the initial position when there was no weight placed on the balance. Let's define $z$ to be equal to $\Delta h_2$, and let's try to find the relation between the weight $W$ and $z$: \begin{align*} P_A&=P_B\\ \dfrac{W}{A_1}&=\rho gh. \end{align*}
{ "domain": "physics.stackexchange", "id": 51734, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "forces, mass, water, weight", "url": null }
palaeontology, herpetology between small size and greater specialization in the tropics; the possibility in poikilo-therms of heat conservation or of some other physiological process related to surface/volume ratio; selection for larger size in regions subject to winter food shortages; and an association between large adult size and high reproductive potential in cold regions. Other suggestions can be advanced, but all are conjectural and few are subject to test. Global size - latitude trends should be looked for in other living groups. Cite: Lindsey, C. C., 1966: Body sizes of poikilotherm vertebrates at different latitudes. Evolution: 456-465
{ "domain": "biology.stackexchange", "id": 2449, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "palaeontology, herpetology", "url": null }
mobile-robot, slam Occupancy Grid representation Feature-based mapping
{ "domain": "robotics.stackexchange", "id": 587, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "mobile-robot, slam", "url": null }
lambda-calculus, combinatory-logic Note: In the book, we assume that $\mathsf{Y} \equiv (\lambda ux. xuux)(\lambda ux. xuux)$. Further, for ease of notation, let $V \equiv (\lambda x y_1 \ldots y_n.Z)$. The problem is that when I check this with my own examples, I'm not getting this result. For example, suppose that neither $x$ nor any of $y_1, \ldots , y_n$ is in the free variables of $Z$ (to make it easy). Then this theorem asserts that if $X \equiv \mathsf{Y}(\lambda x y_1 \ldots y_n . Z)$, then $$ Xy_1 \ldots y_n =_{\beta, w} Z $$ When I check whether this true, I get $$ (\mathsf{Y}(\lambda x y_1 \ldots y_n . Z))y_1 \ldots y_n = (\mathsf{Y}V)y_1 \ldots y_n = (V\mathsf{Y}V)y_1 \ldots y_n =_{\beta, w} Zy_n $$ Am I doing something wrong? $\newcommand{\Y}{\mathsf{Y}}$ Did you leave out any parentheses by any chance? We should take $\Y = (\lambda u x . x (u u x)) (\lambda u x . x (u u x))$. Note that $x u u x$ is the same as $(x u u) x$, which is not the same as $x (u u x)$.
{ "domain": "cs.stackexchange", "id": 8107, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "lambda-calculus, combinatory-logic", "url": null }
c++, strings, c++11, interview-questions, edit-distance //check equality if (s1 == s2) return true; //otherwise try to erase last character in s1 and check again (since for loop may not check this character if s2 was smaller string size) else { s1.erase(s1.size() - 1, 1); if (s1 == s2) return true; } return false; }
{ "domain": "codereview.stackexchange", "id": 26516, "lm_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++, strings, c++11, interview-questions, edit-distance", "url": null }
So this gives one solution, with $x=sk$ and $y=tk$. Now suppose that $ax_1 + by_1 = c$ is a solution, and $ax+by=c$ is some other solution. Taking the difference between the two, we get $$a(x_1-x) + b(y_1-y) = 0.$$ Therefore, $a(x_1-x) = b(y-y_1)$. That means that $a$ divides $b(y-y_1)$, and therefore $\frac{a}{\gcd(a,b)}$ divides $y-y_1$. Therefore, $y = y_1 + r\frac{a}{\gcd(a,b)}$ for some integer $r$. Substituting into the equation $a(x_1-x) = b(y-y_1)$ gives $$a(x_1 - x) = rb\left(\frac{a}{\gcd(a,b)}\right)$$ which yields $$\gcd(a,b)a(x_1-x) = rba$$ or $x = x_1 - r\frac{b}{\gcd(a,b)}$. Thus, if $ax_1+by_1 = c$ is any solution, then all solutions are of the form $$x = x_1 - r\frac{b}{\gcd(a,b)},\qquad y = y_1 + r\frac{a}{\gcd(a,b)}$$ exactly as yunone said. To give you an example of this in action, suppose we want to find all integer solutions to $$258x + 147y = 369.$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9811668695588648, "lm_q1q2_score": 0.8397327960894309, "lm_q2_score": 0.8558511524823265, "openwebmath_perplexity": 447.78264724190035, "openwebmath_score": 0.9817954897880554, "tags": null, "url": "http://math.stackexchange.com/questions/20717/how-to-find-solutions-of-linear-diophantine-ax-by-c/20738" }
c, linked-list, pointers Title: Linked list - append, insert, print I am a beginner in C and am learning linked lists. I have made a program to implement a linked list, allowing certain operations on the linked list. There are 3 functions: addnode() adds node to end of list printlist() prints the whole linked list insertnode() inserts a node after a specified node addnode(): void addnode(struct node **head) { if (*head == NULL) { struct node *newNode = (struct node*) malloc(sizeof(struct node)); *head = newNode; printf("enter data: "); scanf("%d",&((*head)->data)); (*head)->node = NULL; } else { struct node *newNode = (struct node*) malloc(sizeof(struct node)); printf("enter data: "); scanf("%d", &(newNode->data)); newNode->node = NULL; struct node *temp = *head; while (temp->node != NULL) { temp = temp->node; } temp->node = newNode; } }
{ "domain": "codereview.stackexchange", "id": 41844, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c, linked-list, pointers", "url": null }
robots, multi-agent-systems The advantage of stigmergy-like models is that they are often simple and resilient: You can lose an ant without impact on the food-finding trail. On the downside, these models are usually slow, as the coordination takes time to emerge from indirect interactions. This can be improved upon by adding extra direct interactions (e.g. empowering ants with a GPS and a grocery store map, or just a magnetic-North sense).
{ "domain": "ai.stackexchange", "id": 50, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "robots, multi-agent-systems", "url": null }
notifications of new posts by email. Oct 2008 27 0. is the is impossible because vector and a Thread starter JG89; Start date Nov 18, 2009; Tags matrices product rank; Home. "Matrix product and rank", Lectures on matrix algebra. such How do you prove that the matrix C = AB is full-rank, as well? Rank. coincide. Proposition have just proved that any vector We are going matrix and coincide. https://www.statlect.com/matrix-algebra/matrix-product-and-rank. Taboga, Marco (2017). Notify me of follow-up comments by email. As a consequence, the space that can be written as linear combinations of the rows of column vector In most data-based problems the rank of C(X), and other types of derived product-moment matrices, will equal the order of the (minor) product-moment matrix. linearly independent Apparently this is a corollary to the theorem If A and B are two matrices which can be multiplied, then rank(AB) <= min( rank(A), rank(B) ). and be a This lecture discusses some facts about Here it is:
{ "domain": "discoverme.ca", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9811668728630677, "lm_q1q2_score": 0.8397327989173368, "lm_q2_score": 0.8558511524823265, "openwebmath_perplexity": 421.7119663277017, "openwebmath_score": 0.7659544944763184, "tags": null, "url": "http://discoverme.ca/tgeerpn1/archive.php?tag=d12907-rank-of-product-of-matrices" }
I would usually proceed with assigned variables, which may yield: $\begin{bmatrix}x1\\x2\\x3\end{bmatrix}$= r $\begin{bmatrix}0\\1\\0\end{bmatrix}$ + s $\begin{bmatrix}0\\0\\1\end{bmatrix}$ But even this feels odd, seeing as I'm assigning a variable to a pivot. Can someone please clarify this for me. Thank You. Welcome to MHB, Jundoe! I think you are trying to solve $x1$, $x2$, and $x3$ from: $$\begin{bmatrix}0 & 2 & -8\\0 & 2 & 0\\0 & 0 & 2\end{bmatrix} \begin{bmatrix}x1\\x2\\x3\end{bmatrix} = \begin{bmatrix}0\\0\\0\end{bmatrix}$$ Let me know if I am misunderstanding. Row reduction turns this into: $$\begin{bmatrix}0 & 1 & 0\\0 & 0 & 1\\0 & 0 & 0\end{bmatrix} \begin{bmatrix}x1\\x2\\x3\end{bmatrix} = \begin{bmatrix}0\\0\\0\end{bmatrix}$$ You correctly deduced that $x2=0$ and $x3=0$.
{ "domain": "mathhelpboards.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9773707960121132, "lm_q1q2_score": 0.8165772057101462, "lm_q2_score": 0.8354835330070839, "openwebmath_perplexity": 1204.8963278301437, "openwebmath_score": 0.872795820236206, "tags": null, "url": "https://mathhelpboards.com/threads/parametrization-from-matrix.7878/" }
thermodynamics, electromagnetic-radiation Title: EM Radiation and Heat If there is EM radiation, will there always be a heat exchange between the wave and its surroundings? If you have an extremely energy-efficient light bulb that converts ALL the energy it receives into visible light, will it still heat up the glass bulb? The origin of this question is a puzzle: You are in a basement. You cannot see the above floor. You have three light switches in basement and three light bulbs in the above floor, but you do not know which switch controls which bulb. Modify the switches in any way, but you can only go to check the bulbs once. When you check the bulbs, you must immediately know which switch controls which bulb. The solution is to turn on the switch for a long time to heat up the corresponding bulb, then turn on a second bulb. The light bulbs will be ON and HOT, ON and COLD, and OFF. This info can be used to find the corresponding switches.
{ "domain": "physics.stackexchange", "id": 12602, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics, electromagnetic-radiation", "url": null }
• @Evargelo Thanks for your response. It seems to me that showing that all prime factors of 8881 can't be > 89 isn't the same as showing that at least one prime factor of 8881 can't be greater that 89. That's why I believe it to be a flawed approach. – user7875067 Aug 11 '17 at 15:56 • You have to show that $8881$ has a prime factor that is at most 89. It means exactly the same than "at least one prime factor of 8881 isn't greater that 89", doesn't it ? – Evargalo Aug 11 '17 at 16:05 • @Evargelo The above proof shows that all of 8881's prime factors can't be > 89. But what about the case that some of 8881's prime factors are greater than 89, and some are less? – user7875067 Aug 11 '17 at 16:18 • In that case, at least one of them is smaller than 89. That's exactly what you want to prove. – Evargalo Aug 12 '17 at 11:09
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9643214470715364, "lm_q1q2_score": 0.8289921953537995, "lm_q2_score": 0.8596637541053281, "openwebmath_perplexity": 226.4746156293848, "openwebmath_score": 0.5971364974975586, "tags": null, "url": "https://math.stackexchange.com/questions/2390364/given-that-the-number-8881-is-not-a-prime-number-prove-by-contradiction-that-it" }
satisfiability, boolean-algebra, propositional-logic QBF solvers use both universal and existential quantification, so the distinction between normal forms for them is less rigid. Any QBF circuit can be transformed to CNF, DNF, or a mixed combination of the two, depending on the quantifications you choose for the Tseitin variables. In QBF solving, there is an alternative standard problem format, called QCIR, that maintains the original formulaic structure. See: Non-CNF QBF Solving with QCIR Last but not least, is there extra information relevant to the instance that isn't sufficiently captured by CNF? The answer to this is probably yes. If we consider resolution as a standard proof procedure for unsatisfiable SAT outcomes, then there exist counterexamples - namely the pigeonhole problem - where the size of the proof scales exponentially. Tseitin introduced a new system called "extended resolution" that nullified the exponential proof argument on the pigeonhole problem.
{ "domain": "cs.stackexchange", "id": 19043, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "satisfiability, boolean-algebra, propositional-logic", "url": null }
image-processing You will need the numpy, scipy and opencv modules before you run this method. If you need help in installing these modules, let me know in a comment. Without further ado, here's the code. import cv2 # For OpenCV modules (Morphology and Contour Finding) import numpy as np # For general purpose array manipulation # Load in image img = cv2.imread('uOyDn.png', 0) # Create a new image that pads each side by 20 pixels # This will allow the outlining of the text to be tighter # Create an image of all white imgPad = 255*np.ones((img.shape[0] + 40, img.shape[1] + 40), dtype='uint8') # Place the original image in the middle imgPad[20:imgPad.shape[0]-20, 20:imgPad.shape[1]-20] = img # Invert image # White becomes black and black becomes white imgBW = imgPad < 128 imgBW = 255*imgBW.astype('uint8') # Find all of the contours in the image contours,hierarchy = cv2.findContours(imgBW.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
{ "domain": "dsp.stackexchange", "id": 1981, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "image-processing", "url": null }
## Case 2b If $Q$ is entailed by the axioms $A$ together with the assumption $P$ but not by $A$ alone, then $P$ indeed is necessary in order to arrive at the contradiction, and the theorem is provable. But if $Q$ really is instrumental in making some of the steps in the proof, and we were not aware of this fact, then I think again we have an invalid proof of a true conclusion. Again, this is a possible result of human fallibility that can also happen in direct proofs. ## Conclusion Taking all the cases together, there really are only two ways for a proof by contradiction to go wrong. One is if we are working with an inconsistent set of axioms, which is very bad news altogether. The other is if we have an unjustified step somewhere in the proof.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9678992969868542, "lm_q1q2_score": 0.8302331422784414, "lm_q2_score": 0.8577681013541613, "openwebmath_perplexity": 267.8752633120478, "openwebmath_score": 0.7733908295631409, "tags": null, "url": "https://math.stackexchange.com/questions/2460945/in-a-proof-by-contradiction-how-do-we-know-the-assumption-is-the-cause-of-the-c" }
python, multithreading, sorting, file, audio But I've left out proper handling of streams, in most languages, that I've used streams in, it's recommended to always close the steam. In Python it's the same. You can do this normally in two ways: Use with, this hides a lot of the code, so it makes using streams seamless. It also makes people know the lifetime of the stream, and so people won't try to use it after it's been closed. Here's an example of using it: with wave.open('<file location>') as wf: print(wf.readframes(1024)) Use a try-finally. You don't need to add an except clause to this, as if it errors you may not want to handle it here, but the finally is to ensure that the stream is closed. Here's an example of using it: p = pyaudio.PyAudio() try: stream = p.open(...) try: # do some stuff finally: stream.stop_stream() stream.close() finally: p.terminate()
{ "domain": "codereview.stackexchange", "id": 25331, "lm_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, multithreading, sorting, file, audio", "url": null }
node.js, authentication, ecmascript-6, promise, express.js // check if password matches if (compareResult) { //some logic here setLoginFailureCount(user, loginFailureCount).then(() => { setLastLogin(user) .then(() => { //some logic here }) .catch((err) => { //some logic here }); }) .catch((err) => { //some logic here }); } else { //login failed loginFailureCount = loginFailureCount + 1; setLoginFailureCount(user, loginFailureCount) .then(() => { //some logic here }) .catch((err) => { //some logic here }); } }); } }) .catch((err) => { //some logic here }); }
{ "domain": "codereview.stackexchange", "id": 25767, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "node.js, authentication, ecmascript-6, promise, express.js", "url": null }
homework-and-exercises, special-relativity, classical-electrodynamics Indeed, if one has $a_\mu a^{\mu} = 0$ at any time, then it is easy to show that the three-acceleration is zero, $a = 0$, and therefore $\dot a^\mu = 0$. The first part is obviously true because $a_\mu a^{\mu}$ is a Lorentz invariant, and evaluated in the proper frame gives $a^2= 0$. But I don't see how this then implies $\dot a^\mu = 0$. I assume that "any time" means "every time" actually. It holds $v^cv_c=-1$, where $v$ is the four-velocity, so taking the derivative with respect to the proper time we also have $a_cv^c=0$. This identity implies that $a_0=0$ in the rest frame of the particle. If, in addition, the constraint is valid $a_ca^c=0$ at every instant of proper time, this identity, again considered in the rest frame of the particle, implies $\vec{a}\cdot\vec{a} =0$ at every time. Thus all components of $a$ vanish in that reference frame. As we are dealing with a four-vector, its components vanish in every reference frame at every instant of proper time.
{ "domain": "physics.stackexchange", "id": 40798, "lm_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, special-relativity, classical-electrodynamics", "url": null }
second-quantization, klein-gordon-equation But then we have $\delta^3(0)$ in an integral over the entire $k$-space. Consider a system of $k=1, \ldots, N$ uncoupled harmonic oscillators with angular frequencies $\omega_k$. The Hamiltonian $H$, expressed in terms of ladder operators $a_k$ and $a_k^\dagger$ satisfying the commutation relations $[a_k, a_\ell^\dagger]=\delta_{k \ell} \mathbf{1}$, $[a_k,a_\ell]=0$, is given by $$H= \sum\limits_{k=1}^N \frac{\omega_k}{2} \left(a_k a_k^\dagger+a_k^\dagger a_k \right)=\sum\limits_{k=1}^N \omega_k\left(a_k^\dagger a_k +\frac{1}{2} \mathbf{1}\right), \tag{1} \label{1}$$ where the commutation relation $a_k a_k^\dagger= a_k^\dagger a_k +\mathbf{1}$ was used to arrive at the second form of the Hamiltonian. As the groundstate (the state of lowest energy) $|0\rangle$ of this sytem is characterized by $$a_k |0\rangle=0 \quad \forall \; k=1,\ldots, N, \tag{2} \label{2}$$ the ground state energy $E_0$ (i.e. the smallest eigenvalue of $H$) is given by $$ E_0=\frac{1}{2}\sum\limits_{k=1}^N
{ "domain": "physics.stackexchange", "id": 99525, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "second-quantization, klein-gordon-equation", "url": null }
c#, inheritance, unity3d public ContentButton Init(string contentPath, bool isActive) { base.Init(); // standard constructor like stuff this.contentPath = contentPath; this.isActive = isActive; return this; } private void Awake() { base.Awake(); /* Perform any initialization logic here, like reading the file at contentPath. */ } /* other MonoBehaviour callbacks omitted */ }
{ "domain": "codereview.stackexchange", "id": 30986, "lm_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#, inheritance, unity3d", "url": null }
cosmology, astronomy, universe, space-expansion, redshift So all these considerations are interconnected, and the thought process is not just linear from observation to conclusion. We come up with models, explore their implications, compare to observations, if necessary adjust the models, and do this with many models in parallel. The scientific process is often one of guessing and fitting; much like a young kid, who knows nothing about equations, can still solve a riddle like "what number plus 5 is equal to twice that number?"
{ "domain": "physics.stackexchange", "id": 43895, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "cosmology, astronomy, universe, space-expansion, redshift", "url": null }
general-relativity, differential-geometry, coordinate-systems, tensor-calculus $$X'_1 = \frac{\partial \tilde{f}}{\partial r}\frac{\partial r}{\partial x} + \frac{\partial \tilde{f}}{\partial \theta}\frac{\partial \theta}{\partial x}.$$ How exactly are we supposed to apply the definition given for the polar coordinate chart? The diagram on page 15 is helpful. The axes of your chart are not x and y. Your axes are labeled $\theta$ and $r$. It is very important to understand that the chart is literally just a labeling in $R^n$. $f$ is defined on the manifold. Not the chart. But you have a mapping from the manifold to the chart. Therefore, $f|_p$ = $f(r,\theta)_\ |_{\psi^{-1} (r,\theta)}$. ${X}_\theta (f)= \frac{\partial}{\partial x^\theta} (f \circ \psi^{-1} (r,\theta))$ or $\frac{\partial f}{\partial \theta}= \frac{\partial}{\partial \theta} (f \circ \psi^{-1} (r,\theta))$ If $g:(r,\theta) \rightarrow (x(r,\theta),y(r,\theta))$ then $\frac{\partial f}{\partial \theta}= \frac{\partial}{\partial \theta} (f \circ g \circ \psi^{-1} (r,\theta))$
{ "domain": "physics.stackexchange", "id": 76354, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "general-relativity, differential-geometry, coordinate-systems, tensor-calculus", "url": null }
All of the above is before you start analyzing the numerical stability of evaluating $f$ near a root. You gave an example of essentially a linear function, but for a typical more complicated function, you wouldn't be able to evaluate $f$ accurately to full machine precision near a root at all, which will also limit how small $f$ can possibly get.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.981453437115321, "lm_q1q2_score": 0.8024112732143003, "lm_q2_score": 0.8175744695262775, "openwebmath_perplexity": 175.7161566011494, "openwebmath_score": 0.8890368342399597, "tags": null, "url": "https://scicomp.stackexchange.com/questions/26592/stopping-criteria-in-iterative-methods-for-solving-nonlinear-equations" }
cosmology, general-relativity, dark-energy "The idea that the universe contains close to homogeneous dark energy that approximates a time-variable cosmological “constant” arose in particle physics, ...in cosmology..., and on both sides by the thought that $\Lambda$ might be very small now because it has been rolling toward zero for a very long time. The idea that the dark energy is decaying by emission of matter or radiation is now strongly constrained by the condition that the decay energy must not significantly disturb the spectrum of the 3K cosmic microwave background radiation." So if I understand this correctly the idea of a dynamical effect came from suspecting that $\Lambda$ may be time dependent, but so far that was not detected. And since "one can equally well put Einstein’s new term" on either side of the equation mathematically both interpretations are equivalent. Still, the dynamical interpretation seems to be overwhelmingly preferred.
{ "domain": "astronomy.stackexchange", "id": 922, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "cosmology, general-relativity, dark-energy", "url": null }
ros Title: Is there an equalent for base_local_planner::FootprintHelper().getLineCells in nav2? I'm trying to trace a line between 2 points and I'm looking for a functionality similar to base_local_planner::FootprintHelper().getLineCells in ROS-2, any leads will be helpful. Originally posted by pmuthu2s on ROS Answers with karma: 224 on 2021-04-13 Post score: 0 You can use the line iterator https://github.com/ros-planning/navigation2/blob/main/nav2_util/include/nav2_util/line_iterator.hpp Originally posted by stevemacenski with karma: 8272 on 2021-04-13 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 36315, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros", "url": null }
organic-chemistry, reaction-mechanism, regioselectivity, aldol-reaction * Unless you use kinetic deprotonation conditions such as LDA. In this case you will then have to look at the stability of the transition states leading to enolate formation, but that's a story for another day. ** Very rough values.
{ "domain": "chemistry.stackexchange", "id": 9548, "lm_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, regioselectivity, aldol-reaction", "url": null }
we're including unlimited answers with your free account for the time being. Assuming that the dice are unbiased or not " loaded". The probability of the two dice totaling an even number is 1/2. It is assume each die is fair and 6-sided. Now, favourable outcomes = sum. In this skilltest, we tested our. 4d6, drop lowest, reroll if max < 14 or reroll if the sum of the modifiers is < 1. When rolling one die, the probability of getting a 4 is 1 in 6, or 0. 7) F Two dice are rolled. 6 outcomes on one die X 6 outcomes on other die = 36 outcomes. So we just need to work out the probability of rolling a 7, then take half of what's left. Let B be the event - The sum of the top faces of the 3 dice >= 5. Find the probability of getting a multiple of 2 on one dice and multiple of 3 on the other dice. (i) Prime numbers = 2, 3 and 5 Favourable number of events = 3 Probability that it will be a prime. Find the probability that a 5 will occur first. Explanation of the fundamental concepts of
{ "domain": "farmaciacoverciano.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9859363750229257, "lm_q1q2_score": 0.8399712517041412, "lm_q2_score": 0.8519527963298946, "openwebmath_perplexity": 208.79297532556296, "openwebmath_score": 0.6622301936149597, "tags": null, "url": "http://farmaciacoverciano.it/dhti/when-two-dice-are-rolled-find-the-probability-of-getting-a-sum-of-5-or-6.html" }
quantum-mechanics, condensed-matter, fermions, density-of-states $$N = \int_{-\infty}^{\infty} D(E) f(E) \, dE$$ Now what confuses me is that I don't understand why for example $N$ could depend on the temperature. If the temperature changes, $f(E)$ will not be the same and hence we should expect something else from the integral which computes $N$. But $N$ is the fixed amount of electrons in materials and shouldn't depend on anything. So my guess would be to say that the density of states depend on the number of electrons, but this is not the case for example for the density of state of a free electron gas which is given by: $$D(E) = \frac{m \cdot \sqrt{2 \cdot m \cdot E}}{\pi^2 \cdot \hbar^2}$$ So what is the mistake in my reasoning? To expand on my comment, in writing $$ f(E) = \frac{1}{e^{\frac{E-E_F}{k_BT}}+1} $$ you are pinning the chemical potential to the Fermi energy, i.e. to its value at zero temperature. A more correct expression would be $$ f(E,\mu) = \frac{1}{e^{\frac{E-\mu}{k_BT}}+1} $$ where $\mu$ is the chemical potential.
{ "domain": "physics.stackexchange", "id": 97233, "lm_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, condensed-matter, fermions, density-of-states", "url": null }
java, multithreading, android, file-system, iteration threadPool.execute(new Runnable() { @Override public void run() { File[] files = dir.listFiles(mFilenameFilter); for (File file : files) { if (file.isDirectory()) { extractFiles(file); // recursive call } else { extractedFilesList.add(file); // add to collection } } if (threadCounter.decrementAndGet() == 0) { onScanEnd(); } } }); } private void onScanEnd() { ExtractedFilesManager.getInstance().initAll(extractedFilesList); LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(FILE_SCAN_COMPLETE)); stopSelf(); } } And here is the singletone container: import java.io.File; import java.util.ArrayList; import java.util.concurrent.CopyOnWriteArrayList;
{ "domain": "codereview.stackexchange", "id": 15954, "lm_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, multithreading, android, file-system, iteration", "url": null }
radiation, thermal-radiation, geometric-optics Title: Do all thermal radiators have the same surface brightness? Imagine I heat a piece of metal to 1000K. It will be red hot and will emit black body radiation corresponding to this temperature. But what about the brightness? Assuming the bulk is opaque, does it matter whether I heat and iron or a wolfram piece? Both will have the same color, but which one will be brighter when I look at it? The total power radiated is given by the Stefan-Boltzmann law: $$ j = \varepsilon \sigma T^4 $$ where $\varepsilon$ is the emissivity and this varies from object to object. A perfect black body has $\varepsilon=1$ at all wavelengths, but real surfaces will have $\varepsilon\lt 1$ over at least part of the spectrum.
{ "domain": "physics.stackexchange", "id": 27063, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "radiation, thermal-radiation, geometric-optics", "url": null }
ros started roslaunch server http://adam:44530/ SUMMARY ======== PARAMETERS * /kinect2_bridge/base_name: kinect2 * /kinect2_bridge/base_name_tf: kinect2 * /kinect2_bridge/bilateral_filter: True * /kinect2_bridge/calib_path: /home/adam/catkin... * /kinect2_bridge/depth_device: -1 * /kinect2_bridge/depth_method: default * /kinect2_bridge/edge_aware_filter: True * /kinect2_bridge/fps_limit: -1.0 * /kinect2_bridge/jpeg_quality: 90 * /kinect2_bridge/max_depth: 12.0 * /kinect2_bridge/min_depth: 0.1 * /kinect2_bridge/png_level: 1 * /kinect2_bridge/publish_tf: False * /kinect2_bridge/queue_size: 5 * /kinect2_bridge/reg_device: -1 * /kinect2_bridge/reg_method: default * /kinect2_bridge/sensor: * /kinect2_bridge/use_png: False * /kinect2_bridge/worker_threads: 4 * /kinect2_points_xyzrgb_hd/queue_size: 5 * /kinect2_points_xyzrgb_qhd/queue_size: 5 * /kinect2_points_xyzrgb_sd/queue_size: 5 * /rosdistro: kinetic * /rosversion: 1.12.6
{ "domain": "robotics.stackexchange", "id": 26901, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros", "url": null }
statistical-mechanics, probability, partition-function $~$ Continuous case The probability to find the canonical microstate in the region $(\Gamma,\Gamma+d\Gamma)$ of phase space is $$ P(\Gamma) d\Gamma = \frac{e^{-\beta E(\Gamma)}}{Z} d\Gamma $$ where $\Gamma = (\mathbf r_1,\cdots; \mathbf q_1\cdots)$ is the vector with the positions and momenta of all particles. The probability to find the system in a region $\mathcal R$ of microstates is the sum over all these probabilities: $$ P(\Gamma \in \mathcal R) = \frac{1}{Z} \int_{\Gamma\in\mathbf R} e^{-\beta E(\Gamma)} d\Gamma. $$ In both cases the result can be expressed in the form $$ p(\mathcal R) = \frac{Z_{\mathcal R}}{Z} $$ with the denominator calculated by adding/integrating the factor $e^{-\beta E}$ over all phase space and the numerator is the summation/integral of the same factor in region $\mathcal R$.
{ "domain": "physics.stackexchange", "id": 60738, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "statistical-mechanics, probability, partition-function", "url": null }
Question # Assertion :The inverse of the matrix $$A=\begin{bmatrix} 1 & 1 & 1 \\ 1 & 2 & 3 \\ 1 & 4 & 7 \end{bmatrix}$$ does not exist. Reason: The matrix $$A$$ is singular A Both Assertion and Reason are correct and Reason is the correct explanation for Assertion B Both Assertion and Reason are correct but Reason is not the correct explanation for Assertion C Assertion is correct but Reason is incorrect D Assertion is incorrect but Reason is correct Solution ## The correct option is A Both Assertion and Reason are correct and Reason is the correct explanation for Assertion$$|A|=\begin{vmatrix} 1 & 1 & 1 \\ 1 & 2 & 3 \\ 1 & 4 & 7 \end{vmatrix}=0$$$$A$$ is a singular matrix.Inverse exists iff matrix is non-singular.Both Assertion and Reason are correct and Reason is the correct explanation for AssertionHence, option A.   Mathematics Suggest Corrections 0 Similar questions View More People also searched for View More
{ "domain": "byjus.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9875683473173827, "lm_q1q2_score": 0.835425982409746, "lm_q2_score": 0.84594244507642, "openwebmath_perplexity": 3161.9703176921594, "openwebmath_score": 0.49073389172554016, "tags": null, "url": "https://byjus.com/question-answer/assertion-the-inverse-of-the-matrix-a-begin-bmatrix-1-1-1-1-2-3/" }
oxidation-state, iron Title: Forcing a steel pipe to rust completely I understand rust. Fe + H20 → OH- → Fe(OH)2 or 3 and/or FenOm I understand rust prevention and steels that are resistant to rusting. Trying to google this question gives thousands of answers on prevention. But what I'm interested in is how to force steel to rust. And not in an artsy way, so my steel stuff looks weathered and cool (these are the other thousands of search results for forcing iron/steel to rust). I want to dispose of steel by turning it into iron oxide. I don't actually really want to do this since it's a lot easier to just landfill or recycle, but I thought of it as an alternative and realized it's really not that easy.
{ "domain": "chemistry.stackexchange", "id": 15170, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "oxidation-state, iron", "url": null }
kinematics, terminology, definition, projectile, drag theoretically dimensionless. Now, The projectile motion is largely related to kinematics rather than dynamics, in which we discuss about the cause of this motion i.e. forces in general. These forces depend on various other parameters (such as mass , surface area, cross-sectional area, friction coefficient, drag coefficient, nature of medium, etc). Bodies which appear in projectile motion do feel air resistance but we don't consider it because during discussions regarding kinematics, we only see the acceleration produced by this force, which is very weak in comparison to acceleration due to gravity. So, practically, projectile motion has noting to do with air resistance. Hence it is correct to use the term projectile motion to describe a motion under acceleration due to gravity and air resistance since its effect is however nullified by the comparatively huge magnitude of gravitational force.
{ "domain": "physics.stackexchange", "id": 74298, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "kinematics, terminology, definition, projectile, drag", "url": null }
quantum-mechanics, definition It's easier to start with photons, because they correspond classically to a field. It's intuitive that fields can superpose; for example the sound waves of two musicians playing at once superpose, adding onto each other. When a light wave hits a partially transparent mirror, it turns into a superposition of a transmitted and reflected wave, each with half the energy. We know experimentally that light comes in little bullets called photons. So what is the state of a photon after hitting a partially transparent mirror? There are a few possibilities.
{ "domain": "physics.stackexchange", "id": 50895, "lm_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, definition", "url": null }
ros, remote-roscore, publisher, rostopic, remote rostopic echo /odom works like a charm, printing all the odom messages published by the remote ROS on my local laptop. rostopic pub /cmd_vel geometry_msgs/Twist -- "" however does not. I have traced the communication using Wireshark and all I can see are some registerService, registerPublisher and getParam commands. My message however doesn't arrive. I've also tried to simply publish a std_msgs/String to a topic called /blubb. But even that does not work. I cannot see the message itself on the network (however I can see the mentioned remote procedure calls) and thus it doesn't arrive at the remote machine. ROS_IP is set to the remote machine's IP on both machines. ROS_MASTER_URI is set to http://:11311 on both machines. netcat works, rostopic echo does, rqt_plot does, even rviz does using the remote connection. I just can't send messages to the remote machine. Any idea what might be wrong? Thanks a lot! Cheers, Hendrik
{ "domain": "robotics.stackexchange", "id": 16662, "lm_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, remote-roscore, publisher, rostopic, remote", "url": null }
gazebo Title: ‘setupClient’ is not a member of ‘gazebo’? I followed the tutorial(animated box) here: Animated box. After I 'make' it in the build folder, I got the error in the file independent_listener.cc error: ‘setupClient’ is not a member of ‘gazebo’ What's the matter? PS. I use gazebo 1.9 with ROS hydro on Ubuntu 12.04 LTS. The content of independent_listener.cc: #include <gazebo/transport/transport.hh> #include <gazebo/msgs/msgs.hh> #include <gazebo/gazebo.hh> #include <iostream> ///////////////////////////////////////////////// // Function is called every time a message is received. void posesStampedCallback(ConstPosesStampedPtr &posesStamped) { std::cout << posesStamped->DebugString(); ::google::protobuf::int32 sec = posesStamped->time().sec(); ::google::protobuf::int32 nsec = posesStamped->time().nsec(); std::cout << "Read time: sec: " << sec << " nsec: " << nsec << std::endl;
{ "domain": "robotics.stackexchange", "id": 3719, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "gazebo", "url": null }
the opposite side into segments whose lengths are proportional to the lengths of the other two sides. A corollary to the three parallel lines theorem is that if three parallel lines cut off congruent segments on one transversal line, then they cut off congruent segments on every transversal of those three lines. B Let’s go to the examples. %PDF-1.3 %�������������������������������� 1 0 obj << /X1 86 0 R >> endobj 2 0 obj << /Subtype /Type1C /Filter /FlateDecode /Length 1260 >> stream Find the value of parallel lines and transversals • Use . 8.8 Three Parallel Lines Theorem If three parallel lines intersect two transversals, then they divide the transversals proportionally. As you can see, the three lines form eight angles. Are all those angles that are located on the same side of the transversal, one is internal and the other is external, are grouped by pairs which are 4. If two parallel lines $a$ and $b$ are cut by a transversal line $t$, then the internal conjugate angles are
{ "domain": "websuasion.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.96036116089903, "lm_q1q2_score": 0.8237671765822749, "lm_q2_score": 0.8577681086260461, "openwebmath_perplexity": 1042.8059360575128, "openwebmath_score": 0.6674481630325317, "tags": null, "url": "https://websuasion.com/journal/viewtopic.php?5dc019=3-parallel-lines-theorem" }
asteroids, history, comets, naked-eye, chicxulub The only non-imaginary (i.e. square root of a positive number) solution for $a_n \sim 10$ km is $ d_n \leq 0.047 (a_n/10 {\rm km})$ au or $ \leq 7$ million ($a_n/10 {\rm km})$ km. Moving at say 30 km/s, then it gets closer by 2.6 million km per day, thus hitting the Earth about 3 days after becoming a naked eye object. Obviously this would be longer for a slower approach speed or for a larger or more reflective asteroid. But shorter for a smaller, faster asteroid or if the asteroid approached from a direction not fully illuminated by the Sun or had a smaller albedo than Vesta.
{ "domain": "astronomy.stackexchange", "id": 2714, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "asteroids, history, comets, naked-eye, chicxulub", "url": null }
python, ai, neural-network if unit i is output: . change_rate[i] = (t[i] - a[i]) * a[i] * (1-a[i]) if unit i is hidden, we don't know the target activation, so we estimate it: . change_rate[i] = (sum(k, dr1[k] * W[k][i])) * a[i] * (1-a[i]) . ASSUME: sum(k, dr1[k] * W[k][i]) is approximately (t[i] - a[i]) . (The sum over k is the sum over the units that receive input from the ith unit.) dW[i][j](n+1) = learning rate * change_rate[i] * a[j] + alpha*dW[i][j](n), j=0..numinputs """ import math def i_report_pattern(activations, training_values, change_rates, weights, dweights): """ Empty prototype for reporting the state of a network following a training pattern.
{ "domain": "codereview.stackexchange", "id": 2634, "lm_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, ai, neural-network", "url": null }
waves, fourier-transform, signal-processing Think about it. Does this point of view correlate with the earlier one? Both of the definitions are the same. So you'd wonder, why do we need this point of view? Well, I'd say it's easier to understand how Sine waves are actually important in many common phenomena. Suppose we start to spin the line, by making $\theta$ increase linearly. You'd get something like this: The Sine and Cosine functions are arguably the most important periodic functions in several cases: The periodic functions of how displacement, velocity, and acceleration change with time in SHM oscillators are sinusoidal functions. Every particle has a wave nature and vice versa. This is de-Broglie's Wave Particle Duality. Waves are always sinusoidal functions of some physical quantity (such as Electric Field for EM Waves, and Pressure for Sound Waves).
{ "domain": "physics.stackexchange", "id": 42560, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "waves, fourier-transform, signal-processing", "url": null }
A wins the game if the outcomes of the rounds are any of the following disjoint sequences of events: \begin{align} &\mathcal{A}\\&\mathcal{CA}\\&\mathcal{CCA}\\&\mathcal{CCCA}\\ &\quad\vdots\\&\mathcal{C}^{k-1}\mathcal{A}\\&\quad\vdots \end{align} Thus, $$P(\mathcal A) = p_1 + (1-p^*)p_1 + (1-p^*)^2p_1 + \cdots = \frac{p_1}{p^*}$$ and similarly, \begin{align}P(\mathcal B) &= (1-p_1)p_2 + (1-p^*)(1-p_1)p_2 + (1-p^*)^2(1-p_1)p_2 + \cdots \\ &= \frac{(1-p_1)p_2}{p^*} \\ &= \frac{p^*-p_1}{p^*}\\ &= 1-P(\mathcal A).\end{align} Note that conditioned on the event that the game ended on the round under consideration, the probabilities of the players winning are $$P(\text{A wins}) = \frac{p_1}{p_1 + p_2 - p_1p_2} = \frac{p_1}{p^*}, \quad P(\text{B wins}) = \frac{p_2 - p_1p_2}{p_1 + p_2 - p_1p_2} = \frac{p^*-p_1}{p^*}.$$ These are the same as the unconditional probabilities of $\mathcal A$ and $\mathcal B$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9736446502128796, "lm_q1q2_score": 0.8196390320628619, "lm_q2_score": 0.8418256412990658, "openwebmath_perplexity": 443.8554170869812, "openwebmath_score": 0.974926769733429, "tags": null, "url": "https://stats.stackexchange.com/questions/193264/combining-binomial-random-variables" }
performance, c, multithreading, openmp, openssl When you use it this way, it is very easy to overlook it. I almost glanced over it when examining your code. There isn't really a reason to put it on it's own line, except to save LOC, which you could do better in other places. if (dd == 1) { FILE *file; if ((file = fopen("pidigits.txt", "w")) == NULL) { fprintf(stderr, "Error while opening file\n"); exit(-1); } else { fprintf(file, "%.1s.%s\n", digits_of_pi, digits_of_pi + 1); fclose(file); } } Put all statements on separate lines. From Code Complete, 2nd Edition, pg. 759: With statements on their own lines, the code reads from top to bottom, instead of top to bottom and left to right. When you’re looking for a specific line of code, your eye should be able to follow the left margin of the code. It shouldn’t have to dip into each and every line just because a single line might contain two statements.
{ "domain": "codereview.stackexchange", "id": 6170, "lm_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, multithreading, openmp, openssl", "url": null }
black-hole, general-relativity Of course, that too is an artifact of mathematical idealization: and actual black hole is not infinitely extended in the past and future; it was actually produced by something, a stellar collapse. (And the "bridge" isn't traversable anyway; one will be destroyed in the singularity if one tries.) Finally, on to the Kerr solution, it's a bit better because formally the singularity is avoidable, unlike the Schwarzschild case. However, it's still physically unreasonable: in addition to the fact that actual black holes aren't eternal, the interior of the Kerr solution is unstable in regard to any infalling matter, which will perturb the solution into something else entirely. Therefore, it cannot be taken as a physically meaningful. Still, it is true that full Kerr spacetime contains a way into another universe--in fact, infinitely many of them, chained one after another.
{ "domain": "astronomy.stackexchange", "id": 404, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "black-hole, general-relativity", "url": null }
component. $$x \mapsto \psi_1(\pi_1(x))$$ Now we have $$\psi(\mathscr{N}') = \bigcap_{n \in \omega}A_n$$. Notice that $$\mathscr{N}$$ is homeomorphic to $$\mathscr{N}^{\omega}$$. So all we need is a composition of two isomophism. To complete the proof, we also have to prove it holds for $$\bigcup_{n \in \omega}A_n$$. Let $$\mathscr{N}_j = \{ x \in \mathscr{N}: \pi_1(x) = j\}$$ for each $$j$$. $$\mathscr{N}_j$$ is isomorphic to $$\mathscr{N}$$, so there a continuous surjection $$\phi_j$$such that $$\phi_j(\mathscr{N}_j) = A_j$$. Define $$\phi : \mathscr{N} \to \bigcup_{n \in \omega}A_n$$, for each $$x$$ in $$\mathscr{N}$$: $$x \mapsto \phi_j(x) \text{iff } \pi_1(x) = j$$.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9811668668053618, "lm_q1q2_score": 0.847131244232892, "lm_q2_score": 0.8633916134888613, "openwebmath_perplexity": 112.84937759639506, "openwebmath_score": 0.97163987159729, "tags": null, "url": "https://math.stackexchange.com/questions/376794/what-measure-does-lebesgue-measure-induce-on-the-fat-cantor-set" }
c#, asp.net-web-api, dapper Title: Multiple connection string in Web API 2 I have a Web API 2 using Dapper.net, and it's accessed by various client with their own database. Currently, I'm using custom header called Client-Id to identify the client. This Client-Id contains a ConnectionString name and I passed this connection string into my constructor. Here's my project structure: Api.Persentation -> Api.Service -> Api.Logic The connection string will pass from Api.Persentation to Api.Logic as follows: Api.Persentation public string testApi() { //using the service //consider the connection string was handled on base class var _myService = new testApiService(base.ConnectionString); return _myService.HelloWorld(); } Api.Service public class testApiService: BaseService { #region const //This class was from API.Logic private readonly testApiRepo _testApiRepo;
{ "domain": "codereview.stackexchange", "id": 17942, "lm_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#, asp.net-web-api, dapper", "url": null }
newtonian-mechanics, rotational-dynamics, angular-momentum, momentum, conservation-laws consider the motion of a particle described by the Lagrangian function $$L(x,y,z,\dot{x},\dot{y},\dot{z})=m(\dot{x}^2+\dot{y}^2+\dot{z}^2)/2-V(z), \tag{1} \label{1}$$ where the potential depends only on the coordinate $z$. The system is obviously invariant under $x\to x+x_0$, $y\to y+y_0$ for arbitrary $x_0, y_0 \in \mathbb{R}$. As a consequence, the momenta $p_x=m\dot{x}$ and $p_y=m \dot{y}$ are conserved. This can be seen explicitly from the equations of motion, $$\begin{align} \frac{d}{dt} \frac{\partial L}{\partial \dot{x}} &= \frac{\partial L}{\partial x} \quad \Rightarrow \quad \frac{d}{dt} (m \dot{x}) = 0, \tag{2} \label{2}\\[5pt] \frac{d}{dt}\frac{\partial L}{\partial \dot{y}} &= \frac{\partial L}{\partial y} \quad \Rightarrow \quad \frac{d}{dt}(m\dot{y})=0. \tag{3} \label{3} \end{align}$$ Because of the $z$-dependence of the potential, $p_z=m\dot{z}$ is not conserved: $$\begin{align}\frac{d}{dt} \frac{\partial L}{\partial \dot{z}}&=\frac{\partial L}{\partial z} \quad
{ "domain": "physics.stackexchange", "id": 99667, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, rotational-dynamics, angular-momentum, momentum, conservation-laws", "url": null }
thermodynamics However, in the general case you are 100% right that $p$ is not constant. The trick, then, is knowing how $p$ depends on $V$ so you can calculate $W$ with the integral $$W = -\int p dV.$$ An especially good example of this is for an ideal gas, where you know that $PV = NkT$, so $P = NkT/V$. There are two (simple) cases here: isothermal expansion, where $T$ is held constant as $V$ increases, and adiabatic expansion, where no heat is allowed to enter the system. I suggest looking into how the work is derived in these situations; this is certainly how I came to understand this slightly subtle issue.
{ "domain": "physics.stackexchange", "id": 73818, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics", "url": null }
Here is my attempt: The null hypothesis would be: “Coin is fair.” Level of significance chosen here is 5%. So, 5% of the times we reject the fact that coin is fair when it actually is not. Test statistic is the number of tails. Computing p value P(Outcome with more tails than heads or in 6 throws, 4, 5 or 6 tails|Coin is fair) =C(6,4)(0.5)^4(0.5^2)+ C(6,4)(0.5)^5(0.5^1)+ C(6,6)(0.5)^6(0.5^0) =(0.5^6){C(6,4)+C(6,5)+C(6,6)} =(0.5^6)(15+6+1) =22/64 =0.34 p value=0.34>0.05 So, I do not reject the null hypothesis. Is my analysis correct?
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9926541732082085, "lm_q1q2_score": 0.809243923777974, "lm_q2_score": 0.8152324803738429, "openwebmath_perplexity": 707.9046702848236, "openwebmath_score": 0.3997369706630707, "tags": null, "url": "https://math.stackexchange.com/questions/3108972/is-the-null-hypothesis-test-true" }
We see that \begin{align*}16.25 - 16 = 0.25 \ ounces\end{align*} and \begin{align*}16 - 15.75 = 0.25 \ ounces\end{align*}. The answers are 0.25 ounces bigger and smaller than 16 ounces respectively. The answer you just found describes the lightest and heaviest acceptable bags of coffee beans. But how do we describe the total possible range of acceptable weights? That’s where inequalities become useful once again. Watch this video for help with the Examples above. ### Vocabulary
{ "domain": "ck12.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9898303422461273, "lm_q1q2_score": 0.8183044117248185, "lm_q2_score": 0.8267117876664789, "openwebmath_perplexity": 1686.4788592119432, "openwebmath_score": 0.9547536969184875, "tags": null, "url": "http://www.ck12.org/book/CK-12-Algebra-I-Concepts/r2/section/6.8/" }
deep-learning, reinforcement-learning, rewards A* plus some kind of sequence optimisation like a travelling salesman problem (TSP) solver would probably be optimal if you have been presented the problem and asked to solve it any way you want. With only 11 locations to resolve - mouse start plus 10 cheese locations - then you can brute force the movement combinations in a few seconds on a modern CPU, so that part may not be particularly exciting (whilst TSP solvers can get more involved and interesting). The interesting thing about RL is how it will solve the problem. RL is a learning algorithm - the purpose of implementing it is to see what it takes for the machine to gain knowledge towards a solution. Whilst A* and combinatorial optimisers are where you have knowledge of how to solve the problem and do so as optimally as possible based on a higher level analysis. The chances are high that an A*/optimiser solution would be more robust, quicker to code, and quicker to run than a RL solution.
{ "domain": "ai.stackexchange", "id": 1032, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "deep-learning, reinforcement-learning, rewards", "url": null }
java, game, role-playing-game public String loadString(String propertyFileName, String key, String default) { String result = ""; try{ prop.load(new FileInputStream(propertyFileName)); result = prop.getProperty(key); } catch (IOException e) { e.printStackTrace(); // throw an exception or return default value // copying the code you had here before, though I would recommend not // doing main logic inside an exception. in particular as this exception // can be a number of things, not just filenotfound. prop.setProperty("Save_Point", "0"); prop.store(new FileOutputStream(propertyFileName), null);
{ "domain": "codereview.stackexchange", "id": 10674, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, game, role-playing-game", "url": null }
c++, beginner, reinventing-the-wheel auto p1 = pointer{}; // p1 == nullptr, no-fail and fast auto p2 = std::unique_ptr<int>{}; // p2 == nullptr, no-fail and fast auto p3 = std::shared_ptr<int>{}; // p3 == nullptr, no-fail and fast auto p4 = shared_ptr<int>{}; // p4 != nullptr, very slow, and the allocation might throw Default construction for every other smart pointer I’ve seen gives you a null pointer. That should be the case for your smart pointer, too. If you want a constructor that actually allocates the object—which is a good idea—you can use a “tagged constructor”. A good tag is std::in_place: constexpr shared_ptr() noexcept = default; explicit shared_ptr(std::in_place_t) { id++; internalId = id; countMap[id] = 1; ptr = new dataType(); } And you’d use it like this: auto sp1 = shared_ptr<int>{std::in_place};
{ "domain": "codereview.stackexchange", "id": 41178, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, beginner, reinventing-the-wheel", "url": null }
ros, xmlrpc, ros-kinetic, rosparam setting /run_id to 5dab8662-0754-11e8-a585-b827eb09ee17 process[rosout-1]: started with pid [7721] started core service [/rosout] load_parameters: unable to set parameters (last param was [/head_arduino/serial_node/baud=115200]): cannot marshal None unless allow_none is enabled Traceback (most recent call last): File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/__init__.py", line 307, in main p.start() File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 279, in start self.runner.launch() File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/launch.py", line 654, in launch self._setup() File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/launch.py", line 641, in _setup self._load_parameters() File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/launch.py", line 338, in _load_parameters r = param_server_multi() File "/usr/lib/python2.7/xmlrpclib.py", line 1006, in __call__
{ "domain": "robotics.stackexchange", "id": 29935, "lm_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, xmlrpc, ros-kinetic, rosparam", "url": null }
homework-and-exercises, newtonian-mechanics, velocity, collision Distance between balls A and B. Ball A has velocity $v_A=\dfrac v3$. Ball B has velocity $v_B=-\dfrac 49v$.
{ "domain": "physics.stackexchange", "id": 74644, "lm_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, newtonian-mechanics, velocity, collision", "url": null }
quantum-mechanics, quantum-spin, fermions, spinors \delta_{\alpha}^{\beta} (\sigma_p)_{\theta}^{\ \gamma} + \delta_{\theta}^{\gamma} (\sigma_p)_{\alpha}^{\ \beta} &= \delta_{\theta}^{\beta} (\sigma_p)_{\alpha}^{\ \gamma} + \delta_{\alpha}^{\gamma} (\sigma_p)_{\theta}^{ \ \beta}. \end{align} The second one is the kind of one I was looking for. Without meaningful differences, flat-raise the antisymmetrized adjoint indices k and j, to inspect a triplet of sparse 4×4 Hermitean matrices, $$ M^{kj}_{\alpha \gamma, \theta\beta}= (\sigma^k)_{\alpha \gamma}(\sigma^j)_{\theta \beta} - (\sigma^j)_{\alpha \gamma}(\sigma^k)_{\theta \beta}, $$ one of them real symmetric, and two of them pure imaginary antisymmetric. In the standard tensor product factor convention, $v_\gamma \otimes w_\beta$, "w into v", they evaluate to $$ M^{31}= -M^{13}=\begin{bmatrix}0&1&1&0\\ 1&0&0&-1\\ 1&0&0&-1\\ 0&-1&-1&0\end{bmatrix} , \\ M^{12}= -M^{21}=2i\begin{bmatrix}0&0&0&0\\ 0&0&1&0\\ 0&-1&0&0\\ 0&0&0&0\end{bmatrix} , \\
{ "domain": "physics.stackexchange", "id": 99128, "lm_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-spin, fermions, spinors", "url": null }
special-relativity Title: Special Relativity - Simultaneity Consider a railway carriage. It is moving in +ve x-axis with a velocity, v, relative to the platform. Let A',B' be end points and M' be the exact middle of the carriage. Let the platform observer be O. The observer situated at M' at rest relative to the carriage be O'. When O and O' cross each other I set the clocks in both reference frames to 0. I arrange a switch at M' such that if 2 photons hit M' "simultaneously" a bulb is switched on. At time 0 (when O and O' cross) I shoot 1 photon each from A',B' towards M'. Question - Will the bulb be 'on' or 'off'? Based on some suggestions to include my thoughts. As per O' which is at rest in the railway carriage - both photons travel same distance and hence hit M' simultaneously - hence the bulb should be 'on' As per O photon from B' to M' travels less distance and hence reaches M' first - thus not simultaneous. So bulb should be 'off'
{ "domain": "physics.stackexchange", "id": 58740, "lm_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", "url": null }
A = toeplitz(mod(1:N,2)); If the number of rows (M) is not equal to the number of columns (N) then A = toeplitz(mod(1:M,2),mod(1:N,2)) FWIW, you're asking a specific case of this question: How to generate a customized checker board matrix as fast as possible? m\times n\$ matrix with an even number of 1s in each row and column, Hint: If m=1 or n=1, the problem is simple. So suppose they are both >1. Fill in everything with 0's and/or 1's except the bottom row and the� Multiplying a Row by a Column We'll start by showing you how to multiply a 1 × n matrix by an n × 1 matrix. The first is just a single row, and the second is a single column. By the rule above, the product is a 1 × 1 matrix; in other words, a single number. First, let's name the entries in the row r 1 , r 2 , Can you take three lines? N=8; A = zeros(N); A(1:2:end, 1:2:end) = 1; A(2:2:end, 2:2:end) = 1; One line solution (when N is even): A = repmat([1, 0; 0 1], [N/2, N/2]);
{ "domain": "thetopsites.net", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9683812309063187, "lm_q1q2_score": 0.8529473524906787, "lm_q2_score": 0.880797071719777, "openwebmath_perplexity": 360.06919482051563, "openwebmath_score": 0.6124218702316284, "tags": null, "url": "https://thetopsites.net/article/60225030.shtml" }
python, beginner, checksum Title: Credit card validator using Luhn Algorithm I'm looking for feedback or tips to maybe make my code more readable or faster or just general tips to help get myself started with app making with Python. import sys # check for valid input if len(sys.argv) == 2: try: int(sys.argv[1]) if(len(str(sys.argv[1])) == 16): pass else: print("Not 16 digits!") sys.exit() except ValueError: print('Not an integer!') sys.exit() else: print('Not enough or too many command line arguments! \n Proper use \"python Check.py <credit card number here> \" ') sys.exit() def main(): # put the digits into a list number = convertToList(sys.argv[1]) sum = cardCheck(number) if (sum%10 == 0): print('Valid Card!') else: print('Invalid Card!')
{ "domain": "codereview.stackexchange", "id": 34641, "lm_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, checksum", "url": null }
deep-learning, training Title: Would it be okay to stop training my neural network? When the validation error of my Neural Network that I am trying to train is slowly decreasing but not by much, is it okay to stop train the network at that point, or do I need to increase the training time until the minimum validation error is reached? For instance, in the last 5 epochs my validations errors are shown below: | end of epoch 1 | time: 3782.50s | valid loss 6.7914 | valid ppl 890.1194 | end of epoch 2 | time: 3802.14s | valid loss 6.6084 | valid ppl 741.2616 | end of epoch 3 | time: 3791.33s | valid loss 6.5249 | valid ppl 681.8797 | end of epoch 4 | time: 3792.55s | valid loss 6.4513 | valid ppl 633.5318 | end of epoch 5 | time: 3804.15s | valid loss 6.3884 | valid ppl 594.8927
{ "domain": "datascience.stackexchange", "id": 7117, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "deep-learning, training", "url": null }
The power set of a set {1,2,...,n} in the sequence contains the 2^n subsets of this set. Consider the infinite sequence of these power sets. Which elements belong to some of the sets in this sequence? They have to be subsets of at least on set {1,2,...,n}. In order to stay in the limit of the sequence they have to be subsets as well of all of the sets {1,2,...,n+1},{1,2,...,n+2}... after that. In our case that condition is obviously satisfied, so it is enough that a subset of $$\mathbb{N}$$ is a subset of just one set {1,2,...,n} to guarantee that it will be in the limit. Hence this condition becomes necessary and sufficient for a subset to be an element of the limit of the sequence of power sets. If you still think that there are infinite sets in the limit of the power sets of {1},{1,2},{1,2,3},... please point to any one in particular, then we can consider whether it is in the limit or not. ##### Share on other sites I have  no idea what  $$\mathbb{N}$$. means.
{ "domain": "scienceforums.net", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9715639669551474, "lm_q1q2_score": 0.8296308671093431, "lm_q2_score": 0.8539127585282744, "openwebmath_perplexity": 429.98364087535293, "openwebmath_score": 0.7049829959869385, "tags": null, "url": "https://www.scienceforums.net/topic/116902-end-points-of-cantor-set-countable/" }
ros Originally posted by AHornung with karma: 5904 on 2013-02-19 This answer was ACCEPTED on the original site Post score: 3 Original comments Comment by jarvisschultz on 2013-02-19: Note you could also use apt-cache to search for packages e.g. apt-cache search ros.*joystick shows the name of the package you were trying to install. As well as a small description of the package.
{ "domain": "robotics.stackexchange", "id": 12952, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros", "url": null }
sql, mysql BadgeAssignments table: | userid | badgeid | |--------|---------| | 1 | 1 | | 2 | 2 | | 3 | 3 | | 1 | 4 | | 2 | 5 | | 3 | 6 | | 1 | 5 | | 2 | 4 | | 3 | 3 | Courses table: | courseid | coursename | |----------|------------| | 1 | course 1 | | 2 | course 2 | I have ended up with the following code, and I think it works fine: SELECT userid, SUM(b.points), courseid, (SELECT AVG(points) FROM Badges WHERE courseid = b.courseid) as courseAVG FROM Badges b INNER JOIN BadgeAssignments ba ON b.id = ba.badgeid INNER JOIN Users u ON ba.userid = u.id GROUP BY userid, b.courseid
{ "domain": "codereview.stackexchange", "id": 19770, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "sql, mysql", "url": null }
Hint What is the domain of $g \circ f\text{?}$ ###### Problem340 Explain why a function that has an inverse must be a bijection. ###### Problem341 Is it true that the inverse of a bijection is a bijection? ###### Problem342 If $g$ and $h$ are inverse of $f\text{,}$ then what can we say about $g$ and $h\text{?}$ ###### Problem343 Explain why a bijection must have an inverse. Since a function with an inverse has exactly one inverse $g\text{,}$ we call $g$ the inverse of $f\text{.}$ From now on, when $f$ has an inverse, we shall denote its inverse by $f^{-1}\text{.}$ Thus $f(f^{-1}(x)) = x$ and $f^{-1}(f(x)) = x\text{.}$ Equivalenetly $f\circ f^{-1} = \iota$ and $f^{-1} \circ f = \iota\text{.}$
{ "domain": "openmathbooks.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.987758723627135, "lm_q1q2_score": 0.8294545580368664, "lm_q2_score": 0.8397339736884711, "openwebmath_perplexity": 130.55355684563636, "openwebmath_score": 0.8389067053794861, "tags": null, "url": "https://bogart.openmathbooks.org/ctgd/relationsandfunctions.html" }
linear-algebra, quantum-operation, information-theory Title: Equal partial traces Given an arbitrary state $\rho_{AB}$, is it always possible to construct an extension $\rho_{ABC}$ such that $$Tr_B(\rho_{ABC}) := \rho_{AC} = \rho_{AB} := Tr_C(\rho_{ABC})$$ If yes, does there exist a quantum channel i.e. $\mathcal{E}: \mathcal{H}_{AB} \rightarrow \mathcal{H}_{ABC}$ that can achieve this? No, assume $\rho_{AB}$ is pure, so that $\rho_{AB} = |u\rangle\langle u|_{{AB}}$. Since it's pure $\rho_{ABC}$ must have the form $\rho_{ABC} = \rho_{AB} \otimes \rho_{C}$. It follows that $\rho_{AC} = \rho_{A} \otimes \rho_{C}$. But if $|u\rangle_{{AB}}$ is entangled then $\rho_{AB} \neq \rho_{A} \otimes \rho_{B}$. This is related to Monogamy of entanglement.
{ "domain": "quantumcomputing.stackexchange", "id": 5396, "lm_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, quantum-operation, information-theory", "url": null }
recursion, scala, stream, hash-map, immutability val verbose = false lazy val rawLines = fromInputStream(System.in).getLines.toStream val nQueries = (rawLines.head).head.toInt if(verbose) println(nQueries) def parseLine(s:String):(Int,Array[String]) = { val a = s.split(" ") if(verbose) println(a.mkString(",")) a(0) match { case "add" => {if(verbose) println(0); (0, a)} case "find" =>{if(verbose) println(1); (1, a)} case "del" => {if(verbose) println(2); (2, a)} } } lazy val lines = (rawLines drop 1).map(parseLine) @tailrec def doAction(stream:Stream[(Int,Array[String])],acc:HashMap[Int,String]=HashMap.empty[Int,String]):Unit = { if(stream.isEmpty) Unit else{ val nextAction = stream.head val actionDetail = nextAction._2
{ "domain": "codereview.stackexchange", "id": 22146, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "recursion, scala, stream, hash-map, immutability", "url": null }
quantum-information, quantum-electrodynamics, quantum-optics What I found in literature [2] is that there are two main regimes for this: the first is that the cavity is resonant with the atom, in which case they hybridize into two states with $\Gamma_{1\{r,a\}}^{'} = \frac{\Gamma_{1r}+\Gamma_{1a}}{2}$ where I used the prime to differentiate the bare loss rates and the effective loss rates due to the interaction of the two systems. The second scenario is the so called dispersive regime, in which $\Delta^2 = \left|\omega_r-\omega_a \right|^2 \gg g^2$, for which one has that \begin{equation} \Gamma_{1a}^{'} \approx [1-\left(\frac{g}{\Delta}\right)^2]\Gamma_{1a} + \left(\frac{g}{\Delta}\right)^2\Gamma_{1r} \end{equation}
{ "domain": "physics.stackexchange", "id": 33209, "lm_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-information, quantum-electrodynamics, quantum-optics", "url": null }
javascript, stackexchange, chat, userscript My main questions are: Is my code readable easily? If not, how can I improve it? Is there a cleaner way to do something (anything!) in the script? For example, to check whether there is another word, I've used indexOf(' ') - is there a more preferable way to check for multiple words? Can the code be cleaned up anymore?
{ "domain": "codereview.stackexchange", "id": 15244, "lm_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, stackexchange, chat, userscript", "url": null }
gravity $$F_G = -\frac{Gm_1m_2}{r^2}$$ where $G$ is the gravitational constant, $m_1$ and $m_2$ are two point masses which are gravitationally attracting one another, and $r$ is the distance between (the center of mass of) the two masses. If you think about if for a minute, it should be abundantly clear that gravity causes objects to be round because gravity is only dependent on distance and not on any angle or orientation. That means if I take a planet and throw additional mass onto it, gravity will cause that mass to be attracted to the center of mass of that planet. There's no other way in which gravity can act upon it. If everything is equally pulled towards the center, the only possible object you can form is a sphere. Of course there are objects like asteroids which aren't round, but that's because the structural integrity of the rocks is actually stronger than gravity and gravity, while still trying to make the asteroid round, just can't overcome the strength in the rocks.
{ "domain": "astronomy.stackexchange", "id": 2701, "lm_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", "url": null }
function is a function. A boundary point, depending on the path of approach limit, a lot of natural functions are continuous continuity of a function. Proving continuity of functions, continuity and Differentiability of functional parameters are very.! But they disagree concept of a function function at Math-Exercises.com undefined, does n't exist, or f. Of discontinuity are that where a function of two variables at a. graph without picking up finger. By original problems and others modified from existing literature in Class 11 and Class 12 ( 2n+1 π/2. A closed interval continuity concept is one of the triangle for a function on a graph without up... Pencil from the given function is a continuous function g ( t ) whose domain is all values.But... And continuity of a function is continuous at = if L.H.L = R.H.L (! A hole is the height of a function at Math-Exercises.com this section we consider properties methods. Of one variable to be discontinuous at x = c if f x! Discontinuous at x =
{ "domain": "bestfortnitesettings.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9808759663238371, "lm_q1q2_score": 0.8152482381700669, "lm_q2_score": 0.831143045767024, "openwebmath_perplexity": 352.7097225441085, "openwebmath_score": 0.8293384909629822, "tags": null, "url": "https://bestfortnitesettings.com/7hbwg/2aa728-continuity-of-a-function" }
magnetic-fields, experimental-physics, electrons, spectroscopy, neutrinos Title: Why is the spectrometer so big in KATRIN experiment? I've been studying KATRIN experiment for a popularizing science project and I was wondering, why is the spectrometer so big ? I mean the thing is so huge that they had to carry it over 8000km on the sea, it is 24meters long and had a diameter of 10m. But in all the publications related I didn't find any hint, only that the precision of the filter is given by: $$\frac{\Delta E}{E} = \frac{B_{\text{min}}}{B_{\text{max}}}$$ which involves only magnitude of magnetic field. They also want the magnetic field to vary adiabatically which involves: $$\nabla B/ B << 1$$ That can explain the length, but why this ovoid shape ? I'm not an expert of this field if someone can give a clear and precise answer I'll be very grateful ! Thank you, I'm assumming you obtained your information from the page on the katrin.kit.edu website where the measurement principle of a MAC-E-filter is discussed
{ "domain": "physics.stackexchange", "id": 74444, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "magnetic-fields, experimental-physics, electrons, spectroscopy, neutrinos", "url": null }
c++, optimization, performance, windows, garbage-collection immediately after drawing. I have no idea if this is the right way to do things or not. Any help would be greatly appreciated. Assume any Win32 call that returns a handle allocates a struct with malloc. And assume DeleteObject (DestroyWindow etc) frees allocated memory. you should call DeleteObject every time you creare a GDI object. Calling CreateSolidBrush twice, and losing the first handle without calling Deleteobject on it causes a resource leak. Since you are using C++ the correct way to do it is RAII. see http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization This site has a good tutorial with clear windows programming examples on the subject. http://www.relisoft.com/book/win/index.htm This is a good open source library (MIT licence), that you can use in your project directly. Or you can look at gdi.h in the source. http://win32-framework.sourceforge.net/index.htm
{ "domain": "codereview.stackexchange", "id": 2942, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, optimization, performance, windows, garbage-collection", "url": null }
formal-languages Title: Proof that the complement of a finite language is always an infinite language Let's say that we have a language $L$ that is finite. How can I prove that the complement of $L$, i.e., $\bar{L}$, is always an infinite language? Obs.: infinite language in this case means that is possible to construct an infinite set of words that are acceptable by $\bar{L}$. The set $\Sigma^*$ is an infinite set (you can build a bijection between the naturals and the words in $\Sigma^*$ if you wish to prove this, or you can observe that, for every $k \in \mathbb{N}$, $\Sigma^*$ contains at least one word of length $k$). Let $L$ be a finite language and suppose towards a contradiction that $\overline{L} = \Sigma^* \setminus L$ is finite. Then $\Sigma^* = L \cup \overline{L}$ must also be finite (since it's a finite union of finite sets). This provides the sought contradiction.
{ "domain": "cs.stackexchange", "id": 19267, "lm_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", "url": null }
python, beginner, python-3.x, game, adventure-game def blackout(): button = prompt_for_input(defend_infrastructure_blackout, ('X', 'B')) load(5) if button == 'X': print('\n{}\n\n{}{}\n'.format(blackout_evacuate, change_relation(('government', '---'), ('army', '---')), change_tide(-20))) choices.append('fight or flight: flight') change_tide(-25) print(f'{blackout_lose}\n\n{win_loss()}') elif button == 'B': print('\n{}\n\n{}{}\n'.format(blackout_stay, change_relation(('civilian', '+++'), ('government', '+++'), ('army', '+++')), change_tide(20))) choices.append('fight or flight: fight') change_tide(25) print(f'{blackout_win}\n\n{win_loss()}') def offer(): button = prompt_for_input(quell_rush_offer, ('X', 'B')) load(5)
{ "domain": "codereview.stackexchange", "id": 35731, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, beginner, python-3.x, game, adventure-game", "url": null }
c++, object-oriented Format your code consistently It doesn't matter as much what style you use as it matters that you have a consistent style. Here, the formatting is not too bad, but the different indentation levels are not typical. For example, I would not indent all of those member function definitions. Also there is a spurious semicolon after the destructor: ~Elevator() {};
{ "domain": "codereview.stackexchange", "id": 36544, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, object-oriented", "url": null }
ros, ekf, ekf-localization-node, ros-kinetic Original comments Comment by Dragonslayer on 2020-05-31: Hi, I cant open your EKF config file. What do the ekf inputs look like? EKF doesnt need an initial_pose as it starts at Zero, its localization that gives the map-->odom transform to place the odom frame in the maps initial position. How "large" is this path, are the squares meters wide? What kind of velocities are we talking here, how long does it take to complete the movement? Are those 400 seconds in the graph? Comment by crazymumu on 2020-05-31: Hi, thanks for your reply. the config file is accessible right now.
{ "domain": "robotics.stackexchange", "id": 35023, "lm_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, ekf, ekf-localization-node, ros-kinetic", "url": null }
+ \frac{k}{n}}\right)\cdot\frac{1}{n}$ is between the upper and lower sums, the area that will be assigned to f over [0,1] is equal to this last sum for arbitrarily large n, which is equal to the original limit. But this is just $\int_{0}^{1}\frac{1}{x+1}\,dx,$ which evaluates to ln(2).
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.959154287592778, "lm_q1q2_score": 0.8190340782237798, "lm_q2_score": 0.8539127529517043, "openwebmath_perplexity": 367.2674790711654, "openwebmath_score": 0.8891925811767578, "tags": null, "url": "https://www.physicsforums.com/threads/having-trouble-with-limit-problem.336621/" }
c++, linux, io, posix, gcc auto const data_copy = std::vector(data.begin(), data.end()); But you might consider making the type movable. That could be very handy. It wouldn’t even be hard to do; you just need to make the class aware of a “null” or moved-from state, perhaps like so: class Slurp { private: void* begin_ = nullptr; void* end_ = nullptr; public: [[gnu::nonnull]] explicit Slurp(char const* path) { // your existing constructor code... } Slurp(Slurp&& other) noexcept { std::ranges::swap(begin_, other.begin_); std::ranges::swap(end_, other.end_); } ~Slurp() { if (begin_) // note the if test std::free(begin_); } auto operator=(Slurp&& other) noexcept -> Slurp& { std::ranges::swap(begin_, other.begin_); std::ranges::swap(end_, other.end_); return *this; } Slurp(Slurp const&) = delete; auto operator=(Slurp const&) -> Slurp& = delete; };
{ "domain": "codereview.stackexchange", "id": 41281, "lm_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++, linux, io, posix, gcc", "url": null }
# Does the unit of a quantity change if you take square root of it? For example, I have a mass, m = 0.1kg and I square root it, giving me m = 0.316 (3s.f.) does the unit still stay as kg, or does it change?
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9693241974031599, "lm_q1q2_score": 0.8013517504097756, "lm_q2_score": 0.8267117983401363, "openwebmath_perplexity": 509.51198927082766, "openwebmath_score": 0.8759209513664246, "tags": null, "url": "http://physics.stackexchange.com/questions/62803/does-the-unit-of-a-quantity-change-if-you-take-square-root-of-it/62805" }
quantum-mechanics, atomic-physics, heisenberg-uncertainty-principle again, $\Delta p$, an interval, is converted to the absolute value $p=mv$. If something is in an interval $p \in [p_{min},p_{max}]$ we can say $p=p_{avg}\pm \Delta p$ where $p_{avg}=\frac{p_{max}+p_{min}}{2}$ and $\Delta p=\frac{p_{max}-p_{min}}{2}$, but these texts seems to assume $p_{min}=0$ and $\frac{p_{max}}{2}=mv=\Delta p$ or something similar. In other words, when in this example we give a known value for the speed, we are fixing the momentum without any indetermination, thus, uncertainly in position should be infinite. The usual way this calculation is demonstrated that you complain about isn't a solid argument, it si more like a play with symbols that is repeated and taught for its ability to provide a shortcut procedure to remind us of the correct result for Bohr radius. It isn't solid for two reasons:
{ "domain": "physics.stackexchange", "id": 55283, "lm_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, atomic-physics, heisenberg-uncertainty-principle", "url": null }
The other two terms are found similarly. The third term corresponds to drawing two greens (hence the $(3/7)^2$ and one of each of the other three colors. The first term actually combines two terms: the probability of drawing two blues and one of each of the other colors is $(1/7)^2(1/7)(2/7)(3/7)=(1/7)^3(2/7)(3/7)$, and so is the probability of drawing two whites and one of each of the other two colors, so they’ve been combined into a single term with an extra factor of $2$. The number of possible orders is the same in each case, which is why the factor of ${5!\choose 1!1!1!2!}$ can be pulled out of all the terms.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9890130586647623, "lm_q1q2_score": 0.8108852094019442, "lm_q2_score": 0.8198933293122506, "openwebmath_perplexity": 132.67237961818725, "openwebmath_score": 0.8568284511566162, "tags": null, "url": "http://math.stackexchange.com/questions/78121/probability-with-a-collection-problem" }
astrophysics, astronomy The NASA type of astrolabe has been used for more than 2000 years - the ancient Greeks described them and how to use them. The Danjon astrolabe was only invented in the 20th century. There are some pictures of a Danjon astrolabe here, and a paper about how it works here.
{ "domain": "physics.stackexchange", "id": 37056, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "astrophysics, astronomy", "url": null }
ros, localization, navigation, amcl, laser-scan-matcher Title: AMCL without using odomedry (but laser_scan_matcher instead) Hi, I have been trying to localize my robot using only an URG Hokuyo (so without any odometer) on a known static map. I have been able to run laser_scan_matcher to simulate odometry with gmapping to build the map. Now, using this map I'd like to use amcl to localize my robot in it but it doesn't seem to work since the laser data are not trying to fit the map... $rviz: Image1 $rxgraph: Image2 $tf_monitor: RESULTS: for all Frames Frames: Frame: /base_link published by /laser_scan_matcher_node Average Delay: -0.00268532 Max Delay: 0.00239109 Frame: /laser published by /base_link_to_laser Average Delay: -0.039569 Max Delay: 0 Frame: /odom published by /amcl Average Delay: -0.0978399 Max Delay: 0 All Broadcasters: Node: /amcl 10.3673 Hz, Average Delay: -0.0978399 Max Delay: 0 Node: /base_link_to_laser 25.2033 Hz, Average Delay: -0.039569 Max Delay: 0
{ "domain": "robotics.stackexchange", "id": 8666, "lm_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, localization, navigation, amcl, laser-scan-matcher", "url": null }
java, object-oriented /** * Replaces the Rent object at a specified index with a new one * @param index - index in the database of the Rent object to replace * @param item - Rent object to replace to */ public void set(int index, Rent item) { if(item == null) { System.err.println("Error adding a Rent object to the database: A null Rent object can't be added to the database!"); return; } database.set(index, item); } /** * Is the db empty? * @return true if empty * false if not */ public boolean isEmpty() { return database.isEmpty(); } /** * @return size of the database */ public int size() { return database.size(); }
{ "domain": "codereview.stackexchange", "id": 26689, "lm_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, object-oriented", "url": null }
newtonian-mechanics, classical-mechanics, momentum, conservation-laws, collision Title: Confusion about the collision of a ball against a wall I'm facing a lot of confusion regarding the conservation of momentum when a ball deflects from an infinitely massive wall. Suppose, the ball makes an angle $\alpha$ with the normal, before the deflection. After it, it makes the angle $\beta$ against the normal. Now I know, in a perfectly elastic collision, the coefficient of restitution $e$ is equal to $1$. In that case, it turns out that the angle of incidence is equal to the angle of reflection, such that $\alpha=\beta$. My confusion comes, when we consider the non-elastic general cases. I want to know, what is the relation between $\alpha$ and $\beta$ when the collision is not perfectly elastic. According to some sources, we have : $$\alpha+\beta=\frac{\pi}{2}$$ In some other examples, this is not true. In those examples, $\alpha+\beta$ can take any value.
{ "domain": "physics.stackexchange", "id": 84500, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, classical-mechanics, momentum, conservation-laws, collision", "url": null }
python, performance, functional-programming, concurrency, benchmarking Using time one a single run is at best inaccurate. Any code when run only once is kind of a random indicator as to how long time it'll take to do on the average. The shorter time it takes to execute, the more repeats you should have. You might also run into issues related to which current platform you are on, and imprecision in the time.time() call, as the documentation only promises a precision of a second. You're setting up the time testing method within the actual time taking. You're timing on the outside of the runtime_generator, and do functools.partial and ThreadPoolExecutor within that function. In the best situations this only skew all of your data, in a more likely situation your method disappears in the time to set up the test run. This effect will be worse the faster your tested function are.
{ "domain": "codereview.stackexchange", "id": 16685, "lm_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, functional-programming, concurrency, benchmarking", "url": null }
php, authentication if ($stmt3->execute()) { $row4 = $stmt3->fetch(PDO::FETCH_ASSOC); $returnApp = array( 'LOGIN' => 'Log_In_Success', 'user' =>$row2['user_type'], 'CL' =>$row4['Class'], 'DEP' => $row4['DEPARTMENT'], 'id' => $row4['login_id'], 'token' => $row4['user_token']); echo json_encode($returnApp); } }if ($key == 'MANAGEMENT'){ $stmt4 = $PDO->prepare(" SELECT management_table.CLASS, management_table.DEPARTMENT, management_table.HEAD, user_status.login_id, user_status.user_token FROM management_table
{ "domain": "codereview.stackexchange", "id": 42907, "lm_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, authentication", "url": null }
visible-light, frequency, vision, biology Another effect that you need to take into account is the phosphors involved in CRT's. The 100/120 Hz models have no flicker issue because the phosphors are designed to glow for milliseconds. Your LED phosphors might not be designed for that; there are quite some different variants around.
{ "domain": "physics.stackexchange", "id": 2171, "lm_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, frequency, vision, biology", "url": null }
## Type de bloc • 1 • 1/2 • 1/4 • 1/3 • 2/3 save Modifier l\'article
{ "domain": "blog-louvrehotels.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9773708032626702, "lm_q1q2_score": 0.8186652963919052, "lm_q2_score": 0.8376199633332891, "openwebmath_perplexity": 392.3503805881569, "openwebmath_score": 0.7811976671218872, "tags": null, "url": "http://blog-louvrehotels.com/o39te4/removable-discontinuity-limit-ab71e5" }
python, python-3.x, tkinter, pygame ... do something similar to this: def callback(): controller.show_frame("EnterCharacterScreen") entry_characters.pack(fill=tk.X, padx=10, pady=10) button_submit.pack(fill=tk.X, padx=80, pady=80, side=tk.BOTTOM) entry_characters.focus_set() # Automatically clicks the entry box self.after(seconds_to_wait*1000, callback) Don't repeat code Consider this block of code: def play_music3(): # Defines play_music3 pygame.mixer.music.load('Off Limits.wav') # Loads 'Off Limits.wav') file pygame.mixer.music.play(-1) # Makes the song play infinitely pygame.mixer.music.set_volume(0.8) # Sets the volume (volume can be adjusted from 0-1) def play_music4(): # Defines play_music4 pygame.mixer.music.load('Pim Poy.wav') # Loads 'Pim Poy.wav') file pygame.mixer.music.play(-1) # Makes the song play infinitely pygame.mixer.music.set_volume(0.8) # Sets the volume (volume can be adjusted from 0-1)
{ "domain": "codereview.stackexchange", "id": 31552, "lm_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, tkinter, pygame", "url": null }
thermodynamics, pressure Title: Pressure in a spirometer? https://i.stack.imgur.com/HQg04.jpg so I have this spirometer here to find out the volume of exhaled air, yet The procedure of exhaling through the tube gives me the question of how does the water move into the other rubber tubing explained using physics. When you exhale, the pressure of the gas above the liquid increases. This pushes liquid up the tube - if you keep the exit of the tube at roughly the same height as the liquid level ($h$ in my diagram), you don't need very much pressure differential to move the liquid. The most pressure you would need is that which pushes the liquid to the top of the tube, height $H$.
{ "domain": "physics.stackexchange", "id": 39158, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics, pressure", "url": null }
beginner, c, strings Here, a is a pointer to an integer, but b is only an integer. By moving the asterisk next to the name, it makes this clearer. int length = strlen ( str ); char * newStr = malloc (length * 2 ); if ( !newStr) shutDown ( "can't allocate memory" ) ; Becomes: int const len = strlen(str); char *const new_str = malloc(1 + len * 2); if (new_str == NULL) { shutDown("can't allocate memory"); } Error checking Rather than calling shutDown() and exit()ing the program, you should instead return an error value which can be checked by the caller of str_to_hex(). Because you return a pointer, you can return NULL to indicate an error occurred and the caller should check errno. Likewise, on some systems your program can incorrectly exit when length == 0. If we look at the manual page for malloc(3):
{ "domain": "codereview.stackexchange", "id": 34098, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "beginner, c, strings", "url": null }