text stringlengths 1 1.11k | source dict |
|---|---|
This is so easily generalized to $n$ digit base $k$ numbers corresponding to placing $n$ balls in $k$ boxes, thus making $k^n$ setups.
• Very clever, thank you – Riptyde4 Dec 14 '14 at 0:10 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9877587265099557,
"lm_q1q2_score": 0.8209688005658269,
"lm_q2_score": 0.8311430499496096,
"openwebmath_perplexity": 452.51398429132536,
"openwebmath_score": 0.8514816761016846,
"tags": null,
"url": "https://math.stackexchange.com/questions/1067004/how-many-ways-are-there-to-place-7-distinct-balls-into-3-distinct-boxes"
} |
beginner, functional-programming, reinventing-the-wheel, clojure
For num-to-int, long is the native number type that Clojure uses. If you cast to int, it's just going to be converted to long somewhere down the road, and that could potentially lead to a performance hit. You might also want to make it clearer that "n" is actually a seq. Calling the parameter n then writing (apply str n) is very confusing, since I wouldn't expect n to be a sequence. I would change it to:
(defn num-to-int [n-seq]
(Long/parseLong (apply str n-seq)))
get-val is basically just first. Unless you really like how the name helps readability, I'd just use first.
(alt (lit "1") (lit "2") (lit "3") (lit "4") (lit "5") (lit "6") (lit "7") (lit "8") (lit "9") (lit "0"))
has a ton of repetition. There's a lot of ways to fix this. I'd lean towards something like this though:
(->> "1234567890"
(map str) ; Turn each char into a string
(map lit) ; Turn each string into a literal f
(apply alt)) ; Then give them to alt | {
"domain": "codereview.stackexchange",
"id": 38372,
"lm_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, functional-programming, reinventing-the-wheel, clojure",
"url": null
} |
newtonian-mechanics, general-relativity, black-holes, mass, mass-energy
we get something that looks like the Schwarzschild metric:
$$ ds^2 \approx -\left( 1 - \frac{2GM}{c^2R}\right) c^2dt^2 + \frac{dr^2}{1 - 2GM/c^2R} + r^2d\theta^2 + r^2\sin^2\theta d\phi^2 $$
But the Newtonian radial coordinate $R$ is not the same as the Schwarzschild radial coordinate $r$. The former is the distance measured from the central point to the position labelled by $R$ while the latter is the circumference of a circle passing through the position labelled by $r$ divided by $2\pi$. However it just so happens that the way the Schwarzschild radial coordinate is defined means that if we replace $R$ by $r$ we get an exact result:
$$ ds^2 = -\left( 1 - \frac{2GM}{c^2r}\right) c^2dt^2 + \frac{dr^2}{1 - 2GM/c^2r} + r^2d\theta^2 + r^2\sin^2\theta d\phi^2 $$
And this is why the Newtonian derivation gives the correct result for $r_s$. It is just a coincidence and shouldn't be regarded as a derivation at all. | {
"domain": "physics.stackexchange",
"id": 46080,
"lm_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, general-relativity, black-holes, mass, mass-energy",
"url": null
} |
python, django
if request.method == 'POST':
data = {'error': False, 'error_message': ''}
user = request.user
author = ProfileUser.objects.get(user=user)
comment = Comment()
object = Object.objects.get(id=pk)
comment.object = obj
comment.author = author
comment.content = request.POST.get('content')
comment.rating = request.POST.get('rating')
rating = Comment.objects.filter(object_id=pk).aggregate(Avg('rating'))['rating__avg']
object.rating = rating
data['rating'] = rating
comment.save()
object.save()
return JsonResponse(data)
form = CommentForm()
reviews_count = Comment.objects.filter(object_id=pk).count()
rating = Comment.objects.filter(object_id=pk).aggregate(Avg('rating'))['rating__avg']
comments_list = Comment.objects.all()
paginator = Paginator(comments_list, 2)
comments = paginator.get_page(page_num) | {
"domain": "codereview.stackexchange",
"id": 36619,
"lm_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, django",
"url": null
} |
items —5 red, 8 blue, and 7 yellow • Shopping bag •. Multiplication Rule 2: When two events, A and B, are dependent. Determining the probability of independent and dependent events. But the coin has not changed - if it's a "fair" coin, the probability of getting tails is still 0. The probability that an individual of a given tree species recruits to the adult population at a site is a function of the community of microbial propagules (pathogens and mutualists), and the. Independent And Dependent Probability Worksheets Free Worksheets from Independent And Dependent Events Worksheet, source:comprar-en-internet. Modeling it as a more familiar question of coin tosses, Doctor Ian lights a way forward. P (A) is the probability of event "A" occurring. Now suppose the ball was put back into its original bag, and another ball is picked from the same bag randomly. You use probability in daily life to make decisions when you don't know for sure what the outcome will be. A Markov chain is similar | {
"domain": "pixelzoom.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.987375049232425,
"lm_q1q2_score": 0.818473505022215,
"lm_q2_score": 0.8289388167733099,
"openwebmath_perplexity": 448.21235000471705,
"openwebmath_score": 0.7119199633598328,
"tags": null,
"url": "http://jukz.pixelzoom.it/dependent-probability.html"
} |
python, csv
Any better solutions?
To solve the grouping problem, use itertools.groupby.
To read files with comma-separated fields, use the csv module.
In almost all cases, open() should be called using a with block, so that the files will be automatically closed for you, even if an exception occurs within the block:
with open(file_path) as in_f, open(destination, 'w') as out_f:
data = csv.reader(in_f)
# code goes here
filePath violates Python's official style guide, which recommends underscores, like your curr_line. | {
"domain": "codereview.stackexchange",
"id": 33176,
"lm_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, csv",
"url": null
} |
homework-and-exercises, quantum-information, quantum-entanglement, density-operator, open-quantum-systems
$$
|\psi_k\rangle = \frac{1}{\sqrt{1 + x_k^2}} (|0\rangle + x_k |1\rangle)
$$
$$
\rho_k = |\psi_k\rangle\langle\psi_k| = \frac{1}{1 + x_k^2}\begin{pmatrix}
1 & x_k \\
x_k & x_k^2
\end{pmatrix}.
$$
Now, note that
$$
\rho_{AB}(X) = \sum_{i=1}^N \lambda_i \rho_i \otimes |i\rangle\langle i|\tag1
$$
where
$$
\lambda_i = \frac{1 + x_i^2}{N + \mathrm{tr}X^2}
$$
and the right hand side of $(1)$ is separable. | {
"domain": "physics.stackexchange",
"id": 74364,
"lm_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, quantum-information, quantum-entanglement, density-operator, open-quantum-systems",
"url": null
} |
nuclear-physics
From a fusion or a boosted fission standpoint, both processes rely on tritium which has a finite half-life and hence the tritium capsules in a fusion bomb must be regularly replaced. There are very few tritium sources available, and if you don't have one readily at hand, then your fusion bombs will fail.
That said, the fission primary in a fusion bomb will still do a lot of damage, and even a "fizzle" of a fission bomb will spread the fission fuel far and wide- as a so-called "dirty bomb". | {
"domain": "physics.stackexchange",
"id": 86421,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nuclear-physics",
"url": null
} |
homework-and-exercises, general-relativity, gauge-invariance
I have called this quantity $g$ because in practice, when dealing with perturbations, you want to work on the unperturbed spacetime $M^0$ via pullbacks, so $g$ will be the working metric.
However, the diffeomorphism $\phi^\epsilon$ is not unique. Let $\psi^\epsilon:M^0\rightarrow M^\epsilon$ also be a diffeo, and let $$ g'=(\psi^\epsilon)^*g^\epsilon=g^0+\epsilon g'^{(1)} $$ be the perturbed metric given by this map.
The difference between $\phi$ and $\psi$ can be quantified on $M^0$ by letting $\chi^\epsilon:M^0\rightarrow M^0$ be a 1-parameter family of diffeos on $M^0$ given by $$ \psi^\epsilon=\phi^\epsilon\circ\chi^\epsilon $$
or explicitly, as $$ \chi^\epsilon=(\phi^\epsilon)^{-1}\circ\psi^\epsilon. $$
Then we can express the perturbed metric $g'$ with the other perturbed metric $g$ by noting that $$ g'=(\psi^\epsilon)^*g^\epsilon=(\phi^\epsilon\circ\chi^\epsilon)^*g^\epsilon=(\chi^\epsilon)^*(\phi^\epsilon)^*g^\epsilon=(\chi^\epsilon)^*g. $$ | {
"domain": "physics.stackexchange",
"id": 42644,
"lm_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, general-relativity, gauge-invariance",
"url": null
} |
algorithms, strings, string-matching
Title: Find the maximum number of contiguous occurrences of smaller string s in a larger string l Say we have two strings s and l, and they only have characters 'a' through 'z' (lowercase English alphabet characters). The task is to find the maximum number of consecutive occurrences of s in l.
Ex.
s = "ab"
l = "defgababajklabe"
The answer here would be 2, because there is "abab" which would be 2 consecutive occurrences of string s in l.
My initial thought was to go through each character in l, and try to match the substring starting at that position with s, if it matched we would increment our count and keep track of some global maximum. We would also set the value of our next starting point to one position after the end of this matched portion.
If at any point there is a mismatch, then we wouldn't have to re-check all the previous characters, we would just go to one position after the start point, that would be our new start point. | {
"domain": "cs.stackexchange",
"id": 17671,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, strings, string-matching",
"url": null
} |
), Online calculator of the area of a bisects. Vector with initial point and terminal point, Online calculator ( -2.4, 5/7,... ) parallelogram OACB assuming..., \mathrm { and } \, R^3 [ /math ] R^3 [ /math.! Suppose, we are given which do not lie on the keyboard, multiply the base by height. Any line through the midpoint of a vector in the basis, Exercises and b as shown contact,! Two sides are represented by two pairs of parallel lines as a geometric representation of the vector product parallelogram... Angles are equal in measure is [ math ] R^2\, \, R^3 /math... To find the area of the area of a parallelogram, multiply the of! From two vectors on plane, Exercises this web site and wrote all the mathematical theory, calculator... Which is the number of square units inside the polygon will soon see, vector... Resultant vector the dot product, which we discuss on another page form a! P and Q pairs of parallel lines the cross product parallelogram has two pairs of lines... A region | {
"domain": "poznan.pl",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.989986427013312,
"lm_q1q2_score": 0.8719771444067899,
"lm_q2_score": 0.8807970701552504,
"openwebmath_perplexity": 302.8607392057107,
"openwebmath_score": 0.7798196077346802,
"tags": null,
"url": "http://bip.pks.poznan.pl/oa7pud9/area-of-parallelogram-in-vector-7821f3"
} |
programming-languages, logic, type-theory, type-inference
Title: Inferring refinement types At work I’ve been tasked with inferring some type information about a dynamic language. I rewrite sequences of statements into nested let expressions, like so:
return x; Z => x
var x; Z => let x = undefined in Z
x = y; Z => let x = y in Z
if x then T else F; Z => if x then { T; Z } else { F; Z }
Since I’m starting from general type information and trying to deduce more specific types, the natural choice is refinement types. For example, the conditional operator returns a union of the types of its true and false branches. In simple cases, it works very well.
I ran into a snag, however, when trying to infer the type of the following:
function g(f) {
var x;
x = f(3);
return f(x);
}
Which is rewritten to:
\f.
let x = undefined in
let x = f 3 in
f x | {
"domain": "cs.stackexchange",
"id": 392,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "programming-languages, logic, type-theory, type-inference",
"url": null
} |
hamiltonian-formalism, fermions, constrained-dynamics, poisson-brackets, classical-field-theory
and other fundamental super-Poisson brackets vanish. The equal-time super-Poisson bracket read
$$ \{F(t),G(t)\}_{PB} ~=~ \frac{2\pi}{i}\int \! dx (G^{-1})^{ij}\left[\frac{\delta_R F(t)}{\delta \psi^i(x,t)} \frac{\delta_L G(t)}{\delta \psi^j(x,t)}+\frac{\delta_R F(t)}{\delta \bar{\psi}^i(x,t)} \frac{\delta_L G(t)}{\delta \bar{\psi}^j(x,t)} \right]\tag{6} $$
for arbitrary equal-time functionals $F(t)$ and $G(t)$. Here the subscripts $L$ and $R$ refer to differentiation from left and right, respectively.
References: | {
"domain": "physics.stackexchange",
"id": 22978,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "hamiltonian-formalism, fermions, constrained-dynamics, poisson-brackets, classical-field-theory",
"url": null
} |
biochemistry, plant-physiology, sugar
Title: What controls Fructose regulation in plants? Sugars are found ubiquitously in plants and are regulated.
For sucrose it's pretty straightforward - it's basically kept at a low ish level, and put into storage or other intermediate compounds. These act to inhibit or promote other parts of the calvin cycle of sugar production (fructose 2,6 bisphosphate especially iirc).
Fructose is a bit more obscure. What are the regulatory feedback loops involved? Preamble | {
"domain": "biology.stackexchange",
"id": 3289,
"lm_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, plant-physiology, sugar",
"url": null
} |
units
Depending on the type of coffee and method of preparation, the caffeine content of a single serving can vary greatly. The caffeine content of a cup of coffee varies depending mainly on the brewing method, and also on the coffee variety. According to the USDA National Nutrient Database, an 8-ounce ($\pu{237 mL}$) cup of "coffee brewed from grounds" contains $\pu{95 mg}$ caffeine, whereas an espresso ($\pu{25 mL}$) contains $\pu{53 mg}$.
Thus, the concentration of caffeine in brewed coffee $= \pu{95 mg} \times \frac{\pu{1 mmol}}{\pu{198 mg}} \times \frac{1}{\pu{237 mL}}\times \frac{\pu{1000 mL}}{\pu{1 L}} = \pu{2.02 mmol\:L-1}$
On the other hand, the concentration of caffeine in espresso $= \pu{53 mg} \times \frac{\pu{1 mmol}}{\pu{198 mg}} \times \frac{1}{\pu{25 mL}}\times \frac{\pu{1000 mL}}{\pu{1 L}} = \pu{10.71 mmol\:L-1}$
That means espresso is almost 5 times stronger than brewed coffee (by volume)! | {
"domain": "chemistry.stackexchange",
"id": 13170,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "units",
"url": null
} |
lambda-calculus, functional-programming
Title: "lambda" term usage in programming could any one please let me know what is the relation between "lambda" and anonymous functions in programming?
in other words why we say lambda function to an anonymous function?
I am here trying to understand the reason for use of the term There is a popular formal system called Lambda calculus. It is Turing complete and has great importance in the theory of programming languages. Lambda calculus is based on anonymous functions with very simple syntax. You start a new function with a $\lambda$, list the arguments, place a dot, and write down the return value. For example, $\lambda x.x$ is the identity function, $\lambda x.xx$ applies the functional argument $x$ to itself.
Since programming language designers know Lambda calculus very well, it seemed like a good idea to call anonymous functions in their language lambdas. | {
"domain": "cstheory.stackexchange",
"id": 2169,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lambda-calculus, functional-programming",
"url": null
} |
structural-engineering, structural-analysis, beam, moments, bending
Circular rod, $\sigma = \pm \dfrac{32M}{\pi d^3}$, $d$ is rod diameter.
Rectangular rod, $\sigma = \pm \dfrac{6M}{bh^2}$, $b$ is width, $h$ is height.
The resulting stress shall be checked against the allowable stress of the material. Once the limiting stress is known, you can plug it into the respective equation and obtain the maximum allowable bending for the rod. | {
"domain": "engineering.stackexchange",
"id": 4711,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "structural-engineering, structural-analysis, beam, moments, bending",
"url": null
} |
9. Apr 8, 2014
### LCKurtz
If we are going to explore alternatives, you can also use $|xy|\le \frac{x^2+y^2} 2$ which comes from $(|x|-|y|)^2\ge 0$. Then$$\left|\frac{5x^2y}{x^2+y^2}\right|\le 5 |x|\left|\frac{xy}{x^2+y^2}\right|\le\frac 5 2 |x|$$which leads to a solution too. So @iraid, I guess you have seen more than one way to skin this particular cat. Still, I think polar coordinates is the simplest. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9653811611608242,
"lm_q1q2_score": 0.8086225328141776,
"lm_q2_score": 0.8376199633332891,
"openwebmath_perplexity": 783.7792496990055,
"openwebmath_score": 0.8901349902153015,
"tags": null,
"url": "https://www.physicsforums.com/threads/delta-epsilon-two-variable-limit.747553/"
} |
python, beginner, game, tic-tac-toe
while True:
#set the game up
test_board = ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '] #at the begining of the game empty's the board.
#randomly select a player to go first
if choose_first():
player1,player2=player_input()
else:
player2,player1=player_input()
game_on=True
#players take turns
while game_on:
#player1's turn
display_board(test_board)
print('%s may go'% player1)
place_marker(test_board,player1,player_choice(test_board))#assings the players input to test_board
if win_check(test_board,player1):
display_board(test_board)
print('%s has won! \n game over'% player1)
break #breaks out of local loop and jumps to next loop (if not replay())
elif full_board_check(test_board):
display_board(test_board)
print('board is full')
break
#player2's turn
print('%s may go' % player2) | {
"domain": "codereview.stackexchange",
"id": 40013,
"lm_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, game, tic-tac-toe",
"url": null
} |
string-theory, virtual-particles
Title: How are virtual particles explained from the perspective of string theory? I somewhat can wrap my head around virtual particles in terms of quantum field theory, (as much as possible), and I'm just curious how string theorists would describe them. In Quantum Field Theory virtual particles are not particles, they are just disturbances in the field that is not a particle itself. So you have an effect that looks like its coming from particle but there is no particle. We measure the effect and use that for calculations.
Now in string theory, we just have strings that are vibrating at different frequencies. We treat them as "real" strings. Then there are virtual strings, we can only measure(for lack of better word) the effects but they are not the "real" strings that we defined but are "virtual" strings but we use the effect in our calculations. | {
"domain": "physics.stackexchange",
"id": 44208,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "string-theory, virtual-particles",
"url": null
} |
c#, design-patterns, interview-questions, state
CashInserted = 0;
return refund;
}
public void ResetMachine()
{
CashInserted = 0;
ProductChosen = 0;
}
private static List<Product> PopulateProducts()
{
return new List<Product>()
{
new Product(1, "Guinness", 3),
new Product(2, "Tayto", 2)
};
}
}
public class AwaitingChoice : IState
{
private readonly IVendingMachine _vendingMachine;
public AwaitingChoice(IVendingMachine vendingMachine)
{
_vendingMachine = vendingMachine;
_vendingMachine.ResetMachine();
Console.WriteLine($"Available products: {string.Join(",", _vendingMachine.Products.Select(x => $"Id: {x.Id}, Name: {x.Name}, Price: {x.Price}").ToArray())}");
} | {
"domain": "codereview.stackexchange",
"id": 42969,
"lm_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, interview-questions, state",
"url": null
} |
java, object-oriented, swing, quiz
public void doExam(int numberOfQuestions) {
Random random = new Random();
int maxScore =0;
int userScore =0;
for (int i = 0; i < numberOfQuestions; i++) {
int questionType =random.nextInt(QUESTION_TYPE_COUNT);
Question question;
switch(questionType){
case 0: // Addition
question = new ArithmeticQuestion("+",
(first,second)->first+second,
random.nextInt(ADDITION_INTERVAL)+ADDITION_MINIMUM,
random.nextInt(ADDITION_INTERVAL)+ADDITION_MINIMUM,
ADDITION_SCORE,
"Be careful when you add more than 10 units");
maxScore+=ADDITION_SCORE;
break;
case 1: // Subtraction
question = new ArithmeticQuestion("-",
(first,second)->first-second, | {
"domain": "codereview.stackexchange",
"id": 29165,
"lm_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, object-oriented, swing, quiz",
"url": null
} |
beginner, tree, iterator, rust
// Now add the next left subtree
// (this is the "recursive call")
if let Some(node) = self.right_nodes.pop() {
self.add_left_subtree(node);
}
result
}
}
mod test {
extern crate itertools;
use super::BTree;
#[test]
fn creation() {
BTree::new_leaf(10);
let branch = BTree::new_branch(BTree::new_leaf(15), BTree::new_leaf(20));
BTree::new_branch(branch.clone(), BTree::new_leaf(30));
assert_eq!(branch, branch.clone());
}
#[test]
fn iteration_leaf() {
itertools::assert_equal(BTree::new_leaf(123), vec![123]);
}
#[test]
fn iteration_branch() {
let btree = BTree::new_branch(BTree::new_leaf(10), BTree::new_branch(BTree::new_leaf(20), BTree::new_leaf(30)));
itertools::assert_equal(btree, vec![10, 20, 30]);
} | {
"domain": "codereview.stackexchange",
"id": 16641,
"lm_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, tree, iterator, rust",
"url": null
} |
inorganic-chemistry, acid-base, aqueous-solution, solutions
So if you just put bromine and water together, they may react very slightly, but not much, and most of the bromine will sink to the bottom (assuming you used a lot) while the lesser part will dissolve in the water first. Since the concentration of $\ce{Br2}$ is much higher (and we’re talking orders of magnitude) that those of $\ce{Br-}$ and $\ce{OBr-}$, it is best to consider this a bromine solution and not a bromide/hypobromite one. | {
"domain": "chemistry.stackexchange",
"id": 4764,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inorganic-chemistry, acid-base, aqueous-solution, solutions",
"url": null
} |
newtonian-mechanics, rotational-dynamics, friction, free-body-diagram, string
EDIT: After reading this paper (RG) along with the one mentioned by @John Darby, I have found out that this is apparently a much more complex problem requiring more analysis than I am capable to calculate with my current education and understanding of mechanics. But more importantly, after all that analysis, I found out that the result comes out in such a way that $T_1 - T_2$ creates the net torque on the pulley. Even though these forces act on the string and not the pulley, on calculation the result is the same. You’re right. It’s wrong to write the tensions as if they’re acting on the pulley without any justification. What force does act on the pulley is friction between itself and the rope. There isn't a good way to draw this "force" on an extended FBD for the pulley as it's really a lot of small frictional forces adding up at the contact points between the pulley and rope. These add up to create a single, equivalent net friction force acting at any point tangent to the rim of the | {
"domain": "physics.stackexchange",
"id": 92766,
"lm_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, rotational-dynamics, friction, free-body-diagram, string",
"url": null
} |
dsp-core
multiply coefficient $h[i]$ and sample $x[n-i]$.
add the product $h[i] x[n-i]$ into an accumulator.
pre-fetch, for the next instruction both $h[i+1]$ and $x[n-(i+1)]$ and
post-increment the pointers to point to $h[i+2]$ and $x[n-(i+2)]$ | {
"domain": "dsp.stackexchange",
"id": 2151,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dsp-core",
"url": null
} |
python, strings, iterator
Off-topic for CodeReview.
Avoid globals, use difflib, and this becomes
from difflib import SequenceMatcher
from typing import Iterable
def diff(main_text: str, text_with_commentary: str) -> Iterable[str]:
matcher = SequenceMatcher(a=main_text, b=text_with_commentary, autojunk=False)
for op, a0, a1, b0, b1 in matcher.get_opcodes():
right = text_with_commentary[b0: b1]
if op == 'equal':
yield right
elif op == 'insert':
yield '{' + right + '}'
else:
raise ValueError(f"{op} indicates malformed text") | {
"domain": "codereview.stackexchange",
"id": 41428,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, strings, iterator",
"url": null
} |
electrons, quantum-chemistry, electronic-configuration
Title: How much energy does it cost to have electron configurations that are not in accordance with Hund's rules? What is a ballpark figure for the difference in energy for an atom that follows Hund's rule vs one that has two electrons with opposite spins? I'd be interested to know carbon and nitrogen. Is there a bigger difference when there are two electrons with one spin and one electron with the opposite spin vs two electrons with opposite spins? Each energy level of a given electron configuration is described by a Russell-Saunders term symbol, assuming LS coupling. The ground state term symbol is predicted by Hund's rules. Tables of atomic energy levels identified by their term symbols have been compiled by NIST. So, the only thing you have to do, is to compare the energies of the terms describing the electron configurations you are looking for with their respective ground states. | {
"domain": "chemistry.stackexchange",
"id": 1817,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrons, quantum-chemistry, electronic-configuration",
"url": null
} |
python, python-3.x, interview-questions, complexity, pathfinding
If you want a better explanation of bit masking, please ask and I'll write something together.
EDIT: I threw together a working example, which uses bit masking and BFS (note that to change it to DFS you only have to edit current = self.paths.popleft() to current = self.paths.pop().
import collections
import string
import time
class MazeRunner:
def __init__(self, file_path):
self.maze = self.load_maze(file_path)
self.Point = collections.namedtuple('Point', 'row col parent')
self.paths = collections.deque()
def load_maze(self, file_path):
with open(file_path,'r') as f:
maze = [list(line.rstrip()) for line in f.readlines()]
maze_formatted = [["#_".find(l) for l in row] for row in maze]
maze_formatted[-1] = [i*3 for i in maze_formatted[-1]]
return maze_formatted | {
"domain": "codereview.stackexchange",
"id": 31227,
"lm_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, interview-questions, complexity, pathfinding",
"url": null
} |
machine-learning, keras, tensorflow, cnn
Title: How to get Euclidean Distance between feature maps I'm trying to find "keyframes" within a video using this paper however I'm a little new to machine learning and I'm stuck on the distance vector step. The goal is to calculate the distance vector between consecutive frames to detect a big context change indicating a keyframe. here's what I've done:
Using Googlenet pre-trained model I extracted a (1024,7,7) feature map, so a vector of 7x7 matrices for every other frame in the video.
Now I want to calculate the euclidean distance between two consecutive frames but I'm not sure how that would be.
My intuition is that the distance vector would also be (1024,7,7).
The last step would be to apply a "convolution of 4-window of last distance values with vector [0.1, 0.1, 0.1, 0.99]" on the distance vector?? I don't understand this step either.
Any help or guidance would be appreciated! The Euclidean between two images $p$ and $q$ can be calculated as follows: | {
"domain": "datascience.stackexchange",
"id": 9152,
"lm_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, keras, tensorflow, cnn",
"url": null
} |
electric-circuits, potential, electrical-resistance, conductors, dissipation
Title: Shouldn't resistance only affect the kinetic energy of an electron? Suppose a ball is falling from a high point and we stop it midway using a plank. | {
"domain": "physics.stackexchange",
"id": 66217,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electric-circuits, potential, electrical-resistance, conductors, dissipation",
"url": null
} |
filter-design, delay
The start of the pass band is 49 Hz and the end is at 51 Hz (in fact, it looks like this: https://www.swissgrid.ch/en/home/operation/regulation/grid-stability.html), so it varies in time and is non-stationary. You could use a 2nd order IIR notch filter as I describe in this post Transfer function of second order notch filter - That post demonstrates a 50 Hz IIR notch with 1 KHz sampling.
[Update: As @user47050 astutely points out in the comments, the IIR notch would also have minimal delay regardless of notch bandwidth, since the dominat delay in the IIR notch filter is specific to the signal components in the rejection bandwidth of the filter, not the signals that you want to pass through. The advantage of what follows is not necessarily then to eliminate a delay issue, but to provide tracking rejection of just the interference that is approximately 50Hz (but slowly varying in phase and amplitude) while minimizing impact to adjacent frequencies of interest.] | {
"domain": "dsp.stackexchange",
"id": 9016,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filter-design, delay",
"url": null
} |
java, performance, object-oriented, programming-challenge, unit-testing
You can just have:
word = withoutPunctuation(word.toLowerCase());
if (word.isEmpty()) {
continue;
}
Potential bugs
You are currently lowercasing Strings with
word.toLowerCase()
This can lead to weird bugs. In fact, if someone with a Turkish locale were to run your code on the sentence "I LIKE JAVA", they would have as result the map {java=1, lke=1}. Notice the "I" that are missing. This is because changing the case of a String depends on the locale and by default, this is the locale of the JVM, which also defaults to your system locale. The capital "I" in Turkish is lowercased to "ı" (dot-less i), which then doesn't pass your filter because it isn't a character between 'a' and 'z'.
To counteract this, it is best to use the ROOT locale when changing the case, so you should have:
word.toLowerCase(Locale.ROOT) | {
"domain": "codereview.stackexchange",
"id": 19693,
"lm_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, object-oriented, programming-challenge, unit-testing",
"url": null
} |
python
And here's the pretty result:
>>> import test
>>> test.user_defined_functions()
user_defined_functions:
Return names of user-defined functions
foo:
Return 'foo' string
If I had just used the help function I could have gotten extra stuff I don't need (I'm not writing a library, so the user doesn't need all of this):
Help on module test:
NAME
test
FUNCTIONS
foo()
Return 'foo' string
user_defined_functions()
Return names of user-defined functions
FILE
/home/wena/src/utils/test.py Use for name, value in globals().items(): then you don't need to use eval | {
"domain": "codereview.stackexchange",
"id": 1453,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python",
"url": null
} |
java, file-system, image
Card card = new Card();
card.setbackImage(new ImageIcon(cardBackImage));
Image img = null;
if (ctr < listShuffle.size()) {
if (listShuffle.get(ctr).isFile()) {
if (fileCounter <= gameDiff) {
img = new ImageIcon(listShuffle.get(ctr).getPath()).getImage();
}
}
} else if (ctr < gameDiff) {
if (defaultShuffle.get(ctr).isFile()) {
img = new ImageIcon(defaultShuffle.get(ctr).getPath()).getImage();
}
}
Image dimg = img.getScaledInstance(144, 216, Image.SCALE_SMOOTH);
card.setfrontImage(new ImageIcon(dimg));
// Populate card with db results
cardsList.add(card);
}
} | {
"domain": "codereview.stackexchange",
"id": 5348,
"lm_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, file-system, image",
"url": null
} |
java, game, community-challenge, pathfinding
wwwwww wwwwwwwwwwwwwwwwwwwwwwwwwwwww wwwwwwww
wwwwww wwwwwwwwwwwwwwwwwwwwwwwwwwwwww wwwwwwwww
wwwwww > 1 wwwwwwwwwww
wwwwww > wwwwwwwwwwwwww
wwwwwwww > 2 wwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww | {
"domain": "codereview.stackexchange",
"id": 16173,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, game, community-challenge, pathfinding",
"url": null
} |
quantum-field-theory, mathematical-physics, group-representations, lorentz-symmetry, poincare-symmetry
$$\alpha_g(\phi(f)) := \rho_g \phi(g(f))$$
and extending it to the whole algebra by imposing that it is linear, preserves the adjoint and the products (and the unit),
where $g(f)$ is the standard action of the group on test functions.
Let us indicate the vacuum state by $\Omega$. The above representation has the property that, according to Wighhman axioms, it leaves invariant the $n$-point functions of the vacuum state
$$\langle \Omega, \phi(f_1) \cdots \phi(f_n) \Omega \rangle =
\langle \Omega, \alpha_g(\phi(f_1)) \cdots \alpha_g(\phi(f_n)) \Omega \rangle\:, $$ which extends to
$$\langle \Omega, A\Omega \rangle =
\langle \Omega, \alpha_g(A) \Omega \rangle \tag{1}$$
for a generic element $A\in {\cal A}$ and every $g \in SO(1,3)_+\times \mathbb{R}^4$.
Using the fact that $\phi({\cal A}) \Omega$ is dense in the Hilbert space (again as a consequence of Wightman axioms)
and (1), it is not difficult to prove that | {
"domain": "physics.stackexchange",
"id": 79051,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, mathematical-physics, group-representations, lorentz-symmetry, poincare-symmetry",
"url": null
} |
c, file-system, io, winapi, arduino
The only type of programming that would require the level of comments in this program would be assembly code programming.
The exit() Function and Magic Numbers
Generally the exit(int status) function isn't necessary in the main() function, the use of return would be better. The exit() function can be used in subroutines if a none recoverable error occurs in a subroutine but there are also other ways to handle these errors that you may want to look into in the future. Return from the main() function should return one of two values, EXIT_SUCCESS or EXIT_FAILURE. These symbolic constants are available from stdlib.h which is included in this program.
exit(42); | {
"domain": "codereview.stackexchange",
"id": 35988,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, file-system, io, winapi, arduino",
"url": null
} |
complexity-theory, reductions
I've looked at many different examples of how this is done, and everything I find online includes everything in the proof except the argument of why this is polynomial. I presume it's being left out because it's trivial, but that doesn't help me when I'm trying to learn how to explain such things. You are given a formula, and you will construct a graph. You can argue the reduction is polynomial time by analyzing the time you need to construct the graph. The transformation is an algorithm: write each step down, and analyze them. If every step takes polynomial time, you have shown the reduction runs in polynomial time. | {
"domain": "cs.stackexchange",
"id": 1076,
"lm_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, reductions",
"url": null
} |
## The Attempt at a Solution
I have attempted the solution but have failed to acquire the given answer. Here's what I tried
Acc. to $$\frac{\Delta Z} {Z}= \frac {\Delta A} {A} +\frac {\Delta B} {B}$$
we ignore constants (ρ, Θ and g)
h = (3.00 + 0.01)cm
D = (0.250 ± 0.001)cm
so r = D/2 or r = (0.125 ± 0.001)cm
so
$$\frac{\Delta T} {T}= \frac {\Delta r} {r} +\frac {\Delta h} {h}$$
which gives,
$$\frac{\Delta T} {T} =\frac {0.001} {0.125} +\frac {0.01} {3.00}$$
or,
$$\frac{\Delta T} {T} =0.0080 + 0.0034$$
or,
$$\frac{\Delta T} {T} =0.0113$$
where
$$\frac{\Delta T} {T}$$ is relative error. When we multiply that by 100, we get percent error
therefore percent error = 1.13 %
while the answer given is 0.7 %
Related Introductory Physics Homework Help News on Phys.org
Samy_A
Homework Helper
## Homework Statement | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9546474220263198,
"lm_q1q2_score": 0.8344355682419161,
"lm_q2_score": 0.8740772236840656,
"openwebmath_perplexity": 1577.551206415699,
"openwebmath_score": 0.7955619096755981,
"tags": null,
"url": "https://www.physicsforums.com/threads/errors-uncertainty-in-measurement-problem.870341/"
} |
context-free, formal-grammars
So I was hoping this language might be context free and tried to form a Grammar which generates the language, However I didn't succeed in it, due to the fact that a general word of the form: $a^{i_1}b^{j_1}a^{i_2}b^{j_2}...a^{i_n}b^{j_n}$ when $i_k,j_k \in \mathbb{N}\cup\{0\}$ satisfies $\sum i_k > \sum j_k$ and I am having hard time dealing with cases in which $i_l <j_l$ (for example $aaaababb$ when the second pair is $abb$).
I don't know whether I may proceed from my best attempt, yet, in case $ z = a^{i_1}b^{j_1}a^{i_2}b^{j_2}...a^{i_n}b^{j_n}$ satisfies $i_k > j_k \forall k\in [n]$ The grammar $A\rightarrow a | AA|AAB|BAA , B\rightarrow b$ with A as the initial term, should work (I didn't formally prove it so I might be wrong).
I also tried to work with closure properties but couldn't even find an idea to start with... Here is a hint. Given a word in $L_{a\gt b}$, if you remove $ab$ or $ba$ from it repeatedly until you cannot any more, what kind of word will you end up with? | {
"domain": "cs.stackexchange",
"id": 12138,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "context-free, formal-grammars",
"url": null
} |
matlab, filters, dsp-core
I also don’t understand how I can properly monitor overflow. I did shifts to try to avoid overflow, but I'm not sure if it's correct...
Does anyone have any ideas on how to correctly use integer coefficients generated by matlab to implement digital filters?
I wrote an example from the information that I understood, but I made a mistake somewhere, but I don’t understand where...
Source code with float filter implementation (6th order low pass filter and 2nd order high pass filter):
float lp500_sek1_x[3],lp500_sek1_y[3],lp500_sek1_a[2]={-1.833933353, 0.8860449791},
lp500_sek2_x[3],lp500_sek2_y[3],lp500_sek2_a[2]={-1.669203162, 0.7166338563},
lp500_sek3_x[3],lp500_sek3_y[3],lp500_sek3_a[2]={-1.586906791, 0.6319990754},
hp5_sek1_x[3],hp5_sek1_y[3],hp5_sek1_a[2]={-1.998889327, 0.9988899231}; | {
"domain": "dsp.stackexchange",
"id": 12371,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matlab, filters, dsp-core",
"url": null
} |
bond, molecular-orbital-theory, oxides
Title: Bond order of carbon monoxide and nitrosyl cation The following question was asked in JEE Mains exam in 2022, a competitive exam for engineering in India.
The difference between bond order of CO and NO$^+$ is $\frac{x}{2}$ where $x$ = ____. (Round off to the nearest integer).
Here, I have taken the bond order of CO as 2.6 (which is cited as the actual bond order of CO) as per:
This Stack Exchange answer
Vocation India
Kayson Education
Research Gate | {
"domain": "chemistry.stackexchange",
"id": 17729,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bond, molecular-orbital-theory, oxides",
"url": null
} |
ros, ros-fuerte, turtlesim, tutorial
Question 1 (of 2): Why is turtle1 spawned at a location beyond the end of the universe, instead of at its origin [0,0] ?
I executed
~$ rosrun turtlesim turtle_teleop_key
to see if the [x,y] coordinates would change when the up/down arrow keys were pressed, but unfortunately this is not the case. The [theta] value however -does- respond when the left/right arrow keys are pressed.
Output of the /turtle1/command_velocity topic:
$ rostopic echo /turtle1/command_velocity
linear: 2.0
angular: 0.0
---
linear: -2.0
angular: 0.0
---
linear: 0.0
angular: 2.0
---
...
Output of the /turtle1/pose topic:
...
---
x: inf
y: nan
theta: -3.06081461906
linear_velocity: 0.0
angular_velocity: 2.0
---
x: inf
y: nan
theta: -3.02881479263
linear_velocity: 0.0
angular_velocity: 2.0
---
x: inf
y: nan
theta: -2.99681472778
linear_velocity: 0.0
angular_velocity: 2.0
---
... | {
"domain": "robotics.stackexchange",
"id": 9202,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-fuerte, turtlesim, tutorial",
"url": null
} |
algorithms, randomness
Title: Random conditional association I have a really specific problem to solve and i'm looking for an existing algorithm to help me (i hope i'm in the right section of stackExchange).
I would have to make "random" association between items but all association need to have to answer to specific conditions.
Below, an simple exemple in javascript.
INPUT
var items = [12, 32, 25, 11, 8, 2, 4, 3, 8, 9];
CONDITION
All couples sum need to be between "20"(include) and "27"(include).
OUTPUT
result = [[12,9], [11,9], [25,2], ...]; | {
"domain": "cs.stackexchange",
"id": 12287,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, randomness",
"url": null
} |
homework-and-exercises, newtonian-mechanics, forces, mass, acceleration
So who is correct, me or my physics teacher, and if the physics teacher is, then why? Well, you can think of this as a car pulling a wagon with $a = 0.2 \text{ m/s}^2$.
Naturally, the car's motor needs to generate enough force to accelerate both the car itself and the wagon it is pulling. This is true of the situation in this question. The steam engine needs to generate enough force to accelerate both itself and the two wagons at $a = 0.2 \text{ m/s}^2$. So you need to take into account both the engine's mass and the mass of the two wagons. Consider what would happen if there weren't any wagons pulled by the engine. Would the engine then require the same amount of force to accelerate?
Another way to think of it is considering the engine and two wagons as one big block. Then the force needed to accelerate the block would be its total mass (mass of both the wagons and the engine) times its acceleration. | {
"domain": "physics.stackexchange",
"id": 24134,
"lm_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, forces, mass, acceleration",
"url": null
} |
### Show Tags
15 Aug 2019, 14:07
Bunuel wrote:
SOLUTION
If s and t are positive integers such that s/t = 64.12, which of the following could be the remainder when s is divided by t ?
(A) 2
(B) 4
(C) 8
(D) 20
(E) 45
Note: Positive integer $$a$$ divided by positive integer $$d$$ yields a reminder of $$r$$ can always be expressed as $$a=qd+r$$, where $$q$$ is called a quotient and $$r$$ is called a remainder, note here that $$0\leq{r}<d$$ (remainder is non-negative integer and always less than divisor).
So, "s divided by t gives remainder r" can be expressed by the following formula: $$s=qt+r$$, in or case as $$\frac{s}{t}=64.12$$ then $$q=64$$, --> $$s=64t+r$$, divide both parts by $$t$$ --> $$\frac{s}{t}=64+\frac{r}{t}$$ --> $$64.12=64+\frac{r}{t}$$ --> $$0.12=\frac{r}{t}$$--> $$\frac{3}{25}=\frac{r}{t}$$ so $$r$$ must be the multiple of 3. Only answer multiple of 3 is 45. | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9732407137099625,
"lm_q1q2_score": 0.8001879404340938,
"lm_q2_score": 0.8221891348788759,
"openwebmath_perplexity": 2788.9429618585805,
"openwebmath_score": 0.7442111968994141,
"tags": null,
"url": "https://gmatclub.com/forum/if-s-and-t-are-positive-integers-such-that-s-t-64-12-which-135190-20.html"
} |
condensed-matter, solid-state-physics, fourier-transform, crystals
$$ e^{i \textbf{k} \cdot \textbf{L}_i} = 1. $$
Expressing $ \textbf{k} $ as
$$ \textbf{k} = \sum_i x_i \textbf{b}_i, $$
which I think we can do to generate all space if they are linear independent (right?) and using the condition above we have
$$ x_i = \frac{\mathbb{Z}}{N_i}, $$
with $ \textbf{L}_i = N_i \textbf{a}_i $ where $ \textbf{a}_i $ is a Bravais vector, and therefore a vector of the reciprocal space. | {
"domain": "physics.stackexchange",
"id": 95832,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "condensed-matter, solid-state-physics, fourier-transform, crystals",
"url": null
} |
c, tree
branch is a pointer that keeps track of the node of the tree we are at.
depth tells us how deep we are in the tree.
Represent the depth by printing an equal number of dots. Then, print the current letter. If
we are at an end-of-word node, print E. Print a new-line.
Finally, call print_branch at all the children of the current node with an incremented depth.
*/
void print_branch(Node* branch, int depth) {
int i,j;
for (j = 0; j < depth; j++)
printf(".");
if (branch->is_end_of_word)
printf("%c E\n", branch->letter);
else
printf("%c\n", branch->letter);
for (i = 0; i < branch->number_of_children; i++)
print_branch(branch->children[i], depth+1);
}
void print_tree(Node *root) {
print_branch(root, 0);
}
/*********************************** TREE DICTIONARY FUNCTIONS ****************************/ | {
"domain": "codereview.stackexchange",
"id": 45425,
"lm_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, tree",
"url": null
} |
stoichiometry, crystal-structure
References:
Buddhadev, S. S.; Garala, K. C. Pharmaceutical Cocrystals—A Review. Proceedings 2020, 62, 14; doi 10.3390/proceedings2020062014, open access.
Nugrahani, I.; Jessica, M. A. Amino Acids as the Potential Co-Former for Co-Crystal Development: A Review. Molecules 2021, 26, 3279; doi 10.3390/molecules26113279 , open access.
Ross, S. A.; Lamprou D. A., Douroumis D. Engineering and manufacturing of pharmaceutical co-crystals: a review of solvent-free manufacturing technologies. Chem. Commun. 2016, 52, 8772-8786; doi 10.1039/C6CC01289B. | {
"domain": "chemistry.stackexchange",
"id": 15943,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "stoichiometry, crystal-structure",
"url": null
} |
computer-vision, opencv, 3d-reconstruction, monocular, 3d-model
\begin{bmatrix}
x \\ y \\ z
\end{bmatrix} + \vec{t}_i, \\
\hat{u}_i = \alpha_i\,\frac{\hat{x}'_i}{\hat{z}'_i} + \gamma_i, \\
\hat{v}_i = \beta_i\,\frac{\hat{y}'_i}{\hat{z}'_i} + \delta_i,
$$
where $\mathcal{I}$ is the set of all indices of the cameras which see the considered point. You could also add weights to each quadratic term in the summation, for example to reduce the influence of bad or low resolution cameras. The error terms in the summation are also known as the reprojection errors.
I suspect that this problem is not convex, mainly due to the division by $\hat{z}'_i$. However I do suspect that if you would use an initial guess that is well within the viewing frustum of each camera that it would converge to the global minimum in most cases. This optimization problem can be solved with methods like gradient decent or Newton's method where the gradient can be calculated with
$$ | {
"domain": "robotics.stackexchange",
"id": 1718,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computer-vision, opencv, 3d-reconstruction, monocular, 3d-model",
"url": null
} |
So that would be the other way. Take your matrix, mix it up, take combinations of the columns with random numbers. It's a random world here. Do a mixing, and then operate on the mixed matrix. OK, I'm going to do it the first way. I'm going to pick these probabilities to-- they'll turn out to be proportional to norm squared.
OK, ready for that? Here it comes. So let me bring that down. Yeah. OK. Actually, I could leave it up for now, because it told us what we're up to. OK. So what have I got? Let me just see if I can-- so we're multiplying a times b, and we're going to use these probabilities. Pj is going to be the length of that column times the length of that row, norm squared. | {
"domain": "mit.edu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9871787827157817,
"lm_q1q2_score": 0.8204867739895384,
"lm_q2_score": 0.8311430394931456,
"openwebmath_perplexity": 531.7775349371691,
"openwebmath_score": 0.8814080357551575,
"tags": null,
"url": "https://ocw.mit.edu/courses/mathematics/18-065-matrix-methods-in-data-analysis-signal-processing-and-machine-learning-spring-2018/video-lectures/lecture-13-randomized-matrix-multiplication/"
} |
beginner, promise, typescript, angular-2+
emerald.upload('myFile').subscribe((upload: Upload) => {
expect(upload.status).toBe(Status.SUCCESS);
expect(upload.date.getTime()).toBe(5400);
expect(upload.message).toBeNull();
});
}));
it(`should return an observable with an Upload{'FAIL', 'POST request failed', ...},
when upload response is {false, 0}`,
async(() => {
respond(id0AndFailContentResponse);
emerald.upload('myFile').subscribe((upload: Upload) => {
expect(upload.status).toBe(Status.FAIL);
expect(upload.message).toBe(PostRequestFailedErrMsg);
});
})); | {
"domain": "codereview.stackexchange",
"id": 26999,
"lm_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, promise, typescript, angular-2+",
"url": null
} |
pathology, mycology, infection
Class B: These are organisms that are fairly easy to disseminate, make people sick but don't necessarily have high mortality rates, and may be difficult to detect.
Brucellosis (Brucella species)
Epsilon toxin of Clostridium perfringens
Food safety threats (e.g., Salmonella species, Escherichia coli O157:H7, Shigella)
Glanders (Burkholderia mallei)
Melioidosis (Burkholderia pseudomallei)
Psittacosis (Chlamydia psittaci)
Q fever (Coxiella burnetii)
Ricin toxin from Ricinus communis (castor beans)
Staphylococcal enterotoxin B
Typhus fever (Rickettsia prowazekii)
Viral encephalitis (alphaviruses [e.g., Venezuelan equine encephalitis, eastern equine encephalitis, western equine encephalitis])
Water safety threats (e.g., Vibrio cholerae, Cryptosporidium parvum) | {
"domain": "biology.stackexchange",
"id": 1988,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pathology, mycology, infection",
"url": null
} |
electromagnetism, lagrangian-formalism, field-theory, noethers-theorem, gauge-invariance
ADDED. Let me add a comment to make my question more precise. When one has a Lie group preserving the action, the application of the Noether theorem and construction of charge operators using these currents lead presumably to a representation of the Lie algebra of this group (e.g. this is the case with the Poincare group, inner symmetries and more generally with supersymmetries). Hence if the gauge group preserves the action, one would expect that its Lie algebra acts on the Hilbert space of the theory. In the case of QED one would get a representation in the Hilbert space of the theory of the commutative (infinite dimensional) Lie algebra of real valued functions on $\mathbb{R}^{3+1}$. I am wondering if this is indeed the case. What I have seen in the literature is only one charge operator $Q=-e\int d^3x \cdot \bar\psi(x)\gamma^0\psi(x)$ corresponding to the current $-e\bar\psi\gamma^\mu\psi$ which corresponds to the rotation with the constant phase I mentioned first in the post. I | {
"domain": "physics.stackexchange",
"id": 57225,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, lagrangian-formalism, field-theory, noethers-theorem, gauge-invariance",
"url": null
} |
quantum-mechanics, quantum-entanglement, coherence
The double-slit observable
The simplest observable is $\hat A_1 = |1\rangle\langle 1|$, measuring the probability that a qubit is in state $|1\rangle.$ Now suppose that we don't do this directly, but first evolve the state with a unitary matrix. This will correspond to a photon going through a slit corresponding to the qubit and then traveling to a photomultiplier tube at position $y$, which will "click" (transition from $|0\rangle$ to $|1\rangle$ with amplitudes $f_{0,1}(y)$ when only one of these is open. So the unitary transformation is, for some $\alpha_{0,1}$ that don't matter, $$|0\rangle \mapsto \alpha_0(y) |0\rangle + f_0(y) |1\rangle\\
|1\rangle \mapsto \alpha_1(y) |0\rangle + f_1(y) |1\rangle.$$We measure the resulting qubit, which results in $$\langle A \rangle = \operatorname{Tr} (U\rho U^\dagger~ \hat A_1) = \operatorname{Tr} (\rho~U^\dagger \hat A_1 U).$$The matrix $U^\dagger \hat A_1 U$ is therefore $$\begin{bmatrix}\alpha_0^*&f_0^*\\\alpha_1^*&f_1^*\end{bmatrix} | {
"domain": "physics.stackexchange",
"id": 59194,
"lm_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-entanglement, coherence",
"url": null
} |
ros, ros-melodic, rosserial-arduino, rosserial-python, rosserial
Originally posted by ekptwtos on ROS Answers with karma: 35 on 2020-10-20
Post score: 0
The answer to this question unfortunately was not the one I was looking for.
The software serial library, even though it allows you to use whichever pins you want as software serial, it still uses the hardware serial, therefore microcontrollers that have only 1 hardware serial port can not be used for this application.
My solution was to buy a Feather M0 which has 1 hardware serial, but you can create more hardware serial ports through SERCOMs. Here is the relevant link for those who are interested.
IMPORTANT NOTE
it took me some time before I could make the Feather communicate over its USB with rosserial. The reason behind this: to use samd21 native usb port you have to add
#define USE_USBCON
before including any ros libraries in the Feather code.
Hope this helps someone, and /or save some and frustration!
Best,
Mike | {
"domain": "robotics.stackexchange",
"id": 35658,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-melodic, rosserial-arduino, rosserial-python, rosserial",
"url": null
} |
ros
Title: Orbbec Astra Camera. Unable to receive images. Missing configuration files
Hello.
So, I run roslaunch astra_launch astra.launch and use Rviz to test out my Orbbec Astra camera. The problem is that the launch application gives me these messages if I try to subscribe to a topic on Rviz:
[ WARN] [1498238437.855693874]: Camera calibration file /home/tbot1/.ros/camera_info/rgb_Astra_Orbbec.yaml not found.
[ WARN] [1498238564.009640794]: Camera calibration file /home/tbot1/.ros/camera_info/depth_Astra_Orbbec.yaml not found.
I've looked around and I can't seem to find any configuration files similar to what it's asking for.
Can anybody help me? Thanks. | {
"domain": "robotics.stackexchange",
"id": 28193,
"lm_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
} |
performance, c, strings, type-safety
where the function could return the number of bytes successfully appended or –1 on error.
My second remark would be that you are growing your buffer by a constant amount each time you reallocate. It should really grow exponentially unless you really know that linear growth will be preferable in your specific use-case, which I find hard to imagine how that could be.
Concerning your comments: there is no NULL byte. NULL is a macro constant for the null pointer. The null byte is abbreviated as NUL in the ASCII character set. I would also find it helpful to have your function's semantics exactly documented in a comment. For example, should the user free the buffer if it fails and returns NULL? Will the existing data be modified in that case? I can try answering those questions by reading your implementation but that doesn't allow me to distinguish a bug in your code from a different valid design decision. | {
"domain": "codereview.stackexchange",
"id": 12515,
"lm_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, c, strings, type-safety",
"url": null
} |
# Definition of the outer measure and the outer measure of an interval.
I'm taking a course in Real Analysis covering Measure Theory. We are using Real Analysis by Royden/Fitzpatrick as the text. I'm going through the book and I'm struggling to understand the approach of Proposition 1 which states: The outer measure of an interval is it's length. This makes me think I'm misunderstanding the definition of the outer measure.
I understand the first part which tells us that if we have an interval $$[a,b]$$, let $$\epsilon > 0$$ be given. Then $$[a,b] \subseteq (a- \epsilon, b+ \epsilon)$$ so $$m^*([a,b]) \leq \ell((a- \epsilon, b+ \epsilon) = b - a + 2\epsilon$$. Since this holds for any $$\epsilon > 0$$ then $$m^*([a,b]) \leq b-a$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9597620539235895,
"lm_q1q2_score": 0.8437716966486652,
"lm_q2_score": 0.8791467564270272,
"openwebmath_perplexity": 41.54206455655335,
"openwebmath_score": 0.9328638315200806,
"tags": null,
"url": "https://math.stackexchange.com/questions/3828745/definition-of-the-outer-measure-and-the-outer-measure-of-an-interval"
} |
### Show Tags
16 Aug 2015, 11:18
triptigahlot wrote:
As per option B, C is the midpoint of BD, and any line drawn from a vertex to midpoint of another side is median. So, Ac is median. I want to know that won't the property:- "Median drawn to the hypotenuse of right triangle is half length of hypotenuse length", applicable here?
Please let me know where i am wrong?
According to me the answer shud be B.
The property you quote is right but how does this help to find the length of BD?
_________________
Intern
Joined: 06 Aug 2015
Posts: 5
Re: If angle BAD is a right angle, what is the length of side [#permalink]
### Show Tags | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9213576144970795,
"lm_q1q2_score": 0.810008571422812,
"lm_q2_score": 0.8791467706759584,
"openwebmath_perplexity": 1271.148772051905,
"openwebmath_score": 0.7576377987861633,
"tags": null,
"url": "https://gmatclub.com/forum/if-angle-bad-is-a-right-angle-what-is-the-length-of-side-105559.html"
} |
slam, navigation, octomap, ros-kinetic, rtabmap-ros
Title: Rtabmap_ros does not show octo map but points clouds are good
Hi
Im using two point Grey Chameleon3 mono camera set up as Master Salve and synchronized so can work as stereo camera. I have a installed ROS driver and able to publish the camera topics . Im using this ROS driver https://github.com/KumarRobotics/flea3. And with roslaunch flea3 stereo_node.launch left:=18081067 right:=17496474 camera:=stereo_camera
can launch the driver. Im hand holding the cameras so for that case using this tutorial http://wiki.ros.org/rtabmap_ros/Tutorials/StereoHandHeldMapping about hand-held stereo mapping. | {
"domain": "robotics.stackexchange",
"id": 31589,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam, navigation, octomap, ros-kinetic, rtabmap-ros",
"url": null
} |
java, tree, generics
public static FileWriter writeFile(String fileName){
FileWriter wF = null;
try {
wF = new FileWriter(fileName);
return wF;
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("Unable to write file..");
return null;
}
}
public static void callWhom(BinaryTreeNode<Contact> subRoot){
System.out.print(subRoot.getData().getName() + " calls ");
if(subRoot.getLeft() != null){
System.out.print(subRoot.getLeft().getData().getName());
if(subRoot.getRight() != null)
System.out.println(" and " + subRoot.getRight().getData().getName());
else
System.out.println();
}
else if(subRoot.getRight() != null)
System.out.println(subRoot.getRight().getData().getName());
else
System.out.println("No Contact"); | {
"domain": "codereview.stackexchange",
"id": 35307,
"lm_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, tree, generics",
"url": null
} |
scikit-learn, random-forest, accuracy
I compare the algorithms by changing n1, n2, mu1, sigma1, mu2, sigma1 and checking the accuracies of the training and test sets. I initialize the classifiers with their default parameters.
To make a long story short, the Random Forest Classifier always scores 100% accuracy on the test test, no matter what parameters I set.
If, for instance, I test the following parameters:
n1 = n2 = 250
mu1 = mu2 = 7.0
sigma1 = sigma2 = 3.0,
I merge two completely overlapping subpopulations into X (they still have the correct label y associated to them). My expectation for this experiment is that the various classifiers should be completely guessing, and I would expect a test accuracy of around 50%.
In reality, this is what I get: | {
"domain": "datascience.stackexchange",
"id": 7264,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "scikit-learn, random-forest, accuracy",
"url": null
} |
quantum-field-theory, lagrangian-formalism, path-integral
Title: Is the physics of a Quantum Field Theory dependent on the choice of Lagrangian? A Quantum Field Theory can be obtained by quantising a Classical Field Theory through to a procedure. The procedure involves starting with a set of equations of motion that describe a Classical Field Theory, then find a Lagrangian that produces that set of equations of motion, then use that Lagrangian in Quantum Field Theory.
However, we know that different Lagrangians can produce the same equations of motion in Classical Field Theory. In other words, in Classical Field Theory, as long as two Lagrangians produce the same equations of motion, then we can use either of those. | {
"domain": "physics.stackexchange",
"id": 77888,
"lm_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, lagrangian-formalism, path-integral",
"url": null
} |
quantum-gate, quantum-algorithms, simulation, hamiltonian-simulation
Start with a (possibly time dependent) Hamiltonian $H$ of a many-body system, e.g. a molecular system. The evolution operator then reads:
$$
U = \mathrm{e}^{-{\rm i}Ht}.
$$
Use Trotter decomposition so as to break this unitary to a sum/product of many unitaries:
$$
U \approx ( {\rm e}^{-{\rm i}\, h_1\,\delta t}\ldots {\rm e}^{-{\rm i}\, h_n\,\delta t})^{1/\delta t}
$$
for Hermitian matrices $h_i$. $U$ can be viewed as the propagator.
Use the Jordan-Wigner mapping to convert the
propagator above into a sequence of quantum gates.
Knowing that for a stationary initial state $|\psi_0\rangle$ it holds that the action $\mathrm{e}^{-{\rm i}Ht}|\psi_0\rangle$ will produce an eigenvalue $ \mathrm{e}^{-{\rm i}E_0t}$, use QPE to compute ${\rm e}^{2\pi {\rm i}(\phi+k)}$
Specifically for the QPE algorithm we read: | {
"domain": "quantumcomputing.stackexchange",
"id": 3253,
"lm_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-gate, quantum-algorithms, simulation, hamiltonian-simulation",
"url": null
} |
navigation, odometry, laser, amcl
uint g=0;
for(int i = 0; i < 1080; i++){
r = receivedscan.ranges[i];
x = r*cos(((0.25*i)-45)/180*PI);
z = r*sin(((0.25*i)-45)/180*PI);
rotator->unrotate(x, y ,z, xt, yt, zt);
float d=-90.0;
if((xt!=0.0)||(zt!=0.0))
{
d=atan2(zt,xt)*180.0/PI+45.0;
}
if(d<0.0){
d+=360.0;
}
float e= (d*215/270)+0.5;
int h = e;
float absolutedifference= std::abs (e-h);
rt = sqrt(zt*zt+xt*xt);
if(h>=0.0)
{
if(absolutedifference<indexdifference[h])
{
indexdifference[h]=absolutedifference;
publishscan.ranges[h]=rt;
}
}
/*if(i<2 && absolutedifference<angle[0])
{
angle[0]=d;
publishscan.ranges[0]=rt;
} | {
"domain": "robotics.stackexchange",
"id": 16403,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, odometry, laser, amcl",
"url": null
} |
java, performance, ai, compiler, prolog
}
continue;
}
else{// c'est un mot
if(predicatConstant(mot)){predicat = true;}
continue;
}
}while (!mot.equals(""));
// case of a constant predicat at the end of a Clause
if(predicat){c.add(c.new Litteral(mot_old));}
//we have to change the variables name adding the name (only var) didn't understood this type actually
//il faut changer le nom des variables en y incorporant le nom (var uniquement)
for(int i=0;i<listeCode.size();i++){
if( Annuaire.val((Integer)listeCode.get(i))==null )
Annuaire.AffSymbole.put((Integer)listeCode.get(i),listeAff.get(i)+listeCode.get(i).toString());
}
if(display){
System.out.println("CLAUSE "+c);
} | {
"domain": "codereview.stackexchange",
"id": 22490,
"lm_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, ai, compiler, prolog",
"url": null
} |
knowrob
% library(semweb/owl) compiled into t20_owl 0.01 sec, 37,936 bytes
% library(socket) compiled into socket 0.00 sec, 7,012 bytes
% library(base64) compiled into base64 0.00 sec, 9,640 bytes
% library(http/http_open.pl) compiled into http_open 0.01 sec, 58,700 bytes
% library(thea/owl_parser) compiled into owl_parser 0.02 sec, 105,276 bytes
% library(odbc) compiled into odbc 0.00 sec, 21,508 bytes
% library(semweb/rdfs_computable) compiled into rdfs_computable 0.00 sec, 57,604 bytes
% /opt/ros/fuerte/stacks/knowrob/semweb/prolog/init.pl compiled 0.10 sec, 874,864 bytes
% library(tf_prolog) compiled into tf_prolog 0.01 sec, 13,080 bytes
% /opt/ros/fuerte/stacks/knowrob/tf_prolog/prolog/init.pl compiled 0.01 sec, 15,428 bytes
% library(knowrob_owl) compiled into knowrob_owl 0.00 sec, 7,420 bytes
% library(knowrob_perception) compiled into knowrob_perception 0.01 sec, 13,176 bytes
% Parsed "knowrob_objects.owl" in 0.00 sec; 202 triples | {
"domain": "robotics.stackexchange",
"id": 16296,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "knowrob",
"url": null
} |
ros2
Originally posted by Gabbar on ROS Answers with karma: 49 on 2019-01-22
Post score: 2
Original comments
Comment by Technerd on 2019-05-28:
You should run ros2 bag play [folder name] and mention the folder that contains all rosbag files
(metdata.yaml,...).
The idea for rosbag2 is that you don't load the concrete db3 file, but specify the folder where your data is located.
Can you try to run
ros2 bag play rosbag2_2019_01_22-17_57_14
I believe this should help.
To give you a bit of background: The file you specified is then getting interpreted as the folder name and within rosbag2 looks for a metdata file telling how to interpret this data. Obviously, this metadata file is not found.
I believe though the error messages are misleading. I think it makes sense to check whether the given file is indeed a directory or not and present the error message accordingly.
Feel free to open a ticket for this here: https://github.com/ros2/rosbag2 | {
"domain": "robotics.stackexchange",
"id": 32310,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros2",
"url": null
} |
beginner, html, email, perl
This is much easier to read as the zig-zag you have there. The same goes for the GetOptions call (though I think that's just the real tabs confusing SO). If you don't want to do this yourself, take a look at perltidy. It's an auto-indentation tool that does this for you. It's highly configurable and integrates nicely into almost all editors or IDEs.
You don't need to escape double quotes "" in strings that you built with qq(). It's horrible to read with all the backslashes. Get rid of them.
(my $serviceHTMLTable = qq(
!<table class="fixed">
! <tr><th colspan="2" class="header">Nagios Monitoring System Notification</th></tr>
You can use say instead of print "\n". It's a built-in that needs to be enabled by use feature 'say'; at the top of your program, with the other pragmas.
say "Time time is: ", time; | {
"domain": "codereview.stackexchange",
"id": 23191,
"lm_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, html, email, perl",
"url": null
} |
java, xml, finance, javafx
Title: Stock control system I have programmed this simple Stock Control System using JavaFX for GUI and PostgreSQL for a database.
Please go through my code and point out flaws, inefficiencies, and better ways of doing things. I'd also like to be made aware of best practices which I am not following. The last two files are external links because I exceed the character limit (but don't review them).
com.HassanAlthaf.StockControlSystem.Main.java
/*
* Program developed by Hassan Althaf.
* Copyright © 2015, Hassan Althaf.
* Website: http://hassanalthaf.com
*/
package com.HassanAlthaf.StockControlSystem;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("View/LoginWindow.fxml")); | {
"domain": "codereview.stackexchange",
"id": 16450,
"lm_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, xml, finance, javafx",
"url": null
} |
thermodynamics, experimental-physics, heat-conduction
Alright so in order to learn how fast the temperature of a material rises as time goes on we need to do some crash-course in thermodynamics.
So there is this quantity called internal energy $U$ that is the sum of a kinetic energy and potential energy of the particles of a system. We can think of $U$ as a function of the chemical composition of a system, its pressure, volume and temperature. So in a system composed of substances $A$, $B$ and $C$, for instance, $U = U(n_A,n_B,n_C,p,V,T)$ where $n_A$ is the number of moles of substance $A$.
$$
\mathrm{d}U=
\left(\frac{\partial U}{\partial p}\right)_{n_A,n_B,n_C,V,T}\mathrm{d}p
+\left(\frac{\partial U}{\partial V}\right)_{n_A,n_B,n_C,p,T}\mathrm{d}V
+\left(\frac{\partial U}{\partial T}\right)_{n_A,n_B,n_C,V,p}\mathrm{d}T
+\sum_{i=A,B,C}\left(\frac{\partial U}{\partial n_i}\right)_{n_{j\neq i},p,V,T}\mathrm{d}n_i
$$ | {
"domain": "physics.stackexchange",
"id": 91028,
"lm_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, experimental-physics, heat-conduction",
"url": null
} |
java, role-playing-game
//Exploration Location Menu
public void exploreMenu() {
System.out.println("\n--------------------------------------------------------------------\n");
System.out.println("Where would you like your children to explore?\n");
System.out.println("1) The mountains to the north.\n");
System.out.println("2) The forest to the south.\n");
System.out.println("3) The plains to the east.\n");
System.out.println("4) The coastline to the west.\n");
System.out.println("5) Back");
System.out.println("\n--------------------------------------------------------------------\n");
exploreMenuChoice = myScanner.nextInt(); | {
"domain": "codereview.stackexchange",
"id": 29718,
"lm_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, role-playing-game",
"url": null
} |
(A) 1
(B) 2
(C) 3
(D) 4
(E) 5
14. How many ways are there to write 2016 as the some of twos and threes, ignoring order? (For example,$$1008 \cdot 2 + 0 \cdot 3$$ and $$402 \cdot 2 + 404 \cdot 3$$ are two such ways.)
(A) 236
(B) 336
(C) 337
(D) 403
(E) 672
15. Seven cookies of radius 1 inch are cut from a circle of cookie dough, as shown. Neighboring cookies are tangent, and all except the centre cookie are tangent to the edge of the dough. The leftover scrap is reshaped to form another cookie of the same thickness. What is the radius in inches of the scrap cookie? | {
"domain": "cheenta.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9873750507184356,
"lm_q1q2_score": 0.8049402138726413,
"lm_q2_score": 0.8152324826183822,
"openwebmath_perplexity": 569.6540603091393,
"openwebmath_score": 0.6772887110710144,
"tags": null,
"url": "https://www.cheenta.com/amc-10a-2016/"
} |
c++, parsing
std::ifstream mapFile(fileName.c_str());
std::string line;
while(std::getline(mapFile, line))
{
// Each line in the file contains a token/value mapping
std::stringstream linestream(line);
std::string token;
std::string value;
std::getline(linestream, token, ':');
std::getline(linestream, value);
// Save the token and value
replaceMap[token] = value;
}
}
std::string replace(std::string const& line)
{
std::string result;
std::size_t last = 0; | {
"domain": "codereview.stackexchange",
"id": 3911,
"lm_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++, parsing",
"url": null
} |
python, matplotlib
Refactored code
import numpy as np
import matplotlib.pyplot as plt
%%matplotlib inline
fig = plt.figure()
axes = fig.add_axes((1, 1, 1, 1))
x = np.array([3, 3.2, 3.5, 3.7, 3.8, 3.9, 5, 5.5, 5.8, 5.9, 5, 5.8])
y = np.array([1, 1, 1, 3, 2, 1, 2, 2, 2, 1, 2, 3])
markers = ['^', 'o', 's', 'v', 'p']
for idx, marker in enumerate(markers):
i = (y == idx + 1)
flat = [idx + 1 for val in y[i]]
axes.scatter(x[i], flat, marker=marker, s=200)
axes.set_xlim([min(x) - 0.5, max(x) + 0.5])
axes.set_ylim([min(y) - 0.5, max(y) + 0.5])
This resulted in the following figure:
As you can see there is a lot more empty space, bigger markers, and even easier to see that in my slightly changed base data the x-ranges are not totally separable. | {
"domain": "codereview.stackexchange",
"id": 17504,
"lm_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, matplotlib",
"url": null
} |
gazebo, ros2, roslaunch, ros-foxy, ubuntu-20.04
launch_description = self.__launch_description_source.get_launch_description(context)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_source.py", line 84, in get_launch_description
self._get_launch_description(self.__expanded_location)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/python_launch_description_source.py", line 51, in _get_launch_description
return get_launch_description_from_python_launch_file(location)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/python_launch_file_utilities.py", line 62, in get_launch_description_from_python_launch_file
launch_file_module = load_python_launch_file_as_module(python_launch_file_path)
File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_description_sources/python_launch_file_utilities.py", line 37, in load_python_launch_file_as_module
loader.exec_module(mod) | {
"domain": "robotics.stackexchange",
"id": 38532,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo, ros2, roslaunch, ros-foxy, ubuntu-20.04",
"url": null
} |
sampling, autocorrelation, stochastic
strictly band limited, then one of these reconstructions will coincide with the function that was sampled. But simply to use the Shannon-Whittaker interpolation formula on $R_Y[n]$ and insist that the result must be $R_X(t)$ is something that boggles my mind, though ymmv. As for ergodicity, the less said the better. | {
"domain": "dsp.stackexchange",
"id": 7268,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sampling, autocorrelation, stochastic",
"url": null
} |
quantum-mechanics, condensed-matter, differential-geometry, gauge-theory, berry-pancharatnam-phase
Part of their derivation considers the tangent space of a point on a closed, adiabatic loop over some parameter space. They show that the tangent vectors in tangent space can be decomposed into vertical and horizontal parts.
The state evolved by Schrodinger's equation is vertical, making the horizontal part zero (parallel transport?). Then, the covariant derivative that makes the basis of the horizontal part is used to show that the Berry connection $A_\mu$ can be written entirely in terms of the scalar product on Hilbert space.
That is, the covariant derivative
$$ D_\mu = \frac{\partial}{\partial X^\mu} + A_\mu \frac{\partial}{\partial\theta}, $$
gives
$$ \langle m| D_\mu |m \rangle= \langle m|\frac{\partial}{\partial X^\mu} + A_\mu \frac{\partial}{\partial\theta}|m \rangle=0
\implies A_\mu = \langle m|\frac{\partial}{\partial X^\mu}|m \rangle. $$ | {
"domain": "physics.stackexchange",
"id": 73405,
"lm_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, condensed-matter, differential-geometry, gauge-theory, berry-pancharatnam-phase",
"url": null
} |
Triangular Arbitrage
A reduced form of FX market efficiency is that of triangular arbitrage, which is the geometric relationship between three currency pairs. Triangular arbitrage is defined in two forms, forward arbitrage and reverse arbitrage. These relationships are defined below.
$$\left(\frac{C_1}{C_2}\right)_{ask} \left(\frac{C_2}{C_3}\right)_{ask} = \left(\frac{C_1}{C_3}\right)_{bid} \\ \left(\frac{C_1}{C_2}\right)_{bid} \left(\frac{C_2}{C_3}\right)_{bid} = \left(\frac{C_1}{C_3}\right)_{ask}$$
With two-way high-frequency prices, we can simultaneously calculate the presence of forward and reverse arbitrage. | {
"domain": "theresearchkitchen.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9881308786041316,
"lm_q1q2_score": 0.8124304614636026,
"lm_q2_score": 0.8221891239865619,
"openwebmath_perplexity": 2287.870760814901,
"openwebmath_score": 0.6073945760726929,
"tags": null,
"url": "http://www.theresearchkitchen.com/blog"
} |
also cover evaluation of trig functions as well as the unit circle (one of the most important ideas from a trig class!) and how it can be used to evaluate trig functions. As a result we say cos -1 (½) = 60°. For $$p < 0$$, the graph of the cosine function shifts to the right by $$p$$ degrees. These ideas will be developed in the module, Trigonometric Functions. Cosine Functions. y = -2 cot. Cos(number) The required number argument is a Double or any valid numeric expression that expresses an angle in radians. fix FIX Round Towards Zero ; log1p LOG1P Natural Logarithm of 1+P Function ; log LOG Natural Logarithm Function ; sqrt SQRT Square Root of an Array ; Page Last Updated on: Sunday, October 25, 2009, 12:19:06 AM (CEST). In a right triangle, the ratio of the length of the side adjacent to an acute angle to the length of the hypotenuse. For an angle Θ with the point (12,5) on its terminating side, what is the value of cosine? - 16250705. The cosine function is a trigonometric function | {
"domain": "tuningfly.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.988491850596674,
"lm_q1q2_score": 0.8673786582643681,
"lm_q2_score": 0.8774767922879693,
"openwebmath_perplexity": 521.5547638858176,
"openwebmath_score": 0.8494910001754761,
"tags": null,
"url": "http://tuningfly.it/ikjw/cosine-function.html"
} |
III) Just to avoid confusion we can do this hybrid solution that has not ambiguity:
i) $$A \subseteq B$$ means $$A$$ is a subset of $$B$$ and $$A$$ might equal $$B$$.
ii) $$A\subsetneq C$$ means $$A$$ is a subset of $$B$$ but $$A \ne B$$.
Just to be safe. No-one can mistake what we mean. I'd recommend using III) just to avoid this silly quibbles.
(It's actually not that bad. It's usually very clear in context which ones make sense.)
A comment points out that if the author uses two different symbols that implies the author wants the symbols to mean two different things. And by convention I) there is no symbol $$\subseteq$$ so it's reasonable that the author is using connvention II).
Which makes me think further about my opinion of which convention I prefer.
And I think a little concern should be made for the ease of reading and writing. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9324533032291501,
"lm_q1q2_score": 0.8228227832616025,
"lm_q2_score": 0.8824278710924295,
"openwebmath_perplexity": 230.93410012494212,
"openwebmath_score": 0.8243317604064941,
"tags": null,
"url": "https://math.stackexchange.com/questions/2939900/difference-between-%E2%8A%82-and-%E2%8A%86"
} |
newtonian-mechanics, forces, friction, free-body-diagram
This is not correct. The friction force acts forwards on the man. Remember, work is force times displacement. So that just means that the displacement is backwards. This makes sense as the man’s foot will move backwards along with the board.
Now, you may be confused because the man’s center of mass moves forward. However, the friction does not act on the center of mass. The friction acts on the foot, so the relevant displacement is the displacement of the foot.
This confusion often stems from poor teaching about the work energy theorem where the “net work” is calculated as the product of the net force and the displacement of the center of mass. This “net work” is not the same as the work done by a given force or even the sum of the works of all forces. And it only reflects the change in kinetic energy, not the total change in energy. It is a rather limited concept that is easily over generalized or over emphasized in class. | {
"domain": "physics.stackexchange",
"id": 80469,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, forces, friction, free-body-diagram",
"url": null
} |
quantum-algorithms, entanglement, measurement
https://en.wikipedia.org/wiki/Wigner_quasiprobability_distribution
These marginal distributions can be interpreted as a shadow of the quantum state along a direction specified by which quadrature is measured. Interestingly, there are quantum states for which the Wigner function may be negative in some phase-space regions! This is an indication of non-classicality, as the multiple "shadows" fail to make sense together: each shadow is a sensible probability distribution, but the "object" that casts the shadows is a phase-space distribution without direct interpretation in terms of probabilities (as it can be negative in some regions).
At least for some definitions of discrete Wigner functions (useful for describing states in finite-dimensional Hilbert spaces), this negativity has been linked to contextuality and advantage in quantum computation, as pointed out for example in these papers:
https://arxiv.org/abs/1201.1256
https://arxiv.org/abs/0710.5549 | {
"domain": "quantumcomputing.stackexchange",
"id": 237,
"lm_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-algorithms, entanglement, measurement",
"url": null
} |
forces, interactions, conservative-field
Title: Are fundamental forces conservative? I wonder whether fundamental forces are conservative.
First of all, I'm not sure if we can talk about conservative forces, since to study electromagnetism, weak and strong interactions we need QFT.
For gravity, I'd that it's not conservative, because energy conservation doesn't even apply. The notion of "conservative forces" is not in any way fundamental. What's fundamental is that we're able to assign a number to the state of a system, and that number is conserved.
The relatively uninteresting notion of a "conservative force" can be applied only to a force that can be expressed as a vector field that depends only on position. That means it's meaningful for Newtonian gravity and for electrostatics, but not for any other force that could be considered fundamental. Re the nuclear forces, see Do strong and weak interactions have classical force fields as their limits? . | {
"domain": "physics.stackexchange",
"id": 38249,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "forces, interactions, conservative-field",
"url": null
} |
quantum-field-theory, renormalization, fermions, effective-field-theory, non-perturbative
i \gamma^\mu p_\mu \delta(p+q) + \int dp_1~ i h_k \phi(p_1) \delta(p+q+p_1) \\ \int dp_3~ i h_k \psi(p_3) \delta(p+q+p_3) & Z_{k,\psi} i \gamma^\mu p_\mu \delta(p+q) + \int dp_1~ i h_k \phi(p_1) \delta(p+q+p_1) & 0 \end{bmatrix}$$ | {
"domain": "physics.stackexchange",
"id": 83948,
"lm_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, renormalization, fermions, effective-field-theory, non-perturbative",
"url": null
} |
quantum-algorithms
In this 2017 work the authors implement Grover's search on a database of size $8$ using $3$ qubits on a "programmable quantum computer". However, it is my understanding that there is a limit to the scalability of these algorithms, in terms of the number of qubits, with existing error correction (or lack thereof) on current devices.
How one turns a decision/oracle problem into something implemented on a quantum computer with Grover search is akin to the way Grover search is used to solve a Sudoku problem in the linked Qiskit tutorial. | {
"domain": "quantumcomputing.stackexchange",
"id": 3946,
"lm_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-algorithms",
"url": null
} |
ros, roscreate-pkg
Title: I can't create a package
I have installed ROS. I did the first two ROS/Tutorials (1. Installing and Configuring Your ROS Environment and 2. Navigating the ROS Filesystem) without problems. However, in the third (Creating a ROS Package) I have problem creating my package.
I do:
$ cd ~/ros_workspace
$ roscreate-pkg beginner_tutorials std_msgs rospy roscpp
and I get:
Created package directory /home/juliocesar/ros_workspace/beginner_tutorials
Created include directory /home/juliocesar/ros_workspace/beginner_tutorials/include/beginner_tutorials
Created cpp source directory /home/juliocesar/ros_workspace/beginner_tutorials/src
Created package file /home/juliocesar/ros_workspace/beginner_tutorials/Makefile
Traceback (most recent call last):
File "/opt/ros/electric/ros/bin/roscreate-pkg", line 35, in <module>
roscreate.roscreatepkg.roscreatepkg_main()
File "/opt/ros/electric/ros/tools/roscreate/src/roscreate/roscreatepkg.py", line 126, in roscreatepkg_main | {
"domain": "robotics.stackexchange",
"id": 8991,
"lm_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, roscreate-pkg",
"url": null
} |
slam, navigation, octomap, octovis, rgbd-slam
Title: octovis for ros-electric
How to install octovis for ros-electric?
I tried $ sudo apt-get install ros-electric-octomap-visualization.
But it reported can't locate the package.
Then I read some of the discussions in ros.answers and tried from
$ svn co https://octomap.svn.sourceforge.net/svnroot/octomap/trunk octomap
and compiled using commands cmake and make
after that in the terminal I typed command $ ocotovis
It says command not found.
Any solutions?
Thanks in advance
Updated:
Also, while compiling I see the compilation is successful. I can see files inside folder build, bin and lib. Though, I am unable to open the octovis GUI. I used the above command to open that.
Originally posted by Sudhan on ROS Answers with karma: 171 on 2012-07-27
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 10388,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam, navigation, octomap, octovis, rgbd-slam",
"url": null
} |
mathematical-physics, differential-geometry, research-level, lie-algebra, brst
A lengthier, but still quick and very readable discussion of this can be found in Josê Figueroa-O'Farrill's lecture notes on "BRST Cohomology". | {
"domain": "physics.stackexchange",
"id": 16442,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mathematical-physics, differential-geometry, research-level, lie-algebra, brst",
"url": null
} |
java, game, android
for (int i = 1; i < layers.length; i++){
String code = "texture" + base_id + "_" + random.nextInt(6);
layers[i] = code;
}
return layers;
}
You have random.nextInt with 3, then +2, and 3 somewhere else, and 6 somewhere else again...
I don't know what they mean. You have apparently 2-4 layers each but the top(?) textured with a random 0-5 subtextures... which seems oddly rigid to me, why 6 different subtextures, why not 5, why not 7...
String code = "texture" + base_id + "_" + random.nextInt(6);
layers[i] = code;
That's an unnecessary local store. You don't do anything with the variable, and it doesn't have a name that clarifies anything. I'd remove it, just put the following in your for loop:
layers[i] = "texture" + base_id + "_" + random.nextInt(6); | {
"domain": "codereview.stackexchange",
"id": 16171,
"lm_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, android",
"url": null
} |
genetics
Title: What´s the origin of junk DNA? Most eukaryotes posses a certain amount of junk DNA in their cell nuclei. What is (are) the origin(s) of this junk DNA, And is it realy junk (superfluous)? "Junk DNA" is more aptly named noncoding DNA. This is defined as any DNA region that does not encode for a gene or more precisely is not within an open reading frame. In the human genome over 98% consists of noncoding DNA. However the more we learn about molecular biology the more we understand the biological function and importance of noncoding DNA. Examples for important functions are:
Regulatory regions that control the expression of a gene
Regions coding for regulatory RNA
Regions where epigenetic regulation takes place
However, there are also regions which likely do not have beneficial biological function, which may rightfully be called junk: | {
"domain": "biology.stackexchange",
"id": 5699,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "genetics",
"url": null
} |
microarray, quality-control, data-preprocessing, batch-effects
Am I missing something here? Why do the people I talk to seem to think this is so hard and time consuming -- is it really that bad? Should I avoid having a dissertation paper that uses gene expression data if I want to graduate on time?
(The data will be from Affymetrix microarrays. There are enough samples to use two 96-well plates, so batch effects will be more of a concern than they were in my class project.) I am not sure how much you know about bioinformatics already, can you use R? For a bioinformatician looking at QC for microarrays should not be a big deal, at least for me it would take maybe a day (or two) to get this done. However, if you never used R and want to start from scratch, it depends on how quickly you learn how to deal with arrays and QC. There are many tutorials and review papers about normalization and QC of arrays. Try there and see if you can easily understand what these papers are telling you. | {
"domain": "bioinformatics.stackexchange",
"id": 410,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "microarray, quality-control, data-preprocessing, batch-effects",
"url": null
} |
ros
/opt/ros/dashing/lib/python3.6/site-packages/rclpy/context.py in __init__(self)
26
27 def __init__(self):
---> 28 from rclpy.impl.implementation_singleton import rclpy_implementation
29 self._handle = rclpy_implementation.rclpy_create_context()
30 self._lock = threading.Lock()
/opt/ros/dashing/lib/python3.6/site-packages/rclpy/impl/implementation_singleton.py in <module>
29 from rclpy.impl import _import
30
---> 31 rclpy_implementation = _import('._rclpy')
32 rclpy_action_implementation = _import('._rclpy_action')
33 rclpy_logging_implementation = _import('._rclpy_logging')
/opt/ros/dashing/lib/python3.6/site-packages/rclpy/impl/__init__.py in _import(name)
20 def _import(name):
21 try:
---> 22 return importlib.import_module(name, package='rclpy')
23 except ImportError as e:
24 if e.path is None: | {
"domain": "robotics.stackexchange",
"id": 35799,
"lm_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
} |
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
int getIndex(int n, int arr[]) {
int odd = 0, even = 0;
vector<pair<int, int >> left_vector, right_vector;
left_vector.push_back(make_pair(odd, even));
for (int i = 0; i < n - 1; i++) { //count and store odd and even frequency for left side
if (arr[i] % 2 == 0)
even++;
else
odd++;
left_vector.push_back(make_pair(odd, even));
}
odd = 0, even = 0;
right_vector.push_back(make_pair(odd, even)); //count and store odd and even frequency for right side
for (int i = n - 1; i > 0; i--) {
if (arr[i] % 2 == 0)
even++;
else
odd++;
right_vector.push_back(make_pair(odd, even));
}
reverse(right_vector.begin(), right_vector.end());
for (int i = 0; i < left_vector.size(); i++) {
if (left_vector[i].first == right_vector[i].first ||
left_vector[i].second == right_vector[i].second)
return i;
}
return -1;
}
int main() {
int arr[] = {4, 3, 2, 1, 2};
int n = sizeof(arr) / sizeof(arr[0]); | {
"domain": "tutorialspoint.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.970687770944576,
"lm_q1q2_score": 0.8067803863716937,
"lm_q2_score": 0.8311430415844385,
"openwebmath_perplexity": 2162.0321468101715,
"openwebmath_score": 0.21567091345787048,
"tags": null,
"url": "https://www.tutorialspoint.com/array-index-with-same-count-of-even-or-odd-numbers-on-both-sides-in-cplusplus"
} |
ros, gazebo, path-planning, 3d-navigation, hector-quadrotor
Originally posted by Stefan Kohlbrecher with karma: 24361 on 2013-03-04
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by Iván on 2013-03-04:
I have already tried that, but it returns a failure.
[rosmake-6] Finished <<< hector_exploration_planner [FAIL] [ 3.98 seconds ]
[ rosmake ] Halting due to failure in package hector_exploration_planner.
[ rosmake ] Waiting for other threads to complete.
Complete log: http://goo.gl/KfHdg
Comment by Stefan Kohlbrecher on 2013-03-04:
Oh ok, I see. See my edit above.
Comment by Iván on 2013-03-05:
Ok, it works. Thank you!
But now it returns a message "Still waiting on map". So I try using "indoor_slam_gazebo.launch" as map. And then there are a lot of errors.
Because of that I would like change the question, do you know a simple rosrun file to say to the robot, "go from 0,0,0 to 1,1,1"? | {
"domain": "robotics.stackexchange",
"id": 13171,
"lm_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, gazebo, path-planning, 3d-navigation, hector-quadrotor",
"url": null
} |
graph-theory, graph-algorithms
Title: find the densest subgraph of size k What is "the best" algorithm to find the densest subgraph of size k?
i.e. a subgraph of size k with the maximum number of edges inside for an unweighted and undirected graph.
For fixed k, the straightforward brute-force algorithm takes $O(n^k)$ time with n the number of nodes. I'm looking for something, like $O(2^kn)$ or so. Maybe using a recursive algorithm or dynamic programming. An answer to your problem tells you whether there exists a clique of size k. So, any such algorithm for your problem must be at least as slow as clique algorithms. See the wikipedia section on FPT and clique for more. | {
"domain": "cstheory.stackexchange",
"id": 3873,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "graph-theory, graph-algorithms",
"url": null
} |
organic-chemistry, carbohydrates
Title: What is a sugar? I've always wondered about this...
I can look up the exact chemical structure of (say) glucose, which is a sugar. That's easy enough. But what I cannot figure out is this: if I proffer some random molecule at you, how do you determine whether it can be considered a "sugar" or not? I can't seem to locate anywhere a definition of what it means to be a sugar; I can only find lists of specific molecules which are sugars. There is no standard "rule" for identifying sugars because in chemistry there are always exceptions to any rule. Nonetheless, the following guidelines will help you correctly identify a simple sugar (a monosaccharide) in most cases.
Simple sugars have the molecular formula $\ce{C_{n}(H_2O)_{n}}$, where n is at least 3. They also have to be capable of forming an aldehyde or ketone carbonyl group. For example, in glucose the cyclic forms predominate, but there is an isomer with a carbonyl group. | {
"domain": "chemistry.stackexchange",
"id": 1940,
"lm_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, carbohydrates",
"url": null
} |
ros-kinetic
** The launch file **
<launch>
<arg name="use_rosbot" default="false"/>
<arg name="use_gazebo" default="true"/>
<param if="$(arg use_gazebo)" name="use_sim_time" value="true"/>
<!-- Bring the ROSbot model and show it in Gazebo and in Rviz -->
<include file="$(find rosbot_description)/launch/rosbot_rviz.launch"/>
<!-- Map server -->
<arg name="map_file" default="$(find rosbot_navigation)/maps/willowgarage-refined.yaml"/>
<node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />
<!--- tf -->
<node unless="$(arg use_rosbot)" pkg="tf" type="static_transform_publisher" name="map_odom_tf" args="0 0 0 0 0 0 map odom 100" />
<node if="$(arg use_rosbot)" pkg="tf" type="static_transform_publisher" name="base_link_to_laser" args="0 0 0 3.14 0 0 base_link laser 100" />
<node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher">
<param name="publish_frequency" type="double" value="30.0" /> | {
"domain": "robotics.stackexchange",
"id": 36538,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-kinetic",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.