text stringlengths 49 10.4k | source dict |
|---|---|
organic-chemistry, reaction-mechanism, reactivity
Then in case of cyclopropyl methyl carbocation the p-orbitals of both carbon containing '+' charge and the carbon on ring are parallel
In your case the p-orbitals of carbon containing '+' charge is perpendicular to plane of cyclopentyl ring but the p-orbitals of carbon on cyclopropyl ring is parallel to plane cyclopentyl ring, so stability is not provided by cyclopropyl ring.
To sum up you can say that the cyclopentyl ring does not let cyclopropyl ring to provide stability to carbocation which makes ring expansion a preferred option.
Edit3 (Bonus): I asked to my professor about this, he told me that there are two conformational isomers of cyclopropyl methyl carbocation. One is bisected conformation and other is perpendicular conformation. The bisected one allows the carbocation to be exceptionally stable but the perpendicular one isn't that much stable (like in your case) due to less interaction of p-orbital and the partial double bond character cannot be achieved. | {
"domain": "chemistry.stackexchange",
"id": 11796,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, reaction-mechanism, reactivity",
"url": null
} |
function of degree ten that has two imaginary roots. We are commited to providing you with factoring help in areas such as quadratic expressions complete squares 2 - lots of lessons in factoring polynomials can be found on our free site. Set the equation to equal zero. Before going to start other sections of Polynomials, try to solve the below-given question. Article Summary: Polynomial is also a vital concept in algebra and all through the science and Math. Consequently x=3 is a root of the polynomial . Also find the other zero of the polynomial Question 5. Let k > 1. solution. The student might think that to evaluate a limit as x approaches a value, all we do is evaluate the function at that value. In other words, is a root or zero of a polynomial if it is a solution to the equation . It must go from to so it must cross the x-axis. Conjugate Zeros Theorem. So f(0) = 8 --- thus 0 is not a factor and not For polynomials, the role of primes in integer factorization is taken by irreducible polynomials, where a polynomial p is irreducible if p(x) = a(x)b(x) holds only if at lest one of a(x) or b(x) has degree zero. Still, degree of zero polynomial is not 0. 1 Linear Approximations We have already seen how to approximate a function using its tangent line. For Polynomials of degree less than or equal to 4, the exact value of any roots (zeros) of the polynomial are returned. CHEBYSHEV_POLYNOMIAL is a MATLAB library which considers the Chebyshev polynomials T(i,x), U(i,x), V(i,x) and W(i,x). This polynomial has only one term, which is constant. So, real numbers, 'm' and 'n' are zeroes of Polynomials: Sums and Products of Roots. A polynomial family {pn(x)} is Appell if it is given by e xt g(t) = P∞ n=0 pn(x)tn or, equivalently, p′n (x) = pn−1(x). following property of zero sets of harmonic polynomials: Hn,k points can be detected in zero sets of harmonic polynomials of degree d (1 ≤ k ≤ d) by finding a single, | {
"domain": "com.br",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9861513873424044,
"lm_q1q2_score": 0.8717965566269317,
"lm_q2_score": 0.8840392741081575,
"openwebmath_perplexity": 364.1644106487573,
"openwebmath_score": 0.7238003611564636,
"tags": null,
"url": "http://riosite.com.br/v4hyp/zero-polynomials.html"
} |
javascript, jquery, html
// Declare and assign. Maybe come up with a better name?
var $li = $('.sub-level > li.expand');
$li.click(function(){
$(this).find('ul.sub-level2').delay(delayTime).slideToggle(slideDownTime);
$li.toggleClass('minus expand');
});
}); | {
"domain": "codereview.stackexchange",
"id": 2031,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, html",
"url": null
} |
So we may conclude that there are:
$$\displaystyle \frac{n!}{m!(n-m)!}={n \choose m}$$ ways to choose $m$ from $n$.
This is where the binomial coefficient comes from in the binomial probability formula. Then we take the product of all the probabilities, as the other factors in the formula, $m$ favorable and $n-m$ unfavorable. For each trial, where there are two possible outcomes, it is certain that one or the other outcome will happen. Suppose that $p$ is the probability for a favorable outcome for each trial. Let $q$ be the probability of the other or unfavorable outcome. Mathematically, we may state the certainty of either outcome occurring as:
$$\displaystyle p+q=1\,\therefore\,q=1-p$$
Now, putting everything together, we find that the probability of obtaining $m$ favorable outcomes during $n$ trials is:
$$\displaystyle P(m)={n \choose m}p^m(1-p)^{n-m}$$
Something we can sometimes use to simplify our calculations is the symmetry of the binomial coefficient, that is, the identity:
$$\displaystyle {n \choose r}={n \choose n-r}$$
Do you see how you can use this in part c) of the given problem? Can you use the definition above of the binomial coefficient to verify this identity?
We should expect to find that the sum of all the possible probabilities is 1, and indeed we see (using the binomial theorem):
$$\displaystyle \sum_{m=0}^n{n \choose m}p^m(1-p)^{n-m}=(p+(1-p))^n=1^n=1$$
I hope this helps, as I find that when I understand where a formula comes from, it is much easier to remember and use. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9852713852853137,
"lm_q1q2_score": 0.8145354682658498,
"lm_q2_score": 0.8267117876664789,
"openwebmath_perplexity": 260.35012041421567,
"openwebmath_score": 0.9442867636680603,
"tags": null,
"url": "https://mathhelpboards.com/threads/aux-18-a-fair-coin-is-tossed-8-times.5934/"
} |
complex-numbers
Title: Can one do the maths of physics without using $\sqrt{-1}$? The use of imaginary and complex values comes up in many physics and engineering derivations. I have a question about that: Is the use of complex numbers simply to make the process of derivation easier, or is it an essential ingredient, without which it would be impossible to derive some results?
I can identify two different settings where the answer may be different:
It doesn't look like it is mandatory for results in Newtonian mechanics, General Relativity and classical electrodynamics.
Can we say the same thing about quantum mechanics either way for sure?
Could this be a difference in quantum mechanics over the classical picture? The use of complex numbers is never really essential, but if applicable it is almost always more convenient than the equivalent representation in a 2d real vector space (in fact, one typically learns the formal properties of complex number manipulations by their effect on $(a,b) = a+ib.$)
You mention that complex numbers don't seem necessary for classical electrodynamics, and I agree -- however I can't imagine any clear-minded person forgoing their use. In fact it is in classical E&M that I think complex numbers really exhibit their gracefulness in the description of physical phenomena.
Likewise, as lurscher has mentioned, there are formulations of QM that avoid explicit reference to complex numbers -- they are equivalent mathematical representations, but the manipulations have an added degree of bookkeeping that we had already built into complex numbers.
And that's the rub. Complex numbers are a tool for describing a theory, not a property of the theory itself. Which is to say that they can not be the fundamental difference between classical and quantum mechanics. The real origin of the difference is the non-commutative nature of measurement in QM. Now this is a property that can be captured by all kinds of beasts -- even real-valued matrices. | {
"domain": "physics.stackexchange",
"id": 18690,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complex-numbers",
"url": null
} |
$t+1/2\ge \frac{1}{2}{x}^{T}Hx$.
Extend the control variable $x$ to $u$, which includes $t$ as its last element:
$\mathit{u}=\left[\begin{array}{c}\mathit{x}\\ \mathit{t}\end{array}\right]$.
Extend the second-order cone constraint matrices and vectors as follows:
${\mathit{A}}_{\mathrm{sc}}=\left[\begin{array}{cc}\mathit{A}& 0\\ 0& 1\end{array}\right]$
${\mathit{b}}_{\mathrm{sc}}=\left[\begin{array}{c}0\\ ⋮\\ 0\end{array}\right]$
${\mathit{d}}_{\mathrm{sc}}=\left[\begin{array}{c}0\\ ⋮\\ 0\\ 1\end{array}\right]$
$\gamma =-1$.
Extend the coefficient vector $f$ as well:
${\mathit{f}}_{\mathrm{sc}}=\left[\begin{array}{c}\mathit{f}\\ 1\end{array}\right]$.
In terms of the new variables, the quadratic programming problem becomes
$\underset{u}{\mathrm{min}}\frac{1}{2}{u}^{T}{A}_{sc}^{2}u+{f}_{sc}^{T}u=-1/2+\underset{u}{\mathrm{min}}\left[1/2+{f}_{sc}^{T}u\right]$
where
$u\left(end\right)+1/2\ge \frac{1}{2}{u}^{T}{A}_{sc}u$. | {
"domain": "mathworks.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9886682461347528,
"lm_q1q2_score": 0.8083099278574509,
"lm_q2_score": 0.8175744806385543,
"openwebmath_perplexity": 1598.5688217163938,
"openwebmath_score": 0.6631385684013367,
"tags": null,
"url": "https://fr.mathworks.com/help/optim/ug/convert-qp-to-socp.html"
} |
accuracy, performance
I'm not sure what you count as tn_mc here? Normally in a multiclass setting accuracy is the sum of $TP_i$ for every class $i$, because there's no TN. That would give us:
$$acc=\frac{\sum_{i}TP_i}{n}$$
With $n$ the total number of instances (from the start, not only the ones fed to mc)
Your precision and recall formulas look correct to me, assuming that fp_y_i are the FP instances where $i$ is the predicted class whereas fn_y_i are the FN instances where $i$ is the true class. | {
"domain": "datascience.stackexchange",
"id": 9868,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "accuracy, performance",
"url": null
} |
java, tic-tac-toe
The usage of the scanner (or streams in general) should most likely be scoped. Streams are rather easily associated with native resources which must be destroyed explicitly to be freed.
public static char[][] table = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'}
};
Why is the table prefilled with values?
public static ArrayList<Character> picksTillNow = new ArrayList<Character>();
Try to always use the most super-class you can use and get away with, makes it easier to make sure that you're coupling classes through methods of the actual implementation instead of the interface. In this case, declare the variable with List.
public static char playerOne = ' ';
public static char playerTwo = ' ';
You're preparing these, but you only use them in a very limited scope, you should declare them there.
for(char i = '1'; i <= '9'; i++){
picksTillNow.add(i);
}
Autoboxing.
while (true){
You could also have a boolean like running or playing or gameRunning and set it depending on the return value of `endGame().
Or, as the number of turns is fixed, you might do a mixture of both:
int turn = 0;
while (turn++ < 9 && nobodyHasWonYet) {
// Logic.
}
endGame();
That's a bad name for the method, as it does not always end the game.
for (int i = 0; i < table.length; i++) {
for (int j = 0; j < table[i].length; j++) {
I'm a persistent advocate that you're only allowed to use single-letter variable names when dealing with dimensions ("x", "y", "z"), and that excludes using i and j). In this case actually, using x and y as variable names would improve the readability of the code. Even better would be using row and column.
if (table[i][2] != 9) {
System.out.println();
} | {
"domain": "codereview.stackexchange",
"id": 40589,
"lm_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, tic-tac-toe",
"url": null
} |
python, python-3.x, game
def increaseRank(self):
while(self.rankPoints >= self.rankPointsNeeded):
self.rank += 1
print("\nYou have a new Rank!")
self.rankPoints -= self.rankPointsNeeded
self.rankPointsNeeded *= 2
time.sleep(1)
class Trainer:
def __init__(self, player):
self.save = Path(".save/trainer")
if self.save.is_file():
self.save = open(".save/trainer", "r")
self.luckExpense = int(self.save.readline())
self.knowledgeExpense = int(self.save.readline())
self.wisdomExpense = int(self.save.readline())
self.luckGoldLevel = int(self.save.readline())
self.knowledgeGoldLevel = int(self.save.readline())
self.wisdomGoldLevel = int(self.save.readline())
self.save.close()
else:
self.luckExpense = 10 # refers to gold
self.knowledgeExpense = 10
self.wisdomExpense = 10
# neccessary for calculating new price
self.luckGoldLevel = 1
self.knowledgeGoldLevel = 1
self.wisdomGoldLevel = 1
self.player = player
def saveToFile(self):
self.save = open(".save/trainer", "w")
self.save.write(str(self.luckExpense) + "\n")
self.save.write(str(self.knowledgeExpense) + "\n")
self.save.write(str(self.wisdomExpense) + "\n")
self.save.write(str(self.luckGoldLevel) + "\n")
self.save.write(str(self.knowledgeGoldLevel) + "\n")
self.save.write(str(self.wisdomGoldLevel) + "\n")
self.save.close()
def train(self):
print("Gold has to be payed only if there are no attribute points remained") | {
"domain": "codereview.stackexchange",
"id": 28807,
"lm_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, game",
"url": null
} |
snp, bedtools, wgs, copy-number, text-mining
Title: Extracting the number SNP in each range I have called copy number and I have 2 files (I have shared the link of my files ); One contains some ranges
> head(cndata[,c(2,3,4)])
Chromosome Start End
4470 1 51479 817980
4471 1 818499 1136753
4472 1 1138735 2558308
4473 1 2558740 5724264
4474 1 5724940 5749083
4475 1 5749226 12529544
>
https://www.dropbox.com/s/wei3i787c9nrz8q/WTSI-OESO_121_1pre.copynumber.caveman.txt.csv?dl=0
I have another file like below
Chromosome Position
rs62635286 1 51479
rs75454623 1 114930
rs806731 1 30923
https://www.dropbox.com/s/tiqjhkrpfr9d9gu/WTSI-OESO_121_1pre.copynumber.txt?dl=0
In first column I have some SNPs, how I can count the number of SNP in each range? For example based on the second table how many SNP are in range of 51479 to 817980? There is like a thousand different ways how to achieve this. You could use a specialised software for this (like bedtools) or calculate it simply in R.
R solution: You can make a function that calculates the number of SNPs in a range and than you can apply it on all the ranges in the table with genomic ranges.
snp_table <- read.table('WTSI-OESO_121_1pre.copynumber.txt')
genomic_ranges <- read.table('WTSI-OESO_121_1pre.copynumber.caveman.txt.csv', sep = ',', col.names = c('Chromosome', 'Start', 'End'), stringsAsFactors = F) | {
"domain": "bioinformatics.stackexchange",
"id": 965,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "snp, bedtools, wgs, copy-number, text-mining",
"url": null
} |
fizzbuzz, assembly
Printing a string (all the li $v0, 4)
Printing a new line.
These can be done away with by coordinating between branching and jump instructions i.e. function calls.
.data
fstring: .asciiz "Fizz\n"
bstring: .asciiz "Buzz\n"
hstring: .asciiz "FizzBuzz\n"
nl: .asciiz "\n"
.text
.globl main
main:
li $s0, 0
loop:
bgt $s0, 99, exit
addi $s0, $s0, 1
move $a0, $s0 # the function takes input with registers $a0 to $a3
jal check_fizzbuzz # call the function
move $a0, $v0 # the function returns a string in register $v0, so move it to $a0 so that it can be printed
li $v0, 4
syscall # print the string
b loop
check_fizzbuzz:
la $v0, hstring
rem $t1, $a0, 15
beq $t1, 0, return_fizzbuzzz
la $v0, fstring
rem $t1, $a0, 3
beq $t1, 0, return_fizzbuzzz
la $v0, bstring
rem $t1, $a0, 5
beq $t1, 0, return_fizzbuzz
li $v0, 1
syscall
la $v0, nl
return_fizzbuzz:
jr $ra
exit:
li $v0, 10
syscall | {
"domain": "codereview.stackexchange",
"id": 23535,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fizzbuzz, assembly",
"url": null
} |
### knowLittle
Wow, so in this case. a is not only the coefficient, but also the ratio.
Ok, thank you. I like to understand.
10. May 5, 2012
### Ray Vickson
Of course you can use the geometric series method; you just have to subtract the n=0 terms from what you wrote. That will give you the sum from n=1 to ∞. Alternatively, you can recognize that for |r| < 1 you have $r + r^2 + r^3 + \cdots = r(1 +r + r^2 + \cdots),$ and use your geometric sum result for the quantity in brackets.
RGV | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9585377249197138,
"lm_q1q2_score": 0.8147294424263826,
"lm_q2_score": 0.8499711813581708,
"openwebmath_perplexity": 722.5802091752241,
"openwebmath_score": 0.6432880163192749,
"tags": null,
"url": "https://www.physicsforums.com/threads/determine-convergence-or-divergence-if-conv-find-the-sum.603461/"
} |
galaxy, observable-universe, extra-terrestrial
Title: Kardashev scale Why is becoming a type 3 from a type 2 civilization the hardest?
I have watched many videos on the topic and still can't figure out why?
Also is there a difference in technology between a type 4 and a type 5 civilization or it is just all type 4 civilizations become type 5 civilizations after some time? No extraterrestrial life has ever been found and we only know of one creature that has formed a civilisation: Homo sapiens. And we have not yet reached type I.
So we know nothing from observations about civilisations that are beyond our own. Kardashev wanted to have a way of thinking that didn't put "humans" at the top, so he described types I, II and III. These give us a way of thinking hypothetically about possible extraterrestrial intelligent life and breaks us free from a human-centred point of view.
Now it might be hard to detect type I or II civilisations, but a type III civilisation would, it seems likely, have profound effects on all worlds in a galaxy or at least the region of a galaxy in which they existed. There does not seem to be any type III civilisation in our part of the galaxy.
Moreover going from type II to type III requires taking over large amounts of star systems and this bumps up against the "space is big" and "you can't go faster than light" problems.
That said, in fact we have no idea if any life form in the whole universe has ever even reached type I
Type 4 and 5 are later additions to the system and there is no standard definition of what type 4 or 5 are (you can extrapolate logarithmically, or you can add some alternate measure of civilisation such as "data processing".
We cannot understand advanced civilizations, we cannot predict their behaviour. Thus, the Kardashev scale may not be relevant or useful for classifying extraterrestrial civilizations. | {
"domain": "astronomy.stackexchange",
"id": 4654,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "galaxy, observable-universe, extra-terrestrial",
"url": null
} |
c++, beginner, object-oriented
}
#endif
This is my main cpp file:
#include <iostream>
#include <string>
#include "banksys.h"
using namespace std;
int main()
{
bank_application b_application;
cout << "welcome to starcity bank , please register " << endl;
b_application.register_acc();
cout << "now please sign in " << endl;
b_application.sign_in();
char reply{};
while (true) {
b_application.menu();
cout << "Are you done [Y/N] " << endl;
cin >> reply;
if ((reply == 'Y') || (reply == 'y'))
continue;
else
break;
}
} General Observations
Not bad for a beginner, but definitely needs improvement. The functions are generally properly sized and simple (good thing). The include guards are good, I prefer this style over #pragma once.
The object oriented design needs some work. There should be multiple classes, one of the classes should be account.
The indentation in the switch statement in bank_application::menu() is questionable.
The vertical spacing needs work, there are too many blank lines, and blank lines are missing where they should be such as between these 2 functions.
void bank_application::menu() {
int option_pick{};
cout << "OPTIONS \n 1> Withdraw \n 2> deposit " << endl;
cin >> option_pick;
switch (option_pick) {
case 1: {
withdraw();
break;
}
case 2:
{
deposit();
break;
}
}
}
void bank_application::register_acc() {
cout << "Type in your full name " << endl;
getline(cin >> std::ws, account_holder);
cout << "Type in your account number " << endl;
cin >> account_num;
cout << "registration succesful " << endl;
} | {
"domain": "codereview.stackexchange",
"id": 43916,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, beginner, object-oriented",
"url": null
} |
Suppose I start with an investigation if there are degree $$4$$ polynomial $$g(x)=ax+bx^2+cx^3+dx^4$$ such that $$f \circ g=g\circ f$$. Then it becomes laborious.
Is there any way to find non-trivial $$g$$ with the help of PARI/GP or SAGE ?
Edit 1: According to the hints given by @achille hui, I have found that $$g(x)=-5x-5x^3-x^5$$ commutes with $$x^3+3x$$. However, I am looking for an polynomial whose first degree coefficient is $$3$$ or multiple of $$3$$. I would appreciate one such example.
Edit 2: But I need to find the polynomial with degree one coefficient, a multiple of $$3$$ and it is certainly possible as $$f$$ commutes with its iteration and each iteration has the degree one coefficient , a multiple of 3
• Comments are not for extended discussion; this conversation has been moved to chat. Dec 22, 2021 at 13:15
## 1 Answer
We have $$f(x):=x^3+3x$$ and you already found $$h(x)=x^5+5x^3+5x$$ with $$h(f(x))=f(h(x))$$ but the coefficient of $$x$$ of $$h$$ is not divisible by $$3$$. But $$g(x)=h(f(f(x)))$$ has this property because
$$g(x)=h(f(f(x)))=f(h(f(x))=(h(f(x))^3+3(h(f(x))$$ and the lowest non vanishing power of $$(h(f(x))^3$$ is $$x^3$$ and all coefficients of $$x$$ in $$3(h(f(x))$$ are divisible by $$3$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9787126513110865,
"lm_q1q2_score": 0.8176983017115405,
"lm_q2_score": 0.8354835309589074,
"openwebmath_perplexity": 354.68376393967196,
"openwebmath_score": 0.9683758020401001,
"tags": null,
"url": "https://math.stackexchange.com/questions/4338875/finding-polynomial-without-constant-term-that-commutes-with-fx-x33x"
} |
ds.algorithms, complexity, machine-models
For instance "insert $v_3$ at position 3"; modifies the list $e_1 e_2 e_3 e_4$
into $e_1 e_2 v_3 e_3 e_4$ and "delete at position 4" would produce the list $e_1 e_2 v_3 e_4$.
Obviously a list can be used to answer all these questions but with a $O(n)$ complexity for all three operations. We can also use an array to have 3. with $O(1)$ complexity but with $O(n)$ complexity for 1. and 2. Finally we can use a balanced tree structure to get all three operations in $O(\ln(n))$. Is there any other known structure that achieves an interesting compromise?
A second but related question: If the operation 3. is limited to retrieve the value of the first element, can we do any better than this? Of course for this a list achieves $O(n)$ for 1. and 2. but $O(1)$ for the first element. With a bit of modification I think we can make the array-based solution work in $O(n)$ for deletion of the first element but $O(1)$ for everything else. With the balanced tree approach we can make $O(\ln(n))$ for 2. and 3. and $O(1)$ for 1. Are there any structure with a better compromise here? | {
"domain": "cstheory.stackexchange",
"id": 4938,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ds.algorithms, complexity, machine-models",
"url": null
} |
training, open-ai, chatgpt, gpu, gpt-3
Title: What is accelerated years in describing the amount of the training time? As described in this article, it was written that GPT-3 took 405 V100 years to train in 2020.
I'm a bit confused about this definition, does that mean the process was accelerated like using a V100 GPU to train in 405 years? The statement in which you mentioned that "GPT-3 took 405 V100 years to train" refers to the computational resources utilized in training the GPT-3 model. Specifically measured in terms of the equivalent time it would take if the GPT model is trained on a single Nvidia Tesla V100 GPU. To make it more understandable it does not mean that the training process took 405 years, but it indicates the computational intensity or amount of time it would have taken if it was trained on a single Nvidia Tesla V100 GPU.
Since GPT-3 is a very large model with 175 billion parameters, it requires very high resources in training. According to this article it takes around 1,024 Nvidia V100 GPUs to train the model, and it costs around $4.6M and 34 days to train the GPT-3 model. | {
"domain": "ai.stackexchange",
"id": 4067,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "training, open-ai, chatgpt, gpu, gpt-3",
"url": null
} |
time-series, pandas
pd.DataFrame(np.array([['2019-05-26','4'],['2019-06-02','4'],['2019-06-09','2'],['2019-06-16','3'],['2019-06-23','2'],['2019-06-30','3'],['2019-07-07','4'],['2019-07-14','4'],['2019-07-21','3'],['2019-07-28','2'],['2019-08-04','5'],['2019-08-11','4'],['2019-08-18','4'],['2019-08-25','3'],['2019-09-01','5'],['2019-09-08','4'],['2019-09-15','4'],['2019-09-22','3'],['2019-09-29','4'],['2019-10-06','3'],['2019-10-13','7'],['2019-10-20','4'],['2019-10-27','4'],['2019-11-03','3'],['2019-11-10','4'],[' | {
"domain": "datascience.stackexchange",
"id": 7534,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "time-series, pandas",
"url": null
} |
beginner, haskell
I guess I'd probably fiddle with this a little more. replaceByChar is just a lookup in a map, so it doesn't seem worthy of being named. On the other hand, reintroducing the name quantize in place of numBin, and the (`div` fromIntegral numBin)) expression makes things clearer.
Also, you've giving a bunch of names to your ASCII palette: it's either replacementChars or mapChar, or maybe they're bins (e.g., numBin). Using a single consistent name would make sense. It might be nice to call it a "palette", though palette-related names are already part of Codec.Picture. So, maybe "brush"? If so:
type Brush = VU.Vector Char
defaultBrush :: Brush
defaultBrush = VU.fromList "#@&%=|;:. "
imageToAscii :: Brush -> Image Pixel8 -> [String]
imageToAscii brush img
= chunksOf (imageWidth img)
. map (\pix -> brush VU.! quantize pix)
. V.toList
. imageData
$ img
where
quantize x = fromIntegral x `div` (1 + 255 `div` VU.length brush)
Also, the logic for quantize isn't very good for general brush sizes. For example, if the brush is 256 characters, it will work pretty well, but what if we have a 255 character brush? I think this will give better results:
quantize x = fromIntegral x * VU.length brush `div` 256 | {
"domain": "codereview.stackexchange",
"id": 41681,
"lm_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, haskell",
"url": null
} |
unit-testing, vhdl, hdl
You might have a good reason for asynchronous reset, but if not, synchronous reset is a better habit.
You often see these asynchronous resets, it is unfortunately a more common habit, since that's what is (or was) most often taught.
See my motivations here: http://www.fpga-dev.com/resets-make-them-synchronous-and-local/
Opinions already covered/partly covered
Somewhat in order of importance (in my subjective opinion).
Define the roll-over behaviour.
The behaviour is actually defined for an unsigned in numeric_std: any carry bits will be ignored so the unsigned will roll-over. However, neither simulators nor synthesis tools should be trusted on following this. (And even less, humans reading the code.) Also; it is good to really think about what behaviour you desire, or is the most stable: roll-over or saturate? I'll take the chance to give two comments on this choice:
For synthesis, roll-over rather than saturation will yield less logic and improved timing. The tool will be able to use a counter macro right-off.
If reaching max count is expected never to happen, add an assertion so a simulation will flag in that case. Then still code the RTL behaviour explicitly to roll-over (less logic, better timing) if there aren't stability reasons to code it to saturate.
Parameterize the width. Put it in a constant or generic.
Generate the clock separately (e.g. clk <= not(clk) after 10 ns;, and make sure to init clk to '1'.
This is more standard and more readable.
Then, when coding your stimuli, do not dead-reckon the time for stimuli assignments, instead, use wait until rising_edge(clk); etc. This makes code more stable, and gives deterministic and proper times for the stimuli changes (not only in regards to time, but also to simulation deltas, which is equally important).
Use entity instantiation
More details and motivation: http://www.fpga-dev.com/leaner-vhdl-with-entity-instantiation/
Simulation performance | {
"domain": "codereview.stackexchange",
"id": 8852,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "unit-testing, vhdl, hdl",
"url": null
} |
homework-and-exercises, special-relativity, particle-physics
Title: Trying to derive compton scattering using 4-vectors I'm trying to derive the energy of a photon after compton scattering:
$$ E_\gamma' = \frac{E_\gamma}{1 + \frac{E_\gamma}{m_ec^2} (1-\cos \theta)}$$
where $E_\gamma'$ is the photon energy after scattering, $E_\gamma$ is the energy before scattering, $m_e$ is the mass of the electron and $\theta$ is the scattering angle.
It seems like I'm running into some mistake, because I get an additional $-m_e c^2$ term.
Let $\textbf{p}_\gamma = (E_\gamma/c, \vec{p}_\gamma)$ and $\textbf{p}_\gamma' = (E_\gamma'/c, \vec{p}_\gamma')$ the 4-vectors of the photon before and after the scattering. Let $\textbf{p}_e = (m_e c, \vec{0})$ and $\textbf{p}_e' = (E_e'/c, \vec{p}_e')$ the 4-vectors of the electron before and after the scattering. The electron is at rest before the scattering.
Then because of 4-momentum conservation, we get
$$ \textbf{p}_\gamma + \textbf{p}_e = \textbf{p}_\gamma' + \textbf{p}_e' $$
$$ \textbf{p}_\gamma - \textbf{p}_\gamma' = \textbf{p}_e' - \textbf{p}_e $$
Squaring leads
$$ \textbf{p}_\gamma^2 - 2\textbf{p}_\gamma\textbf{p}_\gamma' + \textbf{p}_\gamma'^2 = \textbf{p}_e'^2 -2\textbf{p}_e'\textbf{p}_e + \textbf{p}_e^2 $$ | {
"domain": "physics.stackexchange",
"id": 22976,
"lm_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, special-relativity, particle-physics",
"url": null
} |
Instantaneous velocity is slope of displacement-time curve?
I have a toss-up question that I'm not sure how to answer. Here it is (true or false):
The instantaneous velocity at a particular time is the slope of the displacement-time curve at that position.
I know that this statement would be true if it said position-time curve because that would mean that the change in position is the displacement. However, as the statement currently stands, it is saying that instantaneous velocity is equal to the change in the displacement over time, which is the change in the change in position over time. Am I correct to say that?
But when I do an example of each, they both seem to work. Like this:
displacement 1 at 1 second is 10 m from the starting position.
displacement 2 at 2 seconds is 20 m from the starting position.
The change in displacements is 10 m, and over 1 second. So the velocity over that time period is 10 m/s.
And the same with position:
position 1 at 1 second is 10 m from the starting position.
position 2 at 2 seconds is 20 m from the starting position.
The change in position is 10 m, and over 1 second. So the velocity over that time period is 10 m/s.
I can't decide what makes sense here. Is the statement true or false?
If your position is in 3D space (which means your position vector must be defined), then there is no distinction between displacement and change in position.
$s=\boldsymbol{R_f-R_i}=\Delta\boldsymbol{R}$ , where $s$ is displacement and $R$ is position.
However, in $v = ds/dt$, $ds$ does not mean change in displacement but rather an infinitesimally small displacement (infinitesimally small change in position). Since $v=ds/dt$, so the instantaneous velocity is the gradient to the tangent of the curve at that particular point.
In my opinion I believe it's just an issue of wording. I don't think change in displacement means $ΔΔR$, but rather the actual displacement(change in position) that occurred during a time $ΔT$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854111860905,
"lm_q1q2_score": 0.8081460272875224,
"lm_q2_score": 0.8333245870332531,
"openwebmath_perplexity": 289.7423662945096,
"openwebmath_score": 0.6460868120193481,
"tags": null,
"url": "https://physics.stackexchange.com/questions/139733/instantaneous-velocity-is-slope-of-displacement-time-curve"
} |
Here's a question to practice.
Problem 1
Suppose we have a matrix $C = \left[ \begin{array}{cc} \blueD{2} & \maroonD{1} \\ \blueD{-1} & \maroonD{1} \end{array} \right]$.
What does the grid look like after we apply C? | {
"domain": "khanacademy.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9919380075184121,
"lm_q1q2_score": 0.8470285110697343,
"lm_q2_score": 0.8539127492339909,
"openwebmath_perplexity": 7323.333143020888,
"openwebmath_score": 0.9914681315422058,
"tags": null,
"url": "https://www.khanacademy.org/math/multivariable-calculus/thinking-about-multivariable-function/x786f2022:vectors-and-matrices/a/matrices--visualized-mvc"
} |
powershell, active-directory
Title: Get AD Users' Latest Last Logon Dates across Multiple DCs I was recently asked to help our Spanish BU to audit their AD for inactive accounts.
Grabbing a script from online I gave them this: https://gallery.technet.microsoft.com/scriptcenter/Get-Active-Directory-User-bbcdd771
However that doesn't scale well when there's multiple users; as this takes one account then manually searches for the maximum last logon on any domain controller, rather than pulling back the values from all DCs then performing an aggregate function (which can then work the same way for 1 or many accounts).
As such I wrote this:
[string]$DCNameFilter = "ES*" #only get Spanish DCs (i.e. our company's naming convention prefixes server names with 2 char country iso code)
[string]$SearchBase = 'OU=es,DC=eu,DC=myCompany,DC=com' #only look within the Spanish OU; our OUs are under their collective region's domain (i.e. EU) within the company
#filter down to just the ES domain controllers
$DCs = Get-ADDomainController -Filter {Name -like $DCNameFilter} | Select -expand Name | {
"domain": "codereview.stackexchange",
"id": 18660,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "powershell, active-directory",
"url": null
} |
# [SOLVED]n-epsilon proof
#### dwsmith
##### Well-known member
$\lim\limits_{n\to\infty}\frac{1}{a^n} = 0$ if $a > 1$.
Not sure how to handle this one. Do I want have $\frac{1}{\sqrt[n]{\epsilon}} < a$?
#### Fantini
MHB Math Helper
To prove this limit, we need to show that exists $N_0 \in \mathbb{N}$ such that for all $n \geq N_0$ we have that
$$\left| \frac{1}{a^n} - 0 \right| < \varepsilon,$$
for all $\varepsilon >0$.
Not sure what tools you have available, but if perhaps you could do
$$\frac{1}{a^n} < \varepsilon \leadsto a^n > \frac{1}{\varepsilon} \leadsto n \log_a a = n > \log_a \left( \frac{1}{\varepsilon} \right).$$
Therefore, take $N_0 = \left\lceil \log_a \left( \frac{1}{\varepsilon} \right) \right\rceil$.
Not entirely sure, but the whole process looks okay.
#### dwsmith
##### Well-known member
To prove this limit, we need to show that exists $N_0 \in \mathbb{N}$ such that for all $n \geq N_0$ we have that
$$\left| \frac{1}{a^n} - 0 \right| < \varepsilon,$$
for all $\varepsilon >0$.
Not sure what tools you have available, but if perhaps you could do | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9896718462621992,
"lm_q1q2_score": 0.8021081579003302,
"lm_q2_score": 0.8104789086703224,
"openwebmath_perplexity": 365.98967746303833,
"openwebmath_score": 0.9008361101150513,
"tags": null,
"url": "https://mathhelpboards.com/threads/n-epsilon-proof.2239/"
} |
quantum-state, entanglement, teleportation, bell-basis
Title: Why is a Bell state involved in quantum teleportation? Notation: $|\text{qubit}_{1}, ..., \text{qubit}_{N}\rangle$.
The goal of quantum teleportation is to send quantum information using classical bits.
A source transmits a state $|\psi\rangle_{A_{0}} = \alpha|0\rangle + \beta|1\rangle$ to Alice. Alice has no knowledge of what this state is and is forbidden from measuring this state as the laws of quantum mechanics result in the collapse of the state.
At this point, quantum teleportation protocol dictates the introduction of a Bell state, say $|\Phi_{+}\rangle = \frac{1}{\sqrt{2}}[|00\rangle + |11\rangle]$, that tensors with $|\psi\rangle_{A_{0}}$ to give
$|\psi\rangle_{A_{0}}|\Psi_{+}\rangle = \frac{1}{\sqrt{2}}[\alpha (|000\rangle + |011\rangle) + \beta(|100\rangle + |111\rangle)]$.
What is the physical (or mathematical) motivation behind which the above Bell state is introduced? The motivation for introducing the Bell state is simple: it gets the job done! This of course raises the question: what properties of the Bell state make it suitable for use as a resource in quantum teleportation? Perhaps the most intuitive answer to this question is proivded by state-channel duality.
The simplest statement of state-channel duality is as a mapping from operators to states defined by
$$
|i\rangle\langle k|\mapsto|i\rangle|k\rangle\tag1
$$
and extended by linearity$^1$. But then
$$
I=\sum_i|i\rangle\langle i|\mapsto\sum_i|i\rangle|i\rangle=\sqrt{d}|\Phi_+\rangle\tag2
$$ | {
"domain": "quantumcomputing.stackexchange",
"id": 5202,
"lm_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-state, entanglement, teleportation, bell-basis",
"url": null
} |
$$F_2(x,c)={\sf max}_{y\in [0,1]} F_1(x,c,y)$$ is well-defined and continuous on $[0,1] \times {\mathbb R}$. Also, for any $(x,y) \in [0,1]^2$, the map $F_1(x,.,y)$ is nonnegative and strictly convex on $\mathbb R$. We deduce that for any $x\in[0,1]$,$F_2(x,.)$ is also nonnegative and strictly convex on $\mathbb R$.
Now any nonnegative, strictly convex and continuous map on $\mathbb R$ which tends to $+\infty$ at both $-\infty$ and $+\infty$ attains a minimum at a unique point. So for each $x\in [0,1]$, $F_2(x,.)$ attains a global minimum at a unique point, which I denote by $F_3(x)$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9891815526228441,
"lm_q1q2_score": 0.8177680602537196,
"lm_q2_score": 0.8267117983401363,
"openwebmath_perplexity": 177.35498606694856,
"openwebmath_score": 0.9573546648025513,
"tags": null,
"url": "http://math.stackexchange.com/questions/252988/minimising-the-maximum-distance-between-bounded-functions-for-a-given-bounded-fu"
} |
meteorology, clouds, weather-satellites
Title: Great Lakes - cookie cutter clouds On 2014-07-10, in the afternoon, the GOES East satellite image in the visible showed a mass of cloud in central North America. However, in the middle, the Great Lakes stood out in a most extraordinary way, since they were almost completely free of cloud. It was like a cookie-cutter. The cloud followed the outline of the lakes precisely. Why is that?
Here is a second view, from MODIS data: MODIS image of the Great Lakes There are a couple reasons for this. First, Lake Michigan is still cold this time of year, relative to the land that surrounds it. Warm air flowing over the lake will exchange heat and cool, reducing its buoyancy, which will alter the heights at which clouds will form and inhibit lift for surface parcels to achieve that height.
That helps explain the cloudlessness over the lake, but this extends a bit inland as well. I'd have to do a little digging to verify this, but just from that image it looks like that demarcation of cloud/no cloud around the lake is a sea breeze front (or in this case, a lake breeze). The daytime lake breeze flows inland from the water, rises over land and then flows back to the lake where it descends. This will promote clouds where the circulation rises and inhibit them where the circulation falls.
There may also be an orographic effect on along the northern portion of western MI shore, as there are large sand dunes and hills in that area. The upslope flow could be the reason the clouds hug that shore a bit closer than other regions around the lake.
In summary, that looks like a really well defined lake breeze circulation, which explains the shape and location of the clouds. | {
"domain": "earthscience.stackexchange",
"id": 181,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "meteorology, clouds, weather-satellites",
"url": null
} |
quantum-field-theory, lagrangian-formalism, feynman-diagrams, path-integral, 1pi-effective-action
Title: $\Gamma^{1PI}$ contribution to the effective action $\Gamma$ So I am currently taking a class on advanced quantum field theory, and I came across something that I don't understand. I have been thinking about it for quite some time and I cannot get my head around it.
So the $1PI$ effective action is given by:
$$\Gamma[\Phi]= J \Phi- W[J[\Phi]]$$
Plugging this into an exponential yields:
$$e^{-\Gamma[\Phi]} = e^{-J \Phi} e^{W[J[\Phi]]} = LHS.$$
Plugging in the definiftion, of $W$ yiels:
$$LHS = e^{-J \Phi} \int [d \phi] e^{-S[\phi]+ J[\Phi] \phi}.$$
Now, we can do a Feynman expansion of the action and write:
$$S[\phi]= S[\Phi]+ \frac{1}{2} \psi S''[\Phi] \psi + S'[\Phi] \psi + \sum_{n \geq3} \frac{S^{(q)}}{q!} \psi^q$$
plugging in yields
$$LHS = e^{-J \Phi} \int [d \psi] e^{-S[\Phi]- \frac{1}{2} \psi S''[\Phi] \psi - S'[\Phi] \psi - \sum_{n \geq3} \frac{S^{(q)}}{q!} \psi^q -J[\Phi](\Phi +\psi) }$$
The $J \Phi$ terms in the exponent cancel and we can take out the action $S[\phi],$ we get: | {
"domain": "physics.stackexchange",
"id": 89036,
"lm_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, feynman-diagrams, path-integral, 1pi-effective-action",
"url": null
} |
atmospheric-science
Title: What would cause an orange sky? (I was recommended to ask this question here by the guys on World Building)
I'm starting a whole new planet for a story and would like it to have an orange sky during the day.
At a basic level (I am not a smart man) what chemical composition would be most conducive to Orange sky colouring? What colour would that appear during sunrise/sunset (Our blue turns orange due to some science magic, what effect would this same process have on an Orange atmosphere?
The air doesn't have to be breathable, I am fine with whatever implications this will have on human characters re: Breathing gear, space suits, etc. I'm not a professor of chemistry or anything, but on a computer screen, Orange equals about 2 parts red and 1 part green on the RGB scale.
Using the chart in the link below:
http://www.scienceclarified.com/Ga-He/Gases-Properties-of.html
You can get green from Chlorine gas and Red/Brown from NO2. Chlorine is highly reactive so in reality, I don't think it would stay in an atmosphere, but for a simulation, . . . why not.
A mix of Redish Brown and Green lit by a bright sun would equal an Orange like color.
It's worth noting that the sky isn't colored gas but only a tiny refraction effect that's spreads the blue light around the sky. It's noticable cause the atmosphere is miles thick. A colored gas and you'd only need trace amounts of it with an atmosphere a few miles thick and it would have a filtering maybe clouding effect so you wouldn't see the stars very well at night.
I couldn't find any data on which gases refract Orange light more than other colors, but that would work too. A thicker atmosphere might also work where the blue light doesn't make it all the way through that much atmosphere (like what happens at sunset when the sky/atmosphere turn Orange/Red).
Another way to do it would be orange dust, orange clouds or maybe an Orange star (there are many Orange stars) and less refraction - but the science of exactly how coloring of an atmosphere works is kinda complicated. I'm not smart enough to give you a complete answer. | {
"domain": "physics.stackexchange",
"id": 22176,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "atmospheric-science",
"url": null
} |
nuclear-physics, terminology, fusion
Title: What does 'high-beta' mean for a fusion reactor? I see the term 'high-beta' a lot, but cannot find a definition. When I type it into Google, I mostly see results about a Lockheed Martin fusion reactor project..... The beta is plasma-$\beta$, the ratio of hydrodynamic pressure to magnetic pressure. It is useful because in extreme cases you can approximate the very complicated equations of magnetohydrodynamics. The equations simplify in the limits $\beta\rightarrow 0$ or $\beta\rightarrow \infty$.
For high-$\beta$ plasmas, $\beta\gg 1$. In this case, the hydrodynamic pressure supplies the dominant force. Basically, you can treat the system as a regular fluid that drags around the magnetic fields as it moves.
In low-$\beta$ plasmas, $\beta\ll 1$. In this case the magnetic forces dominate. You can solve the equations for the evolution of the magnetic fields, and the fields drag the fluid around with them.
Real plasmas are not usually so extreme. In fusion applications $\beta$ tells you how hard it is to magnetically confine the plasma. | {
"domain": "physics.stackexchange",
"id": 50033,
"lm_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, terminology, fusion",
"url": null
} |
print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.
print "hello world"
MathAppears as
Remember to wrap math in $$...$$ or $...$ to ensure proper formatting.
2 \times 3 $$2 \times 3$$
2^{34} $$2^{34}$$
a_{i-1} $$a_{i-1}$$
\frac{2}{3} $$\frac{2}{3}$$
\sqrt{2} $$\sqrt{2}$$
\sum_{i=1}^3 $$\sum_{i=1}^3$$
\sin \theta $$\sin \theta$$
\boxed{123} $$\boxed{123}$$
Sort by:
@Brian Charlesworth In a previous thread you had suggested that for $$f(n,3,2)$$ you might want to split the group into two, one of which is guaranteed to have two good batteries, and run through each of the combinations in each group, giving:
$$f(2n,3,2) = 2\dbinom{n}{2}$$ and $$f(2n + 1,3,2) = \dbinom{n}{2} + \dbinom{n + 1}{2}$$
One generalization of that for $$g>3$$ might be to split up the batteries into the greatest number of groups ($$g-1$$?) such that at least one is guaranteed to have at least two good batteries and then go through all the combinations in each group. Without showing that this is the best approach, it certainly seems like a promising one.
So, for example if we take $$g=4$$, then we would split into 3 groups, yielding:
$$f(8,4,2) = \binom{2}{2} + \binom{3}{2} + \binom{3}{2} = 1 + 3 + 3 = 7$$
So for $$f(100,50,2)$$ we would have: | {
"domain": "brilliant.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9658995713428387,
"lm_q1q2_score": 0.8170954300739935,
"lm_q2_score": 0.8459424295406088,
"openwebmath_perplexity": 681.1790845992839,
"openwebmath_score": 0.9352931976318359,
"tags": null,
"url": "https://brilliant.org/discussions/thread/battery-optimization/"
} |
the Plane In polar coordinates a point P is also characterized by two numbers: the distance r 0 to a fixed pole or origin O, and the angle the ray OP makes with a fixed ray originating at O, which is generally drawn pointing to the right (this is called the initial ray). In this paper, the term Polar Fourier transform will always refer to the. Subsample the polar coordinates to whatever degree of accuracy needed, treating each subsample as a point. Polar Rectangular Regions of Integration. Could in theory be written entirely in the main function; however, to meet the problem statement the code must include a user defined function that returns polar coordinates. To Convert from Cartesian to Polar. The answer is: (r,θ) Polar = (p x2 +y2, arctan y x) Polar Meanwhile, for a point given by Polar coordinates, (r,θ) Polar, we need to specify the coordinates in Cartesian form in terms of the Polar data r and θ. The calculator will convert the polar coordinates to rectangular (Cartesian) and vice versa, with steps shown. Plot points in polar coordinates #1-8; Write polar coordinates for points #9-16; Convert Cartesian coordinates to polar #17-24; Convert Polar coordinates to Cartesian #25-32; Write alternate versions of polar coordinates #33-38. Thus, in this coordinate system, the position of a point will be given by the ordered. 1 Helmholtz Equation and Angular Basis Functions As a direct extension from the Cartesian case, we begin with the eigenfunctions of the Laplacian, whose expression in polar coordinates is given by: ∇2 = ∇2. Cartesian coordinates arise naturally when you need to express translations (movements) of an object in space. Then x = r cos O, Y = r sin O. Double Integrals in Polar Coordinates. The first such point is immediately clear: if r = 0, we have a zero vector (a point in the origin). You can access a copy of the slides used in the video in the PDF file at the bottom of this step. ENGI 4430 Non-Cartesian Coordinates Page 7-09 Spherical Polar Coordinates The coordinate conversion matrix also provides a quick route to finding the Cartesian components of the three basis vectors of the spherical polar coordinate system. Polar-Cartesian Coordinate conversion and Cartesian-Polar Hi All, Is there any standard program to | {
"domain": "clandiw.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9875683484150417,
"lm_q1q2_score": 0.8432972016158118,
"lm_q2_score": 0.853912747375134,
"openwebmath_perplexity": 486.12006461400983,
"openwebmath_score": 0.9364537000656128,
"tags": null,
"url": "http://clandiw.it/fvql/conversion-of-cartesian-coordinates-to-polar-coordinates-pdf.html"
} |
python, python-3.x, ascii-art
Using this function is now easy, we just need to understand how asterisks, spaces, and starting spaces change. We can deduce that simply by doing simple cases by hand and counting, or if we are lucky by looking at the output required or given by an equivalent program:
def make_triangles(height, cols, rows):
"""
>>> print(make_triangles(6, 6, 4))
* * *
*** *** ***
***** ***** *****
******* ******* *******
********* ********* *********
*********** *********** ***********
"""
return '\n'.join(alternate(' ', '*', ' ', start_space_length, space_length, asterisk_length, cols)
for (start_space_length, asterisk_length, space_length)
in zip(range(height, 0, -1), range(1, height*2, 2), range(height*2-1, 0, -2)))
Using this code to make the odd lines is also easy.
Concatenate a required number of even and odd lines to build the complete output.
I suggest this method because it is logical and conceptually readable from looking at the code. Your code had myself lost over all the top-level variables and conditions leaving me without understanding how each step was correlated to the overall algorithm.
Also the alternate function is now written and documented by a test, and it may prove useful in other similar ASCII art challenges allowing code re-use. | {
"domain": "codereview.stackexchange",
"id": 22619,
"lm_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, ascii-art",
"url": null
} |
climate-change, sea-level, glaciology, ice-sheets, antarctica
Title: Where does the biggest land-based ice cap reside? I'm thinking biggest in volume, regarding which area of the planet will contribute more to a raising in sea level - were the ice in those regions to melt.
I can basically think of two candidates, namely Greenland and Antarctica. So maybe some comparison between the contributions of the two would be great. Antarctica is the ice sheet (cap) that will contribute most IF it would melt completely. The 2013 IPCC report (Ch. 4, the Cryosphere) provides an estimate of 58.3 m of sea level equivalent (sle). Greenland would if completely wasted away provide 7.36 m sle. Remaining glaciers provide an additional 0.41 m sle. The likelihood of Antarctica completely wasting away seems unlikely with our current understanding although the so-called West Antarctic Ice sheet (closes to the Antarctic Penninsula is sitting with its base deep below the current sea level) is far more likely to be lost than the East Antarctic Ice Sheet. Hence the contribution from Antarctica is likely less than the maximum number. Greenland on the other hand is thought to have a "point of no return" beyond which it will irreversibly be lost given the current or warmer climate. Since Greenland is mostly land-based, much of the mass loss will be by surface melting while West-Antarctica can lose much of its mass by ice berg calving which is likely a much faster loss mechanism. Estimates on the scenarios are emerging but there are still uncertainties and there may also be feedbacks that we either do not fully understand or have not yet seen that can change these scenarios (particularly for West-Antarctica). This Science article
published online May 12 2014 is a good example of emerging research on the stability issues of West Antarctica. | {
"domain": "earthscience.stackexchange",
"id": 122,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "climate-change, sea-level, glaciology, ice-sheets, antarctica",
"url": null
} |
information-theory, fidelity, trace-distance, linear-algebra
Question: Is the above statement true for any other Schatten p-norm. Given $\rho_A, \sigma_A$ such that $\|\rho_A - \sigma_A\|_p\leq \varepsilon$ and for any purifications $\Psi_{AR}$ of $\rho_A$ and $\Phi_{AR}$ of $\sigma_A$, is it true that
$$\inf_{U_R}\|\Psi_{AR} - (I_A\otimes U_R)\Phi_{AR} \|_p \leq \delta(\varepsilon)$$
I am particularly interested in the above statement for the operator norm i.e. $p = \infty$. No dimension-independent bound is possible.
Consider states $\rho_A$ and $\sigma_A$ that are close in $p$-norm (for $p>1$) but have relatively low fidelity. Specifically, assume
$$
\|\rho_A - \sigma_A\|_p = \varepsilon
$$
and
$$
\operatorname{F}(\rho_A,\sigma_A)
= \bigl\|\sqrt{\rho_A}\sqrt{\sigma_A}\bigr\|_1 = \delta,
$$
where $\varepsilon$ is small and $\delta$ is bounded away from 1. I'll give a specific example below.
The maximal fidelity between purifications $\Phi_{AB}$ and $\Psi_{AB}$ is also equal to $\delta$, so the minimal trace norm of the difference between purifications is bounded as follows:
$$
\bigl\|\Phi_{AB} - \Psi_{AB}\bigr\|_1 \geq 2 \sqrt{1 - \delta^2},
$$
with equality when the purifications are chosen optimally. | {
"domain": "quantumcomputing.stackexchange",
"id": 2174,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "information-theory, fidelity, trace-distance, linear-algebra",
"url": null
} |
= push-ups / seconds in air is close 340.1... { 450nm } * { f } = { 450nm } * { f } = { 450nm *... Page, or Hz for short bin numbers ( upper levels ) the... Is hit on one end with a speaker bolted to it is n't a concept 's! Calculate the frequency and vice versa vibrational frequency can easily be changed when dial! End with a period of a particular value occurs enrolling in a that... Will show a Sine wave that can be measured in seconds two years of college and save thousands your... Waves that pass a fixed point in unit time divided by a count of all values write our frequencies units. N'T measure something like push-ups in 30 seconds that repeats has a master degree! { 45Hz } =20,250nm/s < =20.25um/s } and the time it takes to do just one.! The 42 seconds per lap through some practice problems the velocity of life... The calculation can be applied to many situations Mean = 2 + 10 + 12 + 8 + 14. Diameter, is the frequency in hertz even if it is an essential feature engines... 1/2 inch in diameter, is the height from highest to lowest points and divide that by 2 your blocker. Means they are related like this: if you are just asked for ,., Types & uses, Mass and Weight: Differences and Calculations, 83,000... Event to occur or education level 83,000 lessons in all major subjects, { courseNav.course.mDynamicIntFields.lessonCount... At B2-B10 and use the first two years of college and save thousands off degree. Something repeats attend yet from a frequency associated with it measurement we use the fact that period is also inverse. Like this: Essentially, anything that repeats has a master 's degree physics. For many people it probably has something to do just one lap how to find frequency measurement! Many situations to connect it to a given wavelength college you want to yet. In how to find frequency proportion of the system frequency is a measure of cycles second! The 1 second of period or from any point to the trough ) an for... To 60 seconds we can see RPM represents a frequency and period can be to! One lap Mean | {
"domain": "7cloudtech.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9648551515780319,
"lm_q1q2_score": 0.8081819288646529,
"lm_q2_score": 0.8376199552262967,
"openwebmath_perplexity": 1116.3333985343006,
"openwebmath_score": 0.6042473912239075,
"tags": null,
"url": "http://www.7cloudtech.com/1v2x8/01ee4b-how-to-find-frequency"
} |
conventions, tensor-calculus, differentiation, vector-fields, covariance
Title: Gradient, divergence and curl with covariant derivatives I am trying to do exercise 3.2 of Sean Carroll's Spacetime and geometry. I have to calculate the formulas for the gradient, the divergence and the curl of a vector field using covariant derivatives.
The covariant derivative is the ordinary derivative for a scalar,so
$$D_\mu f = \partial_\mu f$$
Which is different from
$${\partial f \over \partial r}\hat{\mathbf r}
+ {1 \over r}{\partial f \over \partial \theta}\hat{\boldsymbol \theta}
+ {1 \over r\sin\theta}{\partial f \over \partial \varphi}\hat{\boldsymbol \varphi}$$
Also, for the divergence, I used
$$\nabla_\mu V^\mu=\partial_\mu V^\nu + \Gamma^{\mu}_{\mu \lambda}V^\lambda = \partial_r V^r +\partial_\theta V^\theta+ \partial_\phi V^\phi + \frac2r v^r+ \frac{V^\theta}{\tan(\theta)} $$
Which didn't work either.
(Wikipedia: ${1 \over r^2}{\partial \left( r^2 A_r \right) \over \partial r}
+ {1 \over r\sin\theta}{\partial \over \partial \theta} \left( A_\theta\sin\theta \right)
+ {1 \over r\sin\theta}{\partial A_\varphi \over \partial \varphi}$).
I was going to try
$$(\nabla \times \vec{V})^\mu= \varepsilon^{\mu \nu \lambda}\nabla_\nu V_\lambda$$
But I think that that will not work. What am I missing? | {
"domain": "physics.stackexchange",
"id": 52915,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "conventions, tensor-calculus, differentiation, vector-fields, covariance",
"url": null
} |
ros, moveit, ros-melodic, moveit-setup-assistant
Originally posted by vidu98 with karma: 23 on 2021-11-05
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 37034,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, moveit, ros-melodic, moveit-setup-assistant",
"url": null
} |
The probability of getting an $$F$$ as large as ours is about 0.21 (or 21%). Since $$H_a$$ represents both sides of the distribution, we double the probability to give us the chance of getting a test statistic as great or as small as ours, so for a two-tailed test, $$P=0.42$$. With such a high $$P$$-value, we cannot reject the null and therefore can state that for all intents and purposes, the variances between both populations are the same (i.e. the observed variability between both $$s$$ can be explain by chance alone).
The following figure shows the observed $$P$$ values in both tails.
This can be easily executed in R as a two-tailed test as shown in the following code block:
Ref <- c(560, 530, 570, 490, 510, 550, 550, 530)
Cont <- c(600, 590, 590, 630, 610, 630)
var.test(Ref, Cont, alternative="two.sided")
F test to compare two variances
data: Ref and Cont
F = 2.1163, num df = 7, denom df = 5, p-value = 0.4263
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.3088156 11.1853404
sample estimates:
ratio of variances
2.116337
Note that the var.test() computes the $$F$$ ratio using the first variable name in the list as the numerator. For example, had we reversed the order of variables (i.e. var.test(Cont, Ref, alternative="two-sided")), the returned $$F$$ value would be the inverse of the original $$F$$ value, or $$1/2.12 = 0.47$$. The $$P$$ value would have stayed the same however.
# 3 Example 2
An investor is concerned that stock 1 is a riskier investment than stock 2 because its variation in daily prices is greater. The following table is provided with summary statistics for a sample of 25 daily price changes.
Stock 1 Stock 2
Sample size 25 25
Standard deviation .76 .46 | {
"domain": "github.io",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9893474872757473,
"lm_q1q2_score": 0.811159418251152,
"lm_q2_score": 0.8198933425148213,
"openwebmath_perplexity": 973.2219356509167,
"openwebmath_score": 0.8191537261009216,
"tags": null,
"url": "http://mgimond.github.io/Stats-in-R/F_test.html"
} |
organic-chemistry, electrochemistry, reduction-potential, cyclic-voltammetry
Title: Cyclic Voltammetry - HOMO and LUMO levels I'm a physicist, so I apologize if these are obvious questions.
I've carried out CV measurements on a few different types of material (with a ferrocene reference). I am interested in determining the HOMO and LUMO levels of the material.
My CV measurements result in a current-voltage curve (IV curve). It has been explained to me I just need to measure the mV difference between the peak of the ferrocene and the oxidation or reduction curve, then subtract/add that onto the reference for ferrocene (4.8eV) to get the HOMO/LUMO levels.
Sounds simple, right?
But:
Do I measure to the onset of the oxidation/reduction curve or the
peak?
What justification do I use to convert the voltage to an energy? How can I say that a difference in mV corresponds to eV? Maybe this might make sense if it was a one electron process, but how do I know that?
Are these peaks even the HOMO/LUMO levels at all? In this eminent paper it warns me
" Often cyclic-voltammetry-based ionization potentials and electron
affinities are inappropriately referred to as "HOMO" and "LUMO"
energies" Yes, you can "convert" this way, but you're correct to be skeptical.
Let's start with interpreting the cyclic voltammetry curves themselves.
(figure from Wikipedia)
Note that the "peak" actually has two sides. When you sweep the potential with CV, the cathodic peak ($E_{pc}$) and the anodic peak ($E_{ac}$) won't exactly line up. If you have a well-behaved, reversible redox species, the two peaks will be separated by $E_{pa}-E_{pc}=\frac{56.5\text{ mV}}{n}$ for $n$ electrons.
Do I measure to the onset of the oxidation/reduction curve or the peak | {
"domain": "chemistry.stackexchange",
"id": 7886,
"lm_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, electrochemistry, reduction-potential, cyclic-voltammetry",
"url": null
} |
quantum-mechanics, quantum-field-theory, mathematical-physics
And that's where we come full circle: In many cases, the only way we know of obtaining a QFT is by quantizing the classical field theory, which in turn leads us to all the issue with the canonical formalism and/or the path integral all over again.
In the end, I would submit that the question is somewhat misguided: The issue is not that we do not have axiomatizations of QFT that avoid being mathematically non-rigorous. We have, both AQFT and FQFT do that. The problem is that we do not actually know how to produce physical theories that fulfill these axioms1. Yes, AQFTs deal with Wightman functions rigorously. That doesn't do you any good when trying to understand e.g. the Standard Model because we can't show that the Standard Model fulfills any variant of the AQFT axioms. | {
"domain": "physics.stackexchange",
"id": 40064,
"lm_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-field-theory, mathematical-physics",
"url": null
} |
sensation, ant
Title: Do ants feel acceleration? The organ we have to provide us with current acceleration information is quite complicated. Because an ant queen didn't seem to notice when I picked up the bottle she was in, I have a suspicion that ants don't really care about acceleration and therefore can't tell where it's up and where it's down.
Am I right? If not, how do they sense acceleration? According to Clinical Neurophysiology of the Vestibular System
By Robert William Baloh, Vicente Honrubia, page 8, the vestibular system (animals' "accelerometer") is as old as 600 million years and is present in invertebrates.
I assume (without a precise source) that this is especially important for flying insects (after all, accelerometers were engineered for flying machines in the first place!) and that the ant didn't respond because the acceleration to which you submitted it was not deemed harmful. | {
"domain": "biology.stackexchange",
"id": 2475,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sensation, ant",
"url": null
} |
newtonian-mechanics, forces, friction
Title: Why is normal force at inclined plane defined the way it is? So why is normal force at inclined plane is $mg \cos a$ and friction is $mg \sin a$? I mean, why not vice-versa or why not some other ratio? Where does it come from? I can see that the sum squares of friction and normal force under the root should be equal to $mg$ and the angle at which the plane is inclined has something to do with it.
Does it come from some other part of physics or was it just deduced experimentally? I mean, we could slide a sample block from an inclined plane to see what acceleration it has each time we change the angle.
UPD:
Thank you all guys! What I was ultimately asking just seems to be a matter of philosophy. These all formulas are beautiful and seem to be correct. But they are abstractions. And the confidence that this is true ultimately comes from experiments. Since I am very new to physics, I just wanted to know if my assumptions were true. This question boils down to basic trigonometry and vectors in 2D space.
Given a vector, a quantity with a direction and magnitude. Let's consider this magnitude be its length and its direction is given by the arrows that are used here. Now for a vector with a given length, and making an angle of $\theta$ with the x-axis, the projection of it along the x-axis and y-axis will be mgcos$\theta$ and mgsin$\theta$ respectively. We do the same for the force mg to obtain its components along the two directions. This way the square sum of the components adds up to mg, consistent with what happens in geometry. Now why we use geometry and trigonometry here, can it be experimentally proven to be right, and if this is the exact ratio it splits with may be venturing into Philosophy I guess. | {
"domain": "physics.stackexchange",
"id": 81420,
"lm_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",
"url": null
} |
So
$$\int_{0}^{\infty} \frac{\arctan x}{\sinh \pi x} \, dx = I(1) = \frac{\log \pi}{2} - \frac{\log 2}{2} .$$
Combining this result with the first result we have
\begin{align} \int_{0}^{\infty} \frac{x \log(1+x^{2})}{\sinh \pi x} \, dx &= 2 \left(-\frac{\log 2}{3} - 3 \zeta'(-1) - \frac{\log \pi}{2} + \frac{\log 2}{2} \right) \\&=\frac{\log 2}{3} - \log \pi - 6 \zeta'(-1) \\ &= \frac{\log 2}{3} - \log \pi - \frac{1}{2} + 6 \log A \\ &\approx 0.0788460364 . \end{align}
• There ya' go, buddy. :):) Very nice indeed. – Cody Nov 13 '13 at 20:45
I'll conjecture that the correct value is : $$I:=\frac{\ln\;2}3-\ln\, \pi-6\,\zeta'(-1)$$ ($\zeta'(-1)=\frac 1{12}-\ln\,A\;$ with $A$ is the Glaisher-Kinkelin constant)
Let's obtain this solution using the Abel-Plana formula (a little as proposed by Cody) :
$$\sum_{n=0}^\infty (-1)^n\,f(n)=\frac{f(0)}2+i\int_0^\infty\frac{f(it)-f(-it)}{2\,\sinh(\pi\,t)}dt$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9886682444653241,
"lm_q1q2_score": 0.8217247421608304,
"lm_q2_score": 0.8311430520409023,
"openwebmath_perplexity": 1430.8730366514212,
"openwebmath_score": 1.0000097751617432,
"tags": null,
"url": "https://math.stackexchange.com/questions/561736/what-is-the-value-of-the-integral-int-0-infty-fracx-ln-1x2-sin"
} |
organic-chemistry, stereochemistry
The digraph is a two-dimensional (circle) representation of the three-dimensional (sphere) aldehyde 1 as one proceeds outward from $\ce{C2}$ to determine the priorities of the surrounding groups. The spheres are numbered in green. In sphere 2 hydrogen has the lowest priority and $\ce{C1}$, $\ce{C3}$ and $\ce{C6}$ are tied. Proceeding to sphere 3, we have $\ce{C1}${O,O,H}, $\ce{C3}${4,4,H} and $\ce{C6}${O,H,H}. Within the braces the atoms are arranged in descending order of at. no. and a one-to-one comparison is made. Clearly, the order of priorities is $\ce{C1}$>$\ce{C6}$>$\ce{C3}$>H.
Just as $\ce{C6}$ is in front of the five-carbon chain, the hydrogen at $\ce{C2}$ is behind the chain. To assign a configuration, point the thumb of your right hand down the $\ce{C2}$-H bond. Now your fingers will point in from $\ce{C1}$ to $\ce{C6}$ to $\ce{C3}$. Accordingly, the configuration at $\ce{C2}$ is "R" (Rectus).
At $\ce{C3}$ and $\ce{C4}$, C>H. The "E" (Entgegen) configuration applies. | {
"domain": "chemistry.stackexchange",
"id": 17453,
"lm_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, stereochemistry",
"url": null
} |
catkin, ros-indigo, rosbuild
add_subdirectory(cereal_port)
Now the next step is to Declare how your targets (C++ binaries) shall be installed. In my case, Can anyone tell me what do I need to add in my DSP-3000/CMakeLists.txt to complete this step?
Also, can anyone check if I did the rosbuild to catkin conversion correctly for this file?
Thank you.
Originally posted by frodyteen on ROS Answers with karma: 62 on 2018-05-09
Post score: 0
Please refer to catkin documentation: C++ system library dependencies. Then follow through to catkin documentation: Building and installing C++ executables.
On both pages, Boost is used as an example.
Edit: I'm slightly confused. Looking at the master branch of ros-drivers/kvh_drivers it already appears to be a Catkin package (CMakeLists.txt here and package.xml here). It was converted in ros-drivers/kvh_drivers#2.
Do you have any specific reason to want to use the indigo branch? I'm not sure why that is still there, as it seems to have lagged behind master quite a bit.
Edit2: I've opened ros-drivers/kvh_drivers#6 to ask the maintainer(s) what the status of the Indigo branch is.
Edit3:
You are right, I was able to build it successfully, then I ran rosrun kvh dsp3000 and it gave me an error shown in this link
that would seem to be a different issue. Let's not mix them.
If your current question was answered, please mark the question as answered by ticking the checkmark.
Originally posted by gvdhoorn with karma: 86574 on 2018-05-10
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 30796,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "catkin, ros-indigo, rosbuild",
"url": null
} |
We use the matlab program bvp4c to solve this problem. 2003) that use the Hamilton-Jacobi equation to update the level set function. The pseudocode for the Forward Euler solution to the Heat Equation is shown in Figure 1. Ask Question 0. swell or grow as fluids are absorbed. The coefficient α is the diffusion coefficient and determines how fast u changes in time. (44) the Matlab code included in Annex A has been. The objective was to develop a hierarchical multiscale mathematical model to describe the transport of nanoparticles in the blood vessels and their interaction with the vessel wall and write the C++ code to solve the equations of the model (using the GetFEM++ library). Steady-State Diffusion When the concentration field is independent of time and D is independent of c, Fick'! "2c=0 s second law is reduced to Laplace's equation, For simple geometries, such as permeation through a thin membrane, Laplace's equation can be solved by integration. This is the home page for the 18. We use the matlab program bvp4c to solve this problem. That is the main idea behind solving this system using the model in Figure 1. NOTE: These are rough lecture notes for a course on applied math (Math 350), with an emphasis on chemical kinetics, for advanced undergraduate and beginning graduate students in science and math-ematics. Many mathematicians have. Lecture notes on finite volume models of the 2D Diffusion equation. • Sample Code in Python, Matlab, and Mathcad –Polynomial fit –Integrate function –Stiff ODE system –System of 6 nonlinear equations –Interpolation –2D heat equation: MATLAB/Python only • IPython Notebooks Thanks to David Lignell for providing the comparison code. 1 Learning Outcomes The goal of this chapter is for the student to understand: • physical process of diffusion of neutrons • limitations of diffusion • the neutron balance equation • analytical solutions to the one speed neutron diffusion equation • boundary condition rationale. This can be done as follows: Consider a solution vector ~y with components y1 and y2 defined as follows: y1 = c and y2 = dc/dx (2). (1) be written as two first order equations rather than as a single second order differential equation. * Practical approach to signal processing: The first book to focus | {
"domain": "studiotamarapani.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9873750525759486,
"lm_q1q2_score": 0.8249356033961638,
"lm_q2_score": 0.8354835391516133,
"openwebmath_perplexity": 929.5599831264353,
"openwebmath_score": 0.6053187251091003,
"tags": null,
"url": "http://jmly.studiotamarapani.it/matlab-code-for-diffusion-equation.html"
} |
homework-and-exercises, electromagnetism, magnetic-fields, electric-fields
The proton gets pushed in both ways at the same time (in the first example, it doesn't move at first, but then starts to move as the electric field pushes it, so the magnetic force appears too). It might be a bit hard to visualize, but I'll talk about the first example: the proton is both first pushed in the $\hat{x}$-direction (so its velocity is non-zero) and then undergoes the centripetal force (from the magnetic field) which causes it to start revolving around the x-axis. However, just before it dips under the z-axis, the proton stops moving (the electric field caused it to decelerate), causing the electric field to accelerate it again, restarting the process while causing the proton to move a net displacement along the z-axis (since it never rotated back to the origin). | {
"domain": "physics.stackexchange",
"id": 20363,
"lm_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, electromagnetism, magnetic-fields, electric-fields",
"url": null
} |
machine-learning, classification, text
Title: How to add incorporate meta data into text classification? I have a collection of statements which I need to classify into 5 classes. Each statement have meta data in different columns:
Author|Editor| date of release| statement | Class
How can one use the meta data to improve the text classification task? Some models cannot really handle this, while others lend themselves for it easily. I'll explain two approaches that you could use:
Naive bayes
With Naive Bayes you can use other categorical values as well as your normal n-grams or sparse bag of words vectors. Just add them one-hot encoded to your features and it is also incorporated. With numerical features you would need to use something like Gaussian Naive Bayes, to fit a distribution to your features per target class, then you can use the likelihoods of these features per class to compute the probabilities.
Neural network
If you use a neural network approach like CNNs or RNNs, you can add any type of feature representation network and concatenate it somewhere in your original network. In your case you would have a softmax at the end of your RNN. Before this, concatenate the output of your 'normal-feature' neural network, add some dense layers and feed this to your softmax output layer. This way you can train your model end-to-end and it will learn important interactions as well. | {
"domain": "datascience.stackexchange",
"id": 2281,
"lm_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, classification, text",
"url": null
} |
javascript, jquery
Title: How can I clean up (DRY) this verbose jQuery code? I had posted this on StackOverflow — someone pointed me here.
My code is working, but it's incredibly verbose and I know that it can be made more compact. I just don't know how :-)
I'm building an audio portfolio. When a button is clicked, a sequence of events happens. When another button is clicked, all other active buttons are killed and the sequence for that specific button runs.
The buttons are invisible and are placed on a visualisation of a switch. When clicked, an image of the switch flicked into its "activated" state has its class of "display: none" removed. That should give the user the impression that actually flicking a switch starts playing audio.
Like so:
$(function(){
// FIRST BUTTON
$('.button01').click(function() {
if ($('.switch01').hasClass('activated')){
// So if button.button01 is clicked and img.switch01 has class "activated"
// Kill all audio
$('audio').each(function(){ this.pause(); this.currentTime = 0; });
// Turn this switch off
$('.switch01').removeClass('activated');
// Kill all info cards showing the playback controls
$('.audio-info-card').addClass('d-none');
} else {
// If button.button01 is clicked and img.switch01 DOESN'T have class "activated"
// Turn all other switches off
$('.switch02, .switch03').removeClass('activated');
// Kill all info cards
$('.audio-info-card').addClass('d-none');
// Activate this switch and info card
$('.switch01').addClass('activated');
$('.audio-info-card#card01').removeClass('d-none');
// Kill all audio
$('audio').each(function(){ this.pause(); this.currentTime = 0; }); | {
"domain": "codereview.stackexchange",
"id": 38311,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery",
"url": null
} |
javascript, object-oriented, ecmascript-6
this.minInput.addEventListener("input", this.changeInputValue);
this.maxInput.addEventListener("input", this.changeInputValue);
window.addEventListener("mouseup", this.mouseUp);
window.addEventListener("mousemove", this.mouseMove);
}
mouseDown = (e) => {
e.preventDefault();
this.setActive(e.target);
this.dragged = e.target === this.minThumb.element ? 'min' : 'max';
}
mouseUp = () => {
this.dragged = null;
}
mouseMove = (e) => {
const { dragged } = this;
if (!dragged) {
return;
}
e.preventDefault();
const input = dragged === 'min' ? this.minInput : this.maxInput;
const { range: [low, high] } = this.options;
const percent = this.getXToPercent(e.clientX);
input.value = low + (percent / 100) * (high - low);
this.sanitizeInput(input);
this.updateUI();
}
sanitizeInput(input) {
const { range: [low, high] } = this.options;
// Make sure value is in range of slider:
const valueInRange = Math.round(Math.max(Math.min(input.value || 0, high), low));
// Make sure lower value is below or equal to higher:
input.value = input === this.minInput
? Math.min(valueInRange, this.maxInput.value)
: Math.max(valueInRange, this.minInput.value);
}
changeInputValue = (e) => {
this.sanitizeInput(e.target);
this.updateUI();
this.setActive(this.container.querySelector(".slider-btn:not(.active)"));
}
setSliderBackground() { | {
"domain": "codereview.stackexchange",
"id": 37891,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, object-oriented, ecmascript-6",
"url": null
} |
robotic-arm, turtlebot, robot-state-publisher
and same error on minimal.launch
changed ROS_BOOST_LIB_DIR_NAME to /usr/lib/arm-linux-gnueabihf/ based on a webpage that I can't remember, but could find again if needed. This got rid of the errors in roswtf minimal.launch, but robot_state_publisher still fails when it is run
testing on a amd64 install roswtf minimal.launch generates the same errors, but minimal.launch runs successfully, so it would appear that was a dead end.
running with gdb trace as requested produces this
setting /run_id to 5d69beda-02c0-11e5-9ec8-001e06c2b101
process[rosout-1]: started with pid [6778]
started core service [/rosout]
process[robot_state_publisher-2]: started with pid [6796]
process[diagnostic_aggregator-3]: started with pid [6798]
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device]
process[mobile_base_nodelet_manager-4]: started with pid [6820]
process[mobile_base-5]: started with pid [6858]
process[cmd_vel_mux-6]: started with pid [6914]
process[bumper2pointcloud-7]: started with pid [6974]
process[turtlebot_laptop_battery-8]: started with pid [7040]
process[capability_server-9]: started with pid [7060]
[tcsetpgrp failed in terminal_inferior: Inappropriate ioctl for device] | {
"domain": "robotics.stackexchange",
"id": 21749,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "robotic-arm, turtlebot, robot-state-publisher",
"url": null
} |
Which one of the following is an iterative technique for solving a system of simultaneous linear algebraic equations? Gauss elimination Gauss-Jordan Gauss-Seidel $LU$ decomposition
The Laplace transform of $e^{at}\sin\left ( bt \right )$ is $\frac{b}{\left ( s-a \right )^{2}+b^{2}}$ $\frac{s-a}{\left ( s-a \right )^{2}+b^{2}}$ $\frac{s-a}{\left ( s-a \right )^{2}-b^{2}}$ $\frac{b}{\left ( s-a \right )^{2}-b^{2}}$
What are the modulus $\left ( r \right )$ and argument $\left ( \theta \right )$ of the complex number $3+4i$ ? $r=\sqrt{7}, \theta =tan^{-1}\left ( \frac{4}{3} \right )$ $r=\sqrt{7}, \theta =tan^{-1}\left ( \frac{3}{4} \right )$ $r={5}, \theta =tan^{-1}\left ( \frac{3}{4} \right )$ $r={5}, \theta =tan^{-1}\left ( \frac{4}{3} \right )$
A liquid mixture of ethanol and water is flowing as inlet stream $P$ into a stream splitter. It is split into two streams, $Q$ and $R$, as shown in the figure below. The flowrate of $P$, containing $30$ mass$\%$ of ethanol, is $100\:kg/h$. What is the ... additional specification$(s)$ required to determine the mass flowrates and composition (mass $\%$) of the two exit streams? $0$ $1$ $2$ $3$ | {
"domain": "gateoverflow.in",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9796676496254958,
"lm_q1q2_score": 0.8660646808351999,
"lm_q2_score": 0.8840392771633078,
"openwebmath_perplexity": 793.7065183566209,
"openwebmath_score": 0.9886487722396851,
"tags": null,
"url": "https://ch.gateoverflow.in/tag/gate2016"
} |
What is the correct probability that you will win in a game of rock scissors paper with 3 players? Thanks.
• You count the case where A and B win, and also the case where B and A win, though they're the same case. Instead of $12$ cases where two people win, there are only $9$ ($3$ ways to choose the two winners, and $3$ ways to win.) – saulspatz Jan 25 at 6:24
• Doubt - Lets say the three players put rock, paper and scissors respectively. Would you consider that as a win for all 3 participants, or just a draw? – Smriti Sivakumar Jan 25 at 7:20
• @saulspatz Yes, you are correct.. But what is the probability that one person wins? – Freddie Jan 25 at 8:48
• @SmritiSivakumar That would be a draw. Draw is when all three people put rock/scissor/paper, or there is one of each. – Freddie Jan 25 at 8:49
• What if two players choose "sciccors" and one "paper" ? Do then two players win ? – Peter Jan 25 at 11:29
There is nothing wrong with your calculation; each player wins with probability $$1/3$$. The point is that these are not disjoint events, so $$P(A\text{ wins})+P(B\text{ wins})+P(C\text{ wins})\neq P(A\text{ or }B\text{ or }C\text{ wins}).$$ In fact, the sum of the probabilities is the expected number of players who win. (When there are no multiple winners, so the events are disjoint, this number is always $$0$$ or $$1$$ and so its expectation is the probability someone will win, but this is not true in general.) | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109525293959,
"lm_q1q2_score": 0.8185187787090623,
"lm_q2_score": 0.8311430499496096,
"openwebmath_perplexity": 226.0947945810751,
"openwebmath_score": 0.8772203326225281,
"tags": null,
"url": "https://math.stackexchange.com/questions/3998809/probability-that-you-win-in-rock-scissors-paper-with-3-players"
} |
newtonian-mechanics, energy, work
You must think of "work done" as "work suffered by the object", regardless of what you as a person do on it.
According to physics laws, if you push an object, it will keep moving indefinitely forever (in straight line and constant velocity)
If you push an object, but it stops after you stop pushing, then there must be another force you're not taking into account. (Friction!)
So this is what is happening. On a frictionless ideal surface, you would push an object and it would acquire a kinetic energy given by $E_k=\Delta W$, so it would get the speed $v=\sqrt{\frac{2W}{m}}$.
However, friction is acting to stop the body. This means that the work done by friction is the same as the one you did, so they cancel out and you have no movement. No kinetic energy means no work.
But "no work" means "no NET work ON THE BODY" under consideration; i.e. the body received the same amount of work both negative and possitive. But that does not mean you didn't get tired. You usually provide the possitive part, and nature fights it adding the negative part. That's why you won't make work pushing a wall, but you'll get tired. | {
"domain": "physics.stackexchange",
"id": 47474,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, energy, work",
"url": null
} |
python, beginner, python-3.x, cryptography, caesar-cipher
Title: (Final)Simple Decryptor/Encryptor This is my final version of my simpel Decrypter/Encryptor called Dencryptor. This is one of my first Python projects and I think it turned out pretty good. I am using a Caesar cipher right now and I think it is working as intended. I may try to add some other ciphers to it but I think it is working good right now. This was just a project to learn from and the encryption isn't strong so I do not recommend any one actually using this for anything.
List of commands:
help - Show this page.
encrypt {text} - Encrypt some text
key - Displays your current decryption key
key {key} - Set a decryption key
decrypt {text} - Decrypt some text
exit - close application
What do you guys think about it? Any changes required?
Special thanks to: @Coal_ and @henje for helping!
import secrets
import string
print(""" _____ _
| __ \ | |
| | | | ___ _ __ ___ _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ '_ \ / __| '__| | | | '_ \| __/ _ \ '__|
| |__| | __/ | | | (__| | | |_| | |_) | || __/ |
|_____/ \___|_| |_|\___|_| \__, | .__/ \__\___|_|
__/ | |
|___/|_| """)
userinput = ''
exit = False
key = None
characters = list(string.printable)[:-5]
def get_int(prompt):
try:
return int(prompt)
except ValueError:
print("Input requires a number!") | {
"domain": "codereview.stackexchange",
"id": 29726,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, python-3.x, cryptography, caesar-cipher",
"url": null
} |
javascript
Title: Function which returns the smallest / largest numbers in a nested array structure Given is an array which contains sub-arrays. The elements in this sub-arrays are numbers.
The task is to implement a JavaScript-function which returns an array with the smallest / largest numbers in the single arrays.
I have figured out this solution:
// Returns the smallest / largest
// numbers contained in a
// set of arrays.
// Parameter ---------------------
// 1.: Array - Containing other arrays.
// 2.: Function - Either Math.max or
// Math.min
// Return -------------------------
// Array - Containing numbers in case
// of success.
// Containing 'undefined' in case
// of elements which aren't arrays.
// Containing NaN in case of elements
// which aren't numbers.
function getExtrema(structure, funct) {
var ret = structure.map(function(value) {
if (Array.isArray(value)) {
return funct.apply(null, value);
}
});
return ret;
}
Complete code (with examples) on CodePen: http://codepen.io/mizech/pen/bEBMaW?editors=101
Are there better ways to solve the described task? Edge cases
Your function works slightly different than you say it does:
Math.max and Math.min work on anything that can be converted to a number. The array [1,2,"3",4] will just work fine. NaN is returned for a case whenever there is an element in that subarray that cannot be converted to a number.
Math.max and Math.min return -Infinity and Infinity if the array is empty. This case is undocumented.
Documentation
Your function is documented well. You might want to consider changing the documentation to the format that JSDoc uses, so you can automatically generate documentation for your javascript codebase. | {
"domain": "codereview.stackexchange",
"id": 17639,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript",
"url": null
} |
a flxed point. (100 points) Find a fully reduced equation for the set of all points in R2 i. com and master linear equations, adding and a large number of additional math topics. Solutions: (1) (2) , (3) Set of all points in a plane equidistant from a fixed point. (iv) Mark 2 points X and Y which are at a distance of 3. Comparing equation (6) with the Fourier Series given in equation (1), it is clear that this is a form of the Fourier Series with non-integer frequency components. Find The Parametric Equation Of A Line Segment Between Two Points. A parabola is the set of points in the plane equidistant from a xed point Fcalled the focus and a xed line lcalled the directrix. Visit Mathway on the web. By signing up, you'll get thousands. Perhaps let the user be able to set a length for this line (the 500-mile-long mid-point line). The standard form of a parabola with vertex (0, 0) and the x-axis as its axis of symmetry can be used to graph the parabola. Standard Form of a. Find all of the points on the x-axis which are 2 units from the point (−1, 1). Thanks for contributing an answer to Mathematics Stack Exchange! Please be sure to answer the question. Applications The Circle: WHEELS AND TABLE TOPS Definition The circle is the locus (set) of all points that are equidistant from a given point called the center. In this section we define ordinary and singular points for a differential equation. Similar to the "How far can I travel" tool. In other words, every point on the circumference of a circle is. Equations -. For example, a parabola can be defined as the set of points in a plane that are equidistant from a focus F and a directrix. Equation of a line that passes halfway between two points in 2942 equidistant equation of a plane between two points find an equation of the plane consisting all points that are solved find the equation of plane each point which Equation Of A Line That Passes Halfway Between Two Points In 2942 Equidistant Equation Of A Plane Between…. Find a point on the y-axis that is equidistant from the points | {
"domain": "shantideva.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9910145696551569,
"lm_q1q2_score": 0.8423338188635793,
"lm_q2_score": 0.8499711756575749,
"openwebmath_perplexity": 236.3292171589137,
"openwebmath_score": 0.6133164763450623,
"tags": null,
"url": "http://gpuf.shantideva.it/find-an-equation-of-the-set-of-all-points-equidistant-from-the-points-calculator.html"
} |
biochemistry, cell-biology, cell-membrane, cellular-respiration, membrane-transport
Title: Membrane Permeability to Pyruvate Pyruvate seems to pass easily through the outer membrane of the mitochondrion but has difficulty entering the inner membrane (and gets in by H+ symport). I have two questions: (1) what property of pyruvate disallows it from passing through the inner membrane? Is it its charge? and (2) what structural differences are there between the outer and inner membranes of the mitochondrion that create their disparate permeabilities to pyruvate? Pyruvate is negatively charged and quite polar, which makes it unfavourable to diffuse directly through any membrane. The outer mitochondrial membrane contains porins, which allow small molecules, like pyruvate, to passively diffuse through. Specifically, pyruvate uses voltage dependent anion channels. The inner mitochondrial membrane lacks such channels and depends on active transport by the long anticipated but only recently discovered mitochondrial pyruvate carrier (Herzig et al. and Bricker et al., 2012). | {
"domain": "biology.stackexchange",
"id": 4541,
"lm_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, cell-biology, cell-membrane, cellular-respiration, membrane-transport",
"url": null
} |
• The lower bound is clear for me. But for the upper bound if we apply cauchy-schwarz then I think we will get the bound $n$. I couldn't understand the last line i.e., using the fact that $\sum |x_i| = 1$ – Kumar Mar 4 '13 at 6:20
• I have clarified the Cauchy-Schwarz application in the edit above. As mentioned, the upper bound is loose, but I meant $\sum x_i = 1$ should prove helpful in tightening it. – Macavity Mar 4 '13 at 6:39
• @Macavity as my answer shows, the upper bound of $\sqrt{n}$ is actually quite tight, and is attainable whenever $n=m^2$ is a perfect square, via $x_1=x_2= \ldots =x_{\frac{m^2+m}{2}}=\frac{1}{m}, x_{\frac{m^2+m}{2}+1}=x_{\frac{m^2+m}{2}+2}= \ldots =x_{m^2}=-\frac{1}{m}$ – Ivan Loh Mar 4 '13 at 15:47
• @IvanLoh: Yes - did not specifically consider case of n being perfect square, where its tight. Even otherwise it looks good! – Macavity Mar 5 '13 at 8:49
Overview: I shall prove the bounds
$$1 \leq \sum\limits_{i=1}^{n}{|x_i|} \leq \frac{2(k+\sqrt{(n-k)k(n-1)})}{n}-1$$
, where $k=\lceil \frac{n-1+\sqrt{n}}{2} \rceil$
Equality is achievable for both bounds, so they are the best possible bounds. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9939024370849708,
"lm_q1q2_score": 0.8007198006608287,
"lm_q2_score": 0.8056321936479701,
"openwebmath_perplexity": 139.8104940007435,
"openwebmath_score": 0.9807653427124023,
"tags": null,
"url": "https://math.stackexchange.com/questions/320180/bound-for-the-solution-of-non-homogeneous-equations"
} |
javascript, game, interview-questions, pathfinding, ai
function startLevel(map) {
map.placePlayer(0, map.getHeight() - 1);
var player = map.getPlayer();
map.defineObject('robot', {
'type': 'dynamic',
'symbol': 'R',
'color': 'gray',
'onCollision': function (player, me) {
me.giveItemTo(player, 'greenKey');
},
'behavior': function (me) {
for(i = 2; i<9; i++){
map.placeObject(map.getWidth() - 20, i, 'block');
}
for(i = 2; i<9; i++){
map.placeObject(map.getWidth() - 3, i, 'block');
}
if(me.canMove('down') && !me.canMove('left')){
me.move('down');
}else{
if(me.canMove('right') && !me.canMove('down')){
me.move('right');
}
if(me.canMove('up') && !me.canMove('right')){
if(me.canMove('left')){
me.move('up');
}else{
me.move('down');
}
}
if(!me.canMove('up') && me.canMove('right')){
me.move('right');
}
if(!me.canMove('up') && !me.canMove('right')){
me.move('down');
}
}
}
});
map.defineObject('barrier', {
'symbol': '░',
'color': 'purple',
'impassable': true,
'passableFor': ['robot']
}); | {
"domain": "codereview.stackexchange",
"id": 7322,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, game, interview-questions, pathfinding, ai",
"url": null
} |
ros, kinect, depth-image, rxbag
Originally posted by Paul0nc on ROS Answers with karma: 271 on 2011-11-06
Post score: 0
Original comments
Comment by joq on 2011-11-07:
Pre-formatted text lines start with four spaces.
Comment by Paul0nc on 2011-11-07:
joq: Apologies for another basic question: How did you format the above edit to appear as it did on my screen? (assuming you did this).
Comment by Paul0nc on 2011-11-07:
joq: See my edit above regarding rosbag output. Thanks.
Comment by joq on 2011-11-07:
What does rosbag info say about this bag file?
Comment by Paul0nc on 2011-11-06:
Eric: I am using electric on ubuntu 10.4. I do not get any error messages in the terminal.
Comment by Eric Perko on 2011-11-06:
Could you update your question to include which ROS release you are using (Diamondback, Electric, etc)? Do you get any error messages in the terminal where rxbag was run from?
I don't see anything wrong with your bag contents. It has data, apparently the right type.
Sometimes I've noticed rxbag refusing to display message contents if its cursor is positioned at the beginning of the data.
Try moving the cursor past the first few messages before attempting to plot.
Originally posted by joq with karma: 25443 on 2011-11-07
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by Paul0nc on 2011-11-08:
Agreed. I'll check to see if one exists or open one.
Comment by joq on 2011-11-08:
We should open a defect ticket for this problem. It's been happening for several releases.
Comment by Paul0nc on 2011-11-07:
Many thanks joq. Moving the cursor did the trick. | {
"domain": "robotics.stackexchange",
"id": 7201,
"lm_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, kinect, depth-image, rxbag",
"url": null
} |
For $N = 5$, $2A$ looks like:
$$\begin{array}{ccccc} &0 &1 &0 &0 &1 \\ &1 &0 &1 &0 &0 \\ &0 &1 &0 &1 &0 \\ &0 &0 &1 &0 &1 \\ &1 &0 &0 &1 &0 \end{array}$$
Solving this equation system for $\mathbf{x}$ with $N = 10$ and $\mathbf{b} = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]$ gives
$x_6 = 1$.
6. For her to announce an average of 6, the two numbers she receives must add up to 12. This happens to be the average of the two averages announced to either side of her. This pattern holds around the circle, which makes sense if the announced average is also the number picked.
• Wait, I forgot to take into account that this is a circle. :( will edit answer once I reconsider – Irishpanda Feb 18 '16 at 13:08
• haha, I had this same thought process initially – question_asker Feb 18 '16 at 16:03
1
Let $g_n$ be the number picked by the girl who said $n$. The average of $g_6$ and $g_4$ is two more than the average of $g_2$ and $g_4$, so $g_6$ must be four more than $g_2$. Symmetrically $g_6$ four less than $g_{10}$. $g_6$ is therefore the average of $g_2$ and $g_{10}$, but we already have already been told what this is.
• Very elegantly thought and stated. Best answer. – Vynce Aug 30 '17 at 2:20
I know there are plenty of correct answers, but here is a super-simple one.
Let's note $$g_n$$ the n'th girl's secret number and $$a_n$$ the average she gave aloud. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9736446463891304,
"lm_q1q2_score": 0.8070918370209027,
"lm_q2_score": 0.8289388125473628,
"openwebmath_perplexity": 1202.2420020785169,
"openwebmath_score": 0.9042574763298035,
"tags": null,
"url": "https://puzzling.stackexchange.com/questions/27580/ten-girls-around-a-table/27581"
} |
deep-learning, time-series, cnn
We can see that it is an encoder/decoder-looking model, introducing a bottleneck that condenses the information, before upsampling again. This is based on the U-net model architecture: an encoder/decoder that also introduces skip connections between layers of different scales. | {
"domain": "datascience.stackexchange",
"id": 3781,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning, time-series, cnn",
"url": null
} |
classical-mechanics, statistical-mechanics
$$
\eta(\theta) = \frac{b(\theta)}{\sin\theta}\left|b'(\theta)\right|\cdot \mathcal L
$$
where here I use a prime for differentiation. It follows then, by dividing by $\mathcal L$, that the differential scattering cross-section is precisely the standard expression;
$$
\boxed{D(\theta) = \frac{b(\theta)}{\sin\theta}\left|b'(\theta)\right|}
$$ | {
"domain": "physics.stackexchange",
"id": 8389,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classical-mechanics, statistical-mechanics",
"url": null
} |
java, javafx
Title: Media player component with JavaFX I am trying to build a media player as a part of a bigger project in JavaFX. It is a simple media player as of now, which requires a Presentation component to output videos to. The dependencies are being injected by Guice.
This is my first time working on a Java project, so I would love some reviews on my code, especially based on design patterns, SOLID/DRY principles, code readability/re-usability/maintainability and how I can improve.
/**
* Media Player component for Quizatron
*
* @author Dedipyaman Das <2d@twodee.me>
* @version 1.0.18.1
* @since 1.0.18.1
*/
public class Player {
private MediaView mediaView;
private MediaPlayer mediaPlayer;
private FileChooser fileChooser;
private Presentation presentation;
@FXML
private AnchorPane playerNode;
@FXML
private Button playBtn;
@FXML
private Label currTimeLbl;
@FXML
private Label endTimeLbl;
@FXML
private JFXSlider timeSlider;
@FXML
private Label mediaInfo;
@FXML
private Label sourceFileLbl;
/**
* Media player component constructor.
* Guice or any other injector needs to inject a {@link FileChooser} for getting the media file,
* {@link MediaView} for visual output
* and {@link Presentation} to have it presented in a separate view
*
* @param fileChooser FileChooser - single file
* @param mediaView MediaView - Parent container for visual output
* @param presentation Presentation state for separate stage
*/
@Inject
public Player(FileChooser fileChooser, MediaView mediaView, Presentation presentation) {
this.mediaView = mediaView;
this.fileChooser = fileChooser;
this.presentation = presentation;
}
public enum PlayerState {
PLAY, PAUSE
}
/**
* Initializer to get the FXML components working.
*/
@FXML
public void initialize() {
timeSlider.setValue(0);
prepareMediaView();
} | {
"domain": "codereview.stackexchange",
"id": 30703,
"lm_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, javafx",
"url": null
} |
newtonian-mechanics, newtonian-gravity, orbital-motion, solar-system, three-body-problem
Title: Would a planet in a binary star system follow Kepler's Laws? I'm thinking it would not. I am thinking Kepler's Laws were a simplification that were possible with a simple two body (sun, planet) but would not apply for something more complex (sun1, sun2, planet).
Is there a more general form of Kepler's Laws that would apply to solar systems with multiple suns? I like Kieran Hunt's answer but I'm going to give a different answer, even though I agree with what he said.
In a very real sense, our solar system doesn't obey Kepler's laws because there are many bodies. The planets and even more so, the moons in our solar system don't precisely follow Kepler's 3 laws, but they mostly follow it pretty close. Our moon has a pretty strange, wobbly orbit since it's pulled on by both the sun and the earth. But the planets in our solar system do follow Kepler's laws well enough for Kepler to have tested and verified his laws.
In a binary star system, the end result is likely pretty similar. Imagine if Jupiter was a star - further out. It would depend on how big and how close, but if it was far enough, the earth could still orbit the sun, while Jupiter and the sun orbited each other. There's 2 main types of binary systems. One, where the stars are close and the planets orbit the center of mass of the 2 stars. The other, where the stars are far enough apart where the planets can orbit either star individually. See picture below: | {
"domain": "physics.stackexchange",
"id": 31056,
"lm_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, newtonian-gravity, orbital-motion, solar-system, three-body-problem",
"url": null
} |
c++, math-expression-eval
if (pop_back) {
_reg.pop_back();
}
}
} Use fixed-width integer types
Your type aliases for Word and Double_Word are wrong. They may work on your platform, but there is no guarantee that a Double_Word is larger than a Word on all platforms. I recommend that you use the standard fixed-width integer types instead, like std::uint32_t and std::uint64_t.
There are also problems with your #ifdefs: consider for example that one can build Windows binaries using the GNU compiler, so both _WIN32 and __GNUC__ would be set simultaneously.
Naming
I would reconsider using the word "Register" here. In the context of computers, register has a specific meaning. A vector of integers is not a register.
Since the goal is to have a vector where you can access and manipulate individual bits, I think a better name would be bitvector. The standard library already has a type std::bitset which has similar functionality, except that its size is fixed, and your type has a dynamic size like std::vector.
There are also type aliases defined somewhere that you didn't include in the code you posted, like Text and Text_Stream. Are those std::string and std::stringstream? I strongly suggest that you do not create aliases for standard types, it makes it very hard for someone else reading your code to know what is going on, and they'd have to search your code base for the definition of those aliases. Just use std::string and std::stringstream.
Bits or words?
Some member functions work on both bits and words, some don't. Any calling code would need to check sizeof(binary_register::Word) to safely know how big a "word" is. I would simplify things and not expose Word at all in the public API, only allow bit-wise access or let the caller provide an integer type if they want to access multiple bits at once. For example, to_integral<I>() should just remove an I instead of a Word.
Avoid using strings to pass integers | {
"domain": "codereview.stackexchange",
"id": 44575,
"lm_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++, math-expression-eval",
"url": null
} |
electromagnetism, units, si-units, unit-conversion
Title: Why does the vacuum permeability have the value of $\pi$ in it? The vacuum permeability, or the capability of the vacuum to permit magnetic field lines, contains the value of $\pi$. Why? What does this have to do with the ratio of a circle's circumference to its diameter? This is nothing but a choice of units.
Let me make that (hopefully) more clear by explaining more about how choosing units in electromagnetism works:
Coulomb's Law is $\vec F = k \frac{q_1 q_2}{r^2} \hat{\vec r}$ for the force between two charges $q_1$ and $q_2$. $k$ is different in the various systems of units - essentially, it depends on how the unit of charge is defined.
Ampere's Law is $\vec F = k' I_1 I_2 \oint_{C_1} \oint_{C_2} \frac{d\vec r_1 \times (d\vec r_2 \times \vec r)}{|r|^3}$ for the force between two currents along $C_1$ and $C_2$. $k'$ is different in the various systems of units - essentially, it depends on how the unit of current is defined.
In electrodynamics, we find out that
$$ k / k' = c^2 $$
otherwise, we are free to choose.
In CGS, we define $k = 1$, and in SI $k' = 10^{-7} \frac{Vs}{Am}$.
Now we introduce constants
$$ \mu_0 = 4\pi\, k', \quad \varepsilon_0 = \frac{1}{4\pi k} $$
That is nothing more than a definition - the factors of $4\pi$ simplify some formulas later on, e.g. when fields are integrated over the surface of a sphere. | {
"domain": "physics.stackexchange",
"id": 26407,
"lm_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, units, si-units, unit-conversion",
"url": null
} |
java, c, functional-programming, lisp, compiler
You use the name dst for a char buffer, a FILE *, and a GPtrArray * at different points in the program. This is a bit jarring when skimming the code in a small browser window — "Wait, you can't fputs into a char pointer! ...oh, I see, it's a FILE here" —; it might be totally fine in your editor of choice. | {
"domain": "codereview.stackexchange",
"id": 18391,
"lm_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, c, functional-programming, lisp, compiler",
"url": null
} |
strings, f#
Title: Defining a zip code string I'm following this
let StringOfLengthConstructor<'c> (input:string, length:int, defaultConstructor:string->'c) =
match input with
| null -> None
| x when x.Length = length -> Some(defaultConstructor(input))
| _ -> None
type String3 = | String3 of string
let String3 input = StringOfLengthConstructor<String3>(input, 3, String3)
type String4 = | String4 of string
let String4 input= StringOfLengthConstructor<String4>(input, 4, String4)
type String5 = | String5 of string
let String5 input = StringOfLengthConstructor<String5>(input, 5, String5)
type String6 = | String6 of string
let String6 input = StringOfLengthConstructor<String6>(input,6, String6)
and am trying to make more of these with hopefully less repetition. Can this be done without having to repeat type String3 =| String3 of string followed by this?
let String3 input = StringOfLengthConstructor<String3>(input, 3, String3)
See all the repetition? For the purpose of defining a zip code, a US zip code could be defined as
type ZipCode = | Us of String5
or
type ZipCode = | Us of String5*(String4 option) | Canadian of String3*String3 The solution can be made cleaner by re-arranging the order of the arguments and using pointfree style.
let StringOfLengthConstructor<'c> (length : int) (defaultConstructor : string -> 'c) (input : string) =
match input with
| x when x <> null && x.Length = length -> Some (defaultConstructor input)
| _ -> None
type String3 = String3 of string
let String3 = StringOfLengthConstructor 3 String3
However, I don't think that String5 * (String4 option) is a good definition of a zip code. The code should be validating on more than just the string length. | {
"domain": "codereview.stackexchange",
"id": 8340,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "strings, f#",
"url": null
} |
computational-chemistry, energy
Title: What are computed energies in DFT and FF methods relative to? I am not talking about zero-point energy.
I wish to understand how the energy of a system is calculated relative to a zero baseline. This is best explained with an example.
From DFT, the energy could be:
Isolated H = -13.6 eV,
H2 = -31.8 eV
What are these numbers related to? What would be a system at 0 eV? Or what is the zero baseline from which these number are calculated from?
I have also noticed that force-field energies tend to be positive. What is the zero baseline here?
In summary: | {
"domain": "chemistry.stackexchange",
"id": 13113,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computational-chemistry, energy",
"url": null
} |
optics, fourier-transform
where $G$ is the Fourier transform of $g$. For a generic function the Fourier transform used is:
$$G(f_{x}, f_{y}) = \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} g(x,y) e^{-2\pi j (f_{x}x+f_{y}y)}dxdy$$
I've been trying to derive this result by attempting what he says to do, but have so far failed. I think I might be missing a substitution trick somewhere. I've also searched for other sources where this equivalence could be proven, but in the ones I have found, either both expressions are stated as definitions, or the equivalence result is just stated but never proven.
Could someone please help me with this? Looks like a homework problem. In any case, for
$$
G(k) = \int \!\! dx ~ e^{2\pi j xk}~ g(x) \qquad \leadsto G^*(k) = \int \!\! dx ~ e^{-2\pi j xk}~ g^*(x), \leadsto \\
g(x+u/2)= \int \!\! dk' ~ e^{-2\pi j k' (x+u/2)}~ G(k'), \qquad g^*(x+u/2)= \int \!\! dk'' ~ e^{2\pi j k'' (x-u/2)}~ G^*(k''),
$$
so that, substituting in W,
$$
W(x;k)= \int \!\! du \int \!\! dk' \int \!\! dk'' ~ e^{2\pi j( k'x+k'u/2-k''x +k''u/2- ku )} G(k') G^*(k'') \\ | {
"domain": "physics.stackexchange",
"id": 98982,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, fourier-transform",
"url": null
} |
In practice, this means that it would be safest never to use the term range, instead using codomain and image. (But most people don't do that either...)
• Perfect! Thanks for the clarification.
– Ray
Aug 24, 2011 at 12:56
• One important reason for the use of codomain is if discussing properties of functions. $f:\mathbb{R}\to \mathbb{R}$, with $f(x)= x^2$ as above is not 'onto', whilst $f:\mathbb{R}\to [0,\infty)$, with $f(x)= x^2$ is. These two functions have different properties so must be different functions.:-), and the use of language where this point is not taken into account leads to a mess. It is also the case, of course, that domain and codomain then play roles that are nearer being dual to each other. Aug 24, 2011 at 17:41
• You get to define the codomain when you define the function yourself, just like the domain, right? So can you define the codomain as $[0,\infty)$? If not, can you provide a more specific definition of codomain that explains why? Oct 17, 2015 at 3:07
• @Kyle: In the context of my example, we have agreed that the function is $f: \mathbb{R} \rightarrow \mathbb{R}, \ x \mapsto x^2$ and then we are just illustrating the terminology. One could also consider the function $g: \mathbb{R} \rightarrow [0,\infty), \ x \mapsto x^2$, but since the codomain is different, $g$ is a different function from $f$. (E.g. $g$ is surjective but $f$ is not.) Oct 17, 2015 at 4:08
To add a bit to Pete's and lhf's answer: assuming we are talking about functions from one set to another, there are two common ways of viewing functions:
• As sets $$f$$ such that: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9621075744568837,
"lm_q1q2_score": 0.8234208728735077,
"lm_q2_score": 0.8558511488056151,
"openwebmath_perplexity": 281.12457696864226,
"openwebmath_score": 0.8906229138374329,
"tags": null,
"url": "https://math.stackexchange.com/questions/59432/domain-co-domain-range-of-a-function"
} |
xml, php5, rss
$Month = "08";
} else if (strpos($PublishingDate, "Sep") !== false) {
$PublishingDate = str_replace("Sep", "09", $PublishingDate);
$Month = "09";
} else if (strpos($PublishingDate, "Oct") !== false) {
$PublishingDate = str_replace("Oct", "10", $PublishingDate);
$Month = "10";
} else if (strpos($PublishingDate, "Nov") !== false) {
$PublishingDate = str_replace("Nov", "11", $PublishingDate);
$Month = "11";
} else if (strpos($PublishingDate, "Dec") !== false) {
$PublishingDate = str_replace("Dec", "12", $PublishingDate);
$Month = "12";
} | {
"domain": "codereview.stackexchange",
"id": 15435,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "xml, php5, rss",
"url": null
} |
javascript, object-oriented, playing-cards
// Main deck used to play the game
var PlayingDeck = new DeckObject();
(function fillPlayingDeck() { // Filling the main deck with card objects
var listCardNum = ['ace', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'jack', 'queen', 'king']
var listCardSuits = ['clubs', 'diamonds', 'hearts', 'spades']
for (var i = 0; i < listCardNum.length; i++) {
for (var j = 0; j < listCardSuits.length; j++) {
PlayingDeck.iniDeck.push(new CardObject(listCardNum[i], listCardSuits[j])) // generating 52 new card objects
}
}
var len = PlayingDeck.iniDeck.length,
randomNum, tempValue
while (len) { // Fischer-Yates shuffling Algorithm
randomNum = Math.floor(Math.random() * len--)
tempValue = PlayingDeck.iniDeck[len]
PlayingDeck.iniDeck[len] = PlayingDeck.iniDeck[randomNum]
PlayingDeck.iniDeck[randomNum] = tempValue
}
}())
// player and dealer function objects
var mainPlayer = new DeckObject()
function player() {
mainPlayer.iniDeck.push(PlayingDeck.iniDeck.pop(), PlayingDeck.iniDeck.pop())
mainPlayer.displayCards(mainPlayer.iniDeck)
playerSum.value = mainPlayer.sumCards(mainPlayer.iniDeck)
}
var mainDealer = new DeckObject()
function dealer() {
mainDealer.iniDeck.push(PlayingDeck.iniDeck.pop(), PlayingDeck.iniDeck.pop())
mainDealer.displayCards(mainDealer.iniDeck)
dealerSum.value = mainDealer.sumCards(mainDealer.iniDeck)
} | {
"domain": "codereview.stackexchange",
"id": 23965,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, object-oriented, playing-cards",
"url": null
} |
c#, asp.net, observer-pattern, asp.net-core
public class LoadComponent : GenericComponent {
public LoadComponent(IValueService valueService) : base(valueService) {
variables = new List<string>() { "load" };
variables.ForEach(s => valueService.RegisterValue(s));
cancellation = valueService.Subscribe(this, variables);
}
public override bool Valid() => valueService.GetValue("load")?.Valid ?? false;
public override void OnNext(Tuple<string, object> value) {
double load = (double)value.Item2;
if (Math.Abs(load) < 1) {
valueService.SetWarning(value.Item1, "Small load, should be larger");
}
}
}
public class ValidationComponent : GenericComponent { | {
"domain": "codereview.stackexchange",
"id": 34813,
"lm_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#, asp.net, observer-pattern, asp.net-core",
"url": null
} |
human-biology, human-physiology
Title: Is there muscle hyperplasia or hypertrophy after surgery? After exercise there is hypertrophy only. I am curious, if a surgery removes muscle, will there be hyperplasia or hypertrophy to restore it? It does not required much research to find the answer. After injury and surgery the muscle undergoes inflammation to clear up the debris. After that myogenic cells start to proliferate and differentiate, so as expected, there is hyperplasia by restoring injured muscle. Which means that the body can fully restore muscle function if the injury is not too severe.
Effective fiber hypertrophy in satellite cell-depleted skeletal muscle.
Cellular and Molecular Regulation of Muscle Regeneration
Regeneration of mammalian skeletal muscle. Basic mechanisms and clinical implications.
I investigated this a little bit further. Muscle regrowth is mediated by the BM (basement membrane) which is the extracellular matrix that sorrounds the muscle fiber. If that is badly damaged or the nerve is cut, then the muscle fiber won't grow back and we will get scar tissue instead. The muscle will compensate this at a certain level by hypertrophy. There is an interesting new treatment for severe muscle injury, which removes the scar tissue and adds pig extracellular matrix to regrow the muscle.
Implant Lets Patients Regrow Lost Leg Muscle | {
"domain": "biology.stackexchange",
"id": 9106,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-biology, human-physiology",
"url": null
} |
quantum-field-theory, matrix-elements, lorentz-symmetry
So my first guess was that this matrix element does not depend on $p$ and equals to constant.
Can you help me? First remark: The correct expression is
$$\langle0|\Phi(0)|p\rangle =(2\pi)^{-3/2}\left(2\sqrt{\vec{p}^{2}+m^{2}}\right)^{-1/2}N=(2\pi)^{-3/2}\left(2p^0\right)^{-1/2}N,$$
where $\vec{p}$ represents a spatial vector. | {
"domain": "physics.stackexchange",
"id": 13592,
"lm_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, matrix-elements, lorentz-symmetry",
"url": null
} |
python, python-3.x, chess
# If there is a piece of the same colour in the space it is not available, neither are further spaces
else:
break
return available_spaces
So is there any way that I can make this more simple, by perhaps using another method to test what is in each grid space? I'm just not sure how to go about implementing something like that.
Thank you for your help.
Variable definitions:
The grid variable is just a class which contains information on the
current layout of the board and is responsible for drawing the pieces
in the correct locations.
grid.rows and grid.columns are integers containing the dimensions
of the board.
grid.board_layout is an array containing a dictionary of the form
{'piece': 'rook', 'colour': 'white'} where there is a piece and
containing None where there isn't.
Rook.grid_position is a tuple containing the grid coordinates of
the piece. The difference between the code for moving right:
for x in range(self.grid_position[0] + 1, grid.columns):
# Position to check
position = (x, self.grid_position[1])
# If there is nothing in the space it is available
if grid.board_layout[position[1]][position[0]] is None:
available_spaces[position[1]][position[0]] = True
# If there is a piece of the opposite colour in the space it is available, but further spaces are not
elif grid.board_layout[position[1]][position[0]]['colour'] != self.colour:
available_spaces[position[1]][position[0]] = True
break
# If there is a piece of the same colour in the space it is not available, neither are further spaces
else:
break
and for moving forward is just the definition of position:
position = (self.grid_position[0], y)
So you can certainly factor out a function looking something like this:
def update_line(chessman, grid, available_spaces, line_positions):
for position in line_positions:
# If there is nothing in the space it is available
if grid.board_layout[position[1]][position[0]] is None:
available_spaces[position[1]][position[0]] = True | {
"domain": "codereview.stackexchange",
"id": 35502,
"lm_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, chess",
"url": null
} |
forces, electric-fields, work, potential-energy, conventions
$$\text{from} \qquad F_e = -\frac{d U_r}{dr} \qquad \text{and} \qquad F_e = \frac{dW}{dr} \qquad \text{it follows} \qquad \boxed{dW = -dU_r} \tag 1$$
As you already mentioned, the work $W$ done by a conservative force equals the negative of the change in potential energy $\Delta U$
$$W = -\Delta U \tag 2$$
What is seems to me is that you are confused how come $dW$ in Eq. (1) and $W$ in Eq. (2) mean the same thing. Note that the well known equation for work
$$W = \int \vec{F} \cdot d\vec{r} \tag 3$$
actually comes from
$$dW = \vec{F} \cdot d\vec{r} \tag 4$$
You can read the Eq. (4) as follows: a force $\vec{F}$ over infinitesimal small displacement $d\vec{r}$ does infinitesimal small work $dW$. | {
"domain": "physics.stackexchange",
"id": 86995,
"lm_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, electric-fields, work, potential-energy, conventions",
"url": null
} |
Just because you get 6 heads in a row does not mean the next result would be a tail. What is the probability that the results are all heads or all tails? Found 2 solutions by solver91311, Alan3354: Answer by solver91311(23907) (Show Source): You can put this solution on YOUR website! 1/2 times 1/2 times 1/2 times 1/2 times 1/2. " It Cannot Be Determined 5096 Less Than 50%, Sincetails" Is Due To Come Up. This way of looking at probability is called the relative frequency estimate of a probability The interesting thing with this is that the more you flip the coin, the closer you get to 0. In general though, the expected number of flips before seeing n heads in a row is 2^(n+1)-2 The solution to the problem involves solving a system of equ. In that case, you want to know the total n. Question: A Fair Coin Has Come Up "heads" 10 Times In A Row. Walkthrough by MaGtRo August, 2008. row, rather than just 3 of either heads or tails in a row. As long as the coin was not manipulated the theoretical probabilities of both outcomes are the same—they are equally probable. For instance, flipping an coin 6 times, there are 2 6, that is 64 coin toss possibility. Home For instance if you are interested in the second column there is a 25% chance of losing two in a row if you toss the coin 2 times, and there is a 50% chance of losing two or more in a row if you toss the coin 4 times (but that includes cases where you have lost the first 2, the first 3, etc. But every time the coin lands tails. What is the probability of getting exactly two heads and two tails. In that question a fair coin is used, and it is thus a probability of$(1/2)^{10}$that heads will not appear in ten. What is the probability of getting at least 3 heads when flipping 4 coins? The reason being is we have four coins and we want to choose 3 or more heads. So each toss of a coin has a ½ chance of being Heads, but lots of Heads in a row is unlikely. This is the difference between a single toss probability, and the average of a large number of tosses. For | {
"domain": "redgiant.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.976310532836284,
"lm_q1q2_score": 0.8114537180429797,
"lm_q2_score": 0.831143054132195,
"openwebmath_perplexity": 361.56865089685897,
"openwebmath_score": 0.7884907126426697,
"tags": null,
"url": "http://usbn.redgiant.it/coin-flip-odds-in-a-row.html"
} |
algorithms, graphs, parameterized-complexity, vertex-cover
Title: Structural parametrization for weighted vertex cover Let $G$ be a graph which is a tree with $\ell$ added edges. I wish to show that VWVC ((Vertex-)Weighted Vertex cover) is FPT with respect to $\ell$. In particular, I'd like an algorithm running in $O(2^\ell n^c)$ time, where $n$ is the number of vertices and $c$ is a constant.
I tried to approach this by finding a tree and find VWVC there with polynomial time and then brute forcing the rest $\ell$ edges in $O(2^{\ell})$, unfortunately i found a counterexample very quickly. Also I attempted to somehow assign all edges a weight (maybe for $uv\in E$ set $w(uv)=w(u)+w(v)$) and compute the minimal spanning tree and do something with that but I couldn't show that this would yield optimal vertex cover either. I'm kinda lost. Any hints appreciated. Find the set $L$ containing the $\ell$ extra edges (actually, find any set $L$ of $\ell$ edges such that $G-L$ is a tree).
Let $C$ be an optimal solution.
For each edge $(u,v)$ in $L$, guess whether $u \in C$. If you guess "yes", add $u$ to a set $X$, otherwise add $v$ to $X$.
(Notice that it is possible for both $u$ and $v$ to be in $C$, but we do not need to explicitly consider this case).
Overall, there are at most $2^\ell$ distinct choices for the $\ell$ guesses.
At least one set $X^*$ among the guessed sets $X$ is a subset of $C$. | {
"domain": "cs.stackexchange",
"id": 17843,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, graphs, parameterized-complexity, vertex-cover",
"url": null
} |
quantum-field-theory, special-relativity, lagrangian-formalism, locality
We typically want locality because, especially when we also demand Lorentz invariance, locality is deeply related to causality. As you say, we typically don't want to allow for spacelike separated interactions because we could send signals back in time.
We typically don't want timelike separated interactions because they are just acausal--that would allow a field value in the future to interact with the field values now. Furthermore, if your theory is Lorentz invariant, then if you allow for timelike separated interactions you also have to allow for spacelike separated interactions.
There is research into non-local theories, and there is some evidence that quantum gravity is non-local. However, standard QFTs, in particular the Standard Model, are local in the above sense. | {
"domain": "physics.stackexchange",
"id": 23239,
"lm_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, special-relativity, lagrangian-formalism, locality",
"url": null
} |
c, compression
write_char(current_char);
current_char_count = 1;
}
previous_char = current_char;
}
if (current_char_count > 0) {
write_count(current_char_count);
}
To me this this clearer indicates the main purpose of reading characters until end of file, and by switching the if's around, I also clearer indicates that the main thingy is counting equal characters. And it is a clearer connection between the if and the else so that it is easier to see why we entered the else clause.
I've removed the reference related to MAX_COUNT as I consider it rather esoteric if you run this code on something with 2^64 repetitions of a single character. Another change is that I need to finish of the writing of the last count in an additional write_count() at the end. Still I think this reads somewhat easier than your implementation.
Optionally change brace style – This is totally a personal preference, and the main point is to keep bracing consistent, which you do! But I prefer having the opening brace on the same line in C, as I feel it make the code somewhat easier to read and slightly more compact.
Do however note that I still keep braces around one-line blocks, as you do.
Refactored code
Here is the complete refactored code (using opening braces on previous line):
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
const int BIT_SHIFT = 7;
const int LOWER_BITS = 0x7f;
const int HIGH_BIT = 0x80;
bool G_print_hex = false;
void write_char(int c)
{
if (printf(G_print_hex ? "0x%x " : "%c", c) < 0) {
perror("Error printing to stdout.");
exit(EXIT_FAILURE);
}
}
void write_count(uint64_t count)
{
int lower_bits = count & LOWER_BITS;
while (lower_bits != count || count > LOWER_BITS) {
write_char(lower_bits | HIGH_BIT);
count >>= BIT_SHIFT;
lower_bits = count & LOWER_BITS;
} | {
"domain": "codereview.stackexchange",
"id": 17715,
"lm_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, compression",
"url": null
} |
feature-engineering
Title: Are there any search algorithms for feature optimization similar to RFE, but which consider all possible combinations? Does anyone know any good search algorithms for feature optimization that search through every possible combination to find the optimal combination of features for maximum predictive power? (Permutations are not important).
So far I have been using Recursive Feature Elimination (RFE), which trains a model many times over and each time removes a feature with the least ranking. It is good but not perfect. Say for example we have a,b,c, it then goes to a,b and then a, but does not consider a,c.
There are hundreds of algorithms, but if you know one such, I would really appreciate it! Computational power is not that important, as I only need to run it once! This is implemented in mlxtend as ExhaustiveFeatureSelector: docs. | {
"domain": "datascience.stackexchange",
"id": 10271,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "feature-engineering",
"url": null
} |
c++, object-oriented, inheritance, polymorphism
I understand you want to edit your sources using menus, but I have no idea how your application organizes the data here.
If you really need the base class LightSource you may use RTTI to check whether your object is a IMovable or an IRotatable when creating the menu (dynamic_cast<IMovable*>(ptr) checks if ptr is a subclass of IMovable). | {
"domain": "codereview.stackexchange",
"id": 33333,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, object-oriented, inheritance, polymorphism",
"url": null
} |
torque
3) Why there is resultant force between $f$ and $F_2$ in the diagram and so for $f$ and $F_1$?
I am sorry to ask these basic concepts. Thanks a lot. Here author consider two extra oppositely directed forces along the rod for the seek of calulation. This two forces being oppositely directed, there will be no net force for this and would not cause any rotation of the rod. Now the combination force of $f$ and $F_2$ gives the resultant ${F_2}^{'}$ which makes an angel $\theta_1$ with the rod. similarly the forces $f$ and $F_1$ gives the resultant ${F_1}^{'}$. Now we know that when a force acting through the point of ratation, does not cause any torque i.e. there will be no rotation. | {
"domain": "physics.stackexchange",
"id": 24668,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "torque",
"url": null
} |
sql, sql-server, join
--INSERT INTO [DestinationDatabase].dbo.InvoiceDetailSizes (InvoiceDetailId, SizeId, Units, DateInserted)
SELECT
detail.Id InvoiceDetailId,
sz.Id SizeId,
buckets.Units,
GETDATE()
FROM #sizedInvoices src
INNER JOIN [DestinationDatabase].dbo.InvoiceHeaders header
ON src.InvoiceNumber = header.Number
INNER JOIN [DestinationDatabase].dbo.InvoiceDetails detail
ON src.InvoiceLine = detail.LineNumber
AND detail.InvoiceHeaderId = header.Id
INNER JOIN [DestinationDatabase].dbo.SizeRanges ranges
ON src.SizeRangeCode = ranges.Code
CROSS APPLY
(
SELECT
id SizeIndex,
CAST(item AS INT) Units
FROM [DestinationDatabase].dbo.BucketString(src.UnitsPerSize, 5, 1, 1)
) buckets
INNER JOIN [DestinationDatabase].dbo.Sizes sz
ON buckets.SizeIndex = sz.SizeRangeIndex
AND sz.SizeRangeId = ranges.Id
LEFT JOIN [DestinationDatabase].dbo.InvoiceDetailSizes dst
ON detail.Id = dst.InvoiceDetailId
AND sz.Id = dst.SizeId
WHERE buckets.Units <> 0
AND dst.id is null;
DROP TABLE #sizedInvoices | {
"domain": "codereview.stackexchange",
"id": 9795,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sql, sql-server, join",
"url": null
} |
noise
Title: What does clipping gaussian noise mean? I found the subject at here like this "Does clipping noise colour the spectrum"
When I researching for clipping noise.
But I can't understand because typically something has clipped means something has removed.
But he has some different point of view about this.
so I want to know what is the clipping noise and how to undertand the posing about "Does clipping noise colour the spectrum"?
update
Especially, I want to know the meanning about clipping gaussian noise.
Especially this part
IV. CLIPPING (CENSORING)
A. Clipped observations model If your noise has independent and identically distributed samples from a zero-mean distribution (for example Gaussian), it is white. Other definitions of white noise also require the distribution to be symmetrical, but that is not required for the spectrum to be flat. Clipping the samples of such white noise will only change the common probability distribution of the samples:
This will affect the mean of the distribution, but if both sides are clipped in a way that preserves the zero mean of the distribution, then there is no "coloring" of the spectrum by a 0 Hz peak and the noise remains white.
Example in Octave (MATLAB clone):
Create random variables from a Gaussian distribution:
N = 65536;
x = normrnd(zeros(N, 1), ones(N, 1));
Clip from above:
y = min(x, 1);
Clip symmetrically from below:
z = max(y, -1);
Plot values of Gaussian random variables (blue), clipped above (green), clipped symmetrically (red). Horizontal axis = index, vertical axis = value:
plot(1:N, x, 1:N, y, 1:N, z)
Plot spectrum of Gaussian random variables (blue), clipped above (green), clipped symmetrically (red). Horizontal axis = frequency, vertical axis = magnitude:
loglog(1:N/2, abs(fft(x)(1:N/2)), 1:N/2, abs(fft(y)(1:N/2)), 1:N/2, abs(fft(z)(1:N/2))); | {
"domain": "dsp.stackexchange",
"id": 2792,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "noise",
"url": null
} |
## Welcome to Mathematics Stack Exchange
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's built and run by you as part of the Stack Exchange network of Q&A sites. With your help, we're working together to build a library of detailed answers to every question about math.
We're a little bit different from other sites. Here's how:
This site is all about getting answers. It's not a discussion forum. There's no chit-chat.
Just questions...
up vote
Good answers are voted up and rise to the top.
The best answers show up first so that they are always easy to find.
accept
Accepting doesn't mean it's the best answer, it just means that it worked for the person who asked.
# When the numerator of a fraction is increased by 4, the fraction increases by 2/3....
When the numerator of a fraction is increased by $4$, the fraction increases by $2/3$. What is the denominator of the fraction?
I tried,
Let the numerator of the fraction be $x$ and the denominator be $y$.
Accordingly, $$\frac{x+4}y=\frac xy+\frac 23$$
I am not able to find the second equation.
Again, you've got a fine start:
You wrote: $$\frac{x+4}y=\color{red}{\frac xy}+\color{blue}{\frac 23}\tag{1}$$
But note that $$\frac{x+4}{y} = \color{red}{\frac xy} + \color{blue}{\frac 4y}\tag{2}$$
From $(1),(2),$ it must follow that $$\color{blue}{\frac 4y = \frac 23 } \iff 2y = 4\cdot 3 = 12 \iff y = \frac{12}{2} = 6$$
So the denominator, $y$ is $6$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9579122684798184,
"lm_q1q2_score": 0.8322598313958524,
"lm_q2_score": 0.8688267796346599,
"openwebmath_perplexity": 1035.1089680750451,
"openwebmath_score": 0.37631988525390625,
"tags": null,
"url": "http://math.stackexchange.com/tour"
} |
dna
D) Indeed, even when one looks at repeat elements derived from endogenous retroviruses, there are those that are of functional significance; Syncitin (which actually codes for a protein) is responsible for trophoblast fusion + placenta formation (See https://www.ncbi.nlm.nih.gov/pubmed/10693809 ) , and there are multiple repeats that themselves serve as enhancers of interferon response genes. See https://www.ncbi.nlm.nih.gov/pubmed/26941318 | {
"domain": "biology.stackexchange",
"id": 6593,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dna",
"url": null
} |
binary-trees, recursion
But now the node in question is 5, we've returned back up a level, so the stack is:
inOrderTraverseNode(Node(11), callback)
inOrderTraverseNode(Node(7), callback)
inOrderTraverseNode(Node(5), callback)
So the callback is called on 5, and now we continue execution, recursively traversing the right subtree. After that, that code returns, and eventually we have the stack:
inOrderTraverseNode(Node(11), callback)
inOrderTraverseNode(Node(7), callback)
And now we're finished with the left subtree, so we call the callback with 7.
And so on. So imagine the stack growing every time you call it on a subtree. Then you go back up, process that node, then head back down to the other subtree (growing the stack again), and processing that.
So what you're neglecting from your explanation is that after execution finishes, it goes back to the code that called it. So although it makes it down to 3, and processes fully there, that code was called from the call at 5, so it has to finish processing that call. Likewise for each further call up. This is the same process that brings you back to where you were after you call it. | {
"domain": "cs.stackexchange",
"id": 11393,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "binary-trees, recursion",
"url": null
} |
quantum-mechanics, quantum-field-theory, symmetry
(There is a subtlety regarding the arbitrary phase in passing from the real state $[\psi_t]$ to a representative vector $\psi_t$, but I will not enter into the details here.) Taking $t=0$ in (1), we have that $V\psi_0=\phi_0$. Since $\psi_0$ is arbitrary, the requirement above is
$$V U_t = U_t V \quad \mbox{for all $t\in \mathbb R$}\tag{2}$$
I.e., the action of the symmetry $S$ commutes with the time evolution.
Requirement (2) is the definition of a dynamical symmetry.
If $S$ is in turn a continuous symmetry, a quantum implementation of Noether theorem arises, but it is far form the initial question so I stop here.
QFT in Hilbert space (there are other more abstract formulations) is nothing but a quantum theory in a specific Hilbert space (usually taken as a Fock space) and where the algebra of observables is of a specific kind: generated by elementary observables called field operators.
In the case of a real scalar field, it is a map associating smooth real-valued functions on the spacetime $f: M \to \mathbb R$ to selfadjoint (essentially selfadjoint in general) operators
$$f \mapsto \Phi(f) = \int_{M} \Phi(x) f(x) d^4x$$
The notion of symmetry simply specialises to this context, so that it is still given in terms of unitary or antiunitary operators, but also it is often defined by fixing its action on the said elementary observables.
For instance if $T_y$ is the action of spacetime translations on smearing functions
$$(T_y f)(x) = f(x-y)$$
we can assume that there is a corresponding symmetry (unitary operator) $U_y :H \to H$ whose action is compatible with
$$U_y \Phi(f) U_y^{-1} = \Phi(T_y f)\tag{3}$$ | {
"domain": "physics.stackexchange",
"id": 62237,
"lm_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-field-theory, symmetry",
"url": null
} |
quantum-field-theory, group-representations, lorentz-symmetry, poincare-symmetry
The dynamics is still there but it's now it's hidden in the transformation from in to out states (the S matrix) instead of the Hamiltonian. | {
"domain": "physics.stackexchange",
"id": 29604,
"lm_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, group-representations, lorentz-symmetry, poincare-symmetry",
"url": null
} |
graphs, asymptotics, trees, binary-trees
Title: Can we construct a binary tree with width and height Θ(n)? we know this definition:
Given a binary tree, Width of a tree is maximum of widths of all levels.
Let us consider the below example tree.
1
/ \
2 3
/ \ \
4 5 8
/ \
6 7
For the above tree,
width of level 1 is 1,
width of level 2 is 2,
width of level 3 is 3
width of level 4 is 2.
So the maximum width of the tree is 3.
can we have a binary tree with Height $\Theta(n)$ and Width $\Theta(n)$
My solution:
is YES. for example a binary tree with one-node:
1
am i right? Statements about $\Theta$-classes are statements about the behaviour of an algorithm/data structure, as (in this case) $n$ gets large. Thus, a single example can never prove such a statement. You'd have to provide a set that contains examples that become arbitrarily large and behave as desired. (The set, however, doesn't have to contain an example for every value of $n$.)
So you should try to construct such a set of examples. (And if you fail constantly, try to find out why. This might lead to a proof that no such set exists, i.e. the claim is false.) | {
"domain": "cs.stackexchange",
"id": 3179,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "graphs, asymptotics, trees, binary-trees",
"url": null
} |
general-relativity, black-holes, metric-tensor, symmetry, time-dilation
Title: Time Dilation inside a hollow shell Assuming I have a hollow shell with total mass $M$ and radius $r$.
On the surface, the gravitational time dilation would be
$$\tau=t \cdot \sqrt{1-\frac{v_{esc}^2}{c^2}}$$
where
$$v_{esc} = \sqrt{\frac{2 \cdot G \cdot M}{r}}$$
but inside the shell there would be no gravitational field (Newton's shell theorem and Birkhoff's theorem).
But still, the escape velocity required to escape to infinity would be the same as on the surface, since inside the shell you could move without any accelerating or decelerating forces acting on you until you reach the surface, from where you would get pulled backwards.
So is the time dilation inside the hollow shell relative to a field free observer at infinity
zero (I assume it's not) or
the same as on the surface (my best guess), or
something completely different? | {
"domain": "physics.stackexchange",
"id": 44114,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, black-holes, metric-tensor, symmetry, time-dilation",
"url": null
} |
Trying to solve recurrence $T(n)=3T(n/3) + 3$
I'm trying to solve the following recurrence without using the Master Theorem:
$$T(1)=1;$$
$$T(n)=3T(n/3) + 3$$
My attempt:
$T(n) = 3T(n/3) + 3$
$= 3(3T(n/9) n/3)) + 3)$
$= 9T(n/9) + 9$
$= 9(3T(n/27 + n/9)) +9$
$= 27T(n/27) + 9$
$...$
I know this is wrong but I'm stuck here. Thanks.
• Why the second line is $3(3T(n/9) n/3)) + 3)$ and not $3(3T(n/3)+3)+3$? – Phicar May 1 '16 at 2:14
• Sorry I'm trying to figure out how to do this – Carlo May 1 '16 at 2:16
• You must replace $k$ times the recurrence you have and see what should be $k$ in order to stop the recurrence and use $T(1)=1$. So, if $k=3$ $T(n)=3T(n/3)+3=3(3T(n/3^2)+3)+3=3(3(3T(n/3^3)+3)+3)+3=3^3T(n/3^3)+3+3^2+3^3$..so, do it in general for $k$ and the geometric sum will be helpful. – Phicar May 1 '16 at 2:23
• I see. so what would Theta class would that be then? Theta(nlogn)? – Carlo May 1 '16 at 2:26
• What expression do you have at the end? If you guess is that complexity, try to prove it by induction. – Phicar May 1 '16 at 2:31 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9861513910054508,
"lm_q1q2_score": 0.838200251567605,
"lm_q2_score": 0.8499711699569787,
"openwebmath_perplexity": 300.85450309544916,
"openwebmath_score": 0.9979469776153564,
"tags": null,
"url": "https://math.stackexchange.com/questions/1766187/trying-to-solve-recurrence-tn-3tn-3-3"
} |
performance, sql, mysql
The problem is that this query is very slow (from 5 to 20 seconds) when I have over 5k COORDINATES and it does not returns all couriers sometimes. According to your description, you are only interested in each courier's delivery with the latest start date (if one exists) and each delivery's latest coordinates (if one exists). So, you should be able to simplify things by limiting those tables before joining.
Ignoring the remaining order count column for now…
SELECT c.`COURIER_ID`,
last_delivery_by_courier.`DELIVERY_ID`,
last_coordinates_by_delivery.`LAT`,
last_coordinates_by_delivery.`LNG`
FROM `COURIERS` AS c
LEFT JOIN (
SELECT d.`COURIER_ID` AS `COURIER_ID`,
MAX(d.`DELIVERY_ID`) AS `DELIVERY_ID`
FROM `DELIVERIES` AS d
GROUP BY d.`COURIER_ID`
ORDER BY d.`START_DATE` DESC
LIMIT 1
) AS last_delivery_by_courier
ON last_delivery_by_courier.`COURIER_ID` = c.`COURIER_ID`
LEFT JOIN (
SELECT coord.`DELIVERY_ID` AS `DELIVERY_ID`,
AVG(coord.`LAT`) AS `LAT`,
AVG(coord.`LNG`) AS `LNG`
FROM `COORDINATES` AS coord
GROUP BY coord.`DELIVERY_ID`
ORDER BY coord.`DATE` DESC
LIMIT 1
) AS last_coordinates_by_delivery
ON last_coordinates_by_delivery.`DELIVERY_ID` = last_delivery_by_courier.`DELIVERY_ID`
ORDER BY last_delivery_by_courier.`START_DATE` DESC | {
"domain": "codereview.stackexchange",
"id": 9398,
"lm_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, sql, mysql",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.