text stringlengths 1 1.11k | source dict |
|---|---|
c++, strings, immutability
inline bool operator<=(const Char *lhs, const basic_cstring<Char,Traits,Allocator> &rhs) noexcept {
return (rhs.compare(lhs) >= 0);
}
template<typename Char, typename Traits, typename Allocator>
inline bool operator>(const Char *lhs, const basic_cstring<Char,Traits,Allocator> &rhs) noexcept {
return (rhs.compare(lhs) < 0);
}
template<typename Char, typename Traits, typename Allocator>
inline bool operator>=(const Char *lhs, const basic_cstring<Char,Traits,Allocator> &rhs) noexcept {
return (rhs.compare(lhs) <= 0);
} | {
"domain": "codereview.stackexchange",
"id": 45074,
"lm_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++, strings, immutability",
"url": null
} |
c#, mvvm
if (webError == WebErrorStatus.Unknown)
throw;
}
return null;
}
if (feed.Title != null && feed.Title.Text != null)
feedData.Title = feed.Title.Text;
if (feed.Subtitle != null && feed.Subtitle.Text != null)
feedData.Description = feed.Subtitle.Text;
feedData.Link = feedLink;
if (feed.Items != null && feed.Items.Any())
{
// Use the date of the latest post as the last updated date
feedData.PubDate = feed.Items.First().PublishedDate.DateTime;
foreach (SyndicationItem item in feed.Items)
{
FeedItem feedItem = new FeedItem();
if (item.Title != null && item.Title.Text != null)
feedItem.Title = item.Title.Text; | {
"domain": "codereview.stackexchange",
"id": 7911,
"lm_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#, mvvm",
"url": null
} |
• And it does only apply to linear equations. Her is one equation, on unknown, and two solutions. $x^2 = 49$. Two solutions $x = -7$ and $x = 7$. Less trivial $ax^2 + bx = c= 0$ has two solutions. And $ax^2 + bxy + cy^2 = C_1$ and $dx^2 + exy + fy^2 = C_2$ will give you 2 acceptable expression with $x$ in terms of $y$ and for $2$ fourth degree polynomials with in terms of $y$ we could have $4$ potential solutions each so hypothetically $8$ solutions. (ALthough maybe we can prove there must be redundancies) Apr 11 '21 at 0:32 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9643214450208031,
"lm_q1q2_score": 0.8157604298043879,
"lm_q2_score": 0.8459424334245618,
"openwebmath_perplexity": 307.495988374558,
"openwebmath_score": 0.6268768310546875,
"tags": null,
"url": "https://math.stackexchange.com/questions/4097442/does-the-adage-n-distinct-equations-and-n-unknowns-gives-1-solution-always-ho"
} |
machine-learning, decision-trees, cross-validation, data-science-model, grid-search
1 frames
/usr/local/lib/python3.6/dist-packages/sklearn/tree/_export.py in export(self, decision_tree)
393 # n_features_ in the decision_tree
394 if self.feature_names is not None:
--> 395 if len(self.feature_names) != decision_tree.n_features_:
396 raise ValueError("Length of feature_names, %d "
397 "does not match number of features, %d"
AttributeError: 'GridSearchCV' object has no attribute 'n_features_'
code for decision-tree based on GridSearchCV
dtc=DecisionTreeClassifier()
#use gridsearch to test all values for n_neighbors
dtc_gscv = gsc(dtc, parameter_grid, cv=5,scoring='accuracy',n_jobs=-1)
#fit model to data
dtc_gscv.fit(x_train,y_train) | {
"domain": "datascience.stackexchange",
"id": 7418,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, decision-trees, cross-validation, data-science-model, grid-search",
"url": null
} |
biochemistry
I varried already concentrations and times without noticeable success. I also tried adding some BSA to Fibronectin - also without success. All solutions are within PBS.
Further steps I anticipate:
Varying pH around the protein's isolectric point (Fibronectin: around 5.2)
Adding some detergens to fn-solution (e.g. Tween)
Variation of salt-content in fn-protein-buffer
My question
I'm wondering what the exact reason for the stickiness of Fibronectin is and which parameter is the best to vary? Did I miss something? Does Fibronectin stick to the other proteins or rather to "free areas" of the surface?
Please note: surface modification techniques (e.g. using epoxys) are no option.
I'm not sure, whether this topic perhaps suits the chemistry-community better. Feel free to move.
What is the exact reason for the stickiness of Fibronectin? | {
"domain": "biology.stackexchange",
"id": 4519,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "biochemistry",
"url": null
} |
cosmology, cosmic-microwave-background
There is no one definition. The CMB formed over tens of thousands of years and at a range of redshifts.
See Understanding the recombination and decoupling periods in the early universe and For how long CMB was being emitted? | {
"domain": "physics.stackexchange",
"id": 66883,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cosmology, cosmic-microwave-background",
"url": null
} |
java, design-patterns, sudoku
fillColumns();
String[] cells = row.split(DELIMITERS);
int nAddedCells = 0;
for (int index = 0; index < cells.length; ++index) {
if (nAddedCells == mSudoku.getWidth()) {
if (mIsStrict) {
throw new IllegalArgumentException("Strict Mode: " +
"Too many symbols in " + row);
} else {
break;
}
}
String cell = cells[index];
if ("".equals(cell)) continue;
++nAddedCells;
withAddedCell(cell);
}
if (mIsStrict && nAddedCells < mSudoku.getWidth()) {
throw new IllegalArgumentException("Strict Mode: Too few " +
"symbols in " + row);
} | {
"domain": "codereview.stackexchange",
"id": 2141,
"lm_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, design-patterns, sudoku",
"url": null
} |
beginner, php, chat
This way it just does a simple check rather than loading a file.
I removed some of the comments as being overly obvious. You shouldn't have to comment a line that loads a file saying that it loads a file. Concentrate on commenting why you do things rather than on what you are doing.
Future improvements
Consider making things like deleting a response into their own methods. The current method is quite long. More, shorter methods would be easier to read.
Consider using a database for storage rather than files. Particularly for security reasons, don't name storage files with the .php extension.
Consider making classes to represent things like storage, responses, etc. | {
"domain": "codereview.stackexchange",
"id": 26976,
"lm_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, php, chat",
"url": null
} |
c, algorithm, interview-questions
So the rest is just some personal preferences. Nothing I could complain about in a code review.
int rightMost_of_curElem(int A[], int curElem, int ind, int n)
This returns the righmost element. Which means the user has basically has the index to beginning an end of a range. Most C/C++ like functions use a concept of beginning to one past the end. So I would have made this return the index of the first element that did not match (and re-named slightly).
Slight improvement is that you pass the index of the current index which you already know equals the value. You should pass current index + 1 (avoids one compare).
int remove_duplicates(int A[], int n)
You hard code the number of elements to retain. In an interview (and in real life) I would have parametrized this.
Using if(A[pos]==A[pos-1]) as a test seems a bit hard to read when testing one or two elements. I would just use the distance between pos and i to find the number.
I would have written like this: | {
"domain": "codereview.stackexchange",
"id": 3358,
"lm_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, interview-questions",
"url": null
} |
thermodynamics, molecules, gas-laws
Thus, even without shaking the can, it's possible to observe that the bottom end of a half-empty spray can will feel cooler to your hand than the top end.
Now, when you hold the can and shake it, you cause the propellant liquid to slosh around inside, coating all of the inner surface of the can instead of just the bottom. The sloshing also significantly increases the heat transfer from the can to the liquid, by causing the warmer liquid near the surface of the can to mix with the colder liquid in the interior. (This is essentially the same reason as why moving air feels cooler on your skin than still air.) Thus, a shaken can will generally feel even cooler to touch than either end of an unshaken can. | {
"domain": "chemistry.stackexchange",
"id": 3185,
"lm_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, molecules, gas-laws",
"url": null
} |
Now the quantity $\vec r \cdot \vec n$, call it the projected distance, has a natural geometric interpretation. It is simply the distance between $O$ and the tangent plane at the surface element. (Observe that for a sphere with $O$ at the center, it is always equal to the radius, and for a cube with $O$ at the center, it is always equal to the distance from the center to any face.) | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9861513881564148,
"lm_q1q2_score": 0.860266572857145,
"lm_q2_score": 0.8723473730188543,
"openwebmath_perplexity": 162.8361176625972,
"openwebmath_score": 0.8902303576469421,
"tags": null,
"url": "http://math.stackexchange.com/questions/38010/intuition-for-a-relationship-between-volume-and-surface-area-of-an-n-sphere/38017"
} |
quantum-mechanics, statistical-mechanics, condensed-matter, many-body, partition-function
Title: Partition function for independent particles I am trying to understand Section 3.8.3, "Independent particles", of Piers Coleman's Introduction to Many-Body Physics (self-study, mathematics background). He considers "a system of independent particles with many energy levels $E_\lambda$," with Hamiltonian
$$H - \mu N = \sum_{\lambda} (E_\lambda - \mu) \hat{n}_\lambda.$$
He then writes
the partition function is given by a product of the individual partition functions:
$$Z = \text{Tr} \left[\prod_{\lambda \, \otimes} e^{-\beta (E_\lambda - \mu) \hat{n}_\lambda} \right].$$
Since the trace of an (exterior) product of matrices, this is equal to the product of their individual traces ($\text{Tr} \prod_{\lambda \otimes} = \prod_\lambda \text{Tr}$),
$$Z = \prod_\lambda \text{Tr} [e^{-\beta (E_\lambda - \mu)\hat{n}_\lambda}] = \prod_{\lambda} Z_\lambda.$$ | {
"domain": "physics.stackexchange",
"id": 98795,
"lm_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, statistical-mechanics, condensed-matter, many-body, partition-function",
"url": null
} |
gene-expression, systems-biology
Signal fluctuations can be temporal but parameter fluctuations are not (parameters are supposed to be time invariant). Parameter fluctuation can exist in a genotypic space or a population of cells because of variation.
Some motifs are robust to signal perturbations whereas some are robust to parameter fluctuations.
Negative feedbacks and incoherent feed-forward can confer robustness by correcting the output fluctuations because of fluctuations in the input.
When an all or none sort of (binary: one state need not be smaller in magnitude than the other) behaviour is important, then positive feedbacks confer robustness to such systems because of their property of bistability.
I cannot recall any particular motif that is robust to parameters. There are certain cases though (I am still working on that!! :P).
In any case environment can be thought of as an input. For your question "what mechanisms can make a gene susceptible to a certain environment in one cell-type but not in another": | {
"domain": "biology.stackexchange",
"id": 3547,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gene-expression, systems-biology",
"url": null
} |
civil-engineering, hydrology, flow-control
Example 2: River Seine in Paris (from Les Miserables (2012))
What is the purpose of these structures? The two photos in the post show the same structure: Pulteney Weir, downstream of Pulteney Bridge on the River Avon in Bath. The shot of the "Seine" in Les Miserables was filmed on location in Bath.
Pulteney Weir was designed by architect Neville Conder, and built between 1968 and 1972. It's one component of the Bath Flood Prevention Scheme, which was carried out after the disastrous flood of December 1960. The Bath in Time website has photos of the old weir (which descended in a single step) and of the new weir under construction (1968, 1972).
An upstream view of the weir shows that there's more to the structure than the horseshoe-shaped steps: these meet a mid-river artificial island, and a channel to the left of the island terminates in a sluice gate. | {
"domain": "engineering.stackexchange",
"id": 299,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "civil-engineering, hydrology, flow-control",
"url": null
} |
nuclear-physics, nuclear-engineering
In the Tchernobyl nuclear plant of the 1986 accident, were there a secondary circuit, or were there only a primary circuit ?
If there were no secondary circuit : what is the advantage/purpose of the existence of a secondary circuit in a modern nuclear plant ? Many different reactors systems have been developped .
Mainly , six types are used to-day : Magnox , AGR , PWR , BWR , CANDU and RBMK .
So , they are different : it an obvious fact !
RBMK - like Tchernobyl - is an " old system " derived from military reactors to produce plutonium used in the West as in the East .
Yes , primary light water and steam drive directly a turbine in RBMK system .
A secondary circuit is a supplementary safety device : secondary water has no physical contact with primary water ( if exchangers are in perfect condition ...).
And yes , RBMK is believed in the West to be inherently less safe than a modern PWR like EPR . | {
"domain": "physics.stackexchange",
"id": 71822,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nuclear-physics, nuclear-engineering",
"url": null
} |
quantum-mechanics, operators, group-theory, lie-algebra
What is meant by Lie algebra corresponding to the unitary group comprises Hermitian operators in the derivation in that link? The short answer is that the idea of group elements that are infinitesimally near the identity element are described by the Lie algebra of the group. If $\mathbb{1}$ is the identity of the unitary group, we can think of infinitesimally nearby elements as $\mathbb{1} + i\epsilon X$, where $\epsilon$ is a small (real) number. The set of all possible $X$ such that $\mathbb{1}+i\epsilon X$ is unitary is the Lie algebra of the unitary group. You can check that in order for $\mathbb{1} + i\epsilon X$ to be unitary, $X$ must be Hermitian. (Simply apply the condition for unitarity, $U^\dagger U = \mathbb{1}$ and ignore second order terms in $\epsilon$.) That's what is meant by "the Lie algebra of the unitary group is the set of Hermitian operators". | {
"domain": "physics.stackexchange",
"id": 57406,
"lm_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, operators, group-theory, lie-algebra",
"url": null
} |
ros, navigation, local-planner, global-planner
What outputs these warning and error? I means which source file says error and warning? and What kind of problem happens on my plan?
Could anyone give me any clues? Thank you in advance?
Originally posted by Ken_in_JAPAN on ROS Answers with karma: 894 on 2014-06-24
Post score: 0
Yes, this in the rotate_recovery behavior inside the navigation stack. However, the actual cause of this is typically more complex. If your robot has an odd-shaped footprint, than that can be the cause. But if you are using a turtlebot, with a circular footprint and centered drive wheels, you should pretty much always be able to rotate in place -- unless localization drifts/jumps, thus putting you on top of an obstacle that was already in the cost map.
Originally posted by fergs with karma: 13902 on 2014-06-25
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 18373,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, navigation, local-planner, global-planner",
"url": null
} |
special-relativity, atomic-physics, laser
while the field in any transverse direction follows:
$$E_y = \frac{+e}{4\pi\epsilon_0\sqrt{1-v^2}}
\frac{y}{\big[\frac{(x-vt)^2}{1-v^2}-y^2+z^2 \big]^{\frac 3 2}} $$
Moreover, there is a magnetic field associated with the current, given by:
$$ \vec B = \vec v \times \vec E$$
The electric field looks like this: | {
"domain": "physics.stackexchange",
"id": 76247,
"lm_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, atomic-physics, laser",
"url": null
} |
typescript, ramda.js
Title: Group orders with Ramda I made some crude code using RamdaJS to essentially group orders by their states. There are some nested structures. Currently, I have a working code, but I wondering if Ramda can perhaps help to clean that up more? I've added TypeScript annotations to present (simplified) structures more clearly.
I've also prepared codesandbox with example data: https://codesandbox.io/s/yqwm2p65zz
import * as R from 'ramda'
export default function(orders: Order[], orderListing: OrderListing[]) {
const pluckStateEnum = (orderState: OrderState) => orderState.enum
const ordersByState = (states: OrderStateEnum[]) =>
orders.filter(
(order: Order) =>
!R.isEmpty(
R.intersection(R.map(pluckStateEnum, order.orderStates), states),
),
)
return orderListing.map(listing => ({
id: listing.id,
orders: ordersByState(listing.orderStateEnums).map(order => order.id),
}))
} | {
"domain": "codereview.stackexchange",
"id": 29747,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "typescript, ramda.js",
"url": null
} |
complexity-theory, terminology, complexity-classes, p-vs-np
for it. The exact algorithm depends on how you encode the number. If it is in unary you can just count the number of bits modulo 2, if it is in binary you can just check that the last bit is a 0. | {
"domain": "cs.stackexchange",
"id": 19311,
"lm_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, terminology, complexity-classes, p-vs-np",
"url": null
} |
complexity-theory, complexity-classes
$x\in L\Rightarrow \Pr\left[\text{M accepts x}\right]>\frac{1}{2}\left(1-2^{-n^c}\right)$, and
$x\notin L\Rightarrow \Pr\left[\text{M accepts x}\right]\le \frac{1}{2}-2^{-n^c}<\frac{1}{2}-\frac{1}{2}2^{-n^c}$
Which proves $L\in \class{PP}$, since we can replace the constant $\frac{1}{2}$ with any function $f(x)\in \class{FP}$. See this question for a proof to why we can replace $\frac{1}{2}$ with any rational constant, and convince yourself that it generalizes immediately to any $f\in \class{FP}$. | {
"domain": "cs.stackexchange",
"id": 7729,
"lm_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, complexity-classes",
"url": null
} |
localization, imu, navigation
false, false, false,
true, true, false]</rosparam>
<param name="imu0_differential" value="false"/>
<param name="imu0_relative" value="true"/> | {
"domain": "robotics.stackexchange",
"id": 23440,
"lm_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, imu, navigation",
"url": null
} |
javascript, algorithm, programming-challenge, functional-programming, ecmascript-6
An interval is covering another interval if one or more values in its range are the same. Examples A = [0, 1], B = [1, 2], C = [3, 4]. A covers B, C does not cover A and B
An interval is an array containing two unsorted integers, that have a range from min to max value inclusive. Examples [0, 1] has a range 0, 1. [3, -2] has a range -2, -1, 0, 1, 2, 3. [2, 2] has a range 2.
The following [], [0], [1,2,3] are not valid intervals
The return must be a valid interval
Your code
You have a bug and return incorrect intervals in some cases.
Two examples of the bug
Given the intervals [[10, 20], [10, -20]] your function returns [-20,10] which is in fact the largest range, the correct solution is [10, 10] (Yes unfair as [10,-20] is A over T)
Given intervals [[10,20]] you incorrectly return [10,20]. There are 11 possible correct solutions. Any of [10,10], [11, 11], ..., [n, n] (n = 20) | {
"domain": "codereview.stackexchange",
"id": 33627,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, algorithm, programming-challenge, functional-programming, ecmascript-6",
"url": null
} |
ros, hokuyo-laser, hokuyo-node, laser-filters
Originally posted by Naman on ROS Answers with karma: 1464 on 2015-05-11
Post score: 1
Original comments
Comment by hubble on 2015-06-16:
Hi ! I have the same issue as you... Have you found the solution ? Thanks a lot !!
You have to add the lower_replacement_value and upper_replacement_value. Else they are taken as NaN by default.
Originally posted by harsha336 with karma: 26 on 2018-04-05
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 21657,
"lm_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, hokuyo-laser, hokuyo-node, laser-filters",
"url": null
} |
java, performance, integer
Your powInternal is also a functional extraction that is redundant. I suspect this is a copy/paste issue, or a refactoring that was partially undone. Still, the assert is meaningless, and cannot happen, and the function should just be re-integrated in to the public pow(...) function. Then, I would also make base the variable that mutates in the loop, and remove the x variable, allowing you to convert the loop to a while loop. Finally, I know it is pedantic, but you should sjift the exponent with >>>= instead of >>=, even though the exponent is not negative. Something like:
public int pow(long base, long exp) {
checkArgument(exp>=0, "Only non-negative exponents are implemented."); //TODO allow negative exponents
if (modulus==1) return 0;
if (exp==0) return 1;
base = mod(base);
if (base<=1) return base; // For both 0 and 1, no exponentiation is needed. | {
"domain": "codereview.stackexchange",
"id": 14366,
"lm_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, performance, integer",
"url": null
} |
# word problem in probability
i would like to exactly what is asked in this problem:
The probability that A can solve the problem is $1/4$ and that B can solve it is $1/3$. If both of them try, what is the probability that problem will be solved.
$A. 1/4$
$B. 7/12$
$C. 1/3$
$D. 1/2$
$E. 1/12$
i will say what is a point of my confusion,when we are trying to find probability of two independent events,we are multiplying probability of each other to get probability that both event occur .now first it is what i have tried and got $1/12$,but it shows me that it is not correct,now i have this question and please could help me,how can i translate if both of them will try into probability language?
$P(A or B)$ is not correct because it means that one or second will solve,so it means that $P(A and B)$,but they are independent are this would not be product of their probabilities?let us denote probability that $A$ will solve by $P(A)$, and probability that $B$ will solve by $P(B)$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.986777178636555,
"lm_q1q2_score": 0.8367552246043028,
"lm_q2_score": 0.8479677506936878,
"openwebmath_perplexity": 762.0036368106973,
"openwebmath_score": 0.9102334380149841,
"tags": null,
"url": "http://math.stackexchange.com/questions/457103/word-problem-in-probability"
} |
orbit, orbital-resonance
Title: Is this a stable system? Just messing around and was wondering how stable a system like this would be. Seems like it would be subject to Kozai oscillations at least-- see https://www.cfa.harvard.edu/research/ta/kozai-lidov-mechanism. That mechanism tends to swap obliquity for eccentricity, without changing the energies of the orbits, so it is fueled by torque rather than work. It is easier to get a slow torque from two inclined orbits than it is to get work done, because work requires a consistently oriented force, whereas torque tends to require only an overall average asymmetry in the geometry. | {
"domain": "astronomy.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": "orbit, orbital-resonance",
"url": null
} |
c#, enum, pdf
Let's give a shot to reimplement the method based on this:
private void AddFieldToPdf(Field field,
iTextSharp.text.pdf.PdfStamper pdfStamper, int numberOfPages)
{
var parentField = iTextSharp.text.pdf.PdfFormField.CreateTextField(
pdfStamper.Writer, false, false, 0);
parentField.FieldName = field.Title;
int pageNumber = field.Pages == Pages.Last ? numberOfPages : PdfFirstPageNumber;
switch (field.Pages)
{
case Pages.All:
case Pages.Odd:
case Pages.Even:
int increment = field.Pages == Pages.All ? 1 : 2;
if(field.Pages == Pages.Even){
pageNumber += 1;
}
for (;pageNumber <= numberOfPages; pageNumber += increment)
{
AddFieldToPage(field, pageNumber, pdfStamper,
parentField);
}
break;
case Pages.First:
case Pages.Last:
AddFieldToPage(field, pageNumber, pdfStamper, | {
"domain": "codereview.stackexchange",
"id": 20216,
"lm_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#, enum, pdf",
"url": null
} |
c#, design-patterns, sorting, expression-trees
public ComparerBuilder<T, TComparable> LessThen(Expression<Func<bool>> expression)
{
_expressions[CompareOperator.LessThan] = expression;
return this;
}
public ComparerBuilder<T, TComparable> Equal(Expression<Func<bool>> expression)
{
_expressions[CompareOperator.Equal] = expression;
return this;
}
public ComparerBuilder<T, TComparable> GreaterThan(Expression<Func<bool>> expression)
{
_expressions[CompareOperator.GreaterThan] = expression;
return this;
}
internal IDictionary<CompareOperator, Func<T, T, bool>> Build()
{
var left = Expression.Parameter(typeof(T), "left");
var right = Expression.Parameter(typeof(T), "right");
return _expressions.ToDictionary(x => x.Key, x => CompileComparer(x.Value, new[] { left, right }));
} | {
"domain": "codereview.stackexchange",
"id": 32490,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, design-patterns, sorting, expression-trees",
"url": null
} |
php, sql, pdo
Many connections
For each action you make a separate connection. You can improve the performance of your script by creating one connection, and make every query use that connection instead.
General bugs
file_get_contents(..) returns FALSE on failure. The documentation is not concise about this, but I assume that a timeout will cause it to fail. Your script should do something sensible in this case instead of trying to decode it as json.
json_decode(..) returns NULL if the result cannot be decoded properly (e.g. someone replaced the resource to "Use v.77.2 you silly goose") or the recursion limit is exceeded. You do not check for this condition.
If one of the inserts fails, do you really want to just ignore that insert and continue inserting? Do you really not want to retry it at the very least (in case of a failed connection for example).
Maintainability | {
"domain": "codereview.stackexchange",
"id": 18016,
"lm_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, sql, pdo",
"url": null
} |
homework-and-exercises, newtonian-mechanics, momentum, energy-conservation, conservation-laws
$$mgR={1\over 2}mv^2+{1\over 2}MV^2.$$ | {
"domain": "physics.stackexchange",
"id": 100130,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, momentum, energy-conservation, conservation-laws",
"url": null
} |
c++, c++11, reinventing-the-wheel, queue
typename vector<T, Allocator>::iterator operator -> () const
Why not T *operator->() const?
template <class T, class Allocator>
deque<T, Allocator> &deque<T, Allocator>::operator = (deque<T, Allocator> &&x) {
negative = x.negative;
positive = x.positive;
return *this;
}
You're not getting move semantics here. This function should be =default'ed anyway; but if you're not going to =default it, then you ought to be doing
negative = std::move(x.negative);
positive = std::move(x.positive);
so that the vector contents are moved rather than copied.
In particular, because of your inefficient move-assignment operator, your swap operation is neither efficient nor noexcept:
template <class T, class Allocator>
void swap(deque<T, Allocator> &x, deque<T, Allocator> &y) {
deque<T, Allocator> temp(std::move(x));
x = std::move(y);
y = std::move(temp);
} | {
"domain": "codereview.stackexchange",
"id": 15224,
"lm_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, reinventing-the-wheel, queue",
"url": null
} |
algorithm-analysis, asymptotics, sorting
So we need to come up with a function that does just depend on the length of the input. Two natural functions are the best-case and worst-case number of execution steps. We know that, for an input of length $n$, the best case is that insertion sort finds that the input is already sorted, and in this case, it takes a linear number of steps. No more, no less, so we're entitled to say that the best-case running time of the algorithm is $\Theta(n)$. Similarly, we're entitled to say that the worst-case running time is $\Theta(n^2)$. | {
"domain": "cs.stackexchange",
"id": 8748,
"lm_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, asymptotics, sorting",
"url": null
} |
civil-engineering, power
Title: Connecting power lines around corners I am working on a model city.
Suppose I have utility poles A, B and C (brown) that go around a sharp corner. Looking from above, how do I connect the poles with power lines (gray, solid)?
Are the crossarms of utility pole B rotated correctly with respect to the direction of the lines? Do the crossarms of pole B the correct length, or do they need to be longer than normal? Are there any other problems I should keep in mind?
Thanks. You can easily see that the wires don't allign(parallel) with the dotted line which would be the line they should follow to maintain the same mutual distance. To calculate the widht the mast should have, you can take the width of the first mast, and divide that by $cos(\alpha)$ where $\alpha$ is half the angle the middle mast makes in degrees. | {
"domain": "engineering.stackexchange",
"id": 1892,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "civil-engineering, power",
"url": null
} |
immunology, antigen
So, why does an immune reaction not happen when a new protein is introduced to patients lacking it ? For example if you give clotting factor to hemophilic patient. They actually can produce antibodies against the clotting factor (as @Xylo pointed out, many patients do produce the clotting factor that's being replaced, just in insufficient quantity, which lowers a lot the risk of an immune response). The antibodies against the clotting factor are called inhibitors. See here for more info. | {
"domain": "biology.stackexchange",
"id": 1625,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "immunology, antigen",
"url": null
} |
homework-and-exercises, newtonian-mechanics, newtonian-gravity, earth
So now we apply the integral form of Gauss's law to the Earth, whose mass distribution is very nearly perfectly axisymmetric, i.e. depends on the distance $r$ from the Earth's centre. Thus, by symmetry and Gauss's law, we know that the gravitational field at a distance $r$ from the centre is the same as that arising from a point mass whose mass equals the total mass enclosed within a sphere of radius $r$. Thus if the density as a function of radius $r$ is $\rho(r)$ we have:
$$g(r) = 4\,\pi\,\int_0^r \,u^2 \,\rho(u)\,\mathrm{d} u\,\frac{G}{r^2}$$
where the field is of course always directed towards the Earth's centre.
Now the form of $\rho(r)$ is highly nontrivial, being determined by the different materials at different depths and the response of that material to pressure as described by e.g. the Adams-Williamson Equation.
But if we idealise the Earth so that $\rho(r) = \rho_0$ we get:
$$g(r) = \frac{4}{3}\pi\,G\,\rho_0\,r$$ | {
"domain": "physics.stackexchange",
"id": 11942,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, newtonian-gravity, earth",
"url": null
} |
javascript, jquery
I don't like your filterData() function at all. First off, it seems like you should be able to refactor it to avoid redefining the same variable again and again. Second, I'm just not sure I see the point. To me it looks like this is just removing unwanted tags from something. No idea what, but it seems like you should be able to use a selector to chose what part of that document you want without having to regex it. Because I don't know exactly what you are trying to do here I can't make a good suggestion, sorry. | {
"domain": "codereview.stackexchange",
"id": 2575,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery",
"url": null
} |
happen.</p> http://mathoverflow.net/questions/20696/a-question-regarding-a-claim-of-v-i-arnold/64414#64414 Comment by VA VA 2012-04-09T19:04:15Z 2012-04-09T19:04:15Z Dear Robert, let me try to explain myself better. This is what I am saying: Denote the vertex of the right triangle by $P$ (it lies on the line $y=x$). Then it is easy to draw a triangle in which the slopes of AB and DC are very close to 1, but AD/BC=2, <b>*for as long as*</b> AD and BC are much much smaller than AP and BP. But this is indeed the case here. http://mathoverflow.net/questions/20696/a-question-regarding-a-claim-of-v-i-arnold/64414#64414 Comment by VA VA 2012-04-09T16:41:43Z 2012-04-09T16:41:43Z "BD" should read "BC" everywhere. http://mathoverflow.net/questions/20696/a-question-regarding-a-claim-of-v-i-arnold/64414#64414 Comment by VA VA 2012-04-09T16:17:36Z 2012-04-09T16:17:36Z At first, this looks like a great geometric explanation. Unfortunately, I do not understand it. The problem is | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9840936054891429,
"lm_q1q2_score": 0.8022650731317889,
"lm_q2_score": 0.8152324826183822,
"openwebmath_perplexity": 1032.683736208798,
"openwebmath_score": 0.8992882966995239,
"tags": null,
"url": "http://mathoverflow.net/feeds/user/1784"
} |
c++, beginner, console, c++14, adventure-game
system("cls"); // clears the screen
cout << "You wake up after being blacked out, you proceed to stand up and look into the land and see that forests, villages, and farms are burned to the ground.\n";
cout << "while starring in disbelif you hear a lound shreek you have two paths.\n";
cout << "1. Head up the mountains.\n";
cout << "2. Head down the path towards the town.\n";
cin >> SChoice; // select choice used for numbers
if (SChoice == 1)
{
cout << "Type any letter to continue....\n";
system("cls"); | {
"domain": "codereview.stackexchange",
"id": 21401,
"lm_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, c++14, adventure-game",
"url": null
} |
root of b. n √x nth Root formula nth Root Definition: Definition of nth Root:. In printed form a hook for the square root, i. nth root In mathematics, the nth root of a number x is a number r which, when raised to the power of n, equals x where n is the degree of the root. Excel's powerful mathematical toolkit includes functions for square roots, cube roots, and even nth roots. The calculator will generate all the work with detailed explanation. The following chart is a visual representation of the integer square root over a portion of the. nth Root The number that must be multiplied times itself n times to equal a given value. without the vinculum (=the horizontal bar over the numbers inside the radical symbol), appears for the first time in the year 1525 in Die Coss by German mathematician Christoff Rudolff. The shifting nth root algorithm is an algorithm for extracting the nth root of a positive real number which proceeds iteratively by shifting in n digits of the radicand, starting | {
"domain": "mdeparis.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9865717464424894,
"lm_q1q2_score": 0.8156104942687764,
"lm_q2_score": 0.8267117898012105,
"openwebmath_perplexity": 471.26140074529457,
"openwebmath_score": 0.7266640067100525,
"tags": null,
"url": "http://mdeparis.it/pqrr/nth-root-in-r.html"
} |
materials
Also, can wool bricks be used in the house's construction? Yes.
This can be delivered as a set of wooden-framed walls all with completed wiring and pipework pre-fitted, as well as insulation and final internal wall finishes. Only some joints need painting.
A friend had one delivered like that, build from the foundations was 2 weeks.
There are companies that do this and I won't tell you the one he used as it may not be local to you. You can easily search for others as there are several. Try looking at the trade shows - they always are present there.
As for insulation it can be any material as long as its performance specs meet building regulations. We used "wood wool" as well as lamb's wool in ours, but we specified 30cm of insulation. A no-brainer between a small construction cost increase or lower heating bills for 40 years... | {
"domain": "engineering.stackexchange",
"id": 4266,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "materials",
"url": null
} |
homework-and-exercises, thermodynamics, pressure, vacuum, evaporation
Title: Methods to solve a vapor pressure equilibrium question with water on the moon?
"Imagine a tall column of water on the Moon, maintained at a temperature of 50°C and left to the open vacuum at the top. Up to what depth will the water continue to boil? The Moon's radius is 0.273 that of the Earth's and its mass is 1.23% that of the Earth's. "
This question is on a physics prize exam in our area and is the only question on the exam that I have no knowledge on how to complete. I understand that if the vapor pressure of a liquid is less than the pressure of the liquid then the liquid will vaporize, but I still do not understand how I would use that knowledge to solve this problem. I am wondering if there are any resources that will further explain the vapor pressure equilibrium that could potentially lead to a way to solve this question? Or any explanation on how to approach this question to solve it?
Thank you.
NOTE | {
"domain": "physics.stackexchange",
"id": 28242,
"lm_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, thermodynamics, pressure, vacuum, evaporation",
"url": null
} |
image-processing, wavelet, transform
There, you have A, H, V and D. A standard DWT further decomposes the small top-left image. With the same reasoning, you get approximation, vertical, horizontal and "diagonal" details at a second level (the $2$ in your comand):A2, D2, H2, V2.
Since A1 has been decomposed, you are left with A2, V2, H2, D2, V1, H1 and D1, hence $7$ images. With the DWT, those images are smaller (by $4 \times 4$ and $2 \times 2$).
Here, we have taken separate original $2 \times 2$ blocks. Another word for it is decimation, by $2$, after each filter pass.
Wiht ndwt2, the main difference is that you do not decimate, it is like taking blocks with overlap. So, normally, the A, V, H, D images look about the same, except they have almost the same size as the original (up to border effects and extension).
I am surprised by the apprroximation you show. Indeed, I believe there is a read or format issue with it. Open it with an image editor, save it again an a new JPG or PNG seems to fix the problem. | {
"domain": "dsp.stackexchange",
"id": 3588,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "image-processing, wavelet, transform",
"url": null
} |
observational-astronomy, gravitational-waves
For reference only: this is what got me curious enough to ask the question. GW190425 was the first event to be confidently detected based on data from a single detector. This means that the localization on the Earth's sky was likely not as good as if multiple detectors observed it. As such, no electromagnetic counterpart was observed for this merger.
Although LIGO/Virgo could not rule out that one or both components were black holes, it is unlikely, theoretically speaking, that the components were black holes because their masses are well below the expected lower limit of the mass gap between neutron stars and black holes. However, the existence of such a mass gap is uncertain (e.g., see this). | {
"domain": "astronomy.stackexchange",
"id": 6270,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "observational-astronomy, gravitational-waves",
"url": null
} |
electrical-engineering, energy, renewable-energy, wind-power
You could try to manually include temperature de-rating (I don't know exactly how this works, but if you have a curve you could apply it), but if your aim is to check that the Windfarmer result is sensible, this ought to get you pretty close. | {
"domain": "engineering.stackexchange",
"id": 2857,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrical-engineering, energy, renewable-energy, wind-power",
"url": null
} |
organic-chemistry, everyday-chemistry
From the non-scientific sources I glanced through, it seems to be well known that excessive soot buildup can be due to wet fuel or low airflow and that burning a very hot fire can help make soot easier to remove. As for the corn starch, it may indeed be leaving some deposit that hinders soot adhesion (there are commercial cleaners that claim to leave a film behind that makes soot easier to remove), the act of applying it may be removing existing soot that's too small to see but new soot adheres readily too, or it may do nothing. Perhaps you might want to try applying corn starch to half of a freshly-cleaned window to see if there is a noticeable difference. | {
"domain": "chemistry.stackexchange",
"id": 9186,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, everyday-chemistry",
"url": null
} |
c#, performance, linq, set
//intersect the other sequences
do
{
hashSet.IntersectWith(sourceIterator.Current);
}
while (sourceIterator.MoveNext());
foreach (TSource element in hashSet)
{
yield return element;
}
}
else
{
//if there is only one sequence, return it without any intersection
foreach (TSource element in firstSequence)
{
yield return element;
}
}
}
}
I'm particularly annoyed that the method is lot of times slower than the following implementation, when there is only one sequence:
public static IEnumerable<TSource>
Intersect<TSource>(this IEnumerable<IEnumerable<TSource>> source)
{
return source.Aggregate((x, y) => x.Intersect(y));
} | {
"domain": "codereview.stackexchange",
"id": 9344,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, linq, set",
"url": null
} |
cc.complexity-theory, computability, pl.programming-languages
The authors give a proof that this can express exactly the primitive recursive functions. The language PL does not match the question perfectly, as it uses GOTO instead of while, and PL-{GOTO} is derived from PL by removing GOTO from it. However, PL programs are just as powerful as while programs, and this GOTO-removal transformation is just as simply stated as replacing while with for. (Arguably perhaps even a bit simpler.)
Edit 2: http://en.wikipedia.org/wiki/Total_Turing_machine suggests this result goes back to: Meyer, A.R., Ritchie, D.M. (1967), The complexity of loop programs, Proc. of the ACM National Meetings, 465. According to a classic result of Meyer and Ritchie (mentioned in the paper cited in the question), the elementary functions are characterized by LOOP programs in which the nesting depth of for-loops is restricted to be at most 2. | {
"domain": "cstheory.stackexchange",
"id": 1806,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cc.complexity-theory, computability, pl.programming-languages",
"url": null
} |
computability, lo.logic
Background:
Assuming towards a contradiction that there is a Turing machine $Q$ that can decide on input $M$ which is an encoding for a Turing machine and $X$, whether or not $M(X)$ halts. Then consider a Turing machine $K$ that takes $M$ and $X$ and uses $Q$ to decide whether $M(X)$ halts or not, and then does the opposite, i.e. $K$ halts if $M(X)$ doesn't halt, and doesn't halt if $M(X)$ halts. Then $K(K)$ demonstrates a contradiction, as $K$ should halt if it doesn't halt, and doesn't halt when it halts.
Motivation: | {
"domain": "cstheory.stackexchange",
"id": 349,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computability, lo.logic",
"url": null
} |
This is basically our algorithm. Below you can find the algorithm for $30$.
##### Code to perform this
The code to perform this is quite easy, specially in python, because of the filter function. Let's see the code;
n = 20
all_list = [i for i in range(2,n+1)]
factor_2_remove = filter(lambda m: m %2 !=0, all_list)
factor_2_remove = list(factor_2_remove)
factor_2_remove.append(2)
print(factor_2_remove)
#output:[3, 5, 7, 9, 11, 13, 15, 17, 19, 2]
As you can clearly see, first we have created a list containing a list from $2$ to $n$, then we use filter. This function filter out the numbers which doesn't satisfy the given. Here the condition is $m \not\equiv 0$ mod $2$. This is written as $m%2 !=0$ in python. After using this we again have to add $2$ as it also doesn't satisfy the condition so, it also is removed.
So, to find all primes within any range, we simply do this for all number, not just $2$. You can use a simple for loop for this. | {
"domain": "cheenta.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9744347890464283,
"lm_q1q2_score": 0.8182659935979606,
"lm_q2_score": 0.8397339696776499,
"openwebmath_perplexity": 469.14476845179405,
"openwebmath_score": 0.8144057989120483,
"tags": null,
"url": "https://www.cheenta.com/sieve-of-eratoshenes/"
} |
ros, simulation, camera
Xacros's conditional block (xacro:if) expects value to be 0, 1, true or false. When the environment variable JACKAL_URDF_EXTRAS is not set then $(optenv JACKAL_URDF_EXTRAS 0) evaluates to 0 (which is correct), but when you do export JACKAL_URDF_EXTRAS=~/somepath it evaluates to ~/somepath (which makes xacro:if fail)
A possible solution would be:
In addition to export JACKAL_URDF_EXTRAS=... (according to http://www.clearpathrobotics.com/assets/guides/ros/ROS%20Navigation%20Basics.html#customization) also do:
export USE_JACKAL_URDF_EXTRAS=1
And then change the code in jackal_description/urdf/jackal.urdf.xacro to:
<!-- Optional custom includes. -->
<xacro:if value="$(optenv USE_JACKAL_URDF_EXTRAS 0)">
<xacro:include filename="$(env JACKAL_URDF_EXTRAS)" />
</xacro:if>
This will tell jackal_description/urdf/jackal.urdf.xacro to load JACKAL_URDF_EXTRAS when USE_JACKAL_URDF_EXTRAS is set to 1 or true.
I hope this helps | {
"domain": "robotics.stackexchange",
"id": 28604,
"lm_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, simulation, camera",
"url": null
} |
Documentation
This is machine translation
Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.
besseli
Modified Bessel function of first kind
Syntax
`I = besseli(nu,Z)I = besseli(nu,Z,1)`
Definitions
The differential equation
`${z}^{2}\frac{{d}^{2}y}{d{z}^{2}}+z\frac{dy}{dz}-\left({z}^{2}+{\nu }^{2}\right)y=0,$`
where ν is a real constant, is called the modified Bessel's equation, and its solutions are known as modified Bessel functions.
Iν(z) and Iν(z) form a fundamental set of solutions of the modified Bessel's equation. Iν(z) is defined by
`${I}_{\nu }\left(z\right)={\left(\frac{z}{2}\right)}^{\nu }\sum _{\left(k=0\right)}^{\infty }\frac{{\left(\frac{{z}^{2}}{4}\right)}^{k}}{k!\Gamma \left(\nu +k+1\right)},$`
where Γ(a) is the gamma function.
Kν(z) is a second solution, independent of Iν(z). It can be computed using `besselk`.
Description | {
"domain": "mathworks.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9899864278996301,
"lm_q1q2_score": 0.802363117416582,
"lm_q2_score": 0.8104789063814617,
"openwebmath_perplexity": 1128.3354420156006,
"openwebmath_score": 0.8699938654899597,
"tags": null,
"url": "https://www.mathworks.com/help/matlab/ref/besseli.html?requestedDomain=www.mathworks.com&nocookie=true"
} |
quantum-field-theory, operators, gauge-theory, differentiation, second-quantization
$$\tilde{\nabla}\psi^\dagger=\psi^\dagger\tilde{\nabla}^\dagger=\nabla\psi^\dagger-ie\psi^\dagger\textbf{A}.$$
Question: Why does the covariant derivative act differently on the creation operator, why is it conjugated? If it's any help, the annihilation and creation operators are defined as
$$\psi=\begin{pmatrix}\psi_\uparrow\\\psi_\downarrow\\\psi_\uparrow^\dagger\\\psi_\downarrow^\dagger\end{pmatrix},\qquad\psi^\dagger=\begin{pmatrix}\psi_\uparrow^\dagger&\psi_\downarrow^\dagger&\psi_\uparrow&\psi_\downarrow\end{pmatrix}.$$ Let us look at this prolem from a (relativistic) field theory perspective.
The Hamiltonian for $\psi$ must contain a term of the form
$$ \nabla\psi^\dagger\cdot\nabla\psi$$
due to Lorentz invariance. Assuming $\psi$ to transform in a representation of U(1). Resulting in the following simultanious transformations:
$$\begin{aligned}\psi\rightarrow U(x)\psi \\\\\psi^\dagger \rightarrow \psi^\dagger U^\dagger(x)\end{aligned}$$ | {
"domain": "physics.stackexchange",
"id": 25260,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, operators, gauge-theory, differentiation, second-quantization",
"url": null
} |
crystal-structure, crystallography
Title: Silicon crystal orientation I'm confused about how [110] direction is determined for (100), (110) or (111) wafers. I found a book chapter which just confused me even more. From the image below, I understand how [110] is determined on the (110) wafer but not the other two. I'm also having a hard time understanding what different planes would look like on the (111) and (110) wafer. I would appreciate a resource for silicon wafers specifically (not necessarily crystallography). Here are things I'm not understanding.
How is the [110] direction determined and why is it different for each of the three wafers below? For the (110) wafer [110] is between x and y axis which makes sense. But for (100) it seems to go from z to y and for (111) it's between x and z. From my understanding [110] intercepts x and y axis at 1 and doesn't intercept z axis but that doesn't seem to be the case for (100) and (111) wafers. | {
"domain": "chemistry.stackexchange",
"id": 17025,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "crystal-structure, crystallography",
"url": null
} |
approximation, floating-point, numerical-algorithms, intervals
Title: Bisecting Intervals of floating point numbers containing 0 and infinity fairly It is seldom considered that floating points are not evenly distributed in the real number line. I've been working with interval arithmetic and noticed when bisecting $[a,b]$ on the real number line into $[a,(a+b)/2]$ and $[(a+b)/2,b]$ starting from $[-1.3552646593344489*10^{308}
,0]$ until $a,b$ are neighboring floats takes way more steps when you always pick the interval containing $-10$ and way fewer steps if you always pick the interval containing $-10^{305}$. This is because taking the average of two floating point (fp) numbers with differing exponents divides a floating interval in sub intervals which contain a very different number of floats.
Given two interval boundaries $(a,b)$ how do i calculate a fp number $m$ such that between $a$ and $m$ there are nearly as many fp numbers as between $m$ and $b$ given that $a,b$ can have different signs or have values from $\{-\infty,\infty\}$? | {
"domain": "cs.stackexchange",
"id": 19751,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "approximation, floating-point, numerical-algorithms, intervals",
"url": null
} |
import java.util.Random;
public class CardCounter {
/**
* @param args
*/
public static void main(String[] args) {
int heartThenEvenCount = 0;
int cardsNotEqualCount = 0;
for(int i = 0; i < 1000000; i++) {
Random r = new Random();
int card1 = r.nextInt(51) + 1;
int card2 = r.nextInt(51) + 1;
/* Assume that 1-13 are hearts
Ace = 1
King = 0
Queen = 12
Jack = 11
Other numbers as they are written on card. */
//Make sure the cards are not the same
if(card1 != card2) {
// Check to see if the first card is a heart.
cardsNotEqualCount++;
if(card1 <= 13) {
// Check to see if the second card is even, but not a face card.
int card2Rank = (card2 % 13);
if(card2Rank > 0 && card2Rank <= 10 && (card2Rank % 2) == 0) {
heartThenEvenCount++;
}
}
}
}
System.out.println(heartThenEvenCount + " / " + cardsNotEqualCount);
System.out.println(heartThenEvenCount/(double)cardsNotEqualCount);
}
} | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429619433692,
"lm_q1q2_score": 0.8318515438461764,
"lm_q2_score": 0.845942439250491,
"openwebmath_perplexity": 475.50766479533127,
"openwebmath_score": 0.9324673414230347,
"tags": null,
"url": "https://stats.stackexchange.com/questions/211283/probability-of-drawing-a-heart-and-then-an-even-number-without-replacement-fro"
} |
and equal..., we know that the graph tan x, 2017 Messages a function that with! It means for a function whose graph is unbroken at a point x=a where is! N'T continuous are very difficult they disagree Feat work against swarms formulation of site... Not equal to the limit at a point given a function can be explained as a function is a function! Epsilon and delta Feat work against swarms a t π/2 fortunately for us, a is the! Defines what it means for a function of two variables at a hole each begins... Concept of a function can be drawn without lifting the pencil from the given,! That the graph of the most crucial topics in calculus f. angle of a at! Particular side different values at a hole whose graph is unbroken at a point... Been widely explained in Class 11 and Class 12 been widely explained in Class 11 and Class.! For us, a function of one variable exercises will help you practise the procedures involved finding. Given a function whose graph is unbroken at a point x = c, of. Exist | {
"domain": "bestfortnitesettings.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9808759663238371,
"lm_q1q2_score": 0.8152482381700669,
"lm_q2_score": 0.831143045767024,
"openwebmath_perplexity": 352.7097225441085,
"openwebmath_score": 0.8293384909629822,
"tags": null,
"url": "https://bestfortnitesettings.com/7hbwg/2aa728-continuity-of-a-function"
} |
c, file, homework, utf-8
} else if (bitPos <= 11) {
bufferOut[0] = (codepoint >> 6) | 0xC0;
bufferOut[1] = (codepoint & mask) | 0x80;
fwrite(bufferOut, 1, 2, out);
} else if (bitPos <= 16) {
bufferOut[0] = (codepoint >> 12) | 0xE0;
for(int i=1; i<3; i++)
bufferOut[i] = ((codepoint >> 6*(2-i)) & mask) | 0x80;
fwrite(bufferOut, 1, 3, out);
} else if (bitPos <= 21) {
bufferOut[0] = (codepoint >> 18) | 0xF0;
for(int i=1; i<4; i++)
bufferOut[i] = ((codepoint >> 6*(3-i)) & mask) | 0x80;
fwrite(bufferOut, 1, 4, out);
} else if (bitPos <= 26) {
bufferOut[0] = (codepoint >> 24) | 0xF8;
for(int i=1; i<5; i++)
bufferOut[i] = ((codepoint >> 6*(4-i)) & mask) | 0x80;
fwrite(bufferOut, 1, 5, out); | {
"domain": "codereview.stackexchange",
"id": 38293,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, file, homework, utf-8",
"url": null
} |
optimization, c, homework, queue
2nd version
It's not clear whether your Queue new_queue() is part of the code which we're allowed to review.
Assuming that we are allowed to review/change that, I would add, "**Don't create "first element" which represents (contains a first pointer to) the queue: instead the queue should be represented by a pointer to the first real element."
Your first node (allocated using new_queue) might be what's called a "sentinel node" (see references here and here). It's also possible to create a queue without using a sentinel node: the "queue" is simply a pointer to the first node (instead of being a pointer to a node which contains a pointer to the first real node).
void add (Queue* qptr, int priority, Datatyp *d)
{
// initiation
Queue element = (Queue)malloc (sizeof(struct Qelement));
element->prio = priority;
element->dataptr = d; | {
"domain": "codereview.stackexchange",
"id": 6082,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optimization, c, homework, queue",
"url": null
} |
general-relativity, length-contraction
Title: Lorentz contraction in continuously accelerating rod I was having a little thought experiment about Lorentz contraction, and I couldn't really figure out what would actually happen. Note that I'm not looking for a answer 'this effect is barely noticeable'; consider I have a cat that steps on my keyboard.
Say, we are a stationary observer, and we observe a rod continuously accelerating along its axis. As far as the rod is concerned, it is accelerating uniformly.
Being a stationary observer, my guess is that we don't see it accelerating uniformly. It is exhibiting Lorentz contraction, so the rod seems to be getting shorter as it accelerates. In order for the tip and the end of the rod to end up closer to each other after some time accelerating, the end of the rod must appear to be moving faster than the tip of the rod. | {
"domain": "physics.stackexchange",
"id": 21107,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, length-contraction",
"url": null
} |
aerospace-engineering, renewable-energy, regulations
Title: Do regulations in the United States limit the size of aerial wind turbines? What with all the work done by the FAA recently on regulating drone usage, I thought it would be nice to turn my eyes to the sky for another, less-known type of aerial denizen: the aerial wind turbine.
Wikipedia has all the relevant information, so I won't rehash it here. The most important thing here is that aerial wind turbines - and I'm mostly interested in aerostat-based designs - are free-floating, just like certain types of tethered drones, which have given the FAA headaches because they're not like most aircraft.
I did find this article, which says
Regulations and technological restrictions suggest it may not happen very soon, or at all, but some researchers believe aerial turbines will be tapping high-altitude winds for power generation sometime in our future and perhaps within the decade.
and | {
"domain": "engineering.stackexchange",
"id": 73,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "aerospace-engineering, renewable-energy, regulations",
"url": null
} |
homework-and-exercises, kinematics
Which would give me dv/dx * dx/dt = dv/dt
Which gives me dv/dt = dv/dt?
I figured it out. Thanks for the answer though
Dv/dt= dv/dx dx/dt => dv/dt * (dx/dt)^-1 = a/v.
So to get a, wee multiply by v giving us a= v*dv/dx. I get it meows First use the chain rule and then the rule for the derivative of an inverse function:
$$
\frac{dv}{dx}=\frac{dv}{dt}\cdot\frac{dt}{dx}=\frac{dv}{dt}\left(\frac{dx}{dt}\right)^{-1}=\frac{a}{v}
$$
This is basically the identity that you wanted to investigate. | {
"domain": "physics.stackexchange",
"id": 15605,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, kinematics",
"url": null
} |
javascript, jquery, html, jquery-ui, autocomplete
document.getElementById('countryOuter').style.display = 'block';
$( "#country" ).autocomplete({
delay: 0.5,
source: countriesArr,
select: function(event, ui) {
$('#country').attr('disabled', 'disabled');
$('#region').removeAttr('disabled');
console.log(event, countriesObj[ui.item.label]);
getRegions(countriesObj[ui.item.label]);
}
});
}
});
};
function getRegions(countryId) {
$.ajax({
url: "http://api.vk.com/method/database.getRegions?v=5.69&country_id=" + countryId,
dataType: "jsonp",
success: function( data ) {
var regionsRaw = data['response']['items'];
console.log( regionsRaw ); | {
"domain": "codereview.stackexchange",
"id": 28246,
"lm_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, html, jquery-ui, autocomplete",
"url": null
} |
java, linked-list
After that code has been filtered, we find zero elements in uniqueTails, because all were duplicates. That data structure has capacity for (n-1)*2 elements (hash table size is doubled when a certain load factor is reached). We have n elements in duplicates, which also has size for (n-1)*2 elements. Thus in the worst case, we have allocated 2× as much memory as neccessary. But if one of those elements is unique, we can avoid the table size doubling in duplicates, thus using only 1.5× as much memory. If the duplicates are adjacent (A, A, B, B), then the uniqeTails never grow (best case scenario).
Depending on the exact numbers of unique duplicate elements, the acceptable load factor, and the longest streak of unique elements, we can get anything from 1× to 2× the memory usage (plus overhead), but will rather stay at the lower end of that range. I consider this acceptable for most scenarios.
Time | {
"domain": "codereview.stackexchange",
"id": 4447,
"lm_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, linked-list",
"url": null
} |
$\frac{a}{b}=\frac{10}{7}$.
Hence, $7a=10b$.
Since they are relatively prime, $a=10$, $b=7$.
$10-7=\boxed{\textbf{(C)}\ 3}$.
## Solution 5
Note that the denominator, when simplified, gets $3.$ We now have to test the answer choices. If one has a good eye or by simply testing the answer choices the answer will be clearly $\boxed{\textbf{(C)}\ 3}$ ~mathboy282
Solution 6 Let us rewrite the expression as $\frac{(a-b)^2 + 3ab)}{a-b}$. Now letting $x = a - b$, we simplify the expression to $\frac{70x^2 + 3ab}{x} = \frac{73}{3}$. Cross multiplying and doing a bit of simplification, we obtain that $ab = \frac{70x^2}{9}$. Since $a$ and $b$ are both integers, we know that $\frac{70x^2}{9}$ has to be an integer. Experimenting with values of $x$, we get that $x = 3$ which means $ab = 70$. We could prime factor from here to figure out possible vlaues of $a$ and $b$, but it is quite obvious that $a = 10$ and $b=7$, so our desired answer is $3$ ~triggod
~ pi_is_3.14
~savannahsolver | {
"domain": "artofproblemsolving.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9918120888882,
"lm_q1q2_score": 0.8014508356201663,
"lm_q2_score": 0.8080672181749422,
"openwebmath_perplexity": 101.78486848576131,
"openwebmath_score": 0.9558729529380798,
"tags": null,
"url": "https://artofproblemsolving.com/wiki/index.php?title=2012_AMC_10A_Problems/Problem_17&oldid=142853"
} |
particle-physics, neutrinos, dark-matter, density, beyond-the-standard-model
Title: What is the relation between energy density ($\Omega$) and the number density of neutrinos ($n$)? What is the numerical relation between energy density ( $\Omega_\text{s}, \Omega_\alpha$), and the number density of neutrinos (sterile - $n_s$ , active - $n_\alpha$)? | {
"domain": "physics.stackexchange",
"id": 70343,
"lm_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, neutrinos, dark-matter, density, beyond-the-standard-model",
"url": null
} |
quantum-mechanics, quantum-information, quantum-measurements
What is wrong with my conclusion, and why is that? You're right that the post-measurement state would be represented by the action of the projection operator $(\vert \alpha_1 \rangle\langle \alpha_1\vert \otimes \mathbb{I})$ on the pre-measurement state (up to a constant, of course). However, the resultant of this would not get rid of all the coefficients $c_{\alpha\beta}$. Rather (check this by explicitly writing the Kronecker delta function before you get rid of the summation over $\alpha$), it would give $\vert \alpha_1\rangle \otimes \sum_{\beta} c_{\alpha_1 \beta} \vert\beta\rangle$. Thus, the post-measurement state is a product state but the state of the $B$ subsystem is $\sum_{\beta} c_{\alpha_1 \beta} \vert\beta\rangle$ where the dependence of the coefficients on $\alpha_1$ makes it clear that the post-measurement state of the $B$ system depends on the particular state onto which the $A$ system collapses. | {
"domain": "physics.stackexchange",
"id": 68340,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-information, quantum-measurements",
"url": null
} |
quantum-mechanics, education, atoms
freely with a large mean free path, but it can mislead in some respects.
The density of an ordinary gas at STP is about 1 kg/m$^3$.
Now let's think about the interior of an atom. I have in mind some ordinary atom such as carbon, and ordinary locations inside the atom, so not at the nucleus and not far away; one could pick a location about half a Bohr radius from the centre, for example. Let's calculate
some properties.
First, the mass density. This is the mass density owing to the electrons which are present. Their mass is spread throughout the atom
via their extended wavefunctions, and the average mass density can
be estimated by noting that an electron is about 2000 times lighter
than a proton, and a typical atomic nucleus has as many neutrons as protons, so the electrons contribute about one part in 4000 of the total mass. The density of a solid element such as carbon is about 2000 kg/m$^3$ | {
"domain": "physics.stackexchange",
"id": 80257,
"lm_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, education, atoms",
"url": null
} |
special-relativity, spacetime, differential-geometry, inertial-frames, galilean-relativity
This should hopefully address your second paragraph’s concerns. For your remaining questions, the answer is already essentially what I said in the comments, but I’ll elaborate. Note that everything I’m about to say is simply an exercise in formal mathematical writing; particularly, in expressing what ‘structure’ we have, and what ‘structure-preserving morphisms’ ought to look like, etc.
Galilean Spacetimes: Penrose’s second approach.
This is mainly going to be definitions
Definition. (Almost-Galilean spacetime)
An $(n+1)$-dimensional almost-Galilean spacetime, $\mathcal{G}$, (a made-up term btw) consists of the following tuple of information:
\begin{align}
\mathcal{G}=\bigg((\Bbb{E}^1,\text{Or}), \Bbb{E}^n, (\Gamma,\gamma,\Bbb{E}^1),\mathcal{I}\bigg),
\end{align}
where | {
"domain": "physics.stackexchange",
"id": 95785,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, spacetime, differential-geometry, inertial-frames, galilean-relativity",
"url": null
} |
ros
SOLUTION
As Stefan suggested, installing the U71C firmware seemed to fix the issue. Thank you!
Originally posted by BSBingham on ROS Answers with karma: 108 on 2016-08-21
Post score: 0
Original comments
Comment by gvdhoorn on 2016-08-22:
I've given you some karma, so you should be able to upload images now.
Comment by xlightx on 2018-08-02:
My firmware version of this sensor is U72A and still has the drift. I can't find the older drivers anywhere. Does anyone have them by chance?
I also saw extreme yaw drift on a new UM7 unit. It turned out that the estimation of gyro biases that was added in firmware U71D is good in theory, but apparently not very robust in actual use. I downgraded our sensor to firmware U71C and it now works fine again (after trying to make the sensor work with various settings on the newer firmware). I thus recommend downgrading and seeing if it fixes your issue. | {
"domain": "robotics.stackexchange",
"id": 25572,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
pl.programming-languages, linear-programming, functional-programming, compilers
Title: Is there a high level (functional) language compiling to Mixed Integer Linear Programming problems? Many different kinds of optimization problems can be expressed as Mixed Integer Linear Programming (MILP). The translation is usually very direct, and one has to encode invariants as constraints in a somewhat tedious and error prone way. Decoding the actual value after the solver run can again be tedious. I'm wondering whether there is a nicer high level intermediate language that can be used to express the problem, and inspect the solution. | {
"domain": "cstheory.stackexchange",
"id": 5727,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pl.programming-languages, linear-programming, functional-programming, compilers",
"url": null
} |
- Tree node eccentricity - Tree centroid A connected graph G is Eulerian if there is a closed trail which includes every edge of G, such a trail is called an Eulerian trail. The graph on the right is not Eulerian though, as there does not exist an Eulerian trail as you cannot start at a single vertex and return to that vertex while also traversing each edge exactly once. Definition: Eulerian Graph Let }G ={V,E be a graph. crossing-total directions, of medial graph to characterize all Eulerian partial duals of any ribbon graph and obtain our second main result. Watch headings for an "edit" link when available. While P n of course works, perhaps something that's also simple, but slightly more interesting like Image:Semi-Eulerian graph.png would be good. The graph is Eulerian if it has an Euler cycle. Check out how this page has evolved in the past. A graph is called Eulerian if it has an Eulerian Cycle and called Semi-Eulerian if it has an Eulerian Path. Semi-Euler Graph- If a connected | {
"domain": "techaffect.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668668053619,
"lm_q1q2_score": 0.8176304761220029,
"lm_q2_score": 0.8333245891029457,
"openwebmath_perplexity": 656.9268830313274,
"openwebmath_score": 0.48969700932502747,
"tags": null,
"url": "http://techaffect.com/we-will-gmrs/semi-eulerian-graph-00427c"
} |
deep-learning, gradient-descent, mini-batch-gradient-descent
Title: With Stochastic Gradient Descent why we dont compute exact derivative of loss function? In a blog I read this:
With Stochastic Gradient Descent we don’t compute the exact derivate of our loss function. Instead, we’re estimating it on a small batch.
blog.
Now I am confused with the whole concept. | {
"domain": "datascience.stackexchange",
"id": 8266,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning, gradient-descent, mini-batch-gradient-descent",
"url": null
} |
python, sql, python-3.x, natural-language-processing
Becomes
raw_docs = sent_tokenize(y_)
tokenized_docs = [sent_tokenize(y_) for sent in raw_docs]
'''Removing stop words'''
stopword_removed_sentences = []
from nltk.corpus import stopwords
stopset = stopwords.words("English")
for i in raw_docs:
tokenized_docs = ' '.join([word for word in i.split() if word not in stopset])
stopword_removed_sentences.append(tokenized_docs)
And now switch to generators again.
But, we also want generators
raw_docs = sent_tokenize(y_)
stopword_removed_sentences = (' '.join(word for word in i.split() if word not in stopset) for i in raw_docs)
Now this becomes a bit bulky, though. The inner text is quite long. Let's make that a function.
def strip_stopwords(sentence):
return ' '.join(word for word in sentence.split() if word not in stopset)
stopword_removed_sentences = (strip_stopwords(sentence) for sentence in raw_docs) | {
"domain": "codereview.stackexchange",
"id": 20335,
"lm_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, sql, python-3.x, natural-language-processing",
"url": null
} |
terminology, mixtures
Mixtures are combinations of two or more substances in which each substance retains its chemical identity.
This is where I'm confused. How are mixtures not substances? They have distinct properties, and their composition doesn't vary from sample to sample, if you set a standard for the sample. You can create any arbitrary mixture, and you can create any arbitrary compound, and if you follow the "recipe" for either you will always get the same thing, as far as I know.
Where is my logic flawed? As your book uses the terms:
Elements: Single atoms (e.g. O).
Compound: Consists of only one type of molecule, where that molecule consists of more than one element (e.g. H2O).
Mixture: Consists of more than one type of molecule (e.g. Na+ + Cl- + H2O, which is saltwater, or for example the air you breathe, which is mostly N2 with some O2 floating around and a bunch of other stuff). | {
"domain": "chemistry.stackexchange",
"id": 7871,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "terminology, mixtures",
"url": null
} |
quantum-mechanics, operators, hilbert-space, measurements, observables
Just because the eigenvectors are real does not mean that eigenvectors with different eigenvalues are orthogonal.
The orthogonal decomposition is the first essential thing you want. The requirement that the eigenvalues be real isn't as big a deal, you might even want to model decay (poorly) with a complex energy. But you still want the different eigenspaces to be orthogonal.
And you do want more than that. You really want the eigenvectors to contain a maximal orthonormal set, and for a maximal set of commuting operators you get a unique such set, the set of mutual eigenvectors.
And it is after you have this that you can, for instance, finally bring up probability theory (and make a sample space and all that). | {
"domain": "physics.stackexchange",
"id": 24810,
"lm_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, operators, hilbert-space, measurements, observables",
"url": null
} |
python, beginner, search, csv
This is a few lines from my in_file and also the outfile is the same structure. It just updates the ChannelProfileID depending on the results found.
"StockNumber","SKU","ChannelProfileID"
"10m_s-vid#APTIIAMZ","2VV-10",3746
"10m_s-vid#CSE","2VV-10",3746
"1RR-01#CSE","1RR-01",3746
"1RR-01#PCAWS","1RR-01",3746
"1m_s-vid_ext#APTIIAMZ","2VV-101",3746
This is a few line from the check_file:
ProductCode, Description, Supplier, CostPrice, RRPPrice, Stock, Manufacturer, SupplierProductCode, ManuCode, LeadTime
2VV-03,3MTR BLACK SVHS M - M GOLD CABLE - B/Q 100,Cables Direct Ltd,0.43,,930,CDL,2VV-03,2VV-03,1
2VV-05,5MTR BLACK SVHS M - M GOLD CABLE - B/Q 100,Cables Direct Ltd,0.54,,1935,CDL,2VV-05,2VV-05,1
2VV-10,10MTR BLACK SVHS M - M GOLD CABLE - B/Q 50,Cables Direct Ltd,0.86,,1991,CDL,2VV-10,2VV-10,1 | {
"domain": "codereview.stackexchange",
"id": 1040,
"lm_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, search, csv",
"url": null
} |
java, game
if(order==0)
{
if(boardj==1){
if(SnakesnLadders[s_and_l]!=" ")
System.out.print(SnakesnLadders[s_and_l]+"\t|");
else if(SnakesnLadders[s_and_l-1]!=" ")
System.out.print("\t"+SnakesnLadders[s_and_l]+"\t|");
else
System.out.print("\t"+SnakesnLadders[s_and_l]+"\t|\t");
}
else if(SnakesnLadders[s_and_l-1]!=" ")
System.out.print(SnakesnLadders[s_and_l]+"\t|");
else
System.out.print(SnakesnLadders[s_and_l]+"\t|\t");
}
if(order==1)
{ | {
"domain": "codereview.stackexchange",
"id": 38126,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, game",
"url": null
} |
python, python-3.x, algorithm, object-oriented, dynamic-programming
def generate_segmentation(self, traceback): # To generate k-segmentation of sequence seq using traceback array
# Separate the traceback array into two parts starts and ends
starts = traceback[self.is_odd(self.k)][self.n]
ends = starts[1:] + [self.n]
# print(starts, ends)
k_segments = [self.seq[s:e] for s, e in zip(starts, ends)] # Concatenate the two parts for optimal segments
return k_segments | {
"domain": "codereview.stackexchange",
"id": 43775,
"lm_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, algorithm, object-oriented, dynamic-programming",
"url": null
} |
Thus $S_n < 2$
thus we have the $\displaystyle S_n$ is monotonically increasing and bounded above and so is convergent.
I think svenkatr's response is correct. He is using the comparison test, in particular, comparing with the exponential function for $x=1$, that is obviously a number, so he doesn't have to prove that the series for e converges.
Maybe you can prove the same by using the ratio test $\lim_{n \rightarrow \infty} \displaystyle |\frac{a_{n+1}}{a_{n}}|$. For example, you have $a_{n}=\displaystyle \frac{1}{(2n+1)!}$ and $a_{n+1}=\displaystyle \frac{(2n+1)!}{(2n+3)!}$, then using the definition for the factorial you have $\lim_{n \rightarrow \infty} \displaystyle \frac{1}{(2n+3)(2n+2)}$ which is 0. According to the ratio test:
If r < 1, then the series converges. If r > 1, then the series diverges. If r = 1, the ratio test is inconclusive, and the series may converge or diverge.
Therefore, the series converges. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9736446456243805,
"lm_q1q2_score": 0.8559765475281003,
"lm_q2_score": 0.8791467722591728,
"openwebmath_perplexity": 421.98663843244293,
"openwebmath_score": 0.925818920135498,
"tags": null,
"url": "https://math.stackexchange.com/questions/7354/sum-limits-n-0-infty-frac12n1-converges/7370"
} |
information, radio, radio-frequency
Title: Are communications between computers faster by electrical signals via copper cables or electromagnetic signals? Assume that there are two computers which are connected with a copper cable, e.g. Ethernet. Also, there is a radio connection between them, e.g. AM radio, in order to exchange data. When we try to send data from one to the other, which one would be faster? Assume they are the same distance away.
As far as I know, the propagation speed of electromagnetic signals in the air is better than the copper. On the other hand, frequency of the AM signal is smaller. Is there any other factors which affects the speed? Your question is pretty severely under-defined and you've really touched on the tip of the iceberg for a huge subject of information theory and network engineering. The bulk of this isn't physics so I will keep my answer brief.
This is how I've interpreted your question: | {
"domain": "physics.stackexchange",
"id": 10941,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "information, radio, radio-frequency",
"url": null
} |
species-identification, entomology
These clues all point to a very common Theridiid spider which goes by the name of House Spider. It's not the House Spider that spins a flat sheet from a funnel retreat - that's the Tegenaria House Spider. This House Spider is the Theridiid House Spider Parasteatoda tepidariorum. It's a harmless (to us) spider that eats almost anything it can entrap in its web. I've seen them happily eat Gypsy Moth caterpillars, centipedes and other arthropods that aren't very popular choices among household spiders. | {
"domain": "biology.stackexchange",
"id": 8684,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "species-identification, entomology",
"url": null
} |
nuclear-physics, radioactivity, isotopes
So, let's take a tour of the isotopes, relying mainly on data from nuclear datasheets. Start with Cs-134 (you probably did not know there was a journal called Nuclear Data Sheets). Going down to page 69, one finds that the Cs-134 nucleus has a spin of 4. It can decay to any one of 6 possible Ba-134 nuclear energy levels (the ground state and 5 excited states). The majority of the decays go through an excited state, which also has a nuclear spin of 4. The half-life is 2 years.
Cs-135 is listed with a nuclear spin of 7/2. There is only one available Ba-135 level to decay to, and it has a nuclear spin of 3/2. The half-life of this decay is 2.3 million years. Only one state to go to, and a spin mismatch to slow it down. | {
"domain": "physics.stackexchange",
"id": 41233,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nuclear-physics, radioactivity, isotopes",
"url": null
} |
navigation, turtlebot, turtlebot-navigation, gmapping-demo, gmapping
Title: turtlebot navigation almost working
Im using the turtlebot_navigation gmapping_demo.launch along with the turtlebot_teleop turtlebot_teleop_key. When running the gmapping_demo the first section of the map that it produces is always 100% correct, however when i start driving the turtlebot around and watching the map being built in Rviz the turtle bot moves a lot farther in real life than it thinks it does in rviz basically making it so the laserscan is looking at an adjacent wall in real life while in rviz the robot has only rotated like 5 degrees causing overlap in the map an making them always look cone shaped. The robot in Rviz also jumps around randomly sometimes. | {
"domain": "robotics.stackexchange",
"id": 9676,
"lm_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, turtlebot, turtlebot-navigation, gmapping-demo, gmapping",
"url": null
} |
organic-chemistry, synthesis
Title: Converting benzaldehyde to benzophenone in no more than two steps This is a question from my book, as stated in the title:
How will you convert benzaldehyde to benzophenone in no more than two steps?
I can do it in three steps - first using $\ce{PhMgBr}$ on benzaldehyde to get $\ce{Ph_2CH(OMgBr)}$ (sorry for this symbolic mess, I don't know how to format organic synthesis) followed by hydrolysis to $\ce{Ph_2CHOH}$ which is oxidised to $\ce{Ph_2CO}$.
I tried thinking of other ways, but really couldn't find anything. Hints would be appreciated. Thanks! I could give you a satisfactory answer, but I don't say that this is the best method. | {
"domain": "chemistry.stackexchange",
"id": 16574,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, synthesis",
"url": null
} |
ros, moveit, ros-kinetic
[ INFO] [1578775095.459317195, 256.097000000]: ParallelPlan::solve(): Solution found by one or more threads in 0.012923
seconds
[ INFO] [1578775095.466620832, 256.104000000]: SimpleSetup: Path simplification took 0.007186 seconds and changed from 4 to 2 states
[ERROR] [1578775095.495185115, 256.126000000]: Joints on incoming goal don't match the controller joints.
[ WARN] [1578775095.496447441, 256.127000000]: Controller arm_controller failed with error code INVALID_JOINTS
[ WARN] [1578775095.499449045, 256.128000000]: Controller handle arm_controller reports status FAILED
[ INFO] [1578775095.499510155, 256.128000000]: Completed trajectory execution with status FAILED ...
This is my config file :
arm_controller:
name: arm
type: "position_controllers/JointTrajectoryController"
default: true
joints:
- shoulder
- elbow
- wrist
- hand
name: gripper
type: "position_controllers/JointTrajectoryController" | {
"domain": "robotics.stackexchange",
"id": 34257,
"lm_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, moveit, ros-kinetic",
"url": null
} |
$x^2-34y^2 \equiv -1 \pmod{3^a}, x^2-34y^2 \equiv -1 \pmod{5^b}, x^2-34y^2 \equiv -1 \pmod{{p_i}^{q_i}}$
Then $5\nmid 3^a$, $3\nmid 5^b$, and $3\nmid {p_i}^{q_i}$ and $5\nmid {p_i}^{q_i}$, so each of the congruences has a solution. Does the Chinese Remainder Theorem then imply that there is a solution modulo $m$? I know that it holds for polynomials in one variable $x$, and that the number of solutions is the product of the number of solutions for each prime power modulus. Would the same result hold now that there are two variables in the polynomial? I haven't found any proofs to support or contradict the result. Thanks! | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822877054447312,
"lm_q1q2_score": 0.818564498520606,
"lm_q2_score": 0.8333245891029457,
"openwebmath_perplexity": 74.99725750393061,
"openwebmath_score": 0.9267084002494812,
"tags": null,
"url": "http://math.stackexchange.com/questions/11321/how-does-the-chinese-remainder-theorem-behave-with-polynomials-with-multiple-var?answertab=active"
} |
javascript, performance, recursion, sudoku
// For empty cells, the possible values are values that
// are not already used in the same row/column/block.
let cellmask = new Int32Array(81);
for ( let i = 0; i < 9; i++ ) {
for ( let j = 0; j < 9; j++ ) {
var mask = rowmask[i] | colmask[j] | blockmask[(i / 3 | 0) * 3 + (j / 3 | 0)];
// invert to take the *unused* values
// 0x3FE = 0011_1111_1110 (bits 1 to 9 are set)
cellmask[i * 9 + j] = ~mask & 0x3FE;
if ( this.board[i][j] !== 0 )
cellmask[i * 9 + j] = 1 << this.board[i][j];
}
} | {
"domain": "codereview.stackexchange",
"id": 37821,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, performance, recursion, sudoku",
"url": null
} |
maxwell-equations
$$
\begin{align*}
\vec{\nabla} \cdot \left(\vec{\nabla} \times \vec{B}\right) &=-\frac{1}{c^2}\vec{\nabla} \cdot \left( \frac{\partial \vec{E}}{\partial t}\right) +\frac{1}{\epsilon_0 c^2} \vec{\nabla} \cdot \vec{J} \\
0 &= -\frac{1}{c^2}\frac{\partial }{\partial t}\left(\vec{\nabla} \cdot \vec{E}\right) +\frac{1}{\epsilon_0 c^2} \vec{\nabla} \cdot \vec{J} \\
&= \frac{1}{\epsilon_0 c^2} \left( -\frac{\partial \rho}{\partial t} + \vec{\nabla} \cdot \vec{J} \right)
\end{align*}
$$
This would imply that $\partial \rho/\partial t = \vec{\nabla} \cdot \vec{J}$, which would mean (for example) that the charge density in a particular region of space would increase when a positive current flowed out of it. | {
"domain": "physics.stackexchange",
"id": 84627,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "maxwell-equations",
"url": null
} |
fft, amplitude, wave
Title: frequencies in sound: multiple possibilities? First, I am by no mean a sound engineer (as you will guess later).
I was just wondering something while looking at the waveform of a .wav
for a given shape of waveform on a duration of 2 sec for example, how can we make sure that the frequencies fft gives are the only correct one?
what if very little parts of a sinusoid could be considered instead of a full continuous sinusoidal movement that just varies in amplitude?
or, what if a sinusoid had a lot of very fast varying amplitudes ?
that would lead to an infinity of solutions I guess.. The Discrete Fourier Transform, or DFT (the FFT is an algorithm that computes the DFT) of a length of finite duration (which any practical transform would need to be) is identical to the result of the transform of an infinitely long sequence formed by repeating the original sequence in time.
Knowing this provides the following insights related to your question: | {
"domain": "dsp.stackexchange",
"id": 6759,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fft, amplitude, wave",
"url": null
} |
vba, excel, ms-access, ms-word, powerpoint
Sheet1.Range("A1").Calculate
If schedule Then nextExec = DateAdd("s", 1, Now())
Application.OnTime nextExec, "KeepRecalculating", , schedule
End Sub
My solution also took parameters like Range and updateRate and was able to run multiple tasks simultaneously independent of each other to make it more generally applicable.
There is still the annoying fact that with this solution, pressing the Stop button in the VBA IDE does not stop the loop from running. A specific sub has to be called every time to stop it.
The next issue, however, is even more annoying. What if the user just closes the workbook expecting it to also stop updating? Well in this case Application.OnTime has a trick up its sleeve that can be a very useful feature in other situations.
Application.OnTime will reopen a closed Workbook if a macro was scheduled to run in it!
There seem to be two options to deal with this: | {
"domain": "codereview.stackexchange",
"id": 44512,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba, excel, ms-access, ms-word, powerpoint",
"url": null
} |
python, performance, programming-challenge, python-2.x, primes
def diagonalNum(n): # n is the number of row
increment = 2
getDiaNum = 1
limit = (n-1)/2
sideLen = 1.0
c = 0.0
for i in xrange(1, limit + 1):
count = 1
while count <= 4:
getDiaNum += increment
if m_r(getDiaNum):
c += 1
count += 1
increment += 2
sideLen += 4
return c / sideLen | {
"domain": "codereview.stackexchange",
"id": 22164,
"lm_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, programming-challenge, python-2.x, primes",
"url": null
} |
galaxy, milky-way, life, quasars
Title: What would be the outcome for life in our galaxy if the merger of the Milky Way and Andromeda creates a Quasar? If predictions are correct, the Milky Way and Andromeda are set to collide in around 4 billion years. If, when this occurs, a Quasar is formed by matter being accreted to the common galactic center (perhaps with the two supermassive black holes forming a binary), what would be the outcome for life in the new galaxy? | {
"domain": "astronomy.stackexchange",
"id": 1366,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "galaxy, milky-way, life, quasars",
"url": null
} |
performance, algorithm, time-limit-exceeded, swift
var tempSum = 0
for i in q[0]...q[1] {
tempSum += nums[i]
}
by
let tempSum = nums[q[0]...q[1]].reduce(0, +)
Here an "array slice" is created and then reduced. Note that this
does not duplicate the element storage.
Instead of appending a single-element array
sumArray += [tempSum]
you can append a single element:
sumArray.append(tempSum)
Each element sumArray is the result of applying one query
to the given numbers, this can be simpler done as a map
operation:
let sumArray = queries.map { q in
nums[q[0]...q[1]].reduce(0, +)
}
I would define the modulus \$ 10^9+7\$ as a constant (interspersed
with _ for better readability):
let modulus = 1_000_000_000 + 7
There is one problem at your
return sum > 0 ? sum % bigNumber : bigNumber + sum | {
"domain": "codereview.stackexchange",
"id": 29138,
"lm_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, time-limit-exceeded, swift",
"url": null
} |
optics, wavelength, applied-physics
Title: Wavelength comparison of two waves Is there any non-digital (naturally existing) mechanism to compare two or more waves in such a way:
Input 1 Input 2 .... Output
------- -------- .... ------------
Lower Higher .... Lower/Higher
Wavelength Wavelength .... Wavelength | {
"domain": "physics.stackexchange",
"id": 5679,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, wavelength, applied-physics",
"url": null
} |
GMAT Question of the Day - Daily to your Mailbox; hard ones only
It is currently 13 Dec 2018, 07:43
# R1 Admission Decisions:
Stanford Chat (Calls Started) | Wharton Chat (Calls Expected Soon) | Fuqua Chat (Calls Expected Soon)
### GMAT Club Daily Prep
#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.
Customized
for You
we will pick new questions that match your level based on your Timer History
Track
Your Progress
every week, we’ll send you an estimated GMAT score based on your performance
Practice
Pays
we will pick new questions that match your level based on your Timer History
## Events & Promotions
###### Events & Promotions in December
PrevNext
SuMoTuWeThFrSa
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345
Open Detailed Calendar
• ### The winning strategy for 700+ on the GMAT
December 13, 2018 | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9492946352021694,
"lm_q1q2_score": 0.8661707487146797,
"lm_q2_score": 0.9124361569052932,
"openwebmath_perplexity": 1572.045282858755,
"openwebmath_score": 0.5468582510948181,
"tags": null,
"url": "https://gmatclub.com/forum/in-a-certain-baord-game-a-stack-of-48-cards-8-of-which-136256.html"
} |
newtonian-mechanics, energy-conservation, work
Now as I think work done on the mass is zero, but who is carrying the mass from A to B? It can't move from A to B without any assistance, also at the same time my work done is zero!!!
My question is basically, who is doing the real work on the mass? If nobody is doing, then can I assume mass can change its space coordinate with time without any external assistance? Which is undoubtedly not true by a layman thinking. I think I am missing some crucial points, someone, please let me out from this disorder.
I am applying a force which is perfectly perpendicular to my way to place B | {
"domain": "physics.stackexchange",
"id": 60860,
"lm_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, energy-conservation, work",
"url": null
} |
python, template, flask
if request.method == 'POST':
# collect search date information from the dropdown forms if they're all supplied.
search_date = set_search_date(request, search_date)
rows = heart_rate_zone.get_heart_rate_zone_for_day(
database='fitbit',
target_date=search_date)
rows = [i for i in rows]
else: # request.method == 'GET'
# no date supplied, just return data for today.
heart_rate_zone.config = {'base_date': date.today(), 'period': '1d'}
statement = heart_daily_table.select().where(heart_daily_table.columns.date == str(date.today()))
rows = Database(database='fitbit', schema='heart').engine.execute(statement) | {
"domain": "codereview.stackexchange",
"id": 39983,
"lm_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, template, flask",
"url": null
} |
4. special cases for odd and even functions.
For even function, f(-x) = f(x) i.e the graph is symmetrical about y-axis. In such case, $\int_{-a}^{a} f(x)dx = 2 \int_{0}^{a} f(x)dx$
For odd functions, f(-x) = -f(x) and graph of f(x) is mirrored about x-axis AND y-axis. In such case, $\int_{-a}^{a} f(x)dx = 0$ This is because the ’negative’ area balances the ’positive’ area after the origin.
5. $\int_{0}^{2a} f(x)dx = \int_{0}^{a} f(x)dx + \int_{0}^{a} f(2a - x)dx$
### Solved Example:
#### 2-8-01
$\int_{-a}^{a}(\sin^6 x + \sin^7 x)dx = ?$ | {
"domain": "herokuapp.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9930961615201183,
"lm_q1q2_score": 0.8072554154206751,
"lm_q2_score": 0.8128673201042492,
"openwebmath_perplexity": 1349.071932768045,
"openwebmath_score": 0.9926226139068604,
"tags": null,
"url": "https://enggtv.herokuapp.com/topic/Definite%20Integrals/"
} |
ros, rosdep, bloom-release, rosdistro, rosinstall
Also bloom-release ... gives this:
Traceback (most recent call last):
File "/usr/bin/bloom-release", line 9, in <module>
load_entry_point('bloom==0.4.4', 'console_scripts', 'bloom-release')()
File "/usr/lib/pymodules/python2.7/bloom/commands/release.py", line 797, in main
args.new_track, not args.non_interactive, args.pretend)
File "/usr/lib/pymodules/python2.7/bloom/commands/release.py", line 590, in perform_release
release_repo = get_release_repo(repository, distro)
File "/usr/lib/pymodules/python2.7/bloom/commands/release.py", line 207, in get_release_repo
url = get_repo_uri(repository, distro)
File "/usr/lib/pymodules/python2.7/bloom/commands/release.py", line 179, in get_repo_uri
release_file = get_release_file(distro)
File "/usr/lib/pymodules/python2.7/bloom/commands/release.py", line 157, in get_release_file
_rosdistro_release_files[distro] = rosdistro.get_release_file(get_index(), distro) | {
"domain": "robotics.stackexchange",
"id": 16762,
"lm_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, rosdep, bloom-release, rosdistro, rosinstall",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.