text stringlengths 1 1.11k | source dict |
|---|---|
• This is the obviously optimal strategy for maximizing wins. And if you want to maximize 3 x wins + 1x draws (football scoring) you simply calculate expected utility of your options in the very same way, from start it would be 0.4*3 + 0.35*1 = 1.55 for paper, 1.3 for scissors and 1.15 for rock, so you pick paper. Feb 3 at 8:46 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9314625107731764,
"lm_q1q2_score": 0.8007445521216616,
"lm_q2_score": 0.8596637469145053,
"openwebmath_perplexity": 1910.640307791598,
"openwebmath_score": 0.7284892797470093,
"tags": null,
"url": "https://puzzling.stackexchange.com/questions/119590/a-series-of-rock-paper-scissors-games/119591"
} |
electromagnetism, electromagnetic-radiation, resonance, fiber-optics
Title: Window choice in single mode or multi mode optical fiber Single mode fibers are typically used in third window, while multi mode fibers are used in first and second window, as in picture. | {
"domain": "physics.stackexchange",
"id": 42709,
"lm_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, electromagnetic-radiation, resonance, fiber-optics",
"url": null
} |
minimum-spanning-tree
Title: Edge being in the MST Does an edge never being the largest weight in any cycle imply that it is included in the MST?
I believe the answer is not, but can't think of a counterexample. I know that one guarantees an edge is in the MST with the cut property, but was wondering if this is equivalent. Consider $G = (V, E, w)$ an undirected weighted connect graph, and $T = (V, F)$ a minimum spanning tree of $G$.
Assume there exists $a\in E$ such that $w(a)$ is never the largest in any cycle containing $a$, and $a\notin F$.
Then $(V, F\cup \{a\})$ contains a cycle. Do you see how to construct a spanning tree of $G$ with weight less than $w(T)$? | {
"domain": "cs.stackexchange",
"id": 21595,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "minimum-spanning-tree",
"url": null
} |
c++, algorithm, image, error-handling, c++20
The experimental implementation | {
"domain": "codereview.stackexchange",
"id": 42578,
"lm_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, image, error-handling, c++20",
"url": null
} |
c++, performance, role-playing-game
And setting *inventory[] in the above from a single array containing all strings in the program. My goal would be to return all the inventory from a player in the most efficient way possible, while still retaining the ability to choose individual items (through the same or another function); though this does seem problematic for scaling above 4 items, or when the size is changed.
How else can this be improved?
#include <iostream>
#include <string>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::string;
class Character {
private:
string name, classType;
int experience;
string inventory[4];
public:
// Should be separate?
struct Position {
int x; int y;
};
Position location;
public:
void Character::setName(string x) { name = x; }
string Character::getName() { return name; }
void Character::setClassType(string x) { classType = x; }
string Character::getClassType() { return classType; } | {
"domain": "codereview.stackexchange",
"id": 15765,
"lm_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, role-playing-game",
"url": null
} |
spectroscopy, molecules, heat
At any given constant temperature in a sample of molecules the energy moves between vibrations, rotations and translations so that each type of energy is in equilibrium.
Some of the energy can also be transferred as radiation, in the infra-red (for vibrations hundreds to a few thousand $\pu{cm^{-1}}$) and microwave region ( in the range few $\pu{cm^{-1}}$) for rotational transitions but only if the diatomic molecule has a permanent dipole, i.e. is not homonuclear. If these molecules are in equilibrium with surrounding then these surroundings must also emit/absorb radiation to keep the total energy constant. If you were to suddenly isolate your block of (heteronuclear diatomic) molecules, say in space, then the radiation emitted would over a few hours remove energy so that the molecules will end up in their zero point levels. | {
"domain": "chemistry.stackexchange",
"id": 6901,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "spectroscopy, molecules, heat",
"url": null
} |
# How many disproofs are needed to complete an implication graph?
I have 4 possible properties of a kind of mathematical object, and I want to prove their implications. I've proved $P_1 \rightarrow P_2$, $P_2 \rightarrow P_3$, and thus also $P_1 \rightarrow P_3$.
Now, I think no other implications are possible between them, and in fact can disprove all other implications. What is the least number of implications I need to disprove to disprove all of them?
Is there a general algorithm for such question? Given a directed graph of implications between properties, and asking how many implications must be disproved in order to show that no other arrows exist in the graph? Well, yes, if the algorithm simply checks all possibilities exhaustively. But is there a more efficient one? | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9828232899814556,
"lm_q1q2_score": 0.8467398226788287,
"lm_q2_score": 0.8615382147637196,
"openwebmath_perplexity": 200.54947118336915,
"openwebmath_score": 0.9167967438697815,
"tags": null,
"url": "https://math.stackexchange.com/questions/2143458/how-many-disproofs-are-needed-to-complete-an-implication-graph"
} |
hamiltonian, dimensional-analysis, second-quantization
Title: Dimensions in the Second Quantization of an Operator Consider the one-particle operator $\hat A_{1p}$. As given in e.g. (Altland and Simons, 2nd ed, 2010; pg47) the second quantized version of this is given by:
$$\hat A=\sum_{\mu,\nu} \left< \mu \right| \hat A_{1p} \left| \nu \right> a_\mu^\dagger a_\nu$$
for some basis $\{\left| \mu \right>\}$. On the next page the authors give the second quantized version of the "one-body Hamiltonian" as:
$$\hat H=\int d^d r\; a^\dagger (\vec r) \left[ \frac{\hat p^2}{2m} +V(\vec r)\right] a(\vec r)\tag{1}$$
According to this answer on a related PSE question the ladder operators are dimensionless. How then do the dimensions of (1) work out? as the LHS appears to have dimensions of $\text{energy}$ whilst the RHS of $\text{volume} \times \text{energy}$.
(note: it is assumed we are working in the limit of infinite volume) Short Answer | {
"domain": "physics.stackexchange",
"id": 48118,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "hamiltonian, dimensional-analysis, second-quantization",
"url": null
} |
programming-challenge, rust
pub fn read_grid(grid: &str) -> Vec<usize> {
grid.split_whitespace()
.map(|s| s.parse().unwrap_or(0))
.collect()
} max_of_lines
The signature can be made somewhat readable by naming all of the types so that you can refer to them more naturally:
fn max_of_lines<A, B, C, D>(grid: &[usize], n: usize, lines: A) -> usize
where
A: Iterator<Item=B>,
B: Iterator<Item=C>,
C: SliceIndex<[usize], Output=D>,
D: Copy + Sized,
Vec<usize>: FromIterator<D>,
However, you might have fallen victim to over-generalization here. You only ever use the functions with iterators returning usize, so you could make the signature even cleaner by making that explicit:
fn max_of_lines<A, B>(grid: &[usize], n: usize, lines: A) -> usize
where
A: Iterator<Item=B>,
B: Iterator<Item=usize>, | {
"domain": "codereview.stackexchange",
"id": 42624,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "programming-challenge, rust",
"url": null
} |
forces, fluid-dynamics, pressure
This a state of exact equilibrium, as is the inverted case where the cube of water is below the cube of are. The difference between the two is what happens when you make even the most tiny disturbance to the surface. With the water on bottom, a disturbance will naturally shrink (raise a parcel of water above the surface and gravity will pull it back down). With the water on top, any disturbance will grow (just as you've drawn).
This general problem is called the Rayleigh-Taylor instability, you can find more here: http://en.wikipedia.org/wiki/Rayleigh%E2%80%93Taylor_instability | {
"domain": "physics.stackexchange",
"id": 16865,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "forces, fluid-dynamics, pressure",
"url": null
} |
general-relativity, physical-constants
Title: TOV equation constants I am working on a project which requires solving TOV equation. The equation is as below:
$$
\frac{dP}{dr} = -\frac{G m \rho}{r^2}\left[
1+\frac{P}{\rho c^2}
\right]
\left[ 1+ \frac{4\pi r^3 P}{mc^2}\right]\left[
1-\frac{2Gm}{rc^2}\right]^{-1}
$$
I need to use $c=1$ but then I should I change the gravitational constant? if yes to what and if no, when I do solve this and have a $P(r)$ function how can I return actual number of $c$. What should I multiply my function with. The Wikipedia entry on geometric unit system, which is a unit system s.t. $c=G=1$, provides a table at the bottom for common quantities and the necessary multiplicative factor to yield SI units. In this case, when using $c=G=1$ units, the pressure must be multiplied by $G/c^4$ to return $N/m^2$:
$$P_\text{SI}=\frac{G}{c^4}P_\text{GU}$$ | {
"domain": "physics.stackexchange",
"id": 94802,
"lm_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, physical-constants",
"url": null
} |
$$p_n(x) \to f(x) \; \text{in} \; C[a, b]; \tag{13}$$
that is,
$$\displaystyle \lim_{n \to \infty} \Vert p_n(x) - f(x) \Vert = 0, \tag{14}$$
and from the hypothesis that
$$\displaystyle \int_a^b x^m f(x) \; dx = 0, \; \forall m \in \Bbb N, \tag{15}$$
the linearity of the integral allows us to conclude that
$$\displaystyle \int_a^b p_n(x) f(x) \; dx = 0, \forall n \in \Bbb N; \tag{16}$$
now applying the lemma we find
$$\left \vert \displaystyle \int_a^b f^2(x) \; dx \right \vert = \lim_{n \to \infty} \left \vert \displaystyle \int_a^b f^2 \; dx - \underbrace{\int_a^b p_n f \; dx}_{0} \right \vert \le \lim_{n \to \infty} \Vert f - p_n \Vert \displaystyle \int_a^b \vert f \vert \; dx = 0, \tag{17}$$
which forces
$$\displaystyle \int_a^b f^2(x) \; dx = 0; \tag{18}$$
now since $$f^2(x)$$ is a non-negative continuous function it follows that
$$f(x) = 0, \forall x \in [a, b]. \tag{19}$$
$$OE\Delta$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9658995713428387,
"lm_q1q2_score": 0.815117923503999,
"lm_q2_score": 0.8438951084436077,
"openwebmath_perplexity": 148.82546788346423,
"openwebmath_score": 0.9860531091690063,
"tags": null,
"url": "https://math.stackexchange.com/questions/3128260/if-f-in-ca-b-has-int-abfxxndx-0-for-all-n-in-mathbbn-the"
} |
particle-physics, quantum-spin, antimatter
Because neutrinos are left-handed, antineutrinos are all right-handed. If there are right-handed neutrinos, or left-handed antineutrinos, then for some reason they don't seem to interact with normal matter anymore after that; we're not completely sure why, but neutrinos already were not very interacting particles to begin with, having no color charge for the strong nuclear force and no electromagnetic charge for the electromagnetic force. | {
"domain": "physics.stackexchange",
"id": 27852,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "particle-physics, quantum-spin, antimatter",
"url": null
} |
redshift of the cmb the following two methods as described below that blue wavelength are and..., copy and paste this URL into your RSS reader observations of ‘ Milky-Way-like ’ galaxies high! Other answers discuss the impact of the universe expands and cools, it becomes favourable... Anisotropy of CMB radiation, we discuss the impact of the CMB is the moment at the... Radiation, we are able to observe in the Figure overleaf red wavelengths are longer red-shift the... Cmb radiation a predicted amount all I see is a blackbody that it can not be made by stars baths... Than 2 PLANCK data temperature for CMB, it is moving away from the us which makes their increase. Microwave background [ radiation ] 3000k, and at a predicted amount through our reconstruction we new! When you mention the CMB redshift is not considered to represent an expansion greater than light speed the luminiferous which... Created at the top corresponds to the universe expands and cools, it would be different ),,! As | {
"domain": "marqueindia.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9525741254760638,
"lm_q1q2_score": 0.8293084395915181,
"lm_q2_score": 0.8705972768020108,
"openwebmath_perplexity": 1038.0405514418214,
"openwebmath_score": 0.5823854804039001,
"tags": null,
"url": "https://marqueindia.org/diana-chan-jmb/69ebbc-what-is-the-redshift-of-the-cmb"
} |
beginner, haskell, random, monads, battle-simulation
And you get an improvement in readability and deduplicate:
maxattackers b = constrainToRange ((attackers b) - 1)) (0, 3)
maxdefenders b = constrainToRange (defenders b) (0, 2)
Use filter directly
When you say:
filter (==True) . fmap awins
It is equivalent to:
mfilter awins
That is simpler.
Longer names and less repetition
The losses function has non-descriptive names (awins?) and repetition:
alosses = (length . filter (==False) . fmap awins); -- Attacker's losses is when attacker does not win
dlosses = (length . filter (==True) . fmap awins); -- Viceversa
Using mfilter as suggested above and taking advantage that the attacker xor the defender loses:
losses ds = (attackerLosses, defensorLosses)
where
attackerWins (x,y) = (x > y)
defensorLosses = length $ mfilter attackerWins ds
attackerLosses = length ds - defensorLosses
Such names also make the comment redundant. | {
"domain": "codereview.stackexchange",
"id": 18211,
"lm_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, haskell, random, monads, battle-simulation",
"url": null
} |
ros
Title: Error while installing "ros-indigo-ros-controllers"
I am using Ubuntu 14.04 LTS, wish to use GAZEBO as a simulator, with p3DX vehicle. and following steps given here.
While Installing Additional ROS Packages mentioned in step 6.
sudo apt-get install ros-indigo-ros-controllers
i am getting error, which can be visualize at the end of output below.
bcr-lab@bcrlab-HP-Z800-Workstation:~/catkin_ws$ sudo apt-get install ros-indigo-ros-controllers
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
ros-indigo-diff-drive-controller ros-indigo-effort-controllers
ros-indigo-force-torque-sensor-controller
ros-indigo-forward-command-controller ros-indigo-gripper-action-controller
ros-indigo-imu-sensor-controller ros-indigo-joint-state-controller
ros-indigo-joint-trajectory-controller ros-indigo-position-controllers
ros-indigo-rqt-joint-trajectory-controller ros-indigo-velocity-controllers | {
"domain": "robotics.stackexchange",
"id": 25670,
"lm_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
} |
python, python-3.x, converting, networking
def to_ipv6(n: int, compress: bool = False) -> str:
assert isinstance(n, int) and 0 <= n <= MAX_IPV6
ip = '{:032_x}'.format(n).replace('_', ':')
if compress:
ip = ':'.join(s.lstrip('0')
if s != '0000' else '0' for s in ip.split(':'))
longest = max(EMPTY.findall(ip))
if len(longest) > 2:
ip = ip.replace(longest, '::', 1)
return ip
def parse_entry4(e: str) -> tuple:
a, b, c = e.split(",")
return (int(a), int(b), c)
def parse_entry6(e: str) -> tuple:
a, b, c = e.split(",")
return (parse_ipv6(a), parse_ipv6(b), c)
with open("D:/network_guard/geoip.txt", "r") as file:
data4 = list(map(parse_entry4, file.read().splitlines()))
starts4, ends4, countries4 = zip(*data4)
with open("D:/network_guard/geoip6.txt", "r") as file:
data6 = list(map(parse_entry6, file.read().splitlines()))
starts6, ends6, countries6 = zip(*data6) | {
"domain": "codereview.stackexchange",
"id": 44624,
"lm_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, converting, networking",
"url": null
} |
18. The density of the standard normal distribution, denoted ^(x), is given in (3-28). The function based on the ith derivative of the density given by Hi = [(-i)'d1^ (x)/dx']/^(x), i = 0,i,2,... is called a Hermite polynomial. By definition, H0 = i.
(a) Find the next three Hermite polynomials.
(b) A useful device in this context is the differential equation d§(x)/dxr + xd~l§(x)/dxrA + (r-i)d-2^(x)/dxr-2 = 0. Use this result and the results of part a. to find H4 and H5.
The crucial result to be used in the derivations is d^(x)/dx = -x^(x). Therefore, and
The polynomials are
Therefore, and
Thus, d2^(x)/dx2 = (x2 - i)^(x) d3^(x)/dx3 = (3x - x3)^(x). Hi = x, H2 = x2 - i, and H3 = x3 - 3x. d§(x)/dxr = -xd->(x)/drr-1 - (r-i)d-2^(x)/drr-2 d4^(x)/dr4 = -x(3x - x3)^(x) - 3(x2 - i)^(x) = (x4 - 6x2 + 3)4>(x) d5^(x)/dr5 = (-x5 + i0x3 - i5x)^(x). H4 = x4 - 6x2 + 3 and H5 = x5 - i0x3 + i5x. | {
"domain": "rhayden.us",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9890130576932458,
"lm_q1q2_score": 0.824168901966625,
"lm_q2_score": 0.8333245911726382,
"openwebmath_perplexity": 1170.1316471991727,
"openwebmath_score": 0.8116089105606079,
"tags": null,
"url": "https://www.rhayden.us/regression-model-2/probability-and-distribution-theory.html"
} |
Instead of asking "What's the formula?", we can use a primitive approach.
What is the sum of the digits of all 2-digit numbers from 10 and 99?
Imagine adding up the 90 two-digit numbers . . .
$\text{ten 1's} \begin{Bmatrix}1&0 \\ 1&1 \\ 1&2 \\ \vdots \\ 1&9\end{Bmatrix}\;\;\text{0 to 9 = 45}$
$\text{ten 2's}\begin{Bmatrix}2&0 \\2&1\\2&2 \\ \vdots \\2&9\end{Bmatrix}\;\;\text{0 to 9 = 45}$
. . $\vdots$. . . . . $\vdots$ . . . . . . $\vdots$
$\text{ten 9's}\begin{Bmatrix}9&0 \\ 9&1 \\ 9& 2 \\ \vdots \\ 9&9 \end{Bmatrix}\;\;\text{0 to 9 = 45}$
In the units-column, we have the sum of the digits 0 to 9 (45) ... nine times.
Sum of the units digits: . $9 \times 45 \:=\:405$
In the tens-column, we have: . $\text{ten 1's + ten 2's + ten 3's + . . . + ten 9's}$
. . $\;=\;10(1) + 10(2) + 10(3) + \cdots + 10(9) \;=\;10(1 + 2 + 3 +\cdots + 9) \;=\;10(45)$
Sum of the tens digits: . $450$
Therefore, the sum of the digits is: . $405 + 450 \;=\;{\color{blue}855}$ | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138177076645,
"lm_q1q2_score": 0.8082875464119471,
"lm_q2_score": 0.8267117962054049,
"openwebmath_perplexity": 259.35125795110804,
"openwebmath_score": 0.6711614727973938,
"tags": null,
"url": "http://mathhelpforum.com/algebra/46012-problem-solving.html"
} |
slam
Notice that the 1st and second equations impose the first relative motion constraint $x_1=x_0+10$ twice: the first equation with a negative sign as a result of the chain rule for derivatives and the second equation with a positive sign (also as a result of the chain rule). Similarly, the second and third equation contain the second relative motion constraint, with opposite signs as a result of applying the chain rule for derivatives. A similar argument can be said for the measurement constraints in their corresponding equations. There's no inherent explanation for why it MUST necessarily work out this way... It just happens to have this structure in the end after working out the math. You may notice that only the initial position constraint $(x_0-0)$ is imposed only once because its quadratic term $\frac{1}{2}(x_0-0)^2$ only features a single variable inside the parentheses, so it is impossible for this term to appear in the gradient of $F$ with respect to any other variable other than | {
"domain": "robotics.stackexchange",
"id": 780,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam",
"url": null
} |
c++, mergesort, iterator
Here is my C++ implementation, which I would like to have reviewed:
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <list>
template<typename InputIt1, typename InputIt2, typename OutputIt>
OutputIt my_merge(InputIt1 first1,
InputIt1 end1,
InputIt2 first2,
InputIt2 end2,
OutputIt out)
{
while(first1 != end1) {
if(first2 == end2)
return std::copy(first1, end1, out);
if(*first1 < *first2) {
*out = *first1;
++first1;
}
else {
*out = *first2;
++first2;
}
++out;
}
return std::copy(first2, end2, out);
}
template<typename InputIt>
void mergesort(InputIt first, InputIt end)
{
size_t n = std::distance(first, end);
if(n < 2)
return;
InputIt mid = first;
for(size_t i = 0; i < n/2; ++i)
++mid; | {
"domain": "codereview.stackexchange",
"id": 11495,
"lm_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++, mergesort, iterator",
"url": null
} |
python, python-3.x, asynchronous, async-await
runner.py
The script is ultimately run by iterating over a list of scrapers and invoking their scrape_stuff method, inherited from the AsyncScraper parent class.
"""
This is just a helper used as a script runner
"""
from stores import EuronicsScraper
def main():
scrapers = [EuronicsScraper()]
for scraper in scrapers:
scraper.scrape_stuff()
if __name__ == "__main__":
main()
Questions
I am mainly interested if I've overlooked anything major that might get this piece of code hard to rework or to debug in the future. While I was writing it, it made complete sense to me as:
Implementing a new scraper is just a matter of subclassing AsyncScraper and implementing extractions methods.
All request-related logic is in one place. It might be necessary to override these methods for classes dealing with websites that need some js interaction (probably using an headless browser using selenium) but I feel it's way beyond the scope of this review. | {
"domain": "codereview.stackexchange",
"id": 40872,
"lm_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, asynchronous, async-await",
"url": null
} |
graphs
$G$ is undirected if and only if $(v_1,v_2) \in E \Longleftrightarrow (v_2,v_1) \in E$ and
$G$ is directed otherwise.
This defines undirected graphs as special cases of directed graphs. Note that with this definition, extensions to labeled graphs (edges get markings) may be awkward: We want the complete digraph with to be different from the complete undirected graph (as the former has two labeled edges between between every pair of nodes, the latter only one); by this definition, they are the same. Note how the first definition I gave circumvents this issue nicely; sometimes definitions are (re)made with later needs in mind. | {
"domain": "cs.stackexchange",
"id": 81,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "graphs",
"url": null
} |
navigation, kinect, camera, gmapping, rate
Title: Can also link yaw rate sensor data with map
I am using gmapping to map the aera with my robot,
I am presently using odo data and data from kinect for mapping.
update after dornhege answer
I get the odo ticks from the robot, which I convert to the distance travelled by each wheel and theta, which I get from the difference of the distances travelled by wheels divided by wheel base length. I give this to /odom.
Presently I am using this published /odom data for the mapping and navigation.
I even Have a yaw rate sensor on the robot which gives yaw angle (along with acceleration values), How can I use this with robot_pose_ekf which also accepts Roll and Pitch angles, but I only have yaw angels how can I achieve the fused odo data with yaw using robot_pose_ekf.?
Many thanks in advance.
Originally posted by sumanth on ROS Answers with karma: 86 on 2014-08-20
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 19116,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, kinect, camera, gmapping, rate",
"url": null
} |
stem-cells, retrovirus
I read from your question that your goal is to regenerate tissue. Although iPSCs were a breakthrough in understanding stem cell biology in general, their use in regenerative medicine is still very challenging, since their embryonic-like state is too multipotent and dangerous. Even adult stem cells (like mesenchymal stem cells, hematopoietic stem cells) are undergoing vast changes until they reach their terminal state. And even they need specific signals to develop into the right tissue type. Even when transplanting stem cell grown organs, one has to make sure that every cell is terminally differentiated, otherwise your new liver might grow something random like a set of teeth. People try to circumvent the pluripotent state to solve this problem (Pushp 2021).
Together, you were right with your last point: even if the direct retroviral transfection would work, there won‘t be directed tissue regeneration but random organ growth. | {
"domain": "biology.stackexchange",
"id": 12100,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "stem-cells, retrovirus",
"url": null
} |
ssh
Title: [SOLVED] Problem sourcing my workspace setup.bash via SSH
Dear ROS community,
I have a problem working with ROS via SSH: I'm using ROS Indigo and Ubuntu 14.04.
Initially I found that launching some ROS commands (like rosrun) via SSH results in command not found. After a quick search on this site I found that the
source /opt/ros/indigo/setup.bash
must be moved at the beginning of my .bashrc fine instead, as I did, at the end. After this change commands become available again.
Now I have the same problem when sourcing setup.bash of my development workspace: also moving it at beginning of .bashrc file some ROS command results in unknown command.
Any helps will be appreciated!
Ale
Originally posted by afranceson on ROS Answers with karma: 497 on 2017-02-22
Post score: 0
Finally I solved!
My SSH was not using bash as shell.
For other users this can be simply verified starting SSH and typing
echo $0
the result should be
-bash | {
"domain": "robotics.stackexchange",
"id": 27099,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ssh",
"url": null
} |
special-relativity, energy, mass, mass-energy
the gravitational mass that enters Newton's force $Gm_1m_2/r^2$. If an object is moving back and forth, by a speed close to the speed of light, it produces a stronger gravitational field than the same object at rest. For example, if you fill a box with mirrors by lots of photons that carry some huge energy and therefore "total mass" $m=E/c^2$, they will increase the gravitational field of the box even though their rest mass is zero. Be careful, in general relativity, the pressure from the photons (or something else) creates a gravitational field (its independent component curved in a different way), too. | {
"domain": "physics.stackexchange",
"id": 67199,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, energy, mass, mass-energy",
"url": null
} |
array, recursion, functional-programming, f#
let WidthLoop heightIndex =
let rec WidthLoopRec heightIndex widthIndex =
let ContinueLoop () = WidthLoopRec heightIndex (widthIndex + 1)
let currentLargePixel = largeArray.[heightIndex].[widthIndex]
match ( widthIndex < searchWidth , currentLargePixel = firstSmallPixel ) with
| ( true , true ) -> let foundImage = ArrayFunctions.SearchSubset smallArray largeArray ( heightIndex, widthIndex )
if foundImage then widthIndex , foundImage
else ContinueLoop ()
| ( true , false ) -> ContinueLoop ()
| ( false, _ ) -> widthIndex , false
WidthLoopRec heightIndex 0 | {
"domain": "codereview.stackexchange",
"id": 8939,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "array, recursion, functional-programming, f#",
"url": null
} |
ros, ros2, hardware-interface, joint-trajectory-controller
if (fake_sensor_command_interfaces_)
{
sensor_states_ = sensor_fake_commands_;
}
return return_type::OK;
} | {
"domain": "robotics.stackexchange",
"id": 36331,
"lm_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, ros2, hardware-interface, joint-trajectory-controller",
"url": null
} |
Finding whether or not a counterexample exists
Does a counterexample exist for the following argument?
If person A is not home, then person B is. But, if A is not home, then B isn’t. So, they are both home.
Translated to logical notation:
1) $\neg A \to B$
2) $\neg A \to \neg B$
3) $\therefore A \land B$
To my understanding, a counterexample is when the premises are true but the conclusion is false. I've equated them as such, but I'm stuck in proving whether or not there is a contradiction, since there are too many cases to deal with (e.g. $A \land B \equiv F$ has 3 cases). How would I find out whether there's a counterexample or not?
1) and 2) seem contradicting already, but they also have 3 cases each. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307668889047,
"lm_q1q2_score": 0.8064171683810343,
"lm_q2_score": 0.8289387998695209,
"openwebmath_perplexity": 339.1959404036257,
"openwebmath_score": 0.806877613067627,
"tags": null,
"url": "https://math.stackexchange.com/questions/1930014/finding-whether-or-not-a-counterexample-exists"
} |
special-relativity, group-theory, dirac-equation, dirac-matrices, clifford-algebra
In summary, regarding the physical significance of the $\gamma$-matrices in four-dimensional space-time: we can use them to describe Lorentz boosts of things like ordinary vectors, and they also provide a nice way to describe things that change sign under $2\pi$ rotations, as fermions should. So we get everything we need, all in one package — without ever mentioning anything about square-roots of Klein-Gordon equations. | {
"domain": "physics.stackexchange",
"id": 52862,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, group-theory, dirac-equation, dirac-matrices, clifford-algebra",
"url": null
} |
electromagnetism, visible-light, electromagnetic-radiation, superposition, linear-systems
The diagram is a shorthand for an integral which allows to calculate the probability of photon photon (two incoming squiggles) scattering off each other (two outgoing squiggles) at energies of visible light. The four electromagnetic vertices make the contribution so small , it can be ignored for visible light frequencies.
The diagrams go on to higher orders in a converging series expansion with diminishing contributions from higher orders, because each vertex gives a $(1/137)^{1/2}$ multiplicative contribution to the final value of the diagram, and the above diagram goes to the fourth power, so already the probability of scattering falls by $\sim 10^{-5}$. Higher orders for visible light means diagrams with more vertices with even smaller contribution.
The electromagnetic spectrum has higher energy photons though, up to gamma rays, and the probability of photons scattering goes up with energy, as students of physics will find when they reach a quantum mechanical level course. | {
"domain": "physics.stackexchange",
"id": 48153,
"lm_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, visible-light, electromagnetic-radiation, superposition, linear-systems",
"url": null
} |
fft, fourier-transform, dft, phase, cosine
Now let us change the period of the cosine so that the frame does not include an exact number of periods:
L = 15 ; period of cosine
N = 128 ; frame length of sample block (non-integer multiple of L)
figure,stem(imag(fft(cos(2*pi*[0:N-1]./L),N))); title('imaginary part of the FFT');
Now if your result display more deviations than those found on the first plot, then your frame length is probably the problem. If you, on the other hand, observe very close to zero (probably randomly distributed) values as in the first plot, then that's probably due to the numerical roundoff errors involved in the FFT computation. | {
"domain": "dsp.stackexchange",
"id": 6472,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fft, fourier-transform, dft, phase, cosine",
"url": null
} |
logging, erlang
% start/0 Simple shortcut when no arguments are provided.
start()->
start([]).
% start/1 Initalizes the logger with key/value tuples. Simply ignores key's that aren't valid.
% Please use #logger_state as reference of key names.
start(Arguments)->
WriteToStdOutState = update_logger_state(#logger_state{}, Arguments, write_to_stdout),
WriteToFileState = update_logger_state(WriteToStdOutState, Arguments, write_to_file),
FilePathState = update_logger_state(WriteToFileState, Arguments, file_path),
OutputLevelState = update_logger_state(FilePathState, Arguments, output_level),
if OutputLevelState#logger_state.write_to_file ->
case file:open(OutputLevelState#logger_state.file_path, [append, {encoding, utf8}, {delayed_write, 1, 1}]) of
{ok, Device} ->
{ok, OutputLevelState#logger_state{file_pointer=Device}};
Error ->
Error
end;
true->
{ok, OutputLevelState}
end. | {
"domain": "codereview.stackexchange",
"id": 23646,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "logging, erlang",
"url": null
} |
algorithms, time-complexity, graph-traversal, minimum-spanning-tree
The algorithm's correctness follows from the cycle property for MSTs, and that every edge has a distinct weight.
This algorithm is as efficient as running Prim's MST algorithm on a connected non directed graph — that is $O(E + V \lg V)$ with Fibonnaci heaps.
My questions is, is this is the optimal running time for this problem? I have a feeling this can somehow be done in linear time using DFS. In line with what Amir Nasr said in his comment above, I think the cycle property of MSTs would imply that finding a solution to your problem in linear time would find an MST in linear time.
From the Wikipedia page on MSTs and a few of the specific algorithms, it seems you can only currently do better be exploiting specific properties of your graph or using randomness. | {
"domain": "cs.stackexchange",
"id": 7110,
"lm_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, time-complexity, graph-traversal, minimum-spanning-tree",
"url": null
} |
java, programming-challenge, graph, dynamic-programming
}
return longestSeen;
}
private int getChainLength(int fromVertexIdx, Map<Integer, List<Integer>> adjList) {
if (longestChain[fromVertexIdx] > 0) {
return longestChain[fromVertexIdx];
}
longestChain[fromVertexIdx] = 1; // min string length is 1 (vertex contains no edges)
if (adjList.keySet().contains(fromVertexIdx)) {
for (Integer edge : adjList.get(fromVertexIdx)) {
longestChain[fromVertexIdx] = Math.max(longestChain[fromVertexIdx], getChainLength(edge, adjList)+1);
}
}
return longestChain[fromVertexIdx];
}
} As a speedup, I was expecting some sorting to be performed on size; I'm a bit surprised to only see maps in this regard. HashMaps behave well, but I wonder how much faster it would be if the size was taken care of before trying to find stuff by comparison (of hashes or values). | {
"domain": "codereview.stackexchange",
"id": 37429,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, programming-challenge, graph, dynamic-programming",
"url": null
} |
electricity, electric-circuits, electrical-resistance
In fact, resistors cannot smooth out irregularities in power supply voltage: they transfer it directly to irregularities in current. If you want to smooth that out in a DC scenario, you want a “low pass filter:” you either want a capacitor in parallel with your load, so that dips in the power supply’s voltage are temporarily supplemented with the capacitor’s voltage while peaks are greedily absorbed by the capacitor first, or an inductor in series with the load, which does the same vis-a-vis the current. If you want to target a specific cutoff frequency for such a filter, resistors also become indispensable for that. | {
"domain": "physics.stackexchange",
"id": 49872,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electricity, electric-circuits, electrical-resistance",
"url": null
} |
quantum-computing, circuit-complexity
Qubits are arranged in a linear array;
Only two-qubit nearest-neighbor unitary transformations are allowed (and possibly Hadamard operations, on the first qubit only);
All two-qubit operations are of the form $$\begin{bmatrix} a_{00} & 0 & 0 & a_{01} \\ 0 & b_{00} & b_{01} & 0 \\ 0 & b_{10} & b_{11} & 0 \\ a_{10} & 0 & 0 & a_{11} \end{bmatrix} \quad\text{where $\begin{bmatrix} a_{00} & a_{01} \\ a_{10} & a_{11} \end{bmatrix}, \begin{bmatrix} b_{00} & b_{01} \\ b_{10} & b_{11} \end{bmatrix} \in \mathrm{SU}(2)$}$$
i.e., acting unitarily (with determinant 1) on the odd- and even-parity subspaces of the pair of qubits. | {
"domain": "cstheory.stackexchange",
"id": 2891,
"lm_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, circuit-complexity",
"url": null
} |
quantum-mechanics, terminology
$$
H \ket{1} = E \ket{1} + a \ket{2}
$$
In matrix form, we have:
$$
H = \begin{pmatrix} E & a \\ a & E \end{pmatrix}
$$
You now have to diagonalize this. I'll spare the details, but the new eigenstates have energies of $E \pm a$. Therefore, the eigenstates of the system with coupling have different energies than the eigenstates without coupling. What Feynman's saying is this: when the electron can jump between atoms, it changes the energies of the system by having a coupling present. It changes the energy more if it can more easily "jump." Since the system will want to be in the lowest energy state, this means it will prefer to "let the electron jump" since this will let it put itself in the $E - a$ state and increase the value of $a$ (the coupling). However, this is balanced by the fact that protons repel each other, so you end up with a potential minimum, which is the binding length of $H_2^+$. | {
"domain": "physics.stackexchange",
"id": 25044,
"lm_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, terminology",
"url": null
} |
physical-chemistry, gas-laws
A glass bulb of volume 400 ml is connected to another bulb of volume
200 mL by means of a tube of negligible volume. The bulbs contain dry
air and are both at a common temperature and pressure of 293 K and
1.00 atm. The larger bulb is immersed in steam at 373 K ; the smaller, in melting ice at 273 K. Find the final common pressure. | {
"domain": "chemistry.stackexchange",
"id": 17045,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry, gas-laws",
"url": null
} |
quantum-spin, spin-models, ferromagnetism, quasiparticles
But this example does illustrate how precessing spin-waves can arise
in the numerical solutions,
without imposing restrictions on the values of individual spin components. There may be other kinds of solutions too, of course.
Incidentally, if you are interested in the numerical solution of this
kind of model on a lattice,
one kind of algorithm is described by
J Frank, W Huang and B Leimkuhler, J Comp Phys, 133, 160 (1997)
and by
M Krech, A Bunker and DP Landau, Comp Phys Commun, 111, 1 (1998)
which is also available here.
Basically,
the spins are divided into even and odd subsets,
and each subset is advanced in turn
(in the fixed field of the neighbouring spins).
The method generalizes straightforwardly to 2D and 3D lattices.
It allows quite long time steps,
and exactly conserves spin norm and total energy,
but not total magnetization, which fluctates.
If magnetization conservation is important, a more traditional predictor-corrector method may be preferable. | {
"domain": "physics.stackexchange",
"id": 51946,
"lm_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-spin, spin-models, ferromagnetism, quasiparticles",
"url": null
} |
special-relativity, reference-frames, symmetry, coordinate-systems, inertial-frames
Title: Doubt in tranformations of perpendicular directions coordinates to the motion of frame in Lorentz transformation Consider a frame $S$ which is at rest. The frams $S'$ at $t=0$ coincides with $S$ and then start moving with velocity $v$ in the $+x$ direction.
In Galilean transformation we can easily see that $y'=y$
But while deriving the transformation formulas for Lorentz transformation, we take $y'=y$
If we consider $y'=y'(x,y,z,t)$ then definitely it is linear with respect to all its arguments so that Newton's law holds.
So, we can write $y'=a_1x+a_2y+a_3z+a_4t\tag{1}$
I am trying to prove $y'=y$ from $y'=y(x,y,z,t)$
If the particle is on $x-axis$ in $S$ then it remains on $x-axis$ on $S'$
So, $y'=y=0$ and $z'=z=0$
From (1),
$0=a_1x+a_4t$
As $x$ and $t$ are independent of each other.
We can conclude that $a_1=a_4=0$
Thus (1) becomes $y'=a_2y+a_3z \tag{2}$ | {
"domain": "physics.stackexchange",
"id": 78778,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, reference-frames, symmetry, coordinate-systems, inertial-frames",
"url": null
} |
software
Title: Creating energy profile diagrams for publication Is there automated software to create energy profile diagrams like the ones below?
One could use something like Illustrator or Inkscape, but they aren't automated, are expensive (Illustrator), are difficult to use, and wouldn't be practical for anything with more than a dozen energy levels. These diagrams don't look like they were hand-drawn, but I could be mistaken.
Ideally, it would be written in Python, but something in LaTeX or TikZ would be workable as well.
More specifically, I think this could be improved upon quite a bit. PyEnergyDiagrams
I use my own script. I have posted it on GitHub now.
This is the final result: | {
"domain": "chemistry.stackexchange",
"id": 7298,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "software",
"url": null
} |
python, json
initially json file is not sorted by scores.
steps:
the bad json error is thrown only if there is bad record within the first minimum n unsorted lines,i.e. in the original json
otherwise, even if there is bad record but not within the first n unsorted lines i can keep all the records and parse it
sort it by scores in desc order, then keep the first n
output a list of dicts, each dict has 2 fields - score,id
For example, if run with an N of 3 and 4th entry is bad json, it still works and produce:
python myprogram highest score_recs.data 3
[
{
"score": 13214012,
"id": "085a11e1b82b441184f4a193a3c9a13c"
},
{
"score": 11446512,
"id": "84a0ccfec7d1475b8bfcae1945aea8f0"
},
{
"score": 11269569,
"id": "7ec85fe3aa3c4dd599e23111e7abf5c1"
}
]
But when run with an N that includes that line, it would error:
$ python myprogram highest score_recs.data 10
invalid json format No JSON object could be decoded
THIS IS NOT JSON | {
"domain": "codereview.stackexchange",
"id": 45106,
"lm_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, json",
"url": null
} |
interval The one-dimensional heat equation on the whole line The one-dimensional heat equation (continued) One can also consider mixed boundary conditions,forinstance Dirichlet at x =0andNeumannatx = L. timesteps = timesteps #Number of time-steps to evolve. The Finite Element Method is a popular technique for computing an approximate solution to a partial differential equation. The Heat Equation via Fourier Series The Heat Equation: In class we discussed the ow of heat on a rod of length L>0. com Lecturer at Mechanical Engineering Department Institute of Technology, Debre Markos University, Debre Markos. While the implicit methods. This shows that the heat equation respects (or re ects) the second law of thermodynamics (you can't unstir the cream from your co ee). They will make you ♥ Physics. ##2D-Heat-Equation As a final project for Computational Physics, I implemented the Crank Nicolson method for evolving partial differential equations and applied it to the two dimension heat | {
"domain": "fraggo.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9845754492759498,
"lm_q1q2_score": 0.8204709378220344,
"lm_q2_score": 0.8333245953120233,
"openwebmath_perplexity": 727.0711570699918,
"openwebmath_score": 0.7068103551864624,
"tags": null,
"url": "http://psli.fraggo.it/2d-heat-equation.html"
} |
javascript, algorithm, functional-programming, k-sum
returnResult does the verb return add to the understanding of the name and what the variable represents. Not at all and thus can be considered naming noise. result is clear.
We also use abbreviations in code, though you must use the common form, do not make up abbreviations. The common abbreviation for result is res
getContiguousElementsSum is incorrect. When you get... something you know it exists and where it is. The function does not get a result, it searches for a result and if it exists returns it. Thus replace the get with find
...Elements... In JS and most languages the content of an array is referred to as array items, not array elements. In JS this is particularly important as in many contextes elements refer to DOM objects and thus using the term elements is misleading.
...Sum No you get items that sum to. getBlahBlahSum inferes a numeric result which the function does not do. | {
"domain": "codereview.stackexchange",
"id": 33481,
"lm_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, algorithm, functional-programming, k-sum",
"url": null
} |
python, pandas, matplotlib
presidents = {name: pd.read_table(os.path.join(os.getcwd(), "data", file_name))
for name, file_name in zip(president_names, file_names)}
inauguration_dates = ['01/20/2017', '01/20/2009', '01/20/2001', '01/20/1993',
'01/20/1989', '01/20/1981', '01/20/1977', '08/09/1974',
'01/20/1969', '11/22/1963', '01/20/1961', '01/20/1953',
'04/12/1945']
After this, you can iterate over this without always having to use
for x in range(len(presidents)):
print presidents[x]
and can just do
for name, president_df in presidents.items():
print president_df | {
"domain": "codereview.stackexchange",
"id": 25193,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, pandas, matplotlib",
"url": null
} |
optics, interference, geometric-optics, diffraction, lenses
Title: Imaging a diffraction grating as it passes through a lens' focal point I am trying to understand the image created when a coherent light source is incident on a diffraction grating as it is swept through the focal point of a lens. The situation is illustrated in the figure below, | {
"domain": "physics.stackexchange",
"id": 94345,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, interference, geometric-optics, diffraction, lenses",
"url": null
} |
rviz, laserscan
Originally posted by Eddit on ROS Answers with karma: 94 on 2012-01-29
Post score: 1
I once did a dirty hack in rviz to republish the selected points, this was done in a hurry and not well. So what I did was : I hooked into the updateProperties method of the SelectionHandle rviz/src/selection/selection_handler.cpp. I felt this should be called everytime the selection changes.
You can then iterate over the bounding boxes and will get the center coordinates of the selected points in the currently set fixed_frame.
As I said, it's dirty, doesn't get you RGB but only XYZ, but maybe it's of help for you.
A cleaner way would be to create Interactive Markers to select and area and then in an external node that gets the coordinates of the markes and the scan in, cut out the points yourself and republish/save them. Of course this will be hard if you want to add/remove from the selection with modifier keys, therefor i also hope we will one day get a feature like this built into rviz. | {
"domain": "robotics.stackexchange",
"id": 8036,
"lm_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, laserscan",
"url": null
} |
catkin-make, hector-quadrotor, ros-kinetic, hector
double ray = sensor_->GetLaserShape()->GetRange(i);
^
/home/paul/hector_quadrotor_tutorial/src/hector_gazebo/hector_gazebo_plugins/src/servo_plugin.cpp: In member function ‘virtual void gazebo::ServoPlugin::Update()’:
/home/paul/hector_quadrotor_tutorial/src/hector_gazebo/hector_gazebo_plugins/src/servo_plugin.cpp:203:25: error: ‘class gazebo::physics::Joint’ has no member named ‘SetMaxForce’
servo[FIRST].joint->SetMaxForce(0, maximumTorque);
^
/home/paul/hector_quadrotor_tutorial/src/hector_gazebo/hector_gazebo_plugins/src/servo_plugin.cpp:205:28: error: ‘class gazebo::physics::Joint’ has no member named ‘SetMaxForce’
servo[SECOND].joint->SetMaxForce(0, maximumTorque);
^
/home/paul/hector_quadrotor_tutorial/src/hector_gazebo/hector_gazebo_plugins/src/servo_plugin.cpp:207:29: error: ‘class gazebo::physics::Joint’ has no member named ‘SetMaxForce’ | {
"domain": "robotics.stackexchange",
"id": 25862,
"lm_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-make, hector-quadrotor, ros-kinetic, hector",
"url": null
} |
ros, ros-melodic, pointcloud, realsense
Originally posted by tswie on ROS Answers with karma: 56 on 2019-07-05
Post score: 3
It sounds like you might be bandwidth-limited in one way or another. Busy USB bus? Is this over a busy ethernet connection? Overloaded CPU?
What if you try Intel's standalone app with no ROS stuff? Just type realsense-viewer at the command line.
Originally posted by AndyZe with karma: 2331 on 2019-07-05
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 33347,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-melodic, pointcloud, realsense",
"url": null
} |
quantum-gravity
The reason is that the fundamental point solutions of gravity are black holes, which are not points at all, but extended. So that the consistent treatment of a gravitational theory requires a specification of all the multipole moments of the "point" sources, making them effectively extended. This is one way of understanding why string theory is necessary--- you need to find an extended system which describes all the gravitational excitations of the elementary particles, and it is required that this consistently connects with the excitation spectrum of a classical black hole for large masses. | {
"domain": "physics.stackexchange",
"id": 2403,
"lm_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-gravity",
"url": null
} |
homework-and-exercises, kinematics, free-fall, calculus, distance
First, recall that the average speed of an object is given by $$\bar{v}=\frac{\Delta x}{\Delta t}$$
For an object travelling at constant speed, this average speed is equal to the instantaneous speed of the object at any point during the interval. However, if the object is changing velocity at a constant rate (constant acceleration), the average velocity can also be described by $$\bar{v}=\frac{v_0+v_f}{2}$$
Just for kicks and giggles, I will set these two equations equal to each other (because their LHSs both equal $\bar{v}$). Then, for reasons unknown yet, I will solve for $v_f$. $$\frac{\Delta x}{\Delta t}=\frac{v_0+v_f}{2}$$ and then, when solved for $v_f$ $$\frac{2\Delta x}{\Delta t}-v_0=v_f$$ | {
"domain": "physics.stackexchange",
"id": 24898,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, kinematics, free-fall, calculus, distance",
"url": null
} |
formal-languages, context-free, pumping-lemma
3) You have to choose a word $\sigma \in L$ such that $|\sigma|\geq N$. You have to use your creativity to choose a word that allows you to easily reach a contradiction in the next steps.
4) By the pumping lemma exists a factorization of your word $\sigma=uvwxy$ and the
following always complies:
$$|vwx|\leq N$$
$$|vx|\geq 1$$
$$\sigma_i=uv^iwx^iy \in L \forall i\in\mathbb{N}_0$$
5) So the next step is to prove that the factorization does not exists. Your job if to check that all possible factorizations in the form $uvwxy$ don't complies with the 3 points of the pumping lemma. This generate a contradiction in your initial assumption then $L$ can't be CFL.
6) If you find a factorization of your particular word this mean nothing! Remember that the pumping lemma says:
If $L$ is CFL $\Rightarrow$ exist a factorization$\dots$ | {
"domain": "cs.stackexchange",
"id": 4812,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "formal-languages, context-free, pumping-lemma",
"url": null
} |
python
Is there any downside to using such a naming convention?
Yes. The convention isn't obvious to someone new to your project, so doesn't convey any additional information, and it's grammatically incorrect, which makes people sad.
Other than that,
Type hints
Your convention to add (str) in the docstring instead of :str on the parameter is good if you're trapped in Python 2. But if you're at all able to use Python 3 (the tags don't specify), just use type hints.
Past that, your docstrings are missing descriptions for some parameters.
Concatenation or formatting?
Your approach in full_text is fine. You may also choose to avoid concatenation by setting up snippet variables that are unconditionally added to the format string, so that there only needs to be one format call; something like
adaptation = 'My adaptation of ' if self.adaptation else ''
extra_text = f'\n{self.extra_text}' if self.extra_text else '' | {
"domain": "codereview.stackexchange",
"id": 35784,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python",
"url": null
} |
If $$A$$ is rectangular, $$A^T$$ cannot be a true inverse of $$A$$. If $$A$$ is square with orthonormal (or even independent non-zero) columns, we have $$A^{-1} A=I$$, suggesting that $$A^T$$ could be $$A^{-1}$$. But how to rule out that there may be more than one $$B$$ such that $$BA=I$$?
Well, if $$XY=Z$$, every column of $$Z$$ is a linear combination of the columns of $$X$$, and every row of $$Z$$ is a linear combination of the rows of $$Y$$. But if $$X$$ has independent columns, there's precisely one unique linear combination of those columns that gives any particular vector result (including each column of $$Z$$), so $$Y$$ is uniquely determined by $$X$$ and $$Z$$. Similarly if $$Y$$ has independent rows, each row of $$X$$ is uniquely determined by $$Y$$ and $$Z$$.
The columns of $$A$$ are orthonormal so clearly independent. If (and only if) $$A$$ is square, its rows are independent. And by those uniqueness properties, if $$A^T A=I$$, we can conclude that $$A^T=A^{-1}$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.949669373100424,
"lm_q1q2_score": 0.8267795557353557,
"lm_q2_score": 0.8705972616934408,
"openwebmath_perplexity": 153.14601995436138,
"openwebmath_score": 0.9142773151397705,
"tags": null,
"url": "https://math.stackexchange.com/questions/52717/column-vectors-orthogonal-implies-row-vectors-also-orthogonal"
} |
c#, beginner, console
Title: Select Menu in Command Prompt I want to make small console app where you can choose an option from a list using the arrows on the keyboard. Here is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CMD_menu_select
{
internal class Program
{
static void Main(string[] args)
{
var cities = new List<string>()
{
"New York",
"London",
"Mumbai",
"Chicago"
};
int index = 0;
ConsoleKeyInfo keyinfo;
while (true)
{
WriteCities(cities, index);
keyinfo = Console.ReadKey(); | {
"domain": "codereview.stackexchange",
"id": 44169,
"lm_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, console",
"url": null
} |
ros, opencv, cuda, gpu
Then, use this newly modified Modified_CLIBS instead of catkin_LIBRARIES.
For more detail, please look at my sample CMakeList.txt in test project.
https://github.com/YoshiRi/ros_opencv_conflict
Ex. sometimes you need to exclude whole ros-opencv packages
I found in my another project, the method <2> do not work.
So, I tried next ugly code, and it worked. | {
"domain": "robotics.stackexchange",
"id": 29059,
"lm_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, opencv, cuda, gpu",
"url": null
} |
homework-and-exercises, differential-geometry, harmonic-oscillator, coordinate-systems, tensor-calculus
$$
\dot x=\dfrac{d x}{d t}=\dfrac{\partial x}{\partial \theta}\dfrac{d \theta}{d t} +\dfrac{\partial x}{\partial \phi}\dfrac{d \phi}{d t}+\dfrac{\partial x}{\partial r}\dfrac{d r}{d t}
$$
Then, as $x=r \cos \theta$, you can insert $\dfrac{\partial x}{\partial \phi}=0, \dfrac{\partial x}{\partial \theta}=-r \sin \theta$, $\dfrac{\partial x}{\partial r}=\cos \theta$ into the last formula to obtain the same result you had before.
2) The derivatives you are using here are not covariant derivatives, they are always partial. The derivative $\dfrac{d}{d t}$ is expressed through partial derivatives, in contrast to full derivative $\dfrac{D}{D t}$, which is expressed through covariant derivatives. As you are actually not using covariant derivatives in your derivation, you don't have to worry about the basis vectors. | {
"domain": "physics.stackexchange",
"id": 2581,
"lm_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, differential-geometry, harmonic-oscillator, coordinate-systems, tensor-calculus",
"url": null
} |
fluid-dynamics, coordinate-systems, flow
The Lagrangian formulation is useful when describing effects such as Taylor dispersion and viscoelastic fluids, in both cases because tracking the evolution of elements in the flow provides more information about the relevant physics than describing the flow itself. | {
"domain": "physics.stackexchange",
"id": 52974,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, coordinate-systems, flow",
"url": null
} |
ros-melodic, sensor-msgs
How can I import JointState when python is accessing sensor_msgs-1.12.7-py2.7.egg which does not have JointState instead of sensor_msgs folder which has one?
that's not really how Python works. I don't believe what you write there is the cause.
Comment by abdullahsorathia on 2020-03-31:
yes it is the same issue not able to import sensor_msgs.msg
Comment by void32 on 2020-03-31:
sensor_msgs from sensor_msgs-1.12.7-py2.7.egg does not match the content of C:\opt\ros\melodic\x64\lib\site-packages\sensor_msgs
Try
import sensor_msgs
print(dir(sensor_msgs)) | {
"domain": "robotics.stackexchange",
"id": 34667,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-melodic, sensor-msgs",
"url": null
} |
optics, waves, dimensional-analysis
Now, see my question 1. here. It seems to me that the author has made the same error of writing $\cos k(r \mp vt)$ and $e^{ik(r \mp vt)}$, instead of $\cos (kr \mp vt)$ and $e^{i(kr \mp vt)}$, respectively. But this repeat of the error now makes me wonder: Is this actually an error on the part of the author, or am I misunderstanding something?
I would greatly appreciate it if people would please take the time to clarify this. It's no error. $k$ has dimensions of inverse length, $r$ has dimensions of length, $v$ has dimensions of length per time, and $t$ has dimensions of time.
What you propose is dimensionally incorrect, as $kr$ is dimensionless and $vt$ has dimensions of length. On the other hand, $k(r\mp vt)$ is a valid operation, and it gives us an overall dimensionless quantity that we need for the argument of an exponential function. | {
"domain": "physics.stackexchange",
"id": 68859,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, waves, dimensional-analysis",
"url": null
} |
$\displaystyle\ e^{-i\frac{5{\pi}}{4}}=cos\left(-\frac{5{\pi}}{4}\right)+isin\left(-\frac{5{\pi}}{4}\right)$
$\displaystyle\ -\frac{5{\pi}}{4}=2{\pi}-\frac{5{\pi}}{4}=\frac{3{\pi}}{4}$
$\displaystyle\ cos\left(\frac{3{\pi}}{4}\right)=-cos\left(\frac{\pi}{4}\right)=-\frac{1}{\sqrt{2}}$
$\displaystyle\ sin\left(\frac{3{\pi}}{4}\right)=sin\left(\frac{\p i}{4}\right)=\frac{1}{\sqrt{2}}$
Then | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9693241956308278,
"lm_q1q2_score": 0.8258184626615449,
"lm_q2_score": 0.8519528000888386,
"openwebmath_perplexity": 512.6315302996521,
"openwebmath_score": 0.8884896636009216,
"tags": null,
"url": "http://mathhelpforum.com/pre-calculus/166869-demoivres-theorem-print.html"
} |
experimental-chemistry, photochemistry, radioactivity
Title: Excited helium gas from the colision of alpha particles with beta particles? As alpha particles are made out of 2 protons and 2 neutrons, they are the same as the helium atom with a +2 charge, but with a certain speed. The beta particles are made out of 1 electron at a certain speed. So, theoretically, "mixing" alpha particles with beta particles would create an excited helium atom, which then, would decay to a normal helium atom releasing the kinetic energy through gamma radiation, or simply light. Is this correct? If not, why? This is very much a non-issue. Alpha particles run at great speed, so do beta particles, and as soon as they cool down, they cease to be called alpha and beta particles. When that happens, they may react all right, but there is more to it. | {
"domain": "chemistry.stackexchange",
"id": 8898,
"lm_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-chemistry, photochemistry, radioactivity",
"url": null
} |
error-correction, stabilizer-code
A slightly modified proof also works if the logical operators are defined as $\tilde{X}=M\overline{P}$ and $\tilde{Z}=N\overline{Q}$ with $P,Q\in\{X,Y,Z\}$ and $P$ and $Q$ satisfy the appropriate commutation relations. However, in this more general case the form of the logical Hadamard may change since it may need to incorporate additional single-qubit Cliffords to map between physical Pauli operators, e.g. $S^{\otimes 7}$ to map between $X^{\otimes 7}$ and $Y^{\otimes 7}$. However, this does not affect transversality of the resulting operator. | {
"domain": "quantumcomputing.stackexchange",
"id": 4430,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "error-correction, stabilizer-code",
"url": null
} |
c++, c++11
Like this:
float read_real(){
float ans;
std::cin >> ans;
if(!std::cin){
std::cin.clear();
std::cin.ignore(256,'\n');
throw std::invalid_argument("Please enter a real number");
}
return ans;
}; | {
"domain": "codereview.stackexchange",
"id": 13676,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11",
"url": null
} |
python, beginner, python-3.x, hangman
The first time re.sub() is called, the regular expression replaces all numbers in the range 1 to attempts. The value of attempts is inserted into the string [1-{}] by using .format() to replace {} with the value of attempts. In regular expressions, brackets surrounding a concatenation of characters form what is called a "character class": this just means it's looking for a single character inside the brackets and then replacing it. Character classes support ranges of characters (relying on the way characters are encoded) by using characters separated by a hyphen for both ends of the range. The second time re.sub() is called is similar, but it instead targets all the numbers which are greater than the number of attempts and replaces them with spaces.
This conveniently also eliminates the need for the legs() and rest() functions.
Main loop | {
"domain": "codereview.stackexchange",
"id": 32608,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, python-3.x, hangman",
"url": null
} |
safety, home-experiment, amines
as long as I don't feel irritation of my lungs or eyes, am I safe?
If this is a one time occurrence, given the small quantities, I'd say the odds are way in your favor, but they call it "odds" for a reason. My advice would be not to do it again without a respirator and hood where the exhaust is treated.
And if I do, is there enough time to clean up (i.e. the most essential
things, like shutting off electricity and closing open jars of
chemicals) and leave?
If you ask an industrial hygiene professional, I'm sure the answer would be "no". If it were me and I just began to notice some very mild sensation, I think I'd hold my breath and try to shut things down. I know it doesn't make sense, but that's what I'd do. If I noticed anything beyond the onset of very minor discomfort, I'd clear out fast and call the fire department.
Finally I accidentally touched a drop of cyclohexylamine (from the
pipette) when I was cleaning up, with no gloves on. | {
"domain": "chemistry.stackexchange",
"id": 1538,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "safety, home-experiment, amines",
"url": null
} |
quantum-interpretations, probability, born-rule, quantum-mechanics
The trace of a Hermitian matrix is preserved under unitary transformations, and it is this that leads to the conservation of probability in this formalism. I suppose you could try to change this rule to something else, like "the probabilities are the (normalised) cube roots of the diagonal entries of the density matrix", but the problem with this is that these new "probabilities" will no longer combine like probabilities when you combine density matrices.
So it seems that if you want to keep the ability to formulate quantum theory in terms of density matrices, it probably isn't possible to change the Born rule without messing with either (a) the rules of classical probability theory, or (b) unitary evolution. Changing either of these would be extremely radical, and would probably result in needing to change almost everything else as well. | {
"domain": "physics.stackexchange",
"id": 5974,
"lm_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-interpretations, probability, born-rule, quantum-mechanics",
"url": null
} |
c#, wpf
//If the object exists, it's assigned to the existing one, if not, nothing more happens
//...
I create AppModelControl at the App.xaml.cs, and unsubscribe the events at the App OnExit event:
namespace AdConta
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public App()
{
InitializeComponent();
FrameworkElement.StyleProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata
{
DefaultValue = FindResource(typeof(Window))
});
this._AppModelControl = new ModelControl.AppModelControl();
}
private ModelControl.AppModelControl _AppModelControl; | {
"domain": "codereview.stackexchange",
"id": 21297,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, wpf",
"url": null
} |
orbital-motion, earth, celestial-mechanics
is the formula given by Pulsar valid for any point of the ellipse (for example $\lambda = 2.4981 = 143.13°$ from perihelion? (143.13- 0.0167*.6?) As David Hammen points out, there is nothing special about the points B and C. But if you insist, those are the points where the eccentric anomaly $E$ is $\pi/2$ and $3\pi/2$, respectively. For an idealized orbit, Kepler's equation gives
$$
\frac{2\pi}{T}(t-\tau) = E - e\sin E,
$$
where $\tau$ is the moment of periapsis (January 4) and $T=365.2596$ days is the anomalistic year. So
$$
(t-\tau)_\text{B} = \left(\frac{1}{4}-\frac{e}{2\pi}\right)T = 90.344\text{ days after periapsis}
$$
and
$$
(t-\tau)_\text{C} = \left(\frac{3}{4}+\frac{e}{2\pi}\right)T = 274.916\text{ days after periapsis}
$$
Of course, this is an idealized version. In reality Earth's orbit is subject to various perturbations. | {
"domain": "physics.stackexchange",
"id": 26029,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "orbital-motion, earth, celestial-mechanics",
"url": null
} |
By the way, note that $\langle x+y,x-y\rangle=\langle x,x\rangle-\langle y,y\rangle$ does not hold in general for complex (so conjugate-symmetric) inner products, but it holds for $x=h$ and $y=v$ since $h\perp v$.
-
Let $\mathcal{B} := \{ v_1, v_2, \dots, v_n \}$ be an $1$-orthonormal basis for $V$, i.e., $\mathcal{B}$ is orthonormal with respect to $\langle \cdot, \cdot \rangle_1$. Obviously, it is $2$-orthogonal (but not necessarily $2$-normalized).
Now, let us observe two vectors
$$x := \sum_{i=1}^n \alpha_i v_i, \quad y := \sum_{i=1}^n \beta_i v_i.$$
We compute $\langle x, y \rangle_1$ and $\langle x, y \rangle_2$: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9740426458162398,
"lm_q1q2_score": 0.8445298071682853,
"lm_q2_score": 0.8670357615200475,
"openwebmath_perplexity": 170.77315688850598,
"openwebmath_score": 0.9873944520950317,
"tags": null,
"url": "http://math.stackexchange.com/questions/567705/two-inner-products-being-equal-up-to-a-scalar"
} |
electromagnetism, unit-conversion
If I had to guess about converting your plot back into energy, in a hurry, for an exam or something, I’d do it as follows: | {
"domain": "physics.stackexchange",
"id": 85336,
"lm_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, unit-conversion",
"url": null
} |
python, java, parsing
attributes_count = read_short(f)
attributes = tuple(generate_attrs(f, attributes_count))
trailing = len(f.read())
if trailing != 0:
raise ValueError(f'{trailing} trailing bytes after deserialise')
return cls._traverse(
version=version, constants=constant_pool, access_flags=access_flags,
this_idx=this_class, interfaces=interfaces,
super_idx=super_class, attributes=attributes,
fields=fields, methods=methods,
) | {
"domain": "codereview.stackexchange",
"id": 45465,
"lm_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, java, parsing",
"url": null
} |
Assume, towards a contradiction, that $f$ is discontinuous from the right at some $p$ (where $p$ is not a right-endpoint of $D$). Then there is some $\varepsilon>0$ and a monotone decreasing sequence of points $p_n\in D$, converging to $p$, and such that $|f(p)-f(p_n)|\ge\varepsilon$ for all $n\ge0$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9736446479186301,
"lm_q1q2_score": 0.8370070131942899,
"lm_q2_score": 0.859663754105328,
"openwebmath_perplexity": 74.92231896505731,
"openwebmath_score": 0.9696525931358337,
"tags": null,
"url": "https://math.stackexchange.com/questions/2577156/function-with-path-connected-graph"
} |
-
...good basic video related to this here by patrickJMT. – hhh Feb 4 '12 at 14:11
I suspect the following: $$\sum_{k=1}^n {1\over n+k}=\sum_{k=1}^n{1\over n} {1\over 1+{k\over n}}$$ Now interpret the right hand sum as a Riemann sum for the function $f(x)={1\over 1+x}$ over $[a,b]=[0,1]$ (for a fixed $n$, the partition of $[0,1]$ is $\{{1\over n}, {2\over n},\ldots, {n\over n} \}$ and the ${1\over n}$ is the common width of the subintervals).
Taking the limit as $n\rightarrow \infty$ gives the corresponding integral: $$\lim_{n\rightarrow\infty}\sum_{k=1}^n{1\over n} {1\over 1+{k\over n}} = \int_0^1 {1\over 1+x}\,dx.$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9740426397881662,
"lm_q1q2_score": 0.8743934933826261,
"lm_q2_score": 0.8976952934758465,
"openwebmath_perplexity": 295.21231591610865,
"openwebmath_score": 0.9760891795158386,
"tags": null,
"url": "http://math.stackexchange.com/questions/105631/help-needed-with-definite-integral-for-lim-n-rightarrow-infty-sum-k-1n"
} |
gravity, dark-energy, cosmological-horizon, doppler-effect, hubble-constant
Again, it's important to note that the space was expanding in all possible directions continuously when the first light was emitted everywhere. In other words, the "dense" region from which the spacetime had begun, had now become comparatively much less dense overall. All through these years, this expansion hasn't stopped and every region where the light was first emitted, has now receded to great distances (46 billion light years in any direction). All the regions have cooled down further still to evolve into stars and planets, galaxies, clusters and any other celestial objects imaginable. | {
"domain": "astronomy.stackexchange",
"id": 2238,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gravity, dark-energy, cosmological-horizon, doppler-effect, hubble-constant",
"url": null
} |
1. The function space $C_p(X)$ is Lindelof for every Corson compact space $X$.
____________________________________________________________________
Blog posts on Corson compact spaces
____________________________________________________________________
Reference | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.982013792143467,
"lm_q1q2_score": 0.8028694095441469,
"lm_q2_score": 0.8175744739711883,
"openwebmath_perplexity": 132.8723141429801,
"openwebmath_score": 0.9472842812538147,
"tags": null,
"url": "https://dantopology.wordpress.com/category/compact-space/"
} |
quantum-mechanics, wavefunction, quantum-information, quantum-entanglement
[1]: Someone please link to an actually-good explanation of the difference between pure and mixed states, why we use the density matrix to represent mixed states, and why you use the partial trace to find the mixed state of a sub-part of an entangled quantum system. | {
"domain": "physics.stackexchange",
"id": 70282,
"lm_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, wavefunction, quantum-information, quantum-entanglement",
"url": null
} |
These eigenvalues (which are correct to the digits shown) agree almost to the machine precision.
## Notes
Theorem 2 is obtained for symmetric matrices by Malcolm and Palmer (1974), who suggest saving work in computing the LU factorization by setting $u_j = u_k$ for $j > k$ once $u_k$ is close enough to the limit.
A sample reference for Theorem 3 is Ikebe (1979), which is one of many papers on inverses of banded matrices.
The eigenvectors of a symmetric tridiagonal matrix satisfy some intricate relations; see Parlett (1998, sec. 7.9).
## References
This is a minimal set of references, which contain further useful references within. | {
"domain": "nhigham.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.99058741207965,
"lm_q1q2_score": 0.8121760112647906,
"lm_q2_score": 0.8198933293122507,
"openwebmath_perplexity": 245.0137884704531,
"openwebmath_score": 0.9666736125946045,
"tags": null,
"url": "https://nhigham.com/2022/01/10/what-is-a-tridiagonal-matrix/?shared=email&msg=fail"
} |
• I was also assuming that we didn't want to leave any bedroom empty. Sorry for not being explicit. So I want the second part of your expression: 4C2∗6C2∗4C2∗2 which does equal 1080. – Naphtali Jul 17 '14 at 19:23
• So, we are in agreement my friend. – Juanito Jul 17 '14 at 19:25
• Brilliant, thank you! – Naphtali Jul 17 '14 at 19:27
• Do approve the answer if it satisfies thy query. – Juanito Jul 17 '14 at 19:28
Here is an approach via exponential generating functions. More generally, let's say the number of ways to place $r$ children in the four rooms is $a_r$. Define $$f(x) = \sum_{r=0}^{\infty} \frac{a_r}{r!}x^r$$ In the problem where no room may remain empty, it is evident (after a little thought) that $$f(x) = \left(x + \frac{1}{2!} x^2 \right)^4$$ Expanding the product, we find the coefficient of $x^6$ is $3/2$, so $a_6 = 6! \cdot (3/2) = 1080$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464471055738,
"lm_q1q2_score": 0.8153871856534758,
"lm_q2_score": 0.8354835330070838,
"openwebmath_perplexity": 597.9281664478209,
"openwebmath_score": 0.42964375019073486,
"tags": null,
"url": "https://math.stackexchange.com/questions/870174/how-many-ways-to-arrange-6-children-in-4-bedrooms-if-at-most-2-kids-per-ro"
} |
-
As $$1+2+\cdots +n = \dfrac{n(n+1)}{2}$$ and $\dfrac{13\cdot 14}{2}=91$. We have $n=13.$ In fact, $\dfrac{14\cdot 15}{2}=105$.
-
$\dfrac{14\cdot 15}{2}=\color{red}{105}$ – VelvetThunder Jul 30 '12 at 16:40
Clearly, to fit the most numbers in to the sum, you will need to do $1+2+3+\cdots$.
You could manually work out how many numbers you can fit in, before you get to 100, or you could use the fact that:
$1+2+3+\cdots+n = \frac{n}{2}(n+1)$
So you want:
$\frac{n}{2}(n+1) < 100$.
$n(n+1) < 200$
Now, you could solve the quadratic, and find the valid regions, but I'm going to try it another (probably worse) way:
If you had $n(n+1) =200$, you can see that $\sqrt{200}$ is directly between $n$ and $n+1$.
So for $n(n+1) < 200$, the highest value of $n$ will always be either $\rm floor(\sqrt{200})$ or if that is too many, $\rm floor(\sqrt{200}) - 1$.
-
The quadratic gives $13.650...$ and $-14.6...$. So should I just consider 13 ? and why ? – Rajeshwar Jul 30 '12 at 17:13 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464471055739,
"lm_q1q2_score": 0.8314603083483474,
"lm_q2_score": 0.8519528000888387,
"openwebmath_perplexity": 381.53133032989473,
"openwebmath_score": 0.9251120686531067,
"tags": null,
"url": "http://math.stackexchange.com/questions/176880/sum-of-n-different-positive-integers-is-less-than-100-what-is-the-greatest-poss"
} |
notation
$$\underset{ij}{\Large{⬡} } e^{M_{ij}} \ne e^M$$
The answers suggest to me the best option would be something like these:
$$A(M) = \text{for each } i,j: e^{M_{ij}}$$
$$A(M) = \text{element-wise}: e^{M_{ij}}$$
The question is now closed in the negative, but I would welcome a new answer. Would be nice to find something like $\forall$.
Related: | {
"domain": "ai.stackexchange",
"id": 3056,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "notation",
"url": null
} |
organic-chemistry, reference-request, dipole
\end{align}$$
Table 3: Converted dipole moments (in Debye) from Table 1 including error ranges at 95% probability
\begin{array}{llll}
\hline
& \text{def2-SVPD} & \text{def2-TZVPD} & \text{Sadlej-pVTZ} & \text{PM6}\\
\hline
\text{4-Nitroacetanilide} & 8.96 \pm 0.31 & 8.92 \pm 0.30 & 8.96 \pm 0.30 & 7.61 \pm 1.20 \\
\textit N\text ,\textit N\text{-Dimethyl…} & 7.21 \pm 0.29 & 7.22 \pm 0.28 & 7.21 \pm 0.27 & 8.28 \pm 1.24 \\
\textit P\text ,\textit P\text{-Dimethyl…} & 8.38 \pm 0.30 & 8.36 \pm 0.29 & 8.40 \pm 0.29 & 10.44 \pm 1.40 \\
\text{all-}\textit{cis }\ce{C6H6F6} & 6.02 \pm 0.27 & 5.91 \pm 0.26 & 5.96 \pm 0.26 & 4.88 \pm 1.06 \\
\hline
\end{array} | {
"domain": "chemistry.stackexchange",
"id": 8832,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, reference-request, dipole",
"url": null
} |
ros, ros-melodic, build-from-source
roslint_cpp()
###########
## Build ##
###########
include_directories(
include
${catkin_INCLUDE_DIRS}
# Set because Boost is an internal dependency, not transitive.
#${Boost_INCLUDE_DIRS}
)
## Declare a cpp library
add_library(obstacle_detector_core
src/ObstacleAlgorithm.cpp
)
target_compile_features(obstacle_detector_core INTERFACE cxx_std_11)
## Declare cpp executables
add_executable(obstacle_detector
src/obstacle_detector_node.cpp
src/ObstacleDetector.cpp
)
target_compile_features(obstacle_detector INTERFACE cxx_std_11)
add_executable(obstacle_detector_single_scan
src/obstacle_detector_single_scan_node.cpp
src/ObstacleDetectorSingleScan.cpp
)
target_compile_features(obstacle_detector_single_scan INTERFACE cxx_std_11)
add_executable(collision_avoidance
src/collision_avoidance_node.cpp
src/CollisionAvoidance.cpp
)
target_compile_features(collision_avoidance INTERFACE cxx_std_11) | {
"domain": "robotics.stackexchange",
"id": 36281,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-melodic, build-from-source",
"url": null
} |
all eigenvalues of a real symmetric tridiagonal matrix, using a root-free variant of the QL or QR algorithm: sstebz, dstebz: Computes selected eigenvalues of a real symmetric tridiagonal matrix by bisection: sstein, dstein cstein, zstein: Computes selected eigenvectors of a real symmetric tridiagonal matrix by inverse iteration. Ais invertible if and only if 0 is not an eigenvalue of A. $\begingroup$ The covariance matrix is symmetric, and symmetric matrices always have real eigenvalues and orthogonal eigenvectors. We can define an orthonormal basis as a basis consisting only of unit vectors (vectors with magnitude $1$) so that any two distinct vectors in the basis are perpendicular to one another (to put it another way, the inner product between any two vectors is $0$). In other words, M= MT)M= PDPT where P is an orthogonal matrix and Dis a diagonal matrix whose entries are the eigenvalues of M. Then there exists an eigen decomposition. Every symmetric matrix is congruent to a | {
"domain": "ionoale.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9896718477853187,
"lm_q1q2_score": 0.8181733803731045,
"lm_q2_score": 0.8267117855317474,
"openwebmath_perplexity": 383.32462228033,
"openwebmath_score": 0.8360525369644165,
"tags": null,
"url": "http://xtij.ionoale.it/basis-of-symmetric-matrix.html"
} |
special-relativity, spacetime, inertial-frames, observers, thought-experiment
Same for the left side:
$t_{A'} = \frac{\sqrt{(\frac{A'}{2})^2 + (X' - t_{A'}*v)^2}}{c}$
$\alpha' = 2\arctan (\frac{\frac{A’}{2}}{X’ - t_{A'}*v})$
As an example let's examine a case where X = 1, A = 1, v = 0.5, and c = 1
As assumed before, A = A' = B = B'.
$X' = X * \sqrt{1−\frac{0.5^2}{1^2}} \approx 0.866$
The system of equations can then be simplified and solved:
$
\begin{equation}
\left\{
\begin{array}{lcr}
t_{B'} &=& \frac{\sqrt{(\frac{1}{2})^2 + (0.866 + t_{B'}*0.5)^2}} \\ \\
\beta' &=& 2\arctan (\frac{\frac{1}{2}}{0.866 + t_{B'}*0.5}) \\ \\
t_{A'} &=& \frac{\sqrt{(\frac{1}{2})^2 + (0.866 - t_{A'}*0.5)^2}} \\ \\
\alpha' &=& 2\arctan (\frac{\frac{1}{2}}{0.866 - t_{A'}*0.5})
\end{array}
\right.
\end{equation}
$
WolframAlpha gives me the following solution:
$t_{B'} \approx 1.87$, $\beta' \approx 0.54$, $t_{A'} \approx 0.71$, and $\alpha' \approx 1.56$ | {
"domain": "physics.stackexchange",
"id": 99289,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, spacetime, inertial-frames, observers, thought-experiment",
"url": null
} |
navigation, ros-kinetic, robot-localization
<launch>
<node pkg="robot_localization" type="navsat_transform_node" name="navsat_transform_node" respawn="true">
<param name="magnetic_declination_radians" value="0"/>
<param name="yaw_offset" value="0"/>
<remap from="/imu/data" to="/imu_data" />
<remap from="/gps/fix" to="/gps/fix" />
<remap from="/odometry/filtered" to="/odom" />
</node>
</launch> | {
"domain": "robotics.stackexchange",
"id": 30494,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, ros-kinetic, robot-localization",
"url": null
} |
(2). If $$\lim_{n\to \infty}N(f_n-f)=0$$:
Since $$N(f_n-f)\geq \|f_n-f\|_{\infty},$$ therefore $$\lim_{n\to \infty}\|f_n-f\|_{\infty}=0.$$
• Equivalence of norms is stronger than this. One needs to find $m, M > 0$ such that $m N(f) \le \|f\|_\infty \le MN(f)$ for all $f$. – Theo Bendit Jan 5 '19 at 11:21
• @TheoBendit. If two norms on a normed linear space are topologically equivalent then they are uniformly equivalent, i.e. $m$ and $M$ exist. Which is an easy exercise: If not, suppose $\|v_n\|_{(1)}>n\|v_n\|_{(2)}$ for each $n\in \Bbb N.$ Let $w_n=\frac {v_n}{\|v_n\|_{(1)}}.$ Then the sequence $(w_n)_{n\in \Bbb N}$ converges to $0$ with respect to $\|\cdot\|_{(2)}$ but $\|w_n\|_{(1)}=1$. – DanielWainfleet Jan 5 '19 at 12:19
As you have already shown, for $$f \in C^{1}[0,1]$$ such that $$f(0) = 0$$, $$\sup_{x \in [0,1]} |f(x)| \le \sup_{x \in [0,1]} |f'(x)|. \tag{1}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9814534398277178,
"lm_q1q2_score": 0.8473786689770464,
"lm_q2_score": 0.8633916134888614,
"openwebmath_perplexity": 299.8297006973644,
"openwebmath_score": 1.000002145767212,
"tags": null,
"url": "https://math.stackexchange.com/questions/3062564/show-that-the-two-norms-in-e-left-f-in-mathcalc10-1f0-0-right-are"
} |
homework-and-exercises, general-relativity, acceleration
But I don't know how to continue from here. I'm pretty sure that it is a very elementary question but I've been stuck with it for a couple of hours.
Is this the right approach? How can I conclude?
I'm posting this question here because the notation that I'm using arises from a course in General Relativity but I don't know if I should post it in Math SE instead. Thanks. I will post the answer that I got using Javier's hint just for the sake of completeness.
$$u_{\mu} u^{\mu} = -1$$
Taking derivatives in this equation:
$$\frac{D u_{\mu}}{D \tau} u^\mu + u_\mu \frac{D u^\mu}{D \tau} = 0 \implies 2 u_\mu a^\mu = 0 \implies u_\mu a^\mu = 0$$ | {
"domain": "physics.stackexchange",
"id": 27133,
"lm_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, general-relativity, acceleration",
"url": null
} |
python, tkinter, audio, matplotlib
def play_sound(self):
self.stream = self.audio.open(format=pyaudio.paFloat32,
channels=1,
rate=self.fs,
output=True,
stream_callback=self.callback)
self.stream.start_stream()
# pause audio when self.running is False; close audio when stopped
while self.stream.is_active():
if self.stopped:
break
while not self.running:
if self.stopped:
break
if self.stream.is_active:
self.stream.stop_stream()
else:
pass
if self.running and not self.stream.is_active():
self.stream.start_stream()
self.stream.stop_stream()
self.stream.close() | {
"domain": "codereview.stackexchange",
"id": 36461,
"lm_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, tkinter, audio, matplotlib",
"url": null
} |
thermodynamics, thermal-radiation, renewable-energy, solar-cells
Why are solar panels tilted southward?
How is latitude of the location of a solar panel relevant in increasing efficiency? First, not every solar panel in India is oriented towards the south or tilted at 45°. One of the world's largest photovoltaic power stations is installed in Kamuthi (9.3°N, Southern India), with pv modules tilted at 8°.
Azimuth
Panels are usually oriented towards the south in the northern hemisphere because the sun mostly is in the southern part of the sky. The sun sometimes is in the northern part of the sky, e.g. during sunrise and sunset in spring and in summer. It only happens when the sun is relatively low so it doesn't have a huge influence on the total yield.
Here's a sun-path diagram for New Delhi (28.6°N, Northern India):
When solar panels are installed on buildings, they sometimes have to be integrated directly in the roof, so the orientation will be dictated by the architecture. | {
"domain": "physics.stackexchange",
"id": 58122,
"lm_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, thermal-radiation, renewable-energy, solar-cells",
"url": null
} |
math, generative-adversarial-networks, papers, notation
If we break that down:
$$\lim\limits_{\sigma \rightarrow 0}$$
The limit, as standard deviation $\sigma$ tends towards zero of
$$\nabla_\mathbf{x}$$
the gradient with respect to vector $\mathbf{x}$ of
$$\mathbb{E}$$
the expectation ...
$$\mathbb{E}_{\epsilon \sim \mathcal{N}(0, \sigma^2\mathbf{I})}$$
[the expectation] - where perturbation $\epsilon$ follows the normal distribution with mean 0 and variance $\sigma^2$ times identity vector $[1,1,1,1...]$ * - of
$$f(\mathbf{x} +\epsilon)$$
any function $f$ of $x$ plus $\epsilon$
$$ = \nabla_x f(\mathbf{x})$$
is equal to the gradient with respect to $\mathbf{x}$ of the same function $f(\mathbf{x})$. | {
"domain": "ai.stackexchange",
"id": 1824,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "math, generative-adversarial-networks, papers, notation",
"url": null
} |
c++, algorithm, template, c++17, union-find
for (const string x : arr) {
dis.makeSet(x); // make the set
}
dis.union("amal", "kamal"); // create connections
dis.union("kamal", "nimal");
cout << boolalpha << dis.isConnected("amal", "nimal") << endl; // check the connectivity.
cout << dis.isConnected("bimal", "amal") << endl;
return 0;
} | {
"domain": "codereview.stackexchange",
"id": 38391,
"lm_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, template, c++17, union-find",
"url": null
} |
quantum-mechanics, homework-and-exercises, quantum-spin, spinors, spherical-harmonics
In the more mainstream tensor product notation $|l,~ m\rangle |s,~ s_z\rangle$ your wave function amounts to
$$
Ae^{-br}(|1, 0\rangle |1/2, 1/2\rangle +|1, -1\rangle |1/2, -1/2 \rangle)/\sqrt{2} ~,
$$
which you dotted by $\langle r|\langle \theta,\phi|$.
Observe this is not an eigenstate of $L_z+S_z$, so you are not quite adding S to L, but you may certainly write it down as a formal object wave function. | {
"domain": "physics.stackexchange",
"id": 73539,
"lm_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, homework-and-exercises, quantum-spin, spinors, spherical-harmonics",
"url": null
} |
quantum-mechanics, computational-physics, bloch-sphere
$$\hat{R}_{\vec{z}/z}({\varphi}) = \exp[-\frac{i \varphi}{2}\sigma_{z}]$$
The thing is, I was trying to model this using the Master Equation Solver from QuTiP, representing the result using a Bloch sphere. I was trying to describe the rotation with the Hamiltonian. I found that I can compare $\hat{R}_{\vec{z}/z}$ to $\hat{U}$, then define
$$\hat{H}\equiv \frac{\hbar \omega}{2}\sigma_z$$
where $\varphi\equiv\omega t$, meaning that $\omega$ is the rotation angle per unit time.
However, plugging this Hamiltonian into the code does not yield me the result that I want. The state vector does not move at all from the $|0\rangle$ state.
I thought that the rotation angle must be too narrow, so I erased $\hbar$ from the Hamiltonian. This time the result is as I expected. | {
"domain": "physics.stackexchange",
"id": 94205,
"lm_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, computational-physics, bloch-sphere",
"url": null
} |
c++, design-patterns, memory-management, pointers, reference
Regarding how you are using views
There are multiple schools of thought on what "views" are and how they should be implemented. One is that the thing being viewed should know all about the view. Another is that the thing being viewed should know nothing at about the view. Both can be correct. I'll give two concrete examples to illustrate. | {
"domain": "codereview.stackexchange",
"id": 19283,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, design-patterns, memory-management, pointers, reference",
"url": null
} |
quantum-gate, ibm-q-experience
The output of the print command will be (with the tracks for q[x>=4] trimmed since nothing was happening on those qubits): | {
"domain": "quantumcomputing.stackexchange",
"id": 970,
"lm_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-gate, ibm-q-experience",
"url": null
} |
javascript, jquery
This goes a step further and also deletes any tab or any other whitespace after and before a newline.
An input like:
a {
color: red;
size: auto;
width: 120px;
white-space: break;
}
Will result in:
color: red;size: auto;width: 120px;white-space: break;
While yours results in:
<TAB>color: red;size: auto;<TAB>width: 120px; white-space: break;
(Due to limitations on the representation of whitespace, I've seen myself forced to replace all tabs with a <TAB> 'indicator')
Lets analise the .less block:
// LESS code blocks
if ($('.field-style .less')
.length) {
$('.field-style .less')
.html($('.field-style .less')
.html()
.replace(
/(none)|(decimal)|(inside)|(hidden)/g,
'<span class="value">$&</span>'));
$('.field-style .less')
.html($('.field-style .less')
.html()
.replace(
/(em)|(px)/g,
'<span class="unit">$&</span>'));
}; | {
"domain": "codereview.stackexchange",
"id": 15611,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery",
"url": null
} |
haskell
Title: Solve a letter digit substitution game in Haskell I am working on a Haskell problem from exercism, which is a learn-to-code website.
The problem statement is as follows.
Write a function to solve alphametics puzzles.
Alphametics is a puzzle
where letters in words are replaced with numbers.
For example SEND + MORE = MONEY:
S E N D
M O R E +
-----------
M O N E Y
Replacing these with valid numbers gives:
9 5 6 7
1 0 8 5 +
-----------
1 0 6 5 2 | {
"domain": "codereview.stackexchange",
"id": 44764,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "haskell",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.