text
stringlengths
1
1.11k
source
dict
data-structures, trees Finally, you should check if the tree is empty before starting any counting. You can add a simple condition at the start of your fonction to do that: if(head == NULL) return 0; Here is the final program: int Count_leaf(Tree* head) { if(head == NULL) return 0; if(head->left == NULL && head->right == NULL) return 1; else return Count_leaf(head->left) + Count_leaf(head->right); }
{ "domain": "cs.stackexchange", "id": 9049, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "data-structures, trees", "url": null }
java, object-oriented, design-patterns, immutability, fluent-interface return builtPerson; } public Builder setId(int id) { this.personToBuild.id = id; return this; } public Builder setName(String name) { this.personToBuild.name = name; return this; } public Builder setSurname(String surname) { this.personToBuild.surname = surname; return this; } public Builder setOccupied(boolean isOccupied) { this.personToBuild.isOccupied = isOccupied; return this; } } public int getId() { return id; } public String getName() { return name; } public String getSurname() { return surname; } public boolean isOccupied() { return isOccupied; }
{ "domain": "codereview.stackexchange", "id": 24419, "lm_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, design-patterns, immutability, fluent-interface", "url": null }
For reference if required, I am using version 10.2. Combining the results from this answer and this answer, here is how to get the lengths of your parallel curves: p = {{15.7336, -3.557}, {11.1177, -2.53343}, {15.4259, 19.1467}, {6.60292, 10.5131}, {-28.5053, 10.9099}, {-22.7909, -1.35239}, {-3.22756, -13.0483}, {-17.1309, -32.426}, {6.23965, -7.05847}, {25.0532, -25.0634}}; m = 3; (* degree *) n = Length[p]; fn[t_] = Table[BSplineBasis[{m, ArrayPad[Subdivide[n], m, "Extrapolated"]}, j - 1, t], {j, n + m}].ArrayPad[p, {{0, m}, {0, 0}}, "Periodic"]; Table[NIntegrate[Sqrt[#.#] &[D[fn[t] - i #/Sqrt[#.#] &[Cross[fn'[t]]], t]], {t, 0, 1}], {i, 0, 3}] {148.52091182623133, 154.80408759110168, 161.08726314974254, 167.37043875503448}
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9770226327661524, "lm_q1q2_score": 0.8361859390697679, "lm_q2_score": 0.8558511451289037, "openwebmath_perplexity": 3700.9987300221424, "openwebmath_score": 0.3805171251296997, "tags": null, "url": "https://mathematica.stackexchange.com/questions/146457/length-of-a-curve-parallel-to-a-spline" }
thermodynamics, astrophysics, entropy, dark-matter, virial-theorem see Kyle's comment below) when $2K < -W$. And John Baez's derivation did assume the ball of ideal gas is virialized, so his demonstration that collapse of an ideal gas decreases the entropy presumably wouldn't apply to a non-virialized collection of dark matter with $2K < -W$, so I presume this means it could collapse without contradicting the second law, and without the dark matter particles needing to radiate or interact as I suggested in my original answer.
{ "domain": "physics.stackexchange", "id": 17225, "lm_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, astrophysics, entropy, dark-matter, virial-theorem", "url": null }
quantum-mechanics $$\psi(t) = \exp \left(\frac{-iE_1t}{h} \right)\phi_1 + \frac{-1-\cos(\beta)}{\sin(\beta)}\exp \left(\frac{-iE_2t}{h} \right)\phi_2$$. How would I go about finding the probability that at a later time, the particle is in the state corresponding to $\lambda = 1$? And in general, how do you find the probability that a wave function is in a certain state at a later time? Any help is much appreciated P.s Apologies if I have used any strange notation, I am studying mathematics and am not entirely sure on the correct way to write things in physics! Probability of finding a system with state $|\psi\rangle$ in state $|\phi\rangle$ is defined to be a square of norm of projection of $|\phi\rangle$ on $|\psi\rangle$: $$P_\phi=|\langle\phi|\psi\rangle|^2.$$ But, before finding this projection, you should make sure that your states are normalized, otherwise statistical interpretation of wave function won't make any sense.
{ "domain": "physics.stackexchange", "id": 13909, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics", "url": null }
everyday-chemistry, oxides nasaspaceflight.com: Rust on the Moon. How is that possible without oxygen and liquid water? "But how can rust form far from water ice deposits on a barren oasis devoid of oxygen?" Axios: Researchers find rust on the Moon "Scientists were surprised by the findings because rust requires oxygen and water to form on Earth." Since you would know more astronomy than I do, wasn't moon a part of the Earth? I recall this from a documentary. I do remember seeing layers of "rust" in moutainous paths, so the oceans had a lot of iron which settled as a layer in mountains. If moon were a part of Earth, why is that surprising? a) The question is what was the age of this rust? Secondly, Mars is also "rusty", its surface is highly oxidizing with a huge amount of perchlorate in the soil (there is a long story how that was discovered by the folly of analytical chemists). Who knows what is the moon soil like. What about the shower of radiation on the moon. That may promote oxidation as well.
{ "domain": "chemistry.stackexchange", "id": 14453, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "everyday-chemistry, oxides", "url": null }
matlab, interpolation, downsampling, resolution, scaling camera with a specific MTF, and sensor resolution, and are going to neglect scattering (which would require something like MODTRAN), your original image has been acquired with some angular resolution, $\theta_0$, your image has a linear spatial resolution $\Delta_0$ such that $$
{ "domain": "dsp.stackexchange", "id": 6076, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "matlab, interpolation, downsampling, resolution, scaling", "url": null }
ds.algorithms, time-complexity, randomized-algorithms Title: Algorithms with finite expected running time and infinite variance I am working on an algorithm for which the running time is a random variable $X$ that has finite expected value, but infinite variance. Are there examples of other algorithms for which this is the case? Are any such algorithm used in practice, or does the infinite variance make the running time too unpredictable? Though I'm having trouble finding the exact exponent of the power laws they purport to exist, Kroc, Sabharwal and Selman have a paper called "An Empirical Study of Optimal Noise and Runtime Distributions in Local Search" where they show WalkSat (a local solver for SAT) has power law tails in the runtime. If the power law does not fall within the range of $(2,3]$, then obviously this isn't quite what you're looking for, but maybe it's still of some use.
{ "domain": "cstheory.stackexchange", "id": 1586, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ds.algorithms, time-complexity, randomized-algorithms", "url": null }
mechanical-engineering, motors, gears, torque Title: What is the use of gears in a device with a fixed gear ratio? From my understanding, there are two uses of a gearing system: to change the speed of output rotation (trading it with torque), and to change the axis of rotation. Now, in a car, for example, it is necessary to have multiple available gear ratios, to allow for high torque and high acceleration when the car begins to move from stationary, and also high speed when the car is already on the move. However, I know that some systems still have gears when they only used a fixed gear ratio. For example, in my lab, we work with a robot arm, and my colleagues often talk about the gearing system in the arm. But the arm does not repeatedly change its gear ratio like in a car. So what are these gears actually doing?
{ "domain": "engineering.stackexchange", "id": 393, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "mechanical-engineering, motors, gears, torque", "url": null }
ros2, tutorial, colcon, docker, ros-crystal Title: Create Dockerfile for ros2 package : ament_cmake error Hello, I try to use docker to develop ros2 packages. In this context, I use the minimal_publisher package from https://github.com/ros2/examples as example which has the structure: minimal_publisher/ minimal_publisher/CMakeLists.txt minimal_publisher/lambda.cpp minimal_publisher/member_function.cpp minimal_publisher/not_composable.cpp minimal_publisher/package.xml minimal_publisher/README.md minimal_publisher/Dockerfile #THIS FILE WAS ADDED BY ME
{ "domain": "robotics.stackexchange", "id": 32758, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros2, tutorial, colcon, docker, ros-crystal", "url": null }
java, interview-questions, reinventing-the-wheel } else if(eachDigit == 9) { reVal += "9"; } } String reVal2 = ""; for(int index = reVal.length() -1 ; index >= 0 ; index--) { reVal2 += reVal.charAt(index); } return reVal2; }
{ "domain": "codereview.stackexchange", "id": 2005, "lm_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, interview-questions, reinventing-the-wheel", "url": null }
experimental-realization, optical-quantum-computing, spdc, quantum-state Title: State produced by spontaneous parametric down-conversion (SPDC) I'm researching SPDC's efficacy for use in an optical quantum computing model and I've been trying to figure out exactly what state the photons are in when they come out (as represented by a vector, for example), if I'm using type 1 SPDC and I'm looking at the polarization of the photons. Please provide any references used =) Background First of all, I'll use $\lvert H\rangle$ as a horizontally polarised state and $\lvert V\rangle$ as a vertically polarised state1. There are three modes of light involved in the system: pump (p), taken to be a coherent light source (a laser); as well as signal and idler (s/i), the two generated photons
{ "domain": "quantumcomputing.stackexchange", "id": 4, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "experimental-realization, optical-quantum-computing, spdc, quantum-state", "url": null }
homework-and-exercises, fluid-dynamics, percolation The problem is with ln(0) and also if my ΔH is actually smaller than 1, then it will result in a negative value. *Sorry that I uploaded this as a picture as I am not sure how to insert equations and special characters here. The pressure difference across the porous plug is given by Darcy's law: $$P_L-P_R=\frac{\mu}{k}vL\tag{1}$$where L is the length of the plug, k is the permeabiity of the plug, v is the superficial velocity through the plug, and $\mu$ is the fluid viscosity. The volumetric flow rate through the plug is given by $vA$, where A is the area of the plug. So, $$A_c\frac{d(\Delta H)}{dt}=-2vA\tag{2}$$where $A_c$ is the cross sectional area of each of the two tanks. If we neglect kinetic energy effects, then $$P_L-P_R=\rho g\Delta H\tag{3}$$If you combine these equations, you obtain a differential equation for the time variation of $\Delta H$ involving only the areas, the permeability, the viscosity, the density, g, and the length of the plug.
{ "domain": "physics.stackexchange", "id": 32691, "lm_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, fluid-dynamics, percolation", "url": null }
the projective plane has order n; e.g. Π_2 has order 2. (Not order n+1 as might be expected; we already saw that n=r-λ is an important parameter in Fisher's inequality (where it was the coefficient of I in M\T M = (r-λ I) + λ J) and in the BRC theorem, and this is even more decisively the case for projective planes.
{ "domain": "harvard.edu", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9907319853876677, "lm_q1q2_score": 0.8277402594148112, "lm_q2_score": 0.8354835330070839, "openwebmath_perplexity": 2557.5821634393883, "openwebmath_score": 0.8611697554588318, "tags": null, "url": "http://abel.math.harvard.edu/~elkies/M155.15/notes.html" }
special-relativity, speed-of-light Title: How is Special Relativity (SR) shown to NOT be an artifact of perception or measurement Special Relativity (SR) paradoxes are old-hat. But as I read explanations, they tend to resolve issues of simultaneity by applying the appropriate math... but that seems to me to be proving the theory by positing the theory. Just because the math is valid doesn't mean an argument is sound. All I have to do is believe warping space and time against curves and yes... it all works out. For instance... A space ship is traveling toward an asteroid and away from a stationary body at 60 percent the speed of light while at the same time an asteroid is traveling directly toward the space ship and toward the stationary body at 60 percent the speed of light.
{ "domain": "physics.stackexchange", "id": 9106, "lm_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, speed-of-light", "url": null }
python, performance, python-3.x, pygame, raycasting (This also has the nice side-effect of reducing the amount of "pixel creep".) Now that we've eliminated the inner loop, it's no longer obvious where to look for further improvements. So now would be a good time to run the profiler. But I think this is enough for one answer. Revised code This replaces the for y in range(texHeight): loop: # Darken environment with distance. # Faces with side=1 are darker to add to the 3D effect c = max(1, (255.0 - rayLength * 27.2) * (1 - side * .25)) yStart = max(0, drawStart) yStop = min(HEIGHT, drawEnd) pixelsPerTexel = lineHeight / texHeight colStart = int((yStart - drawStart) / pixelsPerTexel + .5) colHeight = int((yStop - yStart) / pixelsPerTexel + .5) yStart = int(colStart * pixelsPerTexel + drawStart + .5) yHeight = int(colHeight * pixelsPerTexel + .5)
{ "domain": "codereview.stackexchange", "id": 25083, "lm_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, python-3.x, pygame, raycasting", "url": null }
Let $X$ be a topological space and $U\subset X.$ If for every $p\in U$ there exists an open $V$ such that $p\in V\subset U$ then $U$ is open: (1). For each $p\in U$ let $F(p)$ be the set of all open $V$ such that $p\in V\in U.$ Let $G(p)=\cup F(p).$ Then $p\in G(p) \subset U.$ And $G(p)$ is open because it is the union of the family $F(p)$ of open sets. (2). Therefore $$U=\cup_{p\in U}\{p\}\subset \cup_{p\in U}G(p)\subset \cup_{p\in U}U=U.$$ And $\cup_{p\in U}G(p$) is open because it is the union of the family $\{G(p):p\in G\}$ of open sets. Applying this to your Q :For $(x,y)\in \mathbb R^2$ and any real $a,b$ the set $(-a+x,a+x)\times(-b+y,b+y)$ is open. If $Ax+By<C$ let $C-(Ax+By)=d.$ Take $a>0$ and $b>0$ such that $|Aa|<d/2$ and $|Bb|<d/2.$ Then $(x,y)\in V=(-a+x,a+x)\times (-b+y,b+y),$ and for all $(x',y')\in V$ we have $$Ax'+By'\leq Ax+By+|A(x'-x)|+|B(y'-y)|<Ax+By+d/2+d/2=C.$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9869795091201804, "lm_q1q2_score": 0.8092179287261823, "lm_q2_score": 0.8198933425148213, "openwebmath_perplexity": 97.40772648029828, "openwebmath_score": 0.9137688875198364, "tags": null, "url": "https://math.stackexchange.com/questions/1476660/prove-that-open-half-planes-are-open-sets/1476733#1476733" }
general-relativity, black-holes, spacetime, event-horizon, singularities "An exact solution helps: consider a black hole formed by matter that goes in by the speed of light. Doesn't change the physics very much but makes it easy to understand. If all particles (basically without rest mass) would enter in a spherically symmetric mode then you can write the solution exactly. One finds that the horizon already opens up at a space-time point at the center (but no singularity there or anywhere else). As soon as the matter passed the horizon the outside world is in the Schwarzschild metric. Now you have to understand that in the inside region, surrounded by the horizon, space and time interchange roles. What you thought is space (such as the r coordinate) is actually time and what you thought to be time (the t coordinate) is actually space. The singularity is at r=0 but that is actually in the future. Not only that, it is, in a sense, the infinite future because outside observers will never see anything that has passed the horizon. For the outside observer, that
{ "domain": "physics.stackexchange", "id": 84741, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "general-relativity, black-holes, spacetime, event-horizon, singularities", "url": null }
c++, gui, qt private: QStackedLayout *const layout; public slots: void setPage(int index) { layout->setCurrentIndex(index); } void goToMenu() { layout->setCurrentIndex(0); } }; #include <QApplication> int main(int argc, char **argv) { QApplication app(argc, argv); MainWindow mw; mw.show(); return app.exec(); } #include "165088_moc.cpp"
{ "domain": "codereview.stackexchange", "id": 25930, "lm_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++, gui, qt", "url": null }
black-hole, observational-astronomy, astrophysics, supermassive-black-hole (emphasis mine)
{ "domain": "astronomy.stackexchange", "id": 3637, "lm_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, observational-astronomy, astrophysics, supermassive-black-hole", "url": null }
dimensional-analysis, physical-constants, si-units, weak-interaction, absolute-units Title: Why is the Fermi coupling constant always expressed in units of $(\hbar c)^3$? Everywhere I've looked so far (such as NIST) the Fermi coupling constant $G_F$ is always expressed as $$\frac{G_F}{(\hbar c)^3} = 1.166 364(5) \times 10^{-5} \textrm{ GeV}^{-2}$$ never as just plain old $G_F$. I am wondering why that is. This is mostly to make an explicit connection with natural units - the unit system in which $\hbar$ and $c$ are both set to 1, which is the natural set of units for relativistic quantum theory. Because you've adimensionalized two units and you had three physical dimensions to start with (mass, length and time), natural units retain a single dimensional parameter, which is usually taken to be mass and, because this is usually particle physics we're talking about, measured in $\mathrm{eV}/c^2$, or just $\mathrm{eV}$ with the factor of $c=1$ understood.
{ "domain": "physics.stackexchange", "id": 27783, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "dimensional-analysis, physical-constants, si-units, weak-interaction, absolute-units", "url": null }
quantum-mechanics, quantum-information, quantum-optics The inputs are at port a and b, and outputs at port c and d. Using this, I have constructed this unitary PBS operator: $$ \hat{O}_{PBS} = \begin{bmatrix} 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & i & 0 \\ 0 & 0 & 0 & i \end{bmatrix} $$ The i's are the phases comming from the reflections, and the rows are ordered in the following way: $\left( \left| H \right>_a, \left| H \right>_b, \left| V \right>_a, \left| V \right>_b \right)$ to $\left( \left| H \right>_c, \left| H \right>_d, \left| V \right>_c, \left| V \right>_d \right)$. At port a, just before the PBS, I put a half-wave plate (HWP) to rotate the polarization of one of the photons. The operator looks like this: $$ \hat{O}_{HWP} = \begin{bmatrix} \cos(2\theta) & \sin(2\theta) \\ \sin(2\theta) & \cos(2\theta) \\ \end{bmatrix} $$ where $\theta$ is the angle with which the HWP is rotated. So if I input two horizontally polarized photons, the state after the PBS is: $$ \left| \psi \right> =
{ "domain": "physics.stackexchange", "id": 49714, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, quantum-information, quantum-optics", "url": null }
homework-and-exercises, kinematics, vectors, calculus, relative-motion Here ship A is my ship and ship B is the other ship. We work in a frame attached to ship A with the positive y axis pointing North and the positive x axis pointing East. Let $\vec r_{A}(t)$ be the position of ship A as a function of time $t$ and $\vec r_{B}(t)$ be the position of ship B. Let $\vec v_{A}(t)$ and $\vec v_{B}(t)$ be the velocities of the two ships. The velocity functions have units of knots (miles per hour) and the position functions have units of miles. $t$ has units of hours. We have : \begin{align} \vec v_{A}(t) & = (0,0) \\\\ \vec v_{B}(t) & = (-10,20) \end{align} So : \begin{align} \vec r_{A}(t) & = (0,0)\\\\ \vec r_{B}(t) & = (-10t,20t-6) \end{align} and the displacement vector between the two ships is : \begin{equation} \vec r_{AB}(t) = \vec r_{B}(t) - \vec r_{A}(t) = (-10t,20t - 6) = \vec r_{B}(t) \end{equation} So the distance between the two ships is given by : \begin{align} d_{AB}(t) = |\vec r_{AB}(t)| & = \sqrt{(-10t)^{2} + (20t-6)^{2}}\\\\
{ "domain": "physics.stackexchange", "id": 93807, "lm_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, kinematics, vectors, calculus, relative-motion", "url": null }
classical-mechanics, everyday-life Title: Why can't you ride a bike with a fixed handlebar? I tried one time, as part of an experiment, to ride a bike with a fixed handle bar. Impossible. So, in any case, our movements made with the handlebar helps us in not falling down. I can feel kinda how, but cannot really put a finger on it. Does anybody know the answer? You can't ride it because it's very thin and so is bound to fall over to one side or the other. A more difficult question is why you can ride a bike in normal circumstances. That has already been discussed on this site but as you would expect the answer is related to the steering mechanism.
{ "domain": "physics.stackexchange", "id": 30923, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "classical-mechanics, everyday-life", "url": null }
gazebo, simulation Title: Husky simulator for ROS-Lunar? I am using Ubuntu 17.04. I have ROS-Lunar and I wish to use Husky simulation in my Gazebo. I tried installing it with $ sudo apt-get install ros-indigo-husky-simulator but it says "Unable to locate package" "ros-lunar-husky-simulator" doesnt work either. Isnt Husky supported by Lunar? Do I need to use ROS-Indigo to get this to work? What to do? Originally posted by MukulKhanna on ROS Answers with karma: 25 on 2017-08-25 Post score: 0 The Husky is currently only supported on Indigo. Kinetic is planned whereas, lunar is not but should work if installed from source. I believe that the husky repo has a kinetic-devel branch that should work if installed from source. Originally posted by tonybaltovski with karma: 2549 on 2017-08-25 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 28697, "lm_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, simulation", "url": null }
$$\frac{\partial P(n,t)}{\partial t}=k_1(P(n-1,t)-P(n,t))+k_2((n+1)P(n+1,t)-nP(n,t))$$ defined as $$G(s,t)=\sum_{n=0}^\infty s^nP(n,t)$$ - The solution method often used for first-order PDEs is the method of characteristics. I could write something up about it if you like. Just to clarify though -- is $s \in \mathbb{R}$ and $t \geq 0$? – Kyle Dec 9 '13 at 22:53 Yes, $s\in \mathbb{R}$ and $t \ge 0$. I'll look up the method of characteristics. – Mark Eichenlaub Dec 9 '13 at 22:59 $\dfrac{\partial G}{\partial t}=(1-s)\left(-k_1G+k_2\dfrac{\partial G}{\partial s}\right)$ $\dfrac{\partial G}{\partial t}+k_2(s-1)\dfrac{\partial G}{\partial s}=k_1(s-1)G$ $\dfrac{dt}{du}=1$ , letting $t(0)=0$ , we have $t=u$ $\dfrac{ds}{du}=k_2(s-1)$ , letting $s(0)=s_0$ , we have $s=(s_0-1)e^{k_2u}+1=(s_0-1)e^{k_2t}+1$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.987946220128863, "lm_q1q2_score": 0.8054058519465839, "lm_q2_score": 0.8152324848629215, "openwebmath_perplexity": 220.54044122233012, "openwebmath_score": 0.9141815304756165, "tags": null, "url": "http://math.stackexchange.com/questions/600276/solution-to-frac-partial-g-partial-t-1-s-left-k-1gk-2-frac-partial-g" }
electrostatics, charge, gauss-law, conductors Title: Electric field inside a conductor and induced charges My textbook says two different things and I'm not sure how to reconcile these two: electric field inside a conductor is always 0. for a conductor with a cavity with a charge q inside it, the field due to the charge q for all exterior points is cancelled by the induced charge on the inner surface.
{ "domain": "physics.stackexchange", "id": 43011, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electrostatics, charge, gauss-law, conductors", "url": null }
optics, visible-light, reflection Now an interesting question is, if the reflected image has the same intensity in both cases, why do you see it in one case and not see it in another? The answer lies in the working of the eye. The eye does not have a constant sensitivity to light. Whenever there is a lot of light, your irises contract, admitting less light into your eyes. This means that you can perceive bright light but dim light becomes invisible. When it is darker, they expand, and the reverse effect happens. That's why you feel blinded by bright light when you leave a dark room, and also why it takes time to adjust to a dark room. (You can actually see your irises contracting; go to a well lit room with a mirror, stare at your eyes, close them for a few seconds, then reopen.. Takes a few tries, but you can see them contracting). Edit: (Credit @BenjaminFranz for pointing this out) The regulatory mechanism does not consist of only the iris/pupil. The retina also does a lot of regulation, which is why it takes half a
{ "domain": "physics.stackexchange", "id": 2405, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "optics, visible-light, reflection", "url": null }
accelerometer, algorithm I'm not sure what method you're using to get from quaternions to the rotated acceleration vector, but I would like to point out that you can't just do numeric integration on quaternions like you can with accelerations or velocities. See page 11 of this document for more detail, but briefly, take your gyroscope angular accelerations $\omega_x \omega_y \omega_z$ and the existing quaternion $q(t)$ and calculate the quaternion derivative: $$ \dot{q}(t) = \frac{1}{2} \left[ \begin{array}{cccc} 0 & \omega_z & -\omega_y & \omega_x \\ -\omega_z & 0 & \omega_x & \omega_y \\ \omega_y & -\omega_x & 0 & \omega_z \\ -\omega_x & -\omega_y & -\omega_z & 0 \end{array} \right] q(t) $$ Then you numerically integrate that, such that, for a discrete system, $$ q_k = q_{k-1} + \dot{q}_k * dT $$ You do not provide any code on how you're updating your acceleration vector, no code on how you're getting a quaternion, etc., so it's not possible to give you any more specific feedback than this.
{ "domain": "robotics.stackexchange", "id": 903, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "accelerometer, algorithm", "url": null }
decomposition Marcin Banach and Agnieszka Makara (211). "Thermal Decomposition of Sodium Phosphates". J. Chem. Eng. Data, 56, 7, 3095–3099. https://doi.org/10.1021/je200381z
{ "domain": "chemistry.stackexchange", "id": 17301, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "decomposition", "url": null }
statistical-mechanics, partition-function As we'll see in a moment, passing to the double sum relies on the mathematical fact (about tensor products of Hilbert spaces) that if $s_1$ labels a basis of states for system $1$, and if $s_2$ labels a basis of states for system $2$, then the set of all pairs $(s_1, s_2)$ labels a basis of states for the composite system. Let's assume that the system at hand is a quantum system described by a state space (Hilbert space) $\mathcal H$. Let the (state) labels $s$ index an orthonormal basis of $\mathcal H$ consisting of eigenvectors $|s\rangle$ of the total system's Hamiltonian $H$; \begin{align} H|s\rangle = E(s)|s\rangle, \end{align} then the partition function is obtained by summing over these states; \begin{align} Z = \sum_s e^{-\beta E(s)}. \end{align} Notice that the state labels $s$ don't have to be numbers. They could, for example, be pairs of numbers or triples of numbers, whatever is most convenient to label the possible states for the system at hand.
{ "domain": "physics.stackexchange", "id": 13970, "lm_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, partition-function", "url": null }
(Common) AC = DB (Given) By SSS congruence rule, ΔABC ≅ ΔDCB. is a parallelogram. 13 is a parallelogram. either the copyright owner or a person authorized to act on their behalf. And the same goes for any other pair of adjacent triangles in the parallelogram. The diagonals bisect each other. All angles are right angles by definition. In a parallelogram, the sides are 8 cm and 6 cm long. The diagonals of a parallelogram bisect each other. Likewise, the diagonal can be written O … Missy is proving the theorem that states that opposite sides of a parallelogram are congruent. The diagonals of a parallelogram bisect each other. Thus, since sides and are parallel and of equal length, they can be represented Ex 8.1, 2 If the diagonals of a parallelogram are equal, then show that it is a rectangle. 13 is a parallelogram. The diagonals of a rhombus are_____congruent. Alternate interior angle pairs are congruent so. It follows that or more of your copyrights, please notify us by providing a
{ "domain": "com.vn", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9585377261041521, "lm_q1q2_score": 0.8345003244035104, "lm_q2_score": 0.8705972667296309, "openwebmath_perplexity": 530.5089890007557, "openwebmath_score": 0.6008806824684143, "tags": null, "url": "https://vison.com.vn/gfw-ssnww-uljrqqi/the-diagonals-of-a-parallelogram-c801d0" }
ros, rviz, visualization, ros-indigo #24 0x00007ffff79b1a17 in rviz::Display::initialize (this=0x168ffe0, context=0x129c430) at /home/likewise-open/FARADAYFUTURE/c-naman.kumar/catkin_ws/src/rviz/src/rviz/display.cpp:94 #25 0x00007ffff7ad057e in rviz::VisualizationManager::addDisplay (this=0x129c430, display=0x168ffe0, enabled=true) at /home/likewise-open/FARADAYFUTURE/c-naman.kumar/catkin_ws/src/rviz/src/rviz/visualization_manager.cpp:434 #26 0x00007ffff7ad0a2b in rviz::VisualizationManager::createDisplay (this=0x129c430, class_lookup_name=..., name=..., enabled=true) at /home/likewise-open/FARADAYFUTURE/c-naman.kumar/catkin_ws/src/rviz/src/rviz/visualization_manager.cpp:477 #27 0x00007ffff79d11b2 in rviz::DisplaysPanel::onNewDisplay (this=0x129f040) at /home/likewise-open/FARADAYFUTURE/c-naman.kumar/catkin_ws/src/rviz/src/rviz/displays_panel.cpp:126
{ "domain": "robotics.stackexchange", "id": 26228, "lm_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, rviz, visualization, ros-indigo", "url": null }
equilibrium, stability, non-linear-systems, complex-systems Rigorously we're only talking about linear stability, which is often the dominant term, but not always. For instance, if $\dot f(x^*)=0$, then the criterion above is insufficient (one might talk about neutral stability): you need to consider higher orders of derivatives. Also, a linearly stable fixed point might have a basin of attraction so small that, for any practical purposes, the point is effectively unstable. Other types of stability exist, even more in systems of higher dimensionality. You can find more about it searching for stability theory.
{ "domain": "physics.stackexchange", "id": 50506, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "equilibrium, stability, non-linear-systems, complex-systems", "url": null }
it can be used to find out the centroid , incenter and excenters of a triangle. Example: Janice needs to find the area of the red section of the circular table top in order to buy the right amount of paint. In an equilateral triangle the orthocenter, centroid, circumcenter and incenter coincide. Locate the centroid x of the circular sector. Given a figure Z, obtain the centroid C i and area A i of each Z n part wherein all holes that extend outside the compound shape are to be treated as negative values. Engineering Fundamentals: CENTROID, AREA, MOMENTS OF INERTIA, POLAR MOMENTS OF INERTIA, & RADIUS OF GYRATION OF A CIRCLE. The figure can be any regular or irregular polygon; it does not have to be a regular geometric figure. In the formula given, A is the area of the sector, N is the degree of the central angle of the sector, pi is an irrational number that can be rounded to 3. The centroid of volume is the geometric center of a body. 1 Answer to A sector-shaped sluice gate having a
{ "domain": "scapinspa.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.991152646485103, "lm_q1q2_score": 0.8033083220547793, "lm_q2_score": 0.8104789155369047, "openwebmath_perplexity": 538.4268003249031, "openwebmath_score": 0.6964551210403442, "tags": null, "url": "http://retq.scapinspa.it/centroid-of-sector-formula.html" }
ros, generate-messages, ros-indigo From this It looks like the messages were created successfully but the message headers are empty... not sure what I'm missing here. Ok Update, rebuilt my catkin workspace and environment, found this on `catkin_make`: Looks like it fails every time I have to rebuild the build from scratch i.e. removing the contents of devel. From `catkin_make --force`:
{ "domain": "robotics.stackexchange", "id": 22904, "lm_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, generate-messages, ros-indigo", "url": null }
nomenclature Title: Are CAS numbers considered proprietary? I’m interested in working with a large dataset consisting of CAS numbers and each corresponding molecule/chemical unit’s name. From my understanding, CAS Registry Numbers are assigned and stored by a division of the American Chemical Society. However, it's not entirely clear to me how these numbers are controlled outside CAS's own database. Does ACS “own” these numbers? CAS numbers itself don't contain chemical information, and initially set to help ACS' Chemical Abstract Service to organize their records. It is the only body to create and curate (both assign and withdraw) them.(1) The rules behind the format of a CAS number are public.
{ "domain": "chemistry.stackexchange", "id": 18015, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "nomenclature", "url": null }
python, excel Allowing nesting of functions in the map commands creates an unnecessary complexity to the code. Dropping that ability allows evalOplist to be split into smaller functions. def evaluate_command(command, from_sheet, row): if isinstance(command, (tuple, list)): return evaluate_func(func, val_list, from_sheet, row) else: evaluate_value(command, from_sheet, row) def evaluate_value(val, from_sheet, row): if isinstance(val, int): return from_sheet.cell(row, val).value else: return command def evaluate_func(func, val_list, from_sheet, row): args = [evaluate_value(val, from_sheet, row) for val in val_list] return func(*args) Two problems still exist:
{ "domain": "codereview.stackexchange", "id": 8954, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, excel", "url": null }
machine-design, machine-elements And it is the photo of the worst part of what I bought. My question is about the brass (?) nut: What is the role of the nut? Why it has something which looks like a small ball inside? Should it be put in the position, in which it is in every other photo of this machine? The image shows what is often known as a zerk fitting, aka a grease fitting. The ball seals the passage from the outside to the internals which require grease. A grease gun with a properly sized connector will snap onto the zerk fitting. The gun is used to pump grease under pressure to the area described in the image as "no space, grinds," likely removing the grinding. Pump grease through the fitting until some appears, then wipe off the excess.
{ "domain": "engineering.stackexchange", "id": 3666, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "machine-design, machine-elements", "url": null }
react.js, reactive-programming What is the best way to do this list? You don't really need to destructure at all, you can simply use props directly if you like this.props.mesas.map(item => ... example class Mesas extends Component { render() { return ( <div> {this.props.mesas.map(function(item) { return ( <div key={item.id}> <text>{item.id}</text> </div> ); })} </div> ); } } but if you did want/need to destructure your props, then the correct pattern is const { mesas } = this.props; example class Mesas extends Component { render() { const { mesas } = this.props; return ( <div> {mesas.map(function(item) { return ( <div key={item.id}> <text>{item.id}</text> </div> ); })} </div> ); } }
{ "domain": "codereview.stackexchange", "id": 38623, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "react.js, reactive-programming", "url": null }
newtonian-mechanics, reference-frames, centrifugal-force, centripetal-force This has always nagged me a bit as I often wonder that if every force has a reaction force then a centripetal force must have a reaction centrifugal force, but when I asked my teachers about this they told me that centrifugal force does not exist. Summary Centrifugal force and Coriolis force exist only within a rotating frame of reference and their purpose is to "make Newtonian mechanics work" in such a reference. So your teacher is correct; according to Newtonian mechanics, centrifugal force truly doesn't exist. There is a reason why you can still define and use it, though. For this reason, your girlfriend's book might also be considered correct. Details
{ "domain": "physics.stackexchange", "id": 65106, "lm_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, reference-frames, centrifugal-force, centripetal-force", "url": null }
cosmology, photons, space-expansion, big-bang, cosmic-microwave-background Title: Why is it said that photon-wavelengths have increased by a factor of 1000 since our universe became transparent to light? After reading several explanations for the so-called "Hubble-radius", and still being confused, (as I reckon are some of the folks who tried to answer THAT question !!), I have a related question, which I hope might help clarify this issue. It's said that the average wavelength of photons at the time when our universe became transparent to light, [i.e., at approx. 300,000 years after the Big Bang started], was about 1000 times less than what it is now, and that each photon carried about 1000 times as much energy. These are, of course, the photons which constitute the so-called "cosmic microwave backround" [CMB] radiation. If our universe has been expanding at approx. the same rate since year-300,000 it seems like the factor would be more like (13 billion) / (300 thousand), which is much larger than 1000. Am I missing something important here? See the lookback
{ "domain": "physics.stackexchange", "id": 32343, "lm_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, photons, space-expansion, big-bang, cosmic-microwave-background", "url": null }
Indeed, if $a$ is a point of a given partition, then it is sufficient to take $\epsilon$ sufficiently small to make sure that the next point is already in $[a+\epsilon,b]$. Boundedness of $f$ takes care of the first interval. • One thing to add perhaps. What is your best estimate for $V_a^b f$? – B. S. Thomson Jan 24 '16 at 0:01 • It would be the same bound, right? – metricspace Jan 24 '16 at 0:09 • Almost the same. (Function need not be continuous here.) – B. S. Thomson Jan 24 '16 at 0:11 • $V_a^b f \leq M+\lim_{c\to a^+} \sup\{|f(a)-f(x)| : x\in (a,c]\}\leq M+\sup_{x\in (a,b]}|f(a)-f(x)|.$ E.g. if $f(x)=0$ for $x\in (a,b]$ and $f(a)=1$, with $M=0$; and $V_a^bf=1.$ – DanielWainfleet Jan 24 '16 at 0:38 • How about $M+\limsup_{x\to a}|f(x)-f(a)|$? – John B Jan 24 '16 at 0:45
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9814534333179649, "lm_q1q2_score": 0.8157281999514091, "lm_q2_score": 0.8311430499496096, "openwebmath_perplexity": 168.0477796878329, "openwebmath_score": 0.8949533104896545, "tags": null, "url": "https://math.stackexchange.com/questions/1624281/if-f-is-of-bounded-variation-on-a-epsilon-b-does-it-imply-f-is-of-bou" }
quantum-mechanics, quantum-entanglement, faster-than-light, bells-inequality, non-locality How can we rescue locality here? (I guess this is deeply connected to the question whether the wavefunction actually collapses or something else is going on.But how can we say that there is not actually a collapse if the model of the collapse gives us the right probability distribution for the angles?Maybe you can adress this) Edit:
{ "domain": "physics.stackexchange", "id": 43828, "lm_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-entanglement, faster-than-light, bells-inequality, non-locality", "url": null }
beginner, strings, haskell -- if the list is empty, the result is the initial value z; else -- apply f to the first element and the result of folding the rest foldr f z [] = z foldr f z (x:xs) = f x (foldr f z xs) -- if the list is empty, the result is the initial value; else -- we recurse immediately, making the new initial value the result -- of combining the old initial value with the first element. foldl f z [] = z foldl f z (x:xs) = foldl f (f z x) xs In this case, the function can be tersely written as stringMapReplace :: Dictionary -> String -> String stringMapReplace = flip $ foldr $ uncurry strReplace Intermediate steps to get there First, recognize that your dictionary is the thing that is being iterated through. (That is, your (m:ms) plays the role of the (x:xs) in the fold.) In Haskell, it is usually more convenient to place the parameter that varies the most at the end. So, rewrite your original
{ "domain": "codereview.stackexchange", "id": 20424, "lm_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, strings, haskell", "url": null }
localization, navigation, gps, robot-localization However from my experience with this package, supplying the correct YAW offset is very important. If you are unsuccessful with the datum option, it may be the yaw offset you supply. Alexandre Originally posted by AlexandreB with karma: 43 on 2016-07-24 This answer was ACCEPTED on the original site Post score: 1 Original comments Comment by Tom Moore on 2016-07-25: Right. You can use the datum parameter, but then all your positions will be w.r.t. that pose. You can then turn on relative mode for that input in the EKF or UKF (if you're using them), which will make the output pose start at 0.
{ "domain": "robotics.stackexchange", "id": 25327, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "localization, navigation, gps, robot-localization", "url": null }
c++, c++11, boost, portability, dynamic-loading ObjectLevelDebuggingOrTesting("\tRpnDLData->m_Data->name = %s\n", m_Data->name); } else { ObjectLevelDebuggingOrTesting("\tRpnDLData->m_data = NULL\n"); } } void RpnDLData::TestReportThisObject() { ObjectLevelDebuggingOrTesting("RPN Dynamic Library Object Test Report\n"); ObjectLevelDebuggingOrTesting("\tRpnDLData->TestLevel = %d\n", GetObjectTestLevel()); ObjectLevelDebuggingOrTesting("\tRpnDLData->DebugLevel = %d\n", GetObjectDebugLevel()); Test_ReportM_LibPath(); Test_Reportm_IsOpen(); Test_ReportM_Data(); Test_ReportM_LibHandle(); } RpnDLData::RpnDLData(string FullLibraryPath, int ObjectDebugTestLevel) { m_LibPath = NULL; m_LibHandle = NULL; m_Data = NULL; SetObjectMinimumDebugOrTestLevel(ObjectDebugTestLevel); m_LibPath = new string(FullLibraryPath); m_OpenLibrary(); m_FindRpnHubSymbol(); TestReportThisObject(); } RpnDLData::~RpnDLData() {
{ "domain": "codereview.stackexchange", "id": 18843, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, c++11, boost, portability, dynamic-loading", "url": null }
algorithms, optimization, sorting I am looking for an efficient algorithm to pick out a unique member for these equivalence classes for lookup in a cache table. Currently what I am doing is: Loop through all permutations of rows Loop through all permutations of colunms Permute digits so that this array is lexicographically minimum (the first digit is 0, the next un-mapped digit is 1 etc). And taking the minimum (again, lexicographically) of these. Obviously, one can improve on that by only considering as the first row any row that has the greatest multiplicity of characters. But I'm sure there is massive speedup to be had here. I am just not seeing a great way of finding it. Edit I want a function that is a many-to-one mapping of these 2D arrays to a representative of the equivalent class, i.e. all matrices that are equivalent are mapped to the same output. I want this operation to be quick, fewer operations is better.
{ "domain": "cs.stackexchange", "id": 21313, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "algorithms, optimization, sorting", "url": null }
algorithms, sorting Title: Bubble sort on an already sorted collection When I look at the following algorithm, I believe I understand how bubble sort works. procedure bubblesort for i := 1 to n − 1 for j := 1 to n − i if a[j] > a[j+1] then interchange a[j] and a[j+1] endif endfor endfor endprocedure However I am having a little tough time understanding statements like the following: The only significant advantage that bubble sort has over most other algorithms, even quicksort, but not insertion sort, is that the ability to detect that the list is sorted efficiently is built into the algorithm.
{ "domain": "cs.stackexchange", "id": 19023, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "algorithms, sorting", "url": null }
php, object-oriented, classes, type-safety, php7 Title: Address class in PHP 7.4 with types About this exercise I found out there is a form of strict types in PHP 7.4, so I freshened up my PHP coding with this simple Address class. I did not use PHP since forever. So, any and all answers and comments highly appreciated. (This question is an update on its deleted version; only users with reputation above 10k threshold can see deleted questions) I still do not know exactly how the exceptions are to be used. If I made some sort of error in this area, please excuse me, but this code is working on my webserver without much testing. Additional Note (EDIT): This class is culturally specific to the Czech Republic, where, just to clarify: Street and City have a minimum of 2 characters. All of the following must be integers: House number / Orientation number, and the Zip code. There can be no letters to the House number for example, nor in the other two.
{ "domain": "codereview.stackexchange", "id": 39773, "lm_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, object-oriented, classes, type-safety, php7", "url": null }
progression is $-12$, and the common difference is $3$ Free Arithmetic Sequences calculator - Find indices, sums and common difference step-by-step This website uses cookies to ensure you get the best experience. Copyrights 2020 © calculatored.com . . Tough Algebra Word Problems.If you can solve these problems with no help, you must be a genius! The calculator will generate all the work with detailed explanation. Numbers sequence, in which the diffference is always constant. Viewed 3k times 0. Viewed 3k times 0. + Addition Order of Operations Factors & Primes Fractions Long Arithmetic Decimals Exponents & Radicals Ratios & Proportions Percent Modulo Mean, Median & Mode Scientific Notation Arithmetics Algebra Equations Inequalities System of Equations System of Inequalities Basic Operations Algebraic Properties Partial Fractions Polynomials Rational Expressions Sequences Power Sums Induction Logical Sets Change the sign of each number that follows so that positive becomes negative, and
{ "domain": "suisco.net", "id": null, "lm_label": "1. Yes\n2. Yes\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9888419697383903, "lm_q1q2_score": 0.8693372337976529, "lm_q2_score": 0.8791467801752451, "openwebmath_perplexity": 623.5942476320388, "openwebmath_score": 0.7360583543777466, "tags": null, "url": "http://suisco.net/awstats/blog/page.php?page=arithmetic-expression-calculator-2f178e" }
quantum-mechanics, quantum-information, quantum-interpretations external measurer.) Most particularly, in the PBR setup we have the systems $a$ and $b$, individual measurers $m_a$ and $m_b$, and joint measurer $m_j$. Then the pairs $(m_a, a)$, $(m_b, b)$, $(m_j, a \otimes b)$ could (and will!) all have different states, too. But also note that Rovelli doesn't say $\Lambda$ is distinct from the Hilbert space $H$ of any of the systems - they could, in fact, be one and the same.
{ "domain": "physics.stackexchange", "id": 91231, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, quantum-information, quantum-interpretations", "url": null }
domain-theory $L$ is lower and rounded: $p \in L \iff \exists q \in L \,.\, p < q$. $U$ is upper and rounded: $q \in U \iff \exists p \in U \,.\, p < q$. $L$ and $U$ are disjoint.
{ "domain": "cstheory.stackexchange", "id": 5315, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "domain-theory", "url": null }
discrete-signals, fourier-series, square and for the discrete difference will look like It's quite straightforward to express the Fourier coefficients of a shifted version of a function in terms of the Fourier coefficients of the original function. If the Fourier series of a $T$-periodic function $f(t)$ is given by $$f(t)=\sum_{k=-\infty}^{\infty}c_ke^{j2\pi kt/T}\tag{1}$$ then it follows that the Fourier series of a shifted version must be $$\begin{align}f(t-t_0)&=\sum_{k=-\infty}^{\infty}c_ke^{j2\pi k(t-t_0)/T}\\&=\sum_{k=-\infty}^{\infty}c_ke^{-j2\pi kt_0/T}e^{j2\pi kt/T}\\&=\sum_{k=-\infty}^{\infty}\tilde{c}_ke^{j2\pi kt/T}\tag{2}\end{align}$$ Hence, the Fourier coefficients of $f(t-t_0)$ are given by $$\tilde{c}_k=c_ke^{-j2\pi kt_0/T}\tag{3}$$ And, by linearity, the Fourier series coefficients of $g(t)=f(t)-f(t-t_0)$ are $$d_k=c_k-\tilde{c}_k=c_k\big(1-e^{-j2\pi kt_0/T}\big)\tag{4}$$
{ "domain": "dsp.stackexchange", "id": 9677, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "discrete-signals, fourier-series, square", "url": null }
terminology Title: Perpendicular to direction of oscillation, 2D sine wave Is there a word to describe "Contour" works for left but not right. "Phase contour"? Context, above right is real part of a 2D separable Morlet (let's say, left windowed by Gaussian), called "spin down" as its direction of oscillation is down (with increasing x), but it happens to maximize chirp up in wavelet transform, so we get "down resonates with up". So something like "contour up maximizes chirp up". Have you considered borrowing the terminology used for water surface waves of crest and/or trough? Image from Wikipedia
{ "domain": "dsp.stackexchange", "id": 11061, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "terminology", "url": null }
c#, repository public override string ToString() { return string.Format("{0}-{1}", SessionId, Key); } public override int GetHashCode() { int hash = 13; hash = (hash * 7) + SessionId.GetHashCode(); hash = (hash * 7) + Key.GetHashCode(); return hash; } } } Your implementation of the CookieRepository<T> is well written, easy to read and has good documentation, but it still can be beautyfied. Style comments variables should be named using camelCase casing so the Cookies variable should be cookies. This should be done for method variables too. See the C# naming guidelines. method parameters should be named using camelCase casing too. IMHO braces {} should always be used and it won't hurt if you use them also where you put the execution statement on the same line like in the Equals() method.
{ "domain": "codereview.stackexchange", "id": 15097, "lm_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#, repository", "url": null }
c#, performance, file-system, mvvm, xaml GameRouletteView.xaml (again, associated .cs file is basically empty, so no point sharing): <UserControl x:Class="GameRoulette.Views.GameRouletteView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:GameRoulette.Views" xmlns:prism="using:Prism.Windows.Mvvm" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400" prism:ViewModelLocator.AutoWireViewModel="True"> <Grid Background="White"> <Button x:Name="btnSelectGames" Content="Click here to select your games" HorizontalAlignment="Left" Margin="110,50,0,0" VerticalAlignment="Top" Height="40" Width="240" Command="{Binding SelectCommand}"/> <Button x:Name="btnChooseGame" Content="{Binding ChooseGameText}"
{ "domain": "codereview.stackexchange", "id": 18520, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, performance, file-system, mvvm, xaml", "url": null }
computability, real-numbers, computable-analysis Supplemental: There was also a question about whether Rice's theorem is related to connectedness of the reals. Yes, it is essentially the statement that the reals are connected. Let us first observe that a continuous map $p : X \to \{0,1\}$ (we take the discrete topology on $\{0,1\}$) corresponds to a pair of disjoint clopen (closed and open) sets $U, V \subseteq X$ such that $U \cup V = X$. Indeed, take $U = p^{-1}(\{0\})$ and $V = p^{-1}(\{1\})$. Because $p$ is continuous and $\{0\}$ and $\{1\}$ are open, $U$ and $V$ will be open, disjoint, and they obviously cover all of $X$. Conversely, any pair $(U,V)$ of disjoint clopens that cover $X$ determines a continuous map $p : X \to \{0,1\}$ that maps elements of $U$ to $0$ and elements of $V$ to $1$.
{ "domain": "cs.stackexchange", "id": 9691, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "computability, real-numbers, computable-analysis", "url": null }
python, python-3.x, battleship # Players will alternate turns. def player_turns(): if total_turns % 2 == 0: return player_two else: return player_one # Allows new game to start def play_again(): answer = str(input("Would you like to play again?")) if answer == "yes" or answer == "y": total_turns = 0 ship_points = load_game(game_board) else: print("Thanks for playing!") exit() # What will be done with players guesses def input_check(ship_row, ship_col, player, board): guess_col = 0 guess_row = 0 while True: try: guess_row = int(input("Guess Row:")) - 1 guess_col = int(input("Guess Col:")) - 1 except ValueError: print("Enter a number only.") continue else: break match = guess_row == ship_row - 1 and guess_col == ship_col - 1 not_on_game_board = (guess_row < 0 or guess_row > 4) or (guess_col < 0 or guess_col > 4)
{ "domain": "codereview.stackexchange", "id": 28119, "lm_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, battleship", "url": null }
performance, c, formatting, timer, time void cleanup() { paused = 1; endchar = '\n'; clear_output(); print_time(stdout); SHOW_CURSOR; set_raw_mode(0); if (sflag) { save_time(); } } void sigint_handler(int sig) { cleanup(); exit(sig); }
{ "domain": "codereview.stackexchange", "id": 45537, "lm_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, formatting, timer, time", "url": null }
c++, performance, image, fractals, openmp std::vector<std::string> optionValues(const std::string& option, int n) const { static const std::vector<std::string> not_found{}; auto it = std::find(tokens.begin(), tokens.end(), option); if (std::distance(it, tokens.end()) <= n) return not_found; std::vector<std::string> results; results.reserve(n); while (n--) results.push_back(*++it); return results; } bool contains(const std::string& option) const { return std::find(tokens.begin(), tokens.end(), option) != tokens.end(); } };
{ "domain": "codereview.stackexchange", "id": 29535, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, performance, image, fractals, openmp", "url": null }
turtlebot, turtlebot3 Originally posted by juergen on ROS Answers with karma: 1 on 2018-01-08 Post score: 0 hi, connect your micro hdmi when u startup joule you press the f7 button to startup from usb to install ubuntu Originally posted by bajramg with karma: 16 on 2018-01-11 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 29683, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "turtlebot, turtlebot3", "url": null }
is always useful to receive feedback and helps make this free resource even more useful for those learning Mathematics anywhere in the world. Her Wikipedia entry confirms that her success rate is 85%. Question Topic Video number 1 Scatter Graphs 165, 166 2 Standard Form 300, 301, 302, 303 3 Use of a Calculator 352 4 Constructions 72, 78, 79, 80, 70 The following table shows the probabilities of winning certain prizes at a stall in Faulton Towers theme park. The probability that she takes a green crayon is $$\frac16$$. (b) Create an equation to represent this information. and 5-a-day. and trainers on the other. Write down the probability that it has the letter R printed on it. They think "In our two classes there are 53 students, 12 of whom have a pet dog. The probability that a prize is something to eat is 0.3, The probability that a prize is worth more than $10 is 0.2, The probability that a prize is something to eat or worth more than$10 is 0.4. A box contains only green and yellow
{ "domain": "unknownfieldsdivision.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9748211590308922, "lm_q1q2_score": 0.8080670878337975, "lm_q2_score": 0.828938806208442, "openwebmath_perplexity": 2023.4915167313359, "openwebmath_score": 0.42520537972450256, "tags": null, "url": "http://unknownfieldsdivision.com/the-honey-wduusk/rat-a-tat-tat-meme-58ab94" }
javascript, dom, audio container.appendChild(controls); } You may consider to make the elements building process more generic. Not sure it ends up with very much less code, but IMO it becomes clearer. I imagined a solution, and applied it on a part of your code, as an example: function makeControls(audioanalyser, container) { var $ = {}, // will contain the set of controls once built elements = { link: { tag: 'link', attrs: {'type': 'text/css', 'rel': 'stylesheet'}, bind: {'load': linkLoad}, parent: document.head }, controls: { tag: 'div', attrs: {'style': settings.controls}, classes: ['audio'], parent: container }, back: { tag: 'div', bind: {'click': backClick}, classes: ['back', 'icon-step-backward'], parent: 'controls' },
{ "domain": "codereview.stackexchange", "id": 14330, "lm_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, dom, audio", "url": null }
java, programming-challenge Am I missing any corner cases? Am I over-specifying my cases (for example, the BothAlphabeticalAndReverseAlphabetical case)? Is this the most efficient way of implementing a solution? Is there a better implementation technique (particularly when it comes to my if statements, which I'm not in love with). I think that your solution is overengineered. I don't think that there is much reason to define a StringCharactersInAlphabeticalOrderEvaluator interface, containing one evaluateAlphabeticalOrderOfCharacters(String) method. Do you plan to write an implementation other than StringCharactersInAlphabeticalOrderEvaluatorImpl? Is there even any reason to have an object at all?
{ "domain": "codereview.stackexchange", "id": 18313, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, programming-challenge", "url": null }
fourier-transform, wavelet, cwt Recall when I said it's not just about energy? Consider what happens if the normalization is anything other than $a^{-2}$. To arrive at $(4)$, we relied on $a^1$ in denominator in $(3b)$, else there is no cancellation with $C_\psi$, so no reconstruction. Thus, one can conclude that $a^{-2}$ is set in retrospect - i.e. "what do we make it to cancel $C_\psi$". Note that we can't go the other way, i.e. redefine $C_\psi$ such that $a^{-2}$ is no longer needed - at least not entirely; per above derivation, it's clear that $\psi$ must somehow drop, thus $C_\psi$ must include it. The usage of exactly $C_\psi$ might be convention-based, since $C_\psi$'s applicability spans much outside the iCWT as the fundamentally defining criterion of wavelets (Farge, 1992). So how to invert L1-normed CWT? Obvious from above. Notes:
{ "domain": "dsp.stackexchange", "id": 9482, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "fourier-transform, wavelet, cwt", "url": null }
javascript, angular.js $scope.updateSource = function() { $scope.from.amount = $scope.convert( $scope.to.selectedcurrency.currency, $scope.from.selectedcurrency.currency, $scope.to.amount) if($scope.from.amount == 0) $scope.from.amount = ''; } $scope.from = { selectedcurrency : $scope.currencies[0] }; $scope.to = { selectedcurrency : $scope.currencies[1] }; $scope.$watch( 'from.amount', function(newValue, oldValue) { if($scope.direction == 0) $scope.updateTarget(); } ); $scope.$watch( function() { return $scope.from.selectedcurrency.currency; }, function(newValue, oldValue) { if($scope.direction == 0) $scope.updateTarget(); } );
{ "domain": "codereview.stackexchange", "id": 18331, "lm_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, angular.js", "url": null }
java, palindrome Making things faster if(sub.equals(reverseString(sub))&&sub.length()>=3) can be rewritten if(sub.length()>=3 && sub.equals(reverseString(sub))) to avoid going through list construction if we don't need to. Actually, this is not so much of an issue because we can make the check for palindromes more efficient : reusing this answer, one can define a check for palindromness that doesn't need to build a string and stops as soon as the string is indeed not a palindrom. With my examples, instead of going through 2420363 iterations in reverseString(), we now perform 31423 iterations in isPalindrome. Now, for a more dramatic improvement we have to focus on what we really want to achieve, what we are really looking for : we don't care that much about populating a list of palindromes, we only care about the biggest one. What does this imply ? It implies that we can ignore whatever is smaller than what we have already found. At this stage, the code looks like this : public class LargestPalindrome{
{ "domain": "codereview.stackexchange", "id": 6888, "lm_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, palindrome", "url": null }
# Paper on compressed sensing and genomics New paper on the arXiv. The next step after the completion of the Human Genome Project, was the search for genes associated with diseases such as autism or diabetes. However, after spending hundreds of millions of dollars, we find that there are very few common variants of genes with large effects. This doesn’t mean that there aren’t genes with large effect. The growth hormone gene definitely has a large effect on height. It just means that variations of genes that are common among people have small effects on the phenotype. Given the results of Fisher, Wright, Haldane and colleagues, this was probably expected as the most likely scenario and recent results measuring narrow-sense heritability directly from genetic markers (e.g. see this) confirms this view.
{ "domain": "wordpress.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9820137916170774, "lm_q1q2_score": 0.8118423876625699, "lm_q2_score": 0.8267117983401363, "openwebmath_perplexity": 534.3191859509956, "openwebmath_score": 0.7642651200294495, "tags": null, "url": "https://sciencehouse.wordpress.com/category/statistics/" }
quantum-mechanics, quantum-information, quantum-interpretations, wavefunction-collapse, bells-inequality $$ \rho = \frac{1}{2} \left( \begin{array}{ccc} 0 & 0 & 0 & 0 \\ 0 & 1 & 1 & 0 \\ 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 0 \\ \end{array} \right), $$ whereas the state of the system after measurement by the central person would become $$ \rho_m = \frac{1}{2} \left( \begin{array}{ccc} 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 \\ \end{array} \right), $$ which is not a pure state and is distinguishable from the previous state.
{ "domain": "physics.stackexchange", "id": 11521, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, quantum-information, quantum-interpretations, wavefunction-collapse, bells-inequality", "url": null }
phase-space, chaos-theory, topological-phase The dimension of the original phase-space of the system, out of which a 1D timeseries was recorded. This dimension is equal to the number of independent variables of the system. The dimension of the reconstruction. This integer number is defined by the user. The dimension of the attractor (IF IT EXISTS!) that the original system ends up on. For example, it is known that the Lorenz system is 3 dimensional, and for some specific parameter values, states are converging to an (almost -)2-Dimensional attractor. By carefully doing a reconstruction of some dimension R, you can estimate the attractor dimension (something different from the reconstruction dimension). You question: QUESTION: In general, the volume of an object is given by $\pi r^d$. What would be phase space or state space volume? Would the power over the radius, r beL or d?
{ "domain": "physics.stackexchange", "id": 43567, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "phase-space, chaos-theory, topological-phase", "url": null }
classification, multilabel-classification, metric Title: Recall score for each sample in multilabel classification Does it make sense to calculate the recall for each sample in a multilabel classification problem? Suppose I have 3 data samples, each having its own true set of labels and predicted set of labels. I want to see the match between the true set of labels and the predicted set of labels. I do not care for the true negatives or false positives in each prediction, so this translates to recall score for me. Programmatically, I would do an AND operation between y_predicted and y_true to get the number of true positives and divide it by the total number of true labels for each sample. (in other words, true positives/(true positives+false negatives)) My question is - Is calculating recall per sample (not per label), usually done? Is my thought process correct?
{ "domain": "datascience.stackexchange", "id": 6983, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "classification, multilabel-classification, metric", "url": null }
cosmology, spacetime, entropy, time, relativity Title: The relationship between time, relativity and entropy I came across a discussion about the nature of time and whether or not time is an illusion on a physics forum. I'm not so much interested in the philosophical issues regarding time, but the following, which is more related to physics, is something that confuses me: Is our world a three dimensional world that keeps changing or is it a four dimensional world that remains static? Relativity seems to say that the world is actually a four dimensional static object, because it is difficult to imagine how the world could be a three dimensional changing world in a spacetime where simultaneity is relative.
{ "domain": "physics.stackexchange", "id": 58189, "lm_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, spacetime, entropy, time, relativity", "url": null }
whether is diagonalizable if it is similar to itself be orthonormal if its columns are vectors. 'S breakthrough technology & knowledgebase, relied on by millions of students & professionals R! Edited: Bruno Luong on 1 Nov 2018 Accepted Answer: Stephan to get the best.! Its columns are mutually orthogonal spanned by the vector ( 1 ; 0 ) given matrix and many... 1 Nov 2018 Accepted Answer: Stephan using Wolfram 's breakthrough technology & knowledgebase, relied by... }$, C 100 020 003 D i − 1 3 by using this website uses cookies ensure! In very simple ways as tools for learning more about real matrices matrix... By a Unitary simi-larity transformation if and only if they commute matrix calculator Solving systems of linear,. Reduced using diagonalization 003 D i − 1 3 then find the real orthogonal matrix that diagonalizes a breakthrough &! Arbitrary square matrices bit longer 100 020 003 D i − 1 3 cookies to ensure you get best... Definition 5.3.1 a matrix, the one with numbers,
{ "domain": "forret.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.966914017797636, "lm_q1q2_score": 0.8218490389552596, "lm_q2_score": 0.8499711699569787, "openwebmath_perplexity": 675.622314942376, "openwebmath_score": 0.807680070400238, "tags": null, "url": "https://web.forret.com/ruv2b6uq/67b03a-matrix-diagonalization-calculator" }
sql, vba, vb6, adodb If ConnectionErrors.Count > 0 Then If Not this.HasADOError Then PopulateADOErrorObject ConnectionErrors Dim ADOError As ADODB.Error Set ADOError = GetError(ConnectionErrors, ConnectionErrors.Count - 1) 'Note: 0 based collection Err.Raise ADOError.Number, ADOError.Source, ADOError.Description, ADOError.HelpFile, ADOError.HelpContext End If End Sub
{ "domain": "codereview.stackexchange", "id": 35962, "lm_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, vba, vb6, adodb", "url": null }
$$t = \frac{n}{4000}$$ $$n = 4000 t$$ \begin{aligned} x(t) &= 2 \cos\left( \frac{3\pi}{4} 4000t +\frac{\pi}{4} \right) \\ &= 2 \cos\left( 3000 \pi t +\frac{\pi}{4} \right) \\ &= 2 \cos\left( 1500 \cdot 2 \pi t +\frac{\pi}{4} \right) \\ \end{aligned} Alternatively: \begin{aligned} x[n] &= \frac{5.657}{4} \sqrt{2} \left[ \frac{1}{\sqrt{2}} \cos \left( \frac{3\pi}{4} n \right) - \frac{1}{\sqrt{2}} \sin \left( \frac{3\pi}{4} n \right) \right] \\ &\approx 2 \left[ \sin\left( \frac{\pi}{4} \right) \cos \left( \frac{3\pi}{4} n \right) - \cos\left( \frac{\pi}{4} \right) \sin \left( \frac{3\pi}{4} n \right) \right] \\ &= 2 \sin\left( \frac{\pi}{4} - \frac{3\pi}{4} n \right) \\ &= -2 \sin\left( \frac{3\pi}{4} n - \frac{\pi}{4} \right) \\ &= 2 \sin\left( \frac{3\pi}{4} n - \frac{\pi}{4} + \pi \right) \\ &= 2 \sin\left( \frac{3\pi}{4} n + \frac{3\pi}{4} \right) \\ \end{aligned} Thanks for the check mark. Here is a little more since this is such an important topic.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9728307653134904, "lm_q1q2_score": 0.8127840828295712, "lm_q2_score": 0.8354835309589074, "openwebmath_perplexity": 826.9173069635189, "openwebmath_score": 0.9992575645446777, "tags": null, "url": "https://dsp.stackexchange.com/questions/62545/finding-the-time-domain-equation-corresponding-to-a-given-dft/62550" }
The equations imply $$h_1(x)-h_2(x) \text{ is constant}$$ $$F_1^{-1}(G_1(x))-F_2^{-1}(G_1(x)) \text{ is constant}$$ $$h(x)-h_1(x) \text{ is constant}$$ $$h(x)-h_2(x) \text{ is constant}$$ Getting a (big) hint from a professor I was able to solve the equation:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9863631651194374, "lm_q1q2_score": 0.8041153007193677, "lm_q2_score": 0.8152324915965392, "openwebmath_perplexity": 120.61495295248916, "openwebmath_score": 0.9719048738479614, "tags": null, "url": "https://math.stackexchange.com/questions/3664810/solving-a-functional-equation-in-cdfs-of-probability-distributions" }
audio, octave Title: Why did my sine wave turn into a square wave when written to a WAV file in Octave? I am trying to use Octave to generate a pure sine wave. The code for the same is as follows: x = 10.*sin(2*pi*(300/16000)*(0:1:400)); The sampling rate is 16000Hz, the sine wave is at 300 Hz. I write the above wave to a file using wavwrite like so: wavwrite(x, 16000, 16, "temp.wav") When I try to read it back into a variable, like so: y = wavread('temp.wav');, I get square waves upon plotting y. I have checked the sine wave and the period indicates a frequency of 300Hz.
{ "domain": "dsp.stackexchange", "id": 57, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "audio, octave", "url": null }
Fibonacci sequences", where these restrictions and/or the recursion are changed. You can discover more about the geometric series below the tool. 2, 4, 8 16 2n The sequence whose nth term is common ratio between consecutive terms is —A. Find the 6th term of a geometric sequence with initial term $$10$$, and $$r = 1/2$$. When given a list, such as$1, 3, 9, 27, 81, \ldots$we can try to look for a pattern in a few ways. 1 6, 3 ar==. For example, if a n = n +1 n2 +3,. ( ) ( ) r a r r ar S. When writing the general expression for a geometric sequence, you will not actually find a value for this. r is known as the common ratio of the sequence. Set up the form View the solution. The second term of a geometric series is and the sixth term is. So let's consider a couple examples. Math Tutor Math Teacher Teaching Math Maths Sequence And Series Math Worksheets Math Activities Algebra 1 Arithmetic. The constant d is called common difference. Example-Problem Pair. Sequences - using/finding nth term
{ "domain": "ecui.pw", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9920620051945144, "lm_q1q2_score": 0.8087611825397049, "lm_q2_score": 0.8152324938410784, "openwebmath_perplexity": 242.81990625846828, "openwebmath_score": 0.7629408240318298, "tags": null, "url": "http://vvnn.ecui.pw/finding-the-nth-term-of-a-geometric-sequence-examples.html" }
machine-learning, deep-learning Title: Training Deep Nets on an Ordinary Laptop Would it be possible for a an amateur who is interested in getting some "hands-on" experience in desining and training deep neural networks, to use an ordinary laptop for that purpose (no GPU), or is it hopeless to get good results in reasonable time without a powerful computer/cluster/GPU? To be more specific, the laptop's CPU is an Intel Core i7 5500U fith generation, with 8GB RAM. Now, since I haven't specified what problems I would like to work on, I'll frame my questions in a different way: which deep architectures would you recommend that I try to implement with my hardware, such that the following goal is achieved: Acquiring intuition and knowledge about how and when to use techniques that were introduced in the past 10 years and were essential to the uprising of deep nets (such as understanding of initialisations, drop-out, rmsprop, just to name a few).
{ "domain": "datascience.stackexchange", "id": 809, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "machine-learning, deep-learning", "url": null }
ros ^ /usr/local/Cellar/qt5/5.7.0/include/QtCore/qbasicatomic.h:102:51: error: use of undeclared identifier 'Ops' T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); } ^ /usr/local/Cellar/qt5/5.7.0/include/QtCore/qbasicatomic.h:102:68: error: use of undeclared identifier '_q_value' T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); } ^ /usr/local/Cellar/qt5/5.7.0/include/QtCore/qbasicatomic.h:103:52: error: use of undeclared identifier 'Ops' void storeRelease(T newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); } ^ /usr/local/Cellar/qt5/5.7.0/include/QtCore/qbasicatomic.h:103:70: error: use of undeclared identifier '_q_value'
{ "domain": "robotics.stackexchange", "id": 26485, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros", "url": null }
quantum-mechanics, soft-question, quantum-interpretations b) It might help our understanding of "reality". This is only interesting, if you believe that your theory describes reality. If you believe that we only ever create effective models that are limited to a certain domain of our variables, then interpretations become uninteresting. Your model isn't the real deal after all, so why bother with something, you can't measure? It doesn't enhance our knowledge. So, if you don't believe that science should (or even can) provide ontologic theories and if you don't think a better theory than quantum mechanics is maybe just beyond the horizon, then you don't care about interpretations of quantum mechanics. Otherwise, you should.
{ "domain": "physics.stackexchange", "id": 56635, "lm_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, soft-question, quantum-interpretations", "url": null }
relativity, wave-particle-duality Title: Is the de Broglie formula normalized for relativity? The de Broglie formula is normally given as: $\lambda=h/mv$. Does this hold for velocity near the speed of light? In this case would you use the rest mass or relativistic mass? The de Broglie wavelenght comes from assuming massive particles have the same relations as the photon: $$ E=\frac{hc}{\lambda}=pc, $$ so that $$ \lambda_B =\frac{h}{p}=\frac{h}{\gamma mv}=\frac{h}{mv}\sqrt{1-\frac{v^2}{c^2}}, $$ which reduces to the usual $\frac{h}{mv}$ in the non-relativistic limit ($c\to\infty$).
{ "domain": "physics.stackexchange", "id": 62640, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "relativity, wave-particle-duality", "url": null }
electromagnetism, condensed-matter Title: Free spin (Curie) Paramagnetism I'm working through a derivation for Curie paramagnetism and hope someone could help clarify a couple of steps. The way that makes sense to me (although now I have seen the wikipedia derivation below I realise this way is pretty long) is to not take any high temperature approximations until near the end of the derivation where I have: $M=g_J\mu_B[(J+1/2)coth[g_J\mu_B\beta(J+1/2)]-\frac{1}{2}coth(g_J\mu_B\beta/2)]$ now to get to the curie susceptibility it seems that when taking the high T limit of the above expression the leading $\frac{1}{x}$ term of the coth expansion is ignored and the second $\frac{1}{3}x$ term is considered (this pops out the correct answer $\chi_{curie}=\frac{n(g_J\mu_B)^2}{3}\frac{J(J+1)}{k_BT}$). I can't find or think or any sensible reason for this apart from when we take the limit of zero B the infinity is just a constant which has no temperature dependence (which is what we're interested in) so we happily ignore it.
{ "domain": "physics.stackexchange", "id": 7775, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electromagnetism, condensed-matter", "url": null }
• I think OP's goal is to "use this combinatorial method", as opposed to "prove this recurrence relation property", though his new comment suggests it doesn't matter. @CopyPasteIt, can you clarify? Nov 13, 2019 at 16:01 • @CalvinLin This is the type of answer I wanted to see. For some reason, when I see these type of problems, I can't find a 'theory handle' and just 'turn the crank'. This looks like the way to go, replacing two recursions with one 'matrix recursion' (+1). Nov 13, 2019 at 16:05 • If so, one approach is take is to calculate initial terms of the sequence, and then try to guess what the pattern is. Eg. I obtained OEIS A052582, which has the formula $2n\times n!$ (with some offsets). Nov 13, 2019 at 16:06 • @CopyPasteIt If you can prove the conjecture above, you're done. Feel free to ask why I conjectured this. Nov 13, 2019 at 16:14
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9732407160384083, "lm_q1q2_score": 0.8384840638411093, "lm_q2_score": 0.8615382094310357, "openwebmath_perplexity": 296.7056135372752, "openwebmath_score": 0.8746145963668823, "tags": null, "url": "https://math.stackexchange.com/questions/3434096/finding-the-closed-formula-for-a-n-b-n-for-recursions-a-n-and-b-n/3434904#3434904" }
php, laravel } catch(EmailException $ee) { } } EmailConfiguration public function __construct($emailSettings) { try { /* I don't like the mixed behavior of this call to areSettingsValid(). If passing validation, you get boolean true, if failing you get exception. Since exception is thrown from this method anyway, there is no reason to return true. The code could be simplified to: $this->areSettingsValid($emailSettings); $this->host = ... continue code No need for 'if' here at all.
{ "domain": "codereview.stackexchange", "id": 21001, "lm_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, laravel", "url": null }
slam, navigation, husky, slam-gmapping, gmapping First, I suggest ensuring that the LIDARS are accurately centered on both the robot and in the URDF. While the URDF showed our LIDARS were centered, they were slightly off on the actually robot. Due to how we affixed the LIDARS to the robot, it was easier for use to fine-tune the placement of the LIDARS sensors in the URDF. The LaserScan data from each LIDAR was shown in RVIZ, each in a different color. We performed multiple iterations of placing an object at different distances and slightly modifying each LIDARS position in the URDF until they agreed as to the placement of the object. However, this could easily be done the other way around, slightly adjusting the placement of the LIDAR sensor on the robot until they agree. This was successful in removing most of the false data. So, depending on your application this may be the optimal solution. In addition, I suggest using many of the filters in laser_filter to filter the raw LaserScan data to ensure your are giving quality data to
{ "domain": "robotics.stackexchange", "id": 21997, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "slam, navigation, husky, slam-gmapping, gmapping", "url": null }
ros, installation, eigen, compilation Title: howto: Eigen Installation All, This is just a brief how to on how to resolve Eigen compile time errors - which wasn't installed on my Raspberry Pi. I kept getting the error: CMake Error at CMakeLists.txt:12 (find_package): By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Eigen3", but CMake did not find one. Could not find a package configuration file provided by "Eigen3" with any of the following names: Eigen3Config.cmake eigen3-config.cmake Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set "Eigen3_DIR" to a directory containing one of the above files. If "Eigen3" provides a separate development package or SDK, be sure it has been installed. And try as I might I couldn't find a conclusive answer. Anyway these steps should solve the issue Download Eigen hg clone https://bitbucket.org/eigen/eigen/ CD into the download dir cd eigen
{ "domain": "robotics.stackexchange", "id": 26852, "lm_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, installation, eigen, compilation", "url": null }
The first fact concerns the exponential map ${\exp: {\mathfrak g} \rightarrow G}$ from a Lie algebra ${{\mathfrak g}}$ of a Lie group ${G}$ to that group. (For this discussion we will only consider finite-dimensional Lie groups and Lie algebras over the reals ${{\bf R}}$.) A basic fact in the subject is that the exponential map is locally a homeomorphism: there is a neighbourhood of the origin in ${{\mathfrak g}}$ that is mapped homeomorphically by the exponential map to a neighbourhood of the identity in ${G}$. This local homeomorphism property is the foundation of an important dictionary between Lie groups and Lie algebras. It is natural to ask whether the exponential map is globally a homeomorphism, and not just locally: in particular, whether the exponential map remains both injective and surjective. For instance, this is the case for connected, simply connected, nilpotent Lie groups (as can be seen from the Baker-Campbell-Hausdorff formula.)
{ "domain": "wordpress.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9898303422461273, "lm_q1q2_score": 0.8160774286195914, "lm_q2_score": 0.8244619242200082, "openwebmath_perplexity": 145.8741805940518, "openwebmath_score": 0.9032233953475952, "tags": null, "url": "https://terrytao.wordpress.com/tag/algebraic-groups/" }
# Is $X_{(1)} + X_{(n)}$ a good estimator for $\theta$? Problem 8.7 From Van der Vaart's Asymptotic Statistics: Given a sample of size $n$ from the uniform distribution on $[0,\theta]$, the maximum $X_{(n)}$ of the observations is biased downwards. Because $\text{E}[\theta-X_{(n)}] = \text{E}[X_{(1)}]$, the bias can be removed by adding the minimum of the observations. Is $X_{(1)} + X_{(n)}$ a good estimator for $\theta$ from an asymptotic point of view? MY ATTEMPT:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9759464450067471, "lm_q1q2_score": 0.8089998748608184, "lm_q2_score": 0.8289387998695209, "openwebmath_perplexity": 325.8840704881652, "openwebmath_score": 0.8753219246864319, "tags": null, "url": "https://stats.stackexchange.com/questions/127428/is-x-1-x-n-a-good-estimator-for-theta" }
homework-and-exercises, electric-circuits, electric-current, electrical-resistance In other words, it doesn't matter which terminal you choose to place the red (positive) probe on, you will measure the correct voltage across regardless. Now, for your KVL equations, say that you choose to label the left-most terminal as positive. If you calculate a positive voltage across $R_3$, then you now know that the left-most terminal is the more positive terminal. What do you think you would calculate if you had chosen to label the right-most terminal positive? Just as with swapping leads of the voltmeter, you'll now calculate a negative voltage across which tells you, again, that the left-most terminal is the more positive terminal. In other words, it doesn't matter which terminal you choose to label positive, your calculation will identify the more positive terminal regardless.
{ "domain": "physics.stackexchange", "id": 52770, "lm_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, electric-circuits, electric-current, electrical-resistance", "url": null }
javascript, jquery window.onload = function() { document.getElementById("ToggleTxTDrop").addEventListener( 'click' , changeClass ); } /* lets remove the previous classes when on focus */ $('#message').on('focus', function(){ $(this).removeClass('dropzone-wrap'); $(this).parent().removeClass('dropzone-content'); }) Here's a step-by-step conversion from your code to the JS-only code of youmightnotneedjquery.com. function changeClass() { document.getElementById("message").className += " dropzone-wrap"; document.getElementById("dragNdrop").className += " dropzone-content"; }
{ "domain": "codereview.stackexchange", "id": 14080, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, jquery", "url": null }
circuit-construction, ibm-q-experience, hadamard EDIT 2: here is a code in QASM of the circuit above: OPENQASM 2.0; include "qelib1.inc"; qreg q[3]; creg c[3]; ry(0.927) q[0]; ry(pi/4) q[1]; cx q[0],q[1]; ry(pi/4) q[1]; cx q[0],q[1]; ry(pi/2) q[2]; cx q[1],q[2]; ry(-pi/4) q[2]; cx q[0],q[2]; ry(pi/4) q[2]; cx q[1],q[2]; cx q[0],q[2]; measure q[0] -> c[2]; measure q[1] -> c[1]; measure q[2] -> c[0];
{ "domain": "quantumcomputing.stackexchange", "id": 1285, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "circuit-construction, ibm-q-experience, hadamard", "url": null }
classical-mechanics, momentum, relative-motion You're suggesting that it's acceptable to compare the velocity of the man after he jumps to the velocity of the buggy before he jumps, but that doesn't represent one single point in time. At the moment the man has relative forward velocity, the buggy has relative backward velocity. There is no time at which the man is moving forward where the buggy is still moving at $v_0$.
{ "domain": "physics.stackexchange", "id": 96509, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "classical-mechanics, momentum, relative-motion", "url": null }
python, python-2.x, csv, gui, tkinter Title: Refactoring Tkinter GUI that reads from and updates csv files, and opens E-Run files Background My lab administers four computer programs in three separate appointments. At each appointment, the subject does the programs in a pseudo-randomized order. Also, three of the programs have subversions, which are also pseudo-randomized so that the subject could do type A of program 1 at the first appointment, type C of program 1 at followup 1, and type B of program 1 at followup 2. The orders and individual program subversions that subjects have run in the past are stored in csv files (one file for each program, and one file for overall program order). The appropriate pseudo-randomized order for each timepoint is stored as a list of lists in a pickle file. Code Purpose
{ "domain": "codereview.stackexchange", "id": 8103, "lm_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-2.x, csv, gui, tkinter", "url": null }
matlab, filters, infinite-impulse-response, c, biquad $$b_0\frac{1+\frac{b_1}{b_0}+\frac{b_2}{b_0}}{1+a_1+a_2}=1\tag{2}$$ Similarly, for a high pass filter a common scaling makes sure that the frequency response equals $1$ at Nyquist, which implies $$b_0\frac{1-\frac{b_1}{b_0}+\frac{b_2}{b_0}}{1-a_1+a_2}=1\tag{3}$$ You can come up with similar guesses for the intended scaling for other standard filter types, like band pass filters (unity gain at the center frequency) and band stop filters (unity gain at DC and/or Nyquist).
{ "domain": "dsp.stackexchange", "id": 8967, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "matlab, filters, infinite-impulse-response, c, biquad", "url": null }
c++, c++11, lambda, opengl, qt #include <QOpenGLWidget> #include <functional> /** * @brief The OpenGLWidget class */ class OpenGLWidget : public QOpenGLWidget { Q_OBJECT public: explicit OpenGLWidget(QWidget* parent = 0) : QOpenGLWidget(parent) , _isInitialized(false) {} protected: virtual void initializeGL() override { for (auto& initFunc : _initFuncs) initFunc(); _initFuncs.clear(); _isInitialized = true; } void delayForInit(std::function<void()> func) { if (_isInitialized) { makeCurrent(); func(); doneCurrent(); } else _initFuncs.push_back(func); } private: bool _isInitialized; std::vector<std::function<void()>> _initFuncs; }; #endif // OPENGLWIDGET_H
{ "domain": "codereview.stackexchange", "id": 27715, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, c++11, lambda, opengl, qt", "url": null }
strings, formatting, clojure I will start with the area-code. This function could be improved with ->> (thread-last macro) and clojure.string/join like this: (defn area-code [num-string] (->> (number num-string) (take 3) s/join)) But you can also use subs: (defn area-code [num-string] (subs (number num-string) 0 3)) Next, pretty-print. You can use format here: (defn pretty-print [num-string] (let [validated (number num-string)] (format "(%s) %s-%s" (area-code validated) (subs validated 3 6) (subs validated 6)))) Next, digit-not-one-or-zero. You usually create a set with these elements and call it on your argument, something like: (defn digit-not-one-or-zero [digit] (not (#{\0 \1} digit))) Or even shorter: (def digit-not-one-or-zero (complement #{\0 \1}))
{ "domain": "codereview.stackexchange", "id": 44172, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "strings, formatting, clojure", "url": null }
motor, design, torque, brushless-motor, gearing For example, if we assume 2.5 kg (about 5.5 pounds), then you find that your mechanical power needs to be (0.0152.59.81*11.2) = 4 watts. If you assume 80 percent efficiency in the drivetrain, then the motor needs to be (4/0.8) = 5 watts. If I google around I find a motor like this (no affiliation or endorsement of the supplier, just a Google result), there's a 5 W motor with a rated speed of 3000 rpm. 3000 rev/min is 50 rev/s, which is 314.15 rad/s, and to get to 25 mph (11.2 m/s), I need $v = r\dot{\theta}$ so $r = v/\dot{\theta}$, so $r = 11.2/314.15$ or wheels with a radius is 3.5 centimeters, or about 1.3 inches.
{ "domain": "robotics.stackexchange", "id": 2605, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "motor, design, torque, brushless-motor, gearing", "url": null }
java, game, 2048 if(area[y][x].getPowerOf2() == area[y][x-1].getPowerOf2()) { area[y][x].setEmpty(); area[y][x-1].increasePowerOf2(); //merging occurs, to the left of the cell y x-1 there are no empty cells according to the algorithm, so do not return } } } } }
{ "domain": "codereview.stackexchange", "id": 36512, "lm_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, 2048", "url": null }