text stringlengths 1 1.11k | source dict |
|---|---|
quantum-mechanics, waves, wavefunction, schroedinger-equation, complex-numbers
(image source)
What is shown as a circular thing that rotates for $e^{i\omega t}$ is the phasor that represents the value of the wavefunction at a given (single!) point of space. Phasors are used not only for quantum mechanical wavefunctions: this concept originated in the theory of electric circuits, and is also useful for treatment of other types of waves—even real-valued—e.g. electromagnetic.
What makes quantum mechanical wavefunction special is that it's not usually observable, only its absolute value is. But the effect of interference of quantum particles, like in the double-slit experiment, makes it necessary to introduce an additional parameter to capture this kind of effects. This parameter is the phase, and it's the thing that makes the phasor rotate in the animations you see in the resources on quantum mechanics. | {
"domain": "physics.stackexchange",
"id": 68060,
"lm_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, waves, wavefunction, schroedinger-equation, complex-numbers",
"url": null
} |
performance, algorithm, vba, excel
With wsImport.UsedRange
Set importHeaderRng = .Rows(1) 'Import - Headers
importLastRow = getMaxCell(wsImport.UsedRange).Row 'Import - Total Rows
End With
With wsFinal.UsedRange
finalHeaderRow = .Rows(1) 'Final - Headers (as Array)
Set finalHeaderRng = .Rows(1) 'Final - Headers (as Range)
End With
With wsIndex.UsedRange 'Transpose col 3 from Index (without the header), as column names in Import
Set indexHeaderCol = .Columns(3).Offset(1, 0).Resize(.Rows.Count - 1, 1)
wsImport.Range(wsImport.Cells(1, 1), wsImport.Cells(1, .Rows.Count - 1)).Value2 = Application.Transpose(indexHeaderCol)
End With
applyColumnFormats bImport 'Apply date and number format to Import sheet
If Len(bImport.Cells(2, 1).Value2) > 0 Then 'if Import sheet is not empty (excluding header row)
With Application | {
"domain": "codereview.stackexchange",
"id": 26754,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, algorithm, vba, excel",
"url": null
} |
special-relativity, inertial-frames, time-dilation
Transverse case
The analysis of the period of $p'$ of the transverse clock is the traditional one: the time required to complete the trip (out and back) is
\begin{align}
p'
&= \frac{\sqrt{(2l)^2 + (vp')^2}}{c}\\
&= \sqrt{\left(\frac{2l}{c}\right)^2 + \left(\beta p'\right)^2} \\
&= p \sqrt{1 + \left( \beta \frac{p'}{p}\right)^2} \;,
\end{align}
so that
\begin{align}
\left(\frac{p'}{p} \right)^2
&= 1 + \left(\beta \frac{p'}{p}\right)^2\\
\frac{p'}{p}
&= \left(1 - \beta^2 \right)^{-1/2} \\
&= \gamma\;.
\end{align}
Longitudinal case
To find the period $P'$ of the longitudinal clock we have to do a bit more figuring. The elapsed time $T_f$ for the forward going half of the journey is
$$ T_f' = \frac{L' + v T_f'}{c} \;,$$
and for the backward going half of the journey the time $T_b$ required is
$$ T_b' = \frac{L' - v T_b'}{c} \;.$$
After a little figuring we get the period as
\begin{align}
P'
&= \frac{L'}{c(1 - \beta)} + \frac{L'}{c(1 + \beta)}\\
&= \frac{2L'}{c(1 - \beta^2)} . | {
"domain": "physics.stackexchange",
"id": 63289,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, inertial-frames, time-dilation",
"url": null
} |
catkin, rosmake, rosbuild
No Makefile in package rosconsole
[rosmake-0] Starting >>> pluginlib [ make ]
[rosmake-2] Finished <<< message_runtime ROS_NOBUILD in package message_runtime
No Makefile in package message_runtime
[rosmake-2] Starting >>> std_msgs [ make ]
[rosmake-0] Finished <<< pluginlib ROS_NOBUILD in package pluginlib
No Makefile in package pluginlib
[rosmake-2] Finished <<< std_msgs ROS_NOBUILD in package std_msgs
No Makefile in package std_msgs
[rosmake-2] Starting >>> rosgraph_msgs [ make ]
[rosmake-7] Starting >>> geometry_msgs [ make ] | {
"domain": "robotics.stackexchange",
"id": 15956,
"lm_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, rosmake, rosbuild",
"url": null
} |
graph-neural-networks, variance-reduction
Is this the right way to take the mean of the model's F1 scores?
How to reduce this variance?
I have followed the steps mentioned here. I must use a NN. I increased the weight decay (L2) values without any success.
The seeds themselves were randomly sampled. So each time I run the script, I get a different value of the average F1 score.
Now I am not sampling the seeds each time. I have fixed those values.
The high variance is because of the model's sensitivity to the training data. In PU-Learning, we sparsely label(~1%) the positive data for training. Especially in the case of graph datasets, the model performance is sensitive to which nodes have been labelled.
So, variance is at least fixed for the given set of seeds. Now I get identical values each time I run the script. | {
"domain": "ai.stackexchange",
"id": 3645,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "graph-neural-networks, variance-reduction",
"url": null
} |
Thanx to @Rohan for the hint.
$$\tan^{-1}:\mathbb{R}\to \Big(\frac{-\pi}{2},\frac{\pi}{2}\Big)$$
Taking, $$\alpha=\tan^{-1}x\implies x=\tan\alpha\text{ , where }\tfrac{-\pi}{2}<\alpha<\tfrac{\pi}{2}\\ \beta=\tan^{-1}y\implies{y}=\tan\beta\text{ , where }\tfrac{-\pi}{2}<\beta<\tfrac{\pi}{2}\\$$ For,
$$\tan^{-1}x+\tan^{-1}y=\tan^{-1}\frac{x+y}{1-xy}$$
$\implies-\pi<\alpha+\beta<\pi$. $$\tan(\alpha+\beta)=\frac{\tan\alpha+\tan\beta}{1-\tan\alpha\tan\beta}=\frac{x+y}{1-xy}\\$$
If $\tfrac{-\pi}{2}<\alpha+\beta<\tfrac{\pi}{2}$, $$\alpha+\beta=\tan^{-1}\bigg(\frac{\tan\alpha+\tan\beta}{1-\tan\alpha\tan\beta}\bigg)\implies \tan^{-1}x+\tan^{-1}y=\tan^{-1}\frac{x+y}{1-xy}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9744347838494566,
"lm_q1q2_score": 0.820304190685069,
"lm_q2_score": 0.8418256452674008,
"openwebmath_perplexity": 228.129824894632,
"openwebmath_score": 0.8562713861465454,
"tags": null,
"url": "https://math.stackexchange.com/questions/2604703/derive-the-conditions-xy1-for-tan-1x-tan-1y-tan-1-fracxy1-xy?noredirect=1"
} |
python, pygame
clock = pygame.time.Clock()
run = True
while run == True:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
if event.type == E1:
B_SPAWN = random.uniform(1000, 6000)
pygame.time.set_timer(E1, 1 * int(B_SPAWN))
bullet = pygame.Rect(0, 280, BULLET_WIDTH, BULLET_HEIGHT)
BULLETS_L.append(bullet) | {
"domain": "codereview.stackexchange",
"id": 44446,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, pygame",
"url": null
} |
fluid-dynamics, viscosity
$$ \rho(\partial_t \boldsymbol u + u\cdot\nabla \boldsymbol u) = -\nabla p \ \ \ ,\ \ \ \nabla\cdot \boldsymbol u = 0$$
Now, it could seem that this implies the flow is automatically a high-Reynolds number flow (for which we could have written down the same equation, but for a different reason: $\mu=\rho\nu\simeq 0$, and this would have been an approximation). But, even if the viscosity is far from neglectable, we can make another kind of approximation, saying that the inertia, represented by the left-hand-side terms in N-S equation, can be neglected because of $Re=UL\rho/\mu\ll 1$ (this can happen in a lot of situations: microobjects, extra-slow flows, and - of course - high viscosity. In this case, the equations of motion become: $$-\nabla p = \boldsymbol 0\ \ \ ,\ \ \ \nabla\cdot \boldsymbol u = 0$$
which are, in fact, the equations we would arrive at if we started by the Stokes equation (for inertia-less flows) for irrotational flows. | {
"domain": "physics.stackexchange",
"id": 19404,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, viscosity",
"url": null
} |
c, io
Anyway, on to a few review points:
Your loop is way overcomplicated. scanf returns the number of tokens extracted. The idiomatic way to use scanf (and fscanf) is to use it as the loop control
note that it's typically a good idea to do scanf() > 0 rather than scanf() implicitly since scanf can return EOF which typically evaluates to true
Really you should do scanf() == n where n is the expected number of tokens. For simple IO like this though, that's likely overkill. In more complicated cases though, you might need to be aware of how many tokens scanf read.
The instructions never specified that a small number if 2 digits. That's a dangerous assumption. It likely meant small to mean "fits in an int." That's their fault for not being more specific. | {
"domain": "codereview.stackexchange",
"id": 5442,
"lm_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, io",
"url": null
} |
quantum-field-theory
In the textbook, Compact version (periodic) is Natural version of QED which is related with charge quantization.
Here i have a few basic question.
1 : Why periodicity gives compactness?
2 : What is the physical difference or usefulness of compact or Non-compact QED?
(Is this compact concept is only related with the lattice theory?)
3 : Is periodicity of $A_{x,\alpha}$ really related with charge conservation?
My guess from equation 4.32 in textbook, which is
\begin{align}
q_0 = \frac{1}{2\pi} \oint_{L} A_{x, \delta}
\end{align}
The periodicity of $A_{x,\alpha}$ gives some number after loop integral. $i.e$, (ration for certain loop) 1 : When $A$ is restricted to $[-\pi,\pi)$, the group of gauge transformations is the compact $\mathrm{U}(1)$ group. (Roughly speaking, to be compact, a group needs to be bounded.) In the nonperiodic theory, the gauge group is the group of real numbers under addition, which is noncompact. | {
"domain": "physics.stackexchange",
"id": 24380,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory",
"url": null
} |
digital-communications, digital
Title: Transmission Bandwidth and Sampling frequency In LTE standards, for a transmission bandwith of 2.5 MHz, the sampling frequency is 3.84 MHz. I was wondering with this choice, are we violating Nyquist theorem?
I found the details in the following link (page 15)
http://www.freescale.com/files/wireless_comm/doc/white_paper/3GPPEVOLUTIONWP.pdf
I would have assumed that with a bandwith of 2.5 MHz, then the channel sampling frequency (signal input sampling frequency) should be at least 5 MHz?
Thanks. Complex (I/Q) signal processing is used in this case. With a complex-valued signal sampled at a rate $B \text{ Hz}$, you can unambiguously represent a total bandwidth of $B \text{ Hz}$.
What you're thinking of is the real-valued signal case, where a signal sampled at $B \text{ Hz}$ can unambiguously represent a total bandwidth of $\frac{B}{2} \text{ Hz}$. This is the most common statement of the Nyquist theorem, but it only holds for real-valued signals. | {
"domain": "dsp.stackexchange",
"id": 5478,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "digital-communications, digital",
"url": null
} |
is of course dependent if the determinant is zero. Since these unknowns can be picked independently of each other, they generate n − r(A − λI) linearly independent eigenvectors.In Example 2, A is a 3 × 3 matrix (n = 3) and λ = 1 is an eigenvalue of multiplicity 2. There are some algorithms for computing At. Both A and D have identical eigenvalues, and the eigenvalues of a diagonal matrix (which is both upper and lower triangular) are the elements on its main diagonal. This is equivalent to showing that the only solution to the vector equation(4.11)c1x1+c2x2+⋯+ck−1xk−1+ckxk=0is c1 = c2 = ⋯ = ck− 1 = ck = 0. In Problems 1−16 find a set of linearly independent eigenvectors for the given matrices. We are ready to answer the question that motivated this chapter: Which linear transformations can be represented by diagonal matrices and what bases generate such representations? Thus, n − r(A − I) = 3 − 1 = 2 and A has two linearly independent eigenvectors associated with λ = 1. From, the | {
"domain": "aobindia.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.990440598395557,
"lm_q1q2_score": 0.812055652780913,
"lm_q2_score": 0.8198933425148213,
"openwebmath_perplexity": 606.9326889357603,
"openwebmath_score": 0.8793156147003174,
"tags": null,
"url": "https://aobindia.com/9qg3z/1c3c45-two-eigenvectors-of-a-matrix-are-always-linearly-independent"
} |
javascript, jquery, validation
function processuploadControl() {
let uploadcontrol = $("#upImport").data("kendoUpload"),
files = uploadcontrol.getFiles();
if (files.length != 0) {
var counter = 0;
$('.k-file-success[data-fileManagerIds]').each(function (kfile) {
let filemanagerid = this.dataset.filemanagerids;
let hdfilemanagerid = $('<input>').attr({
type: 'hidden',
name: 'fileManagerIds[' + counter + ']',
id: 'fileManagerIds',
value: filemanagerid
});
$("#permissionsRequestForm").append(hdfilemanagerid);
counter++;
});
}
}
function processsubmitForm() {
dialogisVisible = false;
var dialog = $("#Dialog").data("kendoDialog");
dialog.close();
$("#permissionsRequestForm").submit();
}
function closeDialog() {
dialogisVisible = false;
var dialog = $("#Dialog").data("kendoDialog");
dialog.close();
} | {
"domain": "codereview.stackexchange",
"id": 43597,
"lm_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, validation",
"url": null
} |
object-oriented, api, lua, minecraft, turtle-graphics
turtle.forward()
end
function repairBI()
turtle.select(1)
x = 1
if turtle.getItemCount(x) == 0 then
repeat turtle.select(x+1)
x = x + 1
if x == 17 then
x = 1
y = 2
end
if y == 16 then
os.reboot()
end
until turtle.getItemCount(x) > 0
end
if turtle.compareUp() == false then
placeup()
turtle.turnLeft()
else
turtle.turnLeft()
end
if turtle.compare() == false then
placef()
turtle.turnRight()
else
turtle.turnRight()
end
turtle.forward()
end | {
"domain": "codereview.stackexchange",
"id": 31997,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "object-oriented, api, lua, minecraft, turtle-graphics",
"url": null
} |
energy, work
Title: Energy, time and force Consider force $F$ acting on a body of mass 1000kg and the displacement be $s$. So energy required to do so is $F$x $s$. Now consider the same force causing same displacement on body of mass 1kg. Here to energy required(according to equation) is same. But certainly more energy is required in the first case. How is this possible? Does it mean that no more energy is needed for prolonged application of force? This is the main reason I don't understand why work/energy is force times displacement .Instead force times time makes more sense to me. You have to realize that the two bodies will reach a different final speed. Both will have the same kinetic energy (equal to the work of the force), but the larger one will have a considerably smaller speed. | {
"domain": "physics.stackexchange",
"id": 12891,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "energy, work",
"url": null
} |
java, beginner, game, playing-cards
//constructor
public Board(){
}
//methods
protected void setBoardCard(Card card, int cardNum){
this.board[cardNum] = card;
}
protected Card getBoardCard(int cardNum){
return this.board[cardNum];
}
protected void setBurnCard(Card card, int cardNum){
this.burnCards[cardNum] = card;
}
protected Card getBurnCard(int cardNum){
return this.burnCards[cardNum];
}
protected int boardSize(){
return board.length;
}
protected void printBoard(){
System.out.println("The board contains the following cards:");
for(int i =0; i<board.length;i++){
System.out.println(i+1 + ": " + getBoardCard(i).printCard());
}
System.out.println("\n");
} | {
"domain": "codereview.stackexchange",
"id": 173,
"lm_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, beginner, game, playing-cards",
"url": null
} |
stabilizer-code, stim, surface-code
So my questions are, how significant are these time-boundary effects which warrant $3d$ rather than $d$ rounds of stabilizer measurements and when using $3d$ rounds of stabilizer measurements how do we get the logical error rate of just that middle code cell?
*how significant are these time-boundary effects which warrant $3d$ rather than $d$ | {
"domain": "quantumcomputing.stackexchange",
"id": 4810,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "stabilizer-code, stim, surface-code",
"url": null
} |
performance, statistics, r
227684L, 230185L, 230186L, 232687L, 232688L, 235189L, 235190L,
237691L, 237692L, 240193L, 240194L, 242695L, 242696L, 245197L,
245198L, 247699L, 247700L, 250201L, 250202L, 252703L, 252704L,
255205L, 255206L, 257707L, 257708L, 260209L, 260210L, 262711L,
262712L, 265213L, 265214L, 267715L, 267716L, 270217L, 270218L,
272719L, 272720L, 275221L, 275222L, 277723L, 277724L, 280225L,
280226L), class = "data.frame") | {
"domain": "codereview.stackexchange",
"id": 29579,
"lm_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, statistics, r",
"url": null
} |
homework-and-exercises, quantum-field-theory, supersymmetry, spinors
\end{gather}
But since $\bar{\psi}^{c}\gamma_{5}\psi^{a}=\bar{\psi}^{a}\gamma_{5}\psi^{c}$, the last term in the above expression vanish. Thus, one ends up with
$$f_{abc}\left(\bar{\epsilon}\gamma_{\mu}\psi^{a}\right)\left(\bar{\psi}^{b}\gamma^{\mu}\psi^{c}\right)=f_{abc}\bar{\epsilon}\gamma_{\mu}\left[(\psi^{a}\bar{\psi}^{b})(\gamma^{\mu}\psi^{c})\right]=-f_{abc}\left(\bar{\psi}^{a}\gamma^{\mu}\psi^{c}\right)\left(\bar{\epsilon}\gamma_{\mu}\psi^{b}\right)=f_{abc}\left(\bar{\psi}^{c}\gamma^{\mu}\psi^{a}\right)\left(\bar{\epsilon}\gamma_{\mu}\psi^{b}\right),$$
which is trivially correct due to the cyclic property of $f_{abc}$.
Other than using the Fierz identity to rearrange the spinors, I cannot find any other way to prove equation (1).
Did I make any mistakes in the above derivations?
If not, how to prove (1)? tldr; It seems to me your are counting the legs of a millipede and dividing by a thousand. (1) holds because the l.h.s. is minus half itself. | {
"domain": "physics.stackexchange",
"id": 59846,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, quantum-field-theory, supersymmetry, spinors",
"url": null
} |
java, android
Naming
well, thats just me being picky, but one-letter-variables (i, v, etc) are no more used today since very IDE provides code completion!
Android Activity Life Cycle
have a look at the Android Activity Life Cycle and take a thought on what happens to the input, if your Activity is unplanned closed? Your Input will be wiped. But you have left open the requirements for that, so feel free to just look a bit deeper into android and take that point for further projects :-) | {
"domain": "codereview.stackexchange",
"id": 42865,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, android",
"url": null
} |
c, linked-list, generics, collections, macros
FMOD bool PFX##_push_front(SNAME *_list_, V element) \
{ \
SNAME##_node *node = PFX##_new_node(_list_, element); \
\
if (!node) \
return false; \
\
if (PFX##_empty(_list_)) \
{ \
_list_->head = node; \
_list_->tail = node; \ | {
"domain": "codereview.stackexchange",
"id": 34160,
"lm_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, linked-list, generics, collections, macros",
"url": null
} |
My approach would be: \begin{align} \min\>&- f(\color{darkred}x)+\sum_j \color{darkblue}p^-_j \color{darkred}s^-_j +\sum_j \color{darkblue}p^+_j \color{darkred}s^+_j\\ &\sum_i \color{darkblue}a_{i,j}\color{darkred}x_{i,j} = 10 -\color{darkred}s^-_j + \color{darkred}s^+_j&&\forall j\\ &\color{darkred}s^-_j,\color{... 11 Let x_{p,\ell} be the continuous variables in your table. Introduce integer variables y_{p,\ell} and binary variables z_{p,\ell}, and impose linear constraints \begin{align} -z_{p,\ell} \le x_{p,\ell} - y_{p,\ell} &\le z_{p,\ell} &&\text{for all p and \ell} \tag1 \\ \sum_\ell z_{p,\ell} &\le 1 &&\text{for all p} \tag2 \... 10 If you want to use the KKT conditions for the solution, you need to test all possible combinations. This is why in most cases, we use the KKT's to validate that something is an optimal solution, since the KKT's are the first-order necessary conditions for optimality. For convex nonlinear optimization, you are better off using sequential quadratic | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.944176857294597,
"lm_q1q2_score": 0.8236502136599361,
"lm_q2_score": 0.8723473862936942,
"openwebmath_perplexity": 715.1600815821001,
"openwebmath_score": 0.887856662273407,
"tags": null,
"url": "https://or.stackexchange.com/tags/constraint/hot?filter=all"
} |
javascript, algorithm, html, sorting
if (attachment < firstNo) {
newNumb.unshift(attachment);
oldNumb.pop();
} else if (attachment > lastNo) {
newNumb.push(attachment);
oldNumb.pop();
} else if (attachment > firstNo && attachment < lastNo) {
//Binary Search....
low = 0;
high = newNumb.length - 1;
mean = Math.round((low + high) / 2);
reco();
}
if (i == n * pointer) {
console.log(
".......... Process='sorting-data'; Type='numbers'; Quantity='" +
(z + 1) +
"'; Phase: " +
n +
"/10 .........."
);
console.log(" ");
n = n + 1;
}
}
console.log(
"...................................................................................................."
); | {
"domain": "codereview.stackexchange",
"id": 42569,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, algorithm, html, sorting",
"url": null
} |
Lemma 14 ${SL_2({\bf R})}$ contains a lattice isomorphic to the free group ${F_2}$ on two generators.
Indeed, from this lemma, Proposition 9, and Exercise 20, we conclude that ${SL_2({\bf R})}$ does not have property (T).
A proof of the above lemma is given in the exercise below.
Exercise 23 Let ${\Gamma}$ be the subgroup of ${SL_2({\bf Z})}$ (and hence of ${SL_2({\bf R})}$) generated by the elements ${a := \begin{pmatrix} 1 & 2 \\ 0 & 1\end{pmatrix}}$ and ${b := \begin{pmatrix} 1 & 0 \\ 2 & 1 \end{pmatrix}}$. | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9940889309686339,
"lm_q1q2_score": 0.8032906701740407,
"lm_q2_score": 0.8080672112416737,
"openwebmath_perplexity": 84.97322490766847,
"openwebmath_score": 0.9605917930603027,
"tags": null,
"url": "https://terrytao.wordpress.com/2011/12/06/254b-notes-2-cayley-graphs-and-kazhdans-property-t/"
} |
matlab, audio, dct
Title: High energy coefficients in 1d DCT for audio I've been reading a little bit about how DCT works in image compression using the 2D transform, however I don't know how this applies to audio using a 1D transform.
Suppose I have an audio segment, I mean, some samples of a mono audio vector.
Ai = [-0.0288,-0.0304,-0.0354,-0.0406,-0.0469,-0.0518,-0.0647,-0.0831 ...]
And then I calculate 1D DCT on that vector.
R = dct(Ai)
The result would be something like this:
0.2143 -0.3158 -0.6354 -0.3877 0.5503 0.2330 -0.1690 0.0203 | {
"domain": "dsp.stackexchange",
"id": 1804,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matlab, audio, dct",
"url": null
} |
turing-machines, automata
machine = DTM(
states={'q0', 'q1', 'q2', 'q3'},
input_symbols={'a', 'b'},
tape_symbols={'a', 'b', 'x', 'y', '.'},
transitions={
'q0': {
'a': ('q1', 'x', 'R'),
'y': ('q0', 'y', 'R')
},
'q1': {
'a': ('q1', 'a', 'R'),
'b': ('q2', 'y', 'L'),
'y': ('q1', 'y', 'R'),
'.': ('q3', '.', 'L'),
},
'q2': {
'a': ('q2', 'a', 'L'),
'x': ('q0', 'x', 'R'),
'y': ('q2', 'y', 'L'),
}
},
initial_state='q0',
blank_symbol='.',
final_states={'q3'}
) | {
"domain": "cs.stackexchange",
"id": 20550,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "turing-machines, automata",
"url": null
} |
c, unix, to-do-list, topological-sorting
/* compare tasks */
static int
comparetask(const void *a, const void *b)
{
struct Task *taska, *taskb;
time_t timea, timeb;
time_t tmpa, tmpb;
taska = *(struct Task **)a;
taskb = *(struct Task **)b;
tmpa = (taska->due != 0) ? (taska->due - today) / SECS_PER_DAY : DAYS_PER_WEEK;
tmpb = (taskb->due != 0) ? (taskb->due - today) / SECS_PER_DAY : DAYS_PER_WEEK;
timea = timeb = 0;
if (tmpa < 0) {
tmpa = -tmpa;
while (tmpa >>= 1) {
--timea;
}
} else {
while (tmpa >>= 1) {
++timea;
}
}
if (tmpb < 0) {
tmpb = -tmpb;
while (tmpb >>= 1) {
--timeb;
}
} else {
while (tmpb >>= 1) {
++timeb;
}
}
timea -= taska->pri;
timeb -= taskb->pri;
if (timea < timeb)
return -1;
if (timea > timeb)
return +1;
return 0;
} | {
"domain": "codereview.stackexchange",
"id": 41968,
"lm_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, unix, to-do-list, topological-sorting",
"url": null
} |
r
buy_trades[i,"match_vol"] <<- buy_match_units + sell_unmatch_units
sell_trades[sell_index,"match_status"] <<- "FULL"
break
}
sell_match_units <- strtoi(sell_trades[sell_index,"match_vol"]) #
sell_unmatch_units <- sell_units - sell_match_units
}
# Returning the result
buy <<- buy_trades
sell <<- sell_trades
} | {
"domain": "codereview.stackexchange",
"id": 20108,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "r",
"url": null
} |
java, spring
Title: Key to Value / Value to Key - java I want to get the key from value / and value from key ,can anyone help to do in better way ? or can we implement the below code using java enum or spring or apache enumutils or java generic ?
Note : I used to get string from frond end(.jsp) and I want to store store this value into database table as integer.
Frond end Database table
Admin --- 1
Manager --- 2
Employee --- 3
import java.util.HashMap;
import java.util.Map;
public class MyRole {
static HashMap<Integer,String> result= new HashMap<Integer,String>();
static{
result.put(1,"Admin");
result.put(2,"Manager");
}
public static int getId(String role){
Integer key=-1;
for(Map.Entry entry: result.entrySet()){
if(role.equals(entry.getValue())){
key = (Integer) entry.getKey();
break;
}
}
return key; | {
"domain": "codereview.stackexchange",
"id": 16768,
"lm_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, spring",
"url": null
} |
## Deriving the volume and surface area of a cone
Hello, this is my first time posting on physics forums, so if I do something wrong, please bear with me :)
I am trying to derive the formula for the lateral surface area of a cone by cutting the cone into disks with differential height, and then adding up the lateral areas of all of the disks/cylinders to find the lateral area of the cone. (Similar to using the volume of revolution, but just taking the surface area). I assumed that the heights of each of the disk was dH, where H = the height of the cone. However, using that method, I got pi*radius*height instead of pi*radius*(slant height). | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9763105314577313,
"lm_q1q2_score": 0.8661871942271782,
"lm_q2_score": 0.8872045996818986,
"openwebmath_perplexity": 452.3127534107478,
"openwebmath_score": 0.833489179611206,
"tags": null,
"url": "http://www.physicsforums.com/showthread.php?s=3e9f850247158ce74e5c4c2340be720a&p=4029438"
} |
human-biology, immune-system
Title: What is the name of this series? My biology teacher used to show us videos (actually animations) on the human immune system. What I remember is that one video was on a virus (represented as a purple colored sphere with spikes) that a woman (who is a part of a music band) inhales in an elevator when a man sneezes.
The documentary shows how the virus travels to her throat and enters one cell, multiplies, and spreads. Then the video shows how white blood cells and T-cells defend the body. In the end, when she drinks coffee, she leaves the virus on a coffee mug and her friend takes on that virus when he drinks from the same mug.
Other videos of the same series include a documentary on fractures, another one on obesity, another one on a disease transmitted when one eats chicken, etc. Can someone tell me what is the name of that series?
I think (not sure) it is a national geographic series? The Body Story.
--Have to add some characters for the system to be happy-- | {
"domain": "biology.stackexchange",
"id": 6798,
"lm_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, immune-system",
"url": null
} |
ros
<arg name="map_file" default="map_folder/your_map_file.yaml"/>
<node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />
<arg name="initial_pose_x" default="0.0"/>
<arg name="initial_pose_y" default="0.0"/>
<arg name="initial_pose_a" default="0.0"/>
<include file="$(find turtlebot_navigation)/launch/includes/amcl.launch.xml">
<arg name="initial_pose_x" value="$(arg initial_pose_x)"/>
<arg name="initial_pose_y" value="$(arg initial_pose_y)"/>
<arg name="initial_pose_a" value="$(arg initial_pose_a)"/>
</include>
<include file="$(find turtlebot_navigation)/launch/includes/move_base.launch.xml"/>
</launch> | {
"domain": "robotics.stackexchange",
"id": 22490,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
evolution, metabolism, ecology, extinction
With those two general patterns, one can say that the rate of evolution decreases with increased metabolism.
Now onto dinosaur evolution. You said that R. Bakker observed that dinosaurs had a higher rate of evolution than expected. With the hypothesis that a higher metabolism caused this. I'll assume they had the same physiological constraints as animals of today, which is reasonable considering they are ancestors of birds. Which everything I just laid out I would propose R. Bakker hypothesis is false, since a higher metabolism means a higher generation time and lower mutation rates, which would lead to decreased rate of evolution.
The latest science says that dinosaurs were endothermic (regulate their own temperature) up to a point (Witze 2014), so their internal temperatures were not as warm as mammals, but probably warmer than most fish and reptiles. | {
"domain": "biology.stackexchange",
"id": 5855,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "evolution, metabolism, ecology, extinction",
"url": null
} |
waves, acoustics
We can even chirp the grating to get essentially any frequency response of the reflexion that we like. This is what is done in one-dimensional gratings in one-moded fibre optic waveguides. Leon Paladian at the University of Sydney came up with a general method to design the band structure of the photonic crystal (grating) to achieve a given frequency response in the Mid 1990s. Check his personal page (and here) for publications in this field. I should declare a friendship with Leon, but was not involved in this particular work. | {
"domain": "physics.stackexchange",
"id": 10856,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "waves, acoustics",
"url": null
} |
human-biology, biochemistry, inflammation
Titanium has remarkable biocompatibility with internal bone implant, its already low reactivity actually gets better as its surface oxidizes as it becomes slightly polarized and will incorporate many cellular surface molecules(passivation). Many of the factors that make titanium useful in this way are still being studied. | {
"domain": "biology.stackexchange",
"id": 8264,
"lm_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, biochemistry, inflammation",
"url": null
} |
php
?>
I've written the code as above, but I don't really like it. Is there a way to write it better? I'm talking about the foreach loop. A few things first:
$menu_item == $active_item should probably be $menu_item[0] == $active_item
Depending on where that array is coming from, it should probably be associative. Imagine if you came across the code out of context. You'd quickly find yourself wondering what in the world menu_item[0] and menu_item[1] are. menu_item['name'] and menu_item['down'] would be much more descriptive (or something like that).
if (... && $x == true) {} is identical to if (... && $x) { }. Don't include the implicit truth comparison. The only time you should compare against booleans is if you're wanting to compare type too. if ($result === false) {}
Anyway, I would probably do something like this:
foreach ($menus_array as $menu_item) {
$classes = array();
if ($menu_item[0] == $active_item) {
$classes[] = 'active';
} | {
"domain": "codereview.stackexchange",
"id": 2227,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php",
"url": null
} |
equal to zero and solve for c: Therefore possible inflection points occur at and .However, to have an inflection point we must check that the sign of the second derivative is different on each side of the point. slope is increasing or decreasing, Now find the local minimum and maximum of the expression f. If the point is a local extremum (either minimum or maximum), the first derivative of the expression at that point is equal to zero. Find the points of inflection of $$y = 4x^3 + 3x^2 - 2x$$. To find a point of inflection, you need to work out where the function changes concavity. Concavity may change anywhere the second derivative is zero. $(1) \quad f(x)=\frac{x^4}{4}-2x^2+4$ To locate a possible inflection point, set the second derivative equal to zero, and solve the equation. or vice versa. \end{align*}\), \begin{align*} Added on: 23rd Nov 2017. To log in and use all the features of Khan Academy, please enable JavaScript in your browser. The y-value of a critical point may be | {
"domain": "kotegyesulet.hu",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9740426420486938,
"lm_q1q2_score": 0.8116936905018818,
"lm_q2_score": 0.8333245953120233,
"openwebmath_perplexity": 460.81010381349364,
"openwebmath_score": 0.7370645999908447,
"tags": null,
"url": "http://kotegyesulet.hu/indoor-planters-cxd/point-of-inflection-first-derivative-adfdf1"
} |
condensed-matter
$$g(\vec{k},\vec{Q}) \cdot c_{k+Q}^{\dagger}c_{k}^{\phantom{\dagger}}$$
then you can easily see that there's a single vector $\vec{Q}=\frac{1}{a}(\pi,\pi)$ that connects a whole lot of states in the Brillouin zone. In perturbation theory we get terms that go like $\frac{1}{E_k - E_{k+Q}}$, so if a single vector $Q$ connects lots of $k$ states (which have the same energy, by virtue of making up the fermi surface, and the states right around the fermi surface are the only ones that matter for low temperature stuff like CDW/SDW) then the static structure factor is going to be strongly peaked at that $Q$.
Fermi surface nesting gives rise to different orders because the scattering mechanisms of different materials are different. The term I wrote above didn't have any spin index on the operators. Spin preserving scattering like that would lead to a CDW. But if I had magnetic scattering that flipped the spin of the electron, I would have had an SDW state. | {
"domain": "physics.stackexchange",
"id": 5546,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "condensed-matter",
"url": null
} |
ros, navigation, mapping, rviz, visualization
Originally posted by LiMuBei with karma: 261 on 2011-10-19
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by joq on 2011-10-20:
This seems like a better solution. | {
"domain": "robotics.stackexchange",
"id": 7020,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, navigation, mapping, rviz, visualization",
"url": null
} |
println(s"number of files is ${numOfMeshes}") val originalData = ui.createGroup("Original Data") var i: Int = 1 val (meshes, meshViews) = meshFiles.map(meshFile => { val mesh = MeshIO.readMesh(meshFile).get val meshView = ui.show(originalData, mesh, "mesh" + i) i = i + 1 (mesh, meshView) // return a tuple of the mesh and the associated view }).unzip // take the tuples apart, to get a sequence of meshes and meshViews //meshViews(0).remove() removeGroupView(originalData) //------------------------------------------------------------------------------------------------------------------// // [removing centroid of each mesh i.e moving the centroid to (0,0,0), and hence the mesh by the same translation] val MeshPoints = meshes.map(mesh => (mesh.pointSet.points).toArray) //iterator to array def centroid(TriMeshPoints: Array[scalismo.geometry.Point[scalismo.geometry._3D]]): EuclideanVector[_3D] = { val vecrdPoints = TriMeshPoints.map { point => point.toVector } (vecrdPoints.reduce((v1, v2) => | {
"domain": "empty-set.me",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9938070083747649,
"lm_q1q2_score": 0.8303093925196413,
"lm_q2_score": 0.8354835350552604,
"openwebmath_perplexity": 2644.032938553268,
"openwebmath_score": 0.7260680198669434,
"tags": null,
"url": "https://empty-set.me/?author=1&paged=3"
} |
algorithm-analysis, asymptotics, quicksort
=\sum_{p=1}^n\sum_{x}^{}x\cdot(\text{number of permutations that starts with }p\text{
with }x\text{ exchanges performed})$$
As we have explained above, for a permutation that starts with $p$, $x$ exchanges will be performed on it if and only if that permutation has $x$ elements greater than $p$ in its front segment of $p-1$ elements. The number of such kind of permutations is the product of the following four factors.
$$
\underbrace{\binom{n-p}{x}}_{\text{the number of ways to choose }\quad\ \ \\x\text{ elements out of all }n-p\\\text{numbers that are greater than }\ \\p \text{ for the front segment}}
\underbrace{\binom{p-1}{p-1-x}}_{\text{the number of ways to chose }\\p-1-x\text{ elements out of all}\\p-1 \text{ numbers that are smaller }\quad\ \ \\\text{than }p\text{ for the front segment}}
\underbrace{(p-1)!}_{\text{the number of ways}\\\text{to permute all }p-1\\\text{elements in the}\\\text{front segment}}\quad\ \ | {
"domain": "cs.stackexchange",
"id": 16494,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithm-analysis, asymptotics, quicksort",
"url": null
} |
navigation, odometry, kinect, ros-kinetic, rgbd
<param name="queue_size" type="int" value="$(arg queue_size)"/>
<param name="subscribe_rgbd" type="bool" value="$(arg subscribe_rgbd)"/>
<param name="guess_frame_id" type="string" value="$(arg odom_guess_frame_id)"/>
<param name="guess_min_translation" type="double" value="$(arg odom_guess_min_translation)"/>
<param name="guess_min_rotation" type="double" value="$(arg odom_guess_min_rotation)"/>
</node> | {
"domain": "robotics.stackexchange",
"id": 31454,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, odometry, kinect, ros-kinetic, rgbd",
"url": null
} |
earth-rotation
of reference of the crust, not non-rotating space)? The mantle rotates about 131850 degrees per year. The actual assertion is that the inner core cycles between rotating about 131851 degrees per year versus 131849 degrees per year over the course of 70 year cycle. The paper was only published yesterday, so the scientific consensus is not there yet. The scientific consensus is not there yet on work done by the same authors eight years ago. | {
"domain": "earthscience.stackexchange",
"id": 2597,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "earth-rotation",
"url": null
} |
clojure
Title: Get city weather and notify an endpoint I'd like some help to improve this cli program. It queries a city's weather and pushes a weather report.
It takes two arguments: the city to query and the apikey for OpenWeatherMap. For example lein run glasgow abcde12345.
How to make it more idiomatic clojure? How can I avoid having to pass the apikey multiple times?
(ns sunshine.core
(:gen-class)
(:require [clj-http.client :as http])
(:require [clojure.data.json :as json])
)
(defn _get
[url]
(http/get url)
)
(defn _post
[url payload]
(http/post url payload)
)
(defn as_json
[text]
(json/read-str text :key-fn keyword)
)
(defn query_weather
[apikey coords]
(as_json
(:body (_get (str "https://api.openweathermap.org/data/2.5/weather?lat=" (:lat coords) "&lon=" (:lon coords) "&appid=" apikey "&units=metric")))
)
) | {
"domain": "codereview.stackexchange",
"id": 44064,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "clojure",
"url": null
} |
matrix and R is rotation. Rotate X,Y (2D) coordinates around a point or origin in Python - rotate_2d_point. Coriolis Force Up: Rotating Reference Frames Previous: Rotating Reference Frames Centrifugal Acceleration Let our non-rotating inertial frame be one whose origin lies at the center of the Earth, and let our rotating frame be one whose origin is fixed with respect to some point, of latitude , on the Earth's surface--see Figure 24. 5 Spin group Rotation matrix - Wikipedia, the free encyclopedia Page 1 of 22 mathematics but are common in 2D computer. Below you can see the new properties introduced to Image boxes:. The sphere can be unwrapped to be a 2D plane with poles and a lattitude/longitude coordinates, but it is not that simple to use in mathemati. its rotational counterpart [5,5,0] * R is given to be -5,5,0 rather than 5,-5,0. Say that you have a "rotation vector" r that is (sin(30), cos(30)), that's the equivalent of your rotation angle = 30. The angle of rotation, is the | {
"domain": "audio-upgrade.pl",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822876992225169,
"lm_q1q2_score": 0.8206851953639296,
"lm_q2_score": 0.8354835309589074,
"openwebmath_perplexity": 643.2726873535121,
"openwebmath_score": 0.6907839775085449,
"tags": null,
"url": "http://audio-upgrade.pl/rotation-2d-formula.html"
} |
thermodynamics, water, temperature, phase
source: http://what-when-how.com/nanoscience-and-nanotechnology/microweighing-in-supercritical-carbon-dioxide-part-1-nanotechnology/
This one is also a a $P-T$ phase diagram, with equal density $(\rho)$ lines. You can see that the lines radiating from the gas–liquid boundary lines are not equal on each side. For example, 0.1 and 0.9. However, as you get close to the critical point, $\rho$ on each side of the line converges to a single value: 0.2 and 0.7, 0.3 and 0.6 and so on.
YouTube has some terrific examples of this happening. For example: http://youtu.be/GEr3NxsPTOA
What you see is a function of density - you can see the phase boundary between liquid and gas because they have differing densities. Notice in the videos how the phase slowly and gradually disappears as the density of both phases converges, effectively turning the $\ce{CO2}$ into a supercritical fluid. | {
"domain": "chemistry.stackexchange",
"id": 2488,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, water, temperature, phase",
"url": null
} |
/* int graph[NODE][NODE] = {
{0, 1, 1, 0},
{0, 0, 1, 0},
{1, 0, 0, 1},
{0, 0, 0, 0}
}; */
int graph[NODE][NODE] = {
{1, 1, 0, 1},
{0, 1, 1, 0},
{0, 0, 1, 1},
{0, 0, 0, 1}
};
int result[NODE][NODE];
void transClosure() {
for(int i = 0; i<NODE; i++)
for(int j = 0; j<NODE; j++)
result[i][j] = graph[i][j]; //initially copy the graph to the result matrix
for(int k = 0; k<NODE; k++)
for(int i = 0; i<NODE; i++)
for(int j = 0; j<NODE; j++)
result[i][j] = result[i][j] || (result[i][k] && result[k][j]);
for(int i = 0; i<NODE; i++) { //print the result matrix
for(int j = 0; j<NODE; j++)
cout << result[i][j] << " ";
cout << endl;
}
}
int main() {
transClosure();
}
## Output
1 1 1 1
0 1 1 1
0 0 1 1
0 0 0 1
Updated on 16-Jun-2020 13:54:00 | {
"domain": "tutorialspoint.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9702399069145609,
"lm_q1q2_score": 0.8147434027358493,
"lm_q2_score": 0.839733963661418,
"openwebmath_perplexity": 3515.4772647751297,
"openwebmath_score": 0.2547570466995239,
"tags": null,
"url": "https://www.tutorialspoint.com/Transitive-closure-of-a-Graph"
} |
plate-tectonics, mantle, convection
If the earth's mantle is solid, why don't we say the plate tectonics are "resting on" the mantle instead of "floating on"?
How can we have convection currents through something that doesn't flow? Even if the solid rock in the mantle can why doesn't the heat just distribute itself evenly through conduction, and negate any convection tendencies?
I realize that entire books can be written on this topic, so a generalized answer is fine. Is the mantle solid? | {
"domain": "earthscience.stackexchange",
"id": 829,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "plate-tectonics, mantle, convection",
"url": null
} |
javascript, performance, algorithm, pathfinding
scanCells();
return;
//continue;
}
$(td[current.x][current.y]).css({ "background-color": '#AAAA00' });
current = node;
path[pathIndex++] = current;
scanCells();
}, 250);
}
else {
finished();
}
}
scanCells(); | {
"domain": "codereview.stackexchange",
"id": 5128,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, performance, algorithm, pathfinding",
"url": null
} |
c++, c++11, iterator
Object operator * () { return _node->data; }
iterator & operator ++()
{
_node = _node->next;
return *this;
}
iterator operator ++(int)
{
iterator retVal = *this;
++this;
return retVal;
}
bool operator < (iterator const& rhs) const
{
return _node < rhs._node;
}
bool operator != (iterator const& rhs) const
{
return _node != rhs._node;
}
bool operator == (iterator const& rhs) const
{
return _node == rhs._node;
}
}; A couple of real issues (rather than the imaginary ones previously pointed out):
Your code does not fully implement the requirements of iterator. | {
"domain": "codereview.stackexchange",
"id": 6153,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, iterator",
"url": null
} |
java, csv
In fact, you could then wrap it using Collections.unmodifiableList to avoid any unintentional modifications.
However, looking at the rest of the code, it may have need simpler if you had used arrays rather than lists for some or all of XLS_COLUMNS, KEYS and VALUES.
Use of Map<String, Object> is a bit "code smell". The code would probably be better if that was a custom class:
The code would probably be simpler and easier to understand.
The code that uses the map could be made statically type-safe.
There are simpler ways to round to 2 decimal places than using BigDecimal.
The error messages in main are not particularly helpful. Depending on who the intended user is, you may be better off printing the exception message. Cases in point:
"This CSV file is invalid" ... gives no clues as to why it is invalid.
"The encoding is not valid" ... what encoding?
and so on. | {
"domain": "codereview.stackexchange",
"id": 40302,
"lm_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, csv",
"url": null
} |
homework-and-exercises, electromagnetism, electric-fields, plasma-physics, dielectric
$$
We also know that the electric polarization, $\mathbf{P}$, is defined as follows:
$$
\mathbf{P} = \varepsilon_{o} \ \chi_{e} \ \mathbf{E} = \left( \varepsilon - \varepsilon_{o} \right) \ \mathbf{E} \tag{2}
$$
where $\varepsilon_{o}$ is the permittivity of free space, $\varepsilon$ is the dielectric permittivity, and $\chi_{e}$ is the electric susceptibility of the material, where $\left( 1 + \chi_{e} \right) = \tfrac{ \varepsilon }{ \varepsilon_{o} }$.
If we assume a pure substance with $n$ molecules per unit volume and $n \ Z$ electrons per unit volume, then the relative permittivity is given by:
$$
\frac{ \varepsilon\left( \omega \right) }{ \varepsilon_{o} } = 1 + \frac{ n \ Z \ e^{2} }{ m \ \varepsilon_{o} } \sum_{j} \ \left[ \omega_{j}^{2} - \omega^{2} - i \ \omega \ \gamma_{j} \right]^{-1} \tag{3}
$$ | {
"domain": "physics.stackexchange",
"id": 66872,
"lm_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, electric-fields, plasma-physics, dielectric",
"url": null
} |
java, programming-challenge
//If the card with number 'i' hasn't been used 4 times
if(cardsKnt.get(i) > 0){
sum = tempSum + i;
//If sum is equal to 31 or less, we can still do another iteration
if(sum <= 31){
if(sum > maxsum){
maxsum = sum;
nextToPick = i;
}
}
//else we know the winner is the previous player.
else {
winner = 'B';
return winner;
}
}
sum = 0;
} | {
"domain": "codereview.stackexchange",
"id": 16192,
"lm_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, programming-challenge",
"url": null
} |
ros, path, message, rospack, source
Originally posted by thepirate16 on ROS Answers with karma: 101 on 2016-03-17
Post score: 1
Yes, you really do need to source a setup.bash file in every single terminal that you want to use ROS in. These scripts control many important ROS environment variables and non-ROS environment variables (PYTHONPATH, CMAKE_PREFIX_PATH, etc.). The setup.bash scripts provide a convenient way to control which version of ROS is "active" and which workspaces are "active" (see page on overlaying workspaces).
If you want every terminal to automatically "source" a particular setup.bash script, you could put that command in your ~/.bashrc. See the Environment Setup section of the ROS installation instructions.
Originally posted by jarvisschultz with karma: 9031 on 2016-03-17
This answer was ACCEPTED on the original site
Post score: 6 | {
"domain": "robotics.stackexchange",
"id": 24151,
"lm_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, path, message, rospack, source",
"url": null
} |
physical-chemistry, quantum-chemistry, molecular-orbital-theory
In general your choice of phase is arbitrary; it does not affect the final physical result, and is simply chosen to make the calculations easier. That is to say, the eigenvalues (MO energies) that you get out of it will still be the same. The eigenfunctions may take on a different form, but that is physically unimportant. | {
"domain": "chemistry.stackexchange",
"id": 7318,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry, quantum-chemistry, molecular-orbital-theory",
"url": null
} |
the-moon, solar-eclipse
If instead we take average distance for the Earth we get $r_p = 3600$km, so a total of $7200$km, not far from @uhoh's answer.
In the case of minimum width, we take $d_e = a_e (1+e_e)$ (Earth at aphelion) and $d_m = a_m (1- e_m)$ (Moon at perigee). We then get $r_p = 3400$km, so a total of $6800$km.
In any case, the width is approximately twice the diameter of the Moon ($7000$km), but notice this is only a coincidence and is due to the fact that the angular diameters of the Moon and Sun are very close to each other. Indeed, simplifying the previous equation, we can neglect $R_e$ at the numerator, $d_m$ at the denominator and approximate $R_s -R_m$ with only $R_s$. We then see that
$\displaystyle r_p = R_m + \frac{d_m}{d_e} R_s = R_m \Big(1+ \frac{R_s / d_e}{R_m / d_m} \Big)$
but $R_s / d_e$ and $R_m / d_m$ are the angular diameters of the Sun and Moon, therefore the fraction is approximately 1 (actually 1.03 on average) and we recover $r_p \approx 2 R_m$. | {
"domain": "astronomy.stackexchange",
"id": 4353,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "the-moon, solar-eclipse",
"url": null
} |
Understanding Time Complexity Of Algorithms | Bits N Tricks. We could also say it is linear on the number of entries in the table but that is less commonly used. Imagine the time it will take to search a Letter of Daniel, Eric, Jayesh or any Employee. Therefore, by using hash table, we can achieve linear time complexity for finding the duplicate. Total comparisons in Bubble sort is: n ( n – 1) / 2 ≈ n 2 – n Best case 2: O (n ) Average case : O (n2) Worst case : O (n2) 3. The time required is flat, an O(1) constant time complexity. The main points in these lecture slides are:Time Complexity, Complexity of Algorithms, Execution Time, Space Complexity, Worst Case Analysis, Division of Integers, Number of Comparisons, Binary Search, Average Case Complexity, Complexity of Bubble Sort. In the later case, the search terminates in failure with n comparisons. If we assume we needed to search the array n times the total worst case run time of the linear searches would be O (n^2)). Why so | {
"domain": "marathon42k.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9814534327754854,
"lm_q1q2_score": 0.8612026083995186,
"lm_q2_score": 0.8774767906859264,
"openwebmath_perplexity": 614.0522630942693,
"openwebmath_score": 0.5858543515205383,
"tags": null,
"url": "http://marathon42k.it/zcy/time-complexity-of-linear-search.html"
} |
• Intuitionistic logic includes minimal logic and the principle of explosion
• Classical logic includes intuitionistic logic and the law of the excluded middle
It is known that there are statements that are provable in intuitionistic logic but not in minimal logic, and there are statements that are provable in classical logic that are not provable in intuitionistic logic. In this sense, the principle of explosion allows us to prove things that would not be provable without it, and the law of the excluded middle allows us to prove things we could not prove even with the principle of explosion. So there are statements that are provable by contradiction that are not provable directly. | {
"domain": "mathzsolution.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9863631633155348,
"lm_q1q2_score": 0.8516176830609768,
"lm_q2_score": 0.8633916134888614,
"openwebmath_perplexity": 160.97916514303006,
"openwebmath_score": 0.8328729271888733,
"tags": null,
"url": "https://mathzsolution.com/can-every-proof-by-contradiction-also-be-shown-without-contradiction/"
} |
structural-engineering, safety
To your specific question, the paragraphs below explains well:
" Since fire sprinkler design involves plenty of technical concepts, the NFPA 13 dedicates its Chapter 3 to defining key terms that are used throughout the document. An automatic sprinkler is defined as a “a fire suppression or control device that operates automatically when its heat-activated element is heated to its thermal rating or above, allowing water to discharge over a specified area.” There is a common misconception that automatic sprinklers are activated by smoke, but actually they respond to heat.
General requirements apply for all sprinkler systems regardless of the type of building or specific configuration, unless there is a direct exception in the code. If a building uses fire sprinklers, NFPA 13 demands full coverage for the entire property unless the standard indicates clearly that a specific building area is optional." | {
"domain": "engineering.stackexchange",
"id": 3998,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "structural-engineering, safety",
"url": null
} |
there are no more eigenvalues n't go any further, because there are does a matrix and its transpose have the same eigenvectors more.... If you find anything incorrect by clicking on the diagonal entries of a matrix an eigenvector of transpose! Link and share the link here it satisfies by transposing both sides of the proof represent. Has the same eigenvalue above example, has eigenvalue z = 3 the! Matrix transpose properties ) it follows does a matrix and its transpose have the same eigenvectors = † represented by \ A'\... Of both matrices have exactly the same eigenvectors up into its eigenvectors eigenvectors enjoy the row is... Form the diagonalising matrix S. Contrast this with b between an eigenvector a! These eigenvalues are linearly independent wrong IE: if a has n distinct eigenvalues do have. Same eigenvectors concepts with the centering issues you mentioned of interest, Theorem HMRE guarantees that these will... every square diagonal matrix commutes with all other diagonal | {
"domain": "levonline.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9334308110294983,
"lm_q1q2_score": 0.819063866407941,
"lm_q2_score": 0.8774767842777551,
"openwebmath_perplexity": 373.11426350705506,
"openwebmath_score": 0.8160443902015686,
"tags": null,
"url": "http://midnattssolsrallyt.com.php54.levonline.com/mrs-doubtfire-xwcehnm/dac93d-parallel-concurrent%2C-and-distributed-programming-in-java-github"
} |
gradient-descent, mini-batch-gradient-descent
The error gradient that you want to calculate for gradient descent is $\nabla_{\theta} C(X, \theta)$, which you can therefore write as:
$$\nabla_{\theta} C(X, \theta) = \nabla_{\theta}(\frac{1}{|X|}\sum_{x \in X} L(x, \theta))$$
The derivative of the sum of any two functions is the sum of the derivatives, i.e.
$$\frac{d}{dx}(y+z) = \frac{dy}{dx} + \frac{dz}{dx}$$
In addition, any fixed multiplier that doesn't depend on the parameters you are taking the gradient with (in this case, the size of the dataset) can just be treated as an external factor:
$$\nabla_{\theta} C(X, \theta) = \frac{1}{|X|}\sum_{x \in X} \nabla_{\theta} L(x, \theta)$$ | {
"domain": "datascience.stackexchange",
"id": 3317,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gradient-descent, mini-batch-gradient-descent",
"url": null
} |
over! ( bigger part is closer to the how to find the centroid of a triangle triangle that has two of... The coordinate of the triangle into a region reason that the centroid of a triangle is to turn the 's! Mentioned the shortcut, which is to average the y coordinates is the centroid of a triangle geometric intersect... Triangle Practice Questions that is 3.6 cm long, the centroid is the centroid of triangle! X coordinates and average the y coordinates that the centroid of a right triangle is from! The coordinates of the median and two-thirds the length of the entire --... On a median that is 3.6 cm long, the centroid of triangle this point is located 2b/3... At a single point which all three medians in a figure vertex.... -- and I think we can figure this out point which corresponds the. Altitude above the base a centroid of the triangle into a region to the... Intersection of all the three medians ( represented as dotted lines in figure! 1/3 from the bottom and the right angle called | {
"domain": "thinkandstart.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357211137666,
"lm_q1q2_score": 0.84580283181265,
"lm_q2_score": 0.8615382058759129,
"openwebmath_perplexity": 248.66812592345596,
"openwebmath_score": 0.7508877515792847,
"tags": null,
"url": "https://thinkandstart.com/menace-ii-oqcpwq/how-to-find-the-centroid-of-a-triangle-3f40df"
} |
algorithms, scheduling
$$
25, 16, 23, 45, 12, 34, 56, 13, 24, 35, 46, 15, 26, 14, 36 \\
25, 37, 12, 34, 56, 17, 23, 45, 67, 13, 24, 35, 46, 57, 16, 27, 36, 47, 15, 26, 14
$$ | {
"domain": "cs.stackexchange",
"id": 19657,
"lm_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, scheduling",
"url": null
} |
reinforcement-learning, reference-request, proofs, bellman-equations, policy-evaluation
\| F^\pi(u) - F^\pi(v) \|_{\infty}
&= \| (\mathbf{r}^\pi + \gamma \mathbf{T}^\pi u) - (\mathbf{r}^\pi + \gamma \mathbf{T}^\pi v)\|_{\infty} \\
&= \| \gamma \mathbf{T}^\pi (u - v)\|_{\infty} \\
&\leq \| \gamma \mathbf{T}^\pi ( \mathbb{1} \cdot \| u - v \|_{\infty})\|_{\infty} \\
&\leq \| \gamma (\mathbf{T}^\pi \mathbb{1}) \cdot \| u - v \|_{\infty}\|_{\infty} \\
&\leq \gamma \| u - v \|_{\infty}
\end{align}
where $\mathbb{1} = [1, \dots, 1]^T$. Note that $\mathbf{T}^\pi \cdot \mathbb{1} = \mathbb{1}$ because $\mathbf{T}^\pi$ is a stochastic matrix.
By the Bellman expectation equation (see Barto and Sutton's book and What is the Bellman operator in reinforcement learning?), $v^\pi$ is a fixed-point of the Bellman operator $F^\pi$. Given the contraction mapping theorem, the iterative application of $F^\pi$ produces a unique solution, so $v^\pi$ must be this unique solution, i.e. SPE finds $v^\pi$. Here is another version of the proof that the Bellman operator is a contraction.
Notes | {
"domain": "ai.stackexchange",
"id": 1870,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reinforcement-learning, reference-request, proofs, bellman-equations, policy-evaluation",
"url": null
} |
is a vector quantity. When the can is inverted in the cold water, the can collapses. It collides with a car (m2) traveling east at 22 m/s. African sleeping sickness is due to (a) Plasmodium vivax transmitted by Tsetse fly (b) Trypanosoma lewsii transmitted by Bed Bug (c) Trypanosoma gambiense transmitted by Glossina palpalis (d) Entamoeba gingivalis spread by Housefly. *Response times vary by subject and question complexity. Use MathJax to format equations. Answer to: Is momentum a vector? so as you say, from this perspective force is naturally a one-form. A scalar multiplied by a vector is a vector. $$L(x, \dot x) = m\sqrt{g_{\mu\nu} \dot x^\mu \dot x^\nu}$$ Infinite dimensional vector spaces vs. the dual space. The momentum p of an object of mass m moving with a velocity v is defined as the product of the mass m and the velocity v of the object. As discussed in an earlier unit, a vector quantity is a quantity that is fully described by both magnitude and direction. The length, or | {
"domain": "migfkul.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307684643189,
"lm_q1q2_score": 0.8042506636940915,
"lm_q2_score": 0.8267117876664789,
"openwebmath_perplexity": 624.540002964023,
"openwebmath_score": 0.620303750038147,
"tags": null,
"url": "https://migfkul.com/28ly0/058b71-is-momentum-a-vector"
} |
part v of an analytic function f = u+iv are harmonic. If history were more logical they might have been found this way. Duration: 11:46 Complex Fourier Series - Square Wave …. Key Mathematics: More Fourier transform theory, especially as applied to solving the wave equation. In this method, if N harmonics are included in the truncated Fourier series, then the amplitude of the kth harmonic is multiplied by (N - k)/N. Our aim was to find a series of trigonometric expressions that add to give certain periodic curves (like square or sawtooth waves. The result of the FFT is an array of complex numbers. The fine oscillations at the edges do not disappear even if the Fourier series takes many more terms. 1 The Fourier Series Components of an Even Square Wave Components of cos(nt) found in the approximation to an even square wave may be calculated generally as a function of n for all n > 0. Y = fft (X) computes the discrete Fourier transform (DFT) of X using a fast Fourier transform (FFT) | {
"domain": "xenchic.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9881308768564867,
"lm_q1q2_score": 0.8670619074356445,
"lm_q2_score": 0.8774767874818409,
"openwebmath_perplexity": 578.2945620419474,
"openwebmath_score": 0.8959225416183472,
"tags": null,
"url": "https://xenchic.de/complex-fourier-series-of-square-wave.html"
} |
c#, .net, unit-testing
string Symbol { get; }
double Value { get; }
SizeUnit(string symbol, double value)
{
Symbol = symbol;
Value = value;
}
public override string ToString() => Symbol;
internal double ToSize(double bytes) => bytes / Value;
internal double ToBytes(double size) => size * Value;
}
And:
public struct DataSize
{
public static DataSize operator +(DataSize left, DataSize right) =>
new DataSize(left.Bytes + right.Bytes).To(left.Unit);
public static DataSize operator -(DataSize left, DataSize right) =>
new DataSize(left.Bytes - right.Bytes).To(left.Unit);
public static DataSize operator *(DataSize left, ulong right) =>
new DataSize(left.Bytes * right).To(left.Unit);
// etc...
DataSize(double bytes)
: this(bytes, Byte)
{
}
public DataSize(double bytes, SizeUnit unit)
{
Bytes = bytes;
Unit = unit;
} | {
"domain": "codereview.stackexchange",
"id": 21779,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, .net, unit-testing",
"url": null
} |
php, codeigniter
if ($query->num_rows() > 0)
{
return $query->row();
}
else
{
return false;
}
}
/**
* Loggedin::clear_login_attempts()
*
* @param int $user_id $user_id of the account trying to be accessed
*/
public function clear_login_attempts($user_id)
{
$this->db->set('lock_date', 'NULL');
$this->db->set('hacker_ip_address', 'NULL');
$this->db->set('failed_logins', '0');
$this->db->where('user_id', $user_id);
$this->db->update('users_logins');
}
/**
* Loggedin::update_logins()
*
*
*/
public function update_logins($user_id)
{
$this->db->query('UPDATE users_logins SET number_of_logins = number_of_logins+1 WHERE user_id ='.$user_id);
} | {
"domain": "codereview.stackexchange",
"id": 1108,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, codeigniter",
"url": null
} |
php, object-oriented, mysql, api, rest
return $data;
}else{
$data['facebookUserIDExists'] = false;
return $data;
}
}catch(PDOException $e){
//Would it be a good idea to log this error in a php log file?
$data['exceptionOccurred'] = true;
$data['exceptionMessage'] = $e->getMessage();
return $data;
}
}
public function getUserProfile($userID){
//this method takes in a userID as a parameter and gets that user's data from the profiles table in the database
$data = array();
try{
$this->query ="SELECT * FROM facebook_users WHERE userID = :userID LIMIT 1";
$this->statement = $this->pdoConnection->prepare($this->query);
$this->statement->bindValue(':userID', $userID, PDO::PARAM_INT);
$this->statement->execute();
$this->statement->setFetchMode(PDO::FETCH_ASSOC); | {
"domain": "codereview.stackexchange",
"id": 27668,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, object-oriented, mysql, api, rest",
"url": null
} |
quantum-mechanics, momentum, probability, eigenvalue
In other words, the momentum space wavefunction is a sum of two "Dirac Delta functions": two sharp "spikes" at $\pm p_0 = \pm 10\pi \hbar /a = \pm 5 h /a$. This means that if the momentum of this state were measured, the only values that have a non-zero probability of being detected are $\pm 5h/a$.
You can easily show the above relation by using the definition of the $\delta-$function: $$\delta(p-p_0) = \frac{1}{\sqrt{2\pi \hbar}} \int_{-\infty}^\infty\text{d}x\,\, e^{-i (p-p_0) x/\hbar}.$$
(In fact, you don't even have to work this out explicitly: you could just write out the wavefunction as a sum of two complex exponentials, and this should immediately be clear.) | {
"domain": "physics.stackexchange",
"id": 75340,
"lm_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, momentum, probability, eigenvalue",
"url": null
} |
By the fundamental theorem of arithemtic, you can write $a$ and $b$ as a product of primes, say $$a=p_1^{\alpha_1}\cdots p_r^{\alpha_r},\qquad b=p_1^{\beta_1}\cdots p_r^{\beta_r}$$ where $\alpha_i,\beta_i\geq 0$. Allow the exponents to possibly be $0$ if such a prime $p_i$ occurs in the factorization of one integer but not the other.
So $a^2=p_1^{2\alpha_1}\cdots p_r^{2\alpha_r}$ and $b^2=p_1^{2\beta_1}\cdots p_r^{2\beta_r}$. Since $a^2\mid b^2$, by unique factorization, necessarily $2\alpha_i\leq 2\beta_i$ for each $i$. That implies $\alpha_i\leq\beta_i$ for all $i$, and so $a\mid b$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9888419671077918,
"lm_q1q2_score": 0.824026327974448,
"lm_q2_score": 0.8333245911726382,
"openwebmath_perplexity": 213.36505366522903,
"openwebmath_score": 0.9297996759414673,
"tags": null,
"url": "http://math.stackexchange.com/questions/182988/if-a2-divides-b2-then-a-divides-b"
} |
newtonian-mechanics, energy-conservation, collision
Isn't the collision of the hammer with the nail inelastic?
In real life situations, the collision would be inelastic since energy will be lost to sound and heat etc.
What would be the correct solution to this problem?
That is the correct solution to the problem. If you proceed with your studies in physics (engineering etc), there will be problems that do include non-ideal situations.
And does the mass of the nail (unknown here) come into play?
No it need not come into play, since you already have been given the force, and the distance (which is also in the direction of the force) the force moves the nail. The product of these two alone, gives you the work done, and as you mentioned, $$\text{Work Done}=\Delta \text{Kinetic Energy}$$ | {
"domain": "physics.stackexchange",
"id": 78359,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, energy-conservation, collision",
"url": null
} |
recursion, common-lisp
add-edge-between-vertexes being defined in the cl-graph package.
I am unsure about the usage of progn. Is it recommended to use it here? Much too complicated. Use MAPCAR:
(defun group-pairwise (numbers)
"Returns a list with the elements of NUMBERS grouped in pairs."
(mapcar #'list numbers (rest numbers)))
Similar:
(defun generate-graph-of-digits (numbers graph)
(mapc (lambda (a b)
(add-edge-between-vertexes graph a b))
numbers
(rest numbers)))
Such primitive recursion can be replaced with mapping functions. Bonus: mapping functions are not limited by recursion stack.
Style
Also:
(append (list (list a b)) some-list)
is
(cons (list a b) some-list)
Then:
(cond (a (progn b c d))
((evenp n) (progn o p q))
(t (progn e f g)))
is:
(cond (a b c d)
((evenp n) o p q)
(t e f g))
Each cond clause accepts any number of Lisp forms after the condition. | {
"domain": "codereview.stackexchange",
"id": 27054,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "recursion, common-lisp",
"url": null
} |
is 30°. asked by tj on October 6, 2010; Pre-Calc. Relevant page. e To find a NEGATIVE coterminal (if in deg) (if in rads) (I call these "swirlies") e Coterminal angles can contain Example 2a: Find a positive and negative coterminal angle for the given angle 0. (In the next Topic, Arc Length, we will see the actual definition of radian measure. #trigonometry #anglesintrigonometry Category. Quadrant Angle Measure (radians) Angle Measure (degrees) Coordinate on Terminal Side of Angle 1 2 3 4. 2 Angles and Radian Measure 471 Finding Coterminal Angles In Example 1(b), the angles 500° and 140° are coterminal because their terminal sides coincide. For example: Find the standard coterminal angle for a. moomoomath. Reference Angle Worksheet Give the reference angle for each angle below. The reference angle is the positive acute angle that can represent an angle of any measure. kcl e Unit Circle: Right Triangle Trigonometry D4 Notes Reference Angles & Exact Values Reference Angles: Special Right | {
"domain": "aavt.pw",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9783846634557752,
"lm_q1q2_score": 0.8276571011290494,
"lm_q2_score": 0.8459424314825853,
"openwebmath_perplexity": 1234.0799687255712,
"openwebmath_score": 0.6979809403419495,
"tags": null,
"url": "http://msgf.aavt.pw/coterminal-and-reference-angles.html"
} |
We will prove that the relation ~ is an equivalence relation on $$\mathbb{R}$$. The relation $$\sim$$ is reflexive on $$\mathbb{R}$$ since for each $$a \in \mathbb{R}$$, $$a - a = 0 = 2 \cdot 0 \cdot \pi$$.
Now, let $$a, b \in \mathbb{R}$$ and assume that $$a$$ $$\sim$$ $$b$$. We will prove that $$b$$ $$\sim$$ $$a$$. Since $$a$$ $$\sim$$ $$b$$, there exists an integer $$k$$ such that
$a - b = 2k\pi.$
By multiplying both side of this equation by -1, we obtain
$\begin{array} {rcl} {(-1)(a - b)} &= & {(-1)(2k\pi)} \\ {b - a} &= & {2(-k)\pi.} \end{array}$
Since $$-k \in \mathbb{Z}$$, the last equation proves that $$b$$ $$\sim$$ $$a$$. Hence, we have proven that if $$a$$ $$\sim$$ $$b$$, then $$b$$ $$\sim$$ $$a$$ and, therefore, the relation $$\sim$$ is symmetric. | {
"domain": "libretexts.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9893474896314054,
"lm_q1q2_score": 0.8088652490125506,
"lm_q2_score": 0.8175744695262775,
"openwebmath_perplexity": 65.98629465601634,
"openwebmath_score": 0.9633486270904541,
"tags": null,
"url": "https://math.libretexts.org/Bookshelves/Mathematical_Logic_and_Proof/Book%3A_Mathematical_Reasoning_-_Writing_and_Proof_(Sundstrom)/7%3A_Equivalence_Relations/7.2%3A_Equivalence_Relations"
} |
ros
Originally posted by Mac with karma: 4119 on 2011-10-25
This answer was ACCEPTED on the original site
Post score: 5
Original comments
Comment by Constantin S on 2011-10-25:
Ahh of course. Thank you! | {
"domain": "robotics.stackexchange",
"id": 7084,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
quantum-mechanics, quantum-optics
This is a direct analogue of the $g \ll min\{ω_0,ω\}$ condition.
Hence one could say that the Rabi and Jaynes-Cummings Hamiltonian describe the same physics as soon as both conditions (near-resonance and weak coupling) are verified. If the coupling becomes strong (as in superconducting qubits for instance), the Jaynes-Cummings Hamiltonian no longer describes completely the physics, since higher order terms start to play a role. (cf. Bloch-Siegert shift and/or AC Stark shift).
An interesting paper on this topic : A modern review of the two-level approximation by Marco Frasca.
Edit : Also, a very elegant way to look at these light-atom interaction problems, is through the dressed-atom formalism (Atom-Photon Interactions - Chapter 6 The Dressed Atom Approach by Claude Cohen-Tannoudji , or any introductory ressource that builds the dressed-atom approach starting from the Rabi Hamiltonian and not the Jaynes-Cummings one). | {
"domain": "physics.stackexchange",
"id": 38574,
"lm_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-optics",
"url": null
} |
Number of sample space $|\Omega|$ is $\binom{N}{2}\times\binom{N}{2}$. Number of possible outcomes is $\binom{N}{2}$. The probability is $\frac{1}{\binom{N}{2}}$.
$|\Omega| = N^4$.
Let $X$ be an event where they both draw the same ordered pair of balls, e.g., $((1,1),(2,2)) \mathrm{or}~ ((1,1),(3,3)).$
Let $Y$ be an event where they both draw the same "cross-ordered" pair of balls, e.g., $((1,2),(2,1)) \mathrm{or}~ ((1,3),(3,1)).$
$|X| = N^2$, and $|Y| = N\times(N-1).$
Hence, the probability is $\frac{N^2 + N\times(N-1)}{N^4}$.
Question:
Is either of these answers correct?
• It is with replacement, so the second is right. – André Nicolas Dec 3 '15 at 7:24
• Thanks. I also agree with the second answer. – Ardevara Dec 3 '15 at 12:12
We denote with $[N]:=\{1,2,3,\ldots,N\}$ and consider all $N^4$ tuples in \begin{align*} \mathcal{A}=\{((A_1,B_1),(A_2,B_2))|A_j,B_j\in[N],j=1,2\} \end{align*} | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9653811631528336,
"lm_q1q2_score": 0.8404582019931288,
"lm_q2_score": 0.8705972667296309,
"openwebmath_perplexity": 489.9537487272463,
"openwebmath_score": 0.941901683807373,
"tags": null,
"url": "https://math.stackexchange.com/questions/1557771/probability-of-the-same-pair-of-balls-drawn-from-two-separate-urns"
} |
ros, kinect, build
make[3]: Leaving directory `/home/sid/ros/tuc-ros-pkg/trunk/stacks/tuc_pelican/kinect_utils/build'
[ 0%] Built target rosbuild_premsgsrvgen
make[3]: Entering directory `/home/sid/ros/tuc-ros-pkg/trunk/stacks/tuc_pelican/kinect_utils/build'
make[3]: Leaving directory `/home/sid/ros/tuc-ros-pkg/trunk/stacks/tuc_pelican/kinect_utils/build'
[ 14%] Built target ROSBUILD_genmsg_cpp
make[3]: Entering directory `/home/sid/ros/tuc-ros-pkg/trunk/stacks/tuc_pelican/kinect_utils/build'
make[3]: Leaving directory `/home/sid/ros/tuc-ros-pkg/trunk/stacks/tuc_pelican/kinect_utils/build'
[ 28%] Built target ROSBUILD_genmsg_lisp
make[3]: Entering directory `/home/sid/ros/tuc-ros-pkg/trunk/stacks/tuc_pelican/kinect_utils/build'
make[3]: Leaving directory `/home/sid/ros/tuc-ros-pkg/trunk/stacks/tuc_pelican/kinect_utils/build'
[ 50%] Built target ROSBUILD_genmsg_py
make[3]: Entering directory `/home/sid/ros/tuc-ros-pkg/trunk/stacks/tuc_pelican/kinect_utils/build' | {
"domain": "robotics.stackexchange",
"id": 8584,
"lm_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, build",
"url": null
} |
python, classification, binary
I tried to explain the problem as clear as possible, but if it isn't, please let me know.
QUESTION What will be the best approach to solve this problem? How to compute thresholds? You are describing every binary classifier. However, you are missing a key point. If your classes are separable by the value of just ONE feature, you can do what you're saying and find e.g. F1 > 1.23 as a threshold. If classification involves a combination of features, you will need to describe some combination of thresholds for each feature, or (equivalently) some relationship between the features that tells you about the class label. It's the job of every binary classifier to do exactly this - they just do it in different ways. See for example this post. Your desire to have a combination of fixed sets of thresholds will only work if you can have a set of thresholds that will encompass/describe/classify every combination of feature values. | {
"domain": "datascience.stackexchange",
"id": 2578,
"lm_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, classification, binary",
"url": null
} |
javascript
function changeBooleanToNumber(o) {
depthVisit(o, function (parent, key) {
if ({}.toString.call(parent[key]) === '[object Boolean]') {
parent[key] = +parent[key];
}
});
} | {
"domain": "codereview.stackexchange",
"id": 2057,
"lm_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
} |
and $g^{p-1} \equiv 1 \bmod p$ $\leftarrow$ not true yet. To complete the proof, we need to show $g^i \not\equiv 1 \bmod p$ for $1 \le i < p-1$. But my question is how to prove this last part?
• Well, there is an easy way to conclude this exercize in a line: $\Bbb{Z}_p^* = \langle g^k \rangle \subseteq \langle g \rangle \subseteq \Bbb{Z}_p^*$, so you have equality. Hence, $g$ generates the whole multiplicative subgroup of $\Bbb{Z}_p$, i.e. it is a primitive root. – Crostul Nov 13 '16 at 23:35
Since $g^k$ is a primitive root mod $p$, we know that the powers of $g^k$ achieve equivalence with all values coprime to $p$ (before reaching $(g^k)^{p-1} \equiv 1 \bmod p$).
However this means that all the residue classes coprime to $p$ can also be expressed as powers of $g$ - that is, $g^k, g^{2k}, g^{3k}$ etc.. Therefore $g$ must also have order $p\!-\!1$ and is a primitive root. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9763105238756898,
"lm_q1q2_score": 0.819841111852199,
"lm_q2_score": 0.8397339696776499,
"openwebmath_perplexity": 109.15574228123958,
"openwebmath_score": 0.9824502468109131,
"tags": null,
"url": "https://math.stackexchange.com/questions/2012737/proof-of-number-being-a-primitive-root"
} |
image-processing, matlab, convolution, linear-systems
But Matlab gives answer as given in that link but i am confused,about convolution steps, why only 5(first element of 2nd vector ) is multiplied with all there 3 element of first vector making up 3 different terms of final answer(as shown in attached photo) but 2nd element(blue under line) & 3rd element(red under line) of 2nd matrix do not repeat the same steps as followed for first element?why they are not multiplied by all elements of first vector as was the case with 5
? Just write down the convolution sum to see what's going on:
$$y[n]=\sum_{k=-\infty}^{\infty}x[k]p[n-k]\tag{1}$$
where we define the elements of the sequences $x[n]$ and $p[n]$ as equal to zero for the index $n$ outside the range of non-zero values, i.e., outside $n\in[0,2]$. Taking into account those zero values, we can rewrite $(1)$ with finite summation limits:
$$y[n]=\sum_{k=0}^{n}x[k]p[n-k]\tag{2}$$ | {
"domain": "dsp.stackexchange",
"id": 7455,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "image-processing, matlab, convolution, linear-systems",
"url": null
} |
linked-list, reinventing-the-wheel, stack, go
Title: Basic linked list stack implementation with go Here goes my first stack implementation with go
New to the go language and it's been ages since I implemented a stack
Would love to discuss the data structure implementation itself and how "goish" the code looks.
package stack
import "errors"
var (
errEmptyStack = errors.New("Stack is empty")
)
type node struct {
next *node
Value interface{}
}
// Stack implementation
type Stack struct {
head *node
Count int // O(1) count
}
// Push value at the top of the stack
func (stack *Stack) Push(value interface{}) {
var node = node{Value: value}
if stack.head == nil {
stack.head = &node
} else {
node.next = stack.head
stack.head = &node
}
stack.Count++
}
// Pop value from the top of the stack
func (stack *Stack) Pop() (value interface{}, err error) {
if stack.head == nil {
return nil, errEmptyStack
}
var node = stack.head
stack.head = node.next | {
"domain": "codereview.stackexchange",
"id": 23370,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "linked-list, reinventing-the-wheel, stack, go",
"url": null
} |
c++, number-systems
std::ostream& operator<<(std::ostream& out, const Bignum& n)
{
if (n.digits.size() == 0)
return out << '0';
bool z = false; // track leading zeros
for (auto i = n.digits.rbegin(); i != n.digits.rend(); ++i) {
int n = *i;
if (z |= n/10)
out << n/10;
if (z |= n)
out << n % 10;
}
return out;
}
// PROGRAM
int main () {
const int N = 100;
auto fac = 1_big;
for (int i = 1; i < N; ++i) {
fac *= i;
std::cout << i << "! = " << fac << std::endl;
};
} | {
"domain": "codereview.stackexchange",
"id": 24782,
"lm_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++, number-systems",
"url": null
} |
python, python-3.x, linked-list
node = self.get_node(index)
new = Node(node, node.after, value)
node.after.before = node
node.after = new
self.size += 1
def remove(self, index):
'''
Removes the specified element at the specified position.
If the given index is out of range of the list, an
IndexError is thrown.
'''
node = self.get_node(index)
node.before.after = node.after
node.after.before = node.before
return node.value
def get(self, index):
'''
Returns the specified element at the specified position.
If the given index is out of range of the list, an
IndexError is thrown.
'''
return self.get_node(index).value
def get_node(self, index):
'''
Returns the specified node at the specified position. | {
"domain": "codereview.stackexchange",
"id": 17530,
"lm_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, linked-list",
"url": null
} |
• @MatthewLeingang in this case the exponent of X must not be equal to zero? x^2 or x^-2 should be a valid power function? Jun 24, 2017 at 10:30
• Yes, $x^2$ and $x^{-2}$ are valid power functions. But your question was about $|x|$ and $x|x|$, right? Those are not power functions. You could insert exponents, but it would have to be $1$, not $0$. That doesn't help with your calculation, though. Applying the power rule to $|x|^1$ gives $1$, times $|x|^0$ (also $1$), times the derivative of $|x|$. Jun 25, 2017 at 10:24 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9615338057771058,
"lm_q1q2_score": 0.837108703177688,
"lm_q2_score": 0.8705972667296309,
"openwebmath_perplexity": 194.45743097309506,
"openwebmath_score": 0.8472493290901184,
"tags": null,
"url": "https://math.stackexchange.com/questions/2331163/derivative-of-absolute-function/2331181"
} |
php, search
Moving on to the next part:
if( isset($_REQUEST['limitstart']) && $_REQUEST['limitstart'] > 0 ) {
...
} else {
$limitstart = "0";
}
The clause is very similar to the one discussed previously, only this time other than checking if $_REQUEST has a "limitstart" index, the author also checks that the value is larger than zero. That's an unsafe check, because at this point we don't now what the type of the value in $_REQUEST['limitstart'] is, and if it's anything other than a number, there will be automatic type juggling involved, and the check is completely unreliable.
From the name and context, I'm assuming the variable should hold an integer (if anything) that limits the search. If the variable doesn't hold anything, the limit is set to zero ($limitstart = "0"), curiously using a string form of zero. I'd rewrite that check as:
$limitstart = 0; | {
"domain": "codereview.stackexchange",
"id": 1971,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, search",
"url": null
} |
$$y = \left( 1 - x^{-1} \right)^{-1} = \frac1{1 - \frac1x} = \frac{x}{x-1} = 1 + \frac1{x-1}$$ Hence, $$y' = - \frac1{(x-1)^2}$$
To proceed through you method of using chain rule, setting $u = (1-x^{-1})$, we have that $y = u^{-1}$. Hence, $$y' = -\frac{u'}{u^2}.$$ Note that $$u' = \frac1{x^2}.$$ Hence, we get that $$y' = - \frac{1/x^2}{(1-x^{-1})^2} = - \frac{1/x^2}{(1-1/x)^2} = - \frac{1/x^2}{(x-1)^2/x^2} = - \frac1{(x-1)^2}$$
The error you made was that you did not write $u^{-2}$ correctly. $\displaystyle u^{-2} = \frac1{(1-x^{-1})^2}$
@Jordan $$(1-x^{-1})^2 = (1-1/x)^2 = (x-1)^2/x^2.$$ Hence, $$\frac{1/x^2}{(x-1)^2/x^2} = \frac1{(x-1)^2}.$$ – user17762 May 5 '12 at 18:16 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429619433693,
"lm_q1q2_score": 0.8194438798848197,
"lm_q2_score": 0.8333245994514084,
"openwebmath_perplexity": 410.37639594660664,
"openwebmath_score": 0.9649019241333008,
"tags": null,
"url": "http://math.stackexchange.com/questions/141449/derivative-of-y-1-x-1-1"
} |
computability, computation-models, turing-completeness
Title: What is required for universal analogue computation? What operations need to be performed in order to do any arbitrary analogue computation? Would addition, subtraction, multiplication and division be sufficient?
Also, does anyone know exactly what problems are tractable using analogue computation, but not with digital? Unfortunately, there is no "universal" concept of universality in analogue computing. However, this paper by Delvenne proposes a unifying formalism for universality in discrete (e.g. Turing Machines) and continuous (e.g. differential equations) dynamical systems and reviews some universal systems studied in the literature. Here is an excerpt from the paper which informally describes the procedure for proving universality of a dynamical system: | {
"domain": "cs.stackexchange",
"id": 4725,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computability, computation-models, turing-completeness",
"url": null
} |
c#, sql
The hardest part is ...populating that time table, not querying it.
Now, to make the above return a column for each quarter, you'll need to pivot it. But if you're working (and thinking) in sets (LINQ works off IEnumerable<T> after all), you won't need to do this.
Speaking of LINQ... assuming you have the time table mapped to FiscalCalendar entities, you could query it like this:
var referenceDate = DateTime.Today;
var quarters = context.FiscalCalendars
.GroupBy(t => new { t.FiscalYear, t.FiscalQuarterOfYear })
.Select(g => new {
FiscalYear = g.Key.FiscalYear,
FiscalQuarterOfYear = g.Key.FiscalQuarterOfYear,
StartDate = g.Min(q => q.CalendarDate),
EndDate = g.Max(q => q.CalendarDate)
}) | {
"domain": "codereview.stackexchange",
"id": 14190,
"lm_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#, sql",
"url": null
} |
java, performance, game-of-life
// update neighbor counts of adjacent cells, and mark them as active
int yMin = (y > 0 ? y-1 : 0), yMax = (y < height-1 ? y+1 : height-1);
int xMin = (x > 0 ? x-1 : 0), xMax = (x < width-1 ? x+1 : width-1);
for (int ny = yMin; ny <= yMax; ny++) {
for (int nx = xMin; nx <= xMax; nx++) {
byte newState = buffer[ny][nx] + delta;
// if this cell is not yet active, add it to the queue for next time step
if (newState & 1 == 0) {
xQueue[activeCells] = nx;
yQueue[activeCells] = ny;
activeCells++;
newState += (byte)1;
}
buffer[ny][nx] = newState;
}
}
// the middle cell only needs to adjusted by +/-2
buffer[y][x] -= (byte)(delta / 2);
} | {
"domain": "codereview.stackexchange",
"id": 9440,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, performance, game-of-life",
"url": null
} |
arduino, rosserial
Update(3):
Solved! I fixed it by checking the flag "TXCn: USART Transmit Complete". I kept the RTS HIGH for as long as the transmit complete flag was not risen. Here is the code:
void write(uint8_t* data, int length){
digitalWrite(RTS, HIGH);
for(int i=0; i<length; i++){
iostream->write(data[i]);
}
while(!(UCSR1A & (1<<TXC1)));
digitalWrite(RTS, LOW);
}
Originally posted by FrankB on ROS Answers with karma: 11 on 2015-02-24
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 20967,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "arduino, rosserial",
"url": null
} |
For case 2 the number of ways that the remaining 7 letters can be arranged, given that there are 3 A's and 4 B's, is:
$
\left( \array 7 \\ 3 \array \right) = \frac {7 \cdot 6 \cdot 5}{3!} = 35.
$
Note that case 2 can occur in 8 different ways, since the starting B can be in position 1, 2, 3, 4, 5, 6, 7, or 8. Thus the total number of ways that case 2 can occur is 8 x 35 = 280.
Finally for case 3 the math is the same as for case 1, so there are 56 ways it can occur.
Thus the total number of arrangements that yield 3 A's in a row, given that you have 6 A's and 6 B's, is 2x56+280 = 392.
• Nov 10, 2013, 09:39 AM
Sabarkantha
Quote:
Originally Posted by ebaines
To clarify your question - I assume you mean that if you get 4 or more A's in a row it's counted as a fail, and if you get two groups of 3 A's each separated by at least one B it's a success. | {
"domain": "askmehelpdesk.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9830850837598123,
"lm_q1q2_score": 0.8127280312205699,
"lm_q2_score": 0.8267117919359419,
"openwebmath_perplexity": 387.15775548506235,
"openwebmath_score": 0.8196262121200562,
"tags": null,
"url": "https://www.askmehelpdesk.com/mathematics/maths-question-774505-print.html"
} |
java, performance, algorithm, programming-challenge
Set<Integer> indexA = new HashSet<>(s.length());
Set<Integer> indexC = new HashSet<>(s.length());
List<Integer> indexB = new ArrayList<>();
for(int i=0;i<s.length();i++){
if(s.charAt(i)=='a')
indexA.add(i);
if(s.charAt(i)=='b')
indexB.add(i);
if(s.charAt(i)=='c')
indexC.add(i);
}
int res = 0;
for(int tmpB:indexB){
int powB = (int)Math.pow((double)(tmpB+1),2);
for(int i=2;i<=Math.sqrt((double)powB);i++){
if(powB%i==0){
if(i != powB/i)
if(indexA.contains(i-1)&&indexC.contains(powB/i-1))
res++;
if(indexC.contains(i-1)&&indexA.contains(powB/i-1))
res++;
else
if(indexA.contains(i-1)&&indexC.contains(i-1))
res++;
}
}
}
return res; | {
"domain": "codereview.stackexchange",
"id": 25748,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, performance, algorithm, programming-challenge",
"url": null
} |
quantum-mechanics, wavefunction, schroedinger-equation, fourier-transform
Title: Does the Fourier transform apply for any number of dimensions? I've seen the equation to get from the momentum wavefunction to the position wavefunction as
$$\Psi(x)=\frac{1}{\sqrt{2{\hbar}\pi}}\int_{-\infty}^\infty{e^{ipx/\hbar}}\Phi(p)dp$$ | {
"domain": "physics.stackexchange",
"id": 81646,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, wavefunction, schroedinger-equation, fourier-transform",
"url": null
} |
quantum-mechanics, condensed-matter, second-quantization, lattice-model
The second term, $\sum_i n_i$, is just the operator that returns the total number of particles in the system. Depending on what you're studying, this term might matter! However, in most cases, you assume you are working with some FIXED number of particles in the system. For example, you might say that you are working at half filling, or whatever. If the number of particles in the system is fixed, then, this operator is ALSO a constant. So it also does not affect the physics, and in particular does not affect the ground state.
However, both of these terms affect the ground state energy. The first term raises the ground state energy by $V\sum_i\frac{1}{4}$, and the second term lowers it by $VN$, where $N$ is the total number of particles in your system. This shouldn't surprise you: when you add constants to a potential energy, you change the zero of your energy scale. | {
"domain": "physics.stackexchange",
"id": 55151,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, condensed-matter, second-quantization, lattice-model",
"url": null
} |
aromatic-compounds, chemical-biology, drugs
But the possibility congo red could act as a bidentate ligand, does seem to make it stand out from curcumin. Am I onto something here? Apart from that, and a somewhat larger size, I don't see why congo red shouldn't be able to cross the BBB.
Now, I'd like to know two things,
1) What enables curcumin to cross the BBB?
2) Why isn't congo red able to cross the BBB, even though it has a structure similar to that of curcumin? Preface: both molecules could act as bidentate ligands but the β-diketo structure found in curcumin is typically a much better bidentate ligands — as the 2-oxophenol moieties would be. So I would expect curcumin to be a much better ligand than congo red. | {
"domain": "chemistry.stackexchange",
"id": 6769,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "aromatic-compounds, chemical-biology, drugs",
"url": null
} |
quantum-field-theory, operators, fourier-transform, antimatter, second-quantization
Title: Expansion coefficients in the solution of the Dirac equation for a free particle So my question is why do we need to write the coefficients $b$ (that after the second quantization are going to be promoted as the antiparticle creation operators) as complex conjugate? I mean, why not just write $b$, without the complex conjugation sign in the solution
$$\psi(x) =\int \frac{d^{3}p}{(2\pi)^{3}}\sum_{s=1,2}(a_{p,s}u_s(p)e^{-ipx} + b^{*}_{p,s}v_s(p)e^{ipx})
$$
I hope my question is clear enough. It bothers me that in a lot of textbooks you just find $b^{*}$ without a clear argument why it isn't just $b$. It is just notation. If you schematically write
$$
\psi\sim A\mathrm e^{-ipx}+B\mathrm e^{+ipx}
$$
then you can check that
$$
\begin{aligned}
{}[H,A]=-\omega A\\
[H,B]=+\omega B
\end{aligned}
$$ | {
"domain": "physics.stackexchange",
"id": 38806,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, operators, fourier-transform, antimatter, second-quantization",
"url": null
} |
gazebo, kinect, gazebo-model, sdformat
I am using xacro parameters (${}) to adapt my sensor.
Originally posted by Brosseau.F with karma: 284 on 2018-02-15
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by RoboticRos on 2018-02-16:
Thanks.....
Comment by RoboticRos on 2018-02-16:
@Brosseau ... It is not publishing any topics. ${lidarName} --> This can be anything (name) i want it to be be ... right??
Comment by Brosseau.F on 2018-02-16:
Yes it can be the name you want. You have to replace all the parameters with the value that you want.
This part of urdf is inside a xacro macro, that's why there is some ${parameters}.
Comment by Subodh Malgonde on 2018-08-11:
The plugin needs to be updated to libgazebo_ros_laser.so, then this works. | {
"domain": "robotics.stackexchange",
"id": 4235,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo, kinect, gazebo-model, sdformat",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.