text stringlengths 1 1.11k | source dict |
|---|---|
digital-communications, channelcoding
Title: Transmission capacity in "duobinary coding" In "duo-binary signalling" how exactly is the transmission capacity increased?
Because , when we encode the binary bits, the bit duration remains the same, but the amplitude will change. Then how can the transmission capacity be better? If you want to transmit a symbol sequence $A_k$ using baseband pulse amplitude modulation (PAM), the transmitted signal is
$$s(t)=\sum_kA_kp(t-kT)$$
where $p(t)$ is the transmit pulse, and $T$ is the symbol interval. If you want to avoid intersymbol interference (ISI), the pulse function $p(t)$ must satisfy the Nyquist criterion, which says that its value must be zero at multiples of the symbol interval:
$$p(0)=1,\quad p(kT)=0,\quad k\neq 0\tag{1}$$ | {
"domain": "dsp.stackexchange",
"id": 2660,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "digital-communications, channelcoding",
"url": null
} |
ros-kinetic, ubuntu, rospy, rosrun, ubuntu-xenial
Title: Error: bad interpreter: No such file or directory
I am trying to run the following node using rosrun, to send data through my serial port and I get the error:
/opt/ros/kinetic/bin/rosrun: /home/spyros/catkin_ws/src/usb_rs232/scripts/serial_connection.py: /opt/bin/python: bad interpreter: No such file or directory
/opt/ros/kinetic/bin/rosrun: line 109: /home/spyros/catkin_ws/src/usb_rs232/scripts/serial_connection.py: Success | {
"domain": "robotics.stackexchange",
"id": 31950,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-kinetic, ubuntu, rospy, rosrun, ubuntu-xenial",
"url": null
} |
analytical-chemistry, transition-metals
This is not true. Boron compounds, when burned in alcohol, burn with a similar green color. Now here is the fundamental point to understand. When we see colors in the flames, usually it is due to very simple molecules of those metallic compounds in the flame. It is a molecular emission. If you can buy a pocket spectroscope, you will just a broad bands of color. So a flame spectrum, specially a low temperature flame, is not equal to an atomic emission spectrum. If I introduce copper into a very hot flame (>2000 Kelvin), you will not see anything, because copper atoms emit light mainly in the UV range.
Therefore all the common flame tests with calcium, barium, strontium show the flame emission spectrum of simple diatomic molecules of Ca/Ba/Sr in the flame. Copper is no exception. You may also wonder why a hydrocarbon flame is blue, there is no transition element there?
Vanadium is yellowish green
Cerium makes the flame yellow
Lead is blue white | {
"domain": "chemistry.stackexchange",
"id": 12920,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "analytical-chemistry, transition-metals",
"url": null
} |
human-biology, neuroscience
Moreover, it's suggested that perhaps higher cognitive reserve increases neuronal efficiency which has been shown to reduce plaque deposition.(1).
So InquilineKea's question and jp89's answer aren't really contradictory. | {
"domain": "biology.stackexchange",
"id": 259,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-biology, neuroscience",
"url": null
} |
ros2, imu, ros-humble
but how can I visualize the orientation the IMU thinks versus the orientation from the wheel encoders /odom topic?
ps. the IMU QoS is set to sensor_data (best effort) Seems that imu_tools has a RViz plugin that can be used to visualize the IMU topic:
https://github.com/CCNYRoboticsLab/imu_tools | {
"domain": "robotics.stackexchange",
"id": 38792,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros2, imu, ros-humble",
"url": null
} |
ros, octomap, ros-kinetic, octree, roscpp
The program is compiled normally without any warning. But when I run it I get the following result.
[ INFO] [1558769545.208112901]: Octomap resolution: [0.020000]
Segmentation fault (core dumped)
As I checked with the condition: if(octree){ }, the octree seem to be NULL.
What am I doing wrong here?
How can I dynamic_cast the AbstractOcTree to OcTree correctly?
Thanks in advance.
Originally posted by TharushiDeSilva on ROS Answers with karma: 79 on 2019-05-25
Post score: 0
As stated in the octomap_msgs reference (http://docs.ros.org/melodic/api/octomap_msgs/html/namespaceoctomap__msgs.html#aebd9cf5ae6b6741b05e9f8dee383f410) , you have to free the memory after its use.
delete octree; | {
"domain": "robotics.stackexchange",
"id": 33060,
"lm_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, octomap, ros-kinetic, octree, roscpp",
"url": null
} |
c#, file-system, comparative-review
An optimization that you can do to speed up the code is change the if clauses.
In both cases, you execute NormalizePath(Path.GetDirectoryName(e.FullPath)).
This can be done once, then use the result in the string comparison of the if clause.
Perform the check of e.ChangeType first.
If the type doesn't match, you don't need do any path manipulation. Simply moving that check to the left side of the && instead of the right means the boolean expression can short circuit after a cheap operation before doing the expensive one. Also, since both cases are checking for the same type, you can pull the whole check out to an outer if block.
Do this.failFolder or this.successFolder change?
If not, you can store the normalized path as a instance variable and not perform the operation each time.
The IOException is being handled in the same way and (it appears that) CopyToDestination() is the only thing that would cause it. You reduce this down to one try catch instead of two. | {
"domain": "codereview.stackexchange",
"id": 11451,
"lm_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#, file-system, comparative-review",
"url": null
} |
β’ In these cases, I sometimes try to replace 0 with $MachineEpsilon. β J. M.'s ennui Jul 2 '15 at 21:38 ## 4 Answers One approach is to begin the integration very slightly beyond the singularity at the origin. That, plus correction of the shooting initial conditions, provides an accurate solution. rs = .001; s = NDSolveValue[{r^2 k''[r] + 2 r k'[r] + 2 r^2 (k'[r]^2)/(1 - k[r]) - 2 (k[r] + 1) (2 - k[r]) == 0, k[rs] == -1, k[1] == 0}, k, {r, rs, 1}, Method -> {"Shooting", "StartingInitialConditions" -> {k[rs] == -1, k'[rs] == .001}}]; Plot[s[t], {t, rs, 1}, AxesLabel -> {t, k}, LabelStyle -> {Black, Bold, 12}] It is not difficult to show analytically that k has the form -1 + a r^2 near the origin (a a constant), and the numerical solution has this character too, as desired. β’ Thank you so much! I greatly appreciate the input and assistance. β Nathan Melton Jul 2 '15 at 20:53 There are two problems with the ODE at r == 0: (1) To solve for k''[r] you have to divide by r^2, that is, divide | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.974434783107032,
"lm_q1q2_score": 0.8077468037777701,
"lm_q2_score": 0.8289388040954683,
"openwebmath_perplexity": 9185.716754077659,
"openwebmath_score": 0.3037427067756653,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/87395/infinite-expression-error-ndsolve"
} |
python, python-3.x, object-oriented, beautifulsoup
The class Translator contains the supported languages, translates a string, and generates examples. Feel free to adapt the interface to your use case, the point is to make the program more modular. A provider is an adapter for the library BeautifulSoup:
class BeautifulSoupProvider:
def __init__(self):
pass
# public methods
def translate(self, from_language, to_language, sentence):
def examples(self, from_lang, to_lang, sentence):
# private methods
def __get_response(self, url):
def __parse_translations(html):
def __parse_sentences(html):
The __main__ would be something like this:
def verify_command_line(args):
#...
def to_console(translations, examples, to_language):
#..
def to_file(translations, examples):
#.. | {
"domain": "codereview.stackexchange",
"id": 39358,
"lm_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, object-oriented, beautifulsoup",
"url": null
} |
quantum-information, measurements
The way I see it, the matrix $U$ is a block matrix:
$$ \left[
\begin{array}{ c c }
P & 0 \\
0 & H
\end{array} \right].
$$
Calculating these matrix elements on the B part gives me $P$, instead of $M_0$ or $M_1$.
Also, the bottom control qubit isn't affected by the measurement so the $H$ gate will turn it back into a $|0 \rangle$ every time... so how is it even possible to get a $1$? what's my mistake? You've incorrectly found that the matrix for $H$ is given by
$$
\left(\begin{array}{cc}
1&0\\0&H
\end{array}\right)
$$
where $H$ and $1$ are $2\times 2$ matrices, and we're using the following ordering of basis elements: $(|00\rangle,|01\rangle,|10\rangle,|11\rangle)$.
This isn't true. An easy way to see that is to compute the matrix element $\langle 00 |H| 00\rangle$. If you're correct, that matrix element should be 1. But,
$$
\begin{array}{rcl}
\langle 00 |H| 00\rangle &=& \langle 0|_A \langle 0|_B (1_A\otimes H_B) |0\rangle_A|0\rangle_B\\ | {
"domain": "physics.stackexchange",
"id": 31982,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-information, measurements",
"url": null
} |
javascript
<script src="script.js"></script>
</body>
</html> Welcome to the JavaScript World! You have a lot to learn and that's really cool :-).
Here are a few tips.
Naming
Try to use more explicit names. I never regretted spending time finding better names for my variables and functions.
For example:
let elements = document.getElementsByClassName("buttons");
Could be (a little bit better but I'm sure you can find better):
let buttons = document.getElementsByClassName("buttons");
Split your function into smaller ones.
This helps readability and code reuse.
For example:
if (operator.includes(value) && operatorUsed == false) {
// ...
}
Can be extracted:
function isOperator (value) {
return operator.includes(value) && operatorUsed == false
}
Then you can use it:
if (isOperator(value)) {
// ...
} | {
"domain": "codereview.stackexchange",
"id": 38820,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript",
"url": null
} |
Now since $BB$ grows faster than any recursive function, for sufficiently large $n$ (say $n \ge N$) we have $BB(n) > h(n+1)$. For any integer $x \ge h(N)$, there is $n \ge N$ such that $h(n) \le x < h(n+1)$, and then (since $f$ and $g$ are nondecreasing) $$f(x) \le f(h(n+1)) \le f(BB(n)) = n < \sqrt{g(h(n)} \le \sqrt{g(x)}$$ and thus $$\dfrac{f(x)}{g(x)} \le \dfrac{1}{\sqrt{g(x)}} \to 0\ \text{as} \ x \to \infty$$
β’ This assumes, of course, that "$BB(n)$ doesn't count as a formula. βΒ Andreas Blass Nov 21 '13 at 16:51
β’ What about g(x)=f(x)/2 βΒ Bulwersator Nov 21 '13 at 22:05
β’ @Bulwersator They both have the exact same growth rate at $\infty$. A function $g(x)$ has a smaller growth rate than $f(x)$ at $\infty$ iff $$\lim_{x\to\infty}{\frac{g(x)}{f(x)}} = 0$$ or alternately: $$\lim_{x\to\infty}{\frac{f(x)}{g(x)}} = \infty$$. βΒ AJMansfield Nov 22 '13 at 1:47
β’ The inverse Ackermann function is frequently cited in these contexts. βΒ MJD Nov 12 '14 at 4:42
Yes: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9755769056853638,
"lm_q1q2_score": 0.8368187607561264,
"lm_q2_score": 0.8577681122619883,
"openwebmath_perplexity": 323.6973258922759,
"openwebmath_score": 0.8649914264678955,
"tags": null,
"url": "https://math.stackexchange.com/questions/576130/is-there-any-nonconstant-function-that-grows-at-infinity-slower-than-all-itera"
} |
matlab, radar, doppler
%% Three-Pulse Canceller
h = [1 -2 1];
TriPC_buffer_Q = filter(h,1,mf_buffer_Q,[],2);
TriPC_buffer_I = filter(h,1,mf_buffer_I,[],2);
that means:
the plot result for this:
what output seems better?
what is the right way to do this 2 filters? one horizontal and the second vertical
or I just should do both filters horizontal.
thanks. The second way is how it is done.
In the fast-time (or range-bin dimension) you are right to perform the matched filter.
However, Doppler information is gathered from sampling pulse-to-pulse. The MTI filter essentially subtracts pulses so that if they have similar phase, or the phase is not changing at all, then there is little to no Doppler being generated and thus the target is not moving.
In other words, the three-pulse canceller applies a filter across the Doppler dimension for each range bin, as the second pulse matrix suggests. | {
"domain": "dsp.stackexchange",
"id": 9197,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matlab, radar, doppler",
"url": null
} |
c++
You should get in the habbit of not:
using namespace std;
It can get you into name-clash issues later, as you progress.
You should be aware that std::endl flushes the stream buffer. This is often unnecessary, unwanted and can be slow if used in a tight loop. You should use '\n' for most situations. If you are worried about
platform specific line-ending, don't be. '\n' adapts, just like
std::endl.
Code formatting
Install clang-format or similar to help you with formatting.
All I did was to integrate your endl into the strings and hit "auto-clang-format" and I got this:
#include <iostream>
int main() {
std::cout << "Hello everybody!\n"
<< "My name is AK.\n"
<< "Goodbye.\n"
<< "\n"
// Poem
<< "Twinkle, twinkle, little bat!\n"
<< "How I wonder what you're at?\n"
<< "Up above the world you fly,\n"
<< "Like a tea-tray in the sky.\n";
return 0;
} | {
"domain": "codereview.stackexchange",
"id": 37218,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++",
"url": null
} |
electricity, electric-current, voltage
Title: Why does current remain constant in a series circuit although the rate at which they flow deceases due to the collisions they go through? I am really confused and frustrated as I can't figure this out. If someone could clear my doubt, I'd be really thankful.
According to my textbook current is the rate of flow of charge, it is directly proportional to voltage provided the resistance remains constant. So, when current which is basically electrons carrying electrical energy, when they pass through a resistor or lamp or any other electrical component, some electrical energy gets converted into thermal energy, so the electrical energy they carry is reduced, right? And as they pass through a component they undergo collisions with the atoms which causes their speed to reduce, they will travel slower and therefore pass through the resistor much slowly, so as its speed reduces the current should reduce? | {
"domain": "physics.stackexchange",
"id": 59995,
"lm_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-current, voltage",
"url": null
} |
homework-and-exercises, newtonian-mechanics, classical-mechanics, forces, spring
$$F = -2kx + 2kxl_o - \frac{kx^3l_o}{(l_o + d)^2}$$
(which doesn't even have correct units) while I should really be getting$$F = -\frac{2kd}{(l_o + d)}x - \frac{kl_o}{(l_o + d)^3}x^3$$
EDIT: The mass is constrained to move in the x direction only. Your formula:
$F=β2kx(1βl_o \frac{1}{\sqrt{x^2+(l_0+d)^2}} )$
is correct.
Now, for the Taylor expansion, taking only leading terms (for small x), you get:
$\frac{1}{\sqrt{x^2+(l_0+d)^2}}=\frac{1}{\sqrt{(l_0+d)^2}}\frac{1}{\sqrt{\frac{x^2}{(l_0+d)^2}+1}}\approx\frac{1}{(l_0+d)}(1-\frac{1}{2}\frac{x^2}{(l_0+d)^2})$
Note you have to get your expression to the form $\frac{1}{\sqrt{1+y}}$ in order to use $\frac{1}{\sqrt{1+y}}\approx1-y/2$, for $y<<1$. This was the origin of your unit error, which was easy to backtrack because of that.
From here you can easily get the expected answer. | {
"domain": "physics.stackexchange",
"id": 19218,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, classical-mechanics, forces, spring",
"url": null
} |
Suppose we want to find prime numbers till N = 30. Declare a linear boolean array of size 30. The array below looks like a 2d array but it is just a linear array from 1-30.
Ignore the first element and start with [2]. Except that element mark all its multiples as False. In this case leave β2β and mark all the multiples of β2β in the array as false. So we get
Move to element [3]. Leaving β3β mark all its multiples as False. If the element is already false, just ignore it. We now get
Since 4 is already False, move to the next element 5. Ignore 5 and mark all its multiples as False.
Continue this process for a larger array till we reach the last element. In this case the above array is our final array.
The given code implements the above algorithm
.wp-block-code {
border: 0;
}
.wp-block-code > div {
overflow: auto;
} | {
"domain": "studyalgorithms.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357232512719,
"lm_q1q2_score": 0.842101583795263,
"lm_q2_score": 0.8577680977182186,
"openwebmath_perplexity": 3963.036829112114,
"openwebmath_score": 0.2162545919418335,
"tags": null,
"url": "https://studyalgorithms.com/theory/find-the-first-n-prime-numbers-method-4-sieve-of-eratosthenes/?shared=email&msg=fail"
} |
data-analysis
So in conclusiion you will get the 1-sigma contour, if you draw you contours at $S_\mathrm{min} + 2.30$. | {
"domain": "astronomy.stackexchange",
"id": 5945,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "data-analysis",
"url": null
} |
java, beginner
Title: Calculator console app in Java Here is my source code for my very first app in Java. I am completely new to the language; any help and criticism is welcomed!
package com.company;
import java.util.*;
public class Main {
public static float multiply(float a, float b)
{
return a*b;
}
public static float divide(float a, float b)
{
return a/b;
}
public static float addition(float a, float b)
{
return a+b;
}
public static float subtraction(float a, float b)
{
return a-b;
}
public static void main(String[] args)
{
Scanner scanner;
float firstNum, secondNum, result;
String operation; | {
"domain": "codereview.stackexchange",
"id": 38673,
"lm_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, beginner",
"url": null
} |
correctness-proof, mathematical-foundations, philosophy
A mistake in a paper of Voevodsky made him doubt written proofs so much that he started developing homotopy type theory, a logical framework useful for developing homotopy theory formally, and henceforth used a computer to verify all his subsequent work (at least according to his own admission). While this is an extreme (and at present, impractical) position, it is still the case that when using a result, one ought to go over the proof and check whether it is correct. In my area there are a few papers which are known to be wrong but have never been retracted, whose status is relayed from mouth to ear among experts. | {
"domain": "cs.stackexchange",
"id": 20157,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "correctness-proof, mathematical-foundations, philosophy",
"url": null
} |
electromagnetic-radiation, terminology
The most energetic primary cosmic rays are hadronic, some mixture of protons and highly stable nuclei like $^{4}$He and $^{56}$Fe. The spectrum of cosmic ray protons extends up about $10^{20}$ eV; beyond this energy scale (the GZK cutoff), the protons interact too strongly with the cosmic microwave background to travel over the Mpc distances between the active galactic nuclei where they originate and telescopes on Earth. However, there is also a high-energy photon component to among primary cosmic rays, and those are the most energetic (or shortest wavelength) photons that have ever been observed, with energies up to about $10^{14}$ eV. These are what charts like that of the electromagnetic spectrum mean by "cosmic rays." | {
"domain": "physics.stackexchange",
"id": 82501,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetic-radiation, terminology",
"url": null
} |
newtonian-gravity, orbital-motion, geometry, approximations, celestial-mechanics
But near the perigeum (the closest approach to the source of the gravitational field), we may actually describe a limiting procedure for which the "whole" ellipse β and not just an infinitesimal piece β becomes a parabola. As the maximum speed of the satellite (the speed at the perigeum etc.) approaches the escape speed, while the place of the perigeum is kept at the same point, the elliptical orbit approaches a parabolic trajectory β the whole one. Note that in this limiting procedure, the furthest point from the center of gravity goes to infinite distance and the eccentricity diverges, too.
So the parabola is a limit of a class of ellipses. In the same way, a parabola is a limiting case of hyperbolae, too. In fact, in the space of conics, a parabola is always the "very rare, measure-zero" crossing point from an ellipse to a hyperbola. This shouldn't be shocking. Just consider an equation in the 2D plane
$$ y-x^2-c=ay^2 $$ | {
"domain": "physics.stackexchange",
"id": 11690,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-gravity, orbital-motion, geometry, approximations, celestial-mechanics",
"url": null
} |
c++, programming-challenge, functional-programming, c++23
using ValStarRngs = tuple<ValueRng, StarRng>;
using ProductType = std::optional<ValueType>;
using Products = tuple<ProductType, ProductType>; // as in multiplicands
using SumType = ValueType;
using SumProducts = tuple<SumType, Products>;
#if 0
//------------------------------------------------------------------------------
void print_val_star_vec(ValStarRngs& val_star_vec) noexcept {
auto& [values, stars] {val_star_vec};
for (auto s: stars) {
auto [l, p] {s};
tout << code_line << "* " << l << tab << p << tab << '*';
}
tout << sp; | {
"domain": "codereview.stackexchange",
"id": 45384,
"lm_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++, programming-challenge, functional-programming, c++23",
"url": null
} |
localization
by increasing light intensity, or increasing beam width. However, increasing light intensity increases power consumption and heat, while increasing beam width requires larger optic lenses, and larger distances between optic components. | {
"domain": "robotics.stackexchange",
"id": 184,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "localization",
"url": null
} |
fluid-dynamics, fluctuation-dissipation, econo-physics
Title: Is it possible to use fluid dynamics to trade in the financial market? I read somewhere that there is an investment fund in the USA which in its trading decisions uses physical laws of hydrodynamics. I asked my physicist friend, on the account of what is really in hydrodynamics there are laws that allow you to analyze market quotes. He said there are different methods analysis, but could not give a definite answer. What do you think about this? Is that marketing ploy? Or in hydrodynamics or related disciplines do have methods and algorithms which can be extrapolated to analyze market quotes (for example, stocks). As far as I understand there is the main idea in the randomness of the process, that for example as the water in the river flows and has random swirls, so market quotes can fluctuate in this style. | {
"domain": "physics.stackexchange",
"id": 74514,
"lm_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, fluctuation-dissipation, econo-physics",
"url": null
} |
electrostatics, gauss-law, conductors
Here's a counter example that makes this point obvious : consider a long charged wire with charge density $A$. To find the E-field, one would use a cylindrical gaussian surface of length $L$ and assume that the total interior charges are $AL$. Then one would assume that the E-field has the same cylindrical symmetry has the wire, which would simplify the surface integal to E multiplied by the lateral surface $2\pi r L$. Now, part of the wire is obviously outside the gaussian surface. What if we remove all the charges there ? The interior charges would remain the same, but the symmetry would be lost, making it impossible to reduce the integral to $E 2\pi r L$. In fact, part of the flux would now be through the ends of the cylindrical surface. That shows the the "E" in the integral is the resulting E caused by ALL charges. | {
"domain": "physics.stackexchange",
"id": 54477,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics, gauss-law, conductors",
"url": null
} |
qiskit, programming, circuit-construction
def random_circuit(num_qubits, depth, max_operands=3, measure=False,
conditional=False, reset=False, seed=None):
if max_operands < 1 or max_operands > 3:
raise CircuitError("max_operands must be between 1 and 3") | {
"domain": "quantumcomputing.stackexchange",
"id": 5072,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "qiskit, programming, circuit-construction",
"url": null
} |
I attempted writing $$\displaystyle \sin (90^\circ - x) < \sin (x)$$ which yields $$\displaystyle x > 45^\circ + n \cdot 180^\circ$$ but I am unable to find an upper bound for $$\displaystyle x$$.
When \displaystyle \begin{align*} -\frac{\pi}{2} + 2\pi n < x < \frac{\pi}{2} + 2\pi n \end{align*} where \displaystyle \begin{align*} n \in \mathbf{Z} \end{align*}, we have \displaystyle \begin{align*} \cos{(x)} > 0 \end{align*}, so in this region we can say
\displaystyle \begin{align*} \sin{(x)} &> \cos{(x)} \\ \frac{\sin{(x)}}{\cos{(x)}} &> 1 \\ \tan{(x)} &> 1 \end{align*}
We know that \displaystyle \begin{align*} \tan{(x)} > 1 \end{align*} when \displaystyle \begin{align*} \frac{ \pi}{ 4} + 2\pi n < x < \frac{\pi}{2} + 2\pi n \end{align*} and when \displaystyle \begin{align*} -\frac{3\pi}{4} + 2\pi n < x < -\frac{\pi}{2} + 2\pi n \end{align*} | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9740426458162397,
"lm_q1q2_score": 0.8074217541934053,
"lm_q2_score": 0.8289388125473629,
"openwebmath_perplexity": 818.0365349726878,
"openwebmath_score": 0.9981600046157837,
"tags": null,
"url": "https://mathhelpboards.com/threads/trig-inequality-strictly-algebraic.5708/"
} |
logic, lambda-calculus
Title: Is there a difference between $\lambda xy.xy$ and $\lambda x.\lambda y.xy$? I am currently learning the lambda calculus and was wondering about the following two different kinds of writing a lambda term.
$\lambda xy.xy$
$\lambda x.\lambda y.xy$
Is there any difference in meaning or the way you apply beta reduction, or are those just two ways to express the same thing?
Especially this definition of pair creation made me wonder:
pair = $\lambda xy.\lambda p.pxy$ These are just differences of notations. $Ξ»xyz.t$ is short for $Ξ»x.Ξ»y.Ξ»z.t$. No magic here.
Indeed, $\mbox{pair}=Ξ»xyp.pxy$ but you tend to emphasize that $\mbox{pair}\,t\,u$ is a function $Ξ»p.ptu$ by changing the way you write the definition. But it is really the same. | {
"domain": "cs.stackexchange",
"id": 70,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "logic, lambda-calculus",
"url": null
} |
The type of center is one we havenβt used before, SDL_Point. But an SDL_Point is simply just a struct with an x and y value.
In our case we are going to make a working analog wall clock. So we canβt rotate it around the middle ( that would be a weird clock! ) What we need to do, is find the base of the hands ( where they connect to the center of the clock )
Here is a picture of on our clock hands. The white hole in the middle is where we want the center of rotation to be. All three hands look very similar to this, all hands have a hole in the base, and all of them rotate around that point. | {
"domain": "headerphile.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.989830340446144,
"lm_q1q2_score": 0.8226906122311185,
"lm_q2_score": 0.831143054132195,
"openwebmath_perplexity": 992.7625765702774,
"openwebmath_score": 0.42407405376434326,
"tags": null,
"url": "http://headerphile.com/tag/game-programming/"
} |
ngs, reads, quality-control
Title: What is the right way of calculating a Phred score by hand? i am trying to calculate mean Phred scores for my sequencing data, but i feel not very comfortable about it. There are actually two ways of calculating. (I just use an existing sample)
giving: 3 reads with a mean phred score of 20, 10 and 3 (meaning Error rates of 1%, 10% and 50%, respectively)
Way 1 to calculate: Just take the arithmetic mean of the q scores:
(20+10+3)/3 = 11
Way 2: Take the arithmetic mean of the error rates:
(0,5+0,1+0,01)/3 ~= 0.2
And then calculate the q score by
-10*log10(0.2) = 6.99
(https://gigabaseorgigabyte.wordpress.com/2017/06/26/averaging-basecall-quality-scores-the-right-way/)
The Author of this Blog claims, that Way 2 is the correct version, but i still do not get why.
Is somebody able to answer this question?
Thanks a lot Not sure if my explanation is any good but let's try... | {
"domain": "bioinformatics.stackexchange",
"id": 1821,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ngs, reads, quality-control",
"url": null
} |
Both are equiprobable and they total to $\dfrac{1}{7}$ in probability so they are both $\dfrac{1}{14}$ in probability.
#### Plato
MHF Helper
From families with three children, a family is selected at random and found to have
a boy. What is the probability that the boy has (a) an older brother and a younger
sister; (b) an older brother; (c) a brother and a sister? Assume that in a three-child
family all gender distributions have equal probabilities.
I think it's $\dfrac{1}{14}$ because getting GBB could be either the "boy" having an older brother as we want, or
it could be that the "boy" is the older brother and thus has a younger brother.
Both are equiprobable and they total to $\dfrac{1}{7}$ in probability so they are both $\dfrac{1}{14}$ in probability.
@Romsek, it clearly says THAT boy has an older brother and younger sister. So the elementary event is BBG. We cannot count GBB because it violates the given.
Last edited:
#### romsek | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668695588647,
"lm_q1q2_score": 0.8378308953946212,
"lm_q2_score": 0.8539127455162773,
"openwebmath_perplexity": 899.0115679170053,
"openwebmath_score": 0.6953040361404419,
"tags": null,
"url": "https://mathhelpforum.com/threads/family-of-three-children-conditional-probability.282503/"
} |
physical-chemistry, quantum-chemistry, temperature
Soon enough that upside down population decays to a right side up population.
But while the distribution is "upside down" one finds that it is given by the same formula used for an ordinary distribution, but with a negative temperature. | {
"domain": "chemistry.stackexchange",
"id": 241,
"lm_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, quantum-chemistry, temperature",
"url": null
} |
machine-learning, classification, nlp, text-mining, similarity
Can you suggest me the approach or at least steer in the right direction? Pretty late but I'm surprised this wasn't answered more. "Cosine similarity" is a great technique to try, though simply letting users search with a hard string and then ranking by popularity isn't so bad (e.g. "dutch" brings up everything with "dutch" in it, though I would discard mid-word matches, so "ball" wouldn't return "football", but would return "ball room dancing").
I'd say in any approach a main issue will be deduplicating previous (non-standardized) skills input by users that weren't quite standardized. You could also try replacing the candidate skills with versions that have different synonyms substituted at search time, e.g. "soccer coaching" might be stored also as "football coaching" if most of your content is from Europeans. | {
"domain": "datascience.stackexchange",
"id": 934,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, classification, nlp, text-mining, similarity",
"url": null
} |
qiskit, quantum-gate
from qiskit.compiler import transpile
qc_transp = transpile(qc)
qc_transp.draw()
βββββ βββββ
q_0: β€ H ββββ βββ€ H β
ββββββββ΄βββββββ
q_1: ββββββ€ X ββββββ
ββββββββββ
q_2: β€ H βββββββββββ
βββββ
c: 1/βββββββββββββββ
Therefore, for the circuit you've given, the inclusion of the barriers does not serve any computational purpose. If more instructions were to be added, then the barriers could once again come into play. | {
"domain": "quantumcomputing.stackexchange",
"id": 3843,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "qiskit, quantum-gate",
"url": null
} |
c#, .net
// get high and low prices
// would never but at hight price
// and would never sell at low pric
for (int i = 0; i < rowCount; i++)
{
for (int j = 0; j < colCount; j++)
{
buySell[i, j] = 0;
if (i == 0)
{
highPrice[j] = portsProducts[i, j];
lowPrice[j] = portsProducts[i, j];
}
else
{
if (highPrice[j] < portsProducts[i, j])
highPrice[j] = portsProducts[i, j];
if (lowPrice[j] > portsProducts[i, j])
lowPrice[j] = portsProducts[i, j];
}
}
} | {
"domain": "codereview.stackexchange",
"id": 23736,
"lm_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#, .net",
"url": null
} |
machine-learning, data-mining, algorithms, neural-network
'Restoring' or 'predicting' data. You can use a bunch of different technics to complete this task, but my vote is for simplest ones (KISS, yes). E.g., in my case, for age prediction, mean of ego-network users' ages gave satisfactory results (for about 70% of users error was less than +/-3 years, in my case it was enough). It's just an idea, but you can try to use for age prediction weighted average, defining weight as similarity measure between visited sites sets of current user and others. | {
"domain": "datascience.stackexchange",
"id": 55,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, data-mining, algorithms, neural-network",
"url": null
} |
conformal-field-theory, lie-algebra, stress-energy-momentum-tensor, quantum-anomalies
An exposition I particularly like on such matters is the little book of Martin Schottenloher, "A Mathematical Introduction to Conformal Field Theory" (2nd. edition), Lecture Notes in Physics 759 (Springer--Verlag, 2008).
Edit (June 15th 2022): this comes more than six years late, but only now have I managed to get time to think about Peter Kravchuk's two (correct) points in his comments. I apologize to all. | {
"domain": "physics.stackexchange",
"id": 30897,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "conformal-field-theory, lie-algebra, stress-energy-momentum-tensor, quantum-anomalies",
"url": null
} |
ros, rosmake, vslam, rosdep-install
Title: no such option --rosdep-install
Hi all,
I am attempting to install the source code modifiable version of VSLAM. I need to run "rosmake --rosdep-install vslam_system" and it fails with this error
yglee@yglee-VirtualBox:~/ros_workspace/VSLAMDIR$ rosmake --rosdep-install vslam_system
Usage: rosmake [options] [PACKAGE]...
rosmake: error: no such option: --rosdep-install
I have rosdep downloaded via pip and easy_install (I tried both just incase). Does anyone know why rosmake doesn't find the option rosdep?
Thanks,
Grace
Originally posted by yglee on ROS Answers with karma: 60 on 2012-07-09
Post score: 0
Internal use of rosdep inside rosmake was removed in ROS Fuerte (see REP 125)
You'll now have to use
rosdep install PACKAGE
rosmake PACKAGE
Originally posted by piyushk with karma: 2871 on 2012-07-09
This answer was ACCEPTED on the original site
Post score: 3 | {
"domain": "robotics.stackexchange",
"id": 10109,
"lm_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, rosmake, vslam, rosdep-install",
"url": null
} |
I am not completely sure what to say about your intuition. You seem to think that the term $8z^4$ is most important, which certainly is correct. Moreover, it is certainly correct to try to deform $\mathbb C\setminus\{0\}$ (and it is crucial that $0$ is excluded) to $S^1$. Formally, this is most easily done by the map $z\mapsto z/|z|$. At this point, your intuitive reasoning gets a bit problematic. There are results on determining the mapping degree by counting intersections of a curve with a ray, but in order to apply them, you have to make sure that all these intersections are transversal and, more importantly, you have to count intersections including a sign. (You have to subtract the number of "backwards" intersections from the number of "forwards" intersections, and transversality is needed in order to make sure that each intersection is either "forwards" or "backwards".) | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.986979508737192,
"lm_q1q2_score": 0.8203211529374078,
"lm_q2_score": 0.8311430436757313,
"openwebmath_perplexity": 113.14567336592964,
"openwebmath_score": 0.9387650489807129,
"tags": null,
"url": "https://math.stackexchange.com/questions/2023352/how-many-times-does-8z44z32z2z-1-wind-around-0"
} |
1. \begin{align*}4x-9 \le 19\end{align*}
2. \begin{align*}-5>-2x+13\end{align*}
3. \begin{align*}\frac{2}{3} x+1 \ge 13\end{align*}
4. \begin{align*}-7<3x-1<14\end{align*}
Know What? Two mountain bike riders leave from the same parking lot and headin opposite directions, on two different trails. The first ridergoes 8 miles due west, then rides due south for 15 miles. The second rider goes 6 miles due east, then changes direction and rides \begin{align*}20^\circ\end{align*} east of due north for 17 miles. Both riders have been travelling for 23 miles, but which one is further from the parking lot?
Comparing Angles and Sides
Look at the triangle to the right. The sides of the triangle are given. Can you determine which angle is the largest?
As you might guess, the largest angle will be opposite 18 because it is the longest side. Similarly, the smallest angle will be opposite the shortest side, 7. Therefore, the angle measure in the middle will be opposite 13. | {
"domain": "ck12.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9740426450627306,
"lm_q1q2_score": 0.8008472669477644,
"lm_q2_score": 0.822189121808099,
"openwebmath_perplexity": 1949.1298320884246,
"openwebmath_score": 0.8079833388328552,
"tags": null,
"url": "http://www.ck12.org/book/CK-12-Geometry-Second-Edition/r1/section/5.5/"
} |
quantum-mechanics, symmetry, quantum-spin, group-representations, representation-theory
How is this possible when every so(3) irrep can get raised to one of SO(3) as described above?
The half-integer irreps of $\mathfrak{so}(3)$ do not have corresponding $\mathrm{SO}(3)$ irreps, but they do have corresponding $\mathrm{SU}(2)$ irreps. When you try to exponentiate the half-integer irreps, you don't get a representation of $\mathrm{SO}(3)$.
An explanation of why we miss physically relevant stuff when we consider only $\mathrm{SO}(3)$ and not its double cover is given here:
Idea of Covering Group | {
"domain": "physics.stackexchange",
"id": 15335,
"lm_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, symmetry, quantum-spin, group-representations, representation-theory",
"url": null
} |
vba, excel
Or better yet, arrays. But one step at a time. Try refactoring all the hard-coded ranges and sheets into variables. Either CodeNames and Named Ranges or a range variable describing what the range is.
Speed
Formulas
If I search the macro for the word "formula" I come up with 53 hits. That's 53 different times you've set a formula. And many of those formulas are for more than one cell in a range. Of course excel will hang when calculations are turned back on - imagine how many calculations that is. If you can use values instead of formulas, please do. If not - please tell us why.
Loops
I see seven loops
For i = 2 to lastRow
For j = 2 to lastRow
For Each ws in thisworkbook.sheets
For j = 2 to LastRowSKU
For j = 2 to LastRowSKU
For j = 2 to LastRowSKU
For j = 2 to LastRowSKU
See those last 4? Or even all 6? Why are you iterating over that four separate times? Why not do everything in the single loop?
You also have
If lastRow > 1 Then | {
"domain": "codereview.stackexchange",
"id": 24454,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba, excel",
"url": null
} |
-> Attach:2nd_order_ode.png
A numerical solution to this equation can be computed with
a variety of different solvers and programming environments. Solution files are available in MATLAB, Python, and Julia below or through a web-interface. Each of these example problems can be easily modified for solutions to other second-order differential equations as well.
March 31, 2016, at 11:35 PM by 10.5.113.123 -
Changed line 15 from:
Attach:2nd_order_ode.png
to:
-> Attach:2nd_order_ode.png
March 31, 2016, at 07:47 PM by 10.5.113.123 -
A differential equation relates some function with the derivatives of the function. Functions typically represent physical quantities and the derivatives represent a rate of change. The differential equation defines a relationship between the quantity and the derivative. Differential equations are very common in fields such as biology, engineering, economics, and physics.
Attach:2nd_order_ode_solution.png | {
"domain": "apmonitor.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9504109770159683,
"lm_q1q2_score": 0.8078219427160057,
"lm_q2_score": 0.8499711832583696,
"openwebmath_perplexity": 1245.0420723087434,
"openwebmath_score": 0.5146600604057312,
"tags": null,
"url": "https://apmonitor.com/wiki/index.php/Apps/2ndOrderDifferential?action=diff"
} |
file, go, casting, checksum
checksum, fileChecksum := computeChecksum(file, blockSize, fileLength, weakChecksumLength, strongChecksumLength, fileDigest, blockDigest)
strFileChecksum := hex.EncodeToString(fileChecksum)
// [ASK] I suspect I can improve performance here rather than appending string with +
strHeader := "zsync: " + ZSYNC_VERSION + "\n" +
"Filename: " + fileInfo.Name() + "\n" +
"MTime: " + fileInfo.ModTime().Format(time.RFC1123Z) + "\n" +
"Blocksize: " + strconv.Itoa(blockSize) + "\n" +
"Length: " + strconv.Itoa(int(fileLength)) + "\n" +
"Hash-Lengths: " + strconv.Itoa(sequenceMatches) + "," + strconv.Itoa(weakChecksumLength) + "," + strconv.Itoa(strongChecksumLength) + "\n" +
"URL: " + opts.Url + "\n" +
"SHA-1: " + strFileChecksum + "\n\n"
return checksum, strHeader, outputFileName
} | {
"domain": "codereview.stackexchange",
"id": 33033,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "file, go, casting, checksum",
"url": null
} |
python, performance, beginner, python-3.x, programming-challenge
return sum(term(mpfr(i)) for i in range(n))
Use consistent and descriptive variable names
Related to the above, you use a lot of one and two letter variable names. It's hard to figure out what each of them means. If you are implementing a formula from a Wikipedia page or a scientific paper, then add a comment with a reference to the source material. Otherwise, just give the variables names that self-document them if possible, for example d in Leibniz() could be renamed denominator.
Exceptions to this are commonly used short variable names, such as i for iterators, and x in lambdas.
Return raw results instead of formatting them
Functions are more useful if they return the raw results without post-processing them unnecessarily. This allows the caller to decide what to do with the data. It can always decide to format it to a string if necessary. In this case, it also removes code duplication. So instead of:
return '{0:.100f}'.format(mpfr(pi))
Just call:
return pi | {
"domain": "codereview.stackexchange",
"id": 41471,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, beginner, python-3.x, programming-challenge",
"url": null
} |
python, performance, python-3.x
But identifying when a entry starts and ends is trickier than you might think. I can't just use indexing and split on every third line, because the block is followed by the block for IPv4 networks which has variable line numbers for each entry, so I used a list to cache the current lines, set the cache to initially empty, on empty lines, if cache is not empty, collect the cached items and clear the cache, else add the current data to cache.
Then we get the block for IPv4 networks, the lines are like this:
net: 1.0.0.0/8
country: AU | {
"domain": "codereview.stackexchange",
"id": 44887,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, python-3.x",
"url": null
} |
implementation, variational-autoencoder, cross-entropy, evidence-lower-bound, categorical-crossentropy
where
$Z$ represents the latent embedding of the auto-encoder
$Z_\mu$ and $Z_\sigma$ represent the mean and standard deviation for sampling for $Z$ from a Gaussian distribution.
$Y$ represents the binary image trying to be reconstructed
$\hat{Y}$ represents its reconstruction from the VAE.
As we can see from the ELBO, it's the entropy of the latent distribution being learned, $Q()$, which is a Gaussian, and the cross entropy of the latent distribution being learned $Q()$ and the actual distribution $P()$ with $Z$ intersected with $X$.
The main points that confuse me are
how $\text{CrossEntropy}(\hat{Y}, Y)$ equates to the CE of the distribution for generating latents and its Gaussian approximation, and
how $(0.5*(1+Z_{\sigma}-Z_{\mu}^2-exp(Z_\sigma)))$ equates to the entropy | {
"domain": "ai.stackexchange",
"id": 2417,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "implementation, variational-autoencoder, cross-entropy, evidence-lower-bound, categorical-crossentropy",
"url": null
} |
quantum-field-theory, particle-physics, higgs
What does this mean? At large energies ($\mu \gg m_h$), $\lambda$ determines completely the Higgs potential, and if $\lambda<0$, then the potential is metastable, it can decay to a lower energy state of the Higgs field.
Both figures are taken from G. Degrassi et al.: Higgs mass and vacuum stability in the Standard Model at NNLO arXiv:1205.6497 [hep-ph] | {
"domain": "physics.stackexchange",
"id": 30724,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, particle-physics, higgs",
"url": null
} |
javascript, html, api, dom, google-maps
Title: Google Maps geocoding lookup function In an effort to keep all of the Google Maps Javascript API in it's own little world, I have created a googleMaps object that will contain all of the functions that directly make google maps webservice calls. This object will be imported once on every page. For now, it only has one function.
if (googleMaps === undefined || googleMaps === null)
{
var googleMaps = { | {
"domain": "codereview.stackexchange",
"id": 20100,
"lm_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, html, api, dom, google-maps",
"url": null
} |
visible-light, symmetry, geodesics
The whole argument is prefaced with the restriction that we have light emitted from A and received at B. In your example, you want light to start at A and go around B, which is an entirely different thing altogether and has nothing to do with Leibniz.
Note also that Leibniz really only can claim to show that the photon path must be axisymmetric about the line AB. Only if take a photon to be perfectly localized in space and time does this then mean that it travels along the straight line in question.
Back to your claim of procognizing the photon sphere: The argument "X isn't obviously wrong, therefore X possibly exists" isn't really substantive, physically or philosophically. In fact, unless you have a definition of "possibly exists" that is somehow more strict than "isn't obviously wrong," this line of reasoning hasn't shown anything at all. | {
"domain": "physics.stackexchange",
"id": 21769,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "visible-light, symmetry, geodesics",
"url": null
} |
quantum-mechanics, quantum-field-theory, wavefunction, second-quantization, klein-gordon-equation
He said that in RQM the wave function $\psi$ is for one electron and in QFT in for the field $\Psi$ of electrons, but since the wave function $\psi$ is already an scalar field, in the sense of pure mathematics, how can describe one electron and not a field? Relativistic quantum mechanics (RQM) constructs single-particle wave equations that are consistent with special relativity (SR). However SR allows to create particles out of energy, while quantum mechanics is based on the conservation of probability. Nevertheless at energies low compared to the masses involved a single-particle description is a good approximation to nature. | {
"domain": "physics.stackexchange",
"id": 94037,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-field-theory, wavefunction, second-quantization, klein-gordon-equation",
"url": null
} |
10%, or 60% of the population, but it is never the whole population. Population and sample standard deviation Standard deviation measures the spread of a data distribution. of 18.8 units. Population Standard Deviation (All elements from a data set - e.g 20 out of 20 students in class) The population standard deviation is used when the entire population can be accounted for. Standard Deviation is of two types: Population Standard Deviation; Sample Standard Deviation In general, the larger this value, that means that the data is more varied from the population mean. β’ Population standard deviation is calculated when all the data β¦ Therefore, a population standard deviation would be β¦ Statistically, it means that the population is 100. This should make sense considering the pooled standard deviation is just a weighted average between the two groups. When considering standard deviations, it may come as a surprise that there are actually two that can be considered. To calculate standard | {
"domain": "tokocase.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.975576914916509,
"lm_q1q2_score": 0.8043260247044693,
"lm_q2_score": 0.8244619285331332,
"openwebmath_perplexity": 390.95259407910424,
"openwebmath_score": 0.8247133493423462,
"tags": null,
"url": "https://tokocase.com/61s0qt8/population-standard-deviation-9f9839"
} |
It is natural to wonder if Theorem 1 can be generalized to product space of $\tau$ many separable metric factors where $\tau$ is an arbitrary uncountable cardinal. The work of [4] shows that the question at the beginning of this post cannot be answered positively in ZFC. Recall the above mentioned result that assuming $2^\omega<2^{\omega_1}$, any normal dense subspace of the product space of continuum many separable metric factors is collectionwise normal (see Corollary 4 in this previous post). A theorem in [4] implies that assuming $2^\omega=2^{\omega_1}$, for any separable metric space $M$ with at least 2 points, the product of continuum many copies of $M$ contains a normal dense subspace $Y$ that is not collectionwise normal. A side note: for this normal subspace $Y$, $Y \times Y$ is necessarily not normal (according to Corsonβs theorem). Thus [3] and [4] collectively show that Arkhangelskiiβs question stated here at the beginning of the post is answered positively (in ZFC) among | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9910145691243959,
"lm_q1q2_score": 0.807907278620123,
"lm_q2_score": 0.8152324938410783,
"openwebmath_perplexity": 70.97457507235224,
"openwebmath_score": 0.982619047164917,
"tags": null,
"url": "https://dantopology.wordpress.com/2014/04/"
} |
So we needed a more methodical approach. The nugget of the solution - for me, at least - was to think about how each line you add to a diagram affects the number of regions - and thatβs related to the number of lines it crosses. In fact, adding a line that crosses $n$ other lines adds $n+1$ regions to the circle - which you might like to prove.
So, in adding a fifth point to the fourth circle, weβll need to add four new lines.
The two lines to the adjacent points each add a single region - they donβt cross any other lines. The lines to the two opposite points each cross two lines, creating three new regions. Overall, thatβs 1 + 3 + 3 + 1 new regions, taking the eight regions to 16.
Letβs go a bit more methodically this time
Going from five to six is a bit trickier ((because counting is hard)). | {
"domain": "co.uk",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9916842229971374,
"lm_q1q2_score": 0.8525149802459883,
"lm_q2_score": 0.8596637523076225,
"openwebmath_perplexity": 629.3774894119178,
"openwebmath_score": 0.5728346705436707,
"tags": null,
"url": "https://flyingcoloursmaths.co.uk/regions-of-a-circle/"
} |
c#, wpf
public ClientPropertyFactory(FilePathChecker fileChecker, string configFilePath)
{
_fileChecker = fileChecker;
_configFilePath = configFilePath;
}
public Client Create(string folderDialog)
{
_fileChecker.Check(folderDialog, _configFilePath);
if (_fileChecker.Success)
//do the magic of creating a client
else
//report said error somehow.
}
} | {
"domain": "codereview.stackexchange",
"id": 17500,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, wpf",
"url": null
} |
So $r_n$ satisfies conditions $(1.)$. Hence $r_n=\gcd(a,b)$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464464059648,
"lm_q1q2_score": 0.8426239770411665,
"lm_q2_score": 0.8633916134888614,
"openwebmath_perplexity": 381.3708144967184,
"openwebmath_score": 0.9816923141479492,
"tags": null,
"url": "https://math.stackexchange.com/questions/2712980/prove-all-other-common-divisors-divide-gcd?noredirect=1"
} |
python, parsing, csv, pandas, email
Your repeated in-place drops will be less efficient than directly loading the CSV and specifying in usecols only the columns you want to keep.
Rather than coercing Change=New to 99999, it's simpler to include the New comparison as part of your filtration predicate.
Avoid using iloc for named columns. Just use the column names.
Your quite long copy-and-paste has effectively unrolled a loop that would just write out the top n rows of the dataframe. This repetition should go away. One easy way to look at the top few rows of a DataFrame is head().
You've hard-coded for Outlook. More portably, multiple mail clients should be able to read .eml files whose content can be produced by the Python built-in email modules; so consider doing that (even if it's a first step toward using Outlook anyway). For Outlook you might need to set an X-Unsent header.
Don't do this:
df["Release Date"].str.split(', ').str[1] | {
"domain": "codereview.stackexchange",
"id": 43147,
"lm_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, parsing, csv, pandas, email",
"url": null
} |
machining
And how do you check if a rod is round? Spin it on a lathe chuck and see if the highest point varies in height above the table (technically you can't trust the lathe to be aligned either so you adjust the lathe to find the achievable minimum deviation in height is ala symmetry of rotating around an axis). Checking that the height above the table for the circumference at one point along the length of the rod is easy, but how do you do it at other points along the length so you can make sure it's not just round by a straight cylinder and not a cone or some shape that randomly varies in diameter along the length? Well your table now has to be flat again and parallel to the rotational axis. | {
"domain": "engineering.stackexchange",
"id": 4705,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machining",
"url": null
} |
quantum-mechanics
We shall first assume that in the vicinity of $r = 0$ the interaction
potential $V(r)$ has the form $$ V(r) = r^p (b_0 + b_1 r + \ldots),
\qquad b_0 \neq 0 $$ where $p$ is an integer such that $p \geq -1$. In
other words, the potential cannot be more singular than $r^{-1}$ at
the origin, which is the case for nearly all interactions of physical
interest. Since $r = 0$ is a regular singular point of the
differential equation $(*)$, we can expand the solution $u_{El}(r)$ in
the vicinity of the origin as $$ u_{El} (r) = r^s \sum_{k =
0}^{\infty} c_k r^k, \qquad c_0 \neq 0 $$ Substituting this expansion
in (*), we find by looking at the coefficient of lowest power of r
(i.e. $r^{s-2}$) that the quantity $s$ must satisfy the indicial
equation $$ s(s-1) - l(l+1) = 0 $$ so that $s = l+1$ or $s = -l$. The
choice $s = -l$ corresponds to irregular solutions which do not
satisfy the condition $u_{El}(0) = 0$. The other choice $s = l+1$ | {
"domain": "physics.stackexchange",
"id": 29598,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics",
"url": null
} |
frequency-response, transfer-function
The magnitude of $H(j\omega)$ tells you the relative amplification/attenuation of the different frequency components, whereas the phase shows you the relative alignment of the different components.
For example, a sinusoid $x(t)=A\sin(\omega_0t+\theta)$ will appear at the output of the system as
$$y(t)=A|H(j\omega_0)|\sin(\omega_0t+\theta+\phi(\omega_0))$$
where $\phi(\omega_0)$ is the system's phase response evaluated at the input frequency $\omega_0$. | {
"domain": "dsp.stackexchange",
"id": 2780,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "frequency-response, transfer-function",
"url": null
} |
java, error-handling, io
return null;
}
} Work with top level classes
Currently, your code only works for file related operations, as seen by the signature of transferBytesFrom.
transferBytesFrom(FileInputStream input, FileOutputStream output)
However, such an operation ought to work for every InputStream and every OutputStream, not just for file streams.
As such, it would be preferable to make all of your methods as generic as possible and let them take Input/OutputStream as arguments, or let them return Input/OutputStream:
private static void transferBytesFrom(InputStream input, OutputStream output)
private static void writeByteTo(OutputStream output, int singleByte)
private static int readByteFrom(InputStream input)
private static InputStream getNewFileOutputStream()
// ... the same for the other methods | {
"domain": "codereview.stackexchange",
"id": 19473,
"lm_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, error-handling, io",
"url": null
} |
neural-network, activation-function
This concludes our discussion of the most common types of neurons and
their activation functions. As a last comment, it is very rare to mix
and match different types of neurons in the same network, even though
there is no fundamental problem with doing so.
TLDR: "What neuron type should I use?" Use the ReLU non-linearity, be careful with your learning rates and possibly
monitor the fraction of "dead" units in a network. If this concerns
you, give Leaky ReLU or Maxout a try. Never use sigmoid. Try tanh, but
expect it to work worse than ReLU/Maxout. | {
"domain": "datascience.stackexchange",
"id": 1142,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-network, activation-function",
"url": null
} |
java, android, number-systems
else if(spinnerinput.equals("Base 8") && spinnerinput2.equals("Base 2")) {
String regex = "[0-7]+";
if(input.getText().toString().matches(regex)) {
output.setText(octalToBinary(input.getText().toString()));
} else {
Context context = getApplicationContext();
showToast(context, "Invalid characters for a base 8 number!");
}
}
else if(spinnerinput.equals("Base 8") && spinnerinput2.equals("Base 10")) {
String regex = "[0-7]+";
if(input.getText().toString().matches(regex)) {
output.setText(octalToDecimal(input.getText().toString()));
} else {
Context context = getApplicationContext();
showToast(context, "Invalid input for a base 8 number!");
}
}
else if(spinnerinput.equals("Base 10") && spinnerinput2.equals("Base 2")) {
String regex = "[0-9]+"; | {
"domain": "codereview.stackexchange",
"id": 23382,
"lm_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, android, number-systems",
"url": null
} |
bacteriology, heat, sterilisation, autoclave
Basically what I am saying is that the Wikipedia article is incorrect and imprecise in its use of language. If it had said something along the lines of "inactivates all medically relevant spore forming bacteria", then it would have been correct and much more precise. | {
"domain": "biology.stackexchange",
"id": 11527,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bacteriology, heat, sterilisation, autoclave",
"url": null
} |
python, scikit-learn, pca, data-analysis, variance
How is it possible that the last execution gives such an output?
Here are data distributions
transformedData
withoutOutliers
normalizedData
I'll add any further data if necessary, thanks in advance to any who can help! With PCA it is really important to put all (!) features on the same scale using standardization, e.g. using standard.scaler, i.e. having mean 0 and standard deviation 1.
Also see this and this posts.
The reason for this is that PCA looks at the variance explained by the different features. So in order to make the features comparable, standardization is required. | {
"domain": "datascience.stackexchange",
"id": 10542,
"lm_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, scikit-learn, pca, data-analysis, variance",
"url": null
} |
frequency-spectrum, frequency
$$f_{rms} = 1 * 10^{-130.8/20}/\sqrt{0.1^3} = 9.12E-6$$
Through subsequent simulation I found the accurate result would be increased by a factor of 1.219 (given the difference of the linear fit approximation I used for small offsets in vicinity of the Sinc DFT response versus the actual effects of that Sinc response):
$$f_{rms} = 1.219 * 10^{-130.8/20}/\sqrt{0.1^3} = 1.11E-5$$
As noted earlier, for real tones the sidelobe interaction will create an additional but predictable frequency offset (so an offset we can compensate for to get an accurate prediction rather than the resulting frequency noise due to signal SNR). | {
"domain": "dsp.stackexchange",
"id": 10659,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "frequency-spectrum, frequency",
"url": null
} |
csv, excel, powershell
## Unpivot Department columns, and add results to datatable
Write-Host "Unpivot each Dept column and add data to datatable"
for($col=2; $col -lt $inHeaders.Count; $col++)
{
$dept = $inHeaders[$col] #current $col header name
foreach($row in $inData)
{
$dr = $outData.NewRow();
$dr.Item("PayCode") = $row.PayCode
$dr.Item("PayDesc") = $row.PayDesc
$dr.Item("DeptCode") = $dept #header name
$dr.Item("GLCode") = $row.$dept #row.col value
$outData.Rows.Add($dr)
}
}
## Output modified file
Write-Host "Output modified $outFile"
$outData | Export-Csv -Path $outFile -Delimiter $delim -notypeinformation -Force
Write-Host "Remove quotes from file"
(Get-Content -Path $outFile) | ForEach-Object {$_ -replace '"', ""} | Out-File -FilePath $outFile -Force Path Joining
$srcDir = "C:"
$srcFile = "$SrcDir\ClientGL.xlsx"
$srcTab = "Sheet1"
$outFile = "$SrcDir\ClientGL.txt" | {
"domain": "codereview.stackexchange",
"id": 13921,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "csv, excel, powershell",
"url": null
} |
c++, object-oriented
void Elevator::set_direction()
{
if (requests[0] > get_current_floor())
{
direction = UP;
}
else if (requests[0] < get_current_floor())
{
direction = DOWN;
}
}
void Elevator::start_elevator()
{
int curr_floor = get_current_floor();
std::size_t curr_capacity = get_current_capacity();
std::cout << "\nThe current floor is " << curr_floor << " and number of person in elevator are " << curr_capacity <<"\n";
//Entering requests for first time
set_initial_request();
std::sort(requests.begin(), requests.end()); | {
"domain": "codereview.stackexchange",
"id": 36544,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, object-oriented",
"url": null
} |
complexity-theory, graphs, space-complexity
Title: Space complexity of a variant of st-connectivity Consider a variant of STCON, called 2STCON, which is defined like this:
$$2STCON = \{\langle G,u,v \rangle \} \mid \text{$G$ is a graph with } \mathit{two} \text{ paths from $u$ to $v$} \} $$
This means the only difference to the "normal" STCON is that there are two paths instead of just one between $u$ and $v$.
I need to show that 2STCON belongs to NL.
What is the best way to approach this problem? The usual proof that STCON is in NL works as follows: you guess a path from $u$ to $v$, and verify it step by step.
A very similar proof works for 2STCON: you guess two paths from $u$ to $v$, and verify them step by step. As you verify them, you also verify that they are different: either the length is different, or the $i$-th vertex is different, for some $i$. | {
"domain": "cs.stackexchange",
"id": 18243,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, graphs, space-complexity",
"url": null
} |
ros, roslaunch, turtlebot, remapping
Original comments
Comment by cyborg-x1 on 2015-09-03:
damned, you were faster ;-)
Comment by cyborg-x1 on 2015-09-03:
For multiple turtlebots he you should probably check out http://wiki.ros.org/turtlebot_concert/Tutorials/indigo/Concert%20Bringup (because of the APP stuff and so on ...)
Comment by tal_eldar on 2015-09-04:
Hi, thanks for the fast response! I'm new in ROS and the tutorials I've encountered so far regarded nodes, can you give me an example? I'm lauching allot of topics with:
roslaunch turtlebot_bringup minimal.launch
how can remap this argument?
and concert is no solution for me (joint computer issues)
Comment by tal_eldar on 2015-09-08:
I was finally able to test the answer and it is working fine with exporting ROS_NAMESPACE before launching the launch file, is there a way to permanently set the ROS_NAMESPACE?
Comment by dornhege on 2015-09-08: | {
"domain": "robotics.stackexchange",
"id": 22561,
"lm_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, roslaunch, turtlebot, remapping",
"url": null
} |
computer-architecture
Instruction set design still has a small effect, mainly seen in power consumption. In general the decoders on x86 machines consume more area, and also more power, per instruction decoded than do machines with RISC instruction sets. On the other hand the x86 power consumption can be reduced somewhat during tight loops by caching a small number of decoded instructions. Additionally the number of instructions to encode a program in x86 is about half that to encode the same program with a RISC instruction set, so the instruction fetch bandwidth (and thus the power consumption for instruction fetch) is a bit lower with x86 than it is with RISC instruction sets. | {
"domain": "cs.stackexchange",
"id": 2551,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computer-architecture",
"url": null
} |
c++, mathematics
return 0;
} A couple of things I noticed:
Here:
while (std::cout << "Please enter the third term in the series: " && !(std::cin >> thirdTerm)) {
std::cin.clear(); //clear bad input flag
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); //discard input
std::cout << "Invalid input; please re-enter.\n";
}
Aside from the prompt string this is repeated three times. This would be better if it was in a separate function that accepted the prompt string and the address of the variable to store the input value:
void GetInput(string prompt, int& input)
{
while (std::cout << prompt && !(std::cin >> input))
{
std::cin.clear(); //clear bad input flag
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); //discard input
std::cout << "Invalid input; please re-enter.\n";
}
} | {
"domain": "codereview.stackexchange",
"id": 24375,
"lm_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++, mathematics",
"url": null
} |
vba, excel
'Prepare Target
On Error Resume Next
Set targetWS = ThisWorkbook.Worksheets.Add(After:=sourceWS)
If Err.Number <> 0 Then
MsgBox "Cannot insert new worksheet", vbExclamation, "Failed"
Err.Clear
app.RestoreState
Exit Sub
End If
targetWS.Name = targetShtName
If Err.Number <> 0 Then
MsgBox "Cannot rename worksheet", vbInformation, "Renaming skipped"
'This might not be critical so just continue
End If
On Error GoTo 0
'Write data
With rngUsed
Range(.Cells(firstRow, 1), .Cells(lastRow, .Columns.Count)).Copy _
Destination:=targetWS.Cells(1, 1)
End With
sourceWS.Delete
app.RestoreState
End Sub
Public Function GetWorksheetByName(ByVal wsName As String, ByVal book As Workbook) As Worksheet
On Error Resume Next
Set GetWorksheetByName = book.Worksheets(wsName)
On Error GoTo 0
End Function | {
"domain": "codereview.stackexchange",
"id": 40518,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba, excel",
"url": null
} |
javascript, performance, object-oriented, search
Example record extracted from music_####.tracks For security ids have been masked with # or A...
"########-####-####-####-############":["########-####-####-####-############","Sheep","https://lh4.ggpht.com/AAAAAAA-AAAAAAAAAAAAAA_AAAAAA...","Pink Floyd","Animals","Pink Floyd","sheep","pink floyd","animals","pink floyd","Roger Waters","Rock",null,620059,4,0,0,0,1977,0,null,null,0,0,1372528857298236,1408583771004924,null,"AAAAAA...","AAAAAAAA...",2,"",null,"AAAAAAA...","AAAAAAAA...",128,1372582779985000,"https://lh3.googleusercontent.com/AAAAAA_AAAA...",null,null,[],null,null,null,null,null,null,null,null,null,null,"AAAAAA...",[],null,null,null,null,0,null,null,[["https://lh3.googleusercontent.com/AAAAA...",0,2],["https://lh3.googleusercontent.com/AAAAA...",0,1]],true,6,null,1], | {
"domain": "codereview.stackexchange",
"id": 33558,
"lm_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, performance, object-oriented, search",
"url": null
} |
Density of min(X,Y), max(X,Y) for iid Uniform (Related to other post)
There's a very detailed answer, but while I was doing the same exercise by myself I was thinking in a similar but slightly different way, which lead me to a different answer. Here I'll share with you my work so I can understand the why of the difference.
Also, I am making focus on the value of the CDF, and not yet working on the joint pdf.
Given $$(Z,W)=(min(X,Y), max(X,Y))$$ for $$X,Y$$ iid Uniform(0,1), find the CDF.
I thought of : $$$$P(Z\leq a,W\leq b)=\\ P(min(X,Y)\leq a,max(X,Y)\leq b)=\\ P( \{X\leq a, a \leq Y\leq b\} \cup \{a \leq X \leq b, Y\leq a\} )=(1)\\ P(\{X\leq a, a \leq Y\leq b\}) + P(\{a \leq X \leq b, Y\leq a\})= (2)\\ P(X\leq a) P( a \leq Y\leq b) + P(a \leq X \leq b) P(Y\leq a)= (3)\\ F_X(a)( F_Y(b)-F_Y(a)) + ( F_X(b)-F_X(a)) F_Y(a)=\\ F(a)(F(b)-F(a))+ (F(b)-F(a)) F(a)= (4)\\ 2F(a)(F(b)-F(a)) =\\ 2F(a)F(b) - 2F(a)^2$$$$ Where $$a$$ would be the minimum, $$b$$ the maximum and I use: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9372107914029486,
"lm_q1q2_score": 0.8021129290493798,
"lm_q2_score": 0.8558511451289038,
"openwebmath_perplexity": 2746.5772544509787,
"openwebmath_score": 0.9999791383743286,
"tags": null,
"url": "https://stats.stackexchange.com/questions/540086/density-of-minx-y-maxx-y-for-iid-uniform-related-to-other-post"
} |
observational-astronomy, radio-astronomy, terminology, pulsar
Title: What are the differences between different types of flux density in radio astronomy? I am new to radio astronomy and have started to analyze some radio observational data of pulsars recently. I am wondering about the differences between "peak flux density", "integrated flux density", " mean flux density", and "pulse flux density" of pulsars in radio. For starters, let's say we observe a pulsar for a certain amount of time. We're interested in getting its integrated profile, which means we fold the data at the spin period of the pulsar and average it out, which removes noise. The integrated profile is essentially a plot of flux density as a function of rotational phase. I'm going to call it simply the profile for now, to avoid confusion.
We then define the peak flux density $S_{\mathrm{peak}}$ as the maximum flux density of the profile. If the profile is roughly Gaussian, then this corresponds to the height of the Gaussian's peak. | {
"domain": "astronomy.stackexchange",
"id": 7007,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "observational-astronomy, radio-astronomy, terminology, pulsar",
"url": null
} |
ros-kinetic
Title: rospy.wait_for_message just hangs
there is no exception or anything, rospy.wait_for_message just hangs, and no result is returned, and no subsequent code is executed. running
rostopic echo /my_topic
is able to yield result. Someone can provide an example of how to use wait_fo_message?
Originally posted by Marc_Chen on ROS Answers with karma: 41 on 2018-08-07
Post score: 2
Take a look at the documentation. Or, if you look at the source for the wait_for_message function, you'll see that you can specifiy a timeout. If that timeout is exceeded then an exception will be raised (I removed the parts that aren't necessary for the question)
def wait_for_message(topic, topic_type, timeout=None):
"""
...
@param timeout: timeout time in seconds
@type timeout: double
...
@raise ROSException: if specified timeout is exceeded
"""
So, just call the function like this
rospy.wait_for_message(my_topic, MyMessage, my_timeout) | {
"domain": "robotics.stackexchange",
"id": 31484,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-kinetic",
"url": null
} |
c++, beginner, strings, c++11, unit-testing
//--------------------------------------------
// Has
//
//--------------------------------------------
// Inherits
//
//--------------------------------------------
// Uses
#include <string>
//--------------------------------------------
That's a huge waste of lines and also quite distracting. Please trim them down.
Use default for empty virtual destructor:
C++11 introduced default member functions. Instead of defining an empty virtual destructor, such as in:
virtual ~StringTokenGenerator() {}
You can default it, which is a more up-to-date style:
virtual ~StringTokenGenerator() = default; | {
"domain": "codereview.stackexchange",
"id": 12296,
"lm_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, strings, c++11, unit-testing",
"url": null
} |
operating-systems
The CPU jumps to the address specified by the MSR register. It is now in kernel mode. It runs whatever code is needed to perform the requested operation (specified in EAX by the caller). It then returns the result to the caller by using certain registers depending on the system call. To return it calls SYSEXIT.
The request was fulfilled, so the user code can continue where it was. | {
"domain": "cs.stackexchange",
"id": 17333,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "operating-systems",
"url": null
} |
javascript, node.js, json, typescript
Use of forEach is modifying response by virtue of 'pass by reference'. This may be intentional, but could lead to unintended side effects if the response is handled later, for example because this handler is part of a middleware chain. You might want instead to convert this to use Array.map so that you are returning a transformed object graph.
Not sure if its intended to leave DataFields alongside the mapped columns as that seems redundant. Again, map might be the solutuion here.
Apologies if there are typos or errors in the above, not easy to test without some expected input and intended output. | {
"domain": "codereview.stackexchange",
"id": 43418,
"lm_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, node.js, json, typescript",
"url": null
} |
inorganic-chemistry, redox, analytical-chemistry, stoichiometry, oxidation-state
Title: How is 1 mole hypochlorite ion equivalent to 1 mole chlorine gas? According to my book, 1 mole ClO- is equivalent to 1 mole Cl2. How is that even possible? 1 mole ClO- contains 1 mole Cl atoms. On the contrary, 1 mole Cl2 gas contains 2 mole Cl atoms. So, how are they equivalent?
Let me put it in this way. If I have 257.5g (5 mole) of ClO- ion, will it be correct to say that I have 355g (5 mole) Cl2 gas?
I have provided some context to my question. It's not required to be read in order to answer this question.
Context (not required to be read):
3.04g bleaching powder is dissolved in water to make a 400mL solution. To titrate 25mL of this solution, 40mL 0.075M sodium thiosulphate solution is needed.
Q) Calculate the amount of available active Cl2 from the mentioned bleaching powder. | {
"domain": "chemistry.stackexchange",
"id": 16618,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inorganic-chemistry, redox, analytical-chemistry, stoichiometry, oxidation-state",
"url": null
} |
fft, ifft
Title: Problem getting IFFT to work I've run into an issue fiddling with the FFT/IFFT routines given here (http://www.dspguide.com/ch12/3.htm). I've rewritten the code to C++ and played with it. The idea is to read a raw wave file (encoded as 32 bit floats),
find its FFT (complex) and then use that FFT as input to the InverseFFT function.
I expected to get the original sound data (samples) and I do for FFT lengths of up to 2048. For greater lengths (>= 4096 ), the code below doesn't (seem to) work. As you can see, my test consist solely of checking values
at indexes 20,30 and 40 for both the original samples and the result (inverse FFT) array. I've tried this on several files (created with Audacity) with the same results.
int main(int argc, char *argv[])
{
unsigned fs;
float *Ix;
QCoreApplication a(argc, argv);
cout << "opening file...";
char *pData= OpenRaw("C:\\test\\250_350_c.raw",fs); | {
"domain": "dsp.stackexchange",
"id": 5366,
"lm_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, ifft",
"url": null
} |
java, beginner, object-oriented, recursion, tree
public void remove(Node tempRoot, int r)
{
if (tempRoot.children != null)
{
for (int i = 0; i < tempRoot.children.size(); i++)
{
if (tempRoot.children.get(i).value == r)
{
for (Node n : tempRoot.children.get(i).children) tempRoot.children.add(n);
tempRoot.children.remove(i);
}
else
{
tempRoot = tempRoot.children.get(i);
remove(tempRoot, r);
break;
}
}
}
}
public boolean contains(int val) { return contains(root, val); }
private boolean contains(Node n, int val)
{
boolean found = false;
if (n == null) return found;
if (n.value == val) found = true;
else if (n.children != null) for (Node f : n.children) { return contains(f, val); }
return found;
} | {
"domain": "codereview.stackexchange",
"id": 32949,
"lm_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, beginner, object-oriented, recursion, tree",
"url": null
} |
programming, qiskit, shors-algorithm
For why $4$ is left out, I have no answer. My guess is that hard coding the unitary for the operation with $a=4$ was too complicated compared to the other values of $a$ to include in an early chapter of the Qiskit textbook like this one.
Update: the tutorial was updated, and now $4$ is included as it should be.
Shor's for 10 digit random number | {
"domain": "quantumcomputing.stackexchange",
"id": 2971,
"lm_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, qiskit, shors-algorithm",
"url": null
} |
type-theory, functional-programming, typed-lambda-calculus, parametricity
Definition of "non-disjunctive type constructor"
A unary type constructor $N$ is called non-disjunctive if for any unary type constructors $P$, $Q$ the following type equivalence holds:
$$ \forall r. \,N\, r\to (P\,r+Q\,r) \cong (\forall r.\,N\,r\to P\,r) + (\forall r.\,N\,r\to Q\,r) $$
The type constructors $N$, $P$, $Q$ are not necessarily covariant or contravariant.
To see the intuition for this name, consider that a function of type $N\, r\to P\,r+Q\,r$ must return a value of type $P\,r$ or a value of type $Q\,r$, that is, either the left or the right part of the disjunction $P\,r+Q\,r$. Could that decision depend on a given value of type $N\,r$? It could, if we could pattern match on a value of type $N\,r$. But if, say, $N\,r=\mathbb 1$ or $N\,r = r$ then we cannot pattern match on those values. Then a function of type $N\, r\to P\,r+Q\,r$ must hard-code the decision of returning either left or right parts for all inputs. | {
"domain": "cstheory.stackexchange",
"id": 5762,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "type-theory, functional-programming, typed-lambda-calculus, parametricity",
"url": null
} |
neural-network, backpropagation
Title: Backprop Through Max-Pooling Layers? This is a small conceptual question that's been nagging me for a while: How can we back-propagate through a max-pooling layer in a neural network?
I came across max-pooling layers while going through this tutorial for Torch 7's nn library. The library abstracts the gradient calculation and forward passes for each layer of a deep network. I don't understand how the gradient calculation is done for a max-pooling layer.
I know that if you have an input ${z_i}^l$ going into neuron $i$ of layer $l$, then ${\delta_i}^l$ (defined as ${\delta_i}^l = \frac{\partial E}{\partial {z_i}^l}$) is given by:
$$
{\delta_i}^l = \theta^{'}({z_i}^l) \sum_{j} {\delta_j}^{l+1} w_{i,j}^{l,l+1}
$$ | {
"domain": "datascience.stackexchange",
"id": 11669,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-network, backpropagation",
"url": null
} |
fundamental-astronomy, orbital-mechanics
Let's see how far we can get with the vis-viva equation and look at the problem purely from an energy standpoint.
$$v^2 = GM(2/r-1/a)$$
becomes
$$a = 1/(2/r-v^2/GM).$$
Let's look at a numerical example. Say $r = 1AU \approx 1.5 \times 10^{11}$ meters, and $v = 25,000$ m/s.
We know then that the semimajor axis of the orbit must be 0.773 AU. If the orbit reaches 1AU, the velocity will be 25,000 m/s. If it reaches 1.1 AU (which it might or might not, depending on eccentricity) it's velocity will be 21,500 m/s.
We're almost there but not quite. We need one more piece of information.
The periapsis and apoapsis $r_p$ and $r_a$ are related to the semimajor axis and eccentricity by
$$r_p = (1-e)a$$
$$r_a = (1+e)a$$
So for example if you had mentioned that the apoapsis was 1.1 AU, then we could calculate eccentricity from
$$e = r_a/a -1$$
and get $e = 0.4228$ AU and a periapsis $r_p = 0.387$ AU. | {
"domain": "astronomy.stackexchange",
"id": 3660,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fundamental-astronomy, orbital-mechanics",
"url": null
} |
fluid-dynamics, aerodynamics
Title: What do bullet trails really look like? In the movie The Matrix, during "bullet time" sequences, bullets are shown trailing evenly-spaced refracting blobs:
which presumably represent shockwaves or vapour trails.
In reality, if it were possible to (almost) freeze time and move around the scene, what would a real bullet trail look like, if at all visible? Is it significantly different for different types of bullets (ignoring tracer bullets) or atmospheric conditions?
These video clips claim to show trails, but they are not at all obvious: | {
"domain": "physics.stackexchange",
"id": 2757,
"lm_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, aerodynamics",
"url": null
} |
c++, optimization, computational-geometry, complexity
// Check to the nearest 6 decimal places.
int test = val*1000000+0.5;
if (test == 0) return 0; // colinear
return (val > 0)? 1: 2; // clock or counterclock wise
}
// The main function that returns true if line segment 'p1q1'
// and 'p2q2' intersect.
bool doIntersect(Point const& p1, Point const& q1, Point const& p2, Point const& q2)
{
// Find the four orientations needed for general and
// special cases
int o1 = orientation(p1, q1, p2);
int o2 = orientation(p1, q1, q2);
int o3 = orientation(p2, q2, p1);
int o4 = orientation(p2, q2, q1);
// General case
if (o1 != o2 && o3 != o4)
return true;
// Special Cases
// p1, q1 and p2 are colinear and p2 lies on segment p1q1
if (o1 == 0 && onSegment(p1, p2, q1)) return true;
// p1, q1 and p2 are colinear and q2 lies on segment p1q1
if (o2 == 0 && onSegment(p1, q2, q1)) return true; | {
"domain": "codereview.stackexchange",
"id": 8083,
"lm_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++, optimization, computational-geometry, complexity",
"url": null
} |
twoβpoint BVP The resulting system of simultaneous equations is nonlinear. We introduce finite difference approximations for the 1-D heat equation. Andre Weideman. For example, consider the heat equation !. finite different method heat transfer using matlab. We can solve the heat equation numerically using the method of lines. In this work, the three-dimensional Poisson's equation in cylindrical coordinates system with the Dirichlet's boundary conditions in a portion of a cylinder for is solved directly, by extending the method of Hockney. 33) The calculator value for tan-1 (β3. in Figure 6 on a log-log plot. where is, for example, an arbitrary continuous function. Some strategies for solving differential equations based on the finite difference method are presented: forward time centered space (FTSC), backward time centered space (BTSC), and the Crank-Nicolson scheme (CN). Numerical Methods for Partial Differential Equations is an international journal that aims to cover research into | {
"domain": "leplec.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9814534376578002,
"lm_q1q2_score": 0.8024112845639997,
"lm_q2_score": 0.8175744806385542,
"openwebmath_perplexity": 783.3088336727461,
"openwebmath_score": 0.4634234607219696,
"tags": null,
"url": "http://leplec.de/finite-difference-method-example-heat-equation.html"
} |
fluid-dynamics, surface-tension, liquid-state
Title: If surface tension was reversed, what shape would a drop have? Let's say surface tension was repulsive instead of attractive. In such a case, a drop (would it be called a drop?) would try to expose as much surface as possible. What shape would it take? What geometrical shape has the maximum surface area for a given volume? A fine mist would suffice. A force like that would tear a drop into tiny pieces rather rapidly.
Alternatively, if your fictional physics which is pretty much unrelated to surface tension also required that the drop also stay together, there are many fractaline structures which have remarkably surface area to volumes. For example, consider the Menger Sponge:
The Menger Sponge is a fascinating fractal with a peculiar property. If the process used to generate it is continued to infinity, the resulting shape has infinite surface area and zero volume! If that's not a limit to your fictional physics problem, I don't know what is! | {
"domain": "physics.stackexchange",
"id": 40618,
"lm_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, surface-tension, liquid-state",
"url": null
} |
ros, navigation, turtlebot, frontier-exploration, dwa-local-planner
# Forward Simulation Parameters
sim_time: 1.0
sim_granularity: 0.025
vx_samples: 6
vy_samples: 1
vtheta_samples: 20
# Trajectory Scoring Parameters
path_distance_bias: 64.0
goal_distance_bias: 24.0
occdist_scale: 1.0
forward_point_distance: 0.325
stop_time_buffer: 0.2
scaling_speed: 0.25
max_scaling_factor: 0.2
meter_scoring: true
# Oscillation Prevention Parameters
oscillation_reset_dist: 0.05 # 0.05
publish_traj_pc : true
publish_cost_grid_pc: true
global_frame_id: odom
navfn_global_planner_params.yaml:
NavfnROS:
visualize_potential: false
allow_unknown: true
planner_window_x: 0.0
planner_window_y: 0.0
default_tolerance: 0.1
global_planner_params.yaml:
GlobalPlanner:
old_navfn_behavior: false
use_quadratic: true
use_dijkstra: false
use_grid_path: false
allow_unknown: true
planner_window_x: 0.0
planner_window_y: 0.0
default_tolerance: 0.25
publish_scale: 100
planner_costmap_publish_frequency: 0.0 | {
"domain": "robotics.stackexchange",
"id": 25002,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, navigation, turtlebot, frontier-exploration, dwa-local-planner",
"url": null
} |
equivalence-principle, general-relativity
The Copernican principle is the "notion" or "philosophy" that neither humans or any given group examining the universe has a privileged view. The idea has been generalized to extend from the original intention applying to the Earth to extend inward as far as a human individual, or outward as far as our local group of galaxies. At the largest scale we have found the distribution and characteristic of matter throughout the universe to be roughly homogenous, as sort of the ultimate example of this principle, leaving no location or collection of matter privileged. | {
"domain": "physics.stackexchange",
"id": 2344,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "equivalence-principle, general-relativity",
"url": null
} |
optics, electromagnetic-radiation, photons, quantum-electrodynamics, refraction
Which is why you can see through a window.
But if you use ground glass, the surface is no longer flat but has been modified to change the direction - and this results in the image behind the glass becoming fuzzy. The same principle exists in the glass used in many showers (original image from Victoria Elizabeth Barnes's posts on bathroom remodeling: | {
"domain": "physics.stackexchange",
"id": 30157,
"lm_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, electromagnetic-radiation, photons, quantum-electrodynamics, refraction",
"url": null
} |
reinforcement-learning, q-learning, dqn, multi-armed-bandits, contextual-bandits
Title: Why do I get bad results no matter my neural network function approximator for parametrized Q-learning implementation for Contextual Bandits? I'd like to ask you why, no matter my neural network function approximator for parametrized Q-learning implementation for a Contextual Bandits environment, I'm getting bad results. I don't know if it's a problem with my formulation of the problem and how I'm trying to solve it, or is it the neural architecture. I tried different fully-connected neural networks with different number of layers and different number of neurons (sticking to low numbers since my environment is not complex) but I always get bad results, and it seems the results are random. | {
"domain": "ai.stackexchange",
"id": 2907,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reinforcement-learning, q-learning, dqn, multi-armed-bandits, contextual-bandits",
"url": null
} |
c#, mvc, n-tier
I've highlighted a line of code using a comment which shows where I am making use of a concrete type in the infrastructure layer to check to see if a user is subscribed to a module. By using a concrete type I've made it impossible to use mock objects which I want to avoid, but...
I'm a little confused because in the line highlighted using a comment I guess I should really be using a repository or a service although I'm not really sure if I should be or not. Also, if I use a repository then the filters can't be in the presentation layer, but I'm not sure if services are purely for controllers or whether I can use services elsewhere.
Can anyone please advise me on whether I should be putting filters in the presentation layer or not, and whether or not I should be using a service, repository, or keep the code how it is.
Also, I'm open to code improvements if you think any can be made. Here's my take on this problem. | {
"domain": "codereview.stackexchange",
"id": 14558,
"lm_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#, mvc, n-tier",
"url": null
} |
# Proving the number of solutions to |a|+|b|= k
## Homework Statement
Prove that there are 4k solutions to the equation |a|+|b| = k, i.e. 4k pairs of a and b such that |a|+|b|=k.
none
## The Attempt at a Solution
I've written out the first few:
for k = 0, the only solution is (0,0)
for k =1, we have (-1,0) (0, -1) (0,1)(1,0)
for k =2, we have (1,1) (-1, -1)(-1,1)(1,-1) (0,2)(2,0)(-2,0)(0,-2)
for k =3, we have (2,1)(1,2)(-2,1)(1,-2)(2,-1)(-1,2)(-1,-2)(-2,-1)(0,3)(3,0)(0,-3)(-3,0)
The pattern seems to involve looking at the order/sign permutations of the pairs. The total number of solutions seems to be:
4(for the permutations made by sign changes and flipping the order of the (0,k) pair) + n*8(where n is the number of pairs where a doesn't equal b and neither a nor b equals 0, and 8 is the number of permutations made by sign changes and flipping the order)+4 (if there is a pair where a=b (i.e. if k is even) for the sign/ordering permutations). | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464415087019,
"lm_q1q2_score": 0.8001719793065136,
"lm_q2_score": 0.8198933315126791,
"openwebmath_perplexity": 451.41841667663,
"openwebmath_score": 0.8096107244491577,
"tags": null,
"url": "https://www.physicsforums.com/threads/proving-the-number-of-solutions-to-a-b-k.472460/"
} |
gravity, acceleration, equivalence-principle, tidal-effect
I expect I would be able to tell the difference between acceleration and a gravitational field by measuring the acceleration vector at $x=3, y=3$. Because gravity is center-seeking, I would expect the apparent acceleration vector to be something like $\left \langle -\sqrt{18},-\sqrt{18},-8 \right \rangle$. Whereas if it's just acceleration in no gravitational field, I would expect it to stay $\left \langle 0,0,-10 \right \rangle$. The change might be really slight, depending on how far the gravitational center is, but any change would be theoretically measurable. | {
"domain": "physics.stackexchange",
"id": 74236,
"lm_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, acceleration, equivalence-principle, tidal-effect",
"url": null
} |
physical-chemistry, temperature
Title: There's an absolute zero, is there an "absolute hot"? This might be more of a physics question, but is there a ceiling on how hot things can get?
What happens at this temperature? In the actual theories of physics the highest temperature which has a physical meaning is the Planck's temperature.
$$T_\mathrm{P} = \frac{m_\mathrm{P} c^2}{k} = \sqrt{\frac{\hslash c^5}{G k^2}} \approx \pu{1.4e32 K}$$
For the moment no theory predict higher temperature because of the limit of our theories.
There is a Wikipedia article about absolute hot with some references. You must have a look. | {
"domain": "chemistry.stackexchange",
"id": 7098,
"lm_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, temperature",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.