text
stringlengths
49
10.4k
source
dict
reductions, approximation, definitions Title: Why are $L$-reductions defined the way they are? I was reading about $L$-reductions and there was one part in the definition that I thought was interesting. I wanted to know what motivated people who came up with it to have it included in the definition. Recall that a problem $A$ is $L$-reducible to another problem $B$ if there exist polynomial-time computable functions $f$ and $g$, and positive constants $\alpha$ and $\beta$ such that: If $x$ is an instance of problem $A$, then $f(x)$ is an instance of problem $B$. If $y'$ is a solution to the instance $f(x)$ of problem $B$, then $g(y')$ is a solution to the instance $x$ of problem $A$. $OPT_B(f(x)) \leq \alpha OPT_A(x)$. $|c_A(g(y'))-OPT_A(x)| \leq \beta |c_B(y')-OPT_B(f(x))|$.
{ "domain": "cs.stackexchange", "id": 16977, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "reductions, approximation, definitions", "url": null }
electromagnetism, electrostatics, electricity, electric-circuits, multipole-expansion Title: The Electric Quadrupole I've read the following sentence: "Every electric circuit with two pairs of accessible terminals is called a quadrupole." I was wondering why does it happen that the multipole expansion gives us a quadrupole in an electric circuit with these properties... Can we see each pair of terminals as oppositely oriented dipoles? If so why? My main problem is to make sense of charges when thinking about the electric circuit itself. My guess; you are mixing up quadripoles and quadrupoles. Quadripoles are two-port networks used in electric circuit analysis. The original German word is "Vierpol Theorie", which means Four-pol because of 4 Poles. https://en.wikipedia.org/wiki/Two-port_network Quadrupoles are related to multipole expansion used in electromagnetic, atomic orbital,.. theory. https://en.wikipedia.org/wiki/Quadrupole
{ "domain": "physics.stackexchange", "id": 20720, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electromagnetism, electrostatics, electricity, electric-circuits, multipole-expansion", "url": null }
Now, what about the easy way? ## Linearity of Expected Values Linearity is this: \begin{align} \mathbb{E}(X+Y) &= \mathbb{E}(X) + \mathbb{E}(Y) & &\quad \text{even if X and Y are dependent}\\ \\ \mathbb{E}(cX) &= c \mathbb{E}(X)\\ \end{align} ### Expected value of Binomial r.v using Linearity Let $X \sim \operatorname{Bin}(n,p)$. The easy way to calculate the expected value of a binomial r.v. follows. Let $X = X_1 + X_2 + \dots + X_n$ where $X_j \sim \operatorname{Bern}(P)$. \begin{align} \mathbb{E}(X) &= \mathbb{E}(X_1 + X_2 + \dots + X_n) \\ \mathbb{E}(X) &= \mathbb{E}(X_1) + \mathbb{E}(X_2) + \dots + \mathbb{E}(X_n) & &\quad \text{by Linearity}\\ \mathbb{E}(X) &= n \mathbb{E}(X_1) & &\quad \text{by symmetry}\\ \mathbb{E}(X) &= np \end{align} ### Expected value of Hypergeometric r.v. Ex. 5-card hand $X=(\# aces)$. Let $X_j$ be the indicator that the $j^{th}$ card is an ace.
{ "domain": "notebook.community", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9910145691243959, "lm_q1q2_score": 0.8170537828647313, "lm_q2_score": 0.824461928533133, "openwebmath_perplexity": 1964.1862747413497, "openwebmath_score": 1.0000100135803223, "tags": null, "url": "https://notebook.community/buruzaemon/stats-110/Lecture_09" }
time-complexity, big-o-notation That said, sometimes $f_{Alg}(n) = \Omega(g(n))$ is used in the following weaker sense: there is a constant $c>0$ such that, for every sufficiently large $n$, there is at least one input of size $n' \ge n$ such that $f_{Alg}(n') \ge c g(n')$. In this sense you would say that $X$ has time complexity of $\Omega(2^n)$. Less commonly, $f_{Alg}(n) = \Omega(g(n))$ is used in the following stronger sense: for every sufficiently large $n$, and for every input of size $n$, $f_{Alg}(n) \ge c g(n)$. In this sense, $f_A$ as defined above would not even belong to $\Omega(n^3)$. This notion is not really useful, since it is often very easy to design algorithms for which the best lower-bound on their running time according to the above interpretation is $\Omega(n)$ (by checking if the input belongs to some class of inputs for which the solution is trivially known).
{ "domain": "cs.stackexchange", "id": 16099, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "time-complexity, big-o-notation", "url": null }
Lemma. If Jacobson’s theorem holds for division rings, then it holds for all rings with $1.$ Proof. Let $R$ be a ring with $1$ such that $x^n=x$ for some integer $n > 1$ and all $x \in R.$ Then clearly $R$ is reduced, i.e. $R$ has no non-zero nilpotent element. Let $\{P_i: \ i \in I\}$ be the set of minimal prime ideals of $R.$ By the structure theorem for reduced rings, $R$ is a subring of the ring $\prod_{i\in I}D_i,$ where $D_i=R/P_i$ is a domain. Clearly $x^n=x$ for all $x \in D_i$ and all $i \in I.$ But then, since each $D_i$ is a domain, we get $x=0$ or $x^{n-1}=1,$ i.e. each $D_i$ is a division ring. Therefore, by our hypothesis, each $D_i$ is commutative and hence $R,$ which is a subring of $\prod_{i\in I}D_i,$ is commutative too. $\Box$ Example. Show that if $x^5=x$ for all $x \in R,$ then $R$ is commutative. Solution. By the lemma, we may assume that $R$ is a division ring. Then $0=x^5-x=x(x-1)(x+1)(x^2+1)$ gives $x=0,1,-1$ or $x^2=-1.$ Suppose that $R$ is not commutative and choose a non-central element $x \in R.$ Then $x+1,x-1$ are also non-central and so $x^2=(x+1)^2=(x-1)^2=-1$ which gives $1=0,$ contradiction! $\Box$
{ "domain": "wordpress.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9755769106559808, "lm_q1q2_score": 0.8108439587819448, "lm_q2_score": 0.8311430394931456, "openwebmath_perplexity": 90.94035984365544, "openwebmath_score": 0.9459206461906433, "tags": null, "url": "https://ysharifi.wordpress.com/tag/division-ring/" }
If c is composite, then you could consider all factorisations c=a.b You can then solve for a|(z-1) and b|(z+1). This is equivalent to z=1 modulo a and z=-1 modulo b. This kind of equation can be solved using the Chinese remainder theorem. Note that for some a,b these equations might have none, or repeated solutions. Good post, explains my ideas somewhat more thoroughly and explicitly. drwhat Posts: 42 Joined: Tue Sep 06, 2011 4:56 am ### Re: Numbers of the form (1+cX)^1/2 Thanks for all the help. I am looking the Chinese remainder theorem now. Also thanks jaap for your take on the solution. Gave me new insight into ways of looking at things to solve a problem euler Posts: 3554 Joined: Sun Mar 05, 2006 4:49 pm Location: Cheshire, England Contact: ### Re: Numbers of the form (1+cX)^1/2 Interestingly, solving $8x+1=y^2$ leads to $x=\dfrac{k(k+1)}{2}$, which is the sequence of Triangle numbers. Below is using the same idea as jaap, but I do the analysis on evenness and divisibility by 3 in separate stages. Given that $24x + 1 = y^2$ it is clear that $y$ must be odd. Let $y = 2i + 1 \implies 24x + 1 = 4i^2 + 4i + 1 \implies 6x = i(i+1)$ As LHS is divisible by 3 then either $i$ or $i+1$ must be divisible by 3. Let $i = 3k \implies 6x = 3k(3k+1) \implies x = \dfrac{k(3k+1)}{2}$, leading to $x = 2,7,15,...$. Let $i+1 = 3k \implies 6x = (3k-1)3k \implies x = \dfrac{k(3k-1)}{2}$, leading to $x = 1,5,12,...$.
{ "domain": "projecteuler.chat", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9859363733699887, "lm_q1q2_score": 0.8150852322776555, "lm_q2_score": 0.8267117983401363, "openwebmath_perplexity": 1221.5832672263869, "openwebmath_score": 0.6890650987625122, "tags": null, "url": "https://projecteuler.chat/viewtopic.php?f=17&t=2659&p=28604" }
structural-engineering, piping The secondary provides sufficient air ventilation so that water traps at the lower levels don't get blown out by the pressure waves generated from drainage coming from the upper floors. Another approach that's used is to separate the different building levels into different drainage zones. This allows for smaller diameter pipe to be used while minimizing the risk that lower level water traps will get blown out from upper level drainage. And yet another approach that's used is the use of "Positive Air Pressure Attenuators" (PAPA) such as the following. Note, this happens to be just one vendors product portfolio. Other vendors for these devices exist. One challenge with PAPAs is that their status with current building codes in tall buildings is unclear. I personally have installed PAPAs in my residence and can attest to their abilities. However, building codes are understandably slow to update and the long term reliability of PAPAs need to be demonstrated. Again, from my own experience, using PAPAs requires modifying the system design from traditional approaches and requires additional considerations.
{ "domain": "engineering.stackexchange", "id": 942, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "structural-engineering, piping", "url": null }
astronomy, mass, specific-reference, galaxies, observational-astronomy Title: Mass of NGC 1097 Galaxy I've been looking all over the internet for this and can't seem to find a reference. Can anyone refer me to a paper citing the mass of NGC 1097 based on luminosity? This paper reports modelling of NGC 1097, and they use a figure of around $10^{10}$ solar masses. They cite a paper that isn't available online. I have to confess this seems small to me. It's only 1% of the mass of the Milky Way.
{ "domain": "physics.stackexchange", "id": 20734, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "astronomy, mass, specific-reference, galaxies, observational-astronomy", "url": null }
fluid-dynamics, bernoulli-equation $$p = C-\frac{1}{2}|\textbf{u}|^2-\rho\frac{\partial \phi}{\partial t}$$ where $C$ is a constant. Why do we have the freedom to just say that the constant is $0$? Since the derivative of a constant is zero, once the gradient operator is removed there will be a constant on the rhs of the equation. That constant when subtracted from the other constant which appears from the integration of the lhs are assumed to cancel. I am not an expert but it intuitively made sense to me that way.
{ "domain": "physics.stackexchange", "id": 66265, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "fluid-dynamics, bernoulli-equation", "url": null }
power-spectral-density Title: PSD (Power spectral density) explanation I'm trying to understand how the PSD is calculated. I've looked in a few of my Communication Engineering textbooks but to no avail. I've also looked online. Wikipedia seems to have the best explanation; however, I get lost at the part where they decide to make the CDF (Cumulative Distrubution Function) and then for some reason decide to related that to the autocorrelation function. I guess what I don't understand is, how does autocorrelation having anything to do with calculating the PSD? I would've thought that the PSD simple be the Fourier Transform of $P(t)$ (where $P(t)$ is the power of the signal with respect to time). You are right, PSD has to do with calculating the Fourier Transform of the power of the signal and guess what.....it does. But first let's look at the mathematical relationship between the PSD and the autocorrelation function. Notations: Fourier Transform: $$ \mathcal{F}[ x(t)] = X(\omega) = \int_{-\infty}^{\infty} x(t)e^{-j\omega t}dt $$ (Time) Auto-Correlation Function: $$ R(\tau) = x(\tau) * x(-\tau) = \int_{-\infty}^{\infty} x(t)x(t + \tau)dt $$ Let's prove that the Fourier Transform of the Auto-Correlation function does indeed equal to the Power Spectral density of our stochastic signal signal $x(t)$.
{ "domain": "dsp.stackexchange", "id": 766, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "power-spectral-density", "url": null }
terminology, information-theory, entropy What can we infer if the entropy of this error term decreases? Can we conclude that the error is reducing and the system is behaving close to the desired signal's behavior? Shall be grateful for these clarifications Information = Entropy = Surprise = Uncertainty = How Much You Learn By Making an Observation. They all increase or decrease together. The entropy of a random variable $X$ is just another number summarizing some quality of that random variable. Just like the mean of a random variable is the expected value of $X$ or the variance of a random variable is the expected value of $(X - \mu)^2$, the entropy is just the expected value of some function, $f(X)$ of the random variable $X$. You find expectations of functions by using $\mathbb{E}[f(X)] = \sum_{x\in X}p(x)f(x).$ In this case the function of $X$ you care about is the log (base 2) of the probability mass function. $$ H(X) = \mathbb{E}[-\log_2 P(X)] = -\sum_{x \in X} p(x) \log_2 p(x).$$ This particular expectation is useful because it doesn't depend on the actual values that $X$ can take on, just the probabilities of those values. So you can use it to talk about situations where you aren't sending numbers, or where the numbers are just arbitrarily assigned to particular messages or symbols that you need to send. What you want for your second question is the conditional entropy of the measurement random variable $X$ given the random variable $Y$ that represents what was sent. When there is no error the conditional entropy will be 0, when there is error the conditional entropy will be greater than 0.
{ "domain": "cs.stackexchange", "id": 3143, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "terminology, information-theory, entropy", "url": null }
machine-learning, python, classification, image-classification Title: Lightweight binary image classifier I want to build a fast binary classifier that decides if an image belongs to a given class (e.g. if it is a picture of a person). I want to do this by training a network on the RGB of pixels at a predetermined set of coordinates (e.g. 4 points, one near each corner of the image) and I want to achieve at least 75% accuracy. How many points and what architecture should I use? Or if this is a very bad method what is another way to build a classifier that makes training and classification as fast as possible maybe on the account of lowering accuracy? If I wanted to build a classifier that takes short time to be trained, I would rather simplify the classifier than the data. In this case, I would rather train a logistic regression model (probably with Ridge or Lasso regularization), than a very complex architecture with few of the data I have. If I had to simplify the data, I would take the average of the three channels, thus having a black and white image as input. I would not simplify it further (I am very confident that 4 points won't give decent accuracies). I don't really know your circumstances, but Lasso in logistic regression is a method that might allow you to select some pixels. As the coefficients obtained by Lasso are sparse (see this answer), Lasso will select the pixels that are relevant towards the prediction of the class. You can then train a bigger network with those pixels that allows you to capture nonlinearities and more complexity.
{ "domain": "datascience.stackexchange", "id": 3105, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "machine-learning, python, classification, image-classification", "url": null }
context-free, pumping-lemma Title: Questions about an answer to a pumping lemma question for CFLs In the answer to this question, I'm not understanding how the string is derived for a given $l$. For example, Case 1: $vx = a^i$ where $i > 0$. Choose $l = 2$ to get $a^{n+i} b^{n+1} c^{n+1} d^n \notin L$. Why is $l = 2$ chosen and how is $a^{n+i}b^{n+1}c^{n+1}d^n$ derived from $l = 2$? Also, how can $vx$ be chosen instead of $vwx$ as the OP chose? What do we do about $w$? Is it the empty string? The essential idea is that pumping lemma tells you about string $uv^lwx^ly$ with $l \geq 0$. That is, you can "pump" to $uwy$, if $l = 0$, that way shortening the initial string. The answer considers the string $a^n b^{n+1} c^{n+1} d^n$. Removing a single $b$ or inserting a single $a$ would move the string out of the language. Removal and insertion correspond to $l = 0$ and $l = 2$. The answer only considers $vx$, because $w$ does not matter - it will not be pumped. If $v$ or $x$ contains any $a$s, double them to get more $a$s then $c$s. If $v$ or $x$ contains any $b$s, remove them to get fewer $b$s than $d$s. $v$ and $x$ will never contain both $a$s and $c$s, because $|vwx| \leq n$. Same is true about the other pair of symbols.
{ "domain": "cs.stackexchange", "id": 1293, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "context-free, pumping-lemma", "url": null }
solid-state-physics, water, phase-transition, ice, phase-diagram Title: Is it possible to mix a drink with a non-standard phase of ice? Would it be possible to safely cool and drink a glass of water with anything else than the Ih form of ice? Here and here you can see that some alternative forms of ice have a higher density than water, hence they would sink. Would it be possible to have the coolest party ever, where the attendees would drink from glasses where the ice is sinking instead of floating? As you can see from the phase diagram plot in the first link you provided, the only other ice phase which is stable at atmospheric pressure is ice XI, and its density is about the same as that of the most familiar ice phase (ice Ih). The other denser ice phases that you see on the phase diagram are only stable at pressures significantly above 1 atmosphere. As far as I'm aware, none of those high-pressure phases of ice are metastable, so you would have no chance of synthesizing any of those high-pressure ice phases in a high-pressure device (e.g., diamond anvil cell, Paris-Edinburgh cell, etc.) and then trying to retain the phase as you download the pressure back to atmospheric pressure.
{ "domain": "physics.stackexchange", "id": 25217, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "solid-state-physics, water, phase-transition, ice, phase-diagram", "url": null }
P.S. I will never do that again, it's so painful... but it was fun. XD Hope you liked it. - Good calculation. –  quanta May 15 '11 at 21:12 Wow, amazing. Thanks for taking the time and effort to do that. –  Dom May 21 '11 at 6:51 No problem ; I suggest you look more closely to the other answers also! They were inspiring for this answer, mosty Marty's. Galois Theory is always so much fun... =) –  Patrick Da Silva May 21 '11 at 8:30 Usually it's a pain to do so, for instance for $\displaystyle \cos(\frac {2\pi}9)$, you use the triple angle cosine formula : $$\cos 3\theta = 4\cos^3(\theta) - 3 \cos (\theta).$$ since substituting $\displaystyle \theta = \frac{2\pi}9$, you can evaluate $\displaystyle \cos \left( \frac{2\pi}3 \right) = -1/2$, which gives you rational coefficients in $\displaystyle \cos \left(\frac{2\pi}9\right)$. I wouldn't say there is a "general method" because I would never do that in general, but a trick to compute the minimal polynomial of $\displaystyle \cos \left(\frac{m\pi}n \right)$ would be to use trigonometric identities to express $\cos n\theta$ in a polynomial that is in terms of $\cos \theta$, or at least $\cos k\theta$ where $k$ divides $n$ so that when you substitute $\theta =$ your angle, you obtain a remarquable angle (like in the $\displaystyle \frac{2\pi}9$ case, we chose $3$ instead of $9$) . Such a polynomial exists, and they are detailed in the following link : http://en.wikipedia.org/wiki/List_of_trigonometric_identities#Multiple-angle_formulae
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9796676442828173, "lm_q1q2_score": 0.8032229794246601, "lm_q2_score": 0.8198933425148214, "openwebmath_perplexity": 389.6490856630421, "openwebmath_score": 0.9049112200737, "tags": null, "url": "http://math.stackexchange.com/questions/38821/is-there-a-usual-method-for-finding-the-minimal-polynomial-of-trigonometric-valu" }
co.combinatorics, lo.logic, computability, automata-theory $$\begin{gather*} \bigvee_{t\in T}p_{x,t},\qquad x\in X,\\ \neg(p_{x,t}\land p_{x,t'}),\qquad x\in X,t\ne t'\in T, \end{gather*}$$ and $$\neg(p_{x,t}\land p_{x',t'})$$ for all $x,x'\in X$ that are neighbours, and $t,t'\in T$ that are incompatible when placed on $x$ and $x'$, respectively. If each finite subset of $X$can be tiled, then $C$ is consistent, and any satisfying assignment gives a tiling of $X$.
{ "domain": "cstheory.stackexchange", "id": 4617, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "co.combinatorics, lo.logic, computability, automata-theory", "url": null }
observational-astronomy, milky-way, radio-astronomy Title: Why the blank wedges in this very early 21 cm map of the Milky Way? (Oort et al. 1958) Jan Oort was a pioneer in radio astronomy. Wikipedia says: It has been written that “Oort was probably the first astronomer to realize the importance” of radio astronomy. “In the days before radio telescopes,” one source notes, “Oort was one of the few scientists to realise the potential significance of using radio waves to search the heavens. His theoretical research suggested that vast clouds of hydrogen lingered in the spiral arms of the Galaxy. These molecular clouds, he predicted, were the birthplaces of stars.” The article includes the image shown below, which is a 21 cm radio map of the Milky Way galaxy. (for more on the transparency of dust at 21 cm see this excellent answer to How was the galactic plane established? You can also read more about Oort's work during this time in this 1976 AIP Oral History Interview interview. I'm guessing that the center of the plot is the galactic center and the point at 8 kpc above it is the Earth. What is the reason for the two blank wedges, projecting downward and upward from the Earth? Are they geometrical, blind spots from the few early radio telescopes in the 1950's perhaps, or do they reflect real phenomenon in the galaxy? The original source is The galactic system as a spiral nebula Oort, J. H.; Kerr, F. J.; Westerhout, G. MNRAS 118, (1958) p. 379 TLDR: these wedges are bits where things are moving around the centre of the galaxy at about the same speed as us, so we can't understand what is there. As it states on page 4 of the paper you have linked, the great gap between 315 and 340, where, except at small R, the differential rotation is too small to separate the various arms The method used to deduce this structure is described on page 2:
{ "domain": "astronomy.stackexchange", "id": 3238, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "observational-astronomy, milky-way, radio-astronomy", "url": null }
c++, performance, c++11, c++14 std::vector<std::vector<int>> is probably not the most efficient representation for an NxN matrix of integers. Did you consider creating your own matrix class template, e.g. my::matrix<int, 4, 4> fourbyfour; and then making these functions take my::matrix<int, N, N>? Admittedly you're making good use of the vector-of-vectors representation by taking advantage of its cheap pointerwise row-swap operation. But depending on the size of these matrices, it might even be cheaper to swap the rows valuewise than to be following pointers on the heap all the time. (The only way to know is to code it both ways and measure.)
{ "domain": "codereview.stackexchange", "id": 23555, "lm_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, c++11, c++14", "url": null }
ros, navigation, exploration, costmap, parameter Originally posted by Roy89 with karma: 133 on 2012-08-01 This answer was ACCEPTED on the original site Post score: 2 Original comments Comment by Achim on 2012-08-29: Does that mean you managed to use navfn with gmapping planing in unknown space? Or are you using your own stuff? I'm quite stuck here... Comment by Roy89 on 2012-09-10: I used gmapping and the navigation stack with navfn planner. There's is an allow_unknown parameter in navfn that should allow plans to traverse unknown space. I can't seem to get the planner to do so though :( Comment by weiin on 2012-09-19: I managed to get the planner to plan into unknown space with track_unknown_space: true unknown_cost_value: 255 Comment by weiin on 2012-09-19: These two parameters are set in costmap_common.yaml, global_costmap uses static_map: true, local_costmap uses static_map: false Comment by Achim on 2012-09-22: I have the same parameters, now. It works, but usually I have to start move_base two times, in order to get it working. Usually on the first run unknown cells still are obstacles.
{ "domain": "robotics.stackexchange", "id": 10436, "lm_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, exploration, costmap, parameter", "url": null }
inorganic-chemistry, oxidation-state Title: Bond strength of pi acceptors and metals with filled d(pi) orbitals I was reading in The Organometallic Chemistry of the Transition Metals (Robert Crabtree) that lewis acids like BF3 often accept electrons from d(pi) orbitals. Is this generally true for all pi acceptor ligands? That is, do metals with filled d(pi) orbitals form thermodynamically stable bonds with pi acceptor ligands? I would imagine that d(pi) electrons would only be available for donation if said metal was in a low oxidation state. Correct me if I'm wrong. If this post merits two different question threads, I'd be happy to separate them. TL;DR Yes, you need low oxidation states unless there is a significant $\ce{M\bond{->}L}$ σ contribution to the bonding.
{ "domain": "chemistry.stackexchange", "id": 9490, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "inorganic-chemistry, oxidation-state", "url": null }
cell-biology, cancer, pharmacology, cell-culture, assay-development Title: How much effort is it to establish a cytotox assay for cancer cell lines against a small number of possible compounds? I am currently testing a series (5-10) of small molecule compounds against an enzyme that are intended as inhibitors. This enzyme is meaningful for cell proliferation. Until now, nothing was active and therefore I could try to test the new molecules in a cytotox assay, to test if they are of any medicinal value. It is known, that these compounds have multiple modes of action and inactivity against the discussed enzyme does not necessarily mean that they are fully inactive. I am wondering how complicated this is and if you're a beginner on this how long does it take to set up a growth inhibition or viability assay. Currently me gathered experience on protein expression and aspetic technique. But I have no experience with cell culture and sterile bench. My cell lines of interest are melanoma cell lines and or various brest cancer cell lines that are commercially available from multiple known suppliers. Do you think it would be possible to test this in a couple of weeks? I am willing to work 7 days per week if this will speed up the process. What is a realistic time frame to get first results? I would work with commercial inhibitors as control. I have no idea how time intense this process might be and would be interested about your insights. The answer to this is, of course, "it depends". There are quite a few factors at play here. As you don't seem to be experienced at cell culture yet, I strongly recommend that you find someone experienced to teach you. It is not something that is easy to pick up, as problems in cell culture (e.g. low-level contamination, cross-contamination, old cells, overgrowth, under-seeding) can be subtle and difficult to identify without experience. It will take at least 4 weeks for experience to kick in, and cells aren't like bacteria in that they won't grow overnight to suitable levels for sub-culturing/experimentation; it'll take days to weeks of growth from a frozen vial to having enough to work with. This takes time alone. You'll need to be in some weekends anyway; when cells need to be split or fed, that's when you'll be in!
{ "domain": "biology.stackexchange", "id": 12455, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "cell-biology, cancer, pharmacology, cell-culture, assay-development", "url": null }
java, android /* Listeners */ private View.OnClickListener m_viewListener; /* Buttons and Views */ private ImageButton m_hiltBtn; private ImageButton m_bladeBtn; /* Sounds */ private SoundPool m_soundPool; private HashMap<Integer, Integer> m_soundMap; private int m_humId; private boolean m_swooshSound; private boolean m_clashSound; int m_swordOnSoundId = 1; int m_swordOffSoundId = 2; int m_swordSwing1SoundId = 3; int m_swordSwing2SoundId = 4; int m_swordClashSoundId = 5; int m_swordHumSoundId = 6; /* the Light Sword State class object */ LightSwordState m_swordState; /* Customize Dialog Stuff */ SwordOptionsDialog customSwordDlg; /* Animation */ Animation m_animSwordOn; protected void onInflateObjects() { m_hiltBtn = (ImageButton) findViewById(R.id.btn_hilt); m_bladeBtn = (ImageButton) findViewById(R.id.btn_blade); // SoundPool ctor: int maxStreams, int streamType, int srcQuality m_soundPool = new SoundPool(12, 3, 0); }
{ "domain": "codereview.stackexchange", "id": 14823, "lm_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 }
ros2 Title: ROS2 Galactic rclpy.parameter.Parameter missing floating_point_range and integer_range no longer availabe Hi all. I started using ROS2 Galactic and realized that the parameters 'floating_point_range' and 'integer_range' for rclpy.parameter.Parameter are now missing, yet the rclcpp does have them. I searched in the changelog but did not find any entry regarding this. Afaik no question has been posted either. What is the correct way to enforce the ranges in galactic rclpy? Thanks in advance. Originally posted by lora on ROS Answers with karma: 26 on 2021-09-22 Post score: 0 I found the answer to my own question, leaving here in case someone needs it: Instead of declaring the ranges in the instantiation of Parameter directly, use a ParameterDescriptor for it. Originally posted by lora with karma: 26 on 2021-09-22 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 36936, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros2", "url": null }
ros, ros2, documentation Title: ROS2 Humble API documentation Hello, Can anyone point me to the ROS2 Humble API documentation? I found ROS2 API documentation for past distributions at https://docs.ros2.org, e.g.: https://docs.ros2.org/foxy/api/ https://docs.ros2.org/galactic/api/ But there's no such link for Humble. I found that there's also a "latest", but even that one is outdated wrt the doxygen info in the installed .hpp files (installed from Ubuntu packages): https://docs.ros2.org/latest/api/ Thanks, Johan Originally posted by jrtg on ROS Answers with karma: 145 on 2022-11-24 Post score: 0 More or less by chance I found the 'Curated List of common ROS2 packages' (REP 2005), which contains links per package to the ROS Index, and there I found the link to the api documentation. Turns out that the humble API docs are at http://docs.ros.org/en/humble/p/ as opposed to the previous ROS2 distributions at https://docs.ros2.org. Originally posted by jrtg with karma: 145 on 2022-11-28 This answer was ACCEPTED on the original site Post score: 2 Original comments Comment by danzimmerman on 2023-06-02: Yes, I had trouble with this in the past. Now, at least, there's a link to the autogenerated API docs on the Humble, Rolling and Iron API Documentation pages (https://docs.ros.org/en/humble/API-Docs.html, for example): A raw list of Humble package documentation may be found here . It's unfortunate that these still don't really seem to show up in search engine queries for the package and API features in question. There's some discussion here: https://github.com/ros2/ros2/issues/1354 and here: https://discourse.ros.org/t/plans-for-ros-2-documentation-particularly-api-docs/28638/2
{ "domain": "robotics.stackexchange", "id": 38152, "lm_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, ros2, documentation", "url": null }
our Earning Credit page matrixis its matrix inverse calculator - calculate matrix inverse step-by-step this website cookies... Is b/a we deal with regular numbers, here are three ways to do please us. Find ( AB ) C. E ) find BC solving simple equations the multiplication of a matrix by inverse! 14, we will talk about its benefits one is the matrix that gives you the identity matrix a.: multiplicative inverse of matrix is the inverse of a number by its inverse results in the matrix... Vector equation into a 3x3 skew symmetric matrix expression and then invert the matrix b. That AB = 1 with its multiplicative inverse Skills Practiced would Use this method whenever you what! Learning to the matrix ( must be a very easy thing to do this not matrices. Are done in modular arithmetic more with Flashcards, games, and personalized coaching help! This is important dimension to it matrix will help Use solve problems involving matrices Assign lesson Feature should... -3, the matrix ( must be a very easy thing to do this is 1/2 age... Property of their respective owners 2 matrices for, the inverse matrix calculator number which does not have *. We then multiply both sides of this matrix has no inverse -- yeah -- --... Recall that functions f and g are INVERSES if number b which is 1/7! Must also be square, having the same number of rows and columns matrices that are to. Both sides of this section we see how Gauss-Jordan elimination to transform [ a I! Y = 2 same thing when the inverse of a nonsingular matrixis matrix... Attend yet passing quizzes and exams inverse is simply 1 divided by our number important... Matrices except that the inverse matrix calculator is written a^ ( -1 ) 1/8 ) × 8 =.... Main diagonal and zeros everywhere else inverse im Koeffizienten aufweist Ring, or contact customer support a Course lets earn. Tel: 800-234-2933 ; Hence, I is known as the identity when!, our answer would be our answer can then be easily found by translating! Containing ones down the main difference between this calculator finds the modular of... Multiply a matrix following nxn matrix step-by-step this website uses cookies to you! Number 2, it
{ "domain": "gridserver.com", "id": null, "lm_label": "1. Yes\n2. Yes\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9814534344029238, "lm_q1q2_score": 0.8544506708232129, "lm_q2_score": 0.8705972600147106, "openwebmath_perplexity": 696.4878762898684, "openwebmath_score": 0.757369875907898, "tags": null, "url": "https://s12762.gridserver.com/1gb40i0t/43d397-master-electrician-test" }
search-algorithms Title: What is the algo used for Phonetic Search I am new to the field of text mining. Could not figure out what to search on google so am here for the same help. When we talk of approximate / fuzzy string match. searching for RAT would give RAAT too. i have used utl_match.edit_distance in oracle. searching for BAAT would give BAT. but if i search for RAT. it would return BAT, CAT, etc. How does google bring the phonetically same rhyming / sounding words eg if some one does'nt know spelling of 'Schwaznegger', even then correct data is brought by google. For 'levenshtein distance', cat and bat are pretty close but for google. closest to cat is kat not bat. Please tell me what we call such a search and what algorithms are used for it. Thanking you in advance for patience. Take a look at Soundex, Levenshtein edit distance, and related ideas.
{ "domain": "cs.stackexchange", "id": 3007, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "search-algorithms", "url": null }
c++, matrix The use of #pragma once is a common extension, but it's not in the standard and thus represents at least a potential portability problem. See SF.8 Use throw rather than assert The bounds checking your program does is good, but it should throw an exception rather than using assert to be compatible with STL containers. Implement mathematical operations with templates Consider the following code: MyMatrix<float> fm; MyMatrix<int> im; fm += im; This ought to work but does not because the current code requires both matrices to be of the same type. Better would be to write the function like this: template<class U> MyMatrix& operator+=(MyMatrix<U> const& mtx) { if (m_rows != mtx.rows() || m_cols != mtx.cols()) throw std::invalid_argument("Matrix dimension must be the same."); std::transform(m_buffer.begin(), m_buffer.end(), mtx.begin(), m_buffer.begin(), std::plus<>{}); return *this; } Now it works with any pair of types for which std::plus<> is defined. Implement mathematical operations as freestanding functions Consider this code: MyMatrix<float> fm; auto doppel = fm + fm; It should work but does not. Fix that by defining operator+ as a freestanding templated function: template <typename T, typename U> MyMatrix<T> operator+(MyMatrix<T> one, MyMatrix<U> const& two) { return one += two; } Don't shadow parameters The inserter function is currently defined like this: template<class T> // linkage error without this! friend std::ostream& operator<<(std::ostream& out, MyMatrix<T> const& mtx);
{ "domain": "codereview.stackexchange", "id": 39099, "lm_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++, matrix", "url": null }
z098mws0dq t40968vgg2q9z74 bbgq1rvp40 29oyrfoaaefz2 n8u6xw16guk6y esqs45w3xm5xd 3eg6w67q36oy0w 6hnew4grqmbf w6vbb3k5w9q3qo fzmchagrdt0g3 ow1rttfma3z3 sxla2ffqjb 468g6r5mop25dpc 09u9nw1ltr jgvrc75s0up z143ney5vo7un w34nhi17664p5a6 7undt25fu7gteyu k8r9rpknc671j2 4f72pk861id tizxn4p3mtt2u u4x928nhf6z5nhx kb7wznyfe0 0j2lc5m06y9ij 475izcxf50b bunpwdpx8a gobhqanixu uzlz12hspju3ck9 ohgcwhvpn4j37z
{ "domain": "macchiaelettrodomestici.it", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9923043537319404, "lm_q1q2_score": 0.8247468587382455, "lm_q2_score": 0.8311430415844385, "openwebmath_perplexity": 588.9401725308323, "openwebmath_score": 0.8791841268539429, "tags": null, "url": "http://zbxo.macchiaelettrodomestici.it/surface-of-revolution-parametric-equations.html" }
rviz, urdf, nxt Originally posted by Flynnn with karma: 76 on 2011-10-19 This answer was ACCEPTED on the original site Post score: 5 Original comments Comment by Flynnn on 2011-10-19: It worked :) When I tried to update libtinyxml (sudo apt-get libtinyxml-dev) it did told me I was up to date (hmm..) So I instead cd'ed to my /usr/lib, and then ran the command: sudo cp libtinyxml.so.2.5.3 libtinuxml.so.2.6.2 (to copy and rename the library) It worked like a charm! :D
{ "domain": "robotics.stackexchange", "id": 7010, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "rviz, urdf, nxt", "url": null }
kinect, rviz, pr2 How to correctly start the kinect on PR2? It seems like a beginner-level question, but I don't know how to start.Thanks. Originally posted by Po-Jen Lai on ROS Answers with karma: 1371 on 2012-11-23 Post score: 0 In fact your kinect is launched when you use openni_launch, but the name of the kinect is camera. In order to change that, you can do the following : roslaunch openni_launch openni.launch camera:=kinect1 If you had multiple kinects, you can use the following to launch two differents kinects (attention, you need to have them plugged on two different usb hub) : roslaunch openni_launch openni.launch device_id:=#1 camera:=kinect1 and in another terminal : roslaunch openni_launch openni.launch device_id:=#2 camera:=kinect2 For more information on the options of openni_launch, please refer to this page. Originally posted by Stephane.M with karma: 1304 on 2012-11-25 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 11855, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "kinect, rviz, pr2", "url": null }
experimental-chemistry, nmr-spectroscopy Title: Wavy baseline in carbon NMR I realize anything NMR-related is essentially physics, but I figured this was a better place to ask this. I have this issue fairly regularly (with one instrument in particular) where my baseline ends up looking like the one in the image below. The (inverted) sine wave-shape is what I'm referring to, if it's not obvious.
{ "domain": "chemistry.stackexchange", "id": 5466, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "experimental-chemistry, nmr-spectroscopy", "url": null }
general-relativity, reference-frames, coordinate-systems, faster-than-light Relative velocity between two entities located at the same event and moving past one another is, on the other hand, a well-defined four-vector. Finally, by observing the distant stars it is certainly possible to pick out one local frame from others. Here in the solar system, for example, there is just one state of motion which makes the cosmic microwave background radiation look isotropic to first approximation (to be precise, to have no dipole term). When we say that different inertial frames have some sort of equivalence between them, we are not denying this. The equivalence is to do with the internal dynamics for systems at rest relative to one frame or another. But among all these frames, you can certainly pick out one and say 'this is the one in which the motion of the universe on the largest scale is the simplest'. It doesn't mean that other local inertial frames are not inertial.
{ "domain": "physics.stackexchange", "id": 66236, "lm_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, reference-frames, coordinate-systems, faster-than-light", "url": null }
I'll try to unify all the previous answers (of GH from MO, Will Sawin and Hurkyl) and also indicate unconditional results on this problem. It turns out that one can get a surprisingly decent unconditional upper bound here, which is something I hadn't appreciated fully previously. As noted in Hurkyl's answer above, a unifying problem is the following: Given a non-trivial subgroup $H$ of $({\Bbb Z}/q{\Bbb Z})^*$ with index $h$, bound (i) the least prime $p$ lying in a given coset of $H$, or (ii) the least integer $n$ lying in a given coset of $H$. Obviously the second problem is easier than the first, and as noted in Hurkyl's answer Theorem 1.4 of Lamzouri, Li and Soundararajan gives a good bound on GRH for the first problem: the least prime is essentially bounded by $((h-1) \log q)^2$ (see the precise form) and this result unifies both the least quadratic non-residue problem and also the least prime in an arithmetic progression problem.
{ "domain": "mathoverflow.net", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.977022625406662, "lm_q1q2_score": 0.8399109344901365, "lm_q2_score": 0.8596637505099168, "openwebmath_perplexity": 247.02325675948828, "openwebmath_score": 0.9119747281074524, "tags": null, "url": "https://mathoverflow.net/questions/217612/primorial-puzzlement" }
- It is sufficient to consider $x={e}^{t}$. Then $dx={e}^{t}\,dt$. we have: $$\int_{0}^{\infty}\frac{\ln x}{1+x^{2}}dx=\int_{-\infty}^{\infty}\frac{t{e}^{t}}{1+{e}^{2t}}dt=0$$ Recall that the function $\frac{t\mathrm{e}^{t}}{1+e^{2t}}$ is odd. - - Does this differ from the method mentioned in the question? – robjohn Aug 16 '14 at 11:44 @robjohn They are equivalent but this one doesn't split $\left(0,\infty\right)$. Thanks. – Felix Marin Aug 16 '14 at 21:14 At the risk of stating the obvious, I would suggest examining the curve of ${\ln x}\over{(1+x^2)}$: The geometrical interpretation is that the area below the $x$-axis down to the curve from 0 to 1 is equal to the area above the $x$-axis up to the curve from 1 to infinity. - Note that the function ln(x) is negative on the interval $(0, 1)$, so the whole integrand is negative on the interval $(0,1)$. While $ln(x)$ is positive on the interval $(1, \infty)$, so the whole integrand is positive on the interval $(1,\infty)$. By splitting the integral on the above two intervals and evaluating the two integrals, we find the value of the integral on the interval $(0,1)$ equals -catalan ( $\sim 0.915965594$. ) and value of the integral on the interval $(1,\infty )$ equals catalan. So the value of the whole integral is $0$. -
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9811668739644686, "lm_q1q2_score": 0.8507067593184088, "lm_q2_score": 0.8670357529306639, "openwebmath_perplexity": 230.33699971752645, "openwebmath_score": 0.9657018780708313, "tags": null, "url": "http://math.stackexchange.com/questions/170331/why-is-int-0-infty-frac-ln-x1x2-mathrmdx-0/170365" }
c++, algorithm, simulation, union-find int Percolation::numberOfOpenSites()const{ return numberOfOpenSites_; } bool Percolation::percolates(){ return connected(top, bottom); } double Percolation::testPercolateThreshold(){ while (!percolates()){ int row = rand_uf(0, sz_grid - 1); int col = rand_uf(0, sz_grid - 1); if (!isOpen(row, col)){ open(row, col); } } double threshold = numberOfOpenSites() / static_cast<double>(sz_grid * sz_grid); return threshold; } PercolationStat.h #pragma once #include "Percolaton.h" class PercolationStat{ private: double thresholdSum; int size; int trials; public: //perform independent trials on a n-by-n grid PercolationStat(int sz, int times); //sample mean of percolation threshold double PercolationMean(); }; PercolationStat.cpp #include "PercolationStat.h" #include "Percolaton.h" PercolationStat::PercolationStat(int sz, int times): size(sz), trials(times) { thresholdSum = 0; for (int i = 0; i < times; i++){ Percolation p(sz); thresholdSum += p.testPercolateThreshold(); } } double PercolationStat::PercolationMean(){ return thresholdSum / trials; } ufmain.cpp #include <iostream> #include "WeightedQuickUnionUF.h" #include "Percolaton.h" #include "gen_uf.h" #include "PercolationStat.h" using namespace std; int main(){ int size; cout << "Enter the size(N) of percolation grid(N-by-N):"; cin >> size; cout << "Enter number of time of simulation:"; int time; cin >> time;
{ "domain": "codereview.stackexchange", "id": 43054, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, algorithm, simulation, union-find", "url": null }
c++, functional-programming, monads virtual double _comp(var n) const = 0; virtual var _b_and(var n) const = 0; virtual var _b_or(var n) const = 0; virtual var _b_xor(var n) const = 0; virtual var _b_neg() const = 0; virtual var _u_add() const = 0; virtual var _u_neg() const = 0; virtual var _add(var n) const = 0; virtual var _sub(var n) const = 0; virtual var _mul(var n) const = 0; virtual var _div(var n) const = 0; virtual var _mod(var n) const = 0; virtual var _f_div(var n) const = 0; virtual var _rem(var n) const = 0; virtual var _pow(var n) const = 0; virtual var _root(var n) const = 0; virtual bool _has(var n) const = 0; virtual std::size_t _size() const = 0; virtual var _front() const = 0; virtual var _back() const = 0; virtual var _place(var n) const = 0; virtual var _push(var n) const = 0; virtual var _next() const = 0; virtual var _prev() const = 0; virtual var _reverse() const = 0; virtual var _get(var key) const = 0; virtual var _set(var key, var val) const = 0; virtual var _del(var key) const = 0; virtual std::size_t _hash() const = 0; virtual Text _help() const = 0; virtual bool _is_nothing() const = 0; virtual OP_CODE _op_code() const = 0; }; template <typename T> struct data_type : interface_type {
{ "domain": "codereview.stackexchange", "id": 44546, "lm_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++, functional-programming, monads", "url": null }
general-relativity, metric-tensor, gravitational-waves, stress-energy-momentum-tensor, linearized-theory In Minkowski spacetime, $T_{\mu\nu}=0$. So Einstein's equations can be written as \begin{equation} \sqrt{G}_N \hat{\mathcal{E}}^{(1)} h_{\mu\nu} + G_N \hat{\mathcal{E}}[h]^{(2)} h_{\mu\nu} + \cdots + G_N^{N/2} \hat{\mathcal{E}}[h]^{(N)} h_{\mu\nu}= 0 \end{equation} Note that up to this point, we actually have not made any approximations. We have written the exact Einstein equations with $T_{\mu\nu}=0$, but just in some weird choice of variables, and without explicitly computing the operators $\hat{\mathcal{E}}^{(N)}$. (Of course you can find these in the literature if you want, although my notation may not be standard). Iterative solution Now we develop an iterative solution for the metric perturbation $h_{\mu\nu}$. We write \begin{equation} h_{\mu\nu} = h^{(1)}_{\mu\nu} + \sqrt{G_N} h^{(2)}_{\mu\nu} + ... + G_N^{N/2} h^{(N)}_{\mu\nu} \end{equation} We then follow the following iterative procedure:
{ "domain": "physics.stackexchange", "id": 78708, "lm_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, metric-tensor, gravitational-waves, stress-energy-momentum-tensor, linearized-theory", "url": null }
cc.complexity-theory, np-hardness, complexity-classes, sat, csp I read this to mean that, by Ladner's, there are problems that are neither ${\bf P}$ nor ${\bf NP}$-complete, but by Schaefer's, problems are either ${\bf P}$ and ${\bf NP}$-complete only. What am I missing? Why don't these two results contradict each other? I took the condensed version of the above theorem statements from here. In his "Final Comments" section, he says "Thus, if a problem is in ${\bf NP} \setminus {\bf P}$ but it is not ${\bf NP}$-complete then it can not be formulated as CSP". Does this mean ${\bf SAT}$ problems miss some instances that are in ${\bf NP}$? How is that possible? As Massimo Lauria states, problems of the form CSP($\Gamma$) are rather special. So there is no contradiction. Any constraint satisfaction problem instance can be represented as a pair $(S,T)$ of relational structures $S$ and $T$, and one has to decide if there exists a relational structure homomorphism from the source $S$ to the target $T$. CSP($\Gamma$) is a special kind of constraint satisfaction problem. It consists of all pairs of relational structures which are constructed using only the relations from $\Gamma$ in the target relational structure: CSP($\Gamma$) = $\{(S,T) \mid \text{all relations of } T \text{ are from } \Gamma\}$. Schaefer's Theorem says that when $\Gamma$ contains only relations over $\{0,1\}$, then CSP($\Gamma$) is either NP-complete or in P, but says nothing at all about other collections of CSP instances.
{ "domain": "cstheory.stackexchange", "id": 1378, "lm_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, complexity-classes, sat, csp", "url": null }
Theorem 2 Let $\mu$ be a locally finite Radon measure on $\mathbb R^n$ and $\alpha$ a nonnegative real number such that the $\alpha$-dimensional density of $\mu$ exists and is positive on a set of positive $\mu$-measure. Then $\alpha$ is necessarily an integer. #### Lebesgue theorem Concerning $n$-dimensional densities, the following theorem corresponds to the fact that, given a summable function $f$, $\lambda$-a.e. point $x$ is a Lebesgue point for $f$: Theorem 3 (Theorem 1 in Section 1.7 of [EG]) Let $f\in L^1_{loc} (\mathbb R^n)$ and consider the measure $$\label{e:densita} \mu (A):= \int_A f\, d\lambda\, .$$ Then the $n$--dimensional density of $\mu$ exists at $\lambda$--a.e. $x\in \mathbb R^n$ and coincides with $f(x)$. A similar result in the opposite direction holds and is a particular case of a more general result on the Differentiation of measures: Theorem 4 Let $\mu$ be a locally finite Radon measure on $\mathbb R^n$. If the $n$-dimensional density $\theta^n (\mu, x)$ exists for $\mu$-a.e. $x$, then the measure $\mu$ is given by the formula \ref{e:densita} where $f = \theta^n (\mu, \cdot)$. The latter theorem can be generalized to Hausdorff $\alpha$-dimensional measures $\mathcal{H}^\alpha$ (cp. with Theorem 6.9 of [Ma]).
{ "domain": "encyclopediaofmath.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9945307250770898, "lm_q1q2_score": 0.8413157455499176, "lm_q2_score": 0.8459424373085146, "openwebmath_perplexity": 260.38993880699303, "openwebmath_score": 0.9546153545379639, "tags": null, "url": "https://encyclopediaofmath.org/wiki/Density_of_a_set" }
newtonian-mechanics, angular-momentum Title: Angular momentum of child and swing system when a child is riding a swing the angular velocity of the swing with respect to the point of suspension keeps on increasing (given that, the child is keep on swinging by his own). Who is providing external torque in this situation? Why the angular momentum of the swing + child system is not constant? If you think of the swing as an oscillator you can add a force to drive the oscillator, and if the driving force is near the resonance frequency then the amplitude of the oscillator will grow. So a child rocking back and forth on the swing is using their own energy to change their center of gravity and its position with respect the lines holding the seat. So the moment of inertia of the swing and child is not constant as the swing moves. One way to model that in a paper by Case and Swanson If you work out the equations you can find that at least for small angles it is like a driven oscillator driven at $\omega$, while for larger amplitudes it can be driven like like a parametric oscillator at frequency $2\omega$. There are other ways to drive the swing, instead of leaning back and forth, a kid can just straighten their knees out a the appropriate frequency, or a more extreme case could crouch and stand in the swing. In the second case, it would be more like a parametric oscillator since if the swing was at rest, standing up and down would not start the motion. There would need to be some initial oscillation. So shifting the center of mass (using the internal energy of the child) is adding energy from the gravitational field to the system at the right times. Or by rotating the legs with a kick adding to the angular momentum at the right time.
{ "domain": "physics.stackexchange", "id": 90301, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, angular-momentum", "url": null }
combinatorics, substrings, bioinformatics But this algorithm produces a duplicate rather quickly: substrings [0-3) and [10-13). I know there are 4^3 = 64 different substrings of length 3, so an upper bound to force pigeonholing is a string of length (64 * 3) + 1 = 195 -> one of the 64 substrings must appear twice. I've convinced myself that this can be bounded tighter to length 67 since this could contain 64 different substrings that start at indexes 0-63 and one duplicate that starts at 64. The interleaving of the substrings with each other is what makes them hard to analyze. How much tighter can this bound go, and what is an algorithm for producing a sequence that forces a pigeonhole? The answer is 66: any sequence of length greater than 66 must contain some repeated substring (as you argue in the question), and there exists a sequence of length 66 where no substring is repeated. The latter can be obtained from a de Bruijn sequence with $n=3$ and $k=4$. The length of this sequence is $k^n=64$ symbols. A de Bruijn sequence is a cyclic string such that every possible length-$n$ string occurs exactly once as a substring of it. It is known that a de Bruijn sequence of length $k^n$ exists. If we take the de Bruijn sequence $x_1 x_2 \cdots x_{64}$, then $x_1 x_2 \cdots x_{64} x_1 x_2$ is an ordinary string where every possible length-3 string occurs exactly once as a substring. In particular, no length-3 substring of $x_1 x_2 \cdots x_{64} x_1 x_2$ is repeated. There are also standard algorithms to find such a string.
{ "domain": "cs.stackexchange", "id": 9959, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "combinatorics, substrings, bioinformatics", "url": null }
java, performance, primes, io public static void main(String[] args) { int count = 50000000; time(() -> loadByQuantity(count, "primes.dat"), "OP"); } I then implemented the same functionality using an NIO mechanism specifically using memory-mapped IO: http://docs.oracle.com/javase/8/docs/api/java/nio/MappedByteBuffer.html This type of IO is designed to significantly reduce the amount of memory copies are made of the input file. It also means that Java reads the content out of the OS, without first copying it in to Java's memory space. For the types of sequential IO this problem has, I expected the performance improvements to be significant. Further, the MappedByteBuffer has methods getInt() which also decodes 4 bytes in to an int for you: http://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html#getInt-- Here's the code I came up with. Note, I have used the same exception handling that you use, and also the same array initialization. I believe you should be throwing exceptions from these methods, and not just wrapping them in runtime exceptions: public static int[] loadByNIO(int argNumPrimes, String fname) { int numPrimes = Math.min(argNumPrimes, 50_000_000); int[] primes = new int[numPrimes]; try (FileChannel fc = FileChannel.open(Paths.get(fname))) { MappedByteBuffer mbb = fc.map(MapMode.READ_ONLY, 0, numPrimes * 4l); for (int i = 0; i < numPrimes; i++) { primes[i] = mbb.getInt(); } } catch (IOException ex) { throw new RuntimeException(ex); } return primes; }
{ "domain": "codereview.stackexchange", "id": 24068, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, performance, primes, io", "url": null }
- if we take sum of first 9 terms of the series: then sum = 0+0+0+1+1+2+4+8+15=31 ; but by the formula it comes as : 221/3 –  pranay Feb 21 '12 at 7:28 @pranay: The formula yields $\frac13(56+2\cdot 15+8-1)=\frac13(93)=31$. –  Brian M. Scott Feb 21 '12 at 7:34 thanks a lot :) –  pranay Feb 21 '12 at 8:56 This can also be solved by a matrix-ansatz (and then generalized in a completely obvious way). Example: assume a vector A containing your first four values, say $\qquad \small A=[1,3,4,5]$ . Next consider the transfermatrix, say T which defines the composition of the next entry by $\small 1*1 + 3*1 + 4*1 + 5*1 =13$, and simply shifts the old entries $\small [1,3,4,5] \to [3,4,5,13]$ . The required matrix T looks like $\qquad \small T=\begin{bmatrix} 0&0&0&1\\1&0&0&1 \\0&1&0&1 \\0&0&1&1\\ \end{bmatrix}$ Then we have the iteration for the computation of consecutive elements of the tetranacci-sequence simply by $\qquad \small A_{k+1} = A_k \cdot T$ or, even better: $\qquad \small A_k = A \cdot T^k$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9833429602348457, "lm_q1q2_score": 0.8107288249221387, "lm_q2_score": 0.8244619199068831, "openwebmath_perplexity": 509.1543080362634, "openwebmath_score": 0.9982683062553406, "tags": null, "url": "http://math.stackexchange.com/questions/111583/generalised-formula-for-sum-of-first-n-tetranacci-numbers" }
# Is the proof of the derivative of $\sin(x)$ circular? The proof of $\frac{d}{dx}\sin(x)$ goes something like this: \begin{aligned} \lim_{h\to0}\frac{\sin(x+h)-\sin(x)}{h}=\lim_{h\to0}\frac{\sin(x)\cos(h)+\cos(x)\sin(h)-\sin(x)}{h}\\ =\lim_{h\to0}\frac{\sin(x)(\cos(h)-1)+\cos(x)\sin(h)}{h}\\ =\lim_{h\to0}\frac{\sin(x)(\cos(h)-1)}{h}+\cos(x)\lim_{h\to0}\frac{\sin(h)}{h}\\ =0+\cos(x)\times1\\ =\cos(x) \end{aligned} My doubt about this is that it uses the limit of $\frac{\sin(h)}h$ and $\frac{\cos(h)-1}{h}$ in the proof. However, proving these two limits uses L'Hopital's rule, which uses the derivative of $\sin(x)$ and $\cos(x)$ to prove the limits. This causes a circular argument because we're using the derivative of $\sin(x)$ to prove the derivative of $\sin(x)$. Is there a way to prove these two limits without using L'Hopital's rule or just looking at the graph, or is there a way to find $\frac{d}{dx}\sin(x)$ without using these two limits? There is a nice way to prove the limits using geometry here, but I'm wondering if there's a way to do it without using this, either. Edit: The way I'm defining sine is by the unit circle definition, not the Taylor series one.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9793540656452213, "lm_q1q2_score": 0.836282928130034, "lm_q2_score": 0.8539127548105611, "openwebmath_perplexity": 182.08287170128386, "openwebmath_score": 0.9572800397872925, "tags": null, "url": "https://math.stackexchange.com/questions/2420474/is-the-proof-of-the-derivative-of-sinx-circular" }
conditional dependence is a relationship between two or more events that are dependent when a third event occurs. Independent 3) You flip a coin twice. Then Vicki draws a ball. A bag contains 4 red marbles, 5 blue marbles, and 3 green marbles. Independent Probability. Free Online Probability Math Games. Answer: _____ Independent and Dependent. Events can be "Independent", meaning each event is not affected by any other events. For example, the complementary events A and A cannot occur simultaneously. In other words, joint probability is the likelihood of two events occurring together. The calculation shows the probability is low. For example, if there are 4 blue blocks and 4 yellow blocks in a jar, the probability of taking a blue block out of the jar then a yellow block out of the jar is 4/8 times 4/7, or 16/56, which reduces. If you're behind a web filter, please make sure that the domains *. What is the. Read through some experiment descriptions and see if you can pick out the independent and dependent variables. The basic procedure for constructing the failure domain boundary in the uncorrelated standard normal space and estimat-ing the probability of failure is given by the following steps:. Person one rolls the die and passes that many matches to. Example Problem. 5 Grade: 6 Objective Represent all possible outcomes for compound events in an organized way and express the theoretical probability of each outcome Represent probabilities as ratios, decimals between 0 and 1, and percentages between 0 and 100. Example There is a student who has a property called. • Lesson 12-6 Find statistical measures. Dependent 3) A box of chocolates contains five milk chocolates, five dark chocolates, and five white chocolates. All of the above.$\begingroup$The probability that a random variable with a continuous distribution (e. P(orange first, green second) _____ b. HOMEWORK - INDEPENDENT vs DEPENDENT EVENTS 1) When the occurrence of an event DOES NOT affect the probability of the next event, the events are 2) Two events are if the occurrence of one event affects the probability that the other event will occur. The probability of me or riley getting a hit is 62%. The rest are fair. After that, you'll learn how to figure out the odds that two or more. B: The dice summing to 8. Life is full of random events! You
{ "domain": "everwoodbiocostruzioni.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9871787883738261, "lm_q1q2_score": 0.80478022772877, "lm_q2_score": 0.8152324960856177, "openwebmath_perplexity": 351.12934814143114, "openwebmath_score": 0.746311366558075, "tags": null, "url": "http://kbjx.everwoodbiocostruzioni.it/dependent-probability.html" }
ros-melodic Title: Possibility of data race in subscriber callback(s)? I have a question on how does the ros::subscriber work. For example, if I have a class and inside that class I constantly update a specific variable in a while loop: while(ros::ok()) _effort = this->getEffort(); What will happen if this same class has a subscriber callback function which also writes into this _effort variable? Does it have some kind of a memory lock enabled? Originally posted by EdwardNur on ROS Answers with karma: 115 on 2019-04-21 Post score: 0 Short answer: no, there is not a memory race (in terms of two threads writing to the same memory address at the same time). By default, ROS doesn't start any threads when you make subscribers/callbacks. When you call ros::spin() or ros::spinOnce(), it will call each of the subscribers you have added sequentially, in the same thread as the spin. Note about your code: if the while(ros::ok()) _effort = this->getEffort(); is running in the main loop, then your subscribers will never get called, since (as mentioned above), in a single threaded program, subscribers are only called when ros::spin() or ros::spinOnce() is called. A slight modification to your above code that would call the subscriber would be: while(ros::ok()) { ros::spinOnce(); _effort = this->getEffort(); } Now if you are creating a different thread to run the while(ros::ok()) _effort = this->getEffort();, then yes, there will be a data race, as ROS doesn't handle memory locks for you. For some more resources on this, look around ROS answers some more (here's one). Source: mostly from http://wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning. Originally posted by BryceWilley with karma: 711 on 2019-04-21 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 32906, "lm_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-melodic", "url": null }
sql, sql-server, t-sql select first_trans_id, ticket_id, ticket_type, service_id,
{ "domain": "codereview.stackexchange", "id": 22491, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "sql, sql-server, t-sql", "url": null }
matrix-representation, clifford-group Title: Is there a way to write a generic low dimensional Clifford matrix? Suppose I want to write a general $2\times2$ special unitary matrix in a given basis, I can write it as such: $$\begin{pmatrix} \alpha & -\overline\beta\\ \beta & \overline \alpha\end{pmatrix}$$ with $|\alpha|^2+|\beta|^2=1$. However I do not know if such a form exists for Clifford matrices/gates. Is there such a way to represent $2\times2$ or $4\times 4$ or even higher dimensions Clifford in terms of conditions between its matrix elements? The unitary group is an infinite group, which is why unitary matrices can be parameterized by continuous parameters. Your representation is incomplete. A $2\times 2$ unitary matrix has four parameters, and one represenation is $$e^{i\phi/2} \begin{pmatrix} e^{i\phi_1/2}\cos\theta & e^{i\phi_2/2}\sin\theta \\ -e^{-i\phi_2/2}\sin\theta & e^{-i\phi_1/2}\cos\theta \end{pmatrix} $$ The Clifford group is a finite, i.e. The $n$-qubit Clifford group has a finite number of elements. The first few such sizes are $$ |C(1)| = 192, \quad |C(2)| = 92160, \quad |C(3)| = 743178240. $$ So, it's not possible to parameterize them with continuous parameters. If instead, you are interested in generating all possible Clifford gates (for small n), there are algorithms that systematically construct them all from the generators.
{ "domain": "quantumcomputing.stackexchange", "id": 4567, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "matrix-representation, clifford-group", "url": null }
• I can follow your explanation to the point where you examine the structure of the cone. Could you please clarify how you obtain the assumptions that $z_{11} \leq 0$, $z_{12} \leq 0$ and $z_{11}z_{12} \leq z_{12}^2$ – tilman151 Nov 30 '14 at 9:40
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9706877726405083, "lm_q1q2_score": 0.8024790382907313, "lm_q2_score": 0.8267118026095991, "openwebmath_perplexity": 130.84129666215682, "openwebmath_score": 0.934492290019989, "tags": null, "url": "https://math.stackexchange.com/questions/1042280/express-this-linear-optimization-problem-subject-to-a-circular-disk-as-a-semidef" }
• How does card 3 have a $\frac 2 3$ chance of being picked in the first place? That statement makes no sense to me. – Wildcard Feb 14 '17 at 6:43 • There are three possible green sides. So far so good. But card 3 has 2 sides. So that's 2/3 since card 1 is out. If you have two white tiles and one black, the probability of a white tile is 2/3. – pie314271 Feb 14 '17 at 19:56 As I see it, I think the idea is that the $RG$ card could have been shuffled in two different but equally likely ways: one with the $R$ facing upwards, and one with the $G$ face facing upwards. I tried using classical probability while being as explicit/obvious as possible in each step. Let $GG$ be the event 'The revealed card is green-green.' Let $FG$ be the event 'The revealed face is green.' Then we wish to calculate the conditional probability $$\mathbb{P}(GG|FG)=\frac{\mathbb{P}(GG\cap FG)}{\mathbb{P}(FG)}$$ Let $RGG$ be the event 'The red-green card has the green face upwards.' Let $RGR$ be the event 'The red-green card has the red face upwards.' Then by the law of total probability: $$\mathbb{P}(GG\cap FG)=\mathbb{P}(GG\cap FG\cap RGG)+\mathbb{P}(GG\cap FG\cap RGR)$$ Now, we have that
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9632305339244013, "lm_q1q2_score": 0.8026836968683269, "lm_q2_score": 0.8333245973817158, "openwebmath_perplexity": 764.155380051241, "openwebmath_score": 0.6330095529556274, "tags": null, "url": "https://math.stackexchange.com/questions/2143546/what-are-the-possible-correct-answers-for-this-probability-word-question" }
what's going on, and more explanation, see the previous pages, Complex Numbers and Polar Form of a Complex Number. 2nd R <> P. Select R> Pr when prompted enter the numbers P>Pr(18,22) which equals 28.425. convert complex numbers to polar co-ordinates. Exponential Form of Complex Numbers; Euler Formula and Euler Identity interactive graph; 6. Degrees - Minutes - Seconds angle calculator. Algebraic form, where a and b - real numbers, i - imaginary unit, so that i 2 =-1. You can zoom the graph in or out using the navigation icons at the bottom of the graph, and pan left-right, up-down by holding down the key while dragging the graph. socratic 8 3 form of complex numbers jnt conjugate wikipedia write the number 2 3i in a Related Links. Complex Numbers: Dividing - Ex 3. if z 1 = r 1∠θ 1 and z 2 = r 2∠θ 2 then z 1z 2 = r 1r 2∠(θ 1 + θ 2), z 1 z 2 = r 1 r 2 ∠(θ 1 −θ 2) Note that to multiply the two numbers we multiply their moduli and add their arguments. = + = / = + = / 5. If your numbers are already in polar form, skip this step. This is an advantage of using the polar form. In the last tutorial about Phasors, we saw that a complex number is represented by a real part and an imaginary part that takes the generalised form of: 1. To use these tools, you have to enter the numbers in standard form and select the operation to be performed. Multiplication and division in polar form Introduction When two complex numbers are given in polar form it is particularly simple to multiply and divide them. Sitemap | Multiplication and division of complex numbers in polar form. Our aim in this section is to write complex numbers in terms of a distance from the origin and a direction (or angle) from the positive horizontal axis. Contact. The number r is the absolute value (or modulus) TI-30X. Math Gifs; Algebra; Geometry; Trigonometry; Calculus; Teacher Tools; Learn to Code; Home; Algebra ; Complex Numbers; Complex number Calc; Complex Number Calculator. Complex Numbers: Convert From Polar to Complex Form, Ex 1 Complex Numbers: Multiplying and Dividing Expressing a
{ "domain": "cimice.cz", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.947381048137938, "lm_q1q2_score": 0.805246577880872, "lm_q2_score": 0.8499711699569787, "openwebmath_perplexity": 1188.9888814618516, "openwebmath_score": 0.8129895925521851, "tags": null, "url": "http://cimice.cz/extra-large-zvt/dividing-polar-form-calculator-7f8c9b" }
performance, php, mvc $title = $article["title"]; $template = "wiki.php"; include 'template/design.php'; template/wiki.php <?php if ($article): ?> <div> <a href="/">[Home]</a> <a href="/edit.php?title=<?= $article["slug"]; ?>">[Edit Article]</a> <a href="/documentation.php">[Documentation]</a> </div> <?= $ParsedownExtra->text($article["body"]); ?> <?php else: ?> <div><a href="/">[Home]</a></div> <p>Unknown article ID. <a href="/edit.php?title=<?= $title; ?>">[Create Article]</a> </p> <?php endif; ?>
{ "domain": "codereview.stackexchange", "id": 34481, "lm_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, php, mvc", "url": null }
c#, .net, reflection And the attribute: [AttributeUsage(AttributeTargets.Property)] public class FeatureControlAttribute : Attribute { public string Key { get; set; } public FeatureControlAttribute(string key) { Key = key; } } There isn't much to say, your code looks well formatted and you are using good and meaningful names to name your things. Nevertheless I would likte to say that in the ExtendedWebBrowser class the order of the methods could be improved. You are calling SetDWordKey() in the Initialize() method which involves an upwards scroll to get there. I would expect a method which is only called by one other method to follow the calling method. In the ExtendedWebBrowserConfiguration you should extract the magic numbers 7 and 11 to meaningful constants.
{ "domain": "codereview.stackexchange", "id": 19894, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, .net, reflection", "url": null }
python, python-3.x, file MAX_AGE = 90 # 60 seconds in a minute, 60 minutes in an hour, 24 hours in a day MINUTES = 60 HOURS = 60*MINUTES DAYS = 24*HOURS PATH_TO_FILES = "path/to/local/copy/of/lib/" EXT = ".pdf" WHITELIST = ['_nl' + EXT, '_en' + EXT, '_de' + EXT] SUPPLIERS = ['Siemens', 'IFM'] def classify_files(basedir, limit): """ Classify files in *basedir* not modified within *limit* :param basedir: directory to search :param limit: timelimit for treshold Return result (dict) and count (int). """ report = { 'Correct' : [], 'Invalid' : [], 'OutOfDate': [] } mod_time_limit = time.time() - limit count = 0 for filename in os.listdir(basedir): path = os.path.join(basedir, filename) count += 1 if not filename[-7:] in WHITELIST: report['Invalid'].append(filename) elif os.path.getmtime(path) < mod_time_limit: report['OutOfDate'].append(filename) else: report['Correct'].append(filename) return report, count def main(): for supplier in SUPPLIERS: print("\n{}:".format(supplier)) result, count = classify_files( PATH_TO_FILES + supplier, MAX_AGE * DAYS ) pprint.pprint(result) print("{} files checked".format(count)) if __name__ == '__main__': main() Issues One of the most glaring issues is the hardcoded 7 here: if not filename[-7:] in WHITELIST:
{ "domain": "codereview.stackexchange", "id": 37139, "lm_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, file", "url": null }
quantum-operation, density-matrix, depolarizing-channel Title: What is the adjoint of the depolarizing channel? Consider the single qubit depolarizing noise channel given by $$\Phi(\rho) = \frac{\lambda}{d} \mathbb{I} + (1- \lambda) \rho.$$ What might be the adjoint $\Phi^{*}(\cdot)$ of this channel? In particular, I am trying to find how the adjoint acts on standard basis states $|0\rangle\langle 0|$ and $|1\rangle\langle 1|$. TL;DR: $\Phi^*=\Phi$. If quantum channel $\Psi:\mathcal{X}\to\mathcal{Y}$ has a Kraus representation $\Psi(X)=\sum_iK_iXK_i^\dagger$ then its adjoint $\Psi^*:\mathcal{Y}\to\mathcal{X}$ has a Kraus representation $\Psi^*(Y)=\sum_iK_i^\dagger YK_i$, because $$ \begin{align} \langle Y,\Psi(X)\rangle&=\mathrm{tr}\left[Y^\dagger \left(\sum_iK_iXK_i^\dagger\right)\right]\tag1\\ &=\mathrm{tr}\left[\left(\sum_iK_i^\dagger Y^\dagger K_i\right)X\right]\tag2\\ &=\mathrm{tr}\left[\left(\sum_iK_i^\dagger YK_i\right)^\dagger X\right]\tag3\\ &=\langle\Psi^*(Y),X\rangle.\tag4 \end{align} $$ Therefore, every channel with Hermitian or anti-Hermitian Kraus operators is self-adjoint. In particular, all Pauli channels including depolarizing channel are self-adjoint.
{ "domain": "quantumcomputing.stackexchange", "id": 4465, "lm_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-operation, density-matrix, depolarizing-channel", "url": null }
ros Title: Unable to control more than one object in gazebo with one node Hey, I just tried to build up a changing world to train my Turtlebot3 in it. The idea is, that everytime when the robot spawns to (0, 0) again, parts of the layout and obstacles shall change. Here I try to switch positions and movement directions of my three obstacles when the Robot respawns. The problem is, only the first obstacle is moving. The other one don´t move at all. My question is, can I communicate with all obstacles from one node? In the following you can see my node code and a part of the .world file. Node: #!/usr/bin/env python import rospy import time import random import math from gazebo_msgs.msg import ModelState, ModelStates class Combination(): def __init__(self): self.pub_model = rospy.Publisher('gazebo/set_model_state', ModelState, queue_size=1) self.moving() def moving(self): state = 0 while not rospy.is_shutdown(): model = rospy.wait_for_message('gazebo/model_states', ModelStates) for i in range(len(model.name)): if model.name[i] == 'turtlebot3_burger': turtlebot_pos= ModelState() turtlebot_pos.model_name=model.name[i] turtlebot_pos.pose = model.pose[i]
{ "domain": "robotics.stackexchange", "id": 4412, "lm_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 }
homework-and-exercises, bose-einstein-condensate Title: Hamiltonian of weakly-interacting Bose gas I try to derive the Hamiltonian for a weakly-interacting Bose gas. I am stucked right now at this step, could someone explain it?
{ "domain": "physics.stackexchange", "id": 25542, "lm_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, bose-einstein-condensate", "url": null }
format for writing this sequence in set builder notation: set-builder notation objects! Follow use set notation and list all the elements Asked Jul 28 '17 at 8:58 a roster is a list of the circle by. Use an ellipsis ( notation describes the properties of the elements in a set can... Function or placing all the elements of a set is called an element belongs to a set, we the. \In \mathbb Z, x > 0, x > 0, x \ = x/5... | edited Aug 10 '19 at 11:16. jpp badges 216 216 bronze badges share | cite | improve question. Listing method to use set notation and list all the elements the set ( ) function estudyassistant.com if the pattern is obvious ( )... Estudyassistant.Com if the pattern is obvious ( a ) the set ( ) function can say “ let (..., we use the set of all even integers, real numbers, such integers... ( ) function, x \ = \ x/5 \ }$ discrete-mathematics created by using the set use set notation and list all the elements... Number of elements a pro golfer is ranked 48th out of 230 players that played in set!, expressed in set-builder notation, the set of all whole numbers greater than and... Includes '' for the subset relation only 50, use set notation and list all the elements, 44....... Also use Venn diagrams can be written explicitly by listing its elements are all the fibers over the of! Include f −1 ( B ) that is less than 10 } express the using! The answers to estudyassistant.com if the set and subsets in a set in Python are typically used for only! contains '' be used to help define the elements of the of. Selection from a larger set, we use the set of all odd integers modeled after sets Python. Listhing method to describe the set modeled after sets in Python is a can! Python are typically used for membership only, and do not have to be in any specific.! Create a set, access it ’ s elements and carry out these mathematical operations shown. Use set notation is { x | x is an odd whole less! Object that belongs to a set using the set be different the subset relation.. A question that asks to use set notation to
{ "domain": "musiccityseminars.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9553191322715436, "lm_q1q2_score": 0.8022139215039696, "lm_q2_score": 0.8397339636614178, "openwebmath_perplexity": 374.92844967249346, "openwebmath_score": 0.7492088079452515, "tags": null, "url": "https://www.musiccityseminars.com/fqz95/use-set-notation-and-list-all-the-elements-ff7227" }
\begin{align} \mc{J} & \equiv \Im\int_{0}^{\infty}\ln\pars{x}\expo{-\pars{t - \ic}x}\,\dd x = \Im\bracks{{1 \over t - \ic}\int_{0}^{\pars{t - \ic}\infty} \ln\pars{x \over t - \ic}\expo{-x}\,\dd x} \\[5mm] & = -\,\Im\braces{{t + \ic \over t^{2} + 1}\int_{\infty}^{0}\bracks{\ln\pars{x \over \root{t^{2} + 1}} + \arctan\pars{1 \over t}\ic}\expo{-x}\,\dd x} \\[5mm] & = \Im\braces{{t + \ic \over t^{2} + 1}\bracks{% \int_{0}^{\infty}\ln\pars{x}\expo{-x}\,\dd x - {1 \over 2}\ln\pars{t^{2} + 1}+ \arctan\pars{1 \over t}\ic}} \end{align}
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9653811571768048, "lm_q1q2_score": 0.8518792288730577, "lm_q2_score": 0.8824278602705731, "openwebmath_perplexity": 1416.1116553532966, "openwebmath_score": 1.000008463859558, "tags": null, "url": "https://math.stackexchange.com/questions/1941888/calculate-int-0-infty-frac-sinx-logxx-mathrm-dx" }
typing, type-inference Am I interpreting the paper incorrectly? How should I determine whether a type variable in a let-bound expression is eligible to be instantiated with multiple types? Yes, you are restricting it too much. The second code is perfectly fine. For the record, Haskell has no issue with your code: > let myid = (\x->x)(\x->x) in (myid 'a', myid True) ('a',True) and Ocaml as well works fine, after eta-expansion: let myid y = (fun x -> x)(fun x -> x) y in (myid 'a', myid true);; - : char * bool = ('a', true) Eta expansion is needed in Ocaml, I think, because of the value restriction, where a binding is not generalized unless it is a function (let f x = ... instead of let f = ...). This restriction was needed to avoid some soundness issues with mutable variables -- remember Ocaml is not a "pure" language, and allows side effects everywhere. Anyway, Hindley-Milner should generalize let f = (\x->x)(\y->y) in ... just fine. First, \y->y is given the monotype $\alpha\to\alpha$, where $\alpha$ is a fresh type variable. Then \x->x is given $\beta\to\beta$, with a fresh $\beta$. Then we type check the application, which succeeds and unifies $\beta = (\alpha\to\alpha)$. The resulting type for the application is $\alpha\to\alpha$. Since $\alpha$ is not present in the environment, it can be generalized so the we get $f : \forall \alpha.\, \alpha\to\alpha$. Bonus exercise: type check the following # let myid y = (fun x -> x)(fun x -> x) y ;; val myid : 'a -> 'a = <fun> # myid myid myid true;; - : bool = true
{ "domain": "cs.stackexchange", "id": 8614, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "typing, type-inference", "url": null }
functional-programming Title: Occurrences notation in "Compiling Pattern Matching to Good Decision Trees" From Compiling Pattern Matching to Good Decision Trees (Luc Maranget, Proceedings of ML '08, pp. 35–46. ACM, 2008.) We also consider the usual occurrences. Occurrences are sequences of integers that describe the positions of subterms. More precisely an occurrence is either empty, written $\Lambda$, or is an integer $k$ followed by an occurrence $o$, written $k\cdot o$. Occurrences are paths to subterms, in the following sense: $$\begin{align*} v/\Lambda &= v\\ c(c_1, \dots, v_a)/k\cdot o &= v_k/o \quad(1\leq k\leq a) \end{align*}$$ Could anyone explain the occurrences notation a bit? I will try to illustrate the concept more intuitively and informally by representing terms as trees. A term can be represented as a rooted tree, where the leafs are atomic operands (literals, or variables) and the other nodes are operators. Typically abstract syntax trees can be built on that model as this example (taken in another answer), for which I am giving both the textual syntax and the tree representation. if (x > y) { if (y < a) { x:= a y:= b } else { x:= b; } } if ________/|\________ / | \ > if := / \ ____/|\____ / \ x y / | \ x b < := := / \ / \ / \ y a x a y b But the concept is used in a lot of different contexts, with different kinds of operators. The example term above could also be written as in the text of your question in function call style: if(>(x,y),if(<(y,a),:=(x,a),:=(y,b)),:=(x,b))
{ "domain": "cs.stackexchange", "id": 4622, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "functional-programming", "url": null }
robotic-arm, slam, navigation, hector-slam Title: hector slam on ARM Hello. first of all let me say that all launch files I post here work on my PC, but not on pandaboard or parallella with Ubuntuarm Ros-hydro. I tried different launch files but my basic one is the following: <node pkg="tf" type="static_transform_publisher"name="base_to_laser_broadcaster4" args="0.0 0 0 0.0 0.0 0.0 /base_footprint/base_link 1" /> <node pkg="tf type="static_transform_publisher"name="base_to_laser_broadcaster3" args="0.0 0 0 0.0 0.0 0.0 /base_link/laser_link 1" /> <arg name="geotiff_map_file_path" default="$(find hector_geotiff)/maps"/> <include file="$(find hector_mapping)/launch/mapping_default.launch"/> <include file="$(find hector_geotiff)/launch/geotiff_mapper.launch"> <arg name="trajectory_source_frame_name" value="scanmatcher_frame"/> <arg name="map_file_path" value="$(arg geotiff_map_file_path)"/> </include> Even with this one I get [ERROR] [1414485362.668347630]: Trajectory Server: Transform from /map to scanmatcher_frame failed: "map" passed to lookupTransform argument target_frame does not exist.
{ "domain": "robotics.stackexchange", "id": 19871, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "robotic-arm, slam, navigation, hector-slam", "url": null }
finite-impulse-response, poles-zeros, zero-padding, group-delay Here is my attempt. a) The transfer function of an FIR filter is given as; $$ H(z) = \sum\limits_{n=0}^{N}h[n] z^{-n} $$ where $h[n] \in \mathbb{R} $ From the problem statement it follows that the transfer function of this filter is given as; $$ H(z) = \sum\limits_{n=7}^{11}h[n] z^{-n} = h[7]z^{-7} + h[8]z^{-8} + h[9]z^{-9} + h[10]z^{-10} + h[11]z^{-11} $$ Am I correct in saying that the filter length is $N=5$ and that the group delay is $ \frac{N-1}{2} + 7 = 9 $ ? Here, I have used the fact that the first 7 coefficients are zero (i.e. $h[0] = h[1] = \dots = h[6] = 0$) and am assuming that this equates to a constant delay. The fact that the first 7 coefficients are zero is confusing me. b) I believe that since the the transfer function as follows $$ H(z) = z^{-11} \big(h[7]z^{4} + h[8]z^{3} + h[9]z^{2} + h[10]z + h[11] \big) $$ where we have factored out the $z^{-11}$ term, it follows that there must be 4 zeros.
{ "domain": "dsp.stackexchange", "id": 11679, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "finite-impulse-response, poles-zeros, zero-padding, group-delay", "url": null }
particle-physics, electrons, elementary-particles, subatomic Title: How did physicists run tests to try to study the internal structure of an electrons? How did physicists run tests to try to study the internal structure of an electrons? How specifically did they run tests to try and study it? I've looked around online and I can't seem to find any studies done. If anyone could explain this to me or point me in the right direction it would be most appreciated. The electron is a spin 1/2 particle. This severely limits the possible structure it can have. If we ignore the weak interaction, and only consider its charge, then it talks to the rest of the world through a photon vertex, e.g.:
{ "domain": "physics.stackexchange", "id": 76042, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "particle-physics, electrons, elementary-particles, subatomic", "url": null }
fluid-dynamics, bernoulli-equation Title: Why does Bernoulli's equation only apply to flow along a streamline that is in viscid, incompressible, steady, irrotational? I am learning about hydrofoil on this website. In a later video I watched, I learned that in the process of deriving Bernoulli's equation, $$constant=P/d+gh+1/2v^2$$ has to multiplied through by density. To keep the left side constant, fluid density has to be constant and thus is incompressible. But what about other qualities like in-viscid, and irrotational? What do they mean? And why are they necessary? Bernoulli's equation is really like an energy conservation equation: if you multiply both sides by the mass flow $\dot{m}$ (also assumed constant) you get: $$\frac12 \dot{m}v^2+\dot{m}gh+\dot{m}\frac{p}{d}=C$$ The terms are all energy per unit of time. The first one, $\frac12 \dot{m}v^2$, represents translational kinetic energy (per unit of time) of the fluid. But there's no term included for rotational kinetic energy (after all, fluid running through conduits rarely rotate!) So using Bernoulli we assume only translational motion of the fluid. The equation applies only to inviscid fluids because fluids with significant viscosity experience viscous energy losses, which are not conserved: the energy lost due to viscous friction would have to be supplied, for example by extra pressure, to prevent deceleration ($\dot{m}$ decreasing).
{ "domain": "physics.stackexchange", "id": 31197, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "fluid-dynamics, bernoulli-equation", "url": null }
java, benchmarking private void appendStats(StringBuilder stringBuilder, List<MeasuredProcedure> measuredProcedures) { String tabLeader = Defaults.TAB_LEADER; long referencedAverage = referencedProcedure.getReference(new MeasurementInputs(measuredProcedures, timesRun)); MeasuredProcedure currentProcedure; long bestResult = measuredProcedures.get(0).getAverageMeasurement(); long currentAverage, averageAsPercentageOfReference; String renderedCurrentAverage, renderedMarginToBestPerformerAsNecessary, renderedMin, renderedMax; for (int i = 0; i < measuredProcedures.size(); i++) { currentProcedure = measuredProcedures.get(i); currentAverage = currentProcedure.getAverageMeasurement(); renderedCurrentAverage = renderReadable(currentAverage); averageAsPercentageOfReference = (long) ((double) currentAverage / referencedAverage * 100); renderedMarginToBestPerformerAsNecessary = (i == 0) ? "" : " (+ " + renderReadable(currentAverage - bestResult) + ")"; renderedMin = renderReadable(currentProcedure.getMinMeasurement()); renderedMax = renderReadable(currentProcedure.getMaxMeasurement()); stringBuilder.append(i + 1).append(". ").append(currentProcedure).append(tabLeader) .append(renderedCurrentAverage).append(renderedMarginToBestPerformerAsNecessary).append(tabLeader) .append(averageAsPercentageOfReference).append("%").append(tabLeader) .append(renderedMin).append(tabLeader) .append(renderedMax).append("\n"); } }
{ "domain": "codereview.stackexchange", "id": 44781, "lm_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, benchmarking", "url": null }
c, parsing, functional-programming Body of include here ... #endif /* INCLUDE_FILENAME_H */ The alternative is #pragma once In the C and C++ programming languages, pragma once is a non-standard but widely supported preprocessor directive designed to cause the current source file to be included only once in a single compilation. Thus, #pragma once serves the same purpose as include guards, but with several advantages, including: less code, avoidance of name clashes, and sometimes improvement in compilation speed. On the other hand, #pragma once is not necessarily available in all compilers and its implementation is tricky and might not always be reliable.
{ "domain": "codereview.stackexchange", "id": 43456, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c, parsing, functional-programming", "url": null }
php, object-oriented, mysql Title: An online store, being converted from procedural to OOP I just start to learn OOP, and it's far more interesting than procedural style. I have a complete working online store written in procedural style. After realizing that my code is becoming very huge and very complex, I'm searching for methods to make my code more maintainable and more comfortable. One solution of course is to move to OOP style. But because I just started to understand how OOP work, I do not know which way to go. con.php: // Create a database connection $connection = mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_NAME); // Test if connection occurred. if(mysqli_connect_errno()) { die(); } qfunctions.php function get_user_info($user_id) { // this function make a query for the user info global $connection, $query_error;; $query = "SELECT * FROM users WHERE users.user_id = {$user_id}"; $user_result = mysqli_query($connection, $query); // Test if there was a qurey error if (!$user_result || mysqli_num_rows($user_result) == 0) { $query_error = $err_array["PROFILE_NOT_FOUND"]; } else { return $user_result; } } I feel like this method is good but not the most efficient way possible, so I built a class for my database. new_con.php class MySQLDatabase { private $connection; function __construct() { $this->open_connection(); }
{ "domain": "codereview.stackexchange", "id": 24170, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "php, object-oriented, mysql", "url": null }
beginner, jquery, html, css, sass Title: Website using HTML/CSS/SASS/Bootstrap/JQuery I'm learning Sass and responsive websites, I've made this simple portfolio website with the help of a bootstrap template (freelancer) and I'd like to know if I'm doing SASS correctly and ways to improve my website code. Also is my project structure correct as a standard? Thanks in advance! index.html <body id="page--top"> <!-- Navigation --> <nav id="mainNav" class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header page-scroll"> <button type="button" class="navbar-toggle navbar__button" data-toggle="collapse" data-target="#mainNavCollapse">Menú</button> <a class="navbar-brand navbar__brand" href="#page--top">Evan</a> </div> <div class="collapse navbar-collapse navbar__collapsingNav" id="mainNavCollapse"> <ul class="nav navbar-nav navbar-right"> <li class="hidden"> <a href="#page--top"></a> </li> <li class="page-scroll"> <a href="#portfolio" class="navbar__item">Portfolio</a> </li> <li class="page-scroll"> <a href="#about" class="navbar__item">About</a> </li> <li class="page-scroll"> <a href="#contact" class="navbar__item">Contact</a> </li> </ul> </div> </div> </nav>
{ "domain": "codereview.stackexchange", "id": 25006, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "beginner, jquery, html, css, sass", "url": null }
ros-fuerte, rosaria void RosAriaNode::cmdvel_cb( const geometry_msgs::Twist &msg) { veltime = ros::Time::now(); ROS_INFO( "new speed: [%0.2f,%0.2f](%0.3f)", msg.linear.x*1e3, msg.angular.z, veltime.toSec() );
{ "domain": "robotics.stackexchange", "id": 13464, "lm_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-fuerte, rosaria", "url": null }
c#, beginner, timer Title: Run a timer while waiting for user input I am making a C# console maths test where the user answers maths questions. I am trying to add a timer to the test, I have managed to make a timer but when I run my code it becomes a mess! Here is some example code: class Program { public static OtherCode() { \\*other code for test } public class Timer { public static int Timers(int timeLeft) { do { Console.Write("\rtimeLeft: {0} ", timeLeft); timeLeft--; Thread.Sleep(1000); } while (timeLeft > 0); Console.Write(Environment.NewLine); return timeLeft; } } public static void Main(string[] args) { int numberOfSeconds = 30; Thread thread = new Thread(new ThreadStart(() => { TimerClass.Timers(numberOfSeconds); })); thread.Start(); \\other code OtherCode(); } } Here is my full code: https://github.com/CrazyDanyal1414/mathstester This is what it looks like when I run the code and try to type an answer to a question: As you can see my timer code is overlapping my question code. If I use Console.SetCursorPosition(), my timer doesn't move but When I try to type an answer to a maths question my code makes me write it on the same line as the timer like so: Any help appreciated! Several things:
{ "domain": "codereview.stackexchange", "id": 38163, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, beginner, timer", "url": null }
matlab, fft Title: Phase angle between two harmnic orders I am trying to get the phase angle between 5th harmonic and the fundamental harmonic of a 50Hz current signal sampled @10kHz. I am doing the following: 1- take a window of 200ms and apply matlab function fft. I get here complex values. 2- Calculate the angle of every harmonic order using matlab function angle(). 3- Substract 5th order phase from 1st order. The issue is I am getting a rotating phase difference as shown below. Is there any way I can get a non-rotating difference between the two harmonics. I understand that they are of different frequencies, but I am trying to get such angle according to IEC standard as shown below: Edit This is a snapshot of the signal I am trying to analyse. The snapshot start from the closest point of zero crossing, the size of fft window is 200ms which is 10 times the signal frequency. After running fft of the entier period in the snapshot, 150 fft windows could be obtained with the angles of fundamental and 5th order shown below. Absolute phase is rarely meaningful since is it's highly dependent on your exact definition of your time reference, i.e. what exactly does $t=0$ mean. Since your time reference changes from frame to frame, so does the phase. If you know the fundamental frequency EXACTLY and it's phase locked to your sample clock, you can fix this simply by making the hop size (and the frame size) an integer multiple of the fundamental period. If it's not phase locked, you can try lining up the start of your frames to the "best" zero crossing in your signal and get the frame length as close to an integer multiple as possible. If your signal is reasonably well behaved and fairly noise free, that should work ok. If none of these work, ask again. There are more options, but they are also more complicated.
{ "domain": "dsp.stackexchange", "id": 9839, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "matlab, fft", "url": null }
php, sorting, mysql, json $sql .= "LIKE '$term' $andWhere GROUP BY $column"; You'll also find, if you upgrade your PHP version, that mysql() is being deprecated. mysqli() and pdo() are now the preferred methods. Error Suppressors DON'T USE ERROR SUPPRESSORS. This is a sign of bad code. If there is an error fix it. If you are doing it just so you don't have to type a couple extra lines, don't. Always ensure your code works 100%. The error suppressor should only be used during debugging. Incrementing There's got to be some better way to increment the "found" array... I thought of using a ternary operator, but that got a little messy, and at the moment, I can't think of anything else... I'll update this if I think of anything... Question How are there empty strings in $found? MAX_LIVESEARCH_SUGGESTIONS Not sure what the MAX_LIVESEARCH_SUGGESTIONS is, but would it not make more sense to perform this before creating the $found array? $length = count( $terms ); while ( $length > MAX_LIVESEARCH_SUGGESTIONS) { array_pop( $terms ); } Notice I moved count() out of the loop. With it in the loop, it will run it every time, which means more overhead. Remove it from the loop to remove the overhead. I'm having difficulties following the program, so unless $found ends up with more elements than $terms the above should work. If there are more, then you should limit how many are recorded by breaking out of the loops once that limit is reached. $length = count( $found ); if( $length == MAX_LIVESEARCH_SUGGESTIONS ) { break 4; } //I think its 4... might be 3... //perform actions to set $found here JSON Updating your PHP will also mean that you can use the JSON library that is now standard instead of needing to recreate it. Hope this helps!
{ "domain": "codereview.stackexchange", "id": 40529, "lm_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, sorting, mysql, json", "url": null }
continuous-signals Title: Properties of Invertible System I have come to the understanding that if these three properties hold true then the system is a memory system: 1) Time Scaling: $$y(t)=x(2t)\,,$$ 2) Time Shifting: $$y(t)=x(t+2)\,,$$ 3) Integration based system. I want to ask that do these properties also hold true for invertible systems? In the context of signal processing, a continuous-time system $$y(t) = \mathcal{T} \{ x(t) \}$$ is said to have memory if its output at time $t=t_0$ has a dependency on the input values for any time other than $t=t_0$. Otherwise; if the output at time $t = t_0$ depends only on the input value at time $t=t_0$, then it's a memoryless system. So the system defined by: $$y(t) = x(2t)$$ has memory, which can be proven by a single example, as $y(t)$ at $t=5$ is given by $x(t)$ at $t=10$... Furthermore, a system is invertible if unique (distinct) inputs produce unique (distinct) outputs, otherwise it not invertible. So the continuous time system defined by: $$y(t) = x(2t)$$ is invertible, as its inverse is given by $x(t) = y(t/2)$.
{ "domain": "dsp.stackexchange", "id": 6720, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "continuous-signals", "url": null }
quantum-mechanics, schroedinger-equation, greens-functions, dirac-delta-distributions, propagator \tag{11} $$ into \eqref{8}. The form of $\tilde{G}(\omega,p)$ is easily obtained and the $\omega$-integration can be performed by complex integration choosing the path in such a way that the boundary condition $G^+(t,x;t^\prime,x^\prime) =0$ for $t \lt t^\prime$ is satisfied. In both cases one finds the final result $$G^+(t,x;t^\prime,x^\prime)= \left(\frac{m}{2\pi i (t-t^\prime)} \right)^{\! 1/2}e^{i m(x-x^\prime)^2/2(t-t^\prime)} \theta(t-t^\prime). \tag{12}$$
{ "domain": "physics.stackexchange", "id": 100081, "lm_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, schroedinger-equation, greens-functions, dirac-delta-distributions, propagator", "url": null }
homework-and-exercises, thermodynamics, statistical-mechanics, stability Now the discriminant is $b^2-4ac$ so $$\left(\tilde{p}-\sqrt{\frac{a}{b}} \right)^2+4\sqrt{\frac{a}{b}}p-4\tilde{t}$$ $$\tilde{p}^2-2\sqrt{\frac{a}{b}}\tilde{p}+\frac{a}{b} +4\sqrt{\frac{a}{b}}p-4\tilde{t}$$ $$\left(\tilde{p}+\sqrt{\frac{a}{b}} \right)^2=4\tilde{t}$$ so ignoring the negative time solution we have $$\tilde{p}=-\sqrt{\frac{a}{b}} +2\sqrt{\tilde{t}}$$ but I don't see what Im meant to be doing next.
{ "domain": "physics.stackexchange", "id": 21910, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "homework-and-exercises, thermodynamics, statistical-mechanics, stability", "url": null }
quantum-mechanics, wavefunction, scattering If you're working with a field in a homogeneous cylindrical shell which doesn't include $r=0$ then arbitrary superpositions of all the functions are possible. Now you can just as well say that your solutions are superpositions of the functions $J_n(k\,r)\,e^{i\,n\,\phi}$ and $Y_n(k\,r)\,e^{i\,n\,\phi}$, with the $Y_n$ terms absent in any homogeneous region including $r=0$ and everything will be equivalent. The reason that people work with Hankel functions instead is their neat asymptotic behavior: \begin{align} H_\alpha^{(1)}(z) &\sim \sqrt{\frac{2}{\pi z}}\exp\left(i\left(z-\frac{\alpha\pi}{2}-\frac{\pi}{4}\right)\right) &&\text{ for } -\pi<\arg z<2\pi \\ H_\alpha^{(2)}(z) &\sim \sqrt{\frac{2}{\pi z}}\exp\left(-i\left(z-\frac{\alpha\pi}{2}-\frac{\pi}{4}\right)\right) && \text{ for } -2\pi<\arg z<\pi \end{align}
{ "domain": "physics.stackexchange", "id": 23217, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, wavefunction, scattering", "url": null }
• @MichaelRozenburg can you please elaborate why (2-x) was added to the expression and how this simplifies out to 1/2 – sardinsky Oct 4 '17 at 15:39 • @sardinsky I added something. See now. – Michael Rozenberg Oct 4 '17 at 15:47 • sardinsky --- he multiplied both the numerator and the denominator of the original fraction by the product of the two conjugates (one being the conjugate of the original numerator, the other being the conjugate of the original denominator). The $(2-x)$ factors arise when you perform the two different conjugate multiplications, one in the new numerator and the other in the new denominator. – Dave L. Renfro Oct 4 '17 at 15:50 • @DaveL.Renfro Thank you for the explanation. But why must we multiply by a product of both conjugates? – sardinsky Oct 4 '17 at 15:52 • I played with this a while and didn't see another "precalculus way". Generally speaking, you use the conjugate method to rewrite something so that a square root is eliminated, which you want to do because square root operation does not behave well with respect to addition or subtraction inside of it --- $\sqrt{a+b}$ cannot be rewritten in a useful way in terms of the separate quantities $\sqrt{a}$ and $\sqrt{b}.$ In the limit you had, each of the square roots was critically linked to stuff that is going to zero. – Dave L. Renfro Oct 4 '17 at 15:57 Just another way: Let $\sqrt{6-x}-2=h,\sqrt{3-x}-1=k\implies h\to0,k\to0$ and $$6-4-4h-h^2=x=3-1-2k-k^2\implies-h(4+h)=-k(k+2)\implies\dfrac hk=\dfrac{k+2}{h+4}$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9796676502191265, "lm_q1q2_score": 0.8267367263817108, "lm_q2_score": 0.8438950966654774, "openwebmath_perplexity": 472.752624618944, "openwebmath_score": 0.998550534248352, "tags": null, "url": "https://math.stackexchange.com/questions/2457481/limit-evaluation-conjugate-method-further-algebraic-manipulation" }
javascript, optimization, performance, beginner CSS: .chips { width: 40px; height: 40px; border-radius: 100px; position: absolute; } .ccont { position: absolute; width: 40px; height: 40px; } .chip1c { right: 0; bottom: -30px; } .chip10c { right: 50px; bottom: -35px; } .chip100c { right: 100px; bottom: -40px; } .chip1kc { right: 150px; bottom: -40px; } .chip10kc { right: 200px; bottom: -38px; } .chip100kc { right: 250px; bottom: -35px; } .chip1mc { right: 300px; bottom: -30px; } HTML: <div class="chip1mc ccont"></div> <div class="chip100kc ccont"></div> <div class="chip10kc ccont"></div> <div class="chip1kc ccont"></div> <div class="chip100c ccont"></div> <div class="chip10c ccont"></div> <div class="chip1c ccont"></div> All the cases should be handled generically; the variables should be in an array. The class names, such as chip10kc, should be renamed to chip10000c. I would also split the calculation from the presentation. /** * Decomposes a value as a sum of differently denominated chips. * The value must be a nonnegative integer. * Returns a seven-element array with the number of one-chips, ten-chips, … * million-chips. (Some of those elements may have undefined values.) */ function chipCounts(value) { var chips = ('' + value).split('').reverse().map(function (e) { return parseInt(e) });
{ "domain": "codereview.stackexchange", "id": 5497, "lm_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, optimization, performance, beginner", "url": null }
python, python-3.x, comparative-review, random We know that each iteration of the loop removes one item from data, so on the \$i\$th iteration of the loop, we will have \$m = k - i - 1\$, where \$k\$ is the initial length of data. In the average case, the popped index will be halfway along the list, so the total runtime in the average case is $$ \eqalign{ T(n, k) &= t_1 + \sum_{0≤i<n}\left(t_2 + t_3 + t_4 + t_5{m\over2} + t_6\right) + t_7 \\ &= t_1 + \sum_{0≤i<n}\left(t_2 + t_3 + t_4 + t_5{k - i - 1\over2} + t_6\right) + t_7 \\ &= {t_5\over2}nk - {t_5\over2}\sum_{0≤i<n}i + n\left(t_2 + t_3 + t_4 - {t_5\over2} + t_6\right) + t_1 + t_7 } $$ and we know that $$ \sum_{0≤i<n}i = {n^2 - n\over 2}$$ and so $$ T(n, k) = {t_5\over2}n\left(k - {n\over2}\right) + n\left(t_2 + t_3 + t_4 - {t_5\over4} + t_6\right) + t_1 + t_7 $$ I've gone into this in excruciating detail just in case you're not familiar with analysis of algorithms, and want to see all the details written out. But the important result of the analysis is the first term: $$ {t_5\over2}n\left(k - {n\over2}\right) $$ We know that \$k\$ has to be at least as big as \$n\$, so this term is at least
{ "domain": "codereview.stackexchange", "id": 29618, "lm_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, comparative-review, random", "url": null }
complexity-theory, asymptotics, runtime-analysis, average-case where your loop is simply decomposed into separate lines and in 1-st line is not used negative infinity. As we are considering function $T$ the number of maxNum updatings, i.e. number of assignements, then, obviously $T$ have values 1,2,3,4. Probability distribution for $T$ can be counted directly and is $Pr(T=1)$: $\frac{1}{4}=\frac{4}{16}$ $Pr(T=2)$: $\frac{1}{4}+\frac{1}{4}\cdot \frac{1}{2}+\frac{1}{4}\cdot \frac{1}{2}\cdot \frac{1}{2}=\frac{7}{16}$ $Pr(T=3)$: $\frac{1}{4}\cdot \frac{1}{2}+\frac{1}{4}\cdot \frac{1}{2}\cdot \frac{1}{2}+\frac{1}{4}\cdot \frac{1}{2}\cdot \frac{1}{2}=\frac{4}{16}$ $Pr(T=4)$: $\frac{1}{4}\cdot \frac{1}{2}\cdot \frac{1}{2}=\frac{1}{16}$ Anticipating the question of how these calculations were obtained, let me say that it is enough to simply consider the possible options for finding the maximum in the all fours and count their fractions. To calculate general case, where we have $n$ elements in array it's more easy to find reccurence relation for $T(n)$: $$T(n) = n \cdot T(n-1) + (n-1)!$$ and from here obtain expected value
{ "domain": "cs.stackexchange", "id": 17559, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "complexity-theory, asymptotics, runtime-analysis, average-case", "url": null }
c#, reinventing-the-wheel, queue Don't use Exception as anything but a base class in production code. This could be an invalid operation exception, or make your own exception. if(Count == _container.Length / 4) ReSize(Count * 2); The logic here is correct, but is nowhere documented. The logic is: we wish to maintain two properties, first, that there is never more than a ratio of three to one for wasted space to used space, and second, that there is never a sequence of enqueue-dequeue or dequeue-enqueue operations that both cause an expensive resize. Give a justification here for why and how this logic maintains those invariants. Consider also: who cares if we are "wasting" in a 4:1 ratio in the case where we have capacity 5 and count 1 ? Resizing the array to size 2 in this case is a waste of time. Consider taking a more sophisticated approach for small queues. Abstract the decision of whether to resize, and by how much, to a helper method that encapsulates that policy. var dequeuedValue = _container[_downHook++]; _container[_downHook - 1] = null; See what your obsession with putting the ++ in place has cost you? You do work in the decrement, and then you undo that work because you did it too soon! This is hard to reason about and a bug waiting to happen given any modification to this code. If you find you are undoing work you just did, you are doing something wrong; write the code more clearly: var dequeuedValue = _container[_downHook]; _container[_downHook] = null; _downHook -= 1; "Resize" is a word; it's not "re size". So the method should be Resize, not ReSize.
{ "domain": "codereview.stackexchange", "id": 25794, "lm_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#, reinventing-the-wheel, queue", "url": null }
ros, rosnode, turtlesim, rosrun, turtlesim-node Original comments Comment by kathrin@ros on 2018-05-23: Hi, I'm a beginner in Ros and just started the tutorial too.Moreover I'm working on SLAM methods with ROS. Maybe ur still interested in this topic and would like to discuss with me about it. Comment by Isam Abdullah on 2018-05-23: Yeah sure. I would be happy to help/discuss. Comment by kathrin@ros on 2018-05-23: I'm a total beginner. But did you manage this connection problem? Comment by Isam Abdullah on 2018-05-23: Are you installing ros in windows bash? If so, then it is not supported and you have to do alot of hacks to make it work on that. Comment by Isam Abdullah on 2018-05-23: So it is advisable for a beginner to work in ubuntu. Comment by kathrin@ros on 2018-05-23: Yes, I did. I managed it with Xserver, seems to be stable.It seems more complicated to me to change to ubuntu... Comment by Isam Abdullah on 2018-05-23: Great!... btw are you university/college graduate? Comment by kathrin@ros on 2018-05-23: Did you installed ubuntu additionally to windows?Does it work well parallel? Comment by Isam Abdullah on 2018-05-23: Yes... It works well to have dual boot. Windows and ubuntu side by side. Comment by kathrin@ros on 2018-05-23: I am an electroengineering student, trying to advance in my bachelor thesis(just began).And you? Comment by Isam Abdullah on 2018-05-23: Well, I have graduated from my BS computer science previous year. I have been working in a startup related to computer vision and deep learning since the past year. Comment by kathrin@ros on 2018-05-23:
{ "domain": "robotics.stackexchange", "id": 27993, "lm_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, rosnode, turtlesim, rosrun, turtlesim-node", "url": null }
quantum-field-theory, quantum-chromodynamics, wilson-loop \end{align} Notice we can rewrite the $A_\mu(s) \frac{ \dd s^\mu}{\dd t}$ as $\frac{ \dd}{\dd t} \left( A_\mu(s) \delta s^\mu\right) - \frac{ \D A_\mu}{\D s^\nu} \frac{ \dd s^\nu}{\dd t} \delta s^\mu.$ [We used the chain rule to write $\frac{ \dd A_\mu}{\dd t} = \frac{ \D A_\mu}{\D s^\nu} \frac{ \dd s^\nu}{\dd t}$.] This is just integration by parts but keeping the boundary term. \begin{align} \delta V = \hat{P} \exp\left(ig \int_0^1 \dd t\left( A_\mu(s) \frac{ \dd s^\mu}{\dd t} + \frac{ \dd}{\dd t} (A_\mu(s) \delta s^\mu) + \left(\frac{ \D A_\mu}{\D s^\nu} - \frac{ \D A_\nu}{\D s^\mu}\right) \delta s^\nu \frac{ \dd s^\mu}{\dd t}\right)\right) - \hat{P} \exp\left(ig\int_0^1\dd t A_\mu(s) \frac{ \dd s^\mu}{\dd t}\right). \end{align} Now, notice that the path ordering operator will enfore ordering. Thus all matrices inside the exponent will commute. So we can insert commutators without changing the result, since any commutator is zero. Thus let's add an $ig[A_\mu,A_\nu]$ to complete the field strength tensor $F_{\nu\mu}$. \begin{align}
{ "domain": "physics.stackexchange", "id": 65344, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-field-theory, quantum-chromodynamics, wilson-loop", "url": null }
java, performance Building a suffix array and LCP array for the strand, so for every gene the number of occurrences in the strand can be counted in O(geneLength + log strandLength) (so without even visiting the occurrences!) by binary-searching for the start and end of the contiguous range in the SA that contains all those occurrences. A suffix trie is good as well but more dangerous for the memory footprint. SA and suffix trie can both be constructed in linear time (in the length of the string), but it is non-trivial to implement. The LCP array can be given as a secondary result of SA construction (depending on the algorithm) or otherwise created in linear time as well by using the SA. Building a trie with the healthy genes, then go over the strand while descending down the trie, backing up as needed. This has a bunch of edge-cases that need to be considered. There are slow cases, for example if a gene is very big (half the length of the strand) and matches nearly everywhere (for example if the strand and gene are both only the same character), which I think is still a quadratic case. Some additional trickery may be able to work around that. The solutions that I could find quickly seemed to use the second approach, but I think the first one would be a "safer" choice in terms of avoiding a quadratic worst-case complexity, though the second one seems useful enough in practice (it has been successfully used, after all). Unnecessary Map When the keys of a map are a dense and non-changing range of integers like this, Map<Integer, String> genes = new HashMap<>(); for (int i = 0; i < n; i++) { genes.put(i, genesItems[i]); } Using an ArrayList or plain array is a little more efficient and maybe more convenient (the array genesItems is already available anyway). Though of course this does not significantly contribute to TLEs in competitive programming. The skeleton code under the problem uses arrays. Avoid re-parsing The inner loop contains Integer.parseInt(health.get(i)), but that should usually be done up front when reading in the problem data. The skeleton code under the problem parses up front.
{ "domain": "codereview.stackexchange", "id": 35135, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, performance", "url": null }
javascript, ecmascript-6 todo-service.js Same as above, why write a class? WebSocketWrapper.js Same as above, why write a class? Even more interesting is that you have "tracking variables" (reqId and responseDeffers) outside the class. Not sure how you'd benefit with let in you code. You're declaring them at the very top of a function scope. var would have sufficed. Just because JS has ES6 doesn't mean you have to use classes, let and all the new stuff.
{ "domain": "codereview.stackexchange", "id": 15628, "lm_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, ecmascript-6", "url": null }
c++, performance, c++20, priority-queue Title: Priority Queue (With raise priority operation) using Vector Here I have implemented a priority queue, with the addition of the raise_priority (also known as reduce key) operation. The reason I have effectively reimplemented std::priority_queue is because the STL implementation does not have a raise_priority operation, nor can it be implemented (No access to the underlying container). That being said, the part I am mostly concerned about in terms of performance is the raise_priority operation. template<typename K, typename T, typename C = std::less<K>> requires std::predicate<C, K, K> class PriorityVectorQueue { std::vector<std::pair<K, T>> heap; private: inline void bubble(size_t index) { while (index > 0 && C()(heap[(index - 1) / 2].first, heap[index].first)) { std::swap(heap[index], heap[(index - 1) / 2]); index = (index - 1) / 2; } } inline void sink(size_t index) { size_t size = heap.size(); while (2 * index + 1 < size) { size_t child = 2 * index + 1; if (child + 1 < size && C()(heap[child].first, heap[child + 1].first)) { ++child; } if (C()(heap[index].first, heap[child].first)) { std::swap(heap[index], heap[child]); index = child; } else { break; } } } public: inline PriorityVectorQueue() : heap() {
{ "domain": "codereview.stackexchange", "id": 44754, "lm_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, c++20, priority-queue", "url": null }
filters, finite-impulse-response, infinite-impulse-response, frequency-response, poles-zeros Title: Notch filter: differences between IIR and FIR filters I'm trying to understand this great answer from Matt L. . It's said that "One advantage of IIR filters is that steep filters with high stopband attenuation can be realized with much fewer coefficients (and delays) than in the FIR case, i.e. they are computationally more efficient." First of all why this is true? Is this because of poles? Actually this comes from my previous question on removing 400Hz noise. There are two filters for that purpose. The first one is a FIR filter with following frequency response and pole-zero plot: And the second one is a IIR filter:
{ "domain": "dsp.stackexchange", "id": 9202, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "filters, finite-impulse-response, infinite-impulse-response, frequency-response, poles-zeros", "url": null }
c++, time-limit-exceeded Help me review this code and point out the expensive lines/ideas in it. I think using map<int, vector<int> > could be expensive but I can't find any easier alternative of it. #include<iostream> #include<iomanip> #include<algorithm> #include<cmath> #include<map> #include<string> #include<cstring> #include<vector> using namespace std; #define MAX 1000000007 long long int NChooseK_Sum(int N, int K){ vector<long long int> prevV, V; prevV.push_back(1); prevV.push_back(1); for(int i=2;i<=N;++i){ V.push_back(1); for(int j=0;j<(i-1);++j){ long long int val = prevV[j] + prevV[j+1]; if(val > MAX) val %= MAX; V.push_back(val); } V.push_back(1); prevV = V; V.clear(); } long long int res=0; for(int i=0;i<=K;++i){ res+=prevV[i]; if(res >= MAX) res %= MAX; } return res; } class Divisors{ map<int, vector<int> >M; public: vector<int> GetDivisors(int N){ map<int, vector<int> >::iterator mit = M.find(N); if(mit != M.end()) return mit->second; else{ vector<int> V; int L = sqrt(N)+1; for(int i=1;i<L;++i) if( !(N%i) ){ V.push_back(i); if(i != N/i) V.push_back(N/i); } sort(V.begin(), V.end()); M.insert(pair<int, vector<int> > (N, V) ); return V; } }
{ "domain": "codereview.stackexchange", "id": 1367, "lm_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++, time-limit-exceeded", "url": null }
c, homework else return -1; } } void readSourceCode() { FILE *f = fopen("SAMPLE.nsf","r"); char c; while((c = getc(f)) != EOF) enqueue(c); fclose(f); } void main() { clrscr(); readSourceCode(); while(isEmpty() != 1) { int i = automaton(); switch(i) { case 0: printf("CASE\n"); break; case 1: printf("DO\n"); break; case 2: printf("ELSE\n"); break; case 3: printf("ELSE IF\n"); break; case 28: printf("IDENT\n"); break; default : printf("Invalid! %d", i); } //printf("%d\n", strlen(name)); /*if(i == 28 && name[0] != '\0') { for(int i = 0; i < strlen(name); i++) printf("%c", name[i]); }*/ } getch(); } Things you could improve: Compilation: I am led to believe that you are compiling your code as C++ code. tmp = (struct node *)malloc(sizeof(struct node)); That line right there would be unacceptable when compiling as C code. And considering that your question originally had c++ on it, I am further convinced that you are compiling your C code as C++ code. Don't do that. Here is a very long list of the incompatibilities between ISO C and ISO C++. Those are the reasons you compile C code, as C code. If I happen to be wrong in my assumption that you are compiling C code as C++ code, you still should not be casting the results of malloc(). Variables/Initialization: You shouldn't use global variables. *front = NULL, *rear = NULL;
{ "domain": "codereview.stackexchange", "id": 6358, "lm_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, homework", "url": null }
noise, terminology Title: What is perfect and imperfect channel? Often in estimation of the input signal to an unknown channel, the bit error rate is plotted as the performance measure. The curve is compared with an ideal curve labelled as 'Perfect channel'. For example in this paper, http://www.iaeng.org/publication/WCECS2015/WCECS2015_pp668-673.pdf although the bit error rate curve is not present, in the introduction the Authors do mention the term perfect channel. One such method of estimation is the Least Squares. What is the meaning of a perfect channel? Does a perfect channel mean that there is no noise or does it mean that the pilot symbols are used to estimate the channel? It's not the channel that is perfect; it is the estimation. So, "perfect channel estimation" means that the receiver knows the fading coefficients perfectly. This is of course only true in a simulation; any actual system performs imperfect estimation and the estimated channel coefficients are only approximately equal to the actual coefficients.
{ "domain": "dsp.stackexchange", "id": 5824, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "noise, terminology", "url": null }
python, python-3.x, regex, reflection, namespaces def rm_unwanted(code): return code.translate(UNWANTED).strip() def assemble_cm(*args): return ''.join(map(rm_unwanted, rev_readlines('with', *args) + readlines(':', *args))) def walk_f_back(f_back, packed): unpacked = [unpacked_name for unpacked_name, v in f_back.f_locals.items() if v in f_back.f_locals[packed]] if bool(unpacked) is True: return unpacked else: return walk_f_back(f_back.f_back, packed) walk_f_back deals with this scenario: hello, world = 0, 1 packed = hello, world It will return the name of the first variable(s) whose value matches one in f_back.f_locals[packed]. I deem this acceptable. My goal was to create a sort of tunnel up the frames, bound to a variable name. It can be intercepted. test.py from unittest import TestCase, main from . import FrameHack from .context_manager import TraceError from . import setvarname
{ "domain": "codereview.stackexchange", "id": 28772, "lm_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, regex, reflection, namespaces", "url": null }
[6 marks] c. (i)     separate consideration of even and odd n     M1 $${\text{eve}}{{\text{n}}^2} – {\text{even}} + {\text{odd is odd}}$$     A1 $${\text{od}}{{\text{d}}^2} – {\text{odd}} + {\text{odd is odd}}$$     A1 all elements of P are odd     AG Note:     Allow other methods eg, $${n^2} – n = n(n – 1)$$ which must be even. (ii)     the list is [41, 41, 43, 47, 53, 61]     A1 (iii)     $${41^2} – 41 + 41 = {41^2}$$ divisible by 41     A1 but is not a prime     R1 the statement is disproved (by counterexample)  AG [6 marks] d. [N/A] a. [N/A] b. [N/A] c. [N/A] d. ## Question Given a sequence of non negative integers $$\{ {a_r}\}$$ show that (i)     $$\sum\limits_{r = 0}^n {{a_r}{{(x + 1)}^r}(\bmod x) = \sum\limits_{r = 0}^n {{a_r}(\bmod x)} }$$ where $$x \in \{ 2,{\text{ }}3,{\text{ }}4 \ldots \}$$. (ii)     $$\sum\limits_{r = 0}^n {(3{a_{2r + 1}} + {a_{2r}}){9^r} = \sum\limits_{r = 0}^{2n + 1} {{a_r}{3^r}} }$$. [5] a. Hence determine whether the base $$3$$ number $$22010112200201$$ is divisible by $$8$$. [5] b. ## Markscheme
{ "domain": "iitianacademy.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9888419674366167, "lm_q1q2_score": 0.8037973178354316, "lm_q2_score": 0.8128673178375734, "openwebmath_perplexity": 2846.0933988708794, "openwebmath_score": 0.8445948958396912, "tags": null, "url": "https://www.iitianacademy.com/ib-dp-maths-topic-10-5-representation-of-integers-in-different-bases-hl-paper-3/" }
performance, strings, homework, matlab diary off; clear diaryFile fileName; Running my code with tic; Word_Count_Speeches; toc;, my code ran in 3.047776 seconds. Are there ways that I can clean up my function more? Are there ways I can get rid of those for loops I have and use vectorization instead? Can I speed up my code to make it more efficient? Rather than going through all of labels looking for the biggest in this line: count = histc(labels, 1:max(labels)) you can pick this number off directly with numel(labels): count = histc(labels, 1:numel(labels)) Alternatively, you can use accumarray: count = accumarray(labels,1); On this line in the loop if(~isempty(words{i}) && ~any(strcmp(stopData, words{i}))) scanning through the stopData list on every iteration is expensive. Instead, you could use intersect to filter out the stopData before this print loop. Rather than exist to see if a variable has been passed in, if (exist('stopFile', 'var')) I prefer to use nargin. if (nargin < 2)
{ "domain": "codereview.stackexchange", "id": 10578, "lm_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, strings, homework, matlab", "url": null }
organic-chemistry, reference-request, symmetry, pericyclic Within this framework, we can refine our argument for why the reaction is forbidden. In fact, the transition from $\Psi_1$ (reactant ground state) to $\Phi_1$ (product ground state) is adiabatic; however, there is an extremely large electronic activation energy to it, on the order of an electronic excitation energy, which cannot be provided by thermal means. Real pericyclic reactions You might notice that the orbital correlation diagram that we drew above is actually similar to that for the disrotatory ring-opening of cyclobutene. The principles are exactly the same, and the state correlation diagram can be constructed exactly analogously (and in fact, the state correlation diagram for this process is found in Fig. 2 of the question), and of course we find that this reaction is thermally forbidden. But, as I alluded to earlier, there is a slight subtlety. Here is the orbital correlation diagram: Unlike in our first example, there is no obvious one-to-one correspondence between the form of the reactant MOs and the form of the product MOs. For example, it's not obvious why $\pi$ has to transform into $\phi_3$ and not $\phi_1$. It turns out that both $\phi_1$ and $\phi_3$ are actually linear combinations of what $\pi$ and $\sigma$ become in the new geometry.
{ "domain": "chemistry.stackexchange", "id": 8543, "lm_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, reference-request, symmetry, pericyclic", "url": null }
It seems to me like it is fairly simple to construct an object which generates almost any 3 projections you like. To make an example, consider only the closed unit cube in $\mathbb{R}^3$. Although not necessarily connected, the set $$\{(x,y,z)\in\mathbb{R}^3:(x,y)\in A_1||(z,y)\in A_2||(x,z)\in A_3\}$$ will generate $A_1$ along the z-axis, $A_2$ along the x-axis, and $A_3$ along the y-axis. For such a construction to be connected in $\mathbb{R}^3$, all three projections must be connected and when placed in the unit cube they all must containat least one of the four corners $(0,0),(0,1),(1,0),(1,1)$. Essentially, take each projection and place them on the face of a rectangular prism as a 0-thickness subset of $\mathbb{R}^3$. MORE METNIONED IN EDIT 3 STARTS HERE We can actually do much better. We can account for the depth problem above by generalizing further. This idea can be materialized. Let the orthogonal axes in question be defined by unit vectors $\vec{a_1}$, $\vec{a_2}$, and $\vec{a_3}$. The following will all work when projections $A_1$ through $A_3$ are connected. We define $A_n'$ as the extension of $A_n$ into $\mathbb{R}^3$ as a prism. More formally, $$A_n'=\{(b_1,b_2,b_3)|\sum_{1\le i\le 3, i\not=n}{b_i\vec{a_i}}\in A_n\}$$ Then the set with largest volume that generates the 3 projections (without considering rotation) is $X=A_1'\cap A_2'\cap A_3'$.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9799765557865638, "lm_q1q2_score": 0.818754277099837, "lm_q2_score": 0.8354835350552604, "openwebmath_perplexity": 336.53826491531186, "openwebmath_score": 0.7989408373832703, "tags": null, "url": "https://math.stackexchange.com/questions/2389560/cover-of-g%C3%B6del-escher-bach/2390355" }
On the other hand, if a specific $$BBR$$ order had been specified and you want to use the choose route, you will need to divide by $$\binom31$$ Beginners often forget this, so be careful, and as a general practice, use the simpler route without multiplier/divider depending on what has been asked. Suppose $$X$$ is the event 2 black balls and 1 red ball in a sample of 3 balls from the specified urn without replacement. You want $$\text{Pr}(X)$$. You might think in 2 ways: (i) sample 3 balls at the same time or (ii) sample each one of the 3 balls in order. From the stand point of the experiment the probability won't change. Let us think using method (ii): $$X=(R,B,B)\cup (B,R,B) \cup (B,B,R)$$. Remember that in the sequence notation $$(R,B,B)$$ order is relevant, this is the sequence in which $$R$$ is the first ball, $$B$$ is the second and $$B$$ the third. As these events are disjoint, $$\Pr(X)=\text{Pr}((R,B,B))+\text{Pr}((B,R,B))+\text{Pr}((B,B,R))\ \ \ (1)$$ When you computed $$\text{Pr}(2\ blacks\cap 1\ red)=\text{Pr}(2\ blacks|1\ red)\text{Pr}(1\ red)=\frac{10}{21\cdot 13}\approx 0.037$$ you've found only $$\text{Pr}((R,B,B))$$ in expression $$(1)$$ instead of $$\text{Pr}(X)=\frac{10}{21\cdot 13}+\frac{10}{21\cdot 13}+\frac{10}{21\cdot 13}\approx 0.110$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9865717474295373, "lm_q1q2_score": 0.8263721889080556, "lm_q2_score": 0.837619961306541, "openwebmath_perplexity": 281.55011030003084, "openwebmath_score": 0.8007021546363831, "tags": null, "url": "https://math.stackexchange.com/questions/4539587/probability-of-pulling-2-black-and-1-red-ball-among-5-black-5-white-and-5-red" }
7. Feb 2, 2015 andyrk They are not the same, i.e. after changing x to x+2 in f(x), f(x) ≠ f(-x). But what I am reading, it says that f(x) is symmetrical about x=2 and I am still wondering that how would I go about proving it? 8. Feb 2, 2015 ShayanJ You're doing something wrong. You should be able to reduce f(x+2) to $\frac 1 2 a[x^2(\frac 1 2 x^2-1)-4]+1$ which is even. 9. Feb 2, 2015 PeroK Another way to look at it is as follows: Imagine starting at x = 2 and moving the same distance, d, to the right and left (d > 0). So, to the right we have 2 + d and to the left we have 2 - d. Now, if f is symmetrical about x = 2, then f(2-d) = f(2+d) for all d. You could try that approach. 10. Feb 2, 2015 andyrk How did you reduce it down to that? Can you show me? I am unable to get to that point. 11. Feb 2, 2015 ShayanJ
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.959154287592778, "lm_q1q2_score": 0.8054344278361305, "lm_q2_score": 0.8397339596505965, "openwebmath_perplexity": 602.5868506932155, "openwebmath_score": 0.6878592371940613, "tags": null, "url": "https://www.physicsforums.com/threads/f-x-symmetric-about-the-line-x-2.795521/" }
keras, tensorflow, cnn Title: Keras + Tensorflow CNN with multiple image inputs I have a CNN that needs to take in 68 images that are all 59x59 pixels. The CNN should output 136 values on the output layer My training data has shape (-1, 68, 59, 59, 1). My current approach is to use concatenate to join multiple networks like so: input_layer = [None] * 68 x = [None] * 68 for i in range(68): input_layer[i] = tf.keras.layers.Input(shape=training_data.shape[1:][1:]) x[i] = Conv2D(64, (5,5))(input_layer[i]) x[i] = LeakyReLU(alpha=0.3)(x[i]) x[i] = MaxPooling2D(pool_size=(2,2))(x[i]) x[i] = Model(inputs=input_layer[i], outputs=x[i]) combined = concatenate(x) However, this always gives the error: ValueError: A `Concatenate` layer should be called on a list of at least 2 inputs Is this approach a suitable approach or am I doing this completely wrong? Yes it is wrong, each (68, 59, 59) input should go through one model not an array of them.
{ "domain": "datascience.stackexchange", "id": 4954, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "keras, tensorflow, cnn", "url": null }
java, swing /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { scrollPane = new javax.swing.JScrollPane(); textArea = new javax.swing.JTextArea(); textField = new javax.swing.JTextField(); setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); textArea.setEditable(false); textArea.setColumns(20); textArea.setRows(5); scrollPane.setViewportView(textArea); add(scrollPane, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 400, 250)); add(textField, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 270, 400, 30)); }// </editor-fold> // Variables declaration - do not modify private javax.swing.JScrollPane scrollPane; protected javax.swing.JTextArea textArea; protected javax.swing.JTextField textField; // End of variables declaration } Maybe something like this? Note: may add textField as a member of State0 and State1 public interface State { boolean hasNext(); State next(); } public final class State0 implements State { private boolean okToContinue = false; private int number; @Override public boolean hasNext() { try { textArea.append("Enter a number"); number = Integer.parseInt(textField.getText()); okToContinue = true; } catch (NumberFormatException ignored) { textArea.append("Input is not a number"); } return true; }
{ "domain": "codereview.stackexchange", "id": 3828, "lm_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, swing", "url": null }