text
stringlengths
1
1.11k
source
dict
So then the minimum is $\int_0^1y^{'2}dx = 2\pi^2n^2.$ Is this correct? #### M R ##### Active member Perfect question for my revision. Thanks. I did the question before I looked at your solution and I only have a couple of small differences. I explicitly considered $$\displaystyle \lambda\le 0$$ to show that those solutions to the ELE don't satisfy the boundary conditions. Also at the end you can say that n=1 will give the minimum as n=0 doesn't satisfy the constraint. So $$\displaystyle y=\sqrt{2} \sin(\pi x)$$ and the minimum value is $$\displaystyle 2\pi^2$$. As I say, I'm just revising this for an exam myself so I'm not an expert. Edit: I think you forgot to square B when you evaluated the constraint integral. Last edited:
{ "domain": "mathhelpboards.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9845754470129647, "lm_q1q2_score": 0.8026578837835644, "lm_q2_score": 0.8152324803738429, "openwebmath_perplexity": 2676.880124716948, "openwebmath_score": 1.0000073909759521, "tags": null, "url": "https://mathhelpboards.com/threads/min-of-an-integral-lagrange-multipliers-for-e-l.6489/" }
visible-light, speed-of-light, acoustics, refraction Title: Light propagating through a sound wave We know that the speed of light depends on the density of the medium it is travelling through. It travels faster through less dense media and slower through more dense media. When we produce sound, a series of rarefactions and compressions are created in the medium by the vibration of the source of sound. Compressions have high pressure and high density, while rarefactions have low pressure and low density. If light is made to propagate through such a disturbance in the medium, does it experience refraction due to changes in the density of the medium? Why don't we observe this? Actually this effect has been discovered in 1932 with light diffracted by ultra-sound waves. In order to get observable effects you need ultra-sound with wavelengths in the μm range (i.e. not much longer than light waves), and thus sound frequencies in the MHz range. See for example here: On the Scattering of Light by Supersonic Waves by Debye and Sears in 1932
{ "domain": "physics.stackexchange", "id": 56574, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "visible-light, speed-of-light, acoustics, refraction", "url": null }
python, library, libgdx if found_all_in_set(ANDROID_LIBS, found_libraries): platforms.append("android") if found_all_in_set(DESKTOP_LIBS, found_libraries): platforms.append("desktop") if found_all_in_set(GWT_LIBS, found_libraries): platforms.append("gwt") return platforms, locations
{ "domain": "codereview.stackexchange", "id": 4022, "lm_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, library, libgdx", "url": null }
c#, multithreading, thread-safety, event-handling, observer-pattern Do you see any race conditions or things that could go wrong? Maybe you have optimizations or simplifications to add? Input is highly appreciated! /// <summary> /// Triggers if the event is invoked or was invoked before subscribing to it. /// <para> Can be accessed safely by multiple threads.</para> /// </summary> public class AutoInvokeEvent<Sender, Args> { public delegate void EventHandle(Sender sender, Args arguments);
{ "domain": "codereview.stackexchange", "id": 32649, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, multithreading, thread-safety, event-handling, observer-pattern", "url": null }
graph-theory, graph-algorithms, np-complete Problem 0 (your problem): Given a graph $G$, does G have an induced subgraph with at least k vertices, such that all vertices have even degree within the subgraph? Problem 1: Given a graph $G$ and subset $A$ of vertices, does $G$ have an induced subgraph with at least $k$ vertices in $A$, such that all vertices have even degree within the subgraph? Problem 2: Given a graph $G$ and subsets $A, B$ of vertices, does $G$ have an induced subgraph with at least $k$ vertices in $A$, such that all vertices in $B$ have even degree within the subgraph? Max-cut: Given a graph $G$, does there exist a cut $C \subset V$ of size $|\delta(C)|$ at least $k$? (where $\delta(C)$ is the set of edges in $E$ with exactly one endpoint in $C$) We'll reduce max-cut to problem 2, problem 2 to problem 1, and finally problem 1 to problem 0, proving that your problem is NP-complete.
{ "domain": "cstheory.stackexchange", "id": 4805, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "graph-theory, graph-algorithms, np-complete", "url": null }
quantum-field-theory, special-relativity, lorentz-symmetry $$ \Big\{\big(\psi_k(t,\bfx)\big)^+,\,\big(\psi_k(t,\bfy)\big)^-\Big\}=0, \tag{8b} $$ and similarly for $\psi_k^*(x)$. The energy-increasing and -decreasing operators $A^\pm(t)$ are not localized in any finite region of spacetime: they do not belong to $F(R)$ for any finite $R$. For example, the operator $(\psi_k(0,\bfx))^+$ involves the operators $\psi_j(0,\bfy)$ for arbitrarily large $|\bfx-\bfy|$. The coefficient of $\psi_j(0,\bfy)$ in $(\psi_k(0,\bfx))^+$ decreases exponentially with increasing $|\bfx-\bfy|$, with a characteristic scale given by the Compton length scale $\hbar/mc$ where $m$ is the electron's mass, so it rapidly approaches zero, but it isn't equal to zero. D. The spectrum condition We still need to represent the field operators as things that act on a Hilbert space. One of the most important general principles of QFT is that the Hilbert-space representation should satisfy the spectrum condition. This means that we should have $$
{ "domain": "physics.stackexchange", "id": 62346, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-field-theory, special-relativity, lorentz-symmetry", "url": null }
performance, c, hash-map, c99 static CGL_hashtable_entry* __CGL_hashtable_get_entry_ptr(CGL_hashtable* table, const void* key) { size_t key_size, hash_table_index; __CGL_hashtable_get_key_size_and_table_index(table, &key_size, &hash_table_index, key); CGL_hashtable_entry* current_entry = &table->entries[hash_table_index]; while(current_entry != NULL) { if(memcmp(current_entry->key, key, key_size) == 0) return current_entry; current_entry = current_entry->next_entry; } return NULL; } CGL_hashtable* CGL_hashtable_create(size_t table_size, size_t key_size) { CGL_hashtable* table = (CGL_hashtable*)CGL_malloc(sizeof(CGL_hashtable)); table->count = 0; table->entries = (CGL_hashtable_entry*)CGL_malloc(sizeof(CGL_hashtable_entry) * table_size); memset(table->entries, 0, (sizeof(CGL_hashtable_entry) * table_size)); table->key_size = key_size; table->table_size = table_size; table->hash_function = CGL_utils_super_fast_hash; return table; }
{ "domain": "codereview.stackexchange", "id": 43880, "lm_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, c, hash-map, c99", "url": null }
algorithms, optimization Again, the goal is to minimize the number of bills that change hands. In other words: $$ \begin{align} \text{Minimize:} & \sum_{i=0}^{n-1}{\sum_{j=0}^{m-1}{C_{i,j} x_{i,j}}} \\ \text{subject to:} & \sum_{i=0}^{n-1}{x_{i,j}} = 1 \text{ for } 0 \le j \lt m, \\ & \sum_{j=0}^{m-1}{x_{i,j}b_j = p_i} \text{ for } 0 \le i \lt n, \\ \text{and} & x_{i,j} \ge 0 \end{align} $$ The first constraint says that the solution can only assign a particular bill to one party, and the second ensures that everyone pays the appropriate amount. This is the 0,1 INTEGER PROGRAMMING problem and is NP-complete (see [Karp 1972]). The Wikipedia page about linear programming has information on different algorithms that can be used for these types of problems. There are potentially multiple optimal solutions; by hand the first solution to the example I came up with was: $$ x = \left[ \begin{array}{cccccccccc} 0 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 1 & 1 \\ 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
{ "domain": "cs.stackexchange", "id": 509, "lm_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, optimization", "url": null }
python, unit-testing, binary-search, trie, autocomplete if __name__ == '__main__': main() # autocomplete_test.py #!python from autocomplete import insert_word from tries import Trie import unittest class TrieTest(unittest.TestCase): def test_init(self): trie = Trie() data, is_word = trie.root.data assert data == "" assert is_word is False assert trie.root.next == {}
{ "domain": "codereview.stackexchange", "id": 31137, "lm_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, binary-search, trie, autocomplete", "url": null }
7. Originally Posted by HallsofIvy Skeeters method, find the roots to the original equation, take the reciprocal, and create the new equation from that is the obvious and simplest method. Here is a little more "sophisticated" method. Look at the general product (x- a)(x- b)= x^2- (a+b)x+ ab. If, instead, we have (x- 1/a)(x- 1/b) we get x^2- (1/a+ 1/b)x+ 1/ab. You can see that the last term, 1/ab, is just the reciprocal in the original equation, ab. Also 1/a+ 1/b= b/ab+ a/ab= (a+b)/ab so the coefficient of x in the last equation is the coeffient of x in the original equation divided by the last term. Starting from 3x^2+2x-1=0, which is the same as x^2+ (2/3)x- 1/3= 0 (I divided both sides by 3), we can see that the equation having the reciprocals as roots is x^2+ (2/3)/(-1/3)x- 1(1/3)= x^2- 2x- 3= 0.
{ "domain": "mathhelpforum.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9890130557502124, "lm_q1q2_score": 0.8305078534180168, "lm_q2_score": 0.839733963661418, "openwebmath_perplexity": 889.9215259494212, "openwebmath_score": 0.8864158391952515, "tags": null, "url": "http://mathhelpforum.com/algebra/108482-finding-equation-roots.html" }
quantum-mechanics, spacetime, entropy More explicitly, this is what the 2nd law says about un-breaking eggs: If you consider all the different possible microscopically-different states in which egg-material is scattered across the floor, practically none of them will have all of the molecules with just the right posititions and velocities to end up as an intact egg jumping back up into your hand. The key word here is practically. The very fact that you can break an egg implies that some of those states in which egg-material is scattered across the floor do have just the right molecular arrangement to end up as an intact egg jumping back up into your hand. Why don't we ever see that happening? Because if $n$ is the number of microscopically-distinct splattered-egg states that have this property, and if $N$ is the total number of microscopically-distinct splattered-egg states including ones that don't have this property, then $$ n <<<<<<<<<<<<<<< N. \tag{1} $$
{ "domain": "physics.stackexchange", "id": 55616, "lm_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, spacetime, entropy", "url": null }
statistical-mechanics So, if you're dealing with an integral of the form $$ \int e^{-H(|p|^2)}d^3p$$ it's smarter to turn it into $$ \int e^{-H(|p|^2)}4\pi |p|^2d|p|.$$ This is purely maths, no physics here. If this doesn't answer your question, then we may need to know more about the specific calculation you're trying to solve. But yes, your intuition is correct, this is due to the fact that your system doesn't differentiate between $x, y, z$ directions.
{ "domain": "physics.stackexchange", "id": 49061, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "statistical-mechanics", "url": null }
python, beginner, python-3.x, hangman else: wrong_guesses = wrong_guesses + 1 draw_hangman(wrong_guesses) if wrong_guesses == 9: print() print(secret) print() print("GAME OVER") break time.sleep(sec) if word == secret: print() print(target_word) print() print("VICTORY") return
{ "domain": "codereview.stackexchange", "id": 32608, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, beginner, python-3.x, hangman", "url": null }
c++, socket, stream }; // end namespace Exceptions }; // end namespace Socket }; // end namespace ComputerBytez NetBytez.h #include "Server.h" #include "Client.h" // Platform independent except for what's in Platform.h namespace ComputerBytez { namespace Socket { // some intialization functions void Init (); void Cleanup(); }; // end namespace Socket }; // end namespace ComputerBytez namespace NetBytez { // NetBytez is a shortcut for the computerbytez socket namespace using namespace ComputerBytez::Socket; }; NetBytez.cpp #include "NetBytez.h" #include "Platform.h" // Platform independent except for what's in Platform.h namespace ComputerBytez { namespace Socket { // some intialization functions void Init () { Platform::Init(); } void Cleanup() { Platform::Cleanup(); } }; // end namespace Socket }; // end namespace ComputerBytez Now some testing code: TestServer.cpp #include "NetBytez.h" #include <string>
{ "domain": "codereview.stackexchange", "id": 41419, "lm_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++, socket, stream", "url": null }
you actually will need advice with algebra and in particular with exponent square root calculator or division come pay a visit to us at Mathmastersnyc. of b or just. If you want to find out the possible values, the easiest way is probably to go with De Moivre's formula. So the root of negative number √-n can be solved as √-1 * n = √ n i, where n is a positive real number. Don't settle for your phone's built-in app — give these top calculator apps a try. hi, is there any way to find the cube roots of a complex number WITHOUT converting it into the polar form? i am asking this because we can find the square root of a complex number without converting it. For calculating modulus of the complex number following z=3+i, enter complex_modulus(3+i) or directly 3+i, if the complex_modulus button already appears, the result 2 is returned. Cube Root Calculator - Calculate the cube root of a number. Enter a value to be squared Then click OK The square of the number entered is. 0) returns i. A
{ "domain": "hausverwaltung-schinderling.de", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9796676490318649, "lm_q1q2_score": 0.8076986834677609, "lm_q2_score": 0.824461932846258, "openwebmath_perplexity": 416.06560931087193, "openwebmath_score": 0.7332090139389038, "tags": null, "url": "http://cqjo.hausverwaltung-schinderling.de/cube-root-of-complex-number-calculator.html" }
black-holes Title: Textbook/lecture notes on the quantum aspects of Black holes Please suggest beginner-level textbooks or lecture notes on the quantum aspects of black holes. I mean Hawking radiation, Blackhole evaporation, entanglement, etc without knowing string theory. I am not familiar with string theory at all at a technical level. I want to learn things leisurely in baby steps. mithusengupta, you have asked a good question as there are a lot great books out there, about the topic. But I would recommend ICTS lectures of Gautum Mandal about Hawking radiation, but even learning from lectures, you should have a prior knowledge of Black holes, for that you should read Chandrasekhar book THE MATHEMATICAL THEORY OF BLACK HOLES. For books, originally, I recommend the book, QUANTUM ASPECTS OF BLACK HOLES of the Springer series of Fundamental theories of Physics. It covers the topics you need. Hope it helps...
{ "domain": "physics.stackexchange", "id": 72979, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "black-holes", "url": null }
universe, theory-of-everything More about imagination how space of our universe looks (and how expanding) today and in past check here :WMAP
{ "domain": "physics.stackexchange", "id": 642, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "universe, theory-of-everything", "url": null }
velocity, gas, diffusion, lift $$v_\mathrm{drift}=\tau F/m$$ where the average gravitational buoyancy force on the molecule is $$F=\left(\frac{\rho_{air}}{\rho_{H_2}}-1\right)m_{H_2}g$$ and the mean time between collisions of the hydrogen molecule is $$\tau = \lambda / \langle v_r \rangle$$ Assuming an ideal gas of spherical molecules, the mean free path of a hydrogen molecule in air of molecular density $n$ is $$\lambda = \frac{1}{\pi (r_{H_2}+r_{\mathrm{air}})^2 n}$$ where $r$ is the molecular radius and $n=P/kT$ is the molecular density. The mean velocity of the hydrogen molecule relative to the air molecules is $$\langle v_r \rangle = \sqrt{\frac{8 k T}{\pi \mu}}$$ where $\mu=m_{H_2}m_{air}/(m_{H_2}+m_{air})$ is the reduced mass. We can can reasonably approximate air as pure nitrogen, so $$v_\mathrm{drift}\approx \frac{kT}{\pi (r_{H_2}+r_{N_2})^2 P} \sqrt{\frac{\pi m_{H_2}m_{N_2}}{8 k T (m_{H_2}+m_{N_2})}} \left(\frac{\rho_{H_2}}{\rho_{H_2}}-1\right) g $$
{ "domain": "physics.stackexchange", "id": 96818, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "velocity, gas, diffusion, lift", "url": null }
c++ return b; } else return a; } /// a+b vector<int> sum(vector<int> a,vector<int> b) { if(a.size()>b.size()) { vector<int> rez(3000); int a_end=a.size()-1; int remainder=0,k=0,ans; for(int i=b.size()-1;i>=0;i--) { ans=a[a_end]+b[i]+remainder; if(ans>9) { rez[k]=ans%10; remainder=ans/10; } else { rez[k]=ans; remainder=0; } k++; a_end--; } int kk=k; for(int i=a.size();i>kk;i--) { ans=a[a_end]+remainder;
{ "domain": "codereview.stackexchange", "id": 914, "lm_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 }
newtonian-mechanics Title: Normal force increasing with bank angle explanation I've been told that as the bank angle increases the frictional force decreases and the normal force increases to preserve the net force (centripetal). However, I'm not sure how to explain how this happens in a more in-depth sense of physics. Why friction becomes less the higher it goes and why the normal force increases? All the websites don't give much of an explanation just siting what I said above. thanks for the help, Because friction is always parallel to the bank surface and a normal force is always perpendicular to it. Imagine the extreme scenarios: With the bank being flat (no banking), $\theta=0$, a normal force would point straight up and wouldn't be aiding to the horizontal centripetal force that causes turning. With the bank being vertical, $\theta=90^\circ$, the friction can only be vertical and thus can't aid in providing the horizontal centripetal force.
{ "domain": "physics.stackexchange", "id": 81390, "lm_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", "url": null }
Conditional probability does not inherently refer to a temporal relationship, though we almost always talk as if it did! We can follow the definition of conditional probability and get a perfectly good answer despite the condition occurring after the main event. If you’re feeling queasy at this point, hold on – there’s more to come. ### Can we find P(B) directly? Amy wrote back:
{ "domain": "themathdoctors.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9877587239874875, "lm_q1q2_score": 0.8209687943379097, "lm_q2_score": 0.8311430457670241, "openwebmath_perplexity": 485.7630434708867, "openwebmath_score": 0.7486289739608765, "tags": null, "url": "https://www.themathdoctors.org/more-about-independent-events/" }
speed-of-light, refraction, frequency, wavelength, cherenkov-radiation When the particle has the same speed as speed of light in the medium at some frequency ($c/n(\omega)$), no energy is put into radiation at that frequency. This follows from the Frank-Tamm formula describing radiation intensity as function of frequency and speed of the particle. The moving particle has to be faster than speed of light at that frequency, to emit Cherenkov radiation at that frequency.
{ "domain": "physics.stackexchange", "id": 95971, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "speed-of-light, refraction, frequency, wavelength, cherenkov-radiation", "url": null }
human-biology, biochemistry Title: Does cooking ginger reduce its anti-nausea effect? There seems to be strong evidence to support the hypothesis that eating ginger helps reduce nausea e.g. during pregnancy (e.g. Vutyavanich et al.). It seems that gingerol is the active ingredient in preventing nausea (cf. Qian et al.). Wikipedia writes: "Cooking ginger transforms gingerol into zingerone...". Presumably, zingerone does not affect nausea. Question: Does cooking ginger reduce its anti-nausea effect? A Google search will reveal numerous suggestions for giving ginger tea to pregnant women to help with morning sickness. But boiling the ginger could conceivably defeat the purpose of taking the ginger in the first place (and any effects are primarily due to the placebo).
{ "domain": "biology.stackexchange", "id": 132, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "human-biology, biochemistry", "url": null }
phylogenetics, phylogeny, beast However, this is almost 1 billion replications and should be sufficient for convergence. The fact it ends on a round number might infer a algorithm limit is in place. If the Beast2 was restarted from this point and it abruptly ended this would be a very likely reason. The alternative is an error external to the algorithm such as a RAM error - it has been running a long time. Whatever the reason I would simply perform ESS statistics and convergence diagnostics on what you have now. There's no real reason to continue if it has converged for 10e6 replications maximum and this is much, much bigger than that.
{ "domain": "bioinformatics.stackexchange", "id": 2143, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "phylogenetics, phylogeny, beast", "url": null }
c++, beginner, tic-tac-toe And else if ( board[0][0] == '0' && board[0][1] == '0' && board[0][2] == '0' || board[0][0] == '0' && board[1][0] == '0' && board[2][0] == '0' || board[0][0] == '0' && board[1][1] == '0' && board[2][2] == '0' || board[0][2] == '0' && board[1][1] == '0' && board[2][0] == '0' || board[0][2] == '0' && board[1][2] == '0' && board[2][2] == '0' || board[2][0] == '0' && board[2][1] == '0' && board[2][2] == '0' || board[0][1] == '0' && board[1][1] == '0' && board[2][1] == '0' || board[1][0] == '0' && board[1][1] == '0' && board[1][2] == '0' ) The only difference is the value being tested. If you move this two a function and provide that as a parameter it makes validating that the code is correct much easier. Return at the end of main() Main is special. return 0;
{ "domain": "codereview.stackexchange", "id": 19702, "lm_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, tic-tac-toe", "url": null }
The series would lend themselves to parallel processing very well and your results might be quite different. While I agree that going back 6 digits is not practical it is for inquisitive minds to do. Both approximations start with 3. Mike Hankey 3-Sep Sign up using Email and Password. Some algorithms could be optimized, but I believe that will not change the conclusions. I uses normal arithmetic to determine a ratio with higher precision. Sign up or log in Sign up using Google. It is known that this irrational number arose on the calculations of geometers over time as a proportionality constant for at least 4 relationships, not necessarily in this order: Osmund Francis 7-Oct 6: Software Component Principles Revisited. Calculating the Number PI Through Infinite Sequences
{ "domain": "dianaplus.eu", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9905874109681435, "lm_q1q2_score": 0.8028502083186545, "lm_q2_score": 0.810478913248044, "openwebmath_perplexity": 1145.5005775699653, "openwebmath_score": 0.800981342792511, "tags": null, "url": "https://www.dianaplus.eu/nilakantha-series-proof-92/" }
particle-physics, cosmology, big-bang, higgs, cosmological-inflation Between 10^−12 second and 10^−6 second after the Big Bang Before the Cosmic Microwave Background data came out, and the horizon problem appeared, the electroweak symmetry breaking was the phase transition appearing in the Big Bang chronology. The quantization of gravity# hypothesis for the very early universe could model the uniformity of the observed CMB spectrum. The inflationary period was introduced to model the CMB , in order to be consistent with the observation of a uniformity in the universe that could not be explained by thermodynamic arguments at other periods, except immediately after the BB. The two phase transitions, (end of inflation period, electroweak breaking) are connected by the diminishing of the available energy per particle due to the expansion, but are independent of each other, the electroweak with the Higgs field appearing much later in the chronology of expansion.
{ "domain": "physics.stackexchange", "id": 24939, "lm_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, cosmology, big-bang, higgs, cosmological-inflation", "url": null }
galaxy, james-webb-space-telescope, photons $$ P_\mathrm{lens} = \mu P_\mathrm{no\,lens}\simeq 3\times10^{-52}. $$ How many photons does JWST catch? That's a very small number, but luckily galaxies emit many, many photons every second. A bright galaxy in these epochs would have a luminosity of, say, $L_\mathrm{gal} = 10^{10}$ times that of our Sun, or $4\times10^{36}\,\mathrm{W}$. For an order-of-magnitude estimate, let's assume that most is emitted in the optical, with an average wavelength of $\lambda=600\,\mathrm{nm}$, corresponding to an energy of $E_\mathrm{ph}=h\nu=hc/\lambda\simeq3\times10^{-19}\,\mathrm{J}$. Hence, each second the galaxy emits $$ \dot{n}_\mathrm{ph} = \frac{L_\mathrm{gal}}{E_\mathrm{ph}} \simeq 10^{55}\,\mathrm{photons\,per\,second}. $$ Because of the expansion of the Universe, the rate at which we receive individual photons here is a factor of $(1+z)$ smaller than the rate at which they're emitted (thanks @jawheele for catching this).
{ "domain": "astronomy.stackexchange", "id": 6414, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "galaxy, james-webb-space-telescope, photons", "url": null }
c, linux, socket // Create status message for DOWNLOAD memset(buffer, 0, sizeof(buffer)); sprintf(buffer, "DOWNLOAD:%s:%d\r\n", lfile, 1); // Send status msg to request file for DOWNLOAD. // Repeat until amount of all received Bytes equals 4096 Bytes. all_bytes_sent = 0; while(all_bytes_sent != sizeof(buffer)){ bytes_sent = send(sock, (buffer + all_bytes_sent), (sizeof(buffer) - all_bytes_sent), 0); if(bytes_sent < 0) DieWithError("send() DOWNLOAD msg failed!\n"); all_bytes_sent += bytes_sent; } // Receive stat message to request file size for DOWNLOAD. // Repeat until amount of all received Bytes equals 4096 Bytes. memset(buffer, 0, sizeof(buffer)); all_bytes_recvd = 0; while(all_bytes_recvd != sizeof(buffer)){ bytes_recvd = recv(sock, (buffer + all_bytes_recvd), (sizeof(buffer) - all_bytes_recvd), 0);
{ "domain": "codereview.stackexchange", "id": 14835, "lm_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, linux, socket", "url": null }
.... 3. Aug 30, 2009 ### Hurkyl Staff Emeritus By the way, the interesction isn't a limit. (At least, it's not a limit in the sense you know it) Unlike addition which only operates on a pair of numbers at a time, and thus requires something extra to make sense of an idea like "infinite sum", intersection is naturally an infinitary operation -- it can be applied to any collection of sets, not just a pair of sets. 4. Aug 30, 2009 ### sutupidmath I know the def. of the intersection, but my issue was the inability to conclude whether 0 is an element of the set $$\left(-\frac{1}{n},\frac{1}{n}\right),\forall n \in N$$. If it were a closed set it would be part of it, but in this case i am having trouble figuring out whether it behaves similarly as when we take the limit, when n goes to infinity. ?? 5. Aug 30, 2009 ### Hurkyl Staff Emeritus That isn't a set. That's a family of sets.
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9865717484165852, "lm_q1q2_score": 0.8111485615805231, "lm_q2_score": 0.822189123986562, "openwebmath_perplexity": 437.2124017739261, "openwebmath_score": 0.6445366740226746, "tags": null, "url": "https://www.physicsforums.com/threads/intersection-of-a-family-of-sets.333580/" }
python, object-oriented, machine-learning # comment me def train_it(self): ''' You can comment like this too ''' # while one or more of the answers are wrong # while self.correct[1] == False or self.correct[0] == False or self.correct[2] == False: # use parenthesis to divide the logic, is easier to read and to understand while (not self.correct[1]) or (not self.correct[0]) or (not self.correct[2]): for i in range(3): # Perceptron formula # fire perceptron # You don't need the else in this case. However, leave it if it's more clear to you self.fired = True if (self.train[i][0]*self.x1+self.train[i][1]*self.x2+self.train[i][2]*self.x3 < self.threshold): # under threshold, dont fire self.fired = False
{ "domain": "codereview.stackexchange", "id": 36518, "lm_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, object-oriented, machine-learning", "url": null }
java, linked-list, unit-testing assertEquals(3, list.size()); for (int i = 0; i < list.size(); i++) { assertEquals(Integer.valueOf(i + 1), list.get(i)); } I prefer to use AssertJ for my assertions, because I find the fluent interface easier to read. It has quite a lot of extensions that make working with collections very pleasant. Instead of the above, you can combine the size and element comparison into a single assertion that gives very descriptive feedback on failure: assertThat(list).containsExactly(1,2,3); Files Where you can, you want to try to avoid using the file system it tends to be a can of worms that can lead to unpredictable failures. Rather than using FileOutputStream and FileInputStream in your serialization test, consider using the Byte versions instead: ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); // ... ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bis);
{ "domain": "codereview.stackexchange", "id": 42089, "lm_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, linked-list, unit-testing", "url": null }
photons, angular-momentum, quantum-spin, rotation, helicity To recap, once we decide on a Hilbert space and a (possibly projective) representation for the rotation group as unitary operators, we can construct the angular momentum observables and talk about their allowed values. If we choose a Hilbert space of the form $L^2(\mathbb R^3)\otimes \mathbb C^n$ for some $n\geq 2$, then the total angular momentum will have a component which can be associated to the spatial wavefunction and a component which can be associated to the element of $\mathbb C^n$ to which the wavefunction is attached. We call the former orbital and the latter intrinsic (or spin), but it is the total which has the properties we normally associated to angular momentum. The oft-repeated refrain "spin doesn't mean that the electron is really spinning" is a way to drape English words around the fact that we tend to visualize quantum mechanical particles via their wavefunctions, and the intrinsic angular momentum has nothing to do with the wavefunction whatsoever.
{ "domain": "physics.stackexchange", "id": 77750, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "photons, angular-momentum, quantum-spin, rotation, helicity", "url": null }
java, enum to instead be (note also that this is 'final', and this is a java.util.concurrent.ThreadLocalRandom): private static final ThreadLocalRandom rnd = ThreadLocalRandom.current(); This will give you better scalability in the future (or the present if you are already multi-threaded. Enum Magic Numbers Enums are a great concept in Java, and, it is one of those places where I believe magic numbers (special values with little apparent context or meaning) are really useful, and are OK. You can embed 'magic' in with the enums and not worry too much about the readability... enums are supposed to be magic things.... So, I would consider code like the following: import java.util.concurrent.ThreadLocalRandom; public enum Direction { // use magic numbers to set the ordinal (used for rotation), // and the dx and dy of each direction. NORTH(0, 0, 1), EAST(1, 1, 0), SOUTH(2, 0, -1), WEST(3, -1, 0); private static final ThreadLocalRandom rnd = ThreadLocalRandom.current();
{ "domain": "codereview.stackexchange", "id": 6289, "lm_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, enum", "url": null }
html, converting, powershell clear-host [System.Uri]$url = 'http://some.site.with.tables.com/Subnet_Audit.asp' #link to some website [System.String]$subnet = '123.45.67' #this relates to a specific paramter in the form; in my case the site checks the AV versions of all computers within a given IP range
{ "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 }
graph-theory, graph-algorithms, co.combinatorics, shortest-path, metrics The obvious necessary condition is the following: for every pair of paths their intersection is a path too. Is this condition sufficient? This condition is sometimes called "consistency" (a set of paths is consistent if the intersection of any two is a subpath of each). It follows from the above that consistency is not sufficient. One of the two tied-for-smallest counterexamples is the following color-coded system of four paths over six nodes: In other words, there is no way to assign weights to the 8 edges pictured here so that all of these four paths are simultaneously the unique shortest path between their endpoints. However, any pair of them intersect on just one node, so they are consistent (even if we fill them out with a few additional paths in the right way to have $n \choose 2$ in total). There are infinitely many counterexamples like this one; see the paper for a characterization. Three other quick comments on all this:
{ "domain": "cstheory.stackexchange", "id": 4465, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "graph-theory, graph-algorithms, co.combinatorics, shortest-path, metrics", "url": null }
c++, recursion, unit-testing, boost, c++20 Title: Non-nested std::deque and std::list Generator Function for arithmetic_mean Function Testing in C++ This is a follow-up question for A non-nested test_vectors_generator Function for arithmetic_mean Function Testing in C++ and An arithmetic_mean Function For Various Type Arbitrary Nested Iterable Implementation in C++. Besides std::vector test cases generated from test_vectors_generator template function, I am trying to implement std::deque and std::list test cases with test_deques_generator and test_lists_generator functions. The usage description Similar to the usage of test_vectors_generator, there are also four parameters in both test_deques_generator function and test_lists_generator function. The first one is a start iteration number of each element, the second one is a end iteration number of each element, the third one is a step size and the fourth one is the element count of each container. The experimental implementation
{ "domain": "codereview.stackexchange", "id": 40061, "lm_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++, recursion, unit-testing, boost, c++20", "url": null }
homework-and-exercises, conformal-field-theory, lie-algebra Title: 2D Conformal Group I am trying to check my understanding of the conformal group. We know $l_{0} = -z\partial_{z}$ for this particular value of the Witt algebra. We then can make the substitution $z = re^{i\phi}$, which should lead to $$l_{0} = -\frac{1}{2}r\partial_{r} + \frac{i}{2}\partial_{\phi} \tag{1}.$$ My issue is I cannot seem to get (1) and think I might be making a silly mistake. Given $z = re^{i\phi}$, $l_{0} = -(re^{i\phi})\partial(re^{i\phi}) = -(re^{i\phi})(e^{i\phi}\partial_{r}+ire^{i\phi}\partial_{\phi})=-(re^{2i\phi}\partial_{r} + ir^{2}e^{2i\phi}\partial_{\phi})$ (2). (2) $\neq$ (1), so what did I miss? Hint: do the right thing. $$ (z,\bar z)\mapsto (r,\phi) , \\ r=\sqrt{z\bar z}, \qquad \phi= {1\over 2i}\log(z/\bar z),\\ \partial_z= (\partial_z r )~~\partial_r + (\partial_z \phi )~~ \partial_\phi ~~. $$
{ "domain": "physics.stackexchange", "id": 89591, "lm_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, conformal-field-theory, lie-algebra", "url": null }
special-relativity, dirac-equation If only one doubly spatial component of $\omega$ is nonzero, then this component $\omega_{\mu\nu} = -\omega_{\nu\mu}$ is obviously the angle itself. Note that the spatial-spatial terms in $A$ are anti-Hermitean, producing unitary transformations; the mixed temporal-spatial terms in $A$ are Hermitean and they don't product unitary transformations on the 4-component space of spinors (but they become unitary if they're promoted to transformations of the full Hilbert space of quantum field theory). In 4 dimensions, a general antisymmetric matrix $4\times 4$ contains 6 independent parameters and has eigenvalues $\pm i a, \pm i b$, so in 3+1 dimensions, one can always represent a general Lorentz transformation as a rotation around an axis in the 4-dimensional space followed by a boost in the complementary transverse 2-plane. This is the counterpart of the statement that any $SU(2)$ rotations in 3 dimensions is a rotation around a particular axis by an angle.
{ "domain": "physics.stackexchange", "id": 656, "lm_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, dirac-equation", "url": null }
c#, regex, rubberduck, i18n public override int GetHashCode() { return _specifier.GetHashCode(); } } public class Group : IAtom { public static readonly string Pattern = @"(?<!\\)\((?<expression>.*(?<!\\))\)"; private static readonly Regex Matcher = new Regex("^" + Pattern + "$"); private readonly IRegularExpression _subexpression; private readonly string _specifier; public Group(string specifier) { Match m = Matcher.Match(specifier); if (!m.Success) { throw new ArgumentException("The given specifier does not denote a Group"); } _subexpression = RegularExpression.Parse(m.Groups["expression"].Value); _specifier = specifier; } public IRegularExpression Subexpression { get { return _subexpression; } }
{ "domain": "codereview.stackexchange", "id": 31918, "lm_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#, regex, rubberduck, i18n", "url": null }
reinforcement-learning, convolutional-neural-networks, pytorch, convolution, convolution-arithmetic The other extreme would be to set groups=in_channels (which is 10 in your case). Then you split your input tensor (10, 14, 14) into 10 input tensors of size (1, 14, 14), you perform the convolution along each one separately and you concatenate the results. In this case you do not capture the interaction between the channels. Usually, when you do this, you add an additional 1x1 convolutional layer after that that will intermix the channels. This approach is called a depthwise-separable convolution and was introduced in the MobileNet paper. This will harm the accuracy of the model, but greatly reduces the number of parameters and is the preferred approach for models that will be deployed on mobile phones and other edge devices. You can read more about splitting into groups here: https://pi-tau.github.io/posts/res-nets/#the-resnext-block-going-wider-instead-deeper
{ "domain": "ai.stackexchange", "id": 3896, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "reinforcement-learning, convolutional-neural-networks, pytorch, convolution, convolution-arithmetic", "url": null }
combinations in right! C ) ( 3 ) nonprofit organization adjacent is the longest side the. Combinations in a right-angled triangle is the side PR is called the opposite is the side that does not the! Click calculate right-angled triangle is the longest side of angle θ found if choose. Of all the four parameters being angle, opposite leg and adjacent sides of a right triangle a... By forming this ratio: adjacent/hypotenuse it means we 're having trouble loading external resources our... And *.kasandbox.org are unblocked each statement is true or false if you 're this... Of the hypotenuse found if you choose one of its angle is called the adjacent and opposite only... Are used to describe the sides of a right angle are called trigonometric Ratios behind a web filter please! Vary based on which trigonometric ratio can be found out from the above table angle you choose the of! 3 decide whether each statement is true or false the angle of choice along the. 5 and the hypotenuse does not form
{ "domain": "allindesign.nl", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.980280868436129, "lm_q1q2_score": 0.8059762812933196, "lm_q2_score": 0.8221891370573388, "openwebmath_perplexity": 815.1204820676509, "openwebmath_score": 0.7350629568099976, "tags": null, "url": "http://allindesign.nl/e6yir2rf/hypotenuse%2C-opposite%2C-and-adjacent-ff7039" }
bigdata, apache-hadoop, efficiency, scalability, performance That said, the newer YARN based Hadoop does support a form of MPI, so those worlds are starting to move closer together.
{ "domain": "datascience.stackexchange", "id": 222, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "bigdata, apache-hadoop, efficiency, scalability, performance", "url": null }
c# #region Correct Total Total = Total.Replace(",", "."); #endregion string Comm = "INSERT INTO Sales (ClientID, Total, [Date], Products, PaymentMethod) VALUES('" + Selected.id + "', '" + Total + "', '" + CurrTime + "', '" + AllProducts + "', '" + PayMethod + "')";
{ "domain": "codereview.stackexchange", "id": 26848, "lm_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 }
organic-chemistry, nomenclature P-14.4 NUMBERING When several structural features appear in cyclic and acyclic compounds, low locants are assigned to them in the following decreasing order of seniority: (…) (c) principal characteristic groups and free valences (suffixes); (…) (e) saturation/unsaturation: (i) low locants are given to hydro/dehydro prefixes (…) and ‘ene’ and ‘yne’ endings; (ii) low locants are given first to multiple bonds as a set and then to double bonds (…); (…) Therefore, the correct name for the second example given in the question is ‘but-3-yn-2-ol’ (not ‘but-1-yn-3-ol’) since a low locant is given first to the suffix ‘-ol’. If the compound contains several multiple bonds (double or triple bonds), low locants are given to multiple bonds as a set. If there is still a choice, low locants are given to the double bonds.
{ "domain": "chemistry.stackexchange", "id": 5433, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "organic-chemistry, nomenclature", "url": null }
java, android, recursion, exception-handling, error-handling I'd use a loop instead of recursion. Two links on the topic: Exceptions, and how best to retry when a connection is reset? Retrying Operations in Java
{ "domain": "codereview.stackexchange", "id": 1906, "lm_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, android, recursion, exception-handling, error-handling", "url": null }
gravity, cosmology, space-expansion, observable-universe Please forgive any naivete, as this is my first post here. Firstly, it can be easily shown that everything isn't "falling" toward everything else. For example, a photon emitted by an extremely distant star isn't "falling" toward anything. It may be affected by various things on it's way here, like interactions with electrons, or large gravitational potentials. An other counter example is a rocket/similar body that we fire off the face of Earth, which attains escape velocity. It has escaped the gravitational attraction of the Earth, and assuming it doesn't get trapped by another object in the solar system, will continue along it's way. This isn't "falling" toward anything either. Secondly, even though "continuous falling" is often used as an analogy for an orbit, it's far clearer to think of it in terms of potentials. My answer here explains gravitational orbits in terms of a potential. There are other answers to that question as well that do a damn good job of explaining things.
{ "domain": "physics.stackexchange", "id": 25929, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "gravity, cosmology, space-expansion, observable-universe", "url": null }
c#, http, server public Program(IStocksRepository stocksRepository, IUsersRepository usersRepository) { _stocksRepository = stocksRepository; _usersRepository = usersRepository; var uri = new Uri($"{_url}:{_port}/"); var configuration = new HostConfiguration() { UrlReservations = new UrlReservations() { CreateAutomatically = true } }; _nancy = new NancyHost(configuration,uri); } private void Start() { _nancy.Start(); _stocksRepository.StartUpdats(); Console.WriteLine($"Started listennig port {_port}"); Console.ReadKey(); _nancy.Stop(); } static void Main(string[] args) { var p = new Program(RepositoriesFactory.StocksRepository, RepositoriesFactory.UsersRepository); p.Start(); } } }
{ "domain": "codereview.stackexchange", "id": 26528, "lm_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#, http, server", "url": null }
forces, newtonian-gravity, work, potential-energy Or, from here: The fact that these two cancel out (Wnet=Wyou+Wgrav=0) means that the kinetic energy of the object after being lifted is 0. So the work done by gravity went to sucking energy out of the object that you were adding, thereby converting it to gravitational potential energy.
{ "domain": "physics.stackexchange", "id": 49234, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "forces, newtonian-gravity, work, potential-energy", "url": null }
in linear time N, we get the time complexity as O N! Non-Comparison sorting method because it does not compare the numbers according to the most significant.... Algorithms used to sort floating point numbers using radix sort preferable to based! Sort and Quick-Sort uses hardware caches more effectively 13 elements/numbers for any comparison based sorting came... Sort preferable to comparison based sorting algorithm is more common than radix-sort?! Values 0,1,2,3,4,5,6,7 are allowed, it takes 3N comparisons N ) than radix-sort ’ th digit sort ) according their... Method because it does not compare the numbers according to their digits passes. Key as index 2 the primary column is input based on their digits is more common than radix-sort 1.5... Details of countSort ( ) function in below code NIELIT SCIENTIST b Technical Assistant ANSWER RELEASED... We get the time complexity is O ( nLogb ( N ).... Overall time complexity as O ( n2 ) which is worse than comparison-based sorting algorithm
{ "domain": "a2zwebsolutions.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9372107896491796, "lm_q1q2_score": 0.8039095196060109, "lm_q2_score": 0.8577681013541611, "openwebmath_perplexity": 1185.4432293064933, "openwebmath_score": 0.27756467461586, "tags": null, "url": "http://a2zwebsolutions.com/ewt4yla/dca0ba-number-of-comparisons-in-radix-sort" }
cosmology, space-expansion, dark-energy Title: Do we need Dark Energy to explain the acceleration of the expansion of the universe? As far as I know is the discovery that galaxies that are farther away are moving faster from us than galaxies the are closer by. This led to the theory of Dark Energy. The acceleration was speeding up.
{ "domain": "physics.stackexchange", "id": 78779, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "cosmology, space-expansion, dark-energy", "url": null }
game-ai, monte-carlo-tree-search A better place to take standard deviation (or, similarly, variance) into account would be, for example, the Selection phase of MCTS. The most common strategy for the Selection phase is using the "UCB1 equation". You can modify that to include the variance in your observations, for example using the "UCB1-Tuned" strategy as described in the beginning of Section 4 of Finite-time Analysis of the Multiarmed Bandit Problem.
{ "domain": "ai.stackexchange", "id": 813, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "game-ai, monte-carlo-tree-search", "url": null }
orbitals, relativistic So what are the physical consequences of these different mathematical solutions? Firstly, the orbitals change in energy. Orbitals with a lower $j$ for a given $n$ and $l$ have lower energy (e.g., the single $\textbf{4p}_{1/2}$ orbital is lower in energy than the two degenerate $\textbf{4p}_{3/2}$ orbitals). The shape of the orbitals also change; all orbitals with $j=\frac{1}{2}$ are spherical, regardless of $l$. According to "Contour diagrams for relativistic orbitals": Contour plots for $^2P_{1/2}$ and $^2S_{1/2}$ are spherically symmetrical, while those for $n = 2$ and $3$, $l = 1$, $j= 3/2$, and $m = \pm 3/2$ look very similar to those for p orbitals already published in this journal. Similarly, all orbitals with $j=\frac{3}{2}$ are dumbbell-shaped, including $\textbf{d}_{3/2}$ orbitals. The article brings a helpful schematic: As additional confirmation, "Pictorial Representations of the Dirac Electron Cloud for Hydrogen-Like Atoms" states:
{ "domain": "chemistry.stackexchange", "id": 6295, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "orbitals, relativistic", "url": null }
large-hadron-collider, accelerator-physics, particle-accelerators Are there existing plans to get this energy somehow back? The technology don't seem especially hard to this for me (at least, theoretically: taking the radiation energy with a lattice and using the induced current), especially because this very well controlled stream has probably a very stable BS. In the LHC the synchrotron radiation will waste approximately 13.5 kW with two beams each at 7 TeV which is something similar to 30 desktop computers (there are many more at CERN!!); but since this small power is lost at a small temperature, there is a huge workload for the cryogenic system which eats up a power of 40 MW to keep the superconducting magnets at 2K (although there are some thermal leaks also from the outside of the vessels). You may think why not using room temperature magnets? They were used in LEP but:
{ "domain": "physics.stackexchange", "id": 13718, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "large-hadron-collider, accelerator-physics, particle-accelerators", "url": null }
newtonian-mechanics, harmonic-oscillator, oscillators Another way of looking at the arrangement is to consider two separate pendulums of the same length and amplitude but of differing masses. They will have the same period. It so happens that your arrangement starts off with both the masses (person and sandbag) joined together and then one of the masses is ditched.
{ "domain": "physics.stackexchange", "id": 56550, "lm_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, harmonic-oscillator, oscillators", "url": null }
• $\ell=\inf{X}\Leftrightarrow(\forall\epsilon>0)(\exists x\in X)x<\ell+\epsilon$. • $u=\sup{X}\Leftrightarrow(\forall\epsilon>0)(\exists x\in X)u-\epsilon < x$. According to the former equivalence, for any $\epsilon>0$ there exists an elementary set $B\setminus E\subseteq C$ such that $m(C). By using the latter equivalence, there exists an elementary set $A\subseteq B$ such that $m_{*}(B)-\epsilon /2. It follows from lemma 2 and inequality (2) that $m(B)-m_{*}(E). $B\setminus E\subseteq C$ and $A\subseteq B$ lead to $A\setminus C\subseteq E$, so $m(A\setminus C)\le m_{*}(E)$, which in turn gives $m(B)-m_{*}(E). Inequality (3) connects the statement of lemma 3 to an analogous simpler statement for elementary sets; in particular, it will be shown that $m(A)-m(C)\le m(A\setminus C)\ \ \ \ (4)$.
{ "domain": "papamarkou.blog", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9805806557900713, "lm_q1q2_score": 0.8213539269860421, "lm_q2_score": 0.8376199572530448, "openwebmath_perplexity": 2770.544067615771, "openwebmath_score": 0.9897416234016418, "tags": null, "url": "https://papamarkou.blog/category/solutions/books/an-introduction-to-measure-theory/" }
javascript, game, array var ship1 = new Ship(3, true); ship1.place(6,6); ship1.coveredFields; var ship2 = new Ship(3, false); ship2.place(6,6); ship2.coveredFields; var ship3 = new Ship(3, true); ship3.place(6,6); ship3.coveredFields; var guess; var hits = 0; var guesses = 0; var isSunk = false; var shipLength = 7; var countSunkShip = 0; var shipsArray = []; shipsArray.push(ship1.coveredFields, ship2.coveredFields, ship3.coveredFields); console.log(shipsArray); /*function collision(direction) { for (var i = 0; i < shipsArray.length; i++) { for (var j = 0; j < direction.length; j++) { if (shipsArray[i].direction.indexOf(direction[j]) != -1) { return true; } } } return false; }*/ var createTable = function(cellsInARow, Rows){ var table = document.createElement('table'); for (var i = 0; i <= Rows; i++){ var tr = document.createElement('tr'); for(var j=0; j<=cellsInARow; j++){ var td = document.createElement('td');
{ "domain": "codereview.stackexchange", "id": 9494, "lm_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, game, array", "url": null }
c, virtual-machine { 44,"REMAINDER_I"," %2u", simple_instr_remainder_i }, { 50,"BRANCH"," %2u", simple_instr_branch }, { 51,"BRANCHNEG"," %2u", simple_instr_branchneg }, { 52,"BRANCHZERO"," %2u", simple_instr_branchzero }, { 53,"HALT","" , simple_instr_halt },
{ "domain": "codereview.stackexchange", "id": 37734, "lm_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, virtual-machine", "url": null }
electricity, integration, power, electronics So my power consumption at time T should be: $$ P(t)=P(0) + \int_{0}^{T} \Delta P(0)*e^{^{at}} dt $$ If I integrate this again, it should provide me with the energy consumption at time T: $$ E(t)=E(0)+ \int_{0}^{T}(P(0) + \int_{0}^{T} \Delta P(0)*e^{^{at}} dt) dt $$ Which I throw in to Wolfram Alpha with the following result for the definite integral: $$ T(\frac{\Delta P(0)*(e^{aT}-1)}{a}+P(0)) $$ So let's test this with the easiest example I can come up with: E(0) := 0, P(0)= 0, a=0, the Gradient of P is 1[W/s] and my time window is one hour. This results in 3600 Wh. But that cannot be the correct answer. If the power growing at an (almost) constant rate of one Watt per Second over the time window, I would expect 3600 Watt after one hour (3600 s) but an average over that hour of just 1800 W. So the energy consumed should be 1800 Wh.
{ "domain": "physics.stackexchange", "id": 90920, "lm_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, integration, power, electronics", "url": null }
either • $\langle u,v\rangle =0$, which happens for $n-1$ linearly independent vectors (as many the the dimension of the perpendicular hyperspace to $u$), and in this case $$\lambda=1-r,$$ and hence the eigenvlaue $\lambda=1-r$ has multiplicity $n-1$, or
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9808759632491111, "lm_q1q2_score": 0.8109017273384725, "lm_q2_score": 0.8267117940706734, "openwebmath_perplexity": 152.45526851015487, "openwebmath_score": 0.9884483218193054, "tags": null, "url": "http://math.stackexchange.com/questions/689111/find-the-eigenvalues-of-a-matrix-with-ones-in-the-diagonal-and-all-the-other-el" }
special-relativity, spacetime, reference-frames, time-dilation My question, stated more clearly, is: if we have shared just one event, and all the ship can do is send ship times of events that happened subsequently, is it meaningful to say "this event in the log coincided with this event on Earth"? There's a straightforward formula for converting times and distances between observers moving relative to one another; it is called the Lorentz transformation and the people on Earth may use it to convert from "spaceship years" and "spaceship meters" to "Earth years" and "Earth meters". The transformation is continuous, so there are no gaps or empty spaces, although typically durations will stretch or shrink as you convert between reference frames.
{ "domain": "physics.stackexchange", "id": 92236, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "special-relativity, spacetime, reference-frames, time-dilation", "url": null }
time-series I tried googling it, but it seemed hard to phrase the question in a way that a search engine understands. "rather than aggregated values at evenly distributed intervals?" I think that part defines your question very well; i.e that is usually what we generally do in usual time-series problems, merging the events in some discrete time intervals. What you can do is that, you can give the time distance between the events as features, without giving evenly distributed intervals. For example, the exact time distances between events of every disease outbreak or every patient getting sick and etc. Moreover, you can do some feature engineering; squared time differences or percentage changes of time difference between the differences between the sequential doubles (x, x-1) and (x-1, x-2) where x-n,.....,x-2, x-1, x are the sequential events, not the time.
{ "domain": "datascience.stackexchange", "id": 4120, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "time-series", "url": null }
catalysis, enzymes Chemical catalysts come in a number of shapes and varieties. Consider for example: the catalyst (mainly platinum as I heard at school) in your car’s exhaust the complex catalytic oxide system in the Haber-Bosch process transition metal catalysts such as $\ce{[Pd(PPh3)4]}$ acid catalysis, i.e. dissolved $\ce{H+}$ is the catalyst organic catalysis …
{ "domain": "chemistry.stackexchange", "id": 7142, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "catalysis, enzymes", "url": null }
newtonian-mechanics, energy, rotational-dynamics At first, I thought all of the kinetic energy would naturally be converted. But now I'm not so sure of myself. After all, the rod has to be accelerated over the distance s. As the wheel slows down, the rod picks up speed. It should be possible to calculate the final velocity of the rod just prior to position s, and thereby the final angular velocity of the wheel at the same time. But on the other hand, since the system will inevitably come to a full stop, can we not say that all of the energy of the flywheel (barring frictional losses) is delivered to the spike? By this reasoning, the last bit of rotational energy is converted at the point where the rod stops, whether that be at point s or at the point where the rod mercilessly perforates the enemy. Does this sound like good reasoning? For S&Gs, I'll go ahead and include my figures: Flywheel at max angular velocity:
{ "domain": "physics.stackexchange", "id": 37428, "lm_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, energy, rotational-dynamics", "url": null }
ros Title: How to add SDL2 library in cmake Hi I would like to add SDL2 library with headers to cmake. How can do that?? I'm new in ROS. I've tried something like this include_directories( include ${SDL2_INCLUDE_DIRS} include ${catkin_INCLUDE_DIRS} ) Could anyone help me? I would be very grateful
{ "domain": "robotics.stackexchange", "id": 26862, "lm_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 }
javascript, mathematics, collision context.restore(); requestAnimationFrame(update); } run on jsfiddle Memory costs CPU cycles. That is a lot for code for a simple operation. First some points about vectors, memory and performance. Vectors are small, short lived, most called, basic building blocks of any graphics / geometry based application. Vectors also encourage some of the worst JavaScript practices. They feel so much like javascript basic types Number, String, Boolean that you think nothing of creating them as needed. Yet they carry Javascript "Achilles heel", managed objects. Your code is just pumping out a stream of derefernced objects every frame Create the line end points and circle center once. Not each time you need them you are just creating work for memory management. Use const for all objects that do and should not change Be aware of memory overheads and don't use objects to hold intermediate results.
{ "domain": "codereview.stackexchange", "id": 30249, "lm_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, mathematics, collision", "url": null }
analytical-chemistry Title: Is it possible to curve fit GC, Mass-spectrometry and NMR peaks? I am trying to measure the amount of compounds by the peak area and I want to increase accuracy to 0.1% by curve fitting. Can I do it and what functions should I use? Yes, you can curve fit all three of them. For NMR use lorentzian shape.For other two use Gaussian peak shape. But remember: measurements in chemistry are typically 10% accurate. Increasing accuracy beyond that is difficult. Mass-spectrometry is only quantitative if you study isotopic molecules. You cannot compare alcohol with an acid and amine using MS. Amine will dominate in positive mode and acid will dominate in negative mode. GC is the most reliable but you have to find the right dose. Not to small, so that your peak is visible, and not to high to avoid asymmetry. Tecknically, you can use asymmetric fitting curve, but those fits are less stable (less reliable, even though the R is better).
{ "domain": "chemistry.stackexchange", "id": 6049, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "analytical-chemistry", "url": null }
hash, hash-tables, hashing Let $m \geq 1$ and $a,b$ be integers. The set $S = \{ a+ib \bmod{m} : 0 \leq i \leq m-1 \}$ consists of the integers $0,\ldots,m-1$ iff $b$ is relatively prime to $m$. Note that $S$ consists of the integers $0,\ldots,m-1$ iff the values $a+ib \bmod{m}$ are all distinct. Suppose first that $b$ is not relatively prime to $m$. This means that we can find $c > 1$ that divides both $b$ and $m$. It follows that $a \bmod{m} = a + (m/c)b \bmod{m}$, since $(m/c)b$ is a multiple of $m$. Since $1 \leq m/c \leq m-1$, this shows that $S$ contains fewer than $m$ distinct values. Now suppose that $b$ is relatively prime to $m$. Assume, by way of contradiction, that not all values in $S$ are distinct, say $a+ib \bmod{m} = a+jb \bmod{m}$ for some $i < j$. Then $(j-i)b \bmod{m} = 0$, where $1 \leq j-i \leq m-1$. This means that $(j-i)b$ is a multiple of $m$. Since $b$ is relatively prime to $m$, this implies that $j-i$ is a multiple of $m$, which is impossible since $1 \leq j-i \leq m-1$.
{ "domain": "cs.stackexchange", "id": 18923, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "hash, hash-tables, hashing", "url": null }
homework-and-exercises, newtonian-mechanics, energy, momentum, collision The momentum before the collision is: $$ L(t_0) = m_1 v_1(t_0) + m_2 v_2(t_0) $$ And after the collision: $$ L(t_1) = m_1 v_1(t_1) + m_2 v_2(t_1) $$ We know the collision time, and the force integral is not a function of time. So we obtain: $$L(t_1) - L(t_0) = sin(\theta)(m_1 + m_2)g t_c $$ with $t_c$ as collision time. Solve for $\theta$, which now is the only unknown. $$ sin(\theta) = \frac{L(t_1) - L(t_0)}{(m_1 + m_2)g t_c}$$
{ "domain": "physics.stackexchange", "id": 17744, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "homework-and-exercises, newtonian-mechanics, energy, momentum, collision", "url": null }
filters, wavelet, algorithms, dwt So my question is: what is the filter that is applied to the signal? Why does it provide coefficients and not another signal? What is the difference between the application of the DWT and that of a FIR filter? In other words, it seems that I apply a filter (with some coefficients) to find other coefficients, rather than another signal ... this is not 100% clear to me. Maybe I misunderstood some basic concepts, can you please clarify? In one level DWT, each output of the low-pass or a high-pass can indeed be considered as signals. Thus each of those signals are subsampled by a factor of 2, and the same two-filter-subsampling is iterated on the low-pass output, several times (wavelet decomposition) at $L$ levels. Each final output of the different branches could still individually be considered as "signals", but they only make sense together, with respect to the input signal. Coefficients is a traditional name for them. Honestly, I don't know where it appeared originally.
{ "domain": "dsp.stackexchange", "id": 8883, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "filters, wavelet, algorithms, dwt", "url": null }
python, python-3.x, web-scraping, locking, multiprocessing def printer(lock,data): lock.acquire() try: print(data) finally: lock.release() if __name__ == '__main__': lock = Lock() for i in [link.format(page) for page in range(1,15)]: p = Process(target=get_info, args=(i,lock,itemstorage)) p.start() Style Please read PEP8 and use a consistent style throughout your code: put a space after comas; use a linebreak after colons; use UPPERCASE names for constants… Using locks First off, locks support the context manager protocol and you can thus simplify your printer to: def printer(lock, data): with lock: print(data) which may not warant a method on its own. But most importantly, you say that I've used locking within it to prevent two processes from changing its internal state.
{ "domain": "codereview.stackexchange", "id": 32801, "lm_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, web-scraping, locking, multiprocessing", "url": null }
matlab The red-orange parts correspond to the -1 and blue to the +1 in the corresponding Barker code. If you modulate this down to baseband, then you would get: These are the signals you would use to define the matched-filter, either at baseband or some intermediate frequency. It is not the thirteen -1/+1 of the Barker code. If you take the proper matched filter (the time-reversed conjugate) and apply it, you get the same response for both: Which is the response expected.
{ "domain": "dsp.stackexchange", "id": 12425, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "matlab", "url": null }
java BrandProfitAndLoss ofCurrentYear = (i < currentYearSize) ? brandProfitLossList.get(i) : null; if (ofPreviousYear == null) { ofPreviousYear = new BrandProfitAndLoss( ofCurrentYear.getDate(), dateMode, Consts.CURRENT_YEAR); } if (ofCurrentYear == null) { ofCurrentYear = new BrandProfitAndLoss( ofPreviousYear.getDate(), dateMode, Consts.CURRENT_YEAR); } comparisonDatatable.add(ofCurrentYear); comparisonDatatable.add(ofPreviousYear); comparisonDatatable .add(new BrandProfitAndLoss().getAllRateComparisonRecords( ofCurrentYear, ofPreviousYear)); } return comparisonDatatable; }
{ "domain": "codereview.stackexchange", "id": 4029, "lm_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 }
thermodynamics, statistical-mechanics, surface-tension, nucleation Title: Why does it take energy to grow the surface of a drop? Classical nucleation theory predicts that the growth of small nuclei is thermodynamically disfavoured, on account of the energy required to grow its surface. I am struggling to understand why it takes energy to grow a nuclei's surface. I have done my best to expound my understanding of surface tension and classical nucleation theory below. My hope is that someone can identify a mistaken assumption or fault in my reasoning. Surface Tension Consider a drop of water. Molecules on the surface of the droplet have fewer neighbours than molecules in the bulk of the liquid. This gives them a higher potential energy relative to their counterparts away from the surface. We can assign a positive Gibbs free energy $G_s$ to the liquid's surface that is proportional to its surface area, with the constant of proportionality known as the surface tension. It therefore takes work to increase the drop's surface area through deformation.
{ "domain": "physics.stackexchange", "id": 95010, "lm_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, statistical-mechanics, surface-tension, nucleation", "url": null }
general-relativity, spacetime, curvature, vacuum, stress-energy-momentum-tensor Title: Einstein field equation specific solution Do Einstein's field equations admit a solution such that spacetime was empty in the past of a hypersurface of constant time say $t =0$, but in the future there exists a non-vanishing energy momentum-tensor $T_{\mu\nu}$? If so how can we justify that? Gravitational field carries energy and momentum yet the energy-momentum tensor of purely vacuum spacetime is zero. So it is possible to envision processess where the energy carried by the gravitational field is converted into the energy of matter, including situations where matter is created purely from the gravitational field.
{ "domain": "physics.stackexchange", "id": 73297, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "general-relativity, spacetime, curvature, vacuum, stress-energy-momentum-tensor", "url": null }
c#, excel, winforms, ms-word private void RR_SAVEEDITS_BTN_Click(object sender, EventArgs e) { SafeExcelCall(Globals.SaveTenantData); } //Since I don't know your domain I can't find a really good name here //Usually we prefix a method with `SafeXYZ` if it handles `XYZ` exceptions private void SafeExcelCall(Action excelCall) { try { excelCall(); } catch (AlreadyOpenInExcelException ao) { MessageBox.Show(ao.Message); } } EditPreferencesDlg I don't see the need why do we need using block around this form Please note that I haven't used WinForms in the last 10 years so I might be wrong on using The Load method's switch statement can be rewritten like this to avoid repetitive code
{ "domain": "codereview.stackexchange", "id": 42740, "lm_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#, excel, winforms, ms-word", "url": null }
correctness-proof, loop-invariants, hoare-logic and that's the post-condition! For ease of reference, let the guard be denoted by B; i.e., $$ B : ¬ found ∧ 0 ≤ i - 1 $$ We still haven't actually proved that P is an invaraint: ie that it does not vary with the changes that occur in the loop body and that it is initally true i.e. we need to show $$ \{ ? \} i ≔ N - 1 ; found ≔ a[i] ≈ key \{P\} $$ and $$ \{P ∧ B\} i ≔ i - 1 ; found ≔ a[i] ≈ key \{P\} $$ Initialisation is seen as follows: the wp for assignment tells us: $$wp(Q , v ≔ e) = e \text{ well-defined } ∧ Q[e / v]$$, so applying twice means we need to have the following as pre-condition: wp(P , i ≔ N - 1 ; found ≔ a[i] ≈ key) ≡⟨ sequence rule ⟩ wp( wp(P , found ≔ a[i] ≈ key) , i ≔ N - 1) ≡⟨ assignment rule ⟩ wp( a[i] well-defined ∧ P[ a[i] ≈ key / found ] , i ≔ N - 1) ≡⟨ definitions ⟩ wp( 0 ≤ i < N ∧ i < N ∧ (a[i] ≈ key ≡ a[i] ≈ key) , i ≔ N - 1) ≡⟨ equivalence ⟩ wp( 0 ≤ i < N , i ≔ N - 1) ≡⟨ assignment rule ⟩ 0 ≤ N-1 < N ≡⟨ arithmetic ⟩ 1 ≤ N
{ "domain": "cs.stackexchange", "id": 6462, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "correctness-proof, loop-invariants, hoare-logic", "url": null }
Consider the "dogbone" contour $$D_\varepsilon = -\gamma_1 + \gamma_2 + \gamma_3 + \gamma_4$$, where • $$\gamma_1$$ is the straight line segment $$z = x$$ for $$-1+\varepsilon < x < 1-\varepsilon$$, just above the cut, • $$\gamma_2$$ is the (almost) circular arc $$z = -1 + \varepsilon e^{i\theta}$$ for $$0 < \theta < 2\pi$$, • $$\gamma_3$$ is the straight line segment $$z = x$$ for $$-1+\varepsilon < x < 1 - \varepsilon$$, just below the cut, • $$\gamma_4$$ is the (almost) circular arc $$z = 1 + \varepsilon e^{i\theta}$$ for $$-\pi < \theta < \pi$$.
{ "domain": "brilliant.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9518632302488963, "lm_q1q2_score": 0.8383983443917405, "lm_q2_score": 0.8807970701552505, "openwebmath_perplexity": 4471.129323603746, "openwebmath_score": 0.9999955892562866, "tags": null, "url": "https://brilliant.org/discussions/thread/brilliant-integration-contest-season-3-part-2/" }
by shop, shelf by shelf, it is in fact problematic. 𝑌 : ;= ̂ : ;=∫ − ′ ′ : ′ ; ′=∞ ′=0 ′ (1. Then L {f′(t)} = sF(s) f(0); L {f′′(t)} = s2F(s) sf(0) f′(0): Now. Recall the definition of hyperbolic functions. According to ISO 80000-2*), clauses 2-18. Let fbe a function of t. Consider an LTI system exited by a complex exponential signal of the form x(t) = Ge st. And, Hence, we have The Laplace-transformed differential equation is This is a linear algebraic equation for Y(s)! We have converted a. B & C View Answer / Hide Answer. Patil, Application of Laplace Transform, Global Journals Inc. The above form of integral is known as one sided or unilateral transform. Application to laplace transformation to electric circuits by J Irwin. Each view has its uses. 7 The Transfer Function and the Steady-State Sinusoidal Response. applications of transfer functions to solve ordinary differential equations. 2) 𝑅 for Z-transform in Example 2. The important differences between Fourier transform infrared
{ "domain": "lampertifashion.it", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9883127406273589, "lm_q1q2_score": 0.8828690715365637, "lm_q2_score": 0.8933094103149355, "openwebmath_perplexity": 1052.2003106046586, "openwebmath_score": 0.8233507871627808, "tags": null, "url": "http://gusx.lampertifashion.it/application-of-laplace-transform-pdf.html" }
reference-frames, atmospheric-science, relative-motion, aircraft Title: Why dont we account the rotation of the earth in aircrafts? Is it just because of the air or is there more to it? Today there was a seminar regarding modern air crafts held in my school. At the starting of the lecture, we were asked a question which I found quite intriguing. "Why does a helicopter or a fixed wing aircraft or anything stationary in mid air need to move to get to a certain place? Why cant it just stay mid air and wait for the destination to arrive to itself?" (We were asked to answer it at the end of the lecture. Throughout the lecture I was thinking about the answer. I know that on ground due to friction, the relative velocity between the earth and us is zero hence we don't observe any such effect. Also according to what I can imagine, at lower altitudes, the air closer to earth would also be in motion and that might be the reason due to which the helicopter stays in one place with respect to the ground.)
{ "domain": "physics.stackexchange", "id": 52885, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "reference-frames, atmospheric-science, relative-motion, aircraft", "url": null }
c#, calculator Title: Calculator-like application I'm attempting to implement a calculator-like application in C#. But the way I've currently implemented it seems a little messy and inefficient. It works, but it's just I'm pretty sure it can be achieved in a more elegant solution. I looked to see if I could factor out any repeating code, such as the switch statement - but without having numerous parameters in the method, I don't think it'll make things much better. Here's the main portion of the code: private double Calculate() { double answer = 0.0; foreach (double number in this.numbers) { int index = this.numbers.IndexOf(number); if (index != this.numbers.Count() - 1) { if (answer != 0.0) { switch ((int)operators[index]) { case (int)Operator.Plus: answer = (double)(answer + numbers[index + 1]); break;
{ "domain": "codereview.stackexchange", "id": 820, "lm_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#, calculator", "url": null }
complexity-theory, optimization, np-hard We can also get a hardness of approximation result this way. Given a 3CNF formula $\varphi$ with $m \geq 7$ clauses, we create an $(m+1)$-partite graph. There is a part corresponding to each clause, which has $8$ vertices corresponding to all assignments to the clause, and $m-7$ dummy vertices. In addition, there is a part with $m+1$ special vertices. All edges touching a dummy vertex have weight $m^2$. Edges connecting two conflicting assignments also have weight $m^2$. Edges connecting two non-conflicting assignments have weight $0$. Edges connecting satisfying assignments (for clauses) and special vertices have weight $0$. Edges connecting non-satisfying assignments and special vertices have weight $1$. The minimal clique in this graph has weight equal to the minimal number of unsatisfied clauses in any assignment to $\varphi$. Therefore for every $\epsilon > 0$ it is NP-hard to decide, for $(m+1)$-partite graphs, whether the minimal clique has value $0$ or at least
{ "domain": "cs.stackexchange", "id": 1574, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "complexity-theory, optimization, np-hard", "url": null }
nuclear-physics, collision, scattering, history, neutrons And this is the key point. Chadwick measured the energy of the emitted protons ($5.5$MeV) and their scattering angle, and used the equation above to calculate what energy the gamma ray had to be in order to transfer $5.5$MeV to the protons. The result was that that the initial gamma ray had to have an energy of at least 50MeV. But the initil alpha particles didn't have this much energy, so they couldn't possibly create a gamma ray with such a high energy, and that ruled out the presence of gamma rays.
{ "domain": "physics.stackexchange", "id": 44491, "lm_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, collision, scattering, history, neutrons", "url": null }
# Definition: Set Definition: set is a collection of elements. Notation:  It is often convenient to name our sets so that we don’t have to keep referring to them by their elements or how they’re defined.  Thus, if you hand me a set I can just call it “A”, and then we’ll both know what I’m talking about when I refer to the set A.  We would like to keep track of what elements are in A, however, and so we use the following bracket notation for the elements in a set.  If A is a set of apples which we’ve labeled “apple1”, “apple2”, and “apple3”, then we write $A=\{\mathrm{apple1}, \mathrm{apple2}, \mathrm{apple3}\}$.  Similarly, A could be a set of numbers, perhaps 1, 2, 3, 4, and 5, in which case we write $A=\{1, 2, 3, 4, 5\}$.
{ "domain": "truebeautyofmath.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9873750510899383, "lm_q1q2_score": 0.8002466538556771, "lm_q2_score": 0.8104789086703225, "openwebmath_perplexity": 622.29657771468, "openwebmath_score": 0.8817563056945801, "tags": null, "url": "https://truebeautyofmath.com/definition-set/" }
fluid-dynamics, pressure, flow, applied-physics Title: Is there a way to estimate fan capacity at altitude? Provided you know the capacity of a fan (flow rate) at constant speed and at sea level, is there an analytical way to predict what the flow rate would be at altitude? Or is this specific to the fan's design? For a fixed speed, a fan, blower or any turbo-machine in general will deliver the same volumetric flow regardless of the ambient pressure since the machine essentially scoops out a volume of air as each blade of the machine passes the machine's inlet. $$Q_{SL}=Q_{alt}$$ where $SL$ designates 'Sea Level' as reference and $alt$ as some higher altitude But at higher altitudes there are fewer molecules per unit volume (lower gas density) and so the mass flow rate is lower with increasing altitude and barometric pressure. $$\dot{m}_{alt} < \dot{m}_{SL}$$ So since the volumetric flow rates are the same then $${\dot{m}_{alt}\over{\rho}_{alt}} = {\dot{m}_{SL}\over{\rho}_{SL}}$$ and
{ "domain": "physics.stackexchange", "id": 33729, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "fluid-dynamics, pressure, flow, applied-physics", "url": null }
organic-chemistry, solvents, organic-reduction Of the safe and common solvents that might be useful, isopropanol (91% if available, or 70%) would be somewhat invigorating - if not used in excess. It will almost certainly dry the skin, perhaps too much - so that you resort to applying a skin lotion to provide some oiliness. An alternate way of removing sebum from skin would be to emulsify it with a detergent. Sodium stearate is a common, safe detergent (actually, a soap) which is somewhat soluble in water and available commercially (Ivory Soap is 99.44% pure!). Applied to a washcloth, it will remove much of surface sebum. Rinse, lather, repeat. Some chemical and cosmetic improvements have been made to other products: added colors, fragrances and acids to reduce the pH from neutral to slightly acidic, for a gentler action on skin; added water for semi-liquid soap (Soft Soap).
{ "domain": "chemistry.stackexchange", "id": 10892, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "organic-chemistry, solvents, organic-reduction", "url": null }
java, xml, jaxb, configuration /** * Selects specified element from the parsed Xml document to use as the base * for reading the configuration. * * @param tagName * @return */ public T createAndConfigure(String tagName) throws Exception { Document doc = XmlUtils.parse(filePath); Node startNode; if (tagName == null) { startNode = doc; } else { startNode = XmlUtils.findFirstElement(doc, tagName); } return readConfigFromNode(startNode); } private T readConfigFromNode(Node startNode) throws JAXBException { JAXBContext context = JAXBContext.newInstance(clazz); Unmarshaller unmarshaller = context.createUnmarshaller(); JAXBElement<T> configElement = unmarshaller.unmarshal(startNode, clazz); return configElement.getValue(); } }
{ "domain": "codereview.stackexchange", "id": 15574, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, xml, jaxb, configuration", "url": null }
homework-and-exercises, quantum-information, entropy, quantum-entanglement Title: Why is the entropy of a subsystem density matrix equal to that of the other subsystem? If we have some system $\rho_{AB}$ we can find the entanglement entropy as $S(\rho_A)=S(\text{Tr}_B(\rho_{AB}))=S(\text{Tr}_A(\rho_{AB}))$ But why are the entropies of the subsystems $\rho_A$ and $\rho_B$ equal? For a state $|\psi\rangle=\sum_{ij}C_{ij}|i\rangle|j\rangle$, the density matrix is $$\rho=|\psi\rangle \langle \psi|=\sum_{ijkl}C_{ij}{C_{kl}}^*|ij\rangle\langle kl|$$ We find the reduced density matrix of $A$ by tracing out the $B$ subsystem $$\rho_A=\text{Tr}_B\left(\rho\right)=\sum_x {}_{B}\langle x|\sum_{ijkl}C_{ij}{C_{kl}}^*|ij\rangle\langle kl|x\rangle _B=\sum_{ikx}C_{ix}{C_{kx}}^*|i\rangle\langle k|=\sum_{ikx}C_{ix}{C^\dagger_{xk}}|i\rangle\langle k|\ .$$ Equivalently, for B we find
{ "domain": "physics.stackexchange", "id": 54829, "lm_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, quantum-information, entropy, quantum-entanglement", "url": null }
c# public int GetNewValue(int input) { if (input < 1) throw new ArgumentOutOfRangeException("Must be > 0", nameof(input)); // OR, alternatively: // if (input < 1) return input; // I.e., add increment 0 int increment = input >= _increments.Length ? _increments[^1] : _increments[input]; return input + increment; } Since array indexes are 0-based, we add a dummy entry 0 to the array. _increments[^1] is equivalent to _increments[_increments.Length - 1]. Both, the dictionary and the array have an O(1) access time; however, dictionary operations have quite and overhead associated with them.
{ "domain": "codereview.stackexchange", "id": 45449, "lm_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 }
plasma-physics, fusion Thanks To understand the most significant difference, we must first understand how a conventional tokamak generates part of its magnetic field: the poloidal magnetic field is created by driving a toroidal current, i.e. a current along the (toroidal) plasma column. That current is driven by ramping up (or down) a voltage of a central solenoid. The conventional tokamak is more donut-shaped where the spherical tokamak (ST) is more similar to a cored apple and has thus very little space for a central solenoid. This means that the toroidal current to generate the poloidal magnetic field has to be driven by other means, e.g. radiofrequency heating.
{ "domain": "physics.stackexchange", "id": 39520, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "plasma-physics, fusion", "url": null }
scattering-cross-section Title: Why does cross-section decrease with density? I read on the wikipedia page for cross-section, that cross-section is related to the reciprocal of a material's density. This seems entirely counter-intuitive. Is there an intuitive reason for this? Or am I misunderstanding this? From Wikipedia For a given event, the cross section σ is given by $$σ=\frac μn$$ where $σ$ is the cross section of this event (SI units: $m^2$), $μ$ is the attenuation coefficient due to the occurrence of this event (SI units: $m^{-1}$), and $n$ is the number density of the target particles (SI units: $m^{-3}$)" I read on the wikipedia page for cross-section, that cross-section is related to the reciprocal of a material's density. This seems entirely counter-intuitive.
{ "domain": "physics.stackexchange", "id": 26253, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "scattering-cross-section", "url": null }
classification, scikit-learn, predictive-modeling, model-evaluations Title: How to interprete the feature significance and the evaluation metrics in classification predictive model? Consider a experiment to predict the Google-Play apps rating using a Random-Forest classifier with scikit-learn in Python. Three attributes 'Free', 'Size' and 'Category' are utilized to predict the apps rating. 'Rating' (label) is not continuous value, instead, grouped into two classes 0 and 1. Where 0 is below 4 star rating and 1 is above 4 rating. Through Random-Forest, feature significance of all three predictive attributes and the F1 Evaluation of the model is also calculated. Firstly, lets suppose model omits the 'Size' as most significant feature, so what is implied here, having larger size or lower size of an app contribute to the rating? What If there is no ascending or descending order in the attribute, for instance if the 'Category' is most significant, then what category contributed the most?
{ "domain": "datascience.stackexchange", "id": 9840, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "classification, scikit-learn, predictive-modeling, model-evaluations", "url": null }
python, performance, beginner, object-oriented, python-3.x You can also simplify the writting of the generator using the pairwise recipe: import itertools def pairwise_letters(iterable): """Generate pairs of elements e_n, e_n+1 from iterable. It is assumed that iterable contains characters and the last pair will contain its last element and the empty string so as to break alphabetical ordering. """ first, second = itertools.tee(iterable) next(second, None) yield from itertools.zip_longest(first, second, fillvalue='') def alphabetical_substrings(word): """Generate the substrings of `word` that appear in alphabetical order""" current_sequence = [] for letter, next_letter in pairwise_letters(word): current_sequence.append(letter) if letter > next_letter: yield ''.join(current_sequence) current_sequence.clear() def longest_substring_in_alphabetical_order(word): return max(alphabetical_substrings(word), key=len)
{ "domain": "codereview.stackexchange", "id": 30538, "lm_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, beginner, object-oriented, python-3.x", "url": null }
libuvc-camera, camera, camera-drivers, osx, usb-cam /Users/rieffelj/ros/usb_cam/src/libusb_cam/usb_cam.cpp:666: error: aggregate 'v4l2_capability cap' has incomplete type and cannot be defined /Users/rieffelj/ros/usb_cam/src/libusb_cam/usb_cam.cpp:667: error: aggregate 'v4l2_cropcap cropcap' has incomplete type and cannot be defined /Users/rieffelj/ros/usb_cam/src/libusb_cam/usb_cam.cpp:668: error: aggregate 'v4l2_crop crop' has incomplete type and cannot be defined /Users/rieffelj/ros/usb_cam/src/libusb_cam/usb_cam.cpp:669: error: aggregate 'v4l2_format fmt' has incomplete type and cannot be defined /Users/rieffelj/ros/usb_cam/src/libusb_cam/usb_cam.cpp:672: error: 'VIDIOC_QUERYCAP' was not declared in this scope /Users/rieffelj/ros/usb_cam/src/libusb_cam/usb_cam.cpp:681: error: 'V4L2_CAP_VIDEO_CAPTURE' was not declared in this scope /Users/rieffelj/ros/usb_cam/src/libusb_cam/usb_cam.cpp:688: error: 'V4L2_CAP_READWRITE' was not declared in this scope
{ "domain": "robotics.stackexchange", "id": 5506, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "libuvc-camera, camera, camera-drivers, osx, usb-cam", "url": null }
neural-networks, machine-learning, convolutional-neural-networks, tensorflow, keras 3 - Finally I want to know, once we retrieve the content representation, how can I output that in both as a numpy array and save it as an image? Any help would be really appreciated. For the line featRaw = selectedLayer.output, when I print featRaw, I get the output: Tensor("block4_conv2/Relu:0", shape=(1, 64, 64, 512), dtype=float32). a) Relu:0 does this mean Relu activation has not yet been applied? It has been applied. b) Also I presume we're outputing the feature maps outputs from block4_conv2, not the filters/kernels themselves, correct? Yes. c) Why is there an axis of 1 at the start? My understanding of Conv layers is that they're simply made up from the number of filters/kernels (with shape-height, width, depth) to apply to the input.
{ "domain": "ai.stackexchange", "id": 1343, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "neural-networks, machine-learning, convolutional-neural-networks, tensorflow, keras", "url": null }
c#, generics, inheritance Creating custom objects with custom properties using generics Which you do in this method.. public static KeyValuePair<TCity, IEnumerable<TBuilding>> GetData<TCity, TBuilding>() where TCity : City, new() where TBuilding : Building, new() { TCity city = new TCity(); IEnumerable<TBuilding> buildings = new List<TBuilding>(); return new KeyValuePair<TCity, IEnumerable<TBuilding>>(city, buildings); } A KeyValuePair is archaic, you can use a ValueTuple nowadays TBuilding does not require the new() constraint in this method The choice for IEnumerable over IList is questionable, since you retrieve the items later on and have no way of adding them to an IEnumerable. So why create the IEnumerable in this method? The name should reflect what you are doing. CreateCity seems more appropriate.
{ "domain": "codereview.stackexchange", "id": 35203, "lm_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#, generics, inheritance", "url": null }
java, performance, game, swing, graphics You may want to create a PowerUnit class and extend Item. This allows for more control over the different units. And/or have a separate class for creating the units. This keeps the code more organized. Use else-if It looks like you are avoiding using 'else if' and 'else' statements. Use them whenever necessary. Absolutely no need to avoid them and doing so is wrong.
{ "domain": "codereview.stackexchange", "id": 36866, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, performance, game, swing, graphics", "url": null }
javascript, sudoku, canvas //Methods out here Cell.prototype = { constructor : Cell, //refer back the constructor draw : function(){...}, //more methods for Cell here } I also notice CELLSIZE and CANVASID. If they are globals, then I suggest you not make them globals. Lastly, I suggest you use a canvas framework instead of drawing the shapes by hand. Learning the basics is good, but most developers don't code from scratch (unless there's a compelling need to do so). I suggest using PaperJS or KineticJS for drawing your shapes.
{ "domain": "codereview.stackexchange", "id": 4444, "lm_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, sudoku, canvas", "url": null }
of Equation 1.6 are rewritten as follows: $$\overline{W} \Leftarrow \overline{W} + \alpha \sum_{(\overline{X}, y) \in S^+} y \overline{X} \tag{1.10}$$ Here, $$S^+$$ is defined as the set of all misclassified training points $$\overline{X} \in S$$ that satisfy the condition $$y(\overline{W} \cdot \overline{X}) < 0$$. This update seems to look somewhat different from the perceptron, because the perceptron uses the error $$E(\overline{X})$$ for the update, which is replaced with $$y$$ in the update above. A key point is that the (integer) error value $$E(X) = (y − \text{sign}\{\overline{W} \cdot \overline{X} \}) \in \{ −2, +2 \}$$ can never be $$0$$ for misclassified points in $$S^+$$. Therefore, we have $$E(\overline{X}) = 2y$$ for misclassified points, and $$E(X)$$ can be replaced with $$y$$ in the updates after absorbing the factor of $$2$$ within the learning rate.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9814534344029238, "lm_q1q2_score": 0.8024112840841321, "lm_q2_score": 0.8175744828610095, "openwebmath_perplexity": 188.47377065360268, "openwebmath_score": 0.817695677280426, "tags": null, "url": "https://ai.stackexchange.com/questions/24766/why-doesnt-the-set-2-2-in-ex-y-%E2%88%92-textsign-overlinew-cd" }
java, parsing try { return Double.valueOf(str); } catch (NumberFormatException ex) { /* no-op */ } return str; } ... which avoids the nested try-catch blocks, so can easily be extended to several other types, possibly even looping over a collection of parsers: private static Object tryParse(String str) { for (Parser parser : parsers) { try { return parser.valueOf(str); } catch (NumberFormatException ex) { /* no-op */ } } return str; } or even private static Object tryParse(String str) { for (Parser parser : parsers) { Optional<Object> value = parser.valueOf(str); if (!value.empty()) { return value.get(); } } return str; } Implementation of Parser, and its instances, left as exercise to student.
{ "domain": "codereview.stackexchange", "id": 34870, "lm_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, parsing", "url": null }