text stringlengths 1 1.11k | source dict |
|---|---|
newtonian-mechanics, forces, projectile, biophysics
Title: Why we are not able to throw further with two hands than with one hand? Suppose you are applying some force on an object by your one of your hand let us say the force be $F_1$ .Now you are applying another force on the same object by using both of your hands let us say the force be $F_2$ then the relation between $F_1$ and $F_2$ must be $$F_1<F_2$$ so, | {
"domain": "physics.stackexchange",
"id": 38155,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, forces, projectile, biophysics",
"url": null
} |
java, hash-map
Title: Evicting an entry from a size-limited HashMap I have a HashMap with a limited size of 1000 elements. When I want to put one more, the T with the lowest related Integer in the map should be replaced with the new one.
I already have this working solution for my problem, but it seems a bit too much code for me so maybe you have a better idea :)
HashMap<T, Integer> set = new HashMap<>();
public boolean add(T element) {
if (set.containsKey(element)) {
return false;
} else if (set.size() == length) {
Integer searchedInteger = set.values().stream().sorted().findFirst().get();
T searchedElement = set.entrySet()
.stream()
.filter(x -> x.getValue().equals(searchedInteger))
.findFirst()
.get()
.getKey();
set.remove(searchedElement);
}
set.put(element, 0);
return true;
} Improvement of the code | {
"domain": "codereview.stackexchange",
"id": 19343,
"lm_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, hash-map",
"url": null
} |
1) The map between sets $g\mapsto {\rm Ad}_g$, for $g\in G$,
Select Option is a group homomorphism from $G$ to ${\rm Aut}(G)$is a group homomorphism from $G^{\rm \,op}$ to ${\rm Aut}(G^{\rm \,op})$is a group homomorphism from $G$ to ${\rm Aut}(G^{\rm \,op})$is a group homomorphism from $G^{\rm \,op}$ to ${\rm Aut}(G)$
.
2) The map between sets $g\mapsto {\rm Ad}_{g^{-1}}$, for $g\in G$,
Select Option is a group homomorphism from $G$ to ${\rm Aut}(G)$is a group homomorphism from $G^{\rm \,op}$ to ${\rm Aut}(G^{\rm \,op})$is a group homomorphism from $G$ to ${\rm Aut}(G^{\rm \,op})$is a group homomorphism from $G^{\rm \,op}$ to ${\rm Aut}(G)$
.
3) The map $g\mapsto L_g$, for $g\in G$,
Select Option is an action of $G$ on the set $G$ is an action of $G^{\rm\, op}$ on the set $G$
.
4) The map $g\mapsto R_g$, for $g\in G$,
Select Option is an action of $G$ on the set $G$is an action of $G^{\rm\, op}$ on the set $G$
.
Select an assignment template | {
"domain": "albert.io",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9915543748058885,
"lm_q1q2_score": 0.8367678866545489,
"lm_q2_score": 0.8438951084436077,
"openwebmath_perplexity": 70.09471546816009,
"openwebmath_score": 0.9932082295417786,
"tags": null,
"url": "https://www.albert.io/learn/abstract-algebra/question/group-action-on-itself-multiply-leftright-adjointconjugation"
} |
ros-fuerte
Warning [parser.cc:362] Converting a deprecatd SDF source[/home/jose/fuerte_workspace/simulator_gazebo/gazebo_worlds/worlds/empty.world].
Set SDF value
Version[1.2] to Version[1.3]
Please use the gzsdf tool to update your SDF files.
$ gzsdf convert [sdf_file]
[ INFO] [1354272041.822041146]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
Msg Waiting for master
Msg Connected to gazebo master @ http://localhost:11345
[ INFO] [1354272043.627426014, 0.001000000]: joint trajectory plugin missing <updateRate>, defaults to 0.0 (as fast as possible)
[ INFO] [1354272043.659119580, 0.024000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1354272043.728475086, 0.090000000]: Starting to spin physics dynamic reconfigure node... | {
"domain": "robotics.stackexchange",
"id": 2835,
"lm_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-fuerte",
"url": null
} |
homework-and-exercises, newtonian-mechanics
I know this is a very silly question. But I am screwing up in understanding the answer in my book. Please help me!
Here,the answer given in my book is $mg$. But I think the force must be greater than that.
To explain my answer, I have taken the scenario as follows: If the boy is holding the ball in his hand, then the force of gravity and the force by his hand counter balance each other as a result of which ball stays stationary. Now, if the boy has to move the ball to a greater height, he must apply an additional force along with the force that keeps the ball stationary. Thus, my answer.
So, can the force being equal to the weight raise the ball up to a height $h$, or does the force need to be larger than this? This is a horribly written question (the exercise, not your post).
You are correct in your reasoning. If the ball starts at rest, the force $F$ needs to be larger than $mg$ in order for it to begin moving upwards. | {
"domain": "physics.stackexchange",
"id": 83533,
"lm_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",
"url": null
} |
use Python to delve into high school—level math topics like statistics, geometry, probability, and calculu. if evaluate: #TODO: check if assumption of discontinuous derivatives exist variables = cls. In this case SymPy automatically rewrote the input expression and gave its canonical form, which is x + 1 once again. Synthetic Data Generation: A must-have skill for new data scientists. Unless you're involved in writing Python code at the level of the code in the sympy module there is seldom a need to under much about sympy's classes. Having some trouble with integrals. doit() method we. If you do complex work on statistical functions I recommend you take a look at sympy. We demonstrate through examples how this is a highly separable way to introduce uncertainty and produce and query stochastic models. That is great for Julia users, as the PyCall package glues Julia to Python in a seamless manner. If Y is a matrix, then cumtrapz(Y) is the cumulative integral over each column. SymPy | {
"domain": "yiey.pw",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9748211590308922,
"lm_q1q2_score": 0.8058961451185194,
"lm_q2_score": 0.8267117898012105,
"openwebmath_perplexity": 1338.5135338409063,
"openwebmath_score": 0.7079145312309265,
"tags": null,
"url": "http://sgix.yiey.pw/sympy-evaluate-integral.html"
} |
navigation
len(data.ranges) #360
len(data.intensities) #360
ranges_filter = copy.copy(data.ranges)
intensities_filter = copy.copy(data.intensities)
#convert them to list
ranges_filter = list(ranges_filter)
intensities_filter = list(intensities_filter)
#filtering those angles that I do not want them (based on the question)
for x in range(45, 135):
ranges_filter[x] = 0
intensities_filter[x] = 0
for y in range(225, 315):
ranges_filter[y] = 0
intensities_filter[y] = 0
#define a new topic called "filterScan" to store all laser scanner data
rospy.init_node('laser_scan_filter')
scan_pub = rospy.Publisher('filterScan', LaserScan, queue_size=50)
rospy.Subscriber("/scan", LaserScan, callback_scan)
#it is based on the type of laser scanner (length of data.ranges)
num_readings = 360
laser_frequency = 60
count = 0
r = rospy.Rate(1.0)
while not rospy.is_shutdown():
current_time = rospy.Time.now() | {
"domain": "robotics.stackexchange",
"id": 29579,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation",
"url": null
} |
F = fdiff(f, 1e-1, pol0)
F =
-1.4119 0.7071
1.4119 0.7071
Note that this bigger step is not as good as what we had. Let's try a very small step instead.
F = fdiff(f, 1e-14, pol0)
F =
-1.4100 0.7216
1.4100 0.7216
It's even worse due to roundoff error -- 1e-14 is too small compared to the states we're using and the results of the function. It's best to stay within a dozen orders of magnitude of the input states.
If our function involved two values of very different magnitudes, we can instead difference with as many step sizes as states. Let's use 1e-6 times the magnitude of each state as the step size.
step_sizes = 1e-6 * pol0
F = fdiff(f, step_sizes, pol0)
step_sizes =
1.0e-05 *
0.0785
0.2000
F =
-1.4142 0.7071
1.4142 0.7071
This works well. Of course, care must be taken to ensure no step size is actually 0.
## Example: Many Function Inputs
Suppose our function took in many inputs, such as the following:
f = @(t, x, u) t * norm(x) * x + [0; 1] * u; | {
"domain": "anuncommonlab.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357205793903,
"lm_q1q2_score": 0.8094037233815748,
"lm_q2_score": 0.8244619263765707,
"openwebmath_perplexity": 2988.8592472981504,
"openwebmath_score": 0.8351020216941833,
"tags": null,
"url": "http://www.anuncommonlab.com/doc/starkf/fdiff.html"
} |
python, python-3.x
def compare(self, value):
"""
Compares the values, with value
as the first compared value. Compari-
sons look something like this:
value operator self.value
"""
return self._operators[self._operator](value, self._value)
def reverse_compare(self, value):
"""
Compares the values with self.value
as the second compared value. Compari-
sons look something like this:
value operator self.value
"""
return self._operators[self._operator](self._value, value)
class QueryableList:
"""
A special class which is like a
default Python list, except it
has querying capabilities.
"""
def __init__(self, _items: list):
self._items = _items
def select(self):
"""
'Select' self._items and return it as
a list. This is used in QueryableList.
where as the first argument.
"""
return self._items | {
"domain": "codereview.stackexchange",
"id": 14333,
"lm_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",
"url": null
} |
general-relativity, string-theory, quantum-gravity, spacetime
So the addition of the closed string external states to the scattering process is equivalent to not adding them but starting with a modified classical background. Whether we include the factor into $\exp(-S)$ or into $\prod V_i$ is a matter of bookkeeping – it is the question which part of the fields is considered background and which part is a perturbation of the background. However, the dynamics of string theory is background-independent in this sense. The total space of possible states, and their evolution, is independent of our choice of the background. By adding perturbations, in this case physical gravitons, we may always change any allowed background to any other allowed background. | {
"domain": "physics.stackexchange",
"id": 63109,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, string-theory, quantum-gravity, spacetime",
"url": null
} |
ros2
Originally posted by dannee on ROS Answers with karma: 43 on 2022-09-16
Post score: 0
Original comments
Comment by ravijoshi on 2022-09-17:
The error message ...name 'variable' is not defined totally makes sense. It should be either self.variable or variable = 1234 # something. Right now, you are using this variable without defining it.
Comment by dannee on 2022-09-18:
@ravijoshi Thanks for your comment. However I know that my variable is not defined. It's not defined in order to crash the node. My problem is with how the error is displayed. I would something like this:
File "/home/daniel/wl_meta_ws/build/timer_test/timer_test/timer_test.py", line 16, in timer_callback variable
NameError: name 'variable' is not defined | {
"domain": "robotics.stackexchange",
"id": 37979,
"lm_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",
"url": null
} |
es auch nicht, dass sie in der Schöpfung eine bedeutende Rolle spielt. Update 2015: After much thought, I no longer think math is a science. Mathematics in Nature provides answers to all these questions and many more, while introducing the reader to the ideas and methods of mathematical modelling. This hands-on kit invites learners of all ages to investigate patterns in nature, with a focus on the Fibonacci sequence.. Once introduced to this spiral pattern in nature, you may start noticing it everywhere. Appendix: The Natural Log of E. Quick quiz: What’s $\ln(e)$? A mathematical symbol is a figure or a combination of figures that is used to represent a mathematical object, an action on mathematical objects, a relation between mathematical objects, or for structuring the other symbols that occur in a formula.As formulas are entierely constitued with symbols of various types, many symbols are needed for expressing all mathematics. This page includes affiliate links. We developed a | {
"domain": "jookhyangla.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429629196684,
"lm_q1q2_score": 0.81513114385388,
"lm_q2_score": 0.8289388083214156,
"openwebmath_perplexity": 2308.346886792761,
"openwebmath_score": 0.3367389738559723,
"tags": null,
"url": "https://jookhyangla.com/kroger-recall-dbzwua/what-is-math-in-nature-725e25"
} |
java, regex
lineNumber = Integer.parseInt(m.group());
} else if (message.matches(regex2)) {
m = p.matcher(message);
if (m.find()) {
lineNumber = Integer.parseInt(m.group()) - 2;
}
} | {
"domain": "codereview.stackexchange",
"id": 12721,
"lm_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, regex",
"url": null
} |
ros-hydro, ubuntu, ubuntu-trusty, ros-indigo
Title: Ros Hydro on Ubuntu14.04
I am currently using a ubuntu 14.04 and I have bought the book "Ros By Example Hydro-Volume 1". Is there any possible ways for me to download Ros Hydro in my computer?? and even though in can't is the Ros indigo very different with hydro?? Is it okay to use the hydro book on the Ros indigo??
Originally posted by Vito 178 on ROS Answers with karma: 1 on 2015-03-23
Post score: 0
I am currently using a ubuntu 14.04 [..]
and:
Is there any possible ways for me to download Ros Hydro in my computer?? | {
"domain": "robotics.stackexchange",
"id": 21204,
"lm_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-hydro, ubuntu, ubuntu-trusty, ros-indigo",
"url": null
} |
java, algorithm, array, queue
/**
* Resizes the array when capacity reaches 100% or 25%
*
* @param capacity New capacity for the array
*/
private void resize(int capacity) {
Item[] copy = (Item[]) new Object[capacity];
for (int i = 0; i < size; i++) {
copy[i] = queue[i + index];
}
queue = copy;
}
} Your code looks good, but can be improved.
/**
* Resizes the array when capacity reaches 100% or 25%
*
* @param capacity New capacity for the array
*/
private void resize(int capacity) {
Item[] copy = (Item[]) new Object[capacity];
for (int i = 0; i < size; i++) {
copy[i] = queue[i + index];
}
queue = copy;
} | {
"domain": "codereview.stackexchange",
"id": 20209,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, algorithm, array, queue",
"url": null
} |
dna, histone
instead of this:
Surely you could simply wrap DNA up in a coil, but to do it in a neat fashion that allows you to package and repackage sections as needed, it's a lot better to have some dedicated machinery.
It is also difficult to organize DNA without a supporting structure because the negative charge of the DNA polymer repels other parts of the molecule, whereas histones are rich in positive charges.
As Galen mentioned in comments, histones both pack DNA into a smaller space (human DNA from one cell would be about the height of an adult if it was all in a straight line) and contribute to gene regulation. Modifications of histones control whether the DNA around that histone can be accessed by transcription machinery and therefore whether those genes will be expressed. | {
"domain": "biology.stackexchange",
"id": 8677,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dna, histone",
"url": null
} |
mathematical-physics, cosmology, mathematics
The space of mathematical structures as normally imagined to exist in ZFC is far too big for physics (this was the previous answer), but I'll try to fix that, and interpret the sapce of structures differently. The correct space of all mathematical objects is probably best given as the set of all integers and relations on the integers which encode arbitrary running histories of computer programs to finite times. This includes sequences of digits which approximate real numbers, the description of all theorems of ZFC (or any other axiomatic system), etc, so is as big as you can conceive.
There is no obvious dynamics on this space (other than the running of computer programs)--- how do you jump from one finite graph on the integers to another? What is the relation between structures which corresponds to different experiences at different times? You have to embed physics into this structure somehow. | {
"domain": "physics.stackexchange",
"id": 6419,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mathematical-physics, cosmology, mathematics",
"url": null
} |
human-biology, cell-biology, neuroscience, neurophysiology, pain
Then inflammatory pain is the pain you get when you cut or bruise yourself, have allergies, stuffy nose, etc. It is the more common and treatable types of pain and is easy to detect. It comes with redness, swelling, and sensitivity to the general area. Biologically your body is stimulating this pain because your inflammatory system is trying to attack any invasive particles or repair damaged sections of the body. There has been much research done in this type of pain (see sources) and is treatable with non-steroidal anti inflammatory drugs (NSAIDs) such as aspirin, Tylenol, etc. | {
"domain": "biology.stackexchange",
"id": 9863,
"lm_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, cell-biology, neuroscience, neurophysiology, pain",
"url": null
} |
algorithms, machine-learning, computational-geometry
The most naive algorithm I came up with is building convex polygon for $A$ and $B$ and test them for intersection. It looks time the time complexity for this should be $O(n\log h)$ as for constructing a convex polygon. Actually I am not expecting any improvements in time complexity, I am not sure it can be improved at all. But al least there should be a more beautiful way to determine if there is such a line. Both uli and Dave Clarke correctly observe that this is a linear programming problem, even in higher dimensions (Can these two point sets be separated by a hyperplane?) and so it can be solved in polynomial time. But because your points lie in the plane, your problem can actually be solved in $O(n)$ time, where $n$ is the total number of points.
The simplest solution is probably Seidel's randomized algorithm. Choose an input point $p$ uniformly at random, and recursively compute a separating line $\ell$ for all the points except $p$. | {
"domain": "cs.stackexchange",
"id": 198,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, machine-learning, computational-geometry",
"url": null
} |
books, pseudo-random-generators
Title: Introductory Book on Pseudo-Random Number Generation I'm a rank amateur in the area of pseudo-random number generation. I've recently found out that certain generators are better than others (e.g. mt19337 vs rand in C++) and learned what modulo bias is.
My Request
I'm looking for an introductory book on pseudo-random number generation. Does one exist?
My Requirements
The book must be understandable by someone with the following mathematics background:
calculus
discrete math (combinatorics, logic and proofs, set theory, mathematical induction, functions and relations, inclusion-exclusion, generating functions, recurrence relations, graphs/graph algorithms)
linear algebra (vectors,matrix algebra, eigenvalues, transformations, diagonalization)
introductory numerical analysis (computer arithmetic and errors, root-finding algorithms, computational techniques for matrices, numerical integration and differentiation) | {
"domain": "cs.stackexchange",
"id": 13582,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "books, pseudo-random-generators",
"url": null
} |
the cone that is obtained. 12 cm 3: B. Volume of frustum of a cone = Volume of the big cone – Volume of small cone. Free online calculators for area, volume and surface area. Geometry . V 5 Bh 3. Find the volume of each cone. Directions: (1) Choose & write whether the problem is asking you to find . Example math problems. The volume of a cone is 1/3*pi*r^2*h, Solve real-world example problems using these formulas ; Volume of Cylinders, Cones, and Spheres Related Study Materials. 59 (approximately). Answer. The base can be found by using the formula to find the area of a circle: base equals pi times radius squared. Types of Problems. Students, teachers, parents, and everyone can find solutions to their math Calculate the volume of a cone by its base and height with the equation volume = 1/3 * base * height. Cone and Cylinder Challenge Problems Quiz: Volume Word Problems 1. Solved problems on volume of cones In this lesson you will find typical solved problems on volume of cones. | {
"domain": "kristinavitalis.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9927672370524974,
"lm_q1q2_score": 0.8093361149226344,
"lm_q2_score": 0.8152324983301568,
"openwebmath_perplexity": 583.2908903722966,
"openwebmath_score": 0.6182653903961182,
"tags": null,
"url": "http://kristinavitalis.com/9rgezjb/fs8deid.php?tynundghs=volume-of-a-cone-problems"
} |
algorithms, computational-geometry, tiling
Convince yourself that it works:
Figure:Start from $A$, follow the push-arrows. Everything should be forced and consistent.
Figure:Start from $A$, follow the push-arrows. Everything should be forced and consistent.
Note: Every wire coming in and out of the splitter absolutely must connect to an endpoint somewhere, in order to maintain the invariant. Alternatively, you can add endpoints to each of the pairs of leads of the splitter.
The gate can be oriented as needed.
not-gate
The not gate takes a wire and outputs a wire that has the reverse implications. It is basically a twist-gate, except that it relabels the colorings of the wires. The not-gate looks like this:
And a view of the two possible states:
The gate can be oriented as needed.
clause-gate
For the clause-gate, we first introduce the clause-gadget:
Left to right: 1 clause-gadget. 2-4: $3$ different minimal-square-partition-states.
This is what the gate looks like: | {
"domain": "cs.stackexchange",
"id": 1966,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, computational-geometry, tiling",
"url": null
} |
resampling, feedback
Title: Resample with unknown rate change I am doing digital signal processing for a software defined radio. I have a signal coming in packets of data (several samples) at an average sample rate of approximately some known value FSin. I am given a request for packets to be sent out periodically, with an average rate out of approximately FSout. If I knew these rates exactly I could resample my data by a ratio R=FSout/FSin and use a FIFO to make sure data always has somewhere to go when I get a packet and there's always data to send when I'm asked to send a packet. However, the clocks of the radio and my computer are not perfectly synchronized, so there is no exact known ratio for R. What would your solution be? | {
"domain": "dsp.stackexchange",
"id": 2532,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "resampling, feedback",
"url": null
} |
javascript, node.js
const ref = obj.expires_secs
const expires_secs = ref != null ? ref : this.expires_secs
await this.mark_installed(obj.uuid)
const val = `${obj.ip}_${obj.port}_${obj.relay_ip}_${obj.relay_port}`
return redis.setex(`${this.prefix}:${obj.uuid}`, expires_secs, val)
}
// Usage
active.ping(obj).then(result => {
}, error => {
})
// or
try {
const result = await active.ping(obj)
} catch (error) {
}
Few other minor nitpicks: | {
"domain": "codereview.stackexchange",
"id": 35183,
"lm_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",
"url": null
} |
javascript, beginner
And my solution - of which I'm wondering if there is another way to do so - is:
transformData(data) {
const values = [];
// loop through totalQuantities
const objTotal: any = {};
objTotal.type = 'Total';
for (let i = 0; i < data.totalQuantities.length; i++) {
const name = 'ammount' + (i + 1).toString();
objTotal[name] = data.totalQuantities[i].ammount;
}
values.push(objTotal);
// loop through each element of singleQuantities
data.typeQuantities.map(element => {
const obj: any = {};
obj.type = element.type.name;
for (let i = 0; i < element.singleQuantities.length; i++) {
const name = 'ammount' + (i + 1).toString();
obj[name] = element.singleQuantities[i].ammount;
}
values.push(obj);
});
return values;
} It looks like you're using TypeScript. TypeScript is great - it can turn difficult-to-debug runtime errors into trivially fixable compile errors. But for this sort of type checking to work: | {
"domain": "codereview.stackexchange",
"id": 40045,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, beginner",
"url": null
} |
algorithms
The goal is to store each unique element in a resulting set R. The naïve single-threaded solution would be to iterate over each set one after the other while keeping track of already seen elements in a separate data structure S. If an element was already seen, do nothing. Otherwise, store the element in R and update S.
For large sets (e.g. 10,000,000 or more total elements) this can get quite slow. Is there a multi-threaded approach for this problem which improves performance? I will assume that each set is stored as a sorted list/array. You can compute the union of two sets using a merge algorithm. This should run in linear time, and is quite I/O friendly, as you only scan through the list in a forward direction (no random access needed). It is easy to extend this to a four-way merge. | {
"domain": "cs.stackexchange",
"id": 20378,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms",
"url": null
} |
ros, camera1394
I allways get the same result no matter which camera I open first.
I am using ROS diamondback on Ubuntu 11.04 (kernel 2.6.38-11-generic), camera_drivers stack is version 1.4.2.
The three cameras are connected via a firewire hub.
Can anybody tell me how I can get the camera nodes to work and open my three cameras at the same time?
Thanks, Kai Bublitz
Originally posted by Kai Bublitz on ROS Answers with karma: 357 on 2011-11-07
Post score: 1
The "failed to allocate iso resources" messages suggests that your bus is not providing enough bandwidth for both cameras in the chosen video mode.
If you have a 1394b bus, try setting the iso_speed parameter to 800 (Mb/s). The default is 400, which would be correct for the older 1394 bus standard.
Originally posted by joq with karma: 25443 on 2011-11-08
This answer was ACCEPTED on the original site
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 7224,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, camera1394",
"url": null
} |
c++, algorithm, recursion, c++20, constrained-templates
template<std::size_t unwrap_level, class T, class Pred>
requires(unwrap_level <= recursive_depth<T>())
constexpr auto recursive_count_if(const T& input, const Pred& predicate)
{
if constexpr (unwrap_level > 0)
{
return std::transform_reduce(std::ranges::cbegin(input), std::ranges::cend(input), std::size_t{}, std::plus<std::size_t>(), [predicate](auto&& element) {
return recursive_count_if<unwrap_level - 1>(element, predicate);
});
}
else
{
return predicate(input) ? 1 : 0;
}
}
/* recursive_all_of template function implementation
*/
template<class T, class Proj = std::identity, class UnaryPredicate>
requires(std::invocable<Proj, T>) && (std::invocable<UnaryPredicate, T>)
constexpr auto recursive_all_of(T&& value, UnaryPredicate p, Proj proj = {}) {
return std::invoke(p, std::invoke(proj, value));
} | {
"domain": "codereview.stackexchange",
"id": 45353,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, algorithm, recursion, c++20, constrained-templates",
"url": null
} |
python, performance, datetime, pandas
allGoodIndices += currentGoodIndices
currentGoodIndices = []
currentGoodTimes = []
skipPoint = new
else:
currentGoodIndices += [ind]
currentGoodTimes += [new]
prev = new
allGoodIndices += currentGoodIndices
return allGoodIndices
I operate this function by taking my dataframe, and running:
result = dropIrregularGaps(df['timeProduced'],pd.Timedelta('4 hours'), pd.Timedelta('8 hours 0 minutes')) | {
"domain": "codereview.stackexchange",
"id": 30113,
"lm_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, datetime, pandas",
"url": null
} |
arduino, rosserial
Originally posted by kylerlaird with karma: 104 on 2016-10-09
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 25890,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "arduino, rosserial",
"url": null
} |
filters, discrete-signals, finite-impulse-response, stochastic, covariance
Am trying to solve this using correlations.
So we all know that the variance $\sigma _y^2\:=\:R_y\left(0\right)$ which is basically the correlation of $y$ evaluated at zero.
Now we know the convolution $y(n)\:=\:x(n)* h(n) = \sum _{m\:=-\infty }^{\infty }h\left(m\right)x\left(n-m\right)$
Using the idea of correlation, I get the following:
$R_y\left(k\right)\:=\:E\left(y\left(k\right)y\left(n+k\right)\right)\:=\:E\left[\sum _{m=-\infty }^{\infty }h\left(m\right)x\left(k-m\right)\sum _{m=-\infty }^{\infty }h\left(m\right)x\left(n+k-m\right)\right]$
Now am so stuck here and just don't know what to do. Please help me by directing me in the right direction and by providing clear and coherent steps and explanations. Thank you very much in advance. You have a typo in your definition of $R_y(k)$, and an error in the time indices when developing the equation. The proper definition of autocorrelation for complex signals (in the case of wide-sense stationary processes) is | {
"domain": "dsp.stackexchange",
"id": 9880,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filters, discrete-signals, finite-impulse-response, stochastic, covariance",
"url": null
} |
general-relativity, spacetime, mass, acceleration, curvature
"Spacetime tells matter how to move; matter tells spacetime how to curve" and acceleration in flat space-time?
We, and all objects we currently know of, exist in spacetime, and must follow its curvature. | {
"domain": "physics.stackexchange",
"id": 71992,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, spacetime, mass, acceleration, curvature",
"url": null
} |
homework-and-exercises, newtonian-mechanics, energy-conservation, work, projectile
Thus in each case, the same amount of gravitational potential energy is converted to kinetic energy, so the final kinetic energy is $\mathrm{KE}_f=\mathrm{KE}_i+mgh$.
If she throws it straight up, the rock will go up, then fall to her level. When the rock is at the girl's level, it will have the same speed as it was launched, except now the rock is falling down. So it's equivalent to her throwing the rock directly down. Whether she throws it sideways or downwards, the change in potential energy will always be $-mgh$, which means that in each case, kinetic energy will increase by $mgh$. | {
"domain": "physics.stackexchange",
"id": 79345,
"lm_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, energy-conservation, work, projectile",
"url": null
} |
greedy-algorithms, number-theory
So here is the algorithm: Start with $x_p$ = primes > $N^{1/2}$. Find the primes $q ≤ N^{1/2}$. For each q, find the maximum gain that can be achieved using q: Either $q^k$ by adding the number $q^k$, or $p * (q^k - 1)$ by multiplying $x_p$ by $q^k$. If each optimal gain is achieved in a different way, and each gain is ≥ N/2, then we found the optimal solution.
Otherwise, we choose one set of q's that use the same $x_p$. For each of these q's: We assume that this q uses $x_p$, find the optimal solution under the restriction that no other q uses this $x_p$, and choose which q using $x_p$ gives the best total.
If there is a case where the two smallest gains add up to less than N, ask someone for a more complex solution :-) | {
"domain": "cs.stackexchange",
"id": 7066,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "greedy-algorithms, number-theory",
"url": null
} |
$\displaystyle \nu(n) := 1_{n=b\ (W)} 1_{[x/2,x]}(n) \times \ \ \ \ \ (46)$
$\displaystyle \left( \sum_{d_i | n+h_i \forall i=1,\dots,k} \mu(d_1) \dots \mu(d_k) f( \frac{\log d_1}{\log R}, \dots, \frac{\log d_k}{\log R} ) \right)^2$ | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9886682444653242,
"lm_q1q2_score": 0.8012947666000314,
"lm_q2_score": 0.8104789155369048,
"openwebmath_perplexity": 248.19796379327,
"openwebmath_score": 0.9931489825248718,
"tags": null,
"url": "https://terrytao.wordpress.com/2015/01/21/254a-notes-4-some-sieve-theory/"
} |
c#, xamarin, soap
Title: Make requests to SOAP API I would like feedback on this class library, mainly the architecture. It works very well. But maybe someone knows how to improve it.
This is a class library for working towards an external system. I reuse this class library in multiple solutions. The scope of this review is limited to "Retrieve the customer".
Since this is Xamarin I can't use the proxy class because it takes ages to load on a mobile device (related question here). Which is why I do the requests manually.
Project structure:
The main interface for the class library is the Facade class. It will call on the proper services to retrieve the data that the application requests.
public class Facade
{
WebRequester WebRequester { get; }
public Facade(string endpointUrl, string apiUser, string apiPassword)
{
WebRequester = new WebRequester(endpointUrl, apiUser, apiPassword);
} | {
"domain": "codereview.stackexchange",
"id": 30474,
"lm_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#, xamarin, soap",
"url": null
} |
c++, game
int addToInventory(std::shared_ptr<Item> item);
static std::vector<std::string> shape;
};
View.cpp
#include "View.h"
void View::drawFightScreen(std::shared_ptr<Monster> monster, int& p_hp_x_coord, int& m_hp_x_coord, int& hp_y_coord) {
//Draw border and fill with blanks
for (int i = 0; i < height; i++) {
buffer[i][0] = '|';
buffer[i][width - 1] = '|';
for(int j = 1; j < width - 1; j++)
buffer[i][j] = ' ';
}
//Draw border
for (int j = 0; j < width; j++) {
buffer[0][j] = '=';
buffer[height - 1][j] = '=';
}
int
spacing = 2,
h_start = 2,
left_width_start = width - 30;
//Draw player shape and stats
for(int i = 0; i < Player::shape.size() && h_start < height-1; i++, h_start++) {
printMessage(spacing, h_start, Player::shape[i]);
}
if(h_start + 4 >= height) {
spacing = 30;
h_start = 2;
} | {
"domain": "codereview.stackexchange",
"id": 40467,
"lm_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++, game",
"url": null
} |
data-structures, time-complexity, binary-trees, linked-lists
Title: What linked list data structure adjustments would give me fast random lookup? I am presently using an doubly linked list (C++ std::list) to hold a bunch of records that each have a unique integer identifier. The linked list is created in sorted order such that in the list, the next item always has a larger unique identifier than its predecessor.
The issue I'm facing is that occasionally I need to be able to insert an item quickly into its relative sorted position and using a plain linked list means this operation is $O(n)$ which is causing performance issues for me. Generally, this would mean I want to use something like a binary tree (C++ std::map), however, I am also depending upon the following feature of a doubly linked list for good performance:
Ability to splice a contiguous section out of one linked list into another in $O(1)$ time. (Amortized $O(1)$ or $O(\log \log n)$ would be good enough.) | {
"domain": "cs.stackexchange",
"id": 1643,
"lm_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-structures, time-complexity, binary-trees, linked-lists",
"url": null
} |
python, python-3.x, web-scraping, beautifulsoup
ul = litag.find('ul', {'class': 'lvprices left space-zero'})
if not ul is None:
for li in ul.find_all('li'):
if '$' in li.text and not 'shipping' in li.text.lower():
products[prod_idx]['Price'] = li.text.split()[0]
if 'shipping' in li.text.lower():
products[prod_idx]['Shipping'] = li.text.strip()
prod_idx += 1
return products, prod_idx
def table_print(products):
'''
Prints products in nice human-readable format
'''
print ("{:<8} {:<100} {:<15} {:<30}".format('Key', 'Product', 'Price', 'Shipping'))
for k, v in products.items():
try:
t, p, s = v
print ('{:<8} {:<100} {:<15} {:<30}'.format(k, products[k][t], products[k][p], products[k][s]))
except ValueError:
continue
def scrape_product(ebay_page):
'''
Main scraper
'''
products = {}
idx = 0 | {
"domain": "codereview.stackexchange",
"id": 27483,
"lm_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, web-scraping, beautifulsoup",
"url": null
} |
• Show your full work not just sniplet, we need a full but minimal example. Also you should not ude $$...$$ syntax in a latex document. It does not follow latex configurations. – daleif Mar 30 '19 at 17:58
• @daleif: What do I use instead? Also, I edited and added the preamble. – K.M Mar 30 '19 at 18:04
• Never even noticed you're setting the equation numbers by hand. You really should read a proper introduction to latex. You're already using amsmath, it provides many useful math constructions. Plus latex it self provides the equation environment which does exactly what you want here, automatically! – daleif Mar 30 '19 at 18:07 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9566341987633822,
"lm_q1q2_score": 0.836172173950266,
"lm_q2_score": 0.8740772335247532,
"openwebmath_perplexity": 1610.3007049320138,
"openwebmath_score": 0.8837676644325256,
"tags": null,
"url": "https://tex.stackexchange.com/questions/482302/how-do-i-align-1-and-2/482344"
} |
php, symfony2, propel
return false;
}
}
This works, but I think it could be optimized. Any ideas? You don't have to loop throught the collection since you can directly query the database or your object if it is already loaded:
class User extends BaseUser
{
public function hasRole($checkRole)
{
$userWithRole = UserQuery::create()
->filterByRole($checkRole)
->findOne();
return !is_null($userWithRole);
}
}
You can either check that $userWithRole is not null like I did or if it is an instance of User.
If your objects are already hydrated you can avoid the query by querying the Roles collection:
class User extends BaseUser
{
public function hasRole($checkRole)
{
return $this->getRoles()->contains($checkRole);
}
} | {
"domain": "codereview.stackexchange",
"id": 9926,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, symfony2, propel",
"url": null
} |
processing the nodes. Recursive Backtracker can't be done as a wall adder because doing so tends to result in a solution path that follows the outside edge, where the entire interior of the Maze is attached to the boundary by a single stem. In the real-time example, it’s like when you stand between two parallel mirrors and the image formed repeatedly. Cooley and John Tukey, is the most common fast Fourier transform (FFT) algorithm. Three simple rules are followed: 1. Merge Sort: Pseudocode. Write a C++ program to print the Fibonacci series using recursion function. First, a procedural recursion example, this one that forms all possible re-arrangements of the letters in a string. Recursion is a widely used approach to solve many programming tasks. How Does Binary Search Algorithm Works? i) Binary search algorithm works only for sorted array. Find many great new & used options and get the best deals for Data Structures : A Pseudocode Approach with C by Behrouz A. This JAVA program is to | {
"domain": "angolodeisaporifirenze.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9637799441350252,
"lm_q1q2_score": 0.8266996963081685,
"lm_q2_score": 0.8577681049901037,
"openwebmath_perplexity": 806.9678291076392,
"openwebmath_score": 0.4165516495704651,
"tags": null,
"url": "http://angolodeisaporifirenze.it/qjxw/recursion-pseudocode.html"
} |
y = 7. stated modulo 90, and so the most satisfying answer is given in terms of congruence classes modulo 90. Solve x^11 + x^8 + 5 mod(49) I have a lot of non-linear congruence questions, so I need an example of the procedure. Solving Linear Congruence by Finding an Inverse. Although Bill Cook's answer is completely, 100% correct (and based on the proof of the Chinese Remainder Theorem), one can also work with the congruences successively; we know from the CRT that a solution exists. For example, we may want to solve 7x â¡ 3 (mod 10). Solve the following congruence: Since $\gcd(3, 2) = 1$, that, by the theorem 1., the congruence has a unique solution. linear congruences (in one variable x). Proof. One or two coding examples would’ve been great, though =P, this really helpful for my project. Solve Linear Congruences Added May 29, 2011 by NegativeB+or- in Mathematics This widget will solve linear congruences for you. This entails that a set of remainders $\{0, 1, \ldots, p-1 \}$ by | {
"domain": "com.au",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9637799441350252,
"lm_q1q2_score": 0.8456945400271467,
"lm_q2_score": 0.8774767986961401,
"openwebmath_perplexity": 425.6677028017383,
"openwebmath_score": 0.7148410677909851,
"tags": null,
"url": "https://thesacrednest.com.au/blog/5zp3nvv/viewtopic.php?557c17=solve-linear-congruence"
} |
machine-learning, deep-learning
If I understand you correctly, you wish to construct a causal chain of the form (Oct-Mar)->(???)->(Apr-Sep)->Outcome. If this is the case, you can't train just on the Oct-Mar data.
There are different ways you can get at (???): | {
"domain": "datascience.stackexchange",
"id": 9815,
"lm_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, deep-learning",
"url": null
} |
particle-physics, large-hadron-collider
Title: How does the LHC separate the protium isotope to have only protons for the collision? I am preparing a presentation for my physics class about the LHC and the following question arose:
Every text about the LHC says that it collides protons from a gas of hydrogen whose electrons were previously taken away.
Can collisions be achieved with any hydrogen isotope or is it only protium that is being used?
If so, how is protium separated from the other isotopes? Given their charge and mass, as soon as you start accelerating particles around a loop with a given magnetic field to deflect them, only particles with the correct mass/charge ratio survive. In effect you have built a giant mass spectrometer - other isotopes of hydrogen are too heavy, and the Lorentz forces are insufficient to deflect them down the tunnel. | {
"domain": "physics.stackexchange",
"id": 44538,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "particle-physics, large-hadron-collider",
"url": null
} |
c#, console, graphics
/// <summary>
/// Clear the current active pixel buffer with a clear character, a
/// foreground clear color and a background clear color.
/// </summary>
/// <param name="clearPixel">The pixel to clear the pixel buffer with.</param>
public void ClearPixelBuffer(RenderingPixel clearPixel)
{
for(int i = 0; i < this.BufferSize - 1; i++)
{
this.PixelBuffer[i] = clearPixel;
}
}
/// <summary>
/// Set a pixel into the current pixel buffer using a 1D index.
/// </summary>
/// <param name="index">The index of the pixel.</param>
/// <param name="fillPixel">The pixel to fill the index with.</param>
public void SetPixel(int index, RenderingPixel fillPixel)
{
if(index < this.BufferSize)
{
this.PixelBuffer[index] = fillPixel;
}
} | {
"domain": "codereview.stackexchange",
"id": 26196,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, console, graphics",
"url": null
} |
c++, beginner, object-oriented, game
#define PLAY_AREA_SIZE 22
#define MAX_TREE_DISTANCE 5
#define FRAME_RATE_REDUCTION 50
#define LEVEL_UP_FACTOR 3
#define PLAYER_START_POSITION 0
#define PLAYER_SPEED 1
#define PLAYER_JUMP_SPAN 3
Console.h
Abstract class, I understood consoles are handled differently in different OS. Implement Console class for required OS.
#pragma once
#include "Config.h"
class Console
{
protected:
int frame_rate;
char input_value;
static const char exit_key = CONSOLE_EXIT_KEY;
static const char jump_key = CONSOLE_JUMP_KEY;
std::string output;
public:
virtual void ClearScreen() = 0;
virtual void Display(const std::string& str = "") = 0;
virtual void Sleep() = 0;
virtual void WaitForInput() = 0;
virtual bool KeyPressed() = 0;
virtual bool IsExitKey() = 0;
virtual bool IsJumpKey() = 0;
virtual void SetOutput(std::string) = 0;
virtual void DecrementFameRate() = 0;
}; | {
"domain": "codereview.stackexchange",
"id": 37977,
"lm_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, object-oriented, game",
"url": null
} |
nuclear-physics
Title: $\frac{1}{\sqrt{2}}$ (|Independent particle Model⟩+ |Strong Interaction Model⟩)? What is an adequate way to understand this simultaneously. One has the underlying assumption that matter is saturated and has the merit of being able to come up with an accurate formula for the Binding Energy (the SEMF/Bethe-Weizsäcker formula) and the other can explain the magic numbers by building up energy levels in a shell structure similar to atomic orbitals. However, the underlying assumptions appear to be completely contradictory. I am looking for a better perspective on how to understand these two simultaneously. Here comes an experimentalist point of view.These models are approximations of the real theoretical description of matter in aggregate,which at the moment is not a simple one.
To truly describe nuclear forces in the language of QCD , our current knowledge of the theory of strong interactions, is a formidable many body task. | {
"domain": "physics.stackexchange",
"id": 904,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nuclear-physics",
"url": null
} |
Is there a way to force Mathematica into this sort of separation of the integrand and unification of the sampling? If not, is there a way to make it aware of the previously calculated values and sampling points which will speed up the process?
One idea is to integrate once to get the sample points then compute the remaining integrals as sums:
sample = Transpose@
SortBy[First@Last@Reap[
NIntegrate[x (c = Cos[10 x + Cos[x]]), {x, 0, 5},
EvaluationMonitor :> Sow[{x, c}]]], #[[1]] &];
wt = ((#[[3]] - #[[1]])/2) & /@ Partition[Join[{0}, sample[[1]], {5}], 3, 1];
wt.(sample[[2]] #) & /@ {sample[[1]], sample[[1]]^2, sample[[1]]^3}
{0.0133333, 0.133275, 0.861541}
Note the accuracy is not terribly good, NIntegrate gives:
{0.0125266, 0.131514, 0.855716}
Somethings a bit off in my quick&dirty trapezoid integration but i think this can be made to work.
For this example there really is little benefit to NIntegrate's adaptive sampling so we might as well just use a uniform sampling: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9597620596782467,
"lm_q1q2_score": 0.8559264113328141,
"lm_q2_score": 0.8918110511888303,
"openwebmath_perplexity": 1677.9384802879292,
"openwebmath_score": 0.2977149188518524,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/48359/unify-the-sampling-of-nintegrate-f-g-h-w"
} |
a periodic signal , then represents the energy density of a non-periodic signal distributed along the frequency axis. S(f) = Z 1 1 X1 l=1 c le j2ˇlt T! Fourier transform has time- and frequency-domain duality. I'm having trouble determining Fourier transform of signal. Fourier Series (FS) Relation of the DFT to is Fourier Transformed. – Magnitude is independent of time (phase) shifts of x(t) – The magnitude squared of a given Fourier Series coefficient corresponds to the power present at the corresponding frequency. The sinusoidal components are integer multiples of the fundamental frequency of a periodic wave. ) A more realistic signal, from the point of view of spectroscopy, is a rectangular pulse. The amplitudes of the harmonics for this example drop off much more rapidly (in this case they go as 1/n 2 (which is faster than the 1/n decay seen in the pulse function Fourier Series (above)). X(k) = NX−1 n=0 e−j2πkn N = Nδ(k) =⇒ the rectangular pulse is “interpreted” by the DFT as a | {
"domain": "party-building.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9863631675246405,
"lm_q1q2_score": 0.808712579162333,
"lm_q2_score": 0.8198933271118221,
"openwebmath_perplexity": 914.1921820473224,
"openwebmath_score": 0.8902535438537598,
"tags": null,
"url": "https://party-building.org/xhymcs/fourier-transform-of-periodic-rectangular-pulse.html"
} |
Changing the definition of FindSum to If[MaybeSumQ[s, n, kmin0], <body>, False] can save some time on average if a solution is not known to exist and has a high enough chance of not being generatable from s. For a list s containing 10000 lists of length about 7, it took only about 0.005 seconds.
Update: compilation
I tried compiling it, using PadRight[s, Automatic, -1] to pad out the ragged array s with -1s, and using something like
amax = Table[
Replace[FirstPosition[si, -1, Length[si]],
Dispatch[{{x_} :> x - 1}]]], {i0, k}]
as well as trying handwritten While loops to check each list element one-by-one, and variations of the above with and without Withs and Replaces, and sometimes with /@s. This didn't seem to make much difference. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9693242000616578,
"lm_q1q2_score": 0.8404387426299114,
"lm_q2_score": 0.8670357580842941,
"openwebmath_perplexity": 1631.2728188724054,
"openwebmath_score": 0.3517647385597229,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/240865/scan-through-partial-tuples/240888"
} |
electromagnetism, electrical-engineering, dielectric
Title: Why does material change electrical property based on frequency of input electrical signal? I was investigating whether dry soil would conduct electricity. What I found was that at 60 Hz frequency (i.e. power line fell to the ground), dry soil is a very good conductor. But if you increase the frequency to about 1 GHz, dry soil becomes a very lossy conductor.
My question is what is the fundamental physics behind as to why these materials change electrical property depending on frequency? One possible answer is the skin effect. At high frequencies electricity is increasingly conducted only on the outer areas of the conductor. That means the bulk of the conductor is not used, and its apparent resistance is higher than it would be for lower frequencies or DC. This would apply to soild as well. The skin effect is due to opposing eddy currents induced by the changing magnetic field resulting from the alternating current. | {
"domain": "physics.stackexchange",
"id": 65640,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, electrical-engineering, dielectric",
"url": null
} |
python, strings, parsing, networking
#print "TOtal bytes we should get is", (metaInt+4080),"\n"
Don't leave dead code in comments
while lengthTotal<(metaInt+4080):
data = s.recv(8192)
lengthTotal=lengthTotal+len(data)
#print "Total length now is", lengthTotal
finalData.append(data)
In this case I suggest using StringIO rather than a list.
print finalData
string12=''.join(finalData)
Don't use meaningless names
metaLen=ord(string12[metaInt])
#print "This is multiplier", metaLen, "No of characters to read ", (metaLen*16)
metaString=string12[metaInt+1:metaInt+1+(metaLen*16)]
metaString=metaString+"\r\n"
#print "Extracted String is \n", metaString
f.write(str(metaString))
It's already a string, don't pass it to str
s.close
f.close | {
"domain": "codereview.stackexchange",
"id": 3312,
"lm_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, strings, parsing, networking",
"url": null
} |
ros, ros-control, topic
Now I am a bit confused of which type the data element points should be. Is it a list, a dict or a string? I tried several variations of the message format, always with the same result.
ROS noetic runs on Ubuntu focal.
This is my testcoding:
import rospy
import numpy
from trajectory_msgs.msg import JointTrajectory
from trajectory_msgs.msg import JointTrajectoryPoint
rospy.init_node('topic_publisher')
pub= rospy.Publisher('arm_controller/command',JointTrajectory,queue_size=2)
rate = rospy.Rate(30)
r0=0.0
r1=0.5
r3=0.0
r4=0.0
t=20.0
msg=JointTrajectory()
point=JointTrajectoryPoint()
point.positions=[r0,r1,r3,r4]
point.velocities=[0.0,0.0,0.0,0.0]
point.time_from_start=rospy.Duration(t)
msg.joint_names=["hip","shoulder","elbow","wrist"]
msg.points.append(point)
while not rospy.is_shutdown():
pub.publish(msg)
if point.positions[0] >= 2*numpy.pi :
point.positions[0] = 0.0
point.positions[0]+=0.7854*2
rate.sleep()
--- | {
"domain": "robotics.stackexchange",
"id": 35140,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-control, topic",
"url": null
} |
electrostatics, electric-fields, work, potential-energy, conventions
(C) Is the work done by the electric field $= -q\Delta V$ or just $q\Delta V$? Is work done by the field always equal to the negative change in potential energy? Does the $\Delta V$ already account for the negative? (A) When using Gauss' law for spherically symmetric systems, $r$ is evaluated at the radius of the Gaussian surface. I understand where the confusion comes from, because in the "standard" equation for the electric field, the distance $r$ is defined as the distance between the point where you're measuring the field and the point where the charge is located, and in the case of a spherical surface, you might think that measuring the field on the surface that since you are infinitesimally close to the surface, $r$ should be zero. In a real system, if you were able to get that close to the surface, you would actually have to start worrying about where the quantized charges are located, so things would get complicated close to the surface. For these types of problems, it is | {
"domain": "physics.stackexchange",
"id": 85630,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics, electric-fields, work, potential-energy, conventions",
"url": null
} |
gazebo
-- catkin 0.5.58
[rosbuild] Including /opt/ros/groovy/share/roscpp/rosbuild/roscpp.cmake
[rosbuild] Including /opt/ros/groovy/share/rospy/rosbuild/rospy.cmake
[rosbuild] WARNING: the file /opt/ros/groovy/stacks/xacro/cmake/xacro.cmake is being included automatically. This behavior is deprecated. The package containing that file should instead export the directory containing the file, and you should use rosbuild_include() to include the file explicitly.
[rosbuild] Including /opt/ros/groovy/stacks/xacro/cmake/xacro.cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jysung/ros_groovy/pr2_simulator/pr2_gazebo/build
cd build && make -j -l8
make[1]: Entering directory `/home/jysung/ros_groovy/pr2_simulator/pr2_gazebo/build'
make[2]: Entering directory `/home/jysung/ros_groovy/pr2_simulator/pr2_gazebo/build'
make[3]: Entering directory `/home/jysung/ros_groovy/pr2_simulator/pr2_gazebo/build' | {
"domain": "robotics.stackexchange",
"id": 2905,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo",
"url": null
} |
materials
If we split it right down the middle, so that we're seeing the actual force on the top plate, and the internal force along each of the pins. These two forces have to be equal, otherwise the system would be in motion, meaning the pins have yielded or fractured.
Now, to calculate the stress in the pins, we simply divide the force applied across all the pins by the total area. Because in this case, the pins are all of even cross sectional area, the stress will be divided evenly between them. The implication of this is that none of the pins should fail before the others, and any difference in their tensile strength is due to manufacturing defects or variations, so we can just multiple the tensile strength of a single pin by the number of pins to get the overall tensile strength. | {
"domain": "engineering.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": "materials",
"url": null
} |
photons, wave-particle-duality
So yes, mirror will gain momentum and the photons will lose momentum. The photons get simply redshifted.
See this answer too, please. | {
"domain": "physics.stackexchange",
"id": 28086,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "photons, wave-particle-duality",
"url": null
} |
c#, beginner, winforms
public static void writeRegistry (string appendedRegistryValue, string registyValue, bool reset)
{
const bool b = true;
if (Equals (reset, false)) {
using (RegistryKey tempKey = Registry.LocalMachine.OpenSubKey (appendedRegistryValue + registyValue, b)) {
tempKey.SetValue ("Calories Left for the Day", FoodRelated.Calories.ToString ());
}
} else {
using (RegistryKey tempKey = Registry.LocalMachine.OpenSubKey (GlobalVariables.RegistryAppenedValue + GlobalVariables.registryMainValue, b)) {
tempKey.SetValue ("Calories Left for the Day", FoodRelated.TotalCaloriesPerDay.ToString (), RegistryValueKind.String);
tempKey.SetValue ("Last Used Date", GlobalVariables.NowDate.AddDays (1).ToString ("yyyy MMMMM dd hh:mm:ss tt"), RegistryValueKind.String);
}
}
} | {
"domain": "codereview.stackexchange",
"id": 11136,
"lm_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, winforms",
"url": null
} |
general-relativity, lagrangian-formalism, string-theory, differential-geometry, gauge-theory
Title: Infinitesimal transformations for a relativistic particle The action of a free relativistic particles can be given by
$$S=\frac{1}{2}\int d\tau \left(e^{-1}(\tau)g_{\mu\nu}(X)X^\mu(\tau)X^\nu(\tau)-e(\tau)m^2\right),\tag{1.8}$$
with signature $(-,+,\ldots,+)$. If we then make an infinitesimal transformation of the parametrization parameter $\tau$ this would be
$$\tau\to\tau^\prime=\tau-\eta(\tau),\tag{1.10}$$
for an infinitesimal parameter $\eta(\tau)$.
Of course we can describe the system as it pleases us so we know that $$X^{\mu^\prime}(\tau^\prime)=X^\mu(\tau).$$ From this relation we see that $X^{\mu^\prime}(\tau)$ must be
$$X^{\mu^\prime}(\tau)
\approxeq X^{\mu^\prime}(\tau^\prime+\eta(\tau))
\approxeq X^{\mu^\prime}(\tau^\prime)+\eta(\tau)\frac{d X^{\mu^\prime}(\tau^\prime)}{d\tau^\prime}
\approxeq X^{\mu}(\tau)+\eta(\tau)\frac{d X^{\mu}(\tau)}{d\tau}$$
Which all can be summarized as | {
"domain": "physics.stackexchange",
"id": 14042,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, lagrangian-formalism, string-theory, differential-geometry, gauge-theory",
"url": null
} |
python, tkinter
def user_select(self, btn):
self.moves.append(btn)
print(self.moves)
print(self.cpu_moves)
if self.moves == self.cpu_moves:
self.clear_user_moves()
self.round += 1
self.cpu_move()
elif len(self.moves) == len(self.cpu_moves) and self.moves != self.cpu_moves:
self.clear_cpu_moves()
def clear_user_moves(self):
self.moves = []
def clear_cpu_moves(self):
self.cpu_moves = []
def cpu_move(self):
nums = [0, 1, 2, 3]
self.cpu_moves.append(choice(nums))
print(self.cpu_moves)
for i in self.cpu_moves:
root.after(200, animate(self.btns[i]))
class App(object):
def __init__(self, master):
self.master = master
game = Game()
game.cpu_move()
root.geometry("300x300") | {
"domain": "codereview.stackexchange",
"id": 37796,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, tkinter",
"url": null
} |
quantum-mechanics, photons, probability, quantum-optics
Any insight greatly appreciated!! Thanks in advance!!
EDIT: Here is a lecture where Feynman talks about this The picture is a way to compute the probability of going from an initial to a final state. In other words, we are
following the light from A to B.
The little arrows are the result of following this algorithm:
Take any path and find the time for that path; then make a complex number, or draw a little complex vector, ρeiθ, whose angle θ is proportional to the time. The number of turns per second is the frequency of the light. Now take another path; it has, for instance, a different time, so the vector for it is turned through a different angle—the angle being always proportional to the time. Take all the available paths and add on a little vector for each one | {
"domain": "physics.stackexchange",
"id": 73204,
"lm_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, photons, probability, quantum-optics",
"url": null
} |
standard form, and vectors, we shall move on to explore the! In the following illustration show the minimum distance between the two line in space line1! The perpendicular between the two lines in the following illustration show the minimum distance between parallel lines can be.! As Further Maths question vector help Further vectors help please we are to shortest distance between two parallel lines the distance between two intersecting is! Understand the meaning of skew lines and how the shortest distance between parallel. Are given by for a minimum distance between two skew lines lies along full. We are considering the two line in space between an alignment centerline and the right-of-way for. Form are given by think about that ; if the planes are not,. 0 distance -- between them two intersecting lines is zero centerline and the distance formula for two are! Minimum distance between is 0 find shortest distance between two lines in the following illustration the! | {
"domain": "psdeg-psoe.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9877587272306607,
"lm_q1q2_score": 0.8375875575429546,
"lm_q2_score": 0.8479677622198946,
"openwebmath_perplexity": 384.98217387414303,
"openwebmath_score": 0.7240748405456543,
"tags": null,
"url": "http://neda.psdeg-psoe.org/htlyz6/4c1425-shortest-distance-between-two-parallel-lines"
} |
algorithms, complexity-theory, time-complexity, computational-geometry, binary-search
If $y[i-1] < y[i] < y[i+1]$ and $y[i] > y_1$, then $i < M$.
If $y[i-1] < y[i] > y[i+1]$, then $i = M$.
If $y[i-1] > y[i] > y[i+1]$, then $M < i < m$.
If $y[i-1] > y[i] < y[i+1]$, then $i = m$.
If $y[i-1] < y[i] < y[i+1]$ and $y[i] < y_1$, then $i > m$.
The above result enables us to cut the search intervals in half each time with 2 or 3 comparisons, thus ensuring an algorithm with $O(\log n)$ time-complexity.
Exercise. What about the case when we have a sequence of $n$ distinct numbers, in which there are $t$ local maximums and $t+1$ local minimums? | {
"domain": "cs.stackexchange",
"id": 13545,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, complexity-theory, time-complexity, computational-geometry, binary-search",
"url": null
} |
quantum-field-theory, mathematical-physics, dirac-delta-distributions
What is going on here? What is going on here is that the example you give of $\frac{1}{\sqrt{x}}$ is not regular. The singular support is not empty, it is equal to $\{0\}$. So the theorem you mentioned does not apply. You trivially get an element of $\mathcal{D}'(\mathbb{R}\backslash\{0\})$ but you still have to work harder in order to get a distribution on the whole real line. | {
"domain": "physics.stackexchange",
"id": 36562,
"lm_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, mathematical-physics, dirac-delta-distributions",
"url": null
} |
acoustics, frequency, electronics, electrical-engineering
for which $p_{2} < p_{1}$ with
$$ \frac{p_{2}}{p_{1}} = \frac{\frac{p_{1}}{1.1}}{p_{1}} = \frac{1}{1.1} \approx 0.91$$
Thus in this case, $p_{2}$ is about $10 \%$ less than $p_{1}$. Now, doing the same for a distance of $r_{1} = 10 ~ m$ and the same increase $r_{2} = r_{1} + 0.1 ~ m = 10 + 0.1 ~ m = 10.1 ~ m$ we get (omitting some of the calculations)
$$ \frac{p_{1}}{p_{2}} = \frac{r_{2}}{r_{1}} \implies \frac{p_{1}}{p_{2}} = \frac{10.1}{1} \implies p_{2} = \frac{p_{1}}{10.1} $$
where in this case $$ \frac{p_{2}}{p_{1}} = \frac{\frac{p_{1}}{10.1}}{p_{1}} = \frac{10}{10.1} \approx 0.99$$
so $p_{2} \approx 0.99 p_{1}$, or just $ 1 \%$ less. For the second case, we could easily say that we are approaching (or for some practical applications we are in) the far-field, which is a different way to say that we can treat the sound field as consisting of plane waves.
The Proximity Effect
Finally, we will combine all the above to describe the "Proximity Effect". | {
"domain": "physics.stackexchange",
"id": 93871,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "acoustics, frequency, electronics, electrical-engineering",
"url": null
} |
electrical-engineering, circuits
Arc needs energy and if the flight of the switch lasts long enough the magnetic energy is used before the switch reaches position 2. In that case the inductor current is zero when the switch reaches position 2. But this obviously is an ideal switch. Its's flight time is zero, so at t=0 the inductor current is that already said 5A. The situation changes obeying a 2nd degree differential equation, because there's also a capacitor taken along.
The problem is not properly defined before one knows the initial charge of the capacitor at t=0. Of course, one can guess that it might be zero, but nothing already shown tells it. | {
"domain": "engineering.stackexchange",
"id": 4704,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrical-engineering, circuits",
"url": null
} |
pointcloud
pub.publish(*cloud_filtered);
pcl::PointCloud< pcl::PointXYZ> cloud;
pcl::fromPCLPointCloud2(*cloud_filtered, cloud);
pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients);
pcl::PointIndices::Ptr inliers (new pcl::PointIndices);
// Create the segmentation object
pcl::SACSegmentation<pcl::PointXYZ> seg;
// Optional
seg.setOptimizeCoefficients (true);
// Mandatory
seg.setModelType (pcl::SACMODEL_LINE);
seg.setMethodType (pcl::SAC_RANSAC);
seg.setDistanceThreshold (0.006);
seg.setInputCloud (cloud.makeShared ());
seg.segment (*inliers, *coefficients); | {
"domain": "robotics.stackexchange",
"id": 20519,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pointcloud",
"url": null
} |
javascript, image
thisImage.src= thisImage.getAttribute(lImgPath);
}
else
{
thisImage.src=defaultImgSource;
}
break;
case 'm':
if (thisImage.getAttribute(mlmgPath)!==null)
{
thisImage.src=thisImage.getAttribute(mlmgPath);
}
else
{
thisImage.src=defaultImgSource;
}
break;
case 's':
if (thisImage.getAttribute(slmgPath)!==null)
{
thisImage.src=thisImage.getAttribute(slmgPath);
}
else
{
thisImage.src=defaultImgSource;
}
break;
}
}
};
//---------------------------------Run The Function On Page Load ---------------------
checkRes(); | {
"domain": "codereview.stackexchange",
"id": 14892,
"lm_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, image",
"url": null
} |
performance, algorithm, sql, .net, sql-server
da . OriginGeoLocationID as DepartureGeoLocationID ,
dgl_city . Title as DepartureCityTitle ,
dgl_city . UTCOffset as DepartureCityUTCOffset ,
dgl_city . IsHub as DepartureCityIsHub ,
dgl_city . ISOCode as DepartureCityISOCode ,
dgl_city . IsExceptionEnabledAtPickup as DepartureCityIsExceptionEnabledAtPickup ,
dgl_city . IsExceptionEnabledAtDropoff as DepartureCityIsExceptionEnabledAtDropoff ,
dgl_city . IsDSTEnabled as DepartureCityIsDSTEnabled ,
dgl_country . Title as DepartureCountryTitle ,
dgl_country . ISOCOde as DepartureCountryISOCode ,
dgl_country . VAT as DepartureCountryVATInPercentage ,
dgl_country . NFSTaxRegisteration as DepartureCountryNFSTaxRegisteration ,
aa . OriginGeoLocationID as ArrivalGeoLocationID ,
agl_city . Title as ArrivalCityTitle ,
agl_city . IsHub as ArrivalCityIsHub ,
agl_city . ISOCode as ArrivalCityISOCOde ,
agl_city . IsExceptionEnabledAtPickup as ArrivalCityIsExceptionEnabledAtPickup , | {
"domain": "codereview.stackexchange",
"id": 35232,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, algorithm, sql, .net, sql-server",
"url": null
} |
of the rows of Another important fact is that the rank of a matrix does not change when we we that , and is preserved. vector of coefficients of the linear combination. , are equal because the spaces generated by their columns coincide. is the if. Advanced Algebra. Aug 2009 130 16. writewhere Matrices. matrices. J. JG89. that is, only Proposition thenso is the space Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share … Let satisfied if and only be a then. (b) If the matrix B is nonsingular, then rank(AB) = rank(A). The rank of a matrix is the order of the largest non-zero square submatrix. (b) If the matrix B is nonsingular, then rank(AB)=rank(A). Keep in mind that the rank of a matrix is Let with coefficients taken from the vector Since vector of coefficients of the linear combination. . can be written as a linear combination of the columns of vectors. is no larger than the span of | {
"domain": "discoverme.ca",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668728630677,
"lm_q1q2_score": 0.8397327989173368,
"lm_q2_score": 0.8558511524823265,
"openwebmath_perplexity": 421.7119663277017,
"openwebmath_score": 0.7659544944763184,
"tags": null,
"url": "http://discoverme.ca/tgeerpn1/archive.php?tag=d12907-rank-of-product-of-matrices"
} |
python, python-3.x
def rowToLetter(row): ...
def letterToRow(letter): ...
def getLongestSeatLength(): ...
def printSeats(): ...
print("Here is a listing of all available seats:")
printSeats()
def seatAvailable(row, col):...
def purchaseSeat(seat, cost=-1): ...
def findSeat(seatsList): ...
findSeat(seatsList)
print("Very well, ending the program.")
But should looks like this:
import csv
def rowToLetter(row): ...
def letterToRow(letter): ...
def getLongestSeatLength(): ...
def printSeats(): ...
def seatAvailable(row, col):...
def purchaseSeat(seat, cost=-1): ...
def findSeat(seatsList): ...
print("Welcome to TickeTron!")
seats = open("tickets.txt", 'r')
seatsRead = open("tickets.txt", 'r').read()
reader = csv.reader(seats)
seatsList = []
for row in list(reader): ...
print("Here is a listing of all available seats:")
printSeats()
findSeat(seatsList)
print("Very well, ending the program.") | {
"domain": "codereview.stackexchange",
"id": 34596,
"lm_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",
"url": null
} |
asteroids, crater
Theoretically if you count surface melt, it's arguably possible to have an impact that would melt 75% or more of the surface but leave 25% or less intact, but I don't consider surface melt the same thing as an impact crater, so I wouldn't count that, but that's optional.
As far as largest known craters, if we measure crater diameter against planet or moon radius (I'm going to ignore depth cause depth is easier on lower gravity bodies), but just diameter to radius.
Hershal on Mimas (the death star crater) (Props to Andy) | {
"domain": "astronomy.stackexchange",
"id": 1816,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "asteroids, crater",
"url": null
} |
crystal-structure, ionic-compounds, solid-state-chemistry, lattices
Do note that FCC to BCC phase transitions$^1$ of $\ce{KCl}$ have also been observed under (not too) high pressures ($\pu{GPa}$).
References
Mashimo, Tsutomu & Nakamura, K & Tsumoto, K & Zhang, Y & Ando, Shinji & Tonda, H. (2002). Phase transition of KCl under shock compression. Journal of Physics: Condensed Matter. 14. 10783. 10.1088/0953-8984/14/44/377. | {
"domain": "chemistry.stackexchange",
"id": 17397,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "crystal-structure, ionic-compounds, solid-state-chemistry, lattices",
"url": null
} |
ros-kinetic
I am using UBUNTU 16.04, KINETIC distro.
Originally posted by sudo_melvinyesudas on ROS Answers with karma: 54 on 2018-04-09
Post score: 1
Original comments
Comment by lucasw on 2018-04-09:
Cut and paste the text from the terminal window instead of using a screenshot.
Comment by sudo_melvinyesudas on 2018-04-09:
updated..sorry..
Your code works, you are only interpreting the return value wrong. "ret" is set if the capturing worked!
If you add a cv2.waitKey(1) after the imshow, the image is also shown. You should also only create publishers or subscribers after you created the nodehandle.
Originally posted by NEngelhard with karma: 3519 on 2018-04-09
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 30587,
"lm_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++, c++14, email, curl
Fix the bugs
The code does not currently format a message correctly because there is no "\r\n" after the date string. It also does not work if there is no "CC" address. Please read the relevant RFCs (e.g. RFC 5322) to understand how an email is properly formatted. For example, the time string format is old. Instead of using the time zone abbreviation "GMT", the preferred format is to use the timezone offset. For that reason, you could just as easily use localtime rather than gmtime.
Use C++11 version of strftime
If you set the locale appropriately, you can eliminate all of the day and month parts from dateTimeNow() and just use this:
std::string dateTimeNow()
{
const int RFC5322_TIME_LEN = 32;
time_t t;
struct tm *tm;
std::string ret;
ret.resize(RFC5322_TIME_LEN);
time(&t);
tm = localtime(&t);
strftime(&ret[0], RFC5322_TIME_LEN, "%a, %d %b %Y %H:%M:%S %z", tm);
return ret;
} | {
"domain": "codereview.stackexchange",
"id": 21726,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++14, email, curl",
"url": null
} |
human-biology, human-anatomy
There are no strict restrictions on nipple numbers in humans; they can occur anywhere on the milk line. So humans tend to have two nipples because that's what primates tend to have, because of our evolutionary history.
A better answer than this one would locate a candidate common ancestor to the primate and non-primate lineages and make reference to the embryonic development of the mammary tissue. | {
"domain": "biology.stackexchange",
"id": 3119,
"lm_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, human-anatomy",
"url": null
} |
visible-light, vision
In physics, it is a bit different. It makes no sense talking about colors in physics. In physics, you talk about wavelengths as a continous spectrum of wavelengths from very low frequency to very high frequency. Either there is a wavelength, or there is no wavelength.
Humans have named certain ranges of these wavelengths as colors red, green, blue, violet etcetera - because it makes it easier to communicate.
There is no range of wavelengths in the spectrum that has the name "black" - and in physics "black" means that there is no wave at all. At the same time, there is no wavelength that has the name "white", because white is a combination of all color frequencies at the same time. Our eyes give white another distinct value, in the same way as black. | {
"domain": "physics.stackexchange",
"id": 11151,
"lm_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, vision",
"url": null
} |
# quick question about the limit of a two-variable function as $x,y\to\infty$
$$\lim_{x,y\to\infty} \frac{x-y}{x^2+y^2}\tag{\star}$$
I'm used to do the following substitution when I see $x^2+y^2"$ and that $x,y\to 0$
$$x^2+y^2 = r^2,\;x=r\cos\theta,\;y=r\sin\theta$$
plug these values in the function and compute the limit as $r\to0$ I know I can do that because the only way for $x$ & $y$ to approach $0$ is $r$ approaching $0.$
I cannot do this substitution everytime because if for example: $(x,y)\to(-1,7)$ there's no value $u$ that guarantee me if $r\to u$ then $(x,y)\to(-1,7).$
but here since $x,y\to\infty$ I think that logically this phenomenon can only happen if $r\to\infty$ as well.
So computing $(\star)$ is the same as computing this :
$$\lim_{r\to\infty} \frac{r\cos\theta-r\sin\theta}{r^2} =\lim_{r\to\infty} \frac{\cos\theta-\sin\theta}{r}=0.$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9715639694252315,
"lm_q1q2_score": 0.8508830922761204,
"lm_q2_score": 0.8757869981319862,
"openwebmath_perplexity": 133.60280344362724,
"openwebmath_score": 0.9482593536376953,
"tags": null,
"url": "https://math.stackexchange.com/questions/2229101/quick-question-about-the-limit-of-a-two-variable-function-as-x-y-to-infty/2229165"
} |
ros, navigation, mapping, multiplemachines, hector-mapping
Title: Getting "maps" to a remote location with hector_mapping
We are working on generating maps to a remote command center. Our first premise was to have ROS running on multiple machines, with the sensors running on the robot and connecting to a roscore running on the remote PC. We almost have this working, but now realize this approach breaks if there are radio dropout zones (the roscore disconnects and the map breaks during the outage).
Next is to consider having the map generated at the robot (hector_slam running on the robot rather than the PC), but the map still needs to get transmitted back to the PC (and in real time if possible).
What does it take to get the maps transmitted to a remote location? | {
"domain": "robotics.stackexchange",
"id": 14441,
"lm_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, mapping, multiplemachines, hector-mapping",
"url": null
} |
organic-chemistry, phase
Do the methyl groups align and act like alkanes to stabilize the solid but the molecule is still small enough to have a low boiling point?
To my larger point, any advice on characteristics of materials that exhibit low liquid phase stability? Highly symmetric molecules tightly fit into crystal lattices, give high melting points for their composition. Their small surface areas minimize London dispersion forces and van der Walls forces, giving high volatility. They tend to sublime. Compare mp and bp data for cyclohexane and benzene versus their perfluorinated derivatives. Less exotic: n-octane, iso-octane, 2,2,4-trimethylpentane, 2,2,3,3-tetramethylbutane, and cubane.
http://en.wikipedia.org/wiki/Neopentane
n-Pentane and isopentane versus neopentane. | {
"domain": "chemistry.stackexchange",
"id": 970,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, phase",
"url": null
} |
Michael Barnsley, who developed it in the 1980's. Southern Ocean frontal structure and sea-ice formation rates revealed by elephant seals. Acceleration in Polar coordinate: rrÖÖ ÖÖ, Usually, Coriolis force appears as a fictitious force in a rotating coordinate system. Goh Boundary Value Problems in Cylindrical Coordinates. For regions where is nicely non-zero, we get for the Hamiltonian equations. In rectangular coordinates these numbers are interpreted, roughly speaking, as the lengths of the sides of a rectangle. If we convert complex number to its polar coordinate, we find: : Distance from to origin, i. Online Library Polar Coordinate Graph Paper Polar Coordinate Graph Paper Getting the books polar coordinate graph paper now is not type of inspiring means. 2 , 53 o) to rectangular coordinates to three decimal places. 1 rad/s 2, needs to be integrated, ω (t) = 0. Our region is the first quadrant inside a circle of radius 3, as shown to the right. a) Find the polar coordinates of the | {
"domain": "quadri-canvas.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9901401455693091,
"lm_q1q2_score": 0.8293611464062882,
"lm_q2_score": 0.8376199572530448,
"openwebmath_perplexity": 618.100891623218,
"openwebmath_score": 0.8884478807449341,
"tags": null,
"url": "http://phoc.quadri-canvas.it/polar-coordinates-example-problems-with-solutions.html"
} |
It is possible for a hypotenuse to be side-B of a triple but only if the hypotenuse $$\space C \space$$ is a multiple of $$\space 4, \space$$ i.e. from a non-primitive triple. We solve the B-function for $$\space k \space$$ and test a defined range of $$\space n$$-values to see which yield integers.
We will use $$\space C=104=4\times26\space$$ to demonstrate:
$$B=2(2n-1)k+2k^2\implies k=\frac{\sqrt{2B+(2n-1)^2)}-(2n-1)}{2} \\\text{for}\quad1\le n \le\frac{B}{4}$$
$$B=104 \implies 1\le n\le\frac{104}{4} =26 \\\text{and we find}\quad n\in \{5,26\} \implies k\in \{4,1\}$$
$$f(5,4)=(153,104,185)\qquad f(26,1)=(2703,104,2705)$$
We now solve the $$\space A$$-funcion for $$\space k \space$$ and test a defined range of $$\space n$$-values to see which yield integers.
$$A=(2n-1)^2+2(2n-1)k\implies k=\frac{A-(2n-1)^2}{2(2n-1)} \\\text{for}\quad 1\le n\le\biggl\lfloor\frac{\sqrt{A+1}}{2}\biggr\rfloor$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9814534387427591,
"lm_q1q2_score": 0.8178692876265966,
"lm_q2_score": 0.8333245932423308,
"openwebmath_perplexity": 273.90307318156545,
"openwebmath_score": 0.6703463196754456,
"tags": null,
"url": "https://math.stackexchange.com/questions/4446835/generating-pythagorean-triples-where-the-legs-are-hypotenuses-of-other-pythagore"
} |
optics
For example, when you look at electromagnetic waves at the surface of a conductor, you know that the electric field parallel to the conductor must be zero. This means that you need this superposition of the two waves at the surface: in fact, the reflected wave has a 180° phase shift precisely so that the sum of the incident and reflected wave is exactly zero at the surface of the conductor. This is actually achieved by the motion of charge carriers (electrons) inside the conductor - which in turn become the source of the reflected wave. | {
"domain": "physics.stackexchange",
"id": 18597,
"lm_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",
"url": null
} |
c#, performance, regex, file-system, search
public IEnumerable<string> EnumerateFiles(string path)
{
if (path == null) throw new ArgumentNullException(nameof(path));
return
from file in Directory.EnumerateFiles(path)
select file;
}
}
To get files I can just use SelectMany:
var nuspecFilter = FileFilterFactory.Default.Create(".nuspec");
fileSystem
.EnumerateDirectories(
@"c:\temp\projects\testproject",
directoryExclusions
.Select(DirectoryFilterFactory.Default.Create)
.ToList()
.ToAny(),
deep: true)
.SelectMany(pathEnumerator.EnumerateFiles)
.Where(nuspecFilter)
.Dump();
where ToAny is implemented as
public static Func<TElement, bool> ToAny<TElement>(this IEnumerable<Func<TElement, bool>> filters)
{
return x => filters.Any(f => f(x));
} | {
"domain": "codereview.stackexchange",
"id": 28160,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, regex, file-system, search",
"url": null
} |
Just to test, for a few values of $$n$$, I used $$a_i=1 \,\, \forall i$$, $$\lambda_1=2p_{n}$$ and $$\lambda_i=p_{n-i+1}$$. Below are given some results
$$\left( \begin{array}{ccc} n & \text{using } (1)& \text{using } (2) & \text{exact} \\ 2 & 6.1622777 & 6.1622777 & 6.1686686 \\ 3 & 10.100248 & 10.098702 & 10.101653 \\ 4 & 14.071954 & 14.070869 & 14.072521 \\ 5 & 22.045695 & 22.045297 & 22.045833 \\ 6 & 26.038680 & 26.038346 & 26.038779 \\ 7 & 34.029541 & 34.029351 & 34.029583 \\ 8 & 38.026434 & 38.026262 & 38.026467 \\ 9 & 46.021819 & 46.021705 & 46.021836 \end{array} \right)$$ AT least for these specific cases, it seems that $$(1)$$ is more than sufficient. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9748211597623861,
"lm_q1q2_score": 0.8144470325981586,
"lm_q2_score": 0.8354835391516133,
"openwebmath_perplexity": 202.83490749940054,
"openwebmath_score": 0.9664036631584167,
"tags": null,
"url": "https://math.stackexchange.com/questions/3188795/approximating-sum-i-fraca-i-lambda-lambda-i-lambda/3188837"
} |
## Decomposing a function
Write $\text{\hspace{0.17em}}f\left(x\right)=\sqrt{5-{x}^{2}}\text{\hspace{0.17em}}$ as the composition of two functions.
We are looking for two functions, $\text{\hspace{0.17em}}g\text{\hspace{0.17em}}$ and $\text{\hspace{0.17em}}h,\text{\hspace{0.17em}}$ so $\text{\hspace{0.17em}}f\left(x\right)=g\left(h\left(x\right)\right).\text{\hspace{0.17em}}$ To do this, we look for a function inside a function in the formula for $\text{\hspace{0.17em}}f\left(x\right).\text{\hspace{0.17em}}$ As one possibility, we might notice that the expression $\text{\hspace{0.17em}}5-{x}^{2}\text{\hspace{0.17em}}$ is the inside of the square root. We could then decompose the function as
We can check our answer by recomposing the functions.
$g\left(h\left(x\right)\right)=g\left(5-{x}^{2}\right)=\sqrt{5-{x}^{2}}$
Write $\text{\hspace{0.17em}}f\left(x\right)=\frac{4}{3-\sqrt{4+{x}^{2}}}\text{\hspace{0.17em}}$ as the composition of two functions. | {
"domain": "quizover.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9744347823646075,
"lm_q1q2_score": 0.8413188189854459,
"lm_q2_score": 0.8633916134888614,
"openwebmath_perplexity": 462.56427474829644,
"openwebmath_score": 0.9333246946334839,
"tags": null,
"url": "https://www.quizover.com/trigonometry/test/decomposing-a-composite-function-into-its-component-by-openstax"
} |
pipelines, infrastructure
Also, the ground does shift during freeze/thaw cycles (a.k.a. "frost heaves"), and this can cause additional stresses on pipes, even below the frost line — especially if an old leak has washed out some of the soil supporting the pipe.
There's really nothing that can be done that I know of to mitigate this for existing pipes. Any preventative measures must be put in place when the pipe is first installed. For example, putting a layer of crushed stone around a pipe helps to decouple it both mechanically and thermally from the surrounding soil. | {
"domain": "engineering.stackexchange",
"id": 690,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pipelines, infrastructure",
"url": null
} |
Up to this point i have 4 elements - $x$, $y$, $e$, $x*y$. (G is abelian therefore $x*y$ is same as $y*x$)
Now see if you can have a new element. It is given that every element is product of some numbers of $x$ and $y$.
Lets try with $x$.
$x*\circ$, what u would like to put next to $x$ ?
If you put $x$ then there is no use and you have to start over again because of $x*x=e$ now you have to start all over again.
Put y next to x. : $x*y$ (this element we already have, we want different element so try multiplying further.)
$x*y*\circ$, obviously u cant put $y$, next to $x*y$ because it will be x again: $x*y*y=x*e=x$
(you have to put alternate.)
Put $x$, next to $x*y$: $x*y*x$.
This is equal to $x*x*y$ because of commutative property. $x*y*x=x*x*y=y$.
I showed you that, once you get $x*y$ using $x$, you can not get next element by multiplying into $x*y$ further. Because of commutive property it will be again $x$ or $y$.
Similarly, if we start with $y$, we have the same issue. | {
"domain": "gateoverflow.in",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9688561685659696,
"lm_q1q2_score": 0.8031224859945975,
"lm_q2_score": 0.82893881677331,
"openwebmath_perplexity": 820.8230760357739,
"openwebmath_score": 0.673643946647644,
"tags": null,
"url": "http://gateoverflow.in/2084/gate2014-3_50?show=104320"
} |
special-relativity, inertial-frames, lorentz-symmetry
Any help? Thought experiment:
Two rings are flying toward each other at relativistic speed. The rings are perpendicular to the velocity, flat toward each other, and have very thin paper stretched across like a drum head.
Now imagine the high speed makes transverse measures smaller. Ring A sees a tiny ring B coming toward it: B punches a tiny hole in A, in the process being obliterated. But B sees A tiny, and sees A punching just a tiny hole in B.
That’s a contradiction: two different results of the same space-time events doesn’t happen.
Ditto if transverse measures get longer.
For longitudinal measures, simultaneity creates consistency between separate points. But here we see inconsistency at the same space-time point.
Must be that neither happens, because transverse measures don’t change, and the rings exactly hit each other. | {
"domain": "physics.stackexchange",
"id": 58701,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, inertial-frames, lorentz-symmetry",
"url": null
} |
javascript, jquery, design-patterns
success: function(){}}
};
return function(data,caller)
{
var settings,p;
caller = caller || 'default';
settings = callers[caller] || callers.default;
for (p in settings)
{
if (settings.hasOwnProperty(p)) ajax[p] = settings[p];
}
return $.ajax(ajax);
};
}()); | {
"domain": "codereview.stackexchange",
"id": 4995,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, design-patterns",
"url": null
} |
• That is to say, I think you have the completely right intuition, you just seem to have written down the wrong formula :) – Sebastian Schulz Apr 5 at 15:32
• Yes, that's right. Let me just point out that the way you drew the axes is called "left-handed" because it changes all of the hand-rules (such as the one from above or the one for the cross-product of vectors) ;) – Sebastian Schulz Apr 5 at 19:41 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.982823294509472,
"lm_q1q2_score": 0.8035312445680545,
"lm_q2_score": 0.8175744806385543,
"openwebmath_perplexity": 666.2515265899083,
"openwebmath_score": 0.9060838222503662,
"tags": null,
"url": "https://math.stackexchange.com/questions/3174815/lhs-and-rhs-of-stokes-theorem-not-equal"
} |
machine-learning, reinforcement-learning, dynamic-programming
Title: Confusion about the Bellman Equation In some resources, the belman equation is shown as below:
$v_{\pi}(s) = \sum\limits_{a}\pi(a|s)\sum\limits_{s',r}p(s',r|s,a)\big[r+\gamma v_{\pi}(s')\big] $
The thing that I confused is that, the $\pi$ and $p$ parts at the right hand side.
Since the probability part - $p(s',r|s,a)$- means that the probability of being at next state ($s'$), and since being at next state ($s'$) has to be done via following a specific action, the $p$ part also includes the probability of taking the specific actions inside it. | {
"domain": "datascience.stackexchange",
"id": 9104,
"lm_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, reinforcement-learning, dynamic-programming",
"url": null
} |
computer-architecture
Then, if the program counter is at 10001111 and we increment by 1, we do in fact get 10010000. To turn this word address into a byte address (so we can fetch the instruction from memory), we can simply left-shift by 4.
In short, if the program counter is at 10001111 (the word address), then the byte address of the instruction we'll actually be fetching is 1000111100. To fetch the next instruction, we can just increment the program counter by 1. | {
"domain": "cs.stackexchange",
"id": 20978,
"lm_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
} |
java, regex, template, rags-to-riches, compiler
private static final Template inmemcomp = TemplateCompiler.compile(text);
private static final Template monkeyfix = MonkeyFix.compile(text);
private static final String inMemFunc(Template t, Map<String, String> params) {
StringWriter sw = new StringWriter();
try {
t.write(sw, params);
} catch (IOException e) {
e.printStackTrace();
}
return sw.toString();
} | {
"domain": "codereview.stackexchange",
"id": 15452,
"lm_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, regex, template, rags-to-riches, compiler",
"url": null
} |
electromagnetic-radiation, atomic-physics, x-rays, medical-physics
The spectrum is measured directly out the end of the window using a SiPIN detector, energized to $40 kV /16.2 µA$, and integrated over $80$ seconds live time. The detector is approximately $8$ cm away from the tube, with a $1.6$ mm collimator immediately in front of the tube window, and a $0.1$ mm aperture immediately in front of the detector window. The space in between is open air.
It can be seen from the spectrum graph that there are Characteristic radiations involved in the form of sudden peaks besides the continuum that is due to the Bremsstrahlung radiation. The manufacturer has not provided the details regarding the spectrum behavior and I am trying to simulate the spectrum under same test conditions but my simulated spectrum shows no such peaks. Looking at the energies of those peaks (from the manufacturer's graph), it seems to be the L shell emissions $(L\alpha,$ $ L\beta)$ since the energies are in those range for Tungsten. | {
"domain": "physics.stackexchange",
"id": 45111,
"lm_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, atomic-physics, x-rays, medical-physics",
"url": null
} |
After the first turn, nobody can win. Player $$B$$ automatically wins after the third turn. Hence, A can only win after his second or his third turn. Let $$a_n$$ be the event that A wins after $$n$$ turns, and let $$b_n$$ be the event that B wins after his $$n$$-th turn. So, we want the following probability: $$P(a_2)+P(a_3\cap\overline{a_2}\cap\overline{b_2}).$$ Because B can't win in the first turn (neither can A), we have $$P(a_2)=\frac{1}{5}.$$ (In the first turn, A draws some ball and has $$5$$ left, of which one is the right one.) We also have $$P(b_2\vert\overline{a_2})=\frac{1}{3}.$$ The second probability equals $$P(a_3\cap\overline{a_2}\cap\overline{b_2})=P(a_3\vert\overline{a_2}\cap\overline{b_2}) \cdot P(\overline{a_2}\cap\overline{b_2})=P(a_3\vert\overline{a_2}\cap\overline{b_2}) \cdot P(\overline{b_2}\vert\overline{a_2})\cdot P(\overline{a_2}).$$ Now, we have three probabilities to calculate: $$P(\overline{a_2})=1-P(a_2)=\frac{4}{5}.$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540644400346,
"lm_q1q2_score": 0.8118245890323078,
"lm_q2_score": 0.828938806208442,
"openwebmath_perplexity": 377.1822568268263,
"openwebmath_score": 0.7530533671379089,
"tags": null,
"url": "https://math.stackexchange.com/questions/3176202/a-and-b-play-a-game-with-colored-balls-a-starts-with-6-balls-2-orange-2-yello/3176294"
} |
c++, beginner, strings, integer
This program I compile as follows:
g++-8 -std=c++17 -Wall -Wextra -Werror -Wpedantic -pedantic-errors -o bigInteger bigInteger.cpp You do need to include <string>. Your platform seems to bring it in as a side-effect of other includes, but you can't portably rely on that.
If there's no need to modify the contents of the string, prefer to pass by reference, to reduce copying:
bool string_contains_integer(const std::string& str)
// ^^^^^ ^
Instead of looping with indexes, learn to use iterators. If you really must use indexes, use the correct type (std::string::size_type, not unsigned long long).
We don't need to write our own loop by hand, as there's a standard algorithm that will do that for us; we just need to supply the correct predicate function:
#include <algorithm>
#include <iostream>
#include <string> | {
"domain": "codereview.stackexchange",
"id": 34394,
"lm_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, integer",
"url": null
} |
c#
return response;
}
public static Response<TResult> Evaluate<T1, T2, T3, TResult>(Func<Response<T1>> func1, Func<T1, Response<T2>> func2, Func<T2, Response<T3>> func3, Func<T3, Response<TResult>> funcResult)
{
var response = new Response<TResult>();
var result1 = func1();
if (result1)
{
var result2 = func2(result1);
if (result2)
{
var result3 = func3(result2);
if (result3)
{
response = response.WithValue(funcResult(result3));
}
}
} | {
"domain": "codereview.stackexchange",
"id": 19136,
"lm_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
} |
c++, performance
From shorthandTypes.h
#ifdef BM67__FORCE_32_BIT_SIZE
typedef uint32_t sZ;
#else
typedef size_t sZ;
#endif
typedef uint32_t u32;
typedef int32_t i32;
typedef const uint32_t cu32;
*/
#pragma once
#include "global.h"
#include "shorthandTypes.h"
#include <vector>
#include "Box2.h" | {
"domain": "codereview.stackexchange",
"id": 44901,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, performance",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.