text
stringlengths
1
1.11k
source
dict
php, object-oriented, css, file, image The naming of some methods could be better - e.g. instead of getTop() a better name might be getTopThreeUsedColors - getTop() sounds like a method called to get something related to the top of the image. Maybe a better name for the class would be something like ImageColorAnalyzer. PSR-5 is in draft status currently but is commonly followed amongst PHP developers. It recommends adding docblocks above structural elements like classes, methods, properties, etc. Many popular IDEs will index the docblocks and use them to suggest parameter names when using code that has been documented. At least do it for the public methods since outside code could reference the docblocks and provide hints for the parameters, return type, etc. Suspected bug
{ "domain": "codereview.stackexchange", "id": 40851, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "php, object-oriented, css, file, image", "url": null }
java, console, calculator, finance if (taxableIncome >= singleFiler[3].minSalary && taxableIncome <= singleFiler[3].maxSalary) { totalTax = taxableIncome * singleFiler[3].taxRate; System.out.println("Your total tax is: $" + totalTax); } else { if (taxableIncome > singleFiler[3].maxSalary && taxableIncome <= singleFiler[4].maxSalary) { temp = taxableIncome - singleFiler[3].maxSalary; totalTax = (singleFiler[3].maxSalary * singleFiler[3].taxRate) + temp * singleFiler[4].taxRate; System.out.println("Your total tax is: $" + totalTax); } } } static void TierFive() { double totalTax; double temp;
{ "domain": "codereview.stackexchange", "id": 24081, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, console, calculator, finance", "url": null }
$\endgroup$ – Rubi Shnol Dec 9 '15 at 11:10 $\begingroup$ @Valery Saharov It's enough one single method in a Q&A board, isn't required to show encyclopedically all possible ways. Find the Fuzzy Logic Controller block and drag it onto the new model as shown. We still assume that the population is constant. Reviewing the SIR disease model We will now build a simple model of an infectious disease. The independent variable is time t, measured in days. Data taken from :- covid19india. 5 - Exponential and Logarithmic Models Exponential Growth Function. Locate the Fuzzy Logic Toolbox on the Simulink menu and expand it (click on the plus sign as shown). SIR model equations - diffrences. , AUC, Cmax). While the book focuses on growth and decay processes, interacting populations, and heating/cooling problems, the mathematical techniques presented can be applied to many other areas. Haupt-Navigation ein-/ausblenden. Parameter Estimation; A. Discover what MATLAB. Notes on linear regression
{ "domain": "collezionericordi.it", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9728307739782682, "lm_q1q2_score": 0.8085615365691371, "lm_q2_score": 0.8311430499496095, "openwebmath_perplexity": 1495.8913086396221, "openwebmath_score": 0.5351118445396423, "tags": null, "url": "http://jmnd.collezionericordi.it/matlab-population-model.html" }
mechanical-engineering, rail, transportation Title: Is there any reason why "inner-flange" style trains are almost universal? There's basically two ways train wheels can operate, the flanges could be either "inner" or "outer". Switches can be made in equivalent ways for inner and outer flanges. We could expect that, just like some countries, as well as different railway companies within countries, picked up different rail gauges, they could have also varied between inner- and outer-flanges railways. We could imagine that, just like today some countries have left-hand and right-hand traffic, there would be inner and outer style rail wheels. Except this is not the case, the "inner" style is almost universal. Almost, because the "outer" style indeed did exist in railways' debuts.
{ "domain": "engineering.stackexchange", "id": 2905, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "mechanical-engineering, rail, transportation", "url": null }
python, design-patterns, python-2.x Title: Python coding style from Java background I am pretty new to Python and just wanted to make sure I am going in the right direction with my coding style. After reading this, I'm not so sure. The following is a convenience class that has operations used a lot in my main code. import requests try: import simplejson as json except ImportError: import json """ Basic operations involving users """ #The URL of the API api_root = "http://api.stuff.com/v1/core"; class UserOperations(object): def __init__(self, headers): self.headers = headers def move_user(self,source_account,destination_account, user_id): user_id = str(user_id) #Get user user = self.get_user(source_account, user_id) if user is not None: #Remove user from source account self.remove_user(source_account, user_id) #Add user to destination account self.add_user(destination_account, user)
{ "domain": "codereview.stackexchange", "id": 5601, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, design-patterns, python-2.x", "url": null }
newtonian-mechanics, friction $$I\dot{\omega}=F_f R,$$ with $I$ the inertial moment, $R$ the radius and $\dot{\omega}=\frac{d\omega}{dt}$ the angular acceleration. This would be the case where you launch a ball with initial speed $v$ but no angular momentum ($\omega=0$) onto a surface that provides much friction: the ball would start spinning ($\dot{\omega} > 0$ but also start decelerating ($a < 0$) and translational kinetic energy would be converted to rotational kinetic energy. If the surface can provide enough friction that process would continue until $v=\omega R$: rolling without slipping. To keep the ball moving without any deceleration we would have to supply an external force, so that: $$F_f=F,$$ and $a=0$. Critical coefficient of friction $\mu_c$: Assume a ball with $v=0, \omega=0$ at $t=0$. We now apply a horizontal force $F$, so that $a>0$. $$F_f=\mu F_n=\mu mg$$ $$I\dot{\omega}=F_fR=\mu mgR$$ After integration we get: $$\omega=\mu\frac{mgR}{I}t$$
{ "domain": "physics.stackexchange", "id": 26296, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, friction", "url": null }
java, security, cryptography, aes String msg2 = decrypt(encrypted, password); System.out.println("restultat='" + msg2 + "'"); } public static byte[] encrypt(String message, String password) throws Exception { SecureRandom rand = new SecureRandom(); try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { try (DataOutputStream dout = new DataOutputStream(out)) { try (InputStream in = new ByteArrayInputStream( message.getBytes(StandardCharsets.UTF_8))) { byte[] salt = new byte[8]; rand.nextBytes(salt); out.write(salt); byte[] derivatedSalt = new byte[8]; rand.nextBytes(derivatedSalt); out.write(derivatedSalt); byte[] iv = new byte[16]; rand.nextBytes(iv); out.write(iv);
{ "domain": "codereview.stackexchange", "id": 45337, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, security, cryptography, aes", "url": null }
quantum-mechanics, homework-and-exercises, commutator Title: Deriving the Angular Momentum Commutator Relations by using $\epsilon_{ijk}$ Identities I've been trying to derive the relation $$[\hat L_i,\hat L_j] = i\hbar\epsilon_{ijk} \hat L_k $$ without doing each permutation of ${x,y,z}$ individually, but I'm not really getting anywhere. Can someone help me out please? I've tried expanding the $\hat L_i = \epsilon_{nmi} \hat x_n \hat p_m$ and using some identities for the $\epsilon_{ijk} \epsilon_{nmi}$ which gives me the LHS as something like $-\hbar^2\delta_{ij}$ but I've got no further than this. Since $L_i = \epsilon_{ijk} x_jp_k$ (operators) one has $$ [L_i,L_j] = \epsilon_{iab}\epsilon_{jcd}[x_ap_b,x_cp_d] = \epsilon_{iab}\epsilon_{jcd}(x_a[p_b,x_c]p_d + x_c[x_a,p_d]p_b) $$
{ "domain": "physics.stackexchange", "id": 7919, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, homework-and-exercises, commutator", "url": null }
statistical-mechanics, phase-transition if changes of the boundary conditions of the system cause macroscopic changes, then the system undergoes a phase transition if a derivative of a thermodynamic function related to the partition function (like the free energy) is not continuous (as a function of the thermodynamic parameters of the ensemble, like $\beta$), then the system undergoes a phase transition
{ "domain": "physics.stackexchange", "id": 58056, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "statistical-mechanics, phase-transition", "url": null }
fluid-dynamics, dimensional-analysis, error-analysis, approximations, navier-stokes I suggest you refer to this Wikipedia page for starting information and quite an extensive list of possible dimensionless numbers. Here I'll briefly illustrate the technique with an example. Let's assume that we want to understand when finite compressibility plays a role in fluid dynamics. We can start with an equation containing density ($\rho$) variation and the velocity field (${\bf u}$), the continuity equation: $$ \frac{\partial \rho}{\partial t}+\nabla\cdot \left( {\rho \bf u} \right)=0. $$ By introducing the material derivative ($\frac{D}{Dt}$) and the equation of state to use pressure as a variable, it may be rewritten as $$ \frac{1}{\rho c^2}\frac{Dp}{Dt}+\nabla \cdot {\bf u}=0, \tag{1} $$ where $c$ is the speed of sound. At this point, we can introduce a typical length ($L$), a typical speed of the fluid ($U$), and a typical density ($\bar\rho$), and we can use them as new units. Equation ($1$) becomes: $$
{ "domain": "physics.stackexchange", "id": 92501, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "fluid-dynamics, dimensional-analysis, error-analysis, approximations, navier-stokes", "url": null }
neural-networks, decision-trees Title: What is the difference between Inductive Learning and Connectionist Learning? According to what we know about inductive and connectionist learning, what is the difference between them ? For those who do not know about : Inductive Learning, like what we have in decision tree and make a decision based on amount of samples Connectionist Learning, like what we have in artificial neural network All of the statistical learning is about inductive learning. What is the difference between inductive learning and connectionist learning? Inductive learning is about identifying patterns from examples. It is more related to statistics. Connectionist learning is more about finding a common pattern and predicting as well as self-learning(learning from the experience of prediction).
{ "domain": "ai.stackexchange", "id": 1590, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "neural-networks, decision-trees", "url": null }
research, intelligent-agent, autonomous-vehicles, probability, robotics With that change, every matrix $H_t^i$ will have the same number of columns: $$6 + 3j - 3 + 3N - 3j = 3 + 3N,$$ which evaluates to a total of $48$ in your case (because you have $N = 15$ landmarks). That's precisely the correct dimensionality required for matrix multiplication with your $\mu_t$ vector.
{ "domain": "ai.stackexchange", "id": 728, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "research, intelligent-agent, autonomous-vehicles, probability, robotics", "url": null }
We have the pattern: m=3 , P = (3) + (0) m=6 , P = (3+5+7) + (5) m=9 , P = (3+5+7+9+11) + (5+9) m=12, P = (3+5+7+9+11+13+15) + (5+9+13) etc. Now since in this case we don't need to consider what is happening in the other cases and we are dealing with m that are multiples of 3, let's take $$\frac{m}{3}=x$$. So for m=12, x=4 and you can consider that as being the 4th sequence in this lone pattern. for x=1, we have 1 in the first bracket, and 0 in the second for x=2, we have 3 in the first bracket, and 1 in the second for x=3, we have 5 in the first bracket, and 2 in the second for x=2, we have 7 in the first bracket, and 3 in the second Can you see the pattern arising? for x=x, we have (2x-1) in the first bracket, and (x-1) in the second Now looking at the formulae I gave you earlier, $$3+5+7+...+(2n+1)=n(n+2)$$ and $$5+9+13+...+(4n+1)=n(2n+3)$$
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9835969674838368, "lm_q1q2_score": 0.8360290764325513, "lm_q2_score": 0.849971181358171, "openwebmath_perplexity": 2664.09586929662, "openwebmath_score": 0.7515673637390137, "tags": null, "url": "https://www.physicsforums.com/threads/convert-to-formula.419721/" }
You found an integrating factor that makes $M_y = N_x$ as $$\tag 2 \mu(x,y)= \dfrac 1 {xy(1-xy)}$$ Multiplying $(1)$ by $(2)$ gives the exact DEQ $$\tag 3 \dfrac{2xy+3}{x(1-xy)}dx+\dfrac{3xy+2}{y(1-xy)}dy=0$$ Now $$g(x, y) = \displaystyle \int \left(\dfrac{2xy+3}{x(1-xy)}\right)~dx = 3 \ln x - 5 \ln(1 - x y) + h(y)$$ We can now write $$\dfrac{\partial g(x, y)}{\partial y} = \dfrac{5 x}{1-x y } + h'(y) = \dfrac{3xy+2}{y(1-xy)} \implies h'(y) = \dfrac{3xy+2}{y(1-xy)} - \dfrac{5 x}{1-x y } = \dfrac{2}{y}$$ Solving $$h(y) = 2 \ln y$$ We now have $$g(x, y) = 3 \ln x - 5 \ln(1 - x y) + h(y) = 3 \ln x - 5 \ln(1 - x y) + 2 \ln y = c$$ I will assume you can take it from here to solve for $c$ using the IC and get the final implicit form.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9830850872288502, "lm_q1q2_score": 0.8394688913939395, "lm_q2_score": 0.8539127510928476, "openwebmath_perplexity": 496.8349641072435, "openwebmath_score": 0.8624807596206665, "tags": null, "url": "https://math.stackexchange.com/questions/2140226/exact-de-y2xy3dxx3xy2dy-0/2140279" }
c++, linked-list, reinventing-the-wheel, memory-management void LinkList::do_reverse() { Link* prev = nullptr; Link* curr = head; Link* next = curr->getNext(); while (curr){ } } Link* LinkList::delete_at_pos(int n) { if(n <=0) return head; int count = 1; Link* curr = head, *prev = nullptr;; while(curr!=nullptr){ if(count == n) break; prev = curr; curr = curr->getNext(); count++; } if(curr!=nullptr){ Link* temp = curr; if(curr == head){ head = head->getNext(); }else{ prev->setNext(curr->getNext()); } delete temp; } return head; } LRU.hpp #ifndef LINKLIST_LRU_HPP #define LINKLIST_LRU_HPP
{ "domain": "codereview.stackexchange", "id": 33550, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, linked-list, reinventing-the-wheel, memory-management", "url": null }
field-theory, boundary-conditions, dirac-equation Title: Boundary conditions for the Dirac spinor I know how to solve the Dirac equation, because I have learnt it from Peskin and Schroeder. But I realized that no constants or boundary conditions appear in the solution to the Dirac eq., as it is a first order differential equation. I can't figure it out, and I have no clue. My guess is that P&S just skipped that part for simplicity. I would greatly appreciate your help. In P&S they used the ansatz of $\psi(x) = \mathcal{u} e^{-ip \cdot x}$, i.e. a plane wave solution. This then leads to constraints on $\mathcal{u}$ (by substituting the ansatz in the Dirac equation). Solving for these constraints shows that $\mathcal{u}$ depends continuously on 3 momentum $\vec{p}$ and discretely on an index $s$ taking values $s \in \{1,2,3,4\}$. This is not the most general (classical) solution of the Dirac equation, the most general solution is a linear combination of all such plane wave solutions, i.e.
{ "domain": "physics.stackexchange", "id": 84076, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "field-theory, boundary-conditions, dirac-equation", "url": null }
electric-circuits, potential, symmetry, electrical-resistance, voltage Title: Why are points on the axis of a circuit with axial symmetry equipotential? Given the following electrical circuit: How to explain that L and K are equipotential? More generic question: why given any electrical circuit with axial symmetry, points that belong to the axis are equipotential: P.S. It's derived from my more complex homework, but I am trying to understand how things work, not just trying to get it solved. Update. There is a resistance between K and L instead of ideal wire. Assuming the wire is ideal and since there are no resistances between the point L and K, the potential drop between L and K is zero i.e potential does not change. So the potential is same anywhere in between those two points and therefore, they are equipotential. UPDATE:
{ "domain": "physics.stackexchange", "id": 47081, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electric-circuits, potential, symmetry, electrical-resistance, voltage", "url": null }
machine-learning-model, data-science-model, cross-validation, hyperparameter-tuning Output: (5110, 10) (5110,) >DT 0.555 (0.034) >RF 0.781 (0.030) >XGB 0.809 (0.026) >LR 0.839 (0.029) >LDA 0.833 (0.030) >SVM 0.649 (0.064) Second model with SMOTE: for i in range(len(models)): transformer = ColumnTransformer(transformers=[('imp',SimpleImputer(strategy='median'),numerical),('o',OneHotEncoder(),categorical)]) pipeline = Pipeline(steps=[('t', transformer),('p',PowerTransformer(method='yeo-johnson', standardize=True)),('over', SMOTE()), ('m', models[i])]) scores = evaluate_model(X, y, pipeline) results.append(scores) print('>%s %.3f (%.3f)' % (names[i], np.mean(scores), np.std(scores))) Output: (5110, 10) (5110,) >DT 0.579 (0.036) >RF 0.765 (0.027) >XGB 0.778 (0.031) >LR 0.837 (0.029) >LDA 0.839 (0.030) >SVM 0.766 (0.040)
{ "domain": "datascience.stackexchange", "id": 11673, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "machine-learning-model, data-science-model, cross-validation, hyperparameter-tuning", "url": null }
observational-astronomy, spectroscopy, spectra, optics, dark-energy But in simple terms: the circular focal plane is divided into ten wedges (or "petals"). Each wedge holds an array of 500 fibers and their associated robotic positioners. Each set of 500 fibers is collected at the back end and passed outside the telescope to a spectrograph, where the fibers are arrayed into a line to pass their light onto a slit. That is, there are ten separate spectrographs (that's your "bank of spectrographs"), each of which has a single slit with the light from 500 fibers passing into it. (Each spectrograph then has dichroics splitting the light from the slit into three different wavelength regimes and three different cameras, each with a different grating -- 360-555 nm ["blue"], 555-656 nm ["red"], and 656-908 nm ["infrared", though this is still handled by a CCD and it not really what modern astronomers usually call "infrared"]).
{ "domain": "astronomy.stackexchange", "id": 4030, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "observational-astronomy, spectroscopy, spectra, optics, dark-energy", "url": null }
mechanical-engineering, structural-engineering, beam, homework then there is a bending and a shear force up to the point that the wire contacts the drum. Beyond that point the wire is resting on the cylinder (pretty much like a beam on elastic foundations). Therefore any shear forces are counteracted by the drum and therefore the wire is in pure bending.
{ "domain": "engineering.stackexchange", "id": 4568, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "mechanical-engineering, structural-engineering, beam, homework", "url": null }
newtonian-mechanics, special-relativity, spacetime, inertial-frames Level sets of $t$ are straight horizontal lines Level sets of $x$ are straight vertical lines Level sets of $\bar{t}$ are straight horizontal lines Level sets of $\bar{x}$ are straight lines of slope $\frac{1}{v}$ (we have the fraction because of the way the axes are drawn). So, if I give you an arbitrary point $p$ in the $(t,x)$ plane, you can immediately tell me what its various coordinates $(t(p),x(p))$ and $(\bar{t}(p),\bar{x}(p))$ are (see figure below). Given the point $p$, draw a horizontal line passing through $p$; this intersects the $t$-axis at a point $q$. Now, draw a vertical line through $p$; this will intersect the $x$-axis at some point $s$. Lastly, draw a line of slope $\frac{1}{v}$ passing through $p$; this will intersect the $x$-axis at a point $r$. So, putting together everything I've said:
{ "domain": "physics.stackexchange", "id": 88127, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, special-relativity, spacetime, inertial-frames", "url": null }
fluid-dynamics A smaller lumen would increase the velocity of flow, increasing turbulence, therefore a low viscosity fluid with a small needle would be best suited It says a needle with a small diameter will increase turbulence but higher Reynolds number indicates more turbulence This confused me does turbulence more in tubed with bigger or smaller diameters? For flow through a pipe/tube the Reynolds number $\text{Re}$ is given by: $$\text{Re}=\frac{WD}{\mu A}$$ where $A=\frac{\pi D^2}{4}$ so that: $$\text{Re}=\frac{4W}{\pi \mu D}$$ It follows that, all other things being equal, smaller diameters lead to higher turbulence.
{ "domain": "physics.stackexchange", "id": 74754, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "fluid-dynamics", "url": null }
This problem can be solved from the definitions alone: the only advanced calculation is the integral of a monomial. ### Preliminary observations Let's work with the variables $X_i/a$ and $Y_i/a$ throughout: this does not change $Z_n$ but it makes $(X_1, \ldots, Y_n)$ iid with Uniform$(0,1)$ distributions, eliminating all distracting appearances of $a$ in the calculations. Thus we may assume $a=1$ without any loss of generality. Note that the independence of the $Y_i$ and their uniform distribution imply that for any number $y$ for which $0\le y \le 1$, $$\Pr(y \ge Y_{(n)}) = \Pr(y \ge Y_1 , \ldots, y \ge Y_n) = \Pr(y \ge Y_1)\cdots \Pr(y \ge Y_n) = y^n,$$ with an identical result holding for $X_{(n)}$. For future reference, this allows us to compute $$\mathbb{E}(2X_{(n)}^n) = \int_0^1 2x^n\mathrm{d}(x^n) = \int_0^1 2nx^{2n-1}\mathrm{d}x = 1.$$ ### Solution
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9912886147702209, "lm_q1q2_score": 0.8104522677743913, "lm_q2_score": 0.8175744739711883, "openwebmath_perplexity": 335.2035273565424, "openwebmath_score": 0.9534310102462769, "tags": null, "url": "https://stats.stackexchange.com/questions/185227/transforming-order-statistics" }
organic-chemistry, carbon-allotropes Title: Why does graphite conduct electricity? The answer i know is delocalized electrons. But how?this site tells me that:
{ "domain": "chemistry.stackexchange", "id": 2111, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "organic-chemistry, carbon-allotropes", "url": null }
php, mysql, security == true is not needed, and should never be used. Either directly write if (password_verify(...)) {...}, or use === (if you don't trust ==, which you shouldn't in many situations[*]). you should generally try to be consistent with your variable naming schemes. Either use camelCase or snake_case, don't mix them. I appreciate that you are mostly consistent with your naming overall, as it really helps readability. :email is the exception here, so you should change it. fld_pwd_form also does not fit your general naming scheme. Either append _form to all values that are input, or to none (and think about changing it to _input). Is there a reason for the fld_ prefix? It reduces readability, so if you can still change your database names, I would remove it. hash is enough as a name, you don't need ToStoreInDb.
{ "domain": "codereview.stackexchange", "id": 19591, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "php, mysql, security", "url": null }
optics, microwaves Here is an experiment with individual footprints of photons which display the classical interference pattern when in large numbers. Unless the experiment is designed to detect single photons at a time, one is working with the classical electromagnetic wave and can usually forget the photon aspect. Individual photons can only be detected by interactions, as seen in the link above. In quantum optics:
{ "domain": "physics.stackexchange", "id": 55347, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "optics, microwaves", "url": null }
c++, c++11, mathematics, template bool operator!=(const DistanceExpression& other) const { return !(*this == other); } private: T _data; }; My new distance function is implemented as such: template<std::size_t N, typename T> auto distance(const Point<N, T>& lhs, const Point<N, T>& rhs) -> DistanceExpression<T> { T res{}; for (std::size_t i = 0 ; i < N ; ++i) { auto tmp = std::abs(lhs[i] - rhs[i]); res += tmp * tmp; } return DistanceExpression<T>{res}; }
{ "domain": "codereview.stackexchange", "id": 6661, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, c++11, mathematics, template", "url": null }
mechanical-engineering, structural-engineering, civil-engineering, structural-analysis, statics Title: How can I determine horizontal force reactions in a fixed on both ends beam How can I determine horizontal force reactions in a fixed on both ends beam like this one? The reaction at either end is simply equal and opposite to the axial load in the beam adjacent to it. So what you need to work out is the axial force each side of where F is applied. To work this out you need the plea formula: d = PL/EA where d is extension, P is axial force, L is the original length, E is Young's modulus and A is cross-sectional area. Using subscript 1 for the left hand side and 2 for the right hand side, we then get two equations: d1 = P1a/EA d2 = P2b/EA We also know that for equilibrium: P2 + P1 = F d2 = d1 We can then solve all of these simultaneous equations (I'll leave that step to you), and we'll find: P1 = F * b/(a+b) P2 = F * a/(a+b)
{ "domain": "engineering.stackexchange", "id": 2108, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "mechanical-engineering, structural-engineering, civil-engineering, structural-analysis, statics", "url": null }
c, compiler, basic-lang initialize(&comp, *argv); populate(&comp); if (dooptimize) optimize(&comp); resolve(&comp); assemble(comp, out); return EXIT_SUCCESS; } /* initialize symbol table, instruction array, flag array and counters */ static void initialize(struct compiler *comp, char *filename) { static struct symbol symtable['z' - 'A']; static memtype sml[MEMSIZE]; static char flag[MEMSIZE]; size_t i; comp->symtable = symtable; comp->sml = sml; comp->flag = flag; comp->memsize = MEMSIZE; comp->file = filename; comp->ln = 1; comp->inscount = 0; comp->datacount = comp->memsize - 1; /* initialize arrays */ for (i = 'A'; i < 'z'; i++) symtable[i - 'A'].type = none; for (i = 0; i < comp->memsize; i++) flag[i] = '\0'; } /* populate symbol table, instruction array, and flag array */ static void populate(struct compiler *comp) { enum tokentype toktype; char *tok;
{ "domain": "codereview.stackexchange", "id": 37770, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c, compiler, basic-lang", "url": null }
symmetry-breaking, spin-chains So I think the text books I mention only meant for the disorderd chains, such as antiferromagnetic chain. Yes and no. The quantum Ising model in 1+1 dimensions has a phase transition as you vary the coupling in the Hamiltonian. This model is directly related to the statistical mechanics of the classical Ising model in 2 spatial dimensions via the usual correspondence between quantum field theory and classical statistical mechanics. But this is only a phase transition for zero temperature. For any finite temperature there is no phase transition. Going back to the statistical model in 2d, finite temperature corresponds to one of the two spatial dimensions being finite and periodic. At large scales that finite dimension looks thin, and the system behaves like the classical Ising model with 1 spatial dimension which has no phase transition.
{ "domain": "physics.stackexchange", "id": 44312, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "symmetry-breaking, spin-chains", "url": null }
close to $$1$$. For example, any design matrix $$X$$ in the form of $$(2)$$ below satisfies that its first PC explains $$1 - \varepsilon$$ total variation: \begin{align} X = U\begin{bmatrix} \operatorname{diag}(\sqrt{1 - \varepsilon}, c, \ldots, c) \\ 0 \end{bmatrix}V', \tag{2} \end{align} where $$c = \frac{\sqrt{\varepsilon}}{\sqrt{p - 1}}$$, $$U$$ and $$V$$ are arbitrary order $$n$$ and order $$p$$ orthogonal matrices. Therefore, it is not surprising at all to observe cases such that $$p_1 > 90\%$$.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9637799441350252, "lm_q1q2_score": 0.8172543206491379, "lm_q2_score": 0.8479677602988602, "openwebmath_perplexity": 992.933348967242, "openwebmath_score": 0.8425297141075134, "tags": null, "url": "https://stats.stackexchange.com/questions/605113/can-pc1-explain-more-than-90-of-variance" }
of the graph and do not represent a maximum or a minimum. The first derivative test states that if we take the derivative of a function and set it equal to zero and solve, we will find critical numbers. The second derivative also can be used to find Points of Inflection. Notes: In many books, the term “relative minimum” is used instead of “local minimum. You should always stick to the definitions and conventions used in that particular class to answer any questions. For general polynomials, finding these turning points is not possible without more advanced techniques from calculus. ) f(x) x5x-2 (x, y) relative maximum (x, y) relative minimum Find the point of inflection of the graph of the function. Subsection 10. These will be a relative extrema if it changes sign, so find 2 values around both to test using the first derivative test, like -3 and -1 for the first and 1 What do the letters R, Q, N, and Z mean in math? 1 educator answer. 7 I can use derivatives to complete optimization
{ "domain": "brouwerverkeersopleidingen.nl", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9916842195563768, "lm_q1q2_score": 0.8198370424180074, "lm_q2_score": 0.8267117962054049, "openwebmath_perplexity": 259.82261796467463, "openwebmath_score": 0.7462790012359619, "tags": null, "url": "http://brouwerverkeersopleidingen.nl/how-to-find-relative-extrema-using-second-derivative-test.html" }
Recall that an axiomatic system is consistent if it cannot derive both a theorem and its negation. What do we mean by the negation of a theorem? Let's take, as a simple example, the theorem: "6 is divisible by 3." Its negation is simply the following statement: "6 is not divisible by 3" or equivalently "It is not the case that 6 is divisible by 3." This second formulation of the negation, although less elegant in English, is preferable because the negation is added to the front of the original theorem. In a formal system, negation is handled by simply adding a symbol for the phrase "it is not the case that." Several symbols have been used for negation, such as ~ and ¬ . We'll use the latter here. So, if T is any theorem in some formal system, then the formula  ¬T is the negation of T.
{ "domain": "blogspot.my", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9907319855244919, "lm_q1q2_score": 0.8572051749767012, "lm_q2_score": 0.865224084314688, "openwebmath_perplexity": 587.8367039734752, "openwebmath_score": 0.7829540371894836, "tags": null, "url": "http://summerofgodel.blogspot.my/" }
# The Convergence of a Telescoping Series The question I've been posed is: Show that the following series converges, and compute its value $$\sum_{k=1}^\infty \frac{1}{k(k+2)}$$ From this I decided to use partial fractions to put into the form: $$\frac{1}{2}\cdot\left(\frac{1}{k}-\frac{1}{k+2}\right)$$ And from this I noticed that this is in the form of a telescoping series which I think would cancel down to: $$\frac12\cdot\left(1+\frac12\right)= \frac{3}{4}$$ So I've got to this point, but I don't think what I've worked out is substantial enough to prove what I've been asked. Would anyone mind giving any tips to make my working more thorough. • Concerning the convergence alone you can use the fact that $$\frac1{k(k+2)}<\frac1{k^2}$$ – mrtaurho Feb 27 '19 at 21:30 Note that$$\frac1k-\frac1{k+2}=\left(\frac1k-\frac1{k+1}\right)+\left(\frac1{k+1}-\frac1{k+2}\right).$$This will give you two telescoping series. Can you take it form here?
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9857180694313358, "lm_q1q2_score": 0.8665908481738798, "lm_q2_score": 0.879146761176671, "openwebmath_perplexity": 193.48921147394122, "openwebmath_score": 0.8755278587341309, "tags": null, "url": "https://math.stackexchange.com/questions/3129387/the-convergence-of-a-telescoping-series" }
• @DavidK oh yes, you are right, but then which method should I use? – Mark Jacon Jan 22 at 16:08
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9744347845918813, "lm_q1q2_score": 0.805576735215294, "lm_q2_score": 0.8267118004748677, "openwebmath_perplexity": 1328.6313131480947, "openwebmath_score": 0.9992067217826843, "tags": null, "url": "https://math.stackexchange.com/questions/3083324/approximate-the-probability-that-the-total-service-time-of-100-passengers-is-l" }
forces, differential-geometry, differentiation, vector-fields, conservative-field Let us say that a $k$-cochain in $M$ is a linear function on $k$-chains, i.e. if $\phi\in \Delta^k(M)$ is a $k$-cochain then for each $k$-chain $\sigma\in\Delta_k(M)$, the expression $\phi(\sigma)$ is a real number linear in $\sigma$. It then follows from linear algebra that the boundary operator $\partial$ has a transpose $\partial^\ast:\Delta^k(M)\rightarrow\Delta^{k+1}(M)$ on cochains which increases the degree by one, squares to zero and is determined by $(\partial^\ast\phi)(\sigma)=\phi(\partial\sigma)$. If $\omega\in\Omega^k(M)$ is a differential $k$-form, then the map $\sigma\mapsto\int_\sigma\omega$ is a linear function on $k$-chains, hence $\omega$ determines a unique $k$-cochain. Not every cochain is of this form, however. But we see through the generalized Stokes theorem that the coboundary operator $\partial^\ast$ - when acting on cochains determined by differential forms - is just the exterior derivative operator: $\partial^\ast\omega=\mathrm d\omega$.
{ "domain": "physics.stackexchange", "id": 94703, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "forces, differential-geometry, differentiation, vector-fields, conservative-field", "url": null }
electricity, electric-circuits, voltage The ΔV across any two points on a wire is zero or close to zero, even if there is current flowing through it? Correct as @The Photon said. But it can never actually be zero since wires will always have some resistance which depends on the resistivity of the wire material, the size (cross sectional area) of the wire, and its length. For example, let’s say we have a AA battery with an emf of 1.5 volts and an internal resistance of 0.2 Ohm. A one-foot piece of 12 AWG copper wire is connected across the terminals. Such a wire would have a very low resistance of about 0.0025 Ohm. The instantaneous current flow will be $$I=\frac {emf}{R_{tot}}=\frac {1.5}{0.2+0.0025}=7.4 amps$$ This means the battery terminal voltage across the entire length of wire will be $$\Delta V=IR_{L}=(7.4)(0.0025)=0.0185 volts$$ Which is 1.2% of the battery emf. Clearly this is close to zero as nearly all of the battery emf is dropped across its internal resistance, but still not zero.
{ "domain": "physics.stackexchange", "id": 56739, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electricity, electric-circuits, voltage", "url": null }
javascript document.querySelectorAll('.image-slider').forEach(createSlider); .image-slider .images { display: none; } <div class="image-slider"> <div class="images"> <img src="https://placeimg.com/200/100/animals"> <img src="https://placeimg.com/200/100/arch"> <img src="https://placeimg.com/200/100/nature"> </div> <button data-prev>Prev</button> <img data-display width="200px" height="100px"> <button data-next>Next</button> </div>
{ "domain": "codereview.stackexchange", "id": 29362, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript", "url": null }
gazebo Title: Gazebo fail to connect to master in 30 seconds. It does not run from the very first time I am new to Gazebo as well as Ubuntu... So dont have much knowledge about any of them. I have been trying to install gazebo's latest version. Step by step copying the lines from the installation guide to the terminal. But at the end when i try to run gazebo it tells to wait for master and never connects to it. Below is the terminal screen after i enter Gazebo. ======================================================================================= salmaan@ubuntu:~$ gazebo Gazebo multi-robot simulator, version 1.8.6 Copyright (C) 2013 Open Source Robotics Foundation. Released under the Apache 2 License. http://gazebosim.o r g Gazebo multi-robot simulator, version 1.8.6 Copyright (C) 2013 Open Source Robotics Foundation. Released under the Apache 2 License. http://gazebosim.o r g Msg Waiting for master.Warning [ModelDatabase.cc:331] Getting models
{ "domain": "robotics.stackexchange", "id": 14602, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "gazebo", "url": null }
algorithms, graphs Title: Find shortest paths in a weighed unipathic graph A directed graph is said to be unipathic if for any two vertices $u$ and $v$ in the graph $G=(V,E)$, there is at most one simple path from $u$ to $v$. Suppose I am given a unipathic graph $G$ such that each edge has a positive or negative weight, but contains no negative weight cycles. From this I want to find a $O(|V|)$ algorithm that finds all the the shortest paths to all nodes from a source node $s$. I am not sure how I would go about approaching this problem. I am trying to see how I could use the fact that it contains no negative weight cycles and of course at most one simple path between any node $u$ to $v$. Choose a data representation
{ "domain": "cs.stackexchange", "id": 75, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "algorithms, graphs", "url": null }
modeling Some other dimensionless groups are more empirical, shown to predict behavior by experiment. To your question on whether dimensionless numbers will predict a real life situation all the time: any physical model is just that, a model, with many assumptions and idealizations. It is meant to get us relatively close to an answer, which is often the best we can hope for with fluid dynamics. Also keep in mind that all dimensionless numbers must match for there to be a true similarity, e.g. Reynolds, Mach, geometric aspect ratios, which can be very difficult to achieve in practice. Often a lab like a wind tunnel testing a model aircraft must make do with an imperfect match, and get what data they can.
{ "domain": "engineering.stackexchange", "id": 5233, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "modeling", "url": null }
electrostatics, electric-fields, potential-energy Perhaps showing you the connection between the formula and the potential energy stored in the volume containing the electric field between the plates of a parallel plate capacitor may give you some insight. First we start with the potential energy stored in the capacitor as a function of its voltage $V$ and capacitance $C$. $$U=\frac{1}{2}CV^2$$ Next we relate the voltage $V$ across the capacitor to the electric field $E$ and the plate separation distance $d$ $$V=Ed$$ Finally, a parallel plate capacitor's capacitance in terms of the area $A$ of the plates and the electrical permittivity $\epsilon$ of the dielectric material between the plates is given by $$C=\frac{\epsilon A}{d}$$ Substituting the last two equations into the first $$U=\frac{1}{2}\frac {\epsilon A E^{2}d^{2}}{d}=\frac{1}{2}\epsilon E^{2}V$$ Where $V=Ad$ is now the volume of the space containing the electric field of the capacitor. For air or vacuum, $\epsilon=\epsilon_{o}$
{ "domain": "physics.stackexchange", "id": 83902, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electrostatics, electric-fields, potential-energy", "url": null }
python, beginner, rock-paper-scissors then you can write code like: if user == ROCK and comp == PAPER: # user loses which is much easier to read. The all-uppercase names are used by convention to indicate constants; python doesn't treat them differently. Also note that this isn't really the best way to do this; what I'm describing is a clumsy way of doing an enumerated type; there are cleaner approaches in all versions of Python, and proper support for enums in Python 3. I'm suggesting a lightweight approach to suit where I've guessed your skill level to be. Choice output At the moment, you have lots of conditionals of the approximate form: if choice == 1: print "Chose ROCK!" elif choice == 2: print "Chose PAPER!" You could define this mapping once at the top of your program: names = { 1: "ROCK", 2: "PAPER", 3: "SCISSORS" } and then refer to it later: print "Chose {}!".format(names[choice])
{ "domain": "codereview.stackexchange", "id": 18422, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, beginner, rock-paper-scissors", "url": null }
javascript, numbers-to-words words.push(TENS[tens - 1]); words.push(inEnglish(ones)); return words.filter(isTruthy).join("-"); } hundreds = number / 100 | 0; words.push(inEnglish(hundreds)); words.push("hundred"); words.push(inEnglish(number % 100)); return words.filter(isTruthy).join(" "); } // append the word for a scale. Made for use with Array.map function appendScale(chunk, exp) { var scale; if(!chunk) { return null; } scale = SCALES[exp - 1]; return [chunk, scale].filter(isTruthy).join(" "); } Worth noting:
{ "domain": "codereview.stackexchange", "id": 13534, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, numbers-to-words", "url": null }
boost, rosrun Title: rosrun warning error i created a simple package for listner.cpp and talker.cpp. i already build my package. when i run "rosrun firstpack talker", it run successfully and print "hello world". when i open new tab and run my listener node it give me error . chhonkar@chhonkar-pc:~/Desktop/catkin$ rosrun firs[rospack] Warning: error while crawling /home/chhonkar: boost::filesystem::status: Permission denied: "/home/chhonkar/.gvfs" tpack listner [rosrun] Couldn't find executable named listner below /home/chhonkar/Desktop/catkin/src/firstpack Both node run successfully when i run it alone. but when i run another node, it return error. my questions are Q1- " what is this error?" Q2 - "why my node run alone but when i execute one after another, it fails and return above error"? Originally posted by ASHISH CHHONKAR on ROS Answers with karma: 41 on 2014-10-30 Post score: 2 I see two separate issues here:
{ "domain": "robotics.stackexchange", "id": 19893, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "boost, rosrun", "url": null }
c#, algorithm, strings, programming-challenge return ans; } private static bool valid(int n, int[] a) { int A, G, T, C; A = a['A']; G = a['G']; T = a['T']; C = a['C']; if (A <= n / 4 && G <= n / 4 && T <= n / 4 && C <= n / 4) return true; return false; } } } Based on the code review on this post, I wrote a new version: using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BearAndSteadyGene2 { class BearAndSteadyGene2 { static void Main(string[] args) { int testCase1 = minChange(8, "GTAAAAAA"); Debug.Assert(testCase1 == 4); int testCase2 = minChange(8, "GATAAAAA"); Debug.Assert(testCase2 == 4); int testCase3 = minChange(8, "GAAATAAA"); Debug.Assert(testCase3 == 5); int testCase4 = minChange(8, "AAAGTAAA"); Debug.Assert(testCase4 == 6); }
{ "domain": "codereview.stackexchange", "id": 23139, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, algorithm, strings, programming-challenge", "url": null }
thermodynamics, energy, statistical-mechanics, entropy, probability My Question My question comes from the details of working out the partial derivative. I obtained, \begin{align*} \frac{\partial S}{\partial U} &= - \lambda_2 - U \frac{\partial \lambda_2}{\partial U} + \frac{k_B}{Z} \frac{\partial Z}{\partial U} \\ &= - \lambda_2 - U \frac{\partial \lambda_2}{\partial U} + \frac{1}{Z} \sum_j e^{\frac{\lambda_2 E_j}{k_B}} \left[ E_j \frac{\partial \lambda_2}{\partial U} + \lambda_2 \frac{\partial E_j}{\partial U} \right] \\ &= - \lambda_2 + \frac{1}{Z} \sum_j e^{\frac{\lambda_2 E_j}{k_B}} \lambda_2 \frac{\partial E_j}{\partial U} \end{align*}
{ "domain": "physics.stackexchange", "id": 97151, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics, energy, statistical-mechanics, entropy, probability", "url": null }
matlab, modulation, demodulation, baseband Where fs2 =100 if we wish to simulate a 100 Hz sampling rate.
{ "domain": "dsp.stackexchange", "id": 12462, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "matlab, modulation, demodulation, baseband", "url": null }
whether it is reflexive, whether it is symmetric, and whether it is antisymmetric, and whether it is transitive. Antisymmetry is different from asymmetry: a relation is asymmetric if, and only if, it is antisymmetric and irreflexive. We call symmetric if means the same thing as . In that, there is no pair of distinct elements of A, each of which gets related by R to the other. This section focuses on "Relations" in Discrete Mathematics. Note: a relation R on the set A is irreflexive if for every a element of A. Here's my code to check if a matrix is antisymmetric. Solution: The relation R is not antisymmetric as 4 ≠ 5 but (4, 5) and (5, 4) both belong to R. 5. Transitive if for every unidirectional path joining three vertices $$a,b,c$$, in that order, there is also a directed line joining $$a$$ to $$c$$. Discrete Mathematics Questions and Answers – Relations. Multi-objective optimization using evolutionary algorithms. I just want to know how the value in the answers come like 2^n2 and
{ "domain": "tpicom.eu", "id": null, "lm_label": "1. Yes\n2. Yes\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9678992932829918, "lm_q1q2_score": 0.8509255257701465, "lm_q2_score": 0.8791467580102418, "openwebmath_perplexity": 559.41462801027, "openwebmath_score": 0.82464998960495, "tags": null, "url": "http://www.tpicom.eu/assassins-creed-drbg/855ddb-every-asymmetric-relation-is-antisymmetric" }
rust, sudoku fn main () { let mut grid = Grid { data: [ [1,6,4,0,0,0,0,0,2], [2,0,0,4,0,3,9,1,0], [0,0,5,0,8,0,4,0,7], [0,9,0,0,0,6,5,0,0], [5,0,0,1,0,2,0,0,8], [0,0,8,9,0,0,0,3,0], [8,0,9,0,4,0,2,0,0], [0,7,3,5,0,9,0,0,1], [4,0,0,0,0,0,6,7,9] ], current: (0, 0), }; loop { if let None = grid.next() { break; } let empty_cell = grid.current; match grid.check(empty_cell) { Some(i) => { grid.data[empty_cell.0][empty_cell.1] = i; }, None => continue, } } for row in grid.data.iter() { println!("{:?}", row); } } General Run clippy. It will automatically tell you such things as:
{ "domain": "codereview.stackexchange", "id": 29287, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "rust, sudoku", "url": null }
So what is special about 1/5 that would exclude it from the domain? The discriminant there is 0, so there is only one solution for x; what is that one solution? Find out, and then look back at the original equation! This is one of the subtleties I mentioned in your method; but it also occurred in mine, and I mentioned it in my summary of what I did. Now, what about the exclusion of 1? That’s the other major subtlety: Look at your quadratic equation in x; is it always quadratic? If it isn’t, then the discriminant isn’t really relevant; you have to take this as a special case. So far, his method has not yielded any numbers to be excluded; they will both be special cases, somehow. So figuring this out will be useful for understanding the whole process. He replied: Ok so I plugged y = 1/5 in the equation and got x = 2, which is of course rejected because x ≠ 2.
{ "domain": "themathdoctors.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9796676490318649, "lm_q1q2_score": 0.8326892634013067, "lm_q2_score": 0.849971175657575, "openwebmath_perplexity": 356.8724881341534, "openwebmath_score": 0.8312191963195801, "tags": null, "url": "https://www.themathdoctors.org/finding-the-range-of-a-tricky-rational-function/" }
electromagnetism, energy, heat, vacuum As an example, let's consider a superconducting metal container of gas suspended in a magnetic field: Now suppose that the gas is at some non-zero temperature. Then there is a non-zero probability that the gas will concentrate onto one side: In order for this to happen, assuming that the center of mass of the container remained constant, the metal part of the container had to have shifted in the opposite direction: Assuming that the levitation is stable, a motion of the superconducting container must be opposed by the magnetic field. Thus the above motion is opposed by a force from the magnetic field. However, for every action there is an opposite and equal reaction (Newton's 3rd law), therefore there will be a corresponding opposing force on the suspension: Therefore thermal motion in the suspended container will induce thermal motion in the base, hence there will be conduction of heat.
{ "domain": "physics.stackexchange", "id": 87575, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electromagnetism, energy, heat, vacuum", "url": null }
picture on the right, then the area (shown in blue) of that side’s trapezoid is given by: Both layers are in CRS OSGB:1936. After entering the required data, click the Calculate button to obtain the cross-sections's area and wetted perimeter. The following are supported geometry properties: AREA — The area of each polygon feature. Based on the sides and the angles of the polygon, it can be classified into two different types, such as regular polygons and irregular polygons. The solution is an area of 259.8 units. Area of a square … Triangles, quadrilaterals, pentagons, and hexagons are all examples of polygons. First, number the vertices in order, going either clockwise or counter-clockwise, starting at any vertex. Geometry is a branch of mathematics that studies spatial structures and relationships, as well as their generalizations. OwlCalculator.com. Regular polygon calculator is an online tool to calculate the various properties of a polygon. Steps to Find Area & Perimeter of a
{ "domain": "tjoget.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9793540692607816, "lm_q1q2_score": 0.8096435638103112, "lm_q2_score": 0.8267117983401363, "openwebmath_perplexity": 730.2853301703782, "openwebmath_score": 0.5794916152954102, "tags": null, "url": "https://tjoget.com/2o423/cada66-find-the-area-of-a-polygon-calculator" }
aerodynamics, drag Title: What shape has the highest drag coefficient? This image from NASA illustrates drag coefficients for several shapes:
{ "domain": "physics.stackexchange", "id": 74919, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "aerodynamics, drag", "url": null }
asymptotics, big-o-notation Title: If we have f(n) ∈ O(h(n)) and g(n) ∈ Ω(h(n)), does that mean that f(n) + g(n) ∈ Θ(h(n))? It is quite easy to prove that f(n) + g(n) ∈ Ω(h(n)), but I am having trouble with proving/disproving that f(n) + g(n) ∈ O(h(n)). Someone suggested that this question answers mine, which it doesn't. As I've written above, proving that f(n) + g(n) ∈ Ω(h(n)) is easy. I am having trouble disproving that f(n) + g(n) ∈ O(h(n)). Thanks for any help. "We know nothing about the upper bound" is a good intuition but it is not a formal proof that you can't hope to show $f(n) + g(n) \in O(h(n))$ if your only assumptions are $f(n) \in O(h(n))$ and $g(n) \in \Omega(h(n))$. Fortunately, a counterexample is easily obtained by considering, e.g., $f(n)=1$, $g(n)=n^2$, and $h(n)=n$.
{ "domain": "cs.stackexchange", "id": 21023, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "asymptotics, big-o-notation", "url": null }
classification, machine-learning-model Title: how many samples do i need to be sure about my model metrics? i have 50 features(columns) and 100 samples(rows) dataset for binary classification problem, i have build a ML model by using cross validation and it has model metrics like roc_auc=0.71 f1=0.75 precision=0.62 recall=0.64 My question is , is it enough samples to say that my model have capacity with that metrics to make new predictions? is there any approach like power analysis to say that i need at least n samples to be sure about my ML model? One of the best ways to screen for this is to use a learning curve. This will graph the training and test accuracy across varying sample sizes. Once a plateau in accuracy growth is observed across increasing sample size, then this is an indication that further samples will be subject to diminishing returns - i.e. have less effect in boosting accuracy. Please see the following reference: sklearn.model_selection.learning_curve
{ "domain": "datascience.stackexchange", "id": 12063, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "classification, machine-learning-model", "url": null }
electricity, electrons, electrical-resistance Generally one can prove that electrons in a perfectly periodic potential can move ABSOLUTELY freely, so any resistance must stem from permanent impurities in the solid or temporary dislocations of individual atoms out of their equilibrium position, i.e. phonons. So the heat that gets produced by resistance is in fact the electrons bumping into things they "see" on their way through the solid.
{ "domain": "physics.stackexchange", "id": 52855, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electricity, electrons, electrical-resistance", "url": null }
python, python-2.x, recursion trees.append(('strange_tree_vDecoded', BinaryTree.from_preordered_list('GCBA...FD.E...H.I'))) print previous_tree = None for tree_name, tree in trees: print('Tree name: {}'.format(tree_name)) print(' Equal to previous tree: {}'.format(previous_tree == tree)) print(' Pre order: {}'.format(string_join(tree.values_pre_order(yield_none_values = True)))) print(' In order: {}'.format(string_join(tree.values_in_order()))) print previous_tree = tree if __name__ == '__main__': main() As can be seen in the output below, the manually built and decoded version of the trees are equal, and the implementation can also be used for a binary tree of integers, or whatever list you'll want. Tree name: balanced Equal to previous tree: False Pre order: DBA..C..FE... In order: ABCDEF Tree name: balanced_DEC Equal to previous tree: True Pre order: DBA..C..FE... In order: ABCDEF
{ "domain": "codereview.stackexchange", "id": 16409, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, python-2.x, recursion", "url": null }
quantum-mechanics, operators, hilbert-space, notation Title: How to use this strange operator with double factorials of the photon number operator? In a few quantum physics papers I saw an operator proportional to this one: $$\hat{N}=\frac{(\hat{n}-1)!!}{\hat{n}!!},$$ where $\hat{n}=\hat{a}^{\dagger}\hat{a}$ and $!!$ is the double factorial. Any idea on how to apply such an operator on e.g. a Fock state $|n\rangle$ or a coherent state? $$\frac{(\hat{n}-1)!!}{\hat{n}!!}|n\rangle =\frac{(n-1)!!}{n!!}|n\rangle$$ Regarding coherent states it is enough expanding them in terms of states with defined $n$ and using linearity. All that immediately arises from the general spectral theory: If $\psi_a$ is an eigenvector of a self-adjoint operator $A$ with eigenvalue $a\in \mathbb R$ and $f$ is any (measurable, real or complex valued) function over $\mathbb R$, by definition $$f(A) \psi_a := f(a) \psi_a\:.$$
{ "domain": "physics.stackexchange", "id": 35348, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, operators, hilbert-space, notation", "url": null }
(1) Four people left without paying. (2) Ten people in total shared the meal. Source: Veritas Prep ### GMAT/MBA Expert GMAT Instructor Posts: 16162 Joined: 08 Dec 2008 Location: Vancouver, BC Thanked: 5254 times Followed by:1268 members GMAT Score:770 ### Re: A number of people shared a meal, intending to divide the cost evenly among themselves. However, several of the dine by [email protected] » Sat Nov 27, 2021 7:31 am 00:00 A B C D E ## Global Stats Vincen wrote: Sat Nov 27, 2021 4:38 am A number of people shared a meal, intending to divide the cost evenly among themselves. However, several of the diners left without paying. When the cost was divided evenly among the remaining diners, each remaining person paid $$\12$$ more than he or she would have if all diners had contributed equally. Was the total cost of the meal, in dollars, an integer? (1) Four people left without paying. (2) Ten people in total shared the meal.
{ "domain": "beatthegmat.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9848109520836026, "lm_q1q2_score": 0.8330933770937216, "lm_q2_score": 0.8459424373085146, "openwebmath_perplexity": 2921.9206532191765, "openwebmath_score": 0.7196266055107117, "tags": null, "url": "https://www.beatthegmat.com/a-number-of-people-shared-a-meal-intending-to-divide-the-cost-evenly-among-themselves-however-several-of-the-diners-t328306.html" }
c#, .net, thread-safety public class MemoryCacheWrapper<T> : IMemoryCacheWrapper<T> { private readonly MemoryCache _memoryCache; private CacheItemPolicy _cacheItemPolicy; private bool _isDisposed; public MemoryCacheWrapper(string name, NameValueCollection config = null) { _memoryCache = config != null ? new MemoryCache(name, config) : new MemoryCache(name); _isDisposed = false; CacheItemPolicy = new CacheItemPolicy { SlidingExpiration = new TimeSpan(1, 0, 0) }; } public string Name { get { return _memoryCache.Name; } } public long CacheMemoryLimitInBytes { get { return _memoryCache.CacheMemoryLimit; } } public long PhysicalMemoryLimit { get { return _memoryCache.PhysicalMemoryLimit; } } public TimeSpan PollingInterval { get { return _memoryCache.PollingInterval; } }
{ "domain": "codereview.stackexchange", "id": 1572, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, .net, thread-safety", "url": null }
The comments are spot-on, but I thought you might like a more or less "authoritative reference." The following is from John Durbin's Modern Algebra: It is sometimes convenient to write $x\mapsto y$ to indicate that $y$ is the image of $x$ under a mapping. In your example, $x\mapsto f(x)$ means the exact same thing; that is, $f(x)$ is the image of $x$ under a mapping. To further solidify this reasoning, consider a very simple example. Say you have the sets $S=\{x,y,z\}$ and $T=\{1,2,3\}$, and define the mapping $\alpha\colon S\to T$ by $\alpha(x)=1,\alpha(y)=3,\alpha(z)=1$. Your question is about what, for example, $x\mapsto \alpha(x)$ means. Well, for the mapping $\alpha\colon S\to T$ defined above, you can see that $$x\mapsto 1\equiv x\mapsto\alpha(x),\quad y\mapsto 3\equiv y\mapsto\alpha(y),\quad z\mapsto 1\equiv z\mapsto\alpha(z).$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9728307653134904, "lm_q1q2_score": 0.8452214193047436, "lm_q2_score": 0.8688267779364222, "openwebmath_perplexity": 225.51302056813603, "openwebmath_score": 0.8896098732948303, "tags": null, "url": "https://math.stackexchange.com/questions/1224928/what-does-this-notation-mean-x-mapsto-fx" }
c++, linked-list Mark classes that one shouldn't inherit from with final. You could provide a constructor taking an std::initializer_list, so you could specify the elements of the list directly on construction. Sometimes you use the implicit conversion to bool for pointers and sometimes not. It might be better to be consistent. You can use in-class initializers for example for Node::next. You can provide an iterator interface, so that your container works with the range for loop. For example, you can provide a public iterator, const_iterator alias to basically pointers to the individual elements inside nodes and provide begin and end as functions. Please provide a copy and move constructor and assignment operator. This is known as the Rule of 5. If I copy your list, then I will probably get a double delete error at runtime, but this is not guaranteed.
{ "domain": "codereview.stackexchange", "id": 29100, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, linked-list", "url": null }
of a photon. The Fourier transform of a Gaussian is also a Gaussian. well, i have to prove that the inv. • One of the software packages that uses DFT to solve the quantum problem for materials. whichisjustapointwisemultiplicationofeachY k byatermproportionaltok. ωω ω ω ωω ω ωω ω ω ω. Oops! Something's Wrong. Computation 62 (205), pp. The Short-Time Fourier Transform (STFT) tool in OriginPro performs time-frequency analysis of. For a continuous signal like a sinewave, you need to capture a segment of the signal in order to perform the DFT. dots are the original 19 Gaussian points. A Mathematical Model of Discrete Samples. In almost all cases, DFT really means the Finite Discrete Fourier Transform, but we neglect to mention the fact. Introduction to Orthogonal Transforms. Developed by Jean Baptiste Joseph Fourier in the early 19th century, the Fourier equations were invented to transform one complex function into another. Nevertheless, it is still a Gaussian profile and it occupies the
{ "domain": "programex.pl", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9902915232319999, "lm_q1q2_score": 0.8252342807886346, "lm_q2_score": 0.8333245932423309, "openwebmath_perplexity": 676.1897974223843, "openwebmath_score": 0.7972910404205322, "tags": null, "url": "http://jrat.programex.pl/discrete-fourier-transform-of-gaussian.html" }
c++, c++17 Title: Configuration Manager The idea here is to implement a configuration system using INI files for a pathfinding library nammed Kraken. This library is in java and I am helping implementing it in C++. The goal is to make it cross platform and to specificaly aim embedded systems. For now the INI parser uses inih for simplicity, but should be able to run without file system in the end (with an INI parser that can parse an INI formated string without loading it from a file). We also want to avoid using streams in the release build. The parameters are stored in modules. Each module can have its parameters changed at runtime to adapt the pathfinding to the situation. This is done by changing the INI section for the desired module. For each module, the user can register function pointers that are called when its section changes.
{ "domain": "codereview.stackexchange", "id": 30890, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, c++17", "url": null }
terminology, logic, regular-expressions, mathematical-programming The languages these programs define which usually contains some form of the Kleene Star and Kleene Plus, along with several other more complicated but useful constructions, which are generally absent from formal regular language literature to my knowledge. Backreferences would be one example of this. These programs are invented, as are their particular sets of notations. They are also instances of computer engineering rather than computing science per se. Although of course they are building on at least a certain amount of computing science results, and computing science results can be stated about these programs. For example, it is possible to construct regular expressions of this sort that produce exponential running times, and subsets of those notations can be defined where that is impossible.
{ "domain": "cs.stackexchange", "id": 14967, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "terminology, logic, regular-expressions, mathematical-programming", "url": null }
special-relativity, reference-frames, time-dilation, observers And, of course, the two twins are again both aging at a normal rate in the rocket frame, but the earth twin is twenty years older while the traveling twin is only a double helping of a few hours older. Would that be accurate? Edit: Willo's answer pointed out an obvious mistake I made, which was to forget that whenever the rocket gets a new velocity (or do I mean a new acceleration --I am confused now) the frame of reference attached to it strictly speaking becomes a new frame of reference. So the question should have asked about the frames of reference of the rocket, I guess. I'm adding this because I don't want every answer to repeat what Willo has pointed out.
{ "domain": "physics.stackexchange", "id": 89523, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "special-relativity, reference-frames, time-dilation, observers", "url": null }
29. Many flows which involve rotation or radial motion are best described in Cylindrical Polar Coordinates. S y J t x x y w w w w w UI (1) where the convection. 12) indicates that any solution to the Laplace equation is a possible potential flow. Cylindrical/Polar Coordinates, the Heat and Laplace's Equations. Bessel functions are therefore especially important for many problems of wave propagation and static potentials. These equations arise from applying Newton's second law to fluid motion, together with the assumption that the fluid stress is the sum of a diffusing viscous term (proportional to the gradient of velocity), plus a pressure term. 1 Diffusion Consider a liquid in which a dye is being diffused through the liquid. In ANSYS Mechanical, coordinate systems reside in the Model Tree between Geometry and Connections. The heat transfer can also be written in integral form as Q˙ = − Z A q′′ ·ndA+ Z V q′′′ dV (1. In order for this to be realized, a polar representation of the
{ "domain": "clodd.it", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.990874360724436, "lm_q1q2_score": 0.8382226737020003, "lm_q2_score": 0.845942439250491, "openwebmath_perplexity": 860.6210905666301, "openwebmath_score": 0.8832836747169495, "tags": null, "url": "http://rlle.clodd.it/2d-heat-equation-in-polar-coordinates.html" }
discrete-signals, sampling, optimization, convex-optimization, norm Title: Is Sum of Absolute Value / $ {L}_{1} $ Norm of Differences Convex? I'm not sure how to approach this exercise. One idea is to derive it w.r.t z, show that there is a min-extremum at $z=f_k$ and then show that for each value from the right and the left of the loss function it is positive which will prove that it is convex. I never worked with Dirichlet functions, I'm not sure how should I show that it is convex analytically. Can somebody give me a clue/solution path ? It is easier to prove it by using atoms. The 1st atom is the Absolute Value function $ \left| \cdot \right| $ which is convex. Then you have linear operation by the subtraction which is convex (Also concave). Then you linear combination which is also Convex. Hence the function is Convex.
{ "domain": "dsp.stackexchange", "id": 9567, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "discrete-signals, sampling, optimization, convex-optimization, norm", "url": null }
ros, embedded, tutorial Title: Teensy tutorial not working Hi! I'm having problems with the Teensy tutorial. I've already worked through the linux tutorial with no problems. Everything builds and loads properly, but when I start the ros2 serial agent, it appears to connect to the teensy and then crash out with no error messages. When this happens the teensy jumps into the error_loop and will just blink away forever. I'm running Arduino 1.8.13, Teensyduino 1.53 and using a Teensy 4.1 board. I've used both the v2.0.2-foxy micro_ros_arduino release as well as v1.0.0 with the same results. I've also tried it with Arduino 1.8.15 and get the same results. Here's the output from the micro ros agent terminal:
{ "domain": "robotics.stackexchange", "id": 37142, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros, embedded, tutorial", "url": null }
quantum-mechanics, quantum-field-theory, condensed-matter, quantum-information, wick-theorem Title: If $|\psi\rangle$ is a free fermionic state, why does its reduced density matrix $\text{Tr}_C(|\psi\rangle \langle \psi|)$ also obey Wick's theorem? I have recently been trying to understand this paper. So far I understand why, given a free fermionic state $|\psi\rangle$, it is fully characterised by its 2-point correlation matrix (i.e. obeys Wicks’s theorem). I also understand why if its reduced density matrix $\rho = \text{Tr}_C(|\psi\rangle\langle \psi|)$ obeys Wick’s theorem, that is $C_{ij} = \text{Tr}(\rho c^{\dagger}_ic_j)$ fully characterises $\rho$, then $\rho$ must be gaussian (or the exponential of a free fermionic Hamiltonian, i.e. $\rho \sim \exp(-\sum_{ij}h_{ij}c^{\dagger}_ic_j)$ ). But why does $\rho$ in the first place need to obey Wick’s theorem?
{ "domain": "physics.stackexchange", "id": 78178, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, quantum-field-theory, condensed-matter, quantum-information, wick-theorem", "url": null }
A. $4 B.$4.5 C. $5 D.$5.5 E. $6 I'm confused how to set up the formulas here. Can any experts help? You could also back-solve. Typically, you want to test B, C, or D first, and then adjust accordingly. Because C is the only integer of the bunch, it would make sense to start there. If the price/pound =$5, then $12 would buy 12/5 = 2.4 pounds of apples. If the price/pound increased by$1, it would be $6. Now$12 would buy 12/6 = 2 pounds of apples. Thus the weight of apples you could purchase would have decreased by 2.4 - 2 = .4 pounds. That's what we want! C is the answer. And as a public service announcement, if you are in a grocery store that's charging $5/pound for apples, you should leave this store at once. Veritas Prep | GMAT Instructor Veritas Prep Reviews Save$100 off any live Veritas Prep GMAT Course
{ "domain": "beatthegmat.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9780517514031506, "lm_q1q2_score": 0.806366439494739, "lm_q2_score": 0.8244619350028204, "openwebmath_perplexity": 3329.7701389651875, "openwebmath_score": 0.2320665419101715, "tags": null, "url": "https://www.beatthegmat.com/a-grocery-store-sells-apples-by-the-pound-if-the-price-per-t301238.html?sid=dc3e57777ca3693119addf19e64528fe" }
ruby, programming-challenge, io, comparative-review, time-limit-exceeded I've update the rest of the code blocks to use flat_map That 3rd line is a bit long, though, so to spell it out: File.open(ARGV.first).each_line do |line| *items, k = line.chomp.split(/[,;]/) next unless k chunks = items.each_slice(k.to_i) reversed = chunks.flat_map { |chunk| chunk.count < k.to_i ? chunk : chunk.reverse } puts reversed.join(",") end You can also do pop off the last chunk if you know it to be smaller than k, which lets you say simply map(&:reverse) on the remaining elements File.open(ARGV.first).each_line do |line| *items, k = line.chomp.split(/[,;]/) next unless k k = k.to_i chunks = items.each_slice(k).to_a tail = items.count % k == 0 ? [] : chunks.pop puts chunks.flat_map(&:reverse).concat(tail).join(",") end
{ "domain": "codereview.stackexchange", "id": 10275, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ruby, programming-challenge, io, comparative-review, time-limit-exceeded", "url": null }
Now let ${\displaystyle Q^{2}={\frac {ac}{b^{2}}}.}$ Then {\displaystyle {\begin{aligned}x&=\left(-{\frac {b}{2a}}\right)\left(1\pm {\sqrt {1-4Q^{2}}}\right)\end{aligned}}} ### A More Numerically Stable Formulation of the Negative Root Considering just the negative square root we have {\displaystyle {\begin{aligned}x_{1}&=\left(-{\frac {b}{2a}}\right)\left(1-{\sqrt {1-4Q^{2}}}\right).\end{aligned}}} Multiplying the numerator and denominator by ${\displaystyle 1+{\sqrt {1-4Q^{2}}}}$  gives
{ "domain": "wikibooks.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9935117292506779, "lm_q1q2_score": 0.8321852602397435, "lm_q2_score": 0.8376199653600372, "openwebmath_perplexity": 9761.418972586353, "openwebmath_score": 0.9644558429718018, "tags": null, "url": "https://en.m.wikibooks.org/wiki/Circuit_Theory/Quadratic_Equation_Revisited" }
geology, geophysics, earthquakes, seismology Having said that, there are some situations (based on the type of earthquake and local geology) in which waves can interfere constructively to cause significant shaking even at large depths, but this only happens in certain areas and not everywhere. In many ways elastic wave propagation is similar to acoustic or water waves. Imagine a small explosive source in a lake/pond, let's say 50 m underwater. After the explosion there will be more 'shaking' on the surface, but not much underwater unless you're extremely close to the explosive source.
{ "domain": "earthscience.stackexchange", "id": 523, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "geology, geophysics, earthquakes, seismology", "url": null }
scala while (continue && x.hasNext) { val g = x.next() if (g == b) { mask += "1"*b.length + "0"*x.length continue = false } else mask += "0" } if (continue) mask += "0" mask } The "never occurs" bug is still there. It stems from the fact that the length of b has an inverse relationship to the length of x. Try varying the length of a non-occurring b and see what you get. There's also the fact that this is a rather imperative approach, whereas good Scala style tries to be more functional. When I first saw this I thought, "Doesn't indexOfSlice() offer most of what's needed?" def binmask(seq :Seq[String], slice :Seq[String]) :String = { val ios = seq indexOfSlice slice if (ios < 0) "0"*seq.length else { val slcLen = slice.length "0"*ios + "1"*slcLen + "0"*(seq.length-slcLen-ios) } }
{ "domain": "codereview.stackexchange", "id": 33613, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "scala", "url": null }
homework-and-exercises, magnetic-fields, electric-fields, maxwell-equations, electromagnetic-induction 2)in example 13.5.2 here, and my book, we've used the radius given[inside solenoid] to get the path of integration and to calculate the flux- That is we are using a single value of the distance from the solenoid's axis to get both the flux through the region enclosed by the loop as well as the path of integration around this said loop; we didn't even use the radius of the solenoid to get the flux through the entire region of the field as is the case with my book in the previous problem. These $2$ problems seemed contradictory to me and would appreciate some input to help clear these two cases. You should use smaller radius if that's how large the field extends. It is the integral of B.ds over the surface. So if B is zero outside a circle then it won't contribute to magnetic flux.
{ "domain": "physics.stackexchange", "id": 74628, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "homework-and-exercises, magnetic-fields, electric-fields, maxwell-equations, electromagnetic-induction", "url": null }
php, pdo Its working fine, but I'm not sure if this is a good way to implement it.. Thank you! Yes, it should work but it's not a good way to implement it. Confusion Why did you create all these methods in the first place? Why don't you use $this->pdo->beginTransaction() right away? What is the reason? Separation of concerns and Code reuse But even if you want to create such methods, it just unnatural to have them in the TestClass. Given there will be TestClass2, you're going to write all these methods again, seriously? Naturally, all those should go into the Database class. Besides, Your TestClass should only contain the code related to Test. While all this transaction business is related to the database. Database connection
{ "domain": "codereview.stackexchange", "id": 43859, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "php, pdo", "url": null }
python doesn't need the + and can use implicit concatenation. find_letter should raise instead of print. Printing can be done at the outer level. Typo: lettter -> letter [i for i in dni.missing_digits] can just be list(dni.missing_digits). _check_valid would be more natural as a @property is_valid on Dni itself. This test: for dni, expected_result in zip(dnis_generator, expected_results): hides a failure mode where there is a length mismatch. Using zip_longest will fix this. Congruential acceleration Recognize that a problem such as finding all numbers for 052407??Q
{ "domain": "codereview.stackexchange", "id": 41970, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python", "url": null }
special-relativity, group-theory Title: Detail on seeing the double cover of $SO^{+}(1, 3)$ as $SL(2, \mathbb{C})$ We can identify Minkowski space-time $M^4$, of metric signature $(1, -1, -1, -1)$, with the (real) space of $2 \times 2$ (complex) Hermitian matrices under the map $(v_0, v_1, v_2, v_3) \mapsto v_0 I + v_1 \sigma_x + v_2 \sigma_y + v_3 \sigma_z$ where $\sigma$'s are Pauli matrices. Given a Hermitian matrix $X$ and some $A \in SL(2, \mathbb{C})$, the matrix $A X A^{\dagger}$ is again Hermitian, and $\det(AXA^{\dagger}) = \det(X)$, so (Hermitian) conjugation by $A$ is a linear transformation of Minkowski space-time which preserves the metric and is thus a Lorentz transformation. It is orthochronous because $AIA^{\dagger} = AA^{\dagger}$ is a positive operator, and thus $\text{tr}(AA^{\dagger}I) = \text{tr}(AA^{\dagger})$ (which, up to a factor of $1/2$, is the $I$-coefficient of $AA^{\dagger}$ in the $I, \sigma$ basis) is positive.
{ "domain": "physics.stackexchange", "id": 72152, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "special-relativity, group-theory", "url": null }
javascript, search the rectangles are static [the rectangles] should never overlap As such we can build a simple tree. Before looking at 2d points we can look at a solution for 1d points. Say we have the following line segments. Beginnings are inclusive ends are not. A: 0 - 2 B: 2 - 3 C: 3 - 4 D: 4 - 8 We could describe the values as a really simple binary tree. With the example I gave we can reduce the amount of leaf nodes to just 4. We do need to assign multiple leaves to the same node at times. For example if we had the following line segments: A: 0 - 3 B: 3 - 8 An algorithm for the above As such we can just use a simple binary tree. With two major changes: We need to make the intermediary nodes when building the leaves. We may need to add multiple leaf nodes to account for the end of the rect. As such we can build a simple algorithm:
{ "domain": "codereview.stackexchange", "id": 40868, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, search", "url": null }
c++, performance, strings, array, vectors const std::string squareIJ[5][5] = { {"A", "B", "C", "D", "E"}, {"F", "G", "H", "I", "K"}, {"L", "M", "N", "O", "P"}, {"Q", "R", "S", "T", "U"}, {"V", "W", "X", "Y", "Z"}, }; for(int i = 0; i < coords.size(); ++i){ std::string coord = coords[i]; output.append(squareIJ[coord[0] - '1'][coord[1] - '1']); } std::cout << output; } std::cout << '\n'; return 0; } std::string getChoice(){ std::string choice; do{ std::cout << "Encrypt or decrypt [e/d] = "; std::getline(std::cin, choice); if(choice == "E") choice = "e"; std::transform(choice.begin(), choice.end(), choice.begin(), ::tolower); } while(choice != "e" && choice != "d"); return choice; }
{ "domain": "codereview.stackexchange", "id": 23981, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, performance, strings, array, vectors", "url": null }
The other method is to just go ahead and multiply both sides of the equation by (x-1)(x+3): $$\frac{1}{x- 1}(x-1)(x+3)+ \frac{3}{x+3}(x-1)(x+3)= 1(x-1)(x+3)$$ $$x+ 3+ 3(x-1)= (x-1)(x+ 3)$$ $$4x = (x-1)(x+3)$$ as before. Most people prefer the second method. As for the inverse function to $$y= \frac{1}{3x-2}$$ First swap x and y: $$x= \frac{1}{3y- 2}$$ That's what really changes from the function to its inverse. But because we prefer to write a function y= ..., no we need to solve for x. Multiply both sides by 3y- 2 to get rid of the fraction: $$x(3y- 2)= 1$$ Divide on both sides by x: $$3y- 2= \frac{1}{x}$$ $$3y= 2+ \frac{1}{x}$$ and finally divide both sides by 3: $$y= \frac{2+ \frac{1}{x}}{3}$$ which we can simplify by multiplying both numerator and denominator of the fraction by x (that's the same as multiplying by x/x= 1 so nothing new is done- we don't need to do that to the left side). $$y= \frac{2x+ 1}{3x}$$ just as you said.
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9814534322330057, "lm_q1q2_score": 0.830253114285874, "lm_q2_score": 0.8459424431344437, "openwebmath_perplexity": 306.42529451585216, "openwebmath_score": 0.8522008061408997, "tags": null, "url": "https://www.physicsforums.com/threads/easy-fraction-problem-forgot-how-to-do-it.152475/" }
proteins, xray-crystallography, phosphorylation, mass-spectrometry, phosphate Title: Techniques for detecting phosphorylation sites in proteins? I would like to know how phosphorylated sites in proteins are detected in practice. I read some papers where the authors were talking about mass spectrometry techniques. But my question is that why can't X-ray crystallography or NMR techniques capture phosphorylated sites? (Note : My background is electronics engineering, so I am not an expert in this area.) In principle X-ray crystallography or NMR could detect phosphorylation sites but they are much more complex and expensive techniques than mass spec. So for simply figuring out phosphorylation patterns in a protein is much easier using mass spec. Detailed reasons:
{ "domain": "biology.stackexchange", "id": 5704, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "proteins, xray-crystallography, phosphorylation, mass-spectrometry, phosphate", "url": null }
javascript, angular.js Title: Property management I was looking to see if anyone could help me come up with a cleaner/DRY methods in duplicate of doing something like this? I would like to get the features that repeats in the 2 controllers to generalize my code. var propertiesModule = angular.module('app.properties', []); propertiesModule.controller('PropertiesCtrl', ['$scope', '$routeParams', 'PropertiesService', 'ApplicationService', 'PlatformService', 'Page', function ($scope, $routeParams, PropertiesService, ApplicationService, PlatformService, Page) { Page.setTitle("Properties"); $scope.platform = $routeParams.platform; $scope.platforms = []; $scope.on_edit_platform = function (platform_name) { /* Reset unit choice */ $scope.unit = undefined; }; $scope.add_platform = function (platform_name) { if (!_.contains($scope.platforms, platform_name)) { $scope.platforms.push(platform_name); } };
{ "domain": "codereview.stackexchange", "id": 10584, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, angular.js", "url": null }
ros-melodic I now want/need individual user accounts rather than one user per machine. What is the easiest way to install the ROS packages system wide on the machine? My thoughts are: As many accounts as necessary per ROS machine (including 1 account for me) SSH on my account on the machine to pull the code and compile when needed Install with a CMAKE_INSTALL_PREFIX like /opt/ros/InstitutMaupertuis/ Modify my ros_desktop_launcher_test examples so that desktop application files are installed in /usr/local/share/applications when the CMAKE_INSTALL_PREFIX does not start with /home/. Is there a simpler way? If not, how do I run catkin_make install with high privileges so that I can install my files anywhere in the system? Originally posted by VictorLamoine on ROS Answers with karma: 1505 on 2018-06-27 Post score: 0
{ "domain": "robotics.stackexchange", "id": 31100, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros-melodic", "url": null }
python, beginner, json, error-handling, http def update(url, json_): """ This will make a PUT api call to update with new json config. """ try: r = requests.put(url, data=json_, headers={'Content-type': 'application/json'}) r.raise_for_status() return True except requests.exceptions.HTTPError as http_error: print(f"Http Error: {http_error}") except requests.exceptions.ConnectionError as connection_error: print(f"Error Connecting: {connection_error}") except requests.exceptions.Timeout as timeout_error: print(f"Timeout Error: {timeout_error}") except requests.exceptions.RequestException as request_error: print(f"Ops: Something Else: {request_error}") return False
{ "domain": "codereview.stackexchange", "id": 40062, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, beginner, json, error-handling, http", "url": null }
namely a tree (see figure below). We need to find the roots of the quadratic polynomial. The examples given in the previous lesson were all given in Standard Form. Elliptic curve. Quadratic Forms in Infinite Dimensional Vector Spaces. At quadratic we are passionate about making Business Intelligence easy. Support Form. On this page you can read or download quadratic equations in vertex form worksheet gina wilson 2012 answer key in PDF format. Linear & Quadratic Inequalities. Student Activity Sheet Day 1_ Quadratic Functions for Projectile Motion. Completely free. 5759v3 [math. Symplectic bases for alternating bilinear forms are discussed in Section5. Find two numbers whose product equals c and whose sum equals b. To see a parabola in the real world, throw a ball. 1A, Quadratic functions MATH 1410, (SOLUTIONS) 1. O'Meara, O. In both of the above formulas, the value of adetermines if the graph opens upward (a>0) or opens. 7a This is a (1) page PDF worksheet requires a student to convert
{ "domain": "movieartstudio.pl", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9898303413461358, "lm_q1q2_score": 0.8373394857135875, "lm_q2_score": 0.8459424314825853, "openwebmath_perplexity": 772.4601184543953, "openwebmath_score": 0.5368044376373291, "tags": null, "url": "http://miy.movieartstudio.pl/" }
ros, openni2 Title: Asus Xtion live pro on USB 3.0 - ROS-kinetic - Ubuntu 16.04 I tried to use roslaunch openni2_launch openni2.launch to connect my asus xtion pro live. But i have errors : Warning: USB events thread - failed to set priority. This might cause loss of data. What may cause this problem? I use ROS kinetic, Ubuntu16.04, my asus xtion live pro supports openni2 not openni. It seems the answers here are mostly about previous versions of softwares. Anyone encounter such problems in latest versions? Originally posted by fredli on ROS Answers with karma: 11 on 2016-12-07 Post score: 0 This is only a warning. Your Xtion should still work. OpenNI tries to set the USB async thread priority to critical. This works on Linux only with root privileges. For a normal user, the program will throw this warning. To get rid of this warning, run the program as root. source Originally posted by fivef with karma: 2756 on 2016-12-07 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 26415, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros, openni2", "url": null }
star, orbit, planet, sagittarius-a Assuming a bond albedo of 0.1 for our hypothesized rocky planet and a luminosity of $50000 L_\odot$ for S2, we have $T^4=1.08586\cdot10^{15} K^4$. Taking this to the fourth root gives 5740 Kelvin. This is way too hot - almost as hot as the Sun, which is enough to boil away the crust, mantle, and whatever is left of the planet. Therefore, while orbits could be stable, no planet could exist due to the tiny orbital radius, extreme temperatures, and unsuitable formation conditions.
{ "domain": "astronomy.stackexchange", "id": 6042, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "star, orbit, planet, sagittarius-a", "url": null }
haskell Title: Two Sum Implementation on Haskell Brute Force and Optimized approach Two Sum Problem: Given an array of integers A and an integer K return True if there are two elements two elements xi, xj (i != j) such that xi + xj = K. Return False otherwise. I am implementing the classical two sum problem but I am currently practising Functional programming so I picked Haskell. I wrote a naive implementation which I expect is O(n²) (not sure though). In the brute force implementation I just try every pair of numbers until I find the ones that meet the criteria; -- O(n^2) implementation twoSum :: [Int] -> Int -> Bool twoSum [] k = False twoSum (x:[]) k = False twoSum (x:y:[]) k = k == x + y twoSum (x:y:xs) k | k == x + y = True | otherwise = twoSum (x:xs) k || twoSum (y:xs) k
{ "domain": "codereview.stackexchange", "id": 44313, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "haskell", "url": null }
Define (possible) generators $x := (1,\iota)$ and $y := (0, \psi)$ of $G$. • $x^2 = (1,\iota)\star (1,\iota) = (1 + \iota(1),\iota\circ\iota) = (1 + 1,\iota\circ\iota) = (2,\iota)$ • $x^3 = (1+2,\iota) = (3,\iota)$ • $x^4 = (4,\iota)$ • $x^5 = (0,\iota)$ • $y^2 = (0, \psi) \star (0, \psi) = (0 + \psi(0), \psi\circ\psi) = (0+0,\psi^2) = (0,\psi^2)$ • $y^3 = (0, \psi^3)$ • $y^4 = (0, \psi^4) = (0,\iota)$ • $y\star x \star y^{-1} = (0, \psi)\star (1,\iota) \star (0, \psi^3) = (0+\psi(1),\psi) \star (0, \psi^3) = (3,\psi) \star (0, \psi^3) = (3+\psi(0),\psi^4) = (3,\iota)= x^3$ So, everything works out except for $y\star x \star y^{-1} =x^3$ instead of $y\star x \star y^{-1} = x^2$ as in the presentation given above. Questions:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9724147201714923, "lm_q1q2_score": 0.8284514510082119, "lm_q2_score": 0.8519528076067262, "openwebmath_perplexity": 280.0941552211789, "openwebmath_score": 0.8531189560890198, "tags": null, "url": "https://math.stackexchange.com/questions/2800873/presentation-of-the-holomorph-of-mathbb-z-5-mathbb-z" }
java, console, compression static final class IntHolder { int value; } private static final class HuffmanTreeNode implements Comparable<HuffmanTreeNode> { byte character; int frequency; boolean isLeaf; HuffmanTreeNode left; HuffmanTreeNode right; HuffmanTreeNode(byte character, int frequency, boolean isLeaf) { this.frequency = checkFrequency(frequency); this.isLeaf = isLeaf; if (isLeaf) { this.character = character; } } @Override public int compareTo(HuffmanTreeNode o) { int cmp = Integer.compare(frequency, o.frequency); if (cmp != 0) { return cmp; } // If reached here, equal weights so order by the character value: return Byte.compare(character, o.character); }
{ "domain": "codereview.stackexchange", "id": 23126, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, console, compression", "url": null }
\begin{align} N_{moves} & = 4 \times 2 \\ & + 4 \times (n-2) \times 3 \\ & + (n-2)² \times 4 \\ & = 4 \times n \times (n-1) \end{align} \begin{align} Branching & = \frac{4 \times n \times (n-1)}{n²} \\ \end{align} In theory, we can also remove the previous move and this lead to : \begin{align} Branching_{without\_repeat} & = \frac{4 \times n \times (n-1)}{n²} - 1 \\ \end{align} We can plot the branching factor with the size of the board In [3]: x = list(range(3, 100)) t = [4*i*(i-1)/(i*i) for i in x] plt.figure(figsize=(20,12)) plt.plot(x, t) plt.title("Evolution of branching factor", fontsize=20) plt.xlabel("Board size", fontsize=15) plt.ylabel("Branching", fontsize=15) plt.show() So the branching factor for the smallest board (3x3) is 8/3, for a 4x4 it's 3 and it rise up to 4 as for a big board, all position nearly have always 4 moves. Now with the branching factor, we can compute the number of State we can have at a specific depth (for example level 10 for a 4x4 board).
{ "domain": "nicolasmine.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9848109516378093, "lm_q1q2_score": 0.809700866491707, "lm_q2_score": 0.8221891370573388, "openwebmath_perplexity": 3511.6761000742936, "openwebmath_score": 0.7781261205673218, "tags": null, "url": "http://nicolasmine.com/scripts/solution/Taquin.html" }
data-cleaning, preprocessing, categorical-data Title: how to handle values that only appear once in a column? Counting the values of a column using pandas I got the following result: Human 195 Mutant 62 God / Eternal 14 Cyborg 11 Human / Radiation 11 Android 9 Symbiote 8 Kryptonian 7 Alien 7 Demon 6 Atlantean 5 Alpha 5 Asgardian 5 Cosmic Entity 4 Inhuman 4 Human / Altered 3 New God 3 Animal 3 Saiyan 2 Eternal 2 Frost Giant 2 Human-Kree 2 Demi-God 2 Human / Cosmic 2 Vampire 2 Metahuman 2 Amazon 2 Icthyo Sapien 1 Czarnian 1 Rodian 1 Martian 1 Clone 1 Zombie 1
{ "domain": "datascience.stackexchange", "id": 5899, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "data-cleaning, preprocessing, categorical-data", "url": null }
thermodynamics, black-holes, temperature, definition, hawking-radiation Title: What is a lukewarm black hole? What is a lukewarm black hole? They supposedly have something to do with hawking radiation. I would like an explanation of their properties. In black hole physics the term “lukewarm black hole” refers to asymptotically de Sitter black hole solutions that have equal temperatures of the black hole and cosmological horizons ($T_b = T_c$) (generally, the temperatures are different). For example, for solutions from Reissner–Nordström–de Sitter family the black hole would be lukewarm when its mass and charge have the same absolute value, $|Q|=M$ (in geometric units). These solutions are generalization of extreme (asymptotically flat) Reissner–Nordström solution to a positive cosmological constant. See e.g. Romans, 1991 or Cai et al., 1997 for details. One can also find lukewarm solutions in other black hole families (such as Kerr–de Sitter).
{ "domain": "physics.stackexchange", "id": 68215, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics, black-holes, temperature, definition, hawking-radiation", "url": null }
c#, design-patterns ... } //---------------------------------------------- // Encapsulates all functions related to process // messaging. //---------------------------------------------- public class MessagingService : IOrderServiceProvider { private Order m_order = null; public bool OrderSave(ref Order order){ m_order = order; return this.SendOrderConfirmationEmail(); } ... } Now, you have an Order class that is a Model and also consumes IOrderServiceProvider classes that do order-specific functions. Encapsulation, Inheritance, Polymorphism ... that's all I'm sayin' here.
{ "domain": "codereview.stackexchange", "id": 5373, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, design-patterns", "url": null }
semantics, formal-methods Lectures on Semantics: The initial algebra and final coalgebra perspectives A Tutorial on (Co)Algebras and (Co)Induction
{ "domain": "cs.stackexchange", "id": 917, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "semantics, formal-methods", "url": null }
information-theory, coding-theory, huffman-coding Suppose it has length strictly less than $n-1$. Then there is some node $u \neq v$ on the path such that the subtree rooted at its left child has at least two vertices. If we were to swap that subtree with one of the children of $v$, the total sum of depths of the leaves would strictly increases (why?). This means that the tree we started with didn't maximize this sum. Now, we have a binary tree consisting of a path of internal nodes of length $n-1$ and one leaf hanging of of every internal node, except for the lowest internal node on the path which has two leaf children. Can you show that in such a tree the sum of depths of the leaves is exactly $n(n-1)/2 + (n-1)$?
{ "domain": "cs.stackexchange", "id": 19635, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "information-theory, coding-theory, huffman-coding", "url": null }
observational-astronomy Title: Draw the celestial sphere for latitude, showing the star Sirius, Estimate the approximate date when Sirius rises with the Sun I'm having trouble understanding how to solve a certain problem. The problem is from the book Astronomy: Principles and Practice by Roy and Clarke. It is actually a solved example, but I am unable to understand parts of the solution. Draw the celestial sphere for latitude 30° N, showing the star Sirius (right ascension 6h 40m, declination 17° S) at rising and draw the ecliptic. Estimate from your diagram the approximate date when Sirius rises with the Sun. This is the image from the solution. I'll copy the entire solution.
{ "domain": "astronomy.stackexchange", "id": 3775, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "observational-astronomy", "url": null }