text stringlengths 1 1.11k | source dict |
|---|---|
homework-and-exercises, electrostatics, gauss-law, dirac-delta-distributions
So, using the product rule relationship, i arrange it as such:
$\bigtriangledown \cdot (\psi \bar{\mathbf{E}})=(\bigtriangledown \psi) \cdot E + \psi (\bigtriangledown \cdot \bar{\mathbf{E}})$
as then substitute in:
$\bigtriangledown \cdot (\psi \frac{\mathbf{\bar{r}}}{r^{3}})=(\bigtriangledown \psi) \cdot \frac{\mathbf{\bar{r}}}{r^{3}} + \psi (\bigtriangledown \cdot \frac{\mathbf{\bar{r}}}{r^{3}})$
I can then do $\bigtriangledown \cdot \frac{\mathbf{\bar{r}}}{r^{3}}$ to $\frac{-3}{r^{4}}$ by differentiation, (i think this is wrong)
And using the given relationship $\bigtriangledown \mathbf{\bar{r}}=3$
I can re-write as: $\bigtriangledown \cdot ( \frac{\mathbf{\bar{r}}}{r^{3}})=\frac{3}{r^{3}}-\frac{3}{r^{4}}$
This is where i'm a little lost, I have the list of solutions, and the solution is 0 | {
"domain": "physics.stackexchange",
"id": 19662,
"lm_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, electrostatics, gauss-law, dirac-delta-distributions",
"url": null
} |
python, algorithm, array, hash-map
# A tie to be resolved happens when two last candidates have equal vote count.
# if so, go backwards removing everybody with the same vote count.
# Binary search would work faster, of course. If a standard library
# provides something similar to std::lower_bound from STL - its even better.
index = num_win
while index > 0 and winners[index - 1]['votes'] == winners[num_win]['votes']:
index -= 1
# Finally, adjust your list
winners = winners[0:index]
PS: One more thing to mention. The final nested loop is not really the best approach. You should decorate the original list with the sequential numbers (or use some other method to remember initial ordering), sort it, mark the winners which are at the beginning of the list, and sort it by sequence numbers back to the original state. | {
"domain": "codereview.stackexchange",
"id": 7523,
"lm_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, algorithm, array, hash-map",
"url": null
} |
potential-energy, conventions, spring, dipole
In an electric field $\vec E$ the torque on the dipole is
$\vec \tau = \vec p \times \vec E = pE \sin \theta\, (-\hat z)$
where $\hat z$ is the unit vector out of the screen and the angle between the electric field direction and the electric dipole direction is $\theta$ then the magnitude of the torque on the dipole is $pE \sin \theta$
The work done by the electric field in rotating the dipole from $\theta_{\rm initial}$ to $\theta_{\rm final}$ is
$\int ^{\rm final}_{\rm initial} \vec \tau \cdot d\vec \theta'= \int ^{\rm final}_{\rm initial} [pE \sin \theta' \,(-\hat z)]\cdot [d\theta'\,\hat z]= -\int ^{\rm final}_{\rm initial} pE \sin \theta' \, d\theta'$
and minus this quantity is the change in potential energy
$\Delta U = + \int ^{\rm final}_{\rm initial} pE \sin \theta' \, d\theta'$ | {
"domain": "physics.stackexchange",
"id": 49272,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "potential-energy, conventions, spring, dipole",
"url": null
} |
python, python-3.x, programming-challenge, number-systems
if __name__ == '__main__':
for i in range(2, 37):
print(convertfrom_decimal(3.1415926535897932, i)) | {
"domain": "codereview.stackexchange",
"id": 43151,
"lm_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, programming-challenge, number-systems",
"url": null
} |
asymptotics, big-o-notation, binary-search-trees, avl-trees
Title: Big O vs. Big Theta for AVL tree operations On the Wikipedia page for AVL trees, the time/space complexity for common operations is stated both for average case (in Big Theta) and worst case (in Big O) scenarios. I understand both Big O and Big Theta in general but am having trouble understanding why they are used in such a way here. A source is linked but it does not seem to make any reference to Big Theta, only Big O.
For example, why is the space complexity for the tree $\Theta(n)$ in the average case but $\mathrm{O}(n)$ in the worst case? My thought process is that since you always have to store all $n$ nodes in the tree, the space complexity is both $\Omega(n)$ and $\mathrm{O}(n)$, hence it should be $\Theta(n)$ in all cases. I don't see how there can be a "worst case" in terms of space when you're always storing the same amount of data. | {
"domain": "cs.stackexchange",
"id": 19670,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "asymptotics, big-o-notation, binary-search-trees, avl-trees",
"url": null
} |
6. Thanks guys! Especially Moo.
Another question about the variance. Would you need to then use MGFs to do derive the variance? Using the 2nd moment of the normal distribution to find E(X^2) for the log normal distribution, thus having E(X^2) - m^2 for the variance.
Though i can't get the right answer.
7. Originally Posted by anonder
Thanks guys! Especially Moo.
Another question about the variance. Would you need to then use MGFs to do derive the variance? Using the 2nd moment of the normal distribution to find E(X^2) for the log normal distribution, thus having E(X^2) - m^2 for the variance.
Though i can't get the right answer.
Okay, here the MGF is more useful XD
$\mathbb{E}(X^2)=\mathbb{E}((e^Y)^2)=\mathbb{E}(e^{ 2Y})=\phi_Y(2)=\exp\left(2\mu+2\sigma^2\right)$
(Y follows a normal distribution $(\mu,\sigma^2)$)
Hence $\text{var}(X)=\mathbb{E}(X^2)-[\mathbb{E}(X)]^2=\exp\left(2\mu+2\sigma^2\right)-\exp\left(2\left(\mu+\frac{\sigma^2}{2}\right)\rig ht)$ | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9845754442973824,
"lm_q1q2_score": 0.8308783936052808,
"lm_q2_score": 0.8438951005915208,
"openwebmath_perplexity": 574.970996358504,
"openwebmath_score": 0.8579851388931274,
"tags": null,
"url": "http://mathhelpforum.com/advanced-statistics/90154-lognormal-distribution.html"
} |
c, interview-questions, fizzbuzz
Keep in mind that code does not become more efficient just because you reduce the number of apparent instructions that you write in C. Optimizing compilers do not perform a literal translation of C instructions into assembly instructions. And even non-optimizing compilers may not be able to do so if they wanted to, because there isn't necessarily a 1-to-1 correspondence of instructions in both languages.
In this case, you're not even gaining any efficiency with the way you've written the printf statements. In fact, the execution of printf is by far the slowest part of the program, so by any real-world performance metrics, avoiding calls to printf whenever possible would be the way to boost performance. Certainly it is not a win to replace a reasonably well-predicted conditional branch with an expensive and pointless function call! | {
"domain": "codereview.stackexchange",
"id": 23704,
"lm_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, interview-questions, fizzbuzz",
"url": null
} |
ds.algorithms, nt.number-theory
$\forall x.x < x+1$
$\forall xy. x < y \Rightarrow x+1 < y+1$.
What's relevant here is the base case (1). Translated
into prime factorisation, it says that you need to know something about
the factorisations of $x+1$ and $y+1$ from the
factorisations of $x$ and $y$. However, as far as I'm aware the
factorisations of $x$ and $x+1$ are essentially unrelated. | {
"domain": "cstheory.stackexchange",
"id": 1760,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ds.algorithms, nt.number-theory",
"url": null
} |
ros, catkin-make, catkin, catkin-ws, catkin-workspace
Title: catkin_make fails with Invalid email and Invalid package
When I try to catkin_make my workspace the following is output:
Base path: /home/user/catkin_ws
Source space: /home/user/catkin_ws/src
Build space: /home/user/catkin_ws/build
Devel space: /home/user/catkin_ws/devel
Install space: /home/user/catkin_ws/install
Package name "${pkg_name}" does not follow naming conventions
Invalid email "${email}" for person "${author}"
Invalid email "${email}" for person "${author}" | {
"domain": "robotics.stackexchange",
"id": 28391,
"lm_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, catkin-make, catkin, catkin-ws, catkin-workspace",
"url": null
} |
formal-languages, formal-grammars, history, chomsky-hierarchy
My question is, when did "regular" shift from referring to type 2 languages to type 3 languages? And why? (Was it intentional, or did someone mis-quote Chomsky at some point and that stuck?) I found an answer, at least a partial one, hinted at in Footnote 10 of Chomsky's paper where he refers to a 1956 paper by Kleene in which Kleene describes "regular events" -- a language recognized by finite state machines.
So it would seem the common usage of "regular language" today traces back to Kleene's "regular events" rather than to Chomsky's "regular grammar".
Furthermore, as renierpost pointed out in a comment, what Chomsky called a "regular" grammar in 1959 is now known as Chomsky normal form.
Edit: I asked Professor Chomsky via email whether he intended his "regular grammar" to have a connection to Kleene's "regular events". He replied: "Long time ago and I don't recall. I suppose just a coincidence." | {
"domain": "cs.stackexchange",
"id": 8794,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "formal-languages, formal-grammars, history, chomsky-hierarchy",
"url": null
} |
I will need to also assign a sentinel number that when entered, will stop the loop and display the results. This is defined everywhere and is zero at $\ds x=\pm \sqrt{3}/3$. By using this website, you agree to our Cookie Policy. For each x value: Determine the value of f '(x) for values a little smaller and a little larger than the x value. The absolute max occurs at S = The absolute min occurs at S =. Decide whether you have a minimum or a maximum. )Given the function 𝑓(𝑥= 𝑥2+ 𝑥+ , chose values for a, b, and c in that could work for the graph shown. Which method do you prefer? f (x) = 1 + 3x^2 - 2x^3. the absolute (global) maximum 3. Meaning answers obtained by looking at the graph in the calculator will not earn V = - 4x +3; [1, 3] BIUA. VO2 max in men is approximately 40-60% higher in males than females. On the interval, fnmin then finds all local extrema of the function as left and right limits at a jump and as zeros of the function's first derivative. If you're behind a web | {
"domain": "rciretedimpresa.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9890130576932457,
"lm_q1q2_score": 0.8520725317968266,
"lm_q2_score": 0.86153820232079,
"openwebmath_perplexity": 373.11161112116935,
"openwebmath_score": 0.6303600668907166,
"tags": null,
"url": "http://hefc.rciretedimpresa.it/absolute-maximum-and-minimum-calculator-on-interval.html"
} |
If we have borrowed 3 then it may become 300-264=36.
36 is also +ve number know.Then why we have borrowed 1 ?
0 0
sam
2016-01-11 21:13:27
In example 5, base is 1000
So, borrowed 1 becomes 1000
No need to borrow 3 as it becomes 3000
0 0
ketan
2014-07-02 08:28:23
how we caculate the figure of 557*613??
B RAJEN TOPNO
2015-08-01 13:07:16
Taking base as 1000 ( Power of 10)
557 : -443 (1000-443)
613 : -387(1000-387)
Left side of the answer will be the diagonal sum including their signs : 170(557-387 or 613-443)
Right side of the answer will be the product of the differences : -443 × -387 = 171441 (First three digits will add up with the left side of the answer) | {
"domain": "careerbless.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9886682491397238,
"lm_q1q2_score": 0.8106025154254443,
"lm_q2_score": 0.8198933425148213,
"openwebmath_perplexity": 1800.64067159421,
"openwebmath_score": 0.8016445636749268,
"tags": null,
"url": "https://www.careerbless.com/maths/speedmaths/Multiplication2.php"
} |
Asking for help, clarification, or responding to other answers. 2D Poisson equations. The 2D Poisson equation is solved in an iterative manner (number of iterations is to be specified) on a square 2x2 domain using the standard 5-point stencil. Particular solutions For the function X(x), we get the eigenvalue problem −X xx(x) = λX(x), 0 < x < 1, X(0) = X(1) = 0. Poisson's equation is = where is the Laplace operator, and and are real or complex-valued functions on a manifold. LAPLACE’S EQUATION AND POISSON’S EQUATION In this section, we state and prove the mean value property of harmonic functions, and use it to prove the maximum principle, leading to a uniqueness result for boundary value problems for Poisson’s equation. Finite Element Solution of the 2D Poisson Equation FEM2D_POISSON_RECTANGLE , a C program which solves the 2D Poisson equation using the finite element method. Eight numerical methods are based on either Neumann or Dirichlet boundary conditions and nonuniform grid | {
"domain": "marcodoriaxgenova.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9923043544146898,
"lm_q1q2_score": 0.8673506481763438,
"lm_q2_score": 0.8740772368049822,
"openwebmath_perplexity": 682.703101573481,
"openwebmath_score": 0.7900996208190918,
"tags": null,
"url": "http://marcodoriaxgenova.it/jytu/2d-poisson-equation.html"
} |
mechanical-engineering, control-engineering, dynamics, vibration, eigenvalue-analysis
Edit: After seeing your most recent comment, your state space could be written as:
$$
X = \begin{bmatrix} x\\y\\u \\ \dot{x}\\\dot{y}\\\dot{u}\end{bmatrix}
$$
I think I misunderstood what you meant by using matlab and maple. Your inputs are known\controlled values, so $F(t)$ and $T(t)$ along with the system parameters, like $K$, outputs are system behavior, like $x,y,u$ and their derivatives, what you don't know upon the formulation of the equation, but you don't need maple to construct the equation for you, it's just the ones you find from the algebra.
Lastly, I somehow didn't notice your controller forces $T(t)$ and $F(t)$ and didn't write them into the first parameter of the solver, but those can be written in as well, as they are. It would just be that $\ddot{q}=M^{-1}(Kq-T(t)-F(t))$. | {
"domain": "engineering.stackexchange",
"id": 1584,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mechanical-engineering, control-engineering, dynamics, vibration, eigenvalue-analysis",
"url": null
} |
c#, unit-testing, moq, autofac
var factory = new ViewModelFactory(vmConfig);
var kitIssueConfig = {
StockBusinessLogic = ...,
LotVerificationBLGenerator = ...
}
var kitIssue = factory.createKitIssueViewModel(kitIssueConfig);
The above isn't perfect yb any means but it seperates concerns relaevant to the current VM vs relevant to all system VMs.
It makes new instances composible without a huge constructor collection by just swapping the config object,
and finally if the factory is backed by an interface contract you can inject the factory directly and the consuming classes are only directly dependent on a factory NOT all the sub elements. AND that factory can be mocked, as can each config object passed in to a concrete factory to test THOSE! | {
"domain": "codereview.stackexchange",
"id": 21911,
"lm_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#, unit-testing, moq, autofac",
"url": null
} |
c++, multithreading, library, boost
float maxLifespan = 1.0f;
float gravityMagnitude = 0.0f;
AxisAngles gravityDirection;
float animationFramesPerSecond = 10.0f;
template <class Archive>
void serialize(Archive & archive) {
archive(CEREAL_NVP(directionalChange), CEREAL_NVP(rotationalChange),
CEREAL_NVP(beginSpeed), CEREAL_NVP(endSpeed),
CEREAL_NVP(beginScale), CEREAL_NVP(endScale),
CEREAL_NVP(beginColor), CEREAL_NVP(endColor),
CEREAL_NVP(maxLifespan),
CEREAL_NVP(gravityMagnitude), CEREAL_NVP(gravityDirection),
CEREAL_NVP(animationFramesPerSecond)
);
}
}; | {
"domain": "codereview.stackexchange",
"id": 13399,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, multithreading, library, boost",
"url": null
} |
above argument are eigenvectors always orthogonal three or more degenerate.!, where three or more degenerate eigenstates PCA always leads to orthogonal components are eigenvectors always orthogonal! Conclude that the vectors need not be of unit length orthogonal.. what if two of the eigenfunctions are.! Moreover, a Hermitian matrix a with dimension n are real, imaginary, and symmetric have! Be to choose two linear combinations which are orthogonal will the are eigenvectors always orthogonal!: Let g are eigenvectors always orthogonal p be distinct eigenvalues are linearly independent eigenvectors circle for the.. And n are eigenvectors always orthogonal eigenvalues is not orthogonal with one of the two eigenvectors for distinct eigenvalues are orthogonal PCA. We will take the matrix is symmetric, and that a has n linearly independent eigenvectors Hermitian are! It has real eigenvalues what you want to know the same eigenvalue, we conclude the! Linear algebra final exam at Nagoya | {
"domain": "painbenit.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822877044076955,
"lm_q1q2_score": 0.8206852117674522,
"lm_q2_score": 0.8354835432479661,
"openwebmath_perplexity": 630.5071021837142,
"openwebmath_score": 0.8961015939712524,
"tags": null,
"url": "https://www.painbenit.com/paymaster-services-uathy/are-eigenvectors-always-orthogonal-7b9981"
} |
the problem. What is the probability of the coin being the double-sided sided one, given the result is heads? I decided to explore the problem using Python, and came up with the code below. If A Fair Coin Is Flipped 15 Times What Is The Probability Of Of Getting Exactly 10 Tails? (You Do Not Need To Simplify Your Answer. Coin denominations are 1 Rupee, 2 Rupee and 5 Rupee. Definition: Example: An experiment is a situation involving chance or probability that leads to results called outcomes. Probability Puzzle #1: The Unfair Coin Problem Description Summary Using an unfair coin, and without knowing the actual probabilities of the coin landing heads-up or tails-up, is it possible to simulate flips of a perfectly fair coin? Definitions • A fair coin is one which has equal probabilities of landing heads-up and tails-up when flipped. This page continues to illustrate probability facts using the flip-a-coin-4-times-and-count-the-number-of-heads problem. (b) Now assume that all pairs of | {
"domain": "luviaheventi.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9787126488274565,
"lm_q1q2_score": 0.827934559772497,
"lm_q2_score": 0.8459424334245617,
"openwebmath_perplexity": 369.53134766360745,
"openwebmath_score": 0.7722846269607544,
"tags": null,
"url": "http://luviaheventi.it/coin-probability-problems.html"
} |
ros, turtlebot, android-core, rosjava, kobuki
-compile:
[javac] Compiling 31 source files to /home/lucid/android/android_core/android_gingerbread_mr1/bin/classes
[javac] /home/lucid/android/android_core/android_gingerbread_mr1/src/org/ros/android/robotapp/AppManager.java:35: error: package app_manager does not exist
[javac] import app_manager.AppList;
[javac] ^
[javac] /home/lucid/android/android_core/android_gingerbread_mr1/src/org/ros/android/robotapp/AppManager.java:36: error: package app_manager does not exist
[javac] import app_manager.ListApps;
[javac] ^
[javac] /home/lucid/android/android_core/android_gingerbread_mr1/src/org/ros/android/robotapp/AppManager.java:37: error: package app_manager does not exist
[javac] import app_manager.ListAppsRequest;
[javac] ^
[javac] /home/lucid/android/android_core/android_gingerbread_mr1/src/org/ros/android/robotapp/AppManager.java:38: error: package app_manager does not exist | {
"domain": "robotics.stackexchange",
"id": 15318,
"lm_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, turtlebot, android-core, rosjava, kobuki",
"url": null
} |
c++
In the code I usually work with i would definitely advise against it. In general I would be suspicious of any code that assigned directly to the result of a free function. I'd rather go with "Don't assign to the result of a free function" as a style rule. In modern c++ doing this prevents the use of move semantics on the result of your function.
With member functions this would be different returning a reference or a const references is something that may happen a lot. So there are cases where you might actually write object.getter() = x. But it's dealing with references as results and not values.
Operator efficiency | {
"domain": "codereview.stackexchange",
"id": 28423,
"lm_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++",
"url": null
} |
# Find all roots of $x^{6} + 1$
I'm studying for my linear algebra exam and I came across this exercise that I can't solve.
Find all roots of polynomial $x^{6} + 1$. Hint: use De Moivre's formula.
I guessed that two roots are $i$ and $-i$, since:
$i^{6} = (i^{2})^{3} = (-1)^{3} = -1$
therefore, $i$ is root and his complex conjugate $-i$ has to be root too. However that was just guessing. I have no idea how can I use De Moivre's formula here.
Can you help me solve this?
-
Hint: if $x^6=-1$, then $|x|^6=1$ and you can write $x=\cos\theta + i\sin\theta$.
details:
Then the equation is, thanks to De Moivre theorem and $\cos^2 + \sin^2 =1$, equivalent to $$\cos 6\theta =-1\\ 6\theta = \pi\mod 2\pi\\ \theta\in \frac \pi 6+\left\{0, \frac\pi 3, \frac{2\pi}3,\pi,\frac{4\pi} 3, \frac{5\pi}3 \right\}.$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9796676430955554,
"lm_q1q2_score": 0.8142439507706136,
"lm_q2_score": 0.8311430478583168,
"openwebmath_perplexity": 365.69208237739235,
"openwebmath_score": 0.960650622844696,
"tags": null,
"url": "http://math.stackexchange.com/questions/731443/find-all-roots-of-x6-1"
} |
python, pygame, battle-simulation, pokemon
field = Game.opponent_field
text = [
["%s come back!" % old.name, 375, y],
["Go %s!" % new.name, 375, y+35]
]
for item in text:
Game.current_turn_text.add((item[0], item[1], item[2], 20, color))
new.first_turn = True
Game.switching = False
Game.text_y += 35
Game.entry_hazard_damage(new, field)
Game.text_y += 35
return new | {
"domain": "codereview.stackexchange",
"id": 23211,
"lm_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, battle-simulation, pokemon",
"url": null
} |
php, array, tree, trie
public function has_child(string $val)
{
if (isset($this->_children[$val])) {
return true;
}
return false;
}
public function get_child(string $val)
{
//if ($this->has_child($val))
return $this->_children[$val];
//else
//return false;
}
}
class Tree
{
protected $root;
public function __construct()
{
$this->root = new Node ();
}
public function insert_word(string $word)
{
$this->insert_letter_node($this->root, $word, 0);
}
protected function insert_letter_node(Node $node, string $word,
int $letter_index)
{
$letter = $word[$letter_index];
if (!$node->has_child($letter)) {
$new_node = $node->add_child($letter);
} else {
$new_node = $node->get_child($letter);
} | {
"domain": "codereview.stackexchange",
"id": 19828,
"lm_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, array, tree, trie",
"url": null
} |
semantics, denotational-semantics
$$
You can transform the above to the following.
$$
\mathcal{S}_{\text{ds}} \lbrack\lbrack\text{repeat } S \text{ until } b\rbrack\rbrack =
\text{FIX }F\\
\text{where }F\ g = \text{cond}(\mathcal{B}\lbrack\lbrack \lnot b\rbrack\rbrack, g, id)\circ \mathcal{S}_{\text{ds}}\lbrack\lbrack S\rbrack\rbrack
$$
Your version is not correct in this regard, it would be equivalent to $\lbrack\lbrack \text{while } b \text{ do } S;S\rbrack\rbrack$, which evaluates the condition before rather than after the first execution of $S$. | {
"domain": "cs.stackexchange",
"id": 2008,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "semantics, denotational-semantics",
"url": null
} |
java, android
02-28 10:28:06.275: W/DefaultChannelPipeline(335): at org.ros.internal.node.DefaultNode.newServiceClient(DefaultNode.java:372)
02-28 10:28:06.275: W/DefaultChannelPipeline(335): at org.ros.android.android_tutorial_pubsub.EnviaDadosClient.onStart(EnviaDadosClient.java:32)
02-28 10:28:06.275: W/DefaultChannelPipeline(335): at org.ros.internal.node.DefaultNode$5.run(DefaultNode.java:506)
02-28 10:28:06.275: W/DefaultChannelPipeline(335): at org.ros.internal.node.DefaultNode$5.run(DefaultNode.java:503)
02-28 10:28:06.275: W/DefaultChannelPipeline(335): at org.ros.concurrent.EventDispatcher.loop(EventDispatcher.java:43)
02-28 10:28:06.275: W/DefaultChannelPipeline(335): at org.ros.concurrent.CancellableLoop.run(CancellableLoop.java:56)
02-28 10:28:06.275: W/DefaultChannelPipeline(335): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088) | {
"domain": "robotics.stackexchange",
"id": 13115,
"lm_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
} |
4. To Bacterius:
5. Originally Posted by mr fantastic
Is it $3 \log_3 (x) - 26 = 9 \log_x 3$ or $3 \log_3 (x - 26) = 9 \log_x 3$?
It's the former, not the latter.
6. Originally Posted by AeroScizor
Hi all,
Just doing my revision and came across a logarithms question that involves changing of base. I could only complete halfway before getting stuck. So I hope someone here can help me out.
Heres the question:
3 log (base 3) x - 26= 9 log (base x) 3
I have managed to switch the base of 9 log from x to 3 but soon got stuck at the part whereby 9/log (base 3) x----doesn't matter if you don't understand, just solve it your own way.
hi AeroScizor,
a small correction is needed.
$3log_3x-26=9log_x3$
$3log_3x=log_x3^9+26$
$3log_3x-log_x3^9=26$
using the change of base formula $log_bx=\frac{log_ax}{log_ab}$ we get
$3log_3x-\frac{log_33^9}{log_3x}=26$
$log_33^9=9$
$\frac{3\left(log_3x\right)^2-9}{log_3x}=26$
$3\left(log_3x\right)^2-9=26log_3x$
$3a^2-26a-9=0$ | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9852713870152409,
"lm_q1q2_score": 0.814535471799291,
"lm_q2_score": 0.8267117898012105,
"openwebmath_perplexity": 1035.6314025352744,
"openwebmath_score": 0.8958474397659302,
"tags": null,
"url": "http://mathhelpforum.com/algebra/143982-problem-changing-base-log-question.html"
} |
file-formats
So the final file should look like:
Id HG00096 HG00097 HG00099 HG00100
22_16051249_T_C_b37 0 1 1 0 1 0 0 1 0
Can anyone please help me out with this. Assuming that the third line is the continuation of the second line. Here's a one (long) liner:
cat <( \
paste -d '\t' \
<(echo "Id") \
<(head -1 test.tsv \
| cut -f5- \
| sed -e '$s/\[[[:digit:]]\+\]//g; s/_HG[[:digit:]]\+//g') ) \
<( \
paste -d '\t' \
<(awk 'NR>1 {print $1"_"$2"_"$3"_"$4"_b37"}' test.tsv) \
<(awk 'NR>1 {print $0}' test.tsv | cut -f5- | sed 's/\.[[:digit:]]\+//g')) \
> output.tsv | {
"domain": "bioinformatics.stackexchange",
"id": 2035,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "file-formats",
"url": null
} |
# 10.4: Trigonometric Identities | {
"domain": "libretexts.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9937100967454597,
"lm_q1q2_score": 0.8344521202632329,
"lm_q2_score": 0.8397339656668287,
"openwebmath_perplexity": 235.8874990521153,
"openwebmath_score": 0.9533764123916626,
"tags": null,
"url": "https://math.libretexts.org/Bookshelves/Precalculus/Book%3A_Precalculus_(Stitz-Zeager)/10%3A_Foundations_of_Trigonometry/10.4%3A_Trigonometric_Identities"
} |
Your polynomial $f$ has real coefficients. Therefore, if $r$ is one root of $f$, $\overline r$ will be another. If $r$ is also imaginary, then $\overline r = -r$. Thus if there is an imaginary root $r$ of $f$, then we must have $f(r)=f(-r)=0$, in other words, the polynomials $f(x)$ and $f(-x)$ have at least one common root, namely $r$.
Therefore, calculate the GCD of $f(x)$ and $f(-x)$, since it must contain all of these common roots. This turns out to be $x^2+3$, whose roots are $i\sqrt 3$ and $-i\sqrt 3$. Therefore these are roots of $f$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985718068592224,
"lm_q1q2_score": 0.8104466881976673,
"lm_q2_score": 0.8221891370573388,
"openwebmath_perplexity": 246.33484809477483,
"openwebmath_score": 0.8609429597854614,
"tags": null,
"url": "https://math.stackexchange.com/questions/1596214/prove-the-roots-of-a-complex-polynomial-are-imaginary"
} |
c#, set
public bool Remove(T item)
{
return m_ListContainer.Remove(item);
}
public void RemoveAt(int index)
{
m_ListContainer.RemoveAt(index);
}
IEnumerator IEnumerable.GetEnumerator()
{
return m_ListContainer.GetEnumerator();
}
#endregion
/// <summary>
/// complement the current list on the basis of universalset
/// </summary>
/// <param name="universalSet"></param>
public IEnumerable<T> Complement(IEnumerable<T> universalSet)
{
// create a copy of the universalSet
List<T> list = new List<T>(universalSet);
foreach (T item in m_ListContainer)
{
list.Remove(item);
}
return list;
}
/// <summary>
/// return [this - set2]
/// </summary>
/// <param name="set2"></param>
/// <returns></returns>
public IEnumerable<T> Difference(IEnumerable<T> set2)
{
List<T> newSet = new List<T>(m_ListContainer.ToArray()); | {
"domain": "codereview.stackexchange",
"id": 38610,
"lm_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#, set",
"url": null
} |
php, object-oriented, parsing, reinventing-the-wheel
/**
* Sets a key=value pair within an INI section header in memory.
*
* Data passed into parameters is validated to ensure generated INI files will be properly formatted and will not
* produce any parsing errors.
*
* Parameters are also trimmed of leading and trailing whitespace prior to validation for INI formatting purposes
* (I.e., saving '[section]' instead of '[ section ]', or 'key=value' instead of 'key = value'. This allows for
* better consistency in writing and reading of INI files between this class, parse_ini_* functions, and any other
* programs written in other languages that may need to access these files.
*
* @param string $parSection INI section
* @param string $parKey INI key
* @param string $parValue Desired new value
* @throws INILibException if any parameters do not fit proper INI formatting or would cause INI parsing errors if
* saved to a file | {
"domain": "codereview.stackexchange",
"id": 26037,
"lm_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, parsing, reinventing-the-wheel",
"url": null
} |
navigation, move-base, actionlib
Comment by Dereck on 2013-11-04:
unfortunately I do not. Perhaps there is a way to inject a debug message in the action server to make sure that your action request is really making it to the server. Then make sure nothing else is overwriting your request? That's what I would do at least. :?
Comment by ctguell on 2013-11-05:
@Dereck thanks, one more question do you now to which topic is the goal posted to? thanks
Comment by Dereck on 2013-11-05:
i think it is: /move_base/goal But I can't say for certain
Comment by ctguell on 2013-11-07:
@Dereck thanks, last question is there a way to get the position of the robot?
Comment by Dereck on 2013-11-07:
That's called SLAM, an active research topic and there is a load of solutions. In ROS you would typicly use gmapping, but it's going to take some effort to get running. :) Good luck!
I'm not sure, how move_base handles the /move_base_simple/goal, but if it is an action, you could try sending a fully empty GoalID message to move_base/cancel. | {
"domain": "robotics.stackexchange",
"id": 13304,
"lm_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, move-base, actionlib",
"url": null
} |
javascript
title_div.classList.add("data_display_div_title");
description_div.classList.add("data_display_div_description");
// Append child
data_display.appendChild(data_item);
data_item.appendChild(title_div);
data_item.appendChild(description_div);
title_div.appendChild(span_title);
title_div.appendChild(span_time);
description_div.appendChild(span_description);
// Values
span_title.innerText = "⬤ " + this.schedule_day.innerText + ": " + input_title.value;
span_time.innerText =
input_init_time.value + " - " + input_final_time.value;
span_description.innerText = input_description.value;
// Clean fields
input_title.value = "";
input_init_time.value = "00:00";
input_final_time.value = "23:59";
input_description.value = ""; | {
"domain": "codereview.stackexchange",
"id": 39777,
"lm_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
} |
c#, performance, .net, unity3d
private void Awake()
{
//Load all the required info into the dictionary.
foreach (PooledObject objectToPool in ObjectsToPool)
{
pooledObjects.Add(objectToPool.Name, new List<GameObject>());
pooledObjectsContainer.Add(objectToPool.Name, objectToPool);
//Create any pooled object with the CreateOnAwake variable set to true.
if (objectToPool.CreateOnAwake)
{
Populate(objectToPool.Name);
}
}
}
/// <summary>
/// Creates objects by a specified pooled object name.
/// </summary>
/// <param name="objectName"> The name of the pooled object. </param>
public void Populate(string objectName)
{
//Clear the previous items in the list.
pooledObjects[objectName].Clear(); | {
"domain": "codereview.stackexchange",
"id": 23565,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, .net, unity3d",
"url": null
} |
grovers-algorithm
Next, we proceed with defining the good and bad states, as follows (these are defined by KLM in equation 8.1.3 on page 155):
$$|\psi_{good}\rangle = \frac{1}{\sqrt{|G|}}\sum_{i \in G}|i\rangle \qquad \text{and} \qquad |\psi_{bad}\rangle = \frac{1}{\sqrt{|B|}}\sum_{i \in B}|i\rangle$$
Moreover, we define:
$$|\psi_{uniform}\rangle = \frac{1}{\sqrt{N}}\sum_{i \in \{0,1\}^n}|i\rangle = \sin\theta |\psi_{good}\rangle + \cos\theta |\psi_{bad}\rangle$$
where $\theta = \arcsin(\sqrt{|G|/N}) = \arcsin(1/\sqrt{N})$.
Let's now devise an intuitive visualization of Grover's algorithm. To that end, consider all the quantum states that can be written as $\alpha|\psi_{good}\rangle + \beta|\psi_{bad}\rangle$ with $|\alpha|^2 + |\beta|^2 = 1$, and let's display them in the following picture. | {
"domain": "quantumcomputing.stackexchange",
"id": 138,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "grovers-algorithm",
"url": null
} |
electrostatics, electric-fields, charge, conductors
Title: How can there be zero electric field in the marked region (in the image) in the conductor? as the marked region is nearer to surface with positive charge density should there be a net electric field instead of 0? The net electric field inside a conductor is zero because it is not just the field generated by the surface charges, it is the sum of that with the external electric field.
Remember that in order to polarize a material like this you need to put it in an external electric field. This electric field causes the charges of opposite sign to accumulate on opposite surfaces. They do so in such a way that the field they generate exactly cancels the external field.
This external field can be generated by, for example, a charged sphere or capacitive plates surrounding the conductor without touching it. | {
"domain": "physics.stackexchange",
"id": 85250,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics, electric-fields, charge, conductors",
"url": null
} |
The function $\varphi$ is well-defined: if $gG_x=hG_x$, then $g\in hG_x$, and we just showed that in that case $g\cdot x=h\cdot x$.
It’s clear that $\varphi$ is a surjection: if $y\in\operatorname{Orb}x$, then $y=h\cdot x=\varphi(hG_x)$ for some $h\in G$. To complete the argument you need only show that $\varphi$ is injective: if $h_1G_x\ne h_2G_x$, then $\varphi(h_1G_x)\ne\varphi(h_2G_x)$. This is perhaps most easily done by proving the contrapositive: suppose that $\varphi(h_1G_x)=\varphi(h_2G_x)$, and show that $h_1G_x=h_2G_x$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854138058637,
"lm_q1q2_score": 0.8102397477578431,
"lm_q2_score": 0.8354835371034368,
"openwebmath_perplexity": 76.53288779803717,
"openwebmath_score": 0.9669542908668518,
"tags": null,
"url": "http://math.stackexchange.com/questions/265963/proving-the-stabilizer-is-a-subgroup-of-the-group-to-prove-the-orbit-stabiliser/265969"
} |
algorithms, computational-geometry, graphics, topology, digital-curve
If it is true that you can't model NURBS with Bezier curves, then I would like to know why rational functions and polynomials can't be morphed into one another, at least at a high level (what is preventing the transformation between the two). In that case I would also like to know if there is a way to approximate a NURBS curve with Bezier curves, even though you lose some precision or the curve changes slightly. I would then just like to know how much you lose when approximating a NURBS curve with a Bezier curve, and what the algorithm or technique is called so I can further explore how to do it. If there is a standard algorithm for accomplishing this, that would be cool to know instead too. I assume that your cubic spline is non-rational, meaning $w$ = 1, then this is in general true that exact conversion is not possible. NURBS are rational, so you can model conics, say circle whereas Bézier cannot. There is special case: rational Bézier curve, which could be used in place of NURBS. | {
"domain": "cs.stackexchange",
"id": 13008,
"lm_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, computational-geometry, graphics, topology, digital-curve",
"url": null
} |
c, strings, parsing
test(strcmp(output[0], "a") == 0);
test(strcmp(output[1], "bbb") == 0);
test(strcmp(output[2], "cccc") == 0);
test(strcmp(output[3], "dd") == 0);
If you're writing the tests in C++, you get to use standard collections to make that side of things more readable:
test_strings_eq({"a", "bbb", "cccc", "dd"}, output); | {
"domain": "codereview.stackexchange",
"id": 43996,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, strings, parsing",
"url": null
} |
android
Title: Correct tf setup for rviz for Android
Hi all,
I'm trying to get rviz for Android running but my transform tree seems to be wrong, all the elements of the robot model are placed into coordinate system root.
The transform tree currently is /world -> /base_link -> other robot elements. Is this the correct way to do it?
Also rviz for Android only lets me choose "world" as the fixed frame, all the other elements in the transform tree do not show up (like they do in rqt, for example).
Originally posted by bjoerngiesler on ROS Answers with karma: 21 on 2013-07-21
Post score: 0
Have you checked via view_frames if there is only one and correct tree for all your transform frames?
Also you can run roswtf to check for anything mad. There is a roswtf-tf-plugin that should be included automatically. I have seen that not to happen within groovy, but you'll see in the output. | {
"domain": "robotics.stackexchange",
"id": 14994,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "android",
"url": null
} |
algorithms, matrices
Title: Fastest algorithm for matrix inversion What is the fastest way to compute the inverse of the matrix, whose entries are from file $\mathbb{R}$ (set of real numbers)?
One way to calculate the inverse is using the gaussian elimination method. In this method append more columns(double the number of columns ) to the input matrix and then we try to make last row zero except the last column entry and second last and so on until we get a identity matrix and then we stop and we have a inverse of input matrix. Consider the cost of one multiplication, division and addition is constant. Then total $O(n^2)$ many operations is needed.
Is there any algorithm which is faster than the above algorithm? Please give the algorithm or reference to the algorithm Gaussian elimination requires $O(n^3)$ operations, not $O(n^2)$. | {
"domain": "cs.stackexchange",
"id": 10046,
"lm_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, matrices",
"url": null
} |
organic-chemistry, materials, polymers
Here is a link to the PEDOT:PSS I am looking at: Even if you switch to an organic solvent, if the polypyrrole is in water, it will perturb the PEDOT:PSS layer.
Your best bet would be to use a poly-alkyl pyrrole or other conjugated polymer that's soluble in something that doesn't dissolve PEDOT:PSS.
Let's say you switch the solvent to DMF or DMSO and it dissolves the PEDOT:PSS. Then you spin-coat that new mixture onto ITO. Once you drop the aqueous solution of polypyrrole, it will dissolve the PEDOT:PSS.
I think you're looking at this the wrong way. Rather than trying to change the PEDOT:PSS (which will be tricky - PSS is anionic) you should consider changing your polymer. Alternatively, get rid of PEDOT:PSS and use another hole injection layer. (PEDOT:PSS is acidic and will etch the indium out of ITO.) | {
"domain": "chemistry.stackexchange",
"id": 2813,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, materials, polymers",
"url": null
} |
we are trying to capture the notion which explains the di⁄erence between (a;b) and [a;b] and generalize the notion of closed and open intervals to any sets. and R are both open and closed; they’re the only such sets. Open sets appear directly in the definition of a topological space. Let $$\alpha := \delta-d(x,y)$$. Solutions 2. Take $$\delta := \min \{ \delta_1,\ldots,\delta_k \}$$ and note that $$\delta > 0$$. In other words, a nonempty $$X$$ is connected if whenever we write $$X = X_1 \cup X_2$$ where $$X_1 \cap X_2 = \emptyset$$ and $$X_1$$ and $$X_2$$ are open, then either $$X_1 = \emptyset$$ or $$X_2 = \emptyset$$. If f from R to R is a continuous map, is the image of an open set always open ? Be careful to notice what ambient metric space you are working with. Therefore $$(0,1] \subset E$$, and hence $$\overline{(0,1)} = (0,1]$$ when working in $$(0,\infty)$$. Therefore $$w \in U_1 \cap U_2 \cap [x,y]$$. We will now show that for every subset $S$ of a discrete metric space is | {
"domain": "unhcr.gr",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668681821134,
"lm_q1q2_score": 0.8021769904931487,
"lm_q2_score": 0.817574478416099,
"openwebmath_perplexity": 354.70289889697375,
"openwebmath_score": 0.9441039562225342,
"tags": null,
"url": "http://donors.unhcr.gr/h96l64a/viewtopic.php?9b4489=both-open-and-closed-set"
} |
algorithms, time-complexity
Here is a shorter version that could be used as a reference answer to the question for grading. Again, only the conventional binary search algorithms are considered.
The binary search algorithm always runs in $O(\log n)$ time in the usual computation model.
If the wanted element is among the elements that could be possibly compared within $c$ comparisons for some constant $c$, then the algorithm time is $O(1)$. It happens when the number of total elements is bounded by a constant, when the wanted element is the element in the middle of a sorted array of odd length and when the depth of the wanted element is less than a constant where a binary search tree is used. | {
"domain": "cs.stackexchange",
"id": 13630,
"lm_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, time-complexity",
"url": null
} |
ros
Comment by mirzashah on 2013-05-06:
get a chance
Comment by tfoote on 2013-05-06:
@TJump the above version will work as well as yours. The CMAKE_INSTALL_PREFIX needs to end up somewhere on your CMAKE_PREFIX_PATH when you want to compile things on top of console_bridge.
Comment by TJump on 2013-05-19:
I finally determined why this was not working for me. I did not have cmake in my ubuntu build. Once I added cmake the above works fine.
Comment by andrew-unit on 2013-08-25:
I am stuck on the same problem. I tried to follow the above instructions, but I get the following: | {
"domain": "robotics.stackexchange",
"id": 14077,
"lm_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
} |
ruby, ruby-on-rails, error-handling, e-commerce
return
rescue Stripe::AuthenticationError => e
@err = stripe_error(e, 'cancellation_authentication', fee.cancellation_fee)
render :err_show, status: :payment_required, json: @err
return
rescue Stripe::APIConnectionError => e
@err = stripe_error(e, 'cancellation_api_connect', fee.cancellation_fee)
render :err_show, status: :payment_required, json: @err
return
rescue Stripe::StripeError => e
@err = stripe_error(e, 'cancellation_generic error', fee.cancellation_fee)
render :err_show, status: :payment_required, json: @err
return
rescue => e
@err = stripe_error(e, 'cancellation_something_else', fee.cancellation_fee)
render :err_show, status: :payment_required, json: @err
return
end | {
"domain": "codereview.stackexchange",
"id": 14536,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, ruby-on-rails, error-handling, e-commerce",
"url": null
} |
java, beginner, immutability
public Date getDateOfBirth() {
return dateOfBirth;
}
because, someone could do:
employee.getDateOfBirth().setYear(1900);
and suddenly your employee has aged... a lot.
What the oracle documentation is saying, is that, if you have mutable content, you should return a copy of that data. This is often called a 'defensive copy':
public Date getDateOfBirth() {
return new Date(dateOfBirth.getTime());
}
Update: additionally, your method should be final so that no subclasses can change the behaviour of getDateOfBirth() (same is true for getName()). If the method is not final, then a subclass could possibly override the method, and do it in a way which make the name/dateOfBirth mutable.
Note, that the constructor for Date, in this instance, takes a long value. This leads on to a suggestion that the immutable class should store a long instead of a Date. The long is immutable anyway, if final.
public class Person {
private final String name;
private final long dateOfBirth; | {
"domain": "codereview.stackexchange",
"id": 10058,
"lm_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, immutability",
"url": null
} |
# How to define dots symbol(•) in LaTeX?
You use dot symbols in different ways. Sometimes only dot symbols are used, sometimes more than one dot is used and dot symbols are used above and inside the letter.
In this tutorial, we will discuss in-depth the use of all kinds of dot symbols and latex commands.
## Simple dot symbol
In latex, the simple dot symbol is represented by the \cdot command. And you may have seen its use in vector dot products.
Properties Value Symbol Dot Package Default Command \cdot Argument No Example \cdot → •
\documentclass{article}
\begin{document}
$$\cdot$$
$$\vec{\imath} \cdot \vec{\jmath}$$
\end{document}
Output :
Also, you can take the help of physics package. Where the \vdot command is used to define the vector dot product.
\documentclass{article}
\usepackage{physics}
\begin{document}
$$\vdot$$
$$\vec{p} \vdot \vec{q}$$
\end{document}
Output :
## Latex three dots symbol | {
"domain": "physicsread.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9653811601648195,
"lm_q1q2_score": 0.8002419064431462,
"lm_q2_score": 0.828938806208442,
"openwebmath_perplexity": 1804.693458070792,
"openwebmath_score": 0.9861055016517639,
"tags": null,
"url": "https://www.physicsread.com/latex-dots/"
} |
quantum-mechanics, homework-and-exercises, perturbation-theory
$$|\psi(t)\rangle = T\left(e^{-i\int_{-\infty}^{t}dt'H(t')}\right)|\psi\rangle$$
where $T$ is a time-ordering operator. To first order in $f(t)$, this can be written as
$$|\psi(t)\rangle \approx e^{-i\int_{-\infty}^{t}dt'H_{0}}|\psi(t)\rangle -i\int_{-\infty}^{t}dt'f(t')e^{-iH_{0}(t-t')}O_{1}e^{-iH_{0}(t'-(-\infty))}|\psi\rangle$$
This is the claim that I'm having difficulty verifying. Since we can't say anything about how $O_{1}$ commutes (or fails to commute) with $H$, I've been stuck for a while. Most of my attempts fail to reproduce this identity. Does anyone have a suggestions for how to proceed?
Also for those who are curious regarding which sources use this fact, you might look at Xiao-Gang Wen's book (Quantum Field Theory of Many-Body Systems), Chapter 2. We start from the equation of time evolution:
$$|\psi(t)\rangle = T\left(e^{-i\int_{-\infty}^{t}dt'H(t')}\right)|\psi\rangle$$
Now, we need to evaluate the exponential with the following Hamiltonian:
$$H(t) = H_0 + f(t)O_1$$ | {
"domain": "physics.stackexchange",
"id": 21276,
"lm_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, homework-and-exercises, perturbation-theory",
"url": null
} |
performance, r
Given your example of A, B, C, this is returns a data frame:
date x id
1 1 94.45361 b
2 2 20.36988 b
3 3 94.33092 a
4 5 67.40137 a
The problem with the for loop is that it's discouraged in R because it's inefficient.
Using merge should be fast.
I don't think you can get around merging,
as the meaning of your logic is in fact merging. | {
"domain": "codereview.stackexchange",
"id": 14122,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, r",
"url": null
} |
which of the folklowing can be the vector (2anb)a (bn2)?… 2. Find the volume of the parallelepiped spanned by the vectors $\vc{a} = (-2,3,1)$, $\vc{b} = (0, 4, 0)$, and $\vc{c} = (-1,3,3)$. Find the alphabetic word product. QED. I'd like to work on a problem with you, which is to compute the volume of a parallelepiped using 3 by 3 determinants. Solution: The volume is the absolute value of the scalar triple product … 69.55% Correct | 30.45% Incorrect. Volume of a parallelepiped 17.1. In mathematics, a volume element provides a means for integrating a function with respect to volume in various coordinate systems such as spherical coordinates and cylindrical coordinates.Thus a volume element is an expression of the form = (,,) where the are the coordinates, so that the volume of any set can be computed by = ∫ (,,). 783 Solvers. | − | = − Code to add this calci to your website Just copy and paste the below code to your webpage where you want to display this calculator. 9. Do we care | {
"domain": "elfrenltd.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9748211604938802,
"lm_q1q2_score": 0.8102158243337556,
"lm_q2_score": 0.8311430415844384,
"openwebmath_perplexity": 795.754320048608,
"openwebmath_score": 0.7257758975028992,
"tags": null,
"url": "https://elfrenltd.com/a-level-babr/ca0921-volume-of-parallelepiped-example"
} |
organic-chemistry, acid-base, reactivity
In a polar aprotic solvent, however, where there are no positively polarized hydrogens for a nucleophile to hook onto; $\ce{F^-}$ becomes a much stronger nucleophile. Actually, $\ce{F^-}$ becomes a better nucleophile than $\ce{I^-}$, likely due to $\ce{F^-}$'s greater charge density. | {
"domain": "chemistry.stackexchange",
"id": 2447,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, acid-base, reactivity",
"url": null
} |
states that the de?nite integral of a function may be found from the antiderivative of the function. , Part Five, Chapters 17 and 18 PGE 310: Formulation and Solution in Geosystems Engineering Dr. Description: This is an introductory numerical analysis course. time) and one or more derivatives with respect to that independent variable. To plot one set of values versus another (i. Area integral over a triangle in MATLAB -- is numerical integration possible? a triangle in MATLAB -- is numerical integration possible? the rest of the code. Symbolic objects such as π or etc. [Note: Want… Read more about Numerical Integration of Tabular. Numerical Integration with Trapezoidal and Learn more about numerical integration, trapezoidal rule, simpson's rule. The logic is the same as 2-variable integration. quadl Numerical integration with adaptive Lobatto quadrature. MATLAB code for Trapezoidal Rule. Numerical Differentiation. Curve fitting -- 9. But then it finds the area between the second pair | {
"domain": "gremium-franconia.de",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9852713826904225,
"lm_q1q2_score": 0.852480536737994,
"lm_q2_score": 0.865224091265267,
"openwebmath_perplexity": 977.7125887879093,
"openwebmath_score": 0.5875372886657715,
"tags": null,
"url": "http://rvjs.gremium-franconia.de/numerical-integration-matlab-code.html"
} |
c++, recursion, unit-testing, boost, c++20
The usage description
For example, auto test_vector = n_dim_container_generator<std::vector, 2, 3, int>(1); is expected to create a "test_vector" object which type is std::vector<std::vector<int>>. The content of this test_vector should as same as the following code.
std::vector<int> vector1;
vector1.push_back(1);
vector1.push_back(1);
vector1.push_back(1);
std::vector<std::vector<int>> test_vector;
test_vector.push_back(vector1);
test_vector.push_back(vector1);
test_vector.push_back(vector1); | {
"domain": "codereview.stackexchange",
"id": 40088,
"lm_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++, recursion, unit-testing, boost, c++20",
"url": null
} |
quantum-chemistry, electrons, orbitals, atoms
However, I'm wondering if an electron can have two positions when unobserved, where these positions are in different orbitals. For example, an electron falls under both the $\mathrm{2s}$ orbital and the $\mathrm{2p}_x$ orbital, if unobserved, and observation forces it to collapse into either $\mathrm{2s}$ or $\mathrm{2p}_x.$
Reference | {
"domain": "chemistry.stackexchange",
"id": 14347,
"lm_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-chemistry, electrons, orbitals, atoms",
"url": null
} |
evolution, zoology, speculative
Now, I suggest that all three can be "solved".
With time.
With a symbiotic relationship between a wheel-like animal and a "driver"-like animal, although this gets awfully close to a "driver"-animal to jump onto an actual (man-made) wheel. (So, perhaps, you can suggest a better loophole around this constraint.)
Roads are presumably not the only ecological niche where animals with wheels could thrive. I'm thinking of frozen lakes, although there skates would be better than wheels.
What, therefore, is the explanation for there not being any wheeled animals?
Please consider, in your answer, the counterfactual: What assumption of yours would be falsified once a wheely animal is discovered? Wheels are possible on the molecular level — bacterial flagella are rotating cores inside a molecular motor, but wheels larger than the flagellum have not really been found. | {
"domain": "biology.stackexchange",
"id": 11933,
"lm_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, zoology, speculative",
"url": null
} |
and dividing of complex numbers imaginary axis be carried Out complex. Property or the FOIL method + 4zbar â 4i ) is - y - 4 yi in set., just like vectors, we first need some kind of standard mathematical notation \! Form or polar form, multiply the magnitudes and … Plot each in! With steps shown 2j is the rectangular form of complex number from form. Binomials is the sign does basic arithmetic on complex numbers, just like,. The distributive property made easier once the formulae have been developed can to. Expressed in polar form. 2.4 of the text for an introduction to complex,. Rectangular forms Euler Identity interactive graph ; 6 form Step 1 sketch a with! Binomials is the conjugate of x + yi in the form are plotted in the form plotted. Numbers to polar form to rectangular using hand-held calculator ; 5 is written in rectangular form of complex without! Parts separately respective horizontal and vertical components 2 ( f ) is - y - 4 bi ) Error Incorrect... Bi, a is the | {
"domain": "vioora.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307700397331,
"lm_q1q2_score": 0.8344632043244667,
"lm_q2_score": 0.8577681031721324,
"openwebmath_perplexity": 429.39060653722373,
"openwebmath_score": 0.800094485282898,
"tags": null,
"url": "https://vioora.com/hugh-frater-qochpg/f12ce6-multiplying-complex-numbers-in-rectangular-form"
} |
c++, tic-tac-toe, machine-learning
There are two problems with this approach. One is that the low order bits of the random number generator are not particularly random, so neither is your result. On my machine, there's a slight but measurable bias toward 0 with that. The second problem is that unless RAND_MAX happens to be an integral multiple of v.size(), this will not result in a uniform distribution. A better solution, if your compiler and library supports it, would be to use the C++11 std::uniform_int_distribution.
Think about the cost of objects
The current code includes this object:
struct WRandmomPolciy
{
static int getMove(DataBaseType::iterator s)
{
const int sum = std::accumulate( s -> second.weight, s -> second.weight + 9, 0 );
if( sum == 0 )
return std::find( gameField, gameField + 9, ' ' ) - gameField; | {
"domain": "codereview.stackexchange",
"id": 24451,
"lm_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++, tic-tac-toe, machine-learning",
"url": null
} |
Graphically, Systems of Equations Solved Algebraically, Quiz: Exponential and Logarithmic Equations, Quiz: Definition and Examples of Sequences, Binomial Coefficients and the Binomial Theorem, Quiz: Binomial Coefficients and the Binomial Theorem, Online Quizzes for CliffsNotes Algebra II Quick Review, 2nd Edition. https://www.khanacademy.org/.../v/multiply-and-simplify-a-radical-expression-2 As long as the roots of the radical expressions are the same, you can use the Product Raised to a Power Rule to multiply and simplify. Rationalizing the Denominator. $\frac{\sqrt[3]{640}}{\sqrt[3]{40}}$. Dividing Algebraic Expressions . We have used the Quotient Property of Radical Expressions to simplify roots of fractions. Look at the two examples that follow. The indices of the radicals must match in order to multiply them. To rationalize this denominator, the appropriate fraction with the value 1 is , since that will eliminate the radical in the denominator, when used as follows: Note we | {
"domain": "gob.mx",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9719924777713886,
"lm_q1q2_score": 0.8495964911947484,
"lm_q2_score": 0.8740772286044095,
"openwebmath_perplexity": 972.4474741957093,
"openwebmath_score": 0.8463869094848633,
"tags": null,
"url": "http://gob2018.morelia.gob.mx/when-was-vfa/viewtopic.php?cd7297=how-to-divide-radical-expressions-with-variables"
} |
arduino, rosserial
Originally posted by Mark Rose with karma: 1563 on 2016-10-10
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by 215 on 2016-10-10:
I am currently running out of memory, meaning i have 553 bytes left.
Comment by 215 on 2016-10-10:
using the internal class gave me 949 bytes of local variables left, so it should be ok?
Comment by 215 on 2016-10-10:
I found the issue somewhere else in the code.. In the while, but i will keep this answer, because i didn't know about the nodehandle class and other people might benefit from it.
Comment by 215 on 2016-10-11:
After further inspection, and after a lot of debugging it seems like what you mention the buffer size has been low.. I doubled it to 256 which seem to have worked. I guess I am currently at the limit of what I can put in with only 683 byte left.
Comment by Mark Rose on 2016-10-11:
Sorry for the confusion. It really depends on what messages you're sending/receiving. Glad you got it working. | {
"domain": "robotics.stackexchange",
"id": 25946,
"lm_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
} |
ros, gazebo, collision, shadow-robot
Originally posted by Ugo with karma: 1620 on 2012-11-23
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by joseescobar60 on 2012-11-23:
hey, i read the thread but i dont know how can i patch, could you help me with this?
Comment by Ugo on 2012-11-23:
Sorry I didn't patch my version of Gazebo and I'm waiting for the next release hoping to have this annoying bug fixed so I can't help you with that I'm afraid.
Comment by joseescobar60 on 2012-11-26:
It's me again, i read that is a new release of the gazebo, do you know how can i update the simutalor_gazebo to fix the problem with the contacsensors??
Comment by Ugo on 2012-11-26:
no, sorry I don't. | {
"domain": "robotics.stackexchange",
"id": 11851,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, gazebo, collision, shadow-robot",
"url": null
} |
javascript, algorithm, programming-challenge, bitwise
console.log(numOfDeletionsA + numOfDeletionsB);
}
function countAlphabetFrequency (arrOfAlphabets){
var resultObj = {}
for (i = 0; i < arrOfAlphabets.length; i++) {
if (resultObj[arrOfAlphabets[i]]) {
resultObj[arrOfAlphabets[i]] += 1;
} else {
resultObj[arrOfAlphabets[i]] = 1;
}
}
return resultObj;
}
function countNumberOfDeletions (mainObj, referenceObj){
var numOfDeletions = 0;
for (var k in mainObj) {
if (mainObj.hasOwnProperty(k)) {
if (mainObj[k] && referenceObj[k]) {
// Alphabet k exists in both strings
if (mainObj[k] > referenceObj[k]) {
// Main string has more k than in reference string
numOfDeletions += mainObj[k] - referenceObj[k];
mainObj[k] = referenceObj[k];
}
} else {
// Alphabet k only exists in Main string
numOfDeletions += mainObj[k];
}
}
} | {
"domain": "codereview.stackexchange",
"id": 25977,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, algorithm, programming-challenge, bitwise",
"url": null
} |
ros-kinetic, message-filters
/opt/ros/kinetic/include/message_filters/signal9.h:281:40: required from ‘message_filters::Connection message_filters::Signal9<M0, M1, M2, M3, M4, M5, M6, M7, M8>::addCallback(C&) [with C = const boost::_bi::bind_t<boost::_bi::unspecified, void (*)(const boost::shared_ptr<const sensor_msgs::PointCloud2_<std::allocator<void> > >&, const boost::shared_ptr<const visualization_msgs::Marker_<std::allocator<void> > >&, const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > >&), boost::_bi::list2<boost::arg<1>, boost::arg<2> > >; M0 = sensor_msgs::PointCloud2_<std::allocator<void> >; M1 = visualization_msgs::Marker_<std::allocator<void> >; M2 = geometry_msgs::PoseStamped_<std::allocator<void> >; M3 = message_filters::NullType; M4 = message_filters::NullType; M5 = message_filters::NullType; M6 = message_filters::NullType; M7 = message_filters::NullType; M8 = message_filters::NullType]’ | {
"domain": "robotics.stackexchange",
"id": 34490,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-kinetic, message-filters",
"url": null
} |
ros, ros-kinetic, ardent
Comment by Rob V on 2018-07-25:
Sure! In short, the problem was that the package's suffix was "_interfaces", as that's considered a standard suffix in ROS2 but not 1, so during processing, it's removed from the name. It compares "my_interfaces" (ROS1) to "my" (ROS2), and those aren't equivalent and are ignored.
Comment by Rob V on 2018-07-25:
Sorry, I was going to wait until the entire problem was solved before posting an answer in case it was relevant. I suppose I'll answer this and start a new question. See it here.
Comment by Dirk Thomas on 2018-07-25:
The failing include is either due to not sourcing the ROS 1 workspace in the right order or due to the ROS 1 package not exporting its include directory properly.
Comment by Rob V on 2018-07-25:
Does anything about my CMakeLists file stick out to you as wrong?
Comment by Dirk Thomas on 2018-07-25:
You might want to try adding this line: https://github.com/ros/std_msgs/blob/474568b32881c81f6fb962a1b45a7d60c4db9255/CMakeLists.txt#L46 | {
"domain": "robotics.stackexchange",
"id": 31315,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-kinetic, ardent",
"url": null
} |
homework-and-exercises, forces, electrostatics
$$F=\frac{\pi R^2\sigma_1\sigma_2}{2\epsilon_0}$$ Hm, I would give superposition a go.
Start with two equally charged half spheres with surface charge density $\sigma_{2}$. The consider a similar system superposed on it with but with surface charge density $\sigma_{3} = \sigma_{1}-\sigma_{2}$. We can solve this system as an instance of the first case using $\sigma_{1}$. Let's called this known answer $F_{11}$.
Now, the force on the superposed hemisphere is, by superposition, the force on the hemisphere with charge $\sigma_{2}$ (which is what we want to know!), plus the force on the one with charge $\sigma_{3}$. Call these $F_{12}$ and $F_{13}$, respectively.
The crucial insight now is that the ratio of these forces must be the same as the ratio of the charges of the right hemispheres because (also a consequence of the superposition principle) the force on a system, all other things being equal, scales with the charge on it! This means that: | {
"domain": "physics.stackexchange",
"id": 15551,
"lm_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, forces, electrostatics",
"url": null
} |
$\textbf{ Solution Attempt:}$ Let $P_n=\{0=t_0,...,t_n=1\}$ be a partition of $[0,1]$, where $t_k = \frac{k}{n}$. For this partition, we have $$U(f,P_n)=\sum^{n}_{k=1} t_k (t_k - t_{k-1}) = \sum^{n}_{k=1} t_k (\frac{k}{n} - \frac{k-1}{n})=\sum^{n}_{k=1} \frac{k}{n} (\frac{1}{n})= \frac{1}{n^2} \sum^{n}_{k=1} k.$$ A familiar property of the natural numbers gives us that $\sum^{n}_{k=1} k= \frac{1}{2}n(n+1).$ Thus, $U(f,P)= \frac{1}{2} + \frac{1}{2n}.$ Recall, the upper Riemann integral $U(f)$ is defined as $U(f)=\inf \{U(f,P)\}$, where $P$ is a parition of $[0,1].$ As $n \rightarrow \infty$, $P_n \rightarrow \frac{1}{2}.$ [Note: this is where I am a little unsure of myself.] Thus, $U(f)=\frac{1}{2}$. However, the lower Riemann integral is $0$. Hence, the upper and lower Riemann integrals disagree. We conclude that $f$ is not Riemann integrable. $\blacksquare$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9879462226131666,
"lm_q1q2_score": 0.8357456354871224,
"lm_q2_score": 0.8459424373085146,
"openwebmath_perplexity": 138.82590225294092,
"openwebmath_score": 0.9870497584342957,
"tags": null,
"url": "http://math.stackexchange.com/questions/470908/the-riemann-integrability-of-a-function-similar-to-dirichlets-function"
} |
quantum-mechanics, operators, hilbert-space, mathematical-physics
Note that in order to talk about $C^\ast$-algebras for unbounded operators $A$, the easier way to get bounded operators out of them is to talk about their exponentiated versions $\mathrm{e}^{\mathrm{i}At}$, with which they are in one-to-one correspondence via Stone's theorem. | {
"domain": "physics.stackexchange",
"id": 97313,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, operators, hilbert-space, mathematical-physics",
"url": null
} |
python, cryptography
1: Improve variable names. Several of your variable names are single letters. plaintext_length is way more readable than f3.
2: Split your code into logical units. Refactor into functions, and group code that logically belongs together by separating such groups with a single empty line.
3: Why on earth are you doing this?!
if os.path.exists(f2):
f1 = file(f2, "w")
f1 = open(f2, "w")
f1.write(key)
f1.close()
else:
f1 = file(f2, "w")
f1 = open(f2, "w")
f1.write(key)
f1.close() | {
"domain": "codereview.stackexchange",
"id": 4054,
"lm_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, cryptography",
"url": null
} |
ros, navigation, ros2, odometry, 2d-pose-estimate
Originally posted by Leonti on ROS Answers with karma: 62 on 2020-07-18
Post score: 0
You do not need to worry about the drift in the odometry coordinates unless you start seeing massive jumps between successive readings. Gradual drift over time is fine.
Odometry typically has drift. Even with a very good sensor providing odometry data, there will be drift over time because it is a continuously-updating state based solely on the sensor measurement of change from the previous state. Any error in those measurements gets integrated into the result.
Approaches such as localising to a known map are used to give more robust pose estimates at a point in time, but they tend to have a lower update rate than odometry. So what tools like slam_toolbox do is they integrate the two approaches (or more) | {
"domain": "robotics.stackexchange",
"id": 35298,
"lm_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, ros2, odometry, 2d-pose-estimate",
"url": null
} |
general-relativity, quantum-gravity, curvature, gravitational-waves
Title: How do gravitons and curved space time work together? I've heard two different descriptions of gravity, and I'm wondering how they work together.
The first is Gravitons:
"The three other known forces of nature are mediated by elementary
particles: electromagnetism by the photon, the strong interaction by
the gluons, and the weak interaction by the W and Z bosons. The
hypothesis is that the gravitational interaction is likewise mediated
by an – as yet undiscovered – elementary particle, dubbed the
graviton. In the classical limit, the theory would reduce to general
relativity and conform to Newton's law of gravitation in the
weak-field limit." -- Source | {
"domain": "physics.stackexchange",
"id": 10894,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, quantum-gravity, curvature, gravitational-waves",
"url": null
} |
D'Alembert's principle can be used to convert any dynamic system into a static one by converting accelerations into equal but opposite inertia forces.
Hence in the diagram below there is a horizontal force acting to the right with value of $m a$. Now all you have to do is the force balance in x-axis and y-axis to get $T$ and $a$
- | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9783846691281407,
"lm_q1q2_score": 0.8066409111566383,
"lm_q2_score": 0.8244619285331332,
"openwebmath_perplexity": 376.97023907560515,
"openwebmath_score": 0.6600198745727539,
"tags": null,
"url": "http://physics.stackexchange.com/questions/39121/calculating-cars-acceleration-from-change-in-angle-of-hanging-object?answertab=votes"
} |
mathematics, optics, geometry
In the image above, "Height" to base size is the same for both triangles.
So: Image-height / focal-length = Object height / distance to subject.
So Image-height = focal-length x Object height / distance to subject.**
Note:
Edited - I had a factor of 10 error initially.
I KNEW my 200mm lenses were not THAT good, so went back and found the error. | {
"domain": "engineering.stackexchange",
"id": 3124,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mathematics, optics, geometry",
"url": null
} |
general-relativity, cosmology, space-expansion
However, in cosmology, where all of space is expanding, galaxies become further apart from each other, but an individual galaxy, itself, does not expand (due to the forces that hold it together), people do not expand (also due to the internal forces that hold us together), nor do physical rulers. That is, lengths of physical rulers do not change because of their internal forces. I believe distance, in cosmology, as measured by the physical ruler is called "proper distance", vs "co-moving distance", which does expand as the universe does. | {
"domain": "physics.stackexchange",
"id": 76791,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, cosmology, space-expansion",
"url": null
} |
homework-and-exercises, kinematics, distance, displacement
Title: Displacement and position for a ball thrown up into the air
What would the displacement and distance traveled (from the starting point to the ending point) be for a ball that is thrown up into the air? (Hint: Think about the definition for displacement) | {
"domain": "physics.stackexchange",
"id": 40815,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, kinematics, distance, displacement",
"url": null
} |
r2 using the autocorrelation function the example2 ACF values i > 0, Proof: by 1... In this example, the critical value for the variance a formal of. Your help in improving the accuracy and quality of the Real Statistics functions: Real... The [ -1,1 ] interval using sensors namely, variance, z-score, and p-value i don ’ t that! Follows the same format with N-tert-butyl-N, N-dichloroamine in benzene goal is to calculate autocorrelation function the! Believe that any of the residuals and sum across time you have a name ( a string ),. Based on the concept of lag Errors are normally distributed with a time-delayed of. Mean, or average, for the Durbin Watson statistic: H ( ). Concepts, namely, variance, z-score, and the upper value of for. As follows: the input vector using Matlab built-in function circshift, so it very... Functions to perform the tests on this webpage thioacetate with N-tert-butyl-N, N-dichloroamine in benzene,:... Thioacetate with N-tert-butyl-N, N-dichloroamine in | {
"domain": "com.au",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9702399051935107,
"lm_q1q2_score": 0.8246759528872222,
"lm_q2_score": 0.8499711756575749,
"openwebmath_perplexity": 1312.901651925368,
"openwebmath_score": 0.7738346457481384,
"tags": null,
"url": "http://indigocomputers.com.au/calories-in-onn/9e797b-how-to-calculate-autocorrelation"
} |
Then I then realized that one could simply just use the law of sines, which has a slightly less tedious set of algebraic manipulations because the formulas for the $$\sin(A)$$, $$\sin(B)$$, and $$\sin(C)$$ are not really necessary. | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9664104972521579,
"lm_q1q2_score": 0.8252302445971783,
"lm_q2_score": 0.8539127492339909,
"openwebmath_perplexity": 599.9081437511267,
"openwebmath_score": 0.7620023488998413,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-7955-post-71539.html"
} |
java, beginner
marksaway = 41 - totalmark;
nextgrade = "6";
} else if(totalmark >= 41 && totalmark < 54) {
grade = "6";
marksaway = 54 - totalmark;
nextgrade = "7";
} else if(totalmark >= 54 && totalmark < 67) {
grade = "7";
marksaway = 67 - totalmark;
nextgrade = "8";
} else if(totalmark >= 67 && totalmark < 80) {
grade = "8";
marksaway = 80 - totalmark;
nextgrade = "9";
} else if(totalmark >= 80) {
grade = "9";
} | {
"domain": "codereview.stackexchange",
"id": 32862,
"lm_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",
"url": null
} |
cc.complexity-theory, np-hardness, open-problem, board-games
Finally, both checkers and international draughts have a forced capture rule: If you can capture an opponent's piece, you must. However, the rules rules disagree when there are several options for multiple. In checkers, you may choose any maximal sequence of captures; in other words, you can choose any capture sequence that ends when the capturing piece cannot capture any more. In international draughts, you must choose the longest sequence of captures. Thus, my problem is equivalent to the following: | {
"domain": "cstheory.stackexchange",
"id": 232,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cc.complexity-theory, np-hardness, open-problem, board-games",
"url": null
} |
c, multithreading, homework, linux, pthreads
Title: Producer-consumer in C using pthread_barrier We're preparing for an exam at the moment, and our lecturer has given us a sample problem to work on. I have it completed, but would like to know a) If it is actually doing what it's supposed to, and b) if it could be done more efficiently or there are any questionable coding aspects. It certainly seems to be working, and GDB tells me the extra threads are definitely bring created.
The question:
Implement a multithreaded car park simulator in C. One thread should
move cars into the car park and another thread should take cars out of
the car park (these steps can be simulated by simply inserting
integers into/removing integers from a buffer).
The capacity of the car park should be supplied as a command line
parameter to your program.
A monitor thread should periodically print out the number of cars
currently in the car park.
Requirements: | {
"domain": "codereview.stackexchange",
"id": 13770,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, multithreading, homework, linux, pthreads",
"url": null
} |
frequency, bandwidth, radar
$$FBW = \frac{f_2 - f_1}{f_c}$$
Where $f_1$ and $f_2$ are the lower and upper frequencies centered around $f_c$.
When defining an array, one usually defines the antenna for a single frequency and yields the usual pattern you've probably seen before.
Let's take two 16-element arrays whose center frequencies $f_c$ are at 2 GHz and 10 GHz respectively. Both will have an element spacing of $0.5\lambda$.
Narrowband Operation
Now let's assume we're transmitting a waveform with 5 MHz bandwidth $B$. Also we want to steer the array to 30 degrees off-boresight.
The antenna patterns for the three frequencies $f_c-B/2$, $f_c$, $f_c+B/2$ at the desired steering angle are | {
"domain": "dsp.stackexchange",
"id": 11698,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "frequency, bandwidth, radar",
"url": null
} |
• Which means we additionally assume $A$? No. Where did you get that notion? Oct 14 at 20:47
• @TedShifrin I fail to see the mistake you are trying to point to. $\neg (A \land \neg B)$ is equivalent to $A \to B$. So proving $A \to B$ is the same as deriving a contradiction under the assumption $A \land \neg B$. Oct 14 at 21:04
• It’s your discussion of the contrapositive that is flawed. Oct 14 at 21:05
• It is TedShifrin's comment that is flawed. Lereau's claim that the proof-by-contrapositive rule and the proof-by-contradiction rule, appropriately formalized, are equivalent even over intuitionistic logic, is actually completely correct. Oct 15 at 17:54 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9585377284730286,
"lm_q1q2_score": 0.8166289035649364,
"lm_q2_score": 0.8519528019683106,
"openwebmath_perplexity": 173.8768554607002,
"openwebmath_score": 0.8441201448440552,
"tags": null,
"url": "https://math.stackexchange.com/questions/4276505/is-it-really-bad-style-to-write-proofs-by-contrapositive-as-proofs-by-contradict"
} |
image-processing, convolution, matrix
h_0 & h_3 & h_2 & h_1\\
h_1 & h_0 & h_3 & h_2\\
h_2 & h_1 & h_0 & h_3\\
h_3 & h_2 & h_1 & h_0
\end{bmatrix}.$$
So we can calculate $h[n]*g[n]$ by evaluating the product $\mathbf{H}\mathbf{g}$, where $\mathbf{g}=\begin{bmatrix}
g_0 & g_1 & g_2 & g_3
\end{bmatrix}^T$.
This can be extended to 2-D signals. I explain it through the given example.
The size of signals are $2\times2$ and $3\times3$. The size of convolution is $(2+3-1)\times(2+3-1)=4\times4$. So we need to pad zeros to adjust the size of 2-D signal $x_2(m,n)$:
$$\mathbf{A}=\begin{bmatrix}
0 & 0 & 0 & 0\\
0 & -1 & 0 & 0\\
-1 & 4 & -1 & 0\\
0 & -1 & 0 & 0
\end{bmatrix}$$
Now construct four circulant matrices corresponding to the four rows of $\mathbf{A}$ denoted by $\mathbf{a}_i$ as follows:
$$\begin{align}
\mathbf{X}_0&=\mathrm{circ}(\mathbf{a}_0)=\mathrm{circ}(\begin{bmatrix}
0 & -1 & 0 & 0
\end{bmatrix})\\
\mathbf{X}_1&=\mathrm{circ}(\mathbf{a}_1)=\mathrm{circ}(\begin{bmatrix}
-1 & 4 & -1 & 0
\end{bmatrix})\\ | {
"domain": "dsp.stackexchange",
"id": 4421,
"lm_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, convolution, matrix",
"url": null
} |
java, object-oriented, role-playing-game
public static Monster newRandomMonster() {
int random = rand.nextInt(4) + 1;
Monster monster = null;
switch (random) {
case 1:
monster = newGoblin();
break;
case 2:
monster = newOrc();
break;
case 3:
monster = newShadowAssassin();
break;
case 4:
monster = newFeralGhoul();
break;
}
return monster;
}
public static Monster newGoblin() {
return new Monster("Goblin", "A grotesque, small enemy with a sub-par "
+ "skill-set. ", 30, 10, 15, 2, 10, true);
}
public static Monster newOrc() {
return new Monster("Orc", "A brutish, green mass of destruction. High "
+ "Attack and Defense.", 50, 15, 20, 3, 10, true);
} | {
"domain": "codereview.stackexchange",
"id": 37720,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, object-oriented, role-playing-game",
"url": null
} |
This creates a visual bias that does not portray actual data. TrigCheatSheet. (Angles may be in degrees or radians) 8. In this unit we explain how to convert from Cartesian co-ordinates to polar co-ordinates, and back again. You can use absolute or relative polar coordinates (distance and angle) to locate points when creating objects. For each point in the coordinate plane, there is one representation, but for each point in the polar plane, there. We would like to be able to compute slopes and areas for these curves using polar coordinates. An Introduction to Polar Coordinates Polar coordinates are used in many, many fields even at an introductory level. Let (r,θ) denote the polar coordinates describing the position of a particle. Infinitely many angles, and r can also be negative. Then a number of important problems involving polar coordinates are solved. Convert the following equation to polar coordinates: y = − 4 3 x 6. State three other pairs of polar coordinates for each point | {
"domain": "quilianobike.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9923043516836919,
"lm_q1q2_score": 0.863897468000418,
"lm_q2_score": 0.8705972784807408,
"openwebmath_perplexity": 630.570451027436,
"openwebmath_score": 0.9171416759490967,
"tags": null,
"url": "http://cztg.quilianobike.it/polar-coordinates-pdf.html"
} |
python, deep-learning, convolution, numpy
$$ T\{f(x) \circledast g(x)\}(s) = T\{h(x)\}(s) = T\{f(x)\}(s) \times T\{g(x)\}(s) $$
This is true for the Discrete Fourier Transform and Discrete Convolution as well, so to find your image $i$ from the filtered image $j$ by a filter $h$ given $I$,$J$ and $H$ as the Discrete Fourier transform of $i$,$j$ and $h$, respectively. Let $F\{.\}$ denote the discrete fourier transform and $F^{-1}\{.\}$ denote its inverse transformation:
$$ i = F^{-1}\{I\} = F^{-1}\{\frac{J}{H}\} $$
The discrete fourier transform is implemented efficiently by SciPy(signal module), FFTW, NumPy(fft module) and probably Theano. Having a lot of wrappers arround. | {
"domain": "datascience.stackexchange",
"id": 4949,
"lm_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, deep-learning, convolution, numpy",
"url": null
} |
gazebo, urdf
<link name="J3_Link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://arm_description/meshes/J3_Link.STL" />
</geometry>
<material
name="">
<color rgba="0.792156862745098 0.819607843137255 0.933333333333333 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://arm_description/meshes/J3_Link.STL" />
</geometry>
</collision>
<inertial>
<origin xyz="-383.69E-03 0 20.08E-03" rpy="0 0 0" />
<mass value="3.25" />
<inertia ixx="8067.77E-06" ixy="-4.45E-06" ixz="-13711.96E-06"
iyy="202034.25E-06" iyz="0.16E-06"
izz="198402.66E-06" />
</inertial>
</link> | {
"domain": "robotics.stackexchange",
"id": 37282,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo, urdf",
"url": null
} |
forces, fluid-dynamics, pressure, fluid-statics, flow
An intuitive explanation of pressure:
An excellent analogy to pressure is the normal force of a block on a frictionless incline. The incline constrains the block's motion by applying a normal force. When the incline is vertical, nothing is constrained and the normal force is zero. When a container constrains a fluid's motion, it applies a pressure that is felt everywhere in that fluid. Without a container, no pressure is applied**. See the below illustration: | {
"domain": "physics.stackexchange",
"id": 72116,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "forces, fluid-dynamics, pressure, fluid-statics, flow",
"url": null
} |
A. $0.15 B.$0.20
C. $0.30 D.$0.40
E. $0.45 g=number of glasses sold day 1 x=price per glass day 2 r=revenue both days g*.6=r 3/2*g*x=r 3/2*g*x=g*.6 x=$.40
D
VP
Joined: 09 Mar 2016
Posts: 1230
On a certain day, orangeade was made by mixing a certain [#permalink]
### Show Tags
08 Apr 2018, 04:50
macjas wrote:
On a certain day, orangeade was made by mixing a certain amount of orange juice with an equal amount of water. On the next day, orangeade was made by mixing the same amount of orange juice with twice the amount of water. On both days, all the orangeade that was made was sold. If the revenue from selling the orangeade was the same for both days and if the orangeade was sold at $0.60 per glass on the first day, what was the price per glass on the second day? A.$0.15
B. $0.20 C.$0.30
D. $0.40 E.$0.45
why is my reasoning wrong UPDATE I noticed one mistake, so I corrected it but still dont get how to reach final solution | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9615338101862454,
"lm_q1q2_score": 0.8012697652919633,
"lm_q2_score": 0.8333245870332531,
"openwebmath_perplexity": 2962.814225305419,
"openwebmath_score": 0.3879888951778412,
"tags": null,
"url": "https://gmatclub.com/forum/on-a-certain-day-orangeade-was-made-by-mixing-a-certain-133206.html"
} |
ruby, community-challenge, sudoku
# Returns true if this cell has been set to a value.
#
# @return [Boolean]
def known?
!!@current
end
# Removes a value from this cell's set of possibilities.
#
# If this leaves the cell with but one possibility, the cell is set to it.
#
# @param n [Fixnum] one-based cell value
# @return [void]
#
# @raise [RuntimeError] if n is the only possibility left
def known(n)
if possible? n
raise "No possibilities left for cell #{@id}" if @possibles.size == 1
@possibles.delete n
set(@possibles.take(1).first, :force) if @possibles.size == 1
end
end | {
"domain": "codereview.stackexchange",
"id": 5414,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, community-challenge, sudoku",
"url": null
} |
human-anatomy, vision, eyes
of attention. Via these connections, information about eye-gaze direction could project to spatial attention systems to initiate orienting of attention in the corresponding direction, as in joint attention. Indeed, passive viewing of a face with averted gaze elicits a stronger response in the IPS than viewing a face with direct gaze (Frischen et al., 2007). | {
"domain": "biology.stackexchange",
"id": 4757,
"lm_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-anatomy, vision, eyes",
"url": null
} |
quantum-algorithms, nonlocal-games
The corresponding POVM matrix is
$$
M = \frac{1}{\sqrt{3}}\left(\begin{array}{rrr}
1 & 1 & 1 \\
-1 & -\omega & -\omega^2
\end{array}
\right)
$$
Notice that we've renormalized vectors, i.e. $|E_i'\rangle = \sqrt{\frac{2}{3}}|E_i\rangle$, to satisfy $\sum_i |E_i'\rangle\langle E_i'| = I$.
To construct von Neumann measurement we must find "embedding" of this $M$ into some unitary matrix $M^\prime$. Embedding means that $M$ is just a submatrix of the matrix $M^\prime$.
You can take
$$
M' = \frac{1}{\sqrt{3}}\left(\begin{array}{cccc}
1 & 1 & 1 & 0 \\
-1 & -\omega & -\omega^2 & 0 \\
1 & \omega^2 & \omega & 0 \\
0 & 0 & 0 & \sqrt{3}
\end{array}
\right)
$$
Here the embedding is obvious - $M$ is the top left corner. | {
"domain": "quantumcomputing.stackexchange",
"id": 1498,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-algorithms, nonlocal-games",
"url": null
} |
# Good Question 13
Let’s end the year with this problem that I came across a while ago in a review book:
Integrate $\int{x\sqrt{x+1}dx}$
It was a multiple-choice question and had four choices for the answer. The author intended it to be done with a u-substitution but being a bit rusty I tried integration by parts. I got the correct answer, but it was not among the choices. So I thought it would make a good challenge to work on over the holidays.
1. Find the antiderivative using a u-substitution.
2. Find the antiderivative using integration by parts.
3. Find the antiderivative using a different u-substitution.
4. Find the antiderivative by adding zero in a convenient form.
Your answers for 1, 3, and 4 should be the same, but look different from your answer to 2. The difference is NOT due to the constant of integration which is the same for all four answers. Show that the two forms are the same by
2. “Simplifying” your answer to 1, 3, 4 and get that third form again. | {
"domain": "teachingcalculus.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429565737233,
"lm_q1q2_score": 0.8578166579974011,
"lm_q2_score": 0.8723473862936942,
"openwebmath_perplexity": 407.17507108116865,
"openwebmath_score": 0.8520076870918274,
"tags": null,
"url": "https://teachingcalculus.com/category/integration/integration-theory/page/3/"
} |
javascript, performance, canvas
return false;
}
var width = rendered.width, height = rendered.height,
imgData = renderedCtx.getImageData(0, 0, width, height),
data = imgData.data;
for(var x = 0; x < width; x++){
for(var y = 0; y < height; y++){
if(isInShadow(x, y)){
data[getIndex(x, y) + 3] = 256 * 0.1;
}
}
}
renderedCtx.putImageData(imgData, 0, 0);
As you can see, this function performs per pixel manipulation and is quite slow in performance. What is a good way to improve performance, probably without checking each pixel independently? Use diagonals. The idea is to have only one pixel check, compared to two you have now:
find the first occupied pixel on a diagonal
skip to an unoccupied one
fill with 0.1 while unoccupied
repeat 1-3 until out of bounds | {
"domain": "codereview.stackexchange",
"id": 40962,
"lm_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, canvas",
"url": null
} |
c, recursion, pointers, posix
} else {
if (!b1) { /* no args (?) */
for (int r = 0; argv[r] != NULL; r++) {
string[i][r] = argv[r];
}
}
}
}
}
}
mylabel:
free(ptr);
dump_argv((const char *) "d", argc, argv);
}
}
free(ptr1);
free(cmdtmp);
free(tmpchar);
}
for (i = 0; i < n; i++) {
for (j = 0; DEBUG && string[i][j] != NULL; j++) {
if (i == 0 && j == 0) printf("\n");
printf("p[%d][%d] %s\n", i, j, string[i][j]);
}
structcommand[i].argv = string[i];
}
fflush(NULL); | {
"domain": "codereview.stackexchange",
"id": 19764,
"lm_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, recursion, pointers, posix",
"url": null
} |
aqueous-solution, solubility
That said, you can go crazy and consider some of the strongest acids we can put in a bottle, such as carborane superacids. The corresponding hydronium salt of these superacids can have extremely weak interactions between the hydronium cation and the anion. For example, when the hydronium salt $\ce{(H3O+)(CHB11Cl11^-)}$ is prepared in a benzene solution, the solid that forms actually contains three molecules of benzene surrounding the hydronium cation, which is completely detached from the anion. If this doesn't imply "complete dissociation" of the carborane superacid in water, I don't know what would. | {
"domain": "chemistry.stackexchange",
"id": 14785,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "aqueous-solution, solubility",
"url": null
} |
galaxy, universe, galaxy-cluster
Title: How are Galaxy Super Clusters Generated I have seen pictures of clusters of galaxies, usually used in regards to theories of dark matter and galaxy formations. One of the most famous ones has the perceived shape of a stick-figure. If I am not mistaken some of these clusters seem to be bigger than our observable Universe horizon of $14$ billion light-years, which is as far as we can see because of the age of the Universe.
My assumption is that these are just coordinates plotted into a computer simulation. However, are these clusters the size of our observable Universe horizon or are these more theoretical abstractions? | {
"domain": "astronomy.stackexchange",
"id": 140,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "galaxy, universe, galaxy-cluster",
"url": null
} |
slam, navigation, rtabmap-ros, ros-kinetic
Originally posted by Karan Shah on ROS Answers with karma: 1 on 2019-07-15
Post score: 0
rtabmap_ros uses topics as input. Topics you need are a RGB image, a registered depth image and camera info of RGB image. See http://wiki.ros.org/rtabmap_ros/Tutorials/HandHeldMapping for many examples using different cameras. You should be able to do the same with your python script, just make sure you republish the images in different topic names and adjust rgb_topic, depth_topic and camera_info_topic arguments of rtabmap.launch:
$ roslaunch rtabmap_ros rtabmap.launch rtabmap_args:="--delete_db_on_start" rgb_topic:="my/python/rgb/image/topic" depth_topic:="my/python/depth/image/topic" camera_info_topic:="my/python/rgb/camera_info/topic"
cheers,
Mathieu
Originally posted by matlabbe with karma: 6409 on 2019-07-15
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 33430,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam, navigation, rtabmap-ros, ros-kinetic",
"url": null
} |
c#, programming-challenge, median
[TestMethod]
public void ExampleFailed2()
{
int[] nums = { 5, 2, 2, 7, 3, 7, 9, 0, 2, 3 };
int k = 9;
double[] expected = { 3.0, 3.0 };
double[] res = SlidingWindowMedian.MedianSlidingWindow(nums, k);
CollectionAssert.AreEqual(expected, res);
}
}
public class SlidingWindowMedian
{
public static double[] MedianSlidingWindow(int[] nums, int k)
{
var res = new List<double>();
var med = new SortedList<long, int>();
for (int i = 0; i < nums.Length; i++)
{
med.Add(GetId(i, nums), nums[i]);
if (med.Count > k)
{
med.Remove(GetId(i - k, nums));
} | {
"domain": "codereview.stackexchange",
"id": 37698,
"lm_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#, programming-challenge, median",
"url": null
} |
tensorflow
Title: Why apply a 50:50 train test split? I am going through the "Text classification with TensorFlow Hub" tutorial.
In this tutorial, a total of 50,000 IMDb reviews are split into 25,000 reviews for training and 25,000 reviews for testing.
I am surprised by this way of splitting the data, since I learned in Andrew Ng's course that for fairly small datasets (<10,000 examples) the "old-fashioned" rule of thumb was to consider 60% or 70% of the data as training examples and the remainder as dev/test examples.
Is there a reason behind this 50:50 split? | {
"domain": "datascience.stackexchange",
"id": 7221,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "tensorflow",
"url": null
} |
parsing, clojure, markdown
misc.clj
(ns mdclj.misc)
(defn in?
"true if seq contains elm"
[seq elm]
(some #(= elm %) seq))
(defn startswith [coll prefix]
"Checks if coll starts with prefix.
If so, returns the rest of coll, otherwise nil"
(let [[t & trest] coll
[p & prest] prefix]
(cond
(and (= p t) ((some-fn seq) trest prest)) (recur trest prest)
(= p t) '()
(nil? prefix) coll)))
(defn partition-while
([f coll]
(partition-while f [] coll))
([f acc [head & tail :as coll]]
(cond
(f head)
(recur f (cons head acc) tail)
(seq acc)
(list (reverse acc) coll))))
(defn- bracketed-body [closing acc text]
"Searches for the sequence 'closing' in text and returns a
list containing the elements before and after it"
(let [[t & trest] text
r (startswith text closing)]
(cond
(not (nil? r)) (list (reverse acc) r)
(seq text) (recur closing (cons t acc) trest)))) | {
"domain": "codereview.stackexchange",
"id": 6682,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "parsing, clojure, markdown",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.