text stringlengths 1 1.11k | source dict |
|---|---|
speedup, complexity-theory, bqp
Many different complexity classes can be described in terms of (more or less complicated properties of) the number of accepting branches of an NTM. Given an NTM in 'normal form', meaning that the set of computational branches are a complete binary tree (or something similar to it) of some polynomial depth, we may consider classes of languages defined by making the following distinctions: | {
"domain": "quantumcomputing.stackexchange",
"id": 32,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "speedup, complexity-theory, bqp",
"url": null
} |
cross-validation, feature-scaling
Title: how to use standardization / standardscaler() for train and test? At the moment I perform the following:
estimators = []
estimators.append(('standardize', StandardScaler()))
prepare_data = Pipeline(estimators)
n_splits = 5
tscv = TimeSeriesSplit(n_splits = n_splits)
for train_index, val_index in tscv.split(df_train):
X_train, X_val = prepare_data.fit_transform(df_train[train_index]), prepare_data.fit_transform(df_train[val_index])
X_test = prepare_data.fit_transform(df_test) | {
"domain": "datascience.stackexchange",
"id": 6404,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cross-validation, feature-scaling",
"url": null
} |
scala
import scala.collection.mutable
/**
* Used to rate limit a repeated action based on three parameters. This class doesn't
* actually control the action, but tells the calling class how long to wait before
* performing the action again by calling `nextWait`. Caller also indicates every time
* an action is performed using `execute`.
*
* @param minSpacing The minimum amount of time between actions for burst throughput (in ms)
* @param maxPer The number of actions that can happen during any one `movingPeriod` time window
* @param movingPeriod The length of the moving time window for controlling sustained throughput (in ms)
*/
class RateLimiter(val minSpacing: Int, val maxPer: Int, val movingPeriod: Int) {
val periodRate: Double = maxPer / RateLimiter.SUBWINDOW_COUNT.toDouble
val periodInterval = movingPeriod / RateLimiter.SUBWINDOW_COUNT
val sustainedInterval: Long = movingPeriod / maxPer
var last: Long = 0
var totalCount = 0 | {
"domain": "codereview.stackexchange",
"id": 19994,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "scala",
"url": null
} |
python
Imports should be on separate lines, i.e. sys and openpyxl should be imported using separate import statements
There should be two blank lines before and after a top level function definition
Using Argparse
I like the comments describing the command line arguments and the usage of the program. This is also the area in which I think you could improve it the most, because with very little effort you could turn these comments into argparse help texts. This does not negatively impact the readability of the program (in my opinion) but helps the user of the program.
if __name__ == "__main__":
from argparse import ArgumentParser | {
"domain": "codereview.stackexchange",
"id": 44078,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python",
"url": null
} |
python
An example :
a = match_with_gaps('a p p _ e', 'apple')
b = match_with_gaps('a p p _ c', 'apple')
print(a) >> outputs : True
print(b) >> outputs : False
I also came up with another way:
def match_with_gaps(my_word, other_word):
'''
my_word: string with _ characters, current guess of secret word
other_word: string, regular English word
returns: boolean, True if all the actual letters of my_word match the
corresponding letters of other_word, or the letter is the special symbol
_ , and my_word and other_word are of the same length;
False otherwise:
'''
my_word = my_word.replace(' ', '')
if len(my_word) != len(other_word):
return False
else:
for i in range(len(my_word)):
if my_word[i] != '_' and (
my_word[i] != other_word[i] \
or my_word.count(my_word[i]) != other_word.count(my_word[i]) \
):
return False
return True | {
"domain": "codereview.stackexchange",
"id": 36294,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python",
"url": null
} |
electromagnetism, electric-current, electrical-resistance, voltage
Title: What is general strategy to find the resistance of medium? What is general strategy to find the resistance of medium?
These are some of the examples
Two metal balls of the same radius $a$ are located in a homogeneous
poorly conducting medium with resistivity $\rho$. Find the
resistance of the medium between the balls provided that the separation
between them is much greater than the radius of the ball.
A metal ball of radius a is located at a distance $l$ from an
infinite ideally conducting plane. The space around the ball is filled
with a homogeneous poorly conducting medium with resistivity $\rho$.
In the case of $a <<l$ find:
(a) the current density at the conducting plane as a function of
distance r from the ball if the potential difference between the ball
and the plane is equal to V;
(b) the electric resistance of the medium between the ball and the plane. | {
"domain": "physics.stackexchange",
"id": 25426,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, electric-current, electrical-resistance, voltage",
"url": null
} |
java, thread-safety, matrix
@Override
public int columns() {
return columns;
}
@Override
public T get(Position pos) {
return get(pos.row, pos.column);
}
@Override
public T get(int row, int column) {
checkIndexes(row, column);
return values[row][column];
}
private void checkIndexes(int row, int column) {
if (row < 0 || column < 0) {
throw new IllegalArgumentException(stringByRowColumn(row, column));
}
if (row >= rows() || column >= columns()) {
throw new IndexOutOfBoundsException(stringByRowColumn(row, column));
}
}
private String stringByRowColumn(int row, int column) {
return "[" + row + ", " + column + "]";
}
@Override
public void set(Position pos, T value) {
set(pos.row, pos.column, value);
}
@Override
public void set(int row, int column, T value) {
checkIndexes(row, column);
values[row][column] = value;
} | {
"domain": "codereview.stackexchange",
"id": 4279,
"lm_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, thread-safety, matrix",
"url": null
} |
• That being said, I do know the antiderivative of secant, which you can get by multiplying top and bottom by secantx+tangentx. – CalculusNerd Sep 2 '14 at 3:18
• I think you can rewrite this integral by using pythagorean theorem. It eventually became the integral of sec(x). I never encountered a need for absolute value bars. – 123 Sep 2 '14 at 3:20 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9838471680195556,
"lm_q1q2_score": 0.808908454070305,
"lm_q2_score": 0.8221891370573388,
"openwebmath_perplexity": 288.0507422879789,
"openwebmath_score": 0.8851790428161621,
"tags": null,
"url": "https://math.stackexchange.com/questions/916619/trig-substitution-problem-integration"
} |
human-biology, cell-biology, cell-membrane, structural-biology
Title: Does the Plasma Membrane have a hydrophilic interior/exterior/contain vesicles? I am very new to the study of biology, and have been unable to find information in other sources which could tell me whether the plasma membrane has the following traits:
has a hydrophilic interior
has a hydrophobic exterior
contains vesicles
Thank you! The plasma membrane is a lipid bilayer. Plasma membrane lipids have a hydrophilic head group and hydrophobic tail groups. Since cells are usually in an aqueous environment (and are filled with aqueous cytoplasm), the hydrophilic head groups is face both the exterior and interior of the cell. Between these head groups facing the interior and exterior, the hydrophobic tail groups of opposing lipids associate with each other to create a hydrophobic core within the membrane.
Vesicles are also made of lipid bilayers. Vesicles can exist within cells or be released by cells. | {
"domain": "biology.stackexchange",
"id": 6642,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-biology, cell-biology, cell-membrane, structural-biology",
"url": null
} |
This kind of squeezing technique is widely applied in analysis, functional analysis, numerical analysis. So, it makes sense to ask something similar for a master degree entrance test.
• Truly a nice approach. The upper bound is basically the same. I missed the lower bound though :( I like your final note. "So, it makes sense to ask something similar for a master degree entrance test" – Subhasis Biswas May 19 '19 at 11:33
• Nice and clean :) – A learner Apr 23 at 15:44 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.978712651931994,
"lm_q1q2_score": 0.9172600577859358,
"lm_q2_score": 0.9372107900876219,
"openwebmath_perplexity": 273.7343699614015,
"openwebmath_score": 0.9380605816841125,
"tags": null,
"url": "https://math.stackexchange.com/questions/3231585/a-n-be-a-sequence-such-that-a-n12-2a-na-n1-a-n-0-then-sum-1/3231653"
} |
java, optimization, parsing, url
HostMetrics hostMetrics = new HostMetrics(hostName, startDate, endDate);
hostMetricsList.add(hostMetrics);
}
// and then print out the list
System.out.println(hostMetricsList);
}
Storing results
In your main you're storing the hostMetricsList only to print it when you're done. Why not simply print the metrics as you go and avoid the list all together? | {
"domain": "codereview.stackexchange",
"id": 9181,
"lm_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, optimization, parsing, url",
"url": null
} |
python, performance, python-2.x, csv, finance
It's good practice and may give you a performance boost if you wrap your code in a def main() function and then run it by having if __name__ == "__main__:" at the bottom of your file.
Using with open(FILE_LOCATION) as f to access the same file repeatedly in the same script seems awkward to me. When you see code repeated three times, it starts to give off a "bad code smell" that suggests it is time to refactor. You may find your code more readable if you have a single function for reading that file and then converting it into a dictionary that your other functions can access.
Adding a from __future__ import print_function, division will make it easier for you to port your code into Python3 in the future, which you may want to consider doing, since there have been updates made to how concurrency can be handled. | {
"domain": "codereview.stackexchange",
"id": 23911,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, python-2.x, csv, finance",
"url": null
} |
shors-algorithm
Title: What is a maximal number factored by Shor's algorithm so far? With reference to a similar question here, I would like to know what is the maximal number which has been factored with Shor's algorithm so far on actual quantum hardware.
The reason I am asking a similar question as the link is that this question is from 2018 and I would expect that some progress has taken place since that time, especially in light of introducing a 65 qubits processor by IBM.
I also saw some other techniques for factoring integers to primes but these are based on converting the factorization problem to QUBO instead of period finding as in the case of Shor's algorithm:
Quantum factorization of 56153 with only 4 qubits
Variational Quantum Factoring | {
"domain": "quantumcomputing.stackexchange",
"id": 4910,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "shors-algorithm",
"url": null
} |
astronomy, galaxies, rotation
Title: Which way do spiral galaxies rotate? Is it known whether spiral galaxies typically (or exclusively?) rotate with the arms trailing or facing?
Intuitively it feels weird to think of the arms as facing the direction of rotation, but that's silly, of course -- it seems to have its origin in an instinctive assumption that some sort of friction with the intergalactic vacuum would make it hard for the galaxy to rotate against the barbs, which is nonsense.
I assume that for galaxies that we don't view head-on, we can measure rotation curves spectroscopically. But that's not enough; it must also be possible to determine which end of the minor axis is the far one. Dust in front of the bulge can help with that -- but in the images I have seen where it is clear which way the galaxy is tilted, it's not easy to see which way the spiral curls. | {
"domain": "physics.stackexchange",
"id": 3180,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astronomy, galaxies, rotation",
"url": null
} |
Since this system of equations is consistent (Theorem RCLS), a solution will provide values for a,\kern 1.95872pt b and c that allow us to recognize C as an element of W.
M20 Contributed by Robert Beezer Statement [928]
The membership criteria for Z is a single linear equation, which comprises a homogeneous system of equations. As such, we can recognize Z as the solutions to this system, and therefore Z is a null space. Specifically, Z = N\kern -1.95872pt \left (\left [\array{ 4&−1&5 } \right ]\right ). Every null space is a subspace by Theorem NSMS.
A less direct solution appeals to Theorem TSS.
First, we want to be certain Z is non-empty. The zero vector of {ℂ}^{3}, 0 = \left [\array{ 0\cr 0 \cr 0 } \right ], is a good candidate, since if it fails to be in Z, we will know that Z is not a vector space. Check that
4(0) − (0) + 5(0) = 0
so that 0 ∈ Z. | {
"domain": "ups.edu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9912886163143679,
"lm_q1q2_score": 0.8081306774443168,
"lm_q2_score": 0.8152324803738429,
"openwebmath_perplexity": 1830.3624001576297,
"openwebmath_score": 0.9782329797744751,
"tags": null,
"url": "http://linear.ups.edu/jsmath/0230/fcla-jsmath-2.30li38.html"
} |
beginner, c, c++17
wchar_t ch = L'\0';
// longest_sequence can't be bigger than UINT_MAX because the size is recorded in the array, and the array uses unsigned ints
while (ch != WEOF && current_name < SIZE_MAX && current_sequence < (SIZE_MAX / sizeof(unsigned int)) && *line_count < SIZE_MAX && current_sequence < UINT_MAX)
{
ch = fgetwc(my_file);
if (ch == WEOF || ch == L'\n')
{
if (checking_sequence == 1)
{
if (current_delay > * longest_delay)
{
*longest_delay = current_delay;
}
if (current_sequence > * longest_sequence)
{
*longest_sequence = current_sequence;
}
checking_sequence = 0;
current_sequence = 3;
current_delay = 1;
} | {
"domain": "codereview.stackexchange",
"id": 40343,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, c, c++17",
"url": null
} |
shows how, in some sense, integration is the opposite of differentiation. G(x) = F(x) + C. Integral Theorems [Anton, pp. the major theorems from the study of di erentiable functions in several variables. The next graph shows the result of the integration for all time, with a black dot at t=1. Complex integration and Cauchy's theorem by Watson, G. As before, to perform this new approximation all that is necessary is to change the calculation of k1 and the initial condition (the value of the exact solution is also changed, for plotting). Integration can be used to find areas, volumes, central points and many useful things. The millenium seemed to spur a lot of people to compile "Top 100" or "Best 100" lists of many things, including movies (by the American Film Institute) and books (by the Modern Library). Complex Integration and Cauchy's Theorem (Dover Books on Mathematics) Paperback – May 17, 2012 by G. 3 Complexification of the Integrand. The Net Change Theorem. Created by Sal Khan. | {
"domain": "novaimperia.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9871787830929848,
"lm_q1q2_score": 0.8410297302997354,
"lm_q2_score": 0.8519528019683105,
"openwebmath_perplexity": 561.1808117201255,
"openwebmath_score": 0.8674394488334656,
"tags": null,
"url": "http://nvmu.novaimperia.it/integration-theorems.html"
} |
c++, c++11, c++14, heap
// Sift it up to re-establish heap property.
siftUp(size() - 1);
}
template<typename T, typename C>
T Heap<T, C>::pop()
{
if (size() == 0) return T();
T ret{top()};
// Move last item to the top, then reduce the array size by one.
items[0] = items[size() - 1];
items.pop_back();
// Sift this new top item down to re-establish heap property.
siftDown(0);
return ret;
}
template<typename T, typename C>
const T& Heap<T, C>::top() const
{
return items.front();
}
template<typename T, typename C>
const T& Heap<T, C>::item(size_t node) const
{
return items[node];
}
template<typename T, typename C>
constexpr size_t Heap<T, C>::size() const
{
return items.size();
}
template<typename T, typename C>
void print(std::ostream& stream, const Heap<T, C>& h, size_t root = 0, size_t level = 0)
{
if (root >= h.size()) return;
// Print left child.
print(stream, h, root * 2 + 1, level + 1); | {
"domain": "codereview.stackexchange",
"id": 24404,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, c++14, heap",
"url": null
} |
javascript, dom, audio
// currentTime in seconds of audio playing
function setTime(currentTime) {
var seconds = Math.floor(currentTime),
minutes = Math.floor(seconds / 60),
timeStr = '';
timeStr += minutes + ':';
seconds -= minutes * 60;
timeStr += ('0' + seconds).slice(-2);
time.textContent = timeStr;
}
// between 0.0 and 1.0 inclusive
function setVolume(percent) {
// if gainNode is initialized, use it
if (audioanalyser.gainNode) {
audioanalyser.audio.volume = 1;
audioanalyser.gainNode.gain.value = percent;
// otherwise fallback to set volume directly, which affects visualization
} else {
audioanalyser.audio.volume = percent;
}
}
// get position of event relative to top-left of specified element
function getPos(event, element) {
var x = event.clientX,
y = event.clientY,
currentElement = element; | {
"domain": "codereview.stackexchange",
"id": 14330,
"lm_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, dom, audio",
"url": null
} |
ros, tutorials
Title: spacenav_node tutorial help
Dear all
I tried to go through spacenav_node two basic tutorials. I was able to echo the 6DOF joystick on topic /spacenav/joy. The reading from the joystick is correct. However when I run the turtle sim, the turtle did not move at all. After double print out the rxgraph, I found turtle_teleop node is subscripting topic /joy[unknown type]. I guess it might be the bug.
So I tried to changed file .../spacenav_node/src/spacenav_node.cpp, make it published /joy topic instead.
ros::Publisher joy_pub = node_handle.advertisejoy::Joy("/joy", 2);
It does not help. node spacenav_node still publish /spacenav/joy. I am new to ROS. I guess there is some easy and right way to do this. Any hint or suggestion will be appreciated. thanks. | {
"domain": "robotics.stackexchange",
"id": 5735,
"lm_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, tutorials",
"url": null
} |
electromagnetism, electromagnetic-radiation, electric-fields, charge, microwaves
I am looking for a physical explanation of this behaviour.
Precisely, let's consider the instant in which the microstrip line is connected to the voltage generator. Step by step:
1) The voltage source provides many positive charges at its positive terminal and many negative charges at its negative terminal. Let's focus on the first one, which is directly connected to the strip.
2) Charges provided by the voltage source will try to distance themselves due to Coulomb repulsion and will go predominantly at the edges of the strip (this may explain the reason by which the surface density is infinite at the edges of the graph).
3) The voltage source will provide other charges which I think will go at the center of the strip. How will the charge distribution be influenced by this factor? | {
"domain": "physics.stackexchange",
"id": 63096,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, electromagnetic-radiation, electric-fields, charge, microwaves",
"url": null
} |
navigation, odometry
As I do not know what is the default turtlebot coordinate system name, I assume it is "base_link". Also, there's a 4cm distance between the center of my sensor and the robot's center, which explains the 0.04 in my translation.
To confirm that my odometry data was correctly being processed by robot_pose_ekf, I set the sensor covariance to 1e-8 (x and y), 1.0 (z, which is irrelevant) and 99999.0 (velocities). After a simple experiment, I believe I should expect the output from the
kalman filter to be similar to the visual odometry. However, this is what I got: the blue path was measured by my sensor, and the red is the output from the kalman filter, which is clearly messed up. Am I missing something?
Update 2 | {
"domain": "robotics.stackexchange",
"id": 8535,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, odometry",
"url": null
} |
## Solution 2
Let's say we have our four by four grid and we work this out by casework. A is where the frog is, while B and C are possible locations for his second jump, while O is everything else. If we land on a C, we have reached the vertical side. However, if we land on a B, we can see that there is an equal chance of reaching the horizontal or vertical side, since we are symmetrically between them. So we have the probability of landing on a C is 1/4, while B is 3/4. Since C means that we have "succeeded", while B means that we have a half chance, we compute $1 \cdot C + \frac{1}{2} \cdot B$.
$$1 \cdot \frac{1}{4} + \frac{1}{2} \cdot \frac{3}{4}$$ $$\frac{1}{4} + \frac{3}{8}$$ We get $\frac{5}{8}$, or $B$ $$\text{O O O O O}$$ $$\text{O B O O O}$$ $$\text{C A B O O}$$ $$\text{O B O O O}$$ $$\text{O O O O O}$$ -yeskay
## Solution 3 | {
"domain": "artofproblemsolving.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9852713891776498,
"lm_q1q2_score": 0.8008949114629362,
"lm_q2_score": 0.8128673178375735,
"openwebmath_perplexity": 191.56254420253063,
"openwebmath_score": 0.8162198662757874,
"tags": null,
"url": "https://artofproblemsolving.com/wiki/index.php?title=2020_AMC_10A_Problems/Problem_13&diff=cur&oldid=115908"
} |
photons, temperature, atoms
In order to make up the energy difference between the photon energy and the atom's "desired" energy, the atom has to use up some of its own kinetic energy. When a photon is later emitted, the kinetic energy it used up gets lost as well as the initial energy.
The net result is that the atom gets slower. If you carry out this cooling process again and again, the atoms keep on getting slower and slower. Their speed is linked to their temperature, so the atoms are being cooled down by this process. | {
"domain": "physics.stackexchange",
"id": 90391,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "photons, temperature, atoms",
"url": null
} |
neural-network, ann
Step 4: We need to compute the derivative of $z_B$ in order to compute Step 3. This is simple:
$$\frac{\partial}{\partial v_1}z_B = \frac{\partial}{\partial v_1}(v_1\cdot o_1 + v_2\cdot o_2) = o_1$$
If we now put everything together, we finally get the derivative of the costs. So the derivative of the activation function is needed to achieve the bigger goal of computing the derivative of the costs.
Further steps
You would also want to optimize the lower layers of the network, e.g. $z_{A_1}=w_{11}x_1 + w_{12}x_2$, so you would also compute $\frac{\partial}{\partial w_{11}}\mathcal{C}$, which would start in the same way and differ in step 4 and require more steps to propagate the derivative further back. Luckily, the backpropagation for all weights can be done at the same time, which leads to the backpropagation algorithms, you learn about. | {
"domain": "datascience.stackexchange",
"id": 11393,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-network, ann",
"url": null
} |
c++, game, c++17, qt
#include <QApplication>
#include <QEvent>
#include <QMouseEvent>
#include <QDebug>
CellInputHandler::CellInputHandler(QObject *parent)
: QObject{ parent },
mLastCell{ nullptr }
{
}
bool CellInputHandler::eventFilter(QObject *watched, QEvent *event)
{
if(event->type() == QEvent::MouseButtonPress){
handleMouseButtonPressEvents(watched, event);
return true;
}
if(event->type() == QEvent::MouseButtonRelease){
handleMouseButtonReleaseEvents(watched, event);
return true;
}
if(event->type() == QEvent::MouseMove) {
handleMouseMoveEvents(event);
return true;
}
return false;
}
void CellInputHandler::handleMouseButtonPressEvents(
QObject *watched, QEvent *event)
{
auto mouseEvent = static_cast<QMouseEvent*>(event);
auto cell = qobject_cast<Cell *>(watched);
cell->handleMousePressEvent(mouseEvent);
mLastCell = cell;
} | {
"domain": "codereview.stackexchange",
"id": 36550,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, game, c++17, qt",
"url": null
} |
go
You can use this shorter form:
func (sd *SliceDiff) SortedDiff(updated []string) (additions, deletions []string) {
Naming
Short names are very popular and encouraged in Go.
But l is really the worst of all single-letter variable names.
In addition to the usual badness of these variables,
depending on the viewer program,
l might be indistinguishable from 1 or I or |.
I suggest to never use l as a symbol name.
Alternative implementation
It seems to me that the use of container/List doesn't really buy you much.
It would be simpler and clearer to implement without it.
Consider this alternative implementation using only slices:
// Package slicediff is a utility to determine the additions and deletions that happened to a sorted slice after each update.
//
// All the slices are assumed to be sorted!
package slicediff
// SliceDiff stores the current state of the sorted slice
type SliceDiff struct {
content []string
} | {
"domain": "codereview.stackexchange",
"id": 23009,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "go",
"url": null
} |
boost
File "/home/eca/ros/ros/bin/rosboost-cfg", line 35, in <module>
rosboost_cfg.main()
File "/home/eca/ros/ros/tools/rosboost_cfg/src/rosboost_cfg/rosboost_cfg.py", line 347, in main
output = libs(ver, options.libs.split(','))
File "/home/eca/ros/ros/tools/rosboost_cfg/src/rosboost_cfg/rosboost_cfg.py", line 283, in libs
print >> s, find_lib(ver, lib, True),
File "/home/eca/ros/ros/tools/rosboost_cfg/src/rosboost_cfg/rosboost_cfg.py", line 246, in find_lib
raise BoostError('Could not locate library [%s] in lib directory [%s]'%(name, dir))
rosboost_cfg.rosboost_cfg.BoostError: 'Could not locate library
[filesystem-mt] in lib directory [/usr/lib]'
Call Stack (most recent call first):
CMakeLists.txt:15 (rosbuild_link_boost)
-- Configuring incomplete, errors occurred!
make: *** [all] Error 1 | {
"domain": "robotics.stackexchange",
"id": 6438,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "boost",
"url": null
} |
c++, algorithm, complexity, binary-search
The more separate functions there are the easier it is to understand or read the code. This also makes it easier for any programmer to maintain or debug the code.
Use Meaningful Variable Names
The variables r, K and N do not help the reader understand the code. It's not clear at all what the variables r and K are. N is defined only if one reads the problem description, which is not currently included in the question. There are some good variable names such as guess, status, and changed although it might be better to make the array names plural. Variable naming should be consistent. The function name exploreCave is quite clear as well. Using i and j is quite common and understandable, but what is r and K? A second question is why is K needed since r does not change between it's assignment and usage?
Use One Statement to Declare and Initialize a Single Variable | {
"domain": "codereview.stackexchange",
"id": 28774,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, algorithm, complexity, binary-search",
"url": null
} |
$=\frac{x^{-1}+y^{-1}}{(x^{-1}-y^{-1})(x^{-1}+y^{-1})}=\frac{1}{x^{-1}-y^{-1}}=\frac{1}{\frac 1x-\frac 1y}=\dots$
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Another way :
eliminate the negative coefficients.
In order to do that, multiply by $\frac{x^2y^2}{x^2y^2}$ :
$=\frac{xy^2+yx^2}{y^2-x^2}=\frac{xy(y+x)}{(y-x)(y+x)}=\frac{xy}{y-x}$
3. This is another problem that needs to be simplified.
It's going to look messy but I'll type it out right. Can someone tell me how to make it look like it does on the paper?
Anyways:
EDIT: sqrt = square root
(((2x)/(sqrt(x-1)))-sqrt(x-1))/(x-1)
Again sorry for the sloppiness >_<
4. Originally Posted by DHS1
This is another problem that needs to be simplified.
It's going to look messy but I'll type it out right. Can someone tell me how to make it look like it does on the paper?
Anyways:
(((2x)/(sqrt(x-1)))-sqrt(x-1))/(x-1)
Again sorry for the sloppiness >_<
You'll have to tell me if this is what you have coded: | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9688561721629776,
"lm_q1q2_score": 0.8828020912524748,
"lm_q2_score": 0.9111797154386843,
"openwebmath_perplexity": 558.2787990628507,
"openwebmath_score": 0.8530687093734741,
"tags": null,
"url": "http://mathhelpforum.com/pre-calculus/62653-negative-exponents.html"
} |
monte-carlo
Some brief, non-rigorous background:
The goal of MCMC in the case of Bayesian inference is to generate random samples from the posterior distribution, which we typically cannot derive in closed form. All MCMC algorithms work by iteratively computing a ratio of probabilities that help determine if the sampler should "stay where it is at currently" (and "record" another sample where it is currently at) or "to move" to a different location of the posterior. Where the algorithm proposes to "move" can be determined by a variety of ways, one of which is HMC. | {
"domain": "datascience.stackexchange",
"id": 12068,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "monte-carlo",
"url": null
} |
probability-theory
Now instead of considering a random order on the arrivals, impose your own order, based on ranks: the first candidate is the less qualified, and the last one is the one which is the best overall. In this case, if the group is made of $n$ candidates, numbering them from $0$ to $n-1$ you get for the $i$th candidate a probability of being hired which is $\frac{1}{n-i}$, since candidates are now arriving on the basis of their ranks, and the $i$-th candidate is always better qualified than the previous $i-1$.
This is why you want to permute the group of candidates: so that no particular input elicits the worst case behavior associated to the permutation in which candidates are sorted by rank. | {
"domain": "cs.stackexchange",
"id": 508,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "probability-theory",
"url": null
} |
time
Title: Is time a finite resource? I am struggling to find an answer for this question because time as we know it would end when we reach the heat death of a universe. Which would imply that is the end of time.
I think I have a misunderstanding that time ends when the heat death happens.
So, is time a finite resource when the end of the universe happens, or would it just keep going even after that point? Assuming general relativity is a valid way to describe the universe, time is just a coordinate like the three spatial coordinates. There is no reason to suppose that the time coordinate has a limit i.e. time increases continuously and without limit into the future.
The only way that the time coordinate may have a limit is if the geometry of the universe has a future singularity. In that case we can't continue the time coordinate past the singularity. However, unless some radically new physics turns up there is no reason to suppose our universe has a future singularity. | {
"domain": "physics.stackexchange",
"id": 24537,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "time",
"url": null
} |
special-relativity, mass-energy, time-dilation
+\frac{35}{128}m\frac{v^8}{c^6}
+ \cdots$$
now $$ -1 \lt -{\left(\frac{v}{c}\right)}^2 \lt 1$$
$$ 1 \gt {\left(\frac{v}{c}\right)}^2 \gt -1$$
$$ c \gt v \gt ic$$
My Analysis:
My initial analysis of this sees the Kinetic energy portion of the 1/2 fraction and I do not know why that is there. Is their some other meaning for the other parts of the equation?
The units for this are going to be energy (Joules) and the farther elements only get small and less significant to the major contribution of the first 5 elements.
Rewording my questions:
Did I make a mistake, or am I allowed to mathematically multiply these two equations?
Are their any conclusions to be drawn from this math?
I know someone else came up with this, where can I learn more?
Also what does the boundary condition of v mean?
Thanks for any input into this! (let me know if there are other tags for this question) $E=\gamma(v) m_0 c^2$ | {
"domain": "physics.stackexchange",
"id": 76770,
"lm_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, mass-energy, time-dilation",
"url": null
} |
thermodynamics, electricity, temperature, physical-chemistry, batteries
Title: Is it possible to make water steam batteries? I have a few questions,
What happens if we compress water steam?
Does its temperature increase (Gay-Lussac’s law)?
Or does it become liquid?
Can we store the compressed water steam in a tank and use it later on, when we require to generate electricity. Yes you can store pressurized steam just like you can store pressurized air or pressurized CO2, and use the pressure to power something later.
The trick is that air or CO2 will remain a gas at room temperature but steam obviously condenses and loses pressure as it cools, so you need a really well insulated tank to prevent heat loss. | {
"domain": "physics.stackexchange",
"id": 82903,
"lm_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, electricity, temperature, physical-chemistry, batteries",
"url": null
} |
computer-vision, camera-calibration
Title: Pinhole calibration This is a conceptual question I am having difficulty to understand due to my limited knowledge of computer vision: If a pinhole calibration or any calibration is a mapping from world coordinates to image coordinate, is it possible to invert this mapping? I understand most of the times camera matrix is 3x4 so non invertible, but is it possible to have a square camera matrix.
Thanks If you have a single calibrated camera, and you have its 3x4 camera matrix, then you can map image points to the world points on the z=0 plane. This assumes that you know that your image point does indeed correspond to a world point on that plane.
So, you cannot map any image point to its corresponding world point using a single image from calibrated camera. To do that, you would need two views from different viewpoints, and you would need to know the 3D rotation and translation between the views. | {
"domain": "dsp.stackexchange",
"id": 2416,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computer-vision, camera-calibration",
"url": null
} |
c++, geospatial
return v;
}
}
usage
#include "geohash.h"
#include <iostream>
#include <utility>
struct Place{
GeoHash::Point point;
std::string_view name;
double supposed_distance;
GeoHash::buffer_t buffer;
std::string_view hash = GeoHash::encode(point, 12, buffer);
}; | {
"domain": "codereview.stackexchange",
"id": 44813,
"lm_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++, geospatial",
"url": null
} |
resources based on grade level, subject, or resource type. We would like to show you a description here but the site won't allow us. Important: Try Math Sample Questions Now Go directly to Math sample questions. The tree, the forest, mathematics and statistics AGRON 590 MG: Crop-Soil Modeling Fernando E. The examples below show how there are three ways of doing this. Phone: 319-335-0714 Fax: 319-335-0627 [email protected] This allows you to make an unlimited number of printable math worksheets to your specifications instantly. Topics include Algebra and Number (proof), Geometry, Calculus, Statistics and Probability, Physics, and links with other subjects. A probability sample is a sample in which every unit in the population has a chance (greater than zero) of being selected in the sample, and this probability can be accurately determined. What is the expectation and variance for the number of 1s in the sequence of die rolls?. Global Warming. Cooks use math to modify the amount a | {
"domain": "mascali1928.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9770226260757067,
"lm_q1q2_score": 0.8435531501284119,
"lm_q2_score": 0.8633916222765627,
"openwebmath_perplexity": 2166.8251969311536,
"openwebmath_score": 0.29697713255882263,
"tags": null,
"url": "http://ifxo.mascali1928.it/math-ia-modelling-example.html"
} |
thermodynamics
$\Delta T = \mbox{change in temperature}e$
(1) is used to find the heat transfer for solids and liquids. (2) is used to find the heat transfer for gas molecules at constant volume(I am aware there is one for constant pressure). Can (2) be converted to (1) by looking up the molecules molar mass in the periodic table and converting the number of moles to grams? If that is possible, is the reason why we do not use $Q = mc\Delta T$ for gas is because the specific heat depends on the type of process? The real problem here is associating any of this with the heat transferred Q. In thermodynamics, Q is not a function of state (but rather process), while C is a function of state, not process. Because, in thermodynamics, there can be work done on the system, the amount of heat changes depending on how much work was done. And, different amounts of heat can be associated with the same change from a specified initial state to a specified final state. | {
"domain": "physics.stackexchange",
"id": 72311,
"lm_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",
"url": null
} |
Just as ebaines did, we want the number of outcomes with exactly 0 red and exactly 1 red, then take the compliment (total number of outcomes minus outcomes that give us only 0 or 1 red). For exactly 0 red, that is $\binom{24}{5}$ outcomes.
For exactly 1 red, that is $\binom{24}{4}\binom{8}{1}$ outcomes (note: since we are doing combinations, we don't care which of the apples is red). So, there are $\binom{32}{5} - \binom{24}{5} - \binom{24}{4}\binom{8}{1}$ outcomes with at least 2 red.
For at least one apple (red or green), we want the number of outcomes with 0 apples and take the compliment: $\binom{32}{5} - \binom{16}{5}$.
So, the probability that you get at least 2 red apples given that you pick at least one apple (red or green):
$\dfrac{\binom{32}{5} - \binom{24}{5} - \binom{24}{4}\binom{8}{1}}{\binom{32}{5} - \binom{16}{5}} = \dfrac{73,864}{197,008} = \dfrac{1319}{3518} \approx 0.375$
14. ## Re: Probability with a "known" | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.992062004490436,
"lm_q1q2_score": 0.8064147807187074,
"lm_q2_score": 0.8128673178375734,
"openwebmath_perplexity": 777.3827612388857,
"openwebmath_score": 0.7933079600334167,
"tags": null,
"url": "http://mathhelpforum.com/statistics/223410-probability-known.html"
} |
localization, kalman-filter, ekf, sensor-fusion
EKF is normally presented as a prediction/correction framework after each action but it's not clear how 3+ sensor sources can be integrated. An EKF or any of the variants of the Kalman filter, as you said mainly works in two steps: prediction and correction. The prediction steps gives you a state estimate based on your process model and the correction step updates your state estimate based on the current measurement. If you have multiple measurements from more than one sensor, you would just update the state as you would in the correction step whenever a new measurement is available. The only difference is that your measurement model would change depending on which sensor is giving you the measurement. If your sensors give you data at different rates then you would do something like: prediction, correction1, prediction, correction2 ... and so on, where correction 1 and correction 2 are based on measurements from sensor 1 and sensor 2 respectively. | {
"domain": "robotics.stackexchange",
"id": 2152,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "localization, kalman-filter, ekf, sensor-fusion",
"url": null
} |
We can find the area from $\theta = 0$ to $\theta = \tfrac{\pi}{2}$ . . . and double.
So we have:. $A \;=\;2 \times \tfrac{1}{2}\int^{\frac{\pi}{2}}_0(1 -\sin\theta)^2\,d\theta$
I get: . $\frac{3\pi}{4}-2 \:\approx\:0.3562$
6. Originally Posted by Soroban
Did you make a sketch?
This is a cardioid . . .
Code:
|
..*.. | ..*..
*:::::::* | *:::::::*
- - * - - - - - * - - - - - * - -
* | *
|
* | *
* | *
* | *
|
* | *
* | *
* | *
* | *
* * *
|
We can find the area from $\theta = 0$ to $\theta = \tfrac{\pi}{2}$ . . . and double.
So we have:. $A \;=\;2 \times \tfrac{1}{2}\int^{\frac{\pi}{2}}_0(1 -\sin\theta)^2\,d\theta$
I get: . $\frac{3\pi}{4}-2 \:\approx\:0.3562$
There ya' go. I just did it from 0 to Pi. Gives the same thing.
7. thank you both very much | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9881308775555447,
"lm_q1q2_score": 0.80555639955098,
"lm_q2_score": 0.8152324938410784,
"openwebmath_perplexity": 1210.6456466967188,
"openwebmath_score": 0.9011908769607544,
"tags": null,
"url": "http://mathhelpforum.com/calculus/89030-area-polar-curve-above-polar-axis.html"
} |
to the plane. So just "move" the intersection of your lines to the origin, and apply the equation. $$\theta$$ also happens to be one of the angles between the lines L1 & L2. What are my options for a url based cache tag? Angle Between Two 3D Vectors Below are given the definition of the dot product (1), the dot product in terms of the components (2) and the angle between the vectors (3) which will be used below to solve questions related to finding angles between two vectors. This circle is called Circumcircle. Incenter is unique for a given triangle. There are no angles formed between two skew lines because they never touch. What environmental conditions would result in Crude oil being far easier to access than coal? Shifting lines by $( -1,-1,-1 )$ gives us: Line $1$ is spanned by the vector $\vec{u} = ( 2,1,-6 )$, Line $2$ is spanned by the vector $\vec{v} = (0,-5,5)$. then the angle between the lines is equal to the angle between perpendicular vectors and to the lines:. These | {
"domain": "ludatou.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9653811611608242,
"lm_q1q2_score": 0.8262225793642178,
"lm_q2_score": 0.8558511524823263,
"openwebmath_perplexity": 387.12714507923596,
"openwebmath_score": 0.5351652503013611,
"tags": null,
"url": "http://ludatou.com/4mhiqzo/95d5a1-angle-between-two-lines-in-3d"
} |
python, python-3.x
At this point, you can do what is called "tuple unpacking" (remember the word "unpacking" -- you'll want to search for it later). That lets you return multiple values into multiple separate variables:
cost, name = cheapest_shipping(weight)
print(f"You should use {name}, it costs only {cost}!") | {
"domain": "codereview.stackexchange",
"id": 34370,
"lm_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
} |
python, beginner, strings, python-3.x, random
### Generate vowel block list:
vowel_block_list = list() # store all vowel blocks
for count0 in range(1,1+n_v): # loop for each block
vlength = random.randint(1,vbl) # random length of vowel block
### Generate single vowel blocks:
v_block = list() # Store single vowel block
for count1 in range(1,1+vlength): # loop for each individual vowel
v1_val = chr(vowel_numbers[random.randint(0,4)]) # random vowel
v_block.append(v1_val) # create list of vowels in single block
string_block = ''.join(v_block) # join to make string
vowel_block_list.append(string_block) # create list of all vowel blocks
### Generate consonant block list:
const_block_list = list() # store all consonant blocks
for count3 in range(1,1+n_c):
clength = random.randint(1,cbl) # random length of block
### Generate single blocks:
c_block = list() # store single block | {
"domain": "codereview.stackexchange",
"id": 14795,
"lm_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, strings, python-3.x, random",
"url": null
} |
Wilson's theorem is your friend here.
$$(p-1)! \equiv -1 \mod p$$ for prime $p$.
Then notice $$-1 \equiv (2003-1)! = 2002 \cdot 2001 \cdot 2000! \equiv (-1) (-2) \cdot 2000! \mod 2003.$$
• What you are left with is the need to compute $(-2)^{-1} \mod 2003$. Hint: $2003 = 2004 -1 = 2 \cdot 1002 - 1$. – Joel Jul 15 '15 at 18:13
• Of course you have to prove that 2003 is a prime otherwise you can't be sure that the result is true. – miracle173 Jul 16 '15 at 9:44
• @miracle173 Indeed it is important to verify the primeness of $2003$. It is sufficient to check all the primes up to $43$, since $\sqrt{2003} \approx 44.7$. This can be performed with a calculator. Also, the OP mentioned that they already know that $2003$ is prime. – Joel Jul 16 '15 at 13:16
$\mathbb{Z}_{2003}$ is a finite field. The equation $x^2 = 1$ has exactly two roots in that field: $x_1 = 1$ and $x_2 = -1 = 2002$. Thus, every $n \in \mathbb{Z}_{2003}^* \setminus \{ 1, 2002 \}$ has $n^{-1} \neq n$. Hence | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109485172559,
"lm_q1q2_score": 0.8269791973056551,
"lm_q2_score": 0.8397339596505965,
"openwebmath_perplexity": 207.35890642859195,
"openwebmath_score": 0.8902060985565186,
"tags": null,
"url": "https://math.stackexchange.com/questions/1362370/calculate-2000-mod-2003/1362387"
} |
slam, kinematics, localization, dynamics
If $\mathbf{f}$ is invertible, then the control-input is computed using
$$
\mathbf{u}_{k-1}
= \mathbf{f}^{-1}(\mathbf{x}_{k}, \mathbf{k-1}).
$$
Let's consider a 2D rigid body example, where the state is the robot's displacements $\mathbf{r}^{b_{k}a}_{w}$ and its heading $\theta_{k}$ at time $t_{k}$.
This state can be "nicely" described using the special Euclidean group $SE(2)$ (check Sola - A Micro Lie Theory for more info on Lie groups for robotics):
$$
\begin{align}
\mathbf{T} &=
\begin{bmatrix}
\cos(\theta) & -\sin(\theta) & x \\
\sin(\theta) & \cos(\theta) & y \\
0 & 0 & 1
\end{bmatrix}
=
\begin{bmatrix}
\mathbf{C}(\theta) & \mathbf{r}^{ba}_{w} \\
\mathbf{0} & 1
\end{bmatrix}
\in SE(2).
\end{align}
$$
Let the control inputs be the linear velocity of the robot resolved in the body frame $\mathbf{v}^{b_{k}a}_{b_{k}}$ and the angular velocity $\omega^{b_{k}w}$.
The motion model is then
$$
\mathbf{T}_{k}
=
\mathbf{T}_{k-1}
\begin{bmatrix} | {
"domain": "robotics.stackexchange",
"id": 2597,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam, kinematics, localization, dynamics",
"url": null
} |
complexity-theory, turing-machines
If a Turing machine repeats the same configuration twice, it must be in an infinite loop.
I thought that a $TM$ can be in a state $q_1$, with the tape on the left 000 and on the right 111. Let's say it moves right and then left, staying in the same state; aren't we in the same configuration? This is because the transition function $\delta$ of a TM is deterministic. If the configuration is the same, then the arguments of $\delta$ are also the same, resulting in an infinite loop. Formally, this can be proved like @gnasher729 does.
Let's consider your example. If your $TM$ moves like the following,
$$
(q_1, \dots00[0]111\dots) \xrightarrow{q_1, \text{right}} (q_1, \dots000[1]11\dots) \xrightarrow{q_1, \text{left}} (q_1, \dots00[0]111\dots)
$$
then the last step equals the first one, which means an infinite loop. | {
"domain": "cs.stackexchange",
"id": 11687,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, turing-machines",
"url": null
} |
of harmonically related sinusoids. Fourier Cosine Transform and Fourier Sine 18 Transform • Any function may be split into an even and an odd function • Fourier transform may be expressed in terms of the Fourier cosine transform and Fourier sine transform f > x f > x f x @ f x f x @ E x O x 2 1 2 1 ³ ³ f f f f F k E x cos 2Skx dx i O x sin 2Skx dx. For example square wave pattern can be approximated with a suitable sum of a fundamental sine wave plus a combination of harmonics of this fundamental frequency. Find the Fourier Tranform of the sawtooth wave given by the equation Solution. Principal Fourier Mountain Wave Models 4 5. Sections 6, 7 and 8 address the multiplication,. Another example is solving the wave equation. Let samples be denoted. Fourier Transforms. A window is not recommended for a periodic signal as it will distort the signal in an unnecessary manner, and actually. ly, for periodic signals we can define the Fourier transform as an impulse train with the impulses | {
"domain": "gorizia-legnami.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9904406003707396,
"lm_q1q2_score": 0.8050967875657755,
"lm_q2_score": 0.8128673110375457,
"openwebmath_perplexity": 568.7099265426834,
"openwebmath_score": 0.8534658551216125,
"tags": null,
"url": "http://gorizia-legnami.it/ybve/fourier-transform-of-periodic-square-wave.html"
} |
thermodynamics, fluid-dynamics, acoustics, aerodynamics, shock-waves
Title: How does shockwave from hypersonic movement protect the moving object from air? The Steak Drop article from the What If? book says:
The steak spends a minute and a half over Mach 2, and the outer surface will likely be singed, but the heat is too quickly replaced by the icy stratospheric blast for it to actually be cooked.
At supersonic and hypersonic speeds, a shockwave forms around the steak which helps protect it from the faster and faster winds. The exact characteristics of this shock front—and thus the mechanical stress on the steak—depend on how an uncooked 8 oz. filet tumbles at hypersonic speeds
How does this happen? I have read the Wikipedia page of Shock wave in supersonic flows, but it doesn't say anything on the protection of the wave from the impact of the medium. I am not really sure what is exactly meant by "protecting" the steak. For instance, here are some schlieren images from some NASA wind tunnel tests. | {
"domain": "physics.stackexchange",
"id": 66750,
"lm_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, fluid-dynamics, acoustics, aerodynamics, shock-waves",
"url": null
} |
10 records of the MNIST sample data. Get the spreadsheets here: Try out our free online statistics calculators if you’re looking for some help finding probabilities, p-values, critical values, sample sizes, expected values, summary statistics, or correlation coefficients. Your email address will not be published. Euclidean distance may be used to give a more precise definition of open sets (Chapter 1, Section 1). > > Can you please help me how to get the Euclidean distance of dataset . Numeric vector containing the first time series. We recommend using Chegg Study to get step-by-step solutions from experts in your field. dist Function in R (4 Examples) | Compute Euclidean & Manhattan Distance . This option is computationally faster, but can be less accurate, as we will see. version 0.4-14. http://CRAN.R-project.org/package=proxy. We don’t compute the similarity of items to themselves. This script calculates the Euclidean distance between multiple points utilising the distances function | {
"domain": "kalpehli.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9553191284552528,
"lm_q1q2_score": 0.833370136858242,
"lm_q2_score": 0.8723473779969194,
"openwebmath_perplexity": 859.4582796240163,
"openwebmath_score": 0.7534364461898804,
"tags": null,
"url": "http://kalpehli.com/srhuil/0fv6vw9.php?id=61fab9-euclidean-distance-in-r"
} |
fully integrated into both typesetting and symbolic expression construction . This carefully selected compilation of exam questions has fully-worked solutions designed for students to go through at home, saving valuable time in class. ... Set Language And Notation. There are many different symbols used in set notation, but only the most basic of structures will be provided here. Bringing the set operations together. Some notations for sets are: {1, 2, 3} = set of integers greater than 0 … Solution: Let P be the set of all members in the math This section is to introduce the notation to the reader and explain its usage. It is still a set, so we use the curly brackets with nothing inside: {} The Empty Set has no elements: {} Universal Set. After school they signed up and became members. Use set notation to describe: (a) the area shaded in blue (b) the area shaded in purple. Usually, you'll see it when you learn about solving inequalities, because for some reason saying "x < 3" isn't good | {
"domain": "com.ua",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9637799420543365,
"lm_q1q2_score": 0.8424181118003392,
"lm_q2_score": 0.8740772400852111,
"openwebmath_perplexity": 1163.4918522943465,
"openwebmath_score": 0.7233943939208984,
"tags": null,
"url": "https://www.naukovy.com.ua/p4c6x9/set-notation-symbols-1478d8"
} |
newtonian-mechanics
Title: Why does $v=\sqrt{gR}$ guarantee circular motion -- why do we only consider the top point? Let's assume we have a body undergoing vertical circular motion. The body is connected with a cord to a fixed point. The length of the cord is $ R $ (radius).
Why does a topmost speed of $v=\sqrt{gR}$ guarantee that the body will undergo circular motion. For there to be circular motion, the particle must have a speed at the top of $v=\sqrt{gR}$.
Note: I mixed up tension force for normal force, although this answer is equally valid for both.
Consider the following diagram of a particle of mass $m$ undergoing vertical circular motion. | {
"domain": "physics.stackexchange",
"id": 78781,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics",
"url": null
} |
c#, .net, linq-expressions
yield return new RawFilterParts
{
Property = filterParts[0],
Operation = filterParts[1],
Value = filterParts[2]
};
}
}
The GetPropertyExpression method in the BaseFilterType class is throwing the InvalidOperationException again but this one is wrong too. It should throw either the ArgumentOutOfRangeException or better a custom exception like InvalidOperatorException - notice it's called Operator not Operation. The property also should be changed to Operator because it is an operator.
See: https://en.wikipedia.org/wiki/Operator_(computer_programming)
As the other review suggested, the operators should be enum values.
This might give you some inspiration about operators: http://www.tomsitpro.com/articles/powershell-comparison-operators-conditional-logic,2-850.html | {
"domain": "codereview.stackexchange",
"id": 24496,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, .net, linq-expressions",
"url": null
} |
quantum-mechanics, wavefunction, symmetry, fermions, bosons
Taking your hydrogen example, the wave function of two hydrogen atoms has a position and spin dependence for each electron:
$$\Psi(\vec r_{e1}, \sigma_{e1}, \vec r_{p1}, \sigma_{p1}, \vec r_{e2}, \sigma_{e2}, \vec r_{p2}, \sigma_{p2}) = -\Psi(\vec r_{e2}, \sigma_{e2}, \vec r_{p1}, \sigma_{p1}, \vec r_{e1}, \sigma_{e1}, \vec r_{p2}, \sigma_{p2}) = \Psi(\vec r_{e2}, \sigma_{e2}, \vec r_{p2}, \sigma_{p2}, \vec r_{e1}, \sigma_{e1}, \vec r_{p1}, \sigma_{p1})$$
Where the sign flips in each step as the electron and protons are both fermions.
The result of this procedure is the wave function where the position of both entire hydrogen atoms have been swapped. As there is no sign change, the wave function is symmetric in the coordinate sets for hydrogen, giving that hydrogen is a boson.
Following this procedure, you can easily see, that a system composed of an even number of fermions is a boson, and a system composed of an odd number of fermions must be a fermion. | {
"domain": "physics.stackexchange",
"id": 22382,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, wavefunction, symmetry, fermions, bosons",
"url": null
} |
`isequal(A*B,B*A)`
```ans = logical 0 ```
Check the commutation relation for addition.
`isequal(A+B,B+A)`
```ans = logical 1 ```
If an operation has any arguments of type `symmatrix`, the result is automatically converted to type `symmatrix`. For example, multiply a matrix `A` that is represented by symbolic matrix variable and a scalar `c` that is represented by symbolic scalar variable. The result is of type `symmatrix`.
```syms A [2 2] matrix syms c class(A)```
```ans = 'symmatrix' ```
`class(c)`
```ans = 'sym' ```
`M = c*A`
`M = $c A$`
`class(M)`
```ans = 'symmatrix' ```
Multiply three matrices that are represented by symbolic matrix variables. The result X is a `symmatrix` object.
```syms V [2 1] matrix X = V.'*A*V```
`X = ${V}^{\mathrm{T}} A V$`
`class(X)`
```ans = 'symmatrix' ```
You can pass `symmatrix` objects as arguments to math functions. For example, perform a mathematical operation to `X` by taking the differential of `X` with respect to `V`. | {
"domain": "mathworks.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9820137900379083,
"lm_q1q2_score": 0.8225543607752206,
"lm_q2_score": 0.8376199694135332,
"openwebmath_perplexity": 1075.1542436230848,
"openwebmath_score": 0.7315763831138611,
"tags": null,
"url": "https://la.mathworks.com/help/symbolic/use-symbolic-matrix-variables.html"
} |
c#, multithreading, .net
return m_KeysFileName;
}
}
// GetKeys
// NOTE: Makes a deep copy of the keys array and returns that
public static List<Key_t> GetKeysArray()
{
lock (m_locker)
{
// Make a copy of the list of the keys
List<Key_t> tmp = new List<Key_t>();
for (int i = 0; i < m_DecryptedKeys.Count(); i++)
{
Key_t s = new Key_t();
s.KeyName = m_DecryptedKeys[i].KeyName;
for (int j = 0; j < 8; j++)
{
// Copy each key separately
s.MasterKey[j] = m_DecryptedKeys[i].MasterKey[j];
s.SessionKey[j] = m_DecryptedKeys[i].SessionKey[j];
}
tmp.Add(s);
}
return tmp;
}
} | {
"domain": "codereview.stackexchange",
"id": 16609,
"lm_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#, multithreading, .net",
"url": null
} |
homework-and-exercises, classical-mechanics, lagrangian-formalism
My solution
Since the text asks for use $x$ as Lagrangian coordinate, I think to express the $z$-coordinate as a function of $x$, and from the equation of the (semi) circle, I get $z=-\sqrt{R^2-x^2}$
Then, I write the Kinetic energy $T(x,\dot x)=\frac{1}{2}m \dot z^2=\frac{1}{2}m \frac{\dot x^2 x^2}{R^2-x^2}$
while the potential energy $V(x)$ I assume to be simply $V(x)=-m g z(x)=+mg\sqrt{R^2-x^2}$
So, the Lagrangian would be $L(x,\dot x)=\frac{1}{2}m \frac{\dot x^2 x^2}{R^2-x^2}+mg\sqrt{R^2-x^2}$
Now, writing the Lagrange equations is just a matter of computations. I'd like to know if I moved correctly, or if I am completely wrong You forgot a term in the kinetic energy. You should have
$$T=\frac{1}{2}mv^{2}=\frac{1}{2}m\left(\dot{x}^{2}+\dot{z}^{2}\right)$$
since $\boldsymbol{v}=\dot{x}\hat{x}+\dot{z}\hat{z}$.
As for you potential term, the gravitational energy increases with height
$$V=mgz$$
Finally, note that $\mathcal{L}=T-V$ (you used + instead). | {
"domain": "physics.stackexchange",
"id": 57553,
"lm_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, classical-mechanics, lagrangian-formalism",
"url": null
} |
statistical-mechanics, spin-models, complex-systems, glass
Now, it has been often said, that his results have found widespread application in all kinds of systems, up to 'flocks of birds'.
Is there a model-free explanation of the technique, making it part of the standard 'toolkit' for complex systems? And what kind of problems does it address, specifically? Here is the model-free explanation: statistical mechanics concerns systems of many (N>>1) interacting elements. Observables can be computed from the partition function $Z$, possibly with added fields. In principle this requires some microscopic probability distribution over dynamical elements, although maximum entropy approaches are also widely used. If we have universality, then not all details of this distribution will be important.
More precisely, observables are obtained by derivatives of $\log Z$. In the thermodynamic limit, the finite observables are of the form
$\mathcal{O} = \lim_{N \to \infty} \frac{1}{N}\frac{\partial \log Z}{\partial h}$
where $h$ is some field-like parameter. | {
"domain": "physics.stackexchange",
"id": 83336,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statistical-mechanics, spin-models, complex-systems, glass",
"url": null
} |
go
Usage
err := http.ListenAndServe(":8080", middleware.RequestId(Router)) Long form comment: Yes, the context version. I'd consider it a bad pattern to modify incoming data inline (because it's harder to track later what came in and what the application did with it). Especially in applications which do not only handle HTTP traffic, but also, say, gRPC calls, it's even more important that this data isn't stored for one type of handler only, but for all of them in a unified fashion. Plus, context is (for better and worse) a kitchen sink for all layers of the code, even in the deepest layers you'll still be able to get that ID for various purposes, maybe auditing, or so. | {
"domain": "codereview.stackexchange",
"id": 35965,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "go",
"url": null
} |
human-biology, physiology
Does it make sense to think that stress physically ages a person? I am specifically referring to characteristics identified with aging such as bleached hair, telomere shortening, wrinkles around the eyes, etc. The fight/flight situation, through activation of the sympathetic part of the autonomous nerve system, leads to secretion of catechol amines, i.e. adrenaline and noradrenaline. The effects of these hormones, if excreted continously or without real resting time, are thought to be bad for your health. If you recall the possible effects of those two substances (which are both similar to amphetamine, by the way), and look at what big studies have found about the impact of high blood pressure then you know the most important negative effect of stress, IMHO.
http://en.wikipedia.org/wiki/Sympathetic_nervous_system | {
"domain": "biology.stackexchange",
"id": 469,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-biology, physiology",
"url": null
} |
performance, algorithm, c
//put number in an array
int j;
for( j = numberLength - 1; j >= 0; j-- )
{
numberA[j] = doorNumber % 10;
doorNumber /= 10;
} | {
"domain": "codereview.stackexchange",
"id": 25807,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, algorithm, c",
"url": null
} |
special-relativity, metric-tensor, tensor-calculus, notation, covariance
Edit 2: The change in placement of indices are actually my doubts. I try to elaborate.
I do not have any background in using indices to talk about tensors. I am used to interpret the expressions $\partial_\mu$ as the local vector field defined in some chart (local coordinates). I think about vector fields $X$ as abstract section of the Tangent bundle, which restricted to local coordinates can be expressed as $X=X^\mu\partial_\mu$. In the context of QFT, as far as I understand, the symbol $\partial_\mu$ denotes $(\partial_t,\nabla)$ in the local coordinates $(t,x,y,z)$. So that $\partial_\mu\phi=(\partial_t \phi,\partial_x \phi,\partial_y\phi,\partial_z\phi)$. This was supposed to be my justification on why I wrote the summation on $\mu$ and $\nu$ in $(*)$, but now I note that this only applies when $\mu$ or $\nu$ appear twice, indicating the scalar product; which leads me to the last remark. I think of $g_{\mu \nu}$ as the component of the matrix $$g=\begin{pmatrix}
1&0&0&0\\ | {
"domain": "physics.stackexchange",
"id": 71580,
"lm_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, metric-tensor, tensor-calculus, notation, covariance",
"url": null
} |
algorithm-analysis, data-structures, amortized-analysis, union-find
Title: Height and depth of every node in Path Compression If we have an union-find(disjoint-set) data structure and we are doing an union by rank and path compression for a find operation, how would the depth and height of every node change after the find operation?
I am trying to find the amortized cost of the find operation using the potential function:
$$phi(x) = \sum_{x} height(x) $$
I know this is not the right potential function, however, i am trying to learn more about amortized analysis and i am just practicing by analyzing more data structures. I assume that the height of a node $\small x$, denoted as $\small h(x)$, is recursively defined as:
$$
\small
h(x) = \begin{cases}
0 & \text{ if $x$ is a leaf} \\
1+\max\{h(y) \mid y\text{ is child of } x\} & \text{ otherwise }
\end{cases}
$$ | {
"domain": "cs.stackexchange",
"id": 7458,
"lm_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-analysis, data-structures, amortized-analysis, union-find",
"url": null
} |
java, collections, concurrency, set
Title: Concurrent Linked Hash Set Basically I want to create a concurrent LinkedHashSet which returns proper size too.
I am mainly concerned about adding and removing iterations. Suggestions relating to implementation of set modification during iteration are also welcomed.
import java.util.Collection;
import java.util.LinkedHashSet;
//TODO still not sure
public class ConcurrentLinkedHashSet<E> extends LinkedHashSet<E>
{
private static final long serialVersionUID = 1L;
private boolean isUpdating = false;
@Override
public int size()
{
while (isUpdating)
{
try
{
wait();
} catch (InterruptedException e)
{
e.printStackTrace();
return (Integer) null;
}
}
return super.size();
} | {
"domain": "codereview.stackexchange",
"id": 12525,
"lm_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, collections, concurrency, set",
"url": null
} |
When you reply, please also let us know what topics you've recently studied, including any formulas or algorithms that you think might apply. Thank you!
How.
4. ## From 5 points choose 3, the combination is 10 (5x4/2)
Therefore, there are 10 different planes that go though these 5 dots. Each two planes intersect to form a line. So from 10 planes choose 2 plane to get a line, the ways is 10x9/2=45, which is the answer.
I made a mistake. After I get 10 planes, I should count the lines, because 3 plane could share the same line.
Let the 5 points be 12345. The 10 plane contain the points are
123 (the plane contain 123)
124
125
134
135
145
234
235
245
345
When two points appear on more than 2 row , it means more than two planes will share the line, therefore, we need to subtract them. So the answer should be 45-20=25 | {
"domain": "freemathhelp.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9748211539104334,
"lm_q1q2_score": 0.8416523986580775,
"lm_q2_score": 0.863391602943619,
"openwebmath_perplexity": 989.8717075858003,
"openwebmath_score": 0.47407764196395874,
"tags": null,
"url": "https://www.freemathhelp.com/forum/threads/109715-Visualization-Problem-Dots-and-Lines?p=422356"
} |
operations. Currently he is on leave from UT Austin and heads the Amazon Research Lab in Berkeley, California, where he is developing and deploying state-of-the-art machine learning methods for Amazon Search. Support Stability of Maximizing Measures for Shifts of Finite Type Journal of Ergodic Theory and Dynamical Systems (accepted) Calkins, S. Those equations may or may not have a solution. Problem solving with algorithms and data structures using Python. Posted by u/[deleted] a linear algebra library in R designed for teaching. Foundations of Data Science is a treatise on selected fields that form the basis of Data Science like Linear Algebra, LDA, Markov Chains, Machine Learning basics, and statistics. in machine learning, it is standard to say “N samples” to mean the same thing. 065 Linear Algebra and Learning from Data New textbook and MIT video lectures OCW YouTube; 18. pdf; TS CH8 Estimation. Government and Fortune 500 companies. These functions are mainly for tutorial purposes | {
"domain": "cfalivorno.it",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9840936073551713,
"lm_q1q2_score": 0.9126122943990052,
"lm_q2_score": 0.9273632991598454,
"openwebmath_perplexity": 1063.9791517497667,
"openwebmath_score": 0.2879904508590698,
"tags": null,
"url": "http://oanx.cfalivorno.it/linear-algebra-and-learning-from-data-github.html"
} |
java, simulation
}
public void showPages(double numberToPrint) {
System.out.println("Printing " + (int) numberToPrint + " Pages, paper remaining is: " + this.ammountOfPaper
+ " Toner level is: " + this.tonerLevel);
}
public void refillToner() {
tonerLevel = 100;
}
public void refillPaper(int paper) {
if(paper > 50) {
System.out.println("Cannot put in more paper");
}
else {
this.ammountOfPaper += paper;
}
}
public int getAmmountOfPaper() {
return ammountOfPaper;
}
public double getTonerLevel() {
return tonerLevel;
}
public void setTonerLevel(double tonerLevel) {
this.tonerLevel = tonerLevel;
}
public void setAmmountOfPaper(int ammountOfPaper) {
this.ammountOfPaper = ammountOfPaper;
} I'd just like to add something that I haven't seen mentioned by others (or maybe I skipped it), but take for example this piece of code:
public void printPages(double numberToPrint) {
// ... | {
"domain": "codereview.stackexchange",
"id": 21517,
"lm_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, simulation",
"url": null
} |
c#, beginner, console, pokemon
// Check whether any pokemon has leveled up
if (PokemonLevelSystem.HasPokemonLeveledUp(pokemon))
{
Console.WriteLine(pokemon.Name + " has leveled up!");
}
if (PokemonLevelSystem.HasPokemonReachedMaxLevel(pokemon))
{
Console.WriteLine(pokemon.Name + " has reached max level! ");
}
}
// Go back to Menu if user chooses so
if (!TrainAgain())
{
trainPokemon = false;
break;
}
} while (TrainSameTeam());
}
}
private static bool TrainAgain()
{
// Train pokemon in gym again (?)
Console.WriteLine("\nDo you want to train again? (Y/N)\n"); | {
"domain": "codereview.stackexchange",
"id": 26450,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, beginner, console, pokemon",
"url": null
} |
gazebo, urdf
Thanks,
Thomas
Comment by Jim Rothrock on 2012-11-26:
Yes, see http://wiki.ros.org/ackermann_vehicle.
Comment by gleb on 2016-08-16:
Hey Jim
I'm working on a model of an ackermann steering vehicle and would like to look into your files to get an idea how to implement a controller for the ackermann steering. Unfortunately your package doesn't exist anymore. Would it be possible to upload your package again?
Thanks in advance
Gleb
Comment by H_Gottlieb on 2017-01-15:
Hey Jim. How would you use your package with a different model? (for example the polaris ranger ev that is in the gazebo database) | {
"domain": "robotics.stackexchange",
"id": 5845,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo, urdf",
"url": null
} |
computational-complexity
Title: Pi in place of binary Some time ago, I asked this question but no one quite understood it or was able to answer. I deleted the original question and have since decided to try it again.
As I understand it, all things digital are originally based on ones and zeros - binary code.
However, I have wondered for some time if it would be possible (now or in the future) to use the digits of pi (22/7) in place of the ones and zeros.
So, my question, is it possible? Could it ever be? No it cannot happen for many reasons.
How would logic look like?
How would you add two numbers?
There is a big problem with telling apart $0$ and $1$ at high frequencies, so adding third option would be harder to manufacture. But encoding it with non-natural basis gets harder.
With non-natural base, all operations that we do are doomed.
If you consider that, try easy example: convert $4$ and $6.5$ into $\pi$ base, add them and write down result. | {
"domain": "cs.stackexchange",
"id": 6092,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computational-complexity",
"url": null
} |
swift, controller, user-interface
I obviously made an assumption here of how you presented this AllowedContentViewController (namely that you must have embedded it in a UINavigationController, based upon the presence of dismiss but that you also had @IBActions with UIBarButton). Clearly, adjust the prepare(for:sender:) according to how you actually presented this table view controller.
Anyway, above, the presenting view controller is responsible for passing data to this presented AllowedContentViewController and for responding to AllowedContentViewControllerDelegate delegate method that supplies the updated user preferences for what is allowed and what isn’t. This gets the AllowedContentViewController from ever having to reach into ViewController to retrieve/update properties itself. Now AllowedContentViewController can be used in any context you want.
Finally, our view model has all the business logic that used to be in the TableViewController:
struct AllowedContentViewModel {
var allowed: Set<Category> | {
"domain": "codereview.stackexchange",
"id": 34322,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "swift, controller, user-interface",
"url": null
} |
performance, r
Title: increase speed for 'for loop' I have files containing data set which contain 11,000 rows. I have to run a loop through each row, this is taking me 25minutes for each file.
I am using following code:
z <- read.zoo("Title.txt", tz = "")
for(i in seq_along(z[,1])) {
if(is.na(coredata(z[i,1]))) next
ctr <- i
while(ctr < length(z[,1])) {
if(abs(coredata(z[i,1])-coredata(z[ctr+1,1])) > std_d) {
z[ctr+1,1] <- NA
ctr <- ctr + 1
} else {
break
}
}
}
Where "Title.txt" is file containing 11,000 rows. It looks like (first five rows):
"timestamp" "mesured_distance" "IFC_Code" "from_sensor_to_river_bottom"
"1" "2012-06-03 12:30:07-05" 3188 1005 3500
"2" "2012-06-03 12:15:16-05" 3189 1005 3500
"3" "2012-06-03 12:00:08-05" 3185 1005 3500
"4" "2012-06-03 11:45:11-05" 3191 1005 3500
"5" "2012-06-03 11:30:15-05" 3188 1005 3500 | {
"domain": "codereview.stackexchange",
"id": 1853,
"lm_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, r",
"url": null
} |
evolution, human-anatomy, neuroanatomy
However, this "rotation hypothesis" is being challenged by the "asymmetry hypothesis" in which the gastropod mantle cavity originated from one side only of a bilateral set of mantle cavities.[15]
Gastropods typically have a well-defined head with two or four sensory tentacles with eyes, and a ventral foot, which gives them their name (Greek gaster, stomach, and poda, feet). The foremost division of the foot is called the propodium. Its function is to push away sediment as the snail crawls. The larval shell of a gastropod is called a protoconch. | {
"domain": "biology.stackexchange",
"id": 2872,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "evolution, human-anatomy, neuroanatomy",
"url": null
} |
particle-physics, experimental-physics, standard-model, history
The fact that the W and Z bosons have mass while photons are massless was a major obstacle in developing electroweak theory. These particles are accurately described by an SU(2) gauge theory, but the bosons in a gauge theory must be massless. As a case in point, the photon is massless because electromagnetism is described by a U(1) gauge theory. Some mechanism is required to break the SU(2) symmetry, giving mass to the W and Z in the process. One explanation, the Higgs mechanism, was forwarded by the 1964 PRL symmetry breaking papers. It predicts the existence of yet another new particle; the Higgs boson. Of the four components of a Goldstone boson created by the Higgs field, three are "eaten" by the W+, Z0, and W− bosons to form their longitudinal components and the remainder appears as the spin 0 Higgs boson. | {
"domain": "physics.stackexchange",
"id": 38324,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "particle-physics, experimental-physics, standard-model, history",
"url": null
} |
The solution for the problem you posed would depend on the relation between P and A. This relation would be specific for each type of cross sectional area(circle, rectangle etc.). So you need to specify the exact shape of cross sectional area for this to be answerable.
• it has circular cross section May 3 '18 at 14:29 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9732407137099625,
"lm_q1q2_score": 0.8131265899567351,
"lm_q2_score": 0.8354835330070838,
"openwebmath_perplexity": 443.79424766171053,
"openwebmath_score": 0.7950314879417419,
"tags": null,
"url": "https://engineering.stackexchange.com/questions/21580/heat-transfer-in-a-fin-with-constant-volume-and-given-efficiency"
} |
Hence, the conjecture seems true, but I don't know how to get a concrete example strictly.
• The simplest examples are tetrahedron (#face = 4) and cuboid (#face = 6). – achille hui Feb 12 '14 at 12:04
• May we paste a sheet (partly) to itself? – Hagen von Eitzen Feb 12 '14 at 13:54
• @achillehui: Oh, you are right. I didn't notice them. Thanks. – mathlove Feb 12 '14 at 14:41
• @HagenvonEitzen: No, we may not. – mathlove Feb 12 '14 at 14:53
• @achillehui: Won't it work even when each of the face $BEF$ and the face $EFG$ belongs to a distinct paper? Maybe I don't think I can understand the rule well – mathlove Feb 19 '14 at 15:51 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429609670702,
"lm_q1q2_score": 0.8257464861954458,
"lm_q2_score": 0.8397339676722393,
"openwebmath_perplexity": 420.8618590672783,
"openwebmath_score": 0.7100414633750916,
"tags": null,
"url": "https://math.stackexchange.com/questions/673617/making-a-convex-polyhedron-with-two-sheets-of-paper"
} |
javascript, jquery, event-handling
Title: Javascript array from IP address I want to make this code better. It works now but I think it can be better. I have a working sample on jsfiddle.
When the page loads I have the End IP Address disable until the data is entered. Then I take the values of the input with id attribute txtstartIpAddr and use it as the value for the input with id attribute txtendIpAddr. Any help would be great.
$(document).ready(function () {
$("#txtstartIpAddr").kendoMaskedTextBox({
mask: "000.000.000.000",
});
$("#txtendIpAddr").kendoMaskedTextBox({
mask: "000.000.000.000",
});
$('#txtstartIpAddr').blur(function() {
$("#txtendIpAddr").removeAttr('disabled');
var startIpAddr = $('#txtstartIpAddr').val();
//console.log(startIpAddr);
var IPArray = startIpAddr.split('.');
if (IPArray.length === 4)
{
var IPClone = "";
for(var i = 0; i < 2; i++) {
IPClone += IPArray[i] + ".";
} | {
"domain": "codereview.stackexchange",
"id": 42676,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, event-handling",
"url": null
} |
c++, object-oriented, mvc, tic-tac-toe
Since you are not doing anything special in either the constructor or distructor
you can use the default constructor and distructor if you are using C++11 or C++14.
This allows you to declare/define your constructors only in your header file, and let the C++ compiler generate the proper constructors and destructors. The less code
you have to write, the less error prone it is.
In C++11 or C++14
class Game
{
TicTacToe board1;
public:
Game() = default;
~Game() = default;
};
Functions in Main.cpp:
If you reverse the order of pause() and main() in Main.cpp you don't need the function prototype of void pause(); prior to main(). Having main() as the last function in the file is fairly common for this reason.
In the past on certain operating systems, pause(); has been a system call. I would avoid it's use, although the system call did return int so the signature is different. It also isn't the most descriptive name you could give this function. | {
"domain": "codereview.stackexchange",
"id": 19441,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, object-oriented, mvc, tic-tac-toe",
"url": null
} |
thermodynamics, heat-conduction
$h$ depends primarily on the clothing. Thick, airy clothing has a low $h$ and is a good insulator while thin, flimsy clothing has a high value of $h$ and less insulating capacity.
When the value of $h$ is sufficiently low, the clothing will keep the body warm because the heat loss is small, so $T_{body}$ doesn't change in time (remember that the body tries hard to maintain a constant $T_{body}$).
The problem arises when $h$ is high (flimsy clothing) and $T_{outside}$ is low. Then according to $(1)$ heat loss becomes large and the body may not be able to maintain homeostasis (constant $T_{body}$). Hypothermia then becomes a real possibility.
Similar reasoning can be applied to high outside temperatures and potential overheating of the body. | {
"domain": "physics.stackexchange",
"id": 64501,
"lm_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, heat-conduction",
"url": null
} |
algorithms, graphs
Is my algorithm correct? if not, what modifications are needed to make it correct or any other approaches will be greatly appreciated.
Note:Here I have considered the DFS algorithm which is given in the book "Introduction to algorithms by Cormen" in which it colors the nodes according to its status.So if the node is unvisited , unexplored and explored then the color will be white,grey and black respectively.All other things are standard. Your current implementation will compute the correct number of paths in a DAG. However, by not marking paths it will take exponential time. For example, in the illustration below, each stage of the DAG increases the total number of paths by a multiple of 3. This exponential growth can be handled with dynamic programming.
Computing the number of $s$-$t$ paths in a DAG is given by the recurrence,
$$\text{Paths}(u) = \begin{cases}
1 & \text{if } u = t \\
\sum_{(u,v) \in E} \text{Paths}(v) & \text{otherwise.}\\
\end{cases}$$ | {
"domain": "cs.stackexchange",
"id": 15684,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, graphs",
"url": null
} |
c#, beginner, number-guessing-game
Title: Guess a number between 1 and 100 This is my attempt at writing a guessing game. Where can I improve my code to make it more succinct?
Link to Revision 1 (Guess a number between 1 and 100 (revision 1))
//Program.CS
namespace MidPointGame
{
class Program
{
static void Main(string[] args)
{
RunTheGame game = new RunTheGame();
}
}
}
//Game.CS
namespace MidPointGame
{
class RunTheGame
{
int _number;
public RunTheGame()
{
const int lbound = 1;
const int ubound = 100;
int guessCount;
bool keepPlaying = true;
bool computerPlays = false;
string whoGuessed = "<unknown>"; | {
"domain": "codereview.stackexchange",
"id": 24777,
"lm_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, number-guessing-game",
"url": null
} |
inorganic-chemistry, bond, hybridization, valence-bond-theory, vsepr-theory
Atomic s character concentrates in orbitals directed toward electropositive substituents. | {
"domain": "chemistry.stackexchange",
"id": 14236,
"lm_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, bond, hybridization, valence-bond-theory, vsepr-theory",
"url": null
} |
php, mysql, mysqli
and then add some helper functions for various tasks
function mysqli_delete($conn, $sql, $values)
{
$stmt = mysqli_database_query($conn, $sql, $values, false);
$return $stmt->affected_rows();
}
function mysqli_assoc($conn, $sql, $values)
{
$result = mysqli_database_query($conn, $sql, $values);
$return $result->fetch_assoc();
}
function mysqli_all($conn, $sql, $values)
{
$result = mysqli_database_query($conn, $sql, $values);
$return $result->fetch_all(MYSQLI_ASSOC);
}
you can use the following function instead of that awkward $param = "id" of yours, for any column, not only id. Just select the desired column, i.e. SELECT user_id FROM table ...:
function mysqli_cell($conn, $sql, $values)
{
$result = mysqli_database_query($conn, $sql, $values);
$row = $return $result->fetch_row();
return ($row) ? $row[0] : false;
} | {
"domain": "codereview.stackexchange",
"id": 37029,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, mysql, mysqli",
"url": null
} |
java
private void addToAccounts(String username,String password){
addToUsernames(username);
addToPasswords(password);
}
private void addToUsernames(String username){
if(usernamesFile.exists()){
try (PrintWriter usernamesWriter = new PrintWriter(new BufferedWriter(new FileWriter(this.usernamesFile, true)))) {
usernamesWriter.println(username);
usernamesWriter.flush();
} catch (IOException ex) {
Logger.getLogger(Accounts.class.getName()).log(Level.SEVERE, null, ex);
}
} else System.err.println("File: Usernames Does Not Exist!");
} | {
"domain": "codereview.stackexchange",
"id": 15227,
"lm_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",
"url": null
} |
homework-and-exercises, energy-conservation, momentum, spring
Title: How to find the compression of a spring attached to an object I am having some trouble figuring out the equation needed to solve this problem.
A 3.0-kg block slides along a frictionless tabletop at 8.0 m/s toward
a second block (at rest) of mass 4.5 kg. A coil spring, which obeys
Hooke's law and has spring constant k = 830N/m , is attached to the
second block in such a way that it will be compressed when struck by
the moving block.
Part A
What will be the maximum compression of the spring?
Part B
What will be the final velocities of the blocks after the collision? | {
"domain": "physics.stackexchange",
"id": 9838,
"lm_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, energy-conservation, momentum, spring",
"url": null
} |
php, constructor
public static function MakeFromValues($text, $userName, $timestamp) {
return new CommentPanel($text, $userName, $timestamp);
}
}
So here's the two methods for instantiating a CommentPanel:
$cp = CommentPanel::MakeFromObject($comment);
// or...
$cp = CommentPanel::MakeFromValues($text, $user, $last_updated_ts);
// but not
$cp = new CommentPanel(); //Runtime error | {
"domain": "codereview.stackexchange",
"id": 38,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, constructor",
"url": null
} |
statistical-mechanics, computational-physics, molecular-dynamics
Reproduction of the relevant derivation from pp141 to 143 in the book (as the original text, be careful as any possible mistake in the original text is not corrected):
The value of the radial distribution function at a distance $r$ from a reference particle is equal to the angular average of $\rho(\mathbf{r})/\rho$:
$$g(r)=\frac{1}{\rho}\int d\hat{\mathbf{r}} \left< \rho(\mathbf{r})\right>_{N-1}=\frac{1}{\rho} \int d\hat{\mathbf{r}} \left<\sum_{j\neq i}\delta(\mathbf{r}-\mathbf{r}_j) \right>_{N-1}$$ (5.1.44). | {
"domain": "physics.stackexchange",
"id": 98213,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statistical-mechanics, computational-physics, molecular-dynamics",
"url": null
} |
java, algorithm, programming-challenge, time-limit-exceeded
Output example 1
4820
Input example 2
5
2
100 150 200 250 330 450 499
180 290 390 450 500 500
5000 4980 4750 4000 3950 3730 3000
Output example 2
3620
My solution
import java.util.Scanner;
public class Main {
static int[] maintenance;
static int[] exchange;
static int[] sell;
static int truemax = Integer.MIN_VALUE;
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int months = sc.nextInt();
int engine = sc.nextInt();
maintenance = new int[months+engine];
exchange = new int[months+engine - 1];
sell = new int[months+engine];
for(int i = 0; i < months+engine; i++)
{
maintenance[i] = sc.nextInt();
}
for(int i = 0; i < months+engine- 1; i++)
{
exchange[i] = sc.nextInt();
}
for(int i = 0; i < months+engine; i++)
{
sell[i] = sc.nextInt();
}
sc.close();
int routes = (int) Math.pow(2, months);
int f = routes/2;
route(0,f, engine,engine, 0, 0); | {
"domain": "codereview.stackexchange",
"id": 30203,
"lm_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, programming-challenge, time-limit-exceeded",
"url": null
} |
neurophysiology, sensation, hearing
1 Bell, A.
A fast, "zero synapse" acoustic reflex: middle ear muscles physically sense eardrum vibration (2017)
2 Narayanan, R. Characterization of Acoustic Reflex Latency in Females (2017) | {
"domain": "biology.stackexchange",
"id": 12279,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neurophysiology, sensation, hearing",
"url": null
} |
r
Title: Avoid recycling when merging with R Data Table I got tableA, which contains a numeric variable, CdTaller (e.g. 1948675).
I also got tableB, which contains two variables: Id (e.g. 2513978) and Name (e.g. "JOSE MANUEL PEREZ")
I want to add a new column to tableA, Name_Taller, which contains a name for those CdTaller which correspond to the Id variable of tableB, so I do the following:
tableA[, Name_Taller := tableB[Id==tableA\$CdTaller]$Name]
However, for those CdTaller of tableA that are not in tableB, R recycles the new variable Name_Taller:
Warning message:
In \`[.data.table\`(tableA, , \`:=\`(Name, tableB[Id == :
Supplied 867324 items to be assigned to 947871 items of column 'Name'
(recycled leaving remainder of 80547 items). | {
"domain": "datascience.stackexchange",
"id": 1009,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "r",
"url": null
} |
ros, ros-kinetic, actionlib, simpleactionclient, ros-indigo
or
roslaunch src/learning_actionlib/launch/test_avg.launch | {
"domain": "robotics.stackexchange",
"id": 25317,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-kinetic, actionlib, simpleactionclient, ros-indigo",
"url": null
} |
ros, urdf, ros-melodic, jackal
JACKAL_URDF_EXTRAS with this you have to do the same procedure as you did above. I think you also have to publish the static transform as well from Jackal to your Lidar.
Adding accessories to the robot. This thing is fairly simple and worked quite well for me and also rendered everything in Gazebo and handling was quite easy.
Here is a small example:
<!-- front laser -->
<xacro:include filename="$(find warthog_description)/urdf/accessories/lasers/front_laser.urdf.xacro" />
<joint name="fl_joint" type="fixed">
<origin xyz="0.025 0.0275 0.025" rpy="1.5708 -0.7854 0" />
<parent link="fl_frame"/>
<child link="f_laser" />
</joint>
</xacro:if>
and the front_laser.urdf.xacro look something like this"
<?xml version="1.0"?>
<robot xmlns:xacro="http://wiki.ros.org/xacro" name="f_laser" >
<xacro:include filename="hukoyu.urdf.xacro" />
<xacro:hokuyo_ust-10lx_mount prefix="front" topic="front_laser/scan" location="0.07"/>
</robot> | {
"domain": "robotics.stackexchange",
"id": 36048,
"lm_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, urdf, ros-melodic, jackal",
"url": null
} |
error-correction, fault-tolerance, magic-states
Title: Magic state distillation with the $15$ qubit code. How are the transversal $T$ performed? Also via a (lower level) state injection? I have a code $C1$ that admits native fault-tolerant gates for any element in the Clifford group (for instance via transversal implementation), but that then doesn't have an easy way to perform the $T$ gate.
In practice, to implement the $T$-gate we can use state injection and create a logical ancilla state in the state $|A\rangle=T |+\rangle$.
A way to create the $|A\rangle$ state in a reliable manner is to make use of a code that has a native fault-tolerant $T$ gate. The $15$ qubit code is such example (the $T$-gate is transversal).
In practice, to prepare $|A\rangle$, we then: | {
"domain": "quantumcomputing.stackexchange",
"id": 3615,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "error-correction, fault-tolerance, magic-states",
"url": null
} |
c#, beginner, checksum
Title: Generate and validate EAN-13 barcodes I developed a console app to generate and validate EAN-13 barcodes. I'm planning to develop a Windows Forms counterpart to render them as images using a barcode font.
I may test the console interface using Process.
Calculator.cs
using System;
namespace Ean13Calc
{
public static class InternationalArticleNumber13Calculator
{
private static int Sz = 12; | {
"domain": "codereview.stackexchange",
"id": 29810,
"lm_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, checksum",
"url": null
} |
ros, boost, ros-fuerte, build-from-source, libboost
Am I missing something? I didn't really understand Tully's response in the related question (to add -lboost_program_options to the linker flags exported by rospack in it's manifest)...I am kinda lost with ROS cmake files.
Thanks in advance. | {
"domain": "robotics.stackexchange",
"id": 10911,
"lm_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, boost, ros-fuerte, build-from-source, libboost",
"url": null
} |
### Show Tags
15 Oct 2017, 22:42
1
KUDOS
Expert's post
RockySinha wrote:
A pen was sold at 10% loss. If the selling price was $6 more then the seller could have made a profit of 5%. What was the purchase price of the pen? (A) 45 (B) 40 (C) 30 (D) 25 (E) None of these. Hi... You can make the Q very simple if you realize that both loss% and profit % are on cost or purchase price.. So an addition of$6 gets it from -10% to +5%, so a change of 15% in purchase price (P).
So 15%of P=6.......
P=$$6*\frac{100}{15}=40$$
B
_________________
Absolute modulus :http://gmatclub.com/forum/absolute-modulus-a-better-understanding-210849.html#p1622372
Combination of similar and dissimilar things : http://gmatclub.com/forum/topic215915.html
Kudos [?]: 5876 [1], given: 118
Director
Joined: 22 May 2016
Posts: 998
Kudos [?]: 347 [0], given: 594 | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 1,
"lm_q1q2_score": 0.8056321913146127,
"lm_q2_score": 0.8056321913146127,
"openwebmath_perplexity": 9883.555017134686,
"openwebmath_score": 0.33871909976005554,
"tags": null,
"url": "https://gmatclub.com/forum/a-pen-was-sold-at-10-loss-if-the-selling-price-was-6-more-then-the-251512.html"
} |
#### Fantini
MHB Math Helper
Thank you caffeine. But the question is: regardless of your solution, is mine wrong? That's the point. I didn't solve it using your way, precisely the one he wanted, but I need to know if my reasoning is incorrect. If it isn't, I want my points in the test!
#### caffeinemachine
##### Well-known member
MHB Math Scholar
The following question appeared in my last Rings and Fields exam.
Let $\alpha \in \mathbb{R}$ be a root of $x^3 -2$. Let $K = \mathbb{Q}(\alpha) \subseteq \mathbb{R}$ and $\sigma: K \to K$ a field isomorphism. Prove that $\sigma (x) = x$ for all $x \in K$. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9433475715065793,
"lm_q1q2_score": 0.8127299843343267,
"lm_q2_score": 0.8615382165412808,
"openwebmath_perplexity": 178.1052126639129,
"openwebmath_score": 0.9436347484588623,
"tags": null,
"url": "https://mathhelpboards.com/threads/field-isomorphism.2690/"
} |
• Maybe I misunderstood something, but it seems that $\sup\limits_{m\in M}\|m\|_\infty=+\infty$ and thus $\inf\limits_{m\in M}(\|\sin\pi t\|-\|m\|)=-\infty$. – Martin Sleziak Dec 8 '18 at 10:00
• I also think that the norm must less than one. For example, if we take $f(t)=\sin\pi t$ and $g(t)=-\frac16\sin(3\pi t)$ than $\|f(t)-g(t)\|_\infty<1$. Instead of detailed computation I'll add link to WA and also to plot of the graphs. Finding the actual infimum seems to be a more difficult problem. – Martin Sleziak Dec 8 '18 at 10:02
• Yeah the greater than proof is fishy now.. I will check it again. But norm is a non negative quantity so cannot be $-\infty$ for sure. So its in $(0,1]$ – mm-crj Dec 8 '18 at 10:09 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9669140216112959,
"lm_q1q2_score": 0.8293880062480596,
"lm_q2_score": 0.8577681031721325,
"openwebmath_perplexity": 207.7919396174907,
"openwebmath_score": 0.9125857353210449,
"tags": null,
"url": "https://math.stackexchange.com/questions/3029843/closed-subspace-and-quotient-norm"
} |
electrochemistry
Title: Can we make a rusting battery Since in rusting (oxidation) of Iron, transfer of 4 electrons takes place is it possible to use this reaction under catalytic conditions to create a simple electric cell, even if it just gave a millivolt of potential.
$\ce {Fe + H2O -> FeOH3 + H2}$
Considering that we have complete control over the surroundings, like volume expansion, disposing hydrogen and other such factors. Sure! A nickel-iron battery uses the oxidation of iron at the negative plate to produce about half the voltage. Though invented by Jungner, it's often called an Edison battery. See http://en.wikipedia.org/wiki/Nickel%E2%80%93iron_battery.
There are very low power semiconductor devices which could be powered by an iron battery. You could make three or four small cells from iron nails and a more electronegative element, e.g. lead, to power a digital watch; even without optimization to remove layers of hydrogen and rust, it should operate for months. | {
"domain": "chemistry.stackexchange",
"id": 2574,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrochemistry",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.