text
stringlengths
49
10.4k
source
dict
Math and Arithmetic Algebra Geometry # How do you find base area of rectangular prism if you know volume and height? ###### Wiki User Volume of a rectangular prism = base x height. If volume and height are known, solve for base area by dividing volume by height. 🙏🏿 0 🤨 0 😮 0 😂 0 ## Related Questions ### How can you find the base area of a rectangular prism if you know the volume and height? Volume of a rectangular prism is equal to the base area x height. (V=BxH or Volume = Base Area * Height) To get the base area, simply divide the volume by the height. (B=V/H or Base Area = Volume / Height) ### What is the volume of retengular prism? The volume of the rectangular prism is:Volume = length x width x heightORVolume = Base x height, where Baseis the area of the rectangle on the side of the prism. ### How do you find the volume of a rectangular prism given only the height? You don't. You need the height and the area of the base to find the volume. ### What is the volume of rectangular prism if base area is 32 cm squared and height is 12 cm how do you get answer? The volume of a rectangular prism is the length times the width times the height. The area of the base is length times width. Multiply that by the height. 384 cubic cm. ### How is the cylinder and rectangular prism alike? Both the cylinder and rectangular prism are solid objects. Volume of both can be found by multiplying the area of the base by the height. ### What is the volume of a rectangular prism with a base area of 32 sq cm and a height of 7 cm? volume prism = area base × height = 32 cm² × 7 cm = 224 cm³ ### How do you find the base of a rectangular prism if you know the volume and height? You can only find the area of the base with this information. The volume divided by the height will give you the area of the base. ### What is the volume of the rectangular prism with the base area of 42 m2 and a height of 8 cm?
{ "domain": "answers.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9805806523850543, "lm_q1q2_score": 0.8084514051742423, "lm_q2_score": 0.8244619177503205, "openwebmath_perplexity": 525.4620918263333, "openwebmath_score": 0.8032235503196716, "tags": null, "url": "https://www.answers.com/Q/How_do_you_find_base_area_of_rectangular_prism_if_you_know_volume_and_height" }
So we got that the equation $$|x|+|x-1|=1$$ holds true only in the range $$0\leq{x}\leq{1}$$. (1) $$x \geq 0$$. Not sufficient. (2) $$x \leq 1$$. Not sufficient. (1)+(2) gives us the range $$0\leq{x}\leq{1}$$, which is exactly the range for which given equation holds true. Sufficient. Hope it helps. _________________ Senior Manager Joined: 13 Dec 2009 Posts: 263 Followers: 10 Kudos [?]: 193 [0], given: 13 Show Tags 16 Mar 2010, 06:31 abhi758 wrote: Is l x l + lx-1l= 1? (1) $$x \geq 0$$ (2) $$x \leq 1$$ Any explanations for the given OA.. [Reveal] Spoiler: C |x|+|x-1|, there can be 4 cases stmt1: x >= 0 => x is positive, if we apply this to eq 1, we cannot say that 2x-1 = 1 cos x can be >= 0 but less than 1 so insuff stmt2: x<=1 => if we apply this to eq 1, we cannot say that 2x-1 = 1 cos x<=1 can lead to negative numbers also. both stmt taken together 0<= x <= 1 x is a fraction between 0 to 1 so always x + 1-x = 1 in our case |x| will be x and |x - 1| is actually value of 1-x so it will always be 1 this is why C both the stmts are reqd. _________________ My debrief: done-and-dusted-730-q49-v40 Senior Manager Joined: 16 Jul 2009 Posts: 256 Followers: 6 Kudos [?]: 364 [0], given: 3 Show Tags
{ "domain": "gmatclub.com", "id": null, "lm_label": "1. Yes\n2. Yes\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9263037262250327, "lm_q1q2_score": 0.8014602981490978, "lm_q2_score": 0.8652240895276223, "openwebmath_perplexity": 5001.860574531439, "openwebmath_score": 0.8046931624412537, "tags": null, "url": "https://gmatclub.com/forum/is-x-x-91471.html" }
cosmology I'll appreciate it if someone could answer this. According to linear-order cosmological perturbation theory, density contrasts $\delta\equiv(\rho-\bar\rho)/\bar\rho$ grow proportionally with some growth function $D(a)$. For example, during matter domination, $D(a)\propto a$. The power spectrum accordingly grows as $P\propto D(a)^2$, and the rms variance grows as $\sigma\propto D(a)$. Meanwhile, according to the spherical collapse model, the critical linear density contrast for collapse is some number $\delta_\mathrm{c}(a)$. For example, $\delta_\mathrm{c}=1.686$ during matter domination, but it is larger during the radiation epoch and is slightly smaller today due to dark energy. So both $\sigma$ and $\delta_\mathrm{c}$ depend on time. However, since the Press-Schechter formalism only cares about the ratio $\delta_\mathrm{c}/\sigma$, you can equivalently think of $\sigma$ being constant while absorbing the growth function $D$ into the definition of $\delta_\mathrm{c}$, so that $\delta_\mathrm{c}\propto 1/D(a)$. This is what your source is doing. It might seem like an arbitrary choice, but it can be convenient, particularly when making more intricate calculations, like using conditional mass functions to study assembly histories.
{ "domain": "physics.stackexchange", "id": 98754, "lm_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", "url": null }
statistical-mechanics, partition-function Title: What is the physical meaning of the partition function in statistical physics? In many places in statistical physics we use the partition function. To me, the explanations of their use are clear, but I wonder what their physical significance is. Can anyone please explain with a good example without too many mathematical complications? The partition function is a measure of the volume occupied by the system in phase space. Basically, it tells you how many microstates are accessible to your system in a given ensemble. This can be easily seen starting from the microcanonical ensemble. In the microcanonical ensemble, where every microstate with energy between $E$ and $E+\Delta E$ is equally probable, the partition function is $$Z_{mc}(N,V,E)= \frac 1 {N! h^{3N}}\int_{E<\mathcal H(\{p,q\})<E+\Delta E} d^{3N}p \ d^{3N} q \tag{1}$$ where the integral is just the hypervolume of the region of phase space where the energy (hamiltonian) $\mathcal H$ of the system is between $E$ and $E+\Delta E$, normalized by $h^{3N}$ to make it dimensionless. The factor $N!^{-1}$ takes into account the fact that by exchanging the "label" on two particles the microstate does not change. The Boltzmann equation $$S=k_B \log(Z_{mc})\tag{2}$$ tells you that the entropy is proportional to the logarithm of the total number of microstates corresponding to the macrostate of your system, and this number is just $Z_{mc}$. In the canonical and grand-canonical ensembles the meaning of the partition function remains the same, but since energy is not anymore fixed the expression is going to change. The canonical partition function is $$Z_c(N,V,T)= \frac 1 {N! h^{3N}}\int e^{-\beta \mathcal H(\{p,q\})} d^{3N}p \ d^{3N} q\tag{3}$$
{ "domain": "physics.stackexchange", "id": 34638, "lm_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, partition-function", "url": null }
java, performance, integer Subtraction is not shown, as it's obviously as fast as addition. The code for multiplication is given in the old question. Small improvements Overall, it seems that what you wrote is correct and is an improvement over the mod(mod(x)+mod(y)) solution, especially in the case where there is no overflow. I have three small improvements: Add instead of multiply by 2 You can replace this line: long result = 2L * mod(half) + lsb; with: long halfmod = mod(half); long result = halfmod + halfmod + lsb; The modified version showed a 1% improvement in the overflow case. (See benchmarks below) Remove one unnecessary check Following the code above, you have this code: // Now the result lies in the range 0 to 2*modulus+1 (both included), // so conditionally reduce it twice. if (result>=modulus) result -= modulus; if (result>=modulus) result -= modulus; But actually, the value of mod(half) is in the range 0..modulus-1. So if you multiply that by 2 and add 1, result will be in the range 0..2*modulus-1, not 0..2*modulus+1 as you stated in the comment. Therefore, after the first result -= modulus, the range of result will be 0..modulus-1 and there is no need for the second check. // Now the result lies in the range 0 to 2*modulus-1 (both included), // so conditionally reduce it once. if (result>=modulus) result -= modulus; By removing the second check, I found a 1% speed improvement in the overflow case. Checking for overflow I replaced this overflow check for add: final boolean overflow = (x^y) >= 0 & (x^sum) < 0; with this very similar one: final boolean overflow = ((x^y^Long.MIN_VALUE) & (x^sum)) < 0; Edit: Later I found that this inverted version is faster: final boolean overflow = ((x^y) | ~(x^sum)) >= 0;
{ "domain": "codereview.stackexchange", "id": 14446, "lm_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, integer", "url": null }
quantum-field-theory, coordinate-systems, fourier-transform, commutator Title: Spherical polar co-ordinates in momentum space I'm trying to write this unequal time commutator in spherical polar coordinate, and align the polar axis to be along the direction of x: $$ \large \Delta(x) = [\phi(x),\phi(0)] = \int \frac{d^3p}{(2\pi)^3}\frac{1}{2E_p}(e^{-ipx}-e^{ipx}) $$ I was told that the first step is to rewrite the above integral as $$ \large \Delta(x) = \frac{1}{(2\pi)^3}\int_0^{\infty}d\rho\ \rho^2\int_0^{2\pi}d\phi\int_{-1}^{1} d(\cos\theta)\frac{1}{2E(\rho)}(e^{-iE(\rho)t+i\rho|x|\cos\theta}-e^{iE(\rho)t-i\rho|x|\cos\theta}) $$ Where we denote $\rho = |p|$, and $E_p$ is transformed to $E{(\rho)}$. From the definition of spherical coordinate in physics convention, we have $\theta\in[0,\pi]$. It makes sense to me the last integrand goes from -1 to 1, but I don't quite understand why do we have the factor of $\cos\theta$ (and integrate along that)? If we look at the spherical coordinate diagram, isn't $\cos\theta$ projecting the vector to the z-axis? Is that consistent with 'align the polar axis to be along the direction of x'? And why are we interested in writing this commutator in spherical coordinate?
{ "domain": "physics.stackexchange", "id": 91316, "lm_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, coordinate-systems, fourier-transform, commutator", "url": null }
php, array Title: Converting multi-dimensional array into row data Input: $input = [ 'category' => [ '1' => [ 'name' => 'c1', 'attribute' => [ '1' => [ 'name' => 'a1', 'option' => [ '1' => [ 'name' => 'o1' ], '2' => [ 'name' => 'o2' ] ] ], '2' => [ 'name' => 'a2', 'option' => [ '3' => [ 'name' => 'o3' ], '4' => [ 'name' => 'o4' ] ] ] ] ], '2' => [ 'name' => 'c2', 'attribute' => [ '3' => [ 'name' => 'a3', 'option' => [ '5' => [ 'name' => 'o5' ], '6' => [ 'name' => 'o6' ] ] ], '4' => [ 'name' => 'a4', 'option' => [ '7' => [ 'name' => 'o7' ], '8' => [ 'name' => 'o8' ] ] ] ] ] ] ];
{ "domain": "codereview.stackexchange", "id": 40633, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "php, array", "url": null }
c++, comparative-review, fibonacci-sequence return 0; } My first comment is that I did not see the most obvious way of doing. A simple recursive algorithm (Though that way does make printing them in order harder). fibo_1 Arrays are fixed size at compile time Dynamically sized arrays are not technically part of the standard. int x[n]; // Not allowed unless n is `constexpr`. Though a lot of compilers support this as an extension, its not technically part of the standard and thus best avoided in preference of using std::vector. Memoization ie. storing the intermediate values. This is not really useful or efficient unless you plan on re-using the values. If you are simply using them to calculate the next value then you could potentially just use two variables (the previous two values. for (int index = 2; index < n; index++){ f[index] = f[index-1] + f[index-2]; std::cout << "-" << f[index]; } I would rewrite like this: for (int index = 2; index < n; index++, f_index_minus_2 = f_index_minus_1, f_index_minus_1 = f){ f = f_index_minus_1 + f_index_minus_2; std::cout << "-" << f; }
{ "domain": "codereview.stackexchange", "id": 29735, "lm_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++, comparative-review, fibonacci-sequence", "url": null }
Alternate Solutions chrisfizzix2008-10-03 14:32:17 I feel that the posted solution lacks a bit of transparency; this is the same solution but reformatted. Bragg Scattering gives the result $2 d \sin{\theta} = n \lambda$ and the DeBroglie relation gives $p = \frac{h}{\lambda}$. First-order reflection lets us set $n = 1$, also the relation usually fails if n > 1 anyway, so we can rearrange to write $p = \frac{h}{2 d \sin{\theta} }$ The answer in E is greater than $c$, so we can get rid of that. All of the other answers are non-relativistic (even for D, $\beta \approx 0.01$ ) so we can just use $p = mv$. Solving this, we get $v = \frac{h}{2 d \sin{\theta} m_e}$ Plugging in values gives a result closest to D.Reply to this comment casseverhart13 2019-08-16 13:14:48 thanks for the very useful problem! Gainesville Pressure Washing University anmuhich 2009-03-21 15:03:39 I don't know hardly any optics, but one can eliminate A, B and E because they are completely unreasonable speeds for an electron. D seems the most plausible out of the two left. student2008 2008-10-14 06:07:56 Since the orders of magnitude in answers differ a lot, we can even don't get use of $\theta$ & Bragg condition. All we use is $mv=p=\frac hd$, since $d\sim \lambda$ (actually, in this problem $2\sin\theta=1$, so we even obtain the exact result).
{ "domain": "grephysics.net", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9744347890464284, "lm_q1q2_score": 0.8055767388979207, "lm_q2_score": 0.8267118004748677, "openwebmath_perplexity": 577.0313120119029, "openwebmath_score": 0.8470216989517212, "tags": null, "url": "http://grephysics.net/ans/8677/91/2169" }
general-relativity, differential-geometry, tensor-calculus, differentiation &=-\frac{1}{\sqrt{|g|}}\partial_{\nu}[\sqrt{|g|}g^{\mu \lambda} \partial_{\mu}f] \end{align} Why did $g^{-1}$ come up? I would appreciate it if you could tell me. For your information, $\ast$ is defined as follows. \begin{align} \ast (dx^{\mu_1}\wedge dx^{\mu_2}\wedge \cdots \wedge dx^{\mu_r})=\frac{\sqrt{|g|}}{(m-r)!}\epsilon^{\mu_1\mu_2 \cdots \mu_r}\ _{\nu_{r+1}\cdots \nu_{m}}dx^{\nu_{r+1}}\wedge \cdots \wedge dx^{\nu_{m}} \end{align} where $m$ is just dimension of manifold. Let's start with this expression, $-\ast \frac{1}{(m-1)!}\partial_{\nu}[\sqrt{|g|}g^{\mu \lambda} \partial_{\mu}f] \epsilon_{\lambda \nu_2 \cdots\nu_m} dx^{\nu}\wedge dx^{\nu_2}\wedge \cdots \wedge dx^{\nu_m}.$ Now, \begin{equation} \ast dx^{\nu}\wedge dx^{\nu_2}\wedge \cdots \wedge dx^{\nu_m}=\sqrt{|g|}\epsilon^{\nu\nu_2\cdots\nu_m}. \end{equation} Therefore, the first expression becomes, \begin{equation}
{ "domain": "physics.stackexchange", "id": 78701, "lm_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, differential-geometry, tensor-calculus, differentiation", "url": null }
python, performance, strings, number-systems Title: Convert boolean list to list of base10 integers Context: I'm coding up a simple genetic optimization algorithm from first principles, and have decided to use boolean/binary strings as genes so that I can flip bits on or off as a form of mutation. In order to evaluate the fitness of the solutions that it generates I need to be able to decode the binary strings produced into the integer values that I'm optimizing for. The genetic optimization technique that I'm using returns it's individuals as a list, so I am extracting the integers as follows: Problem: Take the boolean/binary list... l = [1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1] ...split it into 8-bit sublists... [[1, 0, 1, 0, 0, 1, 1, 1], [0, 0, 1, 0, 1, 0, 1, 0], [0, 0, 1, 1, 1, 0, 1, 1]] ...concatenate each sublist into a string... [10100111, 101010, 111011] ...convert those strings from binary to decimal... [167, 42, 59] ...then scale those integers between 50 and 150... [115, 66, 73] My solution: [int(int(str(bin), 2)/2.55)+50 for bin in [int(''.join(\ map(str,num))) for num in [l[i:i +8] for i in range(0, len(l), 8)]]]
{ "domain": "codereview.stackexchange", "id": 32250, "lm_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, strings, number-systems", "url": null }
python, python-3.x def read(path): """Reads file content from FS""" if path in PREDEFINED: return PREDEFINED[path] with open(path.as_posix()) as file: return file.read() This one wouldn't be needed with a standard way to distribute your file. Also, the pathlib documentation advises str(path) instead of path.as_posix(). def write(path, content): """Writes file content to FS""" with open(path.as_posix(), 'w') as file: file.write(content) Since you're in the context of your application, is it possible to give a more meaningful name to the write function? def copy(from_p, to_p): """Copies file content""" import shutil shutil.copyfile(from_p.as_posix(), to_p.as_posix()) def file_exist(path): """Check if file exist for specified path""" return path.is_file() Think what you want about the clarity of path.is_file(), but those two functions complicate the code (I need to lookup what they do), while shutil.copyfile and is_file() are standard and more likely to be known by other developers. ###Markdown template engine operations def md_read(inp): """Reads markdown formatted message.""" import markdown md_converter = markdown.Markdown(extensions=['meta']) content = md_converter.convert(inp) meta = getattr(md_converter, 'Meta', []) Isn't md_converter.meta enough? return { 'meta' : meta, 'content' : content }
{ "domain": "codereview.stackexchange", "id": 9667, "lm_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", "url": null }
java, array, sliding-tile-puzzle Title: For finding whether a puzzle state is solvable I have code which returns whether or not a sliding tile puzzle state is solvable. I was wondering whether there is any way I could either make the code a bit more readable or increase the performance in any way. public boolean isSolvable(int[] puzzle) { int parity = 0; int gridWidth = (int) Math.sqrt(puzzle.length); int row = 0; // the current row we are on int blankRow = 0; // the row with the blank tile for (int i = 0; i < puzzle.length; i++) { if (i % gridWidth == 0) { // advance to next row row++; } if (puzzle[i] == 0) { // the blank tile blankRow = row; // save the row on which encountered continue; } for (int j = i + 1; j < puzzle.length; j++) { if (puzzle[i] > puzzle[j] && puzzle[j] != 0) { parity++; } } } if (gridWidth % 2 == 0) { // even grid if (blankRow % 2 == 0) { // blank on odd row; counting from bottom return parity % 2 == 0; } else { // blank on even row; counting from bottom return parity % 2 != 0; } } else { // odd grid return parity % 2 == 0; } } You can use a fun fact from abstract algebra. It's a group theory fact, to be more specific. Read all about it here or here or, better yet, here. I actually used this in my own sliding tile puzzle I created for the App Store in 2013. But I used it to generate puzzles, not to verify solvability. I see now where my original intended answer went wrong. The math behind it requires the empty space be in the bottom right corner, and I missed that at first. From the Wiki link: In particular if the empty square is in the lower right corner then the puzzle is solvable if and only if the permutation of the remaining pieces is even.
{ "domain": "codereview.stackexchange", "id": 25288, "lm_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, array, sliding-tile-puzzle", "url": null }
Let $$P(\theta) = (1, y)$$. Then $$\theta = \arctan(y).$$ Then $$\sin \theta = \dfrac{y}{\sqrt{1+y^2}} \qquad \text{and} \qquad \cos \theta = \dfrac{1}{\sqrt{1+y^2}}$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9643214491222695, "lm_q1q2_score": 0.819645443151881, "lm_q2_score": 0.8499711832583696, "openwebmath_perplexity": 1063.3813827224105, "openwebmath_score": 0.9999548196792603, "tags": null, "url": "https://math.stackexchange.com/questions/3100148/why-frac12-arctanx-arctanx-sqrtx21-frac-pi4" }
classical-mechanics, moment-of-inertia Note that dot product multiplication commutes so $\mathbf x\cdot \mathbf{\hat n} = \mathbf{\hat n}\cdot \mathbf x$. With that in mind you can write $(\mathbf x \cdot \mathbf{\hat n})^2 = (\mathbf x \cdot \mathbf{\hat n})(\mathbf x \cdot \mathbf{\hat n}) = (\mathbf{\hat n}\cdot \mathbf x)(\mathbf x \cdot \mathbf{\hat n})=(\mathbf{\hat n}^T \mathbf x)(\mathbf x^T \mathbf{\hat n})$, having switched between the various notational conventions ;). But the parentheses don't really matter here, and you could just as well imagine forming the matrix $\mathbf x \mathbf x^T$ first, and then multiplying it on both sides by $\mathbf{\hat n}$ later, instead of taking the dot products first and multiplying the resulting scalars second. The notation in this text sample was really bad, so don't feel discouraged.
{ "domain": "physics.stackexchange", "id": 74085, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "classical-mechanics, moment-of-inertia", "url": null }
nappe a nappe is one half of a double cone multivariable calculus the study of the calculus of functions of two or more variables monotone sequence an increasing or decreasing sequence moment if n masses are arranged on a number line, the moment of the system with respect to the origin is given by $$\displaystyle M=\sum^n_{i=1}m_ix_i$$; if, instead, we consider a region in the plane, bounded above by a function $$f(x)$$ over an interval $$[a,b]$$, then the moments of the region with respect to the $$x$$- and $$y$$-axes are given by $$\displaystyle M_x=ρ∫^b_a\dfrac{[f(x)]^2}{2}\,dx$$ and $$\displaystyle M_y=ρ∫^b_axf(x)\,dx$$, respectively mixed partial derivatives second-order or higher partial derivatives, in which at least two of the differentiations are with respect to different variables minor axis the minor axis is perpendicular to the major axis and intersects the major axis at the center of the conic, or at the vertex in the case of the parabola; also called the conjugate axis midpoint rule a rule that uses a Riemann sum of the form $$\displaystyle M_n=\sum^n_{i=1}f(m_i)Δx$$, where $$m_i$$ is the midpoint of the $$i^{\text{th}}$$ subinterval to approximate $$\displaystyle ∫^b_af(x)\,dx$$ method of variation of parameters a method that involves looking for particular solutions in the form $$y_p(x)=u(x)y_1(x)+v(x)y_2(x)$$, where $$y_1$$ and $$y_2$$ are linearly independent solutions to the complementary equations, and then solving a system of equations to find $$u(x)$$ and $$v(x)$$
{ "domain": "libretexts.org", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9854964207345893, "lm_q1q2_score": 0.8034087069589012, "lm_q2_score": 0.8152324960856175, "openwebmath_perplexity": 141.3882769672332, "openwebmath_score": 0.9248999357223511, "tags": null, "url": "https://math.libretexts.org/Bookshelves/Calculus/CLP-4_Vector_Calculus_(Feldman_Rechnitzer_and_Yeager)/zz%3A_Back_Matter/20%3A_Glossary" }
tex \node[above=1cm of n7.west] (ub7) {upper\_bound(60)}; \draw [myarrow=-1pt] (ub7) -- (n7.north west); \node[above=0.5cm of n4] (er4) {equal\_range(40)}; \draw [myarrow=-3pt] (er4.south-|n4.north west) -- (n4.north west); \draw [myarrow=-3pt] (er4.south-|n5.north west) -- (n5.north west); \node[below=1cm of n3.west] (lb25) {lower\_bound(25)}; \draw [myarrow=-1pt] (lb25) -- (n3.south west); \node[below=1cm of n7.west] (ub65) {upper\_bound(65)}; \draw [myarrow=-1pt] (ub65) -- (n7.south west); \node[below=0.7cm of n4.east] (er45) {equal\_range(45)}; \draw [myarrow=-3pt] (er45.north) ++(0.45ex,0) coordinate (tmp) -- (tmp|-n5.south west); \draw [myarrow=-3pt] (er45.north) -- (n5.south west); \draw[decoration={brace},decorate,color=black!50] (ne.north west) ++(0,1.3cm) -- node[right=6pt] {gefunden} ++(0,-1.1cm); \draw[decoration={brace,mirror},decorate,color=black!50] (ne.south west) ++(0,-1.3cm) -- node[right=6pt] {nicht gefunden} ++(0,1.1cm); \end{tikzpicture} \end{document}
{ "domain": "codereview.stackexchange", "id": 22713, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "tex", "url": null }
# Merged Bernoulli process ##### New member Consider two Bernoulli processes X1 and X2 such that X1[k] is a Bernoulli random variable with P=0.5 and X2[k] is a Bernoulli random variable with P=0.7 for all k>=0 Let Y be a random process formed by merging X1 and X2, i.e. Y[k] =1 if and only if X1[k] = X2[k] = 1 and Y[k] = 0 otherwise. a.) Solve for the success probability of Y if X1 and X2 are uncorrelated. b.) Solve for the success probability of Y if E[X1[k]X2[k]] = 0.3. c.) If E[X1[k]X2[k]] is constant for all k, find the minimum possible success probability of Y. d.) If E[X1[k]X2[k]] is constant for all k, find the maximum possible success probability of Y. My initial thought was that the success probability of Y was just the intersection of x1 and x2 (when both are equal to 1) or 0.7*0.5 = 0.35. However, the way to problem is written suggests that correlation affects the probability. Can someone explain how this is so? Edit: I've realized that the 2 bernoulli processes may not be independent, therefore, my initial understanding of the problem is wrong. However, how do I use the information given (the correlation) to solve for the probability? What equation relates the two together, or what assumptions can I make about the problem given the correlation? Last edited: #### steep ##### Member Consider two Bernoulli processes X1 and X2 such that X1[k] is a Bernoulli random variable with P=0.5 and X2[k] is a Bernoulli random variable with P=0.7 for all k>=0 Let Y be a random process formed by merging X1 and X2, i.e. Y[k] =1 if and only if X1[k] = X2[k] = 1 and Y[k] = 0 otherwise.
{ "domain": "mathhelpboards.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9840936087546922, "lm_q1q2_score": 0.8068517917330749, "lm_q2_score": 0.8198933359135361, "openwebmath_perplexity": 555.6949413480081, "openwebmath_score": 0.7331236600875854, "tags": null, "url": "https://mathhelpboards.com/threads/merged-bernoulli-process.26674/" }
c#, error-handling, tcp And where I try to send a message private void send(string msg) //TODO: must be set to private is now so for testing purpose public { if (Connection.Connected) { if (!_tcpReader.IsStopped) { _writer.Write(msg); _writer.Flush(); } else Console.Error.WriteLine( "Unable to send message to the server, a request has been made to terminate the connection."); _watchdog.SetStatus(); //give live tick to watchdog } else { Console.Error.WriteLine("Unable to send message, not connected to the server."); _watchdog.Stop(); //the next statement generates an event and the timer would generate the same events wich causes to many events _watchdog.SetManually(); //set manually that connection has been terminated } } I'll express my thoughts step by step reading your code (just a note: you should post a complete compilable code, at least of your main class Watchdog, if you take out what you think is not relevant then it is much harder to understand what you're doing). internal class Watchdog : IDisposable internal modifier (unless Watchdog is a nested class) is superfluous. Moreover if you're not supposed to derive any class from Watchdog I'd declare it as sealed (note that it's an internal class then you can simply remove it when you will need to derive, there is not any public interface to respect). sealed class Watchdog : IDisposable IDisposable interface usually comes together with a common pattern implementation, I see no reason to avoid that (even in simple cases): ~Watchdog() { Dispose(false); } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } private void Dispose(bool disposing) { try { if (disposing) _timer.Elapsed -= _timer_Elapsed; } finally { _timer.Dispose(); } } private Timer _timer = new Timer(1000);
{ "domain": "codereview.stackexchange", "id": 17089, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, error-handling, tcp", "url": null }
python, parsing, regex, numpy, pandas 286.48, 286.25, 286.02, 285.79, 285.50, 285.22, 284.93, 284.73, 284.53, 284.34, 284.12, 283.91, 283.70, 283.85, 284.01, 284.16, 284.62, 285.07, 285.52, 286.27, 287.02, 287.77, 288.59, 289.41, 290.24, 289.73, 289.22, 288.72, 288.49, 288.27, 288.05, 287.72, 287.40, 287.07,
{ "domain": "codereview.stackexchange", "id": 42285, "lm_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, parsing, regex, numpy, pandas", "url": null }
python, python-3.x, tkinter def _back_100(self, event): self.image_index = max(0, self.image_index - 100) self._draw_image(self.files[self.image_index]) self._update_string() def _update_string(self): string_to_format = 'right click to start and stop drawing. k: next image, j: prev image, h: skip 100 back. l: skip 100 forward. u: remove polygon. d: delete all labels. images: {} of {}' string = string_to_format.format(self.image_index+1, len(self.files)) self.info_box.set(string) def _delete_json_file(self, event): json = self._create_json_filename(self.files[self.image_index]) try: remove(json) except FileNotFoundError as e: print("Labels don't exist for this image") self.save_on_next = False def _draw_image(self, image_path): img = ImageTk.PhotoImage(Image.open(image_path)) self.canvas.image = img self.canvas.create_image(0, 0, image=img, anchor='nw') def _create_json_filename(self, filename): out_filename = join(self.label_directory, splitext(basename(filename))[0]) + ".json" return out_filename def _dump_coord_dict(self): if not self.save_on_next: return out_filename = self._create_json_filename(self.files[self.image_index]) with open(out_filename, 'w') as f: dump(self.poly_coords, f) self.object_ids = defaultdict(list) self.poly_coords = defaultdict(list) self.poly_count = 0
{ "domain": "codereview.stackexchange", "id": 36833, "lm_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, tkinter", "url": null }
f(x 0) = 0. x→x 0 This is the same as saying that the function is continuous, because to prove that a function was continuous we’d show that lim f(x) = f(x 0). This counterexample proves that theorem 1 cannot be applied to a differentiable function in order to assert the existence of the partial derivatives. A function having partial derivatives which is not differentiable. If you get two numbers, infinity, or other undefined nonsense, the function is not differentiable. prove that every differentiable function is continuous - Mathematics - TopperLearning.com | 2b8w46gbb. If you were to put a differentiable function under a microscope, and zoom in on a point, the image would look like a straight line. Nowhere Differentiable. But the converse is not true. for products and quotients of functions. Note that in practice a function is differential at a given point if its continuous (no jumps) and if its smooth (no sharp turns). If a function f (x) is differentiable at a point a, then it is continuous at the point a. prove that every differentiable function is continuous - Mathematics - TopperLearning.com | 2b8w46gbb ... As c was any arbitrary point, we have f is a continuous function. On the line everything is known (a measurable subset of the line contains a point of differentiability of every Lipschitz function iff it has positive measure). ... ago. f ( x ) = ∣ x ∣ is contineous but not differentiable at x = 0 . Differentiate it. When you zoom in on the pointy part of the function on the left, it keeps looking pointy - never like a straight line. Prove that any polynomial is differentiable at every point? Point Nowhere differentiable by | 25th Jul, 2014, 01:53: PM graph at. Exists on R. R is all real numbers ( every point ), precise definition differentiability... Point, the function must first of all be defined there big literature on universal differentiability sets spaces... That have Lebesgue measure zero also continuous at that point Nowhere differentiable derivatives which is not.. Defined there precise definition of differentiability two numbers, infinity, or undefined..., 2014, 01:53: PM case where a
{ "domain": "zorilestore.ro", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9719924818279466, "lm_q1q2_score": 0.8120837247188093, "lm_q2_score": 0.8354835452961425, "openwebmath_perplexity": 373.5816553190147, "openwebmath_score": 0.9110859632492065, "tags": null, "url": "http://blog.zorilestore.ro/orris-root-miq/3e5682-how-to-prove-a-function-is-differentiable-at-every-point" }
ros <joint name="chassis_to_motor_holder" type="fixed"> <parent link="base_link"/> <child link="motor_holder"/> <origin xyz="0.09 0 ${chassis_height/2 + 0.07/2}"/> </joint> <gazebo reference="motor_holder"> <material>ETABot/Dark_Grey</material> </gazebo> <!-- Motor --> <link name="motor"> <inertial> <mass value="1.0" /> <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1" /> </inertial> <visual> <geometry> <cylinder length="0.09" radius="0.03"/> </geometry> <origin rpy="0 ${pi/2} 0" xyz="0 0 0"/> <material name="Blue" /> </visual> <collision> <geometry> <cylinder length="0.06" radius="0.03"/> </geometry> <origin rpy="0 ${pi/2} 0" xyz="0 0 0"/> </collision> </link> <joint name="motor_holder_to_motor" type="fixed"> <parent link="motor_holder"/> <child link="motor"/> <origin xyz="-0.06 0 0"/> </joint> <gazebo reference="motor"> <material>ETABot/Blue</material> </gazebo>
{ "domain": "robotics.stackexchange", "id": 15133, "lm_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 }
astronomy, experimental-physics, measurements, signal-processing $$ v_\mathrm{g} = \left\lvert \frac{\mathrm{d}\omega}{\mathrm{d}k} \right\rvert = c \sqrt{1 - \left(\frac{\omega_\mathrm{p}}{\omega}\right)^2}. $$ The travel time across a distance $D$ is simply $$ t = \int_0^D \frac{1}{v_\mathrm{g}} \, \mathrm{d}x. $$ Now since $\omega_\mathrm{p}$ corresponds to (circular) frequencies $\nu$ of less than $10\ \mathrm{kHz}$ at electron densities of $1\ \mathrm{cm}^{-3}$, we often have $\omega \gg \omega_\mathrm{p}$.2 With this approximation, we can write $$ t \approx \frac{1}{c} \int_0^D \left(1 + \frac{1}{2} \left(\frac{\omega_\mathrm{p}}{\omega}\right)^2\right) \, \mathrm{d}x = \frac{D}{c} + \frac{2\pi e^2}{cm_\mathrm{e}\omega^2} \mathrm{DM}, $$ where $$ \mathrm{DM} = \int_0^D n_\mathrm{e} \, \mathrm{d}x $$ is known as the dispersion measure along the line of sight. The spread in arrival times is then seen to obey $$ \Delta t \approx -\frac{4\pi e^2\mathrm{DM}}{cm_\mathrm{e}} \omega^{-3} \Delta\omega = -\frac{e^2\mathrm{DM}}{\pi cm_\mathrm{e}} \nu^{-3} \Delta\nu. \tag{1} $$ Here the negative sign indicates higher frequencies will arrive earlier.
{ "domain": "physics.stackexchange", "id": 9517, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "astronomy, experimental-physics, measurements, signal-processing", "url": null }
quantum-mechanics, homework-and-exercises, harmonic-oscillator The question is that I barely understand that how to deduce equations $(2)$ and $(3)$. In particular, I think the equation $(2)$ is bizarre. And I know if I get $(2)$, I will know how to deduce $(3)$. I hope someone could help me and explain that how to deduce $(2)$. I see that your problem is you can't deduce equation $(2)$.But note that Hermit polynomial is $h(\xi)=\sum_{j=0}^\infty a_j\xi^j$,and the sum start from 0.So the terms are all even. Then using $$a_{j+2}\approx\frac{2}{j}a_j$$ we have$$\begin{align}a_j&\approx\frac{2}{j-2}a_{j-2}\\ &\approx\frac{2}{(j-2)(j-4)}a_{j-4}\\ &\approx\frac{1}{(j/2-1)(j/2-2)(j/2-3)}a_{j-6}\\ &\dots\\ &\approx\frac{a_0}{(\frac{j}{2})!} \end{align}$$ where $a_0$ is $C$ in your expression. The rest I'm sure is easy for you to complete.Just put $a_j$ back to $h(\xi)$ and make a variable substitution.
{ "domain": "physics.stackexchange", "id": 28420, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, homework-and-exercises, harmonic-oscillator", "url": null }
python, performance, signal-processing event_inds = sorted(pk_inds + vly_inds) for x in event_inds: if x in pk_inds: is_peak = True else: is_peak = False if is_peak and curr_event == 'valley': new_vly_inds.append(best_ind) curr_event = 'peak' best_val = arr[x] best_ind = x continue if not is_peak and curr_event == 'peak': new_pk_inds.append(best_ind) curr_event = 'valley' best_val = arr[x] best_ind = x continue if is_peak and curr_event == 'peak' and arr[x] > best_val: best_val = arr[x] best_ind = x elif not is_peak and curr_event == 'valley' and arr[x] < best_val: best_val = arr[x] best_ind = x if curr_event == 'valley': new_vly_inds.append(best_ind) if curr_event == 'peak': new_pk_inds.append(best_ind) return new_pk_inds, new_vly_inds An extended and more comprehensive refactoring would require having more context to your current function: calling context, how do the function's parameters are composed and related, what is close_prices ... But even with restricted context the posted function get_peak_valley has enough space (gaps) for restructuring and optimizations: Rounding numeric arguments and ensuring limits: round function. Python's round function already returns rounded number as integer if precision is omitted, no need to cast to int (like int(round(window_size)) ...). Negative numbers will be rounded to 0. ensuring lower limit with if window_step == 0: window_step = 1 if req_angles == 0: req_angles = 1 can be replaced with convenient max function call, like req_angles = max(round(req_angles), 1) Primary "peak" and "value" indices:
{ "domain": "codereview.stackexchange", "id": 36347, "lm_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, signal-processing", "url": null }
5. Let (f:mathbb{R}tomathbb{R}) be a differentiable function such that its derivative (f’) is a continuous function. Moreover, assume that for all (xinmathbb{R}), $$0leq vert f'(x)vertleq frac{1}{2}$$Define a sequence of real numbers ( {a_n}_{ninmathbb{N}}) by :$$a_1=1~~text{and}~~a_{n+1}=f(a_n)~text{for all}~ninmathbb{N}$$Prove that there exists a positive real number (M) such that for all (ninmathbb{N}), $$vert a_nvert leq M$$
{ "domain": "cheenta.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9852713835553861, "lm_q1q2_score": 0.8032252493375873, "lm_q2_score": 0.8152324960856175, "openwebmath_perplexity": 6673.475017891354, "openwebmath_score": 0.7781991958618164, "tags": null, "url": "https://www.cheenta.com/isi-entrance-paper-2018/" }
catkin, ros-groovy, bloom-release Originally posted by Moirai on ROS Answers with karma: 35 on 2013-02-12 Post score: 1 Original comments Comment by Moirai on 2013-02-14: This bloom error is caused by tag in my repository. I added a correct tag as below ; git tag 0.0.1 git push --tags Hi I'm not confident with this answer since it is not documented, but it seems your target repository (https://github.com/Moirai/opt_camera-release.git) needs "tag" named 0.0.1. git clone https://github.com/Moirai/opt_camera-release.git cd opt_camera-release git tag 0.0.1 git push --tags if this works, we can put this information as an enhancement at https://github.com/ros-infrastructure/bloom/issues. Also, bloom assumes you have https://github.com/Moirai/opt_camera repository that only contains source directory (src/opt_camera in your case), and bloom tool will create opt_camera-release repository for you. Best Originally posted by Kei Okada with karma: 1186 on 2013-02-13 This answer was ACCEPTED on the original site Post score: 2 Original comments Comment by Moirai on 2013-02-14: Thanks for your advice. This bloom error is caused by tag in my repository. The git-bloom-release succeeded. Thank you!
{ "domain": "robotics.stackexchange", "id": 12864, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "catkin, ros-groovy, bloom-release", "url": null }
java, beginner, excel, fizzbuzz, groovy Title: FizzBuzz-type program that reads/writes to Excel I'm new to Groovy, and coming from PHP it's been a rough transition. The code below works. However, I would appreciate feedback on how better to write it and follow good practice with Groovy. I anticipate doing a lot of Excel work in the future, and so tried to make this program reusable for more than just FizzBuzz. /* * In Excel: Create a workbook with a blank sheet, "output" * and a sheet "input" with the values * startValue : 0 * endValue : 100 * fizz : 3 * buzz : 5 * * In Groovy: Create a program that will * - Open an Excel file * - Extract the four parameters above * - Run a "FizzBuzz" on those parameters * - Write the results to the "output" sheet * * FizzBuzz: For all values in a range * If the value is divisible by 3, print "fizz" * If the value is divisible by 5, print "buzz" * If the value is divisible by 3 and 5, print "fizzbuzz" * Otherwise print the value * * The program below uses Apache POI to parse Excel. */ package org.example import java.io.FileNotFoundException import java.io.FileOutputStream import java.io.IOException import org.apache.poi.ss.usermodel.* import org.apache.poi.xssf.usermodel.* class Excel { def file; def workbook; static main(def args) throws Exception { new Excel() } Excel(){ file = new FileInputStream("input.xlsx") workbook = WorkbookFactory.create(file) def sheetIn = workbook.getSheet("input") def fizzbuzz = new Excel.FizzBuzz() def params = fizzbuzz.setFromSheet(sheetIn) def sheetOut = workbook.getSheet("output")
{ "domain": "codereview.stackexchange", "id": 15376, "lm_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, beginner, excel, fizzbuzz, groovy", "url": null }
ros, ros-control, ros-kinetic, hardware-interface, ros-canopen I assume that these messages are OK. But the problem is that i have no topics related to the controllers: /diagnostics /joint_states /rosout /rosout_agg /tf /tf_static If i do rosservice list i have now the controller manager: /rig1/controller_manager/list_controller_types /rig1/controller_manager/list_controllers /rig1/controller_manager/load_controller /rig1/controller_manager/reload_controller_libraries /rig1/controller_manager/switch_controller /rig1/controller_manager/unload_controller /rig1/driver/get_loggers /rig1/driver/get_object /rig1/driver/halt /rig1/driver/init /rig1/driver/recover /rig1/driver/set_logger_level /rig1/driver/set_object /rig1/driver/shutdown /robot_state_publisher/get_loggers /robot_state_publisher/set_logger_level /rosout/get_loggers /rosout/set_logger_level However, if i call for example: rosservice call /rig1/controller_manager/load_controller "name: 'rig1_plate_joint_position_controller'" It returns with false and message: [ERROR] [1529433712.087792833]: Exception thrown while initializing controller rig1_plate_joint_position_controller. Could not find resource 'rig1_plate_joint' in 'hardware_interface::PositionJointInterface'. [ERROR] [1529433712.087895663]: Initializing controller 'rig1_plate_joint_position_controller' failed
{ "domain": "robotics.stackexchange", "id": 31034, "lm_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, ros-control, ros-kinetic, hardware-interface, ros-canopen", "url": null }
species-identification Title: What bird / animal has this call? USA MA NE I have a bird / animal coming to the trees in the backyard making this call (see link to audio file), which does not really sound like a bird - it's fairly low frequency. I have not seen it. Sometimes it sits in a young tree, where you can almost see through to the trunk. But I cannot make it out, so it's not very big (like a turkey). It comes at late afternoon and stays around until ~11PM. It switches trees fairly quickly, so I assume it can fly. The call is always the same. Sometimes another one of its kind answers. Bird_animal_call_mp3 You don't need dropbox. Ignore "suspicious link". Close login popup. Click download arrow. Direct download. I added a Soundcloud link: Bird_animal_call_mp3 It is a grey tree frog's mating call. See youtube link: Grey tree frog mating call Source for finding the answer: Audubon Society
{ "domain": "biology.stackexchange", "id": 11434, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "species-identification", "url": null }
functional-programming, prolog, logic-programming To give more context, I'm attempting to implement type inference, however the intricate features in the type system of my language (Dependent types, refinement types, linear typing to name a few of the less common ones) make me feel that it would be useful to base my type inference off of the algorithms driving Prolog as to obtain a very general algorithm. I will note that I'm entirely self taught, so my knowledge is lacking in large areas. I'll expand on this here, but realize the OP should ask a new question. For some intro stuff see implementing type inference. The best book I know on this is Types and programming languages by Benjamin C. Pierce. The book's site is here. The resources with links to OCaml code is here. And recently started but mostly complete translation of this to F# is here. Dependent types: pg. 462 Refinement types: pg. 207 Linear logic and type systems: pg. 109
{ "domain": "cs.stackexchange", "id": 658, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "functional-programming, prolog, logic-programming", "url": null }
homework-and-exercises, newtonian-mechanics, newtonian-gravity, energy-conservation, potential-energy Title: From my reference frame, why does the Earth need a huge kinetic energy [$0.5M_E(11200)^2=3.75*10^{32}$ joules] to escape me? I wake up screaming into the void, when I see the Earth almost touching me but going away from me at 11.2 $km/s$. After waiting forever, the Earth comes to a stop at infinity. I don't remember what happened before I woke up. Did I lose all memory by being cannoned up at 11.2 $km/s$? Who knows. Separated by an infinite distance feels very sad, but at least we gained $GM_Em/R_E=3.12*10^{9}$ joules of gravitational potential energy. I cannot explain it but I have always had a thing for gravitational potential energy.
{ "domain": "physics.stackexchange", "id": 92441, "lm_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, newtonian-gravity, energy-conservation, potential-energy", "url": null }
algorithm, game, prolog def __repr__(self): return f"V('{self.op}','{self.value}')" def code(self): # OFF ON UNKNOWN return ['', self.shorthand, '?' ][self.state.value] Enum for status of a constraint class Status(Enum): FAILED = 0 PASSED = 1 UNKNOWN = 2 Class for the constraints class Constraint: def __init__(self, variables, op, value): self.variables = list(variables) self.op = op self.value = int(value) def check(self): if self.op == '#': value = 0 for v in self.variables: if v.state==State.UNASSIGNED: return Status.UNKNOWN if v.state==State.ON: value += 1 else: value = None for variable in self.variables: if variable.state == State.UNASSIGNED: return Status.UNKNOWN value = variable.evaluate(value) return Status.PASSED if value == self.value else Status.FAILED def __str__(self): variables = ','.join(repr(v) for v in self.variables) return f"Constraint([{variables}], '{self.op}', '{self.value}')" Class for the puzzle class Puzzle: def __init__(self, puzzle): self.puzzle = puzzle[:] self.constraints = [] self.by_var = defaultdict(list) self.variables = [] rows = defaultdict(list) cols = defaultdict(list) groups = defaultdict(list) last_var_row = 0 # gather the variables for r,row in enumerate(puzzle): for match in re.finditer(r"(?P<op>[+*])(?P<val>\d+)(?P<group>\w?)", row): variable = Variable(match['op'], match['val']) self.variables.append(variable) rows[r].append(variable)
{ "domain": "codereview.stackexchange", "id": 36064, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "algorithm, game, prolog", "url": null }
java, beginner, adventure-game } The class GameLogic implements the main logic of the game. public class GameLogic { static Hero player; public static boolean isRunning; // acts: see checkAct() method public static int act=1; public static void startGame() throws Exception{ player = Hero.getHero(); Util.clearConsole(); System.out.println("\t\t\t-- JavaMUD --"); if(player.getPlace()==0){ Story.printIntro(); player.setPlace(1); } // uncomment the following block to enable the player set hero's name // boolean nameSet=false; // String name; // do { // Util.clearConsole(); // Util.printHeading("Your name: "); // name = Util.scanner.next(); // Util.clearConsole(); // Util.printHeading("Your name is "+name+".\nIs that correct?"); // System.out.println("(1) Yes!"); // System.out.println("(2) No, I want to change my name!"); // int input = Util.readInt("-> ", 2); // if (input == 1){ // nameSet = true; // player.setName(name); // } // }while (!nameSet); isRunning = true; gameLoop(); }
{ "domain": "codereview.stackexchange", "id": 41301, "lm_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, beginner, adventure-game", "url": null }
javascript, tic-tac-toe function allSquaresTaken() { var allSquaresHaveBeenTaken = true; for (var i = 0; i < 9; i++) { if (gridArray[i] == 0) { allSquaresHaveBeenTaken = false; break; } } return allSquaresHaveBeenTaken; } function winCheck() { if ( gridArray[0] == gridArray[1] && gridArray[1] == gridArray[2] && gridArray[0] > 0 || gridArray[3] == gridArray[4] && gridArray[4] == gridArray[5] && gridArray[3] > 0 || gridArray[6] == gridArray[7] && gridArray[7] == gridArray[8] && gridArray[6] > 0 || gridArray[0] == gridArray[3] && gridArray[3] == gridArray[6] && gridArray[0] > 0 || gridArray[1] == gridArray[4] && gridArray[4] == gridArray[7] && gridArray[1] > 0 || gridArray[2] == gridArray[5] && gridArray[5] == gridArray[8] && gridArray[2] > 0 || gridArray[0] == gridArray[4] && gridArray[4] == gridArray[8] && gridArray[0] > 0 || gridArray[2] == gridArray[4] && gridArray[4] == gridArray[6] && gridArray[2] > 0 ) { return true; } else { return false; } } function clearGrid() { for (var i = 0; i < 9; i++) { gridArray[i] = 0; } updateGridDisplay(); }
{ "domain": "codereview.stackexchange", "id": 13485, "lm_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, tic-tac-toe", "url": null }
sql, sql-server, xml </TablixColumn> <TablixColumn> <Width>1in</Width> </TablixColumn> <TablixColumn> <Width>1in</Width> </TablixColumn> <TablixColumn> <Width>1in</Width> </TablixColumn> <TablixColumn> <Width>1in</Width> </TablixColumn> </TablixColumns> <TablixRows> <TablixRow> <Height>0.25in</Height> <TablixCells> <TablixCell> <CellContents> <Textbox Name="Textbox3"> <CanGrow>true</CanGrow> <KeepTogether>true</KeepTogether> <Paragraphs> <Paragraph> <TextRuns> <TextRun> <Value>Dealer ID</Value> <Style> <FontSize>11pt</FontSize> <FontWeight>Bold</FontWeight> <Color>White</Color> </Style> </TextRun> </TextRuns> <Style /> </Paragraph> </Paragraphs> <rd:DefaultName>Textbox3</rd:DefaultName> <Style> <Border> <Color>#4e648a</Color> <Style>Solid</Style> </Border> <BackgroundColor>#384c70</BackgroundColor> <PaddingLeft>2pt</PaddingLeft> <PaddingRight>2pt</PaddingRight> <PaddingTop>2pt</PaddingTop> <PaddingBottom>2pt</PaddingBottom> </Style> </Textbox> </CellContents> </TablixCell> <TablixCell> <CellContents> <Textbox Name="Textbox4"> <CanGrow>true</CanGrow> <KeepTogether>true</KeepTogether> <Paragraphs> <Paragraph> <TextRuns> <TextRun>
{ "domain": "codereview.stackexchange", "id": 8078, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "sql, sql-server, xml", "url": null }
php, html, classes, form, php7 Title: PHP HTML form Class - so far so good? I am writing this class to render HTML forms. It is working as expected, so far. There are many things to be done yet (including testing). Is it ok to keep this way? /** * * This class renders (or aims to render) a valid HTML form * * Note: this documentation still needs to be completed. For now I think it does its job. * * Condensed usage: * * $form = new Form(["name"=>"myform", "method"=>"post", "action" =>"action.php", "id"=>"html_id"]); * $form->add_field(["fieldset"]); * $form->add_field(["label", ["value"=>"My Label", "for"=>"txtareaname"]]); * $form->add_field(["textarea", ["id"=>"txtareaid", "name"=>"txtareaname", "cols"=>80, "rows"=>10, "value"=>"Texto del textarea"]]); * $form->add_field(["fieldset"]); * $form->add_field(["select",["name"=>"myselect"], ["value1"=>"text1", "value2"=>"text2"]]); * $form->add_field(["text", ["name"=>"mytext", "value"=>"", "required"=>""]]); * $form->add_field(["fieldset"]); * $form->add_field(["label", ["for"=>"mycheck", "value"=>"My check?"]]);
{ "domain": "codereview.stackexchange", "id": 44614, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "php, html, classes, form, php7", "url": null }
# How can I find these coefficients? #### kpkkpk ##### New member x = 1x x(x-1) = 1x^2 - 1x x(x-1)(x-2) = 1x^3 - 3x^2 + 2x x(x-1)(x-2)(x-3) = 1x^4 - 6x^3 + 11x^2 - 6x x(x-1)(x-2)(x-3)(x-4) = 1x^5 - 10x^4 + 35x^3 - 50x^2 + 24x ... So, I am looking for a short method how to find these coefficients ahead of each raisings of x: 1 1,-1 1,-3,2 1,-6,11,-6 1,-10,35,-50,24 ... Is the only method just to perform repetative multiplications, or is there a time and energy saving method available? I do can find some predictable features: -The leftmost coefficient is always "1" -The next coefficient comes from triangular numbers (1,3,6,10,15,21,28...that is an integer when we sum up successive positive integers; for example: 1+2+3+4+5=15) with negative sign. - The last term is a factorial with alternate + and - sign (for example: 3 factorial = 3! = 1*2*3 = 6, 4! = 1*2*3*4 =24 etc.) - Positive and negative coefficients in a row, when summoned up, equals to 0 (for example in the last row example: 1-10+35-50+24 = 0) #### mente oscura
{ "domain": "mathhelpboards.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.969785412932606, "lm_q1q2_score": 0.8060304099576581, "lm_q2_score": 0.831143054132195, "openwebmath_perplexity": 1065.7013791774655, "openwebmath_score": 0.5077163577079773, "tags": null, "url": "https://mathhelpboards.com/threads/how-can-i-find-these-coefficients.8056/" }
reductions, np-hard Title: Karp reduction from NP-hard problem to unknown problem If I know that problem $A$ is NP-hard, but know nothing of problem $B$ and I know that the following Karp reduction is true: $$A \to B \, .$$ Is it correct to conclude that $B$ must also be NP-hard? Short answer, yes. I won't provide an actual proof (you probably saw one in class), but rather, a sort of mnemonic that helps if this comes up on an exam. A Karp reduction is also known as a polynomial-time reduction. If you can reduce from $A$ to $B$, that means if I give you a subroutine that solves $B$, you can build an algorithm to solve $A$, which does at most polynomial-time work and then calls the $B$ subroutine to get the answer. The question is now, if you can reduce from $A$ to $B$, and $A$ is $NP$-hard, then is $B$ $NP$-hard? Assume it isn't. In other words, assume $B$ can be solved in polynomial time. Then that means $A$ can be solved in polynomial time: run the polynomial-time reduction, call $B$ which takes polynomial time, and you have a solution to $A$ in polynomial time. We've proven $P = NP$ and earned a million dollars! Since we haven't proven anything of the sort, our assumption must be false. In other words, $B$ must be NP-hard. (Now, this would be a formal proof if $P \neq NP$ were a known result. But it isn't. So while this is good enough to remember on an exam, and the fact that $B$ must be $NP$-hard is in fact true, I haven't actually given a full proof of that fact.)
{ "domain": "cs.stackexchange", "id": 12799, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "reductions, np-hard", "url": null }
cv-bridge or: sensor_msgs::ImagePtr img2_ = cv_ptr->toImageMsg(); //assign pointer to pointer Originally posted by Wolf with karma: 7555 on 2014-09-29 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by fromandto on 2014-11-24: Your suggestion helps alot , thx!
{ "domain": "robotics.stackexchange", "id": 19546, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "cv-bridge", "url": null }
gazebo 26 0 929000000 0.0957307 -23.7403 -0.00834947 -1.08775 -0.00442752 0.152139 25 27 0 930000000 0.136165 -24.29 -0.0100404 -1.11305 -0.00625644 0.157299 26 28 0 931000000 0.136582 -24.8656 -0.00985578 -1.13971 -0.00627645 0.163193 27 29 0 932000000 0.135285 -25.3228 -0.00967874 -1.16096 -0.00621653 0.173514 28 30 0 933000000 0.137828 -25.7879 -0.00953143 -1.18253 -0.0060897 0.173231 29 31 0 934000000 0.13691 -26.2361 -0.00956323 -1.20337 -0.00596015 0.177681 30 32 0 935000000 0.135551 -26.6805 -0.00967777 -1.22406 -0.00590302 0.180783 31 33 0 936000000 0.134221 -27.1333 -0.0097645 -1.24513 -0.00584696 0.185742 32 34 0 937000000 0.136066 -27.581 -0.00989185 -1.26595 -0.00586706 0.185193 33 35 0 938000000 0.134696 -27.9471 -0.00812905 -1.28292 -0.00580213 0.189592 34 36 0 940000000 0.133071 -28.8714 -0.0101342 -1.32424 -0.00574901 0.191895 35
{ "domain": "robotics.stackexchange", "id": 3172, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "gazebo", "url": null }
\eqalignno{ \left [\array{ 1&1&1&1&3\cr 3&2 &1 &2 &4 \cr 2&1&0&2&1\cr 1&1 &1 &1 &3 } \right ] &\mathop{\longrightarrow}\limits_{}^{\text{RREF}}\left [\array{ \text{1}&0&−1&0&−2\cr 0&\text{1 } & 2 &0 & 5 \cr 0&0& 0 &\text{1}& 0\cr 0&0 & 0 &0 & 0 } \right ] & & } Thus, the independent vectors that span S are the first, second and fourth of the set, so a basis of S is \eqalignno{ B & = \left \{\left [\array{ 1\cr 3 \cr 2\cr 1 } \right ],\left [\array{ 1\cr 2 \cr 1\cr 1 } \right ],\left [\array{ 1\cr 2 \cr 2\cr 1 } \right ]\right \} & & } C11 Contributed by Chris Black Statement [1028] We can rewrite an arbitrary vector of W as
{ "domain": "ups.edu", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9927672376944796, "lm_q1q2_score": 0.8069880462422914, "lm_q2_score": 0.8128673223709251, "openwebmath_perplexity": 2550.773089888867, "openwebmath_score": 0.9906160235404968, "tags": null, "url": "http://linear.ups.edu/jsmath/0212/fcla-jsmath-2.12li40.html" }
Thanks in advance ! 2. ## Re: Simple Probability Question Originally Posted by SheekhKebab I am a bit confused by the way this question is solved:- From a of well shuffled pack 52 cards, three cards are drawn at random. Find the probability of drawing an ace, a king and a jack. Here's how I would do that: there are 52 cards, 4 aces, four kings, and a jack. The probability the first card drawn is an ace is 4/52= 1/13. There are then 51 cards left, flur of which are kings. The probability that the second card you draw is a king is 4/51. There are then 50 cards left, 4 of which are jacks. The probability the third card you draw is a jack is 4/50= 2/25. The probability of drawing "ace, king, jack" in that order is (1/13)(4/51)(2/25)= 8/(13*51*25). But if you look at "jack, ace, king" or any other specific order you will see that while you have different fractions, you have the same numerators and the same denominators in different orders so the same probability. There are 3!= 6 such orders so there the probability of drawing an ace, king, and jack is 6(8/(13*51*25)). Solution given:- There are 4 aces, 4 king and 4 jacks and their selection can be made in the following ways: 12C1 X 8C1 X 4C1 = 12 X 8 X 4. Total selections can be made = 52C3= 52 X 51 X 50. Therefore required probability = $\frac{(12)(8)(4)}{ (52)(51)(50)}$ I don't understand why are we taking 12C1 X 8C1 X 4C1 = 12 X 8 X 4 instead of 4C1 X 4C1 X 4C1 = 4 x 4 X 4 for the numerator. Since, we are selecting 1 ace from 4 aces, 1 king from 4 kings and 1 jack from 4 jacks shouldn't we be taking 4C1 X 4C1 X 4C1 = 4 x 4 X 4 for the favourable events ? Please advice on the above.
{ "domain": "mathhelpforum.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9863631659211718, "lm_q1q2_score": 0.8460708582847031, "lm_q2_score": 0.8577680995361899, "openwebmath_perplexity": 322.85663733316176, "openwebmath_score": 0.7575483918190002, "tags": null, "url": "http://mathhelpforum.com/statistics/232876-simple-probability-question.html" }
ros, eigen3, movegroup i have gcc 4.8 installed and have been to the mentioned website, but not being too confident about what to do, i would like to know if there is a simple fix for this, and if no simple fix is available then what course of action i should take? Originally posted by jay75 on ROS Answers with karma: 259 on 2014-09-11 Post score: 0 This is an instance of a Eigen alignment issue that can occur on systems where data is not properly aligned in memory, which means vectorization won´t work. Read the link stated in the error message for some further info. You´ll find quite a few other questions regarding this here on ROS Answers , too. This issue can generally be fixed by modifying source code, but depending on the issue at hand this might not be trivial. Luckily, this error only appears on 32bit (x86) systems, so a relatively easy solution to get rid of it is switching to a 64bit Ubuntu version (not sure about architectures like ARM and others). Originally posted by Stefan Kohlbrecher with karma: 24361 on 2014-09-12 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by jay75 on 2014-09-12: would switching to gcc-4.6 and then compiling solve things? Comment by Stefan Kohlbrecher on 2014-09-12: Pretty sure it would not. I´d recommend installing a 64bit system if at all possible, as this takes a relatively short time and is sure to fix the problem.
{ "domain": "robotics.stackexchange", "id": 19372, "lm_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, eigen3, movegroup", "url": null }
beginner, bash, linux, git, ssh Title: Syncing GitHub repositories local, remote and forks It's a simple bash script but I'm hoping for feedback, advice and examples on how to improve the script and code. Can you guide me how to put more checks in the code and more if possible? This code: Sets IFS variable and backs it up Sets a trap for signals that can kill the script and a trap for exit to do run a cleanup function. Then it pushes changes from the local TO the remote repository Then it syncs the local copy FROM the repository/fork Then there is code to update the Fork from the original but that will be used later on other repositories. Then it gives control back to these signals SIGINT SIGQUIT SIGTERM Then it's set to send a email with the result/status of what's been run after theexit #!/usr/bin/env bash IFS_OLD=$IFS IFS=$'\n\t'
{ "domain": "codereview.stackexchange", "id": 34817, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "beginner, bash, linux, git, ssh", "url": null }
cc.complexity-theory, algebraic-complexity, arithmetic-circuits, computing-over-reals Title: Uniformity vs. nonuniformity in algebraic complexity theory I understand that the study of Boolean circuits and nonuniform complexity classes was introduced to (hopefully) prove separation of uniform complexity classes. In this sense, nonuniform computational models can be thought of as a secondary device in complexity theory, the main interest being the uniform model. However, in algebraic complexity, the situation seems to have been the other way around. Algebraic nonuniform models including algebraic circuits were studied long before the uniform Blum-Shub-Smale machines were introduced. I am confused about this; since nonuniformity preceded uniformity in the algebraic setting, something about nonuniformity should have been unsatisfactory. But what was wrong with straight-line programs? I'd be grateful if you could tell me why uniformity in algebraic complexity theory can be preferable. EDIT: I realized that uniformity helps if you are discussing computability of algebraic problems. Blum, Shub and Smale created their model based on known algebraic models of computations, to unify (as much as possible) complexity theory and numerical analysis (cf. [1]). They wanted to give solid theoretical foundations to numerical analysis, and they wanted uniformity since the algorithms used in real life are uniform. Also, their model is a generalization of the Turing Machine, and having uniformity implies that $\mathsf {(N)P}_{\mathbb Z_2}$ in their model equals precisely $\mathsf{(N)P}$ in the classical model. Uniformity is much less central for lower-bound questions, or as Bürgisser states it [2]: Before, uniformity was not studied systematically in algebraic complexity, mainly because it is unknown how to exploit the uniformity condition for lower bound proofs.
{ "domain": "cstheory.stackexchange", "id": 2445, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "cc.complexity-theory, algebraic-complexity, arithmetic-circuits, computing-over-reals", "url": null }
bucket to the 5 gallon mark. SYLLABUS MATH 21001 – Linear Algebra with Applications (3 Credit Hours) Catalog Information: Systems of linear equations and the associated matrix operations, linear transformations, vector spaces, bases, eigenvectors. - GitHub - bimalka98/Applications-of-Linear-Algebra: Linear Algebra has tons of Real-world Applications …. Linear Algebra and Its Applications mariosuazo PDF Drive. Such systems exist in many fields. Ever wondered how cryptography works? 3. Matrices are incredibly useful things that occur in various . In Appendix D we consider the notion of the pseudoinverse, or generalized inverse matrix, widely used in different economic applications. This seller has earned a 5 of 5 Stars rating from Biblio customers. Elementary Linear Algebra: Applications Version, 12th Edition gives an elementary treatment of linear algebra that is suitable for a first course for undergraduate students. Reviewed a matrix as a generator of determinants (Tucker, 1993). Linear algebra is about linear …. The BLAS (Basic Linear Algebra Subprograms) are routines that provide standard building blocks for performing basic vector and matrix …. Linear Algebra and Its Applications (5th Edition) by David C. Brand New, International Student Edition Book. Activity Cab Company Task #1) Create a name for your cab company. For example, the first row of the matrix R= PQ= 50 …. Linear Algebra And Its Applications, Books A La Carte Edition Plus New Mymathlab With Pearson Etext -- Access Card Package (4th Edition) 4th Edition. Download Free Linear Algebra And Its Applications David C Lay Solutions Linear Algebra And Its Applications David C Lay Solutions Linear Algebra and it's Applications …. Linear Algebra and Its Applications, 5th Edition, by David C. A Markov chain governed by such a matrix is called a regular chain (Fraleigh 107). The amount of antifreeze in the end result is 25% of 48 liters, or 0. Project 3: Write your own game inspired by Linear. Linear Algebra And Its Applications…. Application of Matrix in Electrical Engineering January 12, 2015. We still want combinations of the columns (in the column space). And since you’re interested in the applications of mathematics to business, you probably used linear functions like the one …. Project 1: Write a version of the game Sweep the board where the input is a random matrix and the player has to row reduce
{ "domain": "gemsnroll.de", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9643214470715362, "lm_q1q2_score": 0.8097734748608164, "lm_q2_score": 0.8397339676722393, "openwebmath_perplexity": 850.2804467515359, "openwebmath_score": 0.4044502377510071, "tags": null, "url": "https://gemsnroll.de/application-of-linear-algebra-in-agriculture.html" }
molecular-biology, cell-biology, cancer Title: Does anyone know a good pancreatic-cancer metastasis cell line? Researching about pancreatic cancer. We have mostly "main-tumor" cell lines in our lab, and I´m currently looking for cell lines originating from metastases (liver, lung, etc.). Does anyone know a well-established pancreatic-cancer-metastasis-cell line? SUIT-2 cell lines are derived from the liver metastases of Pancreatic Ductal Adenocarcinoma. The subline S2-007 is highly metastatic. The other sublines are S2-013, S2-020 and S2-028 which have decreasing metastatic capabilities. You can probably refer these articles for more info : 1. https://www.ncbi.nlm.nih.gov/pubmed/3102439 2. https://link.springer.com/article/10.1007/s10585-017-9840-3
{ "domain": "biology.stackexchange", "id": 9904, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "molecular-biology, cell-biology, cancer", "url": null }
ros-melodic did you perhaps forget to source /opt/ros/melodic/setup.bash (or the equivalent for your workspace) before trying to use roslaunch? If you don't source your ROS installation (or workspace), your shell will not be able to find roslaunch, which on Ubuntu causes it to suggest installing the python-roslaunch package. Originally posted by gvdhoorn with karma: 86574 on 2021-11-10 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by gvdhoorn on 2021-11-10: Some related Q&As: #q353082, #q359586, #q390335 and #q356158. Comment by Alex2008 on 2021-11-10: Thank you for your clear answer. I wasn't aware of using upstream packages with packages from a ROS release. Comment by gvdhoorn on 2021-11-10: So the solution would be to not do that. Have you been able to solve your initial problem? Comment by Alex2008 on 2021-11-10: Yes I have been able to solve the problem. Only by using source/opt/ros/melodic/setup.bash the error was fixed. Thanks a lot!
{ "domain": "robotics.stackexchange", "id": 37109, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros-melodic", "url": null }
$$\begin{pmatrix}a_{11}&&a_{12}\\a_{21}&&a_{22}\end{pmatrix}+x\begin{pmatrix}b_{11}&&b_{12}\\b_{21}&&b_{22}\end{pmatrix}=\begin{pmatrix}a_{11}+xb_{11} &&a_{12}+xb_{12}\\a_{21}+xb_{21}&&a_{22}+xb_{22}\end{pmatrix}=C$$ $$\det(C)= a_{11}a_{22}+a_{11}xb_{22}+a_{22}xb_{11}+x^2b_{11}b_{22}- a_{21}a_{12}-a_{21}xb_{12}-a_{12}xb_{21}-x^2b_{21}b_{12}$$ $$=\det(A)+x\left[\det\begin{pmatrix}a_{11}&&a_{12}\\b_{21}&&b_{22}\end{pmatrix}+\det\begin{pmatrix}b_{11}&&b_{12}\\a_{21}&&a_{22}\end{pmatrix}\right]+x^2\det(B)$$ Another approach. All matrices are complex valued. This argument can be extended to $n\times n$ matrices: see the end of the post. (EDIT sorry, I have found another error, the general case is incomplete).
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.979354068055595, "lm_q1q2_score": 0.8419151859400459, "lm_q2_score": 0.8596637451167997, "openwebmath_perplexity": 182.2406255371409, "openwebmath_score": 0.9301890134811401, "tags": null, "url": "https://math.stackexchange.com/questions/2189714/polynomial-form-of-detaxb/2189721" }
catkin-make Title: catkin_make fails: Invoking "make cmake_check_build_system" failed Hello, I just installed ROS and I'm following the beginner tutorial to get familiar with ROS. I've done until step 4 in "Creating a ROS msg and srv", I don't have any problem in the previous steps but when I try "catkin_make" it fails and I can't find the problem. Thank you for your help. Cheers, Carlos This is the message returned in the terminal: carlos@carlos-VirtualBox:~/catkin_ws$ catkin_make Base path: /home/carlos/catkin_ws Source space: /home/carlos/catkin_ws/src Build space: /home/carlos/catkin_ws/build Devel space: /home/carlos/catkin_ws/devel Install space: /home/carlos/catkin_ws/install #### #### Running command: "make cmake_check_build_system" in "/home/carlos/catkin_ws/build" #### -- Using CATKIN_DEVEL_PREFIX: /home/carlos/catkin_ws/devel -- Using CMAKE_PREFIX_PATH: /home/carlos/catkin_ws/devel;/opt/ros/indigo -- This workspace overlays: /home/carlos/catkin_ws/devel;/opt/ros/indigo -- Using PYTHON_EXECUTABLE: /usr/bin/python -- Using Debian Python package layout -- Using empy: /usr/bin/empy -- Using CATKIN_ENABLE_TESTING: ON -- Call enable_testing() -- Using CATKIN_TEST_RESULTS_DIR: /home/carlos/catkin_ws/build/test_results -- Found gtest sources under '/usr/src/gtest': gtests will be built -- Using Python nosetests: /usr/bin/nosetests-2.7 -- catkin 0.6.11 -- BUILD_SHARED_LIBS is on
{ "domain": "robotics.stackexchange", "id": 21620, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "catkin-make", "url": null }
To which Doctor Fenton replied, You’re welcome!  Glad we could help. Here is the complementary event, in which the largest of the two numbers is less than 3: Without listing, that could be counted by seeing it as “both numbers are less than 3″, so that there are 2 choices for the first and 2 for the second, making a total of $$2\times 2=4$$. So the probability of the complement is $$\frac{4}{36}=\frac{1}{9}$$. The probability of the event itself is $$1-\frac{1}{9}=\frac{8}{9}$$. Or, without simplifying first, seeing it as Drey did, the event consists of $$36-4=32$$ outcomes: This could have been counted directly as “first die is at least 3, or second die is at least 3″; but every way to do that with formulas is considerably longer. One way is to use the formula $$P(A\text{ or }B)=P(A)+P(B)-P(A\text{ and }B)$$ applied to$$P((\text{first }\ge 3)\text{ or }(\text{second }\ge 3))=\frac{4}{6}+\frac{4}{6}-\frac{4}{6}\cdot\frac{4}{6}\\ =\frac{24}{36}+\frac{24}{36}-\frac{16}{36}=\frac{32}{36}=\frac{8}{9}$$ This formula amounts to adding the red- and green-bordered regions, then subtracting their overlap:
{ "domain": "themathdoctors.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9891815491146485, "lm_q1q2_score": 0.8465921560947521, "lm_q2_score": 0.8558511396138365, "openwebmath_perplexity": 333.2925444631537, "openwebmath_score": 0.7281996607780457, "tags": null, "url": "https://www.themathdoctors.org/interpreting-probability-questions/" }
python def main(): import Gridder2 Usually not a good idea to import anywhere but at the start of a file grid = Gridder2.board() start = (0,0) goal = (0,3) pt = PathFinder(start, goal, grid) pt? print(pt.find_path(start, goal)) Decide whether the start/goal get passed to the constructor or the find method. Don't do both. return 0 if __name__ == '__main__': main() If you are going to return a value from your main function, you should pass it to sys.exit() so that it actually functions as a return code. And everything Thomas said.
{ "domain": "codereview.stackexchange", "id": 738, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python", "url": null }
quantum-algorithms, mathematics, complexity-theory, hamiltonian-simulation Title: Simulating Sparse Hamiltonians: help understanding query complexity bounds tl;dr: How can I show that $e^k/k^k$ is less than $\epsilon^2/2$ when $k=\Omega\left(\frac{\log(1/\epsilon)}{\log \log(1/\epsilon)}\right)$, where $k,\epsilon\in \mathbb{R}$ and > 0? Context: Berry et al. show a $d$-sparse Hamiltonian can be approximately simulated for time $t$ with precision $\epsilon$ using $O\left(\frac{\log(\tau/\epsilon)}{\log \log(\tau/\epsilon )}\right)$ queries to an oracle, where $\tau=d^2\|H\|_{\max}t$ (1). The authors prove a related query complexity in Appendix 2, Lemma 3.5 which hinges on the argument $e^k/k^k$ is less than $\epsilon^2/2$ when $k=\Omega\left(\frac{\log(1/\epsilon)}{\log \log(1/\epsilon)}\right)$, where $k,\epsilon\in \mathbb{R}$ and > 0. I am not sure how to show this is the case and would greatly appreciate any insight! arXiv:1312.1414 [quant-ph] Here's the argument essentially given in Robin Kothari's thesis (p. 29 in particular). From Stirling's approximation, we have $e^k/k^k \sim 1/k!$, or equivalently, $\log(k!) \sim k\log k - k$. Set $k = c\left(\frac{\log(1/\epsilon)}{\log\log(1/\epsilon)}\right)$ for some constant $c$. Then \begin{align*}
{ "domain": "quantumcomputing.stackexchange", "id": 5085, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-algorithms, mathematics, complexity-theory, hamiltonian-simulation", "url": null }
gazebo-world Title: Costume world fail to load in Hector_quadrotor_gazeboo hi there. I am trying to load a costume world for Hector_quadrotor_gazebo , lets say 3.world which is basically roslaunch hector_quadrotor_gazebo quadrotor_empty_world.launch then added some buildings and objects and saved the new world as 3.world. how can launch this world later on ? i had followed the tutorial in 'http://learn.turtlebot.com/2015/02/03/6/' which worked fine for turtlebot but didnt work for hector_quadrotor. iam new to ROS and Gazebo so excuse my question. Originally posted by Caesar84 on Gazebo Answers with karma: 3 on 2018-04-02 Post score: 0 So if you look at the contents of the quadrotor_empty_world.launch take note of the following section: <include file="$(find gazebo_ros)/launch/empty_world.launch"> <arg name="paused" value="$(arg paused)"/> <arg name="use_sim_time" value="$(arg use_sim_time)"/> <arg name="gui" value="$(arg gui)"/> <arg name="headless" value="$(arg headless)"/> <arg name="debug" value="$(arg debug)"/> </include> This .launch file passes arguments to gazebo_ros's empty_world.launch file. If you look at the empty_world.launch file, you'll see the following line: <arg name="world_name" default="worlds/empty.world"/> <!-- Note: the world_name is with respect to GAZEBO_RESOURCE_PATH environmental variable -->
{ "domain": "robotics.stackexchange", "id": 4248, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "gazebo-world", "url": null }
cosmology, universe, space-expansion, dark-energy Title: How do scientists calculate the percentage of dark energy in the universe? I can understand how the percentage of dark matter compared to ordinary matter is calculated, because the amount of dark matter has a clear gravitational effect on the ordinary matter in a Galaxy. However, calculating the percentage of dark energy in the universe seems less obvious. Is it something to do with the rate of expansion of space-time? Please explain in lay-mans terms, I've never learnt any undergraduate level cosmology. There are (at least) four ways in which the dark energy content of the universe influences things we can observe The cosmic microwave background is formed in the early universe when atoms (of hydrogen) first formed and the universe became transparent to the radiation that was within it. There are small fluctuations in the CMB which reflect small differences in the density of regions within the universe at the time of this "decoupling" of radiation and matter. How big (in terms of an angle on the sky) these regions now look depends on the subsequent rate of expansion of space and this in turn depends on both the amount of gravitating matter (which slows the initial expansion) and the amount of dark energy (which accelerates the expansion). Hence, in broad terms, the angular size of fluctuations (about 1 degree) in the CMB allows one to infer the amount of dark energy, though it is mixed up in what the other cosmological parameters are (including the total amount of gravitating matter density). The expansion of the universe can also be tracked using standard candles. That is we can measure the brightness of something, infer how far away it must be and then measure how fast it is receding away from us. In a decelerating universe, containing only gravitating matter, then the expansion rate would have been much larger in the past and would be witnessed in the recession velocities of more distant objects that are seen as they were in the distant past. Observations of type Ia supernovae - standard candles arising from the explosions of white dwarfs at nearly a fixed mass and with an extremely consistent peak luminosity - confound this expectation. Instead it appears that the expansion of the universe is accelerating and this is attributed to dark energy. Again, this interpretation is not wholly independent of the other cosmological parameters.
{ "domain": "physics.stackexchange", "id": 18895, "lm_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, universe, space-expansion, dark-energy", "url": null }
passes through all three vertices of the triangle. AND CANADA, to comply with Federal Motor Vehicle Safety Standards (FMVSS 105) and Canada Motor Vehicle Safety […]. The farther forward the center of gravity moves, the smaller the load weight must be and the more likely the truck is to tip forward. 3 Isotomic conjugates 31 3. (a) concurrence of the medians (b) intersection of its altitudes (c) intersection of bisector of angles (d) intersection of diagonals (e) all of the. The Earth's rotation and the resultant centrifugal force (heading outward) counteracts the effect of gravity (downward). In most mechanic’s problems the gravitational field is assumed to be uniform. Since center of gravity lies on a height of h/3 from base of the triangle. See medians of a triangle for more information. Re: Center of Gravity Calculations and static tipping angles. The cardboard swings back and forth as a a pendulum until the center of mass comes to rest directly below the point of support. The center of gravity of an irregular shape can be measured, for example by hanging the object from two different points (points of the object), then watching where the lines (from the point where. The center of gravity is on the 1/3 of the triangle base length. Defuzzification is interpreting the membership degrees of the fuzzy sets into a specific decision or real value. September 2006 "Mechanics is the paradise of the mathematical sciences because by means of it one comes to the fruits of mathematics. It is also called the geometrical centre or the centre of gravity. The center of gravity location must be referenced to a 3 dimensional coordinate system. You need to be especially careful when you are doing problems involving gravity pulling something down a slope. Gravity decreases with the square of the distance. Rear-Engine Debate: Porsche Cayman R vs. Location of centre of gravity of a hemisphere: Find out the location of centre of gravity of a hemisphere of radius a. A small stability triangle leaves less room for the center of gravity to wander left or right if the frame is not perfectly level. If an object does not have a uniform weight distribution then the center of gravity will be closer to where most of the weight is located. The "CG" in the name of the oscillator refers to "Center Of Gravity" of the prices over the window of observation. Recall that the
{ "domain": "rafbis.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9805806506825456, "lm_q1q2_score": 0.8254779448344705, "lm_q2_score": 0.8418256512199033, "openwebmath_perplexity": 304.50342906770857, "openwebmath_score": 0.5220875144004822, "tags": null, "url": "http://rafbis.it/azhy/center-of-gravity-formula-for-triangle.html" }
c#, .net, mysql, database, wpf Your models have a depth of 2, max 3 classes in inheritance. Given the fact you have implemented your own base classes to provide custom ORM (as explained by the OP), I find this complexity within reasonal bounds. Is this a SOLID OOP design? It's an attempt at SOLID and OOP design, but with several offenses against these principles. Single responsibility principle data table models have properties that represent list box values; these properties should be on view models data record models serve both as business entities and records with database mapping aware properties; these objects should become business entities (preferrably POCO) with the database aware mapping extracted and stored inside the data table models views should offset the logic to view-models, who in term use business entities and data layer objects in the backend Open/closed principle the models are not closed for changes; you provide public accessors to the internal state; instead you should take more care of encapsulation and provide methods to request the models to change data Dependency inversion principle your application depends your models, there is no easy way to replace any of your layers by another; to allow dependency inversion, you should let layers communicate to each other through interfaces, and use Dependency Injection to configure the layers at runtime. Test-driven design it's hard to test the seperate layers, since you don't use interfaces between layers, making it virtually impossible to mock out dependencies you have included message box prompts inside model logic, which is a pain to test with a unit tests Review You should read the C# Naming Conventions. Many of your method and variable names are offenses against conventions. Don't use Green and Red for button colors. They make the app look like a color book. It's better to use a set of icons that are universal. Don't use center alignment for a list of buttons, instead wrap vertically with the same width. CategoryTableModel Using magic string literals is a design smell. If you must work with such strings, declare them in a dedicated class DataSchemaConstants. public CategoryTableModel() : base("bookcategories", "getAllBookCategoriesWithKeys", "addCategory") { } Use the arrow notation when you can. public string CategoryTitle(uint Key) => KeyToName(Key);
{ "domain": "codereview.stackexchange", "id": 35353, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, .net, mysql, database, wpf", "url": null }
c++, c++11, linked-list, stack Easier to declare the operator<< as a friend then you don't need to worry about the template declaration. template<class U> std::ostream & operator <<(std::ostream& os, const Stack<U>& s){ s.display(os); return os; } Put it inside the class and mark as friend: friend std::ostream& operator<<(std::ostream& os, Stack const& s) { s.display(os); return os; }; Revised Version #include <iostream> template<class T> class Stack{ struct Node{ T data; Node *next; // This is the standard constructor // Where you copy the `val` into the node. Node(Node* next, T const& val) : data(val) , next(next) {} // This is the move constructor // It moves the content of `val` into the node. For // types like vectors this is much more efficient as it // simply means copying three (or so) pointers and thus // transferring the internal containers without the cost // of copying all the elements in the vector. Node(Node* next, T&& val) : data(std::move(val)) , next(next) {} // This is an emplace constructor. // Rather than passing a `T` into the node you pass all the // parameters need to construct a `T` then create the T // in place as the node object is constructed. template<typename... Args> Node(Node* nect, Args&&... args) : data(std::forward<Args>(args)...) , next(next) {} }; Node* head;
{ "domain": "codereview.stackexchange", "id": 26766, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, c++11, linked-list, stack", "url": null }
gravity, speed-of-light, heisenberg-uncertainty-principle, photons Title: Will photon's energy be exactly same after million years? If photon will travel for million years without collisions, what subtle effects can be accumulated ? Gravity fields affect trajectory, but is energy completely intact after fly by ? Photon has its own equivalent mass of energy, does it affect itself over long long period of time and integrate into frequency shift ? Is uncertainty principles applicable for speed of free flying photon ? What if uncertainty of time/location of photon violates speed of light (exceeding it with very small amount of violation) or this violation only occures in lag just a little bit below hard speed limit ? What if there is photon-to-photon interaction when they travel in packs or cross each other individually with some tiny losses scattered ? As photons and mass affect each other, can it be that photons in packs are affecting each other as well ? Can it cause some lens, scatter, frequency change effects ? If some of this effects exist, can it be accumulated over enourmous age and be percepted falsely as doppler red-shift of very distant objects ? Well, if the mode is speed-questioning, I'll attempt speed-answering: If photon will travel for million years without collisions, what subtle effects can be accumulated? The wave packet keeps expanding (or your uncertainty about location, take your pick), and the frequency drops due to space expansion. Nothing else that anyone knows about. Gravity fields affect trajectory, but is energy completely intact after fly by? Depends. Just as with NASA probe launches, a moving gravitational body can increase, leave unchanged, or decrease photon energy depending on how the trajectory is done. That is, you can slingshot photons just like spaceships, only less effectively, and of course they stay at c (only energy/frequency/momentum changes). Photon has its own equivalent mass of energy, does it affect itself over long long period of time and integrates into frequency shift? No. Mass/energy is simply conserved, whether for photons or fermions. Is the uncertainty principle applicable for speed of free flying photon? Yes! But only at very, very small ranges. You have to accommodate superluminal photons in QED to get correct answers, in fact. For the situation you just described, the opposite applies: Long times mean very, very certain velocities.
{ "domain": "physics.stackexchange", "id": 3599, "lm_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, speed-of-light, heisenberg-uncertainty-principle, photons", "url": null }
# Can any Polynomial be factored into the product of Linear expressions? Specifically I am wondering if... Given a Polynomial of n degree in one variable with coefficients from the Reals. Will every Polynomial of this form be able to be factored into a product of n linear (first degree) Polynomials, with the coefficients of these factors not being constrained to $\mathbb{R}$ but to $\mathbb{C}$ instead. By a product of linear polynomials I mean something of the form: $$(Ax+a)(Bx+b)(Cx+c)...$$ I am also interested in the general behaviour of polynomials if we also play around with the parameters of my question. Such as factoring polynomials with complex coefficients, or coefficients from any set for that matter. As well Polynomials in any (Positive Integer?) number of variables. -
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9902915243781044, "lm_q1q2_score": 0.8164576642700392, "lm_q2_score": 0.824461932846258, "openwebmath_perplexity": 86.88533252473307, "openwebmath_score": 0.890515148639679, "tags": null, "url": "http://math.stackexchange.com/questions/170071/can-any-polynomial-be-factored-into-the-product-of-linear-expressions" }
java, ai, machine-learning public void start() { try(BufferedReader r = new BufferedReader(new InputStreamReader(System.in))) { System.out.print("You: "); String s = r.readLine(); if(respond(s)) start(); } catch(Throwable t) { printError(t); } }
{ "domain": "codereview.stackexchange", "id": 24503, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, ai, machine-learning", "url": null }
If $\;\lnot T(c)\;$, then $(2)$ simplifies to \begin{align} & T(c) \;\equiv\; \text{at most one of }T(a),T(b),T(c)\text{ is true} \tag{2} \\ \equiv & \qquad \text{"using assumption $\;\lnot T(c)\;$"} \\ & \text{false} \;\equiv\; \text{at most one of }T(a),T(b),\text{false}\text{ is true} \\ \equiv & \qquad \text{"simplify"} \\ & T(a) \land T(b) \\ \equiv & \qquad \text{"using $(0)$ and $(1)$"} \\ & a = d \land b \not= d \\ \equiv & \qquad \text{"substitute $\;d:=a\;$ in right hand side; using $\;b \not= a\;$"} \\ & a = d \tag{4} \\ \end{align} Now we see that both $(3)$ and $(4)$ imply $\;c \not= d\;$ (using $\;b \not= c\;$ and $\;a \not= c\;$, respectively). In other words, in both cases we can be sure that box $\;c\;$ does not contain the bomb. The advantage of this style of doing proofs, is that often the shape of the formulae help to direct the search for the proof-- and this also helps in presenting the proof, so that it is easy to follow for the readers. -
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9585377284730286, "lm_q1q2_score": 0.8240201386643801, "lm_q2_score": 0.8596637505099168, "openwebmath_perplexity": 920.861968663561, "openwebmath_score": 0.999896764755249, "tags": null, "url": "http://math.stackexchange.com/questions/434270/knight-knave-puzzle-with-three-boxes" }
newtonian-mechanics, mass, momentum, point-particles Title: Center of mass motion and variation of mass Here are the proofs regarding the center of mass motion as reported on my book. $$\vec{r_{cm}}=\frac{\sum\vec{r_i} m_i}{\sum m_i}$$ $$\vec{v_{cm}}=\frac{d{\vec{r_{cm}}}}{dt}=\frac{1}{M}\sum \frac{d}{dt} m_i \vec{r_i}=\frac{1}{M} \sum m_i \vec{v_i}=\frac{1}{M} \vec{P} \tag{1}$$ $$\vec{a_{cm}}=\frac{d{\vec{v_{cm}}}}{dt}=\frac{1}{M}\sum \frac{d}{dt} m_i \vec{v_i}=\frac{1}{M} \sum m_i \vec{a_i}=\frac{1}{M} \vec{F^{(EXT)}}=\frac{1}{M} \frac{d\vec{P}}{dt} \tag{2}$$
{ "domain": "physics.stackexchange", "id": 30271, "lm_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, mass, momentum, point-particles", "url": null }
dimensional-analysis, units, absolute-units An arbitrary dimension of a physical quantity over the above dimensions is $\mathsf{L}^a\mathsf{M}^b\mathsf{Q}^c\mathsf{T}^d\mathsf{\Theta^e}$, which we can denote as a vector $\in V:=\Bbb R^5$ with entries $a$ etc. Setting $c=\hbar=1$ is basically "modulo" arithmetic with vectors. To think of it another way, the "dimensionless" quantities are those who dimension is spanned by the vectors with $a=1,\,d=-1$ and $a=2,\,b=1,\,d=-1$ (in both cases, unstated vector entries are $0$). This is, of course, a subspace of $V$, say $W$. Finally, those two vectors are linearly independent, an arbitrary $v\in V$ can be written uniquely as $v_\parallel+v_\perp$ with $v_\parallel\in W$ and $v_\perp\cdot w=0$ for all $w\in W$. Identifying $v$ with $v_\perp$ then defines an equivalence relation. For example, $E=mc^2$ simplifies to $E=m$, which looks dimensionally inconsistent because $[E]\ne[m]$, but it's fine because $[E]$ is in the same equivalence class as $[m]$. What's more, the uniqueness of $v_\parallel$ implies you can work out which powers of $c$ etc. to reinstate. Even if we are as ambitious as Planck units so everything becomes dimensionless, the choice of powers to fix a given equation is still unique.
{ "domain": "physics.stackexchange", "id": 91348, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "dimensional-analysis, units, absolute-units", "url": null }
ros-humble, nav2, obstacle-avoidance bt_navigator_navigate_through_poses_rclcpp_node: ros__parameters: use_sim_time: True bt_navigator_navigate_to_pose_rclcpp_node: ros__parameters: use_sim_time: True controller_server: ros__parameters: use_sim_time: True controller_frequency: 20.0 min_x_velocity_threshold: 0.001 min_y_velocity_threshold: 0.5 min_theta_velocity_threshold: 0.001 failure_tolerance: 0.3 progress_checker_plugin: "progress_checker" goal_checker_plugins: ["general_goal_checker"] # "precise_goal_checker" controller_plugins: ["FollowPath"]
{ "domain": "robotics.stackexchange", "id": 38583, "lm_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-humble, nav2, obstacle-avoidance", "url": null }
quantum-mechanics, bose-einstein-condensate, ground-state, schroedingers-cat, cold-atoms For $N > 2$, the same principle applies, but now the resonant coupling between $|0, N\rangle$ and $|N, 0\rangle$ is determined by an $N$-th order process, so its strength will be suppressed accordingly. However, the ground state manifold will still be diagonalized as $(|0, N\rangle \pm |N, 0\rangle)/\sqrt{2}$, with increasingly small splitting for large $N$. Therefore technically there will be a well-defined unique ground state, which will be a superposition of $|0, N\rangle$ and $|N, 0\rangle$. Side note: This same principle applies in many examples corresponding to a quantum phase transition into a symmetry-broken phase. For example, consider a quantum Ising model, $H = J \sum_i \sigma^{(i)}_x + V\sum_{i} \sigma_z^{(i)}\sigma_z^{(i+1)}$. Let's take $V < 0$, so the ferromagnetic case. If $J = 0$, then there are two degenerate ground states: $|\downarrow\rangle^{\otimes N}$ and $|\uparrow\rangle^{\otimes N}$. With small coupling $J > 0$, then the same principle applies: these two states are resonantly coupled by an $N$-th order off-resonant process, so technically they diagonalize into a symmetric and antisymmetric superposition, split by a very small energy.
{ "domain": "physics.stackexchange", "id": 60373, "lm_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, bose-einstein-condensate, ground-state, schroedingers-cat, cold-atoms", "url": null }
python-3.x, combinatorics Comment concise (one perfect scenario – which does not exist – would be the understandability of the code without any comment); Use unittest if you like; Turn on your IDE's spell checking; Not sure about what we are doing overall, but my guess is that we might be able to start the second loop from the row + 1: def get_linear_calc(x: float, y: float, coeff: float) -> float: """ param x:float, x coordinate param y:flaot, y coordinate param coeff:float, parameter of the curve """ return x + (y * coeff) def get_ordered_sequence(x, y, coeff): """ algorithm: Suppose arrays are ordered by their index and NOT the element inside Go through an ordering which meets that (one ordering is enough) add on the function curr that point to the sequence """ seq = [0.0] * len(x) for row in range(len(x) + 1): for col in range(row + 1, len(x) + 1): for curr in range(row, col): seq[curr] += get_linear_calc(x[curr], y[curr], coeff) return seq if __name__ == "__main__": x = (1.0, 2.0, 3.0, 2.0) y = (2.0, 3.0, 4.0, 1.0) coeff = 2.0 print(get_ordered_sequence(x, y, coeff)) PS: I don't name things well, ignore my naming.
{ "domain": "codereview.stackexchange", "id": 39896, "lm_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-3.x, combinatorics", "url": null }
php, design-patterns, mysql } /** * Set DB connection currently being used * @param Int $connection_id - Index number of DB connection to set to * @return Null */ public function SetActiveConnection($connection_id){ if(array_key_exists($connection_id, $this->connection) || is_integer($connection_id)){ $this->activeConnection = $connection_id; }else{ trigger_error('Connection does not exists',E_USER_ERROR); } } /** * Get and return active db connection * @param Null * @return active connection */ public function GetActiveConnection(){ //Check using empty because $connection is set to 0 if(!empty($this->activeConnection)){ return $this->connection[$this->activeConnection]; }else{ trigger_error('A connection is not set',E_USER_ERROR); } } /** * Close selected DB connection * @param Null * @return Null */ public function CloseActiveConnection(){ $this->connection[$this->activeConnection]->close(); } /** * Returns number of the current active * @param Null * @return Int index of the active DB connection */ public function ShowActiveConnection(){ echo "Current Connection index[".$this->activeConnection."]"; } public function __destruct(){ foreach ($this->connection as $connection) { $connection->close(); } } } DBcontrol Class The DBcontrol class extends the Database Class include_once('database.object.php'); class DBControl extends Database{ //Array of cached queries private $cacheQuery = array(); public function __constuct(){ //Empty }
{ "domain": "codereview.stackexchange", "id": 4295, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "php, design-patterns, mysql", "url": null }
javascript, jquery, html, css, fancybox var counterStop = setInterval(function() { if($('div.selected').length === 0) { clearInterval(counterIncrease); clearInterval(counterStop); } else { $('div.fancybox-overlay:eq(0), a.fancybox-close:eq(0)').on('mouseup', function () { currentWrapper.removeClass('selected'); $timerIndex.removeClass('counting'); }); $(document).keydown(function(esc){ var code = esc.keyCode ? esc.keyCode : esc.which; if(code === 27) { currentWrapper.removeClass('selected'); $timerIndex.removeClass('counting'); } }); } }, 100); } }); Working Example For most of your code, you use the $ sign for jQuery, like here: $(".fancybox").fancybox({...}); However, there are two places where you do not use the $. Instead, you use the name jQuery. Here is one of the spots: if(jQuery('div#IsInternetExplorer').length > 0) Why did you switch? You should be consistent with which function you use, as it is good practice. You are inconsistent with your brace types: if(jQuery('div#IsInternetExplorer').length > 0) { // <======= ... } // <========= but here you do: function targetDiv(currentTimer) { // <====== ... } // <============== Generally, the style for JavaScript is to go with the second version. However, both work equally as well, but you should choose one and stick with that one.
{ "domain": "codereview.stackexchange", "id": 14962, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, jquery, html, css, fancybox", "url": null }
ros, nodes, publisher the high level coding (e.g. trough roscpp) they don't need to know each others' name, but at the lower level they actually know (do couple) to send info correct. re: not blocked: Publisher::publish(..) returns immediately, and does not wait for all recipients to have received the msg. Comment by aks on 2018-04-16: Sorry for re-opening such an old post. On what factors is the communication protocol selected ? be it TCP or UDP. Are there some other protocols supported as well ? Comment by gvdhoorn on 2018-04-16: It would perhaps be better to open a new post. Your question is only tangentially related to this one.
{ "domain": "robotics.stackexchange", "id": 20878, "lm_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, nodes, publisher", "url": null }
ros imu_pub.publish(imu_msg); } // Magnetometer. transform to ROS axes ///////////////////////////////////////////////////////////////////////////////// if (mag_pub.getNumSubscribers() > 0) { if (use_magnetic_field_msg) { sensor_msgs::MagneticField mag_msg; mag_msg.header = imu_msg.header; switch (axes) { case OutputAxisOptions::ENU: { mag_msg.magnetic_field.x = r.mag.get_scaled(1); mag_msg.magnetic_field.y = r.mag.get_scaled(0); mag_msg.magnetic_field.z = -r.mag.get_scaled(2); break; } case OutputAxisOptions::ROBOT_FRAME: { // body-fixed frame mag_msg.magnetic_field.x = r.mag.get_scaled(0); mag_msg.magnetic_field.y = -r.mag.get_scaled(1); mag_msg.magnetic_field.z = -r.mag.get_scaled(2); break; } case OutputAxisOptions::DEFAULT: { mag_msg.magnetic_field.x = r.mag.get_scaled(0); mag_msg.magnetic_field.y = r.mag.get_scaled(1); mag_msg.magnetic_field.z = r.mag.get_scaled(2); break; } default: ROS_ERROR("OuputAxes enum value invalid"); } mag_pub.publish(mag_msg); } else { cout<<"Vector3Stamped"; geometry_msgs::Vector3Stamped mag_msg; mag_msg.header = imu_msg.header;
{ "domain": "robotics.stackexchange", "id": 36626, "lm_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 }
ros, action, actionlib, ros-service, publisher Edit: a paper with a nice overview of the different interaction patters (but with a focus on publish-subscribe) is The many faces of publish-subscribe, by Eugster et al. (publicly accessible copy here). Originally posted by gvdhoorn with karma: 86574 on 2016-11-25 This answer was ACCEPTED on the original site Post score: 5
{ "domain": "robotics.stackexchange", "id": 26325, "lm_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, action, actionlib, ros-service, publisher", "url": null }
greatest common divisor cehsu 104 views Greatest Common Divisor In mathematics, the greatest common divisor (gcd) of two or more integers, which are not all zero, is the largest positive integer that divides each of the integers. For example, the gcd of 8 and 12 is 4. The greatest common divisor is also known as the greatest common factor (gcf), highest common factor (hcf), greatest common measure (gcm), or highest common divisor. Check for the gcd Write a getGCD function that takes two numbers as parameters and returns the gcd. Sample Input and Output Input: 8 12 Output: 4 Optimization Check out Euclid's algorithm and see how much things speed up. How can you account for this in terms of time complexity? See: https://en.wikipedia.org/wiki/Euclidean_algorithm#Worked_example https://en.wikipedia.org/wiki/Greatest_common_divisor#Complexity_of_Euclidean_method Write the getGCD function 1 2 3 4 5 6 7 8 function getGCD (numOne, numTwo) { } module.exports = getGCD; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Open Source Your Knowledge: become a Contributor and help others learn.
{ "domain": "tech.io", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9911526464851029, "lm_q1q2_score": 0.8343777220856523, "lm_q2_score": 0.8418256512199033, "openwebmath_perplexity": 1394.3991620944616, "openwebmath_score": 0.2932957112789154, "tags": null, "url": "https://tech.io/playgrounds/257/greatest-common-divisor" }
binary-trees, graph-traversal Tree traversal article describes reversed traversal as going right-to-left as opposed to left-to-right; so according to it the tree has preorder traversal 1 2 4 7 8 5 3 6 9 10 and reverse preorder traversal 1 3 6 10 9 2 5 4 8 7 However, the DFS article describes reverse orderings as just the reversed version of a usual one (while left-to-right vs. right to-left is AFAIU left undefined); so according to this article both of the above are preorderings, while 10 9 6 3 5 8 7 4 2 1 is the reverse preordering for the 1st one, and 7 8 4 5 2 9 10 6 3 1 is the reverse preordering for the 2nd one. (I realize the last two are the two post-order traversals in the first article's sense.) So, are there two different terminologies in contexts of trees and general graphs respectively? Isn't there a mistake in some of these articles? If there's no mistake, then, if asked to find a reverse preorder of a given graph (tree), I guess I should clarify which meaning of 'reverse' a person implies, right? You are right. "Reverse" in the context of binary trees does not mean the same as "reverse" in the context of general graphs. In general graphs, "reverse" preorder/postorder simply means putting the nodes in the opposite order as they appear in the normal preorder/postorder trace. For example, if the preorder trace is A, B, C, D, the reverse preorder trace will be D, C, B, A. The same goes for postorder. However, in binary trees, it means a different thing; swapping left and right child nodes in the recurrence relations (or going right-to-left instead of left-to-right): Preorder: root, (left), (right) Reverse preorder: root, (right), (left) Postorder: (left), (right), root Reverse postorder: (right), (left), root # this ordering only exists in binary trees Inorder: (left), root, (right) Reverse inorder: (right), root, (left)
{ "domain": "cs.stackexchange", "id": 20203, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "binary-trees, graph-traversal", "url": null }
python, python-3.x, web-scraping, selenium, instagram If you care deeply about order, then there are other ways to do this that still don't require a custom generator. Generator materialization This: new_links = [urllib.parse.urljoin(link, '?__a=1') for link in links] should use parentheses instead of brackets, because you don't need the list in memory - you only need the generator once through. Variable reuse Save logging_page_id['graphql']['shortcode_media'] to a temporary variable for reuse. Tuples in a function This: def download_video(self, new_videos: Tuple[int, str]) -> None: can simplify its tuple unpacking from number = new_videos[0] link = new_videos[1] to number, link = new_videos Magic numbers Pull the 8 from this Pool(8) into a constant, for instance N_PROCESSES = 8 # ... Pool(N_PROCESSES) This is more maintainable and self-documenting.
{ "domain": "codereview.stackexchange", "id": 37828, "lm_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, selenium, instagram", "url": null }
python, performance, python-3.x, excel Title: Update an Excel master workbook with values from new workbook I have a master .xlsx file on which other spreadsheets depend. Each week, I export a new .xlsx file (from MRP) that may or may not be the same as the master. The columns are always identical. Rows may increase or decrease. Cell values may change, usually just one (price value, column AB). I wrote a Python program that reviews the differences, and updates the master with the new values. I wanted this program to update the master workbook to match the new values. Any new rows in the new workbook would be appended to the master as well. Problems: This is slow. Is there a more efficient way to do this? Luckily there are only about 2 - 4k rows. As in VBA code instead? Or another language altogether? Any Pythonification updates I could make? I am a beginner so I'd like to learn how to optimize code as I go. Any other advice or help would also be appreciated. import sys import openpyxl import openpyxl.utils from datetime import datetime as dt import os #get teh mater path hm_dir = "C:\\path\\MASTER SHEETS" suffix = ".xlsx" #loop to get the choice of master workbook to update while True: wb_choice = input("Enter the master sheet you want to update:\n" \ "a for Main Warehouse\n"\ "c for Composite Item List\n"\ "i for Item Master\n") if wb_choice.lower() == "a": old_workbook_path = os.path.join(hm_dir, "Main_WHSE.xlsx") break if wb_choice.lower() == "c": old_workbook_path = os.path.join(hm_dir, "COMPOSITE.xlsx") break if wb_choice.lower() == "i": old_workbook_path = os.path.join(hm_dir, "ITEMS.xlsx") break else: print("Enter A C or I") continue
{ "domain": "codereview.stackexchange", "id": 44437, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, performance, python-3.x, excel", "url": null }
electromagnetism, gauge-theory, definition, yang-mills, gauge Title: What is 't Hooft-Veltman gauge? What are the interactions in SM in 't Hooft-Veltman gauge? What is 't Hooft-Veltman gauge? I can't really find any suitable answer online. If we introduce this gauge in SM, then what becomes interactions? For what it's worth, the 't Hooft-Veltman gauge $$ G~=~ \partial_{\mu} A^{\mu} +\frac{\lambda}{2} A_{\mu} A^{\mu} $$ is a non-linear deformation of the Lorenz gauge $$G~=~ \partial_{\mu} A^{\mu} .$$ This modifies the Feynman-rules for the interaction vertices but not the propagators. References: R. B. Mann, G. McKeon & S.B. Phillips, Longitudinal contributions to the vacuum polarization in the't Hooft-Veltman gauge, Can. J. Phys. 62 (1984) 1129. G. McKeon, S.B. Phillips, S.S. Samant & T.N. Sherry, Becchi-Rouet-Stora invariance in the 't Hooft-Veltman gauge, Can. J. Phys. 63 (1985) 1343.
{ "domain": "physics.stackexchange", "id": 88912, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electromagnetism, gauge-theory, definition, yang-mills, gauge", "url": null }
ros, rviz, ros-kinetic Title: help with RVIZ plugin Hello, I'm trying to create an RVIZ plugin on ROS KINETIC that does something similar to the "2D pose Estimate" function. My idea is to capture a specific pose on the map and publish on a specific topic. However, I am getting the following error message when I click on the "Add a new Tool" menu in RVIZ: [ERROR] [1611276556.186111089]: PluginlibFactory: The plugin for class 'rviz_plugin_setDock/SetDock' failed to load. Error: Failed to load library /home/mateus/catkin_ws/devel/lib/libsetDock.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = /home/mateus/catkin_ws/devel/lib/libsetDock.so: undefined symbol: _ZN19rviz_plugin_setDock7SetDockD1Ev) the link to my package is this: https://drive.google.com/file/d/1L-vMHZUaHM6aVD4FuIBOouQnXi-rRkFJ/view?usp=sharing setDock.cpp: #include <tf/transform_listener.h> #include <geometry_msgs/PoseWithCovarianceStamped.h> #include "rviz/display_context.h" #include "setDock/setDock.hpp" namespace rviz_plugin_setDock { SetDock::SetDock() { } /*SetDock::~SetDock() { }*/ void SetDock::onInitialize() { SetDock::onInitialize(); setName("Set_Dock"); updateTopic(); } void SetDock::updateTopic() { pub_ = nh_.advertise<geometry_msgs::PoseWithCovarianceStamped>( "dock_position", 1 ); }
{ "domain": "robotics.stackexchange", "id": 35993, "lm_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, rviz, ros-kinetic", "url": null }
java, rock-paper-scissors import Game.Result; import static org.assertj.core.api.Assertions.*; /** * @author ms * */ @RunWith(Parameterized.class) public class GameTest { @Parameters public static Iterable<Object[]> testData() { return Arrays.asList(new Object[][] { { Move.ROCK, Move.ROCK, Result.TIE }, { Move.ROCK, Move.PAPER, Result.B_WINS }, { Move.ROCK, Move.SCISSORS, Result.A_WINS }, { Move.PAPER, Move.PAPER, Result.TIE }, { Move.PAPER, Move.ROCK, Result.A_WINS }, { Move.PAPER, Move.SCISSORS, Result.B_WINS }, { Move.SCISSORS, Move.SCISSORS, Result.TIE }, { Move.SCISSORS, Move.ROCK, Result.B_WINS }, { Move.SCISSORS, Move.PAPER, Result.A_WINS }, }); } @Parameter(0) public Move moveA; @Parameter(1) public Move moveB; @Parameter(2) public Result expectedResult; /** * Test method for * {@link Game#evaluateMoves(Move, Move)} * . */ @Test public void testEvaluateMoves() throws Exception { assertThat(Game.evaluateMoves(moveA, moveB)).isEqualTo(expectedResult); } } Pros: The logic of the game (which move beats which) is kept in one place (the definition of Move), making it easy to replace the rules with e.g. rock-paper-scissors-lizard-spock Cons: The naming of the components feels too trivial The main loop in Game.playGame could probably be converted to using Java8 Streams/Lambdas, but this makes collecting the results more difficult Only the evaluation of moves is tested, as this is the only non-trivial code But I'm still interested in a Java8/Streams-solution. – @Martin Schröder Hey... it's show-and-tell time! Move enum Move { ROCK, PAPER, SCISSORS;
{ "domain": "codereview.stackexchange", "id": 13533, "lm_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, rock-paper-scissors", "url": null }
python, algorithm, pathfinding, a-star, sliding-tile-puzzle return arr def manhattan_distance(a, b): return abs(b[0] - a[0]) + abs(b[1] - a[1]) def count_distance(number, state1, state2): position1 = np.where(state1 == number) position2 = np.where(state2 == number) return manhattan_distance(position1, position2) def manhattan_heuristic(state): distances = [count_distance(num, state, constant.GOAL_STATE) for num in constant.SIZE] return sum(distances) def search(path, g, threshold): node = path[-1] f = g + node.heuristic if f > threshold: return f if np.array_equal(node.state, constant.GOAL_STATE): return True minimum = float('inf') for n in nextnodes(node): if n not in path: path.append(n) tmp = search(path, g + 1, threshold) if tmp == True: return True if tmp < minimum: minimum = tmp path.pop() return minimum def solve(initial_state):path = solve(initial_state) initial_node = Node(initial_state, manhattan_heuristic(initial_state)) threshold = initial_node.heuristic path = [initial_node] while 1: tmp = search(path, 0, threshold) if tmp == True: print(f"GOOD!") return path elif tmp == float('inf'): print(f"WRONG!") return False threshold = tmp You can call the solve() function (and create some needed global variables) like this: def define_goal_state(n): global GOAL_STATE global SIZE global SIZE2 global ZERO
{ "domain": "codereview.stackexchange", "id": 40854, "lm_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, algorithm, pathfinding, a-star, sliding-tile-puzzle", "url": null }
complexity-theory, np-complete Title: Impact of Polynomial Time Algorithm for an NP Complete problem on Complexity Theory Assuming (hypothetically) someone proves $P=NP$ by providing a polynomial time algorithm for a $NP-Complete$ problem the Polynomial Hierarchy collapses. What are the other (important) questions that are still left in complexity theory in respect to the remaining complexity classes? If possible can someone help with a link where it might have been answered already (which I am guessing it might be) is perfectly fine too. If P=NP, then it follows that P=co-NP, and NP=NP-complete (i.e. there are no NP-intermediate problems, which are in NP but not NP-complete). But there are plenty of other divisions in the hierarchy which might still hold, and might not. P=NP wouldn't necessarily tell us anything about this. On the higher end of things, how does NP relate to PSPACE? It's entirely possible that they're the same (only if P=NP: if P≠NP, they're definitely different), in which case all the classes in the middle (such as PP, which uses a probabilistic Turing machine) are collapsed together too. On the lower end, how does P relate to L (logarithmic space)? There are various classes between these ones too, such as NL (nondeterministic log space), and these might all be collapsed into a single class also.
{ "domain": "cs.stackexchange", "id": 11548, "lm_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, np-complete", "url": null }
Solution: $$f(4a+7b)=3(4a+7b)=12a+21b$$ Now look at the same linear combination of $f(a)$ and $f(b)$. $$4f(a)+7f(b)=4(3a)+7(3b)=12a+21b$$ It is the same. That is $$f(4a+7b)=4f(a)+7f(b)$$ This notion of linearity occurs in many areas of mathematics. Notice, for example, that definite integrals are linear. For example $$\int_0^15x-6x^2\,dx=5\int_0^1x\,dx-6\int_0^1x^2\,dx$$ Differentiation is also linear. For example $$\frac{d}{dx}\left(3\sin x+5e^x\right)=3\frac{d}{dx}\sin x+5\frac{d}{dx}e^x$$ Should, at some point, you study Laplace transforms you will find that they are linear transforms. $$\mathcal{L}\{a\cdot f(t)+b\cdot g(t)\}=a\cdot\mathcal{L}\{f(t)\}+b\cdot\mathcal{L}\{g(t)\}$$ • In fact a linear equation is nothing but $f(x)=y$ for some linear function $f$. – user856 Aug 27 '17 at 1:53 • @Rahul I was afraid that I had already gone on at too great a length. – John Wayland Bales Aug 27 '17 at 1:58
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9886682454669814, "lm_q1q2_score": 0.8343322884600007, "lm_q2_score": 0.8438951005915208, "openwebmath_perplexity": 391.6767848549622, "openwebmath_score": 0.7767642736434937, "tags": null, "url": "https://math.stackexchange.com/questions/2402451/what-exactly-do-we-call-a-linear-equation" }
algorithms, graphs, trees, spanning-trees Title: Find MST based upon new definition Redefine the weight of a spanning tree to be the weight of the maximum weight edge in the tree (i.e. the weight of the tree is no longer the sum of the weights of all the edges in the tree, only the weight of the edge with the maximum weight). How would you derive an efficient algorithm to compute the minimum weight spanning tree under this new definition? Do not assume the edge weights are distinct. A brute force approach would obviously be to compute all possible MSTs, then sort them based on their maximum weighted edge, and choose the smallest one. This is not efficient however, but I am having trouble seeing how to do this. Any ideas? Every MST according to the original definition is also optimal according to your new definition. (The proof of this statement is left as an exercise; it is not that hard.) So any MST algorithm will do the job.
{ "domain": "cs.stackexchange", "id": 2831, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "algorithms, graphs, trees, spanning-trees", "url": null }
m * $v = -v * b + K * b * p Implement a model predictive controller that adjusts gas pedal position to regulate velocity. Start at an initial vehicle velocity of 0 m/s and accelerate to a velocity of 40 m/s. Discuss the controller performance and how it could be tuned to meet multiple objectives including: • minimize travel time • remain within speed limits • improve vehicle fuel efficiency • discourage excessive gas pedal adjustments • do not accelerate excessively There is no need to implement these advanced objectives in simulation for this second part of the exercise, only discuss the possible competing objectives. #### Solution The Model Predictive Control both solves the differential equations that describe the velocity of a vehicle as well as minimizes the control objective function. The multiple objectives can be implemented with variable constraints or alternative objective functions. For example, if the only objective is to minimize travel time, the solution would be to use full gas pedal position (100%) for the duration of the simulation. If the objective is to minimize travel time but stay within the speed limit, the solution would be to reach 40 m/s as fast as possible without overshoot. Each additional objective has the potential to adapt the solution to achieve an optimal tradeoff. It is a tradeoff because some of the desirable outcomes have conflicting objectives. See the Dynamic Optimization Course for Excel, MATLAB, and Simulink source files to this problem. The Python source is shown below. import numpy as np try: from APMonitor import * except: # Automatically install APMonitor import pip pip.main(['install','APMonitor']) from APMonitor import * s = 'http://byu.apmonitor.com' a = 'velocity' # clear prior application apm(s,a,'clear all') # time points t = np.linspace(0,30,31) # write model file (model.apm) fid = open('model.apm','w') fid.write('Constants \n') fid.write(' m = 500 ! Mass (kg) \n') fid.write('\n') fid.write('Parameters \n') fid.write(' b = 50 ! Resistive coefficient (N-s/m) \n') fid.write('
{ "domain": "apmonitor.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9773707979895381, "lm_q1q2_score": 0.8123349500606454, "lm_q2_score": 0.8311430541321951, "openwebmath_perplexity": 1917.5450721011614, "openwebmath_score": 0.3040389120578766, "tags": null, "url": "http://apmonitor.com/pdc/index.php/Main/ModelPredictiveControl" }
c#, compiler, roslyn string test1 = D("Hc6zdWqh4D3fIMJ7YmtMGVispS104s9HuSug7Yec3EoVdzpwxSSwiwZ9fifr7SYITmmsk/yZpId3n6wRdrNB1DPJZ5vQrMnXvtET01JzrNpGNXi9XpshmZ5lrSdRpV97", "QcgJWvxFg7lEhX4q4ucohmbxaQhVn047N6ZWvy99"); string test2 = D("q8i/0yaXWTQW0iiVOauTom83aT4SLwBJ+O624k+VyKDFcioZ3dg86H1wGq3Wor4hp6Uw7bmfDp44FJ4K2wQ3pUSwJKXT+j3C8aPcOOSNicRyv/4bXSfGZ1G8KBXVyycA", "nqYq1Oey3iZlDvWnBttFObcqCo0l8h4GudB0Ou6L"); string test3 = D("iColKdv//95gV3TrR5t4Wp3Idw/atPOdbjsRefYifOSLjArhkwwym6ZI5+/SjHP5PuDUyUZqL0WAm8ypmn519mHeS0BD0dzr/MwxVbwsqgUhNmFcVPkfnU2ONqR49vhh", "vtcEaT3bjwVCF3vLOroNY3zVoT0kugYQwhTe8XQs");
{ "domain": "codereview.stackexchange", "id": 29947, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, compiler, roslyn", "url": null }
audio, power-spectral-density, speech-recognition, snr Title: SNR estimation in segmented speech signals I was called to estimate the signal-to-noise ratio in a collection of recordings that were manually annotated, meaning that the speech and noise segments are known. The noise is uncorrelated with the signal and is additive noise: $x(i)=d(i)+n(i)$ ('d' stands for desired). I have no information regarding the sound intensity (no sound meter was employed) neither the voltage-sound-intensity relationship in devices. I found a formula here that seems to be a possible solution (authors explain the annotated way before diving into the no boundaries problem): $$\text{SNR}=10 \log_{10}{\left(\frac{P(x)-P(n)}{P(n)}\right)}$$ Where $P(x)$ and $P(n)$ are the power of the contamined signal 'x' and the noise signal 'n' ('n' is basically a copy of 'x' but with zero energy in the speech segments). The mean was subtracted from both signals as requested in the paper. When I apply the formula in two separate recordings (one clean and the other containing much noise, different signals and different noise) I am getting negative measurements: -6.250953 vs. -7.793706, and a difference of just 1.5 dB between them (I was expecting to see a 20dB diference). Does it make sense to have negative numbers? How can I interpret the 1.5 dB difference in a meaningful way? Thanks in advance for any light on this! Below are two copies of the same magnitude spectrum of the example of the clean recording I mentioned earlier (I did not include the noisy one). The formula estimated a SNR of -6.250953 dB. I did not include the oscillogram but it oscillates in the [-1, 1] range: This is what I am taking as the $x(i)=d(i)+n(i)$ signal: And this is what I am taking as the noise $n(i)$ signal (all energy except the black regions which represent the desired signal):
{ "domain": "dsp.stackexchange", "id": 4373, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "audio, power-spectral-density, speech-recognition, snr", "url": null }
electromagnetism Title: How can dB/dt be defined as a function of the velocity of a permanent magnet (with a known B value) moving towards and then through a conducting loop? Course tutorial questions on faradays law often give numerous examples of rates of changing angle between the A and B vector, or rate of changing Area. However for a dB/dt case you are always given dB/dt in Teslas per second. If you only know the velocity of a permanent magnet, moving towards a conducting loop, how can dB/dt be written as a function of velocity or position? Look back at the law itself. It says that the electromotive force $\mathcal{E}$ is given by the rate of change of the magnetic flux $\Phi_B$. It's not written directly in terms of the area $A$ or the magnetic field $\vec{B}$; it's written in terms of the flux $\Phi_B$, which is kind of the product of the two. Technically, the flux is given by \begin{equation} \tag{1} \Phi_B = \iint_{\Sigma(t)} \vec{B}(\vec{r}, t) \cdot d\vec{A}(\vec{r}, t), \end{equation} where $\Sigma(t)$ is some surface bound by your loop, and $d\vec{A}$ is a differential area element, which might be changing in time. Now the details of that expression may be a little distracting, but basically it's just the magnetic field dotted into the area. So the hand-wavy version of this is \begin{equation} \Phi_B \approx \vec{B} \cdot \vec{A}. \end{equation} (Just remember that if this product changes much over your surface, you'll eventually need to integrate over the surface to get the real answer.) Faraday's Law just says \begin{equation} \mathcal{E} = -\frac{d\Phi_B} {dt}. \end{equation} Next, we can use the hand-wavy expression and the product rule to write \begin{equation}
{ "domain": "physics.stackexchange", "id": 44956, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electromagnetism", "url": null }
c, strings Modified function and tests: int str_equal(const char *s1, const char *s2) { while (*s1) { if (*s1++ != *s2++) { return 0; } } return !*s2; } #include <stdio.h> int test_str_equal(int expected, const char *a, const char *b) { int actual = str_equal(a, b); if (actual == expected) { return 0; } fprintf(stderr, "\"%s\"==\"%s\" should return %d\n", a, b, expected); return 1; } int main(void) { return test_str_equal(1, "", "") + test_str_equal(0, "", "x") + test_str_equal(0, "x", "") + test_str_equal(1, "x", "x") + test_str_equal(0, "x", "y") + test_str_equal(0, "x", "xy") + test_str_equal(0, "xy", "x") + test_str_equal(0, "xx", "xy") + test_str_equal(1, "xy", "xy"); }
{ "domain": "codereview.stackexchange", "id": 43962, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c, strings", "url": null }
python, python-3.x, pandas, django Title: Use django engine to fill in a .html file on storage (no template) and use weasyPrint to convert it to PDF I 'm new here. I wrote the following django code. I 'm opening, closing files here and saving them temporarily and deleting them. I tried to use Python's tempfile and was getting Permission Error and I did asked about it on IRC #django but maybe Windows is not a pleasant to use OS for programmers so I couldn't get a good answer. I needed something like render_to_string of django which takes in a html string and replace all templating with the context dict but it seems django is made to treat every .html file as a template. Purpose of the project : It is to take a visitor's id and return him with a pdf which will be formed by picking up a row from the database by looking at his id. There are 3 kinds of ids here. How is the pdf being made? I was given a pdf empty form which I converted to .docx file with the use of online sites. Now I tried to use python-docx to convert docx to pdf but that required libre office/ms word which might not be available on the server (The form can be formed by the client on his local pc and be given to the technical guy to put on the server). I was suggested to use a html form and the client said that he might change the form. @ChrisWarrick on #python IRCnode suggested me to use HTML to PDF conversion which could be done by weasyPrint which was cross platform and easier to install. Although he said me to use jinja but since I was using django why install some other library. Now I said to the client to open a .docx file and create whatever form he has to make and put {{NAME}} and other variables wherever he wants some information from the database to be put and save it as .html file and further put it in the /media folder of the django project. Then he has to open the config (.cfg) file and put NAME=NAME here 'NAME' on left is what is in the .html file(docx form) and on the right is column name of the database table(I got a single table).
{ "domain": "codereview.stackexchange", "id": 38608, "lm_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, pandas, django", "url": null }
reference-request, quantum-computing, cr.crypto-security What structural property of factoring allows Shor's algorithm to run quickly, but appears to be missing from worst-case lattice (approximation) problems? In particular: How is this gap related to our current understanding of the Abelian Hidden Subgroup Problem (HSP) vs non-Abelian variants of the HSP? The answer to your question is the same as with many other such assumptions in cryptography: despite a lot of effort no one has found any substantially faster quantum algorithms for lattice problems. Why do we assume that RSA is secure? We don't have any particular justification for its classical hardness other than the fact that no one has found any fast algorithms for it, and we know that it is vulnerable to quantum attacks. Despite this we trust it to protect billions of dollars of e-commerce. On the other hand, the situation is not really the same. There is much better justification for LWE-based systems being secure. What makes LWE appealing is that it's based on the worst-case (quantum) hardness of lattice problems. As you probably know, a holy grail of crypto is to derive average-case-hard primitives like one-way functions from worst-case hardness assumptions like $P \neq NP$. Regev's reduction is a big step in this research program, and as far as I know there are no non-lattice based schemes whose security is based on worst-case hardness assumptions. Finally, it's worth noting that LWE may still be secure against classical attacks even if there are efficient quantum algorithms for lattice problems. A major open problem in lattice-based cryptography is to prove classical hardness of LWE with parameters that match the quantum reduction. A paper by Peikert in 2009 and a follow-up paper by Brakerski et al. in 2013 made progress towards this goal by showing classical hardness of LWE under some weaker parameter settings.
{ "domain": "cstheory.stackexchange", "id": 3430, "lm_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-request, quantum-computing, cr.crypto-security", "url": null }
May 27, 2016 - 19:02 Hi nikoo, The body of the problem says as you say, the title says it like I say, “the first N”. May 24, 2016 - 20:07 2 problems with the article. 1. N=25 means I expect 25 prime numbers as the answer. 2. The definition of a prime number is incorrect. ANY number is divisible by either 1 or itself. It should be “ONLY 1 and itself”. May 27, 2016 - 10:44 Hi Rahan, If you read the question properly, it says to print prime numbers in the range of 1-N. It never says to print N prime numbers. August 11, 2015 - 14:17 […] Find the first N prime numbers. (Method 1) […] August 11, 2015 - 14:16 […] Find the first N prime numbers (Method 1) […]
{ "domain": "studyalgorithms.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9688561712637256, "lm_q1q2_score": 0.8052580771989579, "lm_q2_score": 0.831143054132195, "openwebmath_perplexity": 928.4270374745223, "openwebmath_score": 0.27533450722694397, "tags": null, "url": "https://studyalgorithms.com/misc/find-the-first-n-prime-numbers-method-1/" }
quantum-field-theory, particle-physics, mathematical-physics, grand-unification In the context of gauge theory, as here, Y is always the weak hypercharge of the SM, shifting weak isospins, and never the strong hypercharge you cite, shifting plain isospin, which you should henceforth ignore with extreme prejudice. Weak hypercharge treats different chiral states of fermions aggressively differently. It is one of the 12 unbroken generators of SU(5). Certainly not one of the 6 charges corresponding to the $\mathbb{Y}$s! The WP article on $\mathbb{X}$ and $\mathbb{Y}$ bosons is sound, and bears reading and re-reading to identify them. Three of them, $\mathbb{X}^{+4/3}$, carry anticolor charges; three of them, $\mathbb{X}^{-4/3}$, carry color charges; three of them, $\mathbb{Y}^{+1/3}$, carry anticolor charges; and the last three of them, $\mathbb{Y}^{-1/3}$, carry color charges. The positive ones carry B-L= 2/3 and the negative ones -2/3. Consequently, given the weak hypercharges $Y(\mathbb{X}^{+4/3})=5/3$, $Y(\mathbb{X}^{-4/3})=-5/3$, $Y(\mathbb{Y}^{+1/3})=5/3$, $Y(\mathbb{Y}^{-1/3})=-5/3$, they all have $X=0$. It is non-negotiable for you to go to Li & Cheng or your favorite GUT review (e.g. Langacker, but note he is using the half-hypercharge convention!) and see their position and function in the 5×5 traceless matrix of the 24 gauge bosons of SU(5): otherwise all reasonable discussions are bound to end up in shadowboxing sloughs. When confused, just look at an easy bifermion decay mode of these bosons; see how this answer ensures X=0 for all.
{ "domain": "physics.stackexchange", "id": 68687, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-field-theory, particle-physics, mathematical-physics, grand-unification", "url": null }
astronomy, terminology, exoplanets Title: Is there an established standard for naming exoplanets? I understand that exoplanets are named by adding a lowercase letter to the a designation of the planet's parent star or stellar system, beginning with 'b' (the star itself is 'a') in order of discovery (and orbital distance from star where discoveries of more than one planet around a star are announced together). My question is whether there is an established standard for using a space between the stellar designation and the planet's letter. Is it Kepler-22 b or Kepler-22b? Journals seem to have different editorial policies that determine how they handle this, but the comprehensive databases available online (e.g., the Extrasolar Planets Encyclopaedia, the Visual Exoplanet Catalogue, and NASA's Planet Quest) seem to all use a space. You are correct that the standard for naming exoplanets is normally the lower-case letter after the star name in the order of discovery. So in our system, Earth would be Sol b. If there are multiple stars in the system, like 16 Cyg (which has 16 Cyg A and B), then the planet's lower-case letter would be appended to the star's, such as 16 Cyg Bb. So the space is normally there unless it's a binary star system in which case the space is not there because there already is one between the star's A/B/C/etc. designation and the name. (Different systems have been proposed, such as by Hessman et al. (2010.) However, as you note, it appears as though the Kepler team, does not include a space. Their papers, for example, would list a planet as Kepler-22b. Or Kepler-16b (which is confusingly short for Kepler-16 (AB)-b). Newspaper/internet editors often in these cases will go to an established grammar guide or set of rules for their own publications instead of following what the team does. Just looking at the External Links on the Wikipedia page for Kepler-22b shows the BBC using "Kepler 22b," NASA properly using "Kepler-22b," and Planetary Habitability Lab using "Kepler-22 b."
{ "domain": "physics.stackexchange", "id": 3206, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "astronomy, terminology, exoplanets", "url": null }
computer-vision Metric-based no-reference quality assessment of heterogeneous document images No-reference image quality assessment (NR-IQA) aims at computing an image quality score that best correlates with either human perceived image quality or an objective quality measure, without any prior knowledge of reference images. Although learning-based NR-IQA methods have achieved the best state-of-the-art results so far, those methods perform well only on the datasets on which they were trained. The datasets usually contain homogeneous documents, whereas in reality, document images come from different sources. It is unrealistic to collect training samples of images from every possible capturing device and every document type. Hence, we argue that a metric-based IQA method is more suitable for heterogeneous documents. We propose a NR-IQA method with the objective quality measure of OCR accuracy. The method combines distortion-specific quality metrics. The final quality score is calculated taking into account the proportions of, and the dependency among different distortions. Experimental results show that the method achieves competitive results with learning-based NR-IQA methods on standard datasets, and performs better on heterogeneous documents.
{ "domain": "datascience.stackexchange", "id": 1330, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "computer-vision", "url": null }
newtonian-mechanics, forces, rotational-dynamics, torque Now derive the constraint force from that motion. We now know the only way the thing is allowed by the "hinge has to stay at one place" constraint to accelerate, and we can see some interesting results. So first off, as a no-brainer: if the torquing force $\vec T$ is not perfectly perpendicular to the door, we have to extract its normal component $T_\theta = \vec T \cdot \hat \theta$ to influence $\alpha$ and anything else is eaten by the hinges. If the force is provided at a distance $r$ from the hinge, its torque is therefore $\tau = T_\theta ~r$ and this produces an angular acceleration $\alpha = \tau/I = T_\theta~r/I,$ which I'll be plugging into the above expression in a moment. The constraint force $\vec C$ of course comes to fill this gap between "what motions are possible?" and "what are the forces?". For example if you're standing on the ground, then the constraint says "You are not accelerating in the up/down direction" and therefore the normal force provides whatever force it needs to, to make these balance out: this is why the normal force equals your weight. (It is not because of Newton's third law; it is because you are in a state of up-down "equilibrium" which can only happen if the forces on you balance out.) Something similar is happening with this hinge. So because we know from Newton's second law, the sum of these constraint and torquing forces $\vec C + \vec T$ must be equal to the mass times the acceleration, but I just told you the only possible acceleration:
{ "domain": "physics.stackexchange", "id": 36804, "lm_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, forces, rotational-dynamics, torque", "url": null }
polynomial-time, heuristics, packing, greedy-algorithms Notwithstanding this worst-case analysis, a heuristic like the one described in the edited question is likely to work well for practical examples, even if its worst-case performance is at least 28% worse than optimal. Similar heuristics are often used in practice, sometimes with adjustments like "instead of the general criterion, prefer a bin that is only a tiny bit larger than the object to be placed, if one such exists". Most implemented heuristics I'm familiar with are a big mess of such case analysis, but work extremely well in practice. However, it is often quite hard to come up with badly behaved inputs for such complex algorithms, and it is even harder to prove that they are the worst possible.
{ "domain": "cstheory.stackexchange", "id": 3567, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "polynomial-time, heuristics, packing, greedy-algorithms", "url": null }
the-moon, astrophysics, orbital-mechanics The Giant Impact hypothesis for lunar formation predicts that the moon formed close to the Earth in the equatorial plane. The effects of tides caused the Moon to slowly migrate outwards, through the transition region and into its current orbit. The current ~5° inclination of the Moon relative to the Laplace plane is likely a legacy of inclination excitation during the transition. Here's a video of a simulation of the transition by Sarah Stewart-Mukhopadhyay.
{ "domain": "astronomy.stackexchange", "id": 4516, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "the-moon, astrophysics, orbital-mechanics", "url": null }
comparative-review, go, caesar-cipher can be adjusted the same way we did the lower-case branch. return c } This return stays, and handles non-alphabetic as well as alphabetic characters. Also, what's the difference between Byte and byte, and why are you converting from one to the other?
{ "domain": "codereview.stackexchange", "id": 27307, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "comparative-review, go, caesar-cipher", "url": null }