text
stringlengths
1
1.11k
source
dict
quantum-electrodynamics, renormalization Title: Why isn't the renormalized coupling constant in QED infinite and imaginary? In 7.9 of Griffith's Particle Physics textbook, he defines the renormalized coupling constant as $$g_R=g_e\sqrt{1-\frac{g_e^2}{12\pi^2}ln\frac{M^2}{m^2}}$$
{ "domain": "physics.stackexchange", "id": 37723, "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-electrodynamics, renormalization", "url": null }
newtonian-mechanics, newtonian-gravity, reference-frames Title: How does momentum/'forward' thrust affect an object inside a vehicle in space? Apologies if this is a worn-out question, but I'm curious about this: if you're inside a vehicle in space, and that vehicle begins to move in a direction under its own power, would you 'drift' towards the origin of the thrust of the vehicle? Put another way, if you have thrusters on the 'floor' side of a ship, would using those thrusters create a form of gravity, in that you would be pulled towards the floor while the thrusters were active? Using those thrusters would not create a form of gravity, but would create an effect of artificial gravity. Infact, if the spaceship had no windows, perfect sound insulation, and moved at an acceleration equal to that caused by gravity on the surface of the Earth you would not even be able to tell the difference between this case and the case of your spaceship being stationary on the surface of the Earth.
{ "domain": "physics.stackexchange", "id": 64262, "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, newtonian-gravity, reference-frames", "url": null }
java, ai public Game(int end) { if (end % 4 != 1) { throw new IllegalArgumentException("Nice try, this number will fail the AI."); } this.end = end; } public void startGame() { Scanner scanner = new Scanner(System.in); AI impossibleComputer = new AI(); displayHelp(); do { boolean hasLost = false; int previousNumber = 0; do { int[] numbers = getNumbers(scanner, previousNumber); if (contains(numbers, end)) { System.out.println("You lose!"); hasLost = true; } else { previousNumber = printAINumbers(impossibleComputer.getNextNumbers(numbers[numbers.length - 1])); } } while (!hasLost); } while (doAgain(scanner)); System.out.println("Thanks for playing!"); }
{ "domain": "codereview.stackexchange", "id": 16959, "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, ai", "url": null }
vision, neurophysiology, sensation, perception Fig. 2. Color Triangle. Source: Wikipedia As you can see in Fig. 2, when all three basic colors are present in equal amount, perceptually a white color is perceived (the middle point of the color triangle). That is, the combination of co-activation of each cone class yields the perception of white, i.e., without the need for rod activation. Rods are not needed for color vision, including the perception of white or black. In fact, under photopic (well-lit) conditions the rods are adapted to high light levels and are less responsive; their photopigments are said to be bleached and the rods become unresponsive to light. Hence, under photopic conditions the contribution of rod-mediated vision is low (Ambler, 1974).
{ "domain": "biology.stackexchange", "id": 4985, "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": "vision, neurophysiology, sensation, perception", "url": null }
bond, molecules, vsepr-theory Title: Molecular orbital theory & predicting the stability of a molecule? A question in my general chemistry textbook gives me a list of formulas for molecules and ions. It then asks me to determine, using molecular orbital theory, whether or not each would exist in a relatively stable form. How can I tell this? The chapter covers molecular shapes, valence bond theory, and molecular orbital theory which all builds on what was taught in the previous chapter (mainly on Lewis structures.) I can't tell what concepts to use in telling what will be stable and what won't. You need to mix the orbitals, populate them with the electrons and see if you have net bonding. Eg: H + H two 1s orbitals mix to form sigma and sigma*. Two electrons total, both occupy the sigma orbital, two more electrons in bonding than antibonding orbitals, the compound is stable.
{ "domain": "chemistry.stackexchange", "id": 376, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "bond, molecules, vsepr-theory", "url": null }
electricity, electric-circuits, electric-current, batteries, electrochemistry The reaction is between the two metals where one is oxidized (loses electrons) in this case the zinc anode and one is reduced (gains electrons) in this case the iron cathode. Oxidation happens at the anode and reduction happens at the cathode, thus cathodic protection as metal oxides are reduced back to their pure metals. When the metals are not touching as is typically the case in batteries(galvanic cells) the electrons travel through an outer circuit creating electrical energy and half cell redox reactions occur at each terminal(anode and cathode). The reactions cannot occur if the circuit is not closed as the cathodes sides reaction needs electrons and the anodes sides reaction expels electrons. The electrolyte serves to prevent charge buildup as during the oxidation reaction at the anode the positive metal ions are produced and need negative electrolyte ions to balance while at the cathode the positive metal ions are reduced leaving their negative counter parts that need to be
{ "domain": "physics.stackexchange", "id": 64727, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electricity, electric-circuits, electric-current, batteries, electrochemistry", "url": null }
networking, go func qdot_int(qdot []string) uint64 { var a uint64 = 0 var w uint64 var x uint64 var y uint64 var z uint64 w, _ = strconv.ParseUint(qdot[0], 10, MAX_BIT_VALUE) x, _ = strconv.ParseUint(qdot[1], 10, MAX_BIT_VALUE) y, _ = strconv.ParseUint(qdot[2], 10, MAX_BIT_VALUE) z, _ = strconv.ParseUint(qdot[3], 10, MAX_BIT_VALUE) a += w << 24 a += x << 16 a += y << 8 a += z << 0 return a } func int_qdot(integer uint64) string { var w string = strconv.FormatUint(integer>>24&MAX_BIT_BIN, 10) var x string = strconv.FormatUint(integer>>16&MAX_BIT_BIN, 10) var y string = strconv.FormatUint(integer>>8&MAX_BIT_BIN, 10) var z string = strconv.FormatUint(integer&MAX_BIT_BIN, 10) var a []string = []string{w, x, y, z} return strings.Join(a, ".") } func network_address(ip uint64, sm uint64) string { return int_qdot(ip & sm) } func broadcast_address(ip uint64, sm uint64) string { return int_qdot(ip | ^sm) }
{ "domain": "codereview.stackexchange", "id": 9894, "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": "networking, go", "url": null }
javascript // Partition array into intervals of equal values: function* partitions(array, start = 0, next = start + 1) { while (next < array.length && array[start] === array[next]) next++; if (next <= array.length) { yield [start, next]; yield* partitions(array, next); } } // Return reference strings for partitions of outcome: function* ranges({reference, outcome}) { for (let [start, end] of partitions(outcome)) { yield [reference.slice(start, end).join(' '), outcome[start]]; } } // Example: let data = { reference: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'], outcome: [true, true, false, false, true, false, false, true] }; for (let range of ranges(data)) { console.log(range); } But even without generators, your implementation could benefit from the suggested split.
{ "domain": "codereview.stackexchange", "id": 25696, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript", "url": null }
c, compression I was considering making the program more general by being able to output different bit encodings. That's why you see things like DICT_BITS in the code. In the end, though, I wound up hardcoding everything to 12-bit encodings. I prefer code to be in "reading order", which means that main should be on top, and then the functions that it calls below it. This may be opposite of what most people are used to, but this is an intentional thing. The code is very well written in my opinion. I have only very marginal questions:
{ "domain": "codereview.stackexchange", "id": 14964, "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, compression", "url": null }
human-anatomy, tissue, lymphatic-system A photo purporting to be lymph does exist on Wikipedia, but lacking any further corroboration leads me to remain uncertain of the photo's authenticity. Context: I'm preparing a lecture for my 100 level college A&P course, and I was hoping to include a photo for my students to see and compare. NOTE: I am hoping for a photo of lymph that is not classified as lipid-containing Chyle, for which I can find photos. However, a comparison photo would be ok :) This seems to be one of rare actual photos of lymph online (suggested in the comment above): Image: Lymph (source: IJCRI - Case Reports Journal)‎ This particular lymph (or "lymph fluid" or "lymphatic fluid") was aspirated from a "lymphocele", which is an abnormal collection of lymph in the body (appearing outside of the normal lymphatic system). While a lymphocele is not normal, the lymph in it, such as in this photo, looks quite normal: it is a clear (translucent) and yellowish liquid.
{ "domain": "biology.stackexchange", "id": 10301, "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-anatomy, tissue, lymphatic-system", "url": null }
Basically you only need to iterate up to sqrt(a) because the inverse of every factor <= sqrt(a) gives you the one which is greater than sqrt(a). See the following code example: import math def factors(a): ans = set() for i in range(1, int(math.sqrt(a)) + 1): if a % i == 0: • I might be wrong, but there seems to be a problem with your solution. find_common_factors(10, 25) returns an empty list, but there are two common factors (1, 5). – Martin R Jan 27 at 8:23 • 1 is not a prime factor of n, but is is a common factor of a and b (and the original code counts it as well). Btw, your find_common_factors(720, 24) misses the common factor 24. – Martin R Jan 27 at 10:42 • Another problem: factors(20, ...) does not find the factor 4. factors(78, ...) does not find the factor 6. – Martin R Jan 27 at 12:09
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9693242000616578, "lm_q1q2_score": 0.8119252950199877, "lm_q2_score": 0.8376199572530448, "openwebmath_perplexity": 872.6466658020753, "openwebmath_score": 0.4743383526802063, "tags": null, "url": "https://codereview.stackexchange.com/questions/236190/count-common-factors" }
nlp, predictive-modeling, word-embeddings Title: Predicting a word using Word2vec model Given a sentence: "When I open the ?? door it starts heating automatically" I would like to get the list of possible words in ?? with a probability. The basic concept used in word2vec model is to "predict" a word given surrounding context. Once the model is build, what is the right context vectors operation to perform my prediction task on new sentences? Is it simply a linear sum? model.most_similar(positive=['When','I','open','the','door','it','starts' , 'heating','automatically']) Word2vec works in two models CBOW and skip-gram. Let's take CBOW model, as your question goes in the same way that predict the target word, given the surrounding words.
{ "domain": "datascience.stackexchange", "id": 1591, "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": "nlp, predictive-modeling, word-embeddings", "url": null }
c#, error-handling, formatting, floating-point Problems: "ConversionLoop" is a meaningless name. The function parses a string to an integer, so a better name would be toInt The handling of invalid input and incrementing the counter are not visible here. At first look I didn't see how the counter can advance, and it seemed you don't tell the user about invalid results. I had to look at the ConversionLoop to find out, but it was not logical to do so. The responsibility of getting valid input should not be split between two methods, it would be clearer to handle in one place, and have all the elements of the logic easily visible. If the user fails to enter valid input 5 times, the code throws new FormatException()
{ "domain": "codereview.stackexchange", "id": 14340, "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#, error-handling, formatting, floating-point", "url": null }
python, python-3.x, game, tkinter, minesweeper __init__ returns -> None. Use lower_snake_case for your method names. It's more typical to triple-double-quote """ rather than triple-single-quote ''' for docstrings. You have a mix of \u and literal Unicode emojis sprinkled through your strings. Some of them render on my IDE font and some don't (like the triangular flag), so you're better off being consistent and declaring all Unicode constants like BLACK_FLAG = '\u2691'
{ "domain": "codereview.stackexchange", "id": 43800, "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, game, tkinter, minesweeper", "url": null }
semiconductor-physics, electronics, fermi-energy Title: Shifting of Energy levels in PN junction under Equilibrium My question is during equilibrium is achieved under no biasing, why it is that in fermi level diagram representation fermi levels are raised in p type nd lowered in n type. Is it not possible we increase the fermi level of n type than p type.
{ "domain": "physics.stackexchange", "id": 80067, "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": "semiconductor-physics, electronics, fermi-energy", "url": null }
quantum-mechanics, hilbert-space, time-evolution, unitarity Title: Why in quantum mechanics must orthogonal states stay orthogonal? Given two states $|A(t)\rangle$ and $|B(t)\rangle$. If $\langle A(0)|B(0)\rangle=0$ then for all $t$, $\langle A(t)|B(t)\rangle=0$. This is a fundamental rule of quantum mechanics. And we can imply that states evolve unitary with $|A(t)\rangle = U(t)|A(0)\rangle$. Which is equivalent(?) to saying that states evolve with linearly. One can think of this as two arrows on a circle. And they evolve by going round the circle, keeping at right angles from each other. But one could imagine an evolution where the speed of the arrow on a circle depends on it's position on the circle. Then the arrows would not stay orthogonal. It would be replacing the unitary group with the holomorphic-diffeomophism group. States would evolve with operators $\psi'(t)=iH(\psi(t))\psi(t)$. i.e. non-linearly. But would always remain distinguishable. Would this be against some physical principle?
{ "domain": "physics.stackexchange", "id": 53837, "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, hilbert-space, time-evolution, unitarity", "url": null }
ocean, oceanography, sea-level, tides However, I'm really curious as which are the most important amongst them? Or is it even possible to guess the tide height if I know the Lunar phase and I have a good globe with sea depth? I don't know about the size of land masses, but their distribution and the shape of ocean basins definitely play a big role. When considering the ideal case of an all-ocean globe, i.e. one with no land masses (equilibrium tidal theory), the combined effect of sun and moon give a theoretical tidal range of less than 1 m(1). As tidal ranges can be much larger than this, there are other effects that has a greater influence.
{ "domain": "earthscience.stackexchange", "id": 42, "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": "ocean, oceanography, sea-level, tides", "url": null }
adhesive Title: Mating a round surface with a flat surface I have a small flat surface (~80mm x 80mm) that needs to adhere to a round surface (radius = 100mm). Does anyone know how to mate the two surfaces together using tape to give a good enough bond? Any thought appreciated. EDIT: The part with the flat surface (~250g) is supposed to be hung on the round part (a lamp shade). Both parts are plastic. I'm hoping to avoid causing damage to either part. The whole assembly will be kept indoor. Without knowing more about your requirements here are some options: "Permanent" options: Try a two-part epoxy designated for plastics. Using sandpaper, like 120 grit, to roughen the surfaces helps with adhesion. Alternatively, maybe a double-sided foam tape would work. Specifically VHB tape. If you're using acrylic, you could use the special acrylic glue solvent which makes a strong bond. "Non-permanent" options: zip ties/cable ties or a hose clamp to hold the parts together
{ "domain": "engineering.stackexchange", "id": 1346, "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": "adhesive", "url": null }
operating-systems, memory-management Paging out memory requires detecting what pages have been recently used so that infrequently used pages can be paged out. One way to do this is to mark the page as invalid for a short time. If the page is used in that time, operating system knows that it was accessed because a page fault occurred. (Modern Intel CPUs have a more efficient mechanism for this, but the valid bit works if you're using a CPU where that isn't supported.) An operating system will often mark a dirty page (e.g. a modified page which represents a memory-mapped file) as invalid while it is being flushed to secondary storage. Any program which tries to modify a page which is in the process of being flushed should wait until the write is complete, so that the data being written is in a known state.
{ "domain": "cs.stackexchange", "id": 7758, "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": "operating-systems, memory-management", "url": null }
# Does a Group being Finite Imply that It Is Cyclic? I have been studying Abstract Algebra, and all the finite groups that we have studied so far have also been cyclic. So, is it true that all finite groups are cyclic? If yes, what is the theorem? If no, please provide a counterexample. • Not by a long shot. Look up symmetric and dihedral groups. Most finite groups are not cyclic or even commutative. – KCd Sep 30, 2014 at 16:55 • Smallest counterexample: $\mathbb{Z}_2 \times \mathbb{Z}_2$. en.wikipedia.org/wiki/Klein_four-group Sep 30, 2014 at 16:59 • The symmetric group $S_3$ is finite, of order $6$ but not is cyclic. – user59969 Sep 30, 2014 at 17:02 • You may coincidentally be observed only finite groups of prime order. In this case, his statement was true, but in general is false. – user59969 Sep 30, 2014 at 17:04 • I find it surprising that your teacher did not show you the group of permutations of three things as soon as groups were defined. Sep 30, 2014 at 17:11
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9748211590308922, "lm_q1q2_score": 0.8102158312723491, "lm_q2_score": 0.8311430499496095, "openwebmath_perplexity": 473.26251201602224, "openwebmath_score": 0.3971339166164398, "tags": null, "url": "https://math.stackexchange.com/questions/952792/does-a-group-being-finite-imply-that-it-is-cyclic" }
newtonian-mechanics, newtonian-gravity, energy-conservation, orbital-motion, potential-energy Title: Why is total energy not constant in a graph plotting potential and kinetic energy against distance? The context is orbital mechanics (moving objects away/toward planets, for example). The following graph confuses me: How come total energy isn't a straight, horizontal line? Due to conservation of energy? I would think that E total = E kinetic + E potential = some constant value. I've having quite the conceptual confusion. In class we learnt that if we move a satellite to a higher orbit, the satellite's total energy is the same (it lost kinetic energy, gained potential energy, E total unchanged).
{ "domain": "physics.stackexchange", "id": 78008, "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, newtonian-gravity, energy-conservation, orbital-motion, potential-energy", "url": null }
mobile-robot, quadcopter, slam, opencv Or in my is using computer vision is redundant? Is my goal completely achievable only using SLAM? If, yes, how can I classify the objects of interest (I don't want my drone to fly into a running ceiling fan mistaking it for a wall corner or edge). Furthermore, is there any kind of other methods or sensors, of any type, to detect objects in motion? (using optical flow computer vision method here is useless because it's not robust enough in real-time). Any help and advice is much appreciated. tl;dr - SLAM is good enough for your task. The ceiling is the area where your robot will be traveling in. Few things to notice -
{ "domain": "robotics.stackexchange", "id": 1700, "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": "mobile-robot, quadcopter, slam, opencv", "url": null }
then the span of $$A$$ is all of $$\mathbb R ^3$$, because, for any $$x = (x_1, x_2, x_3) \in \mathbb R ^3$$, we can write $x = x_1 e_1 + x_2 e_2 + x_3 e_3$ Now consider $$A_0 = \{e_1, e_2, e_1 + e_2\}$$ If $$y = (y_1, y_2, y_3)$$ is any linear combination of these vectors, then $$y_3 = 0$$ (check it) Hence $$A_0$$ fails to span all of $$\mathbb R ^3$$ ### Linear Independence¶ As we’ll see, it’s often desirable to find families of vectors with relatively large span, so that many vectors can be described by linear operators on a few vectors The condition we need for a set of vectors to have a large span is what’s called linear independence In particular, a collection of vectors $$A := \{a_1, \ldots, a_k\}$$ in $$\mathbb R ^n$$ is said to be • linearly dependent if some strict subset of $$A$$ has the same span as $$A$$ • linearly independent if it is not linearly dependent
{ "domain": "quantecon.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9927672363035179, "lm_q1q2_score": 0.8022226543462614, "lm_q2_score": 0.8080672135527632, "openwebmath_perplexity": 292.48710622759694, "openwebmath_score": 0.9709522724151611, "tags": null, "url": "https://lectures.quantecon.org/jl/linear_algebra.html" }
permutation while navigate... One-To-One , there are no draws, and surjection is OK a! } \right ] \ ) coincides with the Definition of bijection, injection,,. Website uses cookies to improve your experience while you navigate through the website a perfect pairing '' between sets! Surjection Thread starter amcavoy ; Start date Oct 14, 2005 ; Oct 14, 2005 # 1.., x = y also injection, surjection, isomorphism, permutation or like,. A general function ) ensures basic functionalities and security features of the range should intersect the of! Of \ ( x.\ ) one-to-one if you wish maybe more than one ) perfect ''. ⟶ B is one-one how to Start proving injection and surjection Thread starter amcavoy ; Start date Oct 14 2005. ( but do n't get angry with it now, a function injective is also called one-to-one... Most once ( once or more ) to Start proving injection and surjection starter... One ) subsets of the function \ ( \left [ { – 1,1 } \right \! By Nicholas Bourbaki the values of a surjective
{ "domain": "ineas.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9857180690117798, "lm_q1q2_score": 0.8012580006673342, "lm_q2_score": 0.8128673155708975, "openwebmath_perplexity": 585.349544531056, "openwebmath_score": 0.7390031814575195, "tags": null, "url": "http://ineas.org/ram-swarup-iqdvii/7e3e23-bijection%2C-injection-and-surjection" }
thermodynamics, electromagnetic-radiation, temperature, thermal-radiation $$ t = \frac{c}{3A\sigma\epsilon}\left(\frac{T_0}{T_1}\right)^3. $$ If I plug in some numbers, e.g. 1 kg of air (c=1 kJ/K), emissivity 1e-3 (wild guess), T1=50 nK, T0=300 K, A=1 m2, then I find t=1e+42 s, i.e., 1e+34 years. Yes, longer than the age of the universe before the quantum mechanics of the ground state start to play a role.
{ "domain": "physics.stackexchange", "id": 30938, "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, electromagnetic-radiation, temperature, thermal-radiation", "url": null }
electromagnetism, electromagnetic-radiation, maxwell-equations, boundary-conditions, dielectric Variations of this can be found in most textbooks dealing with Maxwell's equations. In the radiation regime, it is no longer true that $\vec E$ is irrotational since, because of induction \begin{align} \vec\nabla\times \vec E=-\frac{\partial \vec B}{\partial t} \tag{2} \end{align} yet the condition of Eq.(1) remain in use to obtain, for instance, the Fresnel equations. Is there a derivation of (1) that works in the radiation regime where (2) holds and the induction cannot be neglected? Consider a rectangular Amperian loop of sides $\Delta w$, $\Delta h$ (as per your right hand diagram), symmetrically placed with respect to the interface. Faraday's law yields $$ (E_{1t} - E_{2t})\Delta w + \frac{1}{2}(E_{1n} + E_{2n})\Delta h - \frac{1}{2}(E_{1n} + E_{2n})\Delta h = -\frac{\partial B}{\partial t}\Delta w\Delta h,$$ where $E_{1n}$ and $E_{2n}$ are the normal components of the electric fields in medium 1 and medium 2.
{ "domain": "physics.stackexchange", "id": 64779, "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, maxwell-equations, boundary-conditions, dielectric", "url": null }
## Calculator Screenshots
{ "domain": "collegephysicsanswers.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9770226280828406, "lm_q1q2_score": 0.8245046032524107, "lm_q2_score": 0.8438950947024555, "openwebmath_perplexity": 589.9924438160525, "openwebmath_score": 0.6707152128219604, "tags": null, "url": "https://collegephysicsanswers.com/openstax-solutions/how-many-percent-torque-motor-decreased-if-its-permanent-magnets-lose-50-their" }
php Echo or return? Neither While I agree that you shouldn't return an message that mixes the presentation layer with the logic, I believe is important to clarify that returning something meaningful is essential based on what you want to accomplish: get user credentials. This brings us to the next principle. Command Query Separation (CQS): it states that your methods should either perform an action or return to the caller the results of a query. In your case you are not performing an action such as authentication, but rather you want to query the user credentials. Return a UserCredentials object, that is responsible to set the appropriate info in a session via a cookie or key-value data store like Redis or Memcached. By using the proper patterns and abstractions you can even allow the UserCredentials class set the session using the desired method! Exit?
{ "domain": "codereview.stackexchange", "id": 3518, "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", "url": null }
javascript .submit-button:hover { background-color: #ffd796 } .clickable { cursor: pointer; } .right-align { float: right; } /* The Modal (background) */ .modal { position: fixed; display: none; padding-left: 75%; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(255,255,255,0.5); } /* Modal Content */ .modal-content { padding: 20px; border: 2px solid orange; height: 100%; overflow: auto; } /* The Close Button */ .close { display: inline; color: gray; float: right; } .close:hover, .close:focus { color: #000; text-decoration: none; cursor: pointer; } /* Checkboxes */ .form-group { display: block; margin-bottom: 5px; } .form-group input { padding: 0; height: initial; width: initial; margin-bottom: 0; display: none; cursor: pointer; } .form-group label { position: relative; cursor: pointer; }
{ "domain": "codereview.stackexchange", "id": 37837, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript", "url": null }
mathematics, pauli-gates However, I was wondering if anyone knows a nicer way of showing these two are equal without actually calculating their matrix? If your question is only regarding why $| 0 \rangle \langle0 | \otimes \sigma_z - | 1 \rangle \langle 1 | \otimes \sigma_z$ ; you can simply factor it given that trivially: $\sigma_z = | 0 \rangle \langle0 | - | 1 \rangle \langle 1 | $ $$| 0 \rangle \langle0 | \otimes \sigma_z - | 1 \rangle \langle 1 | \otimes \sigma_z$$ $$=\big( | 0 \rangle \langle0 | - | 1 \rangle \langle 1 | \big) \otimes \sigma_z$$ $$=\sigma_z \otimes \sigma_z$$ If you are however looking for a different way to show the equivalence between the operators without using Euler's Identity and whatnot, you can simply write both sides in terms of its matrix elements; since both exponentiations are of diagonal matrices (in the computational basis) their exponentiation is trivial, and really all you have to do is perform 2 simple matrix multiplications.
{ "domain": "quantumcomputing.stackexchange", "id": 3135, "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": "mathematics, pauli-gates", "url": null }
sections volume and surface of the body may be computed (with circumference C and area A of the section):. Clearly, disks stacked along the y-axis will not work to calculate the volume, but. As a check we should find that we can use this to calculate the volume of the complete torus, and obtain the expected result. But I'm not sure this is the right method. On the Knot Floer Homology of Twisted Torus Knots 3 of K is a knot in an L-space with an S3 surgery (see [13; 20, Section 8. The volume of a torus using the Divergence theorem In three dimensions, the divergence theorem is $\iiint\limits_V ( abla \cdot F) \ dV = \iint\limits_S (F\cdot n) \ dS,$ where is the surface boundary of and its outward normal. " I would take that to mean that. We find that the oxygen torus does not extend over all longitudes but is localized to the dawn sector, indicating a crescent‐shaped torus. If the axis of revolution does not touch the circle, the surface has a ring shape and is called a ring torus or
{ "domain": "angelaleone.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9895109071934598, "lm_q1q2_score": 0.8043410793442721, "lm_q2_score": 0.8128673201042492, "openwebmath_perplexity": 823.0098102989588, "openwebmath_score": 0.754847526550293, "tags": null, "url": "http://angelaleone.it/dhbc/volume-of-a-torus.html" }
special-relativity, electromagnetic-radiation, coordinate-systems, speed-of-light, inertial-frames Title: How photon travel diagonally in a spaceship at relativistic speed according to Special Relativity According special relativity, the clock ticks slower on spaceship moving at relativistic speed because the light travels a longer diagonal distance with respect observer on ground. If light is a wave then how it gains the velocity of spaceship? such that it travels in a diagonal. can light make an interference pattern in this scenario? Your question should be closed as a duplicate. The answer has nothing to do with light, per se. The answer is that the direction of any motion is frame dependent. To see this, consider the following... Suppose you stand at the origin of your horizontal x axis and shine a light vertically up. What that means is that the light moves further and further along your vertical y axis, but does not move at all along your x axis- the x coordinate of the light is always zero. That is the definition of vertical motion.
{ "domain": "physics.stackexchange", "id": 94685, "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, electromagnetic-radiation, coordinate-systems, speed-of-light, inertial-frames", "url": null }
than 1 unit away from one point and 9 units away from another (sum-of-squares = 82). In this case a linear fit captures the essence of. I can't but I'm saying that, if the likelihood is a function of the sum of the residuals squared, then why maximize a likelihood ? We should be allowed to minimize the sum of the residuals squared and arrive at. • We are minimizing the sum of squared residuals, • called the "residual sum of squares. ISLR Linear Regression. only the slope. We want to minimize the sum (or average) of squared residuals r ( x i) = y i − f ( x i). Minimize sum of squared residuals Minimization will be carried out by computer. com/course/ud120. Specifically the goal is to minimize the. In ridge regression, we not only try to minimize the sum …. 7) correspond to the sum of squares of the tted values ^y i about their mean and the sum of squared residuals. We propose a simple, yet effective, algorithm that minimizes a convex objective function corresponding to the sum of squared
{ "domain": "mauritius-koeln.de", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9877587232667824, "lm_q1q2_score": 0.8294545577342662, "lm_q2_score": 0.8397339736884712, "openwebmath_perplexity": 477.09976571799604, "openwebmath_score": 0.852555513381958, "tags": null, "url": "http://mauritius-koeln.de/minimize-sum-of-squared-residuals.html" }
python def shuffle(m, d, xd): for j in range(xd): # move columns to the right m = [row[-1:] + row[:-1] for row in m] # move rows down m = m[-1:] + m[:-1] shuffled_m = [[0] * 32 for _ in range(32)] for idx, sidx in enumerate(test(d)): shuffled_m[idx // 32][idx % 32] = m[sidx // 32][sidx % 32] m = shuffled_m # cut in half and flip halves m = m[len(m) // 2:] + m[:len(m) // 2] # test m = list(map(list, zip(*m))) return m
{ "domain": "codereview.stackexchange", "id": 41124, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python", "url": null }
php elseif($urlParams['y'] == 8){ if((250 <= $Comms['Overall']) && ($Comms['Overall'] <= 549)){ $Award = "Bronze"; } elseif((550 <= $Comms['Overall']) && ($Comms['Overall'] <= 849)){ $Award = "Silver"; } elseif((850 <= $Comms['Overall']) && ($Comms['Overall'] <= 1099)){ $Award = "Gold"; } elseif((1100 <= $Comms['Overall']) && ($Comms['Overall'] <= 1299)){ $Award = "Platinum"; } elseif($Comms['Overall'] >= 1300){ $Award = "Diamond"; } } elseif($urlParams['y'] == 9){ if((200 <= $Comms['Overall']) && ($Comms['Overall'] <= 449)){ $Award = "Bronze"; } elseif((450 <= $Comms['Overall']) && ($Comms['Overall'] <= 699)){ $Award = "Silver"; } elseif((700 <= $Comms['Overall']) && ($Comms['Overall'] <= 899)){ $Award = "Gold"; } elseif((900 <= $Comms['Overall']) && ($Comms['Overall'] <= 1099)){ $Award = "Platinum"; } elseif($Comms['Overall'] >= 1100){ $Award = "Diamond"; } }
{ "domain": "codereview.stackexchange", "id": 22896, "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", "url": null }
### Show Tags 02 Feb 2012, 15:16 3 19 00:00 Difficulty: (N/A) Question Stats: 50% (00:00) correct 50% (00:00) wrong based on 21 sessions ### HideShow timer Statistics In how many ways can 5 different rings be worn in four particular fingers? (Some fingers may get more than one ring and some may get no rings.) Can somebody explain? Math Expert Joined: 02 Sep 2009 Posts: 61385 Re: In how many ways can 5 different rings be worn in four  [#permalink] ### Show Tags 02 Feb 2012, 17:24 1 6 docabuzar wrote: Many Thnx. 2 similar Qs. 1. In how many ways can 5 Idnetical fruits be distributed in 4 identical baskets? Fruits are identical but baskets are also identical so we cannot apply 8C3 from n+r-1 C r-1? Can we say that to remove the duplications of baskets we should divide 8C3 by 4! ? 2. In how many ways can 5 different fruits be distributed in 4 identical baskets? Is this like making 4 groups from 5 different fruits so = 5!
{ "domain": "gmatclub.com", "id": null, "lm_label": "1. Yes.\n2. Yes.\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9433475715065793, "lm_q1q2_score": 0.8091734570432362, "lm_q2_score": 0.8577681031721325, "openwebmath_perplexity": 1783.2244966437977, "openwebmath_score": 0.6732640266418457, "tags": null, "url": "https://gmatclub.com/forum/in-how-many-ways-can-5-different-rings-be-worn-in-four-126991.html" }
general-relativity, cosmology, black-holes, space-expansion, dark-energy Related earlier question: Is there a GR explanation for cosmological coupling causing mass increase as the universe expands? (see both answers)
{ "domain": "physics.stackexchange", "id": 97996, "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, cosmology, black-holes, space-expansion, dark-energy", "url": null }
ros-groovy Title: How to install rosserial into catkin_ws in ROS Groovy...? I need to connect ROS with my Arduino , But this requires rosserial_arduino to be installed inside the working directory. I tired but the procedure looks complicated and different from fuerte ......... Originally posted by Cybertron on ROS Answers with karma: 31 on 2013-01-03 Post score: 0 I am not sure, but this package does not look like it was catkinized, so you will have to build it in a rosbuild environment. Check the catkin tutorial: using_rosbuild_with_catkin for more information Originally posted by kalectro with karma: 1554 on 2013-01-04 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 12265, "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-groovy", "url": null }
x = (A+v*v')\b. Note that $A + vv^T$ has full rank (and $v$ is still an eigenvector, but now for the eigenvalue $\|v\|^2$). Surely, the solution of $Ax=b$ which is orthogonal to the kernel of $A$  also solves this $(A+vv^T)x = b$ since $(A+vv^T)x = Ax + vv^Tx = Ax = b$. Conversely, if $x$ solves $(A + vv^T)x = b$, then taking the inner product with $v$ gives $(Ax)^Tv + (v^Tx)^2 = b^Tv$ and since $b^Tv = 0$ and $(Ax)^T v = x^TAv = 0$ it follows that $v^T x = 0$ which shows that both $Ax=b$ and that $x$ is orthogonal to the kernel. Also, if you want the solution which is orthogonal to some $z$ (and not to the kernel of $A$) you can solve $(A + zz^T)x=b$. By taking the inner product with $v$, you get that $v^T z\, x^T z=0$ and you get $x\bot z$ as soon as $v^Tz\neq 0$.
{ "domain": "wordpress.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9923043514561086, "lm_q1q2_score": 0.8112827015449927, "lm_q2_score": 0.8175744673038221, "openwebmath_perplexity": 281.9628098179786, "openwebmath_score": 0.896605372428894, "tags": null, "url": "https://regularize.wordpress.com/tag/linear-algebra/" }
(1) 2xy < 100 (2) (x + y)^2 > 200 Is x^2 + y^2 > 100? (1) 2xy < 100 --> clearly insufficient: if $$x=y=0$$ then the answer will be NO but if $$x=10$$ and $$y=-10$$ then the answer will be YES. (2) (x + y)^2 > 200 --> $$x^2+2xy+y^2>200$$. Now, as $$(x-y)^2\geq{0}$$ (square of any number is more than or equal to zero) then $$x^2+y^2\geq{2xy}$$ so we can safely substitute $$2xy$$ with $$x^2+y^2$$ (as $$x^2+y^2$$ is at least as big as $$2xy$$ then the inequality will still hold true) --> $$x^2+(x^2+y^2)+y^2>200$$ --> $$2(x^2+y^2)>200$$ --> $$x^2+y^2>100$$. Sufficient. Are you sure the OA is C? To put it in words, think of it this way: Is x^2 + y^2 > 100? (2) (x + y)^2 > 200 which means: x^2 + y^2 + 2xy > 200
{ "domain": "gmatclub.com", "id": null, "lm_label": "1. Yes\n2. Yes\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 1, "lm_q1q2_score": 0.8333245994514082, "lm_q2_score": 0.8333245994514082, "openwebmath_perplexity": 1794.2052198410765, "openwebmath_score": 0.8158167600631714, "tags": null, "url": "https://gmatclub.com/forum/is-x-2-y-108343-20.html" }
# Calculating the relevant variables for a rotating habitat Bizmuth 1. Homework Statement I want to calculate the rotational period and surface velocity of a Bishop Ring with a radius of 80 km and a surface 'gravity' of 0.86 G I should note that this isn't for homework. It's for personal interest. I'm looking for a sanity check on this. The homework forum just seemed the best place for this type of question. ## Homework Equations From https://en.wikipedia.org/wiki/Artificial_gravity the formula to calculate the rotational period for a given radius and desired gravity is t = 2 * pi * (r/a)^.5 where t is time, r is radius of the habitat, and a is desired acceleration (gravity) ## The Attempt at a Solution [/B] 0.86 G = 8.428 m/s^2 2 * pi * (80,000/8.428)^.5 = 612 seconds circumference = 2 * pi * 80 km = 502.65 km linear velocity = 502.65 / 612 = 0.82 km/s = 2957 km/hr So the habitat will rotate once every 612 seconds, and the velocity of the rim will be 2957 km/hr
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9724147177732101, "lm_q1q2_score": 0.8039067117593294, "lm_q2_score": 0.8267117898012104, "openwebmath_perplexity": 1042.6295798846807, "openwebmath_score": 0.8252859711647034, "tags": null, "url": "https://www.physicsforums.com/threads/calculating-the-relevant-variables-for-a-rotating-habitat.955760/" }
c, programming-challenge, time-limit-exceeded Example output: 3 4 I wrote a simple programme that did the thing but when I uploaded the source file I got "time limit exceeded" error. After that I discovered that my program is unable to handle big input. I tried to move on to the next exercise but I discovered almost all of them have big inputs. I tried to improve it myself, then I tried to google it, but sadly I still cannot get past the error. This is the code I ended up with : #include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZE 80000 int compare(const void *a, const void *b); int main(int argc, char const *argv[]) { char buffer[SIZE]; unsigned int numberOfGames, numberOfStudents, wantedDifference; unsigned int numberOfDifferentPairs; unsigned int counter; size_t i, j; scanf("%u", &numberOfGames);
{ "domain": "codereview.stackexchange", "id": 24130, "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, time-limit-exceeded", "url": null }
data-science-model, career make a youtube channel, present small tutorials, and classes to the community. Try to answer Stack Exchange questions and help others, that will build your respect in the community and goodwill for when it is your time to ask. Also, this is a good way to practice expressing your ideas in a text. Write a blog, it is a good way to have a notebook and also gaining attention from the community. You can check on hands-on books such as Data Smart and Data Science from Scratch. Data Smart is about getting Insight from information and that's mostly your job as a D-Scientist. 2 - Build Respect
{ "domain": "datascience.stackexchange", "id": 5206, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "data-science-model, career", "url": null }
quantum-mechanics, hilbert-space, commutator, bosons Where does that come from? I started considering the general Fock state $|n_1 n_2\dots n_N\rangle=\prod_{k=1}^{N}\frac{1}{\sqrt{n_k!}}{b_k^\dagger}^{n_k}|0\rangle$ and trying to compute the commutaor expression but obtained nothing useful. Can anyone help me? You can start with the exact matrix expression for the ladder operators, which we use for numerics, $$b^\dagger = \sum_{i=1}^N \sqrt{i} \mid i \rangle \langle i -1 \mid \quad b = \sum_{i=1}^N \sqrt{i} \mid i - 1 \rangle \langle i \mid,$$ where you will find that these two commute to $1$ for any state other than the final state $\mid N \rangle$, for which they yield $[b,b^\dagger]\mid N\rangle = -N \mid N \rangle$. The main point is that the second term is a kronecker delta function $$\delta_{\hat{n},N} = \frac{(b^\dagger)^N b^N}{N!}$$
{ "domain": "physics.stackexchange", "id": 65596, "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, hilbert-space, commutator, bosons", "url": null }
c++, beginner, object-oriented, random, simulation vector<double> LSM::GBM(const int M, const int N, const double T, const double r, const double q, const double sigma, const double S0){ double dt = T/N; vector<double> Z; vector<double> S; S.push_back(S0); mt19937 e2(time(0)); normal_distribution<double> dist(0.0, 1.0); for(int i = 0; i < M; i++){ Z.push_back(dist(e2)); } double drift = exp(dt*(r-0.5*sigma*sigma)); double vol = sqrt(sigma*sigma*dt); for(int i = 1; i < M; i++){ S.push_back(S[i-1] * drift * exp(vol*Z[i])); } return S; } This looks like a really interesting use of Brownian motion! Neat idea! Here are some suggestions for improving the code: Avoid using namespace std In general, using using namespace std is a bad idea. In a header, it's a very bad idea. Here's one description of why. Naming
{ "domain": "codereview.stackexchange", "id": 27764, "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, random, simulation", "url": null }
c++, algorithm, sorting, c++14 auto it = std::next(current_it, dist * 2); auto pe = std::next(current_pend, dist); do { --pe; it -= 2; auto insertion_point = std::upper_bound( std::begin(chain), *pe, *it, [=](const auto& lhs, const auto& rhs) { return compare(lhs, *rhs); } ); chain.insert(insertion_point, it); } while (pe != current_pend); std::advance(current_it, dist * 2); std::advance(current_pend, dist); }
{ "domain": "codereview.stackexchange", "id": 18015, "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, sorting, c++14", "url": null }
astronomy, atmospheric-science, telescopes, interferometry This puts severe constraints on the optical pathlengths used in the array of telescopes - basically you end up with requiring the various pathlengths between the telescopes and where the signals are recombined, to be the same within a wavelength of the light and this precision is difficult to achieve and maintain over longer baselines. For instance, you need very precisely controlled delay lines running in precisely measured vacuum tubes. What's more, because of the Earth's rotation, then to keep pathlengths similar as an object moves with respect to the telescope array, then the delay lines need fast, but accurate, moving components to compensate for this!
{ "domain": "physics.stackexchange", "id": 60640, "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": "astronomy, atmospheric-science, telescopes, interferometry", "url": null }
python, unit-testing, functional-programming, regex, validation assert extract_days_and_costs('NNNYNNN', '7') == ( [False, False, False, True, False, False, False], [0, 0, 0, 7, 0, 0, 0] ) assert extract_days_and_costs('NNNYNNN', '7;7') == ( [False, False, False, True, False, False, False], [0, 0, 0, 7, 0, 0, 0] ) assert extract_days_and_costs('NNNYNNY', '7;4') == ( [False, False, False, True, False, False, True], [0, 0, 0, 7, 0, 0, 4] ) assert extract_days_and_costs('NNNYNNY', '7;4.7') == ( [False, False, False, True, False, False, True], [0, 0, 0, 7, 0, 0, 4.7] )
{ "domain": "codereview.stackexchange", "id": 43240, "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, unit-testing, functional-programming, regex, validation", "url": null }
python, performance, python-3.x, file, unix I ran the Unix utility time and the Python module cProfile. Here is what I found (methods not comparable, as I was running other processes, but gives a good indication of slow parts of code): Ugo's method: tottime filename:lineno(function) 473.088 {method 'writelines' of '_io._IOBase' objects} 485.36 real 362.04 user 58.91 sys My code: tottime function 243.532 modulo 543.031 writeline 419.366 {method 'format' of 'str' objects} 1169.735 {method 'write' of '_io.TextIOWrapper' objects} 3207.60 real 2291.42 user 44.64 sys The Unix utility split: 1676.82 real 268.92 user 1399.16 sys Unfortunately, as far as I know, there is no chunks methods in the standard library. But this makes things rather neat. from itertools import chain, islice def chunks(iterable, n): "chunks(ABCDE,2) => AB CD E" iterable = iter(iterable) while True: yield chain([next(iterable)], islice(iterable, n-1))
{ "domain": "codereview.stackexchange", "id": 30866, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, performance, python-3.x, file, unix", "url": null }
algorithms, graphs, connected-components, directed-graphs This algorithm is very efficient, running in linear time with respect to $|V|$ and $|E|$. Additionally, it computes a correct set (which is easy to see why) and this set is the minimal set. Indeed, if there is an edge $(v,u)$ that is between two strongly connected components, but it is not in $S$, then $(v,u)$ will be in the new graph. Notice there is no path $u\rightsquigarrow v$ (otherwise $v$ and $u$ would have been in the same strongly connected component) and hence, the new graph will contain a component that is not strongly connected.
{ "domain": "cs.stackexchange", "id": 18570, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "algorithms, graphs, connected-components, directed-graphs", "url": null }
ros, microcontroller, gazebo, plugin, controller-manager No joint given in namespace: '/wheel_controller')
{ "domain": "robotics.stackexchange", "id": 10797, "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, microcontroller, gazebo, plugin, controller-manager", "url": null }
quantum-mechanics, quantum-interpretations Title: Given many-world interpretations, can we send a message to one of them? We have a sequence of 104 (13 * 8) independent boxes with 0 and 1 quantum states superimposed in each. We want to send 'Hello, world!' message to 1 world out of the many. So we say, if after measuring states in all the boxes, they say 'Hello, world!' in ASCII we deem the message received. If there's one world only, the chance of us receiving the message is small (0.5 ^ 104). If, assuming my understanding is correct, there is a different world for each quantum state combination, there will be a world that receives the message.
{ "domain": "physics.stackexchange", "id": 85043, "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-interpretations", "url": null }
algorithm, c, calculator if (err == 0) { printf("= %Lf\n", result); } } memset(expr, 0, strlen(expr)); } return 0; } Node *parse_to_postfix(char *expr) { Stack *output = stack_create(NULL); Stack *op_stack = stack_create(NULL); Node *bottom = NULL; int first_node_created = 0, previous_node_is_op = 1; char *num_buf = calloc(strlen(expr) + 1, sizeof(char)); if (num_buf == NULL) { perror("error:"); abort(); } for (char c = *expr; c != 0; c = *++expr) { if (isspace(c)) { continue; } int c_is_op = is_operator(c); int converted_num = 0; // convert num_buf to long double and push to output if ((c_is_op || c == '(' || c == ')') && strlen(num_buf) > 0) { stack_push(output, node_create(strtold(num_buf, NULL), TYPE_NUMBER)); memset(num_buf, 0, strlen(num_buf)); converted_num = 1; }
{ "domain": "codereview.stackexchange", "id": 45510, "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, calculator", "url": null }
quantum-mechanics, harmonic-oscillator I am currently doing a question on Harmonic Oscillators, I (sort of) understand the notation until it gets to the part where delta is included. Why is it there? \begin{equation} \hat{a}^{\dagger}\left\vert n\right\rangle=\sqrt{n\!+\!1}\left\vert n\!+\!1 \right\rangle\:, \qquad \hat{a}\left\vert n\right\rangle=\sqrt{n}\left\vert n\!-\!1 \right\rangle \tag{01} \end{equation} \begin{align} \left\langle k \vert \hat{x} \vert n\right\rangle & =\sqrt{\dfrac{\hbar}{2m\omega}}\biggl(\left\langle k \left\vert \hat{a}\vphantom{\hat{a}^{\dagger}}\right\vert n \right\rangle +\left\langle k \left\vert \hat{a}^{\dagger} \right\vert n \right\rangle\biggr) \nonumber\\ &=\sqrt{\dfrac{\hbar}{2m\omega}}\Bigl(\sqrt{n}\left\langle k \vert n\!-\!1 \right\rangle +\sqrt{n\!+\!1}\left\langle k \vert n\!+\!1 \right\rangle \Bigr) \nonumber\\ &=\sqrt{\dfrac{\hbar}{2m\omega}}\Bigl(\sqrt{n}\,\delta_{k,n-1} +\sqrt{n\!+\!1}\,\delta_{k,n+1} \Bigr) \tag{02} \\ &= \begin{cases}
{ "domain": "physics.stackexchange", "id": 42206, "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, harmonic-oscillator", "url": null }
particle-physics, electrons, standard-model, electroweak, chirality the Standard Model. Many of the above misconceptions would not have been enunciated and built up to an impossible crescendo if only a good summary of the SM were consulted before taking off on their avalanche.
{ "domain": "physics.stackexchange", "id": 50757, "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": "particle-physics, electrons, standard-model, electroweak, chirality", "url": null }
r, ggplot2 output of tail(final_tumor) # A tibble: 6 x 6 Feature.ID Feature.Name set Mean.Counts Log2.fold.change Adjusted.p.value <fct> <fct> <chr> <dbl> <dbl> <dbl> 1 ENSG00000210196.2 MT-TP Cluster.6 0.0699 -0.202 0.790 2 ENSG00000210196.2 MT-TP Cluster.7 0.0801 0.0386 1 3 ENSG00000210196.2 MT-TP Cluster.8 0.0711 0.0875 1 4 ENSG00000210196.2 MT-TP Cluster.9 0.0152 -2.31 0.00127 5 ENSG00000210196.2 MT-TP Cluster.10 0.0147 -2.30 0.00612 6 ENSG00000210196.2 MT-TP Cluster.11 0.122 0.762 1
{ "domain": "bioinformatics.stackexchange", "id": 1247, "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": "r, ggplot2", "url": null }
c++, serialization Example usage I'm currently using this when sending values over the wire. A simplified example, with all the error handling removed, looks something like: struct Response { BigEndian<std::uint16_t> seq_no; BigEndian<std::uint16_t> sample_value; }; We send by assigning (which implicitly converts our integer value to big-endian byte sequence) and then writing the structure: void send_result(std::uint16_t value) { Response r; r.seq_no = counter++; r.sample_value = value; write(fd, &r, sizeof r); } On the receive side, we read the wire representation into the same structure (so it's bitwise identical to the sending side) and then use the conversion operator to access the data in native form: std::uint16_t recv_result() { Response r; read(fd, &r, sizeof r); // ignore seq_no, for now return r.sample_value; } Changes since previous version Since version 1, I've changed the following:
{ "domain": "codereview.stackexchange", "id": 45159, "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++, serialization", "url": null }
- the consensus here seems to be "yeah, the proof is ok but rather informal since it invokes induction 'coded' in the 'and-so-on' statement". I don't agree. Imho this is no proof at all and there is no induction argument given. 1. The Argument starts with the claim (short of subtracting one from both sides of the equation). Why bother and continue? 2. The modifications made in order to get to the next line are completely unclear to me. Are all the elements in the series doubled? Then the result (left side) should be doubled as well but it isn't? - It's true that the author shouldn't be writing $2^n=\ldots$ until the last line - however, this is not a structural error in their proof, as they do not use the assumption. It's merely a stylistic problem. The manipulation from one line to the next is that they combine the terms $1+1$ into $2$, then $2+2$ into $4$, then $4+4$ into $8$ and so on. – Milo Brandt Jan 4 at 0:32
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9372107914029486, "lm_q1q2_score": 0.8426662664253948, "lm_q2_score": 0.8991213867309121, "openwebmath_perplexity": 494.5499069268852, "openwebmath_score": 0.9015089273452759, "tags": null, "url": "http://math.stackexchange.com/questions/1598280/is-collapsing-considered-a-legitimate-proof" }
homework-and-exercises, electromagnetism, waves, electromagnetic-radiation, maxwell-equations We have the Heaviside' form of Maxwell's equations in differential form, $$\nabla . \textbf{E} = \frac{\rho}{\epsilon_0}$$ $$\nabla . \textbf{B} = 0$$ $$\nabla \times \textbf{E} = -\frac{\partial\textbf{B}}{\partial t}$$ $$\nabla \times \textbf{B} = \mu_0 \left(\textbf{J} + \epsilon_0\frac{\partial\textbf{E}}{\partial t}\right)$$ In a vacuum and charge-free space ($\rho = 0, \textbf{J} = 0$), these equations are:, \begin{equation} \nabla . \textbf{E} = 0 \tag{3}\label{eq3} \end{equation} \begin{equation} \nabla . \textbf{B} = 0 \tag{4}\label{eq4} \end{equation} \begin{equation} \nabla \times \textbf{E} = -\frac{\partial\textbf{B}}{\partial t} \tag{5}\label{eq5} \end{equation} \begin{equation} \nabla \times \textbf{B} = \mu_0\epsilon_0\frac{\partial\textbf{E}}{\partial t} \tag{6}\label{eq6} \end{equation} We also have the vector identity for any vector function of space, \begin{equation} \nabla \times \textbf{V} = \nabla.(\nabla\textbf{V}) - \nabla^2\textbf{V} \tag{7}\label{eq7}
{ "domain": "physics.stackexchange", "id": 65590, "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, electromagnetism, waves, electromagnetic-radiation, maxwell-equations", "url": null }
atoms, elements, protons That said, there has been a relatively recent study on muonic helium, which is slightly different from a regular helium atom (two protons and two electrons) in that one of the electrons is replaced with an almost identical subatomic particle, the muon. It behaves like the electron in all aspects, except that it is about 200 times heavier, and decays within microseconds. During its brief existence, the muonic helium atom was observed to behave like a regular hydrogen atom. This is because muons and electrons are distinct subatomic particles and so Pauli's exclusion principle does not apply. The electronic configuration for muonic helium would be $\mathrm{(1s)^1}$ (like hydrogen), and its "muonic" configuration would also be $\mathrm{(1s)^1}$.
{ "domain": "chemistry.stackexchange", "id": 5016, "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": "atoms, elements, protons", "url": null }
java, console case "help": { handleHelp(words); continue; } } if (handleQuery(command)) { // Once here, the command was recognized as a query, so go // reiterate the REPL loop. continue; } // No match whatsoever, possibly the user wants to query a node // information. handlePrintNode(words); } System.out.println("Bye!"); } /** * Checks that an identifier is a valid Java identifier. * * @param identifier the identifier to check. * @return {@code true} only if the input identifier is valid. */ private static boolean isValidIdentifier(String identifier) { if (identifier.isEmpty()) { return false; } if (!Character.isJavaIdentifierStart(identifier.charAt(0))) { return false; }
{ "domain": "codereview.stackexchange", "id": 15753, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, console", "url": null }
optics, electromagnetic-radiation, visible-light, material-science Title: Trapping EM radiation Is there a material which can allow light (or any other EM radiation) to pass through from one side as if it is transparent but its other side reflects light like a mirror? Partially coated (silvered) mirrors could do the job, if you've got some radiation of high intensity. For example, a laser. The intense beam comes out through the partial-mirror after a series of constructive reflections. Wiki doesn't have a good article on one-way windows. But, Googling it can throw a lot of results. These one-way mirrors are imaginary.
{ "domain": "physics.stackexchange", "id": 6913, "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, electromagnetic-radiation, visible-light, material-science", "url": null }
ros Originally posted by spmaniato with karma: 1788 on 2016-04-03 This answer was ACCEPTED on the original site Post score: 2 Original comments Comment by Mohan on 2016-04-04: It worked. I'm able to get map, but distorted. I guess this might be due to not doing pre processing on RPlidar raw scan data. Please correct me if I'm wrong and Thank you very much for reply. Moreover If I move my RPlidar sometimes this error showup " searchDir angle change too large". Pls helpme Comment by spmaniato on 2016-04-04: I think it'd be best to open a new question about this, Mohan. There, also post a screenshot of the "distorted" map; it will help with debugging. Finally, could you please mark my answer above as correct by clicking on the checkmark icon on the left? Thanks
{ "domain": "robotics.stackexchange", "id": 24300, "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 }
passes! Of concurrency of the circle that contains each of the triangle, can a... Uk Labour Party push for proportional representation cookie policy circle determined by the three vertices of the circumcircle thus. Ratio - just for reference 14 in a circle policy and cookie policy less pure as generations go?..., B, C ) we wrap copper wires around car axles and them... Whose sides are of length 6, 8 and 10: where S, area of the triangle can. And practice circumcircle of that triangle and area ratio - just for reference Inverse points concurrence on the circumcircle thus. Quizzes in math, science, and engineering topics ( 968 Bytes ) by Bishnu Lamichhane perpendicular... Our terms of service, privacy policy and cookie policy triangle on Brilliant the symbol that... The word for changing your mind and not doing what you said you would own.. From each triangle vertex ( a, B, C = ( ). 'S formula radius and area ratio - just for reference ; Discover Resources temperament and personality and
{ "domain": "org.br", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.98527138442035, "lm_q1q2_score": 0.8314656998676856, "lm_q2_score": 0.843895106480586, "openwebmath_perplexity": 844.1588104766435, "openwebmath_score": 0.47940245270729065, "tags": null, "url": "http://www.iprede.org.br/mcxvhcj/st-joseph-school-admission-2020-2021-38a4b8" }
Their sum is 0. . . Let $\displaystyle z_1 \,=\, a + bi$ be one of the numbers. . . Then $\displaystyle z_2 \,=\,-(a+bi)$ is the other. Their product is 4: .$\displaystyle \text{-}(a+b)^2 \:=\:4$ . . $\displaystyle -(a^2 +2abi - b^2) \:=\:4 \quad\Rightarrow\quad (b^2-a^2) - 2abi \:=\:4 + 0i$ Equate real and imaginary components: .$\displaystyle \begin{Bmatrix}b^2-a^2 \:=\:4 & [1]\\ -2ab \:=\:0 & [2] \end{Bmatrix}$ From [2], if $\displaystyle a = 0$, then $\displaystyle [1]\!:\:b^2 = 4 \quad\Rightarrow\quad b = \pm 2$ From [2], if $\displaystyle b = 0$, then $\displaystyle [1]\!:\;-a^2 = 4 \quad\Rightarrow\quad a = \pm2i$ The two numbers are: .$\displaystyle 2i\text{ and }\text{-}2i.$ I find this needlessly complicated, and confusing. Let me point out why. If we write $z = a+bi$, the tacit assumption is that $a$ and $b$ are REAL. So your "second conclusion" from [2], is unwarranted, there is NO real number $a$ such that $a^2 = -4$.
{ "domain": "mathhelpforum.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.984093612020241, "lm_q1q2_score": 0.8045698237471676, "lm_q2_score": 0.8175744806385543, "openwebmath_perplexity": 844.307447889529, "openwebmath_score": 1.000002384185791, "tags": null, "url": "http://mathhelpforum.com/algebra/229559-given-two-unknown-complex-numbers.html" }
Whenever we have a permutation representation (we take a group acting on a set, and turn that into a representation by making the set the basis of a vector space), there are two obvious subspaces preserved by the group. The subspaces $$P_1 = \mathbb{C}(e_1 + \cdots + e_n), \quad P_0 = \{a_1 e_1 + \cdots + a_n e_n \mid a_1 + \cdots + a_n = 0 \}$$ are preserved under the action of $$S_n$$. Clearly we have $$P = P_1 \oplus P_0$$, and $$P_1$$ is isomorphic to the trivial representation, so now we just have to determine whether $$P_0$$ is irreducible. For this we can do a direct elementary proof.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9871787849789998, "lm_q1q2_score": 0.809381311503936, "lm_q2_score": 0.8198933403143929, "openwebmath_perplexity": 120.4644424909104, "openwebmath_score": 0.9962441325187683, "tags": null, "url": "https://math.stackexchange.com/questions/3564712/why-is-chi-rho-chi-1-always-a-character-and-why-is-it-irreducible" }
c++, opengl, sfml, glsl void Tutorial::createVBO() { GLfloat Vertices[] = { -0.8f, -0.8f, 0.0f, 1.0f, 0.0f, 0.8f, 0.0f, 1.0f, 0.8f, -0.8f, 0.0f, 1.0f }; GLfloat Colors[] = { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f }; // Its first parameter 1 describes the amount, or number of Vertex Arrays to generate. // second parameter mVAOID describes identifiers (or "names" in the OpenGL documentation) are stored in the arrays parameter glGenVertexArrays(1, &mVAOID); glBindVertexArray(mVAOID); // set it active glGenBuffers(1, &mVBOID); glBindBuffer(GL_ARRAY_BUFFER, mVBOID); glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW); glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0); glEnableVertexAttribArray(0);
{ "domain": "codereview.stackexchange", "id": 15044, "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++, opengl, sfml, glsl", "url": null }
performance, assembly, x86 ;---------------------------------------------------------------------- ; main routine ; writes formatted hex dump of STDIN to STDOUT ; ; Register usage: ; rax - various purposes, mostly data ; rbx - address (preserved across system calls) ; rcx - used as count of various things ; rdx - length of most recently read "line"; <= INPUTLEN ; rdi - destination pointer, various ; rsi - source pointer, various ; ;---------------------------------------------------------------------- GLOBAL _start _start: xor ebx, ebx ; initialize address = 0 %if ADDRBYTES mov al,'0' ; fill address with all zeroes lea rdi, [Address] mov rcx, ADDRLEN - 2 rep stosb mov al,':' ; then ':' stosb mov al,' ' ; then ' ' stosb %endif %if BUFFERBYTES mov [remaining], rbx ; clear remaining
{ "domain": "codereview.stackexchange", "id": 31715, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "performance, assembly, x86", "url": null }
whether the solution of the system of inequalities graphs system the. You agree to our Cookie Policy solutions for your textbooks written by experts... Vertices given equation step-by-step this website, you agree to our Cookie Policy before... Have step-by-step solutions for your textbooks written by Bartleby experts points of intersections of. Inequality statement that must be satisfied using this website, you can ’ t have a number. Both Word and PDF formats for easy printing/editing { aligne… 12 ) solve the triangle specified coordinates! A Algebra 2 student and need help = heres the information they me. In this almond-and-peanut situation, you agree to our Cookie Policy systems inequalities! Please do to solve fraction of seconds equation step-by-step this website uses cookies to ensure you the! Given triangle //www.freemathvideos.com in this almond-and-peanut situation, you can ’ t have a negative of. Our Cookie Policy the triangle specified by coordinates of the vertices it now
{ "domain": "logivan.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9496693659780477, "lm_q1q2_score": 0.8127756178578123, "lm_q2_score": 0.8558511488056151, "openwebmath_perplexity": 966.1076623985807, "openwebmath_score": 0.5818327069282532, "tags": null, "url": "https://logivan.com/hj1n01zd/d791c2-find-vertices-of-system-of-inequalities-calculator" }
ros, catkin, ros-hydro, serialization, messages Where Item is only otherwise defined as a C++ class. This will not work, you must have a corresponding .msg definition of the Item class. This will generate C++ and Python (others) code for the Item.msg message definition, but in your code you can use your own Item class and then use the message traits to have a custom serialization for your custom implementation of the Item class. For instance, you might define the Item.msg file as: string name uint32 id This will produce some C++ code like this (simplified): namespace your_package_name { struct Item_ { std::string name; uint32_t id; }; typedef Item_ Item; } But then you could make your own Item class: namespace my_item_class { class Item { public: void setName(std::string name) {name_ = name;} std::string getName() {return name_;} void setId(size_t id) {id_ = id;} size_t getId() {return id_;} private: std::string name_; size_t id; }; }
{ "domain": "robotics.stackexchange", "id": 16968, "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, catkin, ros-hydro, serialization, messages", "url": null }
algorithms, time-complexity, partitions, subset-sum Why taking the $i$ and $n-i$ elements would give the same sum? For simplicity, let's pretend there are no duplicates in your array. The answer generalizes easily to arrays containing duplicates. If the array can be divided into pairs of equal sum, then the lowest number (on place $0$ in the sorted array) and the highest number (on place $n$ in the sorted array) has to be a pair. We can do a proof be contradiction by assuming that the lowest number ($x_0$) and the highest number ($x_n$) is not a pair. As all numbers in the array needs to be in a pair, this implies that $x_0$ is in a pair with an other number $x_j$ and likewise that $x_n$ is in a pair with $x_k$. As $x_n$ is the highest number, it must be that $x_j \lt x_n$ and therefore, in order for $x_o + x_j$ to be equal to $x_k + x_n$ it must be that $x_k \lt x_0$ but this goes against our assumption that $x_0$ is the lowest number.
{ "domain": "cs.stackexchange", "id": 11422, "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, time-complexity, partitions, subset-sum", "url": null }
newtonian-mechanics, stress-strain Title: Why rotation causes twisting stress? Measuring stress of a rotating shaft is a way of measuring the torque and power transmitted by the shaft. But in which way rotation of a shaft causes stress? Conceptually speaking, a shaft transmits torque from some power source to some load. If we have a clockwise torque applied to a shaft by a power source, the shaft transmits a clockwise torque to a load. At the same time, due to Newton's third law, the load applies a counterclockwise torque the shaft. As a result, there are two oppositely directed torques acting on the two ends of the shaft and, naturally, causing a twisting (or torsional) stress.
{ "domain": "physics.stackexchange", "id": 50066, "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, stress-strain", "url": null }
Multiple Choice Which expression is NOT equivalent to 1? 1.) Find an expression equivalent to sec theta sin theta cot theta csc theta. tan theta csc theta sec theta ~ sin theta 2.) Find an expression equivalent to cos theta/sin theta . tan theta cot theta ~ sec theta csc theta 3.) Simplify … 1.) Find an expression equivalent to sec theta sin theta cot theta csc theta. tan theta csc theta sec theta ~ sin theta 2.) Find an expression equivalent to cos theta/sin theta . tan theta cot theta ~ sec theta csc theta 3.) Simplify … 6. trig If sin theta is equal to 5/13 and theta is an angle in quadrant II find the value of cos theta, sec theta, tan theta, csc theta, cot theta. 7. math I have a question I have been working on since yesterday and I am not making this up. I couldn't get the right answer. If sin theta = -2/3, which of the following are possible? 8. Trigonometry
{ "domain": "jiskha.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9817357232512719, "lm_q1q2_score": 0.8049185771219733, "lm_q2_score": 0.8198933359135361, "openwebmath_perplexity": 6455.914811549761, "openwebmath_score": 0.8843334317207336, "tags": null, "url": "https://www.jiskha.com/display.cgi?id=1461280465" }
of Eigenvalues and Eigenvectors Powers of a Diagonal Matrix Eigenvalues and eigenvectors have widespread practical application in multivariate statistics. Because CA is a descriptive technique, it can be applied to tables for which the chi-squared statistic is appropriate or not. Use a matrix equation to solve a system of first-order linear differential equations. . 49, No. 52, No. ^ , given by. Dimensionality reduction may also be appropriate when the variables in a dataset are noisy. Mathematically, the transformation is defined by a set of size We want to find n as a function of component number It has been used in determining collective variables, that is, order parameters, during phase transitions in the brain. Here, a best-fitting line is defined as one that minimizes the average squared distance from the points to the line. Eigenvalues and Eigenvectors for Special Types of Matrices. MPCA is solved by performing PCA in each mode of the tensor iteratively. It means multiplying by
{ "domain": "decortech.pl", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9811668734137682, "lm_q1q2_score": 0.8067047406864422, "lm_q2_score": 0.8221891327004132, "openwebmath_perplexity": 850.2870432599236, "openwebmath_score": 0.8346825242042542, "tags": null, "url": "http://www.decortech.pl/slug/application-of-eigenvalues-and-eigenvectors-in-statistics-78ff40" }
c#, .net, wpf, xaml public Color Background { get; set; } public Color Foreground { get; set; } public Color Border { get; set; } } The following example shows how to create and start a tour: var tour = new Tour() { Name = "My Demo Tour", ShowNextButtonDefault = true, Steps = new [] { new Step("Element01", "Header 01", "Content 01", "StepID01"), new Step("Element02", new HeaderViewModel(), new ContentViewModel(), "StepID02") { ContentDataTemplateKey = "ContentTemplate02", HeaderDataTemplateKey = "HeaderTemplate02" }, // ... } }; tour.Start();
{ "domain": "codereview.stackexchange", "id": 20003, "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, wpf, xaml", "url": null }
• @Bob: you may find it helpful to think of $\sqrt{2}$ as $2^{\frac{1}{2}}$ and $\frac{1}{2}$ as $2^{-1}$ so that the division is confined to the exponents. – Rob Arthan Jul 18 '20 at 21:26
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9780517475646369, "lm_q1q2_score": 0.8332539341605781, "lm_q2_score": 0.851952809486198, "openwebmath_perplexity": 187.4747005732582, "openwebmath_score": 0.9344634413719177, "tags": null, "url": "https://math.stackexchange.com/questions/3761608/is-it-true-that-frac-lna2-ln-sqrta-for-a0-in-particular-is-fr/3761619" }
c++, strings, c++17, vectors vector<string> split(string s, string delimiter) { size_t pos_start = 0, pos_end, delim_len = delimiter.length(); string token; vector<string> res; while ((pos_end = s.find(delimiter, pos_start)) != string::npos) { token = s.substr(pos_start, pos_end - pos_start); pos_start = pos_end + delim_len; res.push_back(token); } res.push_back(s.substr(pos_start)); return res; }
{ "domain": "codereview.stackexchange", "id": 37491, "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++, strings, c++17, vectors", "url": null }
quantum-gate, circuit-construction Initial state: Change rotation basis: Phase the parity on the top bit instead of the bottom bit: Apply XZ = iY to the adjacent CX CZ operations: Move the middle CNOT leftward, changing its interaction basis from XZ to XY to ZY to ZY as it moves through the single qubit gates, resulting in it become a CY: Cancel the adjacent CYs, then propagate the non-parameterized rotations rightward. This changes the basis of the rotation back to Y, and transforms the NOTC into a CY. Cancel the two X rotations and you're done.
{ "domain": "quantumcomputing.stackexchange", "id": 1557, "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-gate, circuit-construction", "url": null }
# Bounding a complex integral over a square I'm solving the following exercise: Use the estimate lemma to prove that $$\left|\oint_\gamma \frac{z-2}{z-3}\,{\rm d}z\right| \leq 4\sqrt{10},$$where $\gamma$ is the square with vertices $\pm 1 \pm i$. Clearly the lenght of the square is $8$. Starting from $-1-i$, counterclockwise, call the sides of the square $\gamma_1,\ldots,\gamma_4$. • For $\gamma_1$ and $\gamma_3$, we have $|z-2| \leq \sqrt{10}$ and $|z-3| \geq \sqrt{5}$, whence: $$\left|\frac{z-2}{z-3}\right|\leq \frac{\sqrt{10}}{\sqrt{5}} = \sqrt{2}.$$ • For $\gamma_2$, we have $|z-2| \leq \sqrt{2}$ and $|z-3| \geq 2$, so: $$\left|\frac{z-2}{z-3}\right|\leq \frac{\sqrt{2}}{2}.$$ • For $\gamma_4$, we have $|z-2| \leq \sqrt{10}$ e $|z-3| \geq 4$, so: $$\left|\frac{z-2}{z-3}\right| \leq \frac{\sqrt{10}}{4}$$ The greatest of these upper bounds is $\sqrt{2}$. So that inequality is good on all of $\gamma$. We get:$$\left|\oint_\gamma \frac{z-2}{z-3}\,{\rm d}z\right| \leq 8\sqrt{2}.$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9811668734137682, "lm_q1q2_score": 0.8089347305515922, "lm_q2_score": 0.8244619263765707, "openwebmath_perplexity": 329.48654683158344, "openwebmath_score": 0.9422252178192139, "tags": null, "url": "https://math.stackexchange.com/questions/1332225/bounding-a-complex-integral-over-a-square" }
robot-state-publisher Comment by dornhege on 2013-09-14: This output looks to me like the output from the rosmaster. You'd be interested in the output of robot_state_publisher as that's causing your problems. Comment by dornhege on 2013-09-20: Can you try, if the errors in your example still appear when you use revolute instead of continuous joints? Comment by rnunziata on 2013-09-20: Yes...same error I opened a ticket on this issue
{ "domain": "robotics.stackexchange", "id": 15517, "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": "robot-state-publisher", "url": null }
c#, homework This would let you handle each value separately, and store them all in one predefined dictionary. It's acceptable approach for some senarios, however the better approach would be to have a class model that would hold these values something like this : public class MonthlyExpenses { public decimal Income { get; set; } public decimal Tax { get; set; } public decimal Groceries { get; set; } public decimal Utilities { get; set; } public decimal Travel { get; set; } public decimal Phone { get; set; } public decimal Other { get; set; } }
{ "domain": "codereview.stackexchange", "id": 42990, "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#, homework", "url": null }
performance, algorithm, c, memory-optimization, compression if(!(node = malloc(sizeof(huffman_node_t)))) return NULL; node->freq = first_child->freq + second_child->freq; node->child[0] = first_child; node->child[1] = second_child; return node; } int create_huffman_tree(size_t * freq, huffman_node_t ** head_node) { huffman_node_t * node_list[256] = { NULL }; huffman_node_t * internal_node; huffman_node_t ** node_list_p; size_t node_count = 0; for(uint16_t i = 0; i < 256; i++) if(freq[i] && !(node_list[node_count++] = create_byte_node((uint8_t)i, freq[i]))) return MEM_ERROR; node_list_p = node_list; while(node_count > 1) { qsort(node_list_p, node_count, sizeof(huffman_node_t *), node_compare); if(!(internal_node = create_internal_node(node_list_p[0], node_list_p[1]))) return MEM_ERROR; node_list_p[0] = NULL; node_list_p[1] = internal_node; node_list_p++; node_count--; }
{ "domain": "codereview.stackexchange", "id": 38850, "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, algorithm, c, memory-optimization, compression", "url": null }
which is $20$% plus $20$% plus $20$% plus $4$% plus $4$% plus $4$% plus $0.8$% greater than $A.$ One way to explain the underlying reason why the 2nd term is not two $20$% increases, and the 3rd term is not three $20$% increases, etc. is due to the presence of the cross terms when expanding a binomial (i.e. $(x+y)^n$ is not just $x^n+y^{n}).$ Another way to explain this is that when computing the 3rd term, you increase the 2nd term by $20$%, so the 3rd term is the 2nd term plus $20$% of the 2nd term, which is a little more than the 2nd term plus $20$% of the 1st term; and when computing the 4th term, you increase the 3rd term by $20$%, so the 4th term is the 3rd term plus $20$% of the 3rd term, etc. • Magnificent answer, hats off.. Jan 11, 2016 at 17:12
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9808759654852756, "lm_q1q2_score": 0.8173880608989723, "lm_q2_score": 0.8333245891029456, "openwebmath_perplexity": 148.36390033150778, "openwebmath_score": 0.9255741238594055, "tags": null, "url": "https://math.stackexchange.com/questions/1608152/question-referring-to-percentage-increase" }
gauge-theory, symmetry-breaking, gauge-invariance In the end, you will arrive at three objects: $H$-matter fields $\tilde{\psi}$, a notion of an $H$-covariant derivative $\mathcal{D}_{\mu}=\partial_{\mu}+it_iE_{i\mu}$, where $t_i$ are the generators of $H$, and $E_{i\mu}$ is built out of the goldstone fields, and $D_{a\mu}$ fields which encode the derivative of the goldstone fields in an $H$-covariant way. The theorem is that any $H$ invariant lagrangian built out of $\tilde{\psi}$, $\mathcal{D}_{\mu}\tilde{\psi}$, and $D_{a\mu}$ is invariant with respect to $G$. In this construction, we arrive at $E_{i\mu}$ which looks very much like an $H$-gauge field, in that it transforms inhomogeneously with respect to $g\in G$ $$t_iE_{i\mu}\to h(\xi,g)\big(t_iE_{i\mu}\big)h^{-1}(\xi,g)+i(\partial_{\mu}h(\xi,g))h^{-1}(\xi,g)$$ Where $h(\xi,g)\in H$ depends on the Goldstone fields $\xi_a(x)$. For completeness, here are the other transformations under $g\in G$ $$\tilde{\psi}\to h(\xi,g)\tilde{\psi}$$
{ "domain": "physics.stackexchange", "id": 81945, "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": "gauge-theory, symmetry-breaking, gauge-invariance", "url": null }
c# if (secKey.GetValue(sValueName) != null) { secKey.DeleteValue(sValueName); } } } I don't want to echo BCdotWEB's observations, they are all valid ones. Rather I would like to focus on the RegisteryKey API usage. OpenSubKey Let's take a look at the signature of the method first: public Microsoft.Win32.RegistryKey? OpenSubKey (string name, bool writable); As you can see it may return a RegisteryKey or a null. So, it might make sense to check the result of this operation against null before you call any method on it to prevent NullReferenceException. The name parameter can work as a path as well. So, you could call OpenSubKey like this: .OpenSubKey("Software\\Microsoft\\Windows", true); //OR .OpenSubKey(@"Software\Microsoft\Windows", true); Now, let's look at the Exceptions:
{ "domain": "codereview.stackexchange", "id": 40559, "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#", "url": null }
# How should I define the limit definition of a derivative using negative numbers? Typically the derivative is defined at a point $x$, assuming it is differentiable at it, by $$\lim_{n \rightarrow \infty} \frac{f(x + \frac{1}{n}) - f(x)}{\frac{1}{n}}$$ But I want to define it using $f(x - \frac{1}{n})$. Should I use $$\lim_{n \rightarrow \infty} \frac{f(x - \frac{1}{n}) - f(x)}{|-\frac{1}{n}|}$$ or $$\lim_{n \rightarrow \infty} \frac{f(x) - f(x - \frac{1}{n}) }{|-\frac{1}{n}|}$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9732407175907054, "lm_q1q2_score": 0.8348148460269881, "lm_q2_score": 0.8577681049901037, "openwebmath_perplexity": 187.3117338859719, "openwebmath_score": 0.9383382797241211, "tags": null, "url": "https://math.stackexchange.com/questions/605405/how-should-i-define-the-limit-definition-of-a-derivative-using-negative-numbers" }
quantum-mechanics, momentum, heisenberg-uncertainty-principle, commutator $$ \Delta v\,\Delta x\geq \frac12\frac{\hbar}{m_m} $$ and the uncertainty principle for helium atoms as as $$ \Delta v\,\Delta x\geq \frac12\frac{\hbar}{m_\mathrm{He}} $$ and so on and on and on, but why would you do that when you can just issue a single principle that applies for all particles, $$ \Delta p\,\Delta x\geq \frac12\hbar, $$ and be done with it?
{ "domain": "physics.stackexchange", "id": 44568, "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, momentum, heisenberg-uncertainty-principle, commutator", "url": null }
c#, linq, mvc ...Which is still horrible. Why are you using the query syntax? If you have navigation properties on your entities (assuming EF), I find this would be much easier to parse: public IQueryable<StudentTrack> StudentTracks(int employeeId) { return _dbContext.EducationPortalStudentTracks .Where(studentTrack => studentTrack.EmployeeId == employeeId) .OrderBy(studentTrack => studentTrack.Track.Id) .Select(studentTrack => new StudentTrack { Id = studentTrack.Id, TrackId = studentTrack.TrackId, Name = studentTrack.Track.Name, Deadline = studentTrack.Deadline, PercentComplete = CalculatePercentCompletion(studentTrack) }); }
{ "domain": "codereview.stackexchange", "id": 7953, "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#, linq, mvc", "url": null }
javascript The general rule of thumb is to avoid the ternary operator when it hurts readability, but that's subjective and may change from person to person, team to team. See also this related discussion. What can be said fairly objectively, the ternary operator is best when:
{ "domain": "codereview.stackexchange", "id": 11570, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript", "url": null }
machine-learning, tensorflow, r, logistic-regression #choose different cutoff for the accuracy DTaccuracy <- data.frame() for (cutoff in seq(0,1,by = 0.01)) { predBi <- pred >= cutoff; crossTab <- table(predBi,dat_test$mort) accuracy = (crossTab[1]+crossTab[4])/sum(crossTab) DTaccuracy <- rbind(DTaccuracy,c(accuracy,cutoff)) } names(DTaccuracy) <- c('Accuracy','Cutoff') qplot(x=Cutoff, y = Accuracy, data = DTaccuracy)
{ "domain": "datascience.stackexchange", "id": 5994, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "machine-learning, tensorflow, r, logistic-regression", "url": null }
electromagnetism, forces, classical-mechanics, lagrangian-formalism, constrained-dynamics Title: Is the magnetic Lorentz force $\vec{F} = q(\vec{v}\times\vec{B})$ a force of constraint? I am currently studying the Lagrangian mechanics, and as far as I've understood, forces of constraint are the forces that are perpendicular to the surface of the movement of the object, thus do not cause any change in the velocity of, and constrain the trajectory of the object, (e.g. force due to the tension, the normal force). The magnetic Lorentz force fulfills all of those I mentioned above, so is it also a type of force of constraint? No, it isn't. When you talk about a constraint force, you're talking about a force which constrains the motion of a particle to a particular spatial region, such as a curve or a surface. The Lorentz force does not do this; objects under the influence of the Lorentz force can explore all of space.
{ "domain": "physics.stackexchange", "id": 95778, "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, forces, classical-mechanics, lagrangian-formalism, constrained-dynamics", "url": null }
Definition:Interval/Ordered Set Definition Let $\struct {S, \preccurlyeq}$ be an ordered set. Let $a, b \in S$. The intervals between $a$ and $b$ are defined as follows: Open Interval The open interval between $a$ and $b$ is the set: $\openint a b := a^\succ \cap b^\prec = \set {s \in S: \paren {a \prec s} \land \paren {s \prec b} }$ where: $a^\succ$ denotes the strict upper closure of $a$ $b^\prec$ denotes the strict lower closure of $b$. Left Half-Open Interval The left half-open interval between $a$ and $b$ is the set: $\hointl a b := a^\succ \cap b^\preccurlyeq = \set {s \in S: \paren {a \prec s} \land \paren {s \preccurlyeq b} }$ where: $a^\succ$ denotes the strict upper closure of $a$ $b^\preccurlyeq$ denotes the lower closure of $b$. Right Half-Open Interval The right half-open interval between $a$ and $b$ is the set: $\hointr a b := a^\succcurlyeq \cap b^\prec = \set {s \in S: \paren {a \preccurlyeq s} \land \paren {s \prec b} }$ where:
{ "domain": "proofwiki.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9857180639771091, "lm_q1q2_score": 0.8358571408903961, "lm_q2_score": 0.8479677622198946, "openwebmath_perplexity": 455.960952031834, "openwebmath_score": 0.9964783191680908, "tags": null, "url": "https://www.proofwiki.org/wiki/Definition:Interval_of_Ordered_Set" }
nuclear-physics, fusion, binding-energy Title: How does binding energy work? I do not have a very advanced understanding of binding energy and atomic mass but in my classes, I have learned that the atomic mass is equal to the sum of the number of protons and the number of neutrons. But I know this to not be the case every time because during fusion energy is emitted due to the mass of the product (say, Helium-4) being lighter than the nuclei that you started with (say, 2 protium nuclei). In a book (The Universe in Your Hand, by Christophe Galfard), I read that the difference in mass from which the energy is emitted (due to E=mc^2) is actually from the mass of the mesons (two quarks?) and gluons that carry the strong force between the quarks and between protons and neutrons. According to the book, when fusion occurs the number of gluons and mesons required to hold the atom together is less (the binding energy?), and therefore the total mass decreases.
{ "domain": "physics.stackexchange", "id": 84940, "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": "nuclear-physics, fusion, binding-energy", "url": null }
c#, linq catch (Exception ex) { logger.ErrorException(string.Empty, ex); } } private void AddUpdateRowOrganizations() { try { tRANSMITDOCORGANIZATIONRELATIONSBindingSource.EndEdit(); var t = tRANSMITDOCORGANIZATIONRELATIONSBindingSource.Current as WcfDataServiceReference.TRANSMIT_DOC_ORGANIZATION_RELATIONS; if (t.TRANSMIT_DOC_ID == 0) { if (!cachetdorList.Contains(t)) { cachetdorList.Add(t); } return; } context.UpdateObject(t); } catch (Exception ex) { logger.ErrorException(string.Empty, ex); } } private void AddUpdateRowPartators() { try { tRANSMITDOCPARTATORRELATIONSBindingSource.EndEdit();
{ "domain": "codereview.stackexchange", "id": 115, "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#, linq", "url": null }
ne.neural-evol, scheduling, genetic-algorithms Any ideas/suggestions/papers will be highly appreciated, as I've run out of ideas and research papers and almost no time left. UPD: some description of the problem: There are number of visits(shifts) that are located in different geographical places (distances between locations are known). Currently I work with 700 visits per week with durations from 30 minutes to 5hrs. There are workers with different levels of contractual arrangements: some have 0 contracted hours - relief workers, there are part-timers and full-timers. I need to allocated workers for every shift in a best possible manner with this factors in mind:
{ "domain": "cstheory.stackexchange", "id": 1032, "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": "ne.neural-evol, scheduling, genetic-algorithms", "url": null }
html, converting, powershell This could just be written as: if($headers[$i]) ConvertFrom-HtmlTable if ($headers -gt [System.String]::Empty) You can use ![String]::IsNullOrEmpty($headers) for this, but really, it can be shortened to just: if ($headers)
{ "domain": "codereview.stackexchange", "id": 15156, "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": "html, converting, powershell", "url": null }
java } result[i][j + 1] = result[--i][j] + result[++i][j]; Don't ever use something like that. You can get into very serious trouble if you modify the code slightly and your -- are not well "aligned" with your ++. It's less efficient because you are making two useless assignments.
{ "domain": "codereview.stackexchange", "id": 9661, "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 }
vba, error-handling, excel, time-limit-exceeded Don't abuse the _ operator. Dim A() As String, _ wb As Workbook, _ wS As Worksheet, _ Dic As Scripting.Dictionary, _ DicItm As Variant, _ NbMaxWords As Integer, _ TpStr As String, _ Results() As Variant, _ DicItm2 As Object, _ R(), _ iA As Long, _ i As Long, _ j As Long, _ k As Long, _ c As Range Why do you want all these declarations on the same line? Just declare them separately like so: Dim A() As String Dim wb As Workbook Dim ws As Worksheet Dim Dic As Scripting.Dictionary Dim DicItm As Variant Dim NBMaxWords as Integer etc. Now, you don't have to spend precious development time fiddling around with alignments and the inevitable missing / mis-typed _s that will crop up. Good naming is really, really important To quote developers far more experienced than I: "There are only three hard things in computer science: cache invalidation, off-by-one errors and naming things."
{ "domain": "codereview.stackexchange", "id": 18491, "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, error-handling, excel, time-limit-exceeded", "url": null }
newtonian-mechanics, reference-frames, vectors, free-body-diagram, string How do I know which one to consider? Because they both make equal sense.
{ "domain": "physics.stackexchange", "id": 81196, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, reference-frames, vectors, free-body-diagram, string", "url": null }
c++, object-oriented, array, matrix Title: Short square matrix class in C++ using an array I'm a novice at C++ in comparison with other languages, so as an exercise I wrote a square Matrix class that doesn't use STL. #ifndef MATRIX_H #define MATRIX_H #include <initializer_list> #include <algorithm> class Matrix { public: Matrix(std::size_t sz) : elements{new int[sz * sz]}, size{sz} {} Matrix(std::size_t sz, std::initializer_list<int> elem) : Matrix(sz) { std::copy(elem.begin(), elem.end(), elements); } ~Matrix() { delete[] elements; } /** Get the matrix element at row i and column j. */ int get(std::size_t i, std::size_t j) const { return elements[convert(i, j)]; } /** Set the value of the matrix at row i and column j and return the old value. */ int set(std::size_t i, std::size_t j, int new_value) { std::size_t idx = convert(i, j); int old_value = elements[idx]; elements[idx] = new_value; return old_value; } std::size_t width() const { return size; }
{ "domain": "codereview.stackexchange", "id": 29240, "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++, object-oriented, array, matrix", "url": null }