text
stringlengths
1
1.11k
source
dict
molecular-biology, cell-biology, bacteriology, cell-membrane, antibiotics After an initial binding step involving outer membrane lipopolysaccharide the kinetics of the uptake of aminoglycosides exhibit two energy-dependent processes (EDP I AND II). EDP I is the slow, rate-limiting stage and is dependent upon the membrane potential ΔΨ, but the details of the process are unclear. EDP II is more rapid and may be triggered by membrane changes arising as a result of translation errors caused by the antibiotic accumulated in EDP I since protein synthesis inhibitors block the transition from EDP I to EDP II. EDP I requires a threshold value of ΔΨ, and there is evidence that this threshold often cannot be achieved under anaerobic conditions. This summary is based on information in this review from 1987. I haven't been able to find any more recent information.
{ "domain": "biology.stackexchange", "id": 7384, "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": "molecular-biology, cell-biology, bacteriology, cell-membrane, antibiotics", "url": null }
java import org.simmetrics.MultisetMetric; import com.google.common.collect.Multiset; /** * Calculates the cosine similarity over two multisets. The similarity is * defined as the cosine of the angle between the multisets expressed as sparse * vectors. * <p> * <code> * similarity(a,b) = a·b / (||a|| * ||b||) * </code> * * <p> * The cosine similarity is identical to the Tanimoto coefficient, but unlike * Tanimoto the occurrence (cardinality) of an entry is taken into account. E.g. * {@code [hello, world]} and {@code [hello, world, hello, world]} would be * identical when compared with Tanimoto but are dissimilar when the cosine * similarity is used. * <p> * This class is immutable and thread-safe. * * @see TanimotoCoefficient * @see <a href="http://en.wikipedia.org/wiki/Cosine_similarity">Wikipedia * Cosine similarity</a> * * @param <T> * type of the token */ public final class CosineSimilarity<T> implements MultisetMetric<T> {
{ "domain": "codereview.stackexchange", "id": 16905, "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", "url": null }
*In real life, human beings do not guess randomly. When you ask people to pick a number between 1 and 10, they are more likely to pick 7 than 6 or 8. That complicates the math for determining the probability of any particular guess+outcome combination. But as long as the outcome (coin/die/whatever) remains random, the probability of a correct guess will not change, because the higher probability of certain guesses will be offset by the lower probability of the other guesses. fblundun's answer does a better job of describing this. In more layman's terms, I would describe it like this: Let's say the friend guesses 20--take that as a given. Now we roll the die, what's the chance that a d20 roll is 20? 1/20 = 5%. Okay, now let's say the friend guesses 19. In this case, what's the chance that a d20 roll is 19? 1/20 = 5%. What if the friend guesses 18? 1/20 = 5%. Et cetera.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9702399051935107, "lm_q1q2_score": 0.8064081560144102, "lm_q2_score": 0.8311430520409023, "openwebmath_perplexity": 614.6189777826722, "openwebmath_score": 0.8243175148963928, "tags": null, "url": "https://stats.stackexchange.com/questions/550800/is-there-a-1-in-20-or-1-in-400-chance-of-guessing-the-outcome-of-a-d20-roll-befo/550802" }
vba, excel PrintAggregatedData CleanUpAggregatedData RestoreApplicationSettings End Sub InitialiseGlobalsBooksSheetsAndCollections Set all the Globals, Collections etc. for the rest of the project. Public Sub InitialiseGlobalsBooksSheetsAndCollections() Sheets(1).Activate LngFinalCellRow = Sheets(1).Rows.Count LngFinalCellColumn = Sheets(1).Columns.Count '/ initialise public arrays ArrAggregatedData = Array() ArrAggregatedArrays = Array() ArrProviders = Array() ArrAdvisers = Array() GetWorkbook StrAdviserReportFilename, StrAdviserReportFilePath Set WbAdviserReport = Workbooks(StrAdviserReportFilename) GetWorkbook StrSubsheetFilename, StrSubsheetFilePath Set WbSubsheet = Workbooks(StrSubsheetFilename) AssignWorksheets InitialiseCollections End Sub
{ "domain": "codereview.stackexchange", "id": 17368, "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": "vba, excel", "url": null }
python, optimization, project-euler Title: Project Euler #4 - Largest Palindrome Product A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. How would you improve the following code? I'm looking specifically for: performance optimizations ways to shorten the code more "pythonic" ways to write it def is_palindrome(num): return str(num) == str(num)[::-1] def fn(n): max_palindrome = 1 for x in range(n,1,-1): if x * n < max_palindrome: break for y in range(n,x-1,-1): if is_palindrome(x*y) and x*y > max_palindrome: max_palindrome = x*y elif x * y < max_palindrome: break return max_palindrome
{ "domain": "codereview.stackexchange", "id": 4601, "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, optimization, project-euler", "url": null }
php, object-oriented, random, file-system /** * Base path that must contain the "kombis" directory. * * @var string Trailing slash is stripped */ private $location; Don't bother writing "<function-name> function." as the first line of each function's documentation. It adds nothing, takes up visual space, and will be obvious in the generated documentation. Drop the @access attributes as they're inferred from the method declarations. Update You're still missing the declaration of $pattern. You're not initializing $pattern in the class. What happens if you forget to call setPattern? You could add it as another constructor parameter or assign a default value in the declaration--or both using a parameter default. public function __construct($location, $pattern = '/kombi*') {
{ "domain": "codereview.stackexchange", "id": 2275, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "php, object-oriented, random, file-system", "url": null }
neural-networks, convolutional-neural-networks, training Speaking in layman terms, even if you do all the sums of a single exercise given in a book, your performance might not be the same in a model paper. You do another exercise from another book, there is no guarantee your previous concepts will stick and you may do even worse in the model paper. Same thing is happening here where exercises are your training set and model papers are to evaluate your learning.
{ "domain": "ai.stackexchange", "id": 1068, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "neural-networks, convolutional-neural-networks, training", "url": null }
python, file, search, time-limit-exceeded Even if you are not able to load all of inSortedKey you would be much better of reading as large a chunk as you are comfortable with into memory, before doing a full read on the dataset. Say you read 100000 lines of inSortedKeys into memory, you would look at \$O(\frac{n}{100000} \cdot m \cdot p)\$ operations doing a slightly heavier operation each time. It would still be a massive improvement. Consider switching to databases If you're actually talking about cross-referencing 62 million keys against 160 millions lines in the dataset files, you should seriously consider using databases. Either permanently, or temporarily. You would most likely get a performance gain if you imported the entire set into a database, did your operations, and wrote the output rather than doing this with plain file operations. Python has excellent support for sqlite or pandas, in addition to multiple other modules and databases, which might help you.
{ "domain": "codereview.stackexchange", "id": 17209, "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, file, search, time-limit-exceeded", "url": null }
human-biology, neuroscience, neurophysiology, hearing, human-ear A CI is a medical device for treating severe-to-profound hearing loss. It bypasses the damaged hair cells in the cochlea, and restores activity in the auditory nerve by direct electrical stimulation of auditory nerve fibers (Fig. 1). CI is, however, not a first-line treatment for tinnitus and remains in the experimental phase for that purpose, at least as far as I know. Tinnitus has been mainly addressed as a secondary outcome to hearing performance after CI for treating deafness, although prospective randomized controlled trials with tinnitus relief being the primary outcome are underway (Assouly et al., 2021).
{ "domain": "biology.stackexchange", "id": 12053, "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": "human-biology, neuroscience, neurophysiology, hearing, human-ear", "url": null }
thermodynamics Title: Fugacity is effective pressure- what does 'effective' actually mean? I am trying to understand what fugacity really is. I asked a related question on chemistry stack exchange but am not satisfied with the answer. In many books, such as Physical Chemistry by Engel and Reid, Physical chemistry bh Castellan, etc. fugacity is called as effective pressure. My questions are a)What does the word 'effective' is trying to say? and b) If we already have various equation of states that have already accounted for intermolecular forces, then why is there a need for fugacity? I'm sorry if this is a stupid question but english is not my first language and maybe I am not interpreting fugacity correctly. So any help is appreciated! Fugacity = the pressure of an ideal gas with the same chemical potential as the real gas
{ "domain": "physics.stackexchange", "id": 96207, "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", "url": null }
optics, visible-light, experimental-physics, lenses Title: Using a collimating lens for beam interference If I have two beams of light which are incident on the same point of a collimating lens, will they emerge as a single beam and interfere? I've attached a drawing below: If not, what happens? No, they will not emerge as a single beam. See Thin Lens in Wikipedia for a better understanding of how a lens works. Your arrangement will produce two beams which may or may not overlap downstream from the lens. Where they do overlap, they will interfere if they are mutually conherent -- e.g., if both beams are derived from the same laser-- and if everything in the setup holds still.
{ "domain": "physics.stackexchange", "id": 56044, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "optics, visible-light, experimental-physics, lenses", "url": null }
javascript, html, event-handling, dom, to-do-list var allRows = table.querySelectorAll("tr"); Just as the code utilizes table methods like insertRow(), the property rows could be used instead: var allRows = table.rows; That way there is no DOM query each time the button is clicked. If there was in fact a need to get all elements with tag name tr, the method Element.getElementsByTagName() could be used, and since it "returns a live HTMLCollection of elements"1 that could happen outside the click handler (e.g. where the other elements fetched by Id are stored). For more information about the differences refer to answers to this post from 2010 which (at the time) claimed “querySelectorAll("a") is a shocking 98% slower than getElementsByTagName("a")”, as well as answers to What is the difference between querySelector and getElementsByTagName? like Quentin's answer plus this jsPerf test. inline onfocus handler vs Javascript The markup contains the text input element with the onfocus attribute:
{ "domain": "codereview.stackexchange", "id": 31396, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, html, event-handling, dom, to-do-list", "url": null }
square and take mean of the numbers then finally take the square root, but rms is again a complex number which has its magnitude and phase. ans = 5 + 4i. We pointed out the need to review operations with complex numbers, which are essential for this class. Complex numbers: 1+2j, 1+2i Constants: pi, i, j Precedence: Left to right, with ^before *and / , before +and – Parentheses may be used. For comparison, the Matlab’s FFT implementation computes the complex DFT and its inverse as. The following Matlab project contains the source code and Matlab examples used for largest lyapunov exponent with rosenstein's algorithm. Identification and Sorting of Power Quality Disturbances Using Matlab with GUI Miss. Complex Numbers. In other words, if we add two elements of the set , we still get a matrix in. using % a) standard plotting and complex number capabilities, % b) standard plotting and complex number capabilities for generating Bode plots, and % c) built in Bode plot function. The DFT
{ "domain": "iwen.pw", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9664104962847373, "lm_q1q2_score": 0.8010951692235778, "lm_q2_score": 0.8289388125473629, "openwebmath_perplexity": 737.8790262700554, "openwebmath_score": 0.6594741940498352, "tags": null, "url": "http://yzkr.iwen.pw/phase-of-complex-number-matlab.html" }
quantum-algorithms, bernstein-vazirani-algorithm CMSC 33001: Novel Computing Architectures and Technologies (Lecture 8) Lecture 18, Tues March 28: Bernstein-Vazirani, Simon (Scott Aaronson) Lecture 4: Elementary Quantum Algorithms (Dieter van Melkebeek) CSE 599d - Quantum Computing: The Recursive and Nonrecursive Bernstein-Vazirani Algorithm (Dave Bacon) The whole point of an oracle-based algorithm is that it does depend on the promised structure of the oracle. For Bernstein-Vazirani, it is assumed that the oracle acts as $$ |x\rangle|y\rangle\rightarrow |x\rangle|y\oplus (x\cdot s)\rangle. $$ That is the fundamental starting point (and is just the reversible implementation of $x\cdot s$). If you didn't have an oracle that did this, all bets would be off (this is one of the key reasons why we haven't proven that quantum computation is faster that classical - the only proven speedups are with respect to specific oracles, but that can never eliminate the possibility of different oracles offering different results).
{ "domain": "quantumcomputing.stackexchange", "id": 707, "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-algorithms, bernstein-vazirani-algorithm", "url": null }
java, datetime, collections, stream }, "dueDate": { "dateValue": "2017-09-24", "formattedValue": "24 Eylül 2017" }, "paymentAmount": { "numberValue": 273, "formattedValue": "273", "numberValueInUsd": 61.04, "formattedValueInUsd": "62" }, "receiptNo": "7212680", "expectedAmount": { "numberValue": 273, "formattedValue": "273", "numberValueInUsd": 61.04, "formattedValueInUsd": "62" }, "investmentDate": { "dateValue": "2017-10-13", "formattedValue": "13 Ekim 2017" }, "investmentAmount": { "numberValue": 252.53, "formattedValue": "253", "numberValueInUsd": 56.46, "formattedValueInUsd": "57" }, "presentValue": {
{ "domain": "codereview.stackexchange", "id": 31146, "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, datetime, collections, stream", "url": null }
formal-languages, context-free, formal-grammars Title: Context-Free Languages where every rule produces at most one non-terminal Consider a context-free grammar where all rules produce at most one non-terminal (i.e., there is at most one non-terminal on the right-hand side of a rule). What is the class of languages which are accepted by such a grammar? If you like, we may assume that all rules are one of the following forms, where $V, V'$ denote non-terminals and $a$ denotes a terminal: (i) $V \to aV'$ (ii) $V \to V' a$ (iii) $V \to \epsilon$ If all rules are of the form (i) or (iii) we get the class of regular languages. On the other hand, we can also recognize more languages, such as the language of palindromes.
{ "domain": "cs.stackexchange", "id": 9010, "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, context-free, formal-grammars", "url": null }
vba, excel Next Loop1 '-- All Done -- MsgBox "All 837 files fixed and saved to the same folders as the source files with " & """" & "Fixed" & """" & "added to their filenames. No original files have been modified." Cancel: Application.StatusBar = False Application.ScreenUpdating = True Application.Calculation = xlAutomatic End Sub classUserSettings Private pstrCorrectionType As String Private pstrOnOffSwitch As String Private pstrSettingsSheet As String 'pstrCorrectionType Properties Public Property Get strCorrectionType() As String strCorrectionType = pstrCorrectionType End Property Public Property Let strCorrectionType(Value As String) pstrCorrectionType = Value End Property 'pstrSwitch Properties Public Property Get strOnOffSwitch() As String strOnOffSwitch = pstrOnOffSwitch End Property Public Property Let strOnOffSwitch(Value As String) pstrOnOffSwitch = Value End Property
{ "domain": "codereview.stackexchange", "id": 24551, "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": "vba, excel", "url": null }
ros, moveit, ros-melodic, ros-industrial, fanuc [ INFO] [1565172177.906114609]: manipulator[RRTConnect]: Created 4 states (2 start + 2 goal) [ INFO] [1565172177.907610677]: manipulator[RRTConnect]: Created 5 states (3 start + 2 goal) [ INFO] [1565172177.910517308]: manipulator[RRTConnect]: Starting planning with 1 states already in datastructure [ INFO] [1565172177.912450371]: manipulator[RRTConnect]: Created 5 states (2 start + 3 goal) [ INFO] [1565172177.912538473]: manipulator[RRTConnect]: Starting planning with 1 states already in datastructure [ INFO] [1565172177.917328668]: manipulator[RRTConnect]: Created 5 states (2 start + 3 goal) [ INFO] [1565172177.917736005]: ParallelPlan::solve(): Solution found by one or more threads in 0.014191 seconds [ INFO] [1565172177.918004493]: manipulator[RRTConnect]: Starting planning with 1 states already in datastructure [ INFO] [1565172177.918686618]: manipulator[RRTConnect]: Starting planning with 1 states already in datastructure
{ "domain": "robotics.stackexchange", "id": 33586, "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-melodic, ros-industrial, fanuc", "url": null }
computational-chemistry, density-functional-theory, quantum-chemistry Title: Why do we integrate square of wave function over N-1 electron coordinates? Quote form F.Jensen's Introduction to computational chemistry: "The electron density is the square of the wavefunction, integrated over N-1 electron coordinates..." Why do we integrate over N-1 instead of N electorn coordinates? What would happen if we integrated over N coordinates? I suppose we would get a norm if we integrated over N coordinates, or 1 if wavefunction is normed. But why N-1? $\newcommand{\el}{_\mathrm{e}} \newcommand{\dif}{\mathrm{d}} \newcommand{\braket}[2]{\langle{#1}\vert{#2}\rangle}$Consider an $n$-electron system in an arbitrary electronic state represented by the electronic wave function $\psi\el(\vec{q}_{1}, \vec{q}_{1}, \dotsc, \vec{q}_{n})$, where $\vec{q}_{i}$ stands for joint spin-spatial coordinate of $i$-th electron, $\vec{q}_{i} = \{ m_{si}, \vec{r}_{i} \}$.
{ "domain": "chemistry.stackexchange", "id": 6407, "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": "computational-chemistry, density-functional-theory, quantum-chemistry", "url": null }
acid-base Title: Why are acid-base reactions so exothermic? If I mix sulfuric acid with sodium hydroxide, the solution really heats up. Could someone explain why acid-base reactions are exothermic from a molecular perspective? One can think of it as simply because of electrostatic attraction. Basically, an acid produces $\ce{H+}$ ions in water while a base produces $\ce{OH-}$ ions in water. So when you mix an acid and a base (e.g. sulfuric acid and sodium hydroxide) in a beaker, you get a solution containing $\ce{H+}$ and $\ce{OH-}$ ions. So, when these ions are far apart, there exists potential energy between them (because opposite charges attract each and want to come closer together). So when these ions come closer together, the attraction between them becomes strong enough that a bond forms between the ions to form $\ce{H2O}$. During this process, the initial potential energy between the ions decreases and is converted to heat energy. Hence this is why it is exothermic.
{ "domain": "chemistry.stackexchange", "id": 7835, "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": "acid-base", "url": null }
beginner, ruby, game, meta-programming I'd love to know which parts of it can be refactored, and changed to follow Ruby best practices, in the game and in the tests The code is also on Github here, but that'll probably get updated and no longer be the same as the code on this site. (and if you find any camel case methods, or variables please let me know, but I tried to remove all that, but I may have missed some. I know it's bad practice in Ruby, I was younger when I made much of this.) If you install if from the one-liner on github, you don't have to enter your correct password, but if you do it'll add a really outdate manual page. Sorry, the installer and updater don't work on Windows and probably not Linux either. I don't have a way to test that.
{ "domain": "codereview.stackexchange", "id": 7028, "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": "beginner, ruby, game, meta-programming", "url": null }
rosbag Title: Playing back large files with rosbag Does rosbag read the whole bag file or a large portion of it before playing? Often when I play back a large bag file it can take a long time before the playback starts.
{ "domain": "robotics.stackexchange", "id": 6368, "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": "rosbag", "url": null }
thermodynamics, particle-physics, home-experiment, experimental-technique, condensation The problem for now is that condensation is produced on the lower part of the plexiglass when the chamber is running. I've tried insulating the juncture of the bottom part using some kind styrofoam, as it is possibile to see in the photo, but the result is the same. Is there a way to completely prevent condensation on the wall of the plexiglass? P.S.: Thank you in advance for any answer and please excuse my English, as I'm still practicing it. First, just try a small fan, a simple stream of air. If that doesn't work, you'll have to go further... In grocery stores in summer they have a "waterfall" of cold air to walk through that prevents a larger scale loss of air conditioned air through big time convection. You can copy them. Before you go that far, though, try something simpler first. You can use a tray of desiccant to produce some very dry air, which you would then use to make a thin stream of air. Just blowing this dry air on the surface that you want to keep dry may work.
{ "domain": "physics.stackexchange", "id": 95232, "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, particle-physics, home-experiment, experimental-technique, condensation", "url": null }
java, algorithm, combinatorics // return final value, our result if no duplicates occur during the // process return arr[size - 1][0]; } } Style In Java it is common practice to have class names to use PascalCase (a.k.a. UpperCamelCase). Also the name spaceship doesn't make sense to me and is confusing. Also, why is the instance called kling? Readability I prefer to prefix my formal parameters with a for argument, for example aInputArray. I believe it would help readability of your code. Please prefer descriptive names. Currently I have no idea what x, co and res are. Nested for loops You are basically implementing a multi-byte counter. You can do something like this (not tested, but you get the idea): boolean incr(int[] co, int max, int min, int pos){ if(co[pos] + 1 > max){ co[pos] = min; if(pos == 0) return false; return incr(co, max, min, pos - 1); } else{ co[pos]++; return true; } } void solveAll(){
{ "domain": "codereview.stackexchange", "id": 14403, "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, algorithm, combinatorics", "url": null }
quantum-mechanics, general-relativity, special-relativity, black-holes Time paradox inside a black hole it is said on this site that this length contraction of the path in front of the muon leading to the singularity is really a rotation in spacetime It hasn't really been contracted, it's just that due to the rotation in spacetime we are viewing the two ends at different times. "Reality" of length contraction in SR But how could we do this rotation if the dimensions behave oddly? Just to clarify, there is very little chance that muons would enter the black hole, but for the sake of argument, lets assume that. Muons anyway are just an example, the main question is whether length contraction (caused by the relativistic speed of the particle) applies in the black hole on the path to the singularity. Question:
{ "domain": "physics.stackexchange", "id": 76273, "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, general-relativity, special-relativity, black-holes", "url": null }
c++, programming-challenge if (a.size() < b.size()) some_helper_function(a, b); else some_helper_function(b, a); This is clearer, and safer. Suggestions for fixing First, write test cases. Especially consider test cases that might be troublesome. Your function basically has two paths, one for when the two numbers have equal amounts of digits, and one for when they don’t. So you probably need (at least) three test cases: TEST_CASE("equal values") { // ... } TEST_CASE("unequal values with the same digit count") { // ... } TEST_CASE("unequal values with different digit counts") { // ... } In the latter case, you should check a bunch of of cases, but especially some cases where the short value is repeated one or more times, like: 1 and 11 1 and 1111111 12 and 1212 12 and 12121212 21 and 2121 21 and 21212121 And you should check cases where the short value is repeated, then followed by something that will make it sort before or after, like:
{ "domain": "codereview.stackexchange", "id": 40688, "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++, programming-challenge", "url": null }
Below that I calculate the return under the assumption of realized forwards. Specifically, the first $10.00 coupon is reinvested at the original F(1,3) = 4.01% and the second$10.00 coupon is reinvested at the original F(2,3) = 5.03%. This bond returns 3.0%; i.e., the original 3-year spot rate. This confirms Tuckman's "Which of the following two strategies is more profitable, rolling over one-period bonds or investing in a long-term bond and reinvesting coupons at prevailing short-term rates? As just demonstrated, if forward rates are realized, the two strategies are equally profitable" and shows how a realized forward is different than -- in this case of the upward sloping spot rate curve, more profitable than -- realizing the yield. This is intuitive: yield is a single factor, a (complex) average of the spot rates; it's not realistic to expect it to stay constant if the forwards are realized in a non-flat curve. Great question on your part, I hope that helps! #### filip313
{ "domain": "bionicturtle.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9372107878954105, "lm_q1q2_score": 0.8254925278264992, "lm_q2_score": 0.8807970826714613, "openwebmath_perplexity": 1766.9848980116096, "openwebmath_score": 0.686928391456604, "tags": null, "url": "https://www.bionicturtle.com/forum/threads/interpretation-of-yield-to-maturity.13395/" }
# Problem to find arithmetic mean of the largest elements of $r$-subsets of ${1,2,…,n}$ Let $$1\le r\le n$$ and consider all $$r$$-element subsets of the set $$\{1,2,...,n\}$$. Each of these subsets has a largest element. Let $$H(n,r)$$ denote the arithmetic mean of these largest numbers. Find $$H(n,r)$$ and simplify your result. I have made the following attempt, but get stuck: Possible largest elements in $$r$$-element subsets are: $$\{r, r+1,\ldots,n-1,n\}$$ If $$r$$ is the largest elements, other elements must be taken from the $$r-1$$ elements $$\lt r$$. Their sum of given by: $$r{r-1 \choose r-1}$$ Similarly, summing over $$\{r, r+1,...,n\}$$ gives: $$r{r-1 \choose r-1} + (r+1){r \choose r-1}+\cdots+n{n-1 \choose r-1}$$ Dividing the above expression by $${n \choose r}$$ should give me their arithmetic mean. But I know not how to simplify the expression... All help is greatly appreciated! Thanks you!
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.976310532836284, "lm_q1q2_score": 0.8114537057924728, "lm_q2_score": 0.8311430415844384, "openwebmath_perplexity": 349.7637264254024, "openwebmath_score": 0.8971453905105591, "tags": null, "url": "https://math.stackexchange.com/questions/3303126/problem-to-find-arithmetic-mean-of-the-largest-elements-of-r-subsets-of-1-2" }
NB: For convenience I write $p$ instead of your $p^*$. Now the probability in question is $1-P(X_1=0,...,X_N=0)$, which equals $1-(1-p)^N$ if all the $X_i$ are mutually independent. Theorem: Suppose $(X_1,...,X_N)$ is distributed on $\{0,1\}^N$ such that $P(X_i=1)=p\in(0,1)$ for all $1\le i\le N$, and $P(X_i=1\mid X_j=1)\ge p$ for all $1\le i\lt j\le N$. If $N=2$, then $$1-P(X_1=0,...,X_N=0) \le 1-(1-p)^N$$ but if $N\ge 3$, then the preceding inequality holds for some distributions and fails for others. Proof: Note that because $P(X_i=1\mid X_j=1)\ge p$, the correlation coefficient between any two distinct $X_i$ and $X_j$ is nonnegative: \begin{align}\rho_{ij} &=\frac{E(X_iX_j)-(EX_i)(EX_j)}{E(X_iX_i)-(EX_i)(EX_i)}=\rho_{ji}\\ \\ &= \frac{E(X_iX_j)-p^2}{p-p^2}\\ &\ge 0 \end{align} because $$EX_iX_j = P(X_i=1,X_j=1) = P(X_i=1\mid X_j=1)P(X_j=1)=P(X_i=1\mid X_j=1)\cdot p\ge p^2.$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.993096161928778, "lm_q1q2_score": 0.8441031104085488, "lm_q2_score": 0.8499711737573762, "openwebmath_perplexity": 254.82835083035135, "openwebmath_score": 0.9992597699165344, "tags": null, "url": "https://math.stackexchange.com/questions/2113686/probability-of-at-least-one-boolean-random-variable-being-true-in-a-network-of-p" }
quantum-mechanics, quantum-entanglement, linear-algebra, density-operator, epr-experiment $$\lvert \Psi \rangle=\frac{1}{\sqrt{2}}(\lvert00\rangle+\lvert11\rangle).$$ This is similar to the state you write in your post. We can then compute the density operator $\lvert \Psi \rangle \langle \Psi \lvert$ and trace out of subsystem 2. This will result in a maximally mixed state $$\frac{1}{2}(\lvert 0 \rangle_1 \langle 0 \lvert_1 + \lvert 1 \rangle_1 \langle 1 \lvert_1) \tag{1}$$ because $\lvert \Psi \rangle$ is maximally entangled. Importantly, (1) is a mixed state, so it is a statistical mixture of pure states of particle 1. We can see in this more concrete example that each pure state composing this mixed state is an eigenstate of $\hat{S}_z$. However, I would think this mixed state is not an eigenstate of an observable (Spin-z, etc.) of system 1 since all of these observables have pure states as their eigenstates.
{ "domain": "physics.stackexchange", "id": 94485, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, quantum-entanglement, linear-algebra, density-operator, epr-experiment", "url": null }
ros Originally posted by bub102x on ROS Answers with karma: 11 on 2012-04-03 Post score: 1 That looks like perfectly normal output - you may not get any further output in the terminal if the driver is running properly. You can verify that the driver is output point clouds by checking the /camera/rgb/points topic. To do that, in a separate terminal (while leaving the one the driver is running in open), you would run: rostopic hz /camera/rgb/points
{ "domain": "robotics.stackexchange", "id": 8851, "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", "url": null }
Please feel free to ask about any parts of the derivation that aren't clear. I skipped some of the details, assuming you were ultimately after a working formula. #### LCKurtz ##### Junior Member Here's another way to look at the problem of finding the angle $$\displaystyle \theta$$. Consider the following picture: The right triangle is inscribed in the circle with diameter $$\displaystyle \frac d 2$$ centered at $$\displaystyle \frac d 4$$. You can get $$\displaystyle \theta$$ from $$\displaystyle \cos\theta = \frac r {\frac d 2} = \frac {2r} d = \frac D d$$ where $$\displaystyle D$$ is the diameter of the ball. All you need is the diameter of the ball and the distance between their centers. ##### New member Interesting, LCKurtz. So the angle that represents half of the range I'm seeking is arccosine=D/d ? #### LCKurtz ##### Junior Member Interesting, LCKurtz. So the angle that represents half of the range I'm seeking is arccosine=D/d ? Yes. #### Dr.Peterson
{ "domain": "freemathhelp.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9852713857177955, "lm_q1q2_score": 0.8167296862682467, "lm_q2_score": 0.828938806208442, "openwebmath_perplexity": 561.208267268756, "openwebmath_score": 0.5751477479934692, "tags": null, "url": "https://www.freemathhelp.com/forum/threads/formula-for-angle-range-of-equal-circles-colliding.116140/" }
javascript, html this is the result when I press the back button and run the function again the codes for more detail: function detail(kodenegara, koderesult) { $.ajax({ type: "GET", contentType: "application/json; charset=utf-8", url: "http://10.80.3.73/webservice/Service1.svc/json/weeklyflash/"+kodenegara, dataType: "json", success:function(data){ var result = koderesult; maks = -1; for(i = 0; i < data[result].length; i++) { if(data[result][i].bulan > maks) maks = data[result][i].bulan; } var loop_tipe = countTypesForBulan(data[result], maks); var innerHtml = "";
{ "domain": "codereview.stackexchange", "id": 2003, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, html", "url": null }
c++, beginner, primes class PrimeGenerator{ PrimeList *primes; public: PrimeGenerator(); ~PrimeGenerator(); PrimeList *getPrimes(); void addPrime(); }; PrimeGenerator::PrimeGenerator(){ primes = new PrimeList; primes->push_back(2); primes->push_back(3); } PrimeGenerator::~PrimeGenerator(){ delete primes; } void PrimeGenerator::addPrime(){ unsigned long long int num = primes->back()+2; while(true){ bool isPrime = true; for(auto it=primes->begin(); it!=primes->end(); ++it){ if(*it > (num / 2)) break; if((num % *it) == 0){ isPrime = false; break; } } if(isPrime){ primes->push_back(num); break; } num += 2; } }
{ "domain": "codereview.stackexchange", "id": 5404, "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, primes", "url": null }
python, python-3.x, rest, framework, cryptocurrency def sign(self, url, endpoint, endpoint_path, method_verb, *args, **kwargs): nonce = self.nonce() try: params = kwargs['params'] except KeyError: params = {} params = json.dumps(params) # sig = nonce + url + req data = (nonce + endpoint_path + params).encode('utf-8') h = hmac.new(self.secret.encode('utf8'), data, hashlib.sha256) signature = h.hexdigest() headers = {"ACCESS-KEY": self.key, "ACCESS-NONCE": nonce, "ACCESS-SIGNATURE": signature} return url, {'headers': headers} class GdaxAuth(AuthBase): def __init__(self, api_key, secret_key, passphrase): self.api_key = api_key.encode('utf-8') self.secret_key = secret_key.encode('utf-8') self.passphrase = passphrase.encode('utf-8')
{ "domain": "codereview.stackexchange", "id": 23853, "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, rest, framework, cryptocurrency", "url": null }
c#, authorization [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public class Principal { internal IRbacSession Session { get; private set; } internal IPrincipal User { get; private set; } internal Principal(IRbacSession session, IPrincipal user) { Session = session; User = user; } public UserRole A(string role) { return new UserRole(this, role) { Result = Session.Query.IsUserInRole(User, role) }; }
{ "domain": "codereview.stackexchange", "id": 18007, "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#, authorization", "url": null }
quantum-mechanics, symmetry, schroedinger-equation $$ \frac{d \langle Q\rangle_t}{dt} = \frac i \hbar \langle [H,Q] \rangle_t + \langle \frac{\partial Q}{\partial t} \rangle_t.$$ Here $\langle O \rangle_t$ is the time-dependent expectation value of the operator $O$ (not necessarily hermitian) defined as $\langle \psi(t) | O | \psi(t) \rangle$, and $Q$ is a particular operator of interest. In quantum mechanics if you have a symmetry it will manifest as a unitary or antiunitary operator $Q$ by Wigner's theorem. For simplicity I'll consider only the unitary case. In the case of a continuous symmetry we can and often do consider instead the generator of the symmetry which is hermitian but this is not necessary for the argument. If the symmetry is respected by the dynamics (so that $[H,Q] = 0$) and is itself time-independent (so that $\frac {\partial Q}{\partial t} =0$) then the right hand side is $0$, so $\langle Q \rangle$ is a conserved quantity.
{ "domain": "physics.stackexchange", "id": 47776, "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, symmetry, schroedinger-equation", "url": null }
photons, noise, ligo When your plot labels the curve with "shot noise" it simply means that it is shot noise that determines the "height" of the curve at those frequencies (not the slope). For example, the shot noise is proportional to the square root of the laser power, so if you quadruple the laser power, the minimum detectable strain falls by a factor of 2 if shot noise dominates. This is the difference between the dashed curves and the solid curves at high frequencies.
{ "domain": "physics.stackexchange", "id": 80374, "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": "photons, noise, ligo", "url": null }
performance, programming-challenge, haskell, primes So it is possible to make a sieve using lists that is quite a bit faster than the one I posted. I find it useful to have the infinite list version for use in other Project Euler problems so I can avoid issues with setting the upper bound incorrectly. As far as my SoS code goes I'm not sure why it's so much worse than the SoE but I'm guessing it has to do with the double map in marked. One last thing to note is the original uses much more memory (1.7GB for N=100k) than the other solutions.
{ "domain": "codereview.stackexchange", "id": 12355, "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": "performance, programming-challenge, haskell, primes", "url": null }
turtlebot Original comments Comment by Hyon Lim on 2011-10-12: In tutorial, there is a command that "service turtlebot start". But why the turtlebot service script is not exist? Turtlebot iso file does not include it. i know upstart is for starting turtlebot service in boot period. But what if I want to stop turtlebot service, howw can I do it? Comment by tfoote on 2011-10-11: Things in /etc/init are used for upstart. Things in /etc/init.d are used for init rc process management. You definitely don't want both. Comment by Hyon Lim on 2011-10-11: How can I use latest version? Do I need to compile it? Comment by Hyon Lim on 2011-10-11: Hi. The "turtlebot.conf" file exist in /etc/init However, there is no script on /etc/init.d In Google, there are mentions about upstart. I think turtlebot.conf file is related to upstart. But for the service, I think there should be turtlebot script file in /etc/init.d Is this correct? Comment by fergs on 2011-10-11: This is fixed in trunk, just not in debs.
{ "domain": "robotics.stackexchange", "id": 6927, "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": "turtlebot", "url": null }
evolution, population-dynamics, marine-biology, landscape-ecology That said, dolphins too are plenty intelligent. Octopus also are quite good puzzle solvers.. but are short lived. As for predator -prey ratio https://www.mcgill.ca/newsroom/channels/news/why-arent-there-more-lions-254873 Here is something to read. Predator-prey ratio appear to be govern by the rate of growth of prey items And prey in the ocean has a faster turn around in the ocean.. so there are more predators in the ocean than on land. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4240998/.
{ "domain": "biology.stackexchange", "id": 6450, "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, population-dynamics, marine-biology, landscape-ecology", "url": null }
What is the average value of $f(x)=\sin(x)$ over $[0, \pi]$? $~ \text{average} = \frac{1}{\pi-0} \int_0^\pi \sin(x) dx = \frac{1}{\pi} (-\cos(x)) \big|_0^\pi = \frac{2}{\pi} ~$ Visually, we have: using CalculusWithJulia using Plots plot(sin, 0, pi) plot!(x -> 2/pi, 0, 2pi) ##### Example What is the average value of the function $f$ which is $1$ between $[0,3]$, $2$ between $(3,5]$ and $1$ between $(5,6]$? Though not continuous, $f(x)$ is integrable as it contains only jumps. The integral from $[0,6]$ can be computed with geometry: $3\cdot 3 + 2 \cdot 2 + 1 \cdot 1 = 14$. The average then is $14/(6-0) = 7/3$. ##### Example What is the average value of the function $e^{-x}$ between $0$ and $\log(2)$? $~ \text{average} = \frac{1}{\log(2) - 0} \int_0^{\log(2)} e^{-x} dx = \frac{1}{\log(2)} (-e^{-x}) \big|_0^{\log(2)} = -\frac{1}{\log(2)} (\frac{1}{2} - 1) = \frac{1}{2\log(2)}. ~$ Visualizing, we have plot(x -> exp(-x), 0, log(2)) plot!(x -> 1/(2*log(2)), 0, log(2))
{ "domain": "juliahub.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9902915238050521, "lm_q1q2_score": 0.8096370694521633, "lm_q2_score": 0.817574471748733, "openwebmath_perplexity": 113.51380834917138, "openwebmath_score": 0.9426450133323669, "tags": null, "url": "https://juliahub.com/docs/CalculusWithJulia/AZHbv/0.0.5/integrals/mean_value_theorem.html" }
You can clearly see a 3-cycle in the light area towards the right; yet we know that if there is a 3-cycle in that slice then there must be a cycle of any period in that slice... so where are they? (The other cycles are there of course, but they are repelling and hence are not visible. You can see artifacts from these repelling cycles near the period-doubling bifurcations in this picture) - Here's a relevant back-and-forth about the use of the term 'chaos' in the AMS Notices (in response to Freeman Dyson's 'Birds and Frogs'): ams.org/notices/200906/rtx090600688p.pdf ams.org/notices/200910/rtx091001232p.pdf –  Mike Hall Aug 8 '11 at 0:17 Here are mistakes I find surprisingly sharp people make about the weak$^{*}$ topology on the dual of $X,$ where $X$ is a Banach space. -It is metrizable if $X$ is separable. -It is locally compact by Banach-Alaoglu.
{ "domain": "mathoverflow.net", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9425067179697695, "lm_q1q2_score": 0.8238236723506055, "lm_q2_score": 0.8740772417253256, "openwebmath_perplexity": 365.97164296974563, "openwebmath_score": 0.8702539205551147, "tags": null, "url": "http://mathoverflow.net/questions/23478/examples-of-common-false-beliefs-in-mathematics/61600" }
dimensional-analysis, units, absolute-units so it seems I have my numbers right. What has been bothering me is the units. More specifically, how does $$1s = 1.17 \times 10^{-51} kg\cdot m^2 \implies 1s \cong 8.522668 \times 10^{50} ~kg^{-1}?$$ How does the $m^2$ disappear? My guess is that from the relation $c = 1$ we conclude that $[L] = [T]$ and so $$1s = 1.17 \times 10^{-51} kg\cdot m^2 = 1.17 \times 10^{-51} kg\cdot s^2\\ \implies \big(1.17 \times 10^{-51}\big)^{-1} kg^{-1} = 8.52 \times 10^{50} ~kg^{-1} = 1~s. $$ But how does it physically make sense to say that $[L] = [T]$? Even with the condition $c = 1$ we still must have units on $c$ right? Put differently, how is it allowed to take $c$ to be a unitless number? If we take 1 $m_c$ (where $m_c$ denotes meters in this new unit system) to be $3 \times 10^8 m$ so that $c = 3 \times 10^8 m / s$, we still would have $c = m_c/s$, and not unitless. I'm not sure what the question's physically requires, so I'll explain it mathematically.
{ "domain": "physics.stackexchange", "id": 91348, "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": "dimensional-analysis, units, absolute-units", "url": null }
deviation is just a weighted average between the two groups. When considering standard deviations, it may come as a surprise that there are actually two that can be considered. To calculate standard deviation in Excel, you can use one of two primary functions, depending on the data set. What is standard deviation? Lower standard deviation concludes that the values are very close to their average. Population vs. Population standard deviation of grades of eight students. The wider the range, which means the greater the standard deviation, the riskier an investment is considered to be. If you were finding difficult to calculate the standard deviation then use this population standard deviation calculator with ease. When the data size is small, one would want to use the standard deviation formula with Bessel’s correction (N-1 instead of N) for calculation purpose. Standard Deviation - Population Formula. The standard deviation (SD) measures the amount of variability, or dispersion, from
{ "domain": "tokocase.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.975576914916509, "lm_q1q2_score": 0.8043260247044693, "lm_q2_score": 0.8244619285331332, "openwebmath_perplexity": 390.95259407910424, "openwebmath_score": 0.8247133493423462, "tags": null, "url": "https://tokocase.com/61s0qt8/population-standard-deviation-9f9839" }
c++, beginner, object-oriented, game You can simplify all of this by simply using an array of size x. This way when you need a specific team, you just need to slice from it, since you have used names like oner, ones, prospect1, and onet, I have no idea what they really do, since all of them are initialized to 0 and the names don't help too much. Here is what an array used in this would look like constexpr int number_of_prospects = 10; std::string prospects[ number_of_prospects ]; prospects[ 0 ] = " Prospect 1 "; std::cout << prospects[0]; Prospect 1 This is an example of readable code, when someone sees std::string prospects[ number_of_prospects], he knows exactly what it is. Does a person know exactly what your program is doing at some points the second he reads it? The same array can be applied for all the threads of globals you have, just a simple array of size 10 can work. Even in your class Team string week1, week2, week3, week4, week5, week6, week7, week8, next; Simply do std::string weeks[ number_of_weeks ];
{ "domain": "codereview.stackexchange", "id": 39714, "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 }
waves, acoustics, thought-experiment edit: This question probably applies in a similar way to light. Not quite sure what the right tags should be for this No, but it can sound like it. If there are two sounds that have similar frequencies, we will only hear the loudest one (this phenomenon is used to help compress music files). This is caused auditory masking. Now, if you have a loud sound far away, and a less loud sound close to you, the one close to you will sound louder, and will mask the farther away one. If you move away from both of them, then because of the inverse square law the near sound will get softer faster than the far-away one, so the far-away sound will no longer be masked. This may sound to you like the farther-away sound is getting louder as you move away from it. (Even though it isn't in reality.)
{ "domain": "physics.stackexchange", "id": 14591, "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": "waves, acoustics, thought-experiment", "url": null }
javascript, jquery, css, html5, to-do-list Title: Web ToDo application in JavaScript, HTML, CSS I would like to share with you the code from the application I just finished. It is a web application written in HTML, CSS, JavaScript and jQuery. It uses LocalStorage to store your tasks. The application also displays the date of adding and completing the task. You can add, edit, delete and mark tasks as done. I would ask for some code review. I do not know good practices in JavaScript yet so I need help from specialists. The application works fully and can be tested here. The whole code (if it is illegible here) can be found on my GitHub here.
{ "domain": "codereview.stackexchange", "id": 30796, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, jquery, css, html5, to-do-list", "url": null }
In matrix form, we have $$D = [d(x_i, x_j)^2]$$ $$= \begin{pmatrix} 0 & \langle x_1,x_1\rangle + \langle x_2, x_2\rangle - 2\langle x_1, x_2\rangle & \cdots & \langle x_1,x_1\rangle + \langle x_n, x_n\rangle - 2\langle x_1, x_n\rangle \\ \langle x_2,x_2\rangle + \langle x_1, x_1\rangle - 2\langle x_2, x_1\rangle & 0 & \cdots & \langle x_2,x_2\rangle + \langle x_n, x_n\rangle - 2\langle x_2, x_n\rangle \\ \vdots & \vdots & \ddots & \vdots \\ \langle x_n,x_n\rangle + \langle x_1, x_1\rangle - 2\langle x_n, x_1\rangle & \langle x_n,x_n\rangle + \langle x_2, x_2\rangle - 2\langle x_n, x_2\rangle & \cdots & 0 \end{pmatrix}$$ Which can be written as
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9820137858267906, "lm_q1q2_score": 0.80514656309631, "lm_q2_score": 0.8198933403143929, "openwebmath_perplexity": 233.94493791408792, "openwebmath_score": 0.9142086505889893, "tags": null, "url": "https://math.stackexchange.com/questions/2240429/pairwise-distance-matrix" }
quantum-mechanics, quantum-entanglement, density-operator, decoherence, coherence In other words, the purity of a density operator is basis-independent, in contrast to the appearance of off-diagonal elements.
{ "domain": "physics.stackexchange", "id": 79029, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, quantum-entanglement, density-operator, decoherence, coherence", "url": null }
noise, sampling, least-squares, regression Question: Let there be $K$ samples spanning these $N$ seconds of measurement. Generally $K$ determines how accurate the estimate $\widehat{\boldsymbol{\theta}}$ is. Generally, the more $K$ you have the better your estimate should be. But if you increase $K$ while keeping the data within the given $N$ seconds, despite having more samples to fit, you also have measurement $y_i$ with the same noise variance $\sigma^2$. This will eventually lead to a 'noisier' data and consequently, a worse fit. So, in my toy example, if I take more samples within $N$ seconds, i.e. more $K$, the estimate is worse than if I would have taken fewer samples because the least-squares is trying to fit the noise rather than the signal. So the questions are:
{ "domain": "dsp.stackexchange", "id": 11493, "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": "noise, sampling, least-squares, regression", "url": null }
genetics, recombination, recombinant Your question stems from the confusion between measuring a recombination rate and the actual recombination rate. In the A/A, B/B individuals you describe, recombinations still occur. Those recombination just don't affect linkage disequilibrium between the Aa and the Bb loci as there is no variance at those loci in the individuals you considered. There is therefore, no way to tell whether or a recombination event occurred in a specific case. You need genetic variance at both loci in order to have a linkage disequilibrium which can be affected by recombination. But it is not because you can't measure the recombination rate that recombinations does not occur.
{ "domain": "biology.stackexchange", "id": 4479, "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": "genetics, recombination, recombinant", "url": null }
java boolean extractValidN = false; if(beansWithIndicatorY.size() > 0) { validRecords.addAll(getValidRecords(beansWithIndicatorY)); extractValidN = true; } else if(beansWithIndicatorNotValid.size() > 0) { extractValidN = true; } if(extractValidN) { validRecords.addAll(getValidRecords(beansWithIndicatorN)); } } else if(beansWithIndicatorY.size() > 0) {
{ "domain": "codereview.stackexchange", "id": 6699, "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", "url": null }
java, design-patterns, spring private List<Object> toList(Object findObject) { List<Object> objects = new ArrayList<>(); if (findObject instanceof List) { ((List) findObject).forEach(item -> objects.add(findObject)); } else { objects.add(findObject); } return objects; } }
{ "domain": "codereview.stackexchange", "id": 31365, "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, design-patterns, spring", "url": null }
context-free, kleene-star Title: Why do we need two variables for implementing kleene star operation on a language using context free grammars? I have a Context-Free Grammar (CFG) G which has a S for generating a language L. Now to produce a grammar for L*, another variable T (which is not present in the variable set of G) is taken and the grammar is produced in the following way: G' = (V, A, T, P) where, G'.V = G.V U {T} (V is the variable set) G'.A = G.A (A is the alphabet here, I was't able to insert the symbol of capital sigma here) G'.T is the starting variable G'.P = G.P U { T -> ST | NULL } (P is a finite relation from V to (A U V)* )
{ "domain": "cs.stackexchange", "id": 17161, "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": "context-free, kleene-star", "url": null }
rviz, urdf, ros-kinetic, collada, dae Original comments Comment by AlexROS on 2017-07-28: Still not working. I have tried the absolute path with the following line of code: marker.mesh_resource = "file://home/alex/catkin_ws/models/v1-01/model.dae"; It still does not work. Do i need any additional urdf file or so? Models ist just a file in which the model is stored, not a ros package Comment by gvdhoorn on 2017-07-28: Note the additional /: this may seem strange, but file:// (with two /) is the scheme, the path starts only after that. So for an absolute path, you need to have three consecutive forward slashes. Comment by AlexROS on 2017-07-28: Okay now the error has gone away. But the car is still not visible in rviz Comment by gvdhoorn on 2017-07-28: one thing to check: ROS uses meters for everything, so make sure your mesh is scaled to that as well (most exports from 3D modellers are in mm). Comment by AlexROS on 2017-07-28:
{ "domain": "robotics.stackexchange", "id": 28464, "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": "rviz, urdf, ros-kinetic, collada, dae", "url": null }
quantum-mechanics, operators, hilbert-space, quantum-information, density-operator Suppose now $P,Q$ are generic Hermitian matrices. Then for some unitary $U$ we have $$\|\sqrt P\sqrt Q\|_1 = \langle U, \sqrt P\sqrt Q\rangle = \langle \sqrt P U,\sqrt Q\rangle,$$ where we are using the Hilbert-Schmidt inner product: $\langle A,B\rangle\equiv \operatorname{tr}(A^\dagger B)$. Using Cauchy-Schwarz, we get the bound $$\|\sqrt P\sqrt Q\|_1 \le \|\sqrt P U\|_2 \|\sqrt Q\|_2 = \sqrt{\operatorname{tr}(\sqrt P UU^\dagger \sqrt P)} \sqrt{\operatorname{tr}(\sqrt Q\sqrt Q)},$$ where $\|A\|_2\equiv \sqrt{\operatorname{tr}(A^\dagger A)}$. In conclusion $$F(P,Q) = \|\sqrt P\sqrt Q\|_1^2 \le \operatorname{tr}(P) \operatorname{tr}(Q),$$ which gives the unit upper bound for normalized density matrices.
{ "domain": "physics.stackexchange", "id": 94607, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, operators, hilbert-space, quantum-information, density-operator", "url": null }
python, game, dice def main(): game_manager = GameManager() game_manager.play_game() main() The code works, but a few matters worry me. I am not happy with the global variables. What design pattern would help me with those? On a related matter, I am having a difficulty on how to implement “player turn” in object oriented manner. Where does it belong? Whose property is it? (Because I did not deal with it properly, the get_action and keep_rolling methods stink.) On yet another related matter, the code is poor in the sense that it is not immediately scalable. For example, if there were more than one human players, I would have to rethink some of the methods. This one is due to my poor knowledge. the HumanPlayer and ComputerPlayer classes are inherited from the Player class. In assign_score method, I had to deal with each case separately; how can I do, say, assign_score to Player (whether human_player or computer_player)?
{ "domain": "codereview.stackexchange", "id": 16790, "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, dice", "url": null }
equilibrium, redox, aqueous-solution Oxidation half-reaction $$\ce{Fe^{2+} -> Fe^{3+} + e-} \ \ \ E^\circ_{ox}= -0.77 \ \text{V}$$ Reduction half-reaction $$\ce{O2 + 4H+ + 4e- -> 2H2O} \ \ \ E^\circ_{red} = +1.229 \ \text{V}$$ Full balanced redox reaction $$\ce{4Fe^{2+} + O2 +4H+ -> 4Fe^{3+} + 2H2O}$$ Cell potential $$E^\circ_{cell}=E^\circ_{ox} + E^\circ_{red} = -0.77 \ \text{V} + 1.229 \ \text{V} = 0.459 \ \text{V}$$ Nernst Equation
{ "domain": "chemistry.stackexchange", "id": 1523, "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": "equilibrium, redox, aqueous-solution", "url": null }
algorithms, integers, rounding However, none of them will ensure the rule for sum, "the sum of output integers must be as close to the sum of original numbers as possible". For example, the nearest integer to $0.6$ and $0.7$ is $1$ but the nearest integer to their sum $0.6+0.7=1.3$ is $1$ instead of $1+1 =2$. Hence to satisfy the rule of sum, we cannot guarantee that each integer is mapped to its nearest integer. Let us pick one of the rounding methods as $\mathcal R$, which will specify the exact meaning of "as close as possible". For methods below, we will ensure that $$\mathcal R(\text{sum of input numbers})=\text{sum of output integers}$$ while trying to round integers to their respective nearest integers fairly. Offline Method Suppose numbers $a_1, a_2, \cdots, a_n$ are given. Let $\{a_i\}=a_i-\lfloor a_i\rfloor$ be the fractional part of $a_i$ and $s = \{a_1\} + \{a_2\} + \cdots + \{a_n\}$.
{ "domain": "cs.stackexchange", "id": 21799, "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, integers, rounding", "url": null }
matrix ) Graphs can be complicated... Algebra is one of the information about the graph inverses of matrices and the LDU decomposition to do this,! Matrix and Regular Graphs ( vertex matrix or its row-standardized counterpart––based upon an planar... Linear systems, Gaussian elimination, inverses of matrices and the LDU decomposition obtain more detailed information about the.... Nodes [ 1: ] ) ) 12.2.1 the adjacency matrix square matrix is the perfect.! Matrices of Graphs Proposition Let a be the adjacency matrix of a finite simple graph, the adjacency matrix vertex. The perfect tool 0 - 1 matrix or adjacency matrix the information about the graph in that matrix graph the. -Entry in A2 is the perfect tool in some areas the only way represent... Matrix which is below a diagonal of matrices and the LDU decomposition graph.... Below a diagonal way to represent Graphs called vertex matrix or its row-standardized counterpart––based upon an undirected planar.... ) ) 12.2.1 the adjacency
{ "domain": "insulinoopornosc.pl", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9693242000616579, "lm_q1q2_score": 0.8119252989491397, "lm_q2_score": 0.837619961306541, "openwebmath_perplexity": 950.8526806909368, "openwebmath_score": 0.673037052154541, "tags": null, "url": "http://insulinoopornosc.pl/hong-leong-qas/f986b5-adjacency-matrix-linear-algebra" }
c#, multithreading, cache public LinkedListNode<KeyValuePair<TKey, CacheValue>> IndexRef { get; set; } public TValue Value { get; set; } } private readonly LinkedList<KeyValuePair<TKey, CacheValue>> _IndexList = new LinkedList<KeyValuePair<TKey, CacheValue>>(); public int MaxSize { get; set; } public SizeLimitedCache(int maxSize) { MaxSize = maxSize; } protected override void UpdateElementAccess(TKey key, CacheValue cacheValue) { var value = cacheValue; // put element at front of the index list // remove first if already present in list, create new otherwise var idxRef = value.IndexRef; if (idxRef != null) { _IndexList.Remove(idxRef); } else { idxRef = new LinkedListNode<KeyValuePair<TKey, CacheValue>>(new KeyValuePair<TKey, CacheValue>(key, value)); value.IndexRef = idxRef; } _IndexList.AddFirst(idxRef);
{ "domain": "codereview.stackexchange", "id": 6204, "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#, multithreading, cache", "url": null }
atomic-physics This is the image you have in mind while asking your question. The ev on the side show how much energy the electron lost falling in the potential well of the proton. The Bohr atom was a useful model and is still shown because the solutions are the same in this primitive precursor of the quantum mechanical equations that need to be solved . Quantum mechanics is a theory from which the microcosm can be modeled , whereas the Bohr model was an ad hoc model that described the spectrum of the hydrogen atom. The difference lies that though the electron has a definite energy in the ground state, (n=1 in the plot) and has given up potential energy by falling down to it ( in the form of a photon seen in the spectral lines of Hydrogen) the wave referred in the figure ( wavelength given) has nothing to do with planetary like orbits.
{ "domain": "physics.stackexchange", "id": 17732, "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": "atomic-physics", "url": null }
c#, .net, winforms repo.Save(); MessageBox.Show("Se guardo el registro exitosamente.", "Exito!", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); this.Close(); } } private string FormatPhoneNumber(string p) { return p.Insert(3, "-"); } private void btnClear_Click(object sender, EventArgs e) { ClearForm(); } private void ClearForm() { Action<Control.ControlCollection> func = null; func = (controls) => { foreach (Control control in controls) if (control is TextBox) (control as TextBox).Clear(); else func(control.Controls); };
{ "domain": "codereview.stackexchange", "id": 1019, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, .net, winforms", "url": null }
ros, navigation, ros-kinetic, rosaria, pioneer Title: Sensor transforms on the Pioneer LX I'm currently working on the navigation of a Pioneer LX robot, and I wish to migrate from the ARNL system to ROSARIA and the ROS navigation stack. However, I'm relatively new to the ROS world and a bit overwhelmed by the information available, so I wish to clarify some things in order to avoid starting unnecessary tasks and/or research. My goal is to implement the navigation stack as a replacement for ARNL to achieve a system that is not reliant on legacy code from MobileRobots. This means I have to implement localization and autonomous navigation system. The figure at move_base tells me that I have to provide nodes from sensor transformations, odometry source etc. Since ROSARIA publishes sensor and odometry messages, I assume I only have to implement the sensor transformation node and optionally amcl. Question: Are there sensor transforms available for the Pioneer LX already or do I have to write them my self?
{ "domain": "robotics.stackexchange", "id": 33888, "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, navigation, ros-kinetic, rosaria, pioneer", "url": null }
Math Help - Equiv Class 1. Equiv Class My question is one aspect of the question below. I have already shown that the relation is reflexive, symmetric, and transitive. What is meant by, and how do I describe the corresponding partition on $\mathbb{Z}$? a ~ b if a-b is divisible by 3. Thank you. 2. How did you demonstrate te properties without the ability to describe the relation? Maybe 3|(a-b) or $(a-b) \equiv 0\;(mod\;3)$ Not too sure what you're looking for. 3. Originally Posted by TKHunny How did you demonstrate te properties without the ability to describe the relation? Maybe 3|(a-b) or $(a-b) \equiv 0\;(mod\;3)$ Not too sure what you're looking for. The books has $3\mathbb{Z}, \ 1+3\mathbb{Z}, \ 2+3\mathbb{Z}$ Not to sure about that above notation. 4. well, for a given integer, let's call it k, let us find out what [k], the equivalence class of k under ~ is. we have that if a is in [k], then k - a = 3m, for some integer m (k-a is divisible by 3).
{ "domain": "mathhelpforum.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.978384666922221, "lm_q1q2_score": 0.8335375620649115, "lm_q2_score": 0.8519528057272544, "openwebmath_perplexity": 812.0087054854569, "openwebmath_score": 0.5366793870925903, "tags": null, "url": "http://mathhelpforum.com/discrete-math/180785-equiv-class.html" }
matlab, wavelet, transform Title: CWT matlab function i'm trying to apply the cwt function from matlab in the first graph and from the different articles that i've read i should get something that shows different peaks to determine the location of damage, but all i'm getting is that spaghetti looking mess. is there a different approach to applying wavelet transform without using the built in function? thanks Trying to guess which signal you are analyzing, and the purpose, here is a demo, on a real signal, with half the Fourier spectrum, and the corresponding continuous wavelet transform scalogram. Here, I suspect that the signal is too short (without further objectives) for FFT and CWT to yield interpretable results. The Matlab code is: nsample = 64; % An odd number timeSampling = 1/nsample; time = (0:nsample-1)*timeSampling; ratioSecondHalf = 20; data = zeros(nsample,1); data(1:nsample/2,1) = rand(nsample/2,1)-0.5; data = medfilt1(data,5); data(nsample/2+1:end,1) = rand(nsample/2,1)/ratioSecondHalf;
{ "domain": "dsp.stackexchange", "id": 7285, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "matlab, wavelet, transform", "url": null }
## Fibonacci multiples I haven’t written anything here in a while, but hope to write more regularly now that the semester is over—I have a series on combinatorial proofs to finish up, some books to review, and a few other things planned. But to ease back into things, here’s a little puzzle for you. Recall that the Fibonacci numbers are defined by $F_0 = 0; F_1 = 1; F_{n+2} = F_{n+1} + F_n$. Can you figure out a way to prove the following cute theorem? If $m$ evenly divides $n$, then $F_m$ evenly divides $F_n$. (Incidentally, the existence of this theorem constitutes good evidence that the “correct” definition of $F_0$ is $0$, not $1$.) For example, $5$ evenly divides $10$, and sure enough, $F_5 = 5$ evenly divides $F_{10} = 55$. $13$ evenly divides $91$, and sure enough, $F_{13} = 233$ evenly divides $F_{91} = 4660046610375530309$ (in particular, $4660046610375530309 = 233 \times 20000200044530173$).
{ "domain": "mathlesstraveled.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9930961629504278, "lm_q1q2_score": 0.8401021866394492, "lm_q2_score": 0.8459424353665381, "openwebmath_perplexity": 880.8107777944282, "openwebmath_score": 0.6591745018959045, "tags": null, "url": "https://mathlesstraveled.com/2012/05/15/fibonacci-multiples/" }
quantum-field-theory, particle-physics, large-hadron-collider In general, any cross-section has peaks when the squared momentum "carried" by the interaction mediator is near the mass of the mediator (and so the mediator becomes to be "on-shell"). This is the main point of the answer, since for the first process the mediator, which is the photon, can be on-shell, while for the second process it can't be on-shell. Let's talk about this precisely. The scattering process $\mu e \to \mu e$ kinematically goes through the $t$-channel, while the annihilation process $e\bar{e} \to \gamma \gamma$ goes through the $s$-channel. Therefore, marking the ingoing particles by the momenta $k_{i}$ and the outgoing ones by $p_{i}$ (the electron has label $1$), we obtain that the electron-muon scattering contains the photon propagator with $$ D_{\mu\nu} \sim \frac{g_{\mu\nu}}{(p_{1}-k_{1})^{2}}, $$ while the electron-positron annihilation contains the one with $$ D_{\mu\nu} \sim \frac{g_{\mu\nu}}{(k_{1}+k_{2})^{2}} $$
{ "domain": "physics.stackexchange", "id": 43536, "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, particle-physics, large-hadron-collider", "url": null }
c++, algorithm, c++17, genetic-algorithm return std::min(population[firstRandomNumber], population[secondRandomNumber], [](const auto &lhs, const auto &rhs) { return lhs.getFitness() < rhs.getFitness(); }); } void Population::addBestPathsFromPreviousPopulationToNextPopulation(std::vector<Path> &newPopulation, int howManyPathFromOldPopulationToAdd) const { std::vector<Path> temp = population; std::sort(std::begin(temp), std::end(temp), [](const auto &lhs, const auto &rhs) { return lhs.getFitness() > rhs.getFitness(); }); std::copy_n(std::begin(population), howManyPathFromOldPopulationToAdd, std::back_inserter(newPopulation)); }
{ "domain": "codereview.stackexchange", "id": 32177, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, algorithm, c++17, genetic-algorithm", "url": null }
newtonian-mechanics, special-relativity, rotation Title: What happens to a body if it rotates extremely fast? I am thinking on a object, e.g. ball or planet that starts rotating with increasing speed. Let's assume that his speed get's closer to the speed of light, what happens to this object? There are several forces acting. But I always get caught thinking that it will get heavier and heavier because of the additional energy which is needed to accelerate it. Is that all? Or anything else interesting happens? A phenomenon which has been observed in stars and planets is that when the body rotates faster and faster, the object becomes more and more elongated, thus some points in the object are farther away from the rotation axis, increasing the relative moment of inertia and requiring more torque to accelerate the body by the same amount.
{ "domain": "physics.stackexchange", "id": 28405, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, special-relativity, rotation", "url": null }
electromagnetism, electromagnetic-radiation, magnetic-fields, electric-fields, maxwell-equations which indeed satisfy $\vec{E}_{\text{rad}}\cdot\vec{B}_{\text{rad}} = 0$. When the radiation enters region $R$, by the superposition principle, the fields are $\vec{E}_{\text{static}} + \vec{E}_{\text{rad}}$ and $\vec{B}_{\text{static}} + \vec{B}_{\text{rad}}$. Note that the fact that the magnet and insulator are fixed in place and the charges on the insulator are fixed as well is important here; this assumption is physically plausible and needed for our argument (otherwise the "static" fields will change). The result is \begin{align*} (\vec{E}_{\text{static}} + \vec{E}_{\text{rad}})\cdot (\vec{B}_{\text{static}} + \vec{B}_{\text{rad}}) &= \vec{E}_{\text{static}}\cdot\vec{B}_{\text{static}} + \underbrace{ \vec{E}_{\text{static}}\cdot\vec{B}_{\text{rad}} }_{\hat{z}\cdot\hat{y}=0} + \underbrace{ \vec{E}_{\text{rad}}\cdot\vec{B}_{\text{static}} }_{\hat{x}\cdot\hat{z}=0} + \underbrace{ \vec{E}_{\text{rad}}\cdot\vec{B}_{\text{rad}} }_{\hat{x}\cdot\hat{y}=0} \\
{ "domain": "physics.stackexchange", "id": 96912, "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, magnetic-fields, electric-fields, maxwell-equations", "url": null }
python, embedded, raspberry-pi def loop(): global catheters_processed, CATH_MODEL, \ JOB_SIZE, JOB_NUMBER, CAL_PASSED, \ end_job, cath_data_dict_unsorted_buffer, \ MODEL_SELECTED, CURRENT_PROCESS_MESSAGE, \ SHOW_LAST_CATH_GUI_MSG, REPEATED_CATHETER_DETECTED, \ KEYPAD_CATH_BARCODE, MANUAL_BARCODE_CAPTURED, \ MANUAL_CATH_BARCODE_CAPTURE, CATH_RES_SAMPLES_COLLECTED, \ PLAY_SOUND, PROCESS_MESSENGER_FONT, EXTERNAL_CAL_INPROGRESS, \ EXTERNAL_CAL_MEASURED_RES_VALS, EXTERNAL_CAL_USER_ENTERED_RES_VALS, \ dynamic_m_low_range, dynamic_b_low_range, dynamic_m_high_range, \ dynamic_b_high_range, initial_b_low_range, initial_m_low_range, \ initial_b_high_range, initial_m_high_range, \ CAL_REF_RESISTANCE_LOWRANGE_LOW, CAL_REF_RESISTANCE_LOWRANGE_HIGH, \ CAL_REF_RESISTANCE_HIRANGE_LOW, \ CAL_REF_RESISTANCE_HIRANGE_HIGH, CAL_FAIL
{ "domain": "codereview.stackexchange", "id": 44727, "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, embedded, raspberry-pi", "url": null }
c++, inheritance, interface Once you've done that, you might discover that "creating some workers for yourself" is an operation that would be useful in polymorphic contexts, when you don't know statically what kind of model you're dealing with. That would be the time to bring back the base class ModelABC, so that you could make addWorkers a virtual function: class ModelABC { virtual void do_addWorkers(int); public: void addWorkers(int n) { do_addWorkers(n); } }; class Model2 : public ModelABC { void addWorker(std::unique_ptr<Worker2>); void do_addWorkers(int n) override { for (int i=0; i < n; ++i) { addWorker(std::make_unique<Worker2>(this)); } } }; However, you should do that only if you need to call model.addWorkers(n) in a polymorphic context! If you are only ever calling addWorkers on an object whose dynamic type matches its static type — Model1 or Model2 — then you don't need polymorphism and virtual here.
{ "domain": "codereview.stackexchange", "id": 39553, "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++, inheritance, interface", "url": null }
teacher is right: if you prove that something true follows from A = B, i.e. A = B => true, you are not allowed to conclude the converse i.e. that A = B since "true is true" (because implication is not symmetric) I agree with @Siddharth Venu. If we have to prove a=b, At times, on proceeding from LHS you may end up in a stage(intermediate step) which you cannot solve any further and you continue to solve RHS to arrive at the same stage i.e, a=c and b=c so you can conclude that a=b these kind of equality problems often comes in trigonometry Many chapters like matrices and our normal algaebra always have a final step where you can directly establish a relation (a=b). There are two common errors that these methods are preventing: \begin{align} 1 &< 2 &&\text{True.} \\ 0 \cdot 1 &< 0 \cdot 2 &&\text{Um...} \\ 0 &< 0 &&\text{False.} \end{align} \begin{align} 1 &= 2 &&\text{False.} \\ 0 \cdot 1 &= 0 \cdot 2 &&\text{Um...} \\ 0 &= 0 &&\text{True.} \end{align} Much confusion ensues when the two
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9799765557865637, "lm_q1q2_score": 0.8852071480988408, "lm_q2_score": 0.903294209307224, "openwebmath_perplexity": 481.2578683796757, "openwebmath_score": 0.8332354426383972, "tags": null, "url": "https://math.stackexchange.com/questions/1763978/can-you-use-both-sides-of-an-equation-to-prove-equality" }
general-relativity, gravity, differential-geometry, covariance, equivalence-principle Definition. Suppose that we are given an equation such that The equation holds in the absence of gravity, i.e. in a frame where $g_{\alpha\beta} = \eta_{\alpha\beta}$ and $\Gamma^\alpha_{\beta\gamma} = 0$. The equation is generally covariant, that is, it preserves its form under a general coordinate transformation $x\rightarrow x'$. Then the principle of general covariance states that such an equation holds generally.*
{ "domain": "physics.stackexchange", "id": 94227, "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": "general-relativity, gravity, differential-geometry, covariance, equivalence-principle", "url": null }
dna, genomics, human-genome Now, I've omitted lots of details here: some genes encode RNA molecules, such as ribosomal RNAs, which are not translated into proteins; eukaryotic genes include stretches of sequence (called introns) that are spliced out of the transcript before the mRNA>protein step. The original definition (if there ever was a definition) of "junk" DNA included these introns, as well as regions of DNA lying outside the coding sequences. We now know that there is useful information stored in much of this DNA, even though it doesn't code for anything directly via the genetic code.
{ "domain": "biology.stackexchange", "id": 7911, "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": "dna, genomics, human-genome", "url": null }
homework-and-exercises, newtonian-mechanics, forces, free-body-diagram, string Title: Static Equilibrium Problem with 3 Tension Forces I had some trouble solving these. For the first one I assumed there wasn't a tension force on the 2nd mass, which gave me: $$FT_1.\cos A = FT_2.\cos D$$ and $$FT_1\sin A + FT_2\sin D = F.g$$ Not sure how to approach 2nd problem. It sounds like you are supposed to assume the masses are all stationary, and you are to find the ratios between the masses that will do that. You know the tension in every rope, each one is mg where m is the mass the string is attached to. That tension is preserved all along the string, so bring it back to the point where all the strings attach. Then say the forces all add up to zero at that central point, and that will give you the constraint on the mass ratios. For the first one, it's obvious that you need m_1 = m_3 from symmetry, but then m_2 depends on the angle at the center.
{ "domain": "physics.stackexchange", "id": 33706, "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, newtonian-mechanics, forces, free-body-diagram, string", "url": null }
quantum-mechanics, thermodynamics, classical-mechanics, statistical-mechanics, phase-space In this formulation, a particle is represented not by a mere point in phase space, but, instead, by a constrained distribution in phase space, a Wigner function. QM forces it to be "fuzzy" and somehow distributed over cells of size never smaller than roughly ℏ, which gives you the same dqdp/ℏ measure in state counting. This spreading out is a consequence of the uncertainty principle, which is embedded in the formulation, automatically, and prevents sharp trajectories. A particle is a profile distribution, usually centered on the classical point in phase space. (Even outside phase space, an x-wavefunction is much "larger" than a point it is centered at and its velocity.)
{ "domain": "physics.stackexchange", "id": 78874, "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, thermodynamics, classical-mechanics, statistical-mechanics, phase-space", "url": null }
organic-chemistry, nmr-spectroscopy Title: NMR splitting of protons in a ring I was presented with the following compound and asked to comment on the splitting of the proton $\ce{H_a}$ in $\ce{^1H}$ NMR. The question presented today was: What is the chemical shift (below) and splitting pattern for $\ce{H_a}$ up to and including $\ce{^4J}$? I relabelled the molecule as shown: but I was left stuck here. I know that $\ce{H_a}$ will be split by $\ce{H_d}$ and $\ce{H_e}$ to give a doublet of doublets (dd) but I was wondering, since the molecule is asymmetric. Now are the protons $\ce{H_c}$ and $\ce{H_d}$ chemically equivalent but magnetically inequivalent to yield the final splitting pattern as dddd? The two protons Hb and Hc are also chemically inequivalent, because they have a different chemical environment with the methyl group, i.e. they don´t have the same chemical shift. In a chiral molecule, the protons in a methylene group are rarely really chemically equivalent. There is usually a preferred orientation.
{ "domain": "chemistry.stackexchange", "id": 13027, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "organic-chemistry, nmr-spectroscopy", "url": null }
special-relativity, spacetime, speed-of-light, time If somehow you manage to do a measurement under this conditions of the time light takes to go from one object to another whose distance previous to the change you know, the result will be that light takes now the double of the time it took before, and thus you will know that distances have doubled. About the last question involving time, I understand you are not referring just to the speed of clocks but to the speed of everything. If the speed of every object is halved at the same time distances are doubled, the scenario will change a bit with respect to the one in which just distances were doubled, but the main qualitative conclusions will be the same. Observe, for example, that half the speed is not enough for the Earth to stay in circular motion; instead, $1/\sqrt{2}$ of the speed is needed.
{ "domain": "physics.stackexchange", "id": 39351, "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, spacetime, speed-of-light, time", "url": null }
svm, loss-function, hinge-loss Title: Hinge Loss understanding and proof I hope this doesn't come off as a silly question, but I am looking at SVMs and in principle I understand how they work. The idea is to maximize the margin between different classes of point (within any dimension) as much as possible. So to understand the internal workings of the SVM classification algorithm, I decided to study the cost function, or the Hinge Loss, first and get an understanding of it... $$L=\frac{1}{N} \sum_{i} \sum_{j \neq y_{i}}\left[\max \left(0, f\left(x_{i} ; W\right)_{j}-f\left(x_{i} ; W\right)_{y_{i}}+\Delta\right)\right]+\lambda \sum_{k} \sum_{l} W_{k, l}^{2}$$ Interpreting what the equation means is not so bad. For all classes we find the difference between all classes and the class we want to interpret (with a difference of delta) and sum all of them that are greater than 0. By looking at this it seems we are trying to figure out how off a classification is for every point.
{ "domain": "datascience.stackexchange", "id": 5344, "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": "svm, loss-function, hinge-loss", "url": null }
rosservice This is actually pretty well described on wiki/roscpp/Overview/Services - Persistent Connections: ROS also allows for persistent connections to services. With a persistent connection, a client stays connected to a service. Otherwise, a client normally does a lookup and reconnects to a service each time. This potentially allows for a client to connect to a different node each time it does a service call, assuming the lookup returns a different node. Persistent connections should be used carefully. They greatly improve performance for repeated requests, but they also make your client more fragile to service failures. Clients using persistent connections should implement their own reconnection logic in the event that the persistent connection fails. Originally posted by gvdhoorn with karma: 86574 on 2016-09-28 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 16384, "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": "rosservice", "url": null }
equilibrium, coordination-compounds assume that in each case the reaction rate with $m$ sites available is equal to $m$ times the reaction rate with $1$ site available, we obtain an equilibrium constant that is proportional to the ratio of sites available for the forward and reverse reactions.
{ "domain": "chemistry.stackexchange", "id": 11767, "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": "equilibrium, coordination-compounds", "url": null }
electromagnetism, electromagnetic-radiation, angular-momentum, poynting-vector Moreover, as if by magic, if you now apply these yardsticks to your original plane-wave state, you'll get zero for the orbital angular momentum, but now you can get a nonzero spin contribution from the second term if the light is circularly polarized. This should seem contradictory, given that our $\mathbf J$ was originally zero, but if you look closely you'll see that our step of neglecting the total derivative in $(3)$ does not really apply to a plane wave, since the fields do not vanish at infinity. So... which is right? Well, we want our plane waves to model physical fields, but if the unphysical characteristics get us into trouble, then the model is wrong, and we should keep the derivations that work for physical fields. Plane waves should always be handled with care, but in this case $(4)$ is the correct expression.
{ "domain": "physics.stackexchange", "id": 37106, "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, angular-momentum, poynting-vector", "url": null }
gazebo, c++ /// \brief Latest total distance. private: double totalDistance{0.0}; /// \brief Noise that will be applied to the sensor data private: gz::sensors::NoisePtr noise{nullptr}; /// \brief Node for communication private: gz::transport::Node node; /// \brief Publishes sensor data private: gz::transport::Node::Publisher pub; }; } #endif MyOdometer.cc #include <math.h> #include <gz/msgs/double.pb.h> #include <gz/common/Console.hh> #include <gz/msgs/Utility.hh> #include <gz/sensors/Noise.hh> #include <gz/sensors/Util.hh> #include "MyOdometer.hh" using namespace custom; ////////////////////////////////////////////////// bool MyOdometer::Load(const sdf::Sensor &_sdf) { auto type = gz::sensors::customType(_sdf); if ("myodometer" != type) { gzerr << "Trying to load [myodometer] sensor, but got type [" << type << "] instead." << std::endl; return false; } // Load common sensor params gz::sensors::Sensor::Load(_sdf);
{ "domain": "robotics.stackexchange", "id": 39030, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "gazebo, c++", "url": null }
c++, performance, beginner void unorderedFFT(complexVec& input, const complexVec& table) { size_t k = 2; while (k <= N) { for (size_t r = 0; r < N / k; r++) { for (size_t j = 0; j < k / 2; j++) { std::complex<double> plusMinus = input[r * k + j + k / 2] * table[N / k * j]; // omega_k^j = (omega_N^(N/k))^j = omega_N^(Nj/k) input[r * k + j + k / 2] = input[r * k + j] - plusMinus; input[r * k + j] += plusMinus; } } k *= 2; } } /* Calculates the FFT TESTED: SUCCESS */ void FFT(complexVec& input, const complexVec& table) { bitReversal(input); unorderedFFT(input, table); } // Prints array of N complex numbers void printArray(complexVec& array) { for (size_t k = 0; k < N - 1; k++) { std::cout << array[k] << ", "; } std::cout << array[N - 1] << std::endl; } int main() { complexVec input; input.resize(N);
{ "domain": "codereview.stackexchange", "id": 40746, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, performance, beginner", "url": null }
asymptotics, recurrence-relation Title: Pick parameter function that minimises whole function I have a recursive algorithm defined by the following recursion. $$T(n) = T(n/f(n)) + O(\log f(n)).$$ I want to find the function $f$ that minimizes $T(n)$. If $f$ is a constant then $T(n) = \Theta(\log n)$. If $f = O(n)$ then $T(n) = \Theta(\log n)$. Is this true for all functions $f$ that $T(n) = \Omega(\log n)$ or can I get asymptotically better behaviour for some $f$? The reason I think there might be is that you can look at an extended binary search where you split your domain into $f(n)$ sections and then examine each section to see if your value is in that section. This recursion can be presented as follows: $$T(n) = T(n/f(n)) + O(f(n)).$$
{ "domain": "cs.stackexchange", "id": 2279, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "asymptotics, recurrence-relation", "url": null }
because involves... I ( i.e am dealing with hundreds of shape files perimeter will using. Point in the two-dimensional plane using Excel, a triangle using its vertex coordinates in the cartesian system! The polygon in either direction providing results on one click trigonometric functions calculate! Go around the polygon in either direction … by Mark Ryan your own enter the of! Of each subarea it on your Test circumcenter calculator is use to how to calculate area using coordinates area and perimeter on formula. By taking coordinate values, area and wetted perimeter the size of a given triangle attribute to specify the of. This without having to rely on the coordinate values, area and the of. The above diagram shows how to do this manually – sided polygon which has 3 edges and vertices. The where am i right now to find out when calculating areas the data decompose total... Written, the calculator can process up to 10 vertices placement of an are... The result should be 18 always take
{ "domain": "thinkandstart.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9658995723244552, "lm_q1q2_score": 0.8209868005619693, "lm_q2_score": 0.849971181358171, "openwebmath_perplexity": 512.5943958607319, "openwebmath_score": 0.6730640530586243, "tags": null, "url": "https://thinkandstart.com/making-love-bpjd/178ee1-how-to-calculate-area-using-coordinates" }
orbit, artificial-satellite, space-travel Approximately 1.5 million kilometers. It is limited by the point at which the influence of the sun's gravity becomes sufficiently stronger than Earth's that any object at that distance would become unbound from Earth & end up in independent orbit around then sun. That limit applies in general to any system of two bodies, and is called the Hill sphere. It's not actually perfectly spherical, but close enough for most practical purposes, and lies between the L1 & L2 Lagrange points. For circular orbits, the radius of the Hill sphere for any planet or moon can be calculated from r = a*(m/(3M))^(1/3) Where r is the radius of the Hill sphere, m is the mass of the planet or moon, M is the mass of the sun a planet orbits, or the planet that a moon orbits, and a is the distance from the sun (or planet) to its planet (or moon).
{ "domain": "astronomy.stackexchange", "id": 2739, "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": "orbit, artificial-satellite, space-travel", "url": null }
evolution, mammals Primates are currently the biggest animals of that clade. Great apes are the biggest primates. Gorillas at about 150kg on average are the biggest (by weight) currently non-extinct great apes. Chimpanzees, Orangutans and Humans are approximately equals at 75kg. The biggest known primate, now extinct, is the Gigantopithecus which was probably a sort of giant Gorilla twice the size of what you know as Gorillas (200-300kg), so still well short of a tonne. The biggest non-extinct rodent is the Capybara (you can see one at the Cosmocaixa in Barcelona). But the biggest known extinct rodent was the Josephoartigasia and did weight 1000kg.
{ "domain": "biology.stackexchange", "id": 10633, "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, mammals", "url": null }
lisp, common-lisp, deque (defmethod find-element-pos ((obj deque) element) "Finds the position of element in a deque, scanning it from start to end. Returns the element if successful, nil otherwise" (let ((i (first-element obj)) (pos 0)) (block nil (tagbody ::loop (if (eq (content i) element) (return-from nil pos)) (setf i (next i) pos (1+ pos)) (if (null i) (return-from nil nil)) (go ::loop))))) Test cases Create a deque from a list CL-USER> (defvar v (make-deque '(1 2 3 4 5 6))) V deque and node have their own print-methods. CL-USER> v #<DEQUE :elements 6 :content (1 ... 6)> CL-USER> (make-node 0) #<NODE 0 sole> Append and prepend elements CL-USER> (append-element v 7) #<DEQUE :elements 7 :content (1 ... 7)> CL-USER> (prepend-element v 0) #<DEQUE :elements 8 :content (0 ... 7)>
{ "domain": "codereview.stackexchange", "id": 39316, "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": "lisp, common-lisp, deque", "url": null }
forces, fluid-dynamics, projectile, drag, navier-stokes normal: in this case no changes to the equation of motion are necessary, the normal velocity field serves to displace the particle in the horizontal direction. In this case you can use regular trajectory calculations to find where it lands. parallel: in this case a modification to the Stokes' equation needs to be made: $$m\frac{dv}{dt}=\left(m-m_w\right)g - 6\pi\mu R_p (v \pm v_\infty)$$ As you can see the far-field velocity makes a contribution to the drag force: if it is in the direction of the motion of the particle, relative velocity is smaller, drag force is reduced so it is a negative contribution if it is against the motion of the particle, relative velocity is greater, drag force is increased so it is a positive contribution.
{ "domain": "physics.stackexchange", "id": 84610, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "forces, fluid-dynamics, projectile, drag, navier-stokes", "url": null }
general-relativity, spacetime, metric-tensor, curvature, boundary-conditions Title: Assumption of asymptotic flatness Why is asymptotic flatness a good assumption for solving Einstein's field equations? Intuitively it makes sense to me but I am looking for a formal justification. (By asymptotic flatness I mean that the metric is Minkowskian at large distances.) It is impossible to solve EFE completely: we are seeking a solution, not all solutions. Also, we want a special solution satisfying the following: the gravitational effects of a star/black hole/etc. have be negligible at huge distances, because the effects of distant attractors doesn't play a major role in our life (indeed, experimentalists put major effort into discovering these objects). In mathematical language this requirement is exactly asymptotic flatness.
{ "domain": "physics.stackexchange", "id": 36738, "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": "general-relativity, spacetime, metric-tensor, curvature, boundary-conditions", "url": null }
c#, beginner while (true) { Console.WriteLine("Enter the first number in the range to find out it odd or even."); if (int.TryParse(Console.ReadLine(), out rangeStartInclusive) == false) { Console.WriteLine("Incorrect number. Press R to try again. Press any key to exit."); if (Console.ReadKey().KeyChar == 'r' || Console.ReadKey().KeyChar == 'R') { Console.Clear(); continue; } else break; }
{ "domain": "codereview.stackexchange", "id": 41512, "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", "url": null }
computer-vision, machine-learning For computer vision I would advise you to first learn about DSP in general. This book has had great reviews everywhere and although I haven't read it yet, I'm pretty sure it's a good start in the vast area of signal processing. There is also an online book, The Scientist & Engineer's Guide to Digital Signal Processing, with plenty of information on digital filtering. Once you have understood the fundamental theory of Machine Learning and DSP, you can start learning programming in C++. One very famous library for computer vision is OpenCV. You will be able to find many tutorials online.
{ "domain": "dsp.stackexchange", "id": 5434, "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": "computer-vision, machine-learning", "url": null }
c#, performance, php bt = binr.ReadByte(); if ( bt != 0x04 ) //expect an Octet string return null; bt = binr.ReadByte(); //read next byte, or next 2 bytes is 0x81 or 0x82; otherwise bt is the byte count if ( bt == 0x81 ) binr.ReadByte(); else if ( bt == 0x82 ) binr.ReadUInt16(); //------ at this stage, the remaining sequence should be the RSA private key byte[] rsaprivkey = binr.ReadBytes( (int)( lenstream - mem.Position ) ); RSACryptoServiceProvider rsacsp = DecodeRSAPrivateKey( rsaprivkey ); return rsacsp; } catch ( Exception ) { return null; } finally { binr.Close(); } } //------- Parses binary ans.1 RSA private key; returns RSACryptoServiceProvider --- private static RSACryptoServiceProvider DecodeRSAPrivateKey( byte[] privkey ) { byte[] MODULUS, E, D, P, Q, DP, DQ, IQ;
{ "domain": "codereview.stackexchange", "id": 23650, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, performance, php", "url": null }
c++, performance, vectors DataArray(const DataArray& dArray) { _Reserve(dArray.m_iDataCapacity); _CopyData(dArray); } void reserve(MaxSizeType size){ } void resize(MaxSizeType size){ if (size < m_iDataSize) { _Delete_Data(m_aData + size, m_aData + m_iDataSize); m_iDataSize = size; } else if (m_iDataSize < size){ _Reserve(size); DataType* pData = (m_aData + m_iDataSize); for (; pData < m_aData + size; ++pData) { new (pData)DataType; } m_iDataSize = size; } }
{ "domain": "codereview.stackexchange", "id": 16823, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, performance, vectors", "url": null }
algorithm, c Actually, a more useful generalization would probably be to accept a function pointer to use in place of isspace. Such indirect calls can have a performance penalty, though. Consider pointer arithmetic Instead of &p[n - i] you can just write p + n - i. I find this much more readable. Modify pointers with care Your trim_white function trims space from the beginning by simply adding an offset to the pointer. While this is super-fast, there is a big downside. If I call your function with a pointer that I obtained through malloc, I still have to keep the original pointer along with the pointer to the trimmed buffer. I need the former to pass it to free when I no longer need the string. I'm sure I will confuse them all the time.
{ "domain": "codereview.stackexchange", "id": 18207, "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, c", "url": null }
waves, information My question is - Is there a way to receive this "wave package" and interpret the original commands from it? Many thanks! Actually, when you combine (superpose) waves with different frequencies, they don't produce new frequencies. You can perform a Fourier transform on the combined wave to get the two original frequencies that went into it. This is a very common operation in signal processing and it can easily be implemented by a computer, or by certain kinds of purely physical systems. Just to give an example, this is how multiple radio stations can be broadcasting at once. Each station has a different frequency, and their signals add together in the air, but your radio is easily able to pick out the individual signal from just one station.
{ "domain": "physics.stackexchange", "id": 1297, "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": "waves, information", "url": null }