text
stringlengths
1
1.11k
source
dict
programming-challenge, go In below version, a type Triangle is defined as []float64, methods are attached to it, and sort.Sort* functions are replaced with specialized functions exposed by the package https://github.com/AlasdairF/Sort to reach 0 allocations. main.go // package triangle contains methods for determining if a triangle is equilateral, isosceles, or scalene package triangle import ( "math" "github.com/AlasdairF/Sort/Float64" ) type Triangle []float64 // Kind of triangle type Kind int // Triangle kinds const ( NaT = iota // not a triangle Equ // equilateral Iso // isosceles Sca // scalene ) func (sides Triangle) Kind() (k Kind) { a := sides[0] b := sides[1] c := sides[2] if sides.IsValid() { k = Sca if a == b && a == c { k = Equ } else if a == b || a == c || b == c { k = Iso } } return k }
{ "domain": "codereview.stackexchange", "id": 36811, "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": "programming-challenge, go", "url": null }
python, performance, programming-challenge #print to_be_added for i in to_be_added: self.index[i[0]] = i[1] to_be_added = set() ind += 1 print self.index[self.details[1]] def main(): t = Thieves((5, 5), [[3, 5], [7, 100], [1, 1], [1, 1], [2, 3]]) t.valuable() z = Thieves((12, 5), [[3, 5], [7, 100], [1, 1], [1, 1], [2, 3], [3, 10], [2, 11], [1, 4], [1, 7], [5, 20], [1, 10], [2, 15]]) z.valuable()
{ "domain": "codereview.stackexchange", "id": 15013, "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, performance, programming-challenge", "url": null }
quantum-mechanics, computational-physics, conformal-field-theory, software, optimization Title: Difficulty solving conformal-bootstrap-like crossing equations using semidefinite-programming (SDP) via SDPB software My question involves semidefinite programming (SDP) in the sense of attempting to find some vector $\alpha^{\mu}$ that satisfies the following conditions: Normalisation: $\alpha^{\mu}n_{\mu} = 1$ Constraint 1: $\alpha^{\mu}f_{\mu}(x) \geq 0$ Constrain 2: $\alpha^{\mu}g_{\mu}(x) \geq 0$
{ "domain": "physics.stackexchange", "id": 94223, "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, computational-physics, conformal-field-theory, software, optimization", "url": null }
transform Originally posted by tfoote with karma: 58457 on 2015-07-19 This answer was ACCEPTED on the original site Post score: 2 Original comments Comment by redskydeng on 2015-07-20: Thanks,tfoote. I have solved this problem by adding "target_link_libraries(OdomOFPS1_R32 tf)" in the "CMakeLists.txt" file. It seems like that the compiler linked the libtf.so shared object file in the lib directory. Comment by Boris on 2015-07-20: Isn't it enough to add dependency to tf package in manifest.xml? As I understand rosbuild_init() in CMakeLists.txt will take care of these dependencies, when rosbuild_add_executable() is used. Comment by redskydeng on 2015-07-21: Hi,Boris, Should I add into the manifest.xml? I will try,thank you very much! Comment by Boris on 2015-07-24: I made a package from scratch and it did work with just a dependency, so it should be enough. Anyway, I guess you have tried it already :) Comment by redskydeng on 2015-07-25: Boris, YES,It works.Thanks a lot!:D
{ "domain": "robotics.stackexchange", "id": 22227, "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": "transform", "url": null }
machine-learning, python, decision-trees, xgboost, explainable-ai You can find this here: cover definition in the code This basically mean that for each split the second order gradient of the specified loss is computed (per sample). Then this number is scaled by the number of samples.
{ "domain": "datascience.stackexchange", "id": 7017, "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, python, decision-trees, xgboost, explainable-ai", "url": null }
java, performance, datetime, validation Examples of valid timestamps: 1.467983982E9 1.468119771E9 1467858808E9 1.468119771E11 1468119771E11 Examples of invalid timestamps: 1.46A802215E9 null 4.1B46A802215E9 There's no point in calling toBigInteger since that doesn't throw anything. You might as well just have this: try { new BigDecimal(data); } catch(NumberFormatException n) { return false; } return true; Or you might consider using toBigIntegerExact if you don't allow fractional parts in the number (e.g. 1.2345E3 which is 1234.5 is not allowed): try { new BigDecimal(data).toBigIntegerExact(); } catch(NumberFormatException | ArithmeticException e) { return false; } return true;
{ "domain": "codereview.stackexchange", "id": 21550, "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, performance, datetime, validation", "url": null }
complexity-theory, quantum-computing, oracle-machines Title: Does there exist any unrelativized separation between a quantum complexity class and a classical one? I'm familiar with results of relativized separation for BPP-BQP, BQP-PH and NPC-BQP. I'm also aware that while e.g. Factoring is not believed to be in BPP, it hasn't been proven and so we're not quite near proving BQP!=BPP. My question is, do we have any certain, theoretical, unrelativized proof that quantum computers are "superior" to classical one on any specific problem - Where here, I define superior to include any sort of runtime complexity superiority, so e.g. a quadratic improvement would qualify in this regard.
{ "domain": "cs.stackexchange", "id": 14783, "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": "complexity-theory, quantum-computing, oracle-machines", "url": null }
geochemistry, geobiology In the EPA reference above, it is noted that the slightly lower pH today versus in the relatively past implies a larger increase in hydrogen ion concentration. But it's worse than that. Because of the way changing pH is coupled with changing dissociation of acids including phosphoric acid, a seemingly small change in pH could mean a lot more potentially acidic material (in the case of phosphate, $\text {H}_2\text{PO}_4^-$ versus $\text {HPO}_4^{2-}$) in the oceans.
{ "domain": "earthscience.stackexchange", "id": 2066, "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": "geochemistry, geobiology", "url": null }
ruby-on-rails, bash, linux UNICORN_CONFIG=$PROJ_DIR/current/config/unicorn/$PROJ_ENV.rb DEPLOY_USER=ec2-user [ -f $PID_FILE ] && KPID=`cat $PID_FILE` # Start the service start() { # [ is the 'test' command -f file? -a and -n variable -d directory if [ -f $PID_FILE -a -n "${KPID}" -a -d "/proc/${KPID}" ]; then logger -sit $TAG "Process ${KPID} in PID file $PID_FILE exists. Service '${PROJ_NAME}' should be running" exit 1 else logger -sit "$TAG" "Process doesn't exist. Trying to start server..." #su - $DEPLOY_USER -c "bash -c 'cd $PROJ_DIR/current ; pwd ; /opt/rbenv/bin/rbenv exec bundle exec unicorn -v'" su - $DEPLOY_USER -c "bash -c 'cd $PROJ_DIR/current ; pwd ; /opt/rbenv/bin/rbenv exec bundle exec unicorn -c $UNICORN_CONFIG -E $PROJ_ENV -D'" if [[ $? == 0 ]]; then logger -sit "$TAG" "server started" else logger -sit "$TAG" "FAILED to start server" exit 1 fi fi }
{ "domain": "codereview.stackexchange", "id": 28261, "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-on-rails, bash, linux", "url": null }
continuous-signals, frequency-modulation $$\phi_m(t) = \beta\int m(t)dt$$ Thus instantaneous frequency as the time derivative of phase is directly proportional to the message $m(t)$: $$ \frac{d\phi_m(t)}{dt} = \beta m(t)$$ Here's a corrected version demonstrating frequency modulation where we see that the frequency of the modulated signal is higher when the message amplitude is at its maximum and lower when the message amplitude is at its minimum, and more generally the instantaneous frequency is proportional to the message amplitude, as expected:
{ "domain": "dsp.stackexchange", "id": 12013, "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": "continuous-signals, frequency-modulation", "url": null }
algorithms, terminology, knapsack-problems, constraint-satisfaction Title: How to put elements in allowed bags? Let's say I have a list of "Items" I also have a list of "Bags". Each bag is a set of "Items" which gives what item can be placed in that bag. But only one item can go in each bag. I want to place all items in a bag. It's okay if there are empty bags left over. Does this sort of problem have a name and a solution other than a naive depth first search (a link in the direction of such an approach will be fine)? This problem is call "$X$-satuated bipartite matching" or Hall's marriage problem, which is discussed at here on Wikipedia. Consider each item as a woman. Each bag is a man. If item $a$ is allowed to be placed in bag $x$, it means woman $a$ and man $x$ can be married happily. Only one item can go in each bag corresponds to the assumption of monogamy, a man with one wife and a woman with one husband. So the problem is asking whether it is possible that all women can be married happily.
{ "domain": "cs.stackexchange", "id": 14105, "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, terminology, knapsack-problems, constraint-satisfaction", "url": null }
population-genetics Replacing $N$ by $N_e$ and solving for $N_e$ yields $$N_e = \frac{p(1-p)}{2 var(p')},$$ which is the definition of the effective population size $N_e$. Wright-Fisher model assumptions The WF does not per say assume a finite population size, it is just that when the population size is infinite, the model loses all of its appeal! Hardy-Weinberg model derivation See here for a more complete discussion The derivation of Hardy-Weinberg genotype frequencies is simple enough to not rely on any pre-existing model. Let's consider the simple version of the HW model, the one with a bi-allelic locus. The two alleles A and B exist at frequency $p$ and $1-p$ respectively. Imagine you have to draw an allele from this population. The probability to draw a given allele is equal to its frequency. Now draw a second allele. Assuming the population is large enough or assuming that selfing is allowed, the probability of drawing a given allele is still the same at the second draw than at the first draw.
{ "domain": "biology.stackexchange", "id": 5889, "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": "population-genetics", "url": null }
statistics, biomechanics If so, does that estimation model:
{ "domain": "engineering.stackexchange", "id": 14, "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": "statistics, biomechanics", "url": null }
c, linked-list, c11 typedef int (*cleanup_op_t)(dll_node_t* node); typedef struct dll { dll_node_t* head; dll_node_t* tail; cleanup_op_t cleanup_op; size_t size; } dll_t; /* Initializes a list with zero nodes. * `list' - The list to initialize * `cleanup_op' - The operation to apply to every datum when it is * removed from the list. This includes the destruction of * the list using `dll_destroy'. */ void dll_init(dll_t* list, cleanup_op_t cleanup_op);
{ "domain": "codereview.stackexchange", "id": 18372, "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, c11", "url": null }
machine-learning, python, supervised-learning, naive-bayes-classifier, naive-bayes-algorithim Title: How to improve results from a Naive Bayes algorithm? I am having some difficulties in improving results from running a Naive Bayes algorithm. My dataset consists of 39 columns (some categorical, some numerical). However I only considered the main variable, i.e. Text, which contains all the spam and ham messages. Since it is a spam filtering, I think that this field can be good. So I used countvectorizer and fit transform using them after removing stopwords. I am getting a 60% of accuracy which is very very low! What do you think may cause this low result? Is there anything that I can do to improve it? These are the columns out of 39 that I am considering: Index(['Date', 'Username', 'Subject', 'Target', 'Country', 'Website','Text', 'Capital', 'Punctuation'], dtype='object')
{ "domain": "datascience.stackexchange", "id": 8220, "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, python, supervised-learning, naive-bayes-classifier, naive-bayes-algorithim", "url": null }
Calculating a 20% discount by multiplying by 0.8333? I've been looking at some discounted prices of goods. They are listed with a $20\%$ discount, so to work this out I did: $$\25.45 \cdot 0.8333 = \21.21.$$ But their total was $20.34$, which I presume they got by doing $25.42 \cdot 0.8$. To apply a $20\%$ discount or to subtract $20\%$, which of the above is correct? • $25.42\times (1 - 20/100)$ Jun 2 '17 at 15:58 • why multiply by $5/6$? Jun 2 '17 at 16:00 • You tell us neither where the $25.45$ comes from, nor the $0.8333$. Jun 2 '17 at 17:39 • Care to check your figures. You quote 25.45 then 25.42. Can't both be accurate. – Tim Jun 3 '17 at 14:16 • Umm, seriously? This is a school-level problem... Jun 4 '17 at 9:47 A $20\%$ discount means that the price is $80\%$ of what it was originally, so you multiply by $1-0.2=0.8$.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.971992481016635, "lm_q1q2_score": 0.8182481936696988, "lm_q2_score": 0.8418256412990658, "openwebmath_perplexity": 820.0496456681817, "openwebmath_score": 0.792188286781311, "tags": null, "url": "https://math.stackexchange.com/questions/2307126/calculating-a-20-discount-by-multiplying-by-0-8333/2307133" }
microbiology, bacteriology, metabolism, microscopy, fluorescent-microscopy Title: Assay for Beta-galactosidase activity in single cell microscopy I'd like to be able to measure the activity of $\beta$-galactosidase in living cells with simple optical (maybe fluorescence) microscopy. Ideally I'd like to do a minimum of genetic engineering, and use this assay with strains I already have (that have a WT lactose system), i.e. a fluorescent lactose-mimic would be ideal. Additionally, it would be nice if the lifetime of the fluorescent byproduct of $\beta$-gal activity was short, so I could detect a decrease in $\beta$-gal activity as well as an increase. Does such a fluorescent analog exist? I'm hoping to look at the switch from lactose to glucose utilization under the microscope, so I want lactose-using cells to light up and glucose-using cells to be dark, or vice versa. It does not have to be fully quantitative--a qualitative sense is fine. Here is a link to on the Invitrogen/Life Technologies webpage detailing various probes to detect the activity of
{ "domain": "biology.stackexchange", "id": 1574, "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": "microbiology, bacteriology, metabolism, microscopy, fluorescent-microscopy", "url": null }
python, python-3.x, csv, tkinter csvwriter.writeheader() csvwriter.writerow(my_whole_info_dict) #main window root = Tk() #employee_gui object mainmenu_submit = employee_gui(root) #constant loop root.mainloop() Welcome to Code Review! Kudos to writing a fairly large program. Several things pop-out from your program. But, a few things first. If you are using any intelligent editor; please see if you can get a python linter (or a PEP-8 integration) in it. PEP-8 is the python's style guide, which makes the code consistent, and hence, readable/maintainable. I noticed that you are creating months, days and years list. Use the range function. It'll generate the whole list for you. You can later map the list to convert each value to string (if tkinter expects strings): self.yearoptions2 = map(str, range(2029, 1921, -1))
{ "domain": "codereview.stackexchange", "id": 28961, "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-3.x, csv, tkinter", "url": null }
matrices, ordinary differential equations, error, boundary condition, boundary value problem - Hide Description This book is the most comprehensive, up-to-date account of the popular numerical methods for solving boundary value problems in ordinary differential equations.
{ "domain": "janachladkova.cz", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9850429169195593, "lm_q1q2_score": 0.8007091915985288, "lm_q2_score": 0.8128673155708976, "openwebmath_perplexity": 579.8513475887443, "openwebmath_score": 0.6568361520767212, "tags": null, "url": "http://janachladkova.cz/towards-juristocracy-cttca/ou18z.php?5cfc29=numerical-solution-of-ordinary-differential-equations" }
electromagnetism, electric-fields, complex-numbers & =& E_x \sigma_1 + E_y \sigma_2+E_z\sigma_3 \pm \mathbb{i}\,c\,\left(B_x \sigma_1 + B_y \sigma_2+B_z\sigma_3\right)\end{array}\tag 5$$ The Pauli spin matrices are simply Hamilton's imaginary quaternion units reordered and where $\mathbb{i}=\sigma_1\,\sigma_2\,\sigma_3$ so that $\mathbb{i}^2 = -1$. When inertial reference frames are shifted by a proper Lorentz transformation: $$L = \exp\left(\frac{1}{2}W\right)\tag 6$$ where: $$W = \left(\eta^1 + i\,\theta\, \gamma^1\right) \sigma_1 + \left(\eta^2 + i\,\theta\, \gamma^2\right) \sigma_2 + \left(\eta^3 + i\,\theta \gamma ^3\right)\,\sigma_3\tag7$$ encodes the transformation's rotation angle $\theta$, the direction cosines of $\gamma^j$ of its rotation axes and its rapidities $\eta^j$, the entities $\mathbf{F}_\pm$ undergo the spinor map: $${\bf F} \mapsto L {\bf F} L^\dagger\tag 8$$
{ "domain": "physics.stackexchange", "id": 9742, "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, electric-fields, complex-numbers", "url": null }
java, xml, xpath return (tokenIndex == -1) ? null : vn.toString(tokenIndex); } In the method, I clone the VTDNav and create a new AutoPilot instance so I don't displace the cursor of those objects of my loop when selecting the new XPath. Furthermore, I have to check the path whether it contains an @, to see if it's an text node or an attribute (i.e. to use getText() or getAttrVal()). My profiler shows that my extractText() method takes the most time in my huge application, so there must be a better solution here. I've found a solution, which doesn't improve the performance, but is a lot shorter. I didn't know about the evalXPathToString() method. protected String extractText(VTDNav v, String path) throws Exception { AutoPilot ap = new AutoPilot(v); ap.selectXPath(path); return ap.evalXPathToString(); } Furthermore, the check in my old version whether the path contains a @ was buggy. It returned true for a path like /a[@b='c'] and executed getAttrVal() for it, which is wrong.
{ "domain": "codereview.stackexchange", "id": 12082, "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, xml, xpath", "url": null }
reagents Title: Why don't we use silver hydroxide instead of Tollen's reagent for test of aldehydes? AgNO3+NH4OH=AgOH+NH4NO3 AgOH is used for the reaction with aldehyde. But why can't we use silver hydroxide directly? Silver hydroxide does not exist. Hydroxides of alkalic metals form insoluble silver oxide: $$\ce{ 2 Ag+ + 2 OH- -> Ag2O + H2O}$$ Ammonia forms with silver ions the linear diammin complex, the nature of the Tollens reagent: $$\ce{ Ag+ + 2 NH3 -> [Ag(NH3)2]+}$$
{ "domain": "chemistry.stackexchange", "id": 12676, "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": "reagents", "url": null }
precipitation, snow, satellites After all, how we can efficiently calculate the snow cover and its temporal change in any language base platform from satellite data? Identification of snow in satellite images is done using multiwavelength measurements and including ancillary information. Snow obviously has far more reflectivity compared to barren soil, water or vegetation and any edge identification algorithm on visible channel images will identify their extent. The biggest trouble comes from clouds which can appear as bright as snow in visible channel images. Satellite measurements in the infrared region of spectrum help in the discriminate snow vs cloud. Infrared emissions of an object depend on temperature and clouds being at a higher altitude has far less temperature compared to snow. The algorithm may use other information also, for example, day to day variability. Clouds have a very short lifetime and display large variability whereas snow/ice disappears far slowly compared to cloud.
{ "domain": "earthscience.stackexchange", "id": 1432, "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": "precipitation, snow, satellites", "url": null }
python, beginner, parsing, numpy Title: Printer Color Templates I'm new to Python and I just wrote my first program with OOP. The program works just fine and gives me what I want. Is the code clear? Can you review the style or anything else? import numpy as np import time, os, sys import datetime as dt class TemplateGenerator(object): """This is a general class to generate all of the templates""" def excelWrtGE(self,*typos): for typo in typos: self.excelWriteGE.write(typo) return
{ "domain": "codereview.stackexchange", "id": 10802, "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, parsing, numpy", "url": null }
electromagnetism, electromagnetic-radiation, classical-electrodynamics, dipole, multipole-expansion Title: Why is dipole the simplest source in electrodynamics? I see this sort of statement in many materials, for example this: The smallest radiating unit is a dipole, an electromagnetic point source. and this: The simplest infinitesimal radiating element, called a Hertzian dipole…
{ "domain": "physics.stackexchange", "id": 39815, "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, electromagnetic-radiation, classical-electrodynamics, dipole, multipole-expansion", "url": null }
For my part, I’m returning to some of these questions this week to stretch and explore my student’s creativity and problem-solving. I’d love to hear what you or your students discover. ## Circle and Square Here’s another great geometry + algebra problem, posed by Megan Schmidt and pitched by Justin Aion to some students in his Geometry class. Following is the problem as Justin posed it yesterday. Justin described the efforts of three of his students’ on his his ‘blog.  Following is my more generalized approach.  Don’t read further if you want to solve this problem for yourself!
{ "domain": "wordpress.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9890130547786954, "lm_q1q2_score": 0.8108852170970462, "lm_q2_score": 0.8198933403143929, "openwebmath_perplexity": 1002.0390663806481, "openwebmath_score": 0.7301233410835266, "tags": null, "url": "https://casmusings.wordpress.com/tag/system-of-equations/" }
react.js, jsx function Task(props) { return ( <div className="task"> <div>{props.taskName}</div> <button onClick={() => props.moveLeft(props.type, props.taskName)}> left </button> <button onClick={() => props.moveRight(props.type, props.taskName)}> right </button> </div> ); } Consider use of useReducer instead of multiple state variables. It helps keep component clean by moving all this transition logic outside of the component. Extract types ("inprogress", "todo", "done") as constants. It's easy to maintain all these magic string when they are constants. filter creates copy of array, spreading is unnecessary. There are no restrictions on key value, it can contain spaces. I suggest to pass click handlers to the Task component to make it dumber.
{ "domain": "codereview.stackexchange", "id": 43743, "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": "react.js, jsx", "url": null }
algorithm-analysis, runtime-analysis, average-case, primes $$\mathbb{E}[T(X_n)] = \Omega\left({\sqrt{n} \over \log n}\right).$$ This is enough to establish that trial division is inefficient. Also, since we have the upper bound $$\mathbb{E}[T(X_n)] = O(\sqrt{n}),$$ we get a pair of upper and lower bounds that are almost matching. It turns out one can show that the correct running time is $$\mathbb{E}[T(X_n)] = \Theta\left({\sqrt{n} \over \log n}\right).$$ I'll show the argument below. It's a bit detailed, so brace yourself.
{ "domain": "cs.stackexchange", "id": 5654, "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": "algorithm-analysis, runtime-analysis, average-case, primes", "url": null }
pl.programming-languages These formulas evaluate perfectly fine in Excel, and Excel does not generate a Circular Dependency error. I am writing a compiler that tries to convert these Excel formulas to C code. In my compiler, these formulas do generate a circular dependency error. The issue is that (naïvely) the expression of X depends on Y and the expression for Y depends on X and my compiler is unable to logically continue. Excel is able to accomplish this feat because it is a lazy, interpreted language. Excel will just lazily evaluate the formulas at run-time (with user inputs), and since no circular dependency occurs at run-time Excel has no problem evaluating such logic.
{ "domain": "cstheory.stackexchange", "id": 2434, "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": "pl.programming-languages", "url": null }
python, generator def format_values(config, name, fmt): return [f"{name}:"] + [fmt.format(value) for value in config[name]] format_values(config, "Args", "\t{}: Function argument") docstring.append(config["Summary"]) raises = ["Raises: "] + [f"\t {config.get('Raises')}"] returns = ["Returns: "] + [f"\t {config.get('Returns')}"] Can all be moved into a function. You add f"{Name}: " except for Summary, You always add config[Name], and You always format the value. (Summary would be "{}") def format_value(config, name, fmt, head=True): return ([f"{name}: "] if head else []) + [fmt.format(config[name])] format_value(config, "Summary", "{}", False) value = config.get('Description') wrapper=textwrap.TextWrapper(subsequent_indent= '\t', width = 120) description = ["Description: "] + [f"\t{wrapper.fill(value)}"] docstring += description
{ "domain": "codereview.stackexchange", "id": 41241, "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, generator", "url": null }
c++, beginner, object-oriented, game while (--j) easier to read as for (int j = player.GetJumpSpan(); j > 0; j--)
{ "domain": "codereview.stackexchange", "id": 37977, "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++, beginner, object-oriented, game", "url": null }
newtonian-mechanics, gravity, newtonian-gravity, projectile Title: What vertical velocity must a projectile launch with to reach a certain height, given a variable gravity? Let's say we're launching a projectile and we want it to max out at a height of .5g, which, if given Earth, comes to about 9,000 km. (In this, I'm using g as the gravity at the surface, not as the gravity experienced by the object.) Now, I fully understand how to launch a projectile to 9000 km given a constant gravity. In this, $h = v^2/2g$, and assuming that h = 9,000 km and that g = 9.8 m/s, we get 13,300 m/s.
{ "domain": "physics.stackexchange", "id": 76418, "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, gravity, newtonian-gravity, projectile", "url": null }
and this is equivalent to $64x^2-48x+9$. All other forms of polynomial multiplication work just fine, too. From one perspective, all of this shifting to a variable number base could be seen as completely unnecessary.  We already have acceptably working algorithms for addition, subtraction, and multiplication.  But then, I really like how this approach completes the connection between numerical and polynomial arithmetic.  The rules of math don’t change just because you introduce variables.  For some, I’m convinced this might make a big difference in understanding. I also like how easily this extends polynomial by polynomial multiplication far beyond the bland monomial and binomial products that proliferate in virtually all modern textbooks.  Also banished here is any need at all for banal FOIL techniques. Level 4–Division:
{ "domain": "wordpress.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9907319878505035, "lm_q1q2_score": 0.8962662254973889, "lm_q2_score": 0.9046505376715775, "openwebmath_perplexity": 980.6773426566747, "openwebmath_score": 0.803494930267334, "tags": null, "url": "https://casmusings.wordpress.com/tag/polynomial/" }
algorithms, graphs, optimization, parallel-computing Title: Parallel Algorithm for Donor/Recipient Matching - Graph Matching/Optimization I'm not certain I can accurately describe the problem using my knowledge of discrete math, so pardon any inaccuracies. Happy to clarify any part of the question which is unclear. Given the following constraints: Two sets, each with 'n' elements: 'donors' and 'recipients'. $|D| = |R| = n $ Each donor has a maximal number of times they are able to be matched with a recipient: "max donations". $ maxd: D \to \mathbb{Z}_{+}$ A distance function, returning a real number representing the suitability of match between a donor and a recipient, given the number of times a donor has already "donated" / been matched with a recipient. $ distance: D \times R \times \mathbb{Z}_{+} \to \mathbb{R}_{+} $
{ "domain": "cs.stackexchange", "id": 4666, "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, optimization, parallel-computing", "url": null }
Open and closed balls in $C[a,b]$ Let $X$ be a non empty set and let $C[a,b]$ denote the set of all real or complex valued continuous functions on $X$ with a metric induced by the supremum norm. How to find open and closed balls in $C[a,b]$? Can we see them geometrically? For example what is an open ball $B(x_0;1)$ i.e. ball centered at $x_0$ with radius $1$ in $C[a,b]$. I can visualize them in $\mathbb R^n$ but when it comes to functional spaces I have no clue how to identify them? Thanks for helping me. - I assume $X$ is the interval $[a,b]$? Given a continuous function $f:[a,b]\to\Bbb R$ I would visualize the open ball of radius one around $f$ to be the set of all functions whose graphs exist in the strip between the graphs of $y=f(x)+1$ and $y=f(x)-1$. –  anon May 22 '12 at 19:11 Yes, you should think of it just like you think of any other metric space. Every norm $\|\cdot\|$ induces a metric $d(x,y) := \|x-y\|$.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9740426450627306, "lm_q1q2_score": 0.8095687747984229, "lm_q2_score": 0.8311430499496095, "openwebmath_perplexity": 218.28610702123436, "openwebmath_score": 0.9102358818054199, "tags": null, "url": "http://math.stackexchange.com/questions/148349/open-and-closed-balls-in-ca-b?answertab=oldest" }
#### pka ##### Elite Member If ace is not included, then the probability is 1/22100. However, i am confused as to why there are 4 cards with pictures and heart? Am I understanding the event incorrectly? I understood the event that “all three cards are both heart and picture” to be drawing “a jack, a queen and a king of hearts”, which is 1 out of 22100 ways. BUT if I were reading this question as an editor I would object to its wording as being unclear. It is extremely unusual to use picture card what standard English uses face cards. #### mmm4444bot ##### Super Moderator Staff member It is extremely unusual to use picture card what standard English uses face cards. Your wikipedia link states that names 'picture card' and 'face card' mean the same thing. #### Otis ##### Elite Member confused as to why there are 4 cards with pictures and heart? Because a lot of card manufacturers draw a picture on each ace. However, the design on the aces do not show a person.
{ "domain": "freemathhelp.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9653811631528337, "lm_q1q2_score": 0.8579909907129283, "lm_q2_score": 0.888758786126321, "openwebmath_perplexity": 1354.7472821015594, "openwebmath_score": 0.2772134840488434, "tags": null, "url": "https://www.freemathhelp.com/forum/threads/probability-question-on-drawing-cards.131372/#post-545800" }
python, beginner, python-3.x, game, battleship #Checks if all locations on a ship have been shot def sunkChecker(): global boardInfo global sunk if len(boardInfo[0]) == 0 and sunk[0] == 0: print("You sunk the aircraft carrier.") sunk[0] = 1 if len(boardInfo[1]) == 0 and sunk[1] == 0: print("You sunk the battleship.") sunk[1] = 1 if len(boardInfo[2]) == 0 and sunk [2] == 0: print("You sunk the cruiser.") sunk[2] = 1 if len(boardInfo[3]) == 0 and sunk[3] == 0: print("You sunk the submarine.") sunk[3] = 1 enemyBoard = enemyBoardLoader() boardInfo = boardInfoLoader() while True: boardFunc("reset", 0) while hits < 15: # Each board has 15 ship spots, when all are hit it breaks out of this loop boardFunc("print", 0) boardFunc("update", inputCleaner()) sunkChecker() boardFunc("print", 0) if input("YOU WON!! Would you like to play again? (y/n):") == "n": quit()
{ "domain": "codereview.stackexchange", "id": 36504, "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, python-3.x, game, battleship", "url": null }
object-oriented, vba, excel, ms-word 'Replace PlaceHolders sPrint = Replace(sPrint, "@VARNAME", UCase(.Name)) sPrint = Replace(sPrint, "@Description", .Description) sPrint = Replace(sPrint, "@VarName", .Name) sPrint = Replace(sPrint, "@VarType", .VarType) sPrint = Replace(sPrint, "@Set ", IIf(UBound(Filter(arrNonObjectVariables, .VarType, , vbTextCompare)) > -1, "", "Set ")) sPrint = Replace(sPrint, "@p", VarPrefix(.VarType)) sPrint = Replace(sPrint, "@LetSet", IIf(UBound(Filter(arrNonObjectVariables, .VarType, , vbTextCompare)) > -1, "Let", "Set")) sOutput = sOutput & sPrint End With Next '# Print Functions sPrint = vbNewLine _ & vbNewLine _ & vbNewLine _ & "'##### FUNCTIONS #####" & vbNewLine sOutput = sOutput & sPrint Dim sArgumentPairs For Each myMember In cFunctions With myMember
{ "domain": "codereview.stackexchange", "id": 33430, "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": "object-oriented, vba, excel, ms-word", "url": null }
c, linked-list Used like: DPRINT("My debug message: %s", somestring); If you really want to explicitly return from main() using a preprocessor-constant, use the dedicated EXIT_SUCCESS from <stdlib.h>. Of course, return 0; is implicit for main() since C99...
{ "domain": "codereview.stackexchange", "id": 25762, "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 }
### Combinations Suppose you have a set of n distinct characters. How many ways are there of selecting k characters into a new set (where order doesn’t matter)? That is, how many k-sized subsets are there out of n distinct elements? From the above Permutation section, we’d have n! / (n - k)! k-length substrings. Since each k-sized subset can be rearranged k! unique ways into a string, each subset will be duplicated k! times in this list of substrings. ${n \choose k} = {1 \over k!} * {n! \over (n - k)!} = {n! \over k!(n - k)!}$ ### Proof by Induction (归纳证明法) Induction is a way of proving something to be true. It is closely related to recursion. Let’s use this to prove that there $2^n$ subsets of an n-element set.
{ "domain": "codebycase.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9930961607027984, "lm_q1q2_score": 0.8254049677460618, "lm_q2_score": 0.831143045767024, "openwebmath_perplexity": 1091.9789664411348, "openwebmath_score": 0.5078982710838318, "tags": null, "url": "https://codebycase.com/algorithm/a14-math-and-logic-puzzles.html" }
visible-light I did not include a more complete survey of the biology - this is, after all, a question about the physics. See also Thomas' answer for a more complete argument of some biological arguments showing that it is probably not beneficial to have multiple eyes. EDIT 2: There were some questions added for clarification, so let me try to answer those:
{ "domain": "physics.stackexchange", "id": 17435, "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": "visible-light", "url": null }
linear-systems, homework, stability, causality The system is non-linear: It's so evident since the system has a fixed, unique output for every input it's a non-linear system as it cannot satisfy $$\mathcal{T}\{a x_1[n]+ b x_2[n] \} = a \mathcal{T}\{x_1[n] \} + b\mathcal{T}\{x_2[n]\} $$ The system is time-varying: Again shifting the input have no effect on the output (which is fixed) so it cannot satisfy $$ y[n-d] = \mathcal{T}\{x[n-d] \}$$ NOTE: Does this make any sense? The system is already a fixed one. It has a fixed output for every input. Hence effectively nothing varies in its output. Nevertheless I called it as time-varying, because evidently it cannot saitsfy the time-invariance constraint. The system is causal: it only depends on the past value of the output and it does not depend on any value of the input so it does not violate causality. The system is unstable: as for a bounded input $x[n] = \delta[n]$ the output is $y[n] = K + (n+1) u[n]$ which grows unbounded as $n$ goes to infinity. The system is not invertible.
{ "domain": "dsp.stackexchange", "id": 9068, "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": "linear-systems, homework, stability, causality", "url": null }
java, server, client in = new BufferedReader( new InputStreamReader(clientSocket.getInputStream())); System.out.println("[RECEIVER] A client connected."); Scanner scanner = new Scanner(in); while (scanner.hasNextLine()) { System.out.println(scanner.nextLine()); } } catch (IOException ex) { Logger.getLogger("CONNECTION").severe(ex.getMessage()); if (in != null) { close(in, clientSocket, serverSocket); } else if (clientSocket != null) { close(clientSocket, serverSocket); } else if (serverSocket != null) { close(serverSocket); } } close(in, clientSocket, serverSocket); } private void close(Closeable... closeables) { for (Closeable c : closeables) { try { c.close(); } catch (IOException ex) { } } } }
{ "domain": "codereview.stackexchange", "id": 16551, "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, server, client", "url": null }
fluid-dynamics, simulations, weight, dissipation, fluctuation-dissipation Yaghoubi, S., et al. "New modified weight function for the dissipative force in the DPD method to increase the Schmidt number." EPL (Europhysics Letters) 110.2 (2015): 24002. (link) By the way, it may be useful for future reference to know that one of the inventors of DPD is an active member on this site: Johannes.
{ "domain": "physics.stackexchange", "id": 32023, "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, simulations, weight, dissipation, fluctuation-dissipation", "url": null }
Note that the denominators keep increasing by $2$ as do the numerators; perhaps it's a tad more suggestive to write $$\frac 4 5 = 1 - \frac 1 5$$ $$\frac 6 7 = 1 - \frac 1 7$$ $$\frac 8 9 = 1 - \frac 1 9$$ and so on. I'll let you come up with the details of a specific formula. As usual, there's the caveat that four terms don't uniquely define a sequence, so the formula really could be anything. -
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9674102589923635, "lm_q1q2_score": 0.8040563152345929, "lm_q2_score": 0.8311430520409023, "openwebmath_perplexity": 321.668535262115, "openwebmath_score": 0.8544692993164062, "tags": null, "url": "http://math.stackexchange.com/questions/608630/determine-the-explicit-formula-of-the-sequence" }
bond SO, when you're thinking about breaking $\ce{H-F}$ bond, you gotta take into consideration what happens with the products. In the example with organic chemistry and leaving groups that you have pointed out, fluorine is the worst leaving group for the precisely the same reason--it cannot stabilize the negative charge well, so it doesn't "want" to leave. However, if you try to do a, say, $S_N2$ reaction in a protic solution (not the best way to go around, but doable), then $\ce{F-}$ will be a much better leaving group than $\ce{I-}$, b/c $\ce{F-}$ will instantly "catch" a hydrogen from the solution and stop being nucleophilic, which according to Le'Chatelie'r principle shifts the equilibrium to where $\ce{F-}$ is a leaving group.
{ "domain": "chemistry.stackexchange", "id": 6119, "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": "bond", "url": null }
image-processing To further clarify the effect of PNG data filtering on data compressibility, I cite the LZ77 algorithm article: LZ77 algorithms achieve compression by replacing repeated occurrences of data with references to a single copy of that data existing earlier in the uncompressed data stream. The less variability of "the differences from prediction" that are "clustered around 0", the more "repeated occurrences of data" exist "in the uncompressed data stream". Therefore, the more effective is the LZ77 algorithm's work. The LZ77 is an algorithm the PNG standard uses for compression. Notice also the statement from W3C description of the PNG file format: Filters are applied to bytes, not to pixels, regardless of the bit depth or colour type of the image. Again, the Wikipedia article is helpful to better understand this statement w.r.t. compressibility:
{ "domain": "dsp.stackexchange", "id": 9285, "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": "image-processing", "url": null }
graph-theory, lower-bounds, hypergraphs It is easy to build such a set which is $\Omega(n)$, for instance a staircase, or stacking squares. Is it the case that these structures are also $O(n)$? Or is there an $\Omega(n^2)$ bound? Building such a set would require adding a linear number of points for each added dimension, which is hard due to the first restriction. This problem may also be reformatted graph-theoretically. We may express points in the cube as 3-edges in a 3-uniform tripartite hypergraph. In this case our restraints become that each set of 2 points contained in a 3-edge is contained in exactly two 3-edges, and the 3-edges are connected. These subsets of grids, and your graph-theoretic interpretation of them, are studied in my paper The complexity of bendless three-dimensional orthogonal graph drawing. D. Eppstein. J. Graph Algorithms and Applications 17 (1): 35–55, 2013. http://dx.doi.org/10.7155/jgaa.00283
{ "domain": "cstheory.stackexchange", "id": 4017, "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": "graph-theory, lower-bounds, hypergraphs", "url": null }
only using tensorflow. Read more Tagged as : R linear algebra classification linear discriminant analysis. My work includes researching, developing and implementing novel computational and machine learning algorithms and applications for big data integration and data mining. You can use it as a main text, as a supplement, or for independent study. I’m interested in applying non-standard tools form abstract algebra and topology to the study of neural networks. About data set: Square feet is the Area of house. uk November 1, 2018 Abstract Development systems for deep learning (DL), such as Theano, Torch, TensorFlow, or MXNet, are. Linear algebra has had a marked impact on the field of statistics. In some cases, functions are provided for concepts available elsewhere in R, but where the function call or name is not obvious. GF2] = One Zero Zero Zero Zero Zero One Zero Zero Zero Zero Zero One Zero Zero Zero Zero Zero One Zero Zero Zero Zero Zero One scala> a + a res0: breeze. Siefken, J.
{ "domain": "cfalivorno.it", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9840936073551713, "lm_q1q2_score": 0.9126122943990052, "lm_q2_score": 0.9273632991598454, "openwebmath_perplexity": 1063.9791517497667, "openwebmath_score": 0.2879904508590698, "tags": null, "url": "http://oanx.cfalivorno.it/linear-algebra-and-learning-from-data-github.html" }
your question. The sum $\sum_{m=0}^{\infty} m x^m = xe^x$ worked, and I thought I might have a generalization of your identities, but then the sum $\sum_{m=0}^{\infty} m^2 x^m = (x+x^2) e^x$ did not. The page mentions that some of the examples there can be thought of as moments of a Poisson distribution. I then remembered that the factorial moments of a Poisson ($x$) distribution are much simpler than the usual moments; the factorial moments are just powers of $x$. I checked it, and that turned out to be the right generalization.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9728307653134903, "lm_q1q2_score": 0.8325983334522231, "lm_q2_score": 0.8558511543206819, "openwebmath_perplexity": 260.12072149593166, "openwebmath_score": 0.9429237246513367, "tags": null, "url": "http://math.stackexchange.com/questions/20441/factorial-and-exponential-dual-identities" }
black-holes, visualization Title: Visualization of Black holes I have generally seen pictures of black holes like these
{ "domain": "physics.stackexchange", "id": 99409, "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": "black-holes, visualization", "url": null }
bloom-filters Title: Set intersection using bloom intersection Let $A \subseteq Z$, where $Z=\{1,2,3,\cdots,n\}$. Now given any $B \subseteq Z$, we need to check whether $A \cap B =\varphi$ or not. I am looking for a randomized algorithm. I am trying to implement it using a bloom filter. Create a bloom filter for $A$ and $B$ respectively. Now consider the intersection of $A$ and $B$ which means AND operation of $A$ and $B$. Assume that there are $n$ elements in both arrays. Then the number of bits required in bloom filters will be $O(n)$ many bits and $O(n/\log n)$ many words. AND operation is going to take $O(n/\log n)$ time
{ "domain": "cs.stackexchange", "id": 20588, "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": "bloom-filters", "url": null }
evolution, abiogenesis Dedicated to the fond memory of two great pioneers of this science, Leslie E. Orgel and Stanley L. Miller, this compilation of reviews and original manuscripts provides an overview of the current state of the art, written by some of the eminent "players" in this creative domain of "explorative chemistry". Since we are still far from finding a definitive answer to the most fundamental of questions in science, "chemistry" here is defined in its broadest sense. It is against this background that the contributions cover such a wide range of theories, including chemistry and selection, evolution of the pioneer organism, chemical aspects of synthetic biology, ribozyme catalysis of metabolism in the RNA world, intractable mixtures and the origin of life, the chemical etiology of nucleic acids, interstellar amino acids, and even the chemistry that preceded life's origin.
{ "domain": "biology.stackexchange", "id": 93, "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": "evolution, abiogenesis", "url": null }
## Number of permutations to obtain identity 1. The problem statement, all variables and given/known data Let $s*(f)$ be the minimum number of transpositions of adjacent elements needed to transform the permutation $f$ to the identity permutation. Prove that the maximum value of $s*(f)$ over permutations of $[n]$ is ${n \choose 2}$. Explain how to determine $s*(f)$ by examining $f$. 2. Relevant equations ${n \choose 2} = \frac{n!}{k!(n-k)!}$ Perhaps... Definition: The identity permutation of [n] is the identity function from [n] to [n]; its word form is 1 2 ... n. A transposition of two elements in a permutation switches their positions in the word form. A permutation f of [n] is even when P(f) is positive, and it is odd when P(f) is negative. When n = 1, there is one even permutation of [n] and no odd permutation. For n >= 2, there are n!/2 even permuatations and n!/2 odd permutations.
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9877587229064297, "lm_q1q2_score": 0.8052529981200346, "lm_q2_score": 0.8152324848629214, "openwebmath_perplexity": 763.3108154773464, "openwebmath_score": 0.8018993139266968, "tags": null, "url": "http://www.physicsforums.com/showthread.php?t=551635" }
ros-melodic W: Target Translations (main/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:54 and /etc/apt/sources.list:55 W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:54 and /etc/apt/sources.list:55 W: Target DEP-11 (main/dep11/Components-i386.yml) is configured multiple times in /etc/apt/sources.list:54 and /etc/apt/sources.list:55 W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:54 and /etc/apt/sources.list:55 W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list:54 and /etc/apt/sources.list:55 W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:54 and /etc/apt/sources.list:55 W: Target CNF (main/cnf/Commands-i386) is configured multiple times in /etc/apt/sources.list:54 and /etc/apt/sources.list:55
{ "domain": "robotics.stackexchange", "id": 31492, "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 }
quantum-field-theory, variational-principle Title: Variations (proportional to unity operator) in Schwingers quantum action principle At the moment I'm working with the quantum action principle of J. Schwinger. For this I read the following paper: http://arxiv.org/abs/1503.08091. The auther mentioned that Schwinger considered for the variation of the action operator $S$ only variations $\delta q_a$ which are proportional to the unity operator (see page 36 of the paper). But why does it make senese to ristrict the possible variations only to c-numbers? In the paper on p.13 (https://arxiv.org/pdf/hep-th/0204003.pdf) I read that not all variations are allowed. And also Schwinger mentioned some restriction in his paper "The Theory of Quantized Fields. I" under equation (2.17): This expression for $\delta_0 \mathcal{L}$ is to be understood symbolically, since the order of the operators in $\mathcal{L}$ must not be altered in the course of effecting the variation. Accordingly,
{ "domain": "physics.stackexchange", "id": 35697, "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-field-theory, variational-principle", "url": null }
electromagnetism, lagrangian-formalism Title: Why do some of the terms of the gradient of the dot product between the velocity and magnetic vector potential disappear? When using the Euler-Lagrange equations to yield the Lorentz force, one of the terms ends up looking like this $$∂L/∂r =q(∇(v⋅A)−∇ϕ) =q(v×(∇×A)+(v⋅∇)A−∇ϕ)$$ Where $v$ is the velocity and $A$ is the magnetic vector potential The gradient of dot product equals, $$∇(a⋅b)=(a⋅∇)b+(b⋅∇)a+a×(∇×b)+b×(∇×a)$$ So the equation would be missing the terms in bold $$∂L/∂r=q(∇(v⋅A)−∇ϕ)=q(v×(∇×A)+(v⋅∇)A+(\mathbf{A⋅}\mathbf{∇})\mathbf{v}+\mathbf{A}\mathbf{×}(\mathbf{∇×}\mathbf{v})−∇ϕ)$$
{ "domain": "physics.stackexchange", "id": 46225, "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, lagrangian-formalism", "url": null }
ros, rosbridge, roslibjs, transform Title: Can't subscribe to tf with roslibjs Hello Community, I have a problem with the roslibjs Library. Right now I try to do this tutorial: roslibjs TfClient Tutorial But I can't get it to work. The rosbridge returns this error: [ERROR] [WallTime: 1445335466.389260] [Client 10] [id: subscribe:/tf2_web_republisher/feedback:4] subscribe: Unable to load the manifest for package tf2_web_republisher. Caused by: tf2_web_republisher [ERROR] [WallTime: 1445335466.393854] [Client 10] [id: subscribe:/tf2_web_republisher/result:5] subscribe: Unable to load the manifest for package tf2_web_republisher. Caused by: tf2_web_republisher [ERROR] [WallTime: 1445335466.523221] [Client 10] [id: publish:/tf2_web_republisher/goal:6] publish: Cannot infer topic type for topic /tf2_web_republisher/goal as it is not yet advertised I am not quite sure what this means. Any help is appreciated. Demian
{ "domain": "robotics.stackexchange", "id": 22805, "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, rosbridge, roslibjs, transform", "url": null }
homework-and-exercises, potential, conventions Title: Lower Voltage = Higher Potential? I am doing problems from a textbook and one of the questions asks to determine where the higher potential is. (b) Find the potential difference between the points on the axis at and which of these points is at the higher potential? Check the question here. Problem 37 is the Question (with the solution) I am trying to comprehend. I was under the assumption that higher Voltage by definition meant that there is higher potential. Because $V_1 =V_2 + 3.00\,\mathrm{kV}$ , the point at $x = 2.00\mathrm{m}$ is at the higher potential.
{ "domain": "physics.stackexchange", "id": 25123, "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, potential, conventions", "url": null }
c, hash-map for (int i = 0; i < array_len; i++) { if (!strcmp(nodeArray[i]->key, key) ) { dataNode = nodeArray[i]; // printf("Found Key"); break; } //else printf("Didn't Find it yet"); } if (dataNode==NULL) { return NULL; } else return dataNode->data; } } Is there a more efficient way of handling collisions, and what else could I do to make this a real-world usable map? Bug Suppose there are 2 keys that hash to the same bucket (i.e. HashLocation). If you add key #1 and then search for key #2, mapGet() will return the data for key #1 instead of returning NULL. The problem is here: if (theHashLocation->numberNodes==1) { HashMapNode* dataNode = theHashLocation->nodes[0]; return dataNode->data; }
{ "domain": "codereview.stackexchange", "id": 16711, "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, hash-map", "url": null }
physical-chemistry, kinetic-theory-of-gases, statistical-mechanics $$\langle E^R \rangle = -\frac{1}{q^R} \left( \frac{\partial q^R}{\partial \beta}\right)_V = \frac{1}{\beta} = kT$$ Note: I already pointed out that this result is valid at "high" temperatures, however, I did not give you a sense of scale. For hydrogen molecule $\theta^R = 87.6 \ K$ for chlorine molecule it is $ 0.351 K $. Similarly, the approximations made while deriving the translational functional are valid at room temperatures and for everyday macroscopic containers whose dimensions are much greater than the thermal wavelength ($\Lambda$) of the molecules. A similar analysis can be performed for vibrational modes, however the temperature range over which it is valid is much greater ($> 805 K$ for chlorine and $> 6332 K $ for hydrogen). These conditions aren't within the realm of everyday experience.
{ "domain": "chemistry.stackexchange", "id": 6627, "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": "physical-chemistry, kinetic-theory-of-gases, statistical-mechanics", "url": null }
special-relativity Title: Regarding synchronization of clocks in special relativity I am trying to read of synchronization of two clocks in same inertial frame in special relativity. Suppose we have two synchronized clocks in an inertial frame placed at positions $x_1$ and $x_2$ in that frame. Suppose two observers at $x_1$ and and $x_2$ try to measure speed of some object moving in between $x_1$ and $x_2$(not at the midpoint or any close) with a constant speed. Now both observers, watch the object travel the distance $ \Delta x$. Let the object be closer to $x_1$. The observer at $x_1$ records times at which the object enters the $\Delta x$ region and another when it leaves the region. Lets call them $t_1$ and $t'_1$ and similarly the observer at $x_2$ records $t_2$ and $t'_2$.
{ "domain": "physics.stackexchange", "id": 62063, "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", "url": null }
fluid-dynamics, water Title: Detailed Explanation Wanted - Bell Siphon Alright, so I'm trying to understand in detail what occurs the moment the water covers the outlet tube in a bell siphon. Most sources hand wave and just say "SIPHON HAS OCCURED" or "VACOOOOOOM", but what specifically causes the formation of the vacuum or siphon effect. If the air in the bell is at 1 ATM the second the water cuts it off, how is a vacuum formed? The volume doesn't change, so this leads me to think it is the added water pressure of the formed water seal plus the ATM in the bell that causes the water to beat the air in the tube thus causing the water to fall. Once this motion is in place the siphon is created due to adhesion pulling the water along plus the pressure of the water column. Please let me know if I got this wrong.
{ "domain": "physics.stackexchange", "id": 89882, "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, water", "url": null }
distributed-systems Title: Derivation of fraction of time when system has k requests I was going through Distributed Systems by Maarten van Steen & Andrew S. Tanenbaum. While going through size scalability of systems, I came across this in a note.
{ "domain": "cs.stackexchange", "id": 20481, "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": "distributed-systems", "url": null }
def FindZeroInInterval(polynomial,range_lower,range_upper): '''perform an interval bisection on polynomial between the values range_lower<range_upper return x such that polynomial(x)=0 (or a good enough approximation to it)''' #this is slightly modified compared to what we presented. assert range_lower<=range_upper,"second argument should be smaller than first" accuracy=10**(-15) value_lower=EvaluatePoly(polynomial,range_lower) value_upper=EvaluatePoly(polynomial,range_upper) if value_lower==0: # an exact root on the lower boundary return(range_lower) elif abs(value_upper/value_lower)<accuracy and abs(value_upper)<accuracy: #define this as being close enough to being a root on the upper boundary return(range_upper) elif abs(value_lower/value_upper)<accuracy and abs(value_lower)<accuracy: #close enough to root on lower boundary return(range_lower) if (range_lower==range_upper): return('')
{ "domain": "cocalc.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9755769049752757, "lm_q1q2_score": 0.8925562454264588, "lm_q2_score": 0.9149009584734676, "openwebmath_perplexity": 4157.842828911409, "openwebmath_score": 0.4697786271572113, "tags": null, "url": "https://share.cocalc.com/share/b67337a608fb9911d3a0a3330eaadd1ab39e446b/week%205/assignment/FindRoots.ipynb?viewer=share" }
python, game, console, chess self.matrix[start_y][end_x] = "." # If black pawn moves 2 steps ahead if start_y - end_y == 2: self.en_passant_squares[Color.WHITE].append([start_y - 1, start_x]) # If white pawn moves 2 steps ahead elif start_y - end_y == -2: self.en_passant_squares[Color.BLACK].append([start_y + 1, start_x]) elif move["type"] == MoveType.PAWN_PROMOTION: start_y, start_x = move["start_pos"] end_y, end_x = move["end_pos"] promoted_piece = move["promoted_piece"] if self.current_turn_color == Color.WHITE: promoted_piece = promoted_piece.upper() self.matrix[end_y][end_x] = promoted_piece self.matrix[start_y][start_x] = "." elif move["type"] == MoveType.SHORT_CASTLE: pos_y = 0 if self.current_turn_color == Color.WHITE else 7 # Move h1/h8 rook to f1/f8
{ "domain": "codereview.stackexchange", "id": 44514, "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, game, console, chess", "url": null }
For the unit square the argument is a bit more complicated. Let $L$ denote the long line and let $S$ denote $[0,1]^2$ with the lexicographic order. Let $p:S\to [0,1]$ be given by $p(x,y)=x$; note that $p$ is continuous (for the usual topology on $[0,1]$). So, if $f:L\to S$ is any continuous map, we have a continuous composition $p\circ f:L\to [0,1]$. Any continuous map $L\to[0,1]$ is eventually constant, so $p\circ f$ is eventually constant. However, this means that there exists $a\in L$ and $x\in [0,1]$ such that $f(b)\in \{x\}\times[0,1]$ for all $b>a$. Since $\{x\}\times[0,1]$ just has the usual topology of $[0,1]$, this again implies that $f$ is eventually constant, and so cannot be an embedding. (This second argument applies equally well to the space $\omega_1$ instead of $L$, to show that it does not embed in either $\mathbb{R}^2$ or $[0,1]^2$ with the lexicographic order topology.)
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9669140244715405, "lm_q1q2_score": 0.821849046465215, "lm_q2_score": 0.8499711718571775, "openwebmath_perplexity": 117.95167789543085, "openwebmath_score": 0.9676244854927063, "tags": null, "url": "https://math.stackexchange.com/questions/2917820/can-the-long-line-be-embedded-in-the-ordered-plane" }
solidworks, technical-drawing, autocad, stiffness Title: Should a stiffener be hatched In my course it's preferred not to hatch ribs and webs so should I consider a stiffener like them and not hatch it or is it different and why ? The standard is that The cylinder part should be hatched but not the rib. So something like the following.
{ "domain": "engineering.stackexchange", "id": 4497, "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": "solidworks, technical-drawing, autocad, stiffness", "url": null }
signal-processing EDIT: In the non-linear case this is convolution in the frequency domain instead of the time domain. It is often easier to characterize the non-linear element in terms of a polynomial using a Volterra series than try to create a model using deconvolution which requires a lot of guessing and iteration. Once your model responds like the real system then you can explore responses to the input using frequency convolution. Here is an example of estimating the Volterra function in an optics application (see the references too for more info). Perhaps the device you're using has already been characterized? It might be helpful for us to know your end goal and if you can control the input source characteristics. Otherwise we have to answer with generalities.
{ "domain": "physics.stackexchange", "id": 9325, "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": "signal-processing", "url": null }
reduced matrix says Thus, Therefore, is a basis for the null space. Now, why is this satisfied in case of a real symmetric matrix ?. That is, A and B are symmetric matrices. In fact, it is necessary to introduce linear combinations of the symmetric top functions much more complicated than sums and differences []. 1 Special properties of real symmetric matrices A matrix A ∈ Mn(C) defined by left multiplication by A has a diagonal matrix. We can express this as: [A] t = -[A] Representing Vector cross Multiplication. Of course, a linear map can be represented as a matrix when a choice of basis has been fixed. Read solution. (Mutually orthogonal and of length 1. To illustrate such symmetry adaptation, consider symmetry adapting the 2s orbital. Suppose we have a vector with coordinates (3, 5) with respect to the basis B. A general re ection has R(v 1) = v 1 and R(v 2) = v 2 for some orthonor-mal eigenvectors v 1 = (c;s) = (cos ;sin ) and v 2 = ( s;c). Every symmetric matrix is thus, up to
{ "domain": "chiasportweek.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.988841966778967, "lm_q1q2_score": 0.8261611840408106, "lm_q2_score": 0.8354835371034369, "openwebmath_perplexity": 346.29154531032003, "openwebmath_score": 0.8441441059112549, "tags": null, "url": "http://rlyi.chiasportweek.it/basis-of-symmetric-matrix.html" }
java, multithreading, datetime, swing, timer And then an object to hold a particular instance of the machine that is transitioning between states public class FSM { volatile State currentState; FSM(State initialState) { this.currentState = initialState; } ... } We use the volatile keyword here because we know that FSM is going to be read by a thread other than the one that writes to it, and we need that value to be visible across all the threads. At a very hand-waving level, the volatile keyword tells the JVM that when this value is written, the value written needs to be pushed all the way out to share memory right away. Part of describing the state machine is defining which state changes are legal. It would be straighforward to write this out, long hand: if (State.STARTED.equals(currentState)) { currentState = State.STOPPED; } else { currentState = State.STARTED; }
{ "domain": "codereview.stackexchange", "id": 8550, "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, multithreading, datetime, swing, timer", "url": null }
slam, navigation, rviz, 3dmapping, ros-kinetic <!-- Fake laser --> <node pkg="depthimage_to_laserscan" type="depthimage_to_laserscan" name="depthimage_to_laserscan"> <remap from="image" to="/camera/depth_registered/image_raw"/> <remap from="camera_info" to="/camera/depth_registered/camera_info"/> <!--<remap from="scan" to="/scan"/>--> <param name="range_max" type="double" value="4"/> </node> <!-- Throttling messages --> <group ns="camera"> <node pkg="nodelet" type="nodelet" name="data_throttle" args="load rtabmap_ros/data_throttle camera_nodelet_manager" output="screen"> <!-- <param name="rate" type="double" value="5.0"/> --> <!-- <param name="approx_sync" type="bool" value="true"/> --> <param name="rate" type="double" value="$(arg rate)"/> <param name="decimation" type="int" value="$(arg decimation)"/> <param name="approx_sync" type="bool" value="$(arg approx_sync)"/>
{ "domain": "robotics.stackexchange", "id": 30460, "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": "slam, navigation, rviz, 3dmapping, ros-kinetic", "url": null }
# Period of Sine and Cosine #### thunc14 ##### New member I understand that the period for sine and cosine functions are theta (in radians) + 2pi. But if you have a point on the unit circle in the first quadrant, and you drew a line parallel to the x-axis until you reached the unit circle in quadrant 2, wouldn't that be the same y-value, thus the same value for sin theta? If you repeated the process from the point in quadrant 1 and drew a line parallel to the y-axis until you reached the unit circle in quadrant 4, wouldn't that be the same x-value, thus the same value for cos theta? I don't understand how this works, if the period is 2pi, then why are there other points on the unit circle that would give the same value for x and y, therefore sine and cosine respectively? I attached a picture, hopefully that makes my confusion clearer. #### mmm4444bot ##### Super Moderator Staff member I understand that the period for sine and cosine functions are theta (in radians) + 2pi.
{ "domain": "freemathhelp.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9773707979895381, "lm_q1q2_score": 0.8035836465965631, "lm_q2_score": 0.8221891305219504, "openwebmath_perplexity": 309.87776966166723, "openwebmath_score": 0.7990578413009644, "tags": null, "url": "https://www.freemathhelp.com/forum/threads/period-of-sine-and-cosine.109790/" }
Any suggestions/comments will be greatly appreciated! 2. Jul 18, 2015 ### ShayanJ There is no need for that. You've done all things needed. You have shown that for all allowed values of x, there exists a $\theta$ that either $x=\sin\theta$ or $x=\cos\theta$. It means for all allowed values of x, this matrix corresponds to a rotation. It may correspond to many other things, but that doesn't matter. All we care about now, is that it corresponds to a rotation. So you're done with this question. 3. Jul 18, 2015 ### ELB27 Ah, I think I get it. Basically, the question can be rephrased as "Prove the $U$ can be represented as a rotation matrix."? Thus my proof will end as: $x=\cos\theta \ ∀x$ for some angle $\theta$ and thus, $U$ is always a rotation matrix about some angle $\theta$.
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.966914019704466, "lm_q1q2_score": 0.8139730223928472, "lm_q2_score": 0.8418256492357359, "openwebmath_perplexity": 201.2903239788009, "openwebmath_score": 0.8772439956665039, "tags": null, "url": "https://www.physicsforums.com/threads/proving-a-certain-orthogonal-matrix-is-a-rotation-matrix.823764/" }
c, database, circular-list, embedded /**************************************************************** * Function Name : BucketGetDataSize * Description : Gets the size of the item * Returns : false on error, !0 on OK * Params @data :points to feed struct ****************************************************************/ static uint8_t BucketGetDataSize(const cbucket_t *data){ uint8_t dataSizeOut = 0;
{ "domain": "codereview.stackexchange", "id": 40955, "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, database, circular-list, embedded", "url": null }
c++, memory-management, thread-safety, c++17 // Removes object from the hashmap. { std::lock_guard<std::mutex> lk{ _hashMapMutex }; if (!_hashMap.erase(handle)) { std::stringstream message; message << "Handle{ size: " << handle.size << ", index: " << handle.index << " }" << " not found in ObjectPool::_hashMap."; throw std::out_of_range(message.str()); } } return; } template <class Pool> inline void ObjectPool::shrink() { auto pool = &std::get<Pool>(_pools); std::lock_guard<std::recursive_mutex> lk{ *std::get<2>(*pool) }; auto pages = &std::get<1>(*pool); if (!std::get<0>(*pool)) return; std::vector<Handle *> freePtrs{ std::get<0>(*pool) }; std::size_t lastPos = pages->size() * OBJECT_POOL_PAGE_LENGTH;
{ "domain": "codereview.stackexchange", "id": 30871, "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++, memory-management, thread-safety, c++17", "url": null }
ros-kinetic, camera Comment by KL_Newt on 2023-04-02: Hi @peci1 will appreciate if you share when it's released! I'm new to all these and doing them as a hobby, but what started from an idle search about how 360 cameras work turned into a fascination on how complex all these stuff are from taking pictures to stitching them to turning them into 360 pictures (still not sure if 360 refers to spherical or not). Grappling with a lot of new concepts to me from the lens all the way to the software, so this will be very interesting to me as well. Thanks in advance! Comment by GYL_99 on 2023-08-02: @peci1 it is amazing! Where can get the source code? I will appreciate if you share when it's released!
{ "domain": "robotics.stackexchange", "id": 35715, "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-kinetic, camera", "url": null }
newtonian-gravity, water, free-body-diagram, fluid-statics, buoyancy When floating or standing generally both the above sensations are rather similar. Not much visual input and not much inner ear activity. Any differences may be a gentle inner ear “sloshing” which is easily habituated and ignored in favor of the visual input. The third related sense is pressure, sensed by your skin. This sensation is particularly different in standing or floating. In standing the pressure sensation is strong and concentrated on your feet. In floating it is weak and distributed across a large surface area. This weak and distributed sensation is easier to habituate and ignore than the strong concentrated sensation. If you specifically direct your attention then you will notice it, but because it is weak it is easy to neglect if you do not specifically attend to it. However, the brain also habituates rather quickly to the pressure on your feet. So although this sensation is different in the two situations, after a short time it is ignored.
{ "domain": "physics.stackexchange", "id": 87465, "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-gravity, water, free-body-diagram, fluid-statics, buoyancy", "url": null }
formal-languages, automata, regular-languages Title: Finding right quotient of $a^*b^*/b^*.$ I argue that right quotient of $a^*b^*/b^*$ is $a^*$,is that true?any help or argument to accept or reject my argument will be appreciated:) $a^*b^* / b^* = \{ w \ | \ \exists \ x, \ x \in b^* \land wx \in a^*b^*\} = a^*b^*$. This is because $wx \in a^*b^* \text{ AND } x \in b^*$ means $w$ is of the form $a^ib^j$ for some $i,j \in \mathbb{N} \cup \{0\}$. Finish it off now.
{ "domain": "cs.stackexchange", "id": 17359, "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": "formal-languages, automata, regular-languages", "url": null }
statistical-mechanics, solid-state-physics, chemical-potential Title: Chemical potential This is something probably very basic but I was led back to this issue while listening to a recent seminar by Allan Adams on holographic superconductors. He seemed very worried to have a theory at hand where the chemical potential is negative. (why?) For fermions, isn't the sign of the chemical potential a matter of definition? The way we normally write our equations for the Fermi-Dirac distribution the chemical potential happens to that value of energy at which the corresponding state has a occupation probability of half. And within this definition the holes in a semiconductor have a negative chemical potential. It would be helpful if someone can help make a statement about the chemical potential which is independent of any convention. {Like one argues that negative temperature is a sign of instability of the system.}
{ "domain": "physics.stackexchange", "id": 21837, "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, solid-state-physics, chemical-potential", "url": null }
Proof: Again, we can construct the chain from a more basic process. Let $$X_0$$ and $$\bs{V}$$ be as in Theorem 1. Let $$U_n$$ be the urn selected at time $$n \in \N_+$$. Thus $$\bs{U} = (U_1, U_2, \ldots)$$ is a sequence of independent random variables, each uniformly distributed on $$\{0, 1\}$$ (so that $$\bs{U}$$ is a fair, Bernoulli trials sequence). Also, $$\bs{U}$$ is independent of $$\bs{V}$$ and $$X_0$$. Now define the state process recursively as follows: $X_{n+1} = \begin{cases} X_n - 1, & V_{n+1} \le X_n, \; U_{n+1} = 0 \\ X_n + 1, & V_{n+1} \gt X_n, \; U_{n+1} = 1 \\ X_n, & \text{otherwise} \end{cases}, \quad n \in \N$ Note that $$Q(x, y) = \frac{1}{2} P(x, y)$$ for $$y \in \{x - 1, x + 1\}$$. In the Ehrenfest experiment, select the modified model. For selected values of $$m$$ and selected values of the initial state, run the chain for 1000 time steps and note the limiting behavior of the proportion of time spent in each state. Classification
{ "domain": "uah.edu", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9899864284905089, "lm_q1q2_score": 0.8472810184856756, "lm_q2_score": 0.8558511451289037, "openwebmath_perplexity": 249.0343649860822, "openwebmath_score": 0.9923355579376221, "tags": null, "url": "http://www.math.uah.edu/stat/markov/Ehrenfest.html" }
I hope this helps ^_^ • This is an excellent answer (+1). I'd like to learn more about Heyting Algebras and intuitionism in general. I have all the standard textbooks (I think); I just doubt I can get around to giving them the time they deserve. Topoi are exciting, too, and some of my first questions on MSE were about them. I'm not sure where I'm going with this comment so I'll stop here :) Nov 23, 2021 at 19:09 • @Shaun, well now I've got butterflies, haha. And yeah, there's so much math worth learning, it's a real shame that we need to choose what we spend time with. I'm in a symmetric position to you with combinatorial group theory :P Nov 23, 2021 at 19:45 • Thanks for this excellent answer. Wish I could accept all three great answers I've received! Nov 25, 2021 at 2:56
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9783846650314325, "lm_q1q2_score": 0.8215828366765197, "lm_q2_score": 0.8397339676722393, "openwebmath_perplexity": 293.6862859550084, "openwebmath_score": 0.8599395155906677, "tags": null, "url": "https://math.stackexchange.com/questions/4314385/looking-for-a-simple-proof-of-the-independence-of-the-law-of-excluded-middle" }
redox, hydrogen two hydrogens. Step 8: Malate (four hydrogens) is oxidised to Oxaloacetate (two hydrogens), reducing NAD+ to NADH/H. Etc. I came across a similar question at https://biology.stackexchange.com/questions/93775/what-exactly-happens-to-hydrogen-atoms-in-step-4-of-citric-acid-cycle but as this was about step 4, and for me the problem occurs one step earlier. Your problem stems from the statement "I would say this process entails the loss of two hydrogens from Isocitrate, and the gain of those hydrogens in NADH/H+." This statement is incorrect. In isocitrate, the carboxylic acid functional groups are deprotonated, as would be the case at neutral pH. The oxidation reaction thus involves loss of only $\ce{H-}$ to NAD. There is no loss of $\ce{H+}$, because that has already been removed.
{ "domain": "chemistry.stackexchange", "id": 14764, "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": "redox, hydrogen", "url": null }
c, hash-map t.c: In function 'main': t.c:31:5: warning: passing argument 2 of 'hashmap_push' makes pointer from integer without a cast [enabled by default] hashmap_push(&hm, 3, 7, 0); ^ As a reminder, here's the method signature: void hashmap_push(HashMap *hm, void *k, void *v, int index); The method takes as 2nd parameter a void*, but you're passing it the int value 3. Well, that just doesn't work: you're passing the wrong type. To make it work, the compiler casts this integer to void*, and warns you about it. Is this really what you wanted? No. Casting an int variable to void* can't be good. The next warning is related to the first: t.c:15:6: note: expected 'void *' but argument is of type 'int' void hashmap_push(HashMap *hm, void *k, void *v, int index) { ^ The first warning was about calling hashmap_push with the wrong parameter types, this one is about the hashmap_push receiving the wrong parameter types. Next warnings:
{ "domain": "codereview.stackexchange", "id": 11087, "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, hash-map", "url": null }
accelerometer, gyroscope, balance Once we have that, we can negate the effect of the inertial forces in the accelerometers, leaving only a much better measure of the gravity. It probably still is a good idea to use this as the input of the usual Kalman filter as in 1. above. Maybe we can even build a Kalman filter that could estimate all those variable at once? I'm going to try that. What do you think? Am I missing something here? I think self-balancing-robot could be a good tag, but I can't create it If you properly construct a Kalman filter with an 'x' input, then yes, it'll be better. Notably, the inertial sensor cannot give you an absolute value for x in any case, because you're (essentially) trying to double-integrate an accelerometer signal into a position, and that is exquisitely sensitive to noise in the accelerometer output. Some things you may wish to consider in your travels:
{ "domain": "robotics.stackexchange", "id": 1570, "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": "accelerometer, gyroscope, balance", "url": null }
newtonian-mechanics, reference-frames, acceleration, inertial-frames, machs-principle Title: Can we determine if a reference frame is inertial or non-inertial by looking at an accelerating object? if we find that in a given frame, an object being acted upon by a force and is accelerating with respect to the frame would that mean that the reference frame in which this object exist is inertial or non-inertial? I think of Newton's First law as a definition of an inertial frame An inertial frame is one in which an object that experiences no net force moves with a constant velocity vector.
{ "domain": "physics.stackexchange", "id": 91698, "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, reference-frames, acceleration, inertial-frames, machs-principle", "url": null }
gravity, newtonian-gravity, method-of-images Some preliminary research online has resulted in no resources on this idea so any references for/against this would be great. While rare, there are a few uses of the method of images to gravitational problems. As lurscher says, the problem is finding equipotential surfaces. In most problems, such a surface doesn't exist, and hence the scare use of the method of images in GR. One class of problems for which it does applies are the so-called Dirichlet problems. Suppose one was interested in solving for the metric in some region, with specified boundary conditions on the boundary surface. This is not usually what is done--usually the entire spacetime is solved for. For the case of Dirichlet boundary conditions (requiring the metric to approach some specified value on the boundary surface), image charges can be useful. In this case the image charges could correspond to image black holes, for example.
{ "domain": "physics.stackexchange", "id": 19421, "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": "gravity, newtonian-gravity, method-of-images", "url": null }
ros, moveit, ros-kinetic, cartesian Comment by gvdhoorn on 2018-09-07: @fvd: of course. That's certainly possible. However, you would still give MoveIt hundreds of mini-trajectories to plan for. Besides not being very efficient, I'd be interested to see what the "quality" of the resulting cumulative trajectory is, instead of planning through a single one. Comment by gvdhoorn on 2018-09-07: re: related question: that is #q261368, which I already linked to in the first comment ;) Comment by Dan_escu on 2018-09-07: To use gvdhoorn's method, would a loop have to be implemented which reads each line and then applies each modification (create geometry_msgs, set x,y,z values)? I'm assuming this is necessary to avoid having to do it manually. Cheers Comment by fvd on 2018-09-07: Pretty much, yes: https://en.wikipedia.org/wiki/Foreach_loop .. calling move_group.computeCartesianPath(..) as you are already doing. My suggestion:
{ "domain": "robotics.stackexchange", "id": 31715, "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, moveit, ros-kinetic, cartesian", "url": null }
c++, c++11, opengl private: Transform m_transform; Mesh* m_pmesh = nullptr; Material* m_pmaterial = nullptr; }; Material.h class Material{ public: template<typename T> Material(T&& texture, float shininess, const glm::vec3& specularColor = glm::vec3(0.5, 1.0, 1.5), const glm::vec3& emissiveColor = glm::vec3(0.0, 0.0, 0.0) ) : m_texture(std::forward<T>(texture)), m_shininess(shininess), m_specularColor(specularColor), m_emissiveColor(emissiveColor) {} ~Material(){ m_texture.Dispose(); ///not necessary... ressources are automatically disposed in texture ! } void Bind(unsigned unit = 0){ this->m_texture.Bind(unit); }
{ "domain": "codereview.stackexchange", "id": 14881, "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, opengl", "url": null }
ros, calibration, robot-calibration Originally posted by vpradeep with karma: 760 on 2011-02-24 This answer was ACCEPTED on the original site Post score: 6
{ "domain": "robotics.stackexchange", "id": 4805, "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, calibration, robot-calibration", "url": null }
digital-communications, algorithms, signal-detection, complex $$\left(H^T H\right)\hat x = H^T y\text.$$ How complex the solution to that is depends on the properties of your MIMO channel matrix! The quadratic / full-rank MIMO case In the (very special) case that $H$ is normal (that implies among other things quadratic, ie. as many receive as transmit antennas $N_r=N_t=:N$), you do that by applying a QR decomposition to $H^T H$: \begin{align} \left(H^T H\right)\hat x &= H^T y\\ QR \hat x &= H^T y\\ R\hat x &= Q^T H^T y\tag{1}\\ &= \nu y\tag{2} \end{align} Since $R$ is a triangular matrix, $(1)$ s the point where you just backsubstitute. Luckily, $R$, $Q^T$ and $H^T$ only need to be calculated once ever, so we can estimate many $\hat x$ from many $y$ as long as the channel doesn't change at fixed complexity. Complexity
{ "domain": "dsp.stackexchange", "id": 7425, "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": "digital-communications, algorithms, signal-detection, complex", "url": null }
thermodynamics, heat, entropy The process is adiabatic with irreversible friction - but no heat exchange, so $\delta q = 0$. The process is not isentropic, as it is irreversible and entropy increases, with $\mathrm{d}S \gt \frac{\delta q}{T} = 0$ If the irreversible action like friction occurs out of the system, like at the piston with friction or mechanical machinery behind, the system may do non-PV work on the surrounding via friction, which converts work to heat. $$\mathrm{d}S_\mathrm{sys} = \frac{\delta q_\mathrm{sys}}{T} = 0$$ $$\mathrm{d}S_\mathrm{surr} \ge \frac{\delta q_\mathrm{surr}}{T} \gt 0$$
{ "domain": "chemistry.stackexchange", "id": 17297, "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, heat, entropy", "url": null }
rust, game-of-life, cellular-automata if has_top_neighbors && world_map[top_row][left_col].alive { alive_neighbors += 1; } if has_btm_neighbors && world_map[btm_row][left_col].alive { alive_neighbors += 1; } } if has_right_neighbors { if world_map[row][right_col].alive { alive_neighbors += 1; } if has_top_neighbors && world_map[top_row][right_col].alive { alive_neighbors += 1; } if has_btm_neighbors && world_map[btm_row][right_col].alive { alive_neighbors += 1; } } if has_top_neighbors { if world_map[top_row][col].alive { alive_neighbors += 1; } } if has_btm_neighbors { if world_map[btm_row][col].alive { alive_neighbors += 1; } }
{ "domain": "codereview.stackexchange", "id": 35141, "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, game-of-life, cellular-automata", "url": null }
Hence there exists a sphere containing the two points but not any lines which has been deleted. There might not be such sphere. Let $$L$$ be a line segment connecting $$a$$ and $$b$$. Now let $$c$$ be any point on $$L$$ (other than $$a$$ and $$b$$) and let $$T$$ be any line passing through $$c$$ but not through $$a$$ and $$b$$. Note that $$T$$ intersects any sphere containing $$a$$ and $$b$$. The reason is because $$c$$ is an interior point of any such sphere. So as you can see, simple "cardinality" argument is not enough. You have to consider geometry as well.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9648551515780318, "lm_q1q2_score": 0.8382919810510249, "lm_q2_score": 0.8688267660487573, "openwebmath_perplexity": 86.9426234306047, "openwebmath_score": 0.7953607439994812, "tags": null, "url": "https://math.stackexchange.com/questions/3470926/removing-countable-no-of-lines-from-r3" }
large-hadron-collider, quarks Title: Could a tetraquark $q \bar{q} q \bar{q}$ be colorless? CERN just posted this article where it informs that it was found an hadron which cannot be classified within the traditional quark model. What other models are there to explain this result? Or is it possible to introduce a correction to the quark model to explain such find? There are three flavours of quarks in the fundamental $3$ representation of $SU(3)$, the QCD gauge group. Their antiparticles are in the conjugate representation $\bar3$ or $3^\star$. QCD is confining; the quarks form bound, colorless states, which are singlets in $SU(3)$. Mesons are $q\bar q$. The general tensor $3\times\bar 3$ can be decomposed into irreducible represetations; $3\times\bar 3 = 1 +8$. Note that this contains a singlet. Tetra-quarks are $q\bar q q\bar q$. Since $3\times\bar 3 = 1 +8$, $3\times\bar 3 \times 3\times\bar 3$ clearly contains a singlet.
{ "domain": "physics.stackexchange", "id": 13030, "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": "large-hadron-collider, quarks", "url": null }
comparative-review, clojure, simulation with result: ---------------------------------- Clojure 1.9.0 Java 10.0.1 ---------------------------------- Testing tst.demo.core "Elapsed time: 0.498 msecs" 0 100 1 1 2 2 3 2 4 3 5 2 6 4 7 2 8 4 9 3 10 4 11 2 12 6 13 2 14 4 15 4 16 5 17 2 18 6 19 2 20 6 21 4 22 4 23 2 24 8 25 3 26 4 27 4 28 6 29 2 30 8 Just noticed that you want the first N open doors: (defn door-open? "Returns true if `door-idx` is open" [door-idx] (assert (pos? door-idx)) (let [hits (atom 0)] (doseq [step (range 1 (inc door-idx))] (when (zero? (rem door-idx step)) (swap! hits inc))) (odd? @hits)))
{ "domain": "codereview.stackexchange", "id": 31989, "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": "comparative-review, clojure, simulation", "url": null }
kinematics, acceleration, velocity, calculus, displacement For circular rotational motion of a particle about a fixed axis with constant magnitude angular acceleration, $\alpha$, the appropriate relationship is $\omega^2_f = \omega^2_i + 2 \alpha \theta$ where $\omega$ is angular speed equal to $d \theta/dt$ and $\theta$ is angular displacement. $\alpha = d \omega/dt$ and unless $\alpha$ is zero $\omega $ is not constant. For circular motion, the particle returns to the same position in space once per revolution, even though $\theta$ is constantly increasing.
{ "domain": "physics.stackexchange", "id": 75635, "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": "kinematics, acceleration, velocity, calculus, displacement", "url": null }
strings, vba, excel The code for extracting the pattern value should also be extracted into its own function. In this way, you can test the return value without running the main subroutine. Private Function getPatternValue(Text As String) As String Dim x As Long x = PatternIndex(Text) If x > 0 Then getPatternValue= Mid(Text, x, 13) End Function The Iff function can be used to replace an If statement where 1 of 2 values will be assigned. Although, not as efficient as an If statement, you will save 4 lines of code. Mid(target, i, 1) = IIf(Mid(target, i, 1) = ".", 0, 1) Although the PatternIndex Error Handler is probably considered the best practice; On Error Resume Next will always give you the same result (in this case). Private Function PatternIndex(ByVal Pattern As String) As Integer ' MATCHES THE PATTERN AND RETURNS THE FIRST INDEX On Error Resume Next PatternIndex = Application.WorksheetFunction.Search("1101101110111", Pattern) End Function
{ "domain": "codereview.stackexchange", "id": 29259, "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": "strings, vba, excel", "url": null }
quantum-mechanics, condensed-matter, perturbation-theory, effective-field-theory I saw the above formula in the book "Interacting Electrons and Quantum Magnetism" by Auerbach. This approach is straightforward to understand if you realize that $1/(E-H)$ is nothing but the propagator (the Green's function) $G(E)=(E-H)^{-1}$. So this approach simply means that the effective propagator $G_\text{eff}(E)=(E-H_\text{eff})^{-1}$ is obtained by restricting the full propagator to the subspace of interest $G_\text{eff}(E)=P_sG(E)P_s$. One may wonder why not projecting the Hamiltonian directly to the subspace but projecting the propagator. The reason is that all physical observables are measured with respect to the density matrix $\rho(E)=-2\Im G(E+i0_+)$, which is the imaginary part of the propagator. For example, the expectation value of an operator $A$ evaluated on an eigenstate of the energy $E$ is given by $$\bar{A}(E)=\text{Tr}\hat{A}\rho(E)=-2\text{Tr}\hat{A}\Im G(E+i0_+).$$
{ "domain": "physics.stackexchange", "id": 39427, "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, condensed-matter, perturbation-theory, effective-field-theory", "url": null }
c++, c++11, multithreading, random, c++14 Use C++17, and mark the variable inline, which behaves exactly like in functions: thread_local inline std::mt19937_64 generator(std::random_device{}()); Mark the variable extern, and put its definition in Random.cpp. You don't need return 0; at the end of main(). The compiler implicitly adds it for you. I like to use types as parameter that try to match the preconditions of a function. For example, I would use unsigned integers everywhere where you use signed integers, because I do not see the point in calling let's say random_walk with a negative number_of_steps. You can shorten the definitions in Random.cpp by removing Random:: if you wrap them around namespace Random, like in the declarations.
{ "domain": "codereview.stackexchange", "id": 26038, "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, multithreading, random, c++14", "url": null }