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
366,000
[ "https://softwareengineering.stackexchange.com/questions/366000", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/65549/" ]
Please see the code below: <pre><code> public sealed class UKCurrency : ICurrency { private static readonly int _decimalPlaces=2; private static readonly decimal[] _denominations = new decimal[] { 50.00M, 20.00M, 10.00M, 5.00M, 2.00M, 1.00M, ...
I don't see any need for your <code>DenominationCounter</code> object. It's purpose is to provide an <code>IEnumerable&lt;(decimal, int)&gt;</code> (I've simplified your data type to use a tuple) via <code>CalculateDenominations</code>. But that method is completely deterministic in nature. You are achieving nothing u...
You don't have two different value objects. You have a value object and a fancy array. You probably need to combine a lot of UKCurrency and DenominationCounter. It's not wrong for a value object to validate that its dependencies are valid even if they are other value objects, but both objects need to be valuable indepe...
https://softwareengineering.stackexchange.com
295,442
[ "https://physics.stackexchange.com/questions/295442", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/56704/" ]
The one-particle solution to the particle-on-a-ring problem is $\psi_m(\phi_j) = \frac{1}{\sqrt{2\pi}}\exp\left(-im \phi_j\right)$ for $m=0, \pm 1, \pm 2, \cdots$ corresponding to energies $E_m = \frac{m^2\hbar^2}{2I}$ where $I=MR^2$ is the moment of inertia. I'm interested in the spatial wavefunction for two electron...
I think I have an answer to your question, assuming I understood what you are asking. Therefore I will express the question <em>as I understand it</em> and answer that question – and hopefully this will answer yours too. First though, I’m going to assume a static situation where charges are always at rest, or moving ve...
I'm not sure whether this answers the question you're asking because I'm not 100% sure what you're asking. But if I guessed your question right, the apparent dilemma is resolved conceptually when you consider the effects of accelerating a charged particle. Suppose you're a proton, and you feel the tug of attraction of...
https://physics.stackexchange.com
45,660
[ "https://softwareengineering.stackexchange.com/questions/45660", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/10208/" ]
I'm a long time programmer in C# but have been coding in Python for the past year. One of the big hurdles for me was the lack of type definitions for variables and parameters. Whereas I totally get the idea of duck typing, I do find it frustrating that I can't tell the type of a variable just by looking at it. This is ...
As of Python 3, you <em>can</em> annotate at least function parameters and return values with types: <pre><code>def foo(task: 'task') -&gt; 'bool': pass </code></pre> The type annotation can be any valid Python expression. In this case I used strings, but you can just as well use integers, dicts, lists, or&nbsp;&...
<blockquote> I can't tell the type of a variable just by looking at it. </blockquote> Why would you need to? <blockquote> ambiguous names for method parameters. </blockquote> Not sure what this could possibly mean. You'll have to provide examples. <blockquote> I've added asserts to ensure parameters comply w...
https://softwareengineering.stackexchange.com
277,606
[ "https://stats.stackexchange.com/questions/277606", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/73335/" ]
My goal to implement a neural net which outputs a range of values with an additional restriction: based on an input value selected among the features, certain output values will be forbidden. For example, suppose an input value is in the range 1 to 100. The output would be forced to be greater than the input value bu...
One way to code such constraints is using something akin to an SVM hinge loss. For $f_i(x)$ be greater than $x_i$, this is morally equivalent to adding a loss term $\alpha_i\max(x_i-f_i(x),0)$, where $\alpha_i$ is a hyperparameter. To make this more stable, typicall you'd add a separation hyperparameter: $\alpha_i\max(...
To restrict your output to a simple inequality as x>=0, you could use a relu activation in your last layer. If the lower limit is different from zero, you could tweak it in the custom loss. For an interval constraint, you could use a similar idea and the sigmoid function.
https://stats.stackexchange.com
169,960
[ "https://softwareengineering.stackexchange.com/questions/169960", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/68815/" ]
I'm developing an app that will be used to open and close valves in an industrial environment, and was thinking of something simple like this:- <pre><code>public static void ValveController { public static void OpenValve(string valveName) { // Implementation to open the valve } public static v...
If each instance of the valve object would run the same code as this ValveController, then it seems like multiple instances of a single class would be the right way to go. In this case just configure which valve it controls(and how) in the valve object's constructor. However if each valve control needs different code ...
My major gripe is using strings for the parameter identifying the valve. At least create a <code>Valve</code> class which has a <code>getAddress</code> in the form the underlying implementation needs and pass those to the <code>ValveController</code> and ensure that you can't create nonexistent valves. This way you wo...
https://softwareengineering.stackexchange.com
211,805
[ "https://stats.stackexchange.com/questions/211805", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/60316/" ]
I want to estimate a classifier accuracy on benchmark data. Data is not split into training and testing so I use 5-fold cross validation, using 80% of data as training and testing on 20%. Each test is repeated 20 times, so in total there are 100 runs (20 test runs * 5 tests on each fold) Accuracy is defined as number o...
How to calculate standard deviation depends on which standard deviation you need. Your results are subject to (at least) 2 differenct sources of variance: <ul> <li>variance due to the actual sample you have (finite test set)</li> <li>variance due to the differences in the surrogate models (model instability)</li> <...
Usually you calculate the performance metrics over all repeats of all partitions, so in your case, over your 5x20 = 100 partitions. Be aware that by repeating the processing that is done on your 5 partitions, it makes sense to redo the partitioning itself as well. So the 5 partitions are likely not the same for the rep...
https://stats.stackexchange.com
286,047
[ "https://softwareengineering.stackexchange.com/questions/286047", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/182686/" ]
I recently discovered SOLID principles and i'm trying to learn how to properly apply them. I have an application that had a huge interface: <pre><code>public interface NotificationService { public void sendNewProjectRequestNotificationToDesigners(String projectId); public void sendNewProjectAcceptedNotificationTo...
No, the qualifiers are just a hint to your dependency injection system. They're more configuration than code. You are still accessing the beans only though the <code>NotificationSender</code> interface, so your code doesn't know any more about the implementation details of the different instances. Imagine you were uni...
Well you could add another layer of indirection by using a factory and injecting the concrete classes into the factory, then injecting the factory where you need the concrete classes. The factory could have a method to which the caller is passed, and then the factory could figure out what to return based on that.
https://softwareengineering.stackexchange.com
6,801
[ "https://scicomp.stackexchange.com/questions/6801", "https://scicomp.stackexchange.com", "https://scicomp.stackexchange.com/users/4060/" ]
I would like to find the analytical form of the point which minimizes the following function: $$ f(x_T) = \frac{1}{T} a_1 (x_T-x_0)^2 + a_2 |x_T-x_0| + T a_3 + \sum_{i=1}^M p_i \left[b_{1i} (x_T - l_i)^2 + b_{2i} |x_t - l_i| + b_{3i} \right] $$ where $T,a_1,x_0,a_2,a_3,p_i,b_{1i},l_i,b_{2i},b_{3i}$ are constants, $T,...
Eigenvector solutions to the standard eigenvalue problem formulation ($A\mathbf{v}=\lambda\mathbf{v}$) are unique up to a constant multiplier. It is clear that if there exists an eigenvector solution $\mathbf{v_a}$ which satisfies $A\mathbf{v_a}=\lambda\mathbf{v_a}$, then for any real\complex scalar $k$, $\mathbf{v_b}=...
The other answers suggest normalizing eigenvectors so that their first component is positive, but this seems bad advice to me: if the computed eigenvectors are <code>v = (1e-17, 1)</code> and <code>w =(-1e-17, 1)</code>, then normalizing them to <code>v_n = (1e-17, 1)</code> and <code>w_n =(1e-17, -1)</code> and checki...
https://scicomp.stackexchange.com
252,949
[ "https://stats.stackexchange.com/questions/252949", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/98646/" ]
When a metric is computed for a trained model with <code>nfolds</code> greater than 1 in h2o, what is the value when `xval=TRUE' ? <pre><code>h2o.mse(model, xval=TRUE) </code></pre> Here is my read and please correct me if I'm off. If <code>nfolds</code> is 3, it is doing 3-fold cross validation to select the best mo...
FDRs are commonly much greater than p-values, and recall the lowest FDR value represents a list of features and not one feature, like a p-value does. So if the lowest value of FDR is for example 0.15 for a list of 15 features(genes), then at the very least you have to publish the list and state that the FDR is 0.15. ...
In my experience, there is no such thing on what the "best" FDR is. The "best" FDR depends on your desired statistical power and type I error. In genetics, FDR 0.05 is common, but this is not mandatory. When you report your results, you should make FDR to 0.1 or 0.05 unless you have a good reason not to. Your report ...
https://stats.stackexchange.com
384,731
[ "https://softwareengineering.stackexchange.com/questions/384731", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/324609/" ]
I was just thinking about implementing a binary tree with its root pointing to the parent folder and then the children pointing to subdirs nested within to store a directory structure in a binary tree. I am not sure how to cater this problem with binary trees or if its possible? M-way trees seems like the correct way ...
Sufficient effort <em>can</em> make most things work, but I personally <em>probably</em> wouldn't use a plain binary tree for this in the future, and never have in the past. Here's an outline of the options as I see them: <ol> <li>Simplest binary tree approach: each directory has no more than one direct parent directo...
You can decide to implement it based on a rule that: Moving to a left child of a node signifies: <ul> <li>in case of a directory node "execute" it and move down its' structure.</li> <li>in case of a file node its' content or a repr of it.</li> </ul> Moving to a right child of a node still signifies directories/files ...
https://softwareengineering.stackexchange.com
568,190
[ "https://physics.stackexchange.com/questions/568190", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/27732/" ]
Let's say I have some Lorentz-violating theory. For concreteness we could imagine a scalar field <span class="math-container">\begin{equation} S=\int {\rm d}^4 x \left(-\frac{1}{2} (\partial \phi)^2 + V(x)^\mu \partial_\mu \phi\right) \end{equation}</span> where <span class="math-container">$V(x)^\mu$</span> is some sp...
If I understand the question correctly, then your question is more general than relativity. For example, you can ask the same question about rotations in a non-relativistic theory. In the spirit of trying to address the problem in the simplest situation possible, allow me to even downgrade to regular particle quantum m...
If we want to describe the real world, QFT (quantum field theory) should respect the apparent symmetries of our universe. One symmetry is the translation invariance, another symmetry is the Lorentz invariance, which compound the Poincaré group ISO(1,3), the isometry group of Minkowski space. Formally <span class="math-...
https://physics.stackexchange.com
507,730
[ "https://stats.stackexchange.com/questions/507730", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/310126/" ]
I am confused about how to disprove a kernel function like <span class="math-container">$k(x,y) = x_1y_1-x_2y_2$</span>. The method mentioned in the book is to create a Kernel Matrix with all the data. But here I do not have any data. I tried to use counterexample but failed. Could someone tell me how to disprove it? O...
I finally found the counterexample below <span class="math-container">$$ x=[2,\sqrt3]^T, y=[3,3]^T, a=[-1,1]^T $$</span> With the entries,<br /> <span class="math-container">$$ a^TKa&lt;0 $$</span> can prove the kernel matrix is not positive semidefinite. Therefore k(x,y) is not a valid kernel.
Hint: Kernel is generalised scalar product. For any real vector <span class="math-container">$a$</span>: <span class="math-container">$a \cdot a \ge 0$</span>.
https://stats.stackexchange.com
3,231,392
[ "https://math.stackexchange.com/questions/3231392", "https://math.stackexchange.com", "https://math.stackexchange.com/users/675350/" ]
<span class="math-container">$$\int \frac{x^2+(n(n-1))}{(x\sin x +n\cos x)^2 } dx$$</span> I know this is an homework problem, but I really couldn't think of any way to solve it. Like DI Method (No go) , What kind of substitution as denominator is trigonometric whereas Numerator is algebric. Thought of n(n-1) can come ...
<span class="math-container">$$I=\int\frac{x^2+n(n-1)}{(x\sin x+n\cos x)^2}dx$$</span> Put <span class="math-container">$x=n\tan \theta\;\;dx=n\sec^2\theta d\theta$</span> <span class="math-container">$$I=\int\frac{n^2\tan^2\theta+n^2-n}{(n\tan\theta\sin(n\tan \theta)+n\cos(n\tan \theta))^2}\cdot n\sec^2\theta d\thet...
<span class="math-container">$I = \int\frac{x^2 + n(n-1)}{(x\sin x + n\cos x )^2}dx$</span> Now we'll try to convert it into the form of <span class="math-container">$\frac{a}{y} + \frac{b}{y^2}$</span>, where <span class="math-container">$a,b$</span> are functions of <span class="math-container">$x$</span> and <span...
https://math.stackexchange.com
16,510
[ "https://electronics.stackexchange.com/questions/16510", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/4861/" ]
What is a good decent power supply noise? Let me expand, two cases, I have a bench top PSU, I put my scope in AC coupling and look at the ripple it is around 20mV. Is this a good number for a decent PSU? (I am fiddling with ANalog circuits so 20mV noise is big deal) Second case is my on board regulator, I have a boo...
There is of course no single answer to what "decent" power supply noise is. That's like asking what a decent car is without telling us whether its for driving around a racetrack or back country dirt roads. Whether the values you mention are decent depends on how that power rail will be used. What you really seem to ...
I designed an extremely low-power PSU before, so let me share a graph I made for a presentation where I outlined the difference in noiselevels of various PSUs. The graph shows the logarithmic noiselevel as a function of frequency from DC to 50 kHz. I don't remember how the scale on the Y-axis is offset but you can get ...
https://electronics.stackexchange.com
42,756
[ "https://quant.stackexchange.com/questions/42756", "https://quant.stackexchange.com", "https://quant.stackexchange.com/users/34879/" ]
I have some questions on VWAP(volume weighted average price): 1) I understand that it gives the average trade price of an asset for a specific time period but why is it beneficial to know this when executing trades? 2) How would one base their trade execution decisions on VWAP?(Please would you explain it for an orde...
Big institutional investors buy and sell large amounts of stock in a variety of ways (through different brokers, using different procedures, tempos, etc.). They are interested in judging the ex-post "quality of execution" , i.e. how good a price they are getting when buying and selling. Even being consistently off by ...
1) I understand that it gives the average trade price of an asset for a specific time period but why is it beneficial to know this when executing trades? It is basically a benchmark of how good where the execution of your trades. 2) How would one base their trade execution decisions on VWAP?(Please would you explain ...
https://quant.stackexchange.com
82,000
[ "https://dba.stackexchange.com/questions/82000", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/10832/" ]
The "Lock Pages in Memory" right can be granted to the service account used by SQL Server. This allows SQL Server to prevent memory being paged to disk. I've noticed several of our SQL Server machines do not have the local policy configured to allow this right for the service account used by SQL Server. Since we hav...
If <code>xp_cmdshell</code> is an option, here is a script making use of <code>whoami</code>: <pre><code>DECLARE @LockPagesInMemory VARCHAR(255); SET @LockPagesInMemory = 'UNKNOWN'; DECLARE @Res TABLE ( [output] NVARCHAR(255) NULL ); IF (SELECT value_in_use FROM sys.configurations c WHERE c.name = 'xp_cmd...
There are other methods as well. Perhaps you can use two DMVs. Please note that both will only work for SQL Server 2008 and above. A non zero value for <code>locked_page_allocations_kb</code> would tell you that SQL Server account has Locked pages in memory privilege. <pre><code>select osn.node_id, osn.memory_nod...
https://dba.stackexchange.com
603,154
[ "https://electronics.stackexchange.com/questions/603154", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/278902/" ]
I am designing a board that will need 3.3 V, 2.8 V, 1.5 V, and ideally 1.2 V rails. The board will be powered by a 12 V power supply so for stepping from 12 V to 3.3 V I am planning on using a buck converter for efficiency, but since stepping from 3.3 V to 2.8 V is much smaller, I was thinking about just using a linear...
The contacts are manufactured in strips with a space between every 5 where they cut them apart to make the main contacts, then they use the same strips for the power rails and cut them to whatever length they need for the size of breadboard.
So some amateur doesn't try to insert an IC between the working area and the power rail. It was done on purpose.
https://electronics.stackexchange.com
262,794
[ "https://math.stackexchange.com/questions/262794", "https://math.stackexchange.com", "https://math.stackexchange.com/users/53124/" ]
Let $\theta(s):\mathbb{C}\to \mathbb{R}$ be a well defined function. I define the following relation in $\mathbb{C}$. $\forall s,q \in \mathbb{C}: s\mathbin{R}q\iff\theta(s)\ne 0 \pmod {2\pi}$ (and) $\theta(q)\ne 0 \pmod {2\pi}$ The function $\pmod {2\pi}$ is the addition $\pmod {2\pi}$ My question: Is this an e...
Your relation is $$sRq\iff \theta(s)\not \equiv 0\text{ and }\theta(q)\not \equiv 0 \mod 2\pi$$ for $s,q\in \mathbb{C}$. For symmetry: $$sRq\iff \theta(s)\not \equiv 0\text{ and }\theta(q)\not \equiv 0 \mod 2\pi \iff qRs$$ For transitivity: $$sRq\text{ and }qRp\iff \theta(s)\not \equiv 0\text{ and }\theta(q)\not \equ...
It is not an equivalence relation if there exists $x$ such that $\theta(x) = 0 \mod 2\pi $. You need reflexivity, so if $x$ satisfies $\theta(x) = 0 \mod 2\pi $, then you do <strong>not</strong> have $x R x$, hence it is not an equivalence relation.
https://math.stackexchange.com
155,429
[ "https://dba.stackexchange.com/questions/155429", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/41748/" ]
I want to update all records in my database table with a fixed value for <code>pwDays</code> and an increasing value in <code>pWDate</code>. My current statement: <pre><code>update [POSUSER] set passDays = '60', passChangeDate = '2017-01-01 00:00:00' </code></pre> But I do not want all users to have to reset their p...
Since you have a primary key <code>userid</code>, you can do it with a query like : <pre><code>update p set passDays = '60', passChangeDate = dateadd(dd, offset, '2017-01-01 00:00:00') from [POSUSER] p join ( select userid, row_number() over(order by userid) / 10 as offset from [POSUSER] ...
I think this is the most simple way to do it. <pre><code>update [POSUSER] set passDays = '60', passChangeDate = DATEADD(day, (userid % 10) ,'2017-01-01 00:00:00') </code></pre> So you get 10 different days for all users to reset their password due to the modules 10. If you want to spread it over 20 days, use userid %...
https://dba.stackexchange.com
447,631
[ "https://stats.stackexchange.com/questions/447631", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/272580/" ]
Why are the number on a ball in a lotto draw categorical nominal instead of categorical ordinal? Don't the numbers have a natural ascending order and would thus be ordinal? Or am I making an incorrect assumption about numbers having a natural order?
You could color-code the balls without fundamentally changing the game. Instead of 6-12-11, we get red-blue-pink. You could go with letters without fundamentally changing the game. Instead of 6-12-11, we get Y-Q-X. You could use animal drawings without fundamentally changing the game. Instead of 6-12-11, we get dog-f...
The lines between the different types of variables are not as clear cut as we often define them. In many cases, the classification of a variables depends on how we use that variable instead of on the fundamental properties of the variable itself. Age in years and time measured in any fixed unit (days, hours, seconds) a...
https://stats.stackexchange.com
294,017
[ "https://softwareengineering.stackexchange.com/questions/294017", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/37393/" ]
I'm building a service on top of Google App Engine Datastore, which is an eventually consistent data store. For my application, this is fine. However, I'm developing tests that do things like PUT object and then GET object and checking properties on the returned object. Unfortunately, because the datastore is eventual...
Consider non-functional requirements when designing your functional tests -- if your service has a non-functional requirement of "Consistent within x (seconds/minutes/etc)", simply run the PUT requests, wait x, then run the GET requests. At that point, if the data has not 'arrived' yet, you can consider the PUT reques...
Use one of the following: <ul> <li>After PUT, retry GET N times until success. Fail if no success after N tries.</li> <li>Sleep between PUT and GET</li> </ul> Unfortunately, you have to pick magic values (N or sleep duration) for both of these techniques.
https://softwareengineering.stackexchange.com
131,088
[ "https://stats.stackexchange.com/questions/131088", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/64816/" ]
I've trained a neural network with two inputs, a single hidden layer with two neurons, and one output using a bipolar sigmoid activation function. If a single input is known, how would I determine the second input to create a desired output? For example, let's say the neural network is trained to add two inputs to pro...
I'm no expert in this field, so I might be wrong. Therefore, correct me if I'm wrong. consider this neural network (which I suppose is equivalent to yours): <pre><code>A---H1 \ / \ X C / \ / B---H2 </code></pre> consider that the activation function of H1, H2 and C is the bipolar sigmoid, to which we'll ref...
The answer is simple: backpropagation. Say you have a trained net $f$ which maps some $x$ to some $y$, which you'd ideally want to be $z$. You then use a different loss, which is the deviation from $y$ to $z$, e.g.: $$ \mathcal{C} = ||z - y||_2^2. $$ In back propagation, you typically follow the gradient of the loss...
https://stats.stackexchange.com
95,080
[ "https://security.stackexchange.com/questions/95080", "https://security.stackexchange.com", "https://security.stackexchange.com/users/81653/" ]
I'm looking to do file encryption for small amounts of text (8-100 characters for each item being encrypted). Here's what I have: <ul> <li>A secret passphrase and a salt.</li> <li>I Use Rijndael to generate a key and iv when encrypting text.</li> <li>I use the key+iv to encrypt the text.</li> <li>I store the iv+encryp...
Yes, this is insecure. It might pass audit if nobody checks, but it is very insecure. In any case, your method doesn't save you a whole lot, because you still have a key management nightmare of determining which year to use for which entries (unless you are basing it off of modified date, which is a bad idea). You ...
The first thing that comes to mind is that once someone knows one password, they know all past and future passwords, too. The idea behind changing them yearly is to counter that problem if someone ends up cracking the passphrase, but it also provides at least a little protection against past employees who may have had...
https://security.stackexchange.com
602,287
[ "https://physics.stackexchange.com/questions/602287", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/141565/" ]
Given a Dirac field <span class="math-container">$$\Psi(x):=\int\frac{d^4k}{(2\pi)^4}\delta\left(p_0-\omega(\mathbf{k})\right)\sum_s\left(a_s(k)u_s(k)e^{-ikx}+b^\dagger_s(k)v_s(k)e^{ikx}\right)$$</span> with the creation operators <span class="math-container">$a^\dagger_s(k),b^\dagger_s(k)$</span> for particles and ant...
Ah I think I understand your question now and I think this is a simple notational issue. The single particle states for the particles and antiparticles should be denoted differently, i.e. trying to be as close to your notation would give something like <span class="math-container">$$|k,s\rangle \equiv a^\dagger_s(k)|0\...
It is <em>not</em> true that <span class="math-container">$a^\dagger_s(k)|0\rangle=b^\dagger_s(k)|0\rangle$</span>. Moreover, the notation <span class="math-container">$|k\rangle $</span> is ambiguous. There is the state <span class="math-container">$|k,s\rangle =a^\dagger_s(k)|0\rangle$</span> containing one <em>parti...
https://physics.stackexchange.com
524,241
[ "https://stats.stackexchange.com/questions/524241", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/147940/" ]
I want to fit a Gaussian <span class="math-container">$q$</span> to a pdf <span class="math-container">$p$</span> by minimizing the energy <span class="math-container">$E = -\int q(x) \log p(x) dx$</span>. This should result in a &quot;delta function&quot; Gaussian with <span class="math-container">$\sigma \rightarrow ...
The last expectation isn't 0. For example, suppose you approximate <span class="math-container">$\log p$</span> with a linear function around <span class="math-container">$\mu$</span>: <span class="math-container">$\log p \approx (x-\mu)^Tw+c$</span>. Then you have: <span class="math-container">$$ \begin{align} &amp;\m...
To get some intuition for this problem, write the energy as a moment: <span class="math-container">$$E(\mu,\sigma) \equiv \mathbb{E}(-\log p(X) | X \sim \text{N}(\mu, \sigma^2)).$$</span> Taking <span class="math-container">$\sigma=0$</span> and <span class="math-container">$\mu=x^*$</span> (where the latter is the mod...
https://stats.stackexchange.com
277,615
[ "https://mathoverflow.net/questions/277615", "https://mathoverflow.net", "https://mathoverflow.net/users/111049/" ]
I understand that the top Stiefel Whitney class is an obstruction for the tangent bundle of a manifold to have a trivial line sub-bundle. I am looking for a counterexample when removing the word "trivial", i.e: A compact manifold $M$ of dimention n such that $w_n(TM)\neq0$ (or equivalently $\chi(M)$ is odd) and there e...
I believe there is no example satisfying all your constraints. If I recall (my memory is a little foggy on this) the result likely goes back to Hopf, and one of his variations on the Poincare-Hopf index theorem. This question might be addressed in the Milnor and Stasheff text. Here is one way to argue the point. Say...
Let $\gamma$ be the canonical (real) line bundle over $RP^2$. In other words, $w_1(\gamma)\neq 0$. The total Stiefel-Whitney class of the Whitney sum $\gamma\oplus\gamma$ is $(1+w_1(\gamma))^2=1+w_1(\gamma)^2$. So $w_2(\gamma\oplus\gamma)=w_1(\gamma)^2$ which is nonzero.
https://mathoverflow.net
3,343,752
[ "https://math.stackexchange.com/questions/3343752", "https://math.stackexchange.com", "https://math.stackexchange.com/users/2333/" ]
Say for a moment two people each have a single die. One has <span class="math-container">$m$</span> sides while the other has <span class="math-container">$n$</span> sides. Assuming the dice are each fair (as in, each die has an equal chance to roll any side... obviously if <span class="math-container">$m &gt; n$</span...
The number of outcomes where player <span class="math-container">$M$</span> beats (or ties) player <span class="math-container">$N$</span> is given by the sum <span class="math-container">$$\sum_{i=1}^{n}\sum_{j=i}^m1 = \sum_{i=1}^{n}(m-i) = mn - \sum_{i=1}^{n}i = mn-\frac{n(n+1)}{2}.$$</span> Dividing through by the t...
Assuming "winning" means having a greater number than the other player. Die <span class="math-container">$n$</span> has sides <span class="math-container">$1,2,3,...,n$</span> and die m has sides <span class="math-container">$1,2,3,...,m$</span>. We can treat this as a probability tree, starting with <span class="math...
https://math.stackexchange.com
618,313
[ "https://physics.stackexchange.com/questions/618313", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/218992/" ]
Suppose I have a metric <span class="math-container">$\mathrm{d}s^2 = (c\mathrm{d}t)^2 - \mathrm{d}x^2 - (A\mathrm{d}y)^2 -\mathrm{d}z^2$</span>, with A a constant (larger than zero and independent of <span class="math-container">$x,y,z,t$</span>). Suppose I have a collection of identical measuring sticks. Suppose that...
This is a good opportunity to discuss and illustrate how coordinate representations of tensorial objects can really obscure their true nature. <blockquote> Suppose I have a metric <span class="math-container">$\mathrm ds^2=(c\mathrm dt)^2−\mathrm dx^2−(A\mathrm dy)^2−\mathrm dz^2$</span>, with <span class="math-contain...
For your calculations, we'd assume you are looking at a fixed time slice. Of course, putting the sticks along the axes would take some time, but your metric is static(it's components are independent of time) thus it won't matter. So, <span class="math-container">$dt=0$</span>. Thus the cross terms (<span class="math-co...
https://physics.stackexchange.com
82,379
[ "https://mathoverflow.net/questions/82379", "https://mathoverflow.net", "https://mathoverflow.net/users/15887/" ]
A (finite dimensional) algebra is called biserial, if the radical of each projective indecomposable left/right module is the sum of two uniserial modules whose intersection is either trivial or simple. It is known that a certain subclass of algebras (called gentle algebras) is closed under derived equivalence. What a...
The answer to your question is no, in general. A simple counterexample is provided by a path algebra of the Dynkin quiver $D_4$ and another algebra tilted from it. That is, let $A$ be the path algebra where the quiver $D_4$ is oriented so that the vertex of degree 3 is a source and let $B$ be the quotient of the path...
Gentle algebras can all be described as path algebras with relations of length $2$, so let's try something with a length $3$ relation. If you take $k A_4$ with a length $3$ relation you get an algebra derived equivalent to $k D_4$. The first algebra is special biserial, while the other is not biserial. There is a nic...
https://mathoverflow.net
261,008
[ "https://stats.stackexchange.com/questions/261008", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/147413/" ]
In terms of neural network lingo (y = Weight * x + bias) how would I know which variables are more important than others? I have a neural network with 10 inputs, 1 hidden layer with 20 nodes, and 1 output layer which has 1 node. I'm not sure how to know which input variables are more influential than other variables. ...
<strong>What you describe</strong> is indeed one standard way of quantifying the importance of neural-net inputs. Note that in order for this to work, however, the input variables must be normalized in some way. Otherwise weights corresponding to input variables that tend to have larger values will be proportionally ...
A somewhat brute force but effective solution: Try 'droping' an input by using a constant for one of your input features. Then, train the network for each of the possible cases and see how your accuracy drops. Important inputs will provide the greatest benefit to overall accuracy.
https://stats.stackexchange.com
203,799
[ "https://dba.stackexchange.com/questions/203799", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/9956/" ]
I need to set a custom order sequence for categories when adding new ones, and changing existing ones. I believe the code and sql query will be the same in both scenarios. In my <code>webshop_categories</code>-table I have a <code>so</code>-column (sorting order INT) that I uses to determen which order the categories s...
<strong>Add new category :</strong> <pre><code> $t_cat = 'jeans';//new category to insert $so_to_set = 2;// so for new category </code></pre> First update all <code>so</code> greater than or equal to <code>$so_to_set</code> <pre><code> $query = "update categaries set so = so+1 where so &gt;= $so_to_set"; <...
Ordering should be performed with step greater than one. I prefer the step equal to 10 for better visual representation. Main idea that new item always can be inserted with SO=N+1 that is normally unused. Say, you have inserted something in between 30 and 40, then your <code>so</code> sequence now look like that: 10-20...
https://dba.stackexchange.com
139,319
[ "https://softwareengineering.stackexchange.com/questions/139319", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/6001/" ]
I am using PetaPoco micro-ORM. It is indeed very easy and secure to work with databases using ORM tools, but the only thing I hate is extra code. I used to put most of the code in the database itself and use all the RDBMS features like Stored Procedures, Triggers etc., which it is built to handle better. I want to kn...
ORMs(Object-relational mapping) are not mutually exclusive with Stored Procedures. Most ORMs can utilize stored procedures. Most ORMs generate Stored Procedures if you so choose. So it the issue is not either or. ORMs may generate unacceptable SQL (in terms of performance) and you may sometimes want to override that S...
ORMs <em>often</em> assume that the database exists to serve the ORM. But usually the database exists to serve the company, which might have hundreds and hundreds of apps written in multiple languages hitting it. But it's only a case of "ORM vs. Stored Procedures" if you're using an ORM that can't call a stored proced...
https://softwareengineering.stackexchange.com
262,706
[ "https://mathoverflow.net/questions/262706", "https://mathoverflow.net", "https://mathoverflow.net/users/94363/" ]
How to prove the inequality <span class="math-container">$a^6+b^6 \geqslant ab^5+a^5b$</span> for all <span class="math-container">$a, b \in \mathbb R$</span>?
This looks like a better fit for Math Stackexchange, because it's the kind of thing one learns from Olympiad problem books . . . One standard approach that has not been mentioned yet: We may assume $a,b$ are both positive (if one is zero it's easy; if they're of opposite sign then ${\rm LHS} &gt; 0 &gt; {\rm RHS}$; a...
Follows from Hölder's inequality (p=6, q = 6/5): $ab^5 + ba^5 \le (a^6+b^6)^{1/6} (b^6+a^6)^{5/6}$
https://mathoverflow.net
3,932,953
[ "https://math.stackexchange.com/questions/3932953", "https://math.stackexchange.com", "https://math.stackexchange.com/users/201051/" ]
Evaluate <span class="math-container">$S=\frac{1}{2} - \frac{1}{3\times 1!} +\frac{1}{4\times 2!} -\frac{1}{5\times 3!} +\ldots$</span> up to infinity. I am not able to plug in the exponential series. Please help
Looks all fine. You can solve the equation straightforward. <span class="math-container">$\log_4(x-1)+1=0$</span> <span class="math-container">$\log_4(x-1)=-1$</span> Writing both sides into the exponent with base <span class="math-container">$4$</span>. <span class="math-container">$4^{\log_4(x-1)}=4^{-1}$</span> <spa...
Let <span class="math-container">$x$</span>-intercept (intersection of curve with <span class="math-container">$x$</span>-axis) of <span class="math-container">$y(x)=\log_{4} (x-1)+1$</span> be <span class="math-container">$(a,0)$</span>. This means to find <span class="math-container">$a$</span>, one has to solve <spa...
https://math.stackexchange.com
20,032
[ "https://dsp.stackexchange.com/questions/20032", "https://dsp.stackexchange.com", "https://dsp.stackexchange.com/users/11588/" ]
As known, we can get a 'phase spectrum' from the DFT of a input signal. Assume, we do a DFT on a given equal interval sampled 50Hz AC signal, the signal is a complete whole cycle, but the start sample point may at any point. And I get the amplitude and phase from the DFT, but what's the reference point of the phase?
They <em>both</em> define the amount of data you can get through a channel -- the channel bandwidth, together with the SNR, defines the channel capacity $C$, which has the unit of $\frac{\mathrm{bit}}{\mathrm{s}}$ (which, by the way, is simply $1$ binary decision per second), giving you the maximum amount of informatio...
As far as I'm aware, the original use of 'bandwidth' comes from communications engineering and is measured in hertz, and its use predates digital communications. The data (or information) rate in a link is meaured in bits per second. Since the data rate in a link is related to the system's bandwidth, the term was also ...
https://dsp.stackexchange.com
38,380
[ "https://mathoverflow.net/questions/38380", "https://mathoverflow.net", "https://mathoverflow.net/users/8755/" ]
When solving the heat equation on say $\mathbb{R}$ (or $[0,2\pi]$, whichever is easier to talk about) we are posing Cauchy data on the surface $t=0$. My understanding is that $t=$constant are precisely the characteristic surfaces of the heat equation. I realize this question may seem elementary to those who know the ...
The concept of a non-characteristic surface for a PDE or a system of PDE's is useful primarily for only establishing the existence and uniqueness of real analytic or formal power series solutions to the initial value problem using the Cauchy-Kovalevsky theorem. The generalization of this to the smooth category is the ...
Your question originates in a confusion about the words <em>Cauchy problem</em>. When you have a linear PDE of order $k$, and a hypersurface $S$, it seems natural to try to solve the Cauchy problem with data posed on $S$. <em>Cauchy problem</em> means here that you give the unknown $u$ and the $k-1$ first normal deri...
https://mathoverflow.net
604,824
[ "https://physics.stackexchange.com/questions/604824", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/284447/" ]
I'm struggling with this seemingly simple question regarding elastic collision. I've worked out something but it is not enough. <blockquote> The problem reads: Consider three small masses A,B and C placed linearly on a frictionless road which weigh <span class="math-container">$2m$</span> kg, <span class="math-containe...
<strong>Part 1</strong>. As you noted, ball A will move with velocity <span class="math-container">$v_A=\dfrac v3$</span>. Ball B will move at velocity <span class="math-container">$v_B=\dfrac 43v$</span>. We'd like to know the distance that ball A moves while ball B moves towards C. Recall that the distance <span clas...
I think I got it. I didn't put it in terms of distance covered. Taking t to again be zero at the moment B strikes C, then the distance covered by B will be <span class="math-container">$S_B(t)=3L/4-4vt/9$</span>, and the distance covered by A will be <span class="math-container">$S_A(t)=tv/3$</span>. These are equal wh...
https://physics.stackexchange.com
125,993
[ "https://cs.stackexchange.com/questions/125993", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/121422/" ]
I'm looking for an algorithm for the problem: "Given an undirected graph with positive weights on its edges and some of the edges are red and some are blue. Describe an algorithm that finds the shortest (lightest) path which includes an even number of red edges, that goes from S to any vertex v." The solution I thoug...
Here's a nice way to do it. Make two copies of the input graph; call them <span class="math-container">$A$</span> and <span class="math-container">$B$</span>. Now redirect the red edges so that they jump across to the other copy, but leave the blue edges untouched. Any path which starts and ends in <span class="math-co...
An alternative (but essentially equivalent to @SamWestrick's) way of thinking about it is to run Dijkstra on the original graph but keeping track of two parameters for each vertex: the shortest path with an even number of red edges found so far, and the shortest with an odd number. Here's a more precise description o...
https://cs.stackexchange.com
540,848
[ "https://electronics.stackexchange.com/questions/540848", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/273006/" ]
I once saw a diagram where a house was supplied by a generator or from the grid by using 3 trip switches only. It must be manual so I can select as preferred, and not a automatic system. I also prefer circuit breakers over a common 3-stage switch-over because the setup can also be used in other applications.
Always there must be a complete circuit: a closed loop of <em>flowing charges</em>. But no electrons flow in electrolytes. The amperes inside the battery-electrolyte are composed of flowing charged atoms; the lithium ions. Flows of positive charge are opposite that of electrons in wires. Of course this means that, ...
There does need to be a closed loop for electrons to flow, but it doesn't need to be inside the battery. The electrons flow through the external circuit, &quot;forced&quot; by the battery. The current flow inside the battery is in the form of Li+ ions.
https://electronics.stackexchange.com
48,429
[ "https://stats.stackexchange.com/questions/48429", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/3125/" ]
During studying the convergence assessment on Markov Chain Monte Carlo, I once read the following statement: <blockquote> A slowly converging sampler may be indistinguishable from one that will never converge(e.g., due to nonidentifiability)! </blockquote> How to understand this statement? Thanks!
It's sometimes very difficult to tell by looking at the various available convergence criteria whether a sampler is converging or not. If it's wandering around the space it may be converging slowly, or it may not be converging at all. Sometimes you can't tell the difference.
What it means is that if each sample is 10.12345, 10.12345, 10.12345, 10.12345, 10.12345, 10.12345, 10.12345, 10.12345, for thousands of iterations, one might imagine that the chain has converged on 10.12345. (In practice, it would be oscillating around this value, but let's pretend the distribution has a tiny tiny va...
https://stats.stackexchange.com
599,606
[ "https://math.stackexchange.com/questions/599606", "https://math.stackexchange.com", "https://math.stackexchange.com/users/105525/" ]
Question: Let $X_n =\dfrac{(-1)^n}{n}$ find the $\limsup X_n$ and $\liminf X_n$. Proof. Can someone help me create a proof for this?
One thing which can be easily observed that $x_n=\frac{(-1)^n}{n}$ is a convergent sequence with 0 as its limit. So $\limsup_{n\rightarrow\infty}x_n=\liminf_{n\rightarrow\infty}x_n=0$. Next, by definition $\limsup_{n\rightarrow\infty}x_n=\lim_{k\rightarrow\infty}y_k$, where $y_k=\sup\{x_n:n\geq k\}$ and $\liminf_{n\ri...
Think.Does $x_n$ converge? if it does ,then $\limsup x_n= \liminf x_n$.
https://math.stackexchange.com
4,106,035
[ "https://math.stackexchange.com/questions/4106035", "https://math.stackexchange.com", "https://math.stackexchange.com/users/697395/" ]
Let <span class="math-container">$A_1, \dots , A_n$</span> be commutative unitary Rings and <span class="math-container">$A = \prod_{i=1}^{n} A_i$</span>. Then every prime Ideal <span class="math-container">$\frak{p}$</span> <span class="math-container">$\subset A$</span> is of the form <span class="math-container">$\p...
You can derive the proof from the following facts: <ol> <li>An ideal <span class="math-container">$\mathfrak{a} \subseteq A$</span> is prime iff <span class="math-container">$A/\mathfrak{a}$</span> is an integral domain. </li> <li>There is an isomorphism of rings <span class="math-container">$(\prod_i A_i) / (\prod_i \...
Assume <span class="math-container">$\mathfrak a_i\neq A_i,\mathfrak a_j\neq A_j$</span> for <span class="math-container">$i\neq j.$</span> Then <span class="math-container">$1_i\in A_i\setminus \mathfrak a_i$</span> and <span class="math-container">$1_j\in A_j\setminus \mathfrak a_j.$</span> Define <span class="math-c...
https://math.stackexchange.com
123,858
[ "https://cs.stackexchange.com/questions/123858", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/105560/" ]
I'm emulating 128-bit arithmetic. At the moment I'm calculating <span class="math-container">$x^2$</span> by computing <span class="math-container">$x\cdot x$</span>. What might be some alternative methods that aren't simply dressing up multiplication?
Base on the fact that: If n is an even number <span class="math-container">$(n = 2m) \implies n^2 = 4m^2$</span> If n is an odd number <span class="math-container">$(n = 2m + 1) \implies n^2 = 4m^2 + 4m + 1$</span> And you can calculate <span class="math-container">$m$</span> by bitwise shifting right of <span class...
You can use <span class="math-container">$x^2 = \exp(2\log x)$</span>. However, this is probably inferior to using <span class="math-container">$x^2 = x \cdot x$</span> in almost all situations.
https://cs.stackexchange.com
3,662
[ "https://physics.stackexchange.com/questions/3662", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/-1/" ]
In all the canonical approaches to the problem of quantum gravity, (eg. loop variable) spacetime is thought to have a discrete structure. One question immediately comes naively to an outsider of this approach is whether it picks a privileged frame of reference and thereby violating the key principle of the special rela...
Here is as I see the problem. The best way to understand it is to think what happens with rotations and quantum theory. Suppose that a certain vector quantity $V=(V_1,V_2,V_3) $ is such that its components are always multiples of a fixed quantity $d $. Then one is tempted to say that obviously rotational invariance i...
Yes, sb1, all your statements are totally correct. A discrete spacetime immediately implies lots of bulk degrees of freedom that remember the detailed arrangement of the discrete blocks - unless it is regular and unique. Consequently, the "vacuum" carries a gigantic entropy density - the Planck entropy density if the ...
https://physics.stackexchange.com
104,889
[ "https://cs.stackexchange.com/questions/104889", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/51591/" ]
The language <span class="math-container">$$ L_1 = \{w \in \{0, 1\}^\ast \mid \exists x \in \{0, 1\}^\ast\colon M_w(x) = x\} $$</span> <sub>(<span class="math-container">$w$</span> is an encoding of a DTM, <span class="math-container">$M_w$</span> is the respective DTM.)</sub> is not decidable, according to Rice's t...
Because we cannot find, given a NTM <span class="math-container">$N$</span> and an input <span class="math-container">$x$</span>, whether <span class="math-container">$N$</span> fulfills the condition <span class="math-container">$N(x)\not= x$</span> in any given finite amount of time. More precisely, we cannot enumera...
The NTM can recognize, not determine (because if no such <span class="math-container">$x$</span> exists, the NTM would not halt), <span class="math-container">$M_w(x)=x$</span>, because if such an <span class="math-container">$x$</span> exists, the NTM would halt finally (and accept <span class="math-container">$\langl...
https://cs.stackexchange.com
118,708
[ "https://dba.stackexchange.com/questions/118708", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/78699/" ]
I am simply trying to create a database. In my account's home directory, I type in <blockquote> sqlite3 test.db </blockquote> Then once I am in sqlite, I type <blockquote> .quit </blockquote> That <strong>should</strong> create the database file in the current directory. But there is no such file! I tried it i...
It's because you haven't actually done anything. Doing nothing: <pre><code>phil@ironforge:~$ sqlite3 test.db SQLite version 3.8.2 2013-12-06 14:53:30 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite&gt; .quit </code></pre> File not created: <pre><code>phil@ironforge:~$ ls -al test.db...
You can create an empty database with <code>sqlite3 new.sqlite "SELECT 1;"</code> A database is created and the result of the SELECT is printed, leaving just an empty database.
https://dba.stackexchange.com
128,830
[ "https://physics.stackexchange.com/questions/128830", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/42966/" ]
Wikipedia: "Antiparticles have exactly opposite additive quantum numbers from particles, so the sums of all quantum numbers of the original pair are zero." Is it possible to annihilate a quark-antiquark pair if the antiquark has a color different from the quark? Eg.: Will red up and anti-green anti-up annihilate? And...
Well, you can just take the ordinary quark/anti-quark/gluon vertex for that and get a red/anti-green gluon (which will then decay/hadronize further, since it is color-charged and thus confined).
Usually the word "annihilation" is reserved for interactions whose inputs are two particles that are each other's antiparticle, and your example is not annihilation by that definition. But you can have an interaction where two different quarks go in and something else comes out, as ACuriousMind already mentioned. We ha...
https://physics.stackexchange.com
136,437
[ "https://electronics.stackexchange.com/questions/136437", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/53389/" ]
My question is with regard to establishing regulation using values taken off the characteristic curve. I have \$I_{kn}\$ = 1.8mA and \$V_z\$ = -8.2V. How can I determine the minimum input voltage for regulation to be established? <img src="https://i.stack.imgur.com/tceDH.png" alt="schematic"> Do I have to calculat...
You want to avoid operating at Izk. That is the point where breakdown begins and there is noticeable change. A good place to operate at is the Izt (zener test current) which is usually provided in the datasheet. Anyways... This problem is going to depend on what you current limiting resistor is. If we assume you are...
Well you've at least got 1.8 mA across R1, even if the load (not shown) is infinite. Try sticking some load resistors on the output.<br> (then you've got look on the spec sheet and see what happens when I-zener decreases.)
https://electronics.stackexchange.com
134,108
[ "https://softwareengineering.stackexchange.com/questions/134108", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/47188/" ]
My workplace will soon be shifting to the concept of 'activity based working', which moves from the idea of IT teams, BA teams, PM teams, etc to project-based work where people from across all facets of IT and the business involved on a project sit and work together. As a result, you wouldn't be sitting with your norma...
Nothing beats getting together face to face. Why can't IT have a pizza lunch and general sharing session one day a week where you and all your old colleagues get together and share ideas and keep in touch?
If you are going to work as a team from the Project's point of view, that's the best thing you can do and it will have a great impact of the project's success. Now your problem is how to be in touch with your home team. Dont go into tools unless they are essential (for some reason like distributed teams). Instead focus...
https://softwareengineering.stackexchange.com
33,664
[ "https://stats.stackexchange.com/questions/33664", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/5836/" ]
I've found plenty of formulas showing how to find the mean survival time for an exponential or Weibull distribution, but I'm having considerably less luck for log-normal survival functions. Given the following survival function: $$S(t) = 1 - \phi \left[ {{{\ln (t) - \mu } \over \sigma }} \right]$$ How does one find ...
The median survival time, $t_{\textrm{med}}$, is the solution of $S(t) = \frac{1}{2}$; in this case, $t_{\textrm{med}} = \exp(\mu)$. This is because $\Phi(0) = \frac{1}{2}$ when $\Phi$ denotes the cumulative distribution function of a standard normal random variable. <hr> When $\mu = 3$, the median survival time is a...
The R <code>rms</code> package can help: <pre><code>require(rms) f &lt;- psm(Surv(dtime, event) ~ ..., dist='lognormal') m &lt;- Mean(f) m # see analytic form m(c(.1,.2)) # evaluate mean at linear predictor values .1, .2 m(predict(f, expand.grid(age=10:20, sex=c('male','female')))) # evaluates mean survival time at ...
https://stats.stackexchange.com
72,173
[ "https://dba.stackexchange.com/questions/72173", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/44275/" ]
I am working on data in oracle 11g as below : <pre><code>subscriber_id | count_s | count_t | min_count | diff | negative_diff | positive_diff 137606401 3 3 3 0 0 0 102842273 5 4 4 1 0 ...
It's a question of timing. Consider deleting StudentID #1: <ol> <li>The row is deleted from the <code>Student</code> table</li> <li>The cascade delete removes corresponding rows from <code>Enrollment</code></li> <li>The foreign key relationship <code>GPA</code> -> <code>Student</code> is checked</li> <li>The trigger f...
Without reading all, just from the diagram: You have either an entry in Enrollment or one in GPA pointing to the Student you want to delete. The entries with the foreign keys need to be deleted first (or the keys set to null, but that is bad practice) before you can delete the Student entry. Also some databases have ...
https://dba.stackexchange.com
36,525
[ "https://engineering.stackexchange.com/questions/36525", "https://engineering.stackexchange.com", "https://engineering.stackexchange.com/users/61/" ]
When welding stainless steel pipes, the welds need some treatment (e.g. ball blasting and pickling). Is there anything equivalent for carbon steel (not stainless)? I'm looking at a tender document where someone specified pickling etc. for C-steel and I'm wondering wether someone copy-pasted from the specifications for ...
Other than inspection/NDE , the only treatment would be for appearance. For stick , you need to knock off the slag to examine it for quality. In some situations the hardness would be a concern and minor grinding for hardness tests would be needed. Stainless is the same; clean for inspection/NDE, anything else like glas...
agree with blacksmith37. Here are the materials science issues. the welding properties of low carbon steel from the standpoint of its time-temperature-transformation curves are well-enough understood by now that the quality of a weld in it can be determined by visual inspection and by swatting it with a 5-pound hammer....
https://engineering.stackexchange.com
91,104
[ "https://mathoverflow.net/questions/91104", "https://mathoverflow.net", "https://mathoverflow.net/users/21864/" ]
Given an action $\alpha$ of $V$ a Lie group on $B$ a Fréchet space with seminorms $ \{ \| \cdot \|_j \} $, let $B^\infty$ be the space of smooth vectors. Is this dense in $B$? Can I guarantee it is non-empty? Is there any requirements on $G$ or $\alpha$ or $B$? For the case I am (supposed to be) working on right now, w...
The answer is "yes" quite generally, and the following argument can be found in many texts (Knapp, Wallach, Varadarajan, ...): for a test function $f$ on the Lie group $G$, there is the "averaged" action on any quasi-complete, locally convex repn space $\pi,V$ for $G$, namely, $f\cdot v=\int_G f(g)\,\pi(g)(v)\;dg$. The...
If the group $G$ is compact, then your statement is true. More precise, let $A$ be a locally convex complete topological vector space and $G \times A \to A$ be a continuous action of $G$. Let $A_s \subset A$ be the sub vector space generated by finite-dimensional $G$-stable subspaces. Then $A_s$ is dense in $A$. This i...
https://mathoverflow.net
456,082
[ "https://math.stackexchange.com/questions/456082", "https://math.stackexchange.com", "https://math.stackexchange.com/users/86177/" ]
In Rudin textbook, there are lines, "$(P_n)$ converges to p if and only if every subsequence of $(P_n)$ converges to p. We leave the details to the reader." I'm confused because I thought there can exist several different subsequential limits?
Yes, a sequence may have several subsequential limits, but this is assuming $x_n$ already converges, or that every subsequences converges to the same limit, that is <blockquote> A sequence converges to $p$ if and only if every subsequence converges to $p$. </blockquote> One claim is easy, since $x_n$ is a subsequen...
There can exist many subsequential limits <strong>IF</strong> the sequence $\{P_n\}$ doesn't converge. If it converges (to $X$), for all $\epsilon &gt; 0$, there exists $N$ such that for all $n &gt; N$, $|P_n - X| &lt; \epsilon$, which holds obviously for any subsequence as well. This shows the forward direction; for t...
https://math.stackexchange.com
183,230
[ "https://physics.stackexchange.com/questions/183230", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/77208/" ]
So as I understand, the inverse-square law which shows up in a variety of physical laws (Newton's universal law of gravitation, Coulomb's law, etc.) is a mathematical consequence of point-like particle emanating a certain physical quantity in all directions in the form of a sphere, and the density of that quantity is i...
Flux is proportional to the area of the sphere not the volume of the sphere. It is evident from definition of the flux $\Phi_\mathbf{B}$ of some quantity $\mathbf{B}$ , which is defined in the following way, $$\Phi_\mathbf{B}= \iint\mathbf{B} \cdot \mathrm d \mathbf{A} $$ Therefore the flux is proportional to the are...
An easy way to explain it is a light source emitting light in all directions. The light is the area of a sphere, and volume has nothing to do with it.
https://physics.stackexchange.com
43,822
[ "https://dba.stackexchange.com/questions/43822", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/10335/" ]
In terms of performance if I have a table like so: <pre><code>CREATE TABLE [TESTDATA].[TableA]( [Col1] [nchar](5) NOT NULL, [Col2] [nchar](2) NULL, [Col3] [float] NULL CONSTRAINT [TableA_PK] PRIMARY KEY CLUSTERED ( [Col1] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF...
No, <code>_idx_TableA</code> will not be affected for this operation. I have modified your example and added another index (NCI) that actually includes the key column <code>Col3</code>. Here's my example code: <pre><code>use testdb; go CREATE TABLE [DBO].[TableA]( [Col1] [nchar](5) NOT NULL, [Col2] [nchar](...
No. Since the update does not update data in neither <strong>col 2</strong> nor the <strong>clustered key (col 1)</strong>, the index _idx_TableA with only col 2 does not get updated. @professionalAmateur, click on the execution plan button on the top. <img src="https://i.stack.imgur.com/tYV8b.png" alt="enter image ...
https://dba.stackexchange.com
3,038
[ "https://physics.stackexchange.com/questions/3038", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/1377/" ]
Just assume that I understand that a field in quantum field theory is an operator-valued distribution. For simplicity, forget about the distribution and think about a function $\varphi:M \rightarrow L(H)$ that assigns an operator to each point of spacetime. Can someone explain to me what (mathematically speaking) ph...
some authors of the questions expect a less mathematical answer than what they are given at the end. In a sense, you are the opposite example because you expect a more mathematical explanation than what the right explanation actually is. The term "quantum of a field" is not representing a particular state or operator;...
The operators assigned to your field usually are creation operators. Quanta are the things these creation operators create. This can be photons, phonons, electron-hole-pairs etc.
https://physics.stackexchange.com
60,373
[ "https://dba.stackexchange.com/questions/60373", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/35305/" ]
I am looking to create a set of fields on my webpage identical to what eBay uses on their category selection page when you are selling something. For my purposes I am doing motorcycles, power sports, parts &amp; accessories. So for example I would like to have three very broad categories: <pre><code>Motorcycles Powers...
I would generalize the design, I.e. instead of a motorcycle_brand table, You would want a category_brand table, and instead of a motorcycle_model table, you would have a category_brand_model table with an fk on the category_brand pk. This allows for several advantages: <ol> <li>Adding new product categories in the fut...
I think that this can be easily done by using just a single table. This table would require three columns i.e. category_id, category_name and parent_category_id. In this case, you will need to use a self join while querying the database. Querying the database would be very easy with this approach as well. But there is...
https://dba.stackexchange.com
56,888
[ "https://cs.stackexchange.com/questions/56888", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/8337/" ]
I am currently finishing my MSc in computer science. I am interested in programming languages, especially in type systems. I got interested in research in this field and next semester I will start a PhD on the subject. Now here is the real question: how can I explain what I (want to) do to people with no previous know...
If you have a few minutes, most people know how to add and multiply two three-digit numbers on paper. Ask them to do that, (or to admit that they could, if they had to) and ask them to acknowledge that they do this task methodically: <em>if</em> this number is greater than 9, <em>then</em> add a carry, and so forth. Th...
I would try something like this: <blockquote> Programmers can tell computers what to do. To do that, they need to use a programming language. That is a language that is understood by both computers and humans. For example, if you edit a Word document and press a key, the computer will show the letter you pressed. Th...
https://cs.stackexchange.com
218,274
[ "https://security.stackexchange.com/questions/218274", "https://security.stackexchange.com", "https://security.stackexchange.com/users/110133/" ]
Our company suffered a phishing attack yesterday. While investigating about the attacker and the potential employees of ours who might have been phished, we ended up with the attacker database of phished users. This database include user email and passwords (~40) from multiple companies (~10) who seems to be sharing t...
This sort of thing needs to be handed off to law enforcement to handle if it is on-going. <ul> <li>Notify victims, then let them handle it.</li> <li>Notify hosters, then let them handle it.</li> </ul> <strong><em>Do not</em></strong> go public about an on-going attack with active victims. As much as you want to fi...
If you are in the US and the bad actors and their other victims are outside your state, or international I recommend you contact the FBI cyber crimes unit nearest you. That have the jurisdiction and processes to handle this. Second; you should inform your company legal counsel. They will want to now and will help with ...
https://security.stackexchange.com
146,188
[ "https://mathoverflow.net/questions/146188", "https://mathoverflow.net", "https://mathoverflow.net/users/41976/" ]
$C$ : a projective curve over an algebraically closed field, $I$ : the ideal sheaf of $\mathcal{O}_C$ defining a point $p\in C$. Why is the following hold? $h^0(C,(\mathcal{O}_C/I^{r})\otimes\mathcal{O}_C(m))=dim(\mathcal{O}_{C,p}/m_{C,p}^r)\ge r$, where $\mathcal{O}_{C,p}$: the local ring at $p$ and $m_{C,p}$:the max...
All the answers above are absolutely fine. Just to give a completely obvious argument: Take a the line $z=t\exp(i\phi)$ with $\phi=2\pi/{4^{n_0}}$ for some $n_0\in \mathbb{N}$. Then $$ f(z)=\Pi_{n=0}^{n_0-1}\left(1+t^{4^n}\exp\left(i\phi^{4^n}\right)\right)\Pi_{n=n_0}^{\infty}(1+t^{4^n}) $$ Since $4^{n_0}/2\neq 4^{...
It was conjectured by G. Pólya in 1916 and proved by F. Carlson in 1921 that a power series with integer coefficients and radius of convergence one is either rational or has the unit circle as a natural boundary. Since $f(z)$ is clearly not rational, the second alternative must hold.
https://mathoverflow.net
128,717
[ "https://softwareengineering.stackexchange.com/questions/128717", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/39669/" ]
I recently discovered Design by Contract (DbC) and I find it an extremely interesting way to write code. Among other things, it would seem to offer: <ul> <li>Better documentation. Since the contract is the documentation, it's impossible for one to be out of date. Additionally, because the contract specifies exactly wh...
Arguably they are supported in virtually every programming language. What you need are "assertions". These are easily coded as "if" statements: <pre><code>if (!assertion) then AssertionFailure(); </code></pre> With this, you can write contracts by placing such assertions at the top of your code for input constraint...
As you say, Design by Contract <em>is</em> a feature in Eiffel, which has long been one of those programming languages that is well respected in the community but which has never caught on. DbC is not in any of the most popular languages because it is only relatively recently that the mainstream programming community...
https://softwareengineering.stackexchange.com
102,412
[ "https://mathoverflow.net/questions/102412", "https://mathoverflow.net", "https://mathoverflow.net/users/492/" ]
Hello, I apologize in advance if this question is misguided somehow, since my algebraic geometry is pretty shaky. I am wondering if there is a way to understand all the conics in a generic quadric line complex $X$. Remember that $X$ is defined as the intersection of the image of the complex Grassmanian $G(2,4)$ in $P...
One interpretation of the quadric line complex $X$ is as the moduli space of stable, rank $2$, degree $1$ vector bundles on a genus $2$ curve $C$ (whose associated Kummer is the Kummer in G&amp;H), cf. Newstead, "Topological Properties of Some Spaces of Stable Bundles". From this point of view, Ana-Maria Castravet has...
Comment: The family of hyperplanes in $\mathbb P^3$ is $3$-dimensional, because it is isomorphic to another copy of $\mathbb P^3$. This does not give you all the conics. The reason is simple. Every conic you constructed lies on a plane entirely contained within $G(2,4)$, so it usually lies on a plane not entirely cont...
https://mathoverflow.net
154,223
[ "https://stats.stackexchange.com/questions/154223", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/78206/" ]
I am doing Stat110 and in the book, "Introduction to Probability" they give the following definition of sampling with replacement: <blockquote> Theorem 1.4.5 (Sampling with replacement). Consider n objects and making k choices from them, one at a time with replacement (i.e., choosing a certain object does not pr...
I think the issue here is that what the theorem call objects and choices are not what we intuitively call objects and choices. The objects here are not the dice but each side of a die. So you have 6 objects in a die. The choices are then the number of time you choose among those objects. Therefore, in you case, n i...
Let us begin with the contradiction. Your finding of 2^6 cannot be correct because each of the six sides of the first die can be matched with any if the six sides from the second. As a result there are 6*6=36 sides, not 2^6=64. But you did apply a formula. What did that formula mean? The formula of 2^6 implies you ar...
https://stats.stackexchange.com
280,706
[ "https://softwareengineering.stackexchange.com/questions/280706", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/79869/" ]
Let's say that I'm using a library and I would like to add a property that doesn't exist to an existing class. In this case, I'd like to add Color as a property of Fruit. <pre><code>namespace Library { public class Fruit : System.IDisposable { public string Name { get; set; } public void Dispos...
The best answer is you shouldn't. But if you don't mind a performance overhead, you can do something similar with <code>ConditionalWeakTable&lt;,></code>: <pre><code>public static class ExtraFruitProperties { private static readonly ConditionalWeakTable&lt;Fruit, Color&gt; _colors = new ConditionalWeakTable&lt;Fr...
<strong>You don't.</strong> The closest you can get to is Java style properties via extension methods, though if you actually need to store the color (as opposed to map it in the function) it can be difficult to do correctly since the extension class would hold references to the actual class if you do it the naive way...
https://softwareengineering.stackexchange.com
330,302
[ "https://electronics.stackexchange.com/questions/330302", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/107412/" ]
The wiki article explaining inductor core saturation talks about <em>magnetic domains</em> lining up with the external magnetic field to concentrate the magnetic flux. This sounds similar to electric permittivity where dipoles rearrange themselves to cancel internal electric fields. I know that electric permittivity i...
Flux density = \$\mu\$H where \$\mu\$ is the magnetic permeability of the core material and H is the applied magnetic field in units of amp-turns per metre. If the turns stay the same and the amps peak at the same value and the core doesn't magically change its dimensions then H remains constant so, providing \$\mu\$ r...
The saturation itself is AFAIK not frequency dependent (though I am not 100% sure, ferrites have all kind of weird properties when the operation frequency increases). What you definitely get is that the permeability decreases and the loses increase. Which means, your inductor will behave slightly different if you go up...
https://electronics.stackexchange.com
57,134
[ "https://dba.stackexchange.com/questions/57134", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/30451/" ]
I had tried to start the <code>MongoDB</code> service using the following command in <code>linux</code> machine. <pre><code>service mongod restart </code></pre> I am getting the following error <pre><code>Stopping mongod: [FAILED] Starting mongod: about to fork child process...
Generally, use the <code>information_schema</code>: <pre><code>SELECT column_name FROM information_schema.columns WHERE table_schema = 'public' AND table_name = 'blah' ORDER BY column_name ASC; </code></pre>
This also works: <pre><code>SELECT col_attr.attname as "ColumnName" FROM pg_catalog.pg_attribute col_attr WHERE col_attr.attnum &gt; 0 AND NOT col_attr.attisdropped AND col_attr.attrelid = (SELECT cls.oid FROM pg_catalog.pg_class cls LEFT JOIN pg_catalog.pg_namespace ns ON ns.oid = cls.relnamespace WHERE cls....
https://dba.stackexchange.com
1,659
[ "https://mechanics.stackexchange.com/questions/1659", "https://mechanics.stackexchange.com", "https://mechanics.stackexchange.com/users/923/" ]
My rear view mirror came off today while in work. Probably due to age and scorching Texas heat. What do I need to do to glue it back on? and what kind of glue should I buy to do it with?
Go to Napa, Autozone, Pepboys or similar - they all stock the specific glue that you need to reattach the mirror. As with most jobs that involve sticking dissimilar materials together, cleanliness is the key - make sure that you get all the old glue off both the windshield (fairly easy) and the metal button (not that ...
The kind at the auto store that says for mirrors.. lol Epoxy glue but I believe you will find one that even is clearly labeled for mirrors.
https://mechanics.stackexchange.com
208,794
[ "https://dba.stackexchange.com/questions/208794", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/152785/" ]
I have a query below. The SUM should be the SIX_AGO + FIVE_AGO + FOUR_AGO + etc. But the SUM give all the times wrong numbers. Is there anything I am doing wrong? <pre><code> SELECT COUNT(CASE WHEN MY_DATE_COL BETWEEN to_date(TRUNC(sysdate, 'DAY') - 365 - diff ) AND to_date(TRUNC(sysdate, 'DAY') + 6 - diff) ...
The question does not contain test data, and some details are not quite clear eg we don't know what the "diff" in the original query stands for. Suppose we have the following test table (assuming that diff is just a constant value): <pre><code>-- Oracle 12c create table test as select sysdate - level as my_date_c...
The numbers are correct. Your assumption of what the values should be is not correct. <h1>TO_CHAR</h1> You are doing <code>DATE</code> comparison. Drop the <code>TO_CHAR()</code> calls. It's not the cause of your issue, but it is a bug in your code. When doing <code>DATE</code> mathematics, make sure everything s...
https://dba.stackexchange.com
742,883
[ "https://physics.stackexchange.com/questions/742883", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/250206/" ]
From M Schwarz's QFT (p 570), Goldstone's theorem indicates that pions are created from the vacuum by the chiral <span class="math-container">${\rm SU}(2)$</span> current <span class="math-container">$J_\mu^{5a}$</span>, <span class="math-container">$$ \langle \Omega| J_\mu^{5a}(x)|\pi^b(p) \rangle = ip_\mu F_\pi e^{i...
The state of the electrons in the situation you describe is actually not <span class="math-container">$|\uparrow, {\rm left}\rangle_1 \otimes |\downarrow, \rm{right}\rangle_2$</span>. It is instead <span class="math-container">\begin{equation} |\Psi\rangle = \frac{1}{\sqrt{2}}\Big(|\uparrow, {\rm left}\rangle_1 \otimes...
Tracking the two electrons you're talking about would requiere knowledge of both position and momentum, which contradicts Heisenberg uncertainty principle. Since you cannot track them you don't know which electron is (spin) up <span class="math-container">$|\uparrow\rangle$</span> and which one is down <span class="mat...
https://physics.stackexchange.com
724,143
[ "https://physics.stackexchange.com/questions/724143", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/276824/" ]
If I have a particle with magnetic moment <span class="math-container">$\vec{\mu}$</span> in its rest system <span class="math-container">$S$</span>, what will its new magnetic moment <span class="math-container">$\vec{\mu}'$</span> be if it is moving at speed <span class="math-container">$\vec{v}$</span> in a referenc...
The magnetic moment is given by <span class="math-container">$$ \mu = \frac{1}{2} \int r \times J \, \mathrm{d}^3 x $$</span> In order to know how this transforms, we have to re-express it in terms of Lorentz-covariant quantities. For starters we can write <span class="math-container">$(r \times J)_i = \epsilon_{ijk} r...
The magnetic moment is part of a skew symmetric 2-tensor <span class="math-container">$M_{\mu\nu}$</span>. In the rest frame only the space components <span class="math-container">$M_{ij}= \epsilon_{ijk} \mu_k$</span> are non zero. In a boosted frame non-zero electric dipole terms <span class="math-container">$M_{i0}$...
https://physics.stackexchange.com
5,110
[ "https://cstheory.stackexchange.com/questions/5110", "https://cstheory.stackexchange.com", "https://cstheory.stackexchange.com/users/3847/" ]
I think that a size hierarchy theorem for circuit complexity can be a major breakthrough in the area. Is it an interesting approach to class separation? The motivation for the question is that we have to say <blockquote> there is some function that cannot be computed by size $f(n)$ circuits and can be computed by ...
In fact it is possible to show that, for every $f$ sufficiently small (less than $2^n/n$), there are functions computable by circuits of size $f(n)$ but not by circuits of size $f(n)-O(1)$, or even $f(n)-1$, depending on the type of gates that you allow. Here is a simple argument that shows that there are functions co...
This result can be proved using a simple counting argument. Consider a random function applied to the first $k$ bits of the input. This function almost certainly has circuit complexity $(1+o(1))(2^k/k)$ by Riordan and Shannon's counting argument, and matching upper bounds. Thus, picking $k$ so that $2g(n) &lt; 2^k...
https://cstheory.stackexchange.com
365,748
[ "https://math.stackexchange.com/questions/365748", "https://math.stackexchange.com", "https://math.stackexchange.com/users/59275/" ]
Find which number plus its <strong>19%</strong> gives for example <em>200, 233 ..</em> Story short: for example I have the number <code>0.30</code> now I need to know with formula how can I get which <strong>number plus its 19%</strong> gives <code>0.30</code> ? I know this must be simple math but I am not so good w...
You want $n=1.19m$, so $m=\frac n{1.19}$ For $n=0.30, m \approx 0.2521$
We'll let $a$ represent the "end" amount, in decimal (so $a = 0.30$ corresponds with an end amount at $30\%$ e.g.), and we'll let $b$ represents the "starting quantity" we are interested in finding (the amount we started with before adding $19\%$ to it, to get $a$). Then $$a = b + 0.19 b = 1.19 b \iff b = \frac{a}{1.1...
https://math.stackexchange.com
198,634
[ "https://mathoverflow.net/questions/198634", "https://mathoverflow.net", "https://mathoverflow.net/users/58226/" ]
Let $C$ be a pointed convex cone in a vector space $V$. This means that $C$ satisfies the three following axioms: <ul> <li>$C + C \subset C$, </li> <li>$\mathbb{R}_+ \cdot C \subset C$, and </li> <li>$C \cap (-C) = \{ 0 \}$. </li> </ul> Say that $K \subset C$ is a <em>base</em> of $C$ if, for every $x \in C \setminu...
This is an extended version of my observations in the comments. The upshot is that there exist pointed convex cones without a convex base, but every cone has a base. Hence what the OP is trying to do is bound not to work. <strong>(1)</strong> <em>There are pointed convex cones that do not have a convex base</em>. To s...
@TobiasFritz's answer is very excellent. Here is another nice example of a Banach lattice with order unit. Consider a measurable set $(S,\Sigma)$ and a $\sigma$-ring $N\subseteq \Sigma$, elements of which we call <em>null</em>. Now consider $L_\infty(\Sigma|N)$ of all equivalence classes of bounded measurable functiona...
https://mathoverflow.net
145,888
[ "https://electronics.stackexchange.com/questions/145888", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/57529/" ]
How can I tell (by reading the datasheet) if a specific MOSFET can be turned fully on (with the minimum drop) with simply 5V on the gate? (assuming 5V or 12V potential between the drain and source). What specs am I looking for (preferably ones that are not on graphs, ew) to determine if a MOSFET is suitable, apart fro...
Turn on is governed by the threshold voltage.<br> Vth or Vgs_th or similar.<br> This is specified at a stated current - usually small - 10 uA or 100 uA or sometimes 1 mA.<br> Useful turn on voltage is a volt or more above this value and fully enhanced operation needs typically 2 or 3 times as much voltage. Most data ...
By checking the \$R_{ds}\$ to \$V_{gs}\$ graph. A MOSFET is on as long as \$V_{gs} \ge V_{gs(on)}\$. Usually you determine if the FET is turned on adequately at the given voltage. For example, <code>2N7000</code> datasheet specifies a \$R_{ds(on)}\$ at \$V_{gs}=10 \mathrm V\$ but it is turned on enough with \$V_{gs}=...
https://electronics.stackexchange.com
232,062
[ "https://security.stackexchange.com/questions/232062", "https://security.stackexchange.com", "https://security.stackexchange.com/users/16066/" ]
I use an "anonymous" mail address (cock.li provider in my case). I have found that mainstream news sites in particular don't send their newsletters to such an addresses. It looks like the domains blacklisted. What is the reason? <strong>I can understand that they don't want you writing comments from anonymous mail add...
This unfortunate situation isn't really infosec issue, but rather: (a) <strong>marketing issue</strong> - They want your real e-mail address to report smth like &quot;We have N subscribers and attracted M more last month&quot;. So, its all about tracking and possibly data collection. (b) <strong>web developer incompete...
It could either be the email address or an issue on their end if they are outsourcing their newsletter email address via a public mail list sending provider (ex: mailchimp) The only thing I can think of for an issue with your email address, is if the developers at the back-end, made sure the email data you placed is a...
https://security.stackexchange.com
548,706
[ "https://electronics.stackexchange.com/questions/548706", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/229001/" ]
I’m building a custom keyboard and have 60 WS2812Bs as part of the backlighting system. I’m worried about the signal integrity as I’m using an STM32 and the max current on that pin is 25mA. Do I need to add a MOSFET to boost the signal or is connecting a 330 ohm resistor enough?
You are confusing the data input and the power supply to the WS2812. The WS2812 (single or a chain) draws its power from the 5V connection. At full brightness a single WS2812 can draw 60 mA IIRC, so that is 1A for every 16 WS2812's! Hence it is a good idea to bypass power (and ground) of a WS2812 (or similar) LED strip...
If STM32 has Vdd max = 3.6 and WS2812 is CMOS input rated for 3.5 to 5.3 with Vih max &gt;= 0.7 * V+ then you need a level shifter to extend past &lt; 30% &amp; &gt; 70%. Due to mismatched impedance of interconnecting cable some ringing occurs so a series R &lt;= cable impedance improves damping of ringing to Input. Tw...
https://electronics.stackexchange.com
64,372
[ "https://dsp.stackexchange.com/questions/64372", "https://dsp.stackexchange.com", "https://dsp.stackexchange.com/users/48028/" ]
I took a z transform and got a double pole at <span class="math-container">$z=1$</span>, but I don't know if that's correct. I'm lost because I don't know if <span class="math-container">$\cos(\theta)$</span> converges or diverges or what that means for <span class="math-container">$h[n]$</span> being absolutely summ...
The <em>system</em> with impulse response given by <span class="math-container">$h[n] = \cos(\pi\sqrt{n})u[n]$</span> is BIBO-<strong>unstable</strong> because the sum <span class="math-container">$\sum_{n=-\infty}^\infty |h[n]]$</span> diverges instead of being convergent as is needed for BIBO-stability. Note that for...
The LTI system defined by the impulse response <span class="math-container">$$h[n] = \cos(\pi \sqrt{n} ) u[n] $$</span> is <strong>unstable</strong>, as the absolute sum of the impulse response does not converge and diverges to infinity instead, i.e.; <span class="math-container">$$ \sum_{n=-\infty}^{\infty} |h[n]| = ...
https://dsp.stackexchange.com
29,457
[ "https://mechanics.stackexchange.com/questions/29457", "https://mechanics.stackexchange.com", "https://mechanics.stackexchange.com/users/17194/" ]
My 1983 Mercedes 380SL seems to be running hotter than I like. It settles down at right at 100 C by the instrument panel temp gauge after running at highway speed for 10 minutes or so. When I first got the car, it had a bum O2 sensor that made it run rich, but on the highway it'd run about 90 C. After I fixed the O2 s...
Nope that sounds about perfect. Remember there is a spring on the radiator cap that keeps the engine coolant pressure to around 13 PSI for most manufacturers. Water doesn't boil until around 242°F (117° C) at that pressure. The manufacturers want the water to stay as a liquid because that helps the radiator work bett...
Make sure your temp sensors are correct. It's not uncommon masking temp out of range w/incorrect sensor. Still battling over heating on 83 500sl
https://mechanics.stackexchange.com
53,230
[ "https://physics.stackexchange.com/questions/53230", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/975/" ]
Consider these two situations when driving on a long straight road uphill: <ol> <li>Starting at a high velocity $v_h$, which the car is able to maintain.</li> <li>Starting at a lower velocity $v_l$, and then trying to reach $v_h$ while driving uphill.</li> </ol> In my experience I've noticed that in case 2 it is very...
<strong>Short, short version:</strong> It's complicated. <strong>Slightly longer version:</strong> Internal combustion engines have at least two relevant performance characteristics: power and torque. Furthermore the maximum attainable values for both are functions of the current engine speed (RPM). Acceleration wil...
Here's my guess: As you know, internal combustion engines burn fuel. The power output of the engine is a function of both the current RPM and the amount of fuel you inject. But there's a catch: the engine can burn a limited amount of fuel per cycle, and therefore the higher the RPM, the more fuel can be combusted. So ...
https://physics.stackexchange.com
377,988
[ "https://softwareengineering.stackexchange.com/questions/377988", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/102690/" ]
My lead dev complained that I have too much logic in a nested catch block. My code goes something like this: <pre class="lang-cs prettyprint-override"><code>try { // some setup and a network call } catch (CustomEx ex) { try { KindaLengthyRecursiveRetryMethodThatHandlesCustomEx(numTimesToTry); }...
If you're basically doing the same in the catch x-times, why you don't do it in the inital <code>try</code>? <pre><code>try { NetworkCall(numTimesToTry); } catch (Exception ex) { // log this } </code></pre> So something like this: <pre><code>void NetworkCall(int maxRetries) { if (!SetupDone()) Do...
By "too much logic", my guess is that your lead developer wasn't referring to the length of the method precisely, but rather the fact that you have a nested try/catch in your catch clause. A nested try/catch isn't really inefficient, but it is a little ugly to look at. Consider pulling the entire try/catch into its o...
https://softwareengineering.stackexchange.com
85,469
[ "https://security.stackexchange.com/questions/85469", "https://security.stackexchange.com", "https://security.stackexchange.com/users/71961/" ]
In light of recent developments on SSL issues such as BEAST and POODLE, I decided to configure my browser to only allow TLS1.1 and higher. The trouble is, that I am finding a lot of websites which do not work correctly (some websites serve all JS and CSS resources as HTTPS always) or at all. A bit of digging usually re...
No, there is absolutely no <em>security</em> related reason to continue to support TLS 1.0, but there are several other business concerns which can twist the arm of a system engineer into allowing it. For larger sites, they may be trying not to leave people with older browsers out in the cold. For some situations, the ...
<blockquote> is there some good reason from a security perspective to allow only TLS 1.0, or is it simply pure "laziness" </blockquote> It is in most cases just the TLS stack used. One of the most common stacks in web servers on UNIX/Linux is OpenSSL and the still widely used (and supported) versions 0.9.8 and 1.0.0...
https://security.stackexchange.com
66,755
[ "https://softwareengineering.stackexchange.com/questions/66755", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/2329/" ]
Many programmers, upon first encountering Python, are immediately put off by the significance of whitespace. I've heard a variety of reasons that this is inconvenient, but I've never heard a complaint from a Python programmer. Of course, I haven't met a lot of Python programmers, as I have spent my career in the Java ...
There is only one case in which I find the whitespace to be annoying, and that is when modifying existing code so that a block of code has to become more or less indented than before (e.g., adding or deleting an <code>if:</code> before the code). When writing in a language like C, you just add the <code>if</code> and a...
I love Python's significant whitespace. To me it's the perfect example of DRY at a syntactic level. The human-readable way to indicate where a block of code begins and ends is with indentation. If you want your code to be readable, you have to indent it regardless of language. It's silly to make the programmer spec...
https://softwareengineering.stackexchange.com
927,765
[ "https://math.stackexchange.com/questions/927765", "https://math.stackexchange.com", "https://math.stackexchange.com/users/74795/" ]
How do you show that $$a+b&gt; \sqrt{a^2+b^2-ab}, \qquad a, b &gt;0$$ I could write $\sqrt{a^2+b^2-ab}=\sqrt{(a+b)^2-3ab}$, but this seems to lead nowhere.
$$a+b&gt; \sqrt{a^2+b^2-ab} \iff (a+b)^2&gt;\left (\sqrt{a^2+b^2-ab}\right )^2$$ $$ \iff\quad a^2+2ab+b^2&gt;a^2+b^2-ab$$ $$\iff\quad 3ab&gt;0 \quad \iff\quad ab&gt;0$$ which is correct because of the hypothesis $a,b &gt;0$.
Note that $2ab &gt; -ab \Rightarrow a^2+b^2+2ab &gt; a^2 + b^2 -ab \Rightarrow (a+b)^2 &gt; a^2 + b^2 -ab \Rightarrow a+b &gt; \sqrt{a^2 + b^2 -ab}$ I was able to do this by squaring the original inequality I was supposed to prove, and then I worked backwards.
https://math.stackexchange.com
371,244
[ "https://softwareengineering.stackexchange.com/questions/371244", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/304824/" ]
I was started programming in 6 months ago in college. I learned Python, C and Java. I want to create a project and using these languages. For example to searching part should use C because it's faster than the others. To design java etc ... How do you use different languages in same project? Is there any special method...
When you don't have to, don't do it! It will become very painful, especially if the languages cross boundaries like you suggested (read Clean Architecture about the boundaries). If you really want to do it, there are are so called interop layers in each software (NDK for Java for example). But you always have to care ...
You might try to refine your concept of "one project". If you're using the languages along clearly defined boundaries it sounds like you have multiple projects that work together. If that is the case then it's probably best to split them into separate projects. As distribution or deployment you can add the combining or...
https://softwareengineering.stackexchange.com
139,593
[ "https://stats.stackexchange.com/questions/139593", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/69143/" ]
My question is why Multiple Linear Regression (MLR), based on least squares, cannot be built when the number of variables $(p)$ are larger than the number of samples $(n)$? Can one explain why is it like this?
I will provide a visual in a very simple case because it is the easiest case to visualize. Imagine you are trying to fit the following linear model: $Y\sim \alpha + X\beta + \epsilon$. In this situation you have two parameters, $\alpha$ and $\beta$, and imagine you only have a sample size of $n=1$. Your single piece o...
I believe what Nick was saying in his comment is: your MLR with N variables is trying to fix N values (coefficients) in N-dimensional space, but you are trying to do it with M (M &lt; N) pieces of data. How will you do this? Since you only have M data points, the other M-N dimensions of your answer are free-floating, ...
https://stats.stackexchange.com
530,840
[ "https://physics.stackexchange.com/questions/530840", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/253994/" ]
The kinetic energy of a body's motion is given by the equation <span class="math-container">$$ E_{kin} = \frac{1}{2}m v^2, $$</span> where <span class="math-container">$m$</span> is the body's mass and <span class="math-container">$v$</span> its velocity. If I consider rotations, it is <span class="math-container">$$ ...
The first thing to note is that almost all of the formulas you wrote are actually <em>approximations.</em> For example, the kinetic energy <span class="math-container">$E = \frac{1}{2}mv^{2}$</span> is actually an approximation to the relativistic formula <span class="math-container">$E = (\gamma - 1)mc^{2}$</span>. Th...
First of all - kinetic energy is very different kind of energy from the rest. The energy of the spring, capacity, inductivity and gravitation is given by the work forces are able to do on the object, but kinetic energy is energy that tells you how does this work influence the objects movement. Now the spring, capacit...
https://physics.stackexchange.com
140,691
[ "https://mathoverflow.net/questions/140691", "https://mathoverflow.net", "https://mathoverflow.net/users/13441/" ]
Suppose $S^1$ is acting smoothly on $S^n$ and $M$ is a connected component of the set of fixed points of the action. What can be said about $M$? Is it true that $\pi_1(M)=0$? (<em>sorry this first bit of the question is silly since any $S^k$ can appear</em>) Is it true that $M$ has to be homeomorphic to a sphere? If ...
The fixed point set need not be simply connected in general. If $M$ is any smooth homology $(n-2)$-sphere that bounds a smooth contractible $(n-1)$-manifold $W$ (such exist in abundance), then $S^1$ acts smoothly on the $(n+1)$-disk $W\times D^2$, by rotations in the $D^2$ factor, with fixed point set $W$ and therefore...
It is known that $M$ has the homology of a sphere, see [1] But you probably knew that. What you also can describe pretty nicely is the cohomology of the orbit space $S^n/G$. To be more precise $S^n/G$ has the cohomology of the join of a sphere and a complex projective space and the dimension of this sphere is exactly ...
https://mathoverflow.net
238,635
[ "https://physics.stackexchange.com/questions/238635", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/87129/" ]
I will be explaining what I think: A battery acts like a pump which provides energy to do work on negative charges to move them towards the negative terminal, and hence creating an electric field. Now, due to this field, when a wire is connected to make a circuit, electrons move from negative to positive terminal, the...
If you add more resistors in series the effect will be the opposite of what you say: the battery will last longer. A battery has a certain rated capacity, written in mAh (milliamps times hours). Divide this capacity by the current you are drawing and you will get how much will that battery last in hours, at the same cu...
The power consumed by your circuit determines how fast the battery drains. P = I * E: power (Watts) is found by multiplying the current (Amps) by the voltage (Volts). Since your battery has a (reasonably) constant voltage under normal operation, current is the variable here. I = E / R, amps = volts / ohms. If we comb...
https://physics.stackexchange.com
3,221
[ "https://dba.stackexchange.com/questions/3221", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/2074/" ]
I'd like to limit the rows and columns that come back from the <pre><code>SHOW TABLE STATUS </code></pre> command in MySQL 5.1. Is there a way to get this same information through a <code>SELECT</code> statement so I can manipulate the results in a normal way?
This has more columns than SHOW TABLE STATUS; but does the trick: <pre><code>SELECT * FROM information_schema.tables WHERE table_schema = DATABASE(); </code></pre> UPDATE 2011-06-07 19:02 <pre><code>SELECT table_name,Engine,Version,Row_format,table_rows,Avg_row_length, Data_length,Max_data_length,Index_length,Data_f...
<pre><code>show table status like 'table1'; </code></pre> You can't manipulate the columns this way, but it is easier to select just the tables you want and get the normal <code>SHOW TABLE STATUS</code> output.
https://dba.stackexchange.com
170,933
[ "https://dba.stackexchange.com/questions/170933", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/47215/" ]
I wanted to create a second log file, but by mistake I created a data file. Now I'm trying to remove it, but I get the error message "the file cannot be removed because it is not empty". The following query lists a lot of tables: <pre><code>SELECT o.name AS TableOrIndex FROM sysfiles f JOIN dbo.sysfilegroups s ON f.g...
I was unable to remove the ndf file. Even the query I posted on the question was being empty, meaning there was no table data on the ndf file, but still the remove command was failing. I just copied create table code of all tables on the DB, removed the DB and recreated it with clean files. This is a ETL stage DB, the...
Use: <pre><code>DBCC SHRINKFILE('logicalname', EMPTYFILE); ALTER DATABASE database_name REMOVE FILE logicalname; </code></pre>
https://dba.stackexchange.com
156,242
[ "https://physics.stackexchange.com/questions/156242", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/27934/" ]
I'm working through Griffiths' <em>Introduction to Quantum Mechanics</em> (2nd edition) and I'm trying to solve problem 4.24 b. In this problem, you're supposed to first find the normalized eigenfunctions to the allowed energies of a rigid rotator, which I correctly realized should be spherical harmonics. Then, you sho...
I’m not sure why this was bumped to the community page, since the relevant answer is contained in bits and pieces in the preceding comments and answer. Anyway, in summary: @Sofia is correct. Griffiths uses a non-standard convention in this question, replacing $l$ with $n$. ‘Degeneracy’ just means that there are multi...
Griffiths 2nd edition Equation [4.118] and [4.119]: $$L^2 f_\ell ^m=\hbar ^2\ell (\ell+1)f_\ell ^m$$ and $$ L_z f_\ell ^m=\hbar m f_\ell ^m$$ where $\ell =0, 1/2, 1, 3/2, \ldots $ and $m=-\ell ,\ldots ,\ell$. There is are degeneracies in the $L^2$ operator since the eigenvalue only depends on the $\ell $ index. T...
https://physics.stackexchange.com
2,346,065
[ "https://math.stackexchange.com/questions/2346065", "https://math.stackexchange.com", "https://math.stackexchange.com/users/458554/" ]
I want to prove, that every closed interval in $\mathbb{R}^1$ is closed set. Can I use the argument, that there are uncountably many points in $\mathbb{R}^1$ and if we will take arbitrary point $x$,that belongs to a closed interval,and take arbitrary neighbourhood around this point, we will always find a point, that ...
You're supposed to prove that any limit point of $I$ is within $I$, but what you do in your proof is to a-priori assume that $x\in I$ and then prove that $x$ is a limit point of $I$. Actually what you're proving is that $I$ is dense in itself, note how your proof also works for open intervals. Besides your proof is br...
I don't see how your argument is in any way a proof of the original claim. There are two major problems with it: <ol> <li>You did not tell us what definition of closed set you are using.</li> <li>You did not structure the argument, so it is impossible to follow.</li> </ol> <hr> A <em>good</em> argument would look so...
https://math.stackexchange.com
18,028
[ "https://quant.stackexchange.com/questions/18028", "https://quant.stackexchange.com", "https://quant.stackexchange.com/users/218/" ]
What mathematical concepts are required before I can understand what exactly is a Geometric Brownian motion as applicable to stock prices? I mean which branches of probability, calculus, statistics etc. are needed to understand GBM? By 'understand', I mean gain an intuitive understanding.
you need to know multivariable calculus and partial differential equations
If you know basic probability and basic programming you can write a MATLAB program less than 10 lines long to simulate (in discrete time) geometric brownian motion and thus gain a <em>basic</em> understanding of how GBM works. To understand what happens as the time step goes to zero, and to prove properties of the res...
https://quant.stackexchange.com
6,028
[ "https://electronics.stackexchange.com/questions/6028", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/1225/" ]
I'm building a 3.3V 400mA power supply around an ultra fast buck reg (3 MHz or 1.6 MHz, LM2734Z/X.) According to simulations, the ripple will be &lt;2mVp-p. The noise floor of my scope is about 500µVp-p on 5mV/div (the minimum setting), so how do I measure such a small signal? I'm thinking I'm going to need an amplif...
Just an idea... Measure with two probes and use the add function for the two channels :)
I have a similar scope. Not a bad little unit but I have to take the front panel off and clean all the buttons. :-) You've already figured out that accumulate mode will give you a good idea of the "envelope" of the ripple over time. In order to get a clearer picture than that you'll need either a better scope or ampli...
https://electronics.stackexchange.com
121,528
[ "https://stats.stackexchange.com/questions/121528", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/11708/" ]
If a "distribution" is constant, then CLT is not going to work, obviously. However, even if it is not a constant, but variance is very small, the distribution of the sums is still not normal. For example: <pre><code>import numpy as np from collections import Counter a = np.zeros(1000) a[0] = 10 samples = [np.sum(np....
What I did was discard all the words that are in the test set and that weren't on the train set, and rearrange everything so the order are the same in each matrix. It can be seen in the following Python code. x_train is a pandas dataframe which contains the training text, and x_test is a pandas dataframe which contain...
You have two options. The first and easiest one is to simply perform the dimension reduction on a matrix composed by training set and test set together. At the end of the process just split the final set between training and test set either by selecting lines or by a random process. The second option is to multiply...
https://stats.stackexchange.com
23,542
[ "https://physics.stackexchange.com/questions/23542", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/8589/" ]
I am receiving unknown units of speed from another system. I must divide the value by 32 to get meters per second. What units do I use to refer to the values I'm receiving? Is there any such unit? Is this just random malice from the previous developers? Google give me nothing.
The reason is that you have periodic boundary conditions in the azimuthal direction while there are no special constraints along the cylinder axis (note that, as in the radial direction we have the $\pi$ bonds of the carbon lattice the electron's wavefunction must be strongly confined). Other way to see this, in the az...
it really makes sense if you take a slice of the bunch of nanofibers in any axial plane, and you'll notice that the fibers form roughly a regular lattice. A regular lattice implies that the longest wavelength not severely absorbed by the carbon walls are of the order of the lattice separation. Also the integer multiple...
https://physics.stackexchange.com
79,415
[ "https://electronics.stackexchange.com/questions/79415", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/24543/" ]
We are designing an image processing pipeline on an FPGA which will need the use of memory interfaces at various pipeline stages. Because of the size of the memory required we decided to go with a DDR3 design. It would be really useful if the pipeline stages can access there own memory in an independent manner so tha...
<blockquote> Does anybody have any experience in using multiple controllers on an FPGA? </blockquote> Yes, I've helped out on a design for an HD video pipeline that used two DDR memory controllers, but I don't know whether they were DDR3 specifically. One 32-bit wide memory held the main frame buffer, and the other ...
As long as you have sufficient logic cells and IO pins, you can have as many memory interfaces as you like. On the downside, narrow memory implies soldering chips down rather than using DIMMs (or other modules) which means a significant cost premium - unless you are buying huge volumes of chips.
https://electronics.stackexchange.com
214,928
[ "https://softwareengineering.stackexchange.com/questions/214928", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/94519/" ]
I was going thru a video (from <code>coursera - by sedgewick</code>) in which he argues that <code>you cannot sustain Moore's law using a quadratic algorithm</code>.He elaborates like this In year 197* you build a computer of power X ,and need to count N objects.This takes M days According to <code>Moore's law</code>...
Let <code>T(N)</code> the time (in days) needed to execute an algorithm for N objects on a computer of "power 1", then the number of days needed is first <pre><code>T(N)/X </code></pre> and second <pre><code>T(2N)/2X </code></pre> Now set T(N)=N in your first case and T(2N)=4N in your second case, and I think you c...
When Sedgwick talks of a "quadratic" algorithm, he means one where the effort is <em>not</em> proportional to the size of the input. For instance, if you have ten letters in your alphabet, there are 100 possible two-letter words, but if you have twenty letters, it's 400 possible words, not just 200. In other words, the...
https://softwareengineering.stackexchange.com
212,053
[ "https://security.stackexchange.com/questions/212053", "https://security.stackexchange.com", "https://security.stackexchange.com/users/210432/" ]
Is it widely known that in the opposite way (an unknown USB to safe pc) it could be really dangerous. But I can't find any info if is it dangerous to put a drive to other pc. Case: <ol> <li>I have my USB drive with some unimportant data to print.</li> <li>I put it into pc in copy point.</li> <li>I print my stuff.</li...
You said, <blockquote> I can't find any info if is it dangerous to put a drive to other pc </blockquote> Before anyone tries to answer that, we need to know what you consider "dangerous" to mean. If you're concerned about the contents of the files you've put on the drive (including any metadata that may be attache...
Well if the USB drive is infected from the PC (which shouldn't be too hard, to write a program that does it in the background) then in step 4 your computer would be infected. Since you need to connect the USB drive to your or some computer before formatting it.
https://security.stackexchange.com