text stringlengths 1 1.11k | source dict |
|---|---|
java, algorithm, taxicab-geometry
private int[][] tiles;
private int N;
// construct a board from an N-by-N array of tiles
public Board(int[][] tiles) {
this.tiles = tiles;
N = tiles.length;
}
// return sum of Manhattan distances between blocks and goal
public int manhattan() {
int count = 0;
int expected = 0;
for (int row = 0; row < tiles.length; row++) {
for (int col = 0; col < tiles[row].length; col++) {
int value = tiles[row][col];
expected++; | {
"domain": "codereview.stackexchange",
"id": 13003,
"lm_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, algorithm, taxicab-geometry",
"url": null
} |
ros, slam, navigation, pcd
Title: rgbdslam cannot save .pcd
Hi,
I am new to ROS and I finally managed to run rgbdslam on my Ubuntu 10.04.
Now the problem is that though I can save node-wide pcd files, but I CANNOT save the whole scene to pcd file. Every time after I clicked save or save as, nothing happened in the destination folder.
Did I miss something?
Could anyone help me with the problem?
Thanks.
Jack
Originally posted by Jack on ROS Answers with karma: 16 on 2012-01-10
Post score: 0
Finally I used cloud_to_pcd to subscribe the topic /rgbdslam/batch_cloud and save the scene into pcd.
Originally posted by Jack with karma: 16 on 2012-01-11
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 7840,
"lm_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, slam, navigation, pcd",
"url": null
} |
homework-and-exercises, newtonian-mechanics, forces, classical-mechanics, coriolis-effect
Title: How to calculate the Coriolis Force/Effect of an object moving West or East ALONG the Equator This is NOT a homework question, there are few informations that I found on the Internet about this specific case of the Coriolis Force
We currently are dealing with the Coriolis Force, and I struggle to understand how to calculate the force when moving east or west ALONG the Equator. I know that the force is zero when moving north or south at the Equator, because the Latitude Angle used to calculate the force is zero.
I know that generally $$F_c = -2m (\Omega \times \overrightarrow{v})$$ where Omega is the Angular Velocity, in the case of Earth it is $\frac{2\pi}{24\cdot 60 \cdot60}$ because we divide the period by the total time in seconds it takes for Earth to go around, so one day. And $\overrightarrow{v}$ is the velocity vector. The resulting force $F_c$ points perpendicular to both velocity and angular velocity | {
"domain": "physics.stackexchange",
"id": 90878,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, forces, classical-mechanics, coriolis-effect",
"url": null
} |
general-relativity, gravity, antimatter
Edit: The linked question explains that mediators governed by an even-spin field will attract when their charges are similar, and repel when they are dissimilar, while mediators governed by an odd-spin field will do the opposite (as in electromagnetism). There are more spins than just 2. There are particles with spin zero (Higgs particle). Spin half (electrons, positrons, neutrions, quarks, muons, etc.), spin 1 (photons, gauge bosons of weak interaction), spin 3/2, spin 2 (hypothetical gravitons).
During attraction / repulsion there are 2 things that come into play:
1) The particles that get attracted / repelled
2) The field that mediates the attraction / repulsion
The question you referenced talks about the spin of the mediating field. If the mediating field is spin 0 or spin 2, it is alway attractive. If it is spin 1, it can be either attractive or repulsive, depending on the charge of the particles. | {
"domain": "physics.stackexchange",
"id": 15436,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, gravity, antimatter",
"url": null
} |
thermodynamics, statistical-mechanics
Title: Confusion about Boltzmann distribution It is well-known that the Boltzmann distribution is given by $p\propto e^{-E/kT}$, where $E$ refers to the energy.
A standard textbook problem is to find the pressure variation in a rotating cylinder using Boltzmann distribution.
Working in the rotating frame, integrating the centrifugal force gives a potential energy $U(r)=-\frac{1}{2}m r^2 \omega^2$, which gives us a boltzmann distribution of $e^{mr^2\omega^2/2kT}$.
However, a contradiction seemingly arises if we were to analyse the same problem in the lab frame. In the lab frame, particles at a radius $r$ from the centre would have kinetic energy of $\frac{1}{2}m (r\omega)^2$, giving a boltzmann distribution of $e^{-mr^2\omega^2/2kT}$ which obviously does not agree with the result derived in the rotating frame of reference (with an additional minus sign in the exponent). | {
"domain": "physics.stackexchange",
"id": 99286,
"lm_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, statistical-mechanics",
"url": null
} |
rotational-dynamics, rotational-kinematics, rigid-body-dynamics, stability, gyroscopes
$$\big(I_1\omega_1\big)^2 + \big(I_1\omega_2\big)^2 + \big(I_3\omega_3\big)^2 = c_1$$
and the other coming from the conservation of energy
$$I_1\big(\omega_1\big)^2 +I_1 \big(\omega_2\big)^2 + I_3\big(\omega_3\big)^2 = c_2$$
The trajectory of the angular velocity is along one of the intersection curves of the two ellipsoids. In the case of the symmetric coin, the ellipsoids are rotational and have $z-$axes aligned, so the trajectory is a circle.
Edit: To make things a bit easier to visualize, it is a good idea to look at the dynamics of the angular momentum $\vec{l} = (l_1, l_2, l_3)$ in the body-fixed frame and compare it to its representation $\vec{L} = (L_1, L_2, L_3)$ in the world frame. There is a linear transformation between the angular momentum and the angular velocity in terms of the inertia tensor, i.e.
\begin{align*}
&l_1 = I_1\, \omega_1\\
&l_2 = I_1\, \omega_2\\
&l_3 = I_3\, \omega_3\\
\end{align*} | {
"domain": "physics.stackexchange",
"id": 59784,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rotational-dynamics, rotational-kinematics, rigid-body-dynamics, stability, gyroscopes",
"url": null
} |
c#, asp.net-mvc
Now, you can do this :
if (IsDisplayLink)
{
response.Add(new FlyoutMenuLinkItem("Portal", "/members/portal", FlyoutMenuLinkItem.Section.MemberPortal);
}
if (IsGroupLink)
{
response.Add(new FlyoutMenuLinkItem("Group Link", "/meetings/disclosures", FlyoutMenuLinkItem.Section.MeetingsDisclosures);
}
if (favoritePages != null)
{
response.AddRange(favoritePages.Select(x=> new FlyoutMenuLinkItem(x.PageName, x.Url, FlyoutMenuLinkItem.Section.MyPages)));
}
Also, a private method would do the same if you don't have access to FlyoutMenuLinkItem :
private FlyoutMenuLinkItem CreateMenuLink(string name, string url, FlyoutMenuLinkItem.Section section)
{
return new FlyoutMenuLinkItem
{
PageName = name,
PageURL = url,
PageSection = section
};
} | {
"domain": "codereview.stackexchange",
"id": 42395,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, asp.net-mvc",
"url": null
} |
general-relativity, spacetime, metric-tensor, coordinate-systems, curvature
We then say that the vanishing of the curvature tensor (in any coordinate system) is a necessary and sufficient condition for the manifold to be flat.
In fact, a manifold is defined to be flat if there exists coordinates $X^\mu$ such that, throughout the manifold, the line element can be written as
$$ds^2=\epsilon_1(dX^1)^2+\epsilon_2(dX^2)^2+...+\epsilon_N(dx^N)^2$$
where $\epsilon_a=\pm1.$ | {
"domain": "physics.stackexchange",
"id": 76777,
"lm_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, spacetime, metric-tensor, coordinate-systems, curvature",
"url": null
} |
electromagnetic-radiation, photons, laser, coherence
This coefficient $N+1$ may be divided to $1$ plus $N$. The term $1$ describes the probability of a spontaneous emission – that occurs even if no other photons were present in the state to start with – while the term $N$ is the stimulated emission whose probabilities scales with the number of photons that are already present.
But in all cases, we must talk about "exactly the same one-photon state" which also means that the direction of the motion is the same. It's because quantum field theory associates one quantum harmonic oscillator with each state i.e. with each information $\vec k$ about the direction of motion and wavelength; combined with a binary information about $\lambda$, the polarization (e.g.left-handed vs right-handed). | {
"domain": "physics.stackexchange",
"id": 49765,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetic-radiation, photons, laser, coherence",
"url": null
} |
algorithms, formal-languages, optimization, context-free, formal-grammars
The second, related, problem you face is tokenisation. Programming language grammars deal in tokens, not in characters. Just the issue of tabs vs spaces in the samples is likely to mess things up. This might be finessed by making assumptions about tokenisation and then finding approximate smallest grammars over the language of tokens, but be prepared for nasty surprises. E.g. string literals in C# are definitely non-trivial, and you might not have many instances of @-strings from which to infer. | {
"domain": "cs.stackexchange",
"id": 12985,
"lm_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, formal-languages, optimization, context-free, formal-grammars",
"url": null
} |
ros, gazebo, navigation, odometry, p3dx
<alwaysOn>true</alwaysOn>
<updateRate>100</updateRate><!-- original = 100 -->
<leftJoint>base_right_wheel_joint</leftJoint>
<rightJoint>base_left_wheel_joint</rightJoint>
<wheelSeparation>0.39</wheelSeparation>
<wheelDiameter>0.15</wheelDiameter>
<torque>5</torque>
<commandTopic>cmd_vel</commandTopic>
<odometryTopic>odom</odometryTopic>
<odometryFrame>odom</odometryFrame>
<robotBaseFrame>base_link</robotBaseFrame>
</plugin>
</gazebo> | {
"domain": "robotics.stackexchange",
"id": 23710,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, gazebo, navigation, odometry, p3dx",
"url": null
} |
the possible mathematical or logical relationships between sets (groups of things). s} B = {s,t,r,s} C = {t,s,t,r} D = {s,r,s,t} a) A and B b) A and C c) B. 3, with aesthetically pleasing results. A typical venn diagram is shown in the figure below: In the figure, set A contains the multiples of 2 which are. The R visualization code provided in this Power BI desktop file will take a dynamic set of columns (based on the values you add in the fields pane), perform the overlap analysis, and display the diagram. Through the dark background, you may feel serious and formal. Venn diagrams are very useful constructs made of two or more circles that sometimes overlap. Introduced by Venn (1880), the Venn diagram has been popularized in texts on elementary logic and set theory (e. A Venn diagram is a graphical way of representing the relationships between sets. Nice Looking Five Sets Venn Diagrams Stack Overflow. It becomes very hard to read with more groups than that and thus must be avoided. | {
"domain": "1upload.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9755769042651874,
"lm_q1q2_score": 0.8576752802971456,
"lm_q2_score": 0.8791467659263148,
"openwebmath_perplexity": 789.4183828942959,
"openwebmath_score": 0.4094984829425812,
"tags": null,
"url": "http://zveg.1upload.de/r-venn-diagram-6-sets.html"
} |
equation is illustrated by variable separation method. Solve the IBVP for the heat equation. practical application rather than proofs of convergence. In addition, Chapter zero expands the topics of. Repetition of eigenvalues and eigenvectors. Bilinear elements 42 14. Traditionally, the heat equations are often solved by classic methods such as Separation of variables and Fourier series methods. Daileda 1-D Heat Equation. 31Solve the heat equation subject to the boundary conditions. 1 Homogeneous IBVP 113 5. Logistic equation with shing term. 4, Myint-U & Debnath §2. 2 Steady-state heat flow. Li and Xiao Boundary Value Problems A note on the IBVP for wave equations with dynamic boundary conditions Chan Li Ti-Jun Xiao In this paper, we investigate the controllability on the IBVP for a class of wave equations with dynamic boundary conditions by the HUM method as well as the wellposedness for the related back-ward problems. Where precisely does the proof of the maximum principle break down | {
"domain": "aquatique-freiburg.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.978712645102011,
"lm_q1q2_score": 0.8001704781633721,
"lm_q2_score": 0.8175744761936437,
"openwebmath_perplexity": 880.9884152822596,
"openwebmath_score": 0.7227175831794739,
"tags": null,
"url": "http://wasb.aquatique-freiburg.de/ibvp-heat-equation.html"
} |
ogre
Title: gzclient throwing Ogre::InvalidParametersException
Hello all. I am attempting to build Gazebo from source this weekend. I was able to get everything built however when I attempt to run the gzclient I get an exception. Could this possible be due to my building of OGRE manually? I couldn't use the default OGRE as it was missing a Cg plugin. Any help would be greatly appreciated.
Additional info
I am running Ubuntu.
Description: Ubuntu 12.04.1 LTS
Release: 12.04
Codename: precise
Here is the output for gzclient. gzserver was already running with the empty world.
user@Azul:~$ gzclient
Gazebo multi-robot simulator, version 1.0.1
Copyright (C) 2011 Nate Koenig, John Hsu, Andrew Howard, and contributors.
Released under the Apache 2 License.
http://gazebosim.org
Msg Waiting for master
Msg Connected to gazebo master @ http://localhost:11345
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must | {
"domain": "robotics.stackexchange",
"id": 2752,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ogre",
"url": null
} |
meteorology, climate-change, soil-science
wood when grown in lower density stands. In managed forests trees are separated at intervals convenient to human maintenance staff and their equipment and are thus considerably farther apart than they would be if they had grown from seed in a wild setting and as tree farm mechanisation has increased so has tree spacing in plantation stands. Climate change could alter wood densities in the long run but at this stage we aren't seeing those effects in timber yet, it may be effecting young stands right now but we won't see the results for a number of years. | {
"domain": "earthscience.stackexchange",
"id": 2176,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "meteorology, climate-change, soil-science",
"url": null
} |
general-relativity, tensor-calculus, continuum-mechanics
What I want to know is what is the way to adapt these equations so that they satisfy General Relativity. That is, I want to simulate the deformation of a mechanical structure when the velocities involved are close to the speed of light and/or when a very massive object is near.
I am familiar with nonlinear elasticity if needed, but as far as tensors go I'm unfamiliar with co-variant/contra-variant notation and I prefer intrinsic notation, even though I'll take answers expressed in any way.
What form do the equilibrium, constitutive and compatibility equations take? Is the simulation of deformation of bodies in a relativistic context something that was properly done already? Does the elasticity tensor need to be redefined in terms of the metric tensor maybe?
I couldn't find any good reference that addresses this issue, even though I feel like this is possible to achieve. I would be very thankful for any help on this matter. The answer you're looking for seems to be contained in | {
"domain": "physics.stackexchange",
"id": 34259,
"lm_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, tensor-calculus, continuum-mechanics",
"url": null
} |
temperature, pressure, vapor-pressure
Source: http://www.aashtoresource.org/university/newsletters/newsletters/2016/08/02/the-anatomy-of-a-liquid-in-glass-thermometer
At high temperatures, the gas phase volume decreases because the liquid expands. As a consequence, the pressure rises (lower volume, higher temperature, more ethanol in the gas phase because of the increased vapor pressure). Does this pressure increase contribute to the non-linearity of the measurement, i.e. position of the meniscus vs. temperature?
Even without a possible pressure effect, the rise of the liquid is non-linear with temperature because of the non-linear expansion coefficient of ethanol. I am wondering whether the pressure effect significantly contributes to the non-linearity. I am also wondering whether the expansion chamber (at the tip of the thermometer) helps to prevent excessively high pressures.
[OP] Does this pressure increase contribute to the non-linearity of the measurement, i.e. position of the meniscus vs. temperature? | {
"domain": "chemistry.stackexchange",
"id": 16951,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "temperature, pressure, vapor-pressure",
"url": null
} |
python, object-oriented
def __flatten_attributes(self) -> Array:
"""Return all instance attributes as a flattened array.
Returns
-------
Array
Flat array with all instance attributes.
"""
flat_attributes = np.empty(0)
for key, _ in self._dimensions.items():
attr = getattr(self, key)
if not np.isscalar(attr):
attr = attr.flatten()
flat_attributes = np.append(flat_attributes, attr)
return flat_attributes
def __set_attributes_from_flat_array(self, flat_attributes: Array) -> None:
"""Sets the instance attributes from a flattened array. | {
"domain": "codereview.stackexchange",
"id": 43275,
"lm_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, object-oriented",
"url": null
} |
electrochemistry, analytical-chemistry, nernst-equation
What I have thought on the subject is that Nernst's potential equation is useful, but I don't really know what equivalence point should mean in a redox context. I know it only from elementary acid-base equilibria. As the ongoing reaction is
$$\ce{5 Fe^2+(aq) + MnO4-(aq) + 8 H+(aq) -> 5 Fe^3+(aq) + Mn^2+(aq) + 4 H2O(l)}$$
the point of equivalence is when the initial molar amount of $\ce{MnO4-(aq)}$ is equal to 1/5 of the initial molar amount of $\ce{Fe^2+(aq)}$.
Another condition comes from the equilibrium requirement that (not standard) redox potentials of all redox systems must be equal
$$E = E^{\circ}_{\ce{MnO4-}/\ce{Mn^2+}} + \frac{RT}{5F} \ln{\left(\frac{[\ce{MnO4-}][\ce{H+}]^8}{[\ce{Mn^2+}]}\right)}=E^{\circ}_{\ce{Fe^3+}/\ce{Fe^2+}} + \frac{RT}{F} \ln{\left(\frac{[\ce{Fe^3+}]}{[\ce{Fe^2+}]}\right)}$$ | {
"domain": "chemistry.stackexchange",
"id": 17284,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrochemistry, analytical-chemistry, nernst-equation",
"url": null
} |
kinematics, acceleration, coordinate-systems, group-theory, geometry
Material Acceleration You can look at the acceleration of a specific particle on the body in terms of how the linear velocity components change over time. We call this the material acceleration. So we are are tracking a point A that is riding on the rotating reference frame
$$\overline{a}_A^m = \tfrac{\rm d}{{\rm d}t} \overline{v}_A \tag{1}$$
Spatial Acceleration You can also look at the change in speed of whatever particle is passing under a fixed reference point | {
"domain": "physics.stackexchange",
"id": 82742,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kinematics, acceleration, coordinate-systems, group-theory, geometry",
"url": null
} |
organic-chemistry, stereochemistry, chirality
It does not (and must not) matter whether you draw the 2-chloropentane with the substituted carbon to the right or to the left. Both ways are identical. Usually, you will chose an orientation that is consistent with further or earlier steps of your synthesis, but if you only have one one reaction that point is moot. (It matters a lot more in total synthesis, where it helps to draw reactands in a way that show their conformation in the final molecule.) Furthermore, there is a IUPAC style guide out there somewhere, which probably says one of the two ways is to be preferred if no other reasons speak for the other … but that’s more relevant for journal publications, not for practising or for exam answers.
So just for total consistency’s sake: Everything you did was correct; just remember that molecules can be drawn with different orientations, and learn to turn them around before your inner eye. | {
"domain": "chemistry.stackexchange",
"id": 3423,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, stereochemistry, chirality",
"url": null
} |
quantum-field-theory, gauge-theory, path-integral, gauge-invariance
The ordinary derivative satisfies an additional property i.e., $\partial_\mu\partial_\nu\ f(x) = \partial_\nu \partial_\mu f(x)$ for all smooth functions. This is not assumed for all derivations. In fact, the obstruction to commutativity of the derivatives defines the field strength.
$$
[D_\mu,D_\nu]\ \Phi \sim g\ (F_{\mu\nu}^a T_a)\ \Phi\ .
$$
In supersymmetry, one uses a graded version of the Leibniz rule for (covariant) derivatives involving Grassmann coordinates. | {
"domain": "physics.stackexchange",
"id": 65402,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, gauge-theory, path-integral, gauge-invariance",
"url": null
} |
python, algorithm, pathfinding, a-star, sliding-tile-puzzle
Title: How can I speed up my IDA* algorithm for N-puzzle? I'm trying to solve the N-Puzzle problem using IDA* algorithm with a Manhattan heuristic. I already implemented the algorithm from the pseudocode in this Wikipedia page (link).
Here's my code so far :
class Node():
def __init__(self, state, manhattan):
self.state = state
self.heuristic = manhattan
def __str__(self):
return f"state=\n{self.state}\nheuristic={int(self.heuristic)}"
def __eq__(self, other):
return np.array_equal(self.state, other.state)
def customSort(node):
return node.heuristic
def nextnodes(node):
zero = np.where(node.state == 0)
y,x = zero
y = int(y)
x = int(x)
directions = []
if y > 0:
directions.append((y - 1, x))
if x > 0:
directions.append((y, x - 1))
if y < constant.SIZE2 - 1:
directions.append((y + 1, x))
if x < constant.SIZE2 - 1:
directions.append((y, x + 1)) | {
"domain": "codereview.stackexchange",
"id": 40854,
"lm_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, algorithm, pathfinding, a-star, sliding-tile-puzzle",
"url": null
} |
computational-geometry, image-processing, computer-vision
Heuristic methods are another possibility. They try to find corresponding points, e.g., using Lucas-Kanade, optical flow, or other methods. As heuristics, they are not guaranteed to work. Sometimes they might fail to detect corresponding points, or output false detections. Another issue is that their effectiveness depends upon characteristics of the scene that you're capturing: they're more effective for some kinds of scenes than others. But this also could be a valid approach. | {
"domain": "cs.stackexchange",
"id": 4996,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computational-geometry, image-processing, computer-vision",
"url": null
} |
space-telescope, gravitational-lensing
$$ x_i = x_o \frac{d_f}{d_o}$$
Thus the image of a distant object will be 10,000 times smaller than if using the Sun, which is much more convenient!
e.g. Observe an Earth-like planet at 10 ly at a focus of 630 au (= 0.01 ly) from the Sun. The image diameter will be 12.5 km. That's a lot of CCD detectors! Using a white dwarf at a focal length that is 10,000 times smaller gives an image just 1.25 m across.
All this assumes that the telescope is perfectly pointed with the source right behind the lens. Any relative motion has to be corrected or the image will move through the focal plane very quickly (like a planet viewed with high magnification through a normal telescope). | {
"domain": "astronomy.stackexchange",
"id": 3969,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "space-telescope, gravitational-lensing",
"url": null
} |
java, converting, inheritance
public class ComponentMapper extends BaseDocumentMapper {
public Component of(CmsDocument cmsDocument) {
return map(new Component(), cmsDocument);
}
protected ComponentMapper map(Component component, CmsDocument cmsDocument) {
super.map(component, cmsDocument);
component.setHidden(Boolean.parseBoolean(cmsDocument.getText(HIDE_PATH)));
return component;
}
}
public class BaseDocumentMapper {
public BaseDocument of(CmsDocument cmsDocument) {
return map(new BaseDocument(), cmsDocument);
}
protected BaseDocument map(BaseDocument baseDocument, CmsDocument cmsDocument) {
baseDocument.setType(cmsDocument.getType());
baseDocument.setName(cmsDocument.getName());
baseDocument.setContentId(cmsDocument.getText(CONTENT_ID_PATH));
return baseDocument;
}
} | {
"domain": "codereview.stackexchange",
"id": 22172,
"lm_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, converting, inheritance",
"url": null
} |
objective-c, ios, cocoa
@end
Main Dog Spawning
GKDogSpawner.h
//
// GKDogSpawner.h
// SampleApp
//
// Cocoa foundation classes
#import <Foundation/Foundation.h>
#pragma mark - Defines
#define GKDOGSPAWNER_IMAGE_MIN_X 0.0f
#define GKDOGSPAWNER_IMAGE_MAX_X ([UIScreen mainScreen].bounds.size.width - GKDOGSPAWNER_IMAGE_WIDTH)
#define GKDOGSPAWNER_IMAGE_MIN_Y 0.0f
#define GKDOGSPAWNER_IMAGE_MAX_Y ([UIScreen mainScreen].bounds.size.height - GKDOGSPAWNER_IMAGE_HEIGHT)
#define GKDOGSPAWNER_IMAGE_WIDTH 64.0f
#define GKDOGSPAWNER_IMAGE_HEIGHT 64.0f
#pragma mark - The DogSpawner class of the GK namespace
@interface GKDogSpawner : NSObject
#pragma mark - Instance methods
- (void)spawnDogWithClassNamed:(NSString *)className onView:(UIView *)targetView;
@end
GKDogSpawner.m
//
// GKDogSpawner.m
// SampleApp
//
#import "GKDogSpawner.h"
#import "GKDog.h"
#import "GKYorkshireTerrier.h"
#import "GKRandomNumber.h" | {
"domain": "codereview.stackexchange",
"id": 6936,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "objective-c, ios, cocoa",
"url": null
} |
classical-mechanics, conservation-laws, symmetry, hamiltonian-formalism, noethers-theorem
&= -\int_{t_1}^{t_2} \varepsilon \dot Q dt
\end{align*}
We can therefore see that on solutions to the equations of motion, $\dot Q = 0$. This is just Noether's theorem.
We may now wonder how this symmetry transformation affects $L_H$ when $\varepsilon$ is a constant. We see that it changes it exactly by a total derivative, as expected:
\begin{align*}
\delta L_H &= - \frac{\partial Q}{\partial q_i} \dot q_i - p_i \frac{d}{dt} \Big( \frac{\partial Q}{\partial p_i} \Big) + \{ H, Q\} \\
&= - \frac{\partial Q}{\partial p_i} \dot q_i - \dot p_i \frac{\partial Q}{\partial p_i} + \frac{d}{dt} \Big( p_i \frac{\partial Q}{\partial p_i} \Big) \\
&= \frac{d}{dt} \Big( p_i \frac{\partial Q}{\partial p_i} - Q\Big)
\end{align*}
So we can see that $L_H$ necessarily changes by a total derivative. Let me now point out an interesting aside. When the quantity $p_i \frac{\partial Q}{\partial p_i} - Q = 0$, the total derivative is $0$. This happens when the conserved quantity is of the form
$$ | {
"domain": "physics.stackexchange",
"id": 55896,
"lm_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, conservation-laws, symmetry, hamiltonian-formalism, noethers-theorem",
"url": null
} |
c++
namespace ranges = std::ranges;
using std::size_t; | {
"domain": "codereview.stackexchange",
"id": 44670,
"lm_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++",
"url": null
} |
energy, electricity, experimental-physics, rotation
Title: How many kWh this turbine would generate? My grandfather and I are running some experiments down the river, however we don't have expertise in physics so I bring up this question to the community and hope someone could help.
How many kWh a turbine with the following features would generate? | {
"domain": "physics.stackexchange",
"id": 65417,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "energy, electricity, experimental-physics, rotation",
"url": null
} |
We had a little chat about this in our class as well, because the $arg(z)$ function was defined as $\theta$ for which $\dfrac{z}{|z|}=e^{i\theta}$, but then we know that $e^{i\theta}$ is a periodic function, because it can be written as $isin(\theta)+cos(\theta)$, which are $2\pi$-periodic functions. So there is still a huge argument about this, and some textbooks like to work with $[0,2\pi)$ while others like to work with $[-\pi,\pi)$, because regardless of which interval you take, the value of $\theta$ is uniquely determined if the length of the interval is exactly $2\pi$. I,like you, normally work with the latter , but there are some others like your sources who work with the former. You think that $90^o$ counter clockwise is like rotating backward, hence you use the minus sign to denote that. On the other hand, the people who have designed the links you have visited must have thought that it's the same as going $270^o$ degrees forward, hence they gave it $3\pi/2$ argument. It's all | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9572778048911612,
"lm_q1q2_score": 0.826505628522055,
"lm_q2_score": 0.8633916134888613,
"openwebmath_perplexity": 192.90722660604345,
"openwebmath_score": 0.8252900838851929,
"tags": null,
"url": "https://math.stackexchange.com/questions/1716913/how-should-i-find-the-argument-when-a-equals-zero-with-complex-numbers"
} |
ros, navigation, realsense-camera, gmapping, ros-indigo
Title: I am trying to use Intel realsense D415 cameras to do gmapping, and the graph is getting formed but in a specific wedge only
I did depthscan_to_laserscan but there were a lot of nan values under the /scan topic. Could that be the reason for the problem?
Originally posted by srnand on ROS Answers with karma: 31 on 2018-07-04
Post score: 0
I think It is because, the Fixed Frame in rviz in not moving. So I have change the Fixed frame. Let me know if this is not the correct solution.
Originally posted by srnand with karma: 31 on 2018-07-04
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 31182,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, navigation, realsense-camera, gmapping, ros-indigo",
"url": null
} |
reinforcement-learning, ai-design, deep-rl, markov-decision-process
How can I encode such states?
Can I simply vectorize such state by concatenating the different features of each element obtaining $[f_{0e_0}, f_{1e_0}, f_{0e_1}, f_{1e_1}, f_{0e_2}, f_{1e_2}]$, or should I use a convolutional architecture of some sort? For general advice about state representation, you could check my answer to How to define states in reinforcement learning? - this does not cover your specific issue, but may help with other details such as whether to one-hot-encode and/or scale your discrete features. Also you will want to assess whether any state vector you construct actually contains enough data for reinforcement learning to work.
Assuming that is all good, then your approach here: | {
"domain": "ai.stackexchange",
"id": 1197,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reinforcement-learning, ai-design, deep-rl, markov-decision-process",
"url": null
} |
javascript, functional-programming, async-await, promise, ecmascript-8
let choice = null;
let serviceList = document.querySelector("#serviceList");
// show list element
serviceList.classList.remove("hidden")
// create some elements for the user to interact with
for (let service of services){
let button = document.createElement("BUTTON");
button.innerHTML = service.label;
button.addEventListener("click",function(){
document.dispatchEvent(
new CustomEvent('serviceChosen', { detail:service })
)
});
serviceList.appendChild(button);
}
// returns promise with one time only event listener
return new Promise((resolve,reject)=>{
document.addEventListener("serviceChosen",function(e){
serviceList.classList.add("hidden") // hide again for we are done
resolve(e.detail)
},{ once: true })
})
}
.hidden{
visibility: hidden
}
<div id="serviceList" class="hidden">
</div> | {
"domain": "codereview.stackexchange",
"id": 39543,
"lm_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, functional-programming, async-await, promise, ecmascript-8",
"url": null
} |
homework-and-exercises, heisenberg-uncertainty-principle
So lets look at what I have done so far. I have done the following:
$$\Delta E \Delta t = \frac{\hbar}{2} $$ but
$$E = h f$$ so
$$\Delta f = \frac{1}{4\pi \Delta t}$$
but if I take $\Delta f$ and convert it into wavelength using $\lambda f = c $ then it gives me the wrong answer. I've tried MANY variations of the above formulas.
The correct answer is $0.142 nm $
Can anyone give me a hint? Hint: Your problem is in the "take $\Delta f$ an convert it to wavelength using $\lambda f = c$" part. The equation $\lambda f = c$ does not imply $\Delta \lambda \Delta f = c$.
Answer: Rather it implies,
$\lambda f = c$
$\lambda = \frac{c}{f} $
Now differentiate:
$d\lambda = -c\frac{df}{f^2}$ | {
"domain": "physics.stackexchange",
"id": 122,
"lm_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, heisenberg-uncertainty-principle",
"url": null
} |
java, performance, android, sqlite
ContentValues values = new ContentValues();
values.put(DBHelper.COLUMN_SAIDANDDONE_PERSON_ID, personId);
values.put(DBHelper.COLUMN_SAIDANDDONE_DOCUMENT_TYPE, documentType);
values.put(DBHelper.COLUMN_SAIDANDDONE_SUB_TYPE, subType);
values.put(DBHelper.COLUMN_SAIDANDDONE_SESSION, session);
values.put(DBHelper.COLUMN_SAIDANDDONE_DOCUMENT_ID, documentId);
values.put(DBHelper.COLUMN_SAIDANDDONE_TERM, term);
values.put(DBHelper.COLUMN_SAIDANDDONE_AUTHORITY, authority);
values.put(DBHelper.COLUMN_SAIDANDDONE_DATE, date);
values.put(DBHelper.COLUMN_SAIDANDDONE_SPEAKER, speaker);
values.put(DBHelper.COLUMN_SAIDANDDONE_SPEAKER_TIME, speakerTime);
values.put(DBHelper.COLUMN_SAIDANDDONE_NUMBER_OF_CHARACTERS, numberOfChars);
values.put(DBHelper.COLUMN_SAIDANDDONE_PERSON_ACTIVITIES, personActivities); | {
"domain": "codereview.stackexchange",
"id": 13194,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, performance, android, sqlite",
"url": null
} |
distributed-systems, computer-networks
Admittedly, there has been a level shift in the terms, and/or they are applied at a logical level. For example, Facebook would be considered a "centralized" system insofar as it's controlled by a single entity, as opposed to Diaspora which is decentralized. I think it has become popular to use the term "distributed" when "decentralized" may be a better term. Of course, Facebook has many servers spread across the world, and so it's infrastructure is very much distributed. Similarly, a single data center for Facebook may logically be a single "server" but internally is a distributed system as well consisting of hundreds of physical servers.
Wikipedia does a pretty good job of outlining the key characteristics of a distributed system from a theoretical perspective: | {
"domain": "cs.stackexchange",
"id": 6662,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "distributed-systems, computer-networks",
"url": null
} |
quantum-state, entanglement, linear-algebra
My taught process:
Let there be three qubits $(Q_1, Q_2, Q_3)$ with corresponding Hilbert spaces $\mathcal{H_1^{2}}$,$\mathcal{H_2^{2}}$,$\mathcal{H_3^{2}}$. Using tensor products I can write a $2^n$ dimensional Hilbert space as
\begin{equation}
\mathcal{H^{2^3}} = \mathcal{H_1^{2}} \otimes\mathcal{H_2^{2}}\otimes \mathcal{H_3^{2}}.
\end{equation}
So with my logic, I've created a $2^n$ dimensional Hilbert space without entanglement.
My question:
Why is entanglement making it possible and where I'm wrong? The error lies in the assertion that $\mathcal{H^{2^3}} = \mathcal{H_1^{2}} \otimes\mathcal{H_2^{2}}\otimes \mathcal{H_3^{2}}$ is without entanglement. For example, $\frac{|000\rangle+|111\rangle}{\sqrt2}\in\mathcal{H^{2^3}}$ is the GHZ state famous for exemplifying one type of tripartite entanglement. | {
"domain": "quantumcomputing.stackexchange",
"id": 3479,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-state, entanglement, linear-algebra",
"url": null
} |
c#, wpf
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Button x:Name="StartServiceButton" Content="Start Service" HorizontalAlignment="Left" Margin="10,288,0,0" VerticalAlignment="Top" Width="91" Click="buttonStartService_Click" IsEnabled="False"/>
<TextBox x:Name="LogsTextBox" Margin="10,315,10,10" TextWrapping="Wrap" Text="Logs:" IsReadOnly="True"/>
<CheckBox x:Name="StopServiceCheckBox" Content="Stop Service" HorizontalAlignment="Left" Margin="10,267,0,0" VerticalAlignment="Top" FontWeight="Bold"/>
</Grid> | {
"domain": "codereview.stackexchange",
"id": 17500,
"lm_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#, wpf",
"url": null
} |
$$\begin{equation*} H_{n}^{(i)} = c_1q_i^n + c_2nq_i^n + \dots + c_{s_i}n^{s_i-1}q_i^n \end{equation*}$$
The general solution of the recurrence relation is
$$\begin{equation*} h_n = H_n^{(1)} + H_n^{(2)} + \dots + H_n^{(t)} \end{equation*}$$
Example: Solve the recurrence relation
$$\begin{equation*} h_n = -h_{n-1} + 3h_{n-2}+5h_{n-3}+2h_{n-4} \qquad (n \ge 4) \end{equation*}$$
subject to the initial values $$h_0=1$$, $$h_1 = 0$$, $$h_2 = 1$$, and $$h_3 = 2$$.
The characteristic equation of this recurrence relation is $$x^4 + x^3 -3x^2 - 5x - 2 = 0$$, which has roots $$-1$$, $$-1$$, $$-1$$, $$-2$$. Thus, the part of the general solution corresponding to the root $$-1$$ is
$$\begin{equation*} H_n^{(1)} = c_1(-1)^n + c_2n(-1)^n + c_3n^2(-1)^n \end{equation*}$$
while the part of a general solution corresponding to the root $$2$$ is $$H_n^{(2)} = c_42^n$$. The general solution is | {
"domain": "zhu45.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9929882037884926,
"lm_q1q2_score": 0.8071676646102487,
"lm_q2_score": 0.8128673246376008,
"openwebmath_perplexity": 276.0780558297555,
"openwebmath_score": 0.9576734900474548,
"tags": null,
"url": "https://zhu45.org/posts/2017/Feb/02/solving-recurrence-relations-in-a-nutshell/"
} |
#### chisigma
##### Well-known member
I have given polynomial: $$\displaystyle x^3-8x^2+19x-12$$
I know how to find the roots with Horners method,i am just wondering if there is an easier and quicker way to find them? Thank you!
The polynomial has degree 3, so that it exists at least one real root that can be found with the Newton-Raphson method...
MHB Math Helper
#### wishmaster
##### Active member
I will try it,but i cant see that this method can be shorter......again you have to test it it with Horners method. Or can you show me how to do it with my example?
#### ZaidAlyafey
##### Well-known member
MHB Math Helper
Find the divisors of $$\displaystyle 12$$ then divide that by the divisors of the leading term $$\displaystyle 1$$ so we have $$\displaystyle \pm 1 , \pm 3 , \pm 4 , \pm 6 \pm 12$$ as possible roots.
$$\displaystyle P(3) = 3^3-8(9)+19\times 3-12 = 27-72+57-12=0$$ | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9632305339244013,
"lm_q1q2_score": 0.8005823637705178,
"lm_q2_score": 0.8311430499496096,
"openwebmath_perplexity": 1780.4506296758123,
"openwebmath_score": 0.8572304844856262,
"tags": null,
"url": "https://mathhelpboards.com/threads/roots-of-the-polynomial.8059/"
} |
electricity, electric-circuits, oscillators, signal-processing
Apart from a NTC thermistor at some temperature above ambient (with the voltage constant, when temperature goes up resistance goes down, increasing the current and dissipated power, further increasing temperature; when temperature goes down, power drops, the NTC cools down further), I can't think of a solution with only passive components. With active components, an inherently unstable circuit is easy to make. The small angle approximation of a pendulum is equivalent to a mass on a spring, and an inverted one is equivalent to a spring with negative spring constant (F=-kx; with negative k, the force is in the direction of the displacement).
With that approximation, the equation for the pendulum becomes ${d^2\theta\over dt^2}={g\over \ell}\theta$
This can be simulated with two opamp integrator circuits:
The output of an integrator is $u_{\text{out}} = -\frac{1}{RC}\int_0^t u_{\text{in}}\, dt$ | {
"domain": "physics.stackexchange",
"id": 32162,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electricity, electric-circuits, oscillators, signal-processing",
"url": null
} |
newtonian-mechanics
$F_{net} = -\frac{mv^2}{r}$
Now we have,
$N - mg = -\frac{mv^2}{r}$
Thus,
$N = mg - \frac{mv^2}{r}$
Therefore the normal force is less at the top of the track than at the bottom. | {
"domain": "physics.stackexchange",
"id": 23198,
"lm_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",
"url": null
} |
the-sun, time, clock
Title: Can I use the Tokyo Skytree as clock? After my observation today at the Skytree in Tokyo, I am wondering if this building could be used as a giant sundial?
As an aside, it would be interesting to consider how the Skytree might be used to display the time. In most sundials, the gnomon is aligned with the Earth's polar axis so that the shadow indicates the Sun's hour angle.
A vertical tower instead casts a shadow indicating the Sun's azimuth.
The time of day can be computed from this, but simple hour marks won't quite do it.
Let's try it with your photo.
The Skytree is at 35.7°N, 139.8°E, and the antenna tip is 634 m above ground.
The buildings near the shadow tip appear to match the satellite image about 830m away and 1° west of due north.
So the Sun's azimuth at that time is 179° and its altitude is atan(634/830) = 37°.
Assuming a date of 2019-11-12, and jiggling the inputs of the NOAA Solar Calculator, I find a matching azimuth at 11:22 AM JST (UTC+9). | {
"domain": "astronomy.stackexchange",
"id": 4045,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "the-sun, time, clock",
"url": null
} |
transformer, gpt, audio-processing, embeddings, self-supervised-learning
wav2vec is probably closest to what you're describing. They train a transformer on raw audio, self-supervised, in order to learn good representations of human speech for the speech-to-text task.
As far as training directly on spectograms, there's MelNet, a somewhat exotic RNN trained for a variety of audio synthesis tasks, including music.
Hope this helps! | {
"domain": "ai.stackexchange",
"id": 3021,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "transformer, gpt, audio-processing, embeddings, self-supervised-learning",
"url": null
} |
L = [4, 5, 1, 0, 3, 8, 8, 2, 1, 0, 3, 3, 4, 3]
d = {}
for x in L:
if x in d:
d[x] = d[x] + 1
else:
d[x] = 1
def g(k, d):
return d[k]
ks = d.keys()
• (A) sorted(ks, key=g)
• g is a function that takes two parameters. The key function passed to sorted must always take just one parameter
• (B) sorted(ks, key=lambda x: g(x, d))
• The lambda function takes just one parameter, and calls g with two parameters.
• (C) sorted(ks, key=lambda x: d[x])
• The lambda function looks up the value of x in d.
Next Section - Breaking ties with stable sorting | {
"domain": "programsinformationpeople.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9632305339244013,
"lm_q1q2_score": 0.8243819554823242,
"lm_q2_score": 0.8558511451289037,
"openwebmath_perplexity": 778.8413028766096,
"openwebmath_score": 0.287016361951828,
"tags": null,
"url": "https://www.programsinformationpeople.org/runestone/static/publicPIP/Sort/SortingaDictionary.html"
} |
by... Where denotes transposition and the over-line denotes complex conjugation the interchanging of the rows and columns of B me that. State the transpose of matrix refers to the solution 3\ ) matrix the first column the... An order of 2 * 3 pretty interesting, because how did define! To the interchanging of rows and columns At ji = aij years, months! A couple of ways to accomplish this in Python 2 * 3 words if [... Mathematics, the ij entry of a given matrix At ji = aij Duane... We said that our matrix product B transpose times a transpose operation on a matrix... By element ; Create a matrix first row and ith column in X will be placed At jth row jth! Ways to accomplish this in Python: Dictionary, Thesaurus, Encyclopedia of a given matrix size 2... And ith column in X ' will be a 2x3 matrix by, writing another matrix B is the. ( 3\times 2\ ) matrix became a \ ( 2\times 3\ ) matrix a... Exchange the positions of two things… two matrix with dimensions returns a matrix formed by | {
"domain": "server-home.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.982287697666963,
"lm_q1q2_score": 0.8289477850737355,
"lm_q2_score": 0.8438951104066293,
"openwebmath_perplexity": 746.62868446024,
"openwebmath_score": 0.7288891673088074,
"tags": null,
"url": "http://web409.webbox443.server-home.org/b0z6yha/transpose-matrix-definition-02f93c"
} |
quantum-mechanics, quantum-information, quantum-teleportation
(where $|\Psi^\pm\rangle$ and $|\Phi^\pm\rangle$ are defined in the next stage of the protocol)
Alice performs a Bell measurement, with projectors obtained from the Bell basis
\begin{equation} |\Phi^\pm\rangle = \frac{1}{\sqrt{2}}(|0\rangle|0\rangle \pm |1\rangle|1\rangle) \end{equation}
\begin{equation} |\Psi^\pm\rangle = \frac{1}{\sqrt{2}}(|0\rangle|1\rangle \pm |1\rangle|0\rangle) \end{equation}
Alice sends two bits to Bob in order to communicate the the result of her measurement (e.g. 00 for $|\Phi^+\rangle$ and so on)
-Now Bob applies a Pauli transformation on his part of the system depending on the result of the measurement of Alice and recovers the original state $|\psi\rangle$. | {
"domain": "physics.stackexchange",
"id": 69667,
"lm_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-teleportation",
"url": null
} |
python, frequency-response, transfer-function
To confirm results (or to compute directly), use the freqs and freqz commands that are part of scipy.signal for continuous-domain (s) and discrete-domain (z) transfer functions.
For example the transfer function
$$H(s) = \frac{s+1}{s+4s+4}$$ could be plotted using:
w,h = scipy.signal.freqs([1, 1], [1, 4, 4]) | {
"domain": "dsp.stackexchange",
"id": 9386,
"lm_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, frequency-response, transfer-function",
"url": null
} |
fluid-dynamics, fluid-statics, superfluidity, capillary-action
That's a simplification inasmuch as it is true that if the two ends of the capillary tube are at different heights, they will experience different amounts of ambient pressure. However, that hydrostatic difference is of order ~several inches of air (not water or mercury!) which, for practical purposes, is unmeasurable. So, we neglect it and still get useful and accurate results from measurements on capillary tubes, j-tube manometers, etc. | {
"domain": "physics.stackexchange",
"id": 83453,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, fluid-statics, superfluidity, capillary-action",
"url": null
} |
electromagnetic-radiation, visible-light, maxwell-equations
To understand visible absorption, you need to be thinking about energy levels and modes, not DC resistivity.
Water absorbs visible light because of various weak (harmonic) vibrational modes. Normally, vibration modes are only in the infrared, but water has unusually high-frequency vibration modes that reach just a bit into the visible. (Because hydrogen is light and bonds very tightly to oxygen. Just like a taut thin string on a guitar will vibrate at a higher frequency than a loose thick string.) Glass does not have that property.
Glass can be much more transparent than water: For example, fiber optics are glass strands through which light can travel many kilometers with negligible absorption. Fiber optics are manufactured very carefully to reduce absorption; if you made ordinary window glass that was 1km thick, it would certainly be opaque. | {
"domain": "physics.stackexchange",
"id": 8781,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetic-radiation, visible-light, maxwell-equations",
"url": null
} |
thermodynamics, pressure, ideal-gas
Title: When a gas expands against an external pressure of 0, must the stopper on the cylinder be massless? Basically, I need to conceptually understand why the work a gas does is the integral $\int p_\mathrm{external}dv$ and is 0 when pressure external is 0. I understand why $\mathrm{d}w = - p_\mathrm{externa } \mathrm{d}v$ and so obviously I understand why the math says the work is 0; I need to conceptually understand it.
When you have isothermal expansion in a cylinder where the external volume outside the gas has pressure 0, a.k.a. vacuum, must the movable top of the cylinder be massless? The equations obviously say the work is 0, but I think of the stopper itself as being resistance. Could I think of isothermal expansion in a vacuum as the top basically "disappearing" when the gas is released? | {
"domain": "physics.stackexchange",
"id": 78194,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, pressure, ideal-gas",
"url": null
} |
ros, ros-control, ros-kinetic, joint-state-publisher, robot-state-publisher
Originally posted by ffusco with karma: 271 on 2019-09-17
This answer was ACCEPTED on the original site
Post score: 3 | {
"domain": "robotics.stackexchange",
"id": 33758,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-control, ros-kinetic, joint-state-publisher, robot-state-publisher",
"url": null
} |
resonance, cis-trans-isomerism
Reference
http://www.siue.edu/~tpatric/Ch%2003%20Stereochem%20H%20T%20I.pdf | {
"domain": "chemistry.stackexchange",
"id": 12268,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "resonance, cis-trans-isomerism",
"url": null
} |
javascript, jquery, html, ajax
<tr>
<td nowrap="nowrap" style="padding-left:20px;" class="BodyText">
<b><a href='jobs.aspx?id=3628&type=1&int=External'>Instructional Support Team Specialist – ELL - SS1209</a></b>
<br/>
<b>Location:</b>Student & Family Support Services<br/>
<b>Contract:</b>Salary Schedule (DOE & Credits)<br/>
<b>Anticipated Hours:</b> TBD<br />
<b>Posting Date:</b> 1/28/2013
<b>Closing date:</b> Until Filled | {
"domain": "codereview.stackexchange",
"id": 3111,
"lm_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, html, ajax",
"url": null
} |
navigation, mapping, path, stack, amcl
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<rosparam file="$(find my_robot_name_2dnav)/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find my_robot_name_2dnav)/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find my_robot_name_2dnav)/local_costmap_params.yaml" command="load" />
<rosparam file="$(find my_robot_name_2dnav)/global_costmap_params.yaml" command="load" />
<rosparam file="$(find my_robot_name_2dnav)/base_local_planner_params.yaml" command="load" />
</node>
<node pkg="rviz" type="rviz" name="rviz" output="screen">
<param name="rviz" value="param_value" />
</node>
</launch>
Base local planner:
TrajectoryPlannerROS:
max_vel_x: 0.25
min_vel_x: 0.1
max_vel_theta: 1.0
min_in_place_vel_theta: 0.4
acc_lim_theta: 10.0
acc_lim_x: 10.0
acc_lim_y: 10.0
holonomic_robot: false
meter_scoring: true | {
"domain": "robotics.stackexchange",
"id": 23845,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, mapping, path, stack, amcl",
"url": null
} |
complexity-theory
Title: Why the $\textbf{PCP}(\log n, 1)$ construction of completeness $c$ and soundness $s$ for an $NP$ language $L$ implies $s/c$ inapproximability for $L$? In the introductory chapter of $\textbf{PCP}$ in Arora and Barak, I read the proof that why a $\textbf{PCP}(\log n, 1)$ of completeness 1 and soundness 1/2 for an $NPC$ language $L$ will imply that there exists a $\rho$ for which $\rho$-approximation algorithm for MAX-3-SAT does not exist unless $P = NP$. But in the paper, https://www.cs.cmu.edu/~odonnell/papers/maxcut.pdf authors say that "We construct a PCP that reads two bits from the proof and accepts if and only if the two bits are unequal. The completeness and soundness are $c$ and $s$ respectively. This implies that MAX-CUT is $NP$-hard to approximate within any factor greater than $s/c$." What is the proof for this? The authors give a reduction $x \mapsto f(x)$ from some NP-hard problem $X$ to MAX-CUT with the following properties: | {
"domain": "cs.stackexchange",
"id": 10282,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory",
"url": null
} |
thermodynamics, fluid-dynamics, flow
Attempt
Using the relation $V_m=\frac{M}{\rho}$, we obtain a relationship for the density of the fluid relative to the molar mass of the fluid. Which, after the chemical reaction will have decreased. Now, using the continuity of the fluid we have
$$\frac{M_1}{V_{m_1}}(\pi r_1^2)v_1=\frac{M_2}{V_{m_2}}(\pi r_2^2)v_2$$
From here the two areas must be equal in order for the surface area to stay constant, we have:
$$\frac{M_1}{M_2}\frac{V_{m_2}}{V_{m_1}}v_1=v_2$$
I am sure that there must be some formula relating the temperature change to the increase in molecules or something along those lines, however I have absolutely no experience with chemistry at all. I could assume the fluid to follow the ideal gas law and get an expression with temperature but this of course will affect the fidelity of the derivation, I am not sure whether it is a valid assumption. | {
"domain": "physics.stackexchange",
"id": 84827,
"lm_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, fluid-dynamics, flow",
"url": null
} |
java, swing
/**
* Creates a new Terminal Panel
*/
public TerminalPanel()
{
state = 0;
initComponents();
textArea.setText("Enter a number: \n");
textField.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent ae)
{
System.out.println("In action performed: state is " + state);
switch(state)
{
case 0:
State0();
break;
case 1:
State1();
break;
}
}
});
}
private int dummy;
private void State0()
{
try
{
dummy = Integer.parseInt(textField.getText());
state = 1; | {
"domain": "codereview.stackexchange",
"id": 3828,
"lm_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, swing",
"url": null
} |
acid-base
It continues to say
For an indicator HA ⇌ $H^+$ + $A^-$
At the end-point, [HA] = [$A^-$] and $$K_a = \frac{[H^+][A^-]}{[HA]} = [H^+]$$
I am confused why this is true. why is the expression [HA] = [$A^-$] valid? In an Acid titration, we want the end-point to be as close to the equivalence point as possible.
Different indicators have different end-points (they will change colour at different pH values).
When an end-point is reached, the colour of the indicator will change with respect to the [$H^+$] concentration of the solution it is measuring.
As [$H^+$] increases, there will be a point when [HA] = [$A^-$] and depending on the indicator used by the person doing the titration, this would be close to the calculated equivalence-point.
Note, the difference in volume between the end-point and equivalence-point is very very small, hence we can approximate the end-point as the same as the equivalence-point in any experiment. | {
"domain": "chemistry.stackexchange",
"id": 7928,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "acid-base",
"url": null
} |
while range_upper - range_lower >10**( -15) :
if value_upper * value_lower >0: #we don 't seem to have a root in this range
return('')
range_mid =( range_upper + range_lower )/2 # bisection
value_mid = EvaluatePoly ( polynomial , range_mid )
if value_mid ==0: #we have found the 0, so return itsposition
return range_mid
elif value_mid * value_lower >0: # crossing between range_mid andrange_upper
range_lower = range_mid
value_lower = value_mid
else : # crossing between range_lower and
range_mid
range_upper = range_mid
value_upper = value_mid
return range_mid
assert above>below
assert FindZeroInInterval(poly,below,above)!=OriginalFindZeroInInterval(poly,below,above)
## The Final Root Finder
Using the previous functions (and defining any additional functions that wish in the cell below), complete the function FindRealZeros which accepts a polynomial as a list and returns a list of the roots of the polynomial, in increasing order, appearing as many times as they are repeated. | {
"domain": "cocalc.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9755769049752757,
"lm_q1q2_score": 0.8925562454264588,
"lm_q2_score": 0.9149009584734676,
"openwebmath_perplexity": 4157.842828911409,
"openwebmath_score": 0.4697786271572113,
"tags": null,
"url": "https://share.cocalc.com/share/b67337a608fb9911d3a0a3330eaadd1ab39e446b/week%205/assignment/FindRoots.ipynb?viewer=share"
} |
pressure, friction, material-science
The material inside the contact arc are under vertical compression due to the rolls. But it is also highly constrained to move sideways due to friction with the rolls. So, most of the material flow is longitudinal.
The roll RPM is constant, but the speed of the bar increases during the pass. So, in the first part, the bar is slower than the rolls and the friction force in the surface is in same direction of rolling. The opposite after the neutral point. The result is building up a longitudinal compressive force in the bar that is maximum at the neutral point.
Now we have a triaxial compressive stress state. If all stresses were equal, there would be no plastic deformation. But as the friction forces have a limit, the vertical stress increases until the difference to the horizontal stress is enough to deform the material (or break the roll...). That is the reason for the friction hill. | {
"domain": "physics.stackexchange",
"id": 67465,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pressure, friction, material-science",
"url": null
} |
pytorch, gpu, torch, cuda
def init_hidden(self):
hidden = (
torch.zeros(self.num_layers,
self.batch_size,
self.hidden_size,
dtype=torch.float32
).cuda(),
torch.zeros(self.num_layers,
self.batch_size,
self.hidden_size,
dtype=torch.float32
).cuda()
)
return hidden
input_size = len(chars) # 65
hidden_size = 256
num_layers = 2
net = Net(input_size=input_size,
batch_size=batch_size,
hidden_size=hidden_size,
num_layers=num_layers
)
net = net.cuda() | {
"domain": "datascience.stackexchange",
"id": 8703,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pytorch, gpu, torch, cuda",
"url": null
} |
ibm-q-experience, experimental-realization, research
How is it possible to reverse time for few qubits and concurently to preserve flowing of time in forward direction for another qubits?
Does this mean that time flows differently for different qubits?
When do the qubits return to commnon time frame to be possible to use them in another calculation? Of course if we have unitary evolution
$$|\psi_1\rangle = U|\psi_0\rangle$$
then
$$|\psi_0\rangle = U^\dagger|\psi_1\rangle$$
I did not read the paper, but evidently the authors do something different, based on the following: the Schrödinger equation
$$i\hbar\frac{\partial\Psi}{\partial t}=\hat{H}\Psi$$
changes its form if we substitute $t\rightarrow -t$ to complex conjugate:
$$-i\hbar\frac{\partial\Psi}{\partial t}=\hat{H}\Psi$$
and its solution is also complex conjugate.
So time reversal is antiunitary operator $U_RK$ where $U_R$ is unitary and $K$ is complex conjugation. | {
"domain": "quantumcomputing.stackexchange",
"id": 1175,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ibm-q-experience, experimental-realization, research",
"url": null
} |
Hi Bunuel,
How can you tell that the triangle is an equilateral triangle?
Thanks!
Math Expert
Joined: 02 Sep 2009
Posts: 36567
Followers: 7081
Kudos [?]: 93218 [1] , given: 10553
Re: Geometry problem from QR 2nd PS145 [#permalink]
### Show Tags
25 May 2014, 13:06
1
KUDOS
Expert's post
russ9 wrote:
Bunuel wrote:
jpr200012 wrote:
The figure shown above consists of three identical circles that are tangent to each other. If the area of the shaded region is $$64sqrt{3}-32\pi$$, what is the radius of each circle?
(A) 4
(B) 8
(C) 16
(D) 24
(E) 32
Let the radius of the circle be $$r$$, then the side of equilateral triangle will be $$2r$$.
Area of the shaded region equals to area of the equilateral triangle minus area of three 60 degrees sectors. | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.950041470275424,
"lm_q1q2_score": 0.8036803932190405,
"lm_q2_score": 0.8459424334245617,
"openwebmath_perplexity": 1936.5074425007347,
"openwebmath_score": 0.80150306224823,
"tags": null,
"url": "http://gmatclub.com/forum/the-figure-shown-above-consists-of-three-identical-circles-99874.html?fl=similar"
} |
ros-melodic
<!--arm_link_2-->
<link name="arm_link_2">
<pose>0 0 0 0 0 0</pose>
<inertial>
<mass value="1.1"/>
<origin rpy="0 0 0" xyz="0 0 0"/>
<inertia
ixx = '0.011'
ixy = '0'
ixz = '0'
iyy = '0.0225'
iyz = '0'
izz = '0.0135'
/>
</inertial>
<visual name='arm_link_2_visual'>
<origin rpy="0 0 0" xyz="${link_l/2-joint_thickness*0.5} 0 0"/>
<geometry>
<box size="${link_l} ${link_b} ${link_h}"/>
</geometry>
</visual>
<collision name='arm_link_2_collision'>
<origin rpy="0 0 0" xyz="${link_l+link_l/2} 0 0"/>
<geometry>
<box size="${link_l-joint_thickness} ${link_b-joint_thickness} ${link_h}"/>
</geometry>
</collision>
</link> | {
"domain": "robotics.stackexchange",
"id": 37363,
"lm_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-melodic",
"url": null
} |
# U-substitution, Is this allowed?
1. Mar 26, 2014
### MexterO
Hi Everyone, I have a question on u-substitution it's a conceptual one.
Let's say I have the integral ∫x-y dx. where y is strictly just some constant, very simple integral.
I know the integration for that is simply (x^2)/2 - yx.
However, my classmate told me that I could use u-substitution. I told him you could either
do this in your head or use the concept of linearity for integrals. I said it would be silly to use u substitution.
I find it peculiar though since if I use u substitution on this problem I get a whole different anti-derivative.
I let u = x-y and I get du = dx, I then substitute it in and I get of course the anti derivative to be equal to ((x-y)^2)/2.
What is going on here, am I forgetting something or am I breaking a calculus rule?
Last edited: Mar 26, 2014
2. Mar 26, 2014
### pwsnafu
It isn't. The correct answer is $\frac{x^2 }{ 2} - yx +C$ for some constant $C$. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9683812309063186,
"lm_q1q2_score": 0.8211560579062032,
"lm_q2_score": 0.8479677545357568,
"openwebmath_perplexity": 473.4538255836332,
"openwebmath_score": 0.855186402797699,
"tags": null,
"url": "https://www.physicsforums.com/threads/u-substitution-is-this-allowed.745313/"
} |
human-evolution
doesn't roll off the tongue though). Science has tight estimates on the most recent mitochondrial ancestor, or "Mitochondrial Eve". To be clear: there were loads of other women alive at the time, and we inherit a lot of their non-mitochondrial DNA. Over millennia all those other women had fewer daughters, and their matrilineal lines died out. She lived about 200 thousand years ago, plus minus 20 thousand years. As a mathematical guarantee we'll never find her body or have a really tight estimate on how long ago she lived, but she's genetically guaranteed to exist. The same principle applies to patrilineal inheritance, but the estimates for the most recent ancestor of all Y-chromosomes are a little looser (200-300 thousand years ago). See here for a more detailed handling of Eve and what's going on there. | {
"domain": "biology.stackexchange",
"id": 4273,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-evolution",
"url": null
} |
parsing, f#
let hl7Seps = "|^~\\&"
let normalChar = noneOf hl7Seps
let unescape c = match c with
| 'F' -> '|'
| 'R' -> '~'
| 'S' -> '^'
| 'T' -> '&'
| 'E' -> '\\'
| c -> c
let escapedChar = attempt (pchar '\\' >>. anyChar |>> unescape .>> skipChar '\\') <|> pchar '\\'
let pHl7Element = manyChars (normalChar <|> escapedChar)
let pcomp = sepBy pHl7Element (pchar '&') |>> (fun vals -> List.mapi (fun i s -> {value = s; position = i}) vals)
let pfield = sepBy pcomp (pchar '^') |>> (fun comps -> List.mapi (fun i c -> {subcomponents = c; position = i}) comps) | {
"domain": "codereview.stackexchange",
"id": 22043,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "parsing, f#",
"url": null
} |
spacetime, physical-constants, discrete
My answer is that a possible discover of a physical limit to divisibility would not modify the way we use mathematics for modeling reality at length scales quite far from the minimum distance. It is not something new in physics. Even if we know that there are atoms, this does not imply that continuum physics has become obsolete or useless. It simply implies that we do not expect that at the scale of a few angstroms we could use a continuum description. But at a micron scale or upper, there is no doubt about the usefulness of a continuum approach.
Another example can be found in electromagnetism where the existence of an elementary charge does not hamper the usefulness of modeling the source of the electric field as a continuous charge density. | {
"domain": "physics.stackexchange",
"id": 63861,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "spacetime, physical-constants, discrete",
"url": null
} |
The correct route is working with $W=BX+(1-B)Y$ where $B\sim\text{Bernoulli}(0.25)$ and where $B,X,Y$ are independent.
• could you please detail "Now observe that the variance .. is not $\sigma^2$ .." – G Cab Feb 27 '18 at 9:54
• If $X$ and $Y$ are independent then so are $aX$ and $bX$ so that $Var(aX+bY)=Var(aX)+Var(bX)=a^2Var(X)+b^2Var(Y)$. Here $a=0.25$ and $b=0.75$. – drhab Feb 27 '18 at 9:58
• I see it now, thanks: the weighted average of two variables with same variance produces a decrease of the variance. – G Cab Feb 27 '18 at 10:27
• Indeed. You are welcome. – drhab Feb 27 '18 at 10:29 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363499098282,
"lm_q1q2_score": 0.8001348486012292,
"lm_q2_score": 0.8128673178375734,
"openwebmath_perplexity": 160.86405866708088,
"openwebmath_score": 0.9522947072982788,
"tags": null,
"url": "https://math.stackexchange.com/questions/2668742/probability-of-mixture-of-normal-random-variables"
} |
Lets try to compute "partial partition" $p_m^k(N), \ k\geqslant 1$ of $N$ on exactly $m$ summands with each summand not less than $k$. First of all if $m*k>N$ then $p_m^k(N)=0$. Note that $p_m^1(N)=p_m(N)$. Assume that $m*k\leq N$. Imagine constant sequence $(a_i)_{i=1}^{m}$ with $a_i=k-1$ for all $i$. If we add (position-wise) some nondecreasing sequence of positive integers $(b_i)_{i=1}^{m}$ that sums up to $N-m*(k-1)$ (in other words any $m$-element partition of the number $r=N-m*(k-1)$), then resulting sequence $(c_i)_{i=1}^{m},\ \ c_i=a_i+b_i$ will be nondecreasing, $c_i\geqslant k$ for all $i$ and $\sum_{i=1}^{m}c_i=N$. Therefore sequence $(c_i)_{i=1}^{m}$ is $m$-element partition of $N$. Notice that above reasoning fixes one-to-one correspondence between $m$-element partition of $N-m*(k-1)$, and $m$-element partition of $N$ with summands $\geqslant k$. Thus $p_m^k(N)=p_m(N-m*(k-1))$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9916842229971374,
"lm_q1q2_score": 0.8242314517626516,
"lm_q2_score": 0.8311430520409023,
"openwebmath_perplexity": 145.42727660799628,
"openwebmath_score": 0.968553900718689,
"tags": null,
"url": "https://math.stackexchange.com/questions/2069639/partition-with-minimum-size-of-parts"
} |
artificial-intelligence
$P$ is the set of atomic ground formulas;
$O$ is the set of operators (actions); an operator $a \in O$ has the form $Pre \Rightarrow Post$, where $Pre$ is a satisfiable conjuction of positive ($a^+$) and negative preconditions ($a^-$) of the operator; $Post$ is a satisfiable conjunction of positive ($a_+$) and negative ($a_-$) postconditions of the operator ($a_+$ is called the add list, $a_-$ is called the delete list);
$I \subseteq P$ is the initial state;
$G = \langle G_+, G_- \rangle$, called the goals, is a satisfiable conjunction of positive and negative conjunctions;
the state $S$ is a subset of $P$.
The result of applying operator (action) $a$ on state $S$ is:
$(S \cup a_+) \setminus a_-\quad$ if $a^+ \subseteq S$ and $S \cap a^- = \emptyset$
$S$ otherwise | {
"domain": "cs.stackexchange",
"id": 1715,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "artificial-intelligence",
"url": null
} |
c++, validation
}
else //THESE ARE PROCESSED WHEN SCORES
{ //ENTERED ARE 100 OR LESS
//update accumulator, then get another score
totalPoints += score;
cout << "Next score (-1 to stop): ";
cin >> score;
} //end if
} //end while
//determine grade
if (totalPoints >= 315)
grade = 'A';
else if (totalPoints >= 280)
grade = 'B';
else if (totalPoints >= 245)
grade = 'C';
else if (totalPoints >= 210)
grade = 'D';
else
grade = 'F';
//end if
//display the total points and grade
cout << "Total points earned: " << totalPoints << endl;
cout << "Grade: " << grade << endl; | {
"domain": "codereview.stackexchange",
"id": 18486,
"lm_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++, validation",
"url": null
} |
python, cs50
if not cur_shares[0]["total"] or cur_shares[0]["total"] < shares:
return apology("You don't own enough shares of this stock.")
if shares < 0:
return apology("You can't sell negative shares.")
# Update user's cash balance
stock_info = lookup(symbol)
profit = shares * stock_info["price"]
update_cash(retrieve_cash() + profit)
record_transaction(stock_info, -shares, "sold")
flash("Sold!")
return redirect("/")
stocks = db.execute(
"""
SELECT DISTINCT(symbol) AS symbol
FROM transactions
WHERE user_id = ?
GROUP BY symbol
HAVING SUM(shares_amount) > 0
""",
session["user_id"],
)
# User reached route via GET (as by clicking a link or via redirect)
return render_template("sell.html", stocks=stocks) | {
"domain": "codereview.stackexchange",
"id": 45084,
"lm_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, cs50",
"url": null
} |
filters, lowpass-filter, infinite-impulse-response, c
Note that the 'EDIT' part of the answer quoted above also explains where the inaccurate formula for the cut-off frequency comes from. The following figure shows the resulting cut-off frequency of the filter as a function of the desired cut-off frequency when the exact formula $(1)$ is used and when the approximation is used:
Clearly, the approximation is quite bad and it only kind of works for very small cut-off frequencies. I see no reason why it should be used at all. | {
"domain": "dsp.stackexchange",
"id": 4352,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filters, lowpass-filter, infinite-impulse-response, c",
"url": null
} |
code-generation
becomes:
function cps(cont) {
foo(1, function(a) {
bar(a, cont);
}
}
But are there any descriptions of the reverse transformation, where the CPS representation is taken back to a direct style? I did some additional research to answer this question but find nothing better suited.
To do reverse of CPS to direct programming you have to assign functions to variables, this makes direct structural code.
Automated and well described technique comes from compilers - SSA (Single Static Assignment).
This has additional bonus like compacting code and constant propagating to some extend.
This is not per se technique to reverse CPS, but structure of assignments creates direct code, so it is usable in your situation. | {
"domain": "cs.stackexchange",
"id": 15648,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "code-generation",
"url": null
} |
quantum-mechanics, hilbert-space, wavefunction, quantum-states
$$\mathcal{H} = \left \{ |\psi\rangle\ \middle|\ \int dx\ |\langle x | \psi \rangle|^2 < \infty \right \}.$$
This definition may seem to single out the position basis as special, but actually it doesn't: by Plancherel's theorem, you get the exact same Hilbert space if you consider the square-integrable momentum wave functions instead.
So while "the Hilbert space of square integrable wave functions" is a mathematical Hilbert space, you are correct that technically it is not the "physics Hilbert space" of quantum mechanics, as physicists usually conceive of it.
I think that in mathematical physics, in order to make things rigorous it's most convenient to consider functional Hilbert spaces instead of abstract ones. So mathematical physicists consider the position-basis functional Hilbert space as the fundamental object, and define everything else in terms of that. But that's not how most physicists do it. | {
"domain": "physics.stackexchange",
"id": 54423,
"lm_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, hilbert-space, wavefunction, quantum-states",
"url": null
} |
• Better than accepted answer. Did you use bijective anywhere? – BCLC Aug 18 '15 at 12:56
• Btw what exactly are b and a? I suspect that that is where bijection is used – BCLC Aug 18 '15 at 12:58
• I only used the bijection to get that $f^{-1}$ exists. In this answer, $a$ and $b$ are arbitrary (satisfying the condition that $f(b)=a$). (The accepted answer is quite clean and provides insight on how to solve other similar questions.) – Michael Burr Aug 18 '15 at 13:03
• googles more on bijection Strange. It seems that the fact of declaring the existence of $f^{-1}$ should be sufficient to mean that the function is bijective. Anyway, you mean repeated compositioning can solve other similar questions? – BCLC Aug 18 '15 at 13:08
First, as others have noted, we must have $f(0) = 0$. Let us now "construct" such a function on $\mathbb R^{*}$ using the Axiom of Choice. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9830850897067341,
"lm_q1q2_score": 0.8487874252543626,
"lm_q2_score": 0.863391617003942,
"openwebmath_perplexity": 210.3892052119001,
"openwebmath_score": 0.9285292625427246,
"tags": null,
"url": "https://math.stackexchange.com/questions/1400217/proving-that-a-function-is-odd/1400255"
} |
python, iterator, reflection, variadic
Title: Sleeping and invoking a task in Python 2.X and Python 3.X I'm writing a program that needs to be compatible for both Python 2.X and Python 3.X. My problem is that, because of the differences between these two versions, I'm duplicating code.
try:
### Python 2.X part
time.sleep(iterator.next())
if len(arguments) >= len(inspect.getargspec(task).args):
task(*arguments)
else:
print("ERROR: There is a mismatch between the number of"
" arguments provided in `arguments` and the ones"
" needed by the task function.")
except AttributeError:
### Python 3.X part
time.sleep(next(iterator))
if len(arguments) >= len(inspect.getfullargspec(task).args):
task(*arguments)
else:
print("ERROR: There is a mismatch between the number of"
" arguments provided in `arguments` and the ones"
" needed by the task function.") | {
"domain": "codereview.stackexchange",
"id": 24315,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, iterator, reflection, variadic",
"url": null
} |
A not so elegant way would be to determine the vertices of $P_1$ and plug them into the constraints for $P_2$, if each vertex satisfies the $P_2$ constraints, then by convexity, so does the entire polyhedron.
As pointed out by @D.W., this approach will typically be very slow, as the number of vertices increases rapidly with the number of edges. Michael Grant's approach, as stated above and accepted, has faster running time. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9688561685659695,
"lm_q1q2_score": 0.8135814364765799,
"lm_q2_score": 0.8397339696776499,
"openwebmath_perplexity": 424.14155341455216,
"openwebmath_score": 0.7558237910270691,
"tags": null,
"url": "https://math.stackexchange.com/questions/1343280/how-to-check-whether-a-convex-polyhedron-is-contained-in-another-convex-polyhedr"
} |
infinite-impulse-response, oscillator
Since I only have a single second order section in my oscillator, I'm using only one section as shown on the picture.
I set the coefficients to be:
$b_0=0.0674923$, $b_1=0$, $b_2=0$
$a_1=-1.9954464$, $a_2=1$
When I start executing this filter, the output is unstable and quickly goes to infinity. Manually experimenting with the parameter $r$, I managed to get a slowly decaying response with $r=0.5$. I suspect that what I'm seeing are the results of the MCU being only able to work with 32bit floating point numbers and lacking precision.
So my question is: How do I model the oscillator while taking into account the numerical precision errors? i'll try to simplify what you have here. so, being an oscillator, there is no input, only output. but you can think of it as a filter (with zero states) with an impulse as input. but that impulse essentially sets the states of your filter and the rest of the input is zero. | {
"domain": "dsp.stackexchange",
"id": 1779,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "infinite-impulse-response, oscillator",
"url": null
} |
c, linked-list
list_pos_insert()
list_head_insert()
list_tail_insert()
list_pos_remove()
list_head_remove()
list_tail_remove()
list_sort()
list_reverse()
Just let me know if something is unclear, codereview "forgot" half of my text so I rushed it a bit to write it down again. | {
"domain": "codereview.stackexchange",
"id": 39236,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, linked-list",
"url": null
} |
motor, electronics, power
Title: Why does our LM2576 circuit suddenly cut down the power? I have an LM2576 circuit plus an adjuster to adjust the output voltage, for controlling motor speed in a line follower robot. The circuit works great when adjusted to give out low voltages, but when I adjust it to higher voltages for my motors to go faster, it works great for 1-2 minutes, then suddenly cuts down the power and motors start to go extremely slow.
Even when I decrease or increase the output voltage, it won't respond until I turn off the power and turn it back on again. There is something mentioned in the LM2576 datasheet that if we overload the IC it will cut down the power until the load comes lower, so I think it might be a problem with that.
Since this problem has already caused us to lose the competitions with 5+ teams, I would like to solve it for our next competition, so why does our LM2576 circuit suddenly reduce the power? If I were you, I would first (1) read the LM2576 datasheet. | {
"domain": "robotics.stackexchange",
"id": 72,
"lm_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, electronics, power",
"url": null
} |
gazebo-7
Both lasers on. Only the rear one seems to be working
How gazebo shows only one laser. The other laser is positioned on top left corner of the robot
The glitch. The one laser that was working is still showing as well. The shifted laser seems to be the combined laser showing the full 360 view but it is rotated 180 | {
"domain": "robotics.stackexchange",
"id": 4531,
"lm_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-7",
"url": null
} |
If the line has equation $y=mx+q$ one just adds first a translation by $-iq$ and last a translation by $iq$: $$z\mapsto z-iq\mapsto \bar{u}(z-iq)\mapsto \overline{\bar{u}(z-iq)}\mapsto u\overline{\bar{u}(z-iq})\mapsto u\overline{\bar{u}(z-iq})+iq$$ and, finally, $$z\mapsto u^2\bar{z}+iq(1+u^2)$$ Note that $1+u^2=1+\cos2\alpha+i\sin2\alpha=\dfrac{2}{1+m^2}+i\dfrac{2m}{1+m^2}$ so the equation is $$(x,y)\mapsto \left(\frac{(1-m^2)x+2my-2mq}{1+m^2},\frac{2mx-(1-m^2)y+2q}{1+m^2} \right)$$ In the present case $m=1/2$ and $q=1/2$, so, just by substituting, $$(3,-3)\mapsto (-1,5)$$
Of course this is overkill if you just want to know the image of one point, but I believe the method well illustrates the power of complex numbers.
• Whew that's pretty darn neat – Vrisk Nov 2 '17 at 14:09
• @Vrisk Last week I assigned the task to my students in the “mathematics teaching” course, telling them to “think to this complex problem”. – egreg Nov 2 '17 at 14:16
Here is one way: there are many others. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9715639636617015,
"lm_q1q2_score": 0.8158552698465467,
"lm_q2_score": 0.8397339756938818,
"openwebmath_perplexity": 280.8804969471603,
"openwebmath_score": 0.8037258982658386,
"tags": null,
"url": "https://math.stackexchange.com/questions/1013230/how-to-find-coordinates-of-reflected-point/1013242"
} |
python, pandas, efficiency, parallel, jaccard-coefficient
Any help would be appreciated very much! Your function does a lot of pythonic data crunching. In these cases numba can be useful.
In the below code I split your function into two: sorting and scoring. I then converted your bigrams from strings to integers (to comply with numba datatypes) and decorated the scoring subfunction with numba's @autojit.
from numba import autojit
import numpy as np
def dice_coefficient(a,b):
try:
if not len(a) or not len(b): return 0.0
except:
return 0.0
if a == b: return 1.0
if len(a) == 1 or len(b) == 1: return 0.0
a_bigram_list = [a[i:i+2] for i in range(len(a)-1)]
b_bigram_list = [b[i:i+2] for i in range(len(b)-1)]
a_bigram_list.sort()
b_bigram_list.sort() | {
"domain": "datascience.stackexchange",
"id": 1258,
"lm_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, pandas, efficiency, parallel, jaccard-coefficient",
"url": null
} |
The complexity of bendless three-dimensional orthogonal graph drawing. D. Eppstein. J. Graph Algorithms and Applications 17 (1): 35–55, 2013. http://dx.doi.org/10.7155/jgaa.00283
I don't think I included the quadratic example suggested in daniello's answer in this paper, but you can find it in one of my blog posts from ten years ago, https://11011110.github.io/blog/2006/06/09/topology-of-xyz.html (see the ETA at the bottom).
Incidentally, the same construction (points with coordinate sum 0 or 1) in the 3d integer lattice, without the mod $n$ part, produces a lattice embedding of the hexagonal tiling of the plane. Doing the same thing in 4d, similarly, produces a lattice embedding of the 3d diamond lattice. See another of my papers:
Isometric diamond subgraphs. D. Eppstein. 16th Int. Symp. Graph Drawing, LNCS 5417, 2009, pp. 384–389. https://arxiv.org/abs/0807.2218 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429624315189,
"lm_q1q2_score": 0.8039561161703979,
"lm_q2_score": 0.8175744850834648,
"openwebmath_perplexity": 186.02721030541286,
"openwebmath_score": 0.8159384727478027,
"tags": null,
"url": "https://cstheory.stackexchange.com/questions/38462/lower-bound-on-the-largest-restrained-cubic-subset"
} |
quantum-mechanics, solid-state-physics, coulombs-law, electronic-band-theory, pauli-exclusion-principle
The key to the answer lies in the $V_{ne}$ term, i.e. the coulomb interaction between nuleus-electron.
First case: if the electrons have opposite spins, then they're allowed to get close to each other, and this means that the one closer to the nucleus will now screen the other electron from the nucleus and meaning the electron bit further away will experience a smaller effective nuclear charge, which results in this electron being weakly bound, not favorable!
Second case: Now if their spins are aligned, due to Pauli exclusion principle, they cannot get as close to each as before, in particular neither of the electrons can get inside the other one's orbit, hence no more screening effect on the nucleus! Consequently we say both electrons here are strongly bound, favorable! Because it means the overall energy is lowered by having both electrons' spins aligned. Hund's first rule! | {
"domain": "physics.stackexchange",
"id": 30289,
"lm_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, solid-state-physics, coulombs-law, electronic-band-theory, pauli-exclusion-principle",
"url": null
} |
java, fluent-interface
Finally I decide to make my own version of "Builder Pattern", which follows the first link above, with some modifications:
The static method Pizza.makePizza() acts as the Director.
For simplicity, I didn't make the Factory a factory method or abstract factory, but it can be without problem.
Before you want to make a pizza, you have to override some methods, which you can put anything must be done before the pizza is created.
Main.java
public class Main {
public static void main(String[] args) throws InterruptedException {
Factory myFactory = new Factory();
Pizza myPizza = Pizza.makePizza(new Pizza.Builder(myFactory) {
@Override
public void prepareDough() {
myFactory.prepareDough();
}
@Override
public void prepareToppings() {
myFactory.prepareToppings();
}
}.withSize(20).withBacon().withPepperoni());
System.out.println(myPizza);
}
} | {
"domain": "codereview.stackexchange",
"id": 25072,
"lm_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, fluent-interface",
"url": null
} |
so I get $$b^2 + 5b -6 = 0$$
$b= 1$ and $b=-6$ by solving the quadratic equation.
-
If the book is asking for the sum of the absolute values, as your title suggests, then 7 is the correct answer. If the book is asking for the absolute value of the sum, then 5 is correct. – Old John Jun 25 '12 at 9:28
The numbers are wrong: $1\cdot(-6)=-6\neq6$. Also, the difference between $1$ and $-6$ is $7$, not $5$. – Jyrki Lahtonen Jun 25 '12 at 9:31
So they are - I assumed he had at least done that bit right! – Old John Jun 25 '12 at 9:32
Sorry i was suppose to enter those values back in the equation. – Rajeshwar Jun 25 '12 at 9:40
Your solution of the quadratic is correct, which means that the smaller of the two numbers is either -6 or 1. In the first case, the two numbers would be -6 and -1, whereas in the second case, the numbers would be 1 and 6. In either case, the sum of the absolute values and the absolute value of the sum are both equal to 7. – Old John Jun 25 '12 at 9:43 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9678992951349231,
"lm_q1q2_score": 0.8107317779862948,
"lm_q2_score": 0.8376199694135333,
"openwebmath_perplexity": 151.08421146525924,
"openwebmath_score": 0.869737982749939,
"tags": null,
"url": "http://math.stackexchange.com/questions/162774/sum-of-absolute-values"
} |
java, optimization, performance
My variable names are not good because I have no idea what this is all about. Anyway, at this stage, there almost no check related to isLeft anymore.
Then, a little detail I noticed is that rightChild is not used sometimes so we can avoid getting it in the first place by noticing that we could move the variables introduced previously (the check on isLeft ensures that we consider the right value) :
for( BinaryRule rule : rules ) {
int state1 = isLeft ? rule.rightChild : state;
int state2 = isLeft ? state : rule.leftChild;
if( isLeft ) {
narrowL = narrowLExtent_end[ state1 ];
// can this right constituent fit next to the left constituent?
if( narrowL < narrowR ) {
continue;
}
}
else {
narrowR = narrowRExtent_start[ state2 ];
if( narrowR > narrowL ) {
continue;
}
} | {
"domain": "codereview.stackexchange",
"id": 3447,
"lm_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, optimization, performance",
"url": null
} |
## Solution 1
Number the squares $0, 1, 2, 3, ... 2^{k} - 1$. In this case $k = 10$, but we will consider more generally to find an inductive solution. Call $s_{n, k}$ the number of squares below the $n$ square after the final fold in a strip of length $2^{k}$.
Now, consider the strip of length $1024$. The problem asks for $s_{941, 10}$. We can derive some useful recurrences for $s_{n, k}$ as follows: Consider the first fold. Each square $s$ is now paired with the square $2^{k} - s - 1$. Now, imagine that we relabel these pairs with the indices $0, 1, 2, 3... 2^{k - 1} - 1$ - then the $s_{n, k}$ value of the pairs correspond with the $s_{n, k - 1}$ values - specifically, double, and maybe $+ 1$ (if the member of the pair that you're looking for is the top one at the final step).
So, after the first fold on the strip of length $1024$, the $941$ square is on top of the $82$ square. We can then write
$$s_{941, 10} = 2s_{82, 9} + 1$$ | {
"domain": "artofproblemsolving.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985271387015241,
"lm_q1q2_score": 0.8032252455237326,
"lm_q2_score": 0.815232489352,
"openwebmath_perplexity": 403.22091766107854,
"openwebmath_score": 0.9745649099349976,
"tags": null,
"url": "https://artofproblemsolving.com/wiki/index.php?title=2004_AIME_II_Problems/Problem_15&diff=prev&oldid=71522"
} |
analog
do the sound waves it produces have the same quality and nature as the ones that could natively be produced by huge speakers?
Not at all. It sounds pretty bad.
would allegedly be used by most good quality bluetooth speakers nowadays.
Nope. Good quality and "fake bass" do not go together well. | {
"domain": "dsp.stackexchange",
"id": 11311,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "analog",
"url": null
} |
quantum-algorithms, mathematics, grovers-algorithm, complexity-theory, nielsen-and-chuang
For example, the Deutsch-Jozsa algorithm uses the Hadamard transform to distinguish a constant function from a balanced function. Similarly as described in the question it appears that we have oracle access to a Boolean function $f$:
$$f:\{0,1\}^n \mapsto \{0,1\}$$
with a promise on the coefficients of the Fourier transform, that either:
$$\hat{f}(00...0)=\sqrt{2/3},$$
e.g. $f$ is nearly constant on its codomain, or
$$\hat{f}(11...1)=\sqrt{2/3},$$
e.g. $f$ has a high frequency. There is no promise on other Fourier coefficients. Our task is to determine whether $f$ is constant or is high frequency. | {
"domain": "quantumcomputing.stackexchange",
"id": 2544,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-algorithms, mathematics, grovers-algorithm, complexity-theory, nielsen-and-chuang",
"url": null
} |
quantum-mechanics, quantum-field-theory, quantum-electrodynamics, research-level
Title: Faddeev-Kulish Asymptotic Dynamics Question I am reading a paper by Faddeev and Kulish ("Asymptotic conditions and infrared divergences in QED" written in 1970) and I have a question regarding the nonrelativistic problem of Coulomb scattering. The authors claim that in the nonrelativistic Coulomb scattering, the potential can be expanded in powers of the $t$, where $t$ is the time which is present in the Coulomb potential through the substitution of the distance $r$ between the scattering particle and the scatterer, which is given by
$$\hat{r}(t)=\frac{\hat{p}}{m}+\hat{r},$$
where $\hat{r}$ and $\hat{p}$ are time independent operators in QM. The expansion goes as follows
$$V(t)=\frac{mg}{pt}+\mathcal{O}(t^{-2})$$ | {
"domain": "physics.stackexchange",
"id": 87214,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-field-theory, quantum-electrodynamics, research-level",
"url": null
} |
thermodynamics
Think of the equilibrium from the point of view of detailed balance. In (ideal) gases, the pressure on a surface is proportional to the number of molecules that impact on a unit area of the surface per unit of time. The equality of partial pressures of the gas A is thus equivalent to requiring that the numbers of molecules of A impacting on the membrane are the same on both sides of the membrane. If this were not the case, then there would be net transport of the gas A through the membrane (assuming that the membrane is symmetric with respect to the transport of molecules from one side to the other), in contradiction to the assumption that the system is in equilibrium. | {
"domain": "physics.stackexchange",
"id": 63250,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics",
"url": null
} |
Possible for the mean value theorem to apply u is continuously differentiable function a ) {! A … // Last Updated: January 22, 2020 - Watch Video.. The power of calculus when working with it as it crosses the y-axis on graph... To download version 2.0 now from the Chrome web Store has partial derivatives were the problem •! Wikipedia 's Smooth functions: the class C0 consists of all, continuous... When we are able to find the corresponding points ( in a (! The three instances where a function to be differentiable, then f is continuous ’... Both sides what did you learn to do when you were first about. The partial derivatives were the problem is true that are continuous functions have continuous derivatives Using the mean value to! Is called the derivative of f with respect to x ( ( 4x^2 ) ). Power of calculus when working with it is true that concept in calculus because it links. Have an essential discontinuity download version 2.0 now from the Chrome web Store 6095b3035d007e49 • IP. … | {
"domain": "com.mx",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9773707973303966,
"lm_q1q2_score": 0.8207314614492937,
"lm_q2_score": 0.8397339716830606,
"openwebmath_perplexity": 226.08973867728454,
"openwebmath_score": 0.8623834252357483,
"tags": null,
"url": "http://g2ingenieria.com.mx/glen-durrant-tzulfx/differentiable-vs-continuous-derivative-7be835"
} |
python, keras, accuracy
Predict results:
y_pred = classifier.predict(X_test)
I have attached the test set results where result probabilities can be seen with respect to frequency. blue shows probabilities for 1 and orange for 0 | {
"domain": "datascience.stackexchange",
"id": 3765,
"lm_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, keras, accuracy",
"url": null
} |
control-engineering, control-theory, pid-control
Thoughts of my own
There are systems where an overshooting control behavior can be tolerated. Like if a robot needs to stay on a specific path on the way to its destination with a given tolerance. A controller that controls the distance to this given path can let the robot wiggle a little around the given trajectory as long as it keeps it inside the tolerance. But if you can design a controller with an asymptotic converge to its trajectory you would prefer it to get rid of this wiggle. I can’t think of any real application where you would prefer an overshooting controller over an asymptotic one if you had the choice. For some systems, the salient criterion is settling time to within some error band. Sometimes you can get faster settling by allowing earlier overshoot. | {
"domain": "engineering.stackexchange",
"id": 946,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "control-engineering, control-theory, pid-control",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.