text stringlengths 1 1.11k | source dict |
|---|---|
general-relativity, lagrangian-formalism, differential-geometry, history, geodesics
Ricci and Levi-Civita realized afterward in the same book that this covariant derivative can be linked to geodesics and hence to the minimization principle you are referring to. The reason why applying Euler-Lagrange (from classical mechanics) give you this derivative is because this derivative tells you how to "parallel transport" a vector (see Levi-Civita's paper in 1917) and this is exactly what the velocity of a path which extremalize the length (a geodesic) does. | {
"domain": "physics.stackexchange",
"id": 99299,
"lm_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, lagrangian-formalism, differential-geometry, history, geodesics",
"url": null
} |
javascript, parsing, coordinate-system, svg, cross-browser
// simple pathToAbsolute for polygons
// returns an array with ABSOLUTE points of the polygon path
var pathToAbsolute = function(p) {
var np = p.match(/(m[^l]*|l[^(l|z)]*)/gi), // we extract the segments string from path string
l = np.length, s, c, r, x = 0, y = 0;
for (var i = 0; i<l; i++){ // here we start processing each segment string
np[i] = np[i].trim(); // we trim the segment string
c = np[i][0].trim(); r = new RegExp(c); // the path command
np[i] = np[i].replace(/(^|[^,])\s*-/g, '$1,-') // fix the x,y 186.101-87.287 to -186.101,-87.287 separation
.replace(/[\s+\,|\s|\,]/g,'|') // replace any spacing and comma with another separator
.replace(r,'') // remove the path command from string
.split('|'); // split by new separator
np[i][0] === '' && np[i].shift(); // I need a way to avoid this
np[i][0] = parseFloat(np[i][0]); // make sure we do math with numbers
np[i][1] = parseFloat(np[i][1]); | {
"domain": "codereview.stackexchange",
"id": 19119,
"lm_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, parsing, coordinate-system, svg, cross-browser",
"url": null
} |
javascript, strings, regex
input.value = format_number(input.value);
}
function format_number(str) {
var replacements = [
[/regex1/, 'replace1'],
[/regex2/, 'replace2'],
[/regex3/, 'replace3'],
[/regex4/, 'replace4'],
[/regex5/, 'replace5'],
[/regex6/, 'replace6'],
[/regex7/, 'replace7'],
[/regex8/, 'replace8'],
[/regex9/, 'replace9'],
[/regex10/, 'replace10'],
[/regex11/, 'replace11'],
[/regex12/, 'replace12'],
[/regex13/, 'replace13'],
[/regex14/, 'replace14'],
[/regex15/, 'replace15'],
[/regex16/, 'replace16'],
[/regex17/, 'replace17']
];
for (var i=0; i<replacements.length; i++) {
var copy = str.replace(replacements[i][0], replacements[i][1]);
if (str != copy)
return copy;
}
return str;
} | {
"domain": "codereview.stackexchange",
"id": 7934,
"lm_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, strings, regex",
"url": null
} |
ros, subscribe
Originally posted by 215 on ROS Answers with karma: 156 on 2016-12-07
Post score: 0
ros::spin() should be fair about the scheduling of the different ROS capabilities, so I'm not sure your actual problem is that you can't call the service because of the subscriber. Did you validate this by disabling the subscriber or throttling the topic?
If this is the deterministic problem you describe, please file a detailed issue at https://github.com/ros/ros_comm that allows others to analyze and address this.
Alternatively, you can consider multithreading your node to allow background processing of messages even when a service call is received. This is as easy as adding ros::AsyncSpinner spinner(1); spinner.start() to your main function.
Originally posted by v4hn with karma: 2950 on 2016-12-08
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 26424,
"lm_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, subscribe",
"url": null
} |
molecular-genetics, homework
My attempt to solve this was as follows:
Observing the sgs1 Δ mutant in homozygosis for MEC1, we see that the phenotype that is produced is within a scale close to the WT phenotype. Further, in heterozygosis for mec1-100 without mutation we also see a phenotypical scale similar to the WT. When we see the heterozygotes for mec1-100/sgs1Δ the scale drops abruptly and the phenotype passes to be very far from the WT phenotype. This last one can be explained as an incomplete dominance in which the genotype of mec1 must present both WT allels to achieve its effect, because just one of the WT alleles cannot fulfill its function, so what we see in comparison with the sgs1Δ/MEC1 homozygote dominant is different from mec1-100/sgs1Δ. When we mutate the gen mec1Δ we see that the viability of the cells is reduced, even though the gen sgs1 is still present. | {
"domain": "biology.stackexchange",
"id": 11801,
"lm_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-genetics, homework",
"url": null
} |
fourier-transform, filter-design, correlation
I will appreciate any help with this.
Thanks The nth entry in the u vector corresponds to the value of the desired correlation peak of the nth training image. Typically you set u to be all ones if you have only images from the positive class. Entries corresponding to negative class example images are typically set to zero. | {
"domain": "dsp.stackexchange",
"id": 2231,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fourier-transform, filter-design, correlation",
"url": null
} |
let c 1,,c r be any basis for the column space of A. To summarize so far, the first stage of Gaussian elimination is to reduce the augmented matrix. Exactly 1 OC. a unique solution ii. Then you can row reduce to solve the system. Use Gauss-Jordan elimination on augmented matrices to solve a linear system and calculate the matrix inverse. The augmented matrix is the combined matrix of both coefficient and constant matrices. These techniques are mainly of academic interest, since there are more efficient and numerically stable ways to calculate these values. Pictures: an inconsistent system of equations, a consistent system of equations, spans in R 2 and R 3. Solve the following system using augmented matrix methods: 5x - 10y = 65 8x - 16y = 104 (a) The initial matrix is: [5 8 -10 -16 65 104] (b) First, perform the Row Operation 1/5 R_1 rightarrow R_1. The leading unknowns are x 1, x 3 and x 5; the free unknowns are x 2 and x 4. Examples and questions with detailed solutions are | {
"domain": "perron-elagage.fr",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9883127420043056,
"lm_q1q2_score": 0.8033671210571836,
"lm_q2_score": 0.8128673110375457,
"openwebmath_perplexity": 265.98192846660635,
"openwebmath_score": 0.7407686114311218,
"tags": null,
"url": "http://casr.perron-elagage.fr/solve-augmented-matrix-r.html"
} |
2. Find the intersection. This is solving for either variable and then plugging it in to get coordinates.
3. Draw a right triangle using a diagonal radius to the intersection and a horizontal line. Based on what you know about slope and tangents, this should help you find an angle that is complementary to your angle. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9787126525529015,
"lm_q1q2_score": 0.8554704541799163,
"lm_q2_score": 0.8740772400852111,
"openwebmath_perplexity": 150.47076647157192,
"openwebmath_score": 0.7090710401535034,
"tags": null,
"url": "https://math.stackexchange.com/questions/712665/find-angles-of-intersection-between-circle-and-line-segment-on-circle"
} |
Polar Partial Derivatives - Boas Ch 4 Sect 1 Prob 13
Tags:
1. Aug 10, 2017 at 7:42 PM
rhdinah
1. The problem statement, all variables and given/known data
If $z=x^2+2y^2$, find the following partial derivative:
$$\Big(\frac{∂z}{∂\theta}\Big)_x$$
2. Relevant equations
$x=r cos(\theta), ~y=r sin(\theta),~r^2=x^2+y^2,~\theta=tan^{-1}\frac{y}{x}$
3. The attempt at a solution
I've been using Boas for self-study and been working on this problem for almost a week now and cannot get the expected answer. I'm persistent though and have decided to look outside my study area for some help. So if you can add some direction or pointers I'd appreciate it. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9621075777163567,
"lm_q1q2_score": 0.8017479118296477,
"lm_q2_score": 0.8333245994514084,
"openwebmath_perplexity": 375.30242157675235,
"openwebmath_score": 0.8050715923309326,
"tags": null,
"url": "https://www.physicsforums.com/threads/polar-partial-derivatives-boas-ch-4-sect-1-prob-13.922453/"
} |
java, dynamic-programming
}
return lcsMatrix[firstWord.length-1][secondWord.length-1];
} Correctness:
It seems your implementations is incorrect since you are always ignoring the first character.
Here in both loops the range should be closed:
for(int i = 0; i <= firstWord.length; i++) {
for(int j = 0; j <= secondWord.length ; j++) {
...
}
}
And the second if inside the inner loop should look like this:
else if(firstWord[i - 1] == secondWord[j - 1]) {
...
}
finally the function should return this:
return lcsMatrix[firstWord.length][secondWord.length];
DRY your code:
Since in java an array of primitive integers are initialized to zero there is no need for the first if, therefore you can start the loop at i = 1 and j = 1. You could also use a ternary operator after getting rid of the if statement(although some people may prefer the if else). | {
"domain": "codereview.stackexchange",
"id": 26012,
"lm_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, dynamic-programming",
"url": null
} |
homework-and-exercises, newtonian-mechanics, elasticity, statics, continuum-mechanics
For the first section from A to C the internal moment is $$M_1(x) = -x\,A_y = - x \,\frac{F}{2} $$
For the second section from C to B the internal moment is $$M_2(x) = -x \, A_y+ F (x-\frac{\ell}{2}) = - (\ell -x) \frac{F}{2}$$
Now you can integrate the moment to get slope and deflection and make sure you use the constants of integration for fitting into the boundary conditions (at $y_1(0)=0$ and $y_2(\ell)=0$) and continuity ($y_1(\frac{\ell}{2})=y_2(\frac{\ell}{2})$ and $y_1'(\frac{\ell}{2}) = y_2'(\frac{\ell}{2})$)
The deflection shape is $$
y_1(x) = \frac{1}{E I} \int \int M_1(x)\,{\rm d}x{\rm d}x + K_1 + K_2 x = -\frac{F x (4 x^2-3 \ell^2)}{48 E I} \\
y_2(x) = \frac{1}{E I} \int \int M_2(x)\,{\rm d}x{\rm d}x + K_3 + K_4 x =
-\frac{F ( \ell^3 -9 \ell^2 x+12 \ell x^2 -4 x^3)}{4 8 EI }$$
In the middle use $x=\frac{\ell}{2}$ for $$ \boxed{\delta = -\frac{F \ell^3}{48 E I} } $$
Here the result is negative because the deflection is along the negative y direction | {
"domain": "physics.stackexchange",
"id": 36507,
"lm_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, elasticity, statics, continuum-mechanics",
"url": null
} |
fourier-transform, audio, frequency-spectrum
Specifically, if you multiply a discrete signal in the time domain by a complex phasor of the general form $e^{j\omega n}$ where n is the sample count and $\omega$ is a fractional radian frequency between $0$ and the sample rate given as $2\pi$, the spectrum will be shifted accordingly by $\omega$ as given by the frequency translation property of the FT (when $\omega$ is a positive number this shift will be to the right, and when $\omega$ is a negative number this shift will be to the left). Since the frequency spectrum for a discrete signal is periodic over the fractional radian frequency range from $0$ to $2\pi$, this shift will also be a spectral rotation, as is clearer from the spectrums I plotted further below (consider shifting these spectrums a small amount to the left and observe how within the range from $0$ to $2\pi$ the spectrum rotates meaning that the spectrum that goes over $f_s$ in the shift appears at $f=0$.) | {
"domain": "dsp.stackexchange",
"id": 9208,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fourier-transform, audio, frequency-spectrum",
"url": null
} |
regular-languages, finite-automata, regular-expressions
Is my logic right? This is essentially @Yuval's hint, expressed in a slightly different way. You've said that you can prove
$$
L_u = \{0^n1^m\mid n, m \ge 0, n - m \equiv 0\pmod{3}\}
$$
is regular. If so, then its intersection with the regular language denoted by $00^*11^*$ will be regular. Show that this intersection is equal to
$$
L_r = \{0^n1^m\mid n, m > 0, n - m \equiv 0\pmod{3}\}
$$
and you're done. Notice that a similar construction shows that
$$
\{0^n1^m\mid n > k, m > j, n - m \equiv 0\pmod{3}\}
$$
is also regular for any $k, j > 0$.
The same idea can be used on your second question. | {
"domain": "cs.stackexchange",
"id": 3413,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "regular-languages, finite-automata, regular-expressions",
"url": null
} |
$570 = 1\times 18 + 2\times 17 + 3\times 16 + 4\times 15 + 5\times 14 + 6\times 13 + 7\times 12 + 8\times 11 + 9\times 10$
In general, if we wish to calculate the resultant value at point $$(u, v)$$ on the surface grid, we must add the contributions from all point sources on the signal grid, $$(x, y)$$ where $$x = 1,\ldots,3$$ and $$y = 1,\ldots,3$$. The contribution of a point source at $$(x, y)$$ is given by the product of the intensity at $$(x, y)$$, which is $$S(x, y)$$, and the point spread due to the blurring effect of the convolution kernel, which is given by $$K(x', y')$$ where $$(x', y')$$ is the kernel coordinate that corresponds to the point source coordinate $$(u, v)$$ on the surface grid coordinate system. If we do the translation, we get $$x' = x - u$$ and $$y' = y - v$$. In fact, this is what causes the flipping of the kernel! This translation is shown visually in the following diagram.
Thus, we can write discrete convolution as follows: | {
"domain": "yaikhom.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.97241471777321,
"lm_q1q2_score": 0.8145139861584657,
"lm_q2_score": 0.8376199694135332,
"openwebmath_perplexity": 159.9402790682537,
"openwebmath_score": 0.9422643780708313,
"tags": null,
"url": "https://yaikhom.com/2020-12-16-understanding-convolution-through-echoes-and-blurring.html"
} |
quantum-field-theory, hilbert-space, fermions, grassmann-numbers, ground-state
The field operators are represented by
$$
\hat\psi_n\Psi[u] = u_n\Psi[u]
\hskip2cm
\hat\psi_n^\dagger\Psi[u] \sim \frac{\partial}{\partial u_n}\Psi[u].
\tag{4}
$$
(Again, I'm writing "$\sim$" so that I don't have to keep track of minus signs.) Inside the inner product (3), taking the derivative of $\Psi_2[u]$ with respect to $u_n$ has the same effect as multplying the other wavefunction $\Psi_1[w]$ by $w_n$, so the second operator in (4) really does represent the adjoint of the first operator in (4).
For a more detailed treatment that pays closer attention to minus signs, see chapter 4 in Montvay and Münster's book Quantum Fields on a Lattice.
The ground state
Regardless of what Hilbert-space representation we use, we can choose a basis for the set of field operators $\hat\psi_n$ that diagonalizes the matrix $M$. This is standard textbook material, so suppose that this has already been done. Then the Hamiltonian has the form
$$
H\sim\sum_{n}\omega_n\hat\psi_n^\dagger\hat\psi_n. | {
"domain": "physics.stackexchange",
"id": 59646,
"lm_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, hilbert-space, fermions, grassmann-numbers, ground-state",
"url": null
} |
experimental-physics, measurements, scattering-cross-section
Title: Measurement of cross section When we measure the cross section of an interaction what is it that we actually measure in a real experiment?
I know what cross section is and how to derive an expression for a given process but I have no idea how we go about actually measuring it. You typically measure the probability of the event. For example, you shoot X-rays at a known blob of material and measure the fraction of Xryas that were deflected / absorbed. You can then imagine each atom in the material to have a certain cross section, and imagine whether you could "shoot past" all those atoms for a given average cross section.
Make sense? | {
"domain": "physics.stackexchange",
"id": 18751,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "experimental-physics, measurements, scattering-cross-section",
"url": null
} |
python, python-3.x, hash-map, meta-programming
To support the super().__init__ I've used the same signature in each class's __init__ method.
I cannot think of a way to use a metaclass here myself, so I moved build_option_dict inside of the class.
if not kwargs['value']: raise KeyError doesn't make much sense, better store the value in some variable and if the key is missing Python will raise an error itself. | {
"domain": "codereview.stackexchange",
"id": 12204,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x, hash-map, meta-programming",
"url": null
} |
• The ratio of Riemann sums is $\dfrac{\sum_{r=1}^N f^2(\frac rN)}{\sum_{r=1}^N f(\frac rN)}$. Why is that maximal for $f(x) = x$? – If your argument is correct then the integral inequality would hold for all functions on $[0, 1]$ with $0 \le f(x) \le x$. – Martin R Apr 2 at 11:24
• Because in every small interval $(rh, (r+1)h)$ the ratio $𝑓^2(𝑟ℎ)/𝑓(𝑟ℎ)=𝑓(𝑟ℎ)$. As a convex function will lie below (or coincide with) the chord $y=x$, we must have $f(rh) \leq rh$. And yes, the integral inequality would hold if $0 \leq f(x) \leq x$. The convexity assures that only. – Anirban Apr 2 at 14:19
• Here is a counter-example (unless I made some error): $f(x) = \sqrt{2x-1}$ for $0.5 \le x \le 1$, $f(x) = 0$ otherwise. Then $\int_0^1 f^2(x)dx = \frac 14$ and $\int_0^1 f(x) dx = \frac 13$. – Martin R Apr 2 at 14:34 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.97631052387569,
"lm_q1q2_score": 0.8135835742282413,
"lm_q2_score": 0.8333245973817158,
"openwebmath_perplexity": 167.18845500679558,
"openwebmath_score": 0.9829267859458923,
"tags": null,
"url": "https://math.stackexchange.com/questions/3170513/int-abf2x-dx-le-frac23-int-abfx-dx-for-a-convex-differentiable"
} |
algorithms, graphs, shortest-path
Then the pairs along with their distance would be $(1,2):1,(1,3):2,(1,4):3,(2,3):1,(2,4):2,(3,4):1$, so the total sum of distances would be $1+2+3+1+2+1=10$.
I tried Dijkstra's Algorithm (time complexity $O(n\log n)$) on every node but the time complexity is $O(n^2 \log n)$ which is inefficient. Is there a way to reduce it to $O(n \log n)$ or less? I think the question is not clear enough, but what I understood is that we want to find the sum of all the shortest path from $u$ to $v$ such that $u < v$. The trick is that the graph is actually a directed chain, so we can represent the edges in an array $A$ of length $n - 1$. | {
"domain": "cs.stackexchange",
"id": 8539,
"lm_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, graphs, shortest-path",
"url": null
} |
quantum-computing
In this case, it's probably easiest to see that you can apply the action of $\mathrm{CNOT}$ on the standard basis states $|0\rangle|0\rangle$ and $|1\rangle|0\rangle$ separately, which form the components of $|\psi_1\rangle$, to obtain components $|0\rangle|0\rangle$ and $|1\rangle|1\rangle$ respectively; this is possible because the $\mathrm{CNOT}$ operation (and all other permutations and unitary operators) is linear. | {
"domain": "cs.stackexchange",
"id": 1170,
"lm_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-computing",
"url": null
} |
homework-and-exercises, newtonian-gravity, kinematics, acceleration
Given the assumption that all the accelerations are constant and down is defined as the positive direction then using the constant acceleration kinematic equations the answer to the question is that the acceleration of the body is $-24 \,\rm m\, s^{-2}$. | {
"domain": "physics.stackexchange",
"id": 52731,
"lm_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-gravity, kinematics, acceleration",
"url": null
} |
random-forest, decision-trees
This never made sense to me. Since each decision tree is trained independently, adding more decision trees should just make your ensemble more and more robust.
(This is different from gradient boosting trees, which are a particular case of ada boosting, and therefore there is potential for overfitting since each decision tree is trained to weight residuals more heavily.)
I did a simple experiment:
from sklearn.datasets import load_digits
from sklearn.ensemble import RandomForestClassifier
from sklearn.grid_search import GridSearchCV
import numpy as np
import matplotlib.pyplot as plt
plt.ioff() | {
"domain": "datascience.stackexchange",
"id": 1030,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "random-forest, decision-trees",
"url": null
} |
• Heropup - Thank you so much for taking the time to show the math involved and the different consequences of taking a geometric mean of means, a geometric mean of the original raw observations, and the arithmetic mean of means. Your example with 3 different sample sizes was particularly helpful and an excellent illustration of how different results would be obtained without appropriate weighting! – plasticnavymike Jul 5 '19 at 13:17
You average geometric means with a geometric average - in this case the July mean is the fifth root of the product of the five annual July geometric means. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9790357561234475,
"lm_q1q2_score": 0.8027048963752806,
"lm_q2_score": 0.8198933403143929,
"openwebmath_perplexity": 324.25570317631764,
"openwebmath_score": 0.7463952898979187,
"tags": null,
"url": "https://math.stackexchange.com/questions/3283179/mean-of-geometric-means"
} |
electrostatics, electric-fields, potential, potential-energy, conservative-field
Remark
I am very tired of stupid websites that use the term "potential" and "potential energy" interchangeably. I wanted this list not only for reasons of disambiguation but also (if it's correct), to serve as a systematic reference, which, when written this way aids the understanding of these formulae. Let me first start by saying that there is no symmetry between them as "symmetry" has a particular technical meaning to it. There is, however, a very precise relation between the two.
Essentially it all comes down to the equations determining the electrostatic field and the gravitational field. Looking at Maxwell's equations, we can see that in the special case where nothing is time-varying, the determining equations for the electric field are
$$
\nabla\cdot\vec E=\rho/\varepsilon_0,\ \ \ \ \nabla\times\vec E=0,
$$
where $\rho$ is the charge density.
On the other hand, the equations determining the (Newtonian) gravitational field are
$$ | {
"domain": "physics.stackexchange",
"id": 78424,
"lm_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, electric-fields, potential, potential-energy, conservative-field",
"url": null
} |
performance, c, embedded, memory-optimization, khronos
PaStream *stream = NULL;
PaError err = init(&stream, data, sampleBlock);
const char *fileRoot = getTmpDir();
bool flag = false;
while (!err)
{
// Creates temporary file safely
char flacFile[FILENAME_MAX] = "";
snprintf(flacFile, FILENAME_MAX, "%sXXXXXX.flac", fileRoot);
fd = mkstemps(flacFile, 5); // the 5 is for the length of the suffix ".flac" | {
"domain": "codereview.stackexchange",
"id": 17474,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, c, embedded, memory-optimization, khronos",
"url": null
} |
regex, clojure, clojurescript
Title: Filtering a data structure using regex predicates Assume we have a data-structure like this:
(def data
(atom [{:id 1 :first-name "John1" :last-name "Dow1" :age 14}
{:id 2 :first-name "John2" :last-name "Dow2" :age 54}
{:id 3 :first-name "John3" :last-name "Dow3" :age 34}
{:id 4 :first-name "John4" :last-name "Dow4" :age 12}
{:id 5 :first-name "John5" :last-name "Dow5" :age 24}])) | {
"domain": "codereview.stackexchange",
"id": 24756,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "regex, clojure, clojurescript",
"url": null
} |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 #include #include using namespace std; long long int power(int w, int b); int check_power(int a, int b, int c, int d); long long int solution(int n, int theta); int main() { for(int n=1;n<=50;n++){ int j=2*n; long long int a=solution(j,0), b=solution(j-1,1); if((a >possible; vector temp; temp.resize(4); for(int a=1;a<=j;a++) for(int b=a;b>0;b--) for(int c=b;c>0;c--){ int d=(j)/(a*b*c); if(a*b*c*d!=j||d>c||check_power(a-1,b-1,c-1,d-1)!=theta) continue; temp[0]=a; temp[1]=b; temp[2]=c; temp[3]=d; possible.push_back(temp); } if(possible.size()==0) return -1; for(int x=0;x<4;x++) minimum[x]=possible[0][x]; for(int x=1;x0) k*=power(w,r); } if(l>k) continue; for(int w=0;w<4;w++) minimum[w]=possible[x][w]; } long long int output=1; for(int x=0;x<4;x++) output*=power(x,minimum[x]-1); return output; } | {
"domain": "brilliant.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363540453381,
"lm_q1q2_score": 0.8586832244515898,
"lm_q2_score": 0.8723473647220787,
"openwebmath_perplexity": 900.9216498143144,
"openwebmath_score": 0.6608328223228455,
"tags": null,
"url": "https://brilliant.org/discussions/thread/how-to-find-an-n-digit-number-with-m-number-of/"
} |
general-relativity, geodesics, anti-de-sitter-spacetime
Thus your statement that "All timelike geodesics that pass through the coordinate origin of AdS...execute simple harmonic motion about the origin..." can be rephrased in a coordinate-independent way as "The relative proper separation between any two intersecting timelike geodesics in AdS undergoes SHM as a function of the proper time along those geodesics." It is now clear how the issue is resolved: you are not considering just a single geodesic, but the relative separation of two geodesics. | {
"domain": "physics.stackexchange",
"id": 36773,
"lm_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, geodesics, anti-de-sitter-spacetime",
"url": null
} |
ros
Originally posted by sirop with karma: 16 on 2016-12-08
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 26397,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
electromagnetism, magnetic-fields, voltage
Title: Can a rod develop emf if magnetic field changes nearby? This is because of this question | {
"domain": "physics.stackexchange",
"id": 70649,
"lm_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, magnetic-fields, voltage",
"url": null
} |
I would like a more general proof, using Euler's Theorem if possible. Checking the remainders isn't practical for larger numbers, e.g. $\bmod 1000$.
• Have you heard about the Chinese remainder theorem? – Arthur Aug 29 '16 at 16:14
• @Arthur Yes: $\mathbb Z/10\mathbb Z \cong \mathbb Z/2\mathbb Z \times \mathbb Z/5\mathbb Z$ where $[a]_{10} \longmapsto ([a]_2,[a]_5)$. – Fly by Night Aug 29 '16 at 16:15
• Another solution is done using induction. – gambler101 Aug 29 '16 at 16:17
It's special case $\ p^i = 2,\ q^j = 5,\ \phi = 4,\ k=1\$ of the following generalization of Euler $\!\rm\color{blue}{(E)}$.
Theorem $\ \ n^{\large k+\phi}\equiv n^{\large k}\pmod{p^i q^j}\ \$ assuming that $\ \color{#0a0}{\phi(p^i),\phi(q^j)\mid \phi},\,$ $\, i,j \le k,\,\ p\ne q.\ \ \$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.971563966131786,
"lm_q1q2_score": 0.8277266377593382,
"lm_q2_score": 0.8519527963298947,
"openwebmath_perplexity": 249.0419938023452,
"openwebmath_score": 0.6424511075019836,
"tags": null,
"url": "https://math.stackexchange.com/questions/1907548/showing-that-a5-and-a-have-the-same-last-digit-using-eulers-theorem"
} |
linux, fish-shell
Calling seqn 1 300 3800 results in the following output:-1
1-301
301-601
601-901
901-1201
1201-1501
1501-1801
1801-2101
2101-2401
2401-2701
2701-3001
3001-3301
3301-3601
3601
The first and last lines are consequences of how the formatting was achieved, and can be easily rectified by iterating over all the $carr values except the first and the last. Instead, we deal with these two separately by bringing them outside of the for loop, printing the respective values immediately prior to entering and immediately after exiting the loop:
function seqn --argument first increment last
set --local carr ( seq $first $increment $last )
printf -- '%s' $carr[1]
for cval in $carr[2..-2]
# set i1 ( math $i + 1 )
printf -- '-%s\n%s' $cval $cval
end
printf -- '-%s' $carr[-1]
end | {
"domain": "codereview.stackexchange",
"id": 43149,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "linux, fish-shell",
"url": null
} |
ros-kinetic
Invalid <arg> tag: moveit_config
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/homefolder/manipulator_ws/src/ros-moveit-arm/moveit_plugin
ROS path [2]=/home/homefolder/manipulator_ws/src/moveit_tutorials
ROS path [3]=/home/homefolder/manipulator_ws/src/my-robotic-manipulator
ROS path [4]=/home/homefolder/manipulator_ws/src/ros-moveit-arm/my_arm_xacro
ROS path [5]=/home/homefolder/manipulator_ws/src/panda_moveit_config
ROS path [6]=/home/homefolder/manipulator_ws/src/version1_desc
ROS path [7]=/opt/ros/kinetic/share.
Arg xml is <arg default="$(find moveit_config)/default_warehouse_mongo_db" name="db_path"/>
The traceback for the exception was written to the log file
The workspace is named "manipulator_ws." My main package is "version1_desc" and when I started the MSA, I opened the new package into this "version1_desc". So the config files that the MSA has created are located in:
manipulator_ws/src/version1_desc/moveit_config/config | {
"domain": "robotics.stackexchange",
"id": 34846,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-kinetic",
"url": null
} |
data-compression, binary
Sorting is an option. If the data can be sorted without needing to be unsorted, then by all means, sort the data. Try the existing compression methods available. If you see some pattern that can be taken advantage of, and you can create a PRE/POST process that can perform the reduction, and undo the reduction to return the file back to what it was before. Great, do so.
When it comes to data compression, the more that is understood about the nature of the specific data, the more likely that some parts of it can be compressed. For example a RGB color image has the colors interleaved values, but compress poorly with generic compression, as they do not understand or attempt to do interleaving. | {
"domain": "cs.stackexchange",
"id": 18957,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "data-compression, binary",
"url": null
} |
c++, observer-pattern
stock.hpp
#ifndef STOCK_HPP
#define STOCK_HPP
#include "stock_exchange.hpp"
#include<string>
class Stock_Exchange;
class Stock
{
std::string name;
double price;
Stock_Exchange* se;
public:
Stock(Stock_Exchange* s, std::string stock_name, double stock_price)
{
se = s;
name = stock_name;
price = stock_price;
}
std::string get_name();
void set_price(double p);
};
#endif // STOCK_HPP
stock.cpp
#include "stock.hpp"
std::string Stock::get_name()
{
return name;
}
void Stock::set_price(double p)
{
price = p;
se->notify_observers(this->name);
}
main.cpp
#include<iostream>
#include "stock_exchange.hpp"
#include "stock_observer.hpp"
#include "stock.hpp"
int main()
{
Stock_Exchange se;
Stock_Observer so1(&se), so2(&se);
Stock infy(&se,"INFY",1234.33);
Stock tcs(&se,"TCS",1100);
Stock sbi(&se,"SBI",2312.33); | {
"domain": "codereview.stackexchange",
"id": 31982,
"lm_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++, observer-pattern",
"url": null
} |
ros, installation, irobot-create-2-1
Title: irobot_create_2_1 installation not working
I tried to install irobot_create_2_1 package but the installation failed during the make step. I followed the steps as given in the following link
(www.ros.org/wiki/irobot_create_2_1)
When i run "rosmake irobot_create_2_1 ", the following is the output I get.
user@ubuntu:~/groovy_workspace/brown_drivers/irobot_create_2_1$ rosmake irobot_create_2_1
[ rosmake ] rosmake starting...
[ rosmake ] Packages requested are: ['irobot_create_2_1']
[ rosmake ] Logging to directory /home/user/.ros/rosmake/rosmake_output-20130416-140004
[ rosmake ] Expanded args ['irobot_create_2_1'] to:
['irobot_create_2_1'] | {
"domain": "robotics.stackexchange",
"id": 13833,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, installation, irobot-create-2-1",
"url": null
} |
• This is also very closely related: mathematica.stackexchange.com/q/10533/21606 – Lukas Nov 20 '15 at 23:58
• @Lucy You will need to log in under the account you posted in order to accept the answer that solves your problem. It is the standard way to show your gratitude to those who helped you voluntarily. You will also be able to edit the question without our having to approve it. Please see mathematica.stackexchange.com/help/merging-accounts or other help pages if you can't get back into your original account. – Michael E2 Nov 22 '15 at 23:14 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9744347860767305,
"lm_q1q2_score": 0.805576723961897,
"lm_q2_score": 0.826711787666479,
"openwebmath_perplexity": 939.7144612381766,
"openwebmath_score": 0.4360703229904175,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/100034/how-do-i-plot-this-3-d-double-integral/100035"
} |
swift, cache
var login: String? {
get {
return value(forKey: Constants.Cache.Login)
}
set {
set(newValue, forKey: Constants.Cache.Login)
}
}
} | {
"domain": "codereview.stackexchange",
"id": 31239,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "swift, cache",
"url": null
} |
From here you could proceed by constructing the corresponding symmetric matrix and then computing its eigensystem, but you can save yourself a quite a bit of work by using fairly well-known formulas. In terms of the general conic equation $Ax^2+Bxy+Cy^2+Dx+Ey+F=0$ we have $$A = \frac1{Y^2} \\ B = -2{\cos\phi \over YZ} \\ C = \frac1{Z^2} \\ D=E=0 \\ F=-\sin^2\phi.$$ Set $\Delta = B^2-4AC$. Using the formulas from the ellipse article on Wikipedia we have $$\tan\Theta = {C-A-\sqrt{(A+C)^2+\Delta} \over B}$$ for the inclination of the ellipse’s major axis from the $x$-axis. With that angle in hand, you can determine the semiaxis lengths by applying the inverse rotation, intersecting the line with this direction and its perpendicular with the ellipse, or just using the formulas from the same source. Most of the terms vanish, leaving $$a,b = -{\sqrt{2\Delta F \left(A+C \pm \sqrt{(A+C)^2+\Delta}\right)} \over \Delta}.$$ I’ll leave plugging in the values of these coefficients and simplifying | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9802808741970027,
"lm_q1q2_score": 0.8037257603916937,
"lm_q2_score": 0.8198933403143929,
"openwebmath_perplexity": 307.93464750893475,
"openwebmath_score": 0.999336838722229,
"tags": null,
"url": "https://math.stackexchange.com/questions/2886108/given-orthogonal-vibrations-how-can-i-find-the-magnitude-and-direction-of-the-m"
} |
evolution, genetics, eyes
Even though the structure of insect and mammalian eyes diverged evolutionarily after the common ancestor, the switch that starts eye development worked so well there was little need to change it. I suppose one could say that it remains backwards compatible. | {
"domain": "biology.stackexchange",
"id": 7201,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "evolution, genetics, eyes",
"url": null
} |
c++, object-oriented, interview-questions, polymorphism
While discussing the proposed solution, I might ask the candidate what might happen if the Triangle object was copy constructed, and then both the copy and the original are destructed. Given the current design, I would expect the candidate to determine that a proper copy constructor that performs a deep copy would have to be implemented.
A similar question regarding assignment would be asked if the candidate did not realize a somewhat similar problem occurs if a Triangle is assigned to a different Triangle (which would also induce a memory leak). Given the current design, I would expect the candidate to determine that a proper assignment operator that frees the existing pointer and then performs a deep copy would have to be implemented.
This might then lead to a question about the copy and swap idiom for assignment operators, which might lead to questions about how to implement a proper swap function for a class.
Rule of Zero | {
"domain": "codereview.stackexchange",
"id": 31904,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, object-oriented, interview-questions, polymorphism",
"url": null
} |
catkin, cmake
Originally posted by Dave Coleman with karma: 1396 on 2016-01-11
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by gvdhoorn on 2016-01-12:
A similar thing is done in the prosilica_gige_sdk package (here).
Comment by Mitch Woodside on 2020-01-06:
First of all, awesome work with this solution! I've been using this and the prosilica_gige_sdk to piece together a ROS package for a pre-compiled dll library on Windows. For lack of a better word, it has been... fun.
@Dave Coleman, quick question about your solution, what is the purpose of this section?
# Foo library
add_library(${PROJECT_NAME} SHARED IMPORTED)
set_property(TARGET ${PROJECT_NAME} PROPERTY IMPORTED_LOCATION ${foo_LOCATION})
Since you are copying the library files directly to the devel and install spaces, why do you need to create a CMAKE target for the imported library? | {
"domain": "robotics.stackexchange",
"id": 23398,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "catkin, cmake",
"url": null
} |
c, memory-management, tree, embedded
seen __code (Keil) and __rom (Microchip), among others.
I should be seeing more const values in your code. This isn't just for performance, but also for maintainability.
Use a size specific data type such as uint8_t to represent data. Hierarchical trees can take up a lot of space. As a result, it is very important that you be aware of exactly how much space is being consumed. The best way to do this is to use the C99 data types so that you know for sure what the underlying storage unit is. As a result, if your data type is int then I'd suggest that you are doing yourself a disservice. | {
"domain": "codereview.stackexchange",
"id": 8691,
"lm_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, memory-management, tree, embedded",
"url": null
} |
python, object-oriented, battle-simulation, pokemon
defenses=int(input("Distribute your points between defense, offense and quickness. The total points can no excede 60. Type in your defense point: "))
quick=int(input("Distribute your points between defense, offense and quickness. The total points can no excede 60. Type in your quickness point: "))
while offenses+defenses+quick>60:
offenses=int(input("Distribute your points between defense, offense and quickness. The total points can no excede 60. Type in your offense point: "))
defenses=int(input("Distribute your points between defense, offense and quickness. The total points can no excede 60. Type in your defense point: "))
quick=int(input("Distribute your points between defense, offense and quickness. The total points can no excede 60. Type in your quickness point: "))
names=Player(names,20,typess,defenses,offenses,quick) | {
"domain": "codereview.stackexchange",
"id": 24180,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, object-oriented, battle-simulation, pokemon",
"url": null
} |
artificial-intelligence, neural-networks, perceptron
classify what type of flower a particular flower is?
There are thousands and thousands of types of flowers so, for simplicity I'm modifying you question as "classify if this flower is jasmine or not"
Input you fed to the perceptron are: (features)
petal size, petal coloring, and leaf size
If you construct a perceptron (network) it will be: | {
"domain": "cs.stackexchange",
"id": 7516,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "artificial-intelligence, neural-networks, perceptron",
"url": null
} |
genetics, proteins, gene, variant, nucleotide
Haemoglobin scores a pLI of 0.01 (higher scores are more intolerant to variation, specifically loss of function variation).
p53 is a gatekeeper of the cell cycle, mutants of which are common in cancer cells. It has a pLI score of 0.53 which means it is very intolerant to variation compared to haemoglobin.
Ribosomal protein L5 has a pLI of 0.998 implying it can tolerate little if any variation.
The ribosome is critical in protein production, hence altering it may cause a complete breakdown of cellular life.
Variation and Evolution
There is an almost philosophical difference between human variation and human evolution. Variation is a static snapshot of our protein sequence from individual to individual. Evolution in the sense of a Dayhoff Matrix requires looking back millions or billions of years by comparing similar protein sequences across many species. | {
"domain": "biology.stackexchange",
"id": 10033,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "genetics, proteins, gene, variant, nucleotide",
"url": null
} |
python, beginner, regex, file
Title: 'Learn projects the hard way': logfind project I'm a new programmer, who has just finished his first small project.
It's a sort of basic imitation of the grep command from Linux. I'm learning from projects the hard way. Here is the description of the project:
The first project that we’ll try is called logfind. It’s nothing more than a simple version of grep so you can learn a few simple basic things in Python:
Opening files based on regular expressions in a file.
Scanning those files for strings from command line arguments.
Create a complete installable Python project.
When I run the script, the first thing it will look for islogfind.txt file on the user's computer, then it will scan this file according to a regular expression to search for filenames of the example.extension type. The files specified in the logfind.txt file will be searched for the strings that the user has specified on the command line.
I have a few questions about my program: | {
"domain": "codereview.stackexchange",
"id": 16599,
"lm_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, regex, file",
"url": null
} |
deep-learning, reinforcement-learning, python, dqn
Title: Why does the DQN not converge when the start or goal states can change dynamically? I'm trying to apply a DQN to a stochastic environment, but I'm having trouble getting it to converge.
I found some similar questions asked here, but no solutions yet.
I can easily get the DQN to converge on a static environment, but I am having trouble with a dynamic environment where the end is not given.
Example: I have made a really simple model of the Frozen Lake (without any holes) - simply navigation from A to B. This navigation works fine when A and B are always the same, but when I shuffle the position of A or B for each session, the DQN cannot converge properly.
I am using the grid (3x3, 4x4 sizes) as input neurons. Each with "0" value. I assign the current position "0.5" and the end position "1". 4x4 grid gives us 16 input neurons. Example of 3x3 grid:
0.5 0 0
0 0 0
0 0 1
I have a few questions in this regard: | {
"domain": "ai.stackexchange",
"id": 1217,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning, reinforcement-learning, python, dqn",
"url": null
} |
plate-tectonics, tectonics
Title: tectonic faults catalog for plot I looking for a catalog (ideally in a ASCII file) of the major tectonic faults on earth, in order to plot some of them on a map
Any suggestion ? A good database of tectonic plates is available at the Institute for Geophysics of the University of Texas. The database includes present conditions and past and future conditions. They provide ASCII files in their ftp site.
Source
Another option is the data from Peter Bird at UCLA that he described in his article "An updated digital model of plate boundaries", $G^3$, 2003. He provides the data in ASCII format in their ftp site (they include a readme file with the description of the data). | {
"domain": "earthscience.stackexchange",
"id": 892,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "plate-tectonics, tectonics",
"url": null
} |
dna, gel-electrophoresis
You can find a very nice and detailed protocol here: "Elution of DNA from Agarose Gels" (The rest of the handbook is also very useful). | {
"domain": "biology.stackexchange",
"id": 2639,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dna, gel-electrophoresis",
"url": null
} |
expansion
Title: Does the gravity oppose to the Universe expansion? I'm trying to understand the very basis of the current cosmology.
I searched in the old questions but I found nothing that answers my questions specifically.
As far as I understand, we have to think the "expansion" more like a "stretching" of the space that makes room for "new" space. This is confirmed because the Universe is homogeneous and non-local.
First question: does the gravity counteract this expansion? In other words: does the space expand more in the areas with less gravity (i.e. among galaxies) and less in the nearby of stars and planets?
If we imagine to place a ruler between two stars, say at 10 ly, it would "extend" over time - even if we will still read 10 ly, right? But if now we place another ruler that was kept in our (huge) pocket, it will measure a longer distance. Is this correct? | {
"domain": "astronomy.stackexchange",
"id": 4135,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "expansion",
"url": null
} |
• On the other hand, it could be. Consider $a=-1$ (with multiplication). Then $\{a,a^{-1},e\}=\{-1,(-1)^{-1},1\} = \{1,-1\}$ which is a perfectly good (cyclic) group (under multiplication). So $\{a,a^{-1},e\}$ can be a group, but usually it isn't. :) – Bill Cook Apr 10 '17 at 16:14 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9893474888461862,
"lm_q1q2_score": 0.8613232080093819,
"lm_q2_score": 0.8705972549785203,
"openwebmath_perplexity": 164.68628413299297,
"openwebmath_score": 0.8695566058158875,
"tags": null,
"url": "https://math.stackexchange.com/questions/2227885/smallest-subgroup-and-langle-a-rangle"
} |
sequence-alignment, multiple-sequence-alignment
Explanation To explain that further HMM uses observed outcomes to estimate/optimise the hidden parameters, the gap penalty being one of the two key hidden parameters. Thus the algorithm is exploring a parameter landscape through reiteration generating multi-multiple alignments (if that makes sense) using different gap penalties and considering the error between the alignments (highlighted below). The search strategy is key to the success of the output. Muscle 5 describes 'introducing variations (perturbations) into HMM parameters', I assume this is singularly with reference to super5. The parameter landscape might be quite small because it doesn't seem to be a directional search strategy in any way (there's no memory in it). | {
"domain": "bioinformatics.stackexchange",
"id": 2136,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sequence-alignment, multiple-sequence-alignment",
"url": null
} |
c++, random, reinventing-the-wheel
x * (1 / y) is an obfuscating way to write x / y.
NextSymmetric() is wrong in consequence of NextFloat() being wrong.
If one invokes NextFloat(float lowerBound, float upperBound) with a large range, the resulting values fall into categories (corresponding to their initial value returned by NextFloat() between 0 and 1) and therefore not all possible numbers in this range can be returned by this function. But at the moment neither I know a better implementation beside some platform dependend bit twiddling on the floating point numbers.
I don't quite get the difference between NextFloat and NextUniform. Is there even any? If not, why are there two different implementations instead of NextUniform just invoking NextFloat?
You can avoid that undefined reinterpret_cast in GenTimeSeed by using bit masks and bit shifts.
You don't have to write inline since modern compiler know better than programmers what's beneficial to inline and what's not (they'll mostly ignore it anyways). | {
"domain": "codereview.stackexchange",
"id": 9633,
"lm_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++, random, reinventing-the-wheel",
"url": null
} |
c#, algorithm, tree
CurrentNode.RightChild.Parent = CurrentNode.Parent;
}
else //No children
{
if (CurrentNode.Parent.LeftChild == CurrentNode)
CurrentNode.Parent.LeftChild = null;
else if (CurrentNode.Parent.RightChild == CurrentNode)
CurrentNode.Parent.RightChild = null;
} | {
"domain": "codereview.stackexchange",
"id": 23002,
"lm_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, tree",
"url": null
} |
java, caesar-cipher
Or use two separate methods as I did in the example above.
And even is you do use a String, then you shouldn't be calculating the "integerDependOnAction" inside the loop, but just once at the start.
The ALPHABET variable should actually be a constant (a final static field) in the class. | {
"domain": "codereview.stackexchange",
"id": 32842,
"lm_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, caesar-cipher",
"url": null
} |
ros
<export>
</export>
</package>
I could not figure out why int16 is not declared. Did I forget to include any header file. Or is there something wrong with my CMakeLists.txt and package.xml?
Please help.
Thank you.
-Kening
Originally posted by Kening Ren on ROS Answers with karma: 1 on 2017-02-24
Post score: 0
I see a problem with ROS built-in primitive type, such as int16.
The only place where int16 is a legal identifier in a ROS context (ignoring custom type definitions in the various languages that have client libraries) is in the ROS msg specification. You cannot use those directly in any client code, as they are mapped onto types native to the language in which the client library is written.
For C++, int16 is mapped onto int16_t. int16 is not a type in C++, so the compiler error is to be expected.
Did I forget to include any header file
Add #include <cstdint> to your .cpp file and try again. | {
"domain": "robotics.stackexchange",
"id": 27124,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
electromagnetism, wave-particle-duality
Title: EM vs Matter wave. The lie and confusion of School Physics In school (at least in Russia) we are taught about the light as EM wave with wave–particle duality.
The nature of waves is described as recursive emitting electric and magnetic fields chain. Then it's mentioned that all objects have such duality: could be represented as waves (with help of the de Broglie formula).
Much latter I accidentally faced the fact that the de Broglie wave is not a EM wave at all. But for EM quantum it's similar enough (frequency, possibly phase).
While there are still a lot vague moments with EM waves for me, is it right that EM wave is just classic outdated concept and the waves of probability amplitude (describing the probability of specific energy quantum to have specific coordinate) is much closer to reality? So there is no chain of changing electric and magnetic fields at all. | {
"domain": "physics.stackexchange",
"id": 42675,
"lm_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, wave-particle-duality",
"url": null
} |
# Random Uniformly Distributed Points in a Circle
I know that by just using a random angle and a random radius within the bounds of your circle, you will end up with points near the center of a circle. Whereas if you do $\sqrt{Random(0,1)}*MaxRadius$ for your radius, you will end up with what appears to be a uniformly random point. I am happy this works but I would like to understand where the square root comes from. The Square Root function in this calculation seems magical to me and I would like to know what it means in this context.
You wish to uniformly distribute points around a disc of radius $R_{\max}$ and centre $\langle 0, 0\rangle$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9884918504271627,
"lm_q1q2_score": 0.8300701895178711,
"lm_q2_score": 0.8397339736884711,
"openwebmath_perplexity": 131.8095582547313,
"openwebmath_score": 0.9317792057991028,
"tags": null,
"url": "https://math.stackexchange.com/questions/1307287/random-uniformly-distributed-points-in-a-circle"
} |
quantum-field-theory, renormalization, terminology, approximations, 1pi-effective-action
Title: Does effective theory have the same meaning in particle and condensed matter physics I have a naive question about the meaning of effective theory in particle physics and condensed matter physics.
In particle physics, from what I know, the effective theory comes from the Wilsonian renormalization. We start from a theory with a fundamental cutoff $\Lambda$, e.g. Planck scale, and consider a smaller cutoff $\Lambda'$, e.g. LHC scale, $\Lambda'<\Lambda$. The Lagrangian then reshuffle into an infinity series including all possible powers of fields. The theory with $\Lambda'$ cutoff is called effective theory (possibly only a few leading terms)
In condensed matter theory, I heard the effective theory means neglect some details, like the BCS theory.
Roughly speaking, "the effective" in both fields has similar meaning, that we ignore something ($>\Lambda'$ in particle physics or uninteresting detail in condensend matter). | {
"domain": "physics.stackexchange",
"id": 9457,
"lm_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, renormalization, terminology, approximations, 1pi-effective-action",
"url": null
} |
human-biology, endocrinology, development, behaviour, dopamine
The dopamine system here is being compared to the child's dopamine system. I'm interested in what happens to the dopaminergic system once a teenager/adolescent becomes an adult at around the age of 24-25?
I'm looking for insight along these lines - does the reward system of an adult "settle down" and no longer respond to novelty as strongly? Is the baseline dopamine level higher? This may shed light on why the teenagers response to dopamine changes. Quote from reuniting website | {
"domain": "biology.stackexchange",
"id": 2650,
"lm_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-biology, endocrinology, development, behaviour, dopamine",
"url": null
} |
newtonian-gravity, orbital-motion, computational-physics, algorithms
$$\vec{\dot{y}}=\vec{f}(\vec{y},t)\tag 1$$
Example:
$$\ddot{r}-r\,\dot{\theta}=-\frac{GM}{r^2}\tag 2$$
$$r\ddot{\theta}+2\,\dot{r}\dot{\theta}=0\tag 3$$
new variables :
$y_1=\dot{r}$
$y_2={r}$
$y_3=\dot{\theta}$
$y_4={\theta}$
equation (2):
$$\dot{y}_1-y_2\,y_3=-\frac{G M}{y_2^2}$$
equation (3):
$$\dot{y}_3\,y_2+2\,y_1\,y_3=0$$
thus:
$$\vec{\dot{y}}=\vec{f}(\vec{y})$$
$$\begin{bmatrix}
\dot{y}_1 \\
\dot{y}_2\\
\dot{y}_3 \\
\dot{y}_4\\
\end{bmatrix}=\begin{bmatrix}
-\frac{G M}{y_2^2}+y_2\,y_3 \\
y_1\\
-\frac{2\,y_1\,y_3}{y_2}\\
y_3
\end{bmatrix}$$ | {
"domain": "physics.stackexchange",
"id": 59987,
"lm_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-gravity, orbital-motion, computational-physics, algorithms",
"url": null
} |
ros, roomba, sensor, gyro
My quetion is:
Is there any simple/convenient way
that can add an extra gyro sensor for
iRobot Create 2?
Can I still launch the commands above
without a gyro sensor?
Thank you very much!!
Originally posted by sonictl on ROS Answers with karma: 287 on 2015-12-02
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 23132,
"lm_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, roomba, sensor, gyro",
"url": null
} |
php, json, authentication, cakephp
Title: CakePHP login action returning json I have some questions on how I can improve this "add action" (method) in "controller":
I'm using the add action only if post request. Is it correct?
This action doesn't have views ($this->autoRender = false;). Is it correct?
I set a response .json file to this action but I didn't change on routes to routing .json files (the file will be return when access localhost:8765/users/add). Is it correct?
I'm using Enums(handmade) to store messages that will returned to user. Is it correct?
I'm using an object to store the fields of message (that will returned to user), that object will be serialized and returned like this:
$this->response->body(json_encode($response));
Is it correct? | {
"domain": "codereview.stackexchange",
"id": 17146,
"lm_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, json, authentication, cakephp",
"url": null
} |
beginner, vhdl
clr_A <= '0';
ld_A <= '0';
clr_B <= '0';
ld_B <= '0';
clr_C <= '0';
ld_C <= '0';
clr_Z <= '0';
ld_Z <= '0';
ALU_op <= "000";
A_Mux <= '0';
REG_Mux <= '0';
DATA_Mux <= "00";
IM_MUX1 <= '0';
IM_MUX2 <= "00";
elsif (INST(31 DOWNTO 28)="0011") then --STB
clr_IR <= '0';
ld_IR <= '0';
--ld_PC <= '0';
clr_A <= '0';
ld_A <= '0';
clr_B <= '0';
ld_B <= '0'; | {
"domain": "codereview.stackexchange",
"id": 30831,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, vhdl",
"url": null
} |
newtonian-mechanics, reference-frames, rotational-kinematics, angular-velocity
Title: Determining the angular velocity from an inertial frame of reference if given a system of two disks stacked Say I have this disk with radius $R$, mass $M$ that could rotate with angular velocity $\omega_0$ around it's CoM freely (no friction, etc). Then we have a smaller disk with radius $r$, mass $m$ that could also rotate around it's CoM freely with angular velocity $\omega_1$ relative to the larger disk. We then placed the smaller disk on the edge of the larger disk, so that the distance between their CoMs is $x$ (which in this case, $x$ = $R$). Both disks are rotating in the clockwise direction. So I tried to draw the system and it looks like this. | {
"domain": "physics.stackexchange",
"id": 63491,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, reference-frames, rotational-kinematics, angular-velocity",
"url": null
} |
ros, tf2, transform
The interpolation logic does not have support for limiting the range of interpolation, nor does it have a way to tell you what the neighboring points used are.
Those are features that could be added. However in general the trasforms are expected to be provided in a continuous manner that is fast enough to approximate the natural bandwidth of the system.
Note that there's an implicit limit with the maximum cache size of 10s by default. It cannot interpolate outside of the cache history. Though you run the risk of incurring extrapolation limits based on your system. | {
"domain": "robotics.stackexchange",
"id": 27936,
"lm_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, tf2, transform",
"url": null
} |
machine-learning, neural-network, deep-learning
It doesn't work quite so directly, and there as a small factor of more calculations involved (you do not calculate each derivative with a single multiplication, often there are a few, some results are re-used, and other operations may be involved). However yes you do need to calculate a derivative for each weight and bias term, and there are roughly that number of weights in your network that require the calculations done.
Your suggested numbers are actually quite small compared to typical neural networks used for image problems. These typically perform millions of computations for a forward pass.
That's why a CPU computer takes so long to train a model because it has to do about 3,600 (1,800 + 1,800 ) mathematical operations.
Actually that is a trivial number of calculations for a modern CPU, and would be done in less than a millisecond. But multiply this out by a few factors:
You must do this for each and every example in the training data | {
"domain": "datascience.stackexchange",
"id": 2124,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, neural-network, deep-learning",
"url": null
} |
reactivity, containers
Incidentally you can look up individual elements on Periodic Table of Videos at http://www.periodicvideos.com/ I think it is mentioned somewhat around 4:35 or so in the link you added. The metal cylinder that has to store elemental fluorine will have to be made from a special metal like nickel or monel. Those form metal fluoride layers on the inside but they remain on the metal and allow no further fluorine to attack the rest of the metal which is called passivation. | {
"domain": "chemistry.stackexchange",
"id": 10912,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reactivity, containers",
"url": null
} |
motor, esc
Title: difference between sabertooth motor controller and rc esc? i am building a rc/robot mower.
most of the youtube videos show the sabertooth motor controllers being used to connect the rc receiver to the dc motors.
But here in Australia, the sabertooth i need cost about 200 dollars. RC esc sell for about 10 dollars.
What is the difference between the esc and the sabertooth and can i use an esc instead?
the specs i have on the motor and battery are 12v 10amp normal, 35amp stall. and my rc is a flysky i have ended up using 2 RC ESCs they can easily handle the 35 amps and 12v. the flysky remote also allows mixing so that the 2 motors/escs can handle skid steering on one stick of the remote. So much cheaper | {
"domain": "robotics.stackexchange",
"id": 1396,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "motor, esc",
"url": null
} |
cc.complexity-theory, np-hardness
The actual problem is that L(U) is not in NP. To be in NP, there needs to be a single polynomial p(n) that bounds the time to check a solution. But in your case this time is bounded by a polynomial q(n) that depends on the particular TM given as input. It's easy to choose inputs that cause q(n) to be larger than any fixed choice of p(n). | {
"domain": "cstheory.stackexchange",
"id": 87,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cc.complexity-theory, np-hardness",
"url": null
} |
javascript, virtual-machine
// Canvas abstraction
var draw = {};
// draws a point
draw.point = function(x, y, color){
var scaleFactor = 4;
ctx.fillStyle = color;
// in this case 4 cuz ive set the scale of the screen to 4x
ctx.fillRect(x * scaleFactor,y * scaleFactor, scaleFactor, scaleFactor);
};
// clear the screen
draw.clearScren = function() {
var scaleFactor = 4;
ctx.fillStyle = "#fff";
ctx.fillRect(0, 0, 64 * scaleFactor, 32 * scaleFactor)
};
// this is run everytime the draw flag is activated
draw.draw = function() {
var x = s.dFlags.x;
var y = s.dFlags.y;
var w = s.dFlags.w;
var h = s.dFlags.h;
var color;
for(var i = 0; i < w; i++){
for(var j = 0; j < h; j++){
var offset = x + i +((y + j) * 64);
if(c8.gfx[offset] === 1){
color = "#000";
} else {
color = "#fff";
}
draw.point(x + i, y + j, color);
}
}
s.dFlags.d = false;
}; | {
"domain": "codereview.stackexchange",
"id": 30003,
"lm_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, virtual-machine",
"url": null
} |
mechanical-engineering, statics, moments
Title: Determine the reactions at A and C, knowing that α = 30º QUESTION(see image attached):
Really need help here can someone help me show how we get the solution as shown in the image file attached above.
okay since I was asked by one of the users commenting asking me to show what I had done; please see attached image file below
Thank You. First you have to notice that the contact at A is a roll support, so the reaction force there is perpendicular to the surface. Therefore Fa has 60 degree against horizontal axis. When you draw free body diagram, decompose the Fa reaction force into its horizontal and vertical components:
Fax = Fa Cos60
Fay = Fa Sin60
Then you solve the balance equations of X-axis, Y-axis, and Moments. I would start from the sum of Moments at C equal zero. You will get the value of Fa.
Then with the balance equations of X-axis and Y-axis with Fa already known you will get the value of Fcx and Fcy.
I get a slightly different result, probably due to rounding: | {
"domain": "engineering.stackexchange",
"id": 1691,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mechanical-engineering, statics, moments",
"url": null
} |
quantum-field-theory, gravity, quantum-gravity, scattering
The part of the amplitude due to the gravitons may be estimated as :
$$\int_0^\Lambda d^4 \tilde E \frac{1}{\tilde E^2(E -\tilde E)^2} \tag{2}$$
The total amplitude would be :
$$ A\sim(\frac{E^2}{M_p^2})^2\int_0^\Lambda d^4 \tilde E \frac{1}{\tilde E^2(E -\tilde E)^2} \tag{3}$$
With $E >> \Lambda$, we have $E - \tilde E \sim E$, so with $d^4E' \sim E'^3 dE'$, we have :
$$ A\sim\frac{E^2}{M_p^4}\int_0^\Lambda d \tilde E ~~\tilde E \tag{4}$$ | {
"domain": "physics.stackexchange",
"id": 9263,
"lm_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, gravity, quantum-gravity, scattering",
"url": null
} |
general-relativity, gravity, speed-of-light, binary-stars, pulsars
This makes it extremely likely that gravitational waves are a thing. Of course, you couldn't have gravity waves if the speed of gravity were infinite. So, at first glance, it certainly seems to confirm that the speed of gravity is finite. Furthermore, the amount of energy radiated away with gravity waves is dependant on the speed of the wave. The theories relate the radiated power as proportional to $1\over v^5$, where $v$ is the speed of the wave. It turns out that if you make $v=c$, you get the exact amount of energy radiated away as what corresponds to the orbital decay of the system to within no more than $1\%$. So it would stand to reason that the speed of gravity is likely the speed of light.
No messing around with the delay of pulses due to spacetime warping is necessary. | {
"domain": "physics.stackexchange",
"id": 48809,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, gravity, speed-of-light, binary-stars, pulsars",
"url": null
} |
photons, energy-conservation, mass-energy, matter
Title: If mass is not conserved but instead energy is conserved, is it right to say that the fundamental particles are photons? If mass is not conserved but instead energy is conserved, so is it right to say that the fundamental particle of the Universe is photon instead of protons, neutrons, electrons, leptons, etc and all that. That is all mass is eventually made of photons (energy).
Or another form of this question would be
What can one imagine the entire universe to be made up of? Well in Greeks time they thought it to be atoms.
But I want a answer synchronous with today's information.
Please try to add a simplified version of quantum mechanics.
Or simply
Please connect energy to mass taking in consideration the fact of sub atomic particles.
If mass is not conserved | {
"domain": "physics.stackexchange",
"id": 27023,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "photons, energy-conservation, mass-energy, matter",
"url": null
} |
pressure, applied-mechanics, statics, torque, wind
$$-P_w H + W_p \cdot L_f + 20 \frac{N}{m} L_f \cdot \frac{L_f}{2} \ge 0 $$
$$ \frac{20 \frac{N}{m}}{2}L_f^2 + W_p \cdot L_f - P_w H \ge 0$$
You can then solve this equation and obtain two solutions. One will be positive and one will be negative. Values greater than the positive value, and values smaller than the negative value will satisfy the above requirement. (The negative value makes sense, because negative $L_f$, just means that the feet extend to the left). | {
"domain": "engineering.stackexchange",
"id": 4067,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pressure, applied-mechanics, statics, torque, wind",
"url": null
} |
nuclear-physics, fusion
Title: Why don't deuterons produce a helium-4 nucleus when they fuse? I would expect two deuterium nuclei to fuse straight into a single helium-4 nucleus, because that's by far the most stable way to arrange 2 protons and 2 neutrons. But instead, any two fusing deuterons have a 50-50 chance of producing either a tritium nucleus and a neutron or a helium-3 nucleus and a proton. Why is this? The deuterium fusion reaction is extremely exothermic. It releases about a million times more energy than a typical chemical reaction, and that energy has to go somewhere. If we had two deuterium nuclei fusing to form a helium-4 nucleus there is nowhere for the energy to go and the helium nucleus would just split up again.
So the newly formed helium nucleus has to get rid of all that energy, and there are three ways to do this:
the helium nucleus could release the energy as a gamma ray and form ${}^4\mathrm{He}$ directly | {
"domain": "physics.stackexchange",
"id": 90116,
"lm_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, fusion",
"url": null
} |
c++, reinventing-the-wheel, image, template, c++20
constexpr auto get(const unsigned int locationx, const unsigned int locationy)
{
return this->image_data[locationy][locationx];
}
constexpr auto set(const unsigned int locationx, const unsigned int locationy, const ElementT& element)
{
this->image_data[locationy][locationx] = element;
return *this;
}
template<class InputT>
constexpr auto set(const unsigned int locationx, const unsigned int locationy, const InputT& element)
{
this->image_data[locationy][locationx] = static_cast<ElementT>(element);
return *this;
}
constexpr auto getSizeX()
{
return this->image_data[0].size();
}
constexpr auto getSizeY()
{
return this->image_data.size();
} | {
"domain": "codereview.stackexchange",
"id": 41582,
"lm_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++, reinventing-the-wheel, image, template, c++20",
"url": null
} |
solar-system, celestial-mechanics, gravitational-lensing, solar-system-evolution, microlensing
what wavelength to best detect the 9th planet (if exists...)
Why hasn't the "9th Planet" been detected already?
How can we see planets thousands of light years away but don't know if there are more planets in the solar system? With the caveat that it is easy to make an arithmetic blunder, I calculate that there is around a 1 in 25 chance per 6-month interval that planet 9 might cause a significant microlensing amplification of a star brighter than 21st magnitude. The problem is that nobody is really monitoring 21st-magnitude stars over a wide area on the sky, with a cadence sufficiently fast to catch the few-minute duration of such an event. | {
"domain": "astronomy.stackexchange",
"id": 7233,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "solar-system, celestial-mechanics, gravitational-lensing, solar-system-evolution, microlensing",
"url": null
} |
metabolism, carbohydrates
relevant molecule that regulates fructose-1,6-bisphosphatase is
fructose 2,6-bisphosphate — inhibiting it — the argument would seem
to be that the entry of fructose into glycolysis through fructose
1-phosphate allows more glucose production for other tissues. Why
this would be a “good thing”, however, is not clear to me.
Unphosphorylated glyceraldehyde has other roles in metabolism, so its
production independently of glyceraldehyde 3-phosphate is more
energy-efficient. Unfortunately the other metabolic fates of
glyceraldehyde are specialized and minor, and do not seem to support
this possibility. | {
"domain": "biology.stackexchange",
"id": 11351,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "metabolism, carbohydrates",
"url": null
} |
thermodynamics, angular-momentum, energy-conservation, rotation, moment-of-inertia
Title: Thermal expansion of a rotating disc This question came up in a discussion section today. Some fellow students and I broke our heads on it for a while but couldn't come to a satisfactory conclusion.
Imagine you have a thin disc of mass $M$, radius $R$ and uniform density that's rotating about its symmetry axis with a constant angular velocity $\omega$. Ignore friction. You immerse the disc into a heat bath that's $\Delta T$ degrees warmer than the disc, which causes the size of the disc to expand with some coefficient $\alpha > 0$:
$\Delta R = \alpha\,\Delta T\,R$ and hence to first order in $\alpha \Delta T$
$\Delta R^2 \approx 2\alpha\, \Delta T\,R^2$
This clearly increases the moment of inertia $I = \frac{1}{2}MR^2$ of the disc. | {
"domain": "physics.stackexchange",
"id": 33240,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, angular-momentum, energy-conservation, rotation, moment-of-inertia",
"url": null
} |
rviz, urdf, ros-kinetic, ubuntu, ubuntu-xenial
<link name="world" />
<!-- connects the UR10 arm to the world -->
<joint name="world_joint" type="fixed">
<parent link="world" />
<child link = "base_link" />
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
</joint>
<!-- connects the camera to the UR10 arm -->
<joint name="cam_joint" type="fixed">
<parent link="ee_link"/>
<child link="mount_link"/>
<origin xyz="0.0 -0.045 0.0" rpy="3.14 0.0 1.57" />
</joint>
Now the problem of the world joint that cannot be found in Rviz is also a bit more clear.
As your thought, it wasn't because of the tf transform node.
The reason was because i forgot to start the node that pubs robot state.
Originally posted by Jan Tromp with karma: 28 on 2019-04-25
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by gvdhoorn on 2019-04-25:\
I think my problem eventually was in the fact that i didnt have the tf static transform node running. | {
"domain": "robotics.stackexchange",
"id": 32932,
"lm_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, urdf, ros-kinetic, ubuntu, ubuntu-xenial",
"url": null
} |
ros, navigation, differential-drive, dwa-local-planner, move-base
obstacle_layer_xtions:
back_point_cloud_sensor: {clearing: false, data_type: PointCloud2, expected_update_rate: 0.4, obstacle_range: 1.5, raytrace_range: 2, marking: true, min_obstacle_height: 0.1, sensor_frame: back_xtion_link, topic: back_xtion_voxel_grid/output}
back_point_cloud_sensor2: {clearing: true, data_type: PointCloud2, expected_update_rate: 0.4, obstacle_range: 1.5, raytrace_range: 2, marking: false, min_obstacle_height: -0.1, sensor_frame: back_xtion_link, topic: back_xtion_voxel_grid/output}
front_point_cloud_sensor: {clearing: false, data_type: PointCloud2, expected_update_rate: 0.4, obstacle_range: 2.5, raytrace_range: 3, marking: true, min_obstacle_height: 0.1, sensor_frame: front_xtion_link, topic: front_xtion_voxel_grid/output} | {
"domain": "robotics.stackexchange",
"id": 20656,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, navigation, differential-drive, dwa-local-planner, move-base",
"url": null
} |
evolution, dna, abiogenesis
Granted, this is a few years old, but I often find myself having to admit that "I don't know" when at the root of discussions on evolution. That is, once abiogenesis has occurred, we can go on and explain the rich diversity of life, but sadly we really don't know much before that critical step. Generally, those satisfied with "magic" as an answer posit their myths and fables, whereas I'd rather try to actually find out what happened. Sadly, as the abstract shows, you actually need a level of education to understand papers such as this that is generally well beyond those who would deny the reality of evolution. | {
"domain": "biology.stackexchange",
"id": 57,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "evolution, dna, abiogenesis",
"url": null
} |
c++, beginner, c++11, hash-map, homework
/** @brief
* @name get_input: Takes no arguments and returns an integer.
* @name goodbye: Takes no arguments and returns void.
* @name menu: Takes no arguments and returns void.
* @name run: Takes no arguments and returns void.
*/
int get_input();
void goodbye();
void menu();
void run();
/** @brief
* @name valid_month: Takes a string and returns a boolean indicating the validity of the month.
* @name valid_day: Takes a string and returns a boolean indicating the validity of the day.
* @name valid_year: Takes a string reference and returns a boolean indicating the validity of */
bool valid_month(std::string);
bool valid_day(std::string);
bool valid_year(std::string &year);
run.cpp
#include <string>
#include <iostream>
#include <vector>
#include <chrono>
#include <algorithm>
#include <limits>
#include <stdexcept>
#include <thread>
#include <atomic>
#include "run.h"
#include "CovidDB.h"
#define LOG | {
"domain": "codereview.stackexchange",
"id": 44705,
"lm_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, c++11, hash-map, homework",
"url": null
} |
algorithms, binary-trees, recursion, heaps
Now for $n-1$ distinct elements(given), for root we have $2$ options i.e. maximum elements and we can recurse as above for left and right sub-tree. But since the repeated element is also there I am not able to figure out exact way to do so.
Eg: $A=[2,6,6] =>$
There are 2 distinct max heaps $ => [6,2,6] , [6,6,2]$
I am unable to think of the way to find out the number of max heaps in this case. Can someone think of algorithm/recurrence relation to find so ? If the duplicate element is the maximum element, the answer is the same as when all numbers are distinct. Let's say the duplicate element is $a_1, a_2$. Even though they are the same, we can treat it as $a_1 > a_2$, and then remove the duplicate heaps where the only difference is the exchange of $a_1, a_2$, but that is not possible because $a_1$ is always at the root. So no duplicates found. | {
"domain": "cs.stackexchange",
"id": 14641,
"lm_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, binary-trees, recursion, heaps",
"url": null
} |
$$\textbf{A [right / left / both] ideal I of a ring R is minimal iff}$$
$$\textbf{ I is generated by any of its nonzero elements x \in I }$$
Proof:
$$1.(\Rightarrow)$$ Suppose $$I$$ is minimal and and $$x \in I$$ is nonzero. Consider the ideal $$J:=(x)$$ generated by $$x$$. By construction, $$J \neq (0)$$ since $$x \in J$$. Now, $$J \subseteq I$$, since by definition $$J$$ is the smallest ideal containing $$x$$. But then , by minimality of $$I$$ we must have $$I=J$$, so $$I$$ is generated by $$x$$.
$$2.(\Leftarrow)$$ Suppose $$I=(x)$$ for any $$x \in I$$, and that $$J$$ is any nonzero ideal of $$R$$ with $$J \subseteq I$$. Let $$y$$ be any nonzero element of $$J$$. Then $$y \in I$$, and by hypothesis we have $$I=(y)$$. But then we must have $$J=I$$, because $$(y)$$ is the smallest ideal of $$R$$ containing $$y$$.
My question is:
$$\textbf{Does this also prove that any minimal ideal is principal? }$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9585377272885904,
"lm_q1q2_score": 0.8533805992424601,
"lm_q2_score": 0.89029422102812,
"openwebmath_perplexity": 166.7801105031896,
"openwebmath_score": 0.9307032227516174,
"tags": null,
"url": "https://math.stackexchange.com/questions/3382832/does-minimal-ideal-always-imply-principal-ideal"
} |
java, game, homework
Information Hiding
The Law of Demeter
The Open-Closed Principle
The DRY Princple
Effectively, your Professor is teaching you how to program with structures, not objects, using Java.
For example, here's one problem with breaking the Law of Demeter:
if (Espectro.VACIO == this.cabina.getRadar().getReporte( values[ii] ).getEspectro()){
If any one of the following are null, the code will throw a NullPointerException:
this.cabina
getRadar()
getReporte( ... )
There are no try/catch blocks, nor does the method declare any exceptions, so the program will crash. A program that crashes can be quite frustrating for the users.
The line should be either of the following:
if( getCabina().isEspectro( Espectro.VACIO ) ) {
if( isEspectro( Espectro.VACIO ) ) {
In the second case, the method isEspectro would resemble:
public boolean isEspectro( Espectro e ) {
return getCabina().isEspectro( e );
} | {
"domain": "codereview.stackexchange",
"id": 3935,
"lm_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, homework",
"url": null
} |
c#, unit-testing, http, dependency-injection
Questions:
1) Should i instantiate the HttpClient in the "Main" function and pass it to every WebHandler as a Singleton?
2) Should i use DI for this purpose?
3) How i could test, with an UnitTest, the SelectAllResponsesAsync method, passing to it a custom string as response, without doing a request to google.com? I really see no point in using decorator pattern in your case since WebHandler doesn't actually decorate FirstType but merely adds another level of abstraction.
So I suggest removing both WebHandler and IWebHandler to keep it simple.
As for unit testing, a lot of folks adding their own custom IHttpClient in order to facilitate mocking. But I think that defining such a poor abstraction is the wrong choice. Instead, I suggest creating a class that accepts data instead of an interface which can be easily tested. Here's a series of posts that will describe the idea better than me.
The code for your case
class Program
{
static async Task Main(string[] args)
{ | {
"domain": "codereview.stackexchange",
"id": 37256,
"lm_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, http, dependency-injection",
"url": null
} |
reinforcement-learning, comparison, genetic-algorithms, optimization, evolutionary-algorithms
an encoding of the solution (aka chromosome or individual)
a fitness function that determines the relative quality of each solution
operations that stochastically change or combine solutions (e.g. the cross-over or the mutation operators, in genetic algorithms) | {
"domain": "ai.stackexchange",
"id": 2031,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reinforcement-learning, comparison, genetic-algorithms, optimization, evolutionary-algorithms",
"url": null
} |
python, time-limit-exceeded
9438, 9493, 9515, 9546, 9595, 9597, 9603, 9614, 9667, 9678, 9757, 9797, 9801, 9802, 9834, 9890,
9898, 9909]
#numbers = [1815] | {
"domain": "codereview.stackexchange",
"id": 32803,
"lm_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, time-limit-exceeded",
"url": null
} |
ngs, illumina, pacbio
Title: What is the most accurate approach for de Novo sequencing? I'm trying to decide between PacBio HiFi or Illumina sequencing platforms for sequencing the genome of aChrysina scarab. We want to identify the color pattern loci and also perform a phylogenetic analysis as we'll be sequencing several species of that genus. | {
"domain": "bioinformatics.stackexchange",
"id": 2245,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ngs, illumina, pacbio",
"url": null
} |
It is now very easy to fill in the rest of the box:
$\begin{matrix} & \text{Bears} & \text{No Bears} & \text{Totals} \\ \text{Alarms} & \text{3} & \text{10} & \text{13} \\ \text{No Alarms} & \text{1} & \text{376} & \text{377} \\ \text{Totals} & \text{4} & \text{386} & \text{390} \end{matrix}$
Of course, the target of this question doesn't even require us to fill in the whole table. (I am including the table here to show how quickly you can leverage a Matrix Box to solve for any number of possible variables or ratios.) In the end,we only need a few numbers from this table. (And this information we can extract from the table without actually filling in all the blanks on the table!) The problem just wants to know “If the alarm sounds, what is the probability that a bear has actually been sighted?” By using our Matrix Box, we can calculate this very quickly: | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9799765552017675,
"lm_q1q2_score": 0.8269974097818971,
"lm_q2_score": 0.8438950966654774,
"openwebmath_perplexity": 4331.398466885446,
"openwebmath_score": 0.489630788564682,
"tags": null,
"url": "https://gmatclub.com/forum/the-bear-alarm-at-grizzly-s-peak-ski-resort-sounds-an-averag-175088.html"
} |
javascript, authentication, promise, firebase, react-native
const AuthForm = ({ headerText, buttonText, onSubmit, errorMessage }) => {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
return (
<View style={styles.container}>
<Text>{headerText}</Text>
<TextInput
style={styles.input}
placeholder="Email"
value={email}
onChangeText={setEmail}
/>
<TextInput
style={styles.input}
placeholder="Password"
secureTextEntry={true}
value={password}
onChangeText={setPassword}
/>
{errorMessage ? (
<Text style={styles.errorMessage}>{errorMessage}</Text>
) : null}
<Button
title={buttonText}
onPress={() => onSubmit({ email, password })}
/>
</View>
);
};
export default AuthForm; | {
"domain": "codereview.stackexchange",
"id": 42993,
"lm_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, authentication, promise, firebase, react-native",
"url": null
} |
# Matrix raised to a matrix: $M^N$, is this possible? with $M,N\in M_n(\Bbb K).$
I was wondering if there is such a valid operation as raising a matrix to the power of a matrix, e.g. vaguely, if $M$ is a matrix, is $$M^N$$ valid, or is there at least something similar? Would it be the components of the matrix raised to each component of the matrix it's raised to, resulting in again, another matrix?
Thanks,
It is possible to define the exponential $$\exp(M) = \sum_{n \ge 0}^{\infty} \frac{M^n}{n!}$$
of any matrix using power series. Similarly, it is possible to define the logarithm $$\log(I + M) = \sum_{n \ge 1} \frac{(-1)^{n-1} M^n}{n}$$
when the above series converges (this is guaranteed for example if the largest singular value of $M$ is less than $1$). We can therefore define $$M^N = \exp(N \log M)$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540710685614,
"lm_q1q2_score": 0.8029658806789023,
"lm_q2_score": 0.819893340314393,
"openwebmath_perplexity": 285.1660720172342,
"openwebmath_score": 0.9484460949897766,
"tags": null,
"url": "https://math.stackexchange.com/questions/164422/matrix-raised-to-a-matrix-mn-is-this-possible-with-m-n-in-m-n-bbb-k"
} |
c#, performance, database
The end result - after applying the changes in the first solution and the changes for these 3 points - should be something like the following:
public void ProcessShifts(IList<NavTechAbsenceDto> navShifts)
{
var branches = _iagiBranchModelFactory.GetAll()
.ToDictionary(/* insert key and value expressions here */);
var technicians = _iagiTechnicianModelFactory.GetAll()
.Where(it => it.IsActive)
.ToDictionary(/* insert key and value expressions here */);
var activeTechCodes = technicians.Select(t => t.ERPId).ToList();
var absencesForActiveTech = navShifts
.Where(a => activeTechCodes.Contains(a.TechCode)).ToList();
var absences = _iagiTechnicianModelFactory.GetAllWithAbsences()
.SelectMany(it => it.Absences);
Dictionary</*TKey*/, /*TVal*/> mwmAbsenceList = absences == null
? null
: absences.Where(a => a.Start >= DateTime.Today)
.ToDictionary(/* Insert key and value expressions here */); | {
"domain": "codereview.stackexchange",
"id": 17877,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, database",
"url": null
} |
quantum-mechanics, mass-energy
So far we talked about mass and energy of fundamental particles. What happens when we have bound states like protons/neutrons or nuclei or atoms or molecules? The mass of these compound objects depend on the bounding energy (or potential energy) that keeps them together. So for example the mass of a proton is not equal to the total mass of the quarks that makes up the proton (two up, one down quark) but is mostly created by the interaction between these quarks explained by quantum chromodynamics (QCD). Since there is more than one fundamental particle making up our bound states, there can also be excited states with slightly different masses. An atom for example can absorb a photon and switch to an excited state for a very brief time which has a different mass. This mass difference is usually very small. This only happens when the energy of the photon matches the difference between the discrete energy levels of the atom. Most of the time they will only scatter like billiard balls. | {
"domain": "physics.stackexchange",
"id": 13286,
"lm_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, mass-energy",
"url": null
} |
c#
Use it to derive other calls (I did it for one of them);
public class RegularCall : Call
{
private const decimal DeafultRate = 0.25m;
public RegularCall() : base(DeafultRate ) {}
}
Alternatively you can make the property abstract and return the value here instead of passing it via the constructor:
public class RegularCall : Call
{
public override decimal Rate => 0.25m;
}
And use some other service to create an instance of a call and do some other stuff:
public class Caller
{
public static void MakeCall<TCall>() where TCall : Call, new
{
var call = new TCall();
call.MakeCall();
}
}
Each button would the just do this:
private void button1_Click(object sender, EventArgs e)
{
Caller.MakeCall<RegularCall>();
}
Now you can add as many calls as you like without modifying anything. | {
"domain": "codereview.stackexchange",
"id": 26051,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#",
"url": null
} |
energy, phase
What you may not realize is that while water is freezing or melting, its temperature is not changing! It is stuck on $0\ \mathrm{^\circ C}$ during the entire melting or freezing process. It is easier to see this for boiling points. if you put a thermometer in water and heat it, the temperature will rise until it reaches $100\ \mathrm{^\circ C}$, and then it starts boiling. And while it boils, it will stay at $100\ \mathrm{^\circ C}$! All the way until the water has all boiled away. Now if you could somehow trap the steam (gaseous water) and keep heating it, the steam could have a temperature higher than $100\ \mathrm{^\circ C}$.
So to sum this all up, when matter is transitioning from solid to liquid (melting) or liquid to solid (freezing), its temperature is fixed at the melting/freezing point, which is the same temperature. | {
"domain": "chemistry.stackexchange",
"id": 1085,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "energy, phase",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.