text
stringlengths
49
10.4k
source
dict
(1) The median of set {x,−1,1,3,−x} is 0 (2) The median of set {x,−1,1,3,−x} is x2 Merging similar topics. Please refer to the solutions above. _________________ GMAT Club Legend Joined: 09 Sep 2013 Posts: 15958 Re: What is the value of x? [#permalink] ### Show Tags 09 Jun 2017, 15:49 Hello from the GMAT Club BumpBot! Thanks to another GMAT Club member, I have just discovered this valuable topic, yet it had no discussion for over a year. I am now bumping it up - doing my job. I think you may find it valuable (esp those replies with Kudos). Want to see all other topics I dig out? Follow me (click follow button on profile). You will receive a summary of all topics I bump in your profile area as well as via email. _________________ Re: What is the value of x?   [#permalink] 09 Jun 2017, 15:49 Similar topics Replies Last post Similar Topics: 3 What is the value of x + 7 ? 14 01 Jul 2014, 10:06 31 What is the value of integer x ? 11 15 Feb 2016, 09:11 8 What is the value of x? 6 05 May 2016, 14:17 4 What is the value of x/yz? 10 16 Sep 2016, 15:54 7 What is the value of x? 9 19 Feb 2014, 00:14 Display posts from previous: Sort by
{ "domain": "gmatclub.com", "id": null, "lm_label": "1. Yes\n2. Yes\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9702399008908849, "lm_q1q2_score": 0.8265985966748293, "lm_q2_score": 0.8519527963298947, "openwebmath_perplexity": 1752.9844269451694, "openwebmath_score": 0.8106594085693359, "tags": null, "url": "https://gmatclub.com/forum/what-is-the-value-of-x-143334.html" }
c#, object-oriented, linq, mvc, entity-framework Personally I would go with the second approach because of the increased flexibility it will bring in the game. Small nitpicking aside from the mentioned points: Let your variables and operators some space to breathe. Here public class PersonListViewModel { IEnumerable<Person> PersonsList { get; set; } public PersonListViewModel(PersonProvider Provider, int NationalityId) { PersonsList = Provider.GetPersonList(p=>p.NationalityId == NationalityId); } } this would be more readable if you add a space after p and after => like so public class PersonListViewModel { IEnumerable<Person> PersonsList { get; set; } public PersonListViewModel(PersonProvider Provider, int NationalityId) { PersonsList = Provider.GetPersonList(p => p.NationalityId == NationalityId); } }
{ "domain": "codereview.stackexchange", "id": 16055, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, object-oriented, linq, mvc, entity-framework", "url": null }
(define (pascal n) (if (= n 0) n (+ (* (pascal (- n 1)) 2) 1))) Bill the Lizard said... sethreno, "a procedure that computes elements of Pascal's triangle" is a little ambiguous. If I were teaching a course using SICP, I'd accept that interpretation of the question. However, your solution is off by one. > (pascal 0) 0 > (pascal 1) 1 > (pascal 2) 3 > (pascal 3) 7 > (pascal 4) 15 If you want the sum of all the elements in the nth row of Pascal's triangle, just raise 2 to the nth power. al said... I was returning 0 if the column is greater than the row so I would get correct result for correct input and 0 for incorrect input. Returning #f is probably a better option since 0 is a response and calling the procedure with a column greater than the row should probably not give a response. Once again, very useful post. Фёдор Ананьев said... Oh thank you. Solved this exercise myself before and managed to do it in three times more lines. What a shame. tokland said... In fact values "outside" the triangle are zeros, no need to return an special value. Anonymous said... Hey Bill, I recently discovered your blog and I love it. I recently started reading SICP and your solutions and explanations are a great help. I also love your lecture notes. I don't know if you already knew this but there is another (iterative) way to calculate the elements of the Pascal's triangle. I give my code below. (define (pascal2 r c) (define (iter col val) (if (= col c) (/ (* val (- (+ r 1) col)) col) (iter (+ col 1) (/ (* val (- (+ r 1) col)) col)))) (cond ((or (< c 0) (> c r)) 0) ((or (= c 0) (= c r)) 1) (else (iter 1 1))))
{ "domain": "billthelizard.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9744347860767305, "lm_q1q2_score": 0.8431044505872826, "lm_q2_score": 0.8652240895276223, "openwebmath_perplexity": 3240.2836922074657, "openwebmath_score": 0.5678353905677795, "tags": null, "url": "http://www.billthelizard.com/2009/11/sicp-exercise-112-pascals-triangle.html" }
waves, frequency Title: How does the diameter have any effect on the first harmonic frequency? The answer is C. What I don't understand is how the diameter would have any effect on the first harmonic frequency as the formula $$f=\frac{1}{2L}\sqrt{\frac{T}{\mu}}$$ The key is that $\mu$ is the linear density of the string, i.e. the mass per unit length. Both strings are made of the same material, so they have the same density $\rho$. The mass of a cylinder of density $\rho$, length $L$, and diameter $d$ is $\frac{\pi}{4}\rho d^2L$. This means that the linear density is $$\mu=\frac{m}{L}=\frac{\pi}{4}\rho d^2$$
{ "domain": "physics.stackexchange", "id": 67348, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "waves, frequency", "url": null }
electromagnetism, vector-fields, magnetostatics Title: Are there cases where $\nabla\cdot\iiint\frac{\mathbf{J}(\mathbf{x}')}{\left|\mathbf{x}-\mathbf{x'}\right|}\mathrm{d}V' \neq 0$? In Jackson's Classical Electrodynamics, Section 5.4 (Vector Potential), the author seems to assume that because $\nabla\cdot\mathbf{J} = 0$, the following holds for the current density (where the integral is done over all space): $$\nabla\cdot\iiint\frac{\mathbf{J}(\mathbf{x}')}{\left|\mathbf{x}-\mathbf{x'}\right|}\mathrm{d}V' = 0$$ However, in general we know that in a closed volume $V$, we have: $$\nabla\cdot\iiint\limits_V\frac{\mathbf{J}(\mathbf{x}')}{\left|\mathbf{x}-\mathbf{x'}\right|}\mathrm{d}V' = \iiint\limits_V\nabla\cdot\frac{\mathbf{J}(\mathbf{x}')}{\left|\mathbf{x}-\mathbf{x'}\right|}\mathrm{d}V' = \iiint\limits_V\mathbf{J}(\mathbf{x}')\cdot\nabla\left(\frac{1}{\left|\mathbf{x}-\mathbf{x'}\right|}\right)\mathrm{d}V'$$
{ "domain": "physics.stackexchange", "id": 59050, "lm_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, vector-fields, magnetostatics", "url": null }
space (3d). The Distance between Two Points in Space. For two points P 1 = (x 1, y 1) and P 2 = (x 2, y 2) in the Cartesian plane, the distance between P 1 and P 2 is defined as: Example : Find the distance between the points ( − 5, − 5) and (0, 5) residing on the line segment pictured below. The coefficients of the two planes are the same. The proof of this theorem is left as an exercise. Thomas Thomas. The expression (x 2 - x 1) is read as the change in x and (y 2 - y 1) is the change in y.. How To Use The Distance Formula. Example 3: Find the distance between the planes x + 2y − z = 4 and x + 2y − z = 3. 1 times 2 minus 2 times-- I'm going to fill it in-- plus 3 times something, minus 5. It can be found starting with a change of variables that moves the origin to coincide with the given point then finding the point on the shifted plane + + = that is closest to the origin. Vector form and in the complex plane if the line intersects the plane negative! = 4 and x + 2y − z = 4 and x + 2y − z = 3 set! And is given by the formula an online Geometry tool requires coordinates of 2 points in the.. The important topics covered in Class 10 Maths Chapter 7 if the line intersects the plane using the.! From point P to the distance between this point to a line and use the formula these formulas a... Of this Theorem is left as an exercise it looks like your line '' is given by formula... One side of the plane obviously the distance between two neighbouring planes within the set. One vector from the other to get an absolute distance two neighbouring planes the. As between lines and planes going to fill it in -- plus 3 times 1 is to calculate the between... To the distance from this point to a plane is given by the formula surface that extends infinitely.... A plane, we extend this to the distance formula is a flat, two-dimensional surface that infinitely... Given by the formula for the distance between two planes is made simple with a diagram their! Vector form and in the complex plane, say, P = ( 4, 0, 0 ) answered... (
{ "domain": "designtemple.se", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9865717452580316, "lm_q1q2_score": 0.8284578040603712, "lm_q2_score": 0.8397339656668287, "openwebmath_perplexity": 226.09025006307743, "openwebmath_score": 0.7681993842124939, "tags": null, "url": "https://designtemple.se/4dx1qg03/85bcb3-distance-between-two-planes-formula" }
kinect, openni Title: OpenNI Kinect Choosing Subjects for Tracking Is it possible to modify the openni_kinect code so that you can give a set of coordinates and it will search for people to track between those coordinates? Also, is it possible to modify it so that if something that is not a person is being tracked, you can tell it to stop tracking it? It seems as though the program currently just tracks what it wants to. Originally posted by qdocehf on ROS Answers with karma: 208 on 2011-08-16 Post score: 0 The features you talk about are not supported by the openni_kinect stack. It sounds more like an application you want to build using the openni_kinect driver. Originally posted by Wim with karma: 2915 on 2012-03-06 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 6430, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "kinect, openni", "url": null }
### Subject:Differential Equations TutorMe Question: Find the general solution $$y = f(x)$$ to the differential equation $$dy + y^3 \, dx = 0$$. Luke B. It looks like a good candidate for separation of variables, so first divide it by $$y^3$$ to obtain $$y^{-3} \, dy + dx = 0.$$ Next integrate the equation (remembering the integration constant $$C$$) to obtain $$\frac{y^{-2}}{-2} + x = C.$$ Finally, carry out some algebraic manipulations to put it into the desired form. $$y^{-2} -2x = -2C$$ $$y^{-2} = 2 \left(x - C\right)$$ $$y^2 = \frac{1}{2 \left( x - C\right)}$$ Square roots generally need to be treated carefully. In this case, either the square root or its negative is a solution. (This can be seen by considering $$\left(-y\right)^{-3} \, d(-y) = y^{-3} \, dy$$.) So the general solution to the differential equation can be written as $$y(x) = \frac{\pm 1}{2 \left(x - C\right)},$$ where a specific sign would be chosen later when a specific initial value problem needed to be solved. ## FAQs
{ "domain": "tutorme.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9893474888461862, "lm_q1q2_score": 0.81567933224277, "lm_q2_score": 0.8244619220634456, "openwebmath_perplexity": 607.7038516410846, "openwebmath_score": 0.8100588321685791, "tags": null, "url": "https://tutorme.com/tutors/963130/interview/" }
homework-and-exercises, newtonian-mechanics, power, drag, software In reality the acceleration will drop as the power increases, and also the air drag will become significant as the car picks up speed. This means you need to calculate the instantaneous velocity (integrate acceleration, or get it from the GPS chip; in fact on most devices there is a function to calculate velocity that will combine inputs from accelerometer and GPS automatically: if you have that, use it). The total force at a given time is $$F = m\cdot a + \frac12 \rho v^2 A C_D$$ where $m$ = mass of car plus passengers / cargo, $a$ = acceleration, $\rho$ is density of the air (about 1.2 kg/m$^3$), $A$ is the projected area of the car, and $C_D$ is the drag factor. According to this site, the product $A\;C_D$ for the Hyundai Accent is 6.35 feet$^2$ or 0.59 m$^2$. Power is force times velocity, so finally if you have acceleration and velocity, you get power from $$P = v\left(1220 a + 0.25 v^2\right)$$ As you can see, the drag term becomes much more important as velocity goes up. You can also see from this formula how a car (with finite power engine) cannot accelerate so fast when it has higher speed - not only does drag create a force, but the power needed scales with velocity and force. Incidentally, the Hyundai Accent has a rated power of 138 HP, or 103 kW. Looking at this movie it gets from 0 - 60 mph in about 7 seconds for an average acceleration of 3.8 m/s$^2$ - much more at the beginning when speed is slower, and less at the end. You can probably look at that clip frame-by-frame to get the speed/time curve and do the math more carefully.
{ "domain": "physics.stackexchange", "id": 23255, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "homework-and-exercises, newtonian-mechanics, power, drag, software", "url": null }
quantum-mechanics, classical-mechanics, particle-physics The $|m|=1$ case is more complicated to visualize. (And most internet visualizations show the real spherical harmonics, which don't have definite $m$.) The $|m|=1$ wavefunction is nonzero on two cones about the $z$-axis. At a given $\phi$ the two cones are exactly out of phase with each other, but the direction in which the phase advances about the $z$-axis is given by the sign of $m$. So an $\ell=2,m=1$ electron is not orbiting in a skewed plane; it's in a superposition of two nonclassical orbits, parallel to the $x$-$y$ plane but not centered on the nucleus. A surprising image! Perhaps someone will help me make an illustration. These two arguments are all we need to get to higher $\ell$; the only difference is the number of cones, their opening angles, and the presence or absence of a wavefunction component in the $x$-$y$ plane. If there were two electron orbits which had well-defined $m$ in different planes, those orbitals would be eigenstates of projection operators $L_z$ and $L_x$ which do not commute. I think you do not get the privilege of quantizing the spins of each electron in an atom separately, so having electrons in well-defined skewed planes is forbidden.
{ "domain": "physics.stackexchange", "id": 21926, "lm_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, classical-mechanics, particle-physics", "url": null }
algorithms, greedy-algorithms Title: Optimizing greedy solution for choice game Consider the following game: Two players choose numbers from a sequence of integers with even number of elements. The two can only choose from either the front or the end of the sequence. The purpose is to pick a series of numbers that form a sum greater than the opponent's. The first player always starts and tries to beat the second player, which chooses his numbers randomly. Develop a strategy with which the first player always wins. By winning we consider that the first player's sum is greater or at least equal to the second player's sum. My solution (greedy): At each step, P1 chooses the greater number between the front and the end of the sequence. At the end Sum(P1) >= Sum(P2). Example: S: 4 5 3 1 P1: 4 P2: 5 or 1 P1: if P2 picks 1, then P1 picks 5 || if P2 picks 5, then P1 picks 3 P2: picks either 3 or 1, depends on P1's choice Sum(P1) (= 9 or 7) >= Sum(P2) (= 6 or 4) Problem: For certain sequences, the above greedy approach does not compute a greater sum for P1. For S: 1 2 80 3, if P1 will choose 3 as it is greater than 1. If P2 then picks 80, the game is lost for P1. My take on this situation: We scan S for it's greatest numbers and compare them to the greatest sum of numbers chosen up to them and create a strategy for P1 so that he chooses the greater number/ numbers. In the example above we find that 80 > 3 +1 (possible sum up to it), so P1 will first choose 1. This way P2 will have to pick from 5 and 3. After P2 chooses, P1 picks 80 and wins. Thoughts on this? The first player cannot always win – consider the case in which all numbers are the same. But we can always guarantee a draw. Here is the strategy – I'll let you figure out why it works.
{ "domain": "cs.stackexchange", "id": 9923, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "algorithms, greedy-algorithms", "url": null }
slam, navigation How to solve it? Thank you~ Originally posted by sam on ROS Answers with karma: 2570 on 2012-08-25 Post score: 1 Original comments Comment by yigit on 2012-09-16: Duplicate http://answers.ros.org/question/43173/how-to-solve-no-such-file-or-directory-uoptrosfuertestacksopenni_cameralaunchopenni_nodelaunch/ Comment by sam on 2012-09-21: I think not. Because this question also including other problem that which topic should mapping to others or other questions. Is there any list of topic from rgbdslam should map to gazebo kinect and how? Thank you~ Comment by yigit on 2012-09-24: @sam my bad. you are right. And about the list of topics, could you give an example, I am not sure I understood what you want. I am not an experienced ros-user but I got rgbdslam to work recently. Comment by sam on 2012-09-25: I know rgbdslam should work when I borrow kinect to testing. But now I don't have kinect, I want to use gazebo's kinect to match all topics for rgbdslam. How can I do that? Thank you~ Did you install the openni_camera package? If not, install it. Then it is up to you to a) start the nodes you need by editing the kinect+rgbdslam.launch file b) create a /opt/ros/fuerte/stacks/openni_camera/launch/openni_node.launch file c) install openni_launch and change the kinect+rgbdslam.launch file by replacing "/openni_camera/launch/openni_node.launch" by "/openni_launch/launch/openni.launch" I suppose option c) is by far the most easy, but it also creates a lot of nodes and topics, and there is a lot of information published in /tf(well, that at least is easy to stop, somewhere in the launchfile is a parameter like "use tf" or sth like that.
{ "domain": "robotics.stackexchange", "id": 10761, "lm_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", "url": null }
geochemistry, earth-history, co2, carbon-cycle Title: Interpretation of Phanerozoic CO2 levels graph I used to talk with a family friend who often sent me links to Nobel Prize winners, claiming that climate change is a myth. Last week, we had a disagreement over a link referencing a Nobel Prize recipient (I believe it was Dr. John Clauser). This link displayed a graph of CO2 levels spanning the past 140 million years, indicating a linear decreasing trend. The article posited that we are depleting our CO2 reserves, a vital gas for plants and, by extension, the biosphere. I responded by saying: "Jorge, that graph is misleading. CO2 levels during the Phanerozoic era are influenced by the Wilson Cycle, and they correlate with the formation and fragmentation of Pangaea. We are not depleting CO2 as the subduction process is initiating in the Atlantic. In the forthcoming million years, CO2 stored by organisms will be released."
{ "domain": "earthscience.stackexchange", "id": 2714, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "geochemistry, earth-history, co2, carbon-cycle", "url": null }
strings, file, integer, common-lisp Title: Reading lines of integers into a list of lists I have a text file containing integers in different lines which I want to read into a list of lists. So 01 11 14 45 50 09 should become ((1) (11 14) (45 50 9)) The real file is longer so I want to read it in using CL instead of transforming it using Emacs' macros etc. It is important that every line becomes exactly one list and the data is stored as integers, i.e. 09 becomes 9. I ended up with the following (using the external library split-sequence): (defun read-data (&optional (file "data.txt")) "Returns the numerical data in FILE as a list of lists." (with-open-file (data file) (loop :for line = (read-line data nil nil) :while line :collect (map 'list #'parse-integer (split-sequence #\Space line))))) which is great because it does the job, I needed only two minutes for it and I knew exactly what I wanted to do. Nevertheless, I found the chain read-line, split-sequence and map a bit too much for this rather simple job. Is there a simpler way just using read which I am just missing? A simple possibility could be to enclose each row between parentheses and use read-from-string (assuming that the file does not contain incorrect data): (defun read-data (&optional (file "data.txt")) "Returns the numerical data in FILE as a list of lists." (with-open-file (data file) (let (*read-eval*) ; set *read-eval* to NIL to avoid malicious code in the input file (loop :for line = (read-line data nil nil) :while line :collect (read-from-string (concatenate 'string "(" line ")"))))))
{ "domain": "codereview.stackexchange", "id": 28805, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "strings, file, integer, common-lisp", "url": null }
I don't know can someone do a computer analysis of this, or tell me the maths of the underlying situation. Note by Ronak Agarwal 3 years, 4 months ago MarkdownAppears as *italics* or _italics_ italics **bold** or __bold__ bold - bulleted- list • bulleted • list 1. numbered2. list 1. numbered 2. list Note: you must add a full line of space before and after lists for them to show up correctly paragraph 1paragraph 2 paragraph 1 paragraph 2 [example link](https://brilliant.org)example link > This is a quote This is a quote # I indented these lines # 4 spaces, and now they show # up as a code block. print "hello world" # I indented these lines # 4 spaces, and now they show # up as a code block. print "hello world" MathAppears as Remember to wrap math in $$...$$ or $...$ to ensure proper formatting. 2 \times 3 $$2 \times 3$$ 2^{34} $$2^{34}$$ a_{i-1} $$a_{i-1}$$ \frac{2}{3} $$\frac{2}{3}$$ \sqrt{2} $$\sqrt{2}$$ \sum_{i=1}^3 $$\sum_{i=1}^3$$ \sin \theta $$\sin \theta$$ \boxed{123} $$\boxed{123}$$ Sort by: Thanks, the analysis was an interesting read. Staff - 3 years, 4 months ago Aah! @Ronak Agarwal I found this too! Before I posted my question, I put this in c++ and the thing failed to converge as soon as $$\alpha$$ became $$>2$$. And I think I know what's happening.
{ "domain": "brilliant.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.979667647844603, "lm_q1q2_score": 0.8054720894476689, "lm_q2_score": 0.8221891283434876, "openwebmath_perplexity": 918.569426863651, "openwebmath_score": 0.9618282318115234, "tags": null, "url": "https://brilliant.org/discussions/thread/now-this-baffles-me/" }
strings, vb.net Public Function bin_add(b1 As Boolean, b2 As Boolean) As String Should look like this. Public Function AddBinary(value1 as String, value2 as String) As String Implementing this change will be left as an exercise for the reader.
{ "domain": "codereview.stackexchange", "id": 9121, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "strings, vb.net", "url": null }
gazebo-7 You can ignore the parseUrdf error. Originally posted by nlamprian with karma: 833 on 2020-10-29 This answer was ACCEPTED on the original site Post score: 1 Original comments Comment by waffle_pi on 2020-10-29: Thanks! A follow up question: I see that gz log -d 1 actually makes gazebo publish a message to ~/log/control, do you think I can write a ROS node, listen to a topic and do the same when received a message? Basically I want to programmatically start/stop recording Comment by nlamprian on 2020-10-30: Probably. If you don't want to look into the details, you can also do a system call to gz log .... Comment by waffle_pi on 2020-10-30: turns out it only works when you publish the message to gazebo/default/log/control but not ~/log/control
{ "domain": "robotics.stackexchange", "id": 4556, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "gazebo-7", "url": null }
A clear and intuitive answer can be provided by ZFC Set-Theory. As described in Enderton's 'Elements of Set Theory (available free for viewing here; see pdf-page 151): http://sistemas.fciencias.unam.mx/~lokylog/images/stories/Alexandria/Teoria%20de%20Conjuntos%20Basicos/Enderton%20H.B_Elements%20of%20Set%20Theory.pdf, the set of all functions from the empty set to the empty set consists merely of the empty function which is 1 function. Hence $0^0$ = 1. Contents taken and reformatted from: The Math Forum What is $$0$$ to the $$0$$ power? This answer is adapted from an entry in the sci.math Frequently Asked Questions file, which is Copyright (c) 1994 Hans de Vreught (hdev@cp.tn.tudelft.nl). According to some Calculus textbooks, $$0^0$$ is an "indeterminate form." What mathematicians mean by "indeterminate form" is that in some cases we think about it as having one value, and in other cases we think about it as having another. When evaluating a limit of the form $$0^0$$, you need to know that limits of that form are "indeterminate forms," and that you need to use a special technique such as L'Hopital's rule to evaluate them. For instance, when evaluating the limit $$\sin(x)^x$$ (which is $$1$$ as $$x$$ goes to $$0$$), we say it is equal to $$x^x$$ (since $$\sin(x)$$ and $$x$$ go to $$0$$ at the same rate, i.e. limit as $$x\to0$$ of $$\sin(x)/x$$ is $$1$$). Then we can see from the graph of $$x^x$$ that its limit is $$1$$.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9407897492587142, "lm_q1q2_score": 0.8255211713969394, "lm_q2_score": 0.8774767922879692, "openwebmath_perplexity": 261.35728347915745, "openwebmath_score": 0.8884240388870239, "tags": null, "url": "https://math.stackexchange.com/questions/11150/zero-to-the-zero-power-is-00-1/11211" }
algorithm, c Are rendered much more readable if we use more whitespace: while (i != 0 && lines < 3) { Use braces consistently I'd recommend using braces around the else clause statement, even though it isn't technically required. In addition to making things more readable (there's that word again!) it helps to prevent bugs. Use better variable names In the current code, lines is a good variable name because it suggests the purpose of the variable, but flag is not a very good name. It would be better to make it bool and call it reverse. Use named constants Named constants make it easier for readers of the program to understand what's being done and why. Simplify your code Essentially, what the program is intended to do is make three traversals from 1 to 10 and back. I'd write it like this: int main(void) { const int lowerlimit = 1; const int upperlimit = 10; int i = lowerlimit; int delta = +1; // start counting up for (int traversals=3; traversals; ) { printf("%d ", i); i += delta; if (i > upperlimit || i < lowerlimit) { printf("\n"); delta *= -1; // change direction i += delta; // come back in bounds --traversals; } } } Omit return 0 When a C or C++ program reaches the end of main the compiler will automatically generate code to return 0, so there is no need to put return 0; explicitly at the end of main. Note: when I make this suggestion, it's almost invariably followed by one of two kinds of comments: "I didn't know that." or "That's bad advice!" My rationale is that it's safe and useful to rely on compiler behavior explicitly supported by the standard. For C, since C99; see ISO/IEC 9899:1999 section 5.1.2.2.3: [...] a return from the initial call to the main function is equivalent to calling the exit function with the value returned by the main function as its argument; reaching the } that terminates the main function returns a value of 0.
{ "domain": "codereview.stackexchange", "id": 25677, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "algorithm, c", "url": null }
newtonian-mechanics, collision, simulations, computational-physics Title: How to calculate impulse force on collision? I've made a program which is supposed to simulate free fall of a ball on a ground. For collision with the ground I relied on calculating the impulse force with the answer in this Phys.SE question but I think the law is, well, wrong, the force must be a very big force acting on short time. The program didn't work, the ball went through the ground, I'm sure I applied the impulse force and the Normal force together, the force is greater than weight but is still small. I have a working collision detection and I know the velocity of the ball before collision, what I want to know is the instantaneous impulse force acting on the ball on collision with the ground. So , how to do that ? and why is this force so enormous that it stops the ball almost instantly ? Edit In this program I define $dt$ as constant equals to 0.1, then I simply say : $$dv=(F/m)*dt$$ $$dl=dv*dt$$ I do these calculations for each frame . this way I don't have to use integrals and I ease the calculations, though they won't be accurate but it's hard for a computer to simulate the world literally . You need the integration step to be much shorter than the impact time. For most real world collisions, 0.1 second will be much too long. The force will change during the collision - and given the very simplistic integration method you use, you have to integrate over sufficiently short steps during which the force doesn't change much. You could do this by repeating the calculation multiple times, each time reducing the time step by 2x. Eventually, the solution will not change (much) when you make the time step shorter - then you will have a short enough step.
{ "domain": "physics.stackexchange", "id": 22573, "lm_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, collision, simulations, computational-physics", "url": null }
quantum-mechanics, condensed-matter, potential, density-functional-theory PS: For reference, I believe we have the following relation $$ E_{xc}[n^\uparrow,n^\downarrow] = \int d^3r n(r) (\varepsilon_x(n^\uparrow(r), n^\downarrow(r)) + \varepsilon_c(n(r))), $$ according to my textbook by Richard M Martin on Electronic structure theory. To arrive at the exchange correlation potential starting from the exchange correlation energy, one indeed does not take a total derivative with respect to the density. The exchange correlation energy is a functional of the density, and the exchange correlation potential is given by the functional derivative of the exchange correlation energy $$E_{\rm xc} = \int_{\rm Volume} {\rm d}^3r n(\vec r)(\epsilon_{\rm x}[n(\vec r)]+\epsilon_{\rm c}[n(\vec r)])$$ ($\epsilon_{\rm x}$ and $\epsilon_{\rm c}$ are energy densities per particle, hence the above multiplication by the density $n$) with respect to $n(\vec r)$. Laxly speaking, the functional derivative will here basically correspond taking the partial derivative of the integral kernel with respect to $n$. If $n_{\uparrow} \neq n_{\downarrow}$, the exchange and correlation energy densities will also depend on the polarization $$\zeta = \frac{n_{\uparrow} - n_{\downarrow}}{n_{\uparrow} + n_{\downarrow}},$$ leading to an additional functional derivative term in the potential with respect to $\zeta(\vec r)$: $$
{ "domain": "physics.stackexchange", "id": 62326, "lm_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, condensed-matter, potential, density-functional-theory", "url": null }
virology, environment, coronavirus Title: What are the environmental conditions for SARS-CoV-2 to survive? What do we know about the environmental limits for nCoV to survive outside the body? For example, in: In open air On surfaces In water What are the limits for temperature, humidity and air pressure, where the virus, can or cannot survive? Because "any" Coronavirus is so dangerous, much research have been done on viruses with similar properties. They are called "surrogates". Because nCoV is new, we don't have any studies, so we need to estimate it's behavior from previously studied similar viruses. Here: RH = Relative Humidity. Tr = Room Temperature TGEV = Transmissible Gastroenteritis (surrogate) MHV = Mouse Hepatitis (surrogate) Viral survival for the TGEV/MHV surrogate: on stainless steel: 4°C @ 20% RH: 28 days in water/sewage (TGEV): 25°C: 22 days in water/sewage (MHV): 25°C: 17 days contaminated water is a potential vehicle for exposure if aerosols are generated For airborne Human Coronavirus 229E (HCV/229E): Optimal survival: 6°C @ 50% RH: Poor* survival: 20°C @ "High" relative humidity (RH) (* "poor" in terms of 20°C but varying RH.) For SARS CoV-P9: Serum: 96 h = 4 days Sputum & Feces: 96 h = 4 days Urine: 72 h = 3 days For SARS-CoV (GVU6109): in diarrheal stool (at low pH): 4 days in respiratory/air droplets: >7 days @ 20°C (Tr) in respiratory/air droplets: >20 days @ 4°C
{ "domain": "biology.stackexchange", "id": 10299, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "virology, environment, coronavirus", "url": null }
evolution, virology Title: How did viruses come to be? My question is out of curiosity and got me thinking. How did viruses with the head, tail and tail fibres actually evolve? These viruses look more like machines than biological entities. Are there any theories to how these viruses evolved? I found a book chapter for you here Quick summary: 3 hypotheses to Origin of viruses From pre-cellular world (virus first hypothesis) From reductive evolution of parasites (reduction hypothesis) From fragments of cellular genetic material (escape hypothesis) Drawbacks: virus require cells (to infect) so how can they come first virus do not look like known reduced parasites from Bacteria/Eukarya/Archaea unlikely that genetic fragments form complex viral structures for viral function Because of these drawbacks, the problem of virus origin was for a long time considered untractable and not worth serious consideration The rest of the chapter looks more in-depth into the 3 hypotheses
{ "domain": "biology.stackexchange", "id": 301, "lm_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, virology", "url": null }
physical-chemistry, molecular-structure The problem is, these structures only resemble the symmetry, but not the expandability of Hoberman sphere. Currently there are many attempts of creating nanomachines with mechanically active molecular assemblies, but I didn't find any working models close to Hoberman structures (yet). Also, some "spherical" viruses such as Cowpea chlorotic mottle virus (CCMV) with a structure of truncated icosahedron, which is significantly larger than Keplerates ($\pu{28 nm}$ (CCMV) vs. $\pu{3.2 nm}$ (average Keplerate)), can undergo swelling (pH < 6.5) and expansion (pH > 6.5), and show pH and metal ion dependent polymorphism [4, 5] as a result of deprotonation of carboxyl moieties at the inter-capsomere contacts, leading to electrostatic repulsion that opens out the structure but falls short of complete disassembly through preservation of interwoven carboxyl/protein links between capsomeres. Don't forget that "there's plenty of room at the bottom", so Hoberman sphere can possibly be a real working entity at molecular scale. Bibliography
{ "domain": "chemistry.stackexchange", "id": 8632, "lm_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, molecular-structure", "url": null }
asking for \Theta(f(x)) for your function f, rather than big-O. In terms of big-O, both A and B are correct answers but there's only one correct answer in terms of \Theta. 0 Hint:$$0\le\left|\frac{(x+2)\cos^2x}{x^2}\right|\le\left|\frac{x+2}{x^2}\right|\xrightarrow[x\to\pm\infty]{}\;\ldots$$2 1 is an eigenvalue of multiplicity 1 of a stochastic matrix as long as your graph edges give a path between every pair of vertices (v,w),and the matrix summation will not converge if 1 is an eigenvalue. Actually, the matrix summation wouldn't converge for any stochastic matrix. You can see this by noting that every power of a stochastic matrix is ... 0 We have$$ x^2\sin(x^4)=\sum_{k=0}^\infty \frac{(-1)^kx^{8k+6}}{(2k+1)!}, $$and hence$$ \int_0^1 x^2\sin(x^4)\,dx=\sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)!(8k+7)}. $$Also,$$ \sin x=x-\frac{x^3}{3!}+\cdots+\frac{(-1)^nx^{2n+1}}{(2n+1)!}\sin^{(2n+1)}(\xi), $$for some \xi\in (0,x). Hence$$ \left|\,\sin ...
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9728307708274402, "lm_q1q2_score": 0.8042506739546417, "lm_q2_score": 0.8267117962054049, "openwebmath_perplexity": 556.5295550321631, "openwebmath_score": 0.9982958436012268, "tags": null, "url": "http://math.stackexchange.com/tags/power-series/new" }
pressure, surface-tension, gas, capillary-action, liquid-state Another common physics trick: if something is static, you can determine the direction of the one force by removing the constraint that keeps it static. Just let the thing do what it “wants to” do. So if I tell you that the bottom hinge on a door actually pushes the door away from the wall, you can quickly visualize this by imagining what would happen if the hinge was not there, at which point the door would rotate into the wall. So this force must have been pushing it away from the wall. Similarly if we let the surface tension do what it “wants to do”, what does it do? It shrinks the bubble. The only reason it can't is because the air/water is incompressible and puts up a pressure to oppose it. In fact the $4$ in your equation is, I think, twice as big as I remember. If I am right then in that case, what we are talking about is a soap bubble, we have air inside and outside, and a thin film of liquid between the two. So we have an air-water-air situation, and if the force were consistently from air to water or from water to air, then the pressure inside the bubble would have to be exactly the same as the pressure outside because you would be adding and subtracting the same number. But because it is not “which side is which substance,” it is only “which side is concave,” the two pressures stack rather than cancel.
{ "domain": "physics.stackexchange", "id": 70957, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "pressure, surface-tension, gas, capillary-action, liquid-state", "url": null }
c++, beginner, c++11, game, minesweeper . #include "minesweeper.ih" void Minesweeper::checkSurrounding(size_t const xCoord, size_t const yCoord) { static int moves[8][2] = { {-1,0}, {-1, -1}, {0, -1}, {1, -1}, {1, 0}, {1, 1}, {0, 1}, {-1, 1} }; for (size_t idx = 0; idx != 8 /*sizeof(move) / sizeof(move[0]) */; ++idx) { size_t possibleX = xCoord + moves[idx][0]; size_t possibleY = yCoord + moves[idx][1]; if (possibleX < 0 or possibleX >= d_size or possibleY < 0 or possibleY >= d_size) continue; if (d_gameBoard[possibleX][possibleY].visited()) continue; d_gameBoard[possibleX][possibleY].setVisited(); if (d_gameBoard[possibleX][possibleY].numBombsNear() == 0) { d_gameBoard[possibleX][possibleY].setState('0'); checkSurrounding(possibleX, possibleY); } else if (d_gameBoard[possibleX][possibleY].numBombsNear() != 0) { d_gameBoard[possibleX][possibleY].setState('0' + d_gameBoard[possibleX][possibleY].numBombsNear()); } } } . #include "minesweeper.h" void Minesweeper::showBombs() { for (auto &location : d_bombLocations) { d_gameBoard[location.first][location.second].setState('B'); } } . #include "minesweeper.ih"
{ "domain": "codereview.stackexchange", "id": 24925, "lm_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, c++11, game, minesweeper", "url": null }
complexity-theory, space-complexity, nondeterminism If the set of possible current states that we are now in does not contain an accept state, then we have found a string that cannot be accepted by $N$. We may have to guess $2^q$ symbols, since each symbol could in principle lead us to a new set of possible current states that had not been seen before. But once all sets of possible current states have been examined, we can stop. We can count to $2^q$ in binary using no more than $q$ bits. Again this requires no more than $O(n)$ bits.
{ "domain": "cs.stackexchange", "id": 7601, "lm_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, space-complexity, nondeterminism", "url": null }
ros, gazebo, server Ubuntu is fine 2) There are many ways to set up environment variables.. that's a more general unix question (to the googles!). You can check http://ros.org/wiki/roslaunch/XML/env for how to do so from a launch file. Good luck.
{ "domain": "robotics.stackexchange", "id": 11917, "lm_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, server", "url": null }
rosjava ommons.httpclient-3.1.0.jar:/home/alex/.m2/repository/org/apache/commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar:/home/alex/.m2/repository/org/jboss/netty/netty/3.2.4.Final/netty-3.2.4.Final.jar',
{ "domain": "robotics.stackexchange", "id": 6785, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "rosjava", "url": null }
Cost of building the base in is \begin{align}70\times ~\left( lb \right) & =70\left( 4 \right) \\ & =280 \end{align} Cost of building the walls in is \begin{align} 2h\left( l~+~b \right)~\times ~45&=2\times 2\left( 2+2 \right)\times 45 \\ & =720 \end{align} Required total cost is is $280 + 720 = 1000$ Thus, the total cost of the tank will be ₹ $$1000.$$ ## Chapter 6 Ex.6.ME Question 10 The sum of the perimeter of a circle and square is $$k$$, where $$k$$ is some constant. Prove that the sum of their areas is least when the side of square is double the radius of the circle. ### Solution Let $$r$$ be the radius of the circle and $$a$$ be the side of the square. Then, we have: \begin{align}&2\pi r + 4a = k\\ &\Rightarrow a = \frac{{k - 2\pi r}}{4}\end{align} The sum of the areas of the circle and the square $$\left( A \right)$$ is given by, \begin{align}A &= \pi {r^2} + {a^2}\\ &= \pi {r^2} + \frac{{{{\left( {k - 2\pi r} \right)}^2}}}{{16}}\end{align} Hence, \begin{align}\frac{{dA}}{{dr}}& = 2\pi r + \frac{{2\left( {k - 2\pi r} \right)\left( { - 2\pi } \right)}}{{16}}\\& = 2\pi r - \frac{{\pi \left( {k - 2\pi r} \right)}}{4}\end{align} Now,
{ "domain": "cuemath.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9886682478041812, "lm_q1q2_score": 0.8128722913443339, "lm_q2_score": 0.822189134878876, "openwebmath_perplexity": 2665.892231110638, "openwebmath_score": 1.0000097751617432, "tags": null, "url": "https://www.cuemath.com/ncert-solutions/me6-application-of-derivatives-class-12-maths/" }
- Well, you can do some series manipulations... First you can write $$\sum_{n = 1}^{\infty} {n \over 4^n} = \sum_{n = 1}^{\infty}\,\sum_{m = 1}^n {1 \over 4^n}$$ Note that the above summation is over all $(m,n)$ with $m \leq n$. So if you switch the order of summation you obtain $$\sum_{m = 1}^{\infty}\,\sum_{n = m}^{\infty} {1 \over 4^n}$$ The inner sum is a geometric series with initial term ${\displaystyle{1 \over 4^m}}$ and ratio ${\displaystyle{1 \over 4}}$, so it sums to ${\displaystyle {{1 \over 4^m} \over 1 - {1 \over 4}} = {4 \over 3}{1 \over 4^m}}$. So the overall sum is $${4 \over 3}\sum_{m = 1}^{\infty} {1 \over 4^m}$$ The sum here is a geometric series that sums to ${\displaystyle{1 \over 3}}$, so your final answer is $${4 \over 3}\times{1 \over 3} = {4 \over 9}$$ - \begin{align} (\frac{1}{4} + \frac{1}{4^2} + \frac{1}{4^3} + \dots ) + \\ (\frac{1}{4^2} + \frac{1}{4^3} + \dots) + \\ (\frac{1}{4^3} + \dots ) + \\ \dots \end{align} –  Aryabhata Jul 11 '11 at 22:18 yeah, basically :) –  Zarrax Jul 11 '11 at 22:19 A simple probabilistic approach:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9915543728093005, "lm_q1q2_score": 0.8700659520203267, "lm_q2_score": 0.877476793890012, "openwebmath_perplexity": 172.77641867966733, "openwebmath_score": 0.9906359910964966, "tags": null, "url": "http://math.stackexchange.com/questions/50919/calculate-the-sum-of-the-infinite-series-sum-n-0-infty-fracn4n" }
relativity Title: Can entities outside of an event E's light cone be influenced by a proxy entity that is inside the light cone of said event E I apologize upfront if my question is poorly worded but I am trying to understand conceptually events and light cones. Say for example that there is a celestial body B that I am capable of observing in some measurable fashion. If this body B is on the edge or boundary of an event E's light cone and I am outside of the light cone for event E then am I able to ascertain any kind of observable influence on the example celestial body B by event E ? Thank you. No. The (future) light cone of an event E is the set of points in spacetime that E can send a signal to. If E could influence B in such a way that you could observe that effect on B, then E can send a signal to you. But by assumption you are outside the light cone of E, so this is not possible.
{ "domain": "physics.stackexchange", "id": 45761, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "relativity", "url": null }
php, mysql, session function write($sess_id, $data) { $con = mysqli_connect("localhost", "root", "","pro"); $CurrentTime = date('Y-m-d H:i:s'); $stmt = mysqli_prepare($con,"UPDATE sessions SET Data= ?,DateTouched=? WHERE SessionID=?"); mysqli_stmt_bind_param($stmt,"sss",$data,$CurrentTime,$sess_id); mysqli_stmt_execute($stmt); return true; } function destroy($sess_id) { $con = mysqli_connect("localhost", "root", "","pro"); $stmt = mysqli_prepare($con,"DELETE FROM sessions WHERE SessionID = ?"); mysqli_stmt_bind_param($stmt,"s",$sess_id); mysqli_stmt_execute($stmt); return true; } function gc($sess_maxlifetime) { $con = mysqli_connect("localhost", "root", "","pro"); $stmt = mysqli_prepare($con,"Delete from sessions where TIMESTAMPDIFF (Second ,DateTouched,now())>=?"); mysqli_stmt_bind_param($stmt,"s",$sess_maxlifetime); mysqli_stmt_execute($stmt); return true; }
{ "domain": "codereview.stackexchange", "id": 406, "lm_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, mysql, session", "url": null }
neural-networks, monte-carlo-tree-search, alphago, alphazero, alphago-zero *Note: I wrote above that "MCTS doesn't benefit from increased training time. In practice, of course it does tend to benefit from increased training time because that tends to result in a better Network, which tends to result in better decisions during the Selection Phase and better evaluations of later game states in the tree. What I mean is that MCTS is not theoretically guaranteed to always keep benefitting from increases in training time as we tend to infinity, precisely because that's also where we don't have theoretical guarantees that the Neural Network itself will forever keep improving.
{ "domain": "ai.stackexchange", "id": 705, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "neural-networks, monte-carlo-tree-search, alphago, alphazero, alphago-zero", "url": null }
machine-learning, qaoa Title: What does the maximum of a Hamiltonian means (in a particular paper)? In the paper Quantum Observables for continuous control of the Quantum Approximate Optimization Algorithm via Reinforcement Learning, an Hamiltonian is defined in order to solve the MAXCUT problem : $$ C = \sum_{<i,j>} \frac{1}{2} (I -\sigma_i^z \sigma_j^z) = \sum_{<i,j>} C_{i,j} $$ with $\sigma_j^z$ the pauli matrix $\sigma^z$ applied to the $j^{th}$ qubit. The sum is taken over all adjacent edge in the original graph problem. The paper indicates the following result : $$ \lim_{p \rightarrow \infty} [\max_{\beta,\gamma} \langle \beta,\gamma |_p C | \beta,\gamma \rangle_p] = \max C $$. consider $|\beta,\gamma \rangle_p$ some states produced by the QAOA algorithm and $p$ an integer, their value do not matter for my question. The quantity $\max_{\beta,\gamma} \langle \beta,\gamma |_p C | \beta,\gamma \rangle_p$ is clearly scalar, whereas I can't make sense of the expression $\max C$. My question is then, what does $\max C$ means in this context ? I believe the answer is not given in this paper. I might have the answer from this documentation, where it is said that the Hamiltonian is constructed from the classical function, $$C(z_1,...,z_n) = \sum_{<i,j>} \frac{1}{2} (1 -z_i z_j)$$
{ "domain": "quantumcomputing.stackexchange", "id": 1429, "lm_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, qaoa", "url": null }
fft, algorithms, digital Title: Guitar Tuner or Guitar effects Algorithms? I need to explore the algorithm of the digital guitar tuner or the digital guitar effects algorithms. Is there any Book or articles that you recommend of? All I know is that relate to DSP. thanks Best book on the topic is probably http://www.amazon.com/DAFX-Digital-Udo-ouml-lzer/dp/0470665998. There is some freeware stuff (very mixed quality) here: http://www.musicdsp.org/ Many companies spend a lot of effort in making good sounding effects and well working tuners to make money with it, so access to "good" non-commercial sources if fairly limited.
{ "domain": "dsp.stackexchange", "id": 1228, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "fft, algorithms, digital", "url": null }
But I don't know what I can do after this. Let's start from your last line: \begin{align} \lim_{x\to+\infty}\frac{1+\sqrt{x}}{\sqrt{x+\sqrt{x}}+\sqrt{x-1}} &= \lim \frac{\sqrt x}{\sqrt x} \frac{\frac{1}{\sqrt x} + 1}{\sqrt{1 + \frac{1}{\sqrt x}} + \sqrt{1 - \frac{1}{ x}}} \\ &= \frac{1}{1 + 1} = \frac{1}{2} \end{align} where we note that everywhere we have $\frac{1}{\sqrt x}$, those terms go to $0$ as $x \to \infty$. The method of factoring out the largest element in the numerator and denominator very often works. $\diamondsuit$ You may just observe that, as $x\to \infty$: $$\frac{1+\sqrt{x}}{\sqrt{x+\sqrt{x}}+\sqrt{x-1}}\sim \frac{\sqrt{x}\left(1+\frac1{\sqrt{x}}\right)}{\sqrt{x}\left(\sqrt{1+\frac{1}{\sqrt{x}}}\right)+\sqrt{x}\left(\sqrt{1-\frac{1}{x}}\right)}\sim \frac12.$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.972830768464319, "lm_q1q2_score": 0.8085615258828347, "lm_q2_score": 0.8311430436757312, "openwebmath_perplexity": 1117.2506982793514, "openwebmath_score": 0.9985162615776062, "tags": null, "url": "https://math.stackexchange.com/questions/1217752/how-to-solve-this-limit-lim-x-to-infty-sqrtx-sqrtx-sqrtx-1/1217759" }
To visualize the result, let us use this nice answer to get a good-looking palette: discreteColors[n_] := With[{partL = Ceiling[Sqrt[n]]}, DeleteCases[ Flatten[Transpose[ Partition[ Table[Lighter[Darker[Hue[c], .1], .25], {c, 0, 1 - 1/n, 1/n}], partL, partL, 1, 0]]], 0]]; palette = discreteColors[chrom]; Do[PropertyValue[{g, v[[1]]}, VertexStyle] = v[[2]], {v, Table[{i, palette[[sol[[i]]]]}, {i, 1, VertexCount[g]}]}] g And there we have it. It should be noted that the code crucially assumes the vertex set is defined on the continuous integer set $1..n$. (If this is not the case, we can use GraphIndex to make it hold). Also, the search space is of size $k^n$, where $k$ is the chromatic number. Moreover, computing the chromatic number of a graph is NP-hard, so we most likely can't have an algorithm that would always be fast. Given the size of the search space, memory consumption is likely to become a problem for larger graphs (especially if the chromatic number is large as well). In such a case, I would randomly generate $k$-colorings; this process is guaranteed to terminate with probability approaching 1 as one of the colorings will be valid. -
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.953966101527047, "lm_q1q2_score": 0.8050473135910996, "lm_q2_score": 0.8438950947024555, "openwebmath_perplexity": 683.3396509357264, "openwebmath_score": 0.2587059438228607, "tags": null, "url": "http://mathematica.stackexchange.com/questions/35617/tools-for-finding-minimal-or-almost-minimal-graph-vertex-colorations-in-mathemat" }
java I've got also classes like Car, Client, RentingACar - they contains getters and setters. You can find it on my github CarRental/Model. Here is the link: https://github.com/must1/RentalCar . Thanks for all suggestions. DataBase In DataBase class I'd use method scoped variables, rather than class properties. In general, it's better to have method scoped variables since you can keep control about their state. This way: public void rentACar(RentingACar rentingACar) throws SQLException { int count = 0; boolean isAvailable = true; { PreparedStatement preparedStatement = connection.prepareStatement("SELECT COUNT(0) FROM car WHERE available='1' AND brand=?"); preparedStatement.setString(1, rentingACar.getBrand()); ResultSet result = preparedStatement.executeQuery(); } while (result.next()) { count = result.getInt(1); } if (count < 1) isAvailable = false; if (isAvailable) { preparedStatement = connection.prepareStatement("insert into rentcar" + "(brand,namee,surname,rentDate,clientNumber)" + "values(?,?,?,?,?)"); preparedStatement.setString(1, rentingACar.getBrand()); preparedStatement.setString(2, rentingACar.getName()); preparedStatement.setString(3, rentingACar.getSurname()); preparedStatement.setString(4, rentingACar.getRentDate()); preparedStatement.setInt(5, rentingACar.getClientNumber()); preparedStatement.executeUpdate();
{ "domain": "codereview.stackexchange", "id": 31283, "lm_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 }
ros, navigation, costmap, ros-indigo ==1806== by 0x13E05241: boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, costmap_2d::StaticLayer, boost::shared_ptr<nav_msgs::OccupancyGrid_<std::allocator<void> > const> const&>, boost::_bi::list2<boost::_bi::value<costmap_2d::StaticLayer*>, boost::arg<1> > >, void, boost::shared_ptr<nav_msgs::OccupancyGrid_<std::allocator<void> > const> const&>::invoke(boost::detail::function::function_buffer&, boost::shared_ptr<nav_msgs::OccupancyGrid_<std::allocator<void> > const> const&) (function_template.hpp:153) ==1806== by 0x13E07CF6: boost::function1<void, boost::shared_ptr<nav_msgs::OccupancyGrid_<std::allocator<void> > const> const&>::operator()(boost::shared_ptr<nav_msgs::OccupancyGrid_<std::allocator<void> > const> const&) const (function_template.hpp:767)
{ "domain": "robotics.stackexchange", "id": 29999, "lm_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, costmap, ros-indigo", "url": null }
file-system, io, linux, assembly ; get file name lea esp,[esp+4] ; jump over program name pop ebx ; file name ; open the file to be shredded mov eax,5 ; sys_open ; ebx has the name mov ecx,1 ; O_WRONLY int 80h ; call sys_open cmp eax,0 ; check fd jl Error ; < 0 means error mov esi,eax ; save fd ; get file size mov ebx,eax mov eax,19 ; sys_lseek xor ecx,ecx ; offset mov edx,2 ; SEEK_END int 80h ; call cmp eax,0 ; check return value jl Error ; negative values indicate errors mov [Size],eax ; save file size ; now open urandom mov eax,5 ; sys_open mov ebx,UrandomPath ; path xor ecx,ecx ; O_RDONLY int 80h ; call open cmp eax,0 ; check returned fd jl Error ; < 0 means error mov [UrandomFd],eax ; save fd for later ; rewind file mov eax,19 ; sys_lseek mov ebx,esi ; fd xor ecx,ecx ; offset 0 xor edx,edx ; SEEK_SET int 80h ; call cmp eax,0 ; error? jl Error ; exit ; We have a random source and the file to shred mov ebp,PASSES ; how many times we are going to overwrite .wholeLoop: mov edi,[Size] ; get size shr edi,9 ; how many full 512 byte runs? .fillRandom: mov eax,3 ; sys_read mov ebx,[UrandomFd] ; fd mov ecx,RandomBuffer ; destination mov edx,4 ; size int 80h ; call cmp eax,4 ; did it read all? jl Error ; we can't risk writing non-random bytes
{ "domain": "codereview.stackexchange", "id": 21253, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "file-system, io, linux, assembly", "url": null }
-- the number has been divided by 10 because each place to the right is worth 10 … Up Next. Here is a list of the number 2 raised to the power of every number from 0 to 100. Stars: Andrew Gray, Ciara Hanna, John Mark Loudermilk, Christina Masterson. Power of Two Decimal Value Hexidecimal Value Octal Value Technobabble Jargon; 2 0: 1: x 1: o 1: Bit (Only when counting bits) 2 1: 2: x 2: o 2 : 2 2: 4: x 4: o 4: Nibble (Only when counting bits) 2 3: 8: x 8: o 10: Byte (Only when counting bits) 2 4: 16: x 10: o 20: Wyde Halfword (Only when counting bits) 2 5: 32: x 20: o 40: Word (Only … To get the power of a number you multiply it by itself the specified number of times. 10 24. zetta. ABC gives children a foundation for success in school and life by fostering a strong and healthy attachment between parent and child. Here is a list of the number 2 raised to the power of every number from 0 to 100. The best Power Table and calculator which help you find the power of number. We're taking six 10s and multiplying them together. The Power of 10 illustrates the challenge and is in place to motivate competitors, coaches and clubs. Multiplying and dividing with powers of 10. 2 Corinthians 10:2 I beg you that when I come I may not need to be as bold as I expect toward those who presume that we live according to the flesh. 8/10 (23 valutazioni) - Download Power2Go gratis. You can also just think of 10 x to simply be equal to the number 1 followed by x zeroes. So 10 to the sixth power is the same thing as 1 being multiplied by 10 six times. The 2-POWER range is a perfect solution for any retailer, e-tailer or reseller, with a comprehensive selection of power accessories for nearly every type of electronic device. The first 20 powers of two are: For example, 2x2 is stated as 'Two squared' or '2 to the 2nd power' 2x2x2 is stated as 'Two cubed' or '2 to the 3rd power'
{ "domain": "alleluiassd.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9632305318133553, "lm_q1q2_score": 0.8148375800310245, "lm_q2_score": 0.8459424334245618, "openwebmath_perplexity": 1412.5076346732396, "openwebmath_score": 0.5659218430519104, "tags": null, "url": "https://www.alleluiassd.com/government-job-lmd/eznol3.php?page=10-to-the-power-of-2-f4df2d" }
c++, beginner, queue // and finally, set the class data members to the new values // // these also can't fail m_RawData = new_data; m_Capacity = new_capacity; } As an optimization to the above, you could put the entire try-catch block in an if constexpr block, so that you only need it when you don’t have no-fail moving. If moving is no-fail (as it is for most types), then there’s no need to worry about anything in that first loop failing, so there’s no need for any cleanup. void m_Realloc(std::size_t t_NewCapacity) { if (t_NewCapacity > m_Capacity) { m_ReallocAnyway(t_NewCapacity); } else { return; } } I mean, you don’t really need the else { return; } here. But I suppose that’s just a matter of personal style. void m_ShiftToLeft() { for (std::size_t i = 0; i < m_Size; i++) { new (&m_RawData[i]) T(std::move_if_noexcept(m_RawData[i + 1])); } } This is really wrong. First, placement new constructs a new object in raw memory. You should never do that overtop of an existing object. If an object is already constructed, you need to destroy it before you can construct a new object over it. If you want to replace an existing object with another existing object… as you’re doing here… you have two options: The hard way: Destroy object 1 Use placement new to copy/move construct from object 2 over the old location of object 1 The easy way: Just copy/move assign object 2 to object 1
{ "domain": "codereview.stackexchange", "id": 40871, "lm_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, queue", "url": null }
c++, unit-testing for (auto it = begin; it != end; ++it) { auto [start_pos, interval_size] = *it; fun(start_pos, interval_size); } Ideally, you would add begin() and end() methods to NDArray that return NDArrayIndexes, so that you can then write: NDArray array{...}; for (auto [start_pos, interval_size]: array) { fun(start_Pos, interval_size); } Of course, I omitted several parts that are left as an excercise for the reader. You'll also notice it's a bit different from the usual iterators; those return references to the data in the container. You could make it so NDArrayIndex stores a reference to the NDArray it is indexing, so instead of the struct span I defined above, operator*() could return an actual std::span that directly references the data in the array.
{ "domain": "codereview.stackexchange", "id": 43993, "lm_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++, unit-testing", "url": null }
But Alice and Carol might not necessarily be friends. [3] Heterogeneous n-ary relations are used in the semantics of predicate calculus, and in relational databases. A metaphorical description of a function could be a black-box or a machine that takes in an input and returns a corresponding output. Our aim is to help students learn subjects like A relation ∼ \sim ∼ on AAA is reflexive if. A relation ∼ \sim ∼ on AAA is transitive if. The homogeneous binary relations are studied for properties like reflexiveness, symmetry, and transitivity, which determine different kinds of orderings on the set. In mathematics, an n-ary relation on n sets, is any subset of Cartesian product of the n sets (i.e., a collection of n-tuples), with the most common one being a binary relation, a collection of order pairs from two sets containing an object from each set. A function is a special kind of relation and derives its meaning from the language of relations. In relational databases jargon, the relations are called tables. Then R R, the composition of R with itself, is always represented. However, this is not so. PLEASE READ MY DISCLOSURE FOR MORE INFO. ∀a∈Aa∼a. All material given in this website is a property of physicscatalyst.com and is for your personal and non-commercial use only, Gravitation NCERT Solutions Class11 physics, Trigonometry Formulas for class 11 (PDF download), Newton�s law Interesting conceptual questions, Difference between resistance and resistivity, Relations and Functions Class 11 Worksheet, NCERT Solutions Relation and Functions class 11 Exercise 2.1, NCERT Solutions Relation and Functions class 11 Exercise 2.2, NCERT Solutions Relation and Functions class 11 Exercise 2.3, In roster form, the order in which the elements are listed is immaterial, while writing the set in roster form an element is not generally repeated, In set-builder form, all the ordered pair of a relation possess a single common property Conversely, given any partitioning scheme, we could define ∼\sim∼ as a∼ba \sim ba∼b if and only if aaa and bbb belong to the same set. Let ℜ\Reℜ be the relation "smaller than" on the real number set, i.e. Alice and Bob are friends. Reflexivity: All lines are parallel to itself. © 2007-2019 . Also, R R is sometimes denoted by
{ "domain": "stereo7.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9632305370909698, "lm_q1q2_score": 0.8047632542019405, "lm_q2_score": 0.8354835350552603, "openwebmath_perplexity": 2123.7384182845894, "openwebmath_score": 0.720538854598999, "tags": null, "url": "http://www.stereo7.com/site/relations-math-afb664" }
fft, sampling, nyquist, aliasing Title: why Sampling with higher than nyquist frequency is causing aliasing? fm=20000 and I am sampling following signal at 65000 Hz: x=0.5*sin(2*pi*(fm-2500)*t)+0.6*sin(2*pi*(fm-1250)*t*1.05)+0.7*sin(2*pi*fm*t*1.1)+0.8*sin(2*pi*(fm+1250)*t*1.15)+0.9*sin(2*pi*(fm+2500)*t*1.2); and looking at frequency spectrum is not as it should look like. Please find attachment. It has code and result also. The effect you see has nothing to do with aliasing. First of all, due to spectral leakage the maxima of the spectrum do not exactly reflect the amplitudes of the sinusoids. Second, note that the DFT (implemented by the FFT) only samples the actual spectrum (the discrete-time Fourier transform, DTFT) of the signal. Depending on the choice of the sampling frequency in your example, the actual spectrum (DTFT) and the location of the sample points of the DFT shift with respect to each other, and there's no guarantee that the samples of the DFT occur at (or close to) the maxima of the actual spectrum.
{ "domain": "dsp.stackexchange", "id": 7801, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "fft, sampling, nyquist, aliasing", "url": null }
robotic-arm, microcontroller, raspberry-pi, industrial-robot Title: Need a pushing mechanism I'm new to robotics (and maybe it's not even robotics), and want to build a "pushing mechanism" to automatically push a "pop up stick" up from my kitchen bench (see product here: http://www.evoline.no/produkter/port/). By design, the "pop up stick" is made to be dragged up by hand, but I want to install a mechanism under the bench, to do it by a trigger of some kind. I'm a programmer, and I have some experience with Raspberry Pi. Does anybody have any hints of what products I could use to build this? Thanks :) You could use a rack and pinion as a linear actuator. A simple way of knowing when to stop turning the motor could be a contract sensor/button at the upper and lower position. You could also add something to compensate for gravity, like a spring or a counter weight, such that it does not fall down under its own weight (or also use "high" friction as used in the linked product, which will as require more force from the motor).
{ "domain": "robotics.stackexchange", "id": 1164, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "robotic-arm, microcontroller, raspberry-pi, industrial-robot", "url": null }
general-relativity Title: Would gravity still act if all objects in a closed system somehow became stationary? I have been trying to understand the implications of general relativity. I unfortunately don't have a good knowledge of advanced topics and I may have made some silly assumptions. As far as I understand, spacetime dictates the trajectory of an object, and the object curves spacetime. Objects follow the shortest path, and it appears as if things are being pulled when instead they're just accelerating in a specific way due to the curvature. Gravity is a fictitious force. I'm confused about what would happen if we imagine a universe with two identical stationary objects. I'm guessing that because it's not actually possible for anything to be completely stationary (because we cannot reach absolute zero (uncertainty principle?)), these objects will move along the curvature. But if we consider it was possible for objects to be completely stationary, does this mean that these objects won't follow the curvature since they're not moving to begin with and it would appear as if gravity has stopped working. The objects stay stationary instead of crashing into each other. What would happen if there are two identical stationary objects and I apply a force to one of the objects, such that the direction of the force is perpendicular to the line connecting the two objects? I'm guessing that it should start to orbit the other object, but I also know that in this inertial frame of reference, since there are two objects, I shouldn't be able to tell who's moving. So the outcome of some force being applied should be symmetrical, so does this mean the objects would start to chase each other? But then, in a situation where the objects are not identical, if I move the heavier object, would it still appear as if the smaller object has started orbiting due to a force pulling it? But this sounds like movement in one stationary object has induced movement in another stationary object (assuming stationary objects were possible)?
{ "domain": "physics.stackexchange", "id": 71530, "lm_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", "url": null }
c#, performance, .net, playing-cards sw.Stop(); // Output code omitted return counters; } The calculate counters method is simply a wrapper around the inner section of your for loop, along with the temporary variables it needs: static Counters CalculateRound(int i) { var counters = new Counters(); Dictionary<int, int> rankCount = new Dictionary<int, int>(5); int card1rank; int card1suit; int card2rank; int card2suit; int card3rank; int card3suit; int card4rank; int card4suit; int card5rank; int card5suit; bool haveStraight; bool haveFlush; card1rank = i % 13; card1suit = i / 13; for (int j = i - 1; j >= 3; j--) { card2rank = j % 13; card2suit = j / 13; for (int k = j - 1; k >= 2; k--) { card3rank = k % 13; card3suit = k / 13; for (int l = k - 1; l >= 1; l--) { card4rank = l % 13; card4suit = l / 13; for (int m = l - 1; m >= 0; m--) { counters.counter++; //if (rand.Next(4) != 0) // continue; haveStraight = false; haveFlush = false; card5rank = m % 13; card5suit = m / 13; if (card1suit == card2suit && card1suit == card3suit && card1suit == card4suit && card1suit == card5suit) { haveFlush = true; } rankCount.Clear(); rankCount.Add(card1rank, 1); if (rankCount.ContainsKey(card2rank)) rankCount[card2rank]++; else rankCount.Add(card2rank, 1); if (rankCount.ContainsKey(card3rank)) rankCount[card3rank]++; else rankCount.Add(card3rank, 1);
{ "domain": "codereview.stackexchange", "id": 21131, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, performance, .net, playing-cards", "url": null }
order-theory Title: Hook length formuli and their invariance properties? Let $P = (V,\leq_P)$ be a poset, and for each $x \in V$ let $x^P = \{ y \in V : x \leq_P y \}$. A well-known property of certain posets (forests, Young diagrams) is the existence of a simple hook length formula counting their linear extensions - while the problem is $\# P$-hard in general. To make this notion precise, we say that $P$ has a hook length formula if there exists a function $h : V \rightarrow \mathbb{N}$ such that for every $x \in V$, the number of extensions of $P | x^P$ is equal to: L(x) = $\frac{|x^P|!}{\prod_{y \geq_P x} h(y)}$.
{ "domain": "cstheory.stackexchange", "id": 2603, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "order-theory", "url": null }
algorithms, sampling p[1, 1] &= 1 \quad \text{(strings of length 1 using only a -- so just "a")} \\ p[1, 2] &= 2 \quad \text{(strings of length 1 using a and d -- so "a" and "d")} \\ p[1, 3] &= 3 \quad \text{("a", "d", and "y")} \\ p[2, 1] &= 0 \quad \text{(no strings of length two using only a since only one a is allowed)} \\ p[2, 2] &= 3 \quad \text{("ad", "da", and "dd")} \\ p[2, 3] &= 7 \quad \text{("ad", "da", "dd", "ay", "ya", "dy", "yd")} \end{align*} Now how do we calculate $p$? We can use a recursive algorithm. Let $M[j]$ denote the value of $M$ on the $j$th character (so in our example, $M[1] = 1, M[2] = 3, M[3] = 1$). Then $$ p[i, j] = \sum_{i' = 0}^{M[j]} \binom{i}{i'} p[i - i', j-1]. $$ What this formula says is: pick $i'$ places to put character $j$. For example, in our running example for $p[2, 3]$, it says pick $i'$ places to put the character $y$ in a string of length $2$. Then for the remaining $i- i'$ places, we fill them in with a string only using the first $j-1$ characters (which can be done in $p[i-i', j-1]$ ways). The variable $i'$ ranges from $0$ to $M[j]$ because we can only use character $j$ at most $M[j]$ times.
{ "domain": "cs.stackexchange", "id": 15704, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "algorithms, sampling", "url": null }
quantum-gate, ibm-q-experience, quantum-operation Title: How to perform this $d$-dimensional unitary operation on IBM Q? $U_{a,b}=\sum^{d-1}_{x=0}\omega^{bx}|x+a\rangle\langle x|$,$\omega=e^{\frac{2\pi i}{d}}$,$a,b\in\{0,1,2,...,d-1\}$ Can someone please give me the pic of the quantum circuit? Since we are talking about a unitary operation on qubits, i assume $ d = 2^n $ where $ n $ is the number of qubits. We define the unitary operations $ V_{a} = \sum_{x=0}^{d - 1} | x + a \rangle \langle x| $ and $ D_{b} = \sum_{x=0}^{d - 1} \omega_d^{bx} | x \rangle \langle x| $. Notice that we can write $ U_{a, b} = V_a \cdot D_b $. In the Fourier basis (see here) we have $ QFT^{\dagger} \cdot V_a \cdot QFT = D_{-a} $ since for a basis state $ |x \rangle $ \begin{align*} V_a \cdot QFT \cdot |x \rangle &= V_a \cdot \frac{1}{\sqrt{d}} \sum_{k=0}^{d-1} \omega_d^{kx} |k \rangle \\ & = \frac{1}{\sqrt{d}} \sum_{k=0}^{d-1} \omega_d^{kx} |k + a\rangle \\ & = \frac{1}{\sqrt{d}} \sum_{k=0}^{d-1} \omega_d^{(k - a)x} |k \rangle \\
{ "domain": "quantumcomputing.stackexchange", "id": 2066, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-gate, ibm-q-experience, quantum-operation", "url": null }
This gives the various angles, from which the area of $\triangle P_1P_2P_3$ can be computed. However, there, too, is an "obvious" solution: that triangle is one-third of the full-octant triangle $\triangle P_1P_2P_4$, and the full-octant triangle has measure $4\pi/8 = \pi/2$. Therefore, $|\triangle P_1P_2P_3|= \pi/6$, which agrees with the "spherical excess" calculation $\phi_1+\phi_2+\phi_3-\pi$. • It's amazing how much I've learned from this post! Thank you very much! Aug 5 '18 at 11:01
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9828232889752295, "lm_q1q2_score": 0.8103003905943539, "lm_q2_score": 0.8244619350028204, "openwebmath_perplexity": 258.63192086664986, "openwebmath_score": 0.9781134128570557, "tags": null, "url": "https://math.stackexchange.com/questions/2872686/angles-and-area-of-a-triangle-defined-on-a-sphere" }
c#, beginner, game-of-life } public void displaygrid(int[,] livegrid) { int gridcol = livegrid.GetLength(0); int gridrow = livegrid.GetLength(1); for (int i = 0; i < gridcol; i++) { for (int j = 0; j < gridrow; j++) { Console.Write("{0,2}", livegrid[i, j]); } Console.WriteLine(); } } } } This is very important: Your algorithm is wrong. Do not ask for help with style or efficiency or anything else like that until you get the algorithm right! Hint: you should not be updating the grid at the same time as you are reading from it. Get the code compiling, then get it right, and then get it elegant and then get it fast. Always that order. So let's start by getting the code right by identifying where it is wrong. It's wrong here: int livecellcount = cellchecker(i,j); if (livegrid[i,j] == 1) { if (livecellcount <= 1) livegrid[i, j] = 0; Suppose cell i, j is 1 and the count of live neighbours is 1; specifically, the next cell over is the only live cell. Now suppose that next cell over has 2 live neighbours. What must happen when you compute the state of the next cell? It is live and it has two live neighbours, so it must stay alive. What happens in your program? You set the current cell to dead, and then you count the number of live neighbors of the next cell, which will then be 1, not 2, and the cell will die! You need to be doing the reading on the previous grid, and the writing on the next grid, in order for this to be correct. There is a mechanism for making sure you never make this terrible mistake again, which I shall now describe. To address your specific questions: A pointer on how to improve the change from one grid to another, i.e. to improve the flow of the game.
{ "domain": "codereview.stackexchange", "id": 21864, "lm_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, game-of-life", "url": null }
blist = 2*Range[12/2] - 2; -Mod[2 blist - 1, 3] // UnitStep {0, 1, 0, 0, 1, 0} • Thank you very much! – user51325 Jul 27 '17 at 10:49 • You're welcome. You could define blist with Range[1, 2 a, 4] - 2 and then just -Mod[blist, 3] // UnitStep – eldo Jul 27 '17 at 11:02 blist = {0, 2, 4, 6, 8, 10}; 1 - Unitize @ Mod[2 blist - 1, 3] {0, 1, 0, 0, 1, 0}
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9539660976007597, "lm_q1q2_score": 0.8050473140230375, "lm_q2_score": 0.8438950986284991, "openwebmath_perplexity": 1868.102266201909, "openwebmath_score": 0.20423103868961334, "tags": null, "url": "https://mathematica.stackexchange.com/questions/152399/changing-or-marking-some-elements-in-a-list" }
ros, ekf-localization Title: Warnings with base_link in namespace for robot_localization Hello, <group if="$(arg enable_ekf)" > <node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization" > <rosparam command="load" file="$(arg ekf_yaml_path)" /> <param name="map_frame" value="map"/> <param name="odom_frame" value="$(arg ns)/odom"/> <param name="base_link_frame" value="$(arg ns)/base_link"/> <param name="world_frame" value="$(arg ns)/odom"/> </node> </group> The above are the relevant lines in my launch file, but when I try it to run it, there are warnings thrown and the functionality is not as expected. The warnings are as below: [WARN] [1617652671.519795535, 1553.900000000]: Could not obtain transform from base_link to jackal2/base_link. Error was "base_link" passed to lookupTransform argument source_frame does not exist. [ WARN] [1617652673.364580966, 1555.740000000]: Could not obtain transform from base_link to jackal1/base_link. Error was "base_link" passed to lookupTransform argument source_frame does not exist. I don't understand why these would come up since I am specifically assigning a base_link_frame. Why does it matter if "base_link" exists or not? Originally posted by pointsnadpixels on ROS Answers with karma: 23 on 2021-04-05 Post score: 0
{ "domain": "robotics.stackexchange", "id": 36282, "lm_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, ekf-localization", "url": null }
F = [P>=0, A'*P+P*A <= -2*t*P, trace(P)== 1, 100 >= t >= 0]; optimize(F,-t,sdpsettings('solver','bmibnb')); In this model, we have changed the constraints slightly, in order to ensure a bounded search-space. For details, check out the [global optimization tutorial]. The code here still assumes you have a nonlinear semidefinite solver installed, since a local solver is needed during the branch and bound search. If you do not have one installed, you can tell YALMIP to perform the branch and bound without any local solver (upper bounds will then be generated using trivial heuristics from relaxed solutions) optimize(F,-t,sdpsettings('solver','bmibnb','bmibnb.upper','none')); This will not perform as well though, and a better choice is to use the bisection approach.
{ "domain": "github.io", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9793540686581882, "lm_q1q2_score": 0.8006948962210438, "lm_q2_score": 0.8175744828610095, "openwebmath_perplexity": 1755.150435008548, "openwebmath_score": 0.674713134765625, "tags": null, "url": "https://yalmip.github.io/example/decayrate/" }
filters, signal-analysis There are basically two parameters for filters like a Butterworth lowpass: Its order and the cutoff frequency. Both have influence on the response. Setting the cutoff frequency lower will make the response more smooth. Setting it higher will make the response follow more closely the steps because more of the frequencies are retained and less are attenuated. The filter order controls how selective the filter is / how "sharply" it separates the passpand (the frequencies that are preserved) from the stop band (the frequencies that are rejected. Inbetween the passband and the stopband you have the transition band which will get narrower the higher order you use. In the time domain higher order filters tend to make the response more wavy. The filter's impulse response oscillates more and its envelope decays more slowly. Choosing the filter order is kind of a trade-off between frequency selectivity and time selectivity. By time selectivity I mean that a tiny pop in your source signal will affect a larger window of time in the filtered signal. Without knowing exactly what you are shooting for, it's hard to suggest anything. I hope this explanation of how the two tuning knobs affect the response will enable you to move into the right direction. If you want to do noise reduction it's generally good to know what the PSD of your signal and the noise part looks like. In your case, the noise is highly correlated and depends too much on the signal. You basically have truncation without any prior dithering which would otherwise decouple the noise error from the signal. So, in your case it's hard to predict the PSD of the error. But given both spectra, Wiener filtering could get you closer to the solution. Then, a good filter's cutoff frequency would depend on the point where the signal PSD crosses the noise's PSD. The order would depend on the difference of the PSD slopes between signal and noise in a loglog domain. So, for example, given a brownish signal mixed with white noise, the difference of the PSD slopes in the loglog domain would be 2. Divide this by two (--> 1) and use that as a filter order. The most appropriate cutoff frequency setting would be to make the -6 dB point the frequency where the signal PSD curve intersects the noise PSD curve.
{ "domain": "dsp.stackexchange", "id": 4290, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "filters, signal-analysis", "url": null }
newtonian-mechanics, forces, classical-mechanics, free-body-diagram, constrained-dynamics Title: Understanding constraint for not losing contact What is the exact constraint for two bodies remain in contact? Consider the case of a rod constrained to move downward on an inclined wedge. It is known that the velocity of the wedge and the velocity of the rod in the common normal direction should be the same because they must not lose contact. Differentiating this we can see that acceleration along common normal direction must be the same too. Let us consider a curved surface. It is correct to say that the velocity of wedge and the velocity of the rod in the normal direction must be the same at any instant, but the same is no longer necessary for accelerations. Why is it so? example problem- Namely $v_w\sin \theta=v_r\cos \theta$, but differentiating this does not give $a_w\sin \theta=a_r\cos \theta$, here $\theta$ is the instantaneous angle made by the common normal with the horizontal. So how does one arrive to the contact constraint? And why is it the way it is? P.S. It seems as though the rate of change of velocity in common normal direction isn't just the acceleration component in that direction but something more. I had the same question exactly when I was learning dynamics (I think). The question at hand is that if a constrained is formed in terms of velocities, how do we transform the constraint in terms of accelerations so that it can be used in ODE system, of equations. The simplest example is that of a slipping wheel on a plane. Velocity Kinematics It is correct to transfer the velocity to the contact point and impose the constraint there $$ \boldsymbol{\hat{j}} \cdot \boldsymbol{v}_A = 0 \tag{1} $$ where the velocity vector at A is evaluated from the velocity vector at C and the location vectors $\boldsymbol{r}_A$ and $\boldsymbol{r}_C$ $$\boldsymbol{v}_A = \boldsymbol{v}_C + \boldsymbol{\omega} \times ( \boldsymbol{r}_A - \boldsymbol{r}_C) \tag{2}$$
{ "domain": "physics.stackexchange", "id": 70051, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, forces, classical-mechanics, free-body-diagram, constrained-dynamics", "url": null }
ros, rosbag, play Title: Replay rosbags recorded with --split option Hi, I have recorded number of rosbags using --split option, say "file_0.bag", "file_1.bag", "file_2.bag" and so on to build a map. My question is: how to play them back one after the other. Using $ rosbag play file_0.bag file_1.bag file_2.bag plays all files at the same time. Whereas, I want to play one after another. Thanks. Originally posted by AsifA on ROS Answers with karma: 231 on 2014-08-18 Post score: 1 If you load 3 sequential bag files recorded with --split they will playback according to the timestamps that they were received. So although they will actually be playing back simultaneously. At any given timestep data will only come from one of the bags. Originally posted by tfoote with karma: 58457 on 2014-08-18 This answer was ACCEPTED on the original site Post score: 7 Original comments Comment by Murilo F. M. on 2014-08-18: Thanks! I was (embarrassingly) oblivious of timestamps when I thought of the problem. Comment by AsifA on 2014-08-19: Thanks Tully. It works. :)
{ "domain": "robotics.stackexchange", "id": 19087, "lm_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, rosbag, play", "url": null }
beginner, php, ruby, ruby-on-rails There's two different interpreters involved: bash + php. Each is powerful. Each does their own interpretation of argument characters. There is room to lose. Now, if we just ask for ls output, there's no shell interpreter involved, as ruby does fork / exec of an ls child. But if the backtick command can contain e.g. a | pipe symbol, then ruby definitely delegates to the shell, which in turn delegates to spawned children. You should have a regex that describes a valid password hash, e.g. /^[0-9a-f]+$/. Only pass that password argument to a child if it matches the regex, that is, only if it could possibly be valid. Php accepts a wide variety of command line options, which can potentially do interesting things for an attacker. I don't want to know about them. I don't want to have to reason about the properties of the attack surface the current proposed code opens up for an attacker. Much better to be conservative in what you send down to the child process. specification The OP question didn't really flesh out the input space in ways that would let an implementer distinguish between good and bad scenarios. automated tests This submission contains no integration or unit tests that would increase our confidence in the ability of target code to reject carefully crafted attack inputs. This code fails to accomplish its stated goals, which is to securely verify client credentials in the presence of attacker clients. I would not be willing to delegate or accept maintenance tasks on this codebase in its current form.
{ "domain": "codereview.stackexchange", "id": 45369, "lm_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, php, ruby, ruby-on-rails", "url": null }
c++ FrameTaskManager::currentFrame() should be const. There's no need for using task_t = std::function<void()>; in FrameTaskManager.cpp. frame class I don't think there's a lot of benefit to providing a default-constructor and default values for Frame. It allows the user to not think about what the values should be... which isn't actually a good thing. (And in this case it enables a bug, detailed below). Frame(int major, int minor) Could use some error checking (assert / throw) to ensure minor frame is valid. major and minor should probably be unsigned types, since (minor at least) can never be negative. minor could also use a smaller integral type if desired. This does require more thought when doing arithmetic, but that's not necessarily a bad thing... Either way, these types should have using declarations or typedefs in the FrameManager class, which can be used for passing arguments etc. (Bug:) auto f = FrameTaskManager::Frame(0, 0) + (-5) gives a frame of (0, -5), which probably isn't desired behaviour. Using unsigned types as suggested above makes it more obvious that we have to think about / check this stuff from the start (even if it doesn't make the actual arithmetic any easier). operator+ The current operator+ seems like a bit of a special-case compromise. The pre-increment operator (or better, a function called advance()) would provide the needed functionality. An advance(int major, int minor) version could also be added to handle changing both values if necessary. The FrameCounter class is not needed - we just need a Frame _currentFrame member. task scheduling
{ "domain": "codereview.stackexchange", "id": 29602, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++", "url": null }
special-relativity, spacetime, inertial-frames, lorentz-symmetry, invariants $$ \frac{d}{d\tau}(ct,x,y,z) \tag{3} $$ transforms just like the quantity $(ct,x,y,z)$. This is why (3) is a 4-vector.
{ "domain": "physics.stackexchange", "id": 54522, "lm_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, inertial-frames, lorentz-symmetry, invariants", "url": null }
general-relativity, differential-geometry, tensor-calculus \begin{align} \lambda_{a;bc} - \lambda_{a;cb} = R^{d}_{\ \ abc} \lambda_{d} \tag{Riemman tensor}. \end{align} However, if one attempts to calculate the Riemman tensor from Eq. (Riemman tensor) by using the definition of the covariant derivative from Eq. (linuxfreebird), one obtains the following result \begin{align} \lambda_{a;bc} &=& \dfrac{\partial y_n}{\partial x_a} \dfrac{\partial }{\partial x_b} \left( \dfrac{\partial x_m}{\partial y_n} \dfrac{\partial y_f}{\partial x_m} \dfrac{\partial }{\partial x_c} \left( \dfrac{\partial x_d}{\partial y_f} \lambda_{d} \right) \right) \\&=& \dfrac{\partial y_n}{\partial x_a} \dfrac{\partial^2 }{\partial x_b \partial x_c} \left( \dfrac{\partial x_d}{\partial y_n} \lambda_{d} \right) , \end{align} which states that the commutator of the covariant derivative is zero, hence the Riemman tensor is zero. This was the inconsistency I discovered from Eq. (linuxfreebird) and proves Eq. (linuxfreebird) cannot be an equivalent representation of Eq. (Rindler). However, I have been unable to prove why Eq. (linuxfreebird) is incorrect. Section (The Supporting Material) provides my formulation of Eq. (linuxfreebird). The Supporting Material Below is my original formulation of Eq. (linuxfreebird): Rindler defines the Christoffel symbol of the first kind as \begin{align} \tag{12} \Gamma_{b ca} = \dfrac{1}{2} \left(
{ "domain": "physics.stackexchange", "id": 12383, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "general-relativity, differential-geometry, tensor-calculus", "url": null }
electrostatics, electric-fields, potential, dielectric, conservative-field Fringe fields of the capacitor may be interfering here somehow (although i only took a loop very close to the interface) Both the electric fields are equal The net electric fields inside both the dielectrics need to be same. Why? Because since electric fields are conservative, which means we can define a corresponding electric potential and thus electric potential difference. The electric potential difference between any two points, $a$ and $b$, is $$\Delta V=\int_a^b \mathbf E \cdot \mathrm d \mathbf l$$ The value of this potential difference stays the same irrespective of the path taken in going from $a$ to $b$. Now, since both the plates are conductors, thus the potential of every point on a certain plate is same. This also implies that the potential difference between any two points, one on the left plate and another on the right plate, is the same. So, now let's find the potential difference between two points which have the dielectric 1 separating them. That would be $$\Delta V_1 = \int _0^d \mathbf E_1 \cdot \mathrm d \mathbf x=E_1d$$ Similarly, the potential difference between any two points separated by dielectric 2 will be $$\Delta V_2 =\int _0^d \mathbf E_2 \cdot \mathrm d \mathbf x=E_2d$$ But since $\Delta V_1=\Delta V_2$, therefore $$E_1d=E_2d\implies E_1=E_2$$ This also implies that $$\oint \mathbf E\cdot \mathrm d \mathbf l=0\tag{1}$$ for any loop in between the two plates. This can also equivalently expressed by the following Maxwell's relation $$\nabla \times \mathbf E=-\frac{\partial \mathbf B}{\partial t}\tag{2}$$ Since $\displaystyle\frac{\partial \mathbf B}{\partial t}$ in the case of electrostatic field only, thus the equation $(2)$ simplifies to
{ "domain": "physics.stackexchange", "id": 68319, "lm_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, electric-fields, potential, dielectric, conservative-field", "url": null }
quantum-mechanics, hilbert-space $$ ⟨\tilde \phi_\alpha^\mathrm{(B)}|\beta^\mathrm{(B)}⟩ = ⟨\alpha^\mathrm{(A)},\beta^\mathrm{(B)}|\Phi^\mathrm{(AB)}⟩; $$ taking the conjugate we ge that the $|\tilde \phi_\alpha^\mathrm{(B)}⟩$ we were guaranteed is the $|\phi_\alpha^\mathrm{(B)}⟩$ we found earlier, and that concludes the proof. So again, to remark on the structure of the proof I just gave: I started with an explicit coordinate representation, which I then used to perform an explicit coordinate calculation of an invariant property, that then turned out to be strong enough to stand on its own feet. This structure is remarkably common $-$ turn to any textbook on vector calculus and you'll see plenty of similar proofs. (Which is, of course, no surprise, since it's the same fundamental linear-algebraic structures that are of interest.) The proof of the completeness relation is similar and it is exactly what you've already posted in your answer.
{ "domain": "physics.stackexchange", "id": 42082, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, hilbert-space", "url": null }
quantum-spin A photon seems to travel, and can be polarized, correct? In such geometry, the rotation of polarization occurs in the plane perpendicular to the direction of the photon's direction of motion. But what would it mean for the polarization when for photons that have been slowed to a stop, as I believe scientists have managed to do? Or more applicably, what would it mean for the "spin" or "polarization" (if they are indeed closely related) for an electron that is bound by a positive charge, not having any real direction of motion as a photon does (or does it?)? The spin of the photon is intrinsic in its description as an elementary particle, +/-1 when measured. There is no zero component because the photon has mass=0., so the spin is always either parallel or antiparallel to the direction of motion of the photon. This wiki article describes the relation between light polarization and photon spin. I find this image useful: Left and right handed circular polarization, and their associate angular momenta. The polarization of the classical electromagnetic wave is the direction of the electric field (by convention), seen here as the red arrows giving the circular polarization of the beam , in this example.The purple arrow shows an individual photon in the em wave which is circularly polarized , left hand top, right hand bottom. The classical beam is built up (emerges) from an enormous number of photons, each of which will have its spin either parallel or antiparallel to the direction of motion of the electromagnetic wave (ensemble of photons). This orientation (+/-1) reflects, like a right hand ( left hand) rule the direction of propagation of the rotation, that is the connection of photon spin to electromagnetic wave polarization. Each individual photon wavefunction is also described by a value connected with the vector potential of the electromagnetic field ( not shown in the image) and that is what contributes to the build up of the red vectors (electric [and magnetic] field[s]). So the polarization of classical electromagnetic waves is not a good analogue for the polarization of an electron beam, for example, where the experimenter tries to orient the spins of the electrons in one direction. The electron spin is also an intrinsic phenomenon and it is what is measured in describing its polarization.
{ "domain": "physics.stackexchange", "id": 19108, "lm_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-spin", "url": null }
pressure, statics, airflow, hvac Title: What is the difference in CFM, at a given static pressure, between a CPU fan and a Squirrel Cage Blower fan when moving air through ductwork? I have a Delta ASB0912L DC Brushless fan. PDF here. In the datasheet it says, RPM 3800 CFM 67.80 IN H2O 0.302 On the blower, squirrel cage fan, Dayton from Grainger, found here (Rectangular Permanent Split Capacitor OEM Specialty Blower, Flange: Yes, Wheel Dia: 3", 115VAC) It says, RPM 3010 CFM @ 0.200-In. SP78 CFM @ 0.300-In. SP74 I want to exhaust fumes from a spray booth. I know there are many articles and plans online. I am trying to understand the math here. It seems intuitive to me the Grainger fan is more powerful and will remove more air than the CPU fan. But the math makes no sense to me. On the CPU fan it has .302 for Static Pressure and .3 for the Grainger and the CFM is pretty close. I am moving air through 6' of ductwork, 4" in diameter, and neither tell me what CFM means in this context. Given a 2'Lx2'Wx2'H spray box. Again, I'm not asking for plans. I can get that already. I only want to understand what these numbers mean and the spray box application gives the question context. Why doesn't the CPU fan move almost as much as the Blower based on the specifications? Also, is the Delta IN H20 given static pressure or is that something else? Why doesn't the CPU fan move almost as much as the Blower based on the specifications? It is because of the working principle of fan and blower. The fan takes the air axially(axis of rotation) and pushing it in the axial direction. But the Blower works like a centrifugal compressor in which axial inlet and radial/tangential outlet are present. Fundamentally, due to the pressure reactions, the centrifugal pump/turbines are more efficient than the axial pump/turbines. That is what you are seeing as the data in the sheets. Also, is the Delta IN H20 given static pressure or is that something else? Both are in the units of inches of water column.
{ "domain": "engineering.stackexchange", "id": 2506, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "pressure, statics, airflow, hvac", "url": null }
electromagnetism, electrostatics, electric-fields, capacitance, dielectric $$E=\frac{\alpha}{2\epsilon_0\pi}\int_a^{d-a}(\frac{1}{2\epsilon_rr}+\frac{1}{r})dr$$. Solving this doesn't get me even close to the solution which appears to be $$F'=\frac{\alpha^2}{2\pi\epsilon_0d}$$ Force per unit length would be given by $$F=\alpha E.$$ For an infinite line charge the electric field at a distance $d$ is, by Gauss' Law, $$E=\frac{\alpha}{2\pi \epsilon_{0} d}.$$ The dielectric is made of dipoles, so you should be able to figure out why it makes no difference to the field outside the wire. And the two wires are far enough apart that we can ignore polarization created by the other wire's field.
{ "domain": "physics.stackexchange", "id": 17946, "lm_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, electrostatics, electric-fields, capacitance, dielectric", "url": null }
then you will get where r, s, and n are all positive integers (with no common factors). r= -7 s= 4 n=-118 [\quote] Almost. The conjugate of $a\sqrt{b} + c\sqrt{d}$ is $a\sqrt{b} - c\sqrt{d}$. You only negate one of the terms. Think of it this way. We are applying the identity: $(a + b)(a - b) = a^2 - b^2$. This ensures that the square root signs disappear. And the last question I have no clue how to do. Find all solutions of the equation and express them in the form : First input the solution with b<0 here: the real number a equals _____ and the real number b equals ______ Then input the solution with b>0 here: the real number a equals _______ and the real number b equals _________ $t + 4 + \frac{6}{t} = 0$ Multiply both sides by t: $t^2 + 4t + 6 = 0$ <-- We have to remember to check the solutions and make sure $t \neq 0$ because the original expression forbids it. As it happens we won't have to worry here. $t = \frac{-4 \pm \sqrt{4^2 - 4 \cdot 1 \cdot 6}}{2 \cdot 1}$ $t = \frac{-4 \pm \sqrt{16 - 24}}{2}$ $t = \frac{-4 \pm \sqrt{-8}}{2}$ $t = \frac{-4 \pm \sqrt{-4 \cdot 2}}{2}$ $t = \frac{-4 \pm 2\sqrt{-2}}{2}$ $t = -2 \pm \sqrt{-2}$ $t = -2 \pm i \sqrt{2}$ -Dan 11. Ok, I see how to came to figure that out. Now I'm having trouble figuring out how to answer that question.
{ "domain": "mathhelpforum.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9777138151101527, "lm_q1q2_score": 0.8147529652605083, "lm_q2_score": 0.8333245911726382, "openwebmath_perplexity": 790.446857772163, "openwebmath_score": 0.7544636130332947, "tags": null, "url": "http://mathhelpforum.com/algebra/7760-complex-numbers.html" }
oxidation-state, valence-bond-theory Title: Why does Pb normally have an oxidation number of +2? Why does $\ce{Pb}$ have an oxidation number of $2^{+}$ while carbon and other elements in the same group have an oxidation number of $4^{+}$? Furthermore, why doesn't carbon also have a $2^{+}$ oxidation number, as can't it also give up its two electrons in the p-suborbital to have a full s-suborbital? Why does it prefer to gain four electrons instead to fill the p-suborbital? Similarly, why can't $\ce{Pb}$ gain four electrons just like carbon instead of giving up two? Finally, doesn't this mean that $\ce{Pb}$ forms ionic bonds? Why doesn't carbon do the same? Why can't lead gain four electrons? The lower you go on the periodic table, the lesser you will find elements that have a more non-metallic character (so with this I mean elements that will have a lower tendency to gain electrons). Just visualize a lead atom with a very small nucleus and a large area surrounding the nucleus, filled with electrons. Now, the more you go away from the nucleus, the weaker the positively charged nucleus can 'pull' on the outer , negatively charged, valence electrons. Elements that haven't got a very tight grip on these valence electrons, will lose their valence electrons. However, elements with a small atomic radius (such as Fluorine) will have such a tight grip on its valence electrons, that it will even be able to snatch electrons from other atoms.
{ "domain": "chemistry.stackexchange", "id": 1059, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "oxidation-state, valence-bond-theory", "url": null }
python, python-3.x, gui, raspberry-pi Title: Measuring the speed of a river I already improved my program with the suggestions of @Mast. As requested by him I re-upload the code in English so we can check it out together. But before I'll explain a little bit what this program does. As my brother is a hydrogeologist, he needed a program that could transform spin of an hydrometric reel into speed (here is a brief explanation with a photo under "Measuring with small hydrometric reel"), to calculate the flow of the river. This has to go on a Raspberry Pi, that he will bring on the field to simplify his work. That's why I chose Python and appJar to do this work. Here is the code improved as discussed in this other question: import csv #import RPi.GPIO as GPIO #library for raspberry pins import time from appJar import gui l=[] class measure: #All the measures that needs to be into the csv file global l def fileName(self):#Station where you do the measures have a code, and we call the filename with that code fileName=app.getEntry("e1") +'.csv' return fileName def vertical(self):#The point where you measure the speed of the river vertical=float(app.getEntry("e2")) return vertical def depthTot(self): depthtot=float(app.getEntry("e3"))#The depth of the river where you are doing the measure return depthtot def edgeDist(self): #Distance from the edge of the river e=float(app.getEntry("e2")) return e def hydroDepth(self): # Depth where you have the hydrometric reel hydrodepth=float(app.getEntry("e4")) return hydrodepth def changeMs(self): #Function that clears the entries for the measures, as you do many measures on the same station app.clearEntry("e2") app.clearEntry("e3") app.clearEntry("e4") app.clearLabel("e5") app.showButton("Start measure")
{ "domain": "codereview.stackexchange", "id": 30116, "lm_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, gui, raspberry-pi", "url": null }
two of the parallelogram,,. Sides of the shorter diagonal of a parallelogram is 10.73 are three cases when a parallelogram are.. Similar congruent triangles the inputs provided within parallelogram the diagonals of a parallelogram Abcd Intersect at.! Of intersecting parallel lines with a right angle figure below diagonals AC and BD each... Rotate the two diagonals around this joint, and diagonals properties of the second diagonal of the is... Done with the diagonals 's end points ) below diagonals AC and BD bisect each other this calculator computes diagonals! Intersect at O inputs provided areas of the parallelogram Kite ; rectangle ; rhombus ; square Discover... Points ) is, each diagonal cuts the other into two equal parts joint and! Its sides, angles, and diagonal of parallelogram this Drag the orange dots each. General quadrilateral ; Kite ; rectangle ; rhombus ; square ; Discover Resources parallelogram perpendicular... Rectangles and general parallelograms, do not about it are all … the diagonals split the figure into pairs. Opposite corners ) bisect each other answer is “ maybe. ” diagonals a! Bisect each other = 6 m × diagonal of parallelogram m = 18 m 2 do bisect the angles are acute obtuse... Ac=24 //Given a parallelogram is ( diagonal x diagonal /2 ), or a rhombus with a right.!, two of the shorter diagonal of the parallelogram, and form different parallelogram by! 2 pairs of intersecting parallel lines a Kite are perpendicular the shape into two equal.... And students a day in preparation for their board … the diagonals of a parallelogram is 10.73 sides parallel., if the diagonals bisect the angles diagonals do indeed bisect the angles are or! Because the parallelogram has adjacent angles as acute and obtuse, the diagonals of a parallelogram where all angles acute. Parallelogram are simply those things that are true about it parallelogram ( by the... Form different parallelogram ( by connecting the diagonals of a parallelogram are perpendicular parallelogram definition a! Abcd Intersect at O pairs of intersecting parallel lines ; rectangle ; rhombus ; ;. And a
{ "domain": "webreus.net", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9702399043329856, "lm_q1q2_score": 0.8340800820301003, "lm_q2_score": 0.8596637577007394, "openwebmath_perplexity": 787.70550087338, "openwebmath_score": 0.734754204750061, "tags": null, "url": "http://3790863534.srv040078.webreus.net/5j9dh35/diagonal-of-parallelogram-7b0654" }
data-structures, trees, sets Let $x_{\text{new}}$ be the largest element $x$ among $x_{-2}, x_{-1}, x_\ell, x_{1}, x_{2}$ such that $d(x)\le0$. Update $(x_\ell, \delta_\ell)$ to $(x_{\text{new}}, d(x_{\text{new}}))$ Update $(x_r, \delta_r)$ similarly, which should take $O(\log n)$ time as well. Any kind of balanced search trees can be used as long as the insertion, finding the predecessor and finding the successor can be done in $O(\log n)$. In particular, we can use AVL tree or red-black tree. Step 1 takes $O(\log n)$ time. Each search for predecessor or successor in Step 2 takes $O(\log n)$ time. Each computation of $d(*)$ takes $O(1)$ time, as we know $d(x_\ell)$. For example, $d(x_{-1})=d(x_\ell)-\lambda_A(x_{-1})-\lambda_B(x_\ell)$, where $\lambda_A(x_{-1})$ is 1 if $x_{-1}\in A$ and 0 otherwise. $\lambda_B(x_{\ell})$ is 1 if $x_{\ell}\in B$ and 0 otherwise. Similarly, $d(x_1)=d(x_\ell)+\lambda_A(x_\ell)+\lambda_B(x_1)$. So step 2 takes $O(\log n)$ tims. Similarly, step 3 takes $O(\log n)$ time. When there are duplicated elements in $A$ and $B$, the idea is similar but somewhat more complicated. A balanced search tree $T$ will store all distinct elements in $A$ and $B$. Each node will store
{ "domain": "cs.stackexchange", "id": 13945, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "data-structures, trees, sets", "url": null }
quantum-field-theory, quantum-chromodynamics, spinors, s-matrix-theory, helicity My question is the following. Since Eq. (1) ≠ (2), have I already made a mistake in my calculation, or is there a chance that the contributions from the other channels may conspire to yield the correct squared amplitude for the entire process, even though Eq. (1) ≠ (2)? You did not make a mistake! You were correct a month ago! Indeed, the contributions from the other channels do conspire to yield the correct squared amplitude for the entire process, even with Eq. (1) ≠ (2).
{ "domain": "physics.stackexchange", "id": 73553, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-field-theory, quantum-chromodynamics, spinors, s-matrix-theory, helicity", "url": null }
python, time-series, regression, predictive-modeling data = [['2021-01-01', 11, 20, 30], ['2021-01-02', 22, 40, 60], ['2021-01-03', 33, 60, 90]] df = pd.DataFrame(data, columns = ['Day', 'X', 'Y', 'Z']) df['ds'] = pd.to_datetime(df.Day) # Convert day to datetime for prophet df['y'] = df.Z # Give prophet specific name # Fit multivariate timeseries from fbprophet import Prophet prophet = Prophet() prophet.add_regressor('X') prophet.add_regressor('Y') prophet.fit(df)
{ "domain": "datascience.stackexchange", "id": 9540, "lm_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, time-series, regression, predictive-modeling", "url": null }
c, linux Title: UNIX semaphores I wrote an example program about UNIX semaphores, where a process and its child lock/unlock the same semaphore. I would appreciate your feedback about what I could improve in my C style. Generally I feel that the program flow is hard to read because of all those error checks, but I didn't find a better way to write it. It's also breaking the rule of "one vertical screen maximum per function" but I don't see a logical way to split it into functions. #include <semaphore.h> #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/mman.h> int main(void) { /* place semaphore in shared memory */ sem_t *sema = mmap(NULL, sizeof(sema), PROT_READ |PROT_WRITE,MAP_SHARED|MAP_ANONYMOUS, -1, 0); if (!sema) { perror("Out of memory"); exit(EXIT_FAILURE); } /* create, initialize semaphore */ if (sem_init(sema, 1, 0) < 0) { perror("semaphore initilization"); exit(EXIT_FAILURE); } int i, nloop=10; int ret = fork(); if (ret < 0) { perror("fork failed"); exit(EXIT_FAILURE); } if (ret == 0) { /* child process*/ for (i = 0; i < nloop; i++) { printf("child unlocks semaphore: %d\n", i); sem_post(sema); sleep(1); } if (munmap(sema, sizeof(sema)) < 0) { perror("munmap failed"); exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); }
{ "domain": "codereview.stackexchange", "id": 3892, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c, linux", "url": null }
quantum-field-theory, correlation-functions, time-evolution, propagator So everything is consistent- time translation is generated by the Hamiltonian ($p^0$) while spatial translation is generated by $\vec{p}$. Note the power of a covariant formulation-you can encode all of this as the single operator $e^{ix^\mu \hat{p}_\mu}$.
{ "domain": "physics.stackexchange", "id": 80597, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-field-theory, correlation-functions, time-evolution, propagator", "url": null }
fluid-dynamics, friction, torque, drag, angular-velocity where $\mu$ is dynamic viscosity coefficient which for air at room temperature is $1.8 \times 10^{-5}$. (see derivation here) End notes I'm looking to use all these in practice but the calculations for arbitrary real-world shapes might certainly get hard. Also notice that we don't take in to account all the effects that different shapes likes concave or wings etc can produce. From looking at purely applied point of view, it seems that drag due to shear would be very small because of not only very small constant $\mu$ for air but also the fact it depends only on first power of $\omega$ and second power of $r$. So I might ignore it all together for practical purposes as I don't have any shapes that will amplify its effect. For frictional drag, one approximation might be to compute area "component" in each axis to form "area vector" and then do coefficient wise multiplication with velocity vector (in body frame) twice. Here velocity vector may simply be approximated by multiplying angular velocity with average encompassing radius of body in axis's direction. Another quick note: So how does physics simulation engines handle angular drag computation? So far I have see that they take easy way out: Just define some constant like 0.01 and reduce angular velocity by that amount each time step. This eliminates surprises like forever rotating body but this just simply isn't right, obviously. Word of caution: I'm not expert on fluid dynamics so please do not view above as an official statement from an expert and please feel free to comment if you see any mistakes! It would be super awesome if some expert in the field can validate this answer, of course!
{ "domain": "physics.stackexchange", "id": 36870, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "fluid-dynamics, friction, torque, drag, angular-velocity", "url": null }
general-relativity, cosmology, astrophysics, neutron-stars Title: Non-Comulative nature of Mass-Radius curves of Neutron Stars For finding the mass-radius curve of neutron stars, we can solve TOV Equations which are constraint equations got by solving Einsteins equations. The boundary conditions are $m(r=0)=0$ and $\rho(r=0)=\rho_c$. Then we put a physical condition that for $r\rightarrow r_*$(radius of star), $\rho\rightarrow 0$, and by this we can get the limiting radius $r_*$ and mass $m_*$ and plots like and for density I understood and took it from MIT OCW One can also do the same process for Modified Gravities and more involved $P(\rho)$ matter equations I have seen many places where the mass-radius curve looks like This curve is from the paper "Neutron stars in Einstein-Λ gravity: the cosmological constant effects G. H. Bordbar1, , S. H. Hendi1, and B. Eslam Panah" Confusion: Why isn't the mass of neutron star cumulative as radius increases, i.e. it must be $0$ at $r=0$ and reach its maximum at $r=r_*$? Maybe I am not getting the right interpretation of these curves. So, I would be grateful for some explanation or references. Your non-cumulative curves relate the total mass of the star to its surface radius. Different points represent different stars. Your cumulative curves relate enclosed mass of a star versus radius of the shell enclosing the mass. Different points represent different radii within a given star.
{ "domain": "physics.stackexchange", "id": 86981, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "general-relativity, cosmology, astrophysics, neutron-stars", "url": null }
rosrun joint_state = JointState() joint_state.header.stamp = rospy.Time.now() # Add Free Joints. for (name, joint) in self.free_joints.items(): joint_state.name.append(str(name)) joint_state.position.append(joint['value']) joint_state.velocity.append(0) return joint_state while not rospy.is_shutdown(): self.get_joints() self.send_ke_servo_pub.publish(self.kirim_ke_servo) self.send_ke_servo.header.stamp = rospy.Time.now() self.save_send_ke_servo = self.kirim_ke_servo def joint_state_handler(self, msg): for joint in msg.name: self.kirim_ke_urdf = msg def shutdown(self): rospy.loginfo('Shutting down Tracker Node.') if __name__ == '__main__': try: tracksendi() except rospy.ROSInterruptException: pass Originally posted by Rizqa on ROS Answers with karma: 45 on 2013-04-01 Post score: 0 The problem is most likely in your code and has nothing to do with rosrun. It appears that your node did start, but it didn't keep running for very long. For the node to continue running, it has to either continuously be doing things (for example: while not rospy.is_shutdown(): #do stuff), or include rospy.spin() somewhere to keep it running after initialization is done. (You can see examples of both of those in this tutorial.) If that wasn't the problem, you'll need to post your code before anyone will be able to help you. EDIT: The actual problem appears to have been that a return statement was placed too early a method. Fixing this revealed another problem with infinite recursive method calls. Originally posted by Elizabeth C with karma: 138 on 2013-04-01 This answer was ACCEPTED on the original site Post score: 5
{ "domain": "robotics.stackexchange", "id": 13628, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "rosrun", "url": null }
c#, http, .net-core, httpclient Next steps If you have received a 429 that means the downstream system is overloaded / under pressure / flooded with requests. So, it might make sense to let it perform self-healing and then retry any pending requests. With the above setup each and every concurrent requests are sent to the downstream system to receive the same "I'm busy" response. It would be nice if we could avoid this unnecessary roundtrips to get the same message. The good news is that we can do this by using a Circuit Breaker. This can be used to short cut any outgoing requests while the downstream is trying to heal itself. The CB has a shared state which can be accessed by the concurrent requests. So, rather than flooding the downstream with new requests we can prevent that on the client-side by short-cutting them. We can combine the retry policy with circuit breaker to define a protocol which will respect the RetryAfter header and applies that to all outgoing requests. I would like to mention one other policy which might be useful here and that is the timeout policy. It allows you to define an upper limit on time to get a valuable response. Either you can define that time constraint on a per retry attempt bases retry > local_timeout Or you can define that time constraint as an overarching constraint which covers all retry attempts global_timeout > retry Or you can combine both global_timeout (60 seconds) > retry (three times) > local_timeout (2 seconds) And of course the Circuit Breaker could be added to this policy chain as well. I have posted a lots of answers on SO about this topic, just to name a few: 1, 2, 3, 4, etc.
{ "domain": "codereview.stackexchange", "id": 44083, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, http, .net-core, httpclient", "url": null }
Before you modify your caloric intake, spend a while logging what you eat and see how many calories that puts you at. If your activity level is consistent on a weekly basis, you can pretty well see what happens over a month if you log your food intake, weight, and waist measurement. This way, after a month you can look at the overall trends. If your weight and waist were staying roughly constant and your caloric intake was consistent, then you have probably found your maintenance level calorie intake for your current level of activity. I work a desk job, but I exercise 5 to 6 days a week, including strength training and a bit of cycling. I'm guessing a 1.5 multiplier is reasonable for me for maintenance. ## Wednesday, December 20, 2017 ### Equation of Circle in 3D and Snap Tangent For a time I was on a bit of an AutoCAD like calculation kick and went through some interesting calculations like snap tangent, snap perpendicular, and intersection of a line with a plane. I wanted to take the next step on snap tangent and consider snap tangent to a sphere. Snap tangent means, start with some point and try to find a point on the destination object (circle, sphere, ellipse, anything) that causes the line segment between the first point and the second point to be tangent to the object selected. My post about snap tangent, showed the result for a circle and worked in 2D. If you get the concept in 2D and are ready to take the concept to 3D for a sphere, you probably recognize without proof that the set of possible points on the sphere which will result in a tangential point, forms a circle. You can pretty much mentally extrapolate from the following picture which a repeat from the previous post. Fig. 1 - Can you imagine the snap tangent circle on this if we allow the figure to represent a sphere? The snap tangent circle has center $$E$$ and radius $$a$$. I will not repeat the method of calculation from the previous post but will simply observe that we can produce the values $$E$$ and $$a$$, which are the center and radius of the snap tangent circle. We add to this the normal of this circle, $$N = A - C$$, and then normalize $$N$$.
{ "domain": "blogspot.com", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9830850847509661, "lm_q1q2_score": 0.8170843274762134, "lm_q2_score": 0.8311430415844384, "openwebmath_perplexity": 686.6043304835285, "openwebmath_score": 0.5754119753837585, "tags": null, "url": "https://darrenirvine.blogspot.com/" }
quantum-mechanics, quantum-field-theory, lagrangian-formalism, action The integral evaluates to $$e^{-i\delta tV(q_j)}\int\frac{dp}{2\pi}e^{-i\delta t(p^2/2m)+ip(q_{j+1}-q_j)}=\sqrt{-\frac{im}{2\pi\delta t}}e^{[im(q_{j+1}-q_j)^2]/2\delta t-i\delta tV(q_j)}=Ce^{i\delta t\{(m/2)[(q_{j+1}-q_j)/\delta t]^2-V(q_j)\}}$$ Plugging this into our formula for the path integral yields $$\langle q_F|e^{-iHt}|q_I\rangle=C^N\left(\prod_{i=1}^{N-1}\int dq_i\right)\exp\left\{i\delta t\sum_{j=0}^{N-1}\left[\frac{m}{2}\left(\frac{q_{j+1}-q_j}{\delta t}\right)^2-V(q_j)\right]\right\}$$ Now we go to the continuum limit, $$N\rightarrow\infty\quad\delta t\rightarrow 0$$ Then $$\lim_{\delta t\rightarrow 0}\left[\frac{q_{j+1}-q_j}{\delta t}\right]^2=\dot{q}^2$$ and $$\lim_{N\rightarrow\infty}\sum_{j=0}^{N-1}\delta t=\int_0^T dt$$ Also define the integral over all paths
{ "domain": "physics.stackexchange", "id": 19486, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, quantum-field-theory, lagrangian-formalism, action", "url": null }
matlab, frequency-response, bandpass, digital-filters, speech-synthesis Title: Computation of parameter filter to match a given frequency response I'm looking for the practical way to compute the parameters ($a_1$, $a_2$) of a digital filter to match a certain frequency response. I'm studying the 12-poles filter of the vintage component SP0256 which is used in speech synthesis, using bandpass filters to create frequency response of allophones. The 12-poles filter is composed of six 2-poles filters : $$H(z)=\frac{1}{1-2 a_1 z^{-1}-a_2 z^{-2}}$$ I came accros a github of the FPGA implementation of the SP06256 which provide a matlab example of this filter for the 'EH' allophone. I ploted the 6 frequency responses in blue and the final one in red with matlab :
{ "domain": "dsp.stackexchange", "id": 7031, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "matlab, frequency-response, bandpass, digital-filters, speech-synthesis", "url": null }
neural-network, matlab, mnist Title: MNIST 2-layer NN failing to recognize certain digits Recently I've been taking a look into some basic multilayer neural networks, and I decided to try tackling the MNIST database of handwritten digits using a 2 layer neural network with 100 neurons in the hidden layer. My network has a hidden layer using ReLU, and the output layer uses the sigmoid function. The cost is calculated by MSE, and weights are updated using SGD. Below is the code written in MATLAB for training the network. When training this network, I discovered that it has somehow failed to recognize every 8 and 9 in the data set. It has some problems recognizing other numbers, but not nearly as much as 8 or 9. How can I fix this issue? Edit: The results when training a network from a random set of weights are quite inconsistent and oftentimes have low accuracy. Is there something wrong with the backpropagation step or is the network structure not the best for digit recognition? *dsigmoid and dReLU are the derivatives of their respective functions. function [trainedWeights1, trainedWeights2] = twoLayerSGD(weights1, weights2, inputs, outputs, alpha, shuffle) % Trains a 2 layer perceptron using stochastic gradient descent and MSE % % function [trainedWeights1, trainedWeights2] = twoLayerSGD(weights2, weights1, inputs, outputs, alpha, numHiddenLayers) % Inputs: % weights1 = weights between input layer and hidden layer as a matrix % where row i and column j represents the weight between node % j of the input layer and node i of the hidden layer % weights2 = weights between hidden layer and output layer as a matrix % where row i and column j represents the weight between node j of the % input layer and node i of the hidden layer % inputs = inputs of the training data, where each set of inputs is % stored as a row vector % outputs = the correct outputs of the training data, where each set of % outputs is stored as a row vector % alpha = the learning rate, default is 0.005 % shuffle = boolean value, determines whether the training cases will be % randomly ordered, default is false % % Outputs: % trainedWeights1 = the trained weight matrix for the weights between the % input layer and hidden layer
{ "domain": "datascience.stackexchange", "id": 8786, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "neural-network, matlab, mnist", "url": null }
php, mvc, url-routing // Get a ReflectionMethod object $method = $ref->getMethod( ( $this->getAction() != null && $ref->hasMethod( $this->getAction() ) ) ? $this->getAction() : BaseController::DEFAULT_METHOD ); // Track the request status $this->request->requestStatus( ( $ref->name == BaseController::ERROR_CONTROLLER ) ? HttpStatus::HTTP_NOT_FOUND : HttpStatus::HTTP_OK ); // Invoke the Controller::method() $method->invoke( $controller ); } else { trigger_error( 'Interface IContoller must be implemented.', E_USER_ERROR ); } } catch( Exception $e ) { header( HttpStatus::getHttpHeader( HttpStatus::HTTP_NOT_IMPLEMENTED ) ); throw new Exception(__METHOD__ . ' threw an exception: ' . $e->getMessage()); } } Request::parseURI() This method makes use of an array of regular expressions, to match common and specific requests: "#^/(?<controller>[\w-]+)?(?:/(?<action>[\w-]+))?(?:/(?<params>[^?]+).*?|$)?#" "#^/admin/(?:(?<controller>[\w]+))?/(?:(?<action>[\w]+))?/(?:(?<params>[^?]+).*?|$)?#" Note: The second expression is intended for a specific module, targeting the request for a controller defined in the second segment. The segments can appear as follows: /controller/action/argument-1/argument-2/argument-3/etc /admin/controller/action/argument-1/argument-2/argument-3/etc
{ "domain": "codereview.stackexchange", "id": 2543, "lm_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, mvc, url-routing", "url": null }
c++, beginner, game void menuSkills() { //Skills menu cout << "\t\t\t\t\t\t\t Skill points: " << skills << "\n"; cout << "\t\t\t\t\t\tHealth: " << hp << " Damage: " << damage << " Protection: " << shield << "\n"; cout << "Select an action:\nImprove health skill: 1\nIncrease attack skill: 2\nIncrease Armor Skill: 3\nBack: 4\n"; char choose; cin >> choose; switch (choose) { case '1': if (skills >= 1) { hp += 10.0; skills -= 1; hero_fight_hp = hp; menuSkills(); } else { cout << "\t\t\t\t\t\t Not enough skill points!\n"; menuSkills(); } break; case '2': if (skills >= 1) { damage += 3.0; skills -= 1; menuSkills(); } else { cout << "\t\t\t\t\t\t Not enough skill points!\n"; menuSkills(); } break; case '3': if (skills >= 1) { if (shield < 500) { shield += 12.5; skills -= 1; menuSkills(); } else { cout << "\t\t\t\t\t\tMaximum armor value reached!\n"; menuSkills(); } } else { cout << "\t\t\t\t\t\t Not enough skill points!\n"; menuSkills(); } break; case '4': mainMenu(); break; default: cout << "\t\t\t\t\t\tI don't understand what is required of me\n"; menuSkills(); break; } } void menuHero() { //Hero menu
{ "domain": "codereview.stackexchange", "id": 41277, "lm_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, game", "url": null }
= c$$ And so $E[f(X^*)]=c$. Thus, that 2-valued random variable minimizes the expression $$E[X^4] + \lambda_1E[X] + \lambda_2(E[X^2]-1) + \lambda_3(E[X^3]-m)$$ over all random variables $X \in \mathcal{S}$. In particular, its moments $$(y_1^*,y_2^*,y_3^*,y_4^*) = (E[X^*], E[(X^*)^2], E[(X^*)^3], E[(X^*)^4])$$ solve the unconstrained optimization problem. Further, from my previous answer, we know those moments for $X^*$ satisfy $y_1^*=0, y_2^*=1, y_3^*=m$, and so by the Lagrange multplier lemma we conclude that $(y_1^*,y_2^*,y_3^*,y_4^*)$ is also optimal for the constrained problem. In particular, the value $y_4^*$ achieved by this 2-valued random variable is the minimum possible value of $E[X^4]$ over all random variables that satisfy $E[X]=0, E[X^2]=1, E[X^3]=m$. In fact, we know: $$y_4^* = E[(X^*)^4] = 1+m^2 =c$$ $\Box$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9748211531789391, "lm_q1q2_score": 0.8285698834757296, "lm_q2_score": 0.8499711775577735, "openwebmath_perplexity": 148.4761639952403, "openwebmath_score": 0.999272882938385, "tags": null, "url": "https://math.stackexchange.com/questions/2725861/bound-third-moment-and-fourth-moment" }
python, performance, bioinformatics BEGIN IONS SEQ=GRPGPVAGHHQMPR TITLE=File3249 Spectrum10594 scans: 11084 PEPMASS=499.59366 927079.3 ... ... END IONS There may be a much more computationally inexpensive way to parse. Given 2,000 annotated files to search through, with the above large unannotated file, parsing currently takes ~ 12 hrs on a 2.6 GHz quad-core Intel Haswell CPU. import numpy as np import subprocess as sp import sys from pyteomics import mgf, auxiliary def main(): pep_files = [] if (len(sys.argv) > 0): spec_in = sys.argv[1] else: print 'Not enough Command Line Arguments!' path = '/DeNovo/QE_2706_229_sequest_high_conf.mgf' print spec_in pep_files.append(spec_in) for ann_spectra in pep_files: seq = ann_spectra[:ann_spectra.find('-') - 1] print seq a = np.genfromtxt(ann_spectra, dtype=float, invalid_raise=False, usemask=False, filling_values=0.0, usecols=(0)) b = np.delete(a, 0) entries = []
{ "domain": "codereview.stackexchange", "id": 8516, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, performance, bioinformatics", "url": null }
python, parsing, csv, pandas, email MailSubject = "Spotify Daily Spike" MailAdress ="" MailInput = """\ <html> <head></head> <body> <h1 style="font-family:calibri;font-size:30px">TODAY'S SPIKEY SONGS</h1> <i><h4 style="font-family:calibri-light;font-size:12px;color:red">THIS IS AN AUTOMATED EMAIL</h4></i> <p style="font-family:calibri light"> """ +str(artist1)+ """ - <a href=""" +link1+ """>""" +str(song1)+ """</a>&emsp;| First released in """ +str(year1)+ """. """ +str(streams1)+ """ streams in the past 24 hours, up """ +str(change1)+ """ places to #""" +str(rank1)+ """<br> """ +str(artist2)+ """ - <a href=""" +link2+ """>""" +str(song2)+ """</a>&emsp;| First released in """ +str(year2)+ """. """ +str(streams2)+ """ streams in the past 24 hours, up """ +str(change2)+ """ places to #""" +str(rank2)+ """<br>
{ "domain": "codereview.stackexchange", "id": 43147, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, parsing, csv, pandas, email", "url": null }
graph-theory, graph-algorithms, ds.data-structures I haven't given this specific problem much thought so it's possible it can be converted to a problem in standard graphs but it seems like these types of problems might be interesting. Your description of an example of your question #2 of having vertex weights and distributing the weight on some $v$ to its neighbours sounds reminiscent of the discharging method famously used in proofs towards the 4-colour theorem. That method, though, had weights assigned to vertices and to the faces of the (planar) graph. But I believe the discharging method has found other applications. Here is a thesis on discharging methods: https://tel.archives-ouvertes.fr/tel-02083632/document As for your general question #2 of example problems studied with vertex weights, consider looking up graceful labelings (e.g. https://en.wikipedia.org/wiki/Graceful_labeling) channel assignment problems (e.g. https://www.sciencedirect.com/science/article/pii/S0166218X04002562) any vertex selection problem (like max clique, min vertex cover, etc) has a vertex-weighted analogue problems that choose orderings of vertices (i.e. assign a timestamp to vertices) like in fire-fighter problems (https://www.sciencedirect.com/science/article/pii/S0012365X0600776X) or graph burning problems (https://arxiv.org/abs/1507.06524) the definition of threshold graphs involves looking at a vertex-weighted graph and adding an edge between any two vertices whose sum of vertex weights exceeds some threshold value: https://en.wikipedia.org/wiki/Threshold_graph Here is a paper talking about more application problems of vertex-weighted graphs: https://www.researchgate.net/publication/268065544_Vertex-weighted_graphs_and_their_applications
{ "domain": "cstheory.stackexchange", "id": 5032, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "graph-theory, graph-algorithms, ds.data-structures", "url": null }
Say colour 1 is used twice. There are (5×4) /2 ways of painting 2 out of the 5 buildings. Now there are 4 colors, so the above is true for each of the 4 colors. We have 4 × [(5×4)/2] ways of painting 2 out of the the 5 buildings with the same color. 3 remaining buildings still need to be painted with the remaining 3 different colors. For each of the ways where 2 equal colors have been used on 2 out of 5 buildings we can paint the remaining 3 buildings in 3×2×1 ways Altogether: 4 × [(5×4)/2] × (3×2×1) = 240.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.986151386528394, "lm_q1q2_score": 0.8496071015305502, "lm_q2_score": 0.861538211208597, "openwebmath_perplexity": 237.71901654202864, "openwebmath_score": 0.7677440047264099, "tags": null, "url": "https://math.stackexchange.com/questions/2278063/calculate-the-number-of-ways-to-paint-5-buildings-with-4-colours-such-that-a" }
programming-languages, logic, coq The smallest solution is called the inductive type, and the largest one the coinductive type. I am skipping technicalities about what "smallest" and "largest" mean precisely (they are the "initial algebra" and "final coalgebra", respectively), but I hope you get the point. In order for us to say that we have a well-defined inductive type, we need to know that the smallest solution to the type equation actually exists. In fact, it does not always exist, sometimes there can be several incomparable solutions, or none at all. The positivity condition in Coq and CIC ensures that a smallest solution exists. It's not the only possible condition one could come up with, and there are variants, but for the purposes of a proof assistant we need something that makes sense computationally, and can actually be verified by a type checker (for instance, it wouldn't do to say that an inductive definition is valid if it defines a $\kappa$-accessible functor for some cardinal $\kappa$, and have the proof checker look for $\kappa$ – hmm, that's an interesting thought). If we now look at your proposed definition Inductive t : Type := b : t | c : ((t -> unit) -> unit) -> t.
{ "domain": "cs.stackexchange", "id": 9831, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "programming-languages, logic, coq", "url": null }
particle-physics, charge, symmetry-breaking, color-charge The local SU(3)×SU(2)×U(1) gauge symmetry is an internal symmetry that essentially defines the Standard Model. Roughly, the three factors of the gauge symmetry give rise to the three fundamental interactions. Group theories are as strict as integration and differentiation, once decided upon, one cannot pick and choose the way the particles are represented, but the group theory imposes the specific way charges are combined that allow real particles and composites of particles to exist. One cannot pick and choose among the members of the group. A good example is the prediction that a particle called $Ω^-$ should exist, that was found experimentally and confirmed the quark model of the standard model. The particle was found and confirmed the theoretical research that led to the development of the standard model. So it is not possible to arbitrarily attach charges to particles, it is the standard model itself as it has developed that does the assignment, in order to agree with observations. If in future experiments observations bring more combinations of the charges that exist in the symmetries of the standard model, the model should change in order to agree with nature , and keep having predictive power.
{ "domain": "physics.stackexchange", "id": 80570, "lm_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, charge, symmetry-breaking, color-charge", "url": null }
waves, computational-physics When solving the wave equation $\psi_{tt}=c^2\nabla^2\psi$, a common trick is to define variables $p$, $q$, $r$ and $s$ such that, $$ p=c\psi_x,\quad q=c\psi_y,\quad r=c\psi_z,\quad s=\psi_t$$ and combine them into $u=\left[p,\,q,\,r,\,s\right]^T$ to form the evolution equation, $$ \frac{\partial u}{\partial t}=-\nabla F\tag{A.1}$$ where $F$ is flux in terms of the variables $p,\,q,\,r,\,s$. For instance, \begin{align} p_t &= c\psi_{xt}=c\psi_{tx}=cs_x \\ q_t &= c\psi_{ty}=cs_y \\ r_t &= c\psi_{tz}=cs_z \\ s_t &= cp_x+cq_y+cr_z \end{align} implies, $$ F_x=\left(\begin{array}{cccc} 0 & 0 & 0 & -c \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ -c & 0 & 0 & 0\end{array}\right)\cdot\left(\begin{array}{c} p \\ q \\ r \\ s \end{array}\right) $$ I believe that what you are supposed to be doing is that, given the initial conditions $\psi(x,0)=f(x)$ and $\psi_t(x,0)=g(x)$, you apply these directly to the variables:
{ "domain": "physics.stackexchange", "id": 89415, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "waves, computational-physics", "url": null }
the sine function is a sine curve. Worksheet by Kuta Software LLC MAC 1114 - Trigonometry Name_____ 7. UNIT 6 WORKSHEET 19 GRAPHING COSINE FUNCTIONS COSINE FUNCTIONS Standard Form: y a bx c d= − +cos ( ) Parent Function y x=cos Amplitude: Period: Phase Shift: Initial Interval: Practice Problems 3cos 2 y x π = − 2cos 4 x y π = − − Amplitude: Period: Phase Shift: Initial Interval: Amplitude: Period:. txt) or read online for free. Singh's online classroom for MPM2U. Later in this chapter we will learn how to translate periodic functions to create the following graph. This graph has an amplitude = 3 and a period length = 2p/2 = p. , Nov 8th Writing Equations and Graphing Writing Worksheet # 1 & 2. 5 Graphs of Sine and Cosine Functions Objective: In this lesson you learned how to sketch the graphs of sine and cosine functions and translations of these functions. KutaSoftware: PreCalc Worksheets Trig Graphs and Limits - Honors Precalculus Notes Graphing Sine and Cosine Trig Functions With Transformations, Phase Shifts, Period - Domain & Range This trigonometry and precalculus video tutorial shows you how to graph trigonometric functions such as sine and cosine. · Sketch the graphs of basic sine and cosine functions · Use amplitude and period to sketch the graphs of sine and cosine functions · Sketch translations of the graphs of sine and cosine functions. v t GAtlflZ ArKiOgchctQsU XrdeusCeWrivredr. Unformatted text preview: Trigonometry Pd Graphing Sine and Cosine Practice Worksheet Name Date Graph the following functions over two periods, one in the positive direction and one in the negative direction. Using radians, find the amplitude and period of each function. Now we can clearly see this property from. What is the elevation of the hour hand tip at 5:00? When is the elevation 3 inches above the zero elevation line? Solutions in the. Using a feature called !bang results you can search a curated list of high quality sites directly. The size of the PDF file is 43804 bytes. Graphing
{ "domain": "cigibuilding.it", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9869795098861571, "lm_q1q2_score": 0.8046177694298513, "lm_q2_score": 0.8152324960856175, "openwebmath_perplexity": 1483.9433332653116, "openwebmath_score": 0.6676138639450073, "tags": null, "url": "http://cigibuilding.it/bizc/graphing-sine-and-cosine-worksheet-pdf.html" }
image-processing, filters, audio, spectrogram Title: how to use image filters for spectrograms? Using MATLAB, I can import an audio signal and use some FFT function to get the spectrogram into the workspace. My question from here, is how to then process this spectrogram with image filtering techniques that usually import some image. For example, here is the code that filters an image: J = imread('example.jpg'); K = somefilter(J); my question is the imread part; as you can see the image is imported to J and then this J is used for the processing function below. However, can I simply input my spectrogram data from the workspace directly into the filter argument? or is there some other step that needs to happen before? Also, most image filtering matlab codes mention sometime the input is grayscale image or RGB, color, etc. My question is: how is a spectrogram in Matlab classified as? does it matter for the filter? do I need to convert the spectrogram then? A spectrogram of a monochannel (real) audio file would generally be a complex 2D matrix, hence a sort of complex image. So you can use 2D filters directly on the complex matrix in the workspace. However, filtering complex data can be complicated, due to the non-linear coupling between the phase and the magnitude: if you want to preserve the Hermitian properties, which is useful when you want to invert the spectrogram into a real (filtered) signal. So traditional algorithms like enhancement, shrinkage, adaptive filtering, masking are possible. Thus, no need to go through an intermediate binary format like: J = imread('example.jpg'); that will quantize or compress values and somehow loose the complex aspect. Note that processing complex values requires some care. In many situations, people only want to analyze the magnitude of the spectrogram, which then become a mere positive real-valued 2D matrix. Then, all sorts of 2D processing are available. In that case, you should take care of preserving the positivity. Most linear filters with non-negative coefficients will do the job. Non-linear processing tools based on histograms, on ranking, may require a simplification of the floating-point values.
{ "domain": "dsp.stackexchange", "id": 5417, "lm_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, filters, audio, spectrogram", "url": null }
What is the difference between 'log' and 'symlog' in matplotlib? MatplotlibServer Side ProgrammingProgramming Log helps to make a plot with log scaling on both the X and Y axis, whereas symlog (symmetric log) is used for axis scaling. Steps • First, we can adjust the subplot layout parameters. • Return an evenly spaced value (t) within a given interval, using the numpy.arrange() method. • Add a subplot to the current figure, with nrows = 1, ncols = 2 and current index is 1. • Make a plot with log scaling on the Y axis, using the semilogy() method. • Set the title for the axes, using the plt.title() method. • Configure the grid lines, using the grid(True) method. • Create two evenly spaced values within a given interval using the numpy.arrange() method. • Add a subplot to the current figure with nrows = 1, ncols = 2 and current index is 2. • Plot using the plt.plot() method with two lists that have been created in step 7. • Set the X-axis scale, using xscale. • Set the title for the axes, using the plt.title() method. • Configure the grid lines, using the grid(True) method. • To show the figure, use the plt.show() method. Example import numpy as np import matplotlib.pyplot as plt t = np.arange(0.01, 20.0, 0.01) # log y axis plt.subplot(121) plt.semilogy(t, np.exp(-t/5.0)) plt.title('Log') plt.grid(True) x = np.arange(-50.0, 50.0, 0.01) y = np.arange(0, 100.0, 0.01) plt.subplot(122) plt.plot(x, y) plt.xscale('symlog') plt.title('Symmetry Log') plt.grid(True) plt.show() Output
{ "domain": "tutorialspoint.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9732407214714478, "lm_q1q2_score": 0.8045895829102971, "lm_q2_score": 0.8267117940706734, "openwebmath_perplexity": 5107.868948029214, "openwebmath_score": 0.5510903596878052, "tags": null, "url": "https://www.tutorialspoint.com/what-is-the-difference-between-log-and-symlog-in-matplotlib" }