yes, c + + is still useful in embedded systems. as everyone else has said, it still depends on the system itself, like an 8 - bit uc would probably be a no - no in my book even though there is a compiler out there and some people do it ( shudder ). there's still an advantage to using c + + even when you scale it down to something like " c + " even in a 8 - bit micro world. what do i mean by " c + "? i mean don't use new / delete, avoid exceptions, avoid virtual classes with inheritance, possibly avoid inheritance all together, be very careful with templates, use inline functions instead of macros, and use const variables instead of # defines. i've been working both in c and c + + in embedded systems for well over a decade now, and some of my youthful enthusiasm for c + + has definitely worn off due to some real world problems that shake one's naivete. i have seen the worst of c + + in an embedded systems which i would like to refer to as " cs programmers gone wild in an ee world. " in fact, that is something i'm working on with my client to improve this one codebase they have among others. the danger of c + + is because it's a very very powerful tool much like a two - edged sword that can cut both your arm and leg off if not educated and disciplined properly in it's language and general programming itself. c is more like a single - edged sword, but still just as sharp. with c + + it's too easy to get very high - levels of abstraction and create obfuscated interfaces that become meaningless in the long - term, and that's partly due to c + + flexibility in solving the same problem with many different language features ( templates, oop, procedural, rtti, oop + templates, overloading, inlining ). i finished a two 4 - hour seminars on embedded software in c + + by the c + + guru, scott meyers. he pointed out some things about templates that i never considered before and how much more they can help creating safety - critical code. the jist of it is, you can't have dead code in software that has to meet stringent safety - critical code requirements. templates can help you accomplish this, since the compiler only creates the code it needs when instantiating templates. however, one must become more thoroughly


educated in their use to design correctly for this feature which is harder to accomplish in c because linkers don't always optimize dead code. he also demonstrated a feature of templates that could only be accomplished in c + + and would have kept the mars climate observer from crashing had nasa implemented a similar system to protect units of measurement in the calculations. scott meyers is a very big proponent on templates and judicious use of inlining, and i must say i'm still skeptical on being gung ho about templates. i tend to shy away from them, even though he says they should only be applied where they become the best tool. he also makes the point that c + + gives you the tools to make really good interfaces that are easy to use right and make it hard to use wrong. again, that's the hard part. one must come to a level of mastery in c + + before you can know how to apply these features in most efficient way to be the best design solution. the same goes for oop. in the embedded world, you must familiarize yourself with what kind of code the compiler is going to spit out to know if you can handle the run - time costs of run - time polymorphism. you need to be willing to make measurements as well to prove your design is going to meet your deadline requirements. is that new interruptmanager class going to make my interrupt latency too long? there are other forms of polymorphism that may fit your problem better such as link - time polymorphism which c can do as well, but c + + can do through the pimpl design pattern ( opaque pointer ). i say that all to say, that c + + has its place in the embedded world. you can hate it all you want, but it's not going away. it can be written in a very efficient manner, but it's harder to learn how to do it correctly than with c. it can sometimes work better than c at solving a problem and sometimes expressing a better interface, but again, you've got to educate yourself and not be afraid to learn how.


the assumption that the layers are all cylindrical is a good first approximation. the assumption that the layers form a logarithmic spiral is not a good assumption at all, because it supposes that the thickness of the paper at any point is proportional to its distance from the center. this seems to me to be quite absurd. an alternative assumption is that the layers form an archimedean spiral. this is slightly more realistic, since it says the paper has a uniform thickness from beginning to end. but this assumption is not a much more realistic than the assumption that all layers are cylindrical ; in fact, in some ways it is less realistic. here's how a sheet of thickness $ h $ actually wraps around a cylinder. first, we glue one side of the sheet ( near the end of the sheet ) to the surface of the cylinder. then we start rotating the cylinder. as the cylinder rotates, it pulls the outstretched sheet around itself. near the end of the first full rotation of the cylinder, the wrapping looks like this : notice that the sheet lies directly on the surface of the cylinder, that is, this part of the wrapped sheet is cylindrical. at some angle of rotation, the glued end of the sheet hits the part of the sheet that is being wrapped. the point where the sheet is tangent to the cylinder at that time is the last point of contact with the cylinder ; the sheet goes straight from that point to the point of contact with the glued end, and then proceeds to wrap in a cylindrical shape around the first layer of the wrapped sheet, like this : as we continue rotating the cylinder, it takes up more and more layers of the sheet, each layer consisting of a cylindrical section going most of the way around the roll, followed by a flat section that joins this layer to the next layer. we end up with something like this : notice that i cut the sheet just at the point where it was about to enter another straight section. i claim ( without proof ) that this produces a local maximum in the ratio of the length of the wrapped sheet of paper to the greatest thickness of paper around the inner cylinder. the next local maximum ( i claim ) will occur at the corresponding point of the next wrap of the sheet. the question now is what the thickness of each layer is. the inner surface of the cylindrical portion of each layer of the wrapped sheet has less area than the outer surface, but the portion of the original ( unwrapped ) sheet that was wound onto the roll to make this layer had equal area on


both sides. so either the inner surface was somehow compressed, or the outer surface was stretched, or both. i think the most realistic assumption is that both compression and stretching occurred. in reality, i would guess that the inner surface is compressed more than the outer surface is stretched, but i do not know what the most likely ratio of compression to stretching would be. it is simpler to assume that the two effects are equal. the length of the sheet used to make any part of one layer of the roll is therefore equal to the length of the surface midway between the inner and outer surfaces of that layer. for example, to wrap the first layer halfway around the central cylinder of radius $ r $, we use a length $ \ pi \ left ( r + \ frac h2 \ right ) $ of the sheet of paper. the reason this particularly simplifies our calculations is that the length of paper used in any part of the roll is simply the area of the cross - section of that part of the roll divided by the thickness of the paper. the entire roll has inner radius $ r $ and outer radius $ r = r + nh $, where $ n $ is the maximum number of layers at any point around the central cylinder. ( in the figure, $ n = 5 $. ) the blue lines are sides of a right triangle whose vertices are the center of the inner cylinder and the points where the first layer last touches the inner cylinder and first touches its own end. this triangle has hypotenuse $ r + h $ and one leg is $ r $, so the other leg ( which is the length of the straight portion of the sheet ) is $ $ \ sqrt { ( r + h ) ^ 2 - r ^ 2 } = \ sqrt { ( 2r + h ) h }. $ $ each straight portion of each layer is connected to the next layer of paper by wrapping around either the point of contact with the glued end of the sheet ( the first time ) or around the shape made by wrapping the previous layer around this part of the layer below ; this forms a segment of a cylinder between the red lines with center at the point of contact with the glued end. the angle between the red lines is the same as the angle of the blue triangle at the center of the cylinder, namely $ $ \ alpha = \ arccos \ frac { r } { r + h }. $ $ now let's add up all parts of the roll. we have an almost - complete hollow


cylinder with inner radius $ r $ and outer radius $ r $, missing only a segment of angle $ \ alpha $. the cross - sectional area of this is $ $ a _ 1 = \ left ( \ pi - \ frac { \ alpha } { 2 } \ right ) ( r ^ 2 - r ^ 2 ). $ $ we have a rectangular prism whose cross - sectional area is the product of two of its sides, $ $ a _ 2 = ( r - r - h ) \ sqrt { ( 2r + h ) h }. $ $ finally, we have a segment of a cylinder of radius $ r - r - h $ ( between the red lines ) whose cross - sectional area is $ $ a _ 3 = \ frac { \ alpha } { 2 } ( r - r - h ) ^ 2. $ $ adding this up and dividing by $ h $, the total length of the sheet comes to \ begin { align } l & = \ frac1h ( a _ 1 + a _ 2 + a _ 3 ) \ \ & = \ frac1h \ left ( \ pi - \ frac { \ alpha } { 2 } \ right ) ( r ^ 2 - r ^ 2 ) + \ frac1h ( r - r - h ) \ sqrt { ( 2r + h ) h } + \ frac { \ alpha } { 2h } ( r - r - h ) ^ 2. \ end { align } for $ n $ layers on a roll, using the formula $ r = r + nh $, we have $ r - r = nh $, $ r + r = 2r + nh $, $ r ^ 2 - r ^ 2 = ( r + r ) ( r - r ) = ( 2r + nh ) nh $, and $ r - r - h = ( n - 1 ) h $. the length then is \ begin { align } l & = \ left ( \ pi - \ frac { \ alpha } { 2 } \ right ) ( 2r + nh ) n + ( n - 1 ) \ sqrt { ( 2r + h ) h } + \ frac { \ alpha h } { 2 } ( n - 1 ) ^ 2 \ \ & = 2n \ pi r + n ^ 2 \ pi h + ( n - 1 ) \ sqrt { ( 2r + h ) h } - \ left ( n ( r + h


) - \ frac h2 \ right ) \ arccos \ frac { r } { r + h } \ \ & = n ( r + r ) \ pi + ( n - 1 ) \ sqrt { ( 2r + h ) h } - \ left ( n ( r + h ) - \ frac h2 \ right ) \ arccos \ frac { r } { r + h }. \ end { align } one notable difference between this estimate and some others ( including the original ) is that i assume there can be at most $ ( r - r ) / h $ layers of paper over any part of the central cylinder, not $ 1 + ( r - r ) / h $ layers. the total length is the number of layers times $ 2 \ pi $ times the average radius, $ ( r + r ) / 2 $, adjusted by the amount that is missing in the section of the roll that is only $ n - 1 $ sheets thick. things are not too much worse if we assume a different but uniform ratio of inner - compression to outer - stretching, provided that we keep the same paper thickness regardless of curvature ; we just have to make an adjustment to the inner and outer radii of any cylindrical segment of the roll, which i think i'll leave as " an exercise for the reader. " but this involves a change in volume of the sheet of paper. if we also keep the volume constant, we find that the sheet gets thicker or thinner depending on the ratio of stretch to compression and the curvature of the sheet. with constant volume, the length of paper in the main part of the roll ( everywhere where we get the the full number of layers ) is the same as in the estimate above, but the total length of the parts of the sheet that connect one layer to the next might change slightly. update : per request, here are the results of applying the formula above to the input values given as an example in the question : $ h = 0. 1 $, $ r = 75 $, and $ r = 25 $ ( inferred from $ r - r = b = 50 $ ), all measured in millimeters. since $ n = ( r - r ) / h $, we have $ n = 500 $. for a first approximation of the total length of paper, let's consider just the first term of the formula. this gives us $ $ l _ 1 = n ( r + r ) \ pi = 500 \ cd


##ot 100 \ pi \ approx 157079. 63267949, $ $ or about $ 157 $ meters, the same as in the example in the question. the remaining two terms yield \ begin { align } l - l _ 1 & = ( n - 1 ) \ sqrt { ( 2r + h ) h } - \ left ( n ( r + h ) - \ frac h2 \ right ) \ arccos \ frac { r } { r + h } \ \ & = 499 \ sqrt { 50. 1 \ cdot 0. 1 } - ( 500 ( 25. 1 ) - 0. 05 ) \ arccos \ frac { 25 } { 25. 1 } \ \ & \ approx - 3. 72246774. \ end { align } this is a very small correction, less than $ 2. 4 \ times 10 ^ { - 5 } l _ 1 $. in reality ( as opposed to my idealized model of constant - thickness constant - volume toilet paper ), this " correction " is surely insignificant compared to the uncertainties of estimating the average thickness of the paper in each layer of a roll ( not to mention any non - uniformity in how it is rolled by the manufacturing machinery ). we can also compare $ \ lvert l - l _ 1 \ rvert $ to the amount of paper that would be missing if the paper in the " flat " segment of the roll were instead $ n - 1 $ layers following the curve of the rest of the paper. the angle $ \ alpha $ is about $ 0. 089294 $ radians ( about $ 5. 1162 $ degrees ), so if the missing layer were the innermost layer, its length would be $ 25. 05 \ alpha \ approx 2. 24 $, and if it were the outermost layer it would be $ 74. 95 \ alpha \ approx 6. 69 $ ( in millimeters ). just for amusement, i also tried expanding $ l - l _ 1 $ as a power series around $ h = 0 $ ( with a little help from wolfram alpha ). ( to make $ l - l _ 1 $ a function of one variable $ h $ with constants $ r $ and $ r $, make the substitution $ n = ( r - r ) / h $. ) this turns out to be a series of powers of $ \ sqrt h $ whose leading term is $ $ - \ fra


##c { ( r + 2r ) \ sqrt2 } { 3 \ sqrt r } \ sqrt h. $ $ plugging in the values from the example, this evaluates to approximately $ - 3. 7267799625 $. if you really wanted the length of the idealized toilet roll to the nearest millimeter, but could tolerate an error of a few $ \ mu \ mathrm m $ ( for typical dimensions of a toilet roll ), a suitable approximation would be $ $ l \ approx \ frac { \ pi ( r ^ 2 - r ^ 2 ) } { h } - \ frac { ( r + 2r ) \ sqrt2 } { 3 \ sqrt r } \ sqrt h. $ $


worst - case hardness of np - complete problems is not sufficient for cryptography. even if np - complete problems are hard in the worst - case ( $ p \ ne np $ ), they still could be efficiently solvable in the average - case. cryptography assumes the existence of average - case intractable problems in np. also, proving the existence of hard - on - average problems in np using the $ p \ ne np $ assumption is a major open problem. an excellent read is the classic by russell impagliazzo, a personal view of average - case complexity, 1995. an excellent survey is average - case complexity by bogdanov and trevisan, foundations and trends in theoretical computer science vol. 2, no 1 ( 2006 ) 1 – 106


let ’ s start with what they have in common : all three formats store sequence data, and sequence metadata. furthermore, all three formats are text - based. however, beyond that all three formats are different and serve different purposes. let ’ s start with the simplest format : fasta fasta stores a variable number of sequence records, and for each record it stores the sequence itself, and a sequence id. each record starts with a header line whose first character is >, followed by the sequence id. the next lines of a record contain the actual sequence. the wikipedia artice gives several examples for peptide sequences, but since fastq and sam are used exclusively (? ) for nucleotide sequences, here ’ s a nucleotide example : > mus _ musculus _ trna - ala - agc - 1 - 1 ( chr13. trna34 - alaagc ) gggggtgtagctcagtggtagagcgcgtgcttagcatgcacgaggccctgggttcgatcc ccagcacctcca > mus _ musculus _ trna - ala - agc - 10 - 1 ( chr13. trna457 - alaagc ) gggggattagctcaaatggtagagcgctcgcttagcatgcaagaggtagtgggatcgatg cccacatcctcca the id can be in any arbitrary format, although several conventions exist. in the context of nucleotide sequences, fasta is mostly used to store reference data ; that is, data extracted from a curated database ; the above is adapted from gtrnadb ( a database of trna sequences ). fastq fastq was conceived to solve a specific problem arising during sequencing : due to how different sequencing technologies work, the confidence in each base call ( that is, the estimated probability of having correctly identified a given nucleotide ) varies. this is expressed in the phred quality score. fasta had no standardised way of encoding this. by contrast, a fastq record contains a sequence of quality scores for each nucleotide. a fastq record has the following format : a line starting with @, containing the sequence id. one or more lines that contain the sequence. a new line starting with the character +, and being either empty or repeating the sequence id. one or more lines that contain the quality scores. here ’ s an example of a fastq file with two records : @ 071112 _ sl


##xa - eas1 _ s _ 7 : 5 : 1 : 817 : 345 gggtgatggccgctgccgatggcgtc aaatcccacc + iiiiiiiiiiiiiiiiiiiiiiiiii iiii9ig9ic @ 071112 _ slxa - eas1 _ s _ 7 : 5 : 1 : 801 : 338 gttcagggatacgacgtttgtattttaagaatctga + iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii6ibi fastq files are mostly used to store short - read data from high - throughput sequencing experiments. the sequence and quality scores are usually put into a single line each, and indeed many tools assume that each record in a fastq file is exactly four lines long, even though this isn ’ t guaranteed. as with fasta, the format of the sequence id isn ’ t standardised, but different producers of fastq use fixed notations that follow strict conventions. sam sam files are so complex that a complete description [ pdf ] takes 15 pages. so here ’ s the short version. the original purpose of sam files is to store mapping information for sequences from high - throughput sequencing. as a consequence, a sam record needs to store more than just the sequence and its quality, it also needs to store information about where and how a sequence maps into the reference. unlike the previous formats, sam is tab - based, and each record, consisting of either 11 or 12 fields, fills exactly one line. here ’ s an example ( tabs replaced by fixed - width spacing ) : r001 99 chr1 7 30 17m = 37 39 ttagataaaggatactg iiiiiiiiiiiiiiiii r002 0 chrx 9 30 3s6m1p1i4m * 0 0 aaaagataaggata iiiiiiiiii6ibi nm : i : 1 for a description of the individual fields, refer to the documentation. the relevant bit is this : sam can express exactly the same information as fastq, plus, as mentioned, the mapping information. however, sam is also used to store read data without mapping information. in addition to sequence records, sam files can also contain a header, which stores information about the reference that the sequences were mapped to, and the tool used to create the sam file. header information precede the sequence records, and consist of lines starting with @. sam itself is almost never used as a storage format ;


instead, files are stored in bam format, which is a compact, gzipped, binary representation of sam. it stores the same information, just more efficiently. and, in conjunction with a search index, allows fast retrieval of individual records from the middle of the file ( = fast random access ). bam files are also much more compact than compressed fastq or fasta files. the above implies a hierarchy in what the formats can store : fasta ⊂ fastq ⊂ sam. in a typical high - throughput analysis workflow, you will encounter all three file types : fasta to store the reference genome / transcriptome that the sequence fragments will be mapped to. fastq to store the sequence fragments before mapping. sam / bam to store the sequence fragments after mapping.


as far as i'm aware, the most accurate methods for static calculations are full configuration interaction with a fully relativistic four - component dirac hamiltonian and a " complete enough " basis set. i'm not an expert in this particular area, but from what i know of the method, solving it using a variational method ( rather than a monte - carlo based method ) scales shockingly badly, since i think the number of slater determinants you have to include in your matrix scales something like $ o ( ^ { n _ { orbs } } c _ { n _ e } ) $. ( there's an article on the computational cost here. ) the related monte - carlo methods and methods based off them using " walkers " and networks of determinants can give results more quickly, but as implied above, aren't variational. and are still hideously costly. approximations currently in practical use just for energies for more than two atoms include : born oppenheimer, as you say : this is almost never a problem unless your system involves hydrogen atoms tunneling, or unless you're very near a state crossing / avoided crossing. ( see, for example, conical intersections. ) conceptually, there are non - adiabatic methods for the wavefunction / density, including cpmd, and there's also path - integral md which can account for nuclear tunneling effects. nonrelativistic calculations, and two - component approximations to the dirac equation : you can get an exact two - component formulation of the dirac equation, but more practically the zeroth - order regular approximation ( see lenthe et al, jchemphys, 1993 ) or the douglas - kroll - hess hamiltonian ( see reiher, computmolsci, 2012 ) are commonly used, and often ( probably usually ) neglecting spin - orbit coupling. basis sets and lcao : basis sets aren't perfect, but you can always make them more complete. dft functionals, which tend to attempt to provide a good enough attempt at the exchange and correlation without the computational cost of the more advanced methods below. ( and which come in a few different levels of approximation. lda is the entry - level one, gga, metagga and including exact exchange go further than that, and including the rpa is still a pretty expensive and new - ish technique as far as i'm aware. there are also functionals which use differing techniques as a function of


separation, and some which use vorticity which i think have application in magnetic or aromaticity studies. ) ( b3lyp, the functional some people love and some people love to hate, is a gga including a percentage of exact exchange. ) configuration interaction truncations : cis, cisd, cisdt, cisd ( t ), casscf, rasscf, etc. these are all approximations to ci which assume the most important excited determinants are the least excited ones. multi - reference configuration interaction ( truncations ) : ditto, but with a few different starting reference states. coupled - cluster method : i don't pretend to properly understand how this works, but it obtains similar results to configuration interaction truncations with the benefit of size - consistency ( i. e. $ e ( h _ 2 ) \ times 2 = e ( ( h _ 2 ) _ 2 $ ( at large separation ) ). for dynamics, many of the approximations refer to things like the limited size of a tractable system, and practical timestep choice - - it's pretty standard stuff in the numerical time simulation field. there's also temperature maintenance ( see nose - hoover or langevin thermostats ). this is mostly a set of statistical mechanics problems, though, as i understand it. anyway, if you're physics - minded, you can get a pretty good feel for what's neglected by looking at the formulations and papers about these methods : most commonly used methods will have at least one or two papers that aren't the original specification explaining their formulation and what it includes. or you can just talk to people who use them. ( people who study periodic systems with dft are always muttering about what different functionals do and don't include and account for. ) very few of the methods have specific surprising omissions or failure modes. the most difficult problem appears to be proper treatment of electron correlation, and anything above the hartree - fock method, which doesn't account for it at all, is an attempt to include it. as i understand it, getting to the accuracy of full relativistic ci with complete basis sets is never going to be cheap without dramatically reinventing ( or throwing away ) the algorithms we currently use. ( and for people saying that dft is the solution to everything, i'm waiting for your pure density orbital - free formulations. ) there's also the issue that the


more accurate you make your simulation by including more contributions and more complex formulations, the harder it is to actually do anything with. for example, spin orbit coupling is sometimes avoided solely because it makes everything more complicated to analyse ( but sometimes also because it has negligable effect ), and the canonical hartree - fock or kohn - sham orbitals can be pretty useful for understanding qualitative features of a system without layering on the additional output of more advanced methods. ( i hope some of this makes sense, it's probably a bit spotty. and i've probably missed someone's favourite approximation or niggle. )


there are a few industry approaches to this. the first is molded cables. the cables themselves have strain reliefs molded to fit a given entry point, either by custom moulding or with off the shelf reliefs that are chemically welded / bonded to the cable. not just glued, but welded together. the second is entry points designed to hold the cable. the cable is bent in a z or u shape around posts to hold it in place. the strength of the cable is used to prevent it from being pulled out. similarly, but less often seen now in the days of cheap molding or diy kits, is this. the cable is screwed into a holder which is prevented from moving in or out by the case and screw posts. both of those options are a bit out of an individual's reach. the third is through the use of cord grips or cable glands, also known as grommets. especially is a water tight fit is needed. they are screwed on, the cable past through, then the grip part is screwed. these prevent the cable from moving in or out, as well as sealing the hole. most can accommodate cables at least 80 % of the size of the opening. any smaller and they basically won't do the job. other options include cable fasteners or holders. these go around the cable and are screwed or bolted down ( or use plastic press fits ). these can be screwed into a pcb for example. cable grommets are a fairly hacky way of doing it, as they are not designed to hold onto the cable. instead they are designed to prevent the cable from being cut or damaged on a sharp or thin edge. but they can do in a pinch. as can tying a knot, though that mainly prevents pull outs, but might not be ideal for digital signals. pushing a cable in doesn't happen too often, so you might not worry about that. similar to the second method, is using two or three holes in a pcb to push a cable through ( up, down, up ), then pulling it tight. this moves the point of pressure away from the solder point and onto the cable + jacket. the other industry method is avoiding all this in the first place, by using panel mounted connectors ( or board mounted connectors like dell does for power plugs, yuck ).


i would suggest use ralee — rnalignment editor in emacs. it can get for you the consensus secondary structure, you can move left / right sequences and their secondary structures ( you can't do it in jalview! ), and more. it's an emacs mode, so could be a bit hard to start off, but just try, you don't have to use all emacs features to edit your alignments! the ralee ( rna alignment editor in emacs ) tool provides a simple environment for rna multiple sequence alignment editing, including structure - specific colour schemes, utilizing helper applications for structure prediction and many more conventional editing functions. sam griffiths - jones bioinformatics ( 2005 ) 21 ( 2 ) : 257 - 259. fig. you can move left / right sequences and their secondary structures ( you can't do it in jalview! )


people are skeptical because : no proof has come from an expert without having been rescinded shortly thereafter so much effort has been put into finding a proof, with no success, that it's assumed one will be either substantially complicated, or invent new mathematics for the proof the " proofs " that arise frequently fail to address hurdles which are known to exist. for example, many claim that 3sat is not in p, while providing an argument that also applies to 2sat. to be clear, the skepticism is of the proofs, not of the result itself.


i recommend you to check scott aaronson's blog post on a proof of the incompleteness theorem via turing machines and rosser's theorem. his proof of the incompleteness theorem is extremely simple and easy to follow.


i realize this question has been answered, but i don't think the extant answer really engages the question beyond pointing to a link generally related to the question's subject matter. in particular, the link describes one technique for programmatic network configuration, but that is not a " [ a ] standard and accepted method " for network configuration. by following a small set of clear rules, one can programmatically set a competent network architecture ( i. e., the number and type of neuronal layers and the number of neurons comprising each layer ). following this schema will give you a competent architecture but probably not an optimal one. but once this network is initialized, you can iteratively tune the configuration during training using a number of ancillary algorithms ; one family of these works by pruning nodes based on ( small ) values of the weight vector after a certain number of training epochs - - in other words, eliminating unnecessary / redundant nodes ( more on this below ). so every nn has three types of layers : input, hidden, and output. creating the nn architecture, therefore, means coming up with values for the number of layers of each type and the number of nodes in each of these layers. the input layer simple - - every nn has exactly one of them - - no exceptions that i'm aware of. with respect to the number of neurons comprising this layer, this parameter is completely and uniquely determined once you know the shape of your training data. specifically, the number of neurons comprising that layer is equal to the number of features ( columns ) in your data. some nn configurations add one additional node for a bias term. the output layer like the input layer, every nn has exactly one output layer. determining its size ( number of neurons ) is simple ; it is completely determined by the chosen model configuration. is your nn going to run in machine mode or regression mode ( the ml convention of using a term that is also used in statistics but assigning a different meaning to it is very confusing )? machine mode : returns a class label ( e. g., " premium account " / " basic account " ). regression mode returns a value ( e. g., price ). if the nn is a regressor, then the output layer has a single node. if the nn is a classifier, then it also has a single node unless softmax is used in which case the output layer has one node per class label in your model.


the hidden layers so those few rules set the number of layers and size ( neurons / layer ) for both the input and output layers. that leaves the hidden layers. how many hidden layers? well, if your data is linearly separable ( which you often know by the time you begin coding a nn ), then you don't need any hidden layers at all. of course, you don't need an nn to resolve your data either, but it will still do the job. beyond that, as you probably know, there's a mountain of commentary on the question of hidden layer configuration in nns ( see the insanely thorough and insightful nn faq for an excellent summary of that commentary ). one issue within this subject on which there is a consensus is the performance difference from adding additional hidden layers : the situations in which performance improves with a second ( or third, etc. ) hidden layer are very few. one hidden layer is sufficient for the large majority of problems. so what about the size of the hidden layer ( s ) - - how many neurons? there are some empirically derived rules of thumb ; of these, the most commonly relied on is'the optimal size of the hidden layer is usually between the size of the input and size of the output layers '. jeff heaton, the author of introduction to neural networks in java, offers a few more. in sum, for most problems, one could probably get decent performance ( even without a second optimization step ) by setting the hidden layer configuration using just two rules : ( i ) the number of hidden layers equals one ; and ( ii ) the number of neurons in that layer is the mean of the neurons in the input and output layers. optimization of the network configuration pruning describes a set of techniques to trim network size ( by nodes, not layers ) to improve computational performance and sometimes resolution performance. the gist of these techniques is removing nodes from the network during training by identifying those nodes which, if removed from the network, would not noticeably affect network performance ( i. e., resolution of the data ). ( even without using a formal pruning technique, you can get a rough idea of which nodes are not important by looking at your weight matrix after training ; look at weights very close to zero - - it's the nodes on either end of those weights that are often removed during pruning. ) obviously, if you use a pruning algorithm during training, then begin with a network configuration that is more likely


to have excess ( i. e.,'prunable') nodes - - in other words, when deciding on network architecture, err on the side of more neurons, if you add a pruning step. put another way, by applying a pruning algorithm to your network during training, you can approach optimal network configuration ; whether you can do that in a single " up - front " ( such as a genetic - algorithm - based algorithm ), i don't know, though i do know that for now, this two - step optimization is more common.


i think i can attempt to clear this up. usb - 100ma usb by default will deliver 100ma of current ( it is 500mw power because we know it is 5v, right? ) to a device. this is the most you can pull from a usb hub that does not have its own power supply, as they never offer more than 4 ports and keep a greedy 100ma for themselves. some computers that are cheaply built will use an bus - powered hub ( all of your usb connections share the same 500ma source and the electronics acting as a hub use that source also ) internally to increase the number of usb ports and to save a small amount of money. this can be frustrating, but you can always be guaranteed 100ma. usb - 500ma when a device is connected it goes through enumeration. this is not a trivial process and can be seen in detail on jan axelson's site. as you can see this is a long process, but a chip from a company like ftdi will handle the hard part for you. they discuss enumeration in one of their app notes. near the end of enumeration you setup device parameters. very specifically the configuration descriptors. if you look on this website they will show you all of the different pieces that can be set. it shows that you can get right up to 500ma of power requested. this is what you can expect from a computer. you can get ftdi chips to handle this for you, which is nice, as you only have to treat the chip as a serial line. usb - 1. 8a this is where things get interesting. you can purchase a charger that does outlet to usb at the store. this is a usb charging port. your computer does not supply these, and your device must be able to recognize it. first, to get the best information about usb, you sometimes have to bite the bullet and go to the people whom write the spec. i found great information about the usb charging spec here. the link on the page that is useful is the link for battery charging. this link seems to be tied to revision number, so i have linked both in case the revision is updated people can still access the information. now, what does this mean. if you open up the batt _ charging pdf and jump to chapter three they go into charging ports. specifically 3. 2. 1 explains how this is gone about. now they keep it very technical, but the key point is simple. a usb charging port


places a termination resistance between d + and d -. i would like to copy out the chapter that explains it, but it is a secured pdf and i cannot copy it out without retyping it. summing it up you may pull 100ma from a computer port. you may pull 500ma after enumeration and setting the correct configuration. computers vary their enforcement, as many others have said, but most i have had experience with will try to stop you. if you violate this, you may also damage a poorly design computer ( davr is spot on there, this is poor practice ). you may pull up to 1. 8a from a charging port, but this is a rare case where the port tells you something. you have to check for this and when it is verified you may do it. this is the same as buying a wall adapter, but you get to use a usb cable and usb port. why use the charging spec? so that when my phone dies, my charger charges it quickly, but if i do not have my charger i may pull power from a computer, while using the same hardware port to communicate files and information with my computer. please let me know if there is anything i can add.


blood is not a good source of water. 1 liter of blood contains about 800 ml of water, 170 grams of protein and 2 grams of sodium ( calculated from the composition of lamb blood ). when metabolized, 170 grams of protein yields the amount of urea that requires 1, 360 ml of water to be excreted in urine ( calculated from here ) ; 2 grams of sodium requires about 140 ml of water to be excreted ( from here ). this means that drinking 1 liter of blood, which contains 800 ml of water, will result in 1, 500 ml of water loss through the kidneys, which will leave you with 700 ml of negative water balance. fish blood can contain less protein, for example, trout ( check table 1 ) contains about 120 g of protein ( plasma protein + hemoglobin ) per liter of blood. using the same calculation as above ( 1 g protein results in the excretion of 8 ml of urine ), drinking of 1 liter of trout blood, which contains about 880 ml of water, will result in 960 ml of urine, so in 80 ml of negative water balance. turtle blood can contain about 80 g of protein ( plasma protein + hemoglobin ) and 3. 4 g of sodium per liter. drinking 1 liter of turtle blood, which contains about 920 ml of water, will result in 80 x 8 ml = 640 ml loss of urine due to protein, and ~ 240 ml due to sodium, which is 880 ml of urine in total. this leaves you with 40 ml of positive water balance ( to get 2 liters of water per day you would need to drink 50 liters of turtle blood, which isn't realistic. in various stories ( the atlantic, the diplomat, the telegraph ), according to which people have survived by drinking turtle blood, they have also drunk rainwater, so we can't conclude it was turtle blood that helped them. i'm not aware of any story that would provide a convincing evidence that the blood of turtle or any other animal is hydrating.


what you've implemented is a single - pole lowpass filter, sometimes called a leaky integrator. your signal has the difference equation : $ $ y [ n ] = 0. 8 y [ n - 1 ] + 0. 2 x [ n ] $ $ where $ x [ n ] $ is the input ( the unsmoothed bin value ) and $ y [ n ] $ is the smoothed bin value. this is a common way of implementing a simple, low - complexity lowpass filter. i've written about them several times before in previous answers ; see [ 1 ] [ 2 ] [ 3 ].


the impulse response and frequency response are two attributes that are useful for characterizing linear time - invariant ( lti ) systems. they provide two different ways of calculating what an lti system's output will be for a given input signal. a continuous - time lti system is usually illustrated like this : in general, the system $ h $ maps its input signal $ x ( t ) $ to a corresponding output signal $ y ( t ) $. there are many types of lti systems that can have apply very different transformations to the signals that pass through them. but, they all share two key characteristics : the system is linear, so it obeys the principle of superposition. stated simply, if you linearly combine two signals and input them to the system, the output is the same linear combination of what the outputs would have been had the signals been passed through individually. that is, if $ x _ 1 ( t ) $ maps to an output of $ y _ 1 ( t ) $ and $ x _ 2 ( t ) $ maps to an output of $ y _ 2 ( t ) $, then for all values of $ a _ 1 $ and $ a _ 2 $, $ $ h \ { a _ 1 x _ 1 ( t ) + a _ 2 x _ 2 ( t ) \ } = a _ 1 y _ 1 ( t ) + a _ 2 y _ 2 ( t ) $ $ the system is time - invariant, so its characteristics do not change with time. if you add a delay to the input signal, then you simply add the same delay to the output. for an input signal $ x ( t ) $ that maps to an output signal $ y ( t ) $, then for all values of $ \ tau $, $ $ h \ { x ( t - \ tau ) \ } = y ( t - \ tau ) $ $ discrete - time lti systems have the same properties ; the notation is different because of the discrete - versus - continuous difference, but they are a lot alike. these characteristics allow the operation of the system to be straightforwardly characterized using its impulse and frequency responses. they provide two perspectives on the system that can be used in different contexts. impulse response : the impulse that is referred to in the term impulse response is generally a short - duration time - domain signal. for continuous - time systems, this is the dirac delta function $ \ delta ( t ) $, while for discrete - time systems, the kronecker delta function $ \


delta [ n ] $ is typically used. a system's impulse response ( often annotated as $ h ( t ) $ for continuous - time systems or $ h [ n ] $ for discrete - time systems ) is defined as the output signal that results when an impulse is applied to the system input. why is this useful? it allows us to predict what the system's output will look like in the time domain. remember the linearity and time - invariance properties mentioned above? if we can decompose the system's input signal into a sum of a bunch of components, then the output is equal to the sum of the system outputs for each of those components. what if we could decompose our input signal into a sum of scaled and time - shifted impulses? then, the output would be equal to the sum of copies of the impulse response, scaled and time - shifted in the same way. for discrete - time systems, this is possible, because you can write any signal $ x [ n ] $ as a sum of scaled and time - shifted kronecker delta functions : $ $ x [ n ] = \ sum _ { k = 0 } ^ { \ infty } x [ k ] \ delta [ n - k ] $ $ each term in the sum is an impulse scaled by the value of $ x [ n ] $ at that time instant. what would we get if we passed $ x [ n ] $ through an lti system to yield $ y [ n ] $? simple : each scaled and time - delayed impulse that we put in yields a scaled and time - delayed copy of the impulse response at the output. that is : $ $ y [ n ] = \ sum _ { k = 0 } ^ { \ infty } x [ k ] h [ n - k ] $ $ where $ h [ n ] $ is the system's impulse response. the above equation is the convolution theorem for discrete - time lti systems. that is, for any signal $ x [ n ] $ that is input to an lti system, the system's output $ y [ n ] $ is equal to the discrete convolution of the input signal and the system's impulse response. for continuous - time systems, the above straightforward decomposition isn't possible in a strict mathematical sense ( the dirac delta has zero width and infinite height ), but at an engineering level, it's an approximate, intuitive way of looking


at the problem. a similar convolution theorem holds for these systems : $ $ y ( t ) = \ int _ { - \ infty } ^ { \ infty } x ( \ tau ) h ( t - \ tau ) d \ tau $ $ where, again, $ h ( t ) $ is the system's impulse response. there are a number of ways of deriving this relationship ( i think you could make a similar argument as above by claiming that dirac delta functions at all time shifts make up an orthogonal basis for the $ l ^ 2 $ hilbert space, noting that you can use the delta function's sifting property to project any function in $ l ^ 2 $ onto that basis, therefore allowing you to express system outputs in terms of the outputs associated with the basis ( i. e. time - shifted impulse responses ), but i'm not a licensed mathematician, so i'll leave that aside ). one method that relies only upon the aforementioned lti system properties is shown here. in summary : for both discrete - and continuous - time systems, the impulse response is useful because it allows us to calculate the output of these systems for any input signal ; the output is simply the input signal convolved with the impulse response function. frequency response : an lti system's frequency response provides a similar function : it allows you to calculate the effect that a system will have on an input signal, except those effects are illustrated in the frequency domain. recall the definition of the fourier transform : $ $ x ( f ) = \ int _ { - \ infty } ^ { \ infty } x ( t ) e ^ { - j 2 \ pi ft } dt $ $ more importantly for the sake of this illustration, look at its inverse : $ $ x ( t ) = \ int _ { - \ infty } ^ { \ infty } x ( f ) e ^ { j 2 \ pi ft } df $ $ in essence, this relation tells us that any time - domain signal $ x ( t ) $ can be broken up into a linear combination of many complex exponential functions at varying frequencies ( there is an analogous relationship for discrete - time signals called the discrete - time fourier transform ; i only treat the continuous - time case below for simplicity ). for a time - domain signal $ x ( t ) $, the fourier transform yields a corresponding function $ x ( f ) $ that specifies, for each frequency $ f $,


the scaling factor to apply to the complex exponential at frequency $ f $ in the aforementioned linear combination. these scaling factors are, in general, complex numbers. one way of looking at complex numbers is in amplitude / phase format, that is : $ $ x ( f ) = a ( f ) e ^ { j \ phi ( f ) } $ $ looking at it this way, then, $ x ( t ) $ can be written as a linear combination of many complex exponential functions, each scaled in amplitude by the function $ a ( f ) $ and shifted in phase by the function $ \ phi ( f ) $. this lines up well with the lti system properties that we discussed previously ; if we can decompose our input signal $ x ( t ) $ into a linear combination of a bunch of complex exponential functions, then we can write the output of the system as the same linear combination of the system response to those complex exponential functions. here's where it gets better : exponential functions are the eigenfunctions of linear time - invariant systems. the idea is, similar to eigenvectors in linear algebra, if you put an exponential function into an lti system, you get the same exponential function out, scaled by a ( generally complex ) value. this has the effect of changing the amplitude and phase of the exponential function that you put in. this is immensely useful when combined with the fourier - transform - based decomposition discussed above. as we said before, we can write any signal $ x ( t ) $ as a linear combination of many complex exponential functions at varying frequencies. if we pass $ x ( t ) $ into an lti system, then ( because those exponentials are eigenfunctions of the system ), the output contains complex exponentials at the same frequencies, only scaled in amplitude and shifted in phase. these effects on the exponentials'amplitudes and phases, as a function of frequency, is the system's frequency response. that is, for an input signal with fourier transform $ x ( f ) $ passed into system $ h $ to yield an output with a fourier transform $ y ( f ) $, $ $ y ( f ) = h ( f ) x ( f ) = a ( f ) e ^ { j \ phi ( f ) } x ( f ) $ $ in summary : so, if we know a system's frequency response $ h ( f ) $ and the fourier transform of the signal that we put into it $ x ( f )


$, then it is straightforward to calculate the fourier transform of the system's output ; it is merely the product of the frequency response and the input signal's transform. for each complex exponential frequency that is present in the spectrum $ x ( f ) $, the system has the effect of scaling that exponential in amplitude by $ a ( f ) $ and shifting the exponential in phase by $ \ phi ( f ) $ radians. bringing them together : an lti system's impulse response and frequency response are intimately related. the frequency response is simply the fourier transform of the system's impulse response ( to see why this relation holds, see the answers to this other question ). so, for a continuous - time system : $ $ h ( f ) = \ int _ { - \ infty } ^ { \ infty } h ( t ) e ^ { - j 2 \ pi ft } dt $ $ so, given either a system's impulse response or its frequency response, you can calculate the other. either one is sufficient to fully characterize the behavior of the system ; the impulse response is useful when operating in the time domain and the frequency response is useful when analyzing behavior in the frequency domain.


hint $ $ there is a $ \ rm \ color { darkorange } { unique } $ denominator $ \ rm \, \ color { # 0a0 } { 2 ^ k } $ having maximal power of $ \ : \! 2, \, $ so scaling by $ \ rm \, \ color { # c00 } { 2 ^ { k - 1 } } $ we deduce a contradiction $ \ large \ rm \, \ frac { 1 } 2 = \ frac { c } d \, $ with odd $ \ rm \, d \ : $ ( vs. $ \, \ rm d = 2c ), \, $ e. g. $ $ \ begin { eqnarray } & & \ rm \ \ \ \ \ color { 0a0 } { m } & = & \ \ 1 & + & \ frac { 1 } { 2 } & + & \ frac { 1 } { 3 } & + & \, \ color { # 0a0 } { \ frac { 1 } { 4 } } & + & \ frac { 1 } { 5 } & + & \ frac { 1 } { 6 } & + & \ frac { 1 } { 7 } \ \ & \ rightarrow \ & \ rm \ \ \ color { # c00 } { 2 } \ : \! m & = & \ \ 2 & + & \ 1 & + & \ frac { 2 } { 3 } & + & \, \ color { # 0a0 } { \ frac { 1 } { 2 } } & + & \ frac { 2 } { 5 } & + & \ frac { 1 } { 3 } & + & \ frac { 2 } { 7 } ^ \ phantom { m ^ m } \ \ & \ rightarrow \ & - \ color { # 0a0 } { \ frac { 1 } { 2 } } \ \ & = & \ \ 2 & + & \ 1 & + & \ frac { 2 } { 3 } & - & \ rm \ color { # c00 } { 2 } \ : \! m & + & \ frac { 2 } { 5 } & + & \ frac { 1 } { 3 } & + & \ frac { 2 } { 7 } ^ \ phantom { m ^ m } \ end { eqnarray } $ $ all denom


' s in the prior fractions are odd so they sum to fraction with odd denom $ \ rm \, d \, | \, 3 \ cdot 5 \ cdot 7 $. note $ $ said $ \ rm \ color { darkorange } { uniqueness } $ has easy proof : if $ \ rm \ : j \ : \! 2 ^ k $ is in the interval $ \ rm \, [ 1, n ] \, $ then so too is $ \, \ rm \ color { # 0a0 } { 2 ^ k } \! \ le \, j \ : \! 2 ^ k. \, $ but if $ \, \ rm j \ ge 2 \, $ then the interval contains $ \ rm \, 2 ^ { k + 1 } \! = 2 \ cdot \! 2 ^ k \! \ le j \ : \! 2 ^ k, \, $ contra maximality of $ \, \ rm k $. the argument is more naturally expressed using valuation theory, but i purposely avoided that because anton requested an " elementary " solution. the above proof can easily be made comprehensible to a high - school student. generally we can similarly prove that a sum of fractions is nonintegral if the highest power of a prime $ \, p \, $ in any denominator occurs in $ \ rm \ color { darkorange } { exactly \ one } $ denominator, e. g. see the remark here where i explain how it occurs in a trickier multiplicative form ( from a contest problem ). in valuation theory, this is a special case of a basic result on the valuation of a sum ( sometimes called the " dominance lemma " or similar ). another common application occurs when the sum of fractions arises from the evaluation of a polynomial, e. g. see here and its comment.


there is a couple of points to consider here, which i outline below. the goal here should be to find a workflow that is minimally intrusive on top of already using git. as of yet, there is no ideal workflow that covers all use cases, but what i outline below is the closest i could come to it. reproducibility is not just keeping all your data you have got your raw data that you start your project with. all other data in your project directory should never just " be there ", but have some record of where it comes from. data processing scripts are great for this, because they already document how you went from your raw to your analytical data, and then the files needed for your analyses. and those scripts can be versioned, with an appropriate single entry point of processing ( e. g. a makefile that describes how to run your scripts ). this way, the state of all your project files is defined by the raw data, and the version of your processing scripts ( and versions of external software, but that's a whole different kind of problem ). what data / code should and should not be versioned just as you would not version generated code files, you should not want to version 10k intermediary data files that you produced when performing your analyses. the data that should be versioned is your raw data ( at the start of your pipeline ), not automatically generated files. you might want to take snapshots of your project directory, but not keep every version of every file ever produced. this already cuts down your problem by a fair margin. approach 1 : actual versioning of data for your raw or analytical data, git lfs ( and alternatively git annex, that you already mention ) is designed to solve exactly this problem : add tracking information of files in your git tree, but do not store the content of those files in the repository ( because otherwise it would add the size of a non - diffable file with every change you make ). for your intermediate files, you do the same as you would do with intermediate code files : add them to your. gitignore and do not version them. this begs a couple of considerations : git lfs is a paid service from github ( the free tier is limited to 1 gb of storage / bandwidth per month, which is very little ), and it is more expensive than other comparable cloud storage solutions. you could consider paying for the storage at github


or running your own lfs server ( there is a reference implementation, but i assume this would still be a substantial effort ) git annex is free, but it replaces files by links and hence changes time stamps, which is a problem for e. g. gnu make based workflows ( major drawback for me ). also, fetching of files needs to be done manually or via a commit hook approach 2 : versioning code only, syncing data if your analytical data stays the same for most of your analyses, so the actual need to version it ( as opposed to back up and document data provenance, which is essential ) may be limited. the key to get this this working is to put all data files in your. gitignore and ignore all your code files in rsync, with a script in your project root ( extensions and directories are an example only ) : #! / bin / bash cd $ ( dirname $ 0 ) rsync - auvr \ - - exclude " *. r " \ - - include " *. rdata " \ - - exclude " dir with huge files that you don't need locally " \ yourhost : / your / project / path / *. the advantage here is that you don't need to remember the rsync command you are running. the script itself goes into version control. this is especially useful if you do your heavy processing on a computing cluster but want to make plots from your result files on your local machine. i argue that you generally don't need bidirectional sync.


the batch size defines the number of samples that will be propagated through the network. for instance, let's say you have 1050 training samples and you want to set up a batch _ size equal to 100. the algorithm takes the first 100 samples ( from 1st to 100th ) from the training dataset and trains the network. next, it takes the second 100 samples ( from 101st to 200th ) and trains the network again. we can keep doing this procedure until we have propagated all samples through of the network. problem might happen with the last set of samples. in our example, we've used 1050 which is not divisible by 100 without remainder. the simplest solution is just to get the final 50 samples and train the network. advantages of using a batch size < number of all samples : it requires less memory. since you train the network using fewer samples, the overall training procedure requires less memory. that's especially important if you are not able to fit the whole dataset in your machine's memory. typically networks train faster with mini - batches. that's because we update the weights after each propagation. in our example we've propagated 11 batches ( 10 of them had 100 samples and 1 had 50 samples ) and after each of them we've updated our network's parameters. if we used all samples during propagation we would make only 1 update for the network's parameter. disadvantages of using a batch size < number of all samples : the smaller the batch the less accurate the estimate of the gradient will be. in the figure below, you can see that the direction of the mini - batch gradient ( green color ) fluctuates much more in comparison to the direction of the full batch gradient ( blue color ). stochastic is just a mini - batch with batch _ size equal to 1. in that case, the gradient changes its direction even more often than a mini - batch gradient.


this one by ramanujan gives me the goosebumps : $ $ \ frac { 2 \ sqrt { 2 } } { 9801 } \ sum _ { k = 0 } ^ \ infty \ frac { ( 4k )! ( 1103 + 26390k ) } { ( k! ) ^ 4 396 ^ { 4k } } = \ frac1 { \ pi }. $ $ p. s. just to make this more intriguing, define the fundamental unit $ u _ { 29 } = \ frac { 5 + \ sqrt { 29 } } { 2 } $ and fundamental solutions to pell equations, $ $ \ big ( u _ { 29 } \ big ) ^ 3 = 70 + 13 \ sqrt { 29 }, \ quad \ text { thus } \ ; \ ; \ color { blue } { 70 } ^ 2 - 29 \ cdot \ color { blue } { 13 } ^ 2 = - 1 $ $ $ $ \ big ( u _ { 29 } \ big ) ^ 6 = 9801 + 1820 \ sqrt { 29 }, \ quad \ text { thus } \ ; \ ; \ color { blue } { 9801 } ^ 2 - 29 \ cdot1820 ^ 2 = 1 $ $ $ $ 2 ^ 6 \ left ( \ big ( u _ { 29 } \ big ) ^ 6 + \ big ( u _ { 29 } \ big ) ^ { - 6 } \ right ) ^ 2 = \ color { blue } { 396 ^ 4 } $ $ then we can see those integers all over the formula as, $ $ \ frac { 2 \ sqrt 2 } { \ color { blue } { 9801 } } \ sum _ { k = 0 } ^ \ infty \ frac { ( 4k )! } { k! ^ 4 } \ frac { 29 \ cdot \ color { blue } { 70 \ cdot13 } \, k + 1103 } { \ color { blue } { ( 396 ^ 4 ) } ^ k } = \ frac { 1 } { \ pi } $ $ nice, eh?


the perfect number $ 28 = 1 + 2 + 4 + 7 + 14 $ provides a solution : $ $ \ frac1 { 28 } + \ frac1 { 14 } + \ frac17 + \ frac14 + \ frac12 = \ frac { 1 + 2 + 4 + 7 + 14 } { 28 } = 1 \ ;. $ $ if they ’ ve been doing unit ( or ‘ egyptian ’ ) fractions, i ’ d expect some to see that since $ \ frac16 + \ frac13 = \ frac12 $, $ $ \ frac16 + \ frac16 + \ frac16 + \ frac16 + \ frac13 = 1 $ $ is a solution, though not a much more interesting one than the trivial solution. the choice of letters might well suggest the solution $ $ \ frac16 + \ frac16 + \ frac16 + \ frac14 + \ frac14 \ ;. $ $ a little playing around would show that $ \ frac14 + \ frac15 = \ frac9 { 20 } $, which differs from $ \ frac12 $ by just $ \ frac1 { 20 } $ ; that yields the solution $ $ \ frac1 { 20 } + \ frac15 + \ frac14 + \ frac14 + \ frac14 \ ;. $ $ if i were the teacher, i ’ d hope that some kids would realize that since the average of the fractions is $ \ frac15 $, in any non - trivial solution at least one denominator must be less than $ 5 $, and at least one must be greater than $ 5 $. say that $ x \ le y \ le z \ le a \ le b $. clearly $ x \ ge 2 $, so let ’ s try $ x = 2 $. then we need to solve $ $ \ frac1y + \ frac1z + \ frac1a + \ frac1b = \ frac12 \ ;. $ $ now $ y \ ge 3 $. suppose that $ y = 3 $ ; then $ $ \ frac1z + \ frac1a + \ frac1b = \ frac16 \ ;. $ $ now $ 1, 2 $, and $ 3 $ all divide $ 36 $, and $ \ frac16 = \ frac6 { 36 } $, so we


can write $ $ \ frac1 { 36 } + \ frac1 { 18 } + \ frac1 { 12 } = \ frac { 1 + 2 + 3 } { 36 } = \ frac6 { 36 } = \ frac16 \ ;, $ $ and we get another ‘ nice ’ solution, $ $ \ frac12 + \ frac13 + \ frac1 { 12 } + \ frac1 { 18 } + \ frac1 { 36 } \ ;. $ $


there is an explanation to this that can be generalized, which dips a little into quantum chemistry, which is known as the idea of pairing energy. i'm sure you can look up the specifics, but basically in comparing the possible configurations of $ \ ce { nb } $, we see the choice of either pairing electrons at a lower energy, or of separating them at higher energy, as seen below : d : _ _ _ ^ or or | s : _ energy gap ( e ) the top row is for the d - orbitals, which are higher in energy, and the bottom row is for the s - orbital, which is lower in energy. there is a quantifiable energy gap between the two as denoted on the side ( unique for every element ). as you may know, electrons like to get in the configuration that is lowest in energy. at first glance, that might suggest putting as many electrons in the s - orbital ( lower energy ) as possible, and then filling the rest in the d - orbital. this is known as the aufbau principle and is widely taught in chemistry classes. it's not wrong, and works most of the time, but the story doesn't end there. there is a cost to pairing the electrons in the lower orbital, two costs actually, which i will define now : repulsion energy : pretty simple, the idea that e - repel, and having two of them in the same orbital will cost some energy. normally counted as 1 c for every pair of electrons. exchange energy : this is a little tricky, and probably the main reason this isn't taught until later in your chemistry education. basically ( due to quantum chemistry which i won't bore you with ), there is a beneficial energy associated with having pairs of like energy, like spin electrons. basically, for every pair of electrons at the same energy level ( or same orbital shell in this case ) and same spin ( so, if you had 2 e - in the same orbital, no dice, since they have to be opposite spin ), you accrue 1 k exchange energy, which is a stabilizing energy. ( this is very simplified, but really " stabilizing energy " is nothing more than negative energy. i hope your thermodynamics is in good shape! ) the thing with exchange ( or k ) energy is that you get one for every pair, so in the case :


from say a p - subshell, you would get 3 k, for each pair, while from this example : from a $ \ ce { d ^ 6 } $, you would get 10 k ( for each unique pair, and none for the opposite spin e - ) this k is quantifiable as well ( and like the repulsion energy is unique for each atom ). thus, the combination of these two energies when compared to the band gap determines the state of the electron configuration. using the example we started with : d : _ _ _ ^ s : or or _ | pe : 3k + 1c 6k + 0c 10k + 0c energy gap ( e ) you can see from the example that shoving 1 e - up from the s to the d - subshell results in a loss of 1c ( losing positive or " destabilizing " repulsive energy ) and gaining 3k ( gaining negative or " stabilizing " exchange energy ). therefore, if the sum of these two is greater than the energy gap ( i. e. 3k - 1c > e ) then the electron will indeed be found in the d shell in $ \ ce { nb } $'s ground state. which is indeed the case for $ \ ce { nb } $. next, lets look at perhaps exciting the second s e - up to the d - subshell. we gain 4 additional k but don't lose any c, and we must again overcome the energy gap for this electron to be found in the d - subshell. it turns out that for $ \ ce { nb } $ : 4k + 0c < e ( remember that c is considered a negative value, which we're not losing any of ), so $ \ ce { nb } $ is ultimately found in the $ \ ce { 5s ^ 1 4d ^ 4 } $ configuration.


if you have some experience with python ( or even not ), i would recommend using the python scientific software that is available ( scipy, pandas ),... ) together with matplotlib. being a programming environment, you have full control over your data flows, data manipulations and plotting. you can also use the " full applications " mayavi2 or veusz.


to really understand this you should study the differential geometry of geodesics in curved spacetimes. i'll try to provide a simplified explanation. even objects " at rest " ( in a given reference frame ) are actually moving through spacetime, because spacetime is not just space, but also time : apple is " getting older " - moving through time. the " velocity " through spacetime is called a four - velocity and it is always equal to the speed of light. spacetime in gravitation field is curved, so the time axis ( in simple terms ) is no longer orthogonal to the space axes. the apple moving first only in the time direction ( i. e. at rest in space ) starts accelerating in space thanks to the curvature ( the " mixing " of the space and time axes ) - the velocity in time becomes velocity in space. the acceleration happens because the time flows slower when the gravitational potential is decreasing. apple is moving deeper into the graviational field, thus its velocity in the " time direction " is changing ( as time gets slower and slower ). the four - velocity is conserved ( always equal to the speed of light ), so the object must accelerate in space. this acceleration has the direction of decreasing gravitational gradient. edit - based on the comments i decided to clarify what the four - velocity is : 4 - velocity is a four - vector, i. e. a vector with 4 components. the first component is the " speed through time " ( how much of the coordinate time elapses per 1 unit of proper time ). the remaining 3 components are the classical velocity vector ( speed in the 3 spatial directions ). $ $ u = \ left ( c \ frac { dt } { d \ tau }, \ frac { dx } { d \ tau }, \ frac { dy } { d \ tau }, \ frac { dz } { d \ tau } \ right ) $ $ when you observe the apple in its rest frame ( the apple is at rest - zero spatial velocity ), the whole 4 - velocity is in the " speed through time ". it is because in the rest frame the coordinate time equals the proper time, so $ \ frac { dt } { d \ tau } = 1 $. when you observe the apple from some other reference frame, where the apple is moving at some speed, the coordinate time is no longer equal to the proper time. the time dilation causes that there is less proper time measured by


the apple than the elapsed coordinate time ( the time of the apple is slower than the time in the reference frame from which we are observing the apple ). so in this frame, the " speed through time " of the apple is more than the speed of light ( $ \ frac { dt } { d \ tau } > 1 $ ), but the speed through space is also increasing. the magnitude of the 4 - velocity always equals c, because it is an invariant ( it does not depend on the choice of the reference frame ). it is defined as : $ $ \ left \ | u \ right \ | = \ sqrt [ 2 ] { c ^ 2 \ left ( \ frac { dt } { d \ tau } \ right ) ^ 2 - \ left ( \ frac { dx } { d \ tau } \ right ) ^ 2 - \ left ( \ frac { dy } { d \ tau } \ right ) ^ 2 - \ left ( \ frac { dz } { d \ tau } \ right ) ^ 2 } $ $ notice the minus signs in the expression - these come from the minkowski metric. the components of the 4 - velocity can change when you switch from one reference frame to another, but the magnitude stays unchanged ( all the changes in components " cancel out " in the magnitude ).


my problem with expression templates is that they are a very leaky abstraction. you spend a lot of work writing very complicated code to do a simple task with nicer syntax. but if you want to change the algorithm, you have to mess with the dirty code and if you slip up with types or syntax, you get completely unintelligible error messages. if your application maps perfectly to a library based on expression templates, then it might be worth considering, but if you aren't sure, i would recommend just writing normal code. sure, the high level code is less pretty, but you can just do what needs to be done. as a benefit, compilation time and binary sizes will go way down and you won't have to cope with huge variance in performance due to compiler and compilation flag choice.


the correct pullup resistance for the i2c bus depends on the total capacitance on the bus and the frequency you want to operate the bus at. the formula from the atmega168 datasheet ( which i believe comes from the official i2c spec ) is - - $ $ \ text { freq } < 100 \ text { khz } \ implies r _ { \ text { min } } = \ frac { v _ { cc } - 0. 4 \ text { v } } { 3 \ text { ma } }, r _ { \ text { max } } = \ frac { 1000 \ text { ns } } { c _ { \ text { bus } } } $ $ $ $ \ text { freq } > 100 \ text { khz } \ implies r _ { \ text { min } } = \ frac { v _ { cc } - 0. 4 \ text { v } } { 3 \ text { ma } }, r _ { \ text { max } } = \ frac { 300 \ text { ns } } { c _ { \ text { bus } } } $ $ the microchip 24lc256 specifies a maximum pin capacitance of 10pf ( which is fairly typical ). count up the number of devices you have in parallel on the bus and use the formula above to calculate a range of values that will work. if you are powering off of batteries i would use values that are at the high end of the range. if there are no power limits on the power source or power dissipation issues in the ics i would use values on the lower end of the range. i sell some kits with an i2c rtc ( ds1337 ). i include 4k7 resistors in the kit which seems like a reasonable compromise for most users.


i think it's a great question, and enjoyed it very much when i grappled with it myself. here's a picture of some of the forces in this scenario. $ ^ \ dagger $ the ones that are the same colour as each other are pairs of equal magnitude, opposite direction forces from newton's third law. ( w and r are of equal magnitude in opposite directions, but they're acting on the same object - that's newton's first law in action. ) while $ f _ \ text { matchbox } $ does press back on my finger with an equal magnitude to $ f _ \ text { finger } $, it's no match for $ f _ \ text { muscles } $ ( even though i've not been to the gym in years ). at the matchbox, the forward force from my finger overcomes the friction force from the table. each object has an imbalance of forces giving rise to acceleration leftwards. the point of the diagram is to make clear that the third law makes matched pairs of forces that act on different objects. equilibrium from newton's first or second law is about the resultant force at a single object. $ \ dagger $ ( sorry that the finger doesn't actually touch the matchbox in the diagram. if it had, i wouldn't have had space for the important safety notice on the matches. i wouldn't want any children to be harmed because of a misplaced force arrow. come to think of it, the dagger on this footnote looks a bit sharp. )


there are many ways to see that your result is the right one. what does the right one mean? it means that whenever such a sum appears anywhere in physics - i explicitly emphasize that not just in string theory, also in experimentally doable measurements of the casimir force ( between parallel metals resulting from quantized standing electromagnetic waves in between ) - and one knows that the result is finite, the only possible finite part of the result that may be consistent with other symmetries of the problem ( and that is actually confirmed experimentally whenever it is possible ) is equal to $ - 1 / 12 $. it's another widespread misconception ( see all the incorrect comments right below your question ) that the zeta - function regularization is the only way how to calculate the proper value. let me show a completely different calculation - one that is a homework exercise in joe polchinski's " string theory " textbook. exponential regulator method add an exponentially decreasing regulator to make the sum convergent - so that the sum becomes $ $ s = \ sum _ { n = 1 } ^ { \ infty } n e ^ { - \ epsilon n } $ $ note that this is not equivalent to generalizing the sum to the zeta - function. in the zeta - function, the $ n $ is the base that is exponentiated to the $ s $ th power. here, the regulator has $ n $ in the exponent. obviously, the original sum of natural numbers is obtained in the $ \ epsilon \ to 0 $ limit of the formula for $ s $. in physics, $ \ epsilon $ would be viewed as a kind of " minimum distance " that can be resolved. the sum above may be exactly evaluated and the result is ( use mathematica if you don't want to do it yourself, but you can do it yourself ) $ $ s = \ frac { e ^ \ epsilon } { ( e ^ \ epsilon - 1 ) ^ 2 } $ $ we will only need some laurent expansion around $ \ epsilon = 0 $. $ $ s = \ frac { 1 + \ epsilon + \ epsilon ^ 2 / 2 + o ( \ epsilon ^ 3 ) } { ( \ epsilon + \ epsilon ^ 2 / 2 + \ epsilon ^ 3 / 6 + o ( \ epsilon ^ 4 ) ) ^ 2 } $ $ we have $ $ s = \ frac { 1 } { \ epsilon ^ 2 } \ frac { 1 + \ epsilon + \ epsilon ^ 2 / 2


+ o ( \ epsilon ^ 3 ) } { ( 1 + \ epsilon / 2 + \ epsilon ^ 2 / 6 + o ( \ epsilon ^ 3 ) ) ^ 2 } $ $ you see that the $ 1 / \ epsilon ^ 2 $ leading divergence survives and the next subleading term cancels. the resulting expansion may be calculated with this mathematica command 1 / epsilon ^ 2 * series [ epsilon ^ 2 sum [ n exp [ - n epsilon ], { n, 1, infinity } ], { epsilon, 0, 5 } ] and the result is $ $ \ frac { 1 } { \ epsilon ^ 2 } - \ frac { 1 } { 12 } + \ frac { \ epsilon ^ 2 } { 240 } + o ( \ epsilon ^ 4 ) $ $ in the $ \ epsilon \ to 0 $ limit we were interested in, the $ \ epsilon ^ 2 / 240 $ term as well as the smaller ones go to zero and may be erased. the leading divergence $ 1 / \ epsilon ^ 2 $ may be and must be canceled by a local counterterm - a vacuum energy term. this is true for the casimir effect in electromagnetism ( in this case, the cancelled pole may be interpreted as the sum of the zero - point energies in the case that no metals were bounding the region ), zero - point energies in string theory, and everywhere else. the cancellation of the leading divergence is needed for physics to be finite - but one may guarantee that the counterterm won't affect the finite term, $ - 1 / 12 $, which is the correct result of the sum. in physics applications, $ \ epsilon $ would be dimensionful and its different powers are sharply separated and may be treated individually. that's why the local counterterms may eliminate the leading divergence but don't affect the finite part. that's also why you couldn't have used a more complex regulator, like $ \ exp ( - ( \ epsilon + \ epsilon ^ 2 ) n ) $. there are many other, apparently inequivalent ways to compute the right value of the sum. it is not just the zeta function. euler's method let me present one more, slightly less modern, method that was used by leonhard euler to calculate that the sum of natural numbers is $ - 1 / 12 $. it's of course a bit more heuristic but his heuristic approach showed that


he had a good intuition and the derivation could be turned into a modern physics derivation, too. we will work with two sums, $ $ s = 1 + 2 + 3 + 4 + 5 + \ dots, \ quad t = 1 - 2 + 3 - 4 + 5 - \ dots $ $ extrapolating the geometric and similar sums to the divergent ( and, in this case, marginally divergent ) domain of values of $ x $, the expression $ t $ may be summed according to the taylor expansion $ $ \ frac { 1 } { ( 1 + x ) ^ 2 } = 1 - 2x + 3x ^ 2 - 4x ^ 3 + \ dots $ $ substitute $ x = 1 $ to see that $ t = + 1 / 4 $. the value of $ s $ is easily calculated now : $ $ t = ( 1 + 2 + 3 + \ dots ) - 2 \ times ( 2 + 4 + 6 + \ dots ) = ( 1 + 2 + 3 + \ dots ) ( 1 - 4 ) = - 3s $ $ so $ s = - t / 3 = - 1 / 12 $. a zeta - function calculation a somewhat unusual calculation of $ \ zeta ( - 1 ) = - 1 / 12 $ of mine may be found in the pictures of yellows roses, a czech student journal. the website no longer works, although a working snapshot of the original website is still available through the webarchive ( see this link ). a 2014 english text with the same evaluation at the end can be found at the reference frame. the comments were in czech but the equations represent bulk of the language that really matters, so the czech comments shouldn't be a problem. a new argument ( subscript ) $ s $ is added to the zeta function. the new function is the old zeta function for $ s = 0 $ and for $ s = 1 $, it only differs by one. we taylor expand around $ s = 0 $ to get to $ s = 1 $ and we find out that only a finite number of terms survives if the main argument $ x $ is a non - positive integer. the resulting recursive relations for the zeta function allow us to compute the values of the zeta - function at integers smaller than $ 1 $, and prove that the function vanishes at negative even values of $ x $.


i do not think mine will be a complete answer, but i'll offer what i know and since this is a community edited site, i hope somebody will give a complimentary answer soon : ) adaptive thresholding methods are those that do not use the same threshold throughout the whole image. but, for some simpler usages, it is sometimes enough to just pick a threshold with a method smarter than the most simple iterative method. otsu's method is a popular thresholding method that assumes the image contains two classes of pixels - foreground and background, and has a bi - modal histogram. it then attempts to minimize their combined spread ( intra - class variance ). the simplest algorithms that can be considered truly adaptive thresholding methods would be the ones that split the image into a grid of cells and then apply a simple thresholding method ( e. g. iterative or otsu's method ) on each cell treating it as a separate image ( and presuming a bi - modal histogram ). if a sub - image can not be thresholded good the threshold from one of the neighboring cells can be used. alternative approach to finding the local threshold is to statistically examine the intensity values of the local neighborhood of each pixel. the threshold is different for each pixel and calculated from it's local neighborhood ( a median, average, and other choices are possible ). there is an implementation of this kind of methods included in opencv library in the cv : : adaptivethresholding function. i found another similar method called bradley local thresholding. it also examines the neighborhood of each pixel, setting the brightnes to black if the pixels brightness is t percent lower than the average brightness of surrounding pixels. the corresponding paper can be found here. this stackoverflow answer mentiones a local ( adaptive ) thresholding method called niblack but i have not heard of it before. lastly, there is a method i have used in one of my previous smaller projects, called image thresholding by variational minimax optimization. it is an iterative method, based on optimizing an energy function that is a nonlinear combination of two components. one component aims to calculate the threshold based on the position of strongest intensity changes in the image. the other component aims to smooth the threshold at the ( object ) border areas. it has proven fairly good on images of analog instruments ( various shading and reflection from glass / plastic present ), but required a careful choice of the number of iterations. late


edit : inspired by the comment to this answer. there is one more way i know of to work around uneven lighting conditions. i will write here about bright objects on a dark background, but the same reasoning can be applied if the situation is reverse. threshold the white top - hat transform of the image with a constant threshold instead of the original image. a white top hat of an image is nothing but a difference between the image $ f $ and it's opening $ \ gamma ( f ) $. as further explanation let me offer a quote from p. soille : morphological image analysis : an opening of the original image with a large square se removes all relevant image structures but preserves the illumination function. the white top - hat of the original image or subtraction of the illumination function from the original image outputs an image with a homogeneous illumination.


a cholesky factorization makes the most sense for the best stability and speed when you are working with a covariance matrix, since the covariance matrix will be positive semi - definite symmetric matrix. cholesky is a natural here. but... if you intend to compute a cholesky factorization, before you ever compute the covariance matrix, do yourself a favor. make the problem maximally stable by computing a qr factorization of your matrix. ( a qr is fast too. ) that is, if you would compute the covariance matrix as $ $ c = a ^ { t } a $ $ where $ a $ has had the column means removed, then see that when you form $ c $, it squares the condition number. so better is to form the qr factors of $ a $ rather than explicitly computing a cholesky factorization of $ a ^ { t } a $. $ $ a = qr $ $ since q is orthogonal, $ $ \ begin { align } c & = ( qr ) ^ { t } qr \ \ & = r ^ t q ^ t qr \ \ & = r ^ t i r \ \ & = r ^ { t } r \ end { align } $ $ thus we get the cholesky factor directly from the qr factorization, in the form of $ r ^ { t } $. if a $ q $ - less qr factorization is available, this is even better since you don't need $ q $. a $ q $ - less qr is a fast thing to compute, since $ q $ is never generated. it becomes merely a sequence of householder transformations. ( a column pivoted, $ q $ - less qr would logically be even more stable, at the cost of some extra work to choose the pivots. ) the great virtue of using the qr here is it is highly numerically stable on nasty problems. again, this is because we never had to form the covariance matrix directly to compute the cholesky factor. as soon as you form the product $ a ^ { t } a $, you square the condition number of the matrix. effectively, you lose information down in the parts of that matrix where you originally had very little information to start with. finally, as another response points out, you don't even need to compute and store the inverse at all, but use it implicitly in the form of


backsolves on triangular systems.


the discrete fourier transform ( dft ) and discrete cosine transform ( dct ) perform similar functions : they both decompose a finite - length discrete - time vector into a sum of scaled - and - shifted basis functions. the difference between the two is the type of basis function used by each transform ; the dft uses a set of harmonically - related complex exponential functions, while the dct uses only ( real - valued ) cosine functions. the dft is widely used for general spectral analysis applications that find their way into a range of fields. it is also used as a building block for techniques that take advantage of properties of signals'frequency - domain representation, such as the overlap - save and overlap - add fast convolution algorithms. the dct is frequently used in lossy data compression applications, such as the jpeg image format. the property of the dct that makes it quite suitable for compression is its high degree of " spectral compaction ; " at a qualitative level, a signal's dct representation tends to have more of its energy concentrated in a small number of coefficients when compared to other transforms like the dft. this is desirable for a compression algorithm ; if you can approximately represent the original ( time - or spatial - domain ) signal using a relatively small set of dct coefficients, then you can reduce your data storage requirement by only storing the dct outputs that contain significant amounts of energy.


use 10 kω, it's a good value. for more detail, we have to look at what a pullup does. let's say you have a pushbutton you want to read with a microcontroller. the pushbutton is a momentary spst ( single pole single throw ) switch. it has two connection points which are either connected or not. when the button is pressed, the two points are connected ( switch is closed ). when released, they are not connected ( switch is open ). microcontrollers don't inherently detect connection or disconnection. what they do sense is a voltage. since this switch has only two states it makes sense to use a digital input, which is after all designed to be only in one of two states. the micro can sense which state a digital input is in directly. a pullup helps convert the open / closed connection of the switch to a low or high voltage the microcontroller can sense. one side of the switch is connected to ground and the other to the digital input. when the switch is pressed, the line is forced low because the switch essentially shorts it to ground. however, when the switch is released, nothing is driving the line to any particular voltage. it could just stay low, pick up other nearby signals by capacitive coupling, or eventually float to a specific voltage due to the tiny bit of leakage current thru the digital input. the job of the pullup resistor is to provide a positive guaranteed high level when the switch is open, but still allow the switch to safely short the line to ground when closed. there are two main competing requirements on the size of the pullup resistor. it has to be low enough to solidly pull the line high, but high enough to not cause too much current to flow when the switch is closed. both those are obviosly subjective and their relative importance depends on the situation. in general, you make the pullup just low enough to make sure the line is high when the switch is open, given all the things that might make the line low otherwise. let's look at what it takes to pull up the line. looking only at the dc requirement uncovers the leakage current of the digital input line. the ideal digital input has infinite impedance. real ones don't, of course, and the extent they are not ideal is usually expressed as a maximum leakage current that can either come out of or go into the pin. let's


say your micro is specified for 1 µa maximum leakage on its digital input pins. since the pullup has to keep the line high, the worst case is assuming the pin looks like a 1 µa current sink to ground. if you were to use a 1 mω pullup, for example, then that 1 µa would cause 1 volt accross the 1 mω resistor. let's say this is a 5v system, so that means the pin is only guaranteed to be up to 4v. now you have to look at the digital input spec and see what the minimum voltage requirement is for a logic high level. that can be 80 % of vdd for some micros, which would be 4v in this case. therefore a 1 mω pullup is right at the margin. you need at least a little less than that for guaranteed correct behaviour due to dc considerations. however, there are other considerations, and these are harder to quantify. every node has some capacitive coupling to all other nodes, although the magnitude of the coupling falls off with distance such that only nearby nodes are relevant. if these other nodes have signals on them, these signals could couple onto your digital input. a lower value pullup makes the line lower impedance, which reduces the amount of stray signal it will pick up. it also gives you a higher minimum guaranteed dc level against the leakage current, so there is more room between that dc level and where the digital input might interpret the result as a logic low instead of the intended logic high. so how much is enough? clearly the 1 mω pullup in this example is not enough ( too high a resistance ). it's nearly impossible to guess coupling to nearby signals, but i'd want at least a order of magnitude margin over the minimum dc case. that means i want a 100 kω pullup or lower at least, although if there is much noise around i'd want it to be lower. there is another consideration driving the pullup lower, and that is rise time. the line will have some stray capacitance to ground, so will exponentially decay towards the supply value instead of instantly going there. let's say all the stray capacitance adds up to 20 pf. that times the 100 kω pullup is 2 µs. it takes 3 time constants to get to 95 % of the settling value, or 6 µs in this case. that is of no consequence in human time so


doesn't matter in this example, but if this were a digital bus line you wanted to run at 200 khz data rate it wouldn't work. now lets look at the other competing consideration, which is the current wasted when the switch is pressed. if this unit is running off of line power or otherwise handling substantial power, a few ma won't matter. at 5v it takes 5 kω to draw 1 ma. that's actually " a lot " of current in some cases, and well more than required due to the other considerations. if this is a battery powered device and the switch could be on for a substantial fraction of the time, then every µa may matter and you have to think about this very carefully. in some cases you might sample the switch periodically and only turn on the pullup for a short time around the sample to minimize current draw. other than special considerations like battery operation, 100 kω is high enough impedance to make me nervous about picking up noise. 1 ma of current wasted when the switch is on seems unnecessarily large. so 500 µa, which means 10 kω impedance is about right. like i said, use 10 kω. it's a good value.


" i am thinking of a number which is either 0 or 1. is the sum of our numbers greater than 2? "


part of the issue is that the frequentist definition of a probability doesn't allow a nontrivial probability to be applied to the outcome of a particular experiment, but only to some fictitious population of experiments from which this particular experiment can be considered a sample. the definition of a ci is confusing as it is a statement about this ( usually ) fictitious population of experiments, rather than about the particular data collected in the instance at hand. so part of the issue is one of the definition of a probability : the idea of the true value lying within a particular interval with probability 95 % is inconsistent with a frequentist framework. another aspect of the issue is that the calculation of the frequentist confidence doesn't use all of the information contained in the particular sample relevant to bounding the true value of the statistic. my question " are there any examples where bayesian credible intervals are obviously inferior to frequentist confidence intervals " discusses a paper by edwin jaynes which has some really good examples that really highlight the difference between confidence intervals and credible intervals. one that is particularly relevant to this discussion is example 5, which discusses the difference between a credible and a confidence interval for estimating the parameter of a truncated exponential distribution ( for a problem in industrial quality control ). in the example he gives, there is enough information in the sample to be certain that the true value of the parameter lies nowhere in a properly constructed 90 % confidence interval! this may seem shocking to some, but the reason for this result is that confidence intervals and credible intervals are answers to two different questions, from two different interpretations of probability. the confidence interval is the answer to the request : " give me an interval that will bracket the true value of the parameter in $ 100p $ % of the instances of an experiment that is repeated a large number of times. " the credible interval is an answer to the request : " give me an interval that brackets the true value with probability $ p $ given the particular sample i've actually observed. " to be able to answer the latter request, we must first adopt either ( a ) a new concept of the data generating process or ( b ) a different concept of the definition of probability itself. the main reason that any particular 95 % confidence interval does not imply a 95 % chance of containing the mean is because the confidence interval is an answer to a different question, so it is only the right answer when the answer to the two questions happens to have the same numerical solution. in short, credible and confidence intervals answer different questions from different perspectives ; both


are useful, but you need to choose the right interval for the question you actually want to ask. if you want an interval that admits an interpretation of a 95 % ( posterior ) probability of containing the true value, then choose a credible interval ( and, with it, the attendant conceptualization of probability ), not a confidence interval. the thing you ought not to do is to adopt a different definition of probability in the interpretation than that used in the analysis. thanks to @ cardinal for his refinements! here is a concrete example, from david makay's excellent book " information theory, inference and learning algorithms " ( page 464 ) : let the parameter of interest be $ \ theta $ and the data $ d $, a pair of points $ x _ 1 $ and $ x _ 2 $ drawn independently from the following distribution : $ p ( x | \ theta ) = \ left \ { \ begin { array } { cl } 1 / 2 & x = \ theta, \ \ 1 / 2 & x = \ theta + 1, \ \ 0 & \ mathrm { otherwise } \ end { array } \ right. $ if $ \ theta $ is $ 39 $, then we would expect to see the datasets $ ( 39, 39 ) $, $ ( 39, 40 ) $, $ ( 40, 39 ) $ and $ ( 40, 40 ) $ all with equal probability $ 1 / 4 $. consider the confidence interval $ [ \ theta _ \ mathrm { min } ( d ), \ theta _ \ mathrm { max } ( d ) ] = [ \ mathrm { min } ( x _ 1, x _ 2 ), \ mathrm { max } ( x _ 1, x _ 2 ) ] $. clearly this is a valid 75 % confidence interval because if you re - sampled the data, $ d = ( x _ 1, x _ 2 ) $, many times then the confidence interval constructed in this way would contain the true value 75 % of the time. now consider the data $ d = ( 29, 29 ) $. in this case the frequentist 75 % confidence interval would be $ [ 29, 29 ] $. however, assuming the model of the generating process is correct, $ \ theta $ could be 28 or 29 in this case, and we have no reason to suppose that 29 is more likely than 28, so the posterior probability is $ p ( \ theta = 28 | d ) = p ( \ theta = 29 |


d ) = 1 / 2 $. so in this case the frequentist confidence interval is clearly not a 75 % credible interval as there is only a 50 % probability that it contains the true value of $ \ theta $, given what we can infer about $ \ theta $ from this particular sample. yes, this is a contrived example, but if confidence intervals and credible intervals were not different, then they would still be identical in contrived examples. note the key difference is that the confidence interval is a statement about what would happen if you repeated the experiment many times, the credible interval is a statement about what can be inferred from this particular sample.


gradient descent maximizes a function using knowledge of its derivative. newton's method, a root finding algorithm, maximizes a function using knowledge of its second derivative. that can be faster when the second derivative is known and easy to compute ( the newton - raphson algorithm is used in logistic regression ). however, the analytic expression for the second derivative is often complicated or intractable, requiring a lot of computation. numerical methods for computing the second derivative also require a lot of computation - - if $ n $ values are required to compute the first derivative, $ n ^ 2 $ are required for the second derivative.


this good non - scholarly article covers some of the usual advantages ( rest / regeneration ). one of the research papers they mentioned ( they linked to press release ) was conservation of sleep : insights from non - mammalian model systems by john e. zimmerman, ph. d. ; trends neurosci. 2008 july ; 31 ( 7 ) : 371 – 376. published online 2008 june 5. doi : 10. 1016 / j. tins. 2008. 05. 001 ; nihmsid : nihms230885. to quote from the press release : because the time of lethargus coincides with a time in the round worms ’ life cycle when synaptic changes occur in the nervous system, they propose that sleep is a state required for nervous system plasticity. in other words, in order for the nervous system to grow and change, there must be down time of active behavior. other researchers at penn have shown that, in mammals, synaptic changes occur during sleep and that deprivation of sleep results in a disruption of these synaptic changes.


where is the sugar? when you freeze a dilute aqueous sugar solution pure water freezes first, leaving a more concentrated solution until you reach a high concentration of sugar called the eutectic concentration. now you have the pure water that's frozen out, called proeutectic water, and the concentrated eutectic sugar solution from which the sugar is finally ready to freeze along with the water. upon freezing this eutectic composition forms a two - phase eutectic mixture, in which the sugar may appear as veins or lamellae ( like veins of some ores among earth's rocks, though these typically form form a different process ). if that structure is in the interior of the ice cube, likely since you cooled the solution from the outside, then licking the outside you got only the pure water proeutectic component. see for more about this process. addendum : i tried this with store - bought fruit juice which was red in color. poured it into an ice tray and froze it overnight in my household freezer. it appeared to be a homogeneous red mass and tasted sweet, but was also mushy implying some liquid was still present ( after overnight freezing for an ice cube sized sample ). the juice was roughly 10 % sugar by weight.