qid int64 1 4.65M | metadata listlengths 3 3 | prompt stringlengths 31 25.8k | chosen stringlengths 17 28.2k | rejected stringlengths 19 40.5k | domain stringclasses 28
values |
|---|---|---|---|---|---|
2,684,042 | [
"https://math.stackexchange.com/questions/2684042",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/539104/"
] | I have given two lines in $ℝ3$:
$p1(t)=v1 * t + P1$
$p2(t)=v2 * t + P2$
where $v1, v2$ are the velocities/slopes and $P1, P2$ are the offsets from the origin.
I'm trying to write an algorithm that calculates the time $t$ at which the distance between the two points $p1(t)$ and $p2(t)$ is at a specific value.
Given ... | <blockquote>
Before editing for $n^n \ge (n!)^2$
</blockquote>
Note that it is false indeed
$$n^n=\overbrace{n\cdot n \cdot n\cdot...\cdot n} ^{n \, terms} $$
$$(n!)^2=(\overbrace{n\cdot (n-1) \cdot (n-2)\cdot...\cdot 1}^{n \, terms})^2\ge(n\cdot (n-1) \cdot (n-2)\cdot...\cdot 1)\cdot n\ge n^n$$
<blockquote>
A... | What you are trying to prove is not true. For large enough $n$ (which means $\ge 3$) it will go the other way. If we just use Stirling's approximation
$$(n!)^2 \approx \left(\frac {n^n}{e^n}\sqrt{2\pi n}\right)^2=\frac {n^{2n}}{e^{2n}}2\pi n$$ which will clearly be greater than $n^n$ when $n \gt e^2$. We can use one... | https://math.stackexchange.com |
29,682 | [
"https://cs.stackexchange.com/questions/29682",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/20500/"
] | Is there any way to combine multiple Hidden Markov Models trained from different sets of data? For example, I want to detect the phases of a sequential activity. I collect two sets of data by using two types of sensors: accelerometer, and video stream. I create two HMM models from the accelerometer and video stream, re... | Yes. Construct the product automaton.
The "product construction" is a standard construction from automata theory class (e.g., typically taught in the context of finite-state automata). It can be applied to HMM's as well, and it will do exactly what you want.
For your example, the resulting HMM will have 9 states. ... | I would just use product states/transitions and probabilities.
Say accelerometer has states A, B...
Say video steam has states 1, 2...
Then we denote probability of transition from state 'foo' to state 'bar' while emitting character baz as P(foo,bar,baz).
Introduce a new HMM with states A1, A2, B1 etc. and then com... | https://cs.stackexchange.com |
41,736 | [
"https://mathoverflow.net/questions/41736",
"https://mathoverflow.net",
"https://mathoverflow.net/users/9934/"
] | Is there a way to calculate the number of non-repeating digits that precede the periodic repeating portion of a decimal expansion? For example:
1/6 = 0.1666.... (there is 1 non repeating digit) **(Correction)
1/12 = 0.08333... (there are 2 non repeating digits)
7/12 = 0.58333....(there are 2 non repeating digits)
1/... | When one writes an irreducible fraction $m/n$ as a periodic digit number all one does is to write
$m/n=\frac{a}{999...9000.00}$
So the number of digits before the period is the maximum of the power of $2$ and $5$ in $n$,
i.e. wirting $n=2^\alpha 5^\beta k$ with $k$ relatively prime to $10$, the number of digits befo... | Suppose we deal with base $B\in\mathbb{Z}$. The trick is to consider the distinct primes that divide $B$. If $a/b$ is in lowest terms, then the prime factorization of $b$ can be sorted into primes that divide $B$ and primes that don't. If $b=uv$, where every prime dividing $u$ divides $B$ and no prime dividing $v$ d... | https://mathoverflow.net |
42,816 | [
"https://quant.stackexchange.com/questions/42816",
"https://quant.stackexchange.com",
"https://quant.stackexchange.com/users/36723/"
] | I know the YTM of a coupon bond is the interest rate <span class="math-container">$i$</span> which verifies
<span class="math-container">$ P =\frac{C}{(1+i)} + \frac{C}{(1+i)^2} + ...+ \frac{C}{(1+i)^n} + \frac{F}{(1+i)^n} $</span>
where <span class="math-container">$P$</span> is price, <span class="math-container">... | Let <span class="math-container">$P$</span> denote the dirty price, <span class="math-container">$F$</span> the face value and <span class="math-container">$i$</span> the YTM. Using the geometric sum we get
<span class="math-container">\begin{align}
P &= \sum_{j=1}^n \frac{C}{{(1+i)}^j} + \frac{F}{(1+i)^n}\\
&am... | The price of a bond is determined by the sum of the discounted cashflows plus the discounted face value of the bond. Intuitively and academically, a bond cannot be worth more than the sum of the future cashflows plus future value. In the case of yield equaling coupon rate, the price is equal to par because the rate at ... | https://quant.stackexchange.com |
66,309 | [
"https://cs.stackexchange.com/questions/66309",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/45142/"
] | Hi fellow computer scientists,
I just began my journey to the world of ML and NLP so please bear with me. I'm hoping to find some guidance here. I would be very grateful if anyone could point me in the right direction (reading materials, lectures, specific algorithms, tools, etc.) for solving the following list of pro... | There are many ways to model polymorphism via domain theory, let me just describe one that is easy to understand, so you can think about it yourself. It's a "PER model".
Take any model of the untyped $\lambda$-calculus, for instance a domain $D$ such that $D \to D$ is a retract of $D$ (for instance, take $D$ such that... | Roy Crole gives a nice explanation of how to use domain theory to model type polymorphism in his book <em>Categories for Types</em>, specifically in section 5.6.
| https://cs.stackexchange.com |
30,765 | [
"https://stats.stackexchange.com/questions/30765",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/776/"
] | In their 1999 book, Yates, Moore & McCabe specify that no more than 20% of expected counts should be less than 5 and all individual expected counts should be greater than 1.
Does this mean that, for any 2 by X contingency table that no more than 20% of the cells should be less than 5?
So, for a 2 by 5 table no ... | I am familiar with an earlier version of the book but I have not seen the specific discussion that you refer to. So I am not exactly sure what they are getting at but I think I have a pretty good idea. The chi square test for contingency tables is only asymptotically valid. So it requires a large sample size for the... | Just for the record, there is an option to the <code>chisq.test</code> function in R that allows to simulate the p-value by randomly generate a given number of independent tables instead of deriving it from the chi-squared distribution :
<pre><code>chisq.test(x, y, simulate.p.value=TRUE, B=2000)
</code></pre>
From th... | https://stats.stackexchange.com |
92,046 | [
"https://mathoverflow.net/questions/92046",
"https://mathoverflow.net",
"https://mathoverflow.net/users/22360/"
] | I'm looking at motivating the standard deformation of $U(\mathfrak{sl}(2))$. As an algebra $U(\mathfrak{sl}(2))$ is generated by $X,Y$ and $H$ and subject to the relations $[X,Y] = H$, $[H,X] = 2X$ and $[H,Y] = -2Y$. From $q$-analysis I have that an integer $n$ is deformed according to $[n] = \frac{q^{n}-q^{-n}}{q-q^... | Hi Ryan,
You can prove that if $a,b$ are some elements in an algebra such that $[a,b]=\lambda b$ for $\lambda$ a scalar, then (in a context where this expression makes sense) $q^a b q^{-a}=q^{\lambda} b$: rewrite the relation as
$$ab=b(a+\lambda)$$
then
$$a^nb=b(a+\lambda)^n$$
therefore
$$q^ab=\sum \frac{\log(q)^na^n}... | Allow me the excuse to mention a cute way of constructing U<sub>q</sub>(sl<sub>2</sub>) as a q-analogue. Presumably this is ahistorical, since I suspect that initially U<sub>q</sub>(sl<sub>2</sub>) was constructed first over the formal disc, then later it was realised that it was definable over $\mathbb{Q}(q)$.
Anyhow... | https://mathoverflow.net |
119,404 | [
"https://security.stackexchange.com/questions/119404",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/106410/"
] | There is a site called <code>www.mysite.com</code>. It uses Qgiv for taking donations and has some HTML5 data-attributes like:
<pre><code> <div class="qgiv-embed-container visible-lg-block" > data-qgiv-embed="true" data-embed-id="1" data-embed="https://secure.qgiv.com/" ></div>
</code></pre>
where the ... | If there is no HTTPS on the pages that redirects to Qgiv, a Man-In-The-Middle could intercept the redirection page and replace the redirect to Qgiv with a redirection to the attacker's site.
The attacker's site might use HTTPS and will capture the card details as the user will be unaware whether the site is the legiti... | First of all SSL and TLS are cryptographic protocols designed to provide communications security over a computer network.
<strong>For your case:</strong>
If the website has no SSL/TLS (I strongly recommend TLS) then all the data sent to that specific website are in plain text.
If the website has no SSL/TLS but the p... | https://security.stackexchange.com |
3,668,265 | [
"https://math.stackexchange.com/questions/3668265",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/743536/"
] | Knowing that in the first 3 draws without replacement from a deck of 52 french cards (26 red|26 black) at least one red card has been drawn, what is the probability that the 2nd draw has been a red card?
How would you solve this problem?
| ==== old answer ===
Assume the answer is <span class="math-container">$M$</span>.
Then there are <span class="math-container">$k$</span> numbers less than or equal to <span class="math-container">$M$</span> that are not divisible by <span class="math-container">$n$</span>.
So <span class="math-container">$k = f(M)$<... | We need the <span class="math-container">$k^{th}$</span> integer not divisible by <span class="math-container">$n$</span>.
At first, we list all the integers not divisible by <span class="math-container">$n$</span>. We don't know the values of these integers yet.
<span class="math-container">$$1^{st}, 2^{nd}, 3^{rd}, ... | https://math.stackexchange.com |
291,447 | [
"https://mathoverflow.net/questions/291447",
"https://mathoverflow.net",
"https://mathoverflow.net/users/31327/"
] | Let $G$ be a (connected) reductive group over some ground field $F$ and $G^*$ its unique quasi-split inner form. Denote by $\operatorname{rank}_F G$ the split rank of $G$, i.e. the dimension of a maximal $F$-split torus in $G$, and likewise for $G^*$. Is it true that
$$\operatorname{rank}_F G\le \operatorname{rank}_F... | Every torus in $G$ transfers to $G^*$, so we definitely have the desired inequality. If we have equality, then there is a maximal split torus $A$ in $G$ that is also maximal split when transferred to the torus $A^*$ in $G^*$; so $C_{G^*}(A^*)$ is a torus; so $C_G(A)$, which is isomorphic over the separable closure to ... | Whilst trying to understand the answer of Loren, I finally came up with an elementary explanation (no need for Steinberg’s result). Since it also gives another picture of the situation, I think it’s worth writing.
Let $G$ and $G^*$ be algebraic groups over $F$ as in the question. Let $K$ be a finite Galois extension o... | https://mathoverflow.net |
107,716 | [
"https://stats.stackexchange.com/questions/107716",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/9330/"
] | I'm looking at p. 355 of Gelman's <em>Bayesian Data Analysis</em> (3rd ed.), for which there is no errata, and I see this:
<blockquote>
In the normal regression model, a convenient non-informative prior
distribution is uniform on $(\beta,\, \log\sigma)$ or, equivalently,
$$p(\beta,\, \sigma^2|X) \propto \sigma^{... | It could say uniform on $(\beta, \log \sigma^2)$, but what is written is also correct. These are equivalent, because
\begin{equation}
\log \sigma^2 = 2\log\sigma
\end{equation}
and reparametrization by multiplying by a constant keeps a uniform pdf uniform (in your notation, $h'(w)$ is constant).
| The original is correct.
If you try to take the (improper) uniform prior on the <em>half</em> line (say by considering it as a limit of a sequence of proper priors), then at any point you choose, consider the ratio of the probability to its right over the probability to its left.
No matter how high you choose that po... | https://stats.stackexchange.com |
4,493 | [
"https://mechanics.stackexchange.com/questions/4493",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/2297/"
] | I have a leaking pipe in the cooling system of my Mk Golf. It leaks about a litre in 5 miles. I'm not sure if it's worth trying Radweld with this rate of flow or if I should just try to find a replacement pipe.
The leaking pipe is the one which is oily at the right hand side of the shot, and wet in the centre. The lea... | All sorted. As Timo said, there was loads of corrosion and Radweld wouldn't have stood a chance! The VAG part number is <code>037121065H</code>. I initially got <code>037121065L</code> but it didn't have a port for the heated inlet manifold!
| You can see the corrosion on the pipe around the clip - even if Radweld or similar is able to temporarily stop the leak, I doubt that it'll last very long. At the rate that it's leaking, there is bound to be a bunch of fairly sizeable holes corroded into the pipe. For that reason alone I would change out the pipe as so... | https://mechanics.stackexchange.com |
54,941 | [
"https://cs.stackexchange.com/questions/54941",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/48423/"
] | I'm a computer science student taking a theory of computation class. Recently we were taught about what is computable and what is not and about the Turing machine. As I understood (please correct me if I'm wrong) Turing machine could do any computation that is possible to compute. But for all examples in computing, wh... | First, you're not entirely correct when you say that a "Turing machine could do any computation that is possible to compute". What you're referring to is known as the <em>Church-Turing thesis</em> and it's not a statement of fact, but more like a statement of confidence. A better way of stating it would be "Any task th... | Turing machines are commonly used to model computation of <em>functions</em> like addition and subtraction. The machine finds its input on the tape when it starts running, and it leaves its output on the tape when it terminates. In this way you can model functions directly.
You can also model functions through decisio... | https://cs.stackexchange.com |
6,543 | [
"https://softwareengineering.stackexchange.com/questions/6543",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/3388/"
] | I'm starting to use the ORM recommended by the framework I choose, and though I like the idea of the added layer of abstraction the ORM provides, I'm starting to realize what this really means. It means I'm no longer working with my database (mysql) and any mysql-specific features are gone, out the window, like they do... | I see it the same way. Any abstraction that doesn't allow you to get underneath it when necessary is evil, because it leads to all sorts of ugly abstraction inversions in your code.
At work we've got a homegrown ORM that works fairly well, but for the times when we need something that its features don't explicitly pr... | <blockquote>
the ORM takes the lowest common
denominator
</blockquote>
I must disagree with your statement. I will take <strong>nHibernate</strong> as an example. This framework supports lots of database, including the most popular ones, regardless the version (and supported features), just like most ORMs.
<em>Qu... | https://softwareengineering.stackexchange.com |
33,968 | [
"https://softwareengineering.stackexchange.com/questions/33968",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/1785/"
] | I have been given the role to improve development in our company. The first thing I wanted to start was code reviews since that has never been done here before.
There are 3 programmers in our company. I am a web programmer, my known languages are mainly PHP, ActionScript and JavaScript. The other 2 developers write in... | Your personal desires to learn other things should take a back seat to learning what you actually need right now for your job. Learn VB.net. You can effectively code review code you don't understand when you know the language it's in by asking lots of questions (usually that's a sign the code isn't well written if you ... | Actually, I disagree with all the above. With JS/PHP/ActiopnScript, you have a fundamental understanding of what a programming language has and how it works. In fact, I would argue that there are a lot of similarities between VB and JS. However, that's not my point. Even if you are very competent with the language, it'... | https://softwareengineering.stackexchange.com |
159,210 | [
"https://dba.stackexchange.com/questions/159210",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/113709/"
] | When I try to restore a DB file I am getting following error:
<pre><code> The log or differential backup cannot be restored because no files are ready to rollforward.
</code></pre>
My Back up SQL
<pre><code>BACKUP LOG [ICT_IdealComputer]
TO DISK = 'C:\ICT\ICTBackup.bak'
WITH NAME = 'ICT-Transaction Log Backup',
SKIP... | By default only root has full access to everything on the database. However, it is very easy to set it so that every user has access to the data in the database.
The following is for a new user specifically: This is usually the more accepted way of granting privileges.<br>
1. On the root account I create a new databa... | Mysql by default creates a single or multiple <code>root</code> user accounts (this depends on the mysql version) that are indeed superusers and have full access to all databases that you create on that mysql server. However, these accounts are initialised as superusers and you can remove their access rights based on y... | https://dba.stackexchange.com |
372,697 | [
"https://electronics.stackexchange.com/questions/372697",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/187740/"
] | Hello I am making a VHDL project in which I am doing some image processing. Color data of pixels are held in Rom and operations are done on Ram. However, when I try to reset the ram from the rom. It is not reset as intented. What I mean is that in place of what should have been the default picture on the moniter, there... | One thing is that
<code>if address_rom = conv_std_logic_vector((PICTURE_WIDTH_HEIGHT*PICTURE_WIDTH_HEIGHT),16) then</code> is never true at this point due to the nested if statements.
You might wanna change your second if-statement into an else condition of the first one.
<pre><code> if address_rom <
... | For a thorough analysis we would need all the code inclusive test-bench, ROM and RAM models and also the code that reads from the memory and makes the video signal.
The latter is important as you state that the memory initialisation is failing, but it could just as well be that your reading or display image code is fa... | https://electronics.stackexchange.com |
62,491 | [
"https://mechanics.stackexchange.com/questions/62491",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/44661/"
] | I have a 2017 Audi A3 Sedan. The all-seasons on my car are 225/40R18. I’m looking at 16” inch tires and wheels due to huge cost difference. Can I get a set of 205/55R16 tires and wheels package? Will there by any issues?
| It would be helpful to know what engine you are rebuilding but if the repair guide suggests machining the cylinder head only then I suspect that your engine has an alloy cylinder head and a cast iron engine block.
The reason to have the mating surfaces machine is to ensure they are perfectly flat and that you get a go... | Facing is more common with higher time engines, or ones which are suspected of having a warped head after overheats.
In your instance, the most likely reason for the recommendation from the shop was to reduce the probability of a disassembly caused by a head which did not seal and resulted in an unsatisfactory mating ... | https://mechanics.stackexchange.com |
15,127 | [
"https://mechanics.stackexchange.com/questions/15127",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/9182/"
] | I recently took off the tail light on our 2000 Toyota Sienna and the clips on the light assembly side broke off as I was pulling it off. Any idea where I can get replacement clips? Or would I have to replace the whole assembly?
| Considering your comments, my suggestion to you is to replace the assembly. If you still have the pins, you could possible repair the assemply by using some (possibly) super glue or maybe even some epoxy. This approach, while cheaper, will never be as strong as new, as well as it may not align correctly once completed.... | I have found replacement parts for this which might be useful. The number is:
<blockquote>
9046717016
</blockquote>
The cost about 1.50 each.
Just walk into any Toyota garage and ask if you can order that part in, and it should be ready in a few days for you. Most garages can order parts in for you, if you get a ... | https://mechanics.stackexchange.com |
147,489 | [
"https://softwareengineering.stackexchange.com/questions/147489",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/47546/"
] | I'm 16. I started programming about a year ago when I was about to start high-school. I'm going for a career in programming, and I'm doing my best to learn as much as I can. When I first started, I learned the basics of C++ from a book and I started to learn things by myself from there on. Nowadays I'm much more experi... | It's critical. I don't think I've ever known a good programmer who wasn't self-taught at some level. As a hiring manager at a large company, I can say that a candidate who describes <b>personal projects</b> and a <b>desire to learn</b> will trump one with an impressive degree every time. (Though it's best to have bo... | Self-teaching is very important. You cannot rely on a formal education to teach you everything you need to know about your field. However, that being said, a formal education is also very important if you want to enter that career field well-prepared and well-equipped.
I am on my way to college and have spent the past... | https://softwareengineering.stackexchange.com |
615,726 | [
"https://physics.stackexchange.com/questions/615726",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/273727/"
] | Before you tell me there are a bunch of other similar questions asked as well, hear me out ;(
I'm really confused when it comes to work being done. When you're considering a charge moving from a one point to another against an electric field, you consider TWO types of work being done. One is the work being done by the ... | I think I understand your confusion. You can define the potential difference between 2 points in 2 ways.
<ol>
<li><strong>The electric p.d between 2 points in an electric field is the negative of the work done by the electric force in bring a unit positive charge from the initial to the final point</strong>. This follo... | If you don't have any external force, use the work done by electric field (to be precise is the work done by the electric force <span class="math-container">$F = qE$</span>), if instead you have a external force, conservation of energy cannot by applied (an external work is been done), here is an example.
You want to d... | https://physics.stackexchange.com |
5,003 | [
"https://scicomp.stackexchange.com/questions/5003",
"https://scicomp.stackexchange.com",
"https://scicomp.stackexchange.com/users/1880/"
] | I sincerely apologise if this question is a duplicate. Though it is clearly a question that must have been asked and answered a 1000 times I can't find any reasonable solution.
How do I take a simple 2D CAD Drawing (.dwg file) of a 2D boundary and generate a 2D computational mesh suitable for FEM analysis in any of th... | If you introduce a variable $\mathbf z=(\mathbf x^T, \mathbf y^T)^T \in \mathbb{R}^{2n}$, then you can write $f(\mathbf x, \mathbf y)=f(\mathbf z)$ and it fits the exact format you wrote in your outline of the first method and it will all work as described. You just have to match things like $\nabla_z f(\mathbf z) = (\... | for your two variable case, $\beta_i$ should be same for both $\beta_i^x$ and $\beta_i^y$, it is computed as $\beta_i=\frac{\mathbf{g}_{i+1}^T\mathbf{g}_{i+1}}{\mathbf{g}_{i}^T\mathbf{g}_{i}}$ (where $\mathbf{g}_{i} = [\mathbf{g}_{i}^x; \mathbf{g}_{i}^y]$). The $\mathbf{g}$ is a 2x1 vector, thus $\mathbf{g}^T\mathbf{g}... | https://scicomp.stackexchange.com |
388,211 | [
"https://physics.stackexchange.com/questions/388211",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/185861/"
] | They say light travels faster than sound.
Lightning is just electrons, right?
Then why are both electrons and photons traveling at the same speed when thunder storms occur?
| Think about a piece of copper wire. It is packed with free electrons that just can't escape because if they did the protons in the copper atoms would pull them back.
It's just like a pipe full of water, sealed at both ends.
Now if you push some water into one end of the pipe (which you can only do if some water can al... | Light is what you see after the initial strike, contact has already been established by time you do see it. If that doesn't make sense think about a light bulb, the electricity gets to the light bulb and then it turn's on. Ask if you don't understand what i mean.
| https://physics.stackexchange.com |
88,967 | [
"https://mechanics.stackexchange.com/questions/88967",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/72376/"
] | When carburetors are not synchronized, the engine does not sound smooth.
At first I thought this is because the frequency of each piston is different, but I guess that is not possible, since they are all connected to the same crankshaft.
So, what causes the noise when carburetors are out of sync?
| Your first thought is possibly closer than you think. <em>Basically</em>, when carbs get out of sync, you're causing an imbalance between cylinders. One or some of the cylinders are going to fire differently from the others, thus causing a slightly different running noise then you are used to when all is in sync. The e... | Imagine a 2-cylinder engine where idle requires ~5% of the throttle.
Next, imagine that the 2 carburetors are off by ~6%.
At full throttle, you will get like 94% and 100% - barely a difference.
At half throttle, they will be like 46% and 52% - still almost equal.
Now, try to adjust the idle. One of the carburetors is 2... | https://mechanics.stackexchange.com |
304,278 | [
"https://physics.stackexchange.com/questions/304278",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/129433/"
] | I have done many double and single slit experiments where I created clear interference patterns. But one of the amazing things about the double slit is that under certain conditions the wave properties of light go away and the particle properties of light are created. How can I create an experiment where the interferen... | Actually the particle properties of light are there all along, and the pattern would be the same.
To see light as particles in the double-slit experiment, you have to shoot photons individually and see them form the interference pattern dot by dot.
What would make a different pattern though is a detector able to rec... | You can detect the individual photons building up the interference pattern by using a digital camera to record the interference pattern. You then need to place the camera behind the slits and you need to make sure the photo-sites of the sensor are going to be hit no more than a few hundred times. This is because you ne... | https://physics.stackexchange.com |
608,692 | [
"https://electronics.stackexchange.com/questions/608692",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/7089/"
] | In my application, a Cortex M0 microcontroller currently samples an ADC signal at 10 kHz and sends the result via a USB serial cable to a computer.
I want to now increase the sampling rate to over 100 kHz and add a second channel.
The USB-serial link is limited to 1-3 Mbps, so it is physically impossible to stream at t... | Is this actually an audio application? Could you replace the whole thing with a dedicated audio interface which will solve all these problems for you, or do you need the precise DC level? 96ksps stereo is quite attainable.
You do not have a lot of MIPS to work with, so I'm going to propose the following coding scheme. ... | There are a few "simple" steps you can take to reduce the needed baud rate :
<ol>
<li>Do you really need 12 bits resolution? If you can sacrifice the 4 least significant bits (which might be only noise), you reduce the required bandwidth by 33%, and save a few operations in the same time.
</li>
<li>by which a... | https://electronics.stackexchange.com |
193,441 | [
"https://electronics.stackexchange.com/questions/193441",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/88081/"
] | I see that a 2 layer PCB is really cheap to prototype. A 4 layer PCB is almost 4x more expensive . I have a design that uses DDR3 RAM where I need to match trace lengths. However I also need to keep the costs down. I observe that going in for a larger 2 layer PCB is more economical compared to a 4 layer PCB. WOuld by d... | Ah the horror of trying to make DDR work in two layers :) The long answer is of course to learn about signal integrity and try to understand exactly what you are doing. I have seen this done before, and even pass EMI but with many caveats. First there was only a single DDR part. Second the controller was carefully d... | There are number of reasons in which you have multilayer boards, and when it comes to high speed design, DDR3 for instance, there is alot more happening than just the connections from pin to pin.
At high speeds, the physics behind electric, and magnetic feilds become a factor as well as power speed requirements. It's ... | https://electronics.stackexchange.com |
109,631 | [
"https://security.stackexchange.com/questions/109631",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/95433/"
] | If an attacker can establish a VPN connection to the company network and have access to internal resources (by getting various certificates and credentials used to authenticate to the VPN server), which is quite dangerous, how can we detect and monitor such events properly?
What should be the criteria for detecting s... | Yes , i got one idea for detection criteria , Your monitoring system ( such as ELK ) can send an alert to the system admin to review the login whose is from such a location that is unexpected ( where you don't expect your employee to be )
| properly monitoring will depend on your network configuration and the environment where you feel comfortable.
following the scenario and as a quick answer you probably want to do a deep study of this concepts and how apply because tool recommendation will be really specific to your network and you didn't give much inf... | https://security.stackexchange.com |
1,437,923 | [
"https://math.stackexchange.com/questions/1437923",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/161104/"
] | <strong>Question:</strong>
<blockquote>
Find the general solution of: $$y + \frac{d[xy]}{dx} = x(\sin x+\log x)$$
</blockquote>
Not sure how I would begin this problem. Should I simplify $\frac{d[xy]}{dx}$ into terms of $dy$ and $dx$? What should be a general approach for such questions?
| The digit sum $s$ of $n$ and $m$ is the same. Since we have $n \equiv s\pmod 9$ and $m \equiv s\pmod 9$ we get
$$n-m \equiv s-s \equiv 0 \pmod 9,$$
so $9\mid n-m$ .
| I don't want to get drowned in notation. So let's just look at three digit numbers and you can figure out the general case.
The most general three digit number would be
$n = (d_3 d_2 d_1)_{10} = 100d_3 + 10d_2 + d_1$.
Let's let $S(n) = d_1+d_2+d_3$ denote the digit sum of $N$.
Now
\begin{align}
n - S(n)
&= ... | https://math.stackexchange.com |
391,838 | [
"https://stats.stackexchange.com/questions/391838",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/40888/"
] | Assuming I have two non-independent random variables and I want to reduce covariance between them as much as possible without loosing too much "signal", does mean centering help? I read somewhere that mean centering reduces correlation by a significant factor, so I'm thinking it should do the same for covariance.
| If <span class="math-container">$X$</span> and <span class="math-container">$Y$</span> are random variables and <span class="math-container">$a$</span> and <span class="math-container">$b$</span> are constants, then
<span class="math-container">$$
\begin{aligned}
\operatorname{Cov}(X + a, Y + b)
&= E[(X + a - E[X +... | The definition of the covariance of <span class="math-container">$X$</span> and <span class="math-container">$Y$</span> is <span class="math-container">$E[(X-E[X])(Y-E[Y])]$</span>. The expression <span class="math-container">$X-E[X]$</span> in that formula <em>is</em> the centered version of <span class="math-containe... | https://stats.stackexchange.com |
130,864 | [
"https://security.stackexchange.com/questions/130864",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/104831/"
] | Supposing we have a software that checks on a remote server online if the input entered by a user (a license key) is valid.
The server sends in a socket to the client <code>True</code> or <code>False</code> if the license is correct or not.
In the binary, a jump (<code>jz</code>...) is made depending of the result.
... | You can't prevent people toying around with your exe, if you check if it wasn't tempered then they'll patch the code that checks that to. One thing you can do is not distribute the whole program but a version missing core functionality in the exe, then when they enter the cd key patch that in memory with data you downl... | <blockquote>
In the binary, a jump (jz...) is made depending of the result.
</blockquote>
There are more complex and multiple of such checks in place. However, it boils down to exactly what you wrote.
<blockquote>
So how do software developers prevent that situation ?
</blockquote>
Not at all. They cant and any ... | https://security.stackexchange.com |
121,158 | [
"https://electronics.stackexchange.com/questions/121158",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/16643/"
] | I'm new to the hardware world and am coming from a software background, and am trying to build a small device to attach to my PC via USB. I've heard the term "<em>open source hardware</em>" in reference to controllers/MCUs/CPUs, but was wondering if it can also apply to <em>any</em> hardware component, such as:
<ul>
<... | The coherence bandwidth measures how much a channel is statisticallt flat given a fixed size window through which we watch it.
Imagine a transmitter and a receiver, the transmitted signal being \$x(t)\rightleftharpoons X(f)\$. The receiver ideally gets the same \$x(t)\$ at the antenna, but unfortunately there's the mi... | Coherence bandwidth refers to the situation in which all the frequencies in that band are subject to the same amount of attenuation. Given that, then they should be well behaved and predictable with frequency/wavelength.
What you are probably not understanding is what a multi-path signal looks like in the frequency do... | https://electronics.stackexchange.com |
176,697 | [
"https://electronics.stackexchange.com/questions/176697",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/79350/"
] | Is there any ways to quantify the health of an electronic appliance according to its power consumption?
| Well, if the device is supposed to draw only 500mA, but it keeps blowing a 16A fuse in your house, then the device is probably busted.<br>
Outside of that, you'd have to know (or track) typical power consumption for the device. If it draws significantly more (or less) current than usual then there may be something wro... | Not easily no.<br>
You would need to have either a very detailed knowledge of the device and how its power consumption is expected to look, or you would need to have good detailed historical data of this device's power consumption for a long period of time.<br>
I used to do some consulting work for a company which moni... | https://electronics.stackexchange.com |
211,683 | [
"https://physics.stackexchange.com/questions/211683",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/95096/"
] | You drop a ball from a building on the road $40\, \mathrm{m}$ below. Your friend beside you throws a second ball 1 second later at $25\,\mathrm{m/s}$, trying to hit your ball in mid-air. Assuming the aim is good, how high does it hit.
So I started by stating my variables
<ul>
<li>initial distance of ball one and two:... | They both must travel the same displacement in order to collide with each other. Try using the kinematic equation $s=ut+\frac{1}{2}at^2$. Remember that as Socre said, one will have travelled the displacement in $x$ seconds, while other in $(x-1)$ seconds as it was thrown 1 second after and that the displacement of the ... | For the second ball to reach the first ball, they must reach the same height at the same time,
We should have an equation which ties this together; when the balls hit each other, an observer would have found a time $t$ on his stop watch in which$t=t_{1}$, ball two must reach that height in that time but there is a on... | https://physics.stackexchange.com |
1,275,267 | [
"https://math.stackexchange.com/questions/1275267",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/239327/"
] | Let $f: \mathbb D \to \mathbb D$ be analytic or holomorphic with $f(0)=\frac{1}{2}$ and $f(\frac{1}{2}) = 0$ where $\mathbb {D} = \{ z: |z| \leq 1\}$. Then find $|f^{'}(0)|$ and $|f^{'}(\frac{1}{2})|$.
I tried Cauchys Inequality Theorem $ |f^{(n)}(z)| \le \frac{n!M}{r^{n}}$.
Since n=1 the inequality becomes $ |f^{'}... | Schwarz–Pick theorem: If $f:\mathbb D\to \mathbb D$ is analytic and: $f(z_1)=w_1\,$, $f(z_2)=w_2$, then: $$\left |\frac{w_1-w_2}{1-w_1\overline w_2}\right|\le \left |\frac{z_1-z_2}{1-z_1\overline z_2}\right|$$ And: $$|f'(z_j)|\le \frac{1-|w_j|^2}{1-|z_j|^2}\,\,\,\,,\, j=1,2$$ If equality obtains in the first expression... | Consider the Blaschke factor $$g(z)=\frac{\frac{1}{2}-z}{1-\frac{1}{2}z}=\frac{1-2z}{2-z}.$$
Then $g$ is holomorphic on $\mathbb D$, and maps $\mathbb D$ to $\mathbb D$. Moreover, $g(0)=\frac{1}{2}$ and $g\left(\frac{1}{2}\right)=0$. Then, $f\circ g$ maps $\mathbb D$ to $\mathbb D$ and fixes $0$ and $\frac{1}{2}$, the... | https://math.stackexchange.com |
17,591 | [
"https://electronics.stackexchange.com/questions/17591",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/2377/"
] | I'm wondering about the long term reliability of FFC connectors, especially in environments exposed to shock and vibration. It seems like everything with a display uses such connectors, which means they must be present and in use in automotive environments, at least in the user console, which is still exposed to shock... | This is really a termios (and perhaps by association serial) question - there really isn't any relevance to stepper motors other than it being a problem you encountered in the course of talking to a board that happens to drive one.
Most likely the program is adjusting the termios settings for the terminal in addition ... | It looks like the software went bananas. The message is most likely a debug message which they forgot to remove, and which didn't show up during testing, since that part of the code (may be just two lines) should never be executed under normal conditions. That would also explain that you lost your communication.<br>
I ... | https://electronics.stackexchange.com |
105,375 | [
"https://dba.stackexchange.com/questions/105375",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/9643/"
] | Assume I have these two queries in SQL Server 2014, both of which return one row from unrelated tables:
<pre><code>SELECT SUM(A) A, SUM(B) B FROM X
SELECT SUM(C) C, SUM(D) D FROM Y
</code></pre>
I'd like to combine these queries into a single resultset that contains <code>A, B, C, D</code>.
What's a good way to do... | Two subqueries?
<pre><code>SELECT Q1.A, Q1.B, Q2.C, Q2.D
FROM (SELECT SUM(A) A, SUM(B) B FROM @X) Q1(A, B)
CROSS APPLY (SELECT SUM(C) C, SUM(D) D FROM @Y) Q2(C, D);
</code></pre>
| Here's one way:
<pre><code>SELECT MAX(A), MAX(B), MAX(C), MAX(D)
FROM (
SELECT SUM(A) AS A, SUM(B) AS B, NULL AS C, NULL AS D FROM X
UNION ALL
SELECT NULL AS A, NULL AS B, SUM(C) AS C, SUM(D) AS D FROM Y
) AS T
</code></pre>
You may have to cast NULL to whatever type A, B, C and D have
| https://dba.stackexchange.com |
70,770 | [
"https://quant.stackexchange.com/questions/70770",
"https://quant.stackexchange.com",
"https://quant.stackexchange.com/users/62027/"
] | I was creating an yield curve using zeroRate, when I read back the value from the created yield curve - it differs from expectation.
<pre><code>tod = ql.Date(5,5,2022)
ardates = [tod, tod+ql.Period(1,ql.Weeks), tod+ql.Period(1,ql.Months), tod+ql.Period(3,ql.Months),
tod+ql.Period(6,ql.Months),tod+ql.Perio... | To make @nbbo2's answer more precise, let's assume that we observe various sums <span class="math-container">$z_{k,h}$</span> of independent and identically distributed random variables <span class="math-container">$x_i$</span> (i.e. returns),
<span class="math-container">$$
z_{k}\equiv \sum_{i=k-h_k+1}^k x_i
$$</span>... | Assume GBM. Suppose there are <span class="math-container">$n+1$</span> observations, indexed by <span class="math-container">$j=0,\cdots,n$</span>. The stock price is <span class="math-container">$S_j$</span> at time <span class="math-container">$T_j$</span> where time is measured in yearly units.
The annualized varia... | https://quant.stackexchange.com |
16,321 | [
"https://stats.stackexchange.com/questions/16321",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/6076/"
] | Can we say anything about the dependence of a random variable and a function of a random variable? For example is $X^2$ dependent on $X$?
| Here is a proof of @cardinal's comment with a small twist. If $X$ and $f(X)$ are independent then
$$
\begin{array}{lcl}
P(X \in A \cap f^{-1}(B)) & = & P(X \in A, f(X) \in B) \\
& = & P(X \in A) P(f(X) \in B) \\
& = & P(X \in A) P(X \in f^{-1}(B))
\end{array}
$$
Taking $A = f^{-1}(B)$ yi... | <strong>Lemma</strong>: Let $X$ be a random variable and let $f$ be a (Borel measurable) function such that $X$ and $f(X)$ are independent. Then $f(X)$ is constant almost surely. That is, there is some $a \in \mathbb R$ such that $\mathbb P(f(X) = a) = 1$.
The proof is below; but, first, some remarks. The Borel measur... | https://stats.stackexchange.com |
63,039 | [
"https://stats.stackexchange.com/questions/63039",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/16041/"
] | I've set up a Bayesian regression model in WinBUGS to determine values for the unknown parameters (b1, b2, b3, b4) and intercept value (b0) in a linear regression model. The code is as follows:
<pre><code>model {
for (i in 1:(J-1)) {
FC[i] ~ dnorm(mu[i], tau)
mu[i] <- b0 + b1*(Factor_b1[i]-mean_Factor_b1)... | In the Bayesian model you are subtracting something (mean_factor_b1, etc.) from each of the predictor variables. But you are not doing the same thing in the call to <code>lm</code>.
Assuming that "mean_factor_b1" is the mean of the "b1" variable, etc. this means that the intercept in the Bayesian model represents t... | I believe Greg Snow's answer is the probable cause, and have given it a +1.
But, there are two other considerations:
<ol>
<li>Did the BUGS calculations properly converge? It may not have. Did you do any convergence diagnostics/plots? Did you try different initial values?</li>
<li>Note that the <code>lm</code> regress... | https://stats.stackexchange.com |
180,452 | [
"https://mathoverflow.net/questions/180452",
"https://mathoverflow.net",
"https://mathoverflow.net/users/46690/"
] | I cannot seem to find stated the following fact, which is surely well known to experts.
Let (S,L) be a polarized K3 surface. Then $M = L^{\otimes 3}$ is very ample and we can consider the embedding in the corresponding projective space $S \to P^N$.
Question: is the image of $S$ in $P^N$ a complete intersection? I sus... | Suppose $X$ is a smooth surface complete intersection in $\mathbb{P}^n$, given by equations of degrees $d_1,\ldots ,d_{n-2}\ $ . I assume $d_i\geq 2$, because the image of a variety by a complete linear system cannot be contained in a hyperplane. By the adjunction formula the canonical divisor of $X$ is $(\sum d_i-n-1)... | That is not typically true. There are certainly more direct arguments, but you can always see this from Gritsenko-Hulek-Sankaran. If K3 surfaces were complete intersections, the moduli spaces would be unirational. In fact the moduli spaces are (typically) of general type.
| https://mathoverflow.net |
92,465 | [
"https://physics.stackexchange.com/questions/92465",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/30818/"
] | The sun pulls on the moon with a force that is more than twice the magnitude of the force with which the earth attracts the moon. Why, then, doesn’t the sun take the moon away from the earth?
| The simple answer is that the sun's gravity produces the same acceleration on both the Earth and the Moon. The Sun is pulling both of them along, but they are falling <em>together</em>.
You may imagine two skydiver jumping out of a plane at the same time (and we'd better ignore air resistance). They are subjected to g... | Let's do a back-of-the-envelope calculation:
Let $M\approx 2.0\cdot 10^{30}\text{kg}$ be the mass of the sun and $m\approx 6.0\cdot 10^{24}\text{kg}$ the mass of the earth, $R\approx 1.5\cdot 10^{11}\text{m}$ the distance between earth and sun and $r\approx 3.8\cdot 10^8\text{m}$ the distance between earth and moon.
... | https://physics.stackexchange.com |
33,049 | [
"https://mathoverflow.net/questions/33049",
"https://mathoverflow.net",
"https://mathoverflow.net/users/7305/"
] | Let <span class="math-container">$D$</span> be the open unit disk, and <span class="math-container">$J$</span> a Jordan arc (that is, a homeomorphic copy of <span class="math-container">$[0, 1]$</span>) that lies in <span class="math-container">$D$</span>, except <span class="math-container">$J(0)$</span> lies on the b... | It's certainly the case that $\mathbb{R}^2\setminus J$ is path connected.
So any two points in $D\setminus J$ are joined by a path in $\mathbb{R}^2$
missing $J$. If this path isn't in $D$ it hits the boundary of $J$
but then replace part of the path by an arc of the boundary of $D$.
Then one can replace this part of th... | I know this is a really old question, but I just happened upon it for some reason. I've always liked these kind of plane topology question, so I think I'll add an answer here.
If you are looking for a simple topological proof, then I suggest using the following theorem of Janiczewski's:
Let z and w be points in the p... | https://mathoverflow.net |
116,588 | [
"https://softwareengineering.stackexchange.com/questions/116588",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/6770/"
] | I'd like to know the Agile stance on the following situation:
<ul>
<li>A contractual, payable milestone states a working version must be installed and run at customer's location;</li>
<li>Development is still ongoing, not all user stories and issues are addressed;</li>
<li>A later deployment will be required</li>
</ul... | <ol>
<li>Ask your client to create a test environment that mimes the production one. Do not, under any circumstances, install a new update on the living system, before you test and demonstrate it to the client, because if you screw up your milestone, you also screw up the client's operation;</li>
<li>Make your QA team ... | By Scrum means the Team iterates to produce increments, they are not by default releaseable but they are <em>done</em>. If the customer wishes qa tested stables during the whole process all qamust be done in the iterations before. Scrum teams can do that but its not effient... The product owner you mentioned reflects t... | https://softwareengineering.stackexchange.com |
4,359,552 | [
"https://math.stackexchange.com/questions/4359552",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/230586/"
] | <h1>Background</h1>
Let <span class="math-container">$A = \left[ \begin{matrix} a & b \\ c & d \end{matrix} \right]$</span> be a matrix in <span class="math-container">$\mathbb{R}^{2 \times 2}$</span>. While matrices are often used to represent a variety of linear transformations, including rotations, here I a... | <span class="math-container">$\DeclareMathOperator\id{id}$</span> Let <span class="math-container">$A$</span> be an arbitrary <span class="math-container">$n \times n$</span> matrix. For each element <span class="math-container">$\sigma \in D_{8},$</span> we let <span class="math-container">$\sigma \cdot A$</span> deno... | In fact, the operations described by @ckefa can be given an all-matricial form, providing a direct access to their determinant. I am going to present them in <span class="math-container">$n=2$</span> dimensions for the benefit of simplicity, but they are valid in any dimension <span class="math-container">$n$</span>:
L... | https://math.stackexchange.com |
141,538 | [
"https://softwareengineering.stackexchange.com/questions/141538",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/40649/"
] | At the moment every javasrcipt file in our project includes closure wrapper. Before deploying all files are concatenated and minimized.
And i'm asking myself, do we really need all that closures OR one closure added after concatenation will do the job.
I can see only one reason not to do that - the variable we are sh... | Yes, you need all the closures so the files are separate <em>from each other</em>.
If you concatenate more then one file inside the same function then they will share variables, just as if they had been global. The only advantage at this point would be insulating your code from external 3rd party Javascript.
<hr>
In... | <blockquote>
But there is no conflict so is don't see any problem
</blockquote>
thats a horrible understatement, wrap every single file in a closure so that the you can "file local" variables inside that file.
The fact that wrapping it in a closure adds 15 bytes is the only disadvantage, if you care about those 15 ... | https://softwareengineering.stackexchange.com |
220,065 | [
"https://mathoverflow.net/questions/220065",
"https://mathoverflow.net",
"https://mathoverflow.net/users/48554/"
] | I am looking for a paper of Weil that is published under a pseudonym, in which he proves a statement along the lines of: a singular algebraic variety cannot be deformed into a nonsingular one.
Thanks in advance.
| $\newcommand\p{\mathfrak{p}}$
$\newcommand\OL{\mathcal{O}}$
$\newcommand\P{\mathfrak{P}}$
Here is a solution which is essentially an elaboration on Felipe's answer.
Instead of working with squares, consider working with $m$th powers instead.
<b>Lemma:</b> If $(1 - v u^m)$ is exactly divisible by a prime $\p$ of $\OL... | This is not really an answer, but it gives an indication where the
difficulty lies.
We first observe that the property of an interger in a number field $K$
to be a sum of two units is invariant under multiplication by a unit.
So the question is equivalent to
<em>How many principal ideals of the ring of integers $R$ o... | https://mathoverflow.net |
85,465 | [
"https://stats.stackexchange.com/questions/85465",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/38348/"
] | For most of my time in stats, I have been able to ignore the marginal distribution that is usually present at the denominator of any bayesian posterior distribution.
For example, if we write down $L_x(\theta)\pi(\theta)$ and recognize that this function of $\theta$ looks like a distribution of $\theta$ but with an in... | <blockquote>
Theoretically, why do we not need to compute a marginal distribution constant for finding a Bayesian posterior?
</blockquote>
Generally speaking, you <em>do</em> need to - it's just that sometimes it's so easy that you might not notice you did it.
With 'textbook' problems you can often take $\pi(x|\the... | Your problem is equivalent to the following: Suppose you have a function $f(x)$ such that $\int f(x) dx < \infty$, and you are looking for a constant $c$ such that $\int cf(x) dx = 1$. Clearly, $c = 1/ \int f(x) dx$ would work, but perhaps it isn't easy to compute $\int f(x) dx$. In your quest to find $c$, perhaps y... | https://stats.stackexchange.com |
880,626 | [
"https://math.stackexchange.com/questions/880626",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/50979/"
] | You are sitting in a dark room. It is completely dark. You can't see anything and there is no way that you can make light. Basically, just assume that you are blind for this task.
There is a table in front of you and you feel a deck of cards in your hand. Now the deck is shuffled. But not only shuffled, 18 cards out o... | This is a classic question.
Split the cards into two piles. The first pile has 18 cards, the second pile has the remaining 35 cards. Say that there are $n$ upside down cards in the first pile, and therefore $18-n$ upside-down cards in the second pile.
Now turn over all the cards in the first pile.
| This is an old puzzle, basically you take any set of 18 cards and turn them over. It should be the duplicate of some other question here.
| https://math.stackexchange.com |
53,047 | [
"https://dsp.stackexchange.com/questions/53047",
"https://dsp.stackexchange.com",
"https://dsp.stackexchange.com/users/38616/"
] | Why is convolution commutative, as it seems to treat two signals in a different way in an LTI system?
If you imagine <span class="math-container">$y[n] = x[n] \star h[n]$</span> with <span class="math-container">$x[n]$</span> being an input signal and <span class="math-container">$h[n]$</span> being the impulse respo... | In a discrete-time system such as the one that you have, the <em>number</em> <span class="math-container">$y[n_0]$</span> (here <span class="math-container">$n_0$</span> is a fixed integer) is a <em>sum</em> of the form <span class="math-container">$$\sum_{k=-\infty}^\infty h[k]x[n_0-k]$$</span> which can be <em>re-arr... | Imagine a system that accepts a single number <span class="math-container">$x$</span> as its input, and it multiplies that number with another number <span class="math-container">$h$</span>. Would it surprise you that another system which multiplies its input with the number <span class="math-container">$x$</span> give... | https://dsp.stackexchange.com |
57,308 | [
"https://electronics.stackexchange.com/questions/57308",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/1288/"
] | There is a toy that is intended to be used in water. However, we found out that the battery box (holds 2 AAA's) is not water tight and water leaks into it. Is this an issue? I know that water is conductive.
So, essentially when water leaks in, the batteries are being shorted right?
How dangerous is this? Will it over... | From experience with a weather station in the Scottish islands : it's not very dangerous because there isn't that much power from AAA batteries. Water won't short out batteries the same way a screwdriver would short out a car battery; the leakage would be milliamps rather than amps and heating is negligible.
Still, t... | If I understand this right, you've got a electronic product that is intended to be used immersed in water, but it leaks and water can get onto the electronics. Seriously!!!?
In case you really are serious, <b>yes, that is a problem</b>. Even if the water only gets to the batteries, it can cause corrosion and will pr... | https://electronics.stackexchange.com |
24,212 | [
"https://mechanics.stackexchange.com/questions/24212",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/14054/"
] | I have a 2002 Mazda B3000 (essentially a Ford Ranger) that almost never starts on the first attempt. Usually it takes 2 or 3 tries before the car finally turns over. Each time I hold in the crank I hear the starter engage and the engine whir but the car doesn't start.
I've tried cycling the key to iginition on, waiti... | The mystery was finally solved after taking in my vehicle due to a check engine light before a smog test.
Both the mass airflow sensor and the throttle sensor needed to be replaced as they were giving faulty readings which caused high idling on top of the cold start problems. I did clean the mass airflow sensor, but a... | I'll bet you have a leaky fuel pump check valve. As you sit, it slowly allows the pressure from the fuel line to bleed back into the tank. You have to crank the engine over long enough to build up pressure to pump the fuel from the tank back up to the engine. I'm guessing you'll wind up replacing the fuel pump, as the ... | https://mechanics.stackexchange.com |
345,592 | [
"https://physics.stackexchange.com/questions/345592",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/162663/"
] | I'm reading Stocker's Thermodynamics and statistical mechanics. On the subsection "Kinetic theory of the iddal gas", it says something similar to this
<blockquote>
Each particle of the gas has a velocity vector $\vec{v}$, and, on average, there will always be the same number of particles in a certain interval $\oper... | It means that the integration is over three dimensions of velocity space (the three components of the velocity vector). In this case, when it doesn't have an integral sign in front of it, the text is talking about a small volume ($\mathrm{d}^3v$) of velocity space around the velocity vector $\vec{v}$.
| This is simply a compact notation for indicating a differential element of volume (i.e. a 3 dimensional differential element). Written out in Cartesian coordinates it looks like
$$ \mathrm{d}^3\vec{v} = \mathrm{d} v_x \, \mathrm{d} v_y \, \mathrm{d} v_z \;,$$
so that (again in Cartesian coordinates)
$$ \iiint \dots \ma... | https://physics.stackexchange.com |
192,150 | [
"https://electronics.stackexchange.com/questions/192150",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/87370/"
] | I'm planning on setting up a voltage comparator with a single rail op amp and was wondering if I still need to attach a diode to the output because it is single rail and not dual. I would think that the op amp will only produce an output when the input voltage is above the reference voltage not below it since it's a s... | Yes, that is correct. Usually a single supply op-amp will saturate quite near the negative rail. If the negative rail is ground, then it cannot output a voltage less than ground by itself.
Not all op-amps are suitable for use as comparators. Some, for example, effectively have diodes between the inputs. Recovery from... | <blockquote>
I would think that the op amp will only produce an output when the
input voltage is above the reference voltage not below it since it's a
single rail. Is this correct?
</blockquote>
No that is incorrect - an op-amp will produce an output voltage under ALL circumstances (except when burnt). On the ot... | https://electronics.stackexchange.com |
150,183 | [
"https://softwareengineering.stackexchange.com/questions/150183",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/7279/"
] | For a long time now I've been in the habit of checking whether a collection (array, dictionary, whatever) is non-empty with a nonequality. Like this:
<pre><code>if ( MyArray.Length < 1 )
{
// Do something if the array is empty
}
</code></pre>
Sometimes I do this for strings too, and other kinds of collections.... | Some collection that is empty has length of zero.
Some collection with a negative length is something else.
Use second one or implement a method like IsEmpty().
| Personally, I think that neither version is good, and both are a sign of bad API design on part of the author of <code>Array</code>.
For example, in Ruby (not that I would propose the Ruby core library as an example of good API design) it would be
<pre><code>do_something if my_array.empty?
</code></pre>
Which coinci... | https://softwareengineering.stackexchange.com |
19,303 | [
"https://mathoverflow.net/questions/19303",
"https://mathoverflow.net",
"https://mathoverflow.net/users/2612/"
] | What's a good example to illustrate the fact that a function all of whose partial derivatives exist may not be continuous?
| The standard example I have seen is: $f(x,y)=\frac{2xy}{x^2+y^2}$.
| I feel it's more informative to have the thought process that leads to the example rather than just be told some magic formula that works, however simple that formula might be.
Here is a way of explaining it. We'll decide that our function is going to be discontinuous at (0,0). In order to ensure that the partial deri... | https://mathoverflow.net |
232,422 | [
"https://softwareengineering.stackexchange.com/questions/232422",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/9441/"
] | In our ASP.NET MVC application, we try really hard to separate concerns to each layer (we use DDD). Nevertheless, it seems that we can't avoid having at least some business logic in DAL.
For instance, there are named objects, where business requirement is that each name must be unique (but the name isn't a key). If th... | BTW Agree with @Robert Harvey.
There's a subtle but problematic shift in your question -- the original question is "how to isolate business <em>logic</em>" but then you switch over to isolating "business <em>requirements</em>".
Business <em>requirements</em> will permeate your system. Of necessity. During the data mo... | <blockquote>
So far, we handle that with constrains in SQL database, so if something like this happens, an exception is thrown in repository - but this approach is simply wrong, since such requirement is strictly business requirement and it shouldn't bubble to persistence layer.
</blockquote>
You can make that argum... | https://softwareengineering.stackexchange.com |
51,566 | [
"https://quant.stackexchange.com/questions/51566",
"https://quant.stackexchange.com",
"https://quant.stackexchange.com/users/44165/"
] | Do we have any direct method to get the 'last' and 'next' cash flow date and amount from the date of valuation in Quantlib Python using fixed leg amt or floating leg amt, day counter,valuation date , notional,Index,payment frequency etc. Please suggest.
| This adjustment takes into account accrued premium at default. Upon default in period <span class="math-container">$\left(t_{i - 1}, t_i\right]$</span>, the protection buyer owes the protection seller <span class="math-container">$S \times d\left(t_{i - 1}, \tau\right)$</span>, where <span class="math-container">$\tau$... | One important difference between a cash bond and a CDS is that when a cash bond defaults, all the accrued coupon is wiped out, but the notional payment is accelerated. For this reason, the exact date of the default is not very important. The bond holder gets recovery on the principal, but no recovery on the accrued cou... | https://quant.stackexchange.com |
180,449 | [
"https://softwareengineering.stackexchange.com/questions/180449",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/75788/"
] | I am starting a software project that I want to have the option to keep it proprietary. However, since I generally use a Linux environment, I want to know: How do people write proprietary software in Linux and not violate the GPL/LGPL/etc licenses that seem to restrict uses of libraries needed to build the project?
A... | In general, when writing software that uses third-party libraries you need to be aware of the licences under which the third-party software is released and how that affects your own software.
The GPL licence is considered an infectious licence in the sense that if your project includes GPL-licensed code in any way, yo... | There is an interesting publication on this topic:
Citation:
Maria Kechagia, Diomidis Spinellis, and Stephanos Androutsellis-Theotokis. <strong>Open source licensing across package dependencies.</strong> In Costas Vassilakis and Nikolaos Tselikas, editors, PCI 2010: Proceedings of 14th Panhelenic Conference on Infor... | https://softwareengineering.stackexchange.com |
38,069 | [
"https://cs.stackexchange.com/questions/38069",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/20256/"
] | Think of an $n$-ary alphabet as $\{0, 1, ..., n-1, n\}$. For example, a binary alphabet is $\{0, 1\}$.
<blockquote>
Do <strong>Turing Machines</strong> with binary alphabets decide the same set of languages as Turing Machines with $3$+ symbol alphabets?
</blockquote>
I am unsure of how to show equivalence. Clearly... | I am answering the question "Can Turing Machines with binary alphabet decide the same languages as Turing Machines with 3 or more alphabet symbols?"
Now, on the one hand, it's not well-defined what happens if you take a string with three different alphabet symbols and give it to a TM that only is designed to see a bin... | We need to emulate an n-symbol Turing machine with a binary TM (the other direction is trivial). So you need to convert the input string to binary (e.g. usual binary encoding) and convert the transition function to work with the binary alphabet. E.g. you have a transition (F,T,R,M,W) - F = from state, T = to state, R =... | https://cs.stackexchange.com |
144,271 | [
"https://softwareengineering.stackexchange.com/questions/144271",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/37978/"
] | I have a simple form for the user to sign up to my site; with email, username and password fields. We are now trying to implement an ajax validation so the user doesn't have to post the form to find out if the username is already taken. I can do this either on <strong>keyup</strong> event or on text <strong>blur</stron... | From user point of view, I would want to know whether whatever I am doing at given moment is going to fail <em>as soon as possible</em>. Which is why I suggest going for key-up validation. Few reasons for it:
<ul>
<li>gives user nice real-time interaction and security feel (system is watching whether you do what you'r... | create a 1 second timeout on keyup and cancel the previous one
<pre><code><input onkeyup="cleartimout(lastTimeout);lastTimeout=setTimeout(validate,1000);">
</code></pre>
this way fast typers don't trigger a validate on each keyup but when the user stops typing the username is validated and gets feedback on whet... | https://softwareengineering.stackexchange.com |
69,411 | [
"https://chemistry.stackexchange.com/questions/69411",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/33671/"
] | Why does moist air have lesser density than dry air? When the amount of vapor inside increases, the mass increases and hence won't the density as well increase?
| The composition of dry air is about $78\%$ $\ce{N2}$, $21\%$ $\ce{O2}$ and $1\%$ $\ce{Ar}$. The molecular weights of these compounds are:<br>
$\ce{N2} = \pu{28 g/mol}$<br>
$\ce{O2} = \pu{32 g/mol}$<br>
$\ce{Ar} = \pu{40 g/mol}$
So, the average molecular weight of dry air is given as:
$\pu{(0.78 * 28 g/mol) + ( 0.2... | If you considered the air within a given volume in two rooms, one with moist air and one with dry air, moist air will have some water vapor in place of other molecules that make up air (e.g. oxygen and nitrogen). A Water molecule has a lower mass than either oxygen or nitrogen, thus the volume of moist air will have a ... | https://chemistry.stackexchange.com |
15,067 | [
"https://mechanics.stackexchange.com/questions/15067",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/9105/"
] | Just took our 2005 Subaru Outback in for an oil change, and got the guys to rotate our tires, which they forgot to do last time (so it had been about 7500-10000 miles since last rotation, as we get oil changes every 4-5000 miles). The tires immediately begin making a lot of noise at speeds above 40mph, and instead of ... | Unidirectional tires should <strong>NOT</strong> be cross rotated. "Uni" implies one, as in one direction (nothing to do with singing). Radials in general should not be cross rotated. They start behaving as you have discribed, with the noise and all. With all this said, I don't believe your tires are unidirectional, bu... | You have symmetrical, bidirectional tires. You can flip the tire around on the wheel, it looks the same. So of course because of the bidirectional design, looking at the outside of the tire will look different on one side of the car than the other. That's how they're made and the majority of passenger cars have the sam... | https://mechanics.stackexchange.com |
98,104 | [
"https://chemistry.stackexchange.com/questions/98104",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/63656/"
] | Now I know that temperature is the average kinetic energy of atoms, molecules and compounds. Photons increase the kinetic energy/temperature of molecules since photons are pure energy. Hence, wouldn't the transfer of kinetic energy mean that photons need to be transferred from a higher temperature molecule to a lower t... | You may be experiencing a very common misconception, which I blame on <em>Star Trek</em> and <em>Star Wars</em> and all their talk of pure energy that always comes as bright lights, with the implicit assumption that energy is some kind of fiery bright <em>substance</em>, like a glowing fluid or something. It isn't. E... | To add a little to the answer by @Christopher Grayce, molecules have kinetic energy due to the fact that they move about and also <em>internal</em> kinetic energy because they have bonds that vibrate and some bonds can rotate as can whole molecules. For a photon to give up all of its energy to a molecule it has to be a... | https://chemistry.stackexchange.com |
227,250 | [
"https://electronics.stackexchange.com/questions/227250",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/106225/"
] | I have some hard time understanding JTAG for programming.
I have an mcu that can only be programmed via JTAG.
What are some easy chips to start with in order to program an mcu via JTAG? I suppose I d need a chip (mentionned in the previous sentence) in order to convert the serial data received via usb to the "JTAG-eq... | EDIT.
That is a cortex-m based mcu, which in this case uses ARM SWD, which we use the term jtag, they call it a serial jtag which jtag was already serial but they supposedly take the four jtag signals (TMS, TCK, TDO, TDI) and serialize them, I have not dug into the details. Arm uses it because it saves signals on the ... | What chip are you using? There are (unfortunately) no universal standards for USB JTAG cables, so it will depend on what chip and what toolchain that you are using. If you are using something like an ARM processor with a GCC toolchain, you will probably be able to use OpenOCD to program your chip. In that case, ther... | https://electronics.stackexchange.com |
714,220 | [
"https://physics.stackexchange.com/questions/714220",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/290987/"
] | The microscopic viewpoint of studying a system in thermodynamics is the one in which we consider the system on a molecular/atomic/sub-atomic level. (is that even right?)
The macroscopic viewpoint is the one in which we ignore the molecular nature of the system and treat it as an aggregation of differential volumes, tha... | The question is about the meaning of terms such as 'microscopic' and 'macroscopic' in thermal physics generally.
To define these terms it is best to put to one side for a moment the idea that large things are often made of atoms and molecules and things like that. Rather, pretend you really don't know what sort of stuf... | A full answer to your question is simply reading a book on statistical physics.
<h3>The thermodynamic limit</h3>
There's no microscopic thermodynamics. At the microscopic level, you simply use ordinary mechanics (classical or quantum) for the particles.
But as the number of particles grow, this approach becomes both in... | https://physics.stackexchange.com |
126,970 | [
"https://physics.stackexchange.com/questions/126970",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/52530/"
] | Question adapted from Examkrackers MCAT prep book:
<blockquote>
A particle moves along a half circle (diameter=<span class="math-container">$10\text{ m}$</span>) at a constant speed of <span class="math-container">$1\text{ m/s}$</span>. What is the average acceleration of the particle as it moves from one side of the h... | <blockquote>
Is there a difference between "average acceleration" and centripetal acceleration?
</blockquote>
Yes, in fact they're almost completely unrelated.
The average acceleration is <em>defined</em> as
$$\vec a_\text{avg} = \frac{\Delta\vec v}{\Delta t}$$
It is one quantity that partially describes the moti... | Here the average acceleration can be understood as follows:
The particle going from A to B along a half circle with <em>speed</em> 1m/s can be here viewed as the particle going from A to C and again to A with an <strong>initial</strong> <strong>velocity</strong> 1m/s as shown in the figure:
<img src="https://i.stack.i... | https://physics.stackexchange.com |
464,981 | [
"https://physics.stackexchange.com/questions/464981",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/224769/"
] | In physics, the potential energy of an object is mgh. We say that the potential energy of an object is equal to the work done on it to make it reach that height. So the work done = mg <em>h. Mg is the force applied too lift the object to the height h But when we apply the force (mg) on an object, the gravitational forc... | If <span class="math-container">$F>mg$</span>, the object will >>accelerate<< upwards under the net upwards <span class="math-container">$F-mg>0$</span> force. So it reaches height <span class="math-container">$h$</span> with some upwards speed <span class="math-container">$v$</span>. And then its energy at... | If you do believe the work done by gravity to fall the object is less than the work to get it up there, then where do you think the rest of the energy go? The atmosphere never disappears on it way down nor is anything else involved. If you're still in doubt, try taking the long way out. Start by claculating the force o... | https://physics.stackexchange.com |
49,402 | [
"https://quant.stackexchange.com/questions/49402",
"https://quant.stackexchange.com",
"https://quant.stackexchange.com/users/43108/"
] | I am trying to figure out an intuitive explanation for the instantaneous change for the value of a portfolio (essentially I'm creating a self-financing portfolio to replicate a derivative payoff).
Suppose that at time t we hold the portfolio <span class="math-container">$\left(a_t,b_t,c_t\right)$</span> where <span cl... | It's best to think of the sum of <span class="math-container">$da_t A_t$</span> and <span class="math-container">$da_t dA_t$</span>:
<span class="math-container">$$
da_t A_t + da_t dA_t = da_t(A_t + dA_t)
$$</span>
which is the cost of rebalancing at the new price <span class="math-container">$A_{t'} = A_t + dA_t$</spa... | Say you start with 1000 units worth 100 equals value 100,000. You buy 100 more but the price falls to 90, giving you 1100*90 equals 99,000 value.
Change in Value =
dP * U = -10 * 1000 = -10,000
P * dU = 100 * 100 = 10,000
dP * dU = -10 * 100 = -1,000
The first two, the change in value of existing units, and t... | https://quant.stackexchange.com |
257,115 | [
"https://dba.stackexchange.com/questions/257115",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/156813/"
] | I am aware there are many questions on this topic, mysql has not improved much on these single-query performance bugs in the past years but my case is more unusual.
<strong>If mysql would access the table index as it was supposed to do and count the entries it should take 70mil entries * 4 byte per entry = ~275MB at... | Add <code>INDEX(last_error_code)</code>, then do <code>SELECT COUNT(*) FROM logos</code>, it will run a lot faster because it will use the much smaller BTree for that secondary index.
<code>SHOW TABLE STATUS LIKE 'logos'</code> will give you an approximate count.
Why is the PK bloated? InnoDB orders the data by the ... | Alternative to SELECT COUNT(*) FROM logos;
<pre><code>SELECT table_rows FROM information_schema.tables WHERE table_name = 'logos';
</code></pre>
if you can survive with a 'close' number.
Other qualifiers may be necessary for schema, etc.
| https://dba.stackexchange.com |
379,453 | [
"https://electronics.stackexchange.com/questions/379453",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/191143/"
] | I'm building a helical antenna at 1.7 GHz from scratch. Theory says that its characteristic impedance is 140 Ohm. The RF transmission line is 50 Ohm so there has to be an impedance transformer in between. What is the proposed custom implementation of such a transformer? I have come across the LC circuit as a possible ... | I thought that I had used Bi-directional port inside a hierarchy but to be 100% sure I tried a simple example.
That example passed synthesis in Vivado without any problems. However it maybe that it passes <strong><em>because</em></strong> the code is so trivial. Who knows what idiosyncrasies the Vivado synthesis tool... | Like @Oldfart said,
<blockquote>
Alternative is to make a tri-state or read/write signal and pass all three signals (In,Out,Tri) to the top and there you have to make your I/O pads.
</blockquote>
This is my recommendation. Handle all tri-states at the top-level if possible (I always use IO rings). You may not be ... | https://electronics.stackexchange.com |
152,755 | [
"https://dba.stackexchange.com/questions/152755",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/108483/"
] | I have following config
<pre><code>[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql-socket/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
innodb_buffer_pool_size=64M
innodb_log_file_size=16M
[mysqld_safe]
log-error=/var/log/shared/mysqld.log
pi... | Your error message says it's connecting to the wrong socket:
<blockquote>
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
</blockquote>
You can either specify that in command line:
<pre><code>mysql -S /var/lib/mysql-socket/mysql.sock ...
</code></pre>
Or in t... | <pre class="lang-none prettyprint-override"><code># For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /mysql/data/mysql/mysql.sock
#datadir = /var/lib/mysql
datadir = /mysql/data/mysql
log... | https://dba.stackexchange.com |
5,435 | [
"https://physics.stackexchange.com/questions/5435",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/1939/"
] | Been studying hopping conduction and something that everyone is taking for granted is bothering me.
Let's say we have a bunch of sites that are either unoccupied, singly occupied, or doubly occupied. Due to on-site Coulomb repulsion the two electron levels are separated by U energy at a doubly occupied site. Now every... | 4tnemele's answer is great, but I thought I'd try to give a simpler explanation of the main point of confusion.
Let's say (as in 4tnemele's answer) that there's only one relevant orbital (or "energy level") at each site. That means there's two states a single electron can occupy: spin up and spin down.
Also, let's sa... | Maybe I am misunderstanding your question, but let me try to explain.
For simplicity suppose that we have only one site with only one relevant orbital (a big energy gap to other orbitals). Furthermore electrons have internal degrees of freedom, which introduces the index $\sigma = \uparrow, \downarrow$. By Pauli exclu... | https://physics.stackexchange.com |
38,667 | [
"https://electronics.stackexchange.com/questions/38667",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/11217/"
] | What options would I have for a cheaper alternative to using a micro controller like the Atmega for mass production products?. I just want something cheaper and smaller than an Atmega micro controller.
Because I can get them from China for cheaper price but they maybe fake or something as they are half the price than ... | There are plenty of legitimate microcontrollers available for under $1 if you buy them from the right place. I am more familiar with Microchip PICs, but I'd be real surprised if Atmel doesn't have a few sub $1 offerings too, especially at 10k quantity. By the way, 10k quantity isn't all that high, but high enough so ... | You'll have to be more specific about the type you need, but you can get ATmega48 for USD 1.08 each at 10 000 at Digikey. But for quantities like this I would go to a <strong>distributor</strong>, that's where the manufacturer also would send you to. Atmel sells through big ones like Arrow, Avnet and EBV. For 10 000 pi... | https://electronics.stackexchange.com |
371,000 | [
"https://softwareengineering.stackexchange.com/questions/371000",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/303984/"
] | I have a working web app that I version control using Git - call this v1.0. I learnt a lot during that development including some of the mistakes I made. I now want to re-write parts of the code to follow best (better?!) practices and allow better maintainability. Should I create a new repo or should I clone? (I am usi... | I suppose the answer to your question entirely depends on whether or not you consider the product to be a new one or not. If you consider it to be a new product, you should most certainly clone your repository to start with. Though, I assume if you're rewriting only <em>parts</em> of your program, it is the same prod... | Assuming you use a languanguage that supports interfaces and dependencyinjection
I would use the same repository and would refactor the old existing code into services with interfaces before the rewrite and then re-implement the services in the rewrite by and by.
benefits
<ul>
<li>both old and new can co-exist in t... | https://softwareengineering.stackexchange.com |
90,191 | [
"https://security.stackexchange.com/questions/90191",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/3286/"
] | A DoS (short for "denial of service") attack is a form of attack used on web services which aims to "crash" the service.
Is there any motive of this form of attack besides crashing the service / website?
For example, I could think of blackmailing/ doing harm to a competitor / political reasons as a direct motive for ... | In general a (Distributed) Denial of Service attack will not provide you with much information directly. However, there are a few scenarios where information could be gleaned as a result of a DoS. The following are a few examples, but this is not at all exhaustive:
<ul>
<li>A load balancer may divulge internal subnet ... | In general, DoS attacks are only designed to cause (as their name suggests) a denial of service, i.e. a compromise of the availability of the service.
Other forms of DoS, e.g. triggering a null pointer dereference, might be used to compromise integrity by crashing a service without it having time to cleanly close file... | https://security.stackexchange.com |
118,540 | [
"https://mathoverflow.net/questions/118540",
"https://mathoverflow.net",
"https://mathoverflow.net/users/23758/"
] | Let $X$ be a projective surface defined over a field $k$ of characteristic $0$, and let $G$ be a finite group acting biregularly on $X$.
Assuming that $X$ is rational over $k$, is the quotient $X/G$ always rational?
If $k=\mathbb{C}$, we can use Castelnuovo's theorem and see that $X/G$ is unirational and hence ration... | This is not always true, and cubic threefolds give a counterexample over the field $k=\mathbb{C}(t)$. Let $\mathcal{Y}$ be a smooth cubic hypersurface in $\mathbb{P}^4_{\mathbb{C}}$. Let $L\subset \mathcal{Y}$ be a line. Denote by $\mathcal{X}$ the (locally closed) subvariety of $\mathcal{Y}\times L$ parameterizing ... | Just to round out the picture: if the characteristic of $k$ is positive and $G$ is a finite, but non-reduced group scheme (for example, the infinitesimal group scheme $\mu_p$ of $p$.the roots of unity), then the quotient $X/G$ need not even have Kodaira dimension $-\infty$ after desingularization. Moreover, if $G$ is n... | https://mathoverflow.net |
614,395 | [
"https://physics.stackexchange.com/questions/614395",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/233550/"
] | I'm sometimes mystified by the use of differentials in physics. I don't understand which formulas—on which occasions—can be thought of as differential equations and which cannot.
While discussing work done by a piston during an isothermal process, my textbook does not treat <span class="math-container">$PV=nRT$</span> ... | <span class="math-container">$$PV=nRT\tag{1}$$</span>
can not be considered a differential equation, simply because it <strong>contains no differentials</strong>.
Now, you can't just go and differentiate that equation as:
<span class="math-container">$$P\mathrm{d}V=nR\mathrm{d}T$$</span>
because <span class="math-conta... | I'll try to concentrate my answer to your general question, more than concentrating on the example, although I'll touch it as an example of the general answer.
The basic answer is that Thermodynamics deals with functions of more than one variable. Therefore, in general, one has to expect to find partial differential eq... | https://physics.stackexchange.com |
1,081 | [
"https://mathoverflow.net/questions/1081",
"https://mathoverflow.net",
"https://mathoverflow.net/users/689/"
] | It would also be nice if someone can explain this comment appearing on the Wikipedia page on CW-complexes:
"The homotopy category of CW complexes is, in the opinion of some experts, the best if not the only candidate for the homotopy category."
| My favorite example of a space which is not homotopy equivalent to a CW complex is the Long Line. All it's homotopy groups vanish (exercise 1) but the long line is not contractible (exercise 2). It's too long!
| The `quasi-circle" of Hatcher's <em>Algebraic Topology</em>, Exercise 10 of 4.1, is a nice example. The point is that is has trivial homotopy groups but is not homotopy equivalent to a point, contradicting Whitehead's theorem (I think that is the name of the theorem).
| https://mathoverflow.net |
575,905 | [
"https://stats.stackexchange.com/questions/575905",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/313156/"
] | If the alpha is set to 0.05 I have encountered many scientific publications saying that a "tendency for an effect" is present based on a p-value of 0.05 < p-value < 0.1. On the other hand, I have had statisticians who criticize me for doing so, because there is only "reject" or "not rejec... | There are two different approaches to interpreting statistical significance - the Fisher way, and the Neyman-Pearson way. We smush these together (into what Gerd Gigerenzer has called a 'bastardised approach'). The reason that statistical significance testing [Edit, n italics] <em>as it is often taught and discussed</e... | I would add to the excellent answer of Jeremy Miles by saying that how you treat your p-values also strongly depends on what you want to do with them. They get a bad reputation (and rightfully so), for being the deciding factor between "Your work is worth publishing" and "Your work is garbage".
Howe... | https://stats.stackexchange.com |
216,084 | [
"https://stats.stackexchange.com/questions/216084",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/27976/"
] | I have a data table that looks like this:
<pre><code>USER AREA
1 X723
1 X278
2 X827
2 X567
2 X234
3 X735
3 X673
3 X346
4 X723
5 X678
</code></pre>
Then I converted the table into:
<pre><code>USER ALL
1 2
2 3
3 3
4 1
5 1
</code></pre>
My problem is that I have hundreds of thousand... | I guess that your user identifiers are not inherently informative; even if they are, the problem as you say is that you can't show them visually any way.
A common set-up in ecology is to count the numbers of individuals of several species and then further to reduce to the numbers of species with so many individuals. ... | You can use insights from panel data and calculate within (over time) and between (across individuals) standard deviation for the area (I am assuming it is a numeric variable). If you are using Stata, you would first generate a pseudo variable for time-period, then <code>xtset</code> the data and finally use <code>xtsu... | https://stats.stackexchange.com |
165,091 | [
"https://chemistry.stackexchange.com/questions/165091",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/119186/"
] | According to my book, 1 mole ClO- is equivalent to 1 mole Cl2. How is that even possible? 1 mole ClO- contains 1 mole Cl atoms. On the contrary, 1 mole Cl2 gas contains 2 mole Cl atoms. So, how are they equivalent?
Let me put it in this way. If I have 257.5g (5 mole) of ClO- ion, will it be correct to say that I have 3... | You will find the "equivalency" relations in many classical volumetric or gravimetric analysis. Active chlorine and active oxygen are such representative terms; these terms are academically old but they are still used in industrial analysis around the world.
When we say that a certain bleach contains a certai... | If we consider reaction <span class="math-container">$$\ce{ClO- + Cl- + 2 H+ -> H2O + Cl2},$$</span>
there is 1:1 ratio, 1 <span class="math-container">$\ce{ClO-}$</span> is equivalent to 1 <span class="math-container">$\ce{Cl2}$</span>.
The equivalence does not mean the atom counts must match, as they can come from... | https://chemistry.stackexchange.com |
433,640 | [
"https://softwareengineering.stackexchange.com/questions/433640",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/98425/"
] | I'm having a hard time wrapping my head around the use of async/await and regular sync function calls in JavaScript.
Let's say I have two functions:
<strong>Function 1</strong>:
<pre><code>async function doSomething() {
const result = await doExpensiveOperation()
const result2 = await doAnotherExpensiveOperatio... | You are correct that <code>await</code> “blocks” the current task. But there might be more than one task awaiting execution at the same time. While one task is awaiting some result, another task can run.
For example, let's assume I need to <code>doSomething(1)</code> and <code>doSomething(2)</code>. Without async/await... | <blockquote>
I think the intention is that Function 1 supposedly unblocks JavaScript's thread of execution and allows it to execute statements past the <code>await</code>
</blockquote>
Not exactly. It allows JavaScript to execute separate statements triggered by other events. So if your <code>doExpensiveOperation</code... | https://softwareengineering.stackexchange.com |
64,766 | [
"https://dsp.stackexchange.com/questions/64766",
"https://dsp.stackexchange.com",
"https://dsp.stackexchange.com/users/45256/"
] | What is the meaning of spectrum in simple words?
Is it just "range or set of different frequencies "
Just like fm spectrum is between 88MHZ to 108MHZ?
| A sinusoid with a frequency that is between bins in the FFT frequency domain is circularly discontinuous in the time domain. So you can't use the same IFFT results back-to-back without the noise from this discontinuity between each IFFT window, as the end of one window will have a value too far from the beginning of t... | If this is about using the STFT, then it's about frames of audio (or whatever signal class) and, if it's about frames, it's about windows. Usually the windows we want are complementary, they add to 1. An example would be a Hann window.
So now imagine your sinusoid of an arbitrary frequency (mid bin or between bins o... | https://dsp.stackexchange.com |
1,839 | [
"https://mechanics.stackexchange.com/questions/1839",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/891/"
] | After being hit by Hurricane Irene last week, I happened to loose power for literally one week so rather than rely completely on batteries and being a nomad, I used my Cobra 400 watt power inverter (wired directly to my car battery such that I can keep it powered even without the key on accessory) on and off to power a... | As your father says, car batteries are designed for a burst of power (the high-current starter motor), not a steady stream. If you're going to use a battery a a general power supply, you need to get a "deep-discharge" battery, as designed for caravans/marine etc usage.
Constantly discharging/charging a normal car batt... | Using a 400 watt inverter for a week will not likely substantially harm your car battery. Car batteries, while designed for short, higher current "starts" can handle longer term loads. It is good to avoid draining them down so that they will not start the car, but you apparently did not drain the battery down substan... | https://mechanics.stackexchange.com |
67,237 | [
"https://stats.stackexchange.com/questions/67237",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/-1/"
] | I need to prove my hypothesis:
The relative impact of the direct ties on the project outcome decreases as the direct ties network grows.
So I have IV (network size) and DV (outcome). I have proved by regression that IV is a significant predictor over the DV. However, how can I prove that the effect decays as the IV ... | Let me begin with the caveat that I'm not a sampling person. I know sampling people, and they're all much smarter than I am, which says something about how simple I am or how non-"overly simple" sampling questions tend to be.
You can do something in-between manually enforcing near-equal distributions of donor amounts... | A simple random sample is ideal. You can always segment (or divide) your results based upon their characteristics after the fact.
A great way to divide your results is to just write a script. In python you write something like this:
<pre><code>for contact in contacts:
if random.randint(0,1) == 0:
add_cont... | https://stats.stackexchange.com |
445,596 | [
"https://physics.stackexchange.com/questions/445596",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/178787/"
] | I am having trouble understanding the total energy for a heavy spinning symmetric top (Gyroscope) on a friction-less surface.
I am trying to understand it via the Lagrangian of the gyroscope. My understanding from my university lecture notes is that on a normal surface with friction, the Lagrangian takes the form of: ... | Since Lagrangian mechanics only deals with conservative forces, friction here is only meant to convey a constraint on the system. Namely, whether the COM has translational motion along the plane on which the top sits.
In the case of a surface with friction the constraint is simply that <span class="math-container">$x... | In the frictionless case there are no net horizontal forces. The point of contact is only constrained from moving lower than the surface. The couple experienced by the top, if it is started in a leaning position, will apply a torque in the horizontal plane. The centre of mass will also accelerate vertically under gravi... | https://physics.stackexchange.com |
315,913 | [
"https://softwareengineering.stackexchange.com/questions/315913",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/109668/"
] | We have shipped our application. Now we have to do internationalization of the application shipping to 15 countries each country its own branded site.
We have many email templates and landing pages that need to get themed/branded e.g. color for header/buttons/icons, master images and logos etc...
As a developer I do ... | The literal answer to your question is "the product owner". The product owner is responsible for delivering valid stories with acceptance criteria to the team.
However, scrum is merely a framework to help teams learn to be self-directed. The rituals and practices are there to guide a team. At the end of the day, the ... | It is the job of the product owner and scrum master between them to ensure that the user stories on the backlog are in a state where they can be estimated by the development team. If that isn't happening (and "I need the current application branded" can't be estimated), then you need to be pushing the user stories back... | https://softwareengineering.stackexchange.com |
340,838 | [
"https://physics.stackexchange.com/questions/340838",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/72875/"
] | I understand that microwaves are able to heat water because their alternating electromagnetic fields flip water molecules (dipoles) up and down which increases the waters kinetic energy (thus increasing temperature).
Doesn't that mean the microwave photons are then losing energy due to law of the conservation of energy... | First, lets calculate the energy per photon for a 30 cm radiation:
$$E = \frac{hc}{\lambda} = \frac{(6.62\times10^{-34}\ {\rm Js})(3\times10^8\ {\rm m/s})}{30\times10^{-2}\ {\rm m}} = 6.62\times10^{-25}\ {\rm J}$$
That means that a 1000 W microwave oven is producing in the neighborhood of $1.5\times10^{27}$ photons p... | Typically, the microwave photon is absorbed by a water molecule, so any re-radiation you get out the other side wouldn't be the same photon anymore.
| https://physics.stackexchange.com |
124,714 | [
"https://security.stackexchange.com/questions/124714",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/112119/"
] | I have two servers with 2 web application in PHP, I need this server make a secure communication there is my scope:
I need to application 1 make a POST on application 2, but on application 2 I need to make sure that POST comes from the application 1.
Which is the best way to figure it?
I was thinking on some alterna... | <blockquote>
I need to application 1 make a POST on application 2, but on application 2 I need to make sure that POST comes from the application 1.
</blockquote>
For the purpose of this post, I'm going to call application 1 the <strong>Client</strong>, and application 2 is the <strong>Server</strong>.
Let's start with:... | Instead of "application 1" sending the data you could have "application 1" notify "application 2" that there is data to fetch and then "application 2" perfroms a fetch from "application 1".
In detail this might look like this...
<ul>
<li>"server 1" POSTs a URL... | https://security.stackexchange.com |
1,578,996 | [
"https://math.stackexchange.com/questions/1578996",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/296808/"
] | I'm given $A= \{3,4,2,5\}$ and $B = \{a,3,b,5\}$. The intersection is $\{3,5\}$ elements in common.
The union is $\{2,3,4,5,a,b\}$.
How can I represent this intersection and union algorithmically and on a flowchart?
| In what follows,
<pre><code>x in A
</code></pre>
can be taken as shorthand for
<pre><code>x == 2 or x == 3 or x == 4 or x == 5
</code></pre>
and similarly for <code>B</code>.
<strong>As flowcharts</strong>
<em>Union</em>
<pre><code> < x in A? >
No / \ Yes
... | Basic procedure (for intersection) looks like this in math symbols:
$$ x \in (A \cap B) \Leftrightarrow (x \in A) \And (x \in B) $$
For union it's
$$ x \in (A \cup B) \Leftrightarrow (x \in A) \| (x \in B) $$
| https://math.stackexchange.com |
412,498 | [
"https://softwareengineering.stackexchange.com/questions/412498",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/369766/"
] | I am working on some project to learn how to make bigger and better software (multiplayer game) and I found a problem about having in my code a design pattern <strong>Command Pattern</strong> and anti-pattern <strong>God Object</strong>. Often I do end up win the latter one and I know that Fascades are okay, but my und... | <strong>1. Commands are simply messengers.</strong>
A command is used to transport a "request to do something" from one part of your code to another. It should do very little besides passing on the request when asked to do so. A "magic spell" by itself is not a command, however "casting a spell... | Your problem seems to be that your command reaches <em>deep</em> into the innards of other objects, so there is minimal encapsulation. Also, some objects seem to be of technical nature (like <code>gameState</code>, <code>soundPlayer</code>, <code>specialEffectsPlayer</code>).
For object-orientation to make sense, you'l... | https://softwareengineering.stackexchange.com |
708,431 | [
"https://math.stackexchange.com/questions/708431",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/102158/"
] | <blockquote>
Let $a,b,c$ real numbers. Prove the inequality $|a-b| \leq |a-c| + |c-b|$. Prove that equality holds if and only if $a \leq c \leq b$ or $b \leq c \leq a$.
</blockquote>
I've tried starting with just $a \leq c$ and using field properties to reconstruct the inequality, however I haven't been able to make... | You could use the triangle inequality and the fact that you can write $|a-b|=|(a-c)+(c-b)|$.
| As others have pointed out, you should prove this by using the triangle inequality. I also think you should try to understand the problem intuitively so I drew a picture:<img src="https://i.stack.imgur.com/vjoac.png" alt="enter image description here">
$|a-b|$ represents the distance between the points $a$ and $b$ on ... | https://math.stackexchange.com |
187,445 | [
"https://softwareengineering.stackexchange.com/questions/187445",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/57674/"
] | I'll be specific: Java 8 is promised to bring lambda expressions as well as method and constructor references among other things. As a Java developer I'm super psyched about that.
In my day to day programming I see more and more opportunities where using these features would greatly simplify code that would otherwise ... | Don't fall for the chant of sirens.
Their song talks about new features and performance improvements, but all you get by listening to that, is a neverending stream of pain, delays, procrastination, and deployment woes.
Write for what <strong><em>exists</em></strong>. The rest is mere speculation.
| I agree with @ZJR's answer, but if you want to go ahead you can probably encapsulate this into a <code>MethodReference</code> class of some sort. With luck you might be able to gain type safety by juggling just one place when Java 8 comes along.
Boost basically does this before C++11. Certain features closely resemble... | https://softwareengineering.stackexchange.com |
167,162 | [
"https://electronics.stackexchange.com/questions/167162",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/50374/"
] | I have been using Eagle for quite a while now but there is one thing that continues to bother me while I am using it. I have made the ground plane cover the shape of the board, however, when I am making minor and frequent changes to the design I have to keep clearing this layer and then making the changes, rats-nesting... | According to the help system of eagle, you can use the command
<pre><code>RIPUP @;
</code></pre>
to ripup all polygons. You can limit this to polygons of a list of signals by
<pre><code>RIPUP @ GND VCC MYSIGNAL;
</code></pre>
You can define a keyboard shortcut for <code>RIPUP @;</code> and another for <code>RATSNES... | If you want to modify the polygon in EAGLE you can click the "split" button, like here:
<img src="https://i.stack.imgur.com/xukYu.png" alt="split">
What this will do is exactlly what the name implies it will split a line into two parts. You can split a line into as much as parts as you want to shape the polygon.
To ... | https://electronics.stackexchange.com |
60,462 | [
"https://physics.stackexchange.com/questions/60462",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/22918/"
] | I would be very grateful to whoever can debug the following calculations...
We have the metric for static spacetime: $$ds^2 = -\exp(2U(\vec x))dt^2+h_{ij}(\vec x) d x^i d x^j$$
I want to find the associated Christoffel symbols.
I know of 2 ways:
The <strong><em>first</em></strong> is to use the formula $$\Gamma^a_{b... | The first one is probably correct, and you are likely not counting correctly in the second method. You should compare you result
$\ddot{t}+ 2 \frac{\partial U}{\partial x^{i}} \dot{x}_i \dot{t}=0$
to
$\ddot{t}+ \Gamma^0_{\mu \nu} \dot{x}^\mu \dot{x}^{\nu}=0 $
or
$\ddot{t}+ \Gamma^0_{i 0} \dot{x}^i \dot{x}^{0}+ \... | Couple mistakes:
<ol>
<li>The second term in the metric should read $h_{ij}(\vec x)dx^idx^j$ not $h_{ij}(\vec x) \dot x^i\dot x^j$</li>
<li>The first term in the Langrangian should have $\dot t^2$ instead of $dt^2$ which means that in the equation after the Lagrangian you should have a $\dot t^2$, and (I redid the cal... | https://physics.stackexchange.com |
247,904 | [
"https://stats.stackexchange.com/questions/247904",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/81598/"
] | In school, I was taught about the normal approximation to the binomial, and it was suggested that I could use it effectively under some conditions, because it can be 'easier to calculate'.
I understand how this could be more convenient if I were using paper tables. Are there still advantages to using the normal appro... | I know of no reason to use the normal approximation to the binomial distribution in practice. There are a variety of exact algorithms that are more than good enough for general use, and these are what you get when you use the binomial RNGs from R, SciPy, etc. The only good reason I can think of to discuss the method in... | The central limit theorem provides the reason why the normal can approximate the binomial in sufficiently large sample sizes. Sufficiently large depends on the success parameter <span class="math-container">$p$</span>. When <span class="math-container">$p=0.5$</span>, the binomial is symmetric and so the sample size ... | https://stats.stackexchange.com |
35,155 | [
"https://physics.stackexchange.com/questions/35155",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/1502/"
] | It´s usual to read in QFT books of how it is "easier" to have a canonically normalized kinetic term. So, for instance:
$${\cal L} = {1 \over 2 }\partial_{\mu} \phi \partial^{\mu}\phi - {1 \over 2 } m^2 \phi \phi - {\lambda \over 4!} \phi^4$$
is canon. And:
$${\cal L}_2 = \partial_{\mu} \phi \partial^{\mu}\phi - ... | First note that the canonical normalization actually has a factor of 1/2 in front of the kinetic and mass terms, and that the sign of the mass term should be reversed. So I'll consider the Lagrangians $\mathcal{L}=\frac{1}{2}((\partial \phi)^2-m^2\phi^2)-\frac{\lambda}{4!}\phi^4$ and $\mathcal{L}_2=(\partial \phi)^2-m^... | Classically, multiplying the Lagrangian by a constant does nothing of course. Quantum mechanically, multiplying the Lagrangian by a constant is equivalent to changing the Planck constant. If you kept the Planck constant explicit in all calculations this would be more obvious, but people usually define it as 1 and hid... | https://physics.stackexchange.com |
359,695 | [
"https://softwareengineering.stackexchange.com/questions/359695",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/63690/"
] | I have seen proponents of isolating data management and storage into microservices in a way that each microservice has its own data store (at least in a logical sense). Hence, joins and aggregations are made in the application layer.
Why is this better than using, for example, a relational database where different mic... | A big advantage that a Microservices architecture has is that each service can be safely developed, tested and deployed independently. Having services share a database undermines this as it allows subtle changes in one service to introduce failures in other services, e.g.
<ul>
<li>One service might start writing data ... | Assume your software is large enough that several, largely independent teams work on it. You can have one database for everyone or one database per team.
One database for everyone allows you to use database features for queries, but most importantly, you can rely on database consistency because your database handles ... | https://softwareengineering.stackexchange.com |
554,973 | [
"https://electronics.stackexchange.com/questions/554973",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/279771/"
] | Given [15:0] number (there is no fractional part, only integer). How do I truncate lower two bits [1:0] and round it off to closest possible value. Consider a case where no overflow happens. Need to do it in verilog.
input [15:0] A;
output [13:0] B;
| To implement rounding, you'll need an incrementer (add 1) for the round-up case.
Let's assume the rounding behavior you want is as follows:
<ul>
<li>lsb's = 0,0: truncate (round down)</li>
<li>lsb's = 0,1: truncate (round down)</li>
<li>lsb's = 1,0: round up</li>
<li>lsb's = 1,1: round up</li>
</ul>
The Verilog would l... | I would try something like this:
<pre><code> wire [15:0] C;
assign C = A+2; //rounding offset
assign B = {C[15:2]}; //drop 2 trailing bits
</code></pre>
A=1 => C=3 => B=0
A=2 => C=4 => B=1
A=3 => C=5 => B=1
This would of course round up on a tie; to round down, change the 2 to 1.... | https://electronics.stackexchange.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.