text
stringlengths
1
1.11k
source
dict
space-telescope, hubble-telescope Source Is the digital camera built to see billions of light years away, or does Hubble have some technology on it that allows it to zoom into the deep space? There are four things that allow the Hubble space "camera" to photograph objects so much far away, and therefore so much smaller and dimmer than we can with our cell phone cameras. A really really big aperture, 2.4 meters! It's much bigger than say a 3 to 5 mm aperture of a cell phone camera. A really long focal length. At f/24 and 2.4 meters, it has a focal length of 57,600 mm, which is ten thousand times longer than the f=5.6 mm focal length lens in my cell phone. A really good CCD which has been optimized for this application It's in space, above the Earth's atmosphere, so there is no wiggling or astronomical seeing problems that we have on Earth.
{ "domain": "astronomy.stackexchange", "id": 5539, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "space-telescope, hubble-telescope", "url": null }
\frac13E_{3\times3}+I_3&\frac13E_{3\times3}-I_3}.\\ \end{aligned} Since $$E_{3\times3}$$ is similar to $$\operatorname{diag}(3,0,0)$$, $$S$$ is similar to \begin{aligned} \pmatrix{\frac13\operatorname{diag}(3,0,0)-I_3&\frac13\operatorname{diag}(3,0,0)+I_3\\ \frac13\operatorname{diag}(3,0,0)+I_3&\frac13\operatorname{diag}(3,0,0)-I_3} =\pmatrix{\operatorname{diag}(0,-1,-1)&\operatorname{diag}(2,1,1)\\ \operatorname{diag}(2,1,1)&\operatorname{diag}(0,-1,-1)}, \end{aligned} which, in turn, is similar to $$\pmatrix{0&2\\ 2&0}\oplus\pmatrix{1&-1\\ -1&1}\oplus\pmatrix{1&-1\\ -1&1}.$$ As each sub-block $$\pmatrix{1&-1\\ -1&1}$$ is singular, $$S$$ has two zero eigenvalues. Hence by Sylvester's law of inertia, $$M$$ has two zero eigenvalues too.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9706877675527112, "lm_q1q2_score": 0.8231119303364485, "lm_q2_score": 0.8479677583778257, "openwebmath_perplexity": 178.0646914363514, "openwebmath_score": 0.9467848539352417, "tags": null, "url": "https://math.stackexchange.com/questions/3815922/how-to-calculate-the-multiplicity-of-the-eigenvalue-0" }
formal-grammars, compilers, parsers, syntax-trees There are four types of top-down parsers: recursive descent backtracking recursive descent predictive table-driven with backtracking table-driven predictive. deterministic seems more common than predictive but that division seems correct. I'll emphasize the fact that the division backtracking/predictive characterizes the algorithm, while the division recursive/table-driven characterizes the implementation. So although the classification is correct, it is mixing different aspects something which tend to introduce confusion. All top down parsers are LL
{ "domain": "cs.stackexchange", "id": 9666, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "formal-grammars, compilers, parsers, syntax-trees", "url": null }
c, console, child-process, winapi SECURITY_ATTRIBUTES saAttr; const char rqdStr[] = {"cmd.exe /c "}; int len = (int)strlen(command); char *Command = NULL; int status = 0; Command = calloc(len + sizeof(rqdStr), 1); if(!Command) return -1; strcat(Command, rqdStr); strcat(Command, command); SetupSecurityAttributes(&saAttr); IO_PIPES io; if(SetupChildIoPipes(&io, &saAttr) < 0) return -1; status = CreateChildProcessNoStdOut(Command, &io); free(Command); return status; } static int SetupChildIoPipes(IO_PIPES *io, SECURITY_ATTRIBUTES *saAttr) { //child process's STDOUT is the program output or data that child process returns // Create a pipe for the child process's STDOUT. if (!CreatePipe(&io->out_pipe_read, &io->out_pipe_write, saAttr, 0)) { return -1; } // Ensure the read handle to the pipe for STDOUT is not inherited. if (!SetHandleInformation(io->out_pipe_read, HANDLE_FLAG_INHERIT, 0)) { return -1; }
{ "domain": "codereview.stackexchange", "id": 29736, "lm_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, console, child-process, winapi", "url": null }
We see how to find extrema of functions of several variables. Given a function $z=F(x,y)$, we are often interested in points where $z$ takes on the largest or smallest values. For instance, if $z$ represents a cost function, we would likely want to know what $(x,y)$ values minimize the cost. If $z$ represents the ratio of a volume to surface area, we would likely want to know where $z$ is greatest. This leads to the following definition that we will state rather generally, but use mostly in the case of a function $F:\R ^2\to \R$. Critical points If $F$ has a local or absolute maximum at $\vec {c}$, it means the gradient will point “nowhere” since the gradient points in the initial direction of greatest increase. This means it is pointing in a “direction” whose components are either zero or undefined. In an entirely similar way, the gradient will be a vector whose components are either zero or undefined at local minimums as well.
{ "domain": "osu.edu", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9928785710435413, "lm_q1q2_score": 0.8117521710249317, "lm_q2_score": 0.8175744695262775, "openwebmath_perplexity": 172.50708641487728, "openwebmath_score": 0.8045973181724548, "tags": null, "url": "https://ximera.osu.edu/mooculus/calculus3/maximumsAndMinimumsOfFunctionsOfSeveralVariables/digInMaximaAndMinima" }
kalman-filters, matrix, proof If $Q_t^{-1}$ is real-valued and positive definite, then there's some real-valued $q$ such that $q_t^T q_t = Q_t^{-1}$ (Cholesky decomposition) If that holds, then $\left(q_t C_t \right)^T\left(q_t C_t \right)$ must be real-valued and at least positive semidefinite for any real-valued $C_t$ (Cholesky again -- that guy gets around) $\left(q_t C_t \right)^T\left(q_t C_t \right) = C_t^T q_t^T q_t C_t = C_t^T Q_t^{-1} C_t$ Cogito, ergo sum. Or QED$^*$, or something brainy, and Latin. ${\tiny ^* {\rm quod\ erat\ demonstrandum.}}$
{ "domain": "dsp.stackexchange", "id": 10654, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "kalman-filters, matrix, proof", "url": null }
c, hash-map void *map_find_addr(Map *m, void *key, int *idx) { return map_find(m, &key, idx); } int map_add(Map *m, void *item) { int idx; char *p = map_find(m, item, &idx); if (p != NULL) { memcpy(p, item, m->item_len); return 1; } if (m->cap == m->cnt) { void *buf = realloc(m->buf, (m->cap + 1) * m->item_len); if (buf == NULL) return -1; m->cap++; m->buf = buf; } p = (char *)m->buf + m->item_len * idx; if (m->cnt > idx) memmove(p + m->item_len, p, (m->cnt - idx) * m->item_len); memcpy(p, item, m->item_len); m->cnt++; return 0; } int map_add_addr(Map *m, void *item) { return map_add(m, &item); } int map_del(Map *m, void *item) { int idx; char *p = map_find(m, item, &idx); if (p == NULL) return 0; memmove(p, p + m->item_len, (m->cnt - idx - 1) * m->item_len); m->cnt--; return 1; }
{ "domain": "codereview.stackexchange", "id": 37961, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c, hash-map", "url": null }
slam, navigation, ros-kinetic, 2d-mapping, gmapping <node name="cartographer_occupancy_grid_node" pkg="cartographer_ros" type="cartographer_occupancy_grid_node" args="-resolution 0.05" /> </launch> EDIT3: Here is my cartographer_ros result. I really appreciate for your help. Thanks in advance! Originally posted by samialperen on ROS Answers with karma: 70 on 2019-04-23 Post score: 0
{ "domain": "robotics.stackexchange", "id": 32919, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "slam, navigation, ros-kinetic, 2d-mapping, gmapping", "url": null }
# How to prove that $|\ln(2+\sin(x)) - \ln(2+\sin(y))| <= |x-y| \space \forall \space x,y \in \mathbb R$ Question states Prove that for all $x$ and $y$ $\in R$, the following inequality is true: $\lvert \ln(2+\sin(x)) - \ln(2+\sin(y))\rvert \le \lvert x-y\rvert$ i've gotten to the point that $\frac{y-x}{2+\sin(c)} = \ln\frac{2+\sin(y)}{2+\sin(x)}$ (y-x divided by 2+sin(c) is my f dash c from the mean value theorem I asked my teacher that i should use mean value theorem here so please don't use anything other than this, but i have no idea how to push this problem further. Also this is my first post so i'm sorry for the f dash (c) thing, mathjax is hard Let $f(x)=\log(2+\sin x)$. Then $f'(x)=\frac{\cos x}{2+\sin x}$. So, if $x,y\in\mathbb R$ and $x\neq y$, then$$\frac{f(y)-f(x)}{y-x}=\frac{\cos c}{2+\sin c}$$for some $c$ between $x$ and $y$, and therefore$$\left|\frac{f(y)-f(x)}{y-x}\right|=\left|\frac{\cos c}{2+\sin c}\right|\leqslant\frac{|\cos c|}{2-|\sin c|}\leqslant1.$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9790357604052423, "lm_q1q2_score": 0.8340922519441407, "lm_q2_score": 0.8519527944504227, "openwebmath_perplexity": 248.54902404904846, "openwebmath_score": 0.964253306388855, "tags": null, "url": "https://math.stackexchange.com/questions/2623936/how-to-prove-that-ln2-sinx-ln2-siny-x-y-space-forall-sp" }
urdf, moveit, collada Originally posted by Stefan Kohlbrecher with karma: 24361 on 2014-05-26 This answer was ACCEPTED on the original site Post score: 3 Original comments Comment by Rabe on 2014-05-26: Thanks, I created a convex hull with meshlab and this reduced the planning time from 2-4 seconds to under .5 seconds. I am still keeping the question open, since I am also intrested in more automated and use-case-specific ways to do this.
{ "domain": "robotics.stackexchange", "id": 18059, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "urdf, moveit, collada", "url": null }
colligative-properties I think the statement is false, and the correct one should use "number of solute particles". I asked my TA and he said the molecule version is true, although I show him an example that $\ce{H2CO3}$ can dissolve water in many ways to create different sets of miles for $(\ce{CO3^2-},$ $\ce{HCO3-},$ $\ce{H+}).$ In this case, one mole of molecules $(\ce{H2CO3})$ can result in different total numbers of particles. However, my TA said that $\ce{CO3^2-},$ $\ce{HCO3-},$ and $\ce{H+}$ can be considered as different molecules. I still don't satisfy with his answer though.
{ "domain": "chemistry.stackexchange", "id": 12766, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "colligative-properties", "url": null }
complexity-theory, np-complete, np-hard Title: If a problem is Cook-NP hard, and this problem is in NP, does it prove that the problem is Karp-NP-complete? I got recently confused when I noticed that there exists 2 types of polytime reductions, which lead to 2 different concepts of NP-hardness. This is well explained in the answer to this question: Can one show NP-hardness by Turing reductions? While a Karp reduction is required to show whether a problem is NP-Hard or co-NP-Hard, with Cook (aka Turing) reductions one only shows that a problem is "Cook-NP-hard", in a sense which does not distinguish NP-hardness from co-NP-hardness. More precisely,
{ "domain": "cs.stackexchange", "id": 10165, "lm_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, np-hard", "url": null }
newtonian-mechanics, velocity, rotation, rotational-kinematics These two southward pushes when the weight points east or west counteract the northward pushes when the weight points north or south. The change in velocity after a whole rotation is zero.
{ "domain": "physics.stackexchange", "id": 31952, "lm_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, velocity, rotation, rotational-kinematics", "url": null }
cuboid was a box you could think of it as the amount of space inside of it. Surface Area = 2(|*w + w * h + |*h ) Volume = L* W * H. Note: The Mathematics Lesson Plan given below is just an example. Volume of a Cube Calculator. You can change the Name, Class, Course, Date, Duration, etc. 2020 16:29, Arealbot. Opposite sides have the same area. For prisms, the formulas are derived by taking the area of the shape at the end, and multiplying that times the figure’s height. To do this, I put a, b and c as 3 separate sides of the parallelepiped. Cuboid is a convex polyhedron bounded by six quadrilateral faces, whose polyhedral graph is the same as that of a cube. The height of cuboid is 3 cm. Why show ads? Report Ad. concrete MJ/kg to MJ/m2. Example 8: The surface areas of the three coterminous faces of a cuboid are 6, 15 and 10 cm2 respectively. (Sometimes the word 'cuboid' has a more general meaning. There are no awards for this game!. Cube: \(6s^2$$ where $$s$$ is the length of one edge.
{ "domain": "caffeparty.it", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.980280871316566, "lm_q1q2_score": 0.8125928572894333, "lm_q2_score": 0.8289388083214156, "openwebmath_perplexity": 876.1001154440027, "openwebmath_score": 0.6718249917030334, "tags": null, "url": "http://caffeparty.it/qhoc/area-of-cuboid.html" }
java This is the first of two times that you read the same file. List<String> list = new ArrayList<String>(); try (BufferedReader in = new BufferedReader(new FileReader(IN_FILE_NAME))) { for (String str = in.readLine(); str != null; str = in.readLine()) { list.add(str); } } Using the try-with-resources form will ensure that file is closed whether you are successful in reading the file or not. The original version only closed the file if successful. For some reason, you read the entire file and throw away the result. If you would keep the result, then you don't have to read the file again. Moved the list out of the try scope so that it would persist. Now we don't need scan.
{ "domain": "codereview.stackexchange", "id": 26832, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java", "url": null }
Aaron plays the sports in the set A = { football, baseball, tennis } and Bryce plays the sports in the set B = { basketball, football, soccer, rugby }. He only owns 3 of the 5, but he wants all 5. Well, simply put, it's a collection. The whole set of The Mysteries of Michael contains Key, Hound, Fish, Cow, and Bike. How many boxes are empty?? In sets it does not matter what order the elements are in. Lets get started! But {1, 6} is not a subset, since it has an element (6) which is not in the parent set. No, not the order of the elements. c. Set-builder notation: Set 1 and set 4 can be written as { x / x is a letter of the modern English alphabet} and { x / x is a type of sausage} { x / x is a letter of the modern English alphabet} is read, " The set of all x such that x is a letter in the modern English alphabet. Of 375 musicians at a high school, some play only in the jazz band, some play only for the marching band, and some do both. Well, that part comes next. First we specify a
{ "domain": "org.es", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9648551556203816, "lm_q1q2_score": 0.814236534820446, "lm_q2_score": 0.8438950966654772, "openwebmath_perplexity": 1090.1124140499783, "openwebmath_score": 0.39895138144493103, "tags": null, "url": "http://www.evia.org.es/71pwkxe/6e8955-what-is-set-in-math" }
cc.complexity-theory, conditional-results "If pigs could fly, horses would sing" type of connections are ok, too, as long as the flying pigs come from complexity theory, and the singing horses from some field of math outside of computer science. This question is in some sense "the converse" of a question we had about surprising uses of mathematics in computer science. Dick Lipton had a blog post exactly along these lines: he writes about consequences of the conjecture that factoring has large circuit complexity. The consequences are that certain diophantine equations have no solutions, a kind of statement that can very hard to prove unconditionally. The post is based on work with Dan Boneh, but I cannot locate a paper.
{ "domain": "cstheory.stackexchange", "id": 3889, "lm_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, conditional-results", "url": null }
ros, ardent Original comments Comment by Dirk Thomas on 2018-04-04: Have you tried to build the two package (matrix2_msgs and matrix2_ros) in a normal workspace without the ExternalProject? If no, you might want to try that first. If yes, maybe sharing the code will allow others to comment / provide feedback. Comment by kutschkem on 2018-04-05: @Dirk Thomas I see a similar problem happened when you tried to build code related to this issue https://github.com/ros2/rclcpp/issues/240#issuecomment-232439715 , did you ever figure out what caused that linking problem? The problem here was that matrix2_msgs was not being linked into matrix2_ros. Since the compiler generates an actual instance of the template method, it is not found in rmw_fastrtps_cpp (which defines the template), but instead in matrix2_msgs__rosidl_typesupport_cpp (which instantiates the template).
{ "domain": "robotics.stackexchange", "id": 30537, "lm_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, ardent", "url": null }
Remark Replying to comments, below I show how the inductive proof of the linked Power Rule can be expressed without knowledge of congruences, using analogous divisibility rules. \begin{align}{\bf Divisibility\ Product\ Rule}\ \ \ \ &m\mid \ a\ -\ b\qquad {\rm i.e.}\quad \ \ a\,\equiv\, b\\ &m\mid \ \ A\: -\: B\qquad\qquad \ A\,\equiv\, B\\ \Rightarrow\ \ &\color{}{m\mid aA - bB}\quad \Rightarrow\quad aA\equiv bB\!\pmod{\!m}\\[.2em] {\bf Proof}\,\ \ m\mid (\color{#0a0}{a\!-\!b})A + b(\color{#0a0}{A\!-\!B}) &\,=\, aA-bB\ \ \text{by\,m\,$divides$\rm\color{#0a0}{green}terms by hypothesis.}\end{align} \begin{align}{\bf Divisibility\ Power\ Rule}\qquad &m\mid a\ -\ b\qquad {\rm i.e.}\qquad a\equiv b\\ \Rightarrow\ \ & m\mid a^n-b^n\quad\ \Rightarrow\quad\,\ \ a^n\!\equiv b^n\pmod{\!m} \end{align} Proof $\$ The base case $\,n=0\,$ is $\,m\mid 1-1\,$ so true, and the inductive step follows by applying the Product Rule, namely $\ m\mid a- b,\,a^n- b^n \Rightarrow\, m\mid a^{n+1}-b^{n+1}.\,$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9822876987039989, "lm_q1q2_score": 0.820685196942615, "lm_q2_score": 0.8354835330070839, "openwebmath_perplexity": 834.9521838044379, "openwebmath_score": 0.9147459864616394, "tags": null, "url": "https://math.stackexchange.com/questions/2425275/how-to-prove-82n-52n-is-divisible-by-13-where-n-in-mathbbn-0/2425333" }
At each observation $$(t_i,y_i)$$, we define a residual, $$y_i - f(t_i)$$. A sensible formulation of the fitting criterion is to minimize $R(c_1,\ldots,c_n) = \sum_{i=1}^m\, [ y_i - f(t_i) ]^2,$ over all possible choices of parameters $$c_1,\ldots,c_n$$. We can apply linear algebra to write the problem in the form $$R=\mathbf{r}^T \mathbf{r}$$, where $\begin{split}\mathbf{r} = \begin{bmatrix} y_1 \\ y_2 \\ \vdots \\y_{m-1} \\ y_m \end{bmatrix} - \begin{bmatrix} f_1(t_1) & f_2(t_1) & \cdots & f_n(t_1) \\[1mm] f_1(t_2) & f_2(t_2) & \cdots & f_n(t_2) \\[1mm] & \vdots \\ f_1(t_{m-1}) & f_2(t_{m-1}) & \cdots & f_n(t_{m-1}) \\[1mm] f_1(t_m) & f_2(t_m) & \cdots & f_n(t_m) \\[1mm] \end{bmatrix} \begin{bmatrix} c_1 \\ c_2 \\ \vdots \\ c_n \end{bmatrix}.\end{split}$ Recalling that $$\mathbf{r}^T\mathbf{r}=\| \mathbf{r} \|_2^2$$, and renaming the variables to standardize the statement, we arrive at the general linear least-squares problem. Definition 3.1.3 :  Linear least-squares problem
{ "domain": "tobydriscoll.net", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9820137884587394, "lm_q1q2_score": 0.8327160346684382, "lm_q2_score": 0.8479677622198946, "openwebmath_perplexity": 689.8994636173056, "openwebmath_score": 0.8324900269508362, "tags": null, "url": "https://tobydriscoll.net/fnc-julia/leastsq/fitting.html" }
ruby, ruby-on-rails The else false isn't being used for anything Move "rescinded" logic to invoice instead of querying invoice and then comparing with a string. use Array#reject to eliminate rescinded invoices Add method to the Invoice class class Invoice def rescinded? current_status == "rescinded" end end and then in your method def current_invoice rescinded_invoices = invoices.reject &:rescinded? raise "Only one non-rescinded invoice association per contract" if rescinded_invoices.length == 1 rescinded_invoices.first end EDIT for clarity: def current_invoice non_rescinded_invoices = invoices.reject &:rescinded? raise "Only one non-rescinded invoice association per contract" if non_rescinded_invoices.length > 1 non_rescinded_invoices.first end
{ "domain": "codereview.stackexchange", "id": 6177, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ruby, ruby-on-rails", "url": null }
python, tkinter, minesweeper window.startbutton = Button(text = "Start", command = lambda: setupwindow.onclick(window)) window.startbutton.grid(column = 2) window.root.mainloop() def onclick(window): setupwindow.verification(window) if window.verf == "Y": window.finish = "Y" window.root.destroy() return window def verification(window): height = window.entry[0].get() width = window.entry[1].get() mines = window.entry[2].get() window.verf = "N" if height.isdigit() and width.isdigit() and mines.isdigit(): height = int(height) width = int(width) mines = int(mines) if height > 0 and height <= 24: totalsquares = height * width if width > 0 and width <= 48:
{ "domain": "codereview.stackexchange", "id": 33555, "lm_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, tkinter, minesweeper", "url": null }
homework-and-exercises, forces, classical-mechanics, torque In my opinion, to compute torque, it is more straightforward to consider the lever as the segment joining the rotation axis and the point where the force is applied, and then to take into account only the component of the force orthogonal to the lever. The radial component of a force does not contribute to torque. Therefore, $r$ is the lever (distance between the point $A$ and the center of the circle, that I will call $O$) and $m\vec{g}$ has to be projected along the distance orthogonal to $AO$. Consequently, when calculating the torque due to gravity, the lever is $r$ itself, but the force is not $mg$ but rather $mg\sin\alpha$, where $\alpha$ is the angle between the segment $AO$ and the vector $m\vec{g}$, highlighted in red in the following figure. The components of $m\vec{g}$ are drawn in orange.
{ "domain": "physics.stackexchange", "id": 90256, "lm_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, forces, classical-mechanics, torque", "url": null }
beginner, ruby, api, networking, ip-address def deleteARecord(ipAddress, hostname, domain) record = "#{hostname}.#{domain}" puts "deleting a-record #{record}" resolver = Dnsruby::Resolver.new(dnsserver) update = Dnsruby::Update.new(domain) # delete record puts "update.delete(#{record})" update.delete(record) # send update begin reply = resolver.send_message(update) puts "Update succeeded" rescue Exception => e puts "Update failed: #{e}" end end
{ "domain": "codereview.stackexchange", "id": 17225, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "beginner, ruby, api, networking, ip-address", "url": null }
doppler-effect If we want this wave to change correctly under change of frame of reference, we need to impose something like $$\omega t - k x + \phi_0 = \omega' t' - k' x' + \phi_0'.$$ Since we know the relation between space and time for the different frames of reference from the Lorentz transformation, we can use that in our equation $$\omega t - k x + \phi_0 = \omega' \gamma(t - vx) - k' \gamma(x - vt) + \phi_0'\\ = \gamma(\omega' + k'v) t - \gamma(\omega' v + k')x.$$ By comparison, we need (recalling that $k = \frac{\omega}{c}$) $$\omega = \gamma(\omega' + k'v) = \gamma \omega' (1 + v/c) $$ Solving for $\omega'$ $$\omega' = \frac{\omega}{\gamma (1 + \frac{v}{c})} = \omega\frac{\sqrt{1 - \frac{v^2}{c^2}}}{1 + v/c} = \omega \frac{\sqrt{(1-\frac{v}{c})(1 + \frac{v}{c})}}{\sqrt{(1-\frac{v}{c})^2}}=\omega \sqrt{\frac{1 + \frac{v}{c}}{1 - \frac{v}{c}}} = \omega \sqrt{\frac{c + v}{c - v}}$$ Or equivalently, $$\nu = \nu_0 \sqrt{\frac{c + v}{c - v}}.$$
{ "domain": "physics.stackexchange", "id": 99306, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "doppler-effect", "url": null }
regular-languages, finite-automata We follow the standard definition for deterministic finite-state automata except that we allow the state-transition function $\delta$ to be a partial function. In other words, an FSM has a finite number of states with transitions between them. We define the depth of a state $s$ as the length of the shortest path from the start state (at depth zero) to $s$. A state $q$ is considered accessible if there is a path from the start state to $q$. A state $q$ is called co-accessible if there is a path from $q$ to a final state. Finally, an automaton is called trim if all its states are both accessible and co-accessible. This is defined here. Consider the minimal trim deterministic finite-state automaton $A$ for the language $$\cup_{i=1}^{p} L_i \circ L'_i$$ We observe that this language is finite. Can we conclude that the number of states in $A$ at level $n$ is $p$? We are given three additional constraints:
{ "domain": "cs.stackexchange", "id": 21146, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "regular-languages, finite-automata", "url": null }
machine-learning, time-series, cross-validation With randomly generated data like in @etiennedm's example (to debug split, I covered simple cases such as when the test sample begins before the training samples or just after). from sklearn.model_selection import GridSearchCV from sklearn.ensemble import RandomForestClassifier df = generate_fake_random_dataframe() grouped_ts_validation_iterator = build_grouped_ts_validation_iterator(df) gridsearch = GridSearchCV(estimator=RandomForestClassifier(), cv=grouped_ts_validation_iterator, param_grid={}) gridsearch.fit(df[['feat0', 'feat1', 'feat2', 'feat3', 'feat4']].values, df['label'].values) gridsearch.predict([[0.1, 0.2, 0.1, 0.4, 0.1]]) The implementation : import pandas as pd import numpy as np from sklearn.model_selection import RepeatedKFold
{ "domain": "datascience.stackexchange", "id": 9236, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "machine-learning, time-series, cross-validation", "url": null }
visible-light, light-pollution, observational-astronomy Title: Light pollution calculation using camera Is it possible to calculate light pollution values using camera (analyzing camera feed) integrated in new smartphones (8 Mpx camera) but with pretty decent accuracy? Or that is only possible with special equipment? Using google I found something on that subject here : http://www.sciencebuddies.org/science-fair-projects/project_ideas/Astro_p022.shtml. But they are using professional digital cameras. Thank you in advance! This question really boils down to a more general one: What degree of photometric precision can be achieved by a smartphone camera? To put this question in context, let me give a brief explanation of what is fundamentally different about a scientific image sensor versus a consumer grade sensor.
{ "domain": "physics.stackexchange", "id": 2194, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "visible-light, light-pollution, observational-astronomy", "url": null }
reference-request, soft-question, optimization, big-list, big-picture Title: What are some good references for mathematical optimization for the layman? I've been getting myself involved with this topic and would like to read more to gain a conceptual understanding of the various techniques and what each one is trying to achieve and their 'idea' behind achieving it. Basically the 'big-picture' view of things excluding the complicated math if possible. I've read numerous articles on the web and TCS too :) but still would like to know some good references for the layman (i.e. if you were to explain the various concepts/ideas to your wife/mother/child what you recommend them?) I know they wouldn't all be listed in one book but even if they are spread out across books that's fine. I'm quite interested in learning about nonlinear programming, semi-definite programming, convex optimization, I'm fairly well versed with linear/integer programming and do have a decent background in algorithms and a strong CS background too :)
{ "domain": "cstheory.stackexchange", "id": 1756, "lm_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, soft-question, optimization, big-list, big-picture", "url": null }
The notation for the floor function is: floor(x) = ⌊x⌋ Examples Floor(2.1) = ⌊2.1⌋ = 2 Floor … PostgreSQL - CAST vs :: operator on LATERAL table function. What should be the graph of $[y]=[\sin x]$? The notation for the floor function is: floor(x) = ⌊x⌋ Examples Floor(2.1) = ⌊2.1⌋ = 2 Floor (3) = ⌊3⌋ = 3 Learn Desmos: Functions. Why are Stratolaunch's engines so far forward? It is not difficult to show that $\lfloor x\rfloor=\lfloor y\rfloor$ if and only if $(x-\lfloor y\rfloor)(y-\lfloor x\rfloor)\ge0$. FLOOR(x) rounds the number x down.Examples. How do rationalists justify the scientific method. Is whatever I see on the internet temporarily present in the RAM? How can I deal with claims of technical difficulties for an online exam? FLOOR function Description. The Floor Function and the Ceiling Function Main Concept The floor of a real number x , denoted by , is defined to be the largest integer no larger than x . For example, mod(6,4) will show the remainder of 6 divided by 4 and
{ "domain": "greenbirdit.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9585377272885903, "lm_q1q2_score": 0.8089052974358638, "lm_q2_score": 0.843895106480586, "openwebmath_perplexity": 1096.1523227406492, "openwebmath_score": 0.2347310334444046, "tags": null, "url": "http://greenbirdit.com/kmqv9o/tth1uxx.php?id=floor-function-desmos-643a98" }
And angles - all circumradius of isosceles triangle one place, the ratio of the isosceles triangle the circumference of circumradius! Quadratic equation for the circumradius and inradius is ( B ) ( C /2! The area of an isoceles triangle is 8 cm C ) /2 ( D 1:44... The amount circumradius of isosceles triangle region enclosed by it in a right-angled isosceles triangle circumference... Sides by 10 sides meet triangle calculate inradius and circumradius of triangle arc.Therefore, by AA similarity so! Who thought they were religious fanatics of OAB=30 find the circumradius of an isosceles is... Url into your RSS reader = B car axles and turn them into electromagnets to help charge the?... 2 } } { 2h } } { 2h } }. an answer to mathematics Stack Exchange a! Were religious fanatics ca n't we wrap copper wires around car axles and turn into! This circle is: a 2 2 h Not every polygon has a circle... Inside or outside of the triangle screen sharing, copy and paste this URL into your RSS reader
{ "domain": "shukunegi.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9621075701109193, "lm_q1q2_score": 0.8270890038451219, "lm_q2_score": 0.8596637523076225, "openwebmath_perplexity": 1297.089643252442, "openwebmath_score": 0.4381413161754608, "tags": null, "url": "http://shukunegi.com/m7x5i/page.php?page=f7ae6f-circumradius-of-isosceles-triangle" }
approximation-hardness Let $G = (V,E)$ be an instance of Max-Cut. We construct $A$, $B$, and $C$ as follows: $A$ contains two vertices, $a_{u,v}$ and $a_{v,u}$, for each $(u,v) \in E$. $B$ contains two vertices, $b_{u,v}$ and $b_{v,u}$, for each $(u,v) \in E$. $C$ contains one set $c_v$ for each $v \in V$. $c_v := \bigcup_{u \in \mathcal{N}(v)} \{a_{u,v}, a_{v,u}, b_{u,v}\}$, where $\mathcal{N}(v)$ denotes the neighborhood of $v$ in $E$. Every subset of $C$ naturally corresponds to a collection of vertices from $V$ (i.e. via the subscripts). Call the set of vertices in this solution $V_C$. Now for every edge $(u,v) \in E$, we count how many vertices from $\{a_{u,v}, a_{v,u}, b_{u,v}, b_{v,u}\}$ belong to $S = \left(A\cap \left(\bigcup_{c \in C} c\right)\right) \cup \left(B \setminus \left(\bigcup_{c \in C} c\right)\right)$.
{ "domain": "cstheory.stackexchange", "id": 4683, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "approximation-hardness", "url": null }
training, pytorch, graphs, matplotlib, vgg16 for batch_idx, (data, target) in enumerate(loaders['valid']): # move to GPU if use_cuda: data, target = data.cuda(), target.cuda() ## update the average validation loss output = model(data) loss = criterion(output, target) valid_loss = valid_loss + ((1 / (batch_idx + 1)) * (loss.data - valid_loss)) print('Valid Loss ', valid_loss) # print training/validation statistics print('\n') print('Epoch: {} \tTraining Loss: {:.6f} \tValidation Loss: {:.6f}'.format( epoch, train_loss, valid_loss )) print('\n') ## save the model if validation loss has decreased if valid_loss <= valid_loss_min: print('Validation loss decreased ({:.6f} --> {:.6f}). Saving model..'.format(valid_loss_min, valid_loss)) torch.save(model.state_dict(), save_path) print('Model Saved')
{ "domain": "datascience.stackexchange", "id": 9410, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "training, pytorch, graphs, matplotlib, vgg16", "url": null }
javascript, performance, jquery, css, memory-management }, { duration: _settings.animationSpeed, complete: function(){ _currentSlide.css({ top: 0 }); /* make target slide to appear on top of stack after animation */ while(_getCurrentSlide().data('index') != _targetSlideIndex){ _currentSlide = _getCurrentSlide().detach().prependTo(_wrapper); } _currentSlide = _getCurrentSlide(); _stopCarousel(); } }) } } function _fade(direction){ if(direction==1){ _currentSlide.css({ opacity: 0 }) .animate({ opacity: 1 }, { duration: _settings.animationSpeed, complete: function(){ _stopCarousel(); } }) }else{ _currentSlide .animate({ opacity: 0 }, { duration: _settings.animationSpeed, complete: function(){ _currentSlide.css({ opacity: 1 }); /* make target slide to appear on top of stack after animation */ while(_getCurrentSlide().data('index') != _targetSlideIndex){
{ "domain": "codereview.stackexchange", "id": 17038, "lm_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, performance, jquery, css, memory-management", "url": null }
of the central angles in any circle is 360°. The diagram shows a 400-m running track. The top part of the door is a semicircle. By that logic, the arc length of a quarter circle is exactly 1/4 of the circumference of a circle. If a circle has a circumference of 8. Arcs are measured in two ways: as the measure of the central angle , or as the length of the arc itself. So that's straightforward, area 36pi, we leverage pi r squared to figure out that the radius was 6, and then from that we were able to figure out that the circumference was 12pi. 7 cm Length of Y 3. Find the circumference of the object. You can also select units of measure for both input data and results. What is the arc-length of a semi-circle with radius of 6 cm? (to 2 decimal places) A car wheel has a circumference of 1. show your working. Angle in a semicircle We want to prove that the angle subtended at the circumference by a semicircle is a right angle. Program to calculate Area and Circumference based on user input.
{ "domain": "milanoporteeserramenti.it", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9907319871663826, "lm_q1q2_score": 0.8820429569942798, "lm_q2_score": 0.8902942152065091, "openwebmath_perplexity": 427.07611142392966, "openwebmath_score": 0.8478139638900757, "tags": null, "url": "http://milanoporteeserramenti.it/tec/circumference-of-a-semicircle-calculator.html" }
ros-indigo ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu trusty-security main restricted deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted deb http://security.ubuntu.com/ubuntu trusty-security universe deb-src http://security.ubuntu.com/ubuntu trusty-security universe deb http://security.ubuntu.com/ubuntu trusty-security multiverse deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
{ "domain": "robotics.stackexchange", "id": 32641, "lm_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-indigo", "url": null }
computational-chemistry \begin{align}\mathbf H &=\begin{bmatrix} \dfrac{\partial ^2 E}{\partial q_1 \partial q_1} & \dfrac{\partial ^2 E}{\partial q_1 \partial q_2} & \dfrac{\partial ^2 E}{\partial q_1 \partial q_3} & \dots & \dfrac{\partial ^2 E}{\partial q_1 \partial q_9} \\ \dfrac{\partial ^2 E}{\partial q_2 \partial q_1} & \dfrac{\partial ^2 E}{\partial q_2 \partial q_2} & \dfrac{\partial ^2 E}{\partial q_2 \partial q_3} & \dots & \dfrac{\partial ^2 E}{\partial q_2 \partial q_9}\\ \vdots & \vdots & \vdots & \ddots & \vdots \\ \dfrac{\partial ^2 E}{\partial q_9 \partial q_1} & \dfrac{\partial ^2 E}{\partial q_9 \partial q_2} & \dfrac{\partial ^2 E}{\partial q_9 \partial q_3} & \dots & \dfrac{\partial ^2 E}{\partial q_9 \partial q_9} \end{bmatrix}\\ \\ &=\underset{\mathbf P}{\begin{bmatrix} q_{11} & q_{12} & q_{13} & \dots & q_{19} \\ q_{21} & q_{22} & q_{23} & \dots & q_{29} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ q_{91} & q_{92} & q_{93} & \dots & q_{99}
{ "domain": "chemistry.stackexchange", "id": 4970, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "computational-chemistry", "url": null }
java, performance, primes, sieve-of-eratosthenes /** * Returns an array of primes upto the given inclusive limit. * <p> * <h2>Time complexity:</h2> * O(n) * <h2>Space complexity:</h2> * O(n) * * @param limit The inclusive upper limit. * @return An array of primes upto the given inclusive limit. */ public static long[] getPrimesTill(int limit) { boolean[] isPrime = siftTill(limit); // 1st pass: count the number of primes int count = 0, index = 0; for (int i = 2; i <= limit; i++) { if (isPrime[i]) count++; } long[] primes = new long[count]; // 2nd pass: store the primes for (int i = 2; i <= limit; i++) { if (isPrime[i]) primes[index++] = i; } return primes; } }
{ "domain": "codereview.stackexchange", "id": 16740, "lm_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, primes, sieve-of-eratosthenes", "url": null }
image-processing, edge-detection \end{array} } \right] $$ $$ \mathbf{K_x} = \left[ {\begin{array}{cc} +1 & +2 & 0 & -2 & -1\\ +4 & +8 & 0 & -8 & -4\\ +6 & +12 & 0 & -12 & -6\\ +4 & +8 & 0 & -8 & -4\\ +1 & +2 & 0 & -2 & -1\\ \end{array} } \right] $$ This article demonstrates how to get Sobel gradient operators analytically. For that was using linear approximation of brightness in window 3x3. Every pixel in window has its own weight. Special weight matrix selection gives Sobel gradient operator.
{ "domain": "dsp.stackexchange", "id": 3584, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "image-processing, edge-detection", "url": null }
rust, heap #[cfg(test)] mod test { use super::*; #[test] fn push_test() { let mut heap: MaxHeap<i32> = MaxHeap::new(); heap.push(3); heap.push(2); assert_eq!(vec![3, 2], heap.data); } #[test] fn root_node_is_always_the_biggest_element_in_heap_after_push_test() { let mut heap: MaxHeap<i32> = MaxHeap::new(); heap.push(5); heap.push(10); heap.push(2); assert_eq!(10, heap.data[0]); heap.push(3); assert_eq!(10, heap.data[0]); heap.push(20); assert_eq!(20, heap.data[0]); } #[test] fn pop_always_pop_the_root_node() { let mut heap: MaxHeap<i32> = MaxHeap::new(); heap.push(10); heap.push(4); heap.push(7); heap.pop(); assert!(!heap.data.contains(&10)); }
{ "domain": "codereview.stackexchange", "id": 41390, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "rust, heap", "url": null }
python, python-3.x, file-system what happens here is that the two files are open at the same time, and since wrong is a generator, it will read one line, in this case word, at the time. If the currently written word is in english it yield it and write it to the file. Pythons enumerate builtins purpose is for these kinda situations, where you want to iterate over something while still keeping track of the rounds. You should also make it a habit to protect your main function by, if __name__ == '__main__': main() to avoid executing self written programs when importing them. Putting it all together: def main(): with open("wordlist", "r") as f: english = {word.strip() for word in f} with open("check", "r") as f: with open("output", "w") as output: wrong = (x.strip() for x in f if x.strip() not in english) for key, word in enumerate(wrong): output.write("{}: {}\n".format(key, word)) if __name__ == '__main__': main()
{ "domain": "codereview.stackexchange", "id": 22936, "lm_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, file-system", "url": null }
c#, design-patterns, entity-framework-core var transaction = new Transaction() { BankAccountId = bankAccount.Id, Amount = amount, TransactionDateTime = DateTime.Now, TransactionType = TransactionType.Deposit }; ctx.Transactions.Add(transaction); trans.Commit(); ctx.SaveChanges(); } catch { trans.Rollback(); } } } } public void WithdrawAmount(BankAccount bankAccount, int amount) { using (var ctx = new AppDbContext()) { using (var trans = ctx.Database.BeginTransaction()) { try { bankAccount.Withdraw(amount); ctx.BankAccounts.Update(bankAccount);
{ "domain": "codereview.stackexchange", "id": 35734, "lm_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#, design-patterns, entity-framework-core", "url": null }
svm, terminology We introduce slack variables to make the data linearly separable
{ "domain": "datascience.stackexchange", "id": 11896, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "svm, terminology", "url": null }
physical-chemistry, thermodynamics, free-energy $$dA = dU - TdS - SdT = \delta q - TdS + \delta w - SdT.$$ If we consider only $PdV$ work, we obtain $$dA = \delta q - TdS - PdV - SdT$$ and at constant $T$ and $V$, we get $$dA = \delta q -TdS.$$ The criterion $dA <0$ for spontaneous processes then follows from the Clausius inequality. These two equations seem to be contradictory, so I was hoping someone could explain how this can be reconciled. Thank you so much! Clarification: The way I derived the $dA = -PdV - SdT$ for an arbitrary process is as follows: For a function $f(x_1,\dots,x_n)$, the complete differential of $f$ is $$df = f_1 dx_1 + f_2 dx_2 + \dots + f_n dx_n$$ where $$f_i = \left(\frac{\partial f}{\partial x_i}\right)_{x_j \: j\neq i}.$$ Consider the function $$g = f - f_1 x_1.$$ The differential of $g$ is $$dg = df - f_1 dx_1 -x_1df_1$$ so that $$dg = -x_1 df_1 + f_2 dx_2 + \dots + f_n dx_n.$$ Now, applying this to the special case of internal energy $U(S,V)$, if we define
{ "domain": "chemistry.stackexchange", "id": 17677, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "physical-chemistry, thermodynamics, free-energy", "url": null }
optics, quantum-optics $$T_{p,q}:\operatorname{span}(\{\hat{X}_p,\,\hat{X}_q\})\to \operatorname{span}(\{\hat{X}_p,\,\hat{X}_q\})$$ and this restricted linear operator is wholly defined by $$T_{p,q}(\hat{X}_p) = \ell_{p,p} \hat{X}_p+\ell_{q,p} \hat{X}_q$$ $$T_{p,q}(\hat{X}_q) = \ell_{p,q} \hat{X}_p+\ell_{q,q} \hat{X}_q$$ and, moreover, the $2\times 2$ matrix $\Lambda_{p,q}=\left(\begin{array}{cc}\ell_{p,p}&\ell_{q,p}\\\ell_{p,q}&\ell_{q,q}\end{array}\right)\in U(2)$ and is unitary. So the images of $\hat{X}_p$ and $\hat{X}_q$ define the matrix $T_{p,q}$. (The weird ordering of the indices in the off diagonal terms will become clearer below). So, how do we write the matrix of $T_{p,q}$? Well, we write the image of $\hat{X}_j$ in the $j^{th}$ column. So all the columns of $T_{p,q}$ aside from the $p^{th}$ and $q^{th}$ column are simply what they would be in the identity matrix, since the image of $\hat{X}_j$ is $\hat{X}_j$. This leaves the last two columns, the columns $p$ and $q$. For column $p$:
{ "domain": "physics.stackexchange", "id": 19255, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "optics, quantum-optics", "url": null }
python, beginner, python-3.x, tic-tac-toe if __name__ == "__main__": retry = True while retry: try: winner = main() message = f"{winner.name} won!" if winner else "WOW! You guys are good! DRAW!!!" print(message) retry = ask_retry() except GameEnd: print("Thanks for playing! Exiting") retry = False testing By separating the methods like this, you can easily test them with unit tests. For code like this, which is 140 lines long, you can easily test it by hand, but if you want to incorporate changes later, like varying board sizes, a working, complete test suite will be a great help in spotting bugs.
{ "domain": "codereview.stackexchange", "id": 33130, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, beginner, python-3.x, tic-tac-toe", "url": null }
c++, c++11, parsing, csv Firstly, I encapsulate student information in this simple Student class. Student.h #ifndef Student_h #define Student_h #include <string> #include <sstream> class Student { private: std::string firstName; std::string lastName; int id; double gpa; public: Student(std::string studentInformation); std::string getFirstName(); std::string getLastName(); std::string getName(); // returns first name and last name int getId(); double getGPA(); double getSize(); }; #endif Student.cpp #include "Student.h" using namespace std; Student::Student(std::string studentInformation) { stringstream studentStream(studentInformation); // a stream of student information studentStream >> firstName; studentStream >> lastName; studentStream >> id; studentStream >> gpa; } std::string Student::getFirstName() { return firstName; } std::string Student::getLastName() { return lastName; }
{ "domain": "codereview.stackexchange", "id": 18476, "lm_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, parsing, csv", "url": null }
For any $\epsilon >0$ ,and by choosing $\quad \delta =min\left( 1,\epsilon \right)$ and note that if $\left| x-1 \right| <\delta$ the we will get $$\left| \frac { x^{ 2 }+3 }{ x+1 } -2 \right| =\left| \frac { { x }^{ 2 }-2x+1 }{ x+1 } \right| =\left| \frac { { \left( x-1 \right) }^{ 2 } }{ \left( x-1 \right) +2 } \right| <\left| \frac { { \left( x-1 \right) }^{ 2 } }{ \left( x-1 \right) } \right| =\left| x-1 \right| <\epsilon$$ • Thanks! Could you elaborate on why you picked $\delta=*$ and not $\delta \lt*$ Also wow that solution is a beauty – RonaldB Jul 28 '16 at 19:37 • you 're welcome.i think $\delta <1$ also posible.may be because it gives you exact answer we usually write $\quad \quad \delta =min\left( 1,\epsilon \right)$ – haqnatural Jul 28 '16 at 19:44 • If you pick $\delta = \epsilon$, you can relax the first inequality to $\leq$. – harvey Jul 28 '16 at 19:44
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.982013790564298, "lm_q1q2_score": 0.8096329878503216, "lm_q2_score": 0.824461932846258, "openwebmath_perplexity": 370.7983936974538, "openwebmath_score": 0.942685604095459, "tags": null, "url": "https://math.stackexchange.com/questions/1874224/proving-lim-limits-x-rightarrow-1-fracx23x1-2-using-the-formal-defi" }
javascript, mathematics, combinatorics Title: Combinations of elements in array I wrote this code to get all possible arrangements for an array containing 3 elements: let a = ["A", "B", "C"]; let b = []; function change(A) { let x = []; for (let i = 0; i < A.length; i++) { x.push(A[i]); } for (let i = 0; i < x.length; i++) { A[i] = x[i + 1]; if (i == (x.length - 1)) { A[i] = x[0]; } } } function combinations() { for (let i = 0; i < a.length; i++) { b.push([a[0], a[1], a[2]]); b.push([a[0], a[2], a[1]]); change(a); } console.log(b); } combinations();
{ "domain": "codereview.stackexchange", "id": 45517, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, mathematics, combinatorics", "url": null }
c, array, memory-management Modest extreme case: sizeof *arr * row * col is multiplied in the right order. When row or col is int/unsigned, good to use sizeof *arr first as that is type size_t and the subsequent multiplication will then happen at least using size_t math. The concern being that with unsigned row, col, row*col calculated first could overflow using unsigned math, but not size_t math. Pedantically, even sizeof *arr * row * col can overflow. Should code need to detect this, the reasonable approach is to use the widest unsigned types like unsigned long long or uintmax_t. (Other more pedantic methods exist.) assert(1LLU * sizeof *arr * row * col < SIZE_MAX);
{ "domain": "codereview.stackexchange", "id": 20115, "lm_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, array, memory-management", "url": null }
python, python-3.x, image, numpy, tensorflow return outputs def train(self, parser): """ training operation argument of this function are given by functions in main.py Parameters ---------- parser: the paser that has some options """ epoch = parser.epoch l2 = parser.l2 batch_size = parser.batch_size train_val_rate = parser.train_rate output = self.UNet(l2_reg=l2, is_training=self.is_training) loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(labels=self.y, logits=output)) update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS) with tf.control_dependencies(update_ops): train_ops = tf.train.AdamOptimizer(parser.learning_rate).minimize(loss)
{ "domain": "codereview.stackexchange", "id": 34485, "lm_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, image, numpy, tensorflow", "url": null }
newtonian-mechanics, energy, work, potential-energy, conventions Title: Does energy have a sign? Quantities like position and time allow us to place our origin anywhere, but can the same be said for energy? I was thinking about the way we have defined the quantity gravitational potential, and for any finite distance from a 'planet' or a body, an abject would be said to have negative gravitational potential, conveying that a negative amount of work is done (in bringing the object from 'infinity' to that position, but this seems impossible as negative energy does not seem to physically exist (as far as I know). So, does negative energy really exist, or does it not (implying that negative work done is just another mathematical argument)?
{ "domain": "physics.stackexchange", "id": 50239, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, energy, work, potential-energy, conventions", "url": null }
c#, beginner, mysql, dapper public static IEnumerable<T> ExecuteQuery<T>(string sql) { return ExecuteQuery<T>(sql, DefaultConnectionString); } This way you can have two overloads but only one implementation. try { ... } catch { MessageBox.Show("Ups Failed to Connect to the Server"); return null; } are you sure you want to ignore the exception completely by not even showing the Exeption.Message? How will you know what failed exactly? I don't think you should be catching and swallowing exceptions here. Let the caller handle this. Lastly, parameter names should follow camelCase not PascalCase style.
{ "domain": "codereview.stackexchange", "id": 27099, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, beginner, mysql, dapper", "url": null }
c, stack, pointers From a usability perspective, genericness is crucial. A stack that can only store ints is pretty useless. I'd like to expand on Lstor's advice to use void*. A good introduction to it is here http://www.youtube.com/watch?v=iyLNYXcEtWE&feature=PlayList&p=9D558D49CA734A02&index=5. The basics of it are pretty simple though once you wrap your head around it. By using a void*, you essentially treat blocks of memory as blocks of memory and nothing more. A good example of this is void* memcpy(void* dest, const void* src, std::size_t count); in the standard. memcpy doesn't care what the memory is. It doesn't care if it's an int*, a char** or whatever. It just knows that you've handed it a chunk of memory and told it to copy count bytes of it to another block of memory.
{ "domain": "codereview.stackexchange", "id": 4264, "lm_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, stack, pointers", "url": null }
deep-learning, machine-learning-model, memory, time-complexity Model size in terms of the number of parameters - If a perceptron with 5 inputs has 5 trainable weight parameters, then just calculate the total number of trainable parameters in a neural network. This will give you the total number of parameters. This is typically calculated in millions or billions. For eg - In the following image from paper, the author compares his approach with other models using these two metrics.
{ "domain": "datascience.stackexchange", "id": 10306, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "deep-learning, machine-learning-model, memory, time-complexity", "url": null }
classical-mechanics, gravity, statics I tried to get a simple closed form which described the balance angle as a function of w1/w2, but could not in the short time I have to devote to this problem. (Maybe someone can pick up where I left off). What I do have is an equation which describes that relationship, as follows: Let B be the half-length of a balance beam between w1 (on the left) and w2 (on the right). Let H be the height of the fulcrum point (F) above this straight line. (So, lines drawn between points w1, w2 and F make a short, wide triangle.) Let L = the slant distance from F to w1 (and also from F to W2). L = SQRT(B^2 + H^2). If you draw a line through F and parallel to line w1w2 (the base of the triangle) then lines w1F and w2F both make a small angle 'A' (radians) with it. Use the convention that if w1 is heavier, it will cause a positive rotation of the balance beam by an angle of 'D' (radians). By writing and solving a moments eqn around point F, you get the eqn: w1/w2 = (cos(D-A)) / (cos(D+A))
{ "domain": "physics.stackexchange", "id": 10494, "lm_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, gravity, statics", "url": null }
genetics An additional reason why some diseases are expected to occur at elevated frequencies in India is shared descent from a common Indian ancestral population. An example is a 25 base pair deletion in MYBPC3 that increases heart failure risk by about 7-fold, and occurs at around 4% throughout India but is nearly absent elsewhere.
{ "domain": "biology.stackexchange", "id": 302, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "genetics", "url": null }
You will have a proof that the number of recurrence relations that do not contain three consecutive $$1$$s is $$s_n=s_{n-1}+s_{n-2}=s_{n-3}$$. You can also prove directly that the number of sequences that do not contain $$3$$ consecutive zeros is the same as the number of sequences that do not contain $$3$$ consecutive ones. Define the inverse of a bit string as the string in which every character is the opposite. Notice that this operation is a bijection between strings with no $$3$$ consecutive zeros and string with no $$3$$ consecutive ones.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9873750514614409, "lm_q1q2_score": 0.8026049097811975, "lm_q2_score": 0.8128673178375734, "openwebmath_perplexity": 43.85261095255205, "openwebmath_score": 0.7152104377746582, "tags": null, "url": "https://math.stackexchange.com/questions/3635201/recurrence-relation-for-the-number-of-bit-strings-of-length-n-that-do-not-contai/3638380" }
ros, navigation, navfn, move-base, carrot-planner Originally posted by DimitriProsser with karma: 11163 on 2012-03-06 This answer was ACCEPTED on the original site Post score: 8 Original comments Comment by Pi Robot on 2012-03-06: @Procópio Silveira Stein If you'd like some sample code to do the kind of visual servoing that @DimitriProsser describes, you might want to check out the TurtleBot follower program. Assuming you have the turtlebot_apps stack installed, just do a 'roscd turtlebot_follower/src' and look at follower.cpp. Comment by Procópio on 2012-03-06: thanks for your suggestion @Pi Robot
{ "domain": "robotics.stackexchange", "id": 8467, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros, navigation, navfn, move-base, carrot-planner", "url": null }
2020-21: Check Telangana ePASS Dates, Application Status, Eligibility, CSJM University Result 2020: Kanpur University Result BSc 3rd Year Soon, RRB NTPC Admit Card 2020 Date: Download Region-Wise CBT 1 Hall Ticket, Bihar Board Model Paper 2021 For Class 10 & 12: Download BSEB Sample Papers PDF Class 12 & 10, Algebraic Expressions: Definition, Types, Formulas | Practice Important Questions, Types Of Fraction: Fraction Definition & Types (Proper, Improper, Mixed, Like, Unlike Fractions), Algebra Formulas For Class 11: Download Algebraic Identities Class 11 PDF. Can an acute angle be adjacent to an obtuse angle? Obtuse angle. (2).\,\,\, \angle QRP \,=\, 41^° We can observe that the two angles are acute angles. If the sum of two angles equal to 90°, then it is the supplementary angle. Copyright © 2021 Applect Learning Systems Pvt. The sum of the measures of two acute angles is greater than the measure of one obtuse angle. Students can also make use of Class 6 Maths Practical Geometry NCERT
{ "domain": "com.mx", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9748211553734218, "lm_q1q2_score": 0.8226467988861915, "lm_q2_score": 0.8438951025545426, "openwebmath_perplexity": 675.4889749429253, "openwebmath_score": 0.5626471638679504, "tags": null, "url": "http://neurospinegp.com.mx/wp-admin/sushi-go-rdqwc/6e8226-can-an-acute-angles-be-adjacent-to-an-obtuse-angle" }
has two small balls glued to its ends. a) Calculate the torque applied to the disk by the rope. 60-cm-diameter sprocket? Three objects of uniform density—a solid sphere, a solid cylinder, and a hollow cylinder—are placed at the top of an incline (Fig. 1 kg m2 as the skater draws his arms and legs inward toward the axis of rotation. Find the moment of inertia about a diameter?. 85kg and diameter 45. 16 The variation of angular position θ, of a point on a rotating rigid body, with time t is shown in Fig. The moment of inertia of the sphere is I = 2 5 MR2. For a ring let’s assume an element of mass dm on the ring. Answer: (a) Moment of inertia of sphere about any diameter = 2/5 MR 2. The density is then (1) and the moment of inertia tensor is (2) (3) (4). moment of inertia is the same about all of them. none of the above are necessary A common thread spool rests on a flat table. For a solid uniform sphere and a thin hoop, each of mass Mand radius R and rotating about their respective
{ "domain": "venetoacquaeterme.it", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9875683465856102, "lm_q1q2_score": 0.850827865008135, "lm_q2_score": 0.8615382094310357, "openwebmath_perplexity": 240.6116665009223, "openwebmath_score": 0.5893383622169495, "tags": null, "url": "http://vkwf.venetoacquaeterme.it/show-that-the-moment-of-inertia-of-a-uniform-solid-sphere-rotating-about-a-diameter-is.html" }
condensed-matter, symmetry, electronic-band-theory, topological-insulators [ The symmetry shown in the band structure here is not the consequence of inversion symmetry or time-reversal symmetry but the structure of hexagon lattice. If the fermion system really has time-reversal symmetry (the Kane-Mele model for example), all kinds of band structures (zigzag, armchair, etc) will be symmetric around the origin because the time-reversal partner for an eigenstate is also an eigenstate for the system with the same eigenenergy but opposite crystal momentum. Besides, as far as I know, the inversion symmetry will not lead to apparent symmetry for band structures.
{ "domain": "physics.stackexchange", "id": 67021, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "condensed-matter, symmetry, electronic-band-theory, topological-insulators", "url": null }
particle-physics, cosmology, dark-matter, wimps 1 There is an assumption that the gas has thermalized hidden here, I think that is OK, but I'm not a dark matter guy. 2 If you want to take a crack at $f$, the simplest estimator would involve a weak-universality computation. In essence getting the phase space available to the products. 3 The observationally interesting unit, I think. 4 I believe the current best guess involves at least two different temperature regimes present at once.
{ "domain": "physics.stackexchange", "id": 24512, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "particle-physics, cosmology, dark-matter, wimps", "url": null }
compilers cause any lexical error ? I am confused. Which error message is generated by which phase of a compiler depends on the underlying language structure and implementation of the compiler. Nevertheless, lexical analyzer is responsible for generating tokens, so at this phase you could check if some lexeme/token is valid or not. For example, you could check if the symbol $ belongs to the source language. It is similar to reading an English text and checking if words belong to the English dictionary. The syntax analyzer on the other hands checks if the sequence of tokens constitutes a legal program structure by analyzing the sequence of tokens (not characters). For example, it may check if a curled left bracket may follow the if keyword, or what token should follow what token in general. It is similar reading reading an English text and checking if "He/She" may be followed by a verb.
{ "domain": "cs.stackexchange", "id": 10000, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "compilers", "url": null }
ros, ros-melodic, ubuntu, docker, libopencv Original comments Comment by gvdhoorn on 2018-11-14: Something to consider: if a ROS node has a dependency on OpenCV, and they're not in the same image, how is the ROS node going to be linked against / use OpenCV? Comment by skr_robo on 2018-11-14: @gvdhoom Based on the research I have done so far, I believe the three isolated entities I have mentioned in the question should be three different containers within same image. I think the networking and interfacing abilities of Docker would handle how ROS talks to OpenCV libraries. Comment by gvdhoorn on 2018-11-14: So saying that you'd like three "isolated entities" with "one each for ROS, OpenCV and Deep Learning Libraries" to me implies that you'll have 3 images. They are only isolated if they don't derive from each other, in which case anything in image A cannot use anything from image B. This makes .. Comment by gvdhoorn on 2018-11-14: .. linking/using OpenCV with ROS rather difficult.
{ "domain": "robotics.stackexchange", "id": 32041, "lm_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-melodic, ubuntu, docker, libopencv", "url": null }
java, beginner, morse-code "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."}; String[] morseNumber = {".----", "..---", "...--", "....-", ".....", "-....", "--...", "---..", "----.", "-----"};
{ "domain": "codereview.stackexchange", "id": 34131, "lm_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, morse-code", "url": null }
electromagnetism Title: How is a magnetic field concentrated by iron? We use iron inside the cores of electromagnets because it will "amplify" the magnetic field. How is this possible without any side effect? It seems like it would be free energy, but that cannot be possible. You can think of iron (and similar materials) "amplifying" magnetic fields by bunching up their field lines closer together within the material. The total number of field lines (i.e. energy) is still conserved. In order to have a higher intensity magnetic field at one point in space, you will necessarily have a lower intensity magnetic field at other points in space (as compared to the case in which there were no iron). You're just redirecting where the lines of magnetic field go.
{ "domain": "physics.stackexchange", "id": 43832, "lm_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 }
machine-learning, neural-network, deep-learning, data-mining, smote ~\AppData\Local\Continuum\anaconda3\lib\site-packages\imblearn\base.py in fit_resample(self, X, y) 86 if self._X_columns is not None: 87 X_ = pd.DataFrame(output[0], columns=self._X_columns) ---> 88 X_ = X_.astype(self._X_dtypes) 89 else: 90 X_ = output[0] ~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\generic.py in astype(self, dtype, copy, errors, **kwargs) 5863 results.append( 5864 col.astype( -> 5865 dtype=dtype[col_name], copy=copy, errors=errors, **kwargs 5866 ) 5867 )
{ "domain": "datascience.stackexchange", "id": 7034, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "machine-learning, neural-network, deep-learning, data-mining, smote", "url": null }
navigation, clearpath, jackal, topic-tools, move-base Originally posted by Procópio with karma: 4402 on 2018-02-08 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by piraka9011 on 2018-02-08: Since this launch file is being used by other packages, wouldn't I have to make sure that all the other packages can 'see' it? How would I tell the launch file to change its 'include' launch file?
{ "domain": "robotics.stackexchange", "id": 29965, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "navigation, clearpath, jackal, topic-tools, move-base", "url": null }
machine-learning, nlp, gensim Such that for the sentence "The nose is leaking blood after head injury" i would like to get the sentence with the highest similarity score ( i guess that it will bring sentences with words like leak or even synonyms like dripping?) . But the sentence i get back are unrelated and change each iteration of model.infer_vector(test_data) Any idea about what is wrong? Doc2Vec (and words vectors) need significant amount of data to learn useful vector representation. 50k sentences is not sufficient for this. To overcome this, you can feed word vectors as initial weights in Embedding Layer of network. For example, code from following question : How to implement LSTM using Doc2Vec vectors? model_doc2vec = Sequential() model_doc2vec.add(Embedding(voacabulary_dim, 100, input_length=longest_document, weights=[training_weights], trainable=False)) model_doc2vec.add(LSTM(units=10, dropout=0.25, recurrent_dropout=0.25, return_sequences=True)) model_doc2vec.add(Flatten())
{ "domain": "datascience.stackexchange", "id": 4926, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "machine-learning, nlp, gensim", "url": null }
general-relativity, curvature, tensor-calculus, metric-tensor Title: What are the local covariant tensors one can form from the metric? Normally in differential geometry, we assume that the only way to produce a tensorial quantity by differentiation is to (1) start with a tensor, and then (2) apply a covariant derivative (not a plain old partial derivative). Applying this to GR, I think one way of stating the equivalence principle is that the only tensorial object that we expect to be "built in" to the vacuum is the metric. Since the covariant derivative is basically defined as a derivative that produces zero when you apply it to the metric, this means that you can't get anything of interest (i.e., local and tensorial) by appying the process described by #1 and #2 to the vacuum. This can be used as a fancy way of arguing that the Newtonian gravitational field $\mathbf{g}$ isn't a tensor, since in the Newtonian limit, it's essentially the gradient of the metric.
{ "domain": "physics.stackexchange", "id": 8275, "lm_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, curvature, tensor-calculus, metric-tensor", "url": null }
design-patterns, vb.net However, sample2 may not be appropriate enough for your concrete requirements. If you give more code clues on what happens in the method in question, then a more-accurate advice can be given.
{ "domain": "codereview.stackexchange", "id": 3562, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "design-patterns, vb.net", "url": null }
pathfinding, groovy def findPath(map) { /** * Validate the map. */ map.with { def size = getAt(0).size() def invalidRows = it.findAll { row -> row.size() != size } if(invalidRows) throw new IllegalArgumentException("The map $it contains the following invalid rows: $invalidRows") it.join().split('').countBy { it }.with { counts -> if(counts.S > 1) throw new IllegalArgumentException("The map $it contains multiple start positions.") if(counts.E > 1) throw new IllegalArgumentException("The map $it contains multiple end positions.") if(!counts.S) throw new IllegalArgumentException("The map $it is missing the start position.") if(!counts.E) throw new IllegalArgumentException("The map $it is missing the end position.") } } /** * Get the start and end locations. */ def (startLocation, endLocation) = { markers -> def locations = markers.clone()
{ "domain": "codereview.stackexchange", "id": 17155, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "pathfinding, groovy", "url": null }
speed-of-light For more material see: https://en.wikipedia.org/wiki/Expansion_of_the_universe and: https://en.wikipedia.org/wiki/Hubble_volume
{ "domain": "physics.stackexchange", "id": 63101, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "speed-of-light", "url": null }
java, beginner, game-of-life } public static void main(String[] args) { } private class ListenForButton implements ActionListener{ public void actionPerformed(ActionEvent e){ String xString = e.getActionCommand(); String yString = e.getActionCommand(); int index = xString.indexOf(','); xString = xString.substring(0, index); String yStringRemove = xString; xString = xString.replace("(", ""); int x = Integer.parseInt(xString); yString = yString.replace(yStringRemove, ""); yString = yString.replace(",", ""); yString = yString.replace(")", ""); int y = Integer.parseInt(yString); ((JButton)e.getSource()).setEnabled(true); if(e.getSource() == grid[x][y]){
{ "domain": "codereview.stackexchange", "id": 5133, "lm_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, game-of-life", "url": null }
cosmology, astrophysics, big-bang, cosmological-inflation, cosmic-microwave-background The idea is that the universe started out as a really hot soup of ions (where the atomic nuclei and electrons wouldn't stay together because they had too much energy). Photons couldn't get very far before being absorbed or scattered by these ions and electrons. But once the universe expanded and cooled a little more, neutral atoms could form. And atoms are far less efficient at absorbing and scattering photons than ions are. So any photon anywhere in the universe was suddenly unlikely to get scattered and absorbed. (Except for absorption by unusually dense clumps of matter like stars and big dust clouds, but we know that most of the universe is empty of those things.)
{ "domain": "physics.stackexchange", "id": 8023, "lm_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, astrophysics, big-bang, cosmological-inflation, cosmic-microwave-background", "url": null }
exoplanet, radial-velocity Title: What are the challenges in finding Earth-like planets via the radial velocity method? [I have re-asked this, because it was a good question by @Banyan, which was deleted whilst I was composing an answer.] Most exoplanets that are found by the radial velocity ("Doppler wobble") technique are quite massive - Jupiter/Saturn-like objects. What are the principle challenges in extending this technique to finding Earth-like exoplanets? Assuming a circular orbit of a planet of mass $m_p$ around a star of mass $m_*$, with an orbital period of $P$ and we can assume that $m_* \gg m_p$ for the case of an Earth-like planet. Newton's second law tells us that $$ m_p a \frac{4\pi^2}{P^2} = G\frac{m_* m_p}{a^2}\ , \tag*{(1)}$$ where $a$ is the orbital radius. The observed radial velocity amplitude of the star will be $$ K \simeq \frac{2\pi a}{P} \left(\frac{m_p}{m_*}\right)\sin i\ , $$ where $i$ is the orbital inclination. Replacing $a$ using eqn. (1)
{ "domain": "astronomy.stackexchange", "id": 5232, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "exoplanet, radial-velocity", "url": null }
reinforcement-learning, policy-gradients Analysis on Policy Difference Equation. This source explains also how from the "time description" you get to the "state visitation distribution" description that confused you. p. 20 There are plenty of other sources that have detailed derivation of the specific lemma. If you are interested in RL theory then this paper by Kakade is a review of various such methods such as the Conservative Policy Iteration which is the algorithm that the teacher is trying to get to.
{ "domain": "datascience.stackexchange", "id": 10957, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "reinforcement-learning, policy-gradients", "url": null }
electrostatics, mathematical-physics, boundary-conditions I'm a little confused how Griffiths uses this theorem in examples: In the classic image problem (finding the potential due to a point charge $q$ a distance $d$ above an infinite, grounded conducting plane), the trick is to forge the original problem and the configuration of $q$ and its mirror image of the point charge $q$ through the plane (and this new charge is $-q$). The boundary conditions are given ($V=0$ on the plane, and $V\rightarrow 0$ far from the point charge), but how do we know that the charge distribution $\rho$ is the same in this second scenario as it is in the first? This is a typical case of a problem which is clear enough physically speaking, but mathematically messy. Where rigorous results are folkloristically employed to achieve some result which, actually, would need much more care in deriving it... But presumably, mathematical details would not change the physical picture. Here the difference between theoretical physics and mathematical physics evidently shows
{ "domain": "physics.stackexchange", "id": 16430, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electrostatics, mathematical-physics, boundary-conditions", "url": null }
(force or torque) which causes unit deformation (shift or turning) of the spring. Vibration of Mechanical Systems Figure 7. A block of mass M is attached to a spring of mass m and force constant K. 5 p 7 i 8: @ xi A yi B T is the position of the i-th mo vable spring-mass. 5 m d 2 p C i D dt2 is the inertial force for the i-th mo vable spring-mass. ME8230 Nonlinear Dynamics Prof. A 1-kg mass stretches a spring 20 cm. For example, if I have spring and I pull on it slightly (a small distance x on the figure below), it will undergo oscillations that are nice and regular. *cos (w*t), y (0) = 0. The system is attached to a dashpot that imparts a damping force equal to 14 times the instantaneous velocity of the mass. The analytical solution can describe both stable and unstable behaviors of the vibration system and therefore offer a comprehensive understanding of the nonlinear responses. Chakraverty 1, * Abstract: The dynamic analysis of damped structural system by using finite element method
{ "domain": "acpm.it", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9895109081214212, "lm_q1q2_score": 0.8329956528383808, "lm_q2_score": 0.8418256393148982, "openwebmath_perplexity": 937.6084491184243, "openwebmath_score": 0.5827639102935791, "tags": null, "url": "http://iquk.acpm.it/nonlinear-spring-mass-system.html" }
machine-learning, neural-network, tensorflow # Initializing the variables init = tf.initialize_all_variables() # Launch the graph with tf.Session() as sess: sess.run(init) # Fit all training data for epoch in range(training_epochs): for (x, y) in zip(train_X, train_Y): sess.run(optimizer, feed_dict={X: x, Y: y}) # Display logs per epoch step if epoch % display_step == 0: cost = sess.run(l2_loss, feed_dict={X: train_X, Y: train_Y}) print("cost=%s\nW1=%s" % (cost, sess.run(W1))) print("Optimization Finished!") print("cost=%s W1=%s" % (sess.run(l2_loss, feed_dict={X: train_X, Y: train_Y}), sess.run(W1))) # "b2=", sess.run(b2) # Get output and plot it ys_pred = [] ys_truth = [] test_X = [] for x in range(-40, 40): test_X.append(float(x))
{ "domain": "datascience.stackexchange", "id": 623, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "machine-learning, neural-network, tensorflow", "url": null }
javascript, performance, node.js, base64 const atob = (str) => Buffer.from(str, 'base64').toString(); const decodeObject = obj => { return Object .entries(obj) .reduce((c, ([key, value])) => ({ ...c, [key]: decode(value) }), {}) } const decodeArray = array => { return array.map(v => decode(v)) } const decodeString = str => atob(str) const decode = value => { return value == null ? null // weed out null and undefined early : typeof value === string ? decodeString(value) : typeof value === 'object' ? decodeObject(value) : typeof value === 'array' ? decodeArray(value) : value // Dunno what to do, leave it alone. }
{ "domain": "codereview.stackexchange", "id": 41676, "lm_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, performance, node.js, base64", "url": null }
python, object-oriented, chess def __init__(self): """ Initialises the Board class. """ self.squares = [] self.turn = WHITE self.initialise_squares() self.read_fen(FEN) self.draw() def initialise_squares(self): """ A method for creating the squares of the board. """ for row in range(8): for col in range(8): self.squares.append(Square(col, row)) def draw(self): """ A method that draws the board. It uses the Board.squares list and draws each of them, iterating through rows and columns and fetching each square. It then assigns the colour of the square, creates and assigns a canvas, binds the functions on clicking to the canvases, and then draws the piece.
{ "domain": "codereview.stackexchange", "id": 41894, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, object-oriented, chess", "url": null }
java, performance In most languages the variable name i is 'reserved' for indexed looping through data, just like you have for (int i = 0; i < len; i++) {...}. It is standard to use j and k as the variable names for any inner/nested loops you need. i is the top level, j is the first nested level, k is the subsequent level, and, if you need more than that, you should be calling a function/method (Never use l as a variable name, it is too easy to confuse with 1). You are breaking this convention by using j as an array, and going immediately to k inside your loop. My suggestion is to rename j to be data, and to rename k to be j.
{ "domain": "codereview.stackexchange", "id": 5683, "lm_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", "url": null }
string-theory, partition-function For example, the first excited level of both CFTs, one with $E_8\times E_8$ (HE) and one with $SO(32)$ (HO), contains $248+248=32\times 31/(2\times 1)=496$ states (and therefore the corresponding operators $K_i$, $i=1,2,\dots, 496$, assigned by the state-operator correspondence) that transform as the adjoint of the gauge group. These $K_i(z)$ operators may become factors in the vertex operators in string theory (the operators encoding the external gauge bosons and their superpartners). The scattering amplitudes involving two gauge bosons (and something else) are integrals of integrands that are proportional to the correlators $$\langle K_i(z_1) K_j(z_2) \cdot \cdots \rangle $$ perhaps with some additional operators. But these correlators may be computed if you replace the $KK$ according to the OPEs (operator product expansions). These OPEs will also contain terms proportional to $K_k$ operators themselves: $$ K_i(z_1) K_j(z_2) \sim \frac 1{z_1-z_2} f_{ij}{}^k K_k(z_2) $$
{ "domain": "physics.stackexchange", "id": 11463, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "string-theory, partition-function", "url": null }
performance, c, memory-optimization Title: WAVE to FLAC encoder in C This is a .wav to .flac encoder that I wrote a little while ago. The only method that is really called is encode(), which takes in a .wav file, converts it to FLAC, and stores it in the .flac file that is taken in as a parameter. I would prefer suggestions on how to improve the method, decrease run-time, or cut down on the length of the code. Any other suggestions are acceptable though. The header file (encode.h): #include <FLAC/stream_encoder.h> int encode(const char *wavfile, const char *flacfile); static void progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data); The encoding program: #include <stdio.h> #include <stdlib.h> #include <string.h> #include "encode.h" #define READSIZE 1020
{ "domain": "codereview.stackexchange", "id": 5620, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "performance, c, memory-optimization", "url": null }
php, api, unit-testing } Is this a good design? Can I improve this design in order to make future additions more testable? Is this the common practice for removing a dependency on an external server for the sake of my unit tests? Yes, it looks like a reasonable design and approach. At the nit-pick level getMockedRequestor should be private or protected, to document that it is a helper for the tests. Also, if every test is going to be calling it, some people might move that code into setUp(). But that only saves one line ($requestor = $this->getMockedRequestor();) in each unit test, so I'd keep it where it is: I like to avoid using member variables, but that is personal preference. You could use the phpUnit mock interface, but you don't have to. It gives you some very useful things, such as when you say you expect a function to be called once with "Hello World": $requestor->expects($this->once()) ->method('afunction') ->with($this->equalTo('Hello World'));
{ "domain": "codereview.stackexchange", "id": 2300, "lm_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, api, unit-testing", "url": null }
thermodynamics, entropy, reversibility One often feels that heat flow is "spontaneous" and therefore irreversible, but this no more true of heat flow than it is of mechanical work when a volume changes. If there is a tiny pressure difference between two side of a friction-less barrier, then the barrier will move "spontaneously", only of course it is not so much spontaneous as dictated by the pressure difference. If that pressure difference is vanishingly small then such a process is thermodynamically reversible. Similar statements apply to heat flow when it is taking place slowly and without restriction. The word "slowly" here means that the relevant systems move through a sequence of equilibrium states so the process is called quasistatic; the phrase "without restriction" is needed to say that there is no thermally insulating barrier or something like that, which could create a temperature gradient. One can say the same thing by saying "without hysteresis". These are various different ways of expressing the same concept.
{ "domain": "physics.stackexchange", "id": 76366, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics, entropy, reversibility", "url": null }
ros, gazebo, sdf, ros-groovy Title: gazebo confliction in groovy When I command roslaunch pr2_gazebo pr2_empty_world.launch
{ "domain": "robotics.stackexchange", "id": 14614, "lm_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, gazebo, sdf, ros-groovy", "url": null }
performance, array, vba, modules Base 1 I know I brought Option Base 1 up, but you should probably avoid changing the default base because it can get confusing to read arrays defined starting at "1" if you expect them to start at "0". Overall, I think you did a pretty good job of explaining the arrays, so maybe get rid of the Option and just change your iterations e.g. For i = LBound(finalArray, 1) + 1 To UBound(finalArray, 1) + 1 But, since your arrays pulled from the sheet starts with 1 instead of 0, I don't think you actually need to change the iteration, or even have the Option because the arrays are arr(1 to x) which clearly starts at 1. The only array with a problem is columnsToKeepArray - For j = (LBound(columnsToKeepArray) + 1) To (UBound(columnsToKeepArray) + 1) tempArr(i, j) = dataArray(i, columnsToKeepArray(j - 1)) Next j Just replace that and delete the Option Base 1.
{ "domain": "codereview.stackexchange", "id": 29485, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "performance, array, vba, modules", "url": null }
# Changing from quadratic formula to standard form. The graph of a quadratic function has $x$-intercepts $-1$ and $3$ and a range consisting of all numbers less than or equal to $4$. Determine an expression for the function. This is my problem. I know what the graph looks like, but I only know quadratic formula and every time I input that into WolframAlpha, it combines my terms to create a different graph. I looked up the answer to this problem to check, and the answer is $-x^2+2x+3$. The only form I know is $y=af(bx+c)+d$. So how would I get that answer from this question without using $y=af(bx+c)+d$?
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9822876992225168, "lm_q1q2_score": 0.803093348980218, "lm_q2_score": 0.8175744739711883, "openwebmath_perplexity": 423.66229388215356, "openwebmath_score": 0.878683865070343, "tags": null, "url": "http://math.stackexchange.com/questions/180100/changing-from-quadratic-formula-to-standard-form" }
quantum-mechanics, interference, double-slit-experiment, diffraction, wave-particle-duality In the classic double-slit arrangement, the two slits are purposely made as narrow as possible so as to better approximate two single sources and are spaced apart by such a distance as to furnish the most dramatic phase cancellation pattern for demonstration purposes.
{ "domain": "physics.stackexchange", "id": 89573, "lm_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, interference, double-slit-experiment, diffraction, wave-particle-duality", "url": null }
javascript, php, html, security, sql-injection Please let me know in the comments if there is any further information I can provide. Edit: Please see the comments below before submitting an answer. While I've made posts about this subject before, the answers that I received on them derailed from the original inquiry. I understand that this is not the way to do things, but I would prefer to unless this opens up a security risk. If this is the case, please let me know. Otherwise, I would appreciate an answer regarding the <script>alert('xssvuln');</script> submissions that I was receiving. It is commendable to be concerned about security. But don’t let the fear of the unknown cripple you. The attack First, hackers typically go for the low-hanging fruit. They will use known exploits and search for code that is vulnerable. They’re looking for careless mistakes. This particular one is probing to see if they can inject javascript and have it executed. For example, this code would be vulnerable: if($_POST['message']) {
{ "domain": "codereview.stackexchange", "id": 40295, "lm_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, php, html, security, sql-injection", "url": null }
special-relativity, spacetime, reference-frames, acceleration Title: What is concept of left region of rindler space-time? A accelerated object follow a hyperbolic path in a Minkowski spacetime diagram. Minkowski spacetime has two regions: left (I) and right (II) regions of Rindler spacetime, as it is shown in the picture below. What is the concept of the left region of the Rindler diagram? What is the concept of AntiRob shown in the picture? As mentioned in the answer by Dale, you can choose many different coordinates in Minkowski spacetime (in fact, in any spacetime). While many presentations of Special Relativity focus only on Cartesian coordinates, choices of coordinates are arbitrary.
{ "domain": "physics.stackexchange", "id": 92433, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "special-relativity, spacetime, reference-frames, acceleration", "url": null }
We can represent this conditional statement as $$P \to Q$$ where $$P$$ is the statement, “It is not raining” and $$Q$$ is the statement, “Daisy is riding her bike.” Although it is not a perfect analogy, think of the statement $$P \to Q$$ as being false to mean that I lied and think of the statement $$P \to Q$$ as being true to mean that I did not lie. We will now check the truth value of $$P \to Q$$ based on the truth values of $$P$$ and $$Q$$. 1. Suppose that both $$P$$ and $$Q$$ are true. That is, it is not raining and Daisy is riding her bike. In this case, it seems reasonable to say that I told the truth and that$$P \to Q$$ is true. 2. Suppose that $$P$$ is true and $$Q$$ is false or that it is not raining and Daisy is not riding her bike. It would appear that by making the statement, “If it is not raining, then Daisy is riding her bike,” that I have not told the truth. So in this case, the statement $$P \to Q$$ is false.
{ "domain": "libretexts.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9845754504074422, "lm_q1q2_score": 0.8267814474688453, "lm_q2_score": 0.8397339656668286, "openwebmath_perplexity": 132.42719216959972, "openwebmath_score": 0.7440686821937561, "tags": null, "url": "https://math.libretexts.org/Bookshelves/Mathematical_Logic_and_Proof/Book%3A_Mathematical_Reasoning_-_Writing_and_Proof_(Sundstrom)/1%3A_Introduction_to_Writing_Proofs_in_Mathematics/1.1%3A_Statements_and_Conditional_Statements" }
evolution, zoology, development, sensation This experiment suggests that birds are imprinted to recognize specific patterns and interpret them as mother. I'm in trying to create a similar experiment for cats. To do so I'm trying to understand if cats other small predators (ferrets,etc) are imprinted in a similar way - do cats recognize specific features of a bird to identify it as "bird", "prey" or "can hunt and eat"? I'm talking about stuff like - do they recognize eyes, beaks, wings or tail in a special way? To paraphrase the question: If I'm to create a stick like above, but for cats, what features would be painted on the stick?
{ "domain": "biology.stackexchange", "id": 3180, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "evolution, zoology, development, sensation", "url": null }
php, repository, laravel, e-commerce Title: eCommerce project using the Repository pattern I am currently working on an eCommerce project in Laravel 5.1. I have implemented Repository Pattern by learning from this site only for 1 model, namely, Carousel just to test myself as I am still at the learning stage. Now I want my code to be reviewed, before moving on to the next part of my project. CarouselRepositoryInterface.php <?php namespace App\Repositories\Contracts; use App\Http\Requests\CarouselRequest; interface CarouselRepositoryInterface { public function getAllCarousels($fromDeleted = false, $fromLatest = true); public function storeNew(CarouselRequest $request); public function find($id, $fromDeleted = false, $fromLatest = true); public function update($id, CarouselRequest $request); public function deleteTemporarily($id); public function restore($id); public function deletePermanently($id); } CarouselRepository.php <?php namespace App\Repositories\Eloquent;
{ "domain": "codereview.stackexchange", "id": 16570, "lm_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, repository, laravel, e-commerce", "url": null }
pauli-gates, optimization, annealing, qaoa Can QAOA be realy considered as a simulation of quantum annealer on gate-based universal quantum computer? What I am missing in discussion above concerning commutation of Pauli matrices? Or is there any condition for matrices $A$ and $B$ allowing equality $\mathrm{e}^{A+B}=\mathrm{e}^A\mathrm{e}^B$? If you use infinite depth then QAOA can be consider as quantum annealer on gate-based. The authors of QAOA original paper probably deduce it from quantum annealing. What I mean by infinite depth is you take $p \to \infty$ in the operator $$U(\beta, \gamma) = \Pi_{i=1}^p U_B(\beta_i)U_C(\gamma_i) $$ Your are right about the commutation problem. However, remember that $$ \lim_{p \to \infty} \big(e^{A/p}e^{B/p} \big)^p = e^{A+B} $$ so in a sense, at infinite limit depth, it is not a problem. So you recover the quantum annealing approach.
{ "domain": "quantumcomputing.stackexchange", "id": 1984, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "pauli-gates, optimization, annealing, qaoa", "url": null }
c, sorting Any suggestions/constructive criticism are very welcome. I'm a beginner, please point out any mistakes I made. The Swap It's the good old "arithmetic swap", a variant of the XOR-swap that uses addition and subtraction instead of XOR. It avoids naming a temporary variable, which was not a significant cost, and instead introduces a handful of extra operations.. and the potential for integer overflow (admittedly it is likely to work in practice, and will work for this example thanks to the small numbers). Here's the assembly for that kind of swap vs a "traditional swap", as compiled by Clang: swap: # @swap movsxd rax, esi mov esi, dword ptr [rdi + 4*rax] movsxd rcx, edx mov edx, dword ptr [rdi + 4*rcx] cmp esi, edx je .LBB0_2 add edx, esi mov dword ptr [rdi + 4*rax], edx sub edx, dword ptr [rdi + 4*rcx] mov dword ptr [rdi + 4*rcx], edx
{ "domain": "codereview.stackexchange", "id": 43357, "lm_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, sorting", "url": null }
mobile-robot, design, legged Stability: Bird-like robots often have a lower center of gravity and a wider base due to their legs being angled outward, which can provide better stability than humanoid robots with vertically aligned legs. This stability can make it easier for bird-like robots to maintain balance, especially on uneven terrain. This would simplify the control system and/or control algorithms required, possibly requiring fewer and/or less complex sensors that add additional weight. Passive dynamics: Bird-like robots can take advantage of passive dynamics, which rely on the robot's mechanical design and natural forces like gravity to conserve energy while walking or running. For example, the inverted pendulum model used in bird-like robots can result in efficient gait patterns that minimize energy consumption. This would lead to much longer battery life, assuming the robot is untethered.
{ "domain": "robotics.stackexchange", "id": 2690, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "mobile-robot, design, legged", "url": null }