text stringlengths 1 1.11k | source dict |
|---|---|
javascript
}
if ($scope.data.depositAccountNumber.length < 8) {
if (sortcodeError != null) {
document.getElementById("sortcodeError").disabled = true;
}
if (accountnameError != null) {
document.getElementById("accountnameError").disabled = true;
// angular.element($('#btnSubmi')).addClass("gray");
}
}
} | {
"domain": "codereview.stackexchange",
"id": 38076,
"lm_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",
"url": null
} |
general-relativity, spacetime, differential-geometry, curvature
Update This question was closed as a duplicate of the following: Question 1, Question 2, Question 3.
While they are somewhat related to my question, they still ask for a different question, namely the following:
Question 1: Is your 3-dimensional universe part of the surface of a 4-dimensional sphere [like in the ant-sphere analogy] that we cannot perceive or access?
Question 2: The correctness of the bend-sheet-analogy for GTR
Question 3: Could the universe be bend over a forth dimension to form a 4-dimensional shphere?
The essence of my question was: When we refer to the shape of the universe (being flat for example), do we mean the same curvature as in GTR? No, your belief is not correct. We do not, at least in General Relativity (GR), embed our spacetime in a higher dimensional space (or like you said in 4 dimensions of space). | {
"domain": "physics.stackexchange",
"id": 69071,
"lm_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, differential-geometry, curvature",
"url": null
} |
natural-language-processing, recurrent-neural-networks, long-short-term-memory, transformer
However, if you are asking handling the various input size, adding padding token such as [PAD] in BERT model is a common solution. The position of [PAD] token could be masked in self-attention, therefore, causes no influence. Let's say we use a transformer model with 512 limit of sequence length, then we pass a input sequence of 103 tokens. We padded it to 512 tokens. In the attention layer, positions from 104 to 512 are all masked, that is, they are not attending or being attended. | {
"domain": "ai.stackexchange",
"id": 3632,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "natural-language-processing, recurrent-neural-networks, long-short-term-memory, transformer",
"url": null
} |
ros, planning-scene, arm-navigation
if(!set_planning_scene_diff_client.call(planning_scene_req, planning_scene_res)) {
ROS_WARN("Can't get planning scene");
return -1;
}
// define the service messages
kinematics_msgs::GetKinematicSolverInfo::Request request;
kinematics_msgs::GetKinematicSolverInfo::Response response;
if(query_client.call(request,response))
{
for(unsigned int i=0; i< response.kinematic_solver_info.joint_names.size(); i++)
{
ROS_DEBUG("Joint: %d %s",i,response.kinematic_solver_info.joint_names[i].c_str());
}
}
else
{
ROS_ERROR("Could not call query service");
ros::shutdown();
exit(-1);
}
// define the service messages
kinematics_msgs::GetConstraintAwarePositionIK::Request gpik_req;
kinematics_msgs::GetConstraintAwarePositionIK::Response gpik_res;
gpik_req.timeout = ros::Duration(5.0);
gpik_req.ik_request.ik_link_name = "r_wrist_roll_link"; | {
"domain": "robotics.stackexchange",
"id": 6958,
"lm_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, planning-scene, arm-navigation",
"url": null
} |
quantum-mechanics, thermodynamics, statistical-mechanics, entropy, hamiltonian-formalism
Now, obviously $\rho(t_B)$ is consistent with macrostate $B$ but $I[\rho(t_B)]$ is not necessarily the maximum possible value of $I$ for all $\rho$'s compatible with the macrostate $B$.
The probability density that is not only consistent with macrostate $B$ but also maximizes information entropy is, in general, different from $\rho(t_B)$. Let us denote this maximizing density as $\rho_B$; then the relation of the two information entropies is
$$
I[\rho_B] \geq I[\rho(t_B)].
$$
Now, based on (2) we can write this as
$$
S_B \geq I[\rho(t_B)],
$$
that is, thermodynamic entropy in the final equilibrium state is higher or equal to information entropy of the evolved probability distribution.
Based on (1) we can write this also as
$$
S_B \geq I[\rho(t_A)].
$$ | {
"domain": "physics.stackexchange",
"id": 30805,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, thermodynamics, statistical-mechanics, entropy, hamiltonian-formalism",
"url": null
} |
quantum-mechanics, photon-emission, fluorescence
Immediately after illumination of quartz or feldspar samples by green light from a laser, there is phosphorescence (optically stimulated phosphorescence, OSP), with a lifetime of a few seconds, the size of the signal being dependent on radiation dose. For both minerals there is also charge transfer into low temperature TL peaks, the amount of transfer being dependent on dose.
https://www.sciencedirect.com/science/article/abs/pii/0277379188900376
To address and overcome the difficulties associated with the increased reactivity and susceptibility of blue emitters to deactivation pathways arising from the high-lying triplet excited states, we have successfully demonstrated an innovative strategy of harvesting triplet emission via the “thermally stimulated delayed phosphorescence” mechanism, where thermal up-conversion of excitons from the lower-energy triplet excited states (T1) to higher-energy triplet excited states (T1′) are observed to generate blue emission. | {
"domain": "physics.stackexchange",
"id": 60982,
"lm_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, photon-emission, fluorescence",
"url": null
} |
navigation, sensor-fusion, ekf, tf2, navsat-transform
This is set in the urdf files of the robot, rather than being broadcast by another node. The Z offset is correct, because it includes the distance between the center of the receiver and the phase center, and because I've checked the Z offset by placing the robot and receiver over a control point (the vertical error was within the natural error of the receiver). The horizontal offset should be correct as well, because the offset is the same as the rear mount on the Jackal model, and these frames appear to match in the horizontal plane in RViz. And navsat_transform should be using the correct frame thanks to this line in navsat_transform
Regarding bagfiles and data logging. The error is only up to 30cm or so, so if anyone is using a receiver that's only accurate to a meter, it will probably get lost in the natural error of the receiver. If you want more bagfiles to test, here are a few more (relatively short) ones:
square_path
rotate_on_spot | {
"domain": "robotics.stackexchange",
"id": 25552,
"lm_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, sensor-fusion, ekf, tf2, navsat-transform",
"url": null
} |
special-relativity, spacetime, time-dilation
Alice wants to determine the elapsed time on her clock from event O to distant event Q.
Alice uses the elapsed proper time on her clock from event O to local event P (on her worldline) since Alice says "events P and Q are simultaneous" (i.e., spacelike segment $PQ$ is Minkowski-perpendicular to the timelike segment $OP$ on her worldline).
As a Minkowski right triangle, $OQ$ is the hypotenuse, $OP$ is the adjacent side, and $PQ$ is the opposite side. The velocity $\beta=(PQ)/(OP)=\tanh\theta$, where $\theta$ is the rapidity [angle] between worldlines. The time dilation factor is $\gamma=\cosh\theta$.
So, time dilation uses the fact that the adjacent side $OP$ is larger than the hypotenuse $OQ$ in Minkowski spacetime geometry. (Recall $\cosh\theta \geq 1$.)
In symbols [with extra notation for clarity],
$$
\begin{eqnarray*}
(t_{Q}^{Alice}-t_{O}^{Alice})=
\Delta t_{OQ}^{Alice}
= \Delta t_{OP}^{Alice}
&=& \tau_{OP} \\
&=& \cosh\theta\ \tau_{OQ} \\
&=& \gamma\ \tau_{OQ} \\ | {
"domain": "physics.stackexchange",
"id": 50484,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, spacetime, time-dilation",
"url": null
} |
atmosphere, meteorology, climate, nwp, climate-models
Because the short range weather prediction model is typically of much higher resolution than climate models (~1-10 km versus ~50-200 km), it is almost always more skilled at simulating clouds forming at a specific location and time. Cloud and rain prediction skill tends to be greater in synoptic scale fronts and near topographic features, and smaller for sporadic, small-scale, tropical thunderstorms. In very high-resolution NWP models (2-3 km or smaller), convection and clouds may be simulated reasonably well without using any cloud parameterization scheme. Nevertheless, clouds and rainfall are still hard to simulate or forecast very accurately. | {
"domain": "earthscience.stackexchange",
"id": 85,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "atmosphere, meteorology, climate, nwp, climate-models",
"url": null
} |
quantum-mechanics, electric-circuits, superconductivity, hamiltonian
https://arxiv.org/abs/cond-mat/0508588 (see Eq. 7, and 12-15)
https://arxiv.org/abs/1009.4470 (3rd last paragraph) I suspect your confusion comes from the fact that the unitary transformation $U$ you are applying depends of $\lambda$.
When you compute transition rates, you are looking at a decomposition of your state vector as:
$$\left| \psi \right\rangle =: \sum_k \psi_k(t) e^{-ikt} \left|k\right\rangle$$
where $\left|k\right\rangle$ are the eigenvectors of $H(\lambda_o)$. The transition rates govern the time-evolution of the $\psi_k(t)$:
$$\frac{d\psi_k}{dt}(t) = -i \sum_l \left\langle k \middle| \delta H \middle| l \right\rangle \psi_l(t) e^{i(k-l)t}$$
and $\delta H = H(\lambda) - H(\lambda_o)$ is the difference between the Hamiltonian $H(\lambda)$ under which $\left|\psi\right\rangle$ evolves and the unperturbed Hamiltonian $H(\lambda_o)$ whose eigenvectors are the $\left|k\right\rangle$. | {
"domain": "physics.stackexchange",
"id": 40174,
"lm_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, electric-circuits, superconductivity, hamiltonian",
"url": null
} |
c++, beginner, calculator
They suggest using two vectors for this; one of student names and one of grades, although I expanded slightly on that to take into account the different grades (midterms, finals and homework). I've also opted to calculate the grades after receiving all input in order to separate the code that gets and stores input from the code that performs calculations.
Here's a full copy of the program as it stands (110 lines). I'm looking for any feedback on style, correctness, language traps I may have accidentally fallen into, and really anything in general that you think may be of use.
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::streamsize;
using std::string;
using std::vector; | {
"domain": "codereview.stackexchange",
"id": 25929,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, beginner, calculator",
"url": null
} |
homework-and-exercises, newtonian-mechanics, moment-of-inertia
Title: Finding the moment of inertia of a lever I am required to find the moment of inertia of the lever for a project in physics. This is my attempt:
Please note that we have not been taught this yet in class so i have not been taught this officially yet.
The seperate radiuses are the distance from the fulcrum to the end of each side of the lever.
$L = 1.57m$
$r_1 = .97m$
$r_2 = .6m$
$M_{total} = 2.3 kg$
$$
I = \frac{M_{total}}{L}\int_{0}^{.97} x^2 dx + \frac{M_{total}}{L} \int_{0}^{.6} x^2 dx
$$
$$
I = \frac{M_{total}}{L}[\frac{.97^3+.6^3}{3}]
$$
$$
I = \frac{2.3(.97^3+.6^3)}{4.71} = \frac{165347}{300000}
$$
But this seems way too easy? Am i doing something wrong? Yes, you did it good, and it is that easy. The expression is correct because you have:
$I = \int x^2 dm = \int x^2 \rho dx = \rho \int x^2 dx= \frac{M_{total}}{L} \int x^2 dx $ | {
"domain": "physics.stackexchange",
"id": 18070,
"lm_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, moment-of-inertia",
"url": null
} |
neural-networks, gradient-descent
Extra note: | {
"domain": "ai.stackexchange",
"id": 3225,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-networks, gradient-descent",
"url": null
} |
Angles and area of a triangle defined on a sphere?
Consider the spherical triangle $\mathcal{P}$ with vertices $P_1 = (1,0,0)$, $P_2 = (0,1,0)$ and $P_3 = (1/\sqrt{3}, 1/\sqrt{3},1/\sqrt{3})$. Find the angles $\phi_1, \phi_2, \phi_3$ of $\mathcal{P}$ at $P_1, P_2, P_3$ respectively.
My first question: what's the relation between cartesian to spherical coordinate change $(x,y, z)$ $= (r\sin \theta \cos \phi, r \sin\theta \sin \phi, r \cos \theta)$ and angles of the spherical triangle?
How do I find $\phi_1, \phi_2, \phi_3$? I've calculated $\theta$ from $r\cos{\theta} = 0$ which resulted in $\theta = \pi/2$.
But I suspect my $\theta$ and $\phi$ may not be related to $\phi_1, \phi_2, \phi_3$. Is this the case? Thank you.
I think I know how to find the area after I've found these angles (regarding the title). | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9828232889752295,
"lm_q1q2_score": 0.8103003905943539,
"lm_q2_score": 0.8244619350028204,
"openwebmath_perplexity": 258.63192086664986,
"openwebmath_score": 0.9781134128570557,
"tags": null,
"url": "https://math.stackexchange.com/questions/2872686/angles-and-area-of-a-triangle-defined-on-a-sphere"
} |
c++
const double usq = cos_sq_alpha * ((pow(req, 2.) - pow(rpol, 2.)) / pow(rpol ,2.));
const double A = 1 + (usq / 16384) * (4096 + usq * (-768 + usq * (320 - 175 * usq)));
const double B = (usq / 1024) * (256 + usq * (-128 + usq * (74 - 47 * usq)));
const double delta_sig = B * sin_sigma * (cos2sigma + 0.25 * B * (cos_sigma * (-1 + 2 * pow(cos2sigma, 2.)) -
(1 / 6) * B * cos2sigma * (-3 + 4 * pow(sin_sigma, 2.)) *
(-3 + 4 * pow(cos2sigma, 2.))));
const double dis = rpol * A * (sigma - delta_sig);
const double azi1 = atan2((cos(u2) * sin(lam)), (cos(u1) * sin(u2) - sin(u1) * cos(u2) * cos(lam)));
return std::make_tuple(dis, azi1);
} | {
"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
} |
planet, size, water, escape-velocity, atmospheric-escape
of exomoon habitability. This lower limit, however, is not a
fixed number. Further sources of energy—such as radiogenic
and tidal heating, and the effect of a moon’s composition and
structure—can alter the limit in either direction. An upper mass limit is given by the fact that increasing mass leads to high pressures in the planet’s interior, which will increase the mantle viscosity and depress heat transfer throughout the mantle as well as in the core. Above a critical mass, the dynamo is strongly suppressed and becomes too weak to generate a magnetic field or sustain plate tectonics. This maximum mass can be placed around 2M4 (Gaidos et al., 2010; Noack and Breuer, 2011; Stamenkovic´ et al., 2011). | {
"domain": "astronomy.stackexchange",
"id": 5293,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "planet, size, water, escape-velocity, atmospheric-escape",
"url": null
} |
generative-model, variational-autoencoder
and prior is
$$ \mathrm{p}(\mathbf{z})=\mathcal{N}( \boldsymbol{0}, \mathbf{I}).$$
So
$$\mathrm{D}_{\mathrm{KL}}\left(\mathrm{q}_{\Phi}(\mathbf{z} \mid \mathbf{x}) \| p_{z}(\mathbf{z})\right)=\frac{1}{2} \sum_{j=1}^{J}\left(1+\log \left(\sigma_{j}^{2}\right)-\sigma_{j}^{2}-\mu_{j}^{2}\right)$$
That's one way I know the prior plays a role, in helping determine part of the loss function. | {
"domain": "ai.stackexchange",
"id": 3065,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "generative-model, variational-autoencoder",
"url": null
} |
neural-networks, convolutional-neural-networks, ai-design, algorithm, performance
Most of the theoretical and practical limits of parallel processing are heavily biased by seventy years of sequential processing as the foundation of computer science study and practice. If an understanding of parallel processing is desired, the von Neumann architecture is not the place to look. At the time of that development, computers could either be made of wood, steel, vacuum tubes, or relays. Developing a computer with 65536 parallel data paths was unrealistic to the extreme. The invention of algorithms was a workaround to funnel all processing through a single CPU. We've been backing out of that mind set for the last thirty years, beginning with FPUs, GPUs, multiple buses, computer clusters, and multiple cores. More parallelism in VLSI form is coming, and soon. | {
"domain": "ai.stackexchange",
"id": 854,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-networks, convolutional-neural-networks, ai-design, algorithm, performance",
"url": null
} |
charge, potential, conductors
Title: Connected and disconnected conductors spheres I have an exercise in which I have the following situation:
there are two conductors spheres (far apart) both of a given radius (R1, R2=2R1). The lesser sphere has a positive charge q and the other shpere is chargeless.
The two spheres are connected with a thin cable and then disconnected.
Now I have to establish the final charges q1 and q2 and the final potentials V1 and V2.
That's what I thought: when they are connected they stay at the same V so I can write:
$$k*Q1/R1 = k*Q2/R2 \ \ \ \ where \ Q1+Q2=q$$
and using this I can establish Q1 and Q2.
But what exactly happen when I disconnect them? Do they just stay at the same V, with the charges they were having while connected, or do they have a different behavior? | {
"domain": "physics.stackexchange",
"id": 32042,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "charge, potential, conductors",
"url": null
} |
algorithm, game, prolog
Enum for status of a constraint
class Status(Enum):
FAILED = 0
PASSED = 1
UNKNOWN = 2
Class for the constraints
class Constraint:
def __init__(self, variables, op, value):
self.variables = list(variables)
self.op = op
self.value = int(value)
def check(self):
if self.op == '#':
value = 0
for v in self.variables:
if v.state==State.UNASSIGNED:
return Status.UNKNOWN
if v.state==State.ON:
value += 1
else:
value = None
for variable in self.variables:
if variable.state == State.UNASSIGNED:
return Status.UNKNOWN
value = variable.evaluate(value)
return Status.PASSED if value == self.value else Status.FAILED | {
"domain": "codereview.stackexchange",
"id": 36064,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithm, game, prolog",
"url": null
} |
Main Article: Using Generating Functions to Solve Recurrence Relations One method to solve recurrence relations is to use a generating function. A generating function is a power series whose coefficients correspond to terms in a sequence of numbers. Solving Linear Recurrence Relations Niloufar Shafiei. 1 Review A recursive definition of a sequence specifies Initial conditions Recurrence relation Example: a 0=0 and a 1=3 a n = 2a n-1 - a n-2 a n = 3n Initial conditions Recurrence relation Solution. 2 Linear recurrences Linear recurrence: Each term of a sequence is a linear function of earlier terms in the sequence. For example: a 0 = 1 a 1 | {
"domain": "severemusick.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9838471637570105,
"lm_q1q2_score": 0.8342706664773966,
"lm_q2_score": 0.8479677506936878,
"openwebmath_perplexity": 616.8304921082495,
"openwebmath_score": 0.6817836165428162,
"tags": null,
"url": "https://severemusick.com/victoria/solving-recurrence-relations-using-generating-functions-pdf.php"
} |
javascript, design-patterns
enableMove: function() {
//In a callback "this" refers to the element in question, and not to the PROJ object
//You can cache it out here:
var self = this
$("#something").on( "click", function() {
//To resolve that you can also cache the reference in here
var self = PROJ
//this will work
self.enableMove();
//this will not work because we are in a callback
this.enableMove();
//You can use your Pub/Sub model anywhere, even in callbacks
$.publish( "done/with/this/baby" );
});
},
enableEraser: function() {
$.subscribe( "done/with/this/baby", this.enableSelect() );
//Just like that I've created a loop, by calling enableSelect it goes back and runs it again.
} //The last closing braquet doesn't have a comma
}; //Close the PROJ object | {
"domain": "codereview.stackexchange",
"id": 3200,
"lm_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, design-patterns",
"url": null
} |
computer-architecture
If you want 8-bit memory, you can combine 8 1-bit chips like you said, or you can use 2 4-bit chips, or 1 8-bit chip, and the circuit designer usually finds it more convenient and cheaper if there are less chips. | {
"domain": "cs.stackexchange",
"id": 21419,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computer-architecture",
"url": null
} |
python, algorithm, programming-challenge, combinatorics, time-limit-exceeded
Use snake_case instead of camelCase for your variable names.
Use spaces around most of your operators (frequency > 1, possibilities%2 == 1, possibilities > 0…)
Remove parenthesis around your tests
EAFP
While
if not (switch in wiring.keys()):
wiring[switch] = digit
else:
wiring[switch] &= digit
is correct, I would first write it
if switch in wiring:
wiring[switch] &= digit
else:
wiring[switch] = digit
for readability (and less computation) but then change it to
try:
wiring[switch] &= digit
except KeyError:
wiring[switch] = digit
It is not necessarily faster in this case (it is when failures are much less than success) but I find it clearer.
Putting it all together
In Python 2 use raw_input, xrange and itervalues instead of input, range and values.
from math import factorial
from collections import Counter
def parse_photo(wiring):
switches = input()
lights = input() | {
"domain": "codereview.stackexchange",
"id": 16954,
"lm_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, programming-challenge, combinatorics, time-limit-exceeded",
"url": null
} |
calibration, camera-calibration
Original comments
Comment by TommyP on 2013-03-11:
We are just trying to calibrate a camera and see exactly the same thing.
Comment by kamek on 2013-03-14:
I'm getting the exact same problem as well using Groovy on Ubuntu 11.10.
Comment by Vincent Rabaud on 2013-04-16:
Any other case, can you please state your g++ version and whether you are 32 bits or not ? Thx
Comment by Crusty on 2013-06-03:
same issue here. g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Linux xxx 3.2.0-43-generic-pae #68-Ubuntu SMP Wed May 15 03:55:10 UTC 2013 i686 i686 i386 GNU/Linux
Try this: download OpenCV source, compile it and replace the opencv libraries(make a backup!) of ROS with the compiled libraries. It helped me with 32bit Ubuntu 12.04 and ROS Groovy. | {
"domain": "robotics.stackexchange",
"id": 13212,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "calibration, camera-calibration",
"url": null
} |
molecular-biology, dna, molecular-genetics
Title: What is two-start or zigzag model of 30 nm chromatin fibre? I read some webpages describing the two-start model but could not get it. I'll be obliged if someone helped me understand the topic.
The websites I have been through are:
1.http://www.nature.com/nrm/journal/v13/n7/fig_tab/nrm3382_F4.html
2.http://www.mechanobio.info/topics/synthesis/go-0006323
3.http://www.fastbleep.com/biology-notes/41/118/1272 From the MB Info Wiki you linked:
In the one-start solenoid model, bent linker DNA sequentially connects each nucleosome cores, creating a structure where nucleosomes follow each other along the same helical path [4, 7]. Alternatively, in the two-start zigzag model, straight linker DNA connects two opposing nucleosome cores, creating the opposing rows of nucleosomes that form so called “two-start��? helix. | {
"domain": "biology.stackexchange",
"id": 5230,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "molecular-biology, dna, molecular-genetics",
"url": null
} |
python, database, graph, csv, data-visualization
try:
i = 0
j = 0
for row in reader:
if row:
if (i == 10000):
print j, "processed"
i = 0
i += 1
j += 1
character = strip(row[0])
first_name = strip(row[1])
last_name = strip(row[2])
actor = strip(row[3])
character_birth = strip(row[4])
character_death = strip(row[5])
allegiance = strip(row[6])
house = strip(row[7])
territory = strip(row[8])
region = strip(row[9]) | {
"domain": "codereview.stackexchange",
"id": 11544,
"lm_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, database, graph, csv, data-visualization",
"url": null
} |
ros, find-package, cmake
So the problem is in the CMakeLists.txt of the folder fcu.
Also:
*Could not find a package configuration file provided by "dji_sdk" with any...*
Make sure that you install the dji_sdk . Clone it: user@name:~$ git clone https://github.com/dji-sdk/Onboard-SDK.git
I dont' know if it would help you, actually I'm not really sure how I fix mine ^^'
Originally posted by paulacb with karma: 16 on 2017-10-31
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 25871,
"lm_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, find-package, cmake",
"url": null
} |
apparent-magnitude, absolute-magnitude
Title: Absolute/apparent magnitude and distance for HIP31978 inconsistent? EDIT: I am still following up, but here's the latest response from Wolfram:
Paclet servers are updated and optimized for each version of
Mathematica, so I suspect you may be working on an older version which
we no longer update. Many times we get reports that data from the
paclet data for version 9 was incorrect, only to find that it has
already been fixed for version 10.
According to Mathematica and several other sources, the
known information about HIP31978 (also known as "S
Monocerotis" and "15 Monocerotis") includes:
The star system is about 101.06 light years from our own.
The star's absolute magnitude is -2.79 (some sources say even lower).
The star's visual magnitude from our solar system is 4.66. | {
"domain": "astronomy.stackexchange",
"id": 1295,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "apparent-magnitude, absolute-magnitude",
"url": null
} |
electrons, electric-current, frequency, intensity
Now let's come to intensity.Now say the hero sent like hundreds of balls of energy in the form of a beam towards villain.But still all of them have the same energy.Now relate that over here.You increased the intensity.This means that number of photons in the beam have increased but still they are of same energy level i.e. hv and we all know that one photon strikes one electron which is responsible for ejection of electron.So more the number of photons,more the number of collision of photon with loosely bonded electrons and more they will come out.Increasing the frequency only increase the energy of photon but still it'll collide with only one electron.So,to increase photoelectric current,we need more electrons as flow of electrons constitute the current and number of electrons coming out will increase only if we increase the number of photons falling on plate.
Hope you found it helpful. | {
"domain": "physics.stackexchange",
"id": 55613,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrons, electric-current, frequency, intensity",
"url": null
} |
and now.... i am stuck.
is there a way to solve this particular equation?
Mark44
Mentor
## Homework Statement
i am looking for the potential extrema on the function y = |sinx(x)| + (1/x) between [-2pi, 2pi]
## Homework Equations
extrema will be likely located at f'(x) = 0 or u/d
An extremum can also occur at an endpoint of a closed interval.
fishspawned said:
## The Attempt at a Solution
first it is noted that there is a discontinuity at x=0
then determining f'(x) by using |sin(x)| as sqrt(sin2x) instead
we get f'(x) = sin(x)cos(x)/|sinx(x)| - x-2
first the easy one : we can see that f'(x) = u/d where sin(x) = 0 [looking only at the denominator here]
that will be at x= -2pi, -pi, pi, and 2pi
My problem is the second part
f'(x) = 0 when the whole equation = 0
0 = sin(x)cos(x)/|sinx(x)| - x-2
therefore
sin(x)cos(x)/|sinx(x)| = x-2
we get
sin(x)cos(x)/(sqrt(sin2x)) = x-2
a little algebra and then we get
x4 = sec2(x) | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9525741214369554,
"lm_q1q2_score": 0.8019013244436923,
"lm_q2_score": 0.8418256452674008,
"openwebmath_perplexity": 1633.5448255629171,
"openwebmath_score": 0.8694120645523071,
"tags": null,
"url": "https://www.physicsforums.com/threads/trouble-solving-an-equation.947258/"
} |
electrostatics, work, potential, capacitance
force $\frac{q\sigma}{\epsilon_0}$ for a distance $d$. Work at the negative plate is $0$, so this is assigned a potential $0$. Then an additional work was done taking the charge from $-$ to $+$ plate, so that the potential (work per unit charge) at the $+$ plate is in an excess of $\frac{d\sigma}{\epsilon_0}$ relative to the $-$ plate and is assigned a potential of $\frac{d\sigma}{\epsilon_0}$ . Hence the potential difference between the plates of $\frac{d\sigma}{\epsilon_0}$ . Remember, potentials are assigned relative to a fixed point, not arbitrarily. | {
"domain": "physics.stackexchange",
"id": 32966,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics, work, potential, capacitance",
"url": null
} |
Than you Ian. Edited the typo.
_________________
Kudos [?]: 118889 [0], given: 12010
Intern
Joined: 10 Mar 2014
Posts: 26
Kudos [?]: 3 [0], given: 299
### Show Tags
02 Aug 2015, 23:16
Bunuel wrote:
defoue wrote:
Hi buddies,
going through this awesome contribution, I got some issues to understand the following : would you please help to understand by giving some extra examples?
1. Finding the power of non-prime in n!:
How many powers of 900 are in 50!
Make the prime factorization of the number: 900=2^2*3^2*5^2, then find the powers of these prime numbers in the n!.
Find the power of 2:
\frac{50}{2}+\frac{50}{4}+\frac{50}{8}+\frac{50}{16}+\frac{50}{32}=25+12+6+3+1=47
= 2^{47}
Find the power of 3:
\frac{50}{3}+\frac{50}{9}+\frac{50}{27}=16+5+1=22
=3^{22}
Find the power of 5:
\frac{50}{5}+\frac{50}{25}=10+2=12
=5^{12}
We need all the prime {2,3,5} to be represented twice in 900, 5 can provide us with only 6 pairs, thus there is 900 in the power of 6 in 50!. | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.959154282922475,
"lm_q1q2_score": 0.8074406826478172,
"lm_q2_score": 0.8418256551882382,
"openwebmath_perplexity": 1714.712744839131,
"openwebmath_score": 0.6197497248649597,
"tags": null,
"url": "https://gmatclub.com/forum/math-number-theory-88376-160.html"
} |
java, game, swing
public Obstacle(int xObstaclePosition, int yObstaclePosition, Ball ball)
{
this.xObstaclePosition = xObstaclePosition;
this.yObstaclePosition = yObstaclePosition;
this.ball = ball;
START_X_OBSTACLE_POSITION = xObstaclePosition;
yDownObstacle = yObstaclePosition + HEIGHT_OBSTACLE;
try
{
obstacleImage = ImageIO.read(getClass().getResource
("/images/obstacle.png"));
}
catch (IOException e)
{
System.exit(0);
}
}
public void followBall()
{
if (ball.xBallPosition > xObstaclePosition + WIDTH_OBSTACLE/2)
{
if (xObstaclePosition < GameFrame.WIDTH_GAME_FRAME - WIDTH_OBSTACLE)
{
xObstaclePosition += OBSTACLE_MOVE;
xObstacleEnd = xObstaclePosition + WIDTH_OBSTACLE;
}
} | {
"domain": "codereview.stackexchange",
"id": 21672,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, game, swing",
"url": null
} |
Find a formula for the general term $a_n$ of the sequence, assuming that the pattern of the first few terms continues.
1 Asked on November 27, 2020 by andrew-lewis
Examples of irreducible holomorphic function in more than one variable.
1 Asked on November 27, 2020 by alain-ngalani
Given $log_2(log_3x)=log_3(log_4y)=log_4(log_2z)$, find $x+y+z$.
3 Asked on November 27, 2020 by hongji-zhu
Which of the following statements is correct?
1 Asked on November 27, 2020 by user469754 | {
"domain": "answerbun.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9886682484719524,
"lm_q1q2_score": 0.8363564239619626,
"lm_q2_score": 0.8459424334245617,
"openwebmath_perplexity": 554.5586649486925,
"openwebmath_score": 0.7157838940620422,
"tags": null,
"url": "https://answerbun.com/mathematics/why-write-computational-complexity-as-oleft-m-n-log-n2-m-right/"
} |
The idea behind Green's Theorem is that the curl of a vector field is a measure of the infinitisimal circulation ("swirl") caused by the vector field at a point. So Green's theorem states that, if we want the circulation along a closed path, we can take the area integral of all the "swirl" inside the curve, which all in a sense cancels out, leaving only the circulation on the boundary.
The curl for a vector field $\vec{F} = \langle F_x, F_y, F_Z \rangle$ is defined as: $$\nabla \times \vec{F} = \begin{vmatrix} \vec{i} & \vec{j} & \vec{k} \\ \frac{\partial}{\partial x} & \frac{\partial}{\partial y} & \frac{\partial}{\partial z} \\ F_x & F_y & F_z \end{vmatrix}$$ its direction gives the axis of rotation of the infinitisimal circulation (oriented by the right-hard rule), and its magnitude is the infinitisimal circulation. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9693241956308277,
"lm_q1q2_score": 0.8035104395070201,
"lm_q2_score": 0.8289388040954683,
"openwebmath_perplexity": 288.12985406174226,
"openwebmath_score": 0.9994905591011047,
"tags": null,
"url": "https://math.stackexchange.com/questions/2277077/apply-greens-theorem-for-iint-d-x2ydxdy-on-region-bounded-with-x-t-s"
} |
ros, ubuntu, ubuntu-xenial
Title: E: Unable to locate package ros-hydro-ros-tutorials
following the ros tutorial [here](http://wiki.ros.org/ROS/Tutorials/NavigatingTheFilesystem).
When I run The pre-requisites command $ sudo apt-get install ros-<distro>-ros-tutorials, the following command is received on the terminal.
adil@adil-HP-Pavilion-g6-Notebook-PC:~/catkin_ws$ sudo apt-get install ros-hydro-ros-tutorials
Reading package lists... Done
Building dependency tree
Reading state information... Done
Any suggestions on how to proceed from this.
Originally posted by bonzi on ROS Answers with karma: 23 on 2017-01-22
Post score: 0
ROS Hydro is much too old and not available on 16.04. I recommend using Kinetic Kame instead.
Supported platforms are listed in REP 3
Originally posted by tfoote with karma: 58457 on 2017-01-22
This answer was ACCEPTED on the original site
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 26793,
"lm_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, ubuntu, ubuntu-xenial",
"url": null
} |
electromagnetism, waves, electromagnetic-radiation, magnetic-fields, dipole
When the current is largest (diagram 3) the magnitude of the B-field is largest and this coincides with the times that the magnitude of the E-field is a maximum.
So the E-field and the B-field are in phase with one another.
The fields are also zero at the same time.
In diagram 5 I have put in a magnetic field line which would actually be a circle if I could draw the diagram in three dimensions.
An important thing to note is that the E-field and the B-field are at right angles to one another and that $\vec E \times \vec B$ gives the direction in which the electromagnetic wave is travelling.
To continue I have to move away from your diagram and go to an annotated diagram obtained with the help of the gif file. | {
"domain": "physics.stackexchange",
"id": 42948,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, waves, electromagnetic-radiation, magnetic-fields, dipole",
"url": null
} |
$P(H = 2 \text { or } W = 2) = P(H = 2) + P(W = 2) - P(H = 2 \text { and } W = 2)$
$= 2 (.2)(.8) - [(.2)(.8)]^2 = 0.2944$
As for the second part, I have no explanation for 0.01067-- it seems to me Grandad's answer of (0.2)^4 is correct.
My reasoning for (i) was based on the assumption that neither passes on the first test - which is not necessarily so. My initial reading of the question assumed that each person took the test at least twice. Apologies!
I remain as puzzled as awkward as to where the answer to (ii) comes from. | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9808759624105493,
"lm_q1q2_score": 0.8216012916448059,
"lm_q2_score": 0.8376199673867852,
"openwebmath_perplexity": 395.31327061637546,
"openwebmath_score": 0.5951566696166992,
"tags": null,
"url": "http://mathhelpforum.com/advanced-statistics/73690-probability-question-quite-challenging.html"
} |
python, graph, breadth-first-search
>>> distance({1: [2, 3], 2: [3, 4], 3: [4, 5]}, 1, 5)
2
"""
if source == target:
return 0
queue = deque([(source, 0)]) # Queue of pairs (node, distance).
visited = set() # Set of visited nodes.
while queue:
node, dist = queue.popleft()
visited.add(node)
for neighbour in graph[node]:
if neighbour in visited:
continue
elif neighbour == target:
return dist + 1
else:
queue.append((neighbour, dist + 1))
else:
raise Unreachable("No path from {!r} to {!r}".format(source, target)) | {
"domain": "codereview.stackexchange",
"id": 23976,
"lm_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, graph, breadth-first-search",
"url": null
} |
quantum-field-theory, path-integral, correlation-functions, functional-determinants
Title: Calculation of current from path integral I would like to calculate $\langle\bar{\psi}\psi\rangle$ in free theory. I start from the following generating functional:
$$Z[J]=\int\mathcal{D}[\bar{\psi},\,\psi]\exp\left(i\int d^dx\,[\bar{\psi}(i\gamma\partial-m)\psi+J\bar{\psi}\psi]\right)\tag{1}$$
and conclude that
$$\langle\bar{\psi}\psi\rangle=\frac{1}{\mathcal{Z}}\left.\frac{\partial}{\partial J}Z[J]\right|_{J=0}=\frac{\partial}{\partial J}\left(\ln Z[J]\right).\tag{2}$$
Then, the path integral is gaussian, therefore $$Z[J]=\det(i\gamma\partial -m+J)\tag{3}$$ and $\ln\det=\mathrm{Tr}\ln$, where $\mathrm{Tr}$ is the trace over all indices. I don't understand how to deal with obtain functional determinant. If it has the form $\det(i\gamma\partial -m +J)/\det(i\gamma\partial-m)$, it will be more clear. May be I am wrong in my derivations?
In fact, it is still unclear. I can rewrite obtained result as | {
"domain": "physics.stackexchange",
"id": 56684,
"lm_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, path-integral, correlation-functions, functional-determinants",
"url": null
} |
ros, ros-kinetic, ubuntu, c++11, geometry-msgs
Anyway using big values are not a good solution overall if you are using other libraries that do not accept "double" precision.
The best I could do for now is shift the coordinates to the first position received and put it as the origin.
This workaround must be changed (explained in the commentaries) if the robot is moving over huge distance.
NB: the original problem was due to a third party library that did not have enough precision to show a position difference between two different position because it could deal only with floating numbers, and this error has been spreaded into the message!
Originally posted by MCmobil with karma: 33 on 2021-01-13
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 35961,
"lm_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-kinetic, ubuntu, c++11, geometry-msgs",
"url": null
} |
The squares are close, but not exactly equal, to $5.$
Round $\sqrt{17}$ to two decimal places using a calculator.
## Solution
$\sqrt{17}$ Use the calculator square root key. $4.123105626$ Round to two decimal places. $4.12$ $\sqrt{17}\approx 4.12$
Round $\sqrt{11}$ to two decimal places.
≈ 3.32
Round $\sqrt{13}$ to two decimal places.
≈ 3.61
## Simplify variable expressions with square roots
Expressions with square root that we have looked at so far have not had any variables. What happens when we have to find a square root of a variable expression?
Consider $\sqrt{9{x}^{2}},$ where $x\ge 0.$ Can you think of an expression whose square is $9{x}^{2}?$
$\begin{array}{ccc}\hfill {\left(?\right)}^{2}& =& 9{x}^{2}\hfill \\ \hfill {\left(3x\right)}^{2}& =& 9{x}^{2}\phantom{\rule{2em}{0ex}}\text{so}\phantom{\rule{0.2em}{0ex}}\sqrt{9{x}^{2}}=3x\hfill \end{array}$ | {
"domain": "jobilize.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9884918522917869,
"lm_q1q2_score": 0.8011517999374733,
"lm_q2_score": 0.8104789109591832,
"openwebmath_perplexity": 1942.5892486029184,
"openwebmath_score": 0.636227011680603,
"tags": null,
"url": "https://www.jobilize.com/course/section/simplify-variable-expressions-with-square-roots-by-openstax?qcr=www.quizover.com"
} |
human-anatomy, biophysics, health, temperature, bone-biology
So I just wanna know does thermal shock apply to our bones? Would going from hot to cold or vice versa damage the performance of bones and joints eventually?
Also, I especially mean the spine. I Litterly cannot stand the thought that doing a cold shower would make my back like an old man's. Squicky and painful to move. No is the answer to this - stop a think for a little bit. If this were the case, there would be many thousands of such incidents observed every year, and no-one would ever do such things as plunge into ice-cold water (there are plenty of videos of this on YouTube) or visit cold climates. Bones do not behave like glass. In addition, your bones are inside your body, where they are heated by your blood and body mass. Thermal shock does not apply. | {
"domain": "biology.stackexchange",
"id": 12363,
"lm_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-anatomy, biophysics, health, temperature, bone-biology",
"url": null
} |
php, active-directory
{
if ($filters !== null) {
$sn = utf8_decode($filters->name);
$givenName = utf8_decode($filters->firstName);
$employeeId = $filters->id;
} else {
$sn = '';
$givenName = '*';
$employeeId = '';
}
$pattern = '(&'; | {
"domain": "codereview.stackexchange",
"id": 33512,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, active-directory",
"url": null
} |
p2tst, aq3, g28sptu, 8sqc7f7, evsta, gjpi, iyucbws, bgoc, wtgqm5, hxk4z, irdtbxb, | {
"domain": "growthpit.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668739644687,
"lm_q1q2_score": 0.8154900281363526,
"lm_q2_score": 0.8311430499496095,
"openwebmath_perplexity": 1240.5699273404657,
"openwebmath_score": 0.6144256591796875,
"tags": null,
"url": "http://growthpit.com/54qm4g8/what-is-modulo.html"
} |
classical-mechanics, atomic-physics, orbital-motion, semiclassical
If nothing else, you can work out
\begin{align}
\vec{L} &= \vec{r}\times (m\vec{v}) \\
&= r v \sin\theta \hat{n},
\end{align}
where $\theta$ is the angle between $\vec{r}$ and $\vec{v}$, and $\hat{n}$ is unimportant (it's perpendicular to the ellipse). The crucial part is that the origin is at one focus of the ellipse, so the relationship between $\phi$ and $\theta$ will be very specific.
Also, you're wrong about the formula for the velocity. That is just the component of the velocity around the origin (we call that the $\hat{\phi}$ direction). The velocity will also have a component inward and outward (the $\hat{r}$ direction) that is given by $\frac{\mathrm{d}r}{\mathrm{d}t} = \frac{\mathrm{d}r}{\mathrm{d}\phi}\times \frac{\mathrm{d}\phi}{\mathrm{d}t}$. The total velocity vector is given by
$$ \vec{v} = \frac{\mathrm{d}r}{\mathrm{d}t} \hat{r} + r \frac{\mathrm{d}\phi}{\mathrm{d}t} \hat{\phi},$$
and its magnitude will be
\begin{align} | {
"domain": "physics.stackexchange",
"id": 59799,
"lm_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, atomic-physics, orbital-motion, semiclassical",
"url": null
} |
nuclear-physics, astrophysics, stars, supernova, nucleosynthesis
Edit:
I picked-up the images randomly from web. The first one, I can see is used in https://answersingenesis.org/astronomy/solar-system/discussion-stellar-nucleosynthesis/ or https://uvachemistry.com/tag/s-process/ . The other one should be inside http://slideplayer.com/slide/10684436/ (I see it is from Maria Lugaro, an expert to the topic). The color codes - there is something is the text, but I cn cite the description from ref: The isotopes represented by white boxes result from either the s or r process. The blue boxes represent isotopes that result only from the r process, while the red boxes are s-only isotopes. The yellow boxes represent isotopes produced by proton capture. | {
"domain": "physics.stackexchange",
"id": 40484,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nuclear-physics, astrophysics, stars, supernova, nucleosynthesis",
"url": null
} |
java, authentication
Title: Password storage slim/trim it down? I have created a personal password storage program that takes the user's username, password, and for what account it is for, and stores it in a text file and can also read from them (assuming you type the right name in). What I'm looking to do, is either trim it down (take out none needed code) or finding more effective ways to go about this.
import java.io.*;
import java.util.*;
public class testing_file
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
System.out.println("Access or create?");
String select = input.nextLine();
switch(select)
{
case "Create": | {
"domain": "codereview.stackexchange",
"id": 4025,
"lm_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, authentication",
"url": null
} |
ros, moveit, pcl, ros-kinetic, move-group
Originally posted by rhaschke with karma: 71 on 2019-06-27
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by nd on 2019-06-27:
I will try this and update here.
Comment by martimorta on 2019-06-27:
Follow the instructions on this link to update the repository keys https://discourse.ros.org/t/security-issue-on-ros-build-farm/9342/8 | {
"domain": "robotics.stackexchange",
"id": 33271,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, moveit, pcl, ros-kinetic, move-group",
"url": null
} |
python, yaml
with open(path) as file:
all_data = yaml.safe_load(file)
result = {}
for f in fields(cls)[1:]:
try:
data_value = all_data[f.name]
except KeyError:
log.add_missing_key(f.name)
else:
if not data_value:
log.add_key_without_value(f.name)
result[f.name] = data_value
return result
@classmethod
def _check_invalid_types(
cls,
data: dict[str, Any],
log: ValidationErrorLog,
handle_type_errors: HandleValidationError
) -> None:
"""
Checks if the value types of the yaml data aligns with the field types declared in the fields of
the child class.
"""
required_types = {f.name: f.type for f in fields(cls)}
keys_to_remove = []
for data_key, data_value in data.items():
required_type = required_types.get(data_key) | {
"domain": "codereview.stackexchange",
"id": 45181,
"lm_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, yaml",
"url": null
} |
• Thanks for the reminder. I did not notice the case of infinite measure. – user negative one over twelve Sep 16 '14 at 12:22
• And one more comment on this about where the argument falls apart in this contradiction. Given $$m^*(A\cap I)\leq (1-\epsilon) m(I) \quad\quad \forall I,$$ if $m^*(A)>0$ then $A$ is not Borel measurable. An intuitive example is the following (from Prof. Tao's RA), take the space $[0,1]$, for each real number $r\in [0,1]$ we flip a fair coin, and define $$A:= \{r\in [0,1] : \text{ with the coin landed on heads }\}.$$ Since the coin is fair, half of the real numbers in $[0,1]$ should belong to $H$, and we have $$m'(H\cap I)\leq \frac{1}{2} m(I) \quad\quad \forall I.$$ – Xiao Sep 16 '14 at 12:49
• It is assumed that $A$ is Borel measurable. Also, if it has infinite measure then you can simply find some interval $[n,n+1]$ such that $A\cap [n,n+1]$ has positive, finite measure, and then replace $A$ by $A\cap [n,n+1]$. – Dimitris Nov 16 '14 at 19:22 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9615338057771058,
"lm_q1q2_score": 0.8134022568154445,
"lm_q2_score": 0.8459424431344437,
"openwebmath_perplexity": 115.26497114468916,
"openwebmath_score": 0.9818388223648071,
"tags": null,
"url": "https://math.stackexchange.com/questions/933233/prove-borel-measurable-set-a-with-the-following-property-has-measure-0"
} |
classical-mechanics
When you turn it into vectors, the first quantity is a rotation purely along the z axis by an amount d\phi, so it's omega vector is purely along the z axis:
$$ \omega(dA A^{-1}) = (0,0,1) d\phi$$
the second starts off as a pure rotation about the y-axis by an amount $d\theta$, but it gets rotated about the z axis by $\phi$ (because of the $A$ and $A^{-1}$), so its omega vector is the y-axis rotated by $\phi$ around the z axis.
$$ \omega(A\,\,dB\,B^{-1}\,\,A^{-1}) = (-\sin(\phi),\cos(\phi),0) d\theta $$
The third would be a rotation about the z axis, or (0,0,1) but it gets rotated around the y axis by $\theta$, so into $(\sin\theta, 0, \cos\theta)$, then it gets rotated around the z axis by $\phi$, so into $(\sin\theta \cos\phi, \sin\theta \sin\phi , \cos\theta)$. This is the rotation vector of the third term.
$$ \omega(AB\,\,dC\,C^{-1}\,\,A^{-1}B^{-1} ) = (\sin\theta \cos\phi , \sin\theta \sin\phi, \cos\theta) d\psi$$ | {
"domain": "physics.stackexchange",
"id": 1801,
"lm_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",
"url": null
} |
11. Originally Posted by ThePerfectHacker
Here are some facts.
3)Every number is expressable as a sum of distinct fibonacci number non of which are adjacent.
What is the proof?
12. Originally Posted by malaygoel
What is the proof?
Using induction for $\displaystyle n>2$.
----
Each of the integers $\displaystyle 1,2,3,...,F(k)-1$ is a sum of numbers from the set $\displaystyle S=\{ F(1),F(2),...,F(k-2) \}$ none of which are repeated. Select $\displaystyle x$ such as,
$\displaystyle F(k)-1<x<F(k+1)$
But because,
$\displaystyle x-F(k-1)<F(k+1)-F(k-1)=F(k)$
We can express,
$\displaystyle x-F(k-1)$ as sum of numbers from $\displaystyle S$ none of which are repeated. Thus, as a result, $\displaystyle x$ is expressable as a sum of the numbers,
$\displaystyle S\cup F(k-1)$ without repetitions.
This means that any of the numbers,
$\displaystyle 1,2,...,F(k+1)-1$ is expressable from the set,
$\displaystyle S\cup F(k-1)$ and the induction is complete. | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9820137874059599,
"lm_q1q2_score": 0.8772421629273606,
"lm_q2_score": 0.8933094159957173,
"openwebmath_perplexity": 1881.2424747708912,
"openwebmath_score": 0.8473930358886719,
"tags": null,
"url": "http://mathhelpforum.com/number-theory/3129-fibonacci-s-sequence.html"
} |
rviz, ros-groovy, transform
output pdf is here http:// www. tempsend.com/AEAD417228 (remove spaces)
Originally posted by bvbdort on ROS Answers with karma: 3034 on 2014-01-09
Post score: 1
Original comments
Comment by rock-ass on 2014-01-10:
could you show frames graph ? you can generate pdf file of it with rosrun tf view_frames. Also you could try increasing publishing rate from 1000 to 100
Comment by bvbdort on 2014-01-10:
@rock-ass frames pdf added.
The most likely cause I can see from your description of the problem is that the timestamp of the tf transform you´re broadcasting is not correct. As requested also in a comment, you should edit your post with further info. You can also try both of these commands:
rosrun tf tf_echo base_link laser_link
rosrun tf tf_echo odom base_link | {
"domain": "robotics.stackexchange",
"id": 16621,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rviz, ros-groovy, transform",
"url": null
} |
Consider the Riemann-Zeta Function: $$\sum_{n=1}^{\infty}\frac{1}{n^{s}}=\prod_{p\text{ prime}}\frac{1}{1-p^{-s}}.$$ For $s=2$, the infinite sum on the left is $\pi^{2}/6$, which is irrational. Thus, $\pi^{2}/6$ is an infinite product of rationals.
There is a simple way to obtain any irrational number as an infinite product:
• take any sequence $s_n$ of rational numbers converging to the targeted irrational one (say the approximations of $\pi$ to $n$ decimals);
• form the product of the numbers $f_n:=\dfrac{s_{n+1}}{s_n}$, with $f_0=1$.
$$\pi=\prod_{n=0}^\infty f_n=\frac{31}{10}\cdot\frac{314}{310}\cdot\frac{3141}{3140}\cdot\frac{31415}{31410}\cdot\frac{314159}{314150}\cdots$$
• Ooops, I just noticed that my answer is a duplicate.
– user65203
Mar 30, 2018 at 15:29 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9867771786365548,
"lm_q1q2_score": 0.8519751265425952,
"lm_q2_score": 0.863391599428538,
"openwebmath_perplexity": 634.1386323894059,
"openwebmath_score": 0.8812333345413208,
"tags": null,
"url": "https://math.stackexchange.com/questions/2711754/can-the-product-of-infinitely-many-elements-from-mathbb-q-be-irrational/2711761"
} |
python, ros2
package_name = 'control_panel_ui'
setup(
name=package_name,
version='0.0.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml'])
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='pi',
maintainer_email='michal@michal.com',
description='TODO: Package description',
license='TODO: License declaration',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'control_panel_ui = control_panel_ui.graphical_interface:graphical_interface'
],
},
)
cfg
[develop]
script-dir=$base/lib/control_panel_ui
[install]
install-scripts=$base/lib/control_panel_ui
Originally posted by robopo on ROS Answers with karma: 72 on 2020-04-18
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 34787,
"lm_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, ros2",
"url": null
} |
Prove the transitivity of $<$ relation in natural numbers using the classical definition and the associativity of addition
In the book Notes on Mathematical Analysis the set $\mathbb{N}$ of natural numbers was defined using the classical Peano's axioms. Then $<$ was defined as if exist $k\in \mathbb{N}$ such that $b=S^k(a)$ then we say $a<b$. Then it was asked to prove the transitivity of $<$ relation.
I proceed as follows: if $a<b$ then by definition there is a $k$, $b=S^k(a)$. Same for $b<c$, $c=S^l(b)$. Then it will comes that $c=S^{k+l}(a)$, which means $a<c$.
I can't find errors in my proof but in the book's hint this transitivity should be proved by the associativity which proved before. I can't find the required proof either. Any help will be greatly appreciated.
ps. Moreover, in the next section another definition of $\mathbb{N}$ appears as:
Given a set $N$ and a map $S:N\rightarrow N$, such that
a) $1\notin S(N)$;
b) $S$ is injective; | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9740426412951847,
"lm_q1q2_score": 0.8074217401550952,
"lm_q2_score": 0.8289388019824946,
"openwebmath_perplexity": 134.62791870955328,
"openwebmath_score": 0.9697290658950806,
"tags": null,
"url": "https://math.stackexchange.com/questions/1946422/prove-the-transitivity-of-relation-in-natural-numbers-using-the-classical-de"
} |
algorithms, data-structures, shortest-path, heaps
Title: Ideal value of d in a d-ary heap for Dijkstra's algorithm I stumbled upon the following statement:
By using a $ d $-ary heap with $ d = m/n $, the total times for these two types of operations may be balanced against each other, leading to a total time of $ O(m \log_{m/n} n) $ for the algorithm, an improvement over the $ O(m \log n) $ running time of binary heap versions of these algorithms whenever the number of edges is significantly larger than the number of vertices | {
"domain": "cs.stackexchange",
"id": 10640,
"lm_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, data-structures, shortest-path, heaps",
"url": null
} |
slam, navigation, kinect, rtabmap-ros
Title: propblem running rtabmap continuesly
Hello sir, im trying to run the rtabmap_ros/Tutorial:
RGB-D Hand-Held Mapping With a Kinect, with my kinect xbox, with ros indigo, ubuntu 14,04. My problem is after i run:
roslaunch rtabmap_ros rgbd_mapping.launch rtabmap_args:="--delete_db_on_start"
i get the rtabmap widow with required output depth image but it don't output the image continuesly, i dont get what is problem.
i was following this link:
http://wiki.ros.org/rtabmap_ros/Tutorials/HandHeldMapping | {
"domain": "robotics.stackexchange",
"id": 24900,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam, navigation, kinect, rtabmap-ros",
"url": null
} |
java
do {
System.out.printf("Please enter an integer between %d and %d: ");
try {
num = scanner.nextInt();
if (num >= low && num <= high) {
invalid = false;
}
}
catch (InputMismatchException x) {
System.out.println("Invalid entry, please try again");
}
} while (invalid);
}
Something like that (if you need to use a do-while. Personally, I try to avoid them but it looks like you like them, and maybe it's part of your assignment).
Those are just a few things that I would suggest you think about. The main problems I see mostly relate to code duplication, so really think about ways to reduce that. | {
"domain": "codereview.stackexchange",
"id": 5196,
"lm_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",
"url": null
} |
c#, design-patterns, memory-management, event-handling, async-await
public DbContext Db { get; }
public string Username { get; set; }
public ExecutionContext ExecutionContext { get; set; }
public async Task SaveChangesAsync()
{
await _eventAggregator.PublishAsync(new SavingChangesEvent(this));
await Db.SaveChangesAsync();
}
public async Task StartTransactionAsync()
{
if (_dbContextTransaction != null) return;
_dbContextTransaction = await Db.Database.BeginTransactionAsync();
}
public void Dispose()
{
_dbContextTransaction?.Dispose();
}
public Task CommitTransactionAsync()
{
_dbContextTransaction?.Commit();
return _eventAggregator.PublishAsync(new TransactionCommitedEvent());
}
public void RollbackTransaction()
{
_dbContextTransaction?.Rollback();
}
} | {
"domain": "codereview.stackexchange",
"id": 35556,
"lm_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#, design-patterns, memory-management, event-handling, async-await",
"url": null
} |
general-relativity, momentum, stress-energy-momentum-tensor
So that's our example. Now let's look at the stress energy tensor. We have a $T^{\mu\nu}$ as the flux of four-momentum $p^{\mu}$ across a surface of constant $x^{\nu}$. A surface of constant $x^0=ct$ is a surface of constant $t$. A flux is a per-area thing. So you can imagine a bit of area/volume in the $t=const$ plane/hyperplane, say a rectangle/box with size $\Delta x \Delta y \Delta z$, if the box is bigger you get more flux. We can draw the worldlines of the particles and count how many pierce through this piece of the $t=const$ hypersurface, and once the piece is small enough, the result is proportional to the size of the volume. So that propotionality constant is the particle density. If we multiply that by the mass per particle, we are now counting mass that pierces that portion of the $t=const$ surface, and the proportionality constant is mass density. If we multiply that by the $c^2$, we are now counting energy that pierces that portion of the $t=const$ surface, and the | {
"domain": "physics.stackexchange",
"id": 19608,
"lm_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, momentum, stress-energy-momentum-tensor",
"url": null
} |
special-relativity, inertial-frames, observers, thought-experiment
Question 5: Technically the light sources cannot be at rest wrt both frames. But given the postulate of the speed of light it really does not matter in what frame they are actually at rest, and this is what the thought experiment emphasizes. What is important is that although the emission events take place symmetrically in space for both observers, they occur simultaneously for one observer and not simultaneously for the other. This is what breaks the symmetry. The symmetrical situation would have instead the bolts striking simultaneously for the train observer, but not simultaneously for the embankment observer. And you are right about the symmetrical conclusion: the latter situation would serve to show that events simultaneous in the train frame are not simultaneous in the embankment frame. | {
"domain": "physics.stackexchange",
"id": 71465,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, inertial-frames, observers, thought-experiment",
"url": null
} |
phylogenetics, phylogeny, networks, bacteria, allele-frequency
Topology does not change with time
Vertex dynamic flows as a Moran process:
At time $t$ , one individual is chosen randomly to reproduce and one
individual is chosen to die. The same individual can be chosen to reproduce and
then die. Thus, an individual has either zero, one, or two descendants. Zero and
two with equal probability $p_0 = p_2 = (N_i -1 )/N_i^2$ , and one with probability $p_1 = 1 − 2 p_2$.
Migration from one Vertex to one another is possible for nearest neighborhood with some fixed probability depending on choosen topology. I will assume that when migration occurs $I$ new individuals enters into $V_i$ and $O$ individuals exits from $V_i$, with $I$ and $O$ depending on origin vertex numerosity. Migrants carry allelic frequencies according to population they came from. When migration occurs a new population is established: allelic profile frequencies changes according to that. | {
"domain": "bioinformatics.stackexchange",
"id": 1541,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "phylogenetics, phylogeny, networks, bacteria, allele-frequency",
"url": null
} |
c, unit-testing, utf-8
if (buf)
for (i=0; i<n && *p; i++){
switch(pre=nlo(x=*p++)){
case 0: break;
case 1: if (errinfo) *errinfo |= invalid_encoding;
x=0xFFFD;
break;
case 2:
case 3:
case 4: x&=lsb(8-pre);
for (j=1; j<pre; j++){
if (nlo(*p)!=1)
if (errinfo) *errinfo |= bad_following_character;
x=(x<<6) | (*p++&lsb(6));
}
break;
default: if (errinfo) *errinfo |= invalid_extended_encoding;
x=0xFFFD;
break;
}
if (x < ((int[]){0,0,0x80,0x800,0x10000})[pre])
if (errinfo) *errinfo |= over_length_encoding;
*u++=x;
}
return buf;
} | {
"domain": "codereview.stackexchange",
"id": 15028,
"lm_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, unit-testing, utf-8",
"url": null
} |
# exponential function examples with answers | {
"domain": "ewingconsulting.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.960361156361018,
"lm_q1q2_score": 0.8002925680026275,
"lm_q2_score": 0.8333245911726382,
"openwebmath_perplexity": 542.4767977931447,
"openwebmath_score": 0.8701205849647522,
"tags": null,
"url": "http://ewingconsulting.com/find-life-tmik/0139ff-exponential-function-examples-with-answers"
} |
ros, integration, windows, callbacks
return 0;
}
int CBprofileImageCallback (CAMDESC* cd, int dattyp, int startX, int height, int width, void* pdata)
{
int i=0;
int k=0;
unsigned short* data = NULL;
//~ unsigned short* pDataProf = NULL;
//~ unsigned short* pDataInten = NULL;
std::vector<int16_t> pDataProf;
std::vector<int16_t> pDataInten;
//memory reservation
//~ pDataProf = (unsigned short *)malloc(width*height*sizeof(unsigned short));
//~ pDataInten = (unsigned short *)malloc(width*height*sizeof(unsigned short)); | {
"domain": "robotics.stackexchange",
"id": 20795,
"lm_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, integration, windows, callbacks",
"url": null
} |
java, swing, gui
/**
* Checks the validity of the input date.
*
* @param c the input date.
* @return {@code true} only if the input date is valid.
*/
private boolean isValidDate(Calendar c) {
c.setLenient(false);
try {
c.get(Calendar.DAY_OF_MONTH);
c.get(Calendar.MONTH);
c.get(Calendar.YEAR);
return true;
} catch (Exception ex) {
return false;
}
}
} | {
"domain": "codereview.stackexchange",
"id": 14874,
"lm_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, gui",
"url": null
} |
python, beginner, python-2.x, time-limit-exceeded
move = string.split()
if move[0] == 'split':
game.put_together(int(move[1]))
else:
if move[0] == 'tap':
game.tap((move[1])[0] == 'T', (move[2])[0] == 'T')
move = ['', '', ''] You have many != 0's for conditions. It just so happens that 0 has a boolean value of False, and any other number has a boolean value of True. That means that you can change | {
"domain": "codereview.stackexchange",
"id": 19755,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, python-2.x, time-limit-exceeded",
"url": null
} |
# Finding total distance and time for a bouncing ball - application of series
Problem: A ball is thrown straight upward so that it reaches a height $h$. It falls down and bounces repeatedly. After each bounce, it returns to a certain fraction $f$ of its previous height. Find the total distance traveled, and also the total time, before it comes to rest. What is its average speed?
Attempt at solution: Let $h$ be the initial height of the ball when it is thrown up. Then a distance of $2h$ is covered before the first bounce. Before the second bounce, a distance of $2hf$ is covered, before the third $2hf^2$, and so on.
Hence we have that $s = 2h + 2hf + 2hf^2 + ...,$ with $s$ the total distance covered. This is a geometric series of the form \begin{align*} \sum_{n=1}^{\infty} a r^{n-1}, \end{align*} with $a = 2h$ and $r = f$ in our case. Since $|f| < 1$ (it is a fraction), this series converges to \begin{align*} \frac{2h}{1-f} = s. \end{align*} | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.989510908740062,
"lm_q1q2_score": 0.8180403428416791,
"lm_q2_score": 0.8267117983401363,
"openwebmath_perplexity": 128.99411833840975,
"openwebmath_score": 0.8779532313346863,
"tags": null,
"url": "https://math.stackexchange.com/questions/1200816/finding-total-distance-and-time-for-a-bouncing-ball-application-of-series"
} |
c++, algorithm, object-oriented, graphics
std::vector<Line2d> clippingRegionLines = rectangle.GetLines();
Line2d tempLine = this->line;
Bits start = startPointBits;
Bits end = endPointsBits;
while(start.IsClippingCandidate(end))
{
tempLine = GetClippedLine(clippingRegionLines, tempLine);
Point2d startP = tempLine.GetStart();
Point2d endP = tempLine.GetEnd();
start.PointToBits(max, min, startP);
end.PointToBits(max, min, endP);
}
return tempLine;
}
};
int main()
{
Line2d ln(Point2d(-120, -40), Point2d(270, 160));
Rectangle2d rect(Point2d(20, 20), Point2d(160, 120));
Coordinates2d::ShowWindow("Cohen-Sutherland Line Clipping");
Coordinates2d::Draw(ln, Red);
Coordinates2d::Draw(rect, LightGreen);
ClippingLine2d clip(rect, ln);
Line2d clippedLine = clip.GetClippedLine();
Coordinates2d::Draw(clippedLine, Yellow);
Coordinates2d::Wait();
return 0;
} | {
"domain": "codereview.stackexchange",
"id": 14656,
"lm_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++, algorithm, object-oriented, graphics",
"url": null
} |
general-relativity, cosmology, redshift, gravitational-redshift
from this expression and understand the metric potentials etc. Any reference would be appreciated. Thanks. This answer is pretty much based on Wald's General Relativity, particularly Sec. 5.3.
For completeness, let me begin by saying the first equation you wrote is a more direct definition of redshift. Notice that $g_{\mu\nu} k^{\mu} u^{\nu}$ is exactly the frequency an observer with four-velocity $u^{\mu}$ measures the photon to have. Hence what the expression says is simply that the redshift $z$ is such that
$$1 + z = \frac{\omega_{\text{emitted}}}{\omega_{\text{detected}}},$$
pretty much what we expected the word "redshift" to mean. It is also applicable when studying the gravitational redshift due to a black hole, for example, so it is more general than the cosmological expression (although I believe I've never seen someone using $z$ when talking about black holes, the RHS is pretty common). | {
"domain": "physics.stackexchange",
"id": 85895,
"lm_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, cosmology, redshift, gravitational-redshift",
"url": null
} |
ros, camera1394, image-proc, camera-drivers, pointgrey
Comment by StFS on 2013-02-20:
@Eruditass sorry no we didn't. We never had a USB3 bus though so that may be a different problem. I seem to recall some mention of a fix in PointGray release notes recently concerning USB2 cameras on a USB3 bus.
Comment by StFS on 2013-02-20:
@Eruditass so my advice would be to: 1) upgrade to the latest PointGray driver, 2) use external power to the cameras through GPIO and 3) try to switch the order in which you have your cameras defined in your launch script. | {
"domain": "robotics.stackexchange",
"id": 9885,
"lm_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, camera1394, image-proc, camera-drivers, pointgrey",
"url": null
} |
c, console, io
int main()
{
do
{
double num1;
double a, b = 1;
char ch1;
float r;
scanf("%lf", &num1);
printf("\ta - Factorial\n\tb - Continue\n");
scanf(" %c", &ch1);
switch (ch1)
{
case 'a':
for (a = 1; a <= num1; a++)
{
b = b * a;
}
if (b < 500000001 & num1 > 0)
{
printf("%f\n", b);
}
else
{
if (b > 500000000)
{
printf("Number is Big\n");
}
if (num1 < 1)
{
printf("Number is Small\n");
}
}
break;
case 'b':
double num2;
char ch2;
scanf("%lf", &num2); | {
"domain": "codereview.stackexchange",
"id": 40138,
"lm_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, console, io",
"url": null
} |
python, beginner, python-3.x, programming-challenge, morse-code
NOTE: Extra spaces before or after the code have no meaning and should be ignored.
In addition to letters, digits and some punctuation, there are some special service codes, the most notorious of those is the international distress signal SOS (that was first issued by Titanic), that is coded as ···−−−···. These special codes are treated as single special characters, and usually are transmitted as separate words.
Your task is to implement a function that would take the morse code as input and return a decoded human-readable string.
For example:
decodeMorse('.... . -.-- .--- ..- -.. .')
#should return "HEY JUDE" | {
"domain": "codereview.stackexchange",
"id": 31830,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, python-3.x, programming-challenge, morse-code",
"url": null
} |
quantum-mechanics, hilbert-space, quantum-entanglement, quantum-interpretations, bells-inequality
Kwiat et al, 1995. “New high-intensity source of polarization-entangled photon pairs,” http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.75.4337
Kwiat et al, 1998. “Ultra-bright source of polarization-entangled photons,” http://arxiv.org/abs/quant-ph/9810003
Weihs et al, 1998. “Violation of Bell’s inequality under strict Einstein locality conditions,” http://arxiv.org/abs/quant-ph/9810080
The fact that the CHSH inequality is violated in the real world implies that the premise from which it was derived cannot be correct. The CHSH inequality was derived above by assuming that the act of measurement merely reveals properties that would exist anyway even if they were not measured. The inequality is violated in the real world, so this assumption must be wrong in the real world. Measurement plays a more active role. | {
"domain": "physics.stackexchange",
"id": 54073,
"lm_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, quantum-entanglement, quantum-interpretations, bells-inequality",
"url": null
} |
concurrency, go
So I think your allocation of a go routine here is just a waste of resources.
Go routine are supposed to be used in all the case where you have to deal with blocking code, like read a file, access a database or, as in your case access to a remote API.
All cases when your local thread as nothing to do but wait for an answer.
The function isNumericFilter just perform calculation, so the results is your actual go routine will wait while a go routine perform the same task that your actual go routine could perform.
I think your point here is that you could do it concurrently, but my point is that the calculation you want to perform concurrently is not so slow.
Consider that allocating go routine is not free, so you should first try the to do in the same go routine and just after you see that a part is slow and could be performed concurrently, than you should go ahead with new go routines.
Another point that I can see in your code is you don't use a channel for errors. | {
"domain": "codereview.stackexchange",
"id": 26163,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "concurrency, go",
"url": null
} |
electrostatics
Electric potential does the same for a charge. Charge move towards points of lowest energy. Having the same energy level or potential at every point (connecting both ends of a wire to the same battery pole, e.g.) makes no charge move. But having a charge difference (connecting the one end to the positive pole (at high potential) and the other end to the negative pole (at low potential), makes them move towards the point at lower potential. | {
"domain": "physics.stackexchange",
"id": 41835,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics",
"url": null
} |
programming, gate-synthesis
If you think of it as XY-rotations, and assuming $p_1$ and $p_2$ do not hold some relation, the two rotations are made along different axes on the XY-plane and therefore the total operation may not be described by a rotation on the XY-plan anymore, making your equation impossible to solve. | {
"domain": "quantumcomputing.stackexchange",
"id": 5246,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "programming, gate-synthesis",
"url": null
} |
newtonian-mechanics, energy, energy-conservation, work
$W = -15mV_1^2/32 = -15K_1/16$ According to the Work-Energy Theorem, the net work done to some object is equal to the difference in its kinetic energy, this is,
\begin{align}
W_{net}=K_{final}-K_{initial}.
\end{align}
In order to understand what you mean by "independent of velocity direction", suppose we have an object at rest, and you can move it either to the right or to the left. Firstly, consider that we move it to the right by some force so it ends up with a velocity $v$, then the net work done is
\begin{align}
W_{net}&=\frac{1}{2}mv^2 - 0. \\
&=\frac{1}{2}mv^2 .
\end{align} | {
"domain": "physics.stackexchange",
"id": 62278,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, energy, energy-conservation, work",
"url": null
} |
astrophysics, laser, plasma-physics, ionization-energy
Is it the electron density produced as a result of ionization from $i$ state to $i + 1$?
Perhaps or perhaps not. Again, this is not the issue so much as $n_{e}$ corresponds to the total electron number density. | {
"domain": "physics.stackexchange",
"id": 55865,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astrophysics, laser, plasma-physics, ionization-energy",
"url": null
} |
c++, algorithm, search, random, simulation
}
break;
}
if(debug_info) {std::cout<<std::endl;}
run_time_p++;
code_size = code2.size();
code_pos = code_pos % code_size;
if(run_time_p == most_run_time) {
cont = false; out_of_time_p = true;}
if(code_size > largest_program)
{
cont = false;
can_resume_p = false;
out_of_space_p = true;
if (debug_info)
std::cout<<"became too large"<<std::endl;
}
if(output.size() > largest_output_size)
{
cont = false;
can_resume_p = false;
output.pop_back();
if (debug_info)
std::cout<<"too much output"<<std::endl;
}
} | {
"domain": "codereview.stackexchange",
"id": 2755,
"lm_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++, algorithm, search, random, simulation",
"url": null
} |
feature-selection, linear-regression
Title: In linear regression, is there anything I can do if the coefficient for one of the features is unrealistic/inappropriate? I'm building a simple linear regression model that predicts Home Price using Square Footage, Number of Bed(s), and Number of Bathroom(s).
After creating the model, I noticed that the coefficients for Square Footage and Number of Bed(s) were positive, which makes sense since Home Prices increases as Square Footage/Number of Bed(s) increases. However, the coefficient for Number of Bathroom(s) was negative, which makes no sense since Home Price does not decrease as Number of Bathroom(s) increases! | {
"domain": "datascience.stackexchange",
"id": 4490,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "feature-selection, linear-regression",
"url": null
} |
anderson-localization
help that how to proceed for that? The states which are most difficult to localise (i.e. they require the largest disorder strength to be localised) are those in the middle of the spectrum; also, the system becomes completely localised when all states in the system are localised. So if you want to proceed with exact diagonalisation (ED) and inverse participation ratios (IPRs), compute the IPRs of the states in the middle of the spectrum, average the IPRs over states and disorder, and do a finite-size scaling procedure. | {
"domain": "physics.stackexchange",
"id": 98587,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "anderson-localization",
"url": null
} |
javascript, beginner, jquery
Title: Meet Results Displayer I decided to dive into the world of JS/JQuery by trying to build a simple web app to display all of my various meet results in an easy-to-view manner. For this stage of the review, all it does is generate a table of all the meets and log some stuff to the console when you click on it.
The app gets its data as JSON in a form like:
[{"Date": "MM/DD/YYYY", "Name": "Some Event", "Sport": "Run", "Events": [...]},
{"Date": "MM/DD/YYYY", "Name": "Some Other Event", "Sport": "Swim", "Events": [...]},
...
]
and displays them in a table like: | {
"domain": "codereview.stackexchange",
"id": 16638,
"lm_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, beginner, jquery",
"url": null
} |
computational-physics, continuum-mechanics, discrete, eigenvalue, coupled-oscillators
So for your model with 5 elements, probably only one eigenvector (the lowest frequency) would be useful for real-life engineering work, and at best it would only be worth plotting the mode shapes for the two or three lowest frequencies. | {
"domain": "physics.stackexchange",
"id": 34842,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computational-physics, continuum-mechanics, discrete, eigenvalue, coupled-oscillators",
"url": null
} |
electric-circuits, electricity, electrons, electric-current, faster-than-light
Title: Can we make electron drift velocity faster than light by reducing area of resistor? We know that $I= nqAV_d$.
Can we send high current ($I$) through a "fat wire" (more $A$) then reduce $A$ at the resistor so much that $V_d$ becomes faster than light in order to maintain $I$? A metal would melt before the drift velocity reaches anywhere near the speed of light (besides all the other mechanisms preventing the drift velocity from getting that high).
In semiconductors, and likely in metals at very high current densities as well, the drift velocity eventually stops increasing linearly with the electric field. This is known as velocity saturation and is mainly due to carriers scattering by emitting optical phonons. The saturation velocity is on the order of $10^7\ \text{cm/s}$ for most semiconductors, about 3 orders of magnitude lower than the speed of light. | {
"domain": "physics.stackexchange",
"id": 87639,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electric-circuits, electricity, electrons, electric-current, faster-than-light",
"url": null
} |
python
Parameters:
element: The element from which the formats are extracted.
Returns:
A list of unique formats.
"""
line_formats = set()
for text_line in element:
if isinstance(text_line, LTTextContainer):
for character in text_line:
if isinstance(character, LTChar):
format_info = f"{character.fontname}, {character.size}"
line_formats.add(format_info)
return list(line_formats)
def format_table(table: list[list[str | None]]) -> str:
"""
Converts a 2D table into a string format, where each cell is separated by '|'
and each row is on a new line. Newline characters in cells are replaced with spaces,
and None values are converted to the string 'None'.
Parameters:
table: The 2D table to convert.
Returns:
The string representation of the table. | {
"domain": "codereview.stackexchange",
"id": 45296,
"lm_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",
"url": null
} |
python, beginner, python-3.x, number-guessing-game
def com_num_guesses(level): #function to get the number of guesses taken by the computer
if level == "e":
com_guesses = round(random.normalvariate(3.7,1.1))
if level == "m":
com_guesses = round(random.normalvariate(5.8,1.319))
if level == "h":
com_guesses = round(random.normalvariate(8.99,1.37474))
print("The computer guessed the number in {0} guesses! Can you beat that?".format(com_guesses))
return com_guesses | {
"domain": "codereview.stackexchange",
"id": 21144,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, python-3.x, number-guessing-game",
"url": null
} |
c#, generics
}
}
else if (_obj is Comment)
{
var comment = (Comment)_obj;
Client borrower = clientRepository.GetMainBorrower(comment.ApplicationID);
emailService().SendEmail("", comment.User.Email,"Comment for the following application: " + borrower.CompanyName + " (" +comment.ApplicationID + ") with message: " + comment.Message + " on date: " +comment.CreatedDate,"Comment for the following application: " + comment.ApplicationID);
}
else if (_obj is Memo)
{
var memo = (Memo)_obj;
var email = userRepository().GetManagerForUser(memo.UserID).Email;
Client borrower = clientRepository.GetMainBorrower(memo.ApplicationID);
if (_objInPreviousState == null)
{
emailService().SendEmail("", email, message, subject);
}
else
{ | {
"domain": "codereview.stackexchange",
"id": 2805,
"lm_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#, generics",
"url": null
} |
performance, csv, vb.net
Dim pBar As Integer = 1
progBar.Maximum = userLAR.Length
Dim pBarScale As Decimal = 0
For i As Integer = 0 To userLAR.Length - 1
curLN = userLAR(i).ToString
' Specify the URL to receive the request.
Dim request As HttpWebRequest = CType(WebRequest.Create("https://empDB.mysite.com/emps/" & curLN), HttpWebRequest)
' Set some reasonable limits on resources used by this request
request.MaximumAutomaticRedirections = 4
request.MaximumResponseHeadersLength = 4
' Set credentials to use for this request.
request.Credentials = CredentialCache.DefaultCredentials
Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
' Get the stream associated with the response.
Dim receiveStream As Stream = response.GetResponseStream() | {
"domain": "codereview.stackexchange",
"id": 15267,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, csv, vb.net",
"url": null
} |
c#, formatting
public class SimpleCustomerDiscount : AccountDiscount
{
public override decimal Discount => 0.10m;
}
public class LoyaltyDiscount : AccountDiscount
{
public override decimal Discount { get; }
public LoyaltyDiscount(int totalYears) : base()
{
Discount = totalYears > 5 ? 0.50m : totalYears / 100.00m;
}
}
then you can add each discount to an account and store that in the database level, which will help you achieve this :
public decimal ApplyDiscounts(IEnumerable<AccountDiscount> discounts, decimal price)
{
decimal finalPrice = price;
foreach(var discount in discounts)
{
finalPrice -= discount.GetDiscountedPrice(finalPrice);
}
return finalPrice;
}
public decimal ApplyDiscountsByAccountId(int accountId, decimal price)
{
List<AccountDiscount> discounts = _someRepoistory.GetAccountDiscounts(accountId);
return ApplyDiscounts(discounts, price);
} | {
"domain": "codereview.stackexchange",
"id": 42134,
"lm_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#, formatting",
"url": null
} |
-
I knew Wilson's Theorem, but really don't know how to find the inverse of 17, 18 mod 19. What's the inverse? Can you give me one example? Thanks. – Chan Feb 26 '11 at 6:17
@Chan: $\rm 17 \equiv -2,\ 18\equiv -1$ – Bill Dubuque Feb 26 '11 at 6:21
@Chan: A general technique to find the inverse of $k$ mod $n$ when $k$ and $n$ are relatively prime is to use integer division and the Euclidean algorithm to find $a$ and $b$ such that $ak + bn = 1$. Since $bn$ is a multiple of $n$, $ak$ is congruent to $1$ mod $n$, and thus the congruence class of $a$ is the inverse of the congruence class of $k$. In this particular case, a further hint to make things easier is that $18\equiv -1$ and $17\equiv -2$ mod $19$. (This makes computations easier for inverting their product.) – Jonas Meyer Feb 26 '11 at 6:21
Many thanks, I got it now ;) – Chan Feb 26 '11 at 6:24
HINT $\$ By Wilson's theorem $\$ mod $19\::\ -1 \ \equiv\ 18\:!\ \equiv\ 18\cdot17\cdot 16\:!\ \equiv\ (-1)\ (-2)\cdot 16\:!$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.975946445006747,
"lm_q1q2_score": 0.8513643207476087,
"lm_q2_score": 0.8723473763375643,
"openwebmath_perplexity": 362.9958573576288,
"openwebmath_score": 0.9255539178848267,
"tags": null,
"url": "http://math.stackexchange.com/questions/23809/what-is-the-remainder-of-16-is-divided-by-19"
} |
homework-and-exercises, capacitance
But, my problem now is relating charge of the equivalent capacitors plate to the original 'split' configuration of capacitors. As in, how would I find the charge on original plates?
On, second thought maybe I could have skipped the whole equivalent capacitor procedure and maybe directly found the capacitance taking the capacitance of a capacitor with the plate of interest as in parallel with the battery. Now this is easy to do for plate -1 as it only has plate-2 adjacent to it, however for plate-4, it makes a capacitor with plate -3 and plate -5. So how would I deal with this? Note that plates 2,3,and 4 have a charge of q/4 on each side of each plate, but plates 1 and 5 have q/4 only on the inner surfaces. | {
"domain": "physics.stackexchange",
"id": 70001,
"lm_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, capacitance",
"url": null
} |
As you observed, the non-constant homomorphisms are injective. Because $$A_5$$ is the only subgroup of $$S_5$$ of order $$60$$ we are looking for automorphisms from $$A_5$$ to itself.
To each element $$g\in S_5$$ we get a conjugation automorphism $$\phi_g(x)=gxg^{-1}$$ for all $$x\in A_5$$. Because the centralizer of $$A_5$$ in $$S_5$$ is trivial, distinct choices of $$g$$ yield distinct automorphisms $$\phi_g$$.
Claim. Any automorphism $$\phi$$ of $$A_5$$ is of the form $$\phi_g$$ for some $$g\in S_5$$.
Proof. The group $$A_5$$ has five distinct Sylow $$2$$-subgroups. Namely $$P_5=\{1,(12)(34),(13)(24),(14)(23)\}$$ and its conjugates, each stabilizing a single element of $$J_5:=\{1,2,3,4,5\}$$. I will denote by $$P_i$$ the conjugate stabilizing $$i\in J_5$$. Because $$\phi$$ is an automorphism it must permute these 5 groups. So there is a permutation $$\sigma\in S_5$$ such that $$\phi(P_i)=P_{\sigma(i)}$$ for all $$i\in J_5$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9773708039218115,
"lm_q1q2_score": 0.8227758037984625,
"lm_q2_score": 0.8418256412990658,
"openwebmath_perplexity": 92.43546156593392,
"openwebmath_score": 0.955654501914978,
"tags": null,
"url": "https://math.stackexchange.com/questions/3134568/find-the-number-of-group-homomorphism-between-a-5-and-s-5"
} |
c#, console
I decided to go for option #3.
#regions
I am not a big fan of #regions. In general, if your code is so complex that you need to break it down into #regions to understand it, then you should rather break it down into methods and objects.
Comments
You have a lot of comments in your code. Personally, I think a lot of comments are a Code Smell: your code already tells you what your code does, if you need comments to tell you what your code does, then your code is too complex.
More precisely, well-written, well-factored, readable code should tell you how the code does things. Well-chosen, intention-revealing, semantic names should tell you what the code does.
The only reason to have comments is to explain why the code does a certain thing in a certain, non-obvious way.
For example, here:
// Show the intro and game rules
ShowIntro(); | {
"domain": "codereview.stackexchange",
"id": 42589,
"lm_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#, console",
"url": null
} |
nlp
We couldn't find anything for integrate with existing website
And now I get a warning that my question "appears to be subjective and is likely to be closed". I'm sure that's machine learning at work. Granted, the step by step details might be different if your site is php vs python, but the issue is a major one I assume a lot of people are going to run into sooner if not later. My site is in Django.
How do you integrate the product of nlp into an existing, complex website with many apps and functions? The answer is it depends on you architecture.
Some things to consider: | {
"domain": "datascience.stackexchange",
"id": 5779,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nlp",
"url": null
} |
drying, evaporation
In principle, for small amounts of water, and a fixed heater power: if airflow is doubled, then the difference in temperature between that airflow and room temperature would be halved. Similarly, if the airflow is halved, the difference in temperature would be doubled. What would the effect on rate of evaporation be?
Perhaps this is impossible to answer without more information, in which case, how might this problem be solved? A compromise would have to be established on criteria like cost of higher pressure air flow generation, noise levels, power consumption, energy efficiency, rate of drying, surface area of objects to be dried, etc etc etc. Might this be better off just developed with experimentation?
Any level of guidance would be appreciated If you are only interested in temperature, flow rate, and drying rate, then you could consider the following quantities for a given air temperature $T$: | {
"domain": "engineering.stackexchange",
"id": 882,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "drying, evaporation",
"url": null
} |
For your first question: The period of $g$.
For your second question: Suppose for a contradiction that g does not have a finite period. Then it will generate an infinite number of elements, resulting in an group with infinite number of elements which is a contradiction to the supposition that $G$ is finite. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9683812327313546,
"lm_q1q2_score": 0.8324822494167106,
"lm_q2_score": 0.8596637577007394,
"openwebmath_perplexity": 86.01365711651012,
"openwebmath_score": 0.9488869309425354,
"tags": null,
"url": "https://math.stackexchange.com/questions/616826/order-of-elements-within-a-group"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.