In this code, nextVal seem to be remembered by the function but i am unable to understand.  var gimmeSomething = (function(){         var nextVal;          return function(){             if (nextVal === undefined) {                 nextVal = 1;             }             else {                 nextVal = (3 * nextVal) + 6;             }              return nextVal;         };     })();      gimmeSomething();       // 1     gimmeSomething();       // 9     gimmeSomething();       // 33     gimmeSomething();       // 105
How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves?  I have seen  given on Wikipedia, but unfortunately it did not help.
prove/disprove Big-Oh I have the following function f(n), and I want to prove/disprove that it is O(n$^2$): \begin{cases}     4[sum(n/2,n)],&amp; \text{if n is even } \\     2n-1+sum(n-3,n),              &amp; \text{otherwise} \end{cases} (it should be 2 n-1, so a space between 2 and n) where sum( j,k ) is a ‘partial arithmetic sum’ of the integers from j up to k, that is \begin{cases}     0&amp; \text{if j&gt;k } \\     j + (j+1) + (j+2) + ... + k,              &amp; \text{otherwise} \end{cases} e.g. sum(3,4) = 3 + 4 = 7, etc. Note that sum(j,k) = sum(1,k) – sum(1,j-1) How do I prove or disprove that this is O(n$^2$)? Missing links to responses to comments on nomination posts In the responses tab in my profile, responses to comments on nomination posts include a working link in the page source, but because there's no title the links are empty and useless.    When listed in the inbox such posts do have a title, though in this case the link is to the post and not directly to the comment. (Actually, the links in responses end up being redirected and also go to the post and not to the comment, but they try to go to the comment.)  In Supercollider:    In Global Profile: Can blender use the Alpha channel of an image as transparency on a plane? What are the best ways to improve a site's position in the Google search results? The difference between try/catch/throw and try/catch(e)/throw e Issue with QGIS 2.10.1 Clip and Intersect Tools Let be the next equivalence relation on $B= \{R \subseteq \mathbb{N}\times\mathbb{N} \ | \ R \ is \ a \ well-order \ on \  \mathbb{N}\}$ : $$"R \equiv R' \leftrightarrow \ (\mathbb{N},R) \cong (\mathbb{N},R') \ are \ well-ordering \ sets \  isomorphic" $$  Which is the cardinality of $B/\equiv$?  Firstly, we can notice that each well-ordering set is isomorphic to an ordinal $\alpha \ $such that $\alpha &lt; \aleph_{1}$, and so it is enough to count how many ordinals are isomorphic to a subset of $\mathbb{N}$. For example, if we consider $A$ the set of the even numbers and $B$ the set of odd numbers with the usual order relation, $A \oplus B$ is isomorphic to $\omega + \omega$. Another example could be: if we consider the order of $\mathbb{N}$ that we use in Sharkowski Theorem, that order is isomorphic to $ \omega^{2} + \omega$. Working with prime numbers we could build also $\omega^{n} \ \forall n \in \mathbb{N}$, and so $\omega^{\omega}$ and maybe something bigger. However, we know that each countable ordinal is isomorphic to a subset of $\mathbb{Q}$, but I bet that the same result is not true for $\mathbb{N}$ because it is "too small".  What can I do? Do indexes work with "IN" clause Javascript variables keep track to their copies? Is some of my internal memory missing? What is the source for defaulting to plain English readings of non-game terms? If I wrote something in plperlu, when would that module be reloaded?  Every time the function ran?  The first time it ran?  Does the Perl DLL get unloaded if it hasn't been used in a while, and then after that it'd be another module reload? About Trivariate Normal Distribution I am working on a paper, and have a problem regarding ellipsoid and Trivariate Normal Distribution. Suprisingly I can't find much in literature but I found your in one of your answers:     Because this construction has nothing to do with "confidence" per se,   the objective is to establish some convention for describing the shape   and relative size of the points. Using 1.96 sort of works (for three   variables): it contains about 72% of the probability of the trivariate   normal distribution. But as the number of variables increases this   method produces ellipses that are far too small. For instance, with 10   variables it will contain only 4.6% of the probability; using 4.28   instead of 1.96 in this case will contain 95% of the probability.   How did you get this number 72%? Or do you have some literature to recommend to me in which I can find this. I would appreciate it very much! Drop "not constructive", combine "noisy", reword "rude" and "other" comment flags Good day guys, i have to something like this, any idea how is this picture made ?  so it looks like negative i did invert it in photoshop but the bright side of his face was blue, so there been negative effect and smting been used to change his face to blue before nagative or smting that changed his face to normal skin color after negative ? what can it be ? what do you guys think ? THANKS ! for help. I created this style that shifts the labels and put them on the bottom of the ybars.  However, I have a problem with the bars that have too short length (for example, see the 8.7 and 5.1 in the example below). I want to check if the values are less than some threshold, or the length of the bar is shorter than the label (number) then change its color.  How can I overlay another label on top of the one in white when the bar is shorter? or maybe change the color of the label to a gradient color? or just overlay the part that is outside of the bar?    \documentclass{standalone}  \usepackage{tikz} \usepackage{pgfplots} \usepackage{pgfplotstable} \usetikzlibrary{calc}  \begin{document} \makeatletter \begin{tikzpicture} \begin{axis}[ ybar, every node near coord/.style={   check for zero/.code={ % If meta=0, make the node a coordinate (which doesn't have text)     \pgfmathfloatifflags{\pgfplotspointmeta}{0}{         \pgfkeys{/tikz/coordinate}     }{}   },   check for zero, color=white, text opacity=1, font=\footnotesize, inner ysep=0.5pt, },% % Bottom nodes  calculate full offset/.code={     \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}     \pgfmathsetmacro\testmacro{((\pgfplotspointmeta-\pgfkeysvalueof{/pgfplots/ymin})*10^\pgfplots@data@scale@trafo@EXPONENT@y)*\pgfplots@y@veclength}     \pgfkeys{/pgf/fpu=false} },% nodes near coords bottom/.style={     every node near coord/.append style={         /pgfplots/calculate full offset,         yshift=-\testmacro,         rotate=90, anchor=west,%I need the rotate text here and not in the          %general style, as the ybar redefines the style     } },% ymin=0, nodes near coords={\pgfmathprintnumber[fixed zerofill,precision=1]{\pgfplotspointmeta}}, nodes near coords bottom, ] \pgfplotstableread{ % set real imag mag 1 8.7 2 5.1 3 91.8367  }\mydata \addplot table[x index=0,y index=1,header=false] {\mydata}; \end{axis} \end{tikzpicture} \makeatother \end{document}   * EDIT *  I need to create some special gradient on each label that is below the bar height. For example, I need to adapt something like  to each label that is not showing. However, I cannot find a way to put the macro in the style section of the codes. Or is there any equivalent solution? UV mapping not filling faces I have tried to map this simple object, but the uv mapping does not correspond to what i see in the textured object. It cuts the image a bit on top and a bit on the bottom of the faces. It does not fill the faces with the texture, even though i have mapped them correctly. Does anyone know what could be happening? Thanks in advance. Outlining in Blender? I am currently working on converting my logo vectored as a SVG to a 3D model using the 2.72 version. I ran into a problem with my logo because it contains a black stroke and an orange stroke (see both images below), but currently all I have is the interior color of each shape. I was wondering whether or not there was a simple way to add in these strokes, and how exactly to go about creating the strokes. Thank you in advance community! I'm reading the Algebra book by Knapp and he mentions in passing that an orthonormal set in an infinite dimension vector space is "never large enough" to be a vector-space basis (i.e. that every vector can be written as a finite sum of vectors from the basis; such bases do exist for infinite dimension vector spaces by virtue of the axiom of choice, but usually one works with orthonormal sets for which infinite sums yield all the elements of the vector space).  So my question is - how can we prove this claim? (That an orthonormal set in an infinite dimension vector space is not a vector space basis).    Edit (by Jonas Meyer): Knapp says in a footnote on  of Basic algebra:     In the infinite-dimensional theory the term "orthonormal basis" is used for an orthonormal set that spans $V$ when limits of finite sums are allowed, in addition to finite sums themselves; when $V$ is infinite-dimensional, an orthonormal basis is never large enough to be a vector-space basis.   Thus, without explicitly using the word, Knapp is referring only to complete infinite-dimensional inner product spaces. Force as gradient of scalar potential energy My text book reads      If a particle is acted upon by the forces which are conservative; that is, if the forces are derivable from a scalar potential energy function in manner $ F=-\nabla V $.   I was just wondering what may be the criteria for force to be expressed as negative gradient of scalar potential energy and HOW DO WE PROVE IT?