text stringlengths 1 1.11k | source dict |
|---|---|
javascript
const getTypeOfValue = v => Array.isArray(v) ? 'array' : typeof v
const replaceValue = (originalValue, dataToMerge, encodeOutput) => {
if (typeof originalValue === 'string' && originalValue.indexOf('TMPL') === 0) {
return templateParse(originalValue)
} else {
// check if property exist, use original value if not
const mergedValue = Object.prototype.hasOwnProperty.call(dataToMerge, originalValue) ? dataToMerge[originalValue] : originalValue
return encodeOutput ? encodeURI(mergedValue) : mergedValue
}
}
const mergeArrayData = (originalValue, dataToMerge, encodeOutput) => {
const arrayOutput = []
const mergedArray = mergeCustomFields(originalValue, dataToMerge, encodeOutput)
for (i in mergedArray) {
arrayOutput.push(mergedArray[i])
}
return arrayOutput
} | {
"domain": "codereview.stackexchange",
"id": 40043,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript",
"url": null
} |
is very useful for . This function is often called the modulo operation, which can be expressed as b = a - m.*floor(a./m). Since we are dealing with individual bits in our data coding, most of our operands will be a 1 or a 0. Ebenso ist bei Architekturen mit 2er-Komplement (was heute praktisch überall so ist) eine Division von 2 signed Integer, bei dem der 1. For example, the expression 14 Mod 4 evaluates to 2. von EAN Codes verwendet, z.B. It is also to minimize the relative movement at implant bone interface. collapse all. The modulus and argument are fairly simple to calculate using trigonometry. Modulus of elasticity (MOE) testing. The Modulus is the remainder of the euclidean division of one number by another. 15.2.1.1 Bulk properties. If you have any feedback about our math content, please mail us : v4formath@gmail.com. Hierbei stehen die Assetklassen Einzelhandel, Wohnen und innerstädtische Immobilien im Vordergrund. In mathematics, the absolute value or modulus of a real number | {
"domain": "hypecinc.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9770226280828406,
"lm_q1q2_score": 0.8098919771548937,
"lm_q2_score": 0.8289388125473629,
"openwebmath_perplexity": 3574.862107216687,
"openwebmath_score": 0.7433726787567139,
"tags": null,
"url": "http://www.hypecinc.com/alison-jaggar-dktb/modulus-of-2i-a06a9f"
} |
12
For the example you give there is no reason you can't use NestList, you just need to make two simple changes: Don't use the side effect in deltaπt to get the value for θnow, give it as an explicit second argument Then you just do: NestList[{deltaπt[#[[1]], #[[2]]] + #[[1]], deltaθt[#[[2]]] + #[[2]]} &, {2, 2}, noYear] Similar changes would allow ...
12
To find out what words go well together one can sample some text from ExampleData and pick only words that have at least been mention together pairwise before. sample = ToLowerCase@StringJoin[{ ExampleData[{"Text", "AliceInWonderland"}], ExampleData[{"Text", "OnTheNatureOfThingsEnglish"}], ExampleData[{"Text", "OriginOfSpecies"}], ...
12 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9481545377452443,
"lm_q1q2_score": 0.8001429708680778,
"lm_q2_score": 0.8438951025545426,
"openwebmath_perplexity": 1839.0671512909803,
"openwebmath_score": 0.4796399772167206,
"tags": null,
"url": "http://mathematica.stackexchange.com/tags/random/hot"
} |
spectroscopy, crystal-structure, history-of-chemistry, carbon-allotropes
Would 1850's level spectroscopy or other technology of the time be able to demonstrate the crystal structures of carbon (specifically graphite and diamond) without a 1900's understanding of atomic structure? | {
"domain": "chemistry.stackexchange",
"id": 3796,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "spectroscopy, crystal-structure, history-of-chemistry, carbon-allotropes",
"url": null
} |
thermodynamics, thermal-radiation
Title: Why can't lenses transfer from colder body to a hotter one? Recently I came up with an idea of a system that apparently is able to transfer heat from a colder body to a hotter one. Obviously, this violates the 2nd rule of thermodynamics, so I would be grateful if you could point out a flaw in my understanding :)
Below is a diagram of a system. There are 2 perfectly black balls (initially both at 100K), inside 2 perfectly reflective spheres, the whole system is in a vacuum. However, parts of the spheres were removed and replaced with lenses which focus electromagnetic radiation emitted by 2 black balls. | {
"domain": "physics.stackexchange",
"id": 34628,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, thermal-radiation",
"url": null
} |
ros, rosmake, tum-ardrone
Title: Repeated rosmake failure
I'm trying to install ardrone_autonomy and tum_ardrone, both of which I have downloaded. However, whenever I use rosmake with these packages I get the error
SyntaxError: EOL while scanning string literal
CMake Error at /opt/ros/hydro/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/usr/bin/python
"/opt/ros/hydro/ardrone_autonomy/build/catkin_generated/generate_cached_setup.py")
returned error code 1
Call Stack (most recent call first):
/opt/ros/hydro/share/catkin/cmake/all.cmake:178 (safe_execute_process)
/opt/ros/hydro/share/catkin/cmake/catkinConfig.cmake:20 (include)
/opt/ros/hydro/share/ros/core/rosbuild/public.cmake:249 (find_package)
CMakeLists.txt:12 (rosbuild_init)
-- Configuring incomplete, errors occurred!
make: *** [all] Error 1
It's consistently the same error for both packages. Any ideas as to what is causing this? | {
"domain": "robotics.stackexchange",
"id": 17513,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, rosmake, tum-ardrone",
"url": null
} |
matlab, noise
In experimental sciences, noise can refer to any random fluctuations of data that hinders perception of an expected signal.
So in that context, even adding or subtracting a constant value to the entire image could be coined as noise (especially if this makes the image too bright or too dark so as to make it harder to discern objects in the image). If on the other hand we focus our attention to what is commonly described as a "noise" effect then this typically refer to some kind of perceived "dots" that occurs due to somewhat large variations in pixel values in close proximity. Since the variance is directly linked to the variation in pixel values, it is clear that an increase of the variance would increase the amount of noise (in the sense of perceived quantity of "dots"). | {
"domain": "dsp.stackexchange",
"id": 4973,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matlab, noise",
"url": null
} |
machine-learning, sports
Scoring might be more difficult to predict, but the winning team might be.
My question is whether these are good questions to throw at a machine learning algorithm. It could be that a thousand people have tried it before, but the nature of sports makes it an unreliable topic. There are a lot of good questions about Football (and sports, in general) that would be awesome to throw to an algorithm and see what comes out. The tricky part is to know what to throw to the algorithm.
A team with a good RB could just pass on 3rd-and-short just because the opponents would probably expect run, for instance. So, in order to actually produce some worthy results, I'd break the problem in smaller pieces and analyse them statistically while throwing them to the machines.
There are a few (good) websites that try to do the same, you should check'em out and use whatever they found to help you out: | {
"domain": "datascience.stackexchange",
"id": 988,
"lm_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, sports",
"url": null
} |
$$t \ge 0$$, with $$t=0$$ marking the event when the clapping finished. This function is similar to the point spread function, of course with the special case where $$g(t) = 0$$ when $$t < 0$$. This is the convolution kernel for the clapping inside this cave at the position where you stand. | {
"domain": "yaikhom.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.97241471777321,
"lm_q1q2_score": 0.8145139861584657,
"lm_q2_score": 0.8376199694135332,
"openwebmath_perplexity": 159.9402790682537,
"openwebmath_score": 0.9422643780708313,
"tags": null,
"url": "https://yaikhom.com/2020-12-16-understanding-convolution-through-echoes-and-blurring.html"
} |
### Showing Boolean combinations with ParametricPlot3D
If $A,B$ are $\mathbb R^2$ surfaces, Show[A,B] shows the union set, say as {A+B} or as ${A \cup}B$. How are differences {A-B}, {B-A} shown by a command? E.g., am curious about a cylinder ...
38 views
### Strange bug involving a list, “Objects of unequal length” [on hold]
Please let me know if I should attach all of the code. I have only decided to attach the problem code to make it easier to read. So hopefully it is enough. sortedTally is a list generated from ...
33 views
Consider: ...
22 views
### Manipulate on Mathematica Online
I am absolutely new to Mathematica Online. Using Mathematica 10.1.0.0 on my MacBook Pro (OS X 10.10.3), the following code works perfectly. ...
76 views
### 3D FEM with holes
I'm trying to create a finite element mesh with some spherical holes. To my mind the behavior is erratic but generally fails. I'm using MMA 10.0.2. In the following 3 different sets of holes are ...
29 views | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9481545289551957,
"lm_q1q2_score": 0.8040044741567955,
"lm_q2_score": 0.8479677622198946,
"openwebmath_perplexity": 1799.5184279694606,
"openwebmath_score": 0.8386775255203247,
"tags": null,
"url": "http://mathematica.stackexchange.com/questions?page=1&sort=newest&pagesize=15"
} |
proteins, protein-structure, linux, awk
1P0EA
363
R P R F S F S I A A R
. . S E E E E E E E E
1H9HI
30
G C P R I L I R C K Q
. E E . . . . B S S
Do you guys have any suggestions for me by awk or any(Linux)code? Please let me know if you require additional information. Cheers! If your file structure is consistent, one potential solution is to use GNU grep:
grep -A4 --no-group-separator -Fwf header.txt pdb.txt
This works with your example data and should be relatively fast on your 'real' data, due to -Fw ('fixed' i.e. not regex, and only match whole words) but it requires GNU grep for the --no-group-separator option (i.e. not BSD grep). | {
"domain": "bioinformatics.stackexchange",
"id": 2431,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "proteins, protein-structure, linux, awk",
"url": null
} |
hadamard, quantum-phase-estimation, phase-kickback
If the goal is to estimate $\theta$, you need to compute the $\arctan$ of the estimates of the imaginary and real parts. This makes the error for $\theta$ no longer additive and would need to be taken into account to determine the number of samples required for the desired error on $\theta$.
On another note, there are versions of QPE that make use of single Hadamard Tests and don't suffer from this problem:
Iterative Quantum Phase Estimation, which performs multiple single qubit QPEs,
or
the semi-classical QFT method that uses a non-unitary variant of the inverse QFT. | {
"domain": "quantumcomputing.stackexchange",
"id": 3267,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "hadamard, quantum-phase-estimation, phase-kickback",
"url": null
} |
ros, build, rospack, makefile, buiding-errors
Title: Rospack command not found in makefile when trying to build
Hello,
I'm a beginner with ROS and I'm having trouble to build my first packages.
If a use 'rosmake rxtools', for example, I get a 'rospack failed to build' message.
I haven't found how to solve this so I tried to manually make this package, by going to its root directory and running 'make'. When I do this, I get the following message:
sudo make
make: rospack: Command not found
Makefile:1: /cmake.mk: No such file or directory
make: *** No rule to make target `/cmake.mk'. Stop.
The Makefile looks like
include $(shell rospack find mk)/cmake.mk
So, it seems to me that the rospack command can not be found inside the makefile. I did some little test modifications in the makefile trying to verify this:
test=$(shell rospack find mk)
#include $(shell rospack find mk)/cmake.mk
all:
@echo Command result: $(test)
Which gives me this result:
make: rospack: Command not found
Command result: | {
"domain": "robotics.stackexchange",
"id": 8745,
"lm_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, build, rospack, makefile, buiding-errors",
"url": null
} |
thermodynamics, atmospheric-science, ideal-gas, boltzmann-equation
Maxwell distribution of velocities (normal distribution of velocity projections).
Random turns of velocity. It does not help at all for ergodicity of the system.
Introducing energy mixer at the bottom which enables the system to become ergodic.
Code:
# Ideal GAS model
#%matplotlib inline
#from IPython.display import HTML
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
np.random.seed(0)
# Macro parameters
x0 = 0; x1 = 16
y0 = 0; y1 = 16
# TODO set to 8000 for evaluation
N = 8400
E = 20000
L = 10
period = 30
SAVEFIG = True
MAKEANIM = False
MAXVELL = True
ENANLEMIX = 'maxwell'
ENABLETURN = True
if SAVEFIG:
plt.ioff()
# State
X = np.random.uniform((x0, y0), (x0 + 1, y0 + 1), (N, 2))
# TODO understand velocity distribution
if MAXVELL:
V = 13 * np.random.randn(N, 2)
else:
V = 30 * (np.random.rand(N, 2) - 0.5)
g = np.array([0, -9.8])
dt = 0.01 | {
"domain": "physics.stackexchange",
"id": 73396,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, atmospheric-science, ideal-gas, boltzmann-equation",
"url": null
} |
# Finding the probability that someone has the disease, given they test positive on two tests
This question is from the textbook "Introduction to Probability - Blitzstein & Hwang."
I was studying for a class when I came across an example problem that I solved, but got a slightly different result than the textbook. Here's the problem in question, paraphrased:
"Fred tests for a disease which afflicts 1% of the population. The test's accuracy is deemed 95%. He tests positive for the first test, but decides to get tested for a second time. Unfortunately, Fred also tests positive for the second test as well. Find the probability that Fred has the disease, given the evidence."
$$\$$
My approach is as follows:
Let $$D$$ be the event that Fred has the disease, $$T_1$$ be the event that the first test result is positive, and $$T_2$$ be the event that the second test is also positive. We want to find $$P(D\ |\ T_1,\ T_2)$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9566342012360932,
"lm_q1q2_score": 0.8819419580886734,
"lm_q2_score": 0.9219218348550491,
"openwebmath_perplexity": 311.0663614422447,
"openwebmath_score": 0.739641547203064,
"tags": null,
"url": "https://math.stackexchange.com/questions/2944252/finding-the-probability-that-someone-has-the-disease-given-they-test-positive-o"
} |
electric-circuits
In this way we can use both the mechanical energy produced by the 1st coil and the electrical energy produced by the 2nd coil, right?
This is a great concept if it works, right? Please throw some light on this. Pranshu Malick is correct. You cannot have a perfectly efficient closed energy system. It would be like trying to move forward in a submarine that had a thrust propeller on the back and a input "generator" propeller on the front, and expecting that once you get going the front will always power the back, and the back the front, and so on.
You are, however, correct in assuming that there is energy that would normally be wasted that can be collected and reused. In some hybrid cars part of the braking system involves engaging generators, reducing the "wasted energy" of negative acceleration. | {
"domain": "physics.stackexchange",
"id": 34387,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electric-circuits",
"url": null
} |
java, set
Title: set implementation based on an array I was supposed to implement set without using any implemented structures. I would love to know what can I correct in my code, because I am not that much satisfied with its quality, so if you have any ideas I will be so grateful!
import java.util.Objects;
abstract class Set {
Object elements[] = null;
abstract Set sum(Set set);
abstract Set antivalence(Set set);
abstract Set union(Set set);
abstract void add(Object x);
abstract void delete(Object x);
void print() {
if(this.elements == null) System.out.print("Set is empty.");
else for (Object element : this.elements) System.out.print(element);
System.out.println();
}
}
class NumSet extends Set { | {
"domain": "codereview.stackexchange",
"id": 29663,
"lm_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, set",
"url": null
} |
python, calculator
if __name__ == '__main__':
calc = Calculator()
print calc.calculate("12^2-(5*(2+2)))") # 124
print calc.calculate("2*32-4+456+(1+2)+3+(1/2*3+3+(1+2))") # 528
print calc.calculate("2 * (7+1) / (2 + 5 + (10-9)) ") # 2 Use actual comments for comments. All of those strings are kept by the interpreter. If you have to use a string as a documentation item then you should use the triple quote variety.
Use full words or at least standard abbreviations. 'EXIT_PE' <-- no one else knows what this is. The proper spelling is 'parenthesis' singular or 'parentheses' plural. 'EXITS_PARENS' would be a good name. Same goes for 'IN_NU'. 'IN_NUM' would be acceptable.
Limit the scope of your try/except blocks. In compile you are catching ValueError but is it from the call to int() or the internal methods?
Make your own exceptions. Use these instead of just throwing Exception. It helps your reader (or debugger) know where to look.
You repeat yourself in _get_last_position. | {
"domain": "codereview.stackexchange",
"id": 6991,
"lm_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, calculator",
"url": null
} |
temperature, subatomic, elementary-particles
Here v is velocity of a molecule, m its mass, k_B the Bolzman constant and T the temperature
The kinetic energy requires to have a degree of freedom, which is fine in gases. In solids the degrees of freedom are the rotations and vibrations of the molecules, as the molecules themselves are bound and thus do not have degrees of freedom in space. The same for the internal constituents of molecules, atoms , etc. They exist in a bound state and a temperature cannot be defined for them. Their only contribution comes into contributing to the mass of the molecules.
One can stretch the definition by using the kinetic energy of a particle in the formula, and derive a temperature. All one is saying is that "this would be the temperature of an ensemble of particles that have this kinetic energy on average"
Another stretch of definitions is found here.
Thus at the subatomic level there does not exist a temperature for the bound quarks and gluons as no kinetic degree of freedom exists. | {
"domain": "physics.stackexchange",
"id": 15261,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "temperature, subatomic, elementary-particles",
"url": null
} |
python, beginner, numpy, machine-learning
hasil = aktualtest - dpredict
hasil1 = (hasil / aktualtest).abs()
suma = hasil1.sum()
mape = (1/n) * suma
print("MAPE")
print(mape)
fitness = 1/(1+mape)
print(fitness)
return fitness, mape, hasilpre | {
"domain": "codereview.stackexchange",
"id": 37271,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, numpy, machine-learning",
"url": null
} |
c++, performance, machine-learning
Each programming language has its own philosophy. When I write Python, I think very differently than when I write C++. If you want to get the most out of C++, you need to align your thinking with the philosophy of C++. You need to do things the C++ way. You need to learn and use the language’s idioms. Good code looks very different in C++ than it does in Python, even when that code is supposed to be doing the same thing.
That being said…
Sometimes—quite often, in fact—you will get a performance boost from a simple direct translation to C++. Maybe not as much as you were hoping for, but the exact same algorithm usually runs at least a little bit faster when implemented in C++. And the reason for that is: the compiler.
Which brings us to the second common mistake people trying to translate code to C++ for a performance boost make: thinking that it’s all about the language. | {
"domain": "codereview.stackexchange",
"id": 42488,
"lm_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, machine-learning",
"url": null
} |
optimization suite on the back end. The cutting plane method was extended to the general integer optimization problem by Ralph Gomory, at Princeton University, in 1958. For the ones that already use Python, modeling and solving a problem with Pyomo … function of time we recommend adding an algebraic variable and constraint to Sets_expr, an expression representing the discretization It then reviews how to apply dynamic programming and branch and bound to the knapsack problem, providing intuition behind these two fundamental optimization techniques. In the case of a custom collocation method, changes will have to be made in Python is used to optimize parameters in a model to best fit data, increase profitability of a possible engineering style, or meet another form of objective which will be described mathematically with variables and equations. inputs can be specified using a Pyomo Suffix. number of free collocation points (degrees of freedom) for a particular The pyomo.dae Simulator | {
"domain": "ericlowitt.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9353465080392795,
"lm_q1q2_score": 0.8040834871274012,
"lm_q2_score": 0.8596637505099168,
"openwebmath_perplexity": 1195.4964350677812,
"openwebmath_score": 0.31521889567375183,
"tags": null,
"url": "http://www.ericlowitt.com/site/dynamic-optimization-python-7b0aea"
} |
spring is mass-less, and the force in either end equals the force of the others, but in the opposite direction (Newton’s 3rd. Both forces oppose the motion of the mass and are, therefore, shown in the negative -direction. A block of mass m sits atop a mass M which rests on a frictionless table. However, in the British system we tend to be given the weight of an object in pounds (yes, pounds are the units of weight not mass…) and so we’ll need to compute the mass for these problems. electricpete (Electrical) 19 Sep 11 12:58 I will say, my comment about this being a "textbook" problem applied to original post – determining the behavior of a SDOF system. The spring of 2020 is suggestive of how much, and how quickly, we can change as a civilization. You need to work any problem in a single unit system. This is because external acceleration does not affect the period of motion around the equilibrium point. In this equation, the total mass pulling down on the spring is actually comprised of | {
"domain": "mexproject.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.986777179803135,
"lm_q1q2_score": 0.8157803347695534,
"lm_q2_score": 0.8267117962054048,
"openwebmath_perplexity": 576.3393247798474,
"openwebmath_score": 0.5349347591400146,
"tags": null,
"url": "http://mexproject.it/jtjy/spring-mass-system-problems.html"
} |
java, algorithm
This method, instead of returning a result, stores it internally in a field, that then needs to be queried. So, each calculation needs a new instance, or be sure that the same instance ins't reused on other threads.
The now local variable is superfluous.
Deeply nested if structure. And strangely the if else chains' bodies are all the same...
Your code would really benefit from using a Range class of some sort. (I would recommend guava's range class).
\$00\$ is \$0\$ but octal.
Use of System.out.println(): return a result and let the client print it if needed. A calculation should just calculate.
The boolean methods have side effects. Method names do not suggest it.
22 pm is hard coded as end of working day? Make this an input, or configuration.
Hard coded time zone to be the default time zone. Make this an input, or configuration.
meetingData ArrayList is used as internal state. Yet client code can still mess with the contents of this list, while the calculation is running. | {
"domain": "codereview.stackexchange",
"id": 15065,
"lm_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",
"url": null
} |
assembly, interpreter, brainfuck
test eax, eax
jz error_exit_outofmemory
mov [bf_program], eax
mov esi, eax
store_program_loop:
push edi
call _fgetc
add esp, 4
cmp eax, EOF ; stop reading when end of file reached
jz short store_program_done
mov [esi], al
inc esi
jmp short store_program_loop
store_program_done:
mov [esi], byte BF_PROGRAM_END ; store program end special code
;
; close file
;
push edi
call _fclose
add esp, 4
;
; zero-initialize BF memory cells
;
push dword 1
push BF_MEMORY_CELL_AMOUNT
call _calloc
add esp, 8
test eax, eax
jz error_exit_outofmemory
mov [bf_memory], eax
;
; run the BF program
;
mov esi, eax ; current memory address
mov edi, [bf_program] ; current program address | {
"domain": "codereview.stackexchange",
"id": 22929,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "assembly, interpreter, brainfuck",
"url": null
} |
inorganic-chemistry, crystal-structure, solid-state-chemistry, crystallography, boron-family
[…]
The n.m.r, absorption for $\ce{BO4}$ groups is sharper and stronger than that for $\ce{BO3}$ groups (Bray et al., 1961; Silver & Bray, 1958) and thus the absence of sharp components in the spectrum of $\ce{B2O3}$ I precludes the presence of tetrahedral $\ce{BO4}$ groups in this material. | {
"domain": "chemistry.stackexchange",
"id": 12975,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inorganic-chemistry, crystal-structure, solid-state-chemistry, crystallography, boron-family",
"url": null
} |
for the even rows, note that each "middle" descendant is the result of the sum of a pair of the odd row above, that is:
$\displaystyle \binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}$
so:
$\displaystyle -\binom{n}{k} + \binom{n}{k+1} = -\binom{n-1}{k-1} - \binom{n-1}{k} + \binom{n-1}{k} + \binom{n-1}{k+1} = -\binom{n-1}{k-1} + \binom{n-1}{k+1}$
and:
$\displaystyle -\binom{n}{k} + \binom{n}{k+1} - \binom{n}{k+2} = -\binom{n-1}{k-1} - \binom{n-1}{k+2}$
if we go "one more term" (assuming we have that many), we have:
$\displaystyle -\binom{n}{k} + \binom{n}{k+1} - \binom{n}{k+2} + \binom{n}{k+3} =$
$\displaystyle -\binom{n-1}{k-1} + \binom{n-1}{k+3}$
where i am going with this is:
$\displaystyle \sum_{i = 1}^{j+1} (-1)^i \binom{n}{k+i-1} = -\binom{n-1}{k-1} + (-1)^{j+1} \binom{n-1}{k+j}$
(this is sort of like a telescoping sum).
if we change this around a bit, and let k = 1, and j = n-2, we get: | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854138058637,
"lm_q1q2_score": 0.8476673452498505,
"lm_q2_score": 0.8740772269642949,
"openwebmath_perplexity": 630.8812305738803,
"openwebmath_score": 0.8851572871208191,
"tags": null,
"url": "https://mathhelpboards.com/threads/prove-sum-of-1-i-times-n-choose-i-equals-0.3045/"
} |
thermal-radiation
However, there are cases like optically thin plasmas where radiation is released and each photon unlikely to be captured by another particle before it escapes. In particular, there is thermal Bremsstrahlung where free electrons and ions in a plasma will radiate energy like $P_{br} \propto n_e n_i \sqrt{T}$ where $n_e,n_i$ is the number density of electrons and ions. The total emissions will be proportional to the volume rather than the surface area as long as the density is low enough that there is not too much self-absorption; as density increases the spectrum becomes more blackbody-like. | {
"domain": "physics.stackexchange",
"id": 68042,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermal-radiation",
"url": null
} |
organic-chemistry, reaction-mechanism, alcohols
Now we could either do electrophilic addition on the alkene or do dehydration of alcohol. These two different reaction pathways yield different products. So how do we decide which reaction occurs first?
I thought that electrophilic addition could be favored because of the generation of a carbocation that could then undergo $\mathrm{S_Ni}$ reaction with the $\ce{-OH}$ generating a cyclic structure. Now if the cyclic structure were more stable than the open chain product formed by dehydration of alcohol then this reaction could be favored. But I don't know how this could be proven. In general, intramolecular reactions occur faster than their intermolecular counterparts. Most commonly this is rationalized by an entropic argument: in the case of the intermolecular reaction, two molecules (substrate + water) combine to form one (diol). This is entropically disfavored relative to the intramolecular case, in which the molecule cyclizes. | {
"domain": "chemistry.stackexchange",
"id": 12547,
"lm_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, reaction-mechanism, alcohols",
"url": null
} |
kinematics, integration, calculus
Now, considering that this has been known for about 350 years, its applications have been pretty thoroughly explored. It's a part of classical kinematics, which is a branch of physics that analyzes simple motion without any quantum effects, so there is no special significance to the Planck time with respect to this equation. | {
"domain": "physics.stackexchange",
"id": 7607,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kinematics, integration, calculus",
"url": null
} |
data-structures, proof-techniques, recursion, binary-search
$$ n \le \Biggl\lfloor\frac{high -low + 1}2\Biggr\rfloor $$
This is the part I don't understand how did we get from the equality equation to the inequality equation?
Again, when we are computing the maximum number of recursive calls performed, $r$, we say that $r$ is the smallest integer such that
$$ \frac{n}{2^r} < 1 $$
So:
$$ r > \log n $$
$$ r = \lfloor \log n \rfloor + 1 $$
Similarly, how did we get from the inequality equation to the equality equation?
Any help will be appreciated to help me understand this proof. Let me start with the first question. Since $\lfloor x \rfloor \leq x$,
$$
\left\lfloor \frac{\mathit{high}+\mathit{low}}{2} \right\rfloor - \mathit{low} \leq
\frac{\mathit{high}+\mathit{low}}{2} - \mathit{low} \leq
\frac{\mathit{high}-\mathit{low}}{2}.
$$ | {
"domain": "cs.stackexchange",
"id": 17186,
"lm_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, proof-techniques, recursion, binary-search",
"url": null
} |
special-relativity
Title: Relativity of simultaneity example in Resnick My question is a follow-up to this question about simultaneity. I would have posted it as a comment to the replies for that question, but I wasn't allowed to.
When Resnick introduces relativity of simultaneity, he gives the following example (see figure): S & S' are two inertial frames with a relative velocity v, and each with its own synchronised clocks and meter sticks. Two events leave marks, at A & B in reference frame S and at A' & B' in reference frame S'. The observers in the two frames are located at O (equidistant from A,B) and O'(equidistant from A',B'), respectively. When the event happens at A, A' coincides with A, and when the event happens at B, B' coincides with B. | {
"domain": "physics.stackexchange",
"id": 15347,
"lm_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",
"url": null
} |
calibration, kinect, openi-tracker
Comment by Miguel Prada on 2011-08-06:
It's nice to know this works with newer versions of openni :) you should answer the question yourself so that some admin can mark it as answered.
Comment by daaango on 2011-08-02:
I was hoping it would maybe be a usage error on my part or something, but I guess deep down I had an inclination that it had something to do with openni... Hopefully someone who deals with OpenNI integration in ROS will stumble upon this thread and provide some insight!
Comment by Miguel Prada on 2011-08-01:
I'm having the same issue, and the only thing I can think of is that this might be a OpenNI version issue. The only people I've heard that has been able to make it work used a more recent version of OpenNI. Hopefully when a newer version is released it will be fixed.
Looks like it has to do with the ROS version of OpenNI, as saving to file works when using the unstable version of OpenNI. Refer to the original post for a link to instructions on how to do that. | {
"domain": "robotics.stackexchange",
"id": 6206,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "calibration, kinect, openi-tracker",
"url": null
} |
algorithms, optimization, dynamic-programming
$$w_1 \cdot v_1 + w_2 \cdot v_2 + \dots + w_n \cdot v_n > c \times d,$$
where $w_i$ is the value of the $w$-field for the $i$th possible item. Note that $w_1,\dots,w_n,c,d$ are all constants (known from the problem statement), and $v_1,\dots,v_n$ are the variables, so this is a linear inequality. Similarly for the sum of the $x$-fields and $y$-fields.
Finally, the goal of maximizing the average of the $z$-fields is equivalent to maximizing the sum of the $z$-fields of the selected items. This corresponds to maximizing the following (linear) objective function:
$$z_1 \cdot v_1 + \dots + z_n \cdot v_n.$$
All of these are linear. Finally, you can express the requirement that each $v_i$ must be either 0 or 1 by adding linear inequalities $0 \le v_i \le 1$ and requiring that $v_i$ be an integer. | {
"domain": "cs.stackexchange",
"id": 7449,
"lm_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, optimization, dynamic-programming",
"url": null
} |
matlab
is for a continuous ("analogue") signal, where t may take any real value.
The second equation:
x(t) = Sin(2*pi*F*n*Ts)
(I assume that this is the correct version - it looks like you have a typo in the question ?)
is for a discrete ("sampled" or "digital") signal, where n is the sample number (integer) and Ts is the sample interval (inverse of sample rate). It has values only at the discrete sampling points where t = n * Ts.
In your MATLAB code you are effectively sampling a continuous function, so although you start off with the first (continuous) equation you end up with the second equation because you are only evaluating (sampling) the continuous function at a set of discrete points.
Note also that as Ts -> 0 the discrete version tends towards the continuous version. | {
"domain": "dsp.stackexchange",
"id": 743,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matlab",
"url": null
} |
aqueous-solution, carbohydrates, ir-spectroscopy
An additional database for IR-spectra (and more) is SDBS. There are more databases like reaxys, but it is not for free. Maybe you university or library owns an account. | {
"domain": "chemistry.stackexchange",
"id": 5625,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "aqueous-solution, carbohydrates, ir-spectroscopy",
"url": null
} |
python, python-3.x
@find.add
def find(needle: Sequence, haystack: Sequence):
# Otherwise, for generic sequences, use Boyer–Moore–Horspool.
h = len(haystack)
n = len(needle)
skip = {needle[i]: n - i - 1 for i in range(n - 1)}
i = n - 1
while i < h:
for j in range(n):
if haystack[i - j] != needle[-j - 1]:
i += skip.get(haystack[i], n)
break
else:
return i - n + 1
return -1 | {
"domain": "codereview.stackexchange",
"id": 8415,
"lm_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
} |
is being connected to the ac supply mains. Secondly, using the trigonometric Fourier series(fs) derived in Problem 1, develop a MATLAB code to confirm the correctness of the series. Next: Beats Previous: Full-Wave Rectification Index. l=linspace(0,10,100); sig=sin(2*pi*50*l); subplot(211) plot(sig); grid % u=1:9; % t=(1:) for t=1:100 if sin(2*p. The sine wave of an AC signal consists of a positive and negative going signal summing over time to zero. The continuous Fourier transform converts a time-domain signal of infinite duration into a continuous spectrum composed of an infinite number of sinusoids. 3: (a) Square wave (b) Sawtooth wave (c) Triangular wave (d) Rectangular wave (e) Full-wave rectified wave (f) Half-wave rectified wave (g) Impulse train - 1780762. (You can also hear it at Sound Beats. The previous page on Fourier Series used only real numbers. Plot the time waveform and the Fourier series coefficients. You'd expect a large DC component because rectification makes the | {
"domain": "amicidellacattolica.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109511920161,
"lm_q1q2_score": 0.811939131812706,
"lm_q2_score": 0.8244619242200081,
"openwebmath_perplexity": 603.0161213606915,
"openwebmath_score": 0.8685778975486755,
"tags": null,
"url": "http://amicidellacattolica.it/bcpi/rectified-wave-fourier-series.html"
} |
java, game, community-challenge, rock-paper-scissors
/**
* Simple conditional that prompts the user to play again, and returns true if we should.
* @param scanner the scanner to get the input from
* @return true if the user wants to continue.
*/
private static boolean playAgain(Scanner scanner) {
return ('n' != prompt(scanner, "\nPlay Again (y/n)?", 'y'));
} | {
"domain": "codereview.stackexchange",
"id": 5184,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, game, community-challenge, rock-paper-scissors",
"url": null
} |
optics, waves, interference, diffraction, superposition
Can anyone help me understand this.
( I know how the fringes appear using integration over a wave and then finding conditions of maxima and minima. I just want to understand this, by using huygens principle ). If light interferes with itself, then shouldn't we see dark and bright bands everywhere ? Why do we need a slit? Huygens' principle does not explain interference. It applies to incoherent waves. You need wave theory to describe interference which results from wave coherence.
"Else, we would get a bright and dark band pattern by simply shining light on an object." These bands exist but they move with the speed of light or alternate with the frequency of the light. They do not form a stationary interference pattern.
We need a perturbation such as a slit to get a stationary pattern. | {
"domain": "physics.stackexchange",
"id": 85192,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, waves, interference, diffraction, superposition",
"url": null
} |
java, android
TextWatcher watcher = new LocalTextWatcher();
goToRoom.addTextChangedListener(watcher);
updateButtonState();
}
void updateButtonState() {
boolean enabled = checkEditText(numberRoom);
if (enabled) {
goToRoom.setBackgroundColor(0xFFFFFFFF);
goToRoom.setEnabled(enabled);
} else {
goToRoom.setBackgroundColor(0xBBFFFFFF);
goToRoom.setEnabled(false);
}
}
private boolean checkEditText(EditText edit) {
return ((edit.getText().toString()).length() == 8 );
}
private class LocalTextWatcher implements TextWatcher {
public void afterTextChanged(Editable s) {
updateButtonState();
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
}
} Here is my list of improvements: | {
"domain": "codereview.stackexchange",
"id": 11748,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, android",
"url": null
} |
populairiteit. We can’t find it by elimination. In fact, we will in a different page that the structure of the solution set of this system is very rich. We figured out the eigenvalues for a 2 by 2 matrix, so let's see if we can figure out the eigenvalues for a 3 by 3 matrix. Vector Norms , Matrix Multiplication, Tensors, Eigendecomposition, SVD, The properties of eigenvalues and eigenvectors of square matrices will . dudamonnerat Hey guys! I started to learn C + + on my own and I would like to ask for some help about an exercise that I got from a site and I The matrix norm ||A|| = p trace (AA0) Herman Bierens November 16, 2009 Let A be an k ×m matrix. Jump to navigation Jump to search. norm that is not induced norm, namely the F r ob enius norm. If the matrix is well-conditioned then c will be near 1 and if the matrix is poorly conditioned it will be close to 0. This happens because $$\langle v,v \rangle=v^\dagger v = v^\dagger U^{-1} U v = \langle U v, U v\rangle. 1. Eigen identiteit, | {
"domain": "samuelnathankahn.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9773707973303966,
"lm_q1q2_score": 0.8123349392929621,
"lm_q2_score": 0.8311430436757312,
"openwebmath_perplexity": 1039.413431243805,
"openwebmath_score": 0.7605956196784973,
"tags": null,
"url": "http://samuelnathankahn.com/u2wv/eigen-norm.html"
} |
c++, monads
// auto val = std::get<std::complex<double>>(res.error());
// do complex calculations...
}
else
{
throw std::system_error{std::get<1>(res.error())};
// or:
// throw std::system_error{std::get<std::error_code>(res.error())};
}
}
catch (std::exception const& x)
{
// Could not calculate a real *OR* complex square root, so report error.
} | {
"domain": "codereview.stackexchange",
"id": 43610,
"lm_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++, monads",
"url": null
} |
$$\mbox{for x very large} ~ \ln x \simeq \frac{1}{1} + \frac{1}{2} +\frac{1}{3} +...+\frac{1}{x}$$
a result which can be recast rigorously in terms of limits.
18. ### lanedance
3,307
Hey sbcdave -welcome to PF!
you're generally best off posting question as new threads, gets less confusing that way, particularly for old threads.
The reminann integral (there are other more complex defintions) is interpreted as the area under of a well behaved function
With this is mind and considering it as a definite integral (over a given integral where the function is well behaved
$$\int_a^bdx \frac{1}{x} = ln(x)|_a^bdx =ln(b)-ln(a)$$
This is equivalent to the area between the function and the horizontal axis. Notice ln(x) is a a "monotonically" increasing function (ln(b)>ln(a) for all 0<a<b), so it always gives a positive area.
I don't totally undertstand your question..
But, at x = 0, f(x) = 1/x is not well defined, so to calculate the area you must use limits. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540674530016,
"lm_q1q2_score": 0.8491349862125928,
"lm_q2_score": 0.8670357477770337,
"openwebmath_perplexity": 799.0612908401829,
"openwebmath_score": 0.8864861130714417,
"tags": null,
"url": "https://www.physicsforums.com/threads/quick-question-about-integral-of-1-x.300986/"
} |
If you read this question then any $2$-maximal field $\mathbb M$ contains every square root. But such a field is not the real algebraic numbers since it contains no elements of order $3$ such as $\sqrt[3]{2}$. Of course such a field is probably larger than you want. Instead let $a_n$ be an enumeration of the positive integers (or positive primes) and let $L_0=\mathbb Q$, $L_i=L_{i-1}(\sqrt{a_i})$ then
$$L=\bigcup_{i=0}^\infty L_i$$ is your desired field. Notice that $[L_i:L_{-1}]=1,2$. Every element of $L$ is necessarily has a power of $2$ since each for each finite $n$, we have that $L_n$ is a power of $2$ extension of $L$. We also have that $L$ is not $2$-maximal because $x^2+1$ does not split over it. Notice that $L$ is an abelian extension as well, since it is generated by its degree $2$ subfields which are necessarily abelian and contained in $\mathbb Q^{\mathrm{ab}}$. So its Galois group should be | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9898303434461161,
"lm_q1q2_score": 0.8115553000984265,
"lm_q2_score": 0.8198933337131077,
"openwebmath_perplexity": 172.27335475789937,
"openwebmath_score": 0.8623108267784119,
"tags": null,
"url": "http://math.stackexchange.com/questions/292330/field-containing-all-square-roots-of-rational-numbers"
} |
performance, functional-programming, swift, immutability, battle-simulation
mutating func fireRocket(inout at victim: Cat) {
let damage = self.AP - victim.DEF
self.rockets -= 1
victim.hp -= damage
if victim.hp <= 0 {
victim.hp = victim.MAXHP
victim.lives -= 1
victim.status = victim.lives > 0 ? "Alive" : "Dead"
}
}
}
Checkpoint
Test 1:
print("Test1: No Battle struct or CatList struct:")
var mittens = Cat(name: "Mittens")
var nyan = Cat(name: "Nyan")
mittens.fireRocket(at: &nyan)
assert(nyan.hp == 30, "Failed")
print("Nyan HP is 30 after battle: \(nyan.hp)")
print() | {
"domain": "codereview.stackexchange",
"id": 23052,
"lm_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, functional-programming, swift, immutability, battle-simulation",
"url": null
} |
Now, upon matrix multiplication, we have
$$(A\cdot\hat A)_{k\ell}=\sum_{i=1}^n (-1)^{i+\ell}a_{ki} \det A(\ell\mid i)$$
If $k=\ell$, then $$(A\cdot \hat A)_{\ell\ell}=\sum_{i=1}^n(-1)^{i+\ell}a_{\ell i}\det A(\ell \mid i)=\det A$$ since we're expanding the determinant through the $\ell$-th row.
If $k\neq \ell$
$$(A\cdot\hat A)_{k\ell}=\sum_{i=1}^n (-1)^{i+\ell}a_{ki} \det A(\ell\mid i)=0$$
for it is the expansion of the determinant of the matrix $A^{k\ell}$ defined by $$(A^{k\ell})=\begin{cases} a_{ij} \text{ if }i\neq \ell\\a_{kj}\text{ if }i=\ell\end{cases}$$ which has two equal rows. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357184418846,
"lm_q1q2_score": 0.8026420635838504,
"lm_q2_score": 0.8175744739711883,
"openwebmath_perplexity": 177.7501536819416,
"openwebmath_score": 0.9739255309104919,
"tags": null,
"url": "https://math.stackexchange.com/questions/345517/why-is-it-true-that-mathrmadjaa-deta-cdot-i"
} |
homework-and-exercises, newtonian-mechanics, rotational-dynamics, friction, centripetal-force
Title: Centripetal Force Acting on a Belt and Pulley System Just a warning: I am an A Level student looking for a simple but thorough explanation. I am happy to be introduced to new ideas, but a sesquipedalian answer with formulae that aren't derived will only confuse me further.
This question concerns a past paper question given to me for a topic test on Circular Motion. I did ask my teacher about this but they weren't sure. The question asks about the following diagram of a washing machine:
The question is this:
When the motor speed is increased, the belt can start to slip on the motor pulley. Explain why the belt slips. [2]
The marking scheme is:
the belt tension is insufficient to provide the centripetal force
so the belt does not 'grip' the pulley/does not hold the belt against the pulley/there is insufficient friction to pull/push/move the belt.
alternative argument: | {
"domain": "physics.stackexchange",
"id": 90490,
"lm_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, rotational-dynamics, friction, centripetal-force",
"url": null
} |
hamiltonian-simulation, bloch-sphere
In other words, upon rotation, the $z$ coordinate of $|\psi\rangle$ remains unchanged, whereas $x$ and $y$ coordinates transform as
$$x \to x \cos(\lambda t) + y \sin(\lambda t), \\
y \to y \cos(\lambda t) - x \sin(\lambda t).$$
It follows that, if $\lambda>0$, then the rotation follows the right-hand rule (i.e. it is counterclockwise around the axes corresponding to the Hamiltonian's eigenvector).
To state this more precisely: given the standard conventions on how the Bloch representation is defined, the rotation is counterclockwise with respect to the direction going from the origin to the first eigenvector of $H$, assuming the phase difference between second and first eigenvalues of $H$ is positive. | {
"domain": "quantumcomputing.stackexchange",
"id": 2591,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "hamiltonian-simulation, bloch-sphere",
"url": null
} |
python, game, tkinter, tic-tac-toe
Now, that's obviously the easy part, but a Tic-Tac-Toe AI is actually not at all hard:
def GetHardAIMove():
# first check if you're about to win. If you are, move there
# now check if your opponent is about to win. If he is, block him
# check if any of the corners are free. If they are, go to a random one of them
# check if the middle is free. If it is, go to it
#otherwise, go to a random open spot
def GetMedAIMove():
# here's where we cheat. generate a random number between 1 and 3. if its <= 2, GetHardAIMove. otherwise, go easy.
def GetEasyAIMove():
# If you're about to win, go there
# If you're about to lose, go there
# Otherwise, go to a random spot. | {
"domain": "codereview.stackexchange",
"id": 5744,
"lm_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, game, tkinter, tic-tac-toe",
"url": null
} |
GoGraph. Does the following graph have horizontal or vertical symmetry? They sketch graphs of quadratic functions as a symmetric curve with a highest or lowest point corresponding to its vertex and an axis of symmetry passing through the vertex. The graph is shown below with the vertex at (1,-1) which is a minimum because a = 4 is positive graph opens upward. Since it is mirrored around the y-axis, the function is even. It's called the axis of symmetry. We will learn how to graph parabola's with horizontal and vertical openings. The y-intercept is the point where the graph intersects the y-axis.The x-intercepts are the points where the graph intersects the x-axis.The vertex The point that defines the minimum or maximum of a parabola. If you were to cut a quadratic equation graph vertically in half at the vertex, you would get these symmetrical sides. One of these characteristics is the axis of symmetry: a vertical line on a graph that splits the graph into two symmetrical mirror | {
"domain": "ykema.nu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9706877709445759,
"lm_q1q2_score": 0.830764243894477,
"lm_q2_score": 0.8558511488056151,
"openwebmath_perplexity": 509.46817848825987,
"openwebmath_score": 0.6092317700386047,
"tags": null,
"url": "http://ykema.nu/aigqkb/81c793-vertical-symmetry-graph"
} |
classification, text-mining, svm, naive-bayes-classifier, text
Title: Why is spam detection a classification problem and not a class modelling problem Trying to get my feet wet with machine learning on text.
The most common dataset I've seen in this space is the sms dataset with classes ham and spam.
And the most common and successful approach seems to be to model this as a binary classification problem and to use a multinomial naïve Bayes to solve it.
However I'm trying to understand why this is a binary classification problem.
I understand that the spam category has some common features associated with it across the class - such as ads, offers , free discounts and so on.
But there's no definition for what is a ham class is there? The definition of ham is - everything other than spam.
So why is this a binary classification task?
For more context - I'm trying to solve the problem of whether a news article belongs to the politics class or to the non-political class.
Suppose I have a labelled dataset of around 3000 samples in each class. | {
"domain": "datascience.stackexchange",
"id": 3052,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classification, text-mining, svm, naive-bayes-classifier, text",
"url": null
} |
python, performance, csv, http, django
Run the query:
from django.db import connection
cursor = connection.cursor()
cursor.execute(sql, params + (csv_path,))
Send the file (using StreamingHttpResponse which is new in Django 1.5):
from django.http import StreamingHttpResponse
response = StreamingHttpResponse(open(csv_path), content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=' + csv_filename
return response
3. Analysis
In my test cases (about a million records) this is around ten times as fast as processing the data through csv.writer in Python.
But there are several problems, mostly related to security: | {
"domain": "codereview.stackexchange",
"id": 44390,
"lm_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, csv, http, django",
"url": null
} |
python, snakemake
Title: Snakemake scatter-gather with wildcard AmbiguousRuleException My problem is when using Snakemake scatter-gather feature the documentation is basic and i modified my code according to mentioned in this link
rule fastq_fasta:
input:rules.trimmomatic.output.out_file
output:"data/trimmed/{sample}.fasta"
shell:"sed -n '1~4s/^@/>/p;2~4p' {input} > {output}"
rule split:
input:
"data/trimmed/{sample}.fasta"
params:
scatter_count=config["scatter_count"],
scatter_item = lambda wildcards: wildcards.scatteritem
output:
temp(scatter.split("data/trimmed/{{sample}}_{scatteritem}.fasta"))
script:
"scripts/split_files.py"
rule process:
input:"data/trimmed/{sample}_{scatteritem}.fasta"
output:"data/processed/{sample}_{scatteritem}.csv"
script:
"scripts/process.py" | {
"domain": "bioinformatics.stackexchange",
"id": 2224,
"lm_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, snakemake",
"url": null
} |
common-lisp
Title: count pairs of matching integers in a collection in Common Lisp This defines count-pairs which
takes a collection of integers
returns the number of pairs of integers that are equal to each other.
If the input collection has these integers ...
1 2 0 2 1 3 2
... then count-pairs returns 2 because
one pair can be made with the 1's
a second pair can be made with the 2's
The leftover unpaired integers do not affect the answer.
(defun make-pair (table i)
(setf
;; increment pair count:
(gethash 'pairs table) (1+ (gethash 'pairs table 0))
;; make first half of the new pair unavailable:
(gethash i table) nil)
table)
(defun keep-first-half-of-pair (table i)
(setf (gethash i table) t)
table)
(defun first-half-available-p (table i)
(gethash i table))
(defun consider-one (table i)
(if (first-half-available-p table i)
(make-pair table i)
(keep-first-half-of-pair table i))) | {
"domain": "codereview.stackexchange",
"id": 40377,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "common-lisp",
"url": null
} |
c#, iterator, extension-methods
public interface IAddEnumerable<T> : IEnumerable<T>
{
IEnumerable<T> If(Func<IEnumerable<T>, T, bool> expression);
}
By renaming this interface you could extend its usability to for instance a sequence like:
data.Remove(12).If(<predicate>);
Maybe IPredicate or something like that.
Although I know that @new, @this etc. are valid variable names, I personally always avoid them, because they distract the reading. I have never been in a situation where it was unavoidable to use them.
I understand, that you want a fluid approach, and therefore define the If method separately, but I think, I would concatenate the behavior to a single function like:
public static IEnumerable<T> AddIf<T>(this IEnumerable<T> source, T element, Func<IEnumerable<T>, T, bool> predicate)
{
return predicate(source, element) ? source.AddItem(element) : source;
} | {
"domain": "codereview.stackexchange",
"id": 38976,
"lm_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#, iterator, extension-methods",
"url": null
} |
bioinformatics, proteins, ncbi
NOTE: t values can be > 1 , the integer assigned to t
is matched by the integer assigned to p
Some few lines from the file:
9606 3329 HSPD1 NG_008915.1 NM_199440.1 NP_955472.1 reference standard
9606 3329 HSPD1 NG_008915.1 NM_002156.4 NP_002147.2 aligned: Selected
9606 3336 HSPE1 NG_008914.1 NM_002157.2 NP_002148.1 reference standard
9606 3339 HSPG2 NG_016740.1 NM_005529.6 NP_005520.4 reference standard | {
"domain": "biology.stackexchange",
"id": 5224,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bioinformatics, proteins, ncbi",
"url": null
} |
tissue
Title: Tissues in plants and animals
What is the equivalent connective tissue in plants?
Connective tissue in animals are mostly made up of collagen.
What about in plants?
Connective tissue in animals are mostly made up of collagen
Tissue is not like a simple chemical mixture ; rather tissue means a group or assemblage of cells, obeying certain defining-characteristics.
Animal connective tissues contain collagen mostly in the extracellular matrix. There are also other cell-constituents like phospholipid(membranes), DNA, RNA, etc. Blood is a liquid connective tissue which do not contain collagen in its matrix (plasma)
What is the equivalent connective tissue in plants?
Connective tissue is defined as all the tissues originated from the mesoderm layer of the animal embryo. | {
"domain": "biology.stackexchange",
"id": 6605,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "tissue",
"url": null
} |
I think the reason this is happening is that you're selecting your coefficients from a uniform distribution on the same interval. If you try running your experiment from the other direction -- that is, you look at the coefficients of a polynomial of degree $n$ with roots randomly selected from some interval $[a,b]$ (with expected value $m=\frac{b-a}{2}$) then you'd expect the coefficients to be about the same as the binomial coefficients of $(x-m)^n$. But then the $i^\text{th}$ coefficient has expected value ${n \choose i}m^{n-i} x^i$, which produces very different distributions for different values of $i$. The exception to this is if all your roots have magnitude close to $1$, in which case the $m^{n-i}$ part doesn't vary much and so you'd get coefficients more in line with the distribution you're picking from.
There are details I haven't worked out properly but I'm pretty sure this is the basic reason for what you're seeing. | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9828232914907946,
"lm_q1q2_score": 0.8211326799223712,
"lm_q2_score": 0.8354835371034368,
"openwebmath_perplexity": 265.6323066576666,
"openwebmath_score": 0.8915950655937195,
"tags": null,
"url": "https://mathoverflow.net/questions/182412/why-do-roots-of-polynomials-tend-to-have-absolute-value-close-to-1/182637"
} |
python, beginner, time
def _main():
_test(time_conversion(15, 30, '12-hour'), '3:30 PM')
_test(time_conversion(3, 30, '24-hour', 'PM'), '15:30 PM')
_test(time_conversion(13, 30, '24-hour', 'AM'), 'Invalid arguments.')
_test(time_conversion(25, 20, '12-hour'), 'Invalid arguments.')
_test(time_conversion(13, 5, '12-hour'), '1:05 PM')
_test(time_conversion(13, 5, '24-hour'), 'Invalid arguments.')
_test(time_conversion(10, 5, '24-hour', 'am'), '10:05 AM')
_test(time_conversion(10, 5, '24-hour', 'PM'), '22:05 PM')
_test(time_conversion(17, 5, '12-hour'), '5:05 PM')
_test(time_conversion(25, 32, '12-hour'), 'Invalid arguments.')
_test(time_conversion(0, 23, '12-hour'), '12:23 AM')
_test(time_conversion(12, 0, '12-hour'), '12:00 PM')
_test(time_conversion(-4, -3, '13-hour'), 'Invalid arguments.')
_test(time_conversion(1003, 29, '39 hour', None), 'Invalid arguments.')
if __name__ == '__main__':
_main() | {
"domain": "codereview.stackexchange",
"id": 45051,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, time",
"url": null
} |
forces, momentum, conservation-laws, definition
I am saying that if we use an idealised model where we take the limit of zero collision time the impulse remains a well defined quantity when the force does not.
However I must emphasise that this is an ideal never achieved in the real world. In the real collisions the force and impulse both remain well behaved functions of time and we can do our calculations using the force or using the impulse. We normally choose whichever is most convenient.
I think Mister Mystère offers another good example. If you're flying a spacecraft you might want to fire your rocket motor on a low setting for a long time or at maximum for a short time. In either case what you're normally trying to do is change your momentum, i.e. impulse, by a preset amount and it doesn't matter much how you fire your rockets as long as the impulse reaches the required value.
Response to response to edit: | {
"domain": "physics.stackexchange",
"id": 18499,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "forces, momentum, conservation-laws, definition",
"url": null
} |
meteorite
between meteoroid and asteroid is fuzzy. Some of the smallest asteroids discovered (based on absolute magnitude H) are 2008 TS26 with H = 33.2[13] and 2011 CQ1 with H = 32.1[14] both with an estimated size of one m (3 ft 3 in).[15] In April 2017, the IAU adopted an official revision of its definition, limiting size to between 30 µm and one meter in diameter, but allowing for a deviation for any object causing a meteor.[16] | {
"domain": "astronomy.stackexchange",
"id": 6637,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "meteorite",
"url": null
} |
frequency-spectrum, sampling, modulation
You can try adjusting your sampling rate and FFT size so that the resulting frequencies will fall exactly on an FFT bin. With the 3000 Hz sampling rate use a 3000 point FFT - corresponding to FFT bins every 1 Hz. With the 4000 Hz sampling rate use a 4000 point FFT - again, corresponding to FFT bins every 1 Hz.
In your 4000 Hz case, you are probably using a 4196 point FFT. The FFT bins are close to being every 1 Hz, so the frequencies at 900 Hz and 1100 Hz are almost exactly on a FFT bin and thus have almost equal amplitude. | {
"domain": "dsp.stackexchange",
"id": 5525,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "frequency-spectrum, sampling, modulation",
"url": null
} |
We could get a little stupider and say that some people will take the stairs if going to floor 2 or 3, but that gets tricky to model.
As far as the flaw in the first solution JMoravits has it right, you are over-counting the number of people who want to go the the 5th floor.
$5\cdot 4^4 + 10\cdot 4^3 + 10\cdot 4^2 + 5\cdot 4 + 1$
Which you might recognize as looking similar to the expansion of: $(x+1)^5 - x^5$ and then setting $x = 4$ Or if this is an American elevator, setting $x = 3.$
• Extraneous complications. 'Entry level' is pretty clearly not meant to be one of the ten floors. A parking level perhaps. – BruceET Aug 17 '16 at 22:46 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668717616667,
"lm_q1q2_score": 0.8434735893270184,
"lm_q2_score": 0.8596637469145054,
"openwebmath_perplexity": 305.75398856591465,
"openwebmath_score": 0.7962881922721863,
"tags": null,
"url": "https://math.stackexchange.com/questions/1894918/whats-the-probability-that-in-a-building-of-10-floors-and-5-people-in-elevator"
} |
dft
However, for signals that are not integer periodic in the FFT length, there will be a circular discontinuity between the last point and point 0. Since the FFT is circular (the only possibility with circular basis vectors), the measurement of phase at a point of discontinuity can be non-intuitive. For sinusoids that are not strict periodic in the FFT length, the sign of the phase also flips between FFT result bins, causing problems with simple linear (or other low order) phase interpolation (e.g. for estimating the phase of a sinusoid that is of a between-bins frequency).
However, an fftshift will move the phase measurement reference to the center of the FFT window (point N/2), where there isn't a discontinuity (assuming the input is continuous). The sign of the phase will no longer keep flipping, allowing easier estimation of interpolated phase. | {
"domain": "dsp.stackexchange",
"id": 2352,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dft",
"url": null
} |
ros, ros2, colcon, ros-crystal, cmake
Title: ROS2 for Win32 (x86): How to make colcon call cmake without "Win64"?
Hi,
for a couple of days now, I've been trying to compile ROS2 for x86 under Windows. Because of other dependecies, I can't use x64. I tried a lot of stuff on my Windows 10 64bit machine that didn't work (i.e. recompile all necessary stuff for x86 and so on).
Now I'm working in a vanilla Windows 10 32bit VM and one problem seems to be, that I colcon always calls cmake with "Visual Studio 15 2017 Win64" and I can't change that. I tried calling colcon witn "--cmake-args -DCMAKE_CXX_FLAGS=-m32" which did not work either.
What I did on the vanilla Win10 32bit VM:
install all prerequisites in: https://index.ros.org/doc/ros2/Installation/Crystal/Windows-Install-Binary
do all the steps from here: https://index.ros.org/doc/ros2/Installation/Crystal/Windows-Development-Setup/
(of course I installed 32bit versions of OpenSSL, Qt, and compiled a 32bit version of OpenCV).
My questions are: | {
"domain": "robotics.stackexchange",
"id": 33078,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros2, colcon, ros-crystal, cmake",
"url": null
} |
Suppose you are given a recurrence relation (say $T(n) ≤ 4S + T(n-1)$), and asked to show that $T(n)$ is $O(n)$. You can do an inductive proof using the definition of big-Oh: > **Given:** $T(n) ≤ 4S + T(n-1)$ > > **Claim:** $T(n)$ is $O(n)$, i.e. there exists $c, n_0 > 0$ such that for all > $n > n_0$, $T(n) ≤ cn$. > > **Proof:** Let $c = max(T(1), 4S)$ and let $n_0 = 0$. We will prove the claim by induction on > $n$. > > In the base case, when $n = 1$, we have $T(1) = T(1) \cdot n ≤ cn$, because $c ≥ > T(1)$. > > For the inductive step, choose $n > 1$, and suppose $T(n-1) ≤ c(n-1)$ (this > is the inductive hypothesis). We wish to show that $T(n) ≤ cn$. We have > > | | | | > |------:|-----|:---|:-------| > |$T(n)$ | $≤$ | $4S + T(n-1)$ | by assumption.| > | | $≤$ | $4S + c(n-1)$ | by inductive hypothesis.| > | | $=$ | $cn + (4S-c)$ | | > | | $≤$ | $cn$ | since $c ≥ 4S$, so $4S-c ≤ 0$ | > > as required. Note that we needed to choose $c$ carefully: we needed $c ≥ T(1)$ for the base case, | {
"domain": "cornell.edu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.986777175136814,
"lm_q1q2_score": 0.8113174676446434,
"lm_q2_score": 0.8221891305219504,
"openwebmath_perplexity": 234.0993763828404,
"openwebmath_score": 0.8676836490631104,
"tags": null,
"url": "http://www.cs.cornell.edu/courses/cs3110/2015fa/l/24b-recurrences/rec.html"
} |
plasma-physics, instrument
Title: What does a retarding field energy analyzer measure? According to [1], p.58, the current collected by a retarding field analyzer is:
$$I= qA \int^\infty_{v_{min}} vf(v)dv $$
where $q$ is the electron charge magnitude (here singly charged ions are assumed), $A$ is the effective collecting area of the probe, $v$ is the velocity of an ion perpendicular to the plane of the RFEA head, $f(v)$ is the velocity distribution function of the ions (IVDF), and $v_{min}$ is the
minimum ion velocity given by:
$$v_{min} = \sqrt{\frac{2qV_D}{M_i}}$$
with $M_i$ the ion mass, and $V_D$ the discriminator voltage.
Now, according to [2], the collected current is:
$$I = -\frac{q^2n_iA}{M} \int^\infty_{qV_D} g(E)dE$$
Where $g(E)$ is the ion energy distribution function (IEDF).
So we have the same instrument, some say it measures the IVDF, others the IEDF. I know the two are related (because $E = \frac{1}{2} M_i v^2$ = qV), but I just don't understand: | {
"domain": "physics.stackexchange",
"id": 41368,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "plasma-physics, instrument",
"url": null
} |
algorithm, c, recursion, matrix
Title: Recursive Matrix Multiplication Algorithm Can I improve on this any further. Is there a prettier way of passing the array sizes?
#include <stdio.h>
void matrix_addition(size_t n, int A[n][n], int B[n][n], int C[2*n][2*n], size_t c_start, size_t c_end) {
for(size_t i = 0; i < n; ++i) {
for(size_t j = 0; j < n; ++j) {
C[i+c_start][j+c_end] = A[i][j] + B[i][j];
}
}
}
void recursive_matrix_multiply(
size_t l, size_t n, int A[l][l], int B[l][l], int C[n][n],
size_t a_r_start, size_t a_r_end, size_t a_c_start, size_t a_c_end,
size_t b_r_start, size_t b_r_end, size_t b_c_start, size_t b_c_end
) {
if(n == 1) {
C[0][0] = A[a_r_start][a_c_start]*B[b_r_start][b_c_start];
} else {
int m = n/2;
int C1[m][m];
int C2[m][m]; | {
"domain": "codereview.stackexchange",
"id": 42380,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithm, c, recursion, matrix",
"url": null
} |
760+: Learn What GMAT Assassins Do to Score at the Highest Levels
Contact Rich at: Rich.C@empowergmat.com
# Rich Cohen
Co-Founder & GMAT Assassin
Special Offer: Save \$75 + GMAT Club Tests Free
Official GMAT Exam Packs + 70 Pt. Improvement Guarantee
www.empowergmat.com/
***********************Select EMPOWERgmat Courses now include ALL 6 Official GMAC CATs!***********************
Non-Human User
Joined: 09 Sep 2013
Posts: 7774
Re: A train travels from city A to city B. The average speed of the train [#permalink]
### Show Tags
29 Jul 2018, 07:25
Hello from the GMAT Club BumpBot!
Thanks to another GMAT Club member, I have just discovered this valuable topic, yet it had no discussion for over a year. I am now bumping it up - doing my job. I think you may find it valuable (esp those replies with Kudos). | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 1,
"lm_q1q2_score": 0.8933094074745443,
"lm_q2_score": 0.8933094074745443,
"openwebmath_perplexity": 3476.47835810479,
"openwebmath_score": 0.4615800380706787,
"tags": null,
"url": "https://gmatclub.com/forum/a-train-travels-from-city-a-to-city-b-the-average-speed-of-the-train-188007.html"
} |
javascript, css, html5
Title: My grade calculator with special weighting My school has a special 65% formal 35% informal weighting, so I made something to find what your grade would be if you added or changed a grade.
http://retep-mathwizard.github.io/gradecalc/gradecalc.html
HTML:
<!DOCTYPE html>
<html>
<head>
<title> Grade Calculator</title>
<meta charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="gradecalc.css">
<script type="text/javascript" src="gradecalc.js"></script>
</head>
<body>
<h1>Grade Calculator</h1>
<input id="ing" placeholder="Informal grades, seperate by commas."><br>
<input id="fog" placeholder="Formal grades, seperate by commas."><br>
<input type="radio" name='type' onclick="changeoldgradedisplay()" id='radio_new_grade' >New<br>
<input type="radio" name='type' onclick="changeoldgradedisplay()" id='radio_old_grade' checked>Change<br>
<input id="old_grade_input" display='none' placeholder="old grade"> | {
"domain": "codereview.stackexchange",
"id": 23926,
"lm_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, css, html5",
"url": null
} |
c#
string[] columnheaders = streamreader.ReadLine().Split(delimiter);
foreach (string columnheader in columnheaders)
{
columnHeadertoLocation[columnheader.ToUpper()] = columnLocation;
columnLocation++;
}
while (streamreader.Peek() > 0)
{
fullRow = streamreader.ReadLine();
string[] currentRowValues = fullRow.Split(delimiter);
string _NPI = currentRowValues[columnHeadertoLocation["ID"]];
string _LName = currentRowValues[columnHeadertoLocation["LNAME"]];
string _FName = currentRowValues[columnHeadertoLocation["FNAME"]];
string _devPKCR = currentRowValues[columnHeadertoLocation["DEV_SYSTEM"]]; | {
"domain": "codereview.stackexchange",
"id": 10176,
"lm_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
} |
haskell
where the first and the second argument are the starting and ending makers. Then
you could write readBetween "//" "\n" text and parse the returned content.
I'd strongly encourage you to explore ReadP, which is available in base, or some other parser (like Parsec AttoParsec). The code will be then much more readable!
You can also go without such a full-featured parser, and instead implement your own, tiny one. Already you can see in your types that the core structure of a parsing function (that doesn't handle errors or multiple possibilities) is
String -> (a, String)
That is, we parse some expected value of type a and return the rest of the string. A parser is then just an encapsulation of such an idea, like newtype Parser a = Parser (String -> (a, String)) and common operations on them. | {
"domain": "codereview.stackexchange",
"id": 31825,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "haskell",
"url": null
} |
c#, design-patterns, parsing
Refactored:
public interface IParser {
void Parse(IEnumerable<string> segments); // or whatever we are talking about ?
void Add(IList<char> map); // what is map ?
}
Let's move on to ParseObstacles.
Your state is public, is this as designed or a code smell? Again, use conventions.
public Dictionary<char, string> Dict;
public List<Entity> Entities;
private IDictionary<char, string> values; // they are values I suppose
private IList<Entity> entities;
Next, we find method Parse.
the signature is already changed by interface implementation
Only use i as an index in an iterator
perform i.Split(')') once
Dict is already renamed previously
public void Parse(string[] txtFile) {
foreach (var i in txtFile) {
if (i.Contains(")")) {
var tile = i.Split(')')[0].ToCharArray()[0];
var name = i.Split(')')[1].Trim();
Dict.Add(tile, name);
}
}
} | {
"domain": "codereview.stackexchange",
"id": 34896,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, design-patterns, parsing",
"url": null
} |
mechanical-engineering, beam, solid-mechanics
Caveats
However, from that point on there are a few caveats. Regarding:
a) bending: the maximum magnitude of normal stress you are calculating is at the top and bottom of the beam. Any point on the neutral axis should have a magnitude of zero.
b) torsional shear: The magnitude at the distance $\frac d 2$ is constant but the direction changes. see the following image:
1.
the magnitute of the maximum torsional stress is correctly:
$$\tau_t = \frac{M_u}{\frac{\pi d^3}{16}}$$
c) Shear: Although usually discarded there is also a shear stress associated with $$\tau_s = \frac{F}{\frac{\pi d^2}{4}}$$. Normally, that is very small, but also it has a constant direction (downwards in this occasion).
The point you need to take is that you need to add as vectors $\tau_s$ and $\tau_t$. Therefore, at different point in the material you'd have different values. Given image 1 and taking points A,B,C,D anti-clockwise, the resultant shear stress will be: | {
"domain": "engineering.stackexchange",
"id": 3489,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mechanical-engineering, beam, solid-mechanics",
"url": null
} |
numerical computing , numerical methods. Useful Computational Methods: The Bisection Method - Finding roots by binary search - Unlike the guess-and-check method, we start with two initial values - one value a below √Q and another value b above √Q, where Q is a positive real number. ContentsDirk DekkerZeroin in AlgolThe test functionBisectionSecant methodZeroin algorithmZeroin in MATLABReferencesDirk DekkerI. As a starting point, let's fix to be the function cosmx that you just wrote. 1997 CREWES software release CREWES Research Report — Volume 9 (1997) 18-3 Figure 2: The same cross section as above showing the result of the synthesis of an ensemble of new logs. 3 Limits of Accuracy 1. In this course, three methods are reviewed and implemented using Python and MATLAB from scratch. 1shows the several first iterations of the bisection algorithm. Designing Robot Manipulator Algorithms. It is a very simple and robust method, but it is also relatively slow. 1 Polynomial Interpolation: Method | {
"domain": "ac-immacolata.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363499098283,
"lm_q1q2_score": 0.8516715152979666,
"lm_q2_score": 0.8652240825770432,
"openwebmath_perplexity": 622.7896160604779,
"openwebmath_score": 0.4754257798194885,
"tags": null,
"url": "http://ac-immacolata.it/csxr/bisection-method-algorithm-matlab.html"
} |
eclipse
Comment by Patrick Bouffard on 2011-08-04:
I'm not an expert on the Eclipse integration stuff but if I'm not mistaken you can only create an Eclipse project from a ROS package, not a ROS stack. The directory you mention in your question (/opt/ros/diamondback/stacks/openni_kinect/) is a stack diretory..
Comment by alfa_80 on 2011-08-04:
In step 2, there is a command "make eclipse-project", but I got an error saying "make: *** No rule to make target `eclipse-project'. Stop." Any thoughts? | {
"domain": "robotics.stackexchange",
"id": 6345,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "eclipse",
"url": null
} |
python, pygame, performance
if qbtnrect.collidepoint(mse):
if pygame.mouse.get_pressed()==(1,0,0):
exit()
if tbtnrect.collidepoint(mse):
if pygame.mouse.get_pressed()==(1,0,0):
ingame='texsel'
screen.blit(backimg,(0,0))
screen.blit(text,(364,76))
screen.blit(sbtn,sbtnrect)
screen.blit(qbtn,qbtnrect)
screen.blit(tbtn,tbtnrect)
pygame.display.flip()
elif ingame=='texsel':
screen.blit(clsimg,(0,0))
inp = ask(screen, 'Texture Directory')
f=open('texdir.txt','w')
f.write(str(inp))
f.close()
pygame.display.flip() | {
"domain": "codereview.stackexchange",
"id": 4717,
"lm_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, pygame, performance",
"url": null
} |
ros, navigation, gps, navsat-transform, robot-localization
Any help
Comment by Tom Moore on 2017-01-18:
You need to specify a base_link->gps transform using static_transform_publisher. You also should change the name of your GPS frame_id from "/gps" to "gps".
Comment by modotz on 2017-01-18:
Hi Tom,
Thanks for your reply.
I changed the frame_id as you said. But could you help me with, what you mean with to specify a base_link->gps transform?
Comment by Tom Moore on 2017-01-18:
Please ask a new question.
Comment by modotz on 2017-01-19:
Thanks for your reply,
I opened a new question --> click | {
"domain": "robotics.stackexchange",
"id": 22454,
"lm_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, gps, navsat-transform, robot-localization",
"url": null
} |
ros-melodic
/opt/ros/melodic/include/message_filters/synchronizer.h:260:18: required from ‘void message_filters::Synchronizer<Policy>::connectInput(F0&, F1&) [with F0 = ros::Subscriber; F1 = ros::Subscriber; Policy = message_filters::sync_policies::ApproximateTime<serial_handler::chemsensor_<std::allocator<void> >, sensor_msgs::NavSatFix_<std::allocator<void> > >]’
/opt/ros/melodic/include/message_filters/synchronizer.h:160:18: required from ‘message_filters::Synchronizer<Policy>::Synchronizer(const Policy&, F0&, F1&) [with F0 = ros::Subscriber; F1 = ros::Subscriber; Policy = message_filters::sync_policies::ApproximateTime<serial_handler::chemsensor_<std::allocator<void> >, sensor_msgs::NavSatFix_<std::allocator<void> > >]’
/home/ardi/aerobone_ws/src/time_sub_handler/src/time_node.cpp:100:63: required from here
/opt/ros/melodic/include/message_filters/synchronizer.h:240:33: error: ‘class ros::Subscriber’ has no member named ‘registerCallback’ | {
"domain": "robotics.stackexchange",
"id": 36393,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-melodic",
"url": null
} |
apache-spark
In fact, both equal the accuracy of the multiclass classifier. | {
"domain": "datascience.stackexchange",
"id": 3979,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "apache-spark",
"url": null
} |
algorithms, greedy-algorithms, assignment-problem, experimental-analysis
Title: Efficient traffic allocation Users can be assigned to one experiment on my site. I have an API that developers use to trigger logic for each experiment. They call ExperimentEngine.run() to trigger the code logic for the experiment.
I would like to allocate users to each experiment, at the point where a user might be exposed to the logic for that experiment. I would like to assign users to experiments such that experiments implemented downstream (on pages that are usually seen last) still get users assigned to them. | {
"domain": "cs.stackexchange",
"id": 11250,
"lm_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, greedy-algorithms, assignment-problem, experimental-analysis",
"url": null
} |
python, beginner, python-3.x, homework
''' Just a testing section recommended in the assignment '''
if __name__ == "__main__":
vec1 = MyVector([1,2,5,5,5]) # vektory mohou byt i jine dimenze nez 3!
vec2 = MyVector([1,2,5,5,5])
print(vec1.get_vector()) # Test getting the list of items
dot_product = vec1*vec2 # Multiplication test
print(dot_product)
The homework was OK, but the validation system is bragging that their implementation is faster:
Message: module file vectors.py found
Result ok
Your elapsed time for 10,000 trials, vectors length 300: 0.675 seconds
Our elapsed time for the same setting: 0.383 seconds
Points: 2 out of 2 | {
"domain": "codereview.stackexchange",
"id": 22262,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, python-3.x, homework",
"url": null
} |
c#, file-system, concurrency, stream
myPath = path.ToLower().Trim('\\');
myUser = user;
myLockTime = lockTime;
}
public string User { get { return myUser; } }
public string Path { get { return myPath; } }
public DateTime LockTime { get { return myLockTime; } }
public static bool TryParse(string input, out LockEntry lockEntry)
{
lockEntry = null;
if (string.IsNullOrWhiteSpace(input))
return false;
var entryParts = input.Split('|');
if (entryParts.Length != 3)
return false;
var path = entryParts[0];
var user = entryParts[1];
var lockTimeString = entryParts[2];
DateTime lockTime;
if (string.IsNullOrWhiteSpace(path) ||
string.IsNullOrWhiteSpace(user) ||
!DateTime.TryParse(lockTimeString, CultureInfo.InvariantCulture, DateTimeStyles.None, out lockTime))
return false; | {
"domain": "codereview.stackexchange",
"id": 20797,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, file-system, concurrency, stream",
"url": null
} |
ros, xv-11-laser-driver
is this cwru-ros-pkg broken? Or am I doing something else wrong ?
(note using cturtle : echo $ROS_ROOT gives /opt/ros/cturtle/ros
$ROS_PACKAGE_PATH gives /home/user/cwru-ros-pkg/cwru-ros-pkg:/opt/ros/cturtle/stacks:/opt/ros/diamondback/stacks
Thx for any help !
Grtz,
Mvp, | {
"domain": "robotics.stackexchange",
"id": 7576,
"lm_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, xv-11-laser-driver",
"url": null
} |
imu, navigation, ekf, robot-localization, ekf-localization-node
So this will explain why this is still a right handed coordinate system with ENU convention.
Regarding your second question, yes, Robot_Localization will handle the different time delays of its input sources. All the message types have a "header" field which is populated with time stamp information. More crucially, be very careful to ensure that the covariances reported by both your camera estimate and the IMU is sensible. It would be even better if the manufacterer can provide the covariance matrix. An incorrect or inaccurate covariance matrix is another huge source of problem for those who work with robot_localization. | {
"domain": "robotics.stackexchange",
"id": 34757,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "imu, navigation, ekf, robot-localization, ekf-localization-node",
"url": null
} |
What we can do is to think of the assertion to be proven as a simple "atomic" proposition: $\,Q.\,$ Then $\,\lnot Q\,$ is the statement to the effect:
Suppose $\,\sqrt 2\,$ is not irrational. $\;$ Put differently, suppose $\,\sqrt 2\,$ is rational.$\quad(\lnot Q)$
The proof then proceeds, after having supposed $\,\lnot Q\,$ to invoke the definition of a rational number in order to arrive at a contradiction.
In a sense then, the proof amounts to a "bare-bones" proof-by-contradiction:
To prove that $\,Q,\,$ we assume $\,\lnot Q,\,$ and then we work to obtain a contradiction. Once we arrive at a contradiction, we can conclude that our assumption is false, and so we are justified in negating the false assumption: "therefore, $\lnot\lnot Q.$" $\;\;$ And this amounts to affirming the desired conclusion/assertion: therefore $Q$, since $\;\lnot \lnot Q\equiv Q$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9688561712637256,
"lm_q1q2_score": 0.8451791342273398,
"lm_q2_score": 0.8723473713594992,
"openwebmath_perplexity": 319.94743806023104,
"openwebmath_score": 0.8737570643424988,
"tags": null,
"url": "https://math.stackexchange.com/questions/443809/whats-p-and-whats-q-in-this-classic-proof-of-the-irrationality-of-sqrt-2"
} |
python, beginner, raspberry-pi
if prop == 'low' or prop == 'high':
val = float(val)
setattr(elem, prop, val)
You could access the properties directly using elem.day but because we are accessing Future's attributes using text values, it makes sense to do the same with elem's.
More classes could be useful depending on the structure of the rest of your code.
String Interpolation
There are several times in your code where you do the following:
string = 'This is ' + foo + ' some string concatenation'
String concatenation is fine in a lot of situations. However, in this case, where you need to sandwich some variable information with strings, you should use str.format(). This syntax allows you to interpolate one to many pieces of information into a string:
>>>'Hello {}!'.format('World')
'Hello World!'
Files
Use the with syntax when opening files. It automatically closes the file once the block has been left:
with open('some_file.txt', 'r') as file:
# Do something | {
"domain": "codereview.stackexchange",
"id": 7581,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, raspberry-pi",
"url": null
} |
Method 2: We use the Inclusion-Exclusion Principle.
The six people can be arranged in $6!$ ways. From these, we must exclude those arrangements in which two husbands sit in adjacent seats.
A pair of husbands sit in adjacent seats: There are $\binom{3}{2}$ ways to choose a pair of husbands who sit in adjacent seats. This gives us five objects to arrange, the block consisting of the pair of husbands and the other four people. The objects can be arranged in $5!$ orders. Within the block, the two husbands can be arranged in $2!$ orders. Hence, there are $$\binom{3}{2}5!2!$$ arrangements in which two husbands sit in adjacent seats.
However, $$6! - \binom{3}{2}5!2! = 0$$ Clearly, we have subtracted too much since the seating arrangement stated above shows it is possible to seat the three couples so that no two husbands sit in adjacent seats. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9835969689263265,
"lm_q1q2_score": 0.8064446022117833,
"lm_q2_score": 0.8198933381139645,
"openwebmath_perplexity": 314.5142027856869,
"openwebmath_score": 0.6798714995384216,
"tags": null,
"url": "https://math.stackexchange.com/questions/2397129/find-the-ways-in-which-no-husband-can-sit-next-to-another-husband"
} |
crc
We'll use a subroutine for computing the discrete log of an arbitrary polynomial $s(x)$, to the base $x$. In other words, given $s(x),p(x)$, this subroutine returns us a number $k$ such that
$$s(x) \equiv x^k \pmod{p(x)}.$$
Now we'll split $q(x)=r(x)+s(x)$ where $r(x)$ has weight $d-1$ and $s(x)$ has weight $1$. If $q(x) \equiv 0 \pmod{p(x)}$, it follows that
$$r(x) \equiv s(x) \pmod{p(x)}.$$
Thus we'll enumerate all possible polynomials $r(x)$ of degree $< n$ and weight $d-1$, and for each, we will compute the discrete logarithm of $r(x)$ to the base $x$. If the resulting discrete log, call it $k$, is less than $n$, we have found a valid $s(x)$ of weight $1$ and thus $q(x) = r(x) + x^k$ is a multiple of $p(x)$ with degree $<n$ and weight $d$, so we have found a valid solution. If the resulting discrete log is $\ge n$, we discard this possibility $r(x)$ and continue enumerating other values of $r(x)$. | {
"domain": "cs.stackexchange",
"id": 8169,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "crc",
"url": null
} |
black-hole, event-horizon
From the point of view of the person far from the black hole, that last second never ends. And so you don't see the clock reach or cross the event horizon.
But pretty soon you can't see the clock. This is because the light emitted by the clock gets more and more stretched. Soon the wavelength of the light grows from nanometres to millimeters, to kilometres to light years to billions of light years. The energy carried by each photon becomes less and less and less, until nothing more can be seen. | {
"domain": "astronomy.stackexchange",
"id": 7025,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "black-hole, event-horizon",
"url": null
} |
Now $3^{n-1} (3 -2) = \frac{n}{C}$ so $3^{n-1} = \frac{n}{C}$. So $(n-1) \ln(3) = \ln(n) - \ln(C)$ so
$n - \ln(n) = K$,
where $K=\ln(3) - \ln(C)$.
But I cannot see why it would be a solution.
-
Please make the body of your question self-contained. The title is not part of the message, it's an indexing feature. Books don't ask you to read the spine in order to understand the first page. – Arturo Magidin Aug 14 '11 at 22:34
Either I am missing something or the question and its title are 100% unrelated. – Did Aug 14 '11 at 23:05
Showing your calculations is good, but you never quite said what it is that you would like to show. In your table, the label should not be $T(n)$, you are listing $T(\log_2 N)$. By the way, there is a little error, $62$ should be $64$. If you make the question clear, I can give a sample solution. – André Nicolas Aug 15 '11 at 1:17 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9814534338604444,
"lm_q1q2_score": 0.809170988729482,
"lm_q2_score": 0.8244619263765706,
"openwebmath_perplexity": 224.44363285127676,
"openwebmath_score": 0.9530953168869019,
"tags": null,
"url": "http://math.stackexchange.com/questions/57471/a-n-c-alphan-where-c-in-r-a-general-solution-to-difference-equation-a/57513"
} |
strings, rust
Title: Rust - insert into piecetable I'm writing a piece table library in Rust with the structures:
#[derive(Default)]
struct Piece {
additional: bool,
offset: usize,
length: usize,
}
and
/// PieceTable contains the additional, original buffers and a vector of pieces.
/// It also maintains a length variable.
pub struct PieceTable {
table: VecDeque<Piece>,
orig_buffer: String,
add_buffer: String,
length: usize,
} | {
"domain": "codereview.stackexchange",
"id": 40023,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "strings, rust",
"url": null
} |
ros, rqt-reconfigure, dynamic-reconfigure
Title: Use PTZ controls on Axis Camera
I have an Axis camera (AXIS M5014 PTZ) and I am using axis_camera package to get the video stream. The video stream using axis.py works perfectly fine.
Now I am trying to use axis_ptz.py node to control PTZ parameters of the camera. Firstly, there is barely any documentation on this page explaining how you can actually set the parameters for dynamic configuration. After some research I found that rosrun rqt_reconfigure rqt_reconfigure opens a GUI for you to set parameters on different available variables. Now, only "pan" variable works, and "tilt" doesn't do anything. Are there and examples/tutorials/documentation that can help me out? | {
"domain": "robotics.stackexchange",
"id": 19861,
"lm_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, rqt-reconfigure, dynamic-reconfigure",
"url": null
} |
c++, beginner, multithreading, concurrency, producer-consumer
Your questions
I see no leaks. With no naked new or any C Library allocations, and no calls to std::unique_ptr::release(), every object is accounted for. That assessment is corroborated by a few runs under Valgrind.
Scoped locks such as std::unique_lock or std::lock_guard are entirely appropriate here. I prefer not to unlock() them if avoidable, as mentioned above.
We could buffer input, and push in batches, but only if it's acceptable for the reader to get stale data. For most platforms, lock acquisition is an important performance consideration, and much work has been put into optimising them, particularly in low-contention scenarios such as this. So I wouldn't be concerned about the overhead unless profiling identifies it as a problem.
There should be no starvation as long as we don't hold the lock during the blocking operations. There cannot be deadlock if we only ever hold one lock at a time. | {
"domain": "codereview.stackexchange",
"id": 44933,
"lm_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, multithreading, concurrency, producer-consumer",
"url": null
} |
We claim without proving:
1. Every accumulation point is a closure point.
2. A closure point is either an accumulation point or an isolated point.
3. $$\closure A = A \cup A'$$.
4. A set is closed if and only if it contains all its accumulation points.
5. In other words, a set is closed if and only if its complement doesn’t contain any of its accumulation points.
6. A singleton set $$\{ x \}$$ doesn’t have any accumulation points.
7. A set consisting of isolated points doesn’t have any accumulation points.
## 2.2.9. Exterior#
Definition 2.24 (Exterior point)
A point $$x$$ is called exterior to a set $$A \subseteq \RR$$ if it is interior to $$RR \setminus A$$.
Definition 2.25 (Exterior)
The set of all exterior points of $$A$$ is called its exterior.
## 2.2.10. Open Cover#
Definition 2.26 (Open cover)
A collection $$\OOO$$ of open sets is called an open cover or open covering of a set $$A$$ if for every $$x \in A$$, there exists a set $$O \in \OOO$$ such that $$x \in O$$. | {
"domain": "indigits.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9953181784477977,
"lm_q1q2_score": 0.8066844001606831,
"lm_q2_score": 0.8104789178257654,
"openwebmath_perplexity": 211.51166746507715,
"openwebmath_score": 0.9660255908966064,
"tags": null,
"url": "https://convex.indigits.com/basic_real_analysis/topology.html"
} |
computability, terminology
Say, I have a certain irrational number e that I get get closer and closer to with a computer and I want to determine if there is a particular digit d appearing after a certain position. Or what about the halting problem (give a program and ask 'will the computer ever halt?')? Are these problems semi-computable problems or noncomputable? Intuitively, a set of numbers is computable or decidable or recursive if there is an algorithm deciding membership for the set. A set of numbers is semidecidable or recursively enumerable (r.e.) if it has verifiable "proofs" of membership. For example, the set of programs which halt is semidecidable, since given a program $A$ and a time bound $t$, one can check that $A$ halts after at most $t$ steps. But this set is not computable, since without the time bound, we don't know how long to wait for. (That's an intuitive explanation; you can google for a proof that the halting problem is not decidable.) | {
"domain": "cs.stackexchange",
"id": 546,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computability, terminology",
"url": null
} |
First, there is no true randomness in today's computer-generated "random numbers." All pseudorandom generators use deterministic methods. (Possibly, quantum computers will change that.)
The difficult task is to contrive algorithms that produce output that cannot meaningfully be distinguished from data coming from a truly random source.
You are right that setting a seed starts you at a particular known starting point in a long list of pseudorandom numbers. For the generators implemented in R, Python, and so on, the list is hugely long. Long enough that not even the largest feasible simulation project will exceed the 'period' of the generator so that values begin to re-cycle. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9496693688269985,
"lm_q1q2_score": 0.8052889985869242,
"lm_q2_score": 0.8479677506936879,
"openwebmath_perplexity": 688.0081092411268,
"openwebmath_score": 0.626780092716217,
"tags": null,
"url": "https://stats.stackexchange.com/questions/354373/what-exactly-is-a-seed-in-a-random-number-generator"
} |
javascript, beginner, html, to-do-list
Title: Simple front end TODO list I have implemented a very basic TODO List with no database or backend support. Though I have coded in C++ and Python before, this is my first HTML and JavaScript code. Please review the code and let me know where it can be improved.
var numericalID = 1
function addNewTask() {
var container = document.getElementById("taskContainer")
var checkbox = document.createElement('input');
checkbox.type = "checkbox";
checkbox.name = "name";
checkbox.value = "value";
var idStr="id:"+numericalID
checkbox.id = idStr
checkbox.addEventListener('change',function() {
var idSplitArray=this.id.split(':')
var labelStr="label:"+idSplitArray[1]
var labelTask=document.getElementById(labelStr)
//alert(idSplitArray)
if(this.checked) {
labelTask.style.setProperty("text-decoration", "line-through");
} else
{
labelTask.style.setProperty("text-decoration","none");
}}) | {
"domain": "codereview.stackexchange",
"id": 33428,
"lm_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, html, to-do-list",
"url": null
} |
quantum-field-theory
$$A^{\mu}~=~(\Phi,{\bf A}). $$
1) Lowering the index of the $4$-potential depends on the sign convention
$$ (+,-,-,-)\qquad \text{resp.} \qquad(-,+,+,+) $$
for the Minkowski metric $\eta_{\mu\nu}$. This Minkowski sign convention is used in
$$\text{Ref. 1 (p. xix) and Ref. 2 (p. xv)} \qquad \text{resp.} \qquad \text{Ref. 3 (eq. (1.9))}.$$
The $4$-potential $A_{\mu}$ with lower index is
$$A_{\mu}~=~(\Phi,-{\bf A})
\qquad \text{resp.} \qquad A_{\mu}~=~(-\Phi,{\bf A}).$$
Maxwell's equations with sources are
$$ d_{\mu}F^{\mu\nu}~=~j^{\nu}
\qquad \text{resp.} \qquad d_{\mu}F^{\mu\nu}~=~-j^{\nu}. $$
The covariant derivative is
$$D_{\mu} ~=~d_{\mu}+iqA_{\mu}\qquad \text{resp.} \qquad D_{\mu} ~=~d_{\mu}-iqA_{\mu}, $$
where $q=-|e|$ is the charge of the electron.
2) The sign convention for the elementary charge $e$ is
$$e~=~-|e| ~<~0 \qquad \text{resp.} \qquad e~=~|e|~>~0.$$
This charge sign convention is used in | {
"domain": "physics.stackexchange",
"id": 15599,
"lm_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",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.