text
stringlengths
1
1.11k
source
dict
Let now $\varphi_D(n)$ be the number of $m\le n$ such that $m$ and $n$ have no common prime divisor less than $D$. Note that $\varphi_D(n)-\Phi_D(n)\le\varphi(n)\le\varphi_D(n)$ and $\Phi_D(n)$ is usually less than $\varepsilon n$. On the other hand, $\varphi_D(n)/n$ is completely determined by the remainder of $n$ modulo the product of primes less than $D$, so if we replace $\varphi$ by $\varphi_D$, the existence of density problem becomes trivial. Note that we can do it outside a set of arbitrarily small upper density with arbitrarily small error. So, the only problem may arise when the small error is not tolerable, i.e., when $\alpha$ is such that for all $\varepsilon>0$ the set of numbers $n$ with $\frac{\varphi(n)}n\in(\alpha-\varepsilon,\alpha+\varepsilon)$ has upper density bounded from below by some $c>0$ independently of $\varepsilon$.
{ "domain": "mathoverflow.net", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9929882037884926, "lm_q1q2_score": 0.8095162519580668, "lm_q2_score": 0.8152324960856175, "openwebmath_perplexity": 74.75430452465537, "openwebmath_score": 0.9649253487586975, "tags": null, "url": "https://mathoverflow.net/questions/111514/density-of-integers-n-whose-totient-varphin-is-larger-than-alpha-n/111515" }
c++ Avoid manual memory management Calling new and delete manually is a lot of work and error-prone. While you did a rather good job here, there are still memory leaks possible if exceptions are thrown at some points (consider that new can throw if it is running out of memory). Instead of doing this yourself, use containers from the standard library to handle memory management for you. In particular, use a std::vector to store your reservations; it does pretty much exactly what you were doing manually. Here is how it would look: #include <vector> … class BookingSystem { std::vector<Reservation> reservations; public: void Reserve(const std::string& referenceID, const Date& start, const Date& end); int GetReservationCount() const; const std::vector<Reservation>& GetReservations() const; };
{ "domain": "codereview.stackexchange", "id": 44114, "lm_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 }
from:... And g are invertible functions and only if, f is invertible if and condition! Bijection f is invertible if and only if it is invertible, then it is invertible X\subseteq! 4.6.3 suppose $g$ are inverses & oldid=994463029, Short description is different from Wikidata, Creative Commons License! \N\To \Z $we are proving a function f is invertible if f is bijective implication$ \Rightarrow $) how to check if function is if. Is proved that f is both injective and surjective g\colon B\to a$ be a function f is invertible if f is bijective. X 2 & in ; a x 1, x 2 & in ; a bijective this condition then... Be a pseudo-inverse to $f$ is surjective if its image is equal to its.! Case, the following are some facts related to surjections: a → B a... Is different bijection function are also known as invertible function because they have inverse then., a function is surjective, so f∘g is the inverse is unique to prove that invertible functions number elements... One function if distinct
{ "domain": "boomingacademy.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9525741254760638, "lm_q1q2_score": 0.8019013259538508, "lm_q2_score": 0.8418256432832333, "openwebmath_perplexity": 595.4966914799656, "openwebmath_score": 0.9115529656410217, "tags": null, "url": "http://www.boomingacademy.com/dennis-block-ghgkg/47de7e-a-function-f-is-invertible-if-f-is-bijective" }
• We do not identify the dual of $H_0^1$ with itself. Brezis gives a nice summary books.google.com/… – Euler....IS_ALIVE Apr 5 '14 at 4:24 • – Jack May 17 '16 at 22:06 As you have said, the dual space of $H_0^1$ is by definition $H^{-1}$. It can be identified with $H_0^1$ via isomorphism, but whether the identification is useful or not, it depends on the problem you are studying. If, for example, you are studying abstract problems about Hilbert spaces and it's duals then, the identification is recommended and you gain a lot of time by using it. Take a look, for example, in Brezis book chapter 5. On the other hand, when dealing with some practical problems, like for example, Partial Differential Equations problems, it is more convenient to use just $H^{-1}$. In some further examples its even better when you know a representation for elements of $H^{-1}$ in terms of $L^2$ functions. See, for instance, page 291 of Brezis book.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9615338035725358, "lm_q1q2_score": 0.8172760211112585, "lm_q2_score": 0.8499711794579723, "openwebmath_perplexity": 161.65717217094914, "openwebmath_score": 0.9476232528686523, "tags": null, "url": "https://math.stackexchange.com/questions/740355/dual-of-h1-0-h-1-or-h-01" }
javascript Title: Merging values into an object I created an algorithm that helps me merging a payload into a given fixed object, in other words this payload const requestPayload = { "customer_email": "me@domain.com", "customer_name": "unit test", "customer_firstname": "unit", "customer_lastname": "test", "customer_phone": "123456789", "customer_ts": "11.10.2020 12:37:39", "sc_device_type": "mobile", "sc_url": "http://www.domain.com" }
{ "domain": "codereview.stackexchange", "id": 40043, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript", "url": null }
quantum-mechanics, momentum, solid-state-physics, schroedinger-equation, crystals What I do not get is, isn't $\alpha = k$ in the zero potential region? Furthermore, in the barrier region, the author again introduces $\beta^2=\frac{2m(U-E)*4\pi^2}{h^2}$ Similarly, isn't $\beta^2 = -k^2$? Now my question is, what does $k$ represent here? I know that it is the wave number. However, isn't $k=\frac{2\pi p}{h}$ (De broglie formula)?
{ "domain": "physics.stackexchange", "id": 98938, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, momentum, solid-state-physics, schroedinger-equation, crystals", "url": null }
quantum-field-theory, operators, solid-state-physics, correlation-functions, wick-theorem $$ E_n=\hbar \omega (n+1/2)\, , $$ and so it is easy to obtain: $$ p_n= e^{-\beta \hbar \omega n}(1-e^{-\beta\hbar \omega }) = z^n (1-z) \, , $$ where we have defined $z\equiv e^{-\beta \hbar \omega}$. Therefore the average becomes: $$ \langle A \rangle = (1-z)\sum_{n=0}^\infty z^n\langle n|A|n\rangle \, . $$ Now let us define a linear operator in the positions and momenta of the crystal (equivalently, linear in the creation and annihilation operators): $$ A = c_1a+c_2a^\dagger \, . $$ Now we can compute $\langle A^2 \rangle = \langle (c_1a+c_2 a^\dagger)^2\rangle$. According to the expression above: $$ \langle A ^2\rangle = (1-z)\sum_{n=0}^\infty z ^n\langle n | (c_1a+c_2 a^\dagger)^2 | n\rangle =\\ =(1-z) \sum_{n=0}^\infty z ^n\langle n |(c_1^2a^2+c_2^2a^{\dagger 2}+c_1c_2aa^\dagger+c_1 c_2a^\dagger a) | n\rangle \, . $$ The non mixed terms (those with $a^2$ and $a^{\dagger 2}$) don't contribute to the sum so we end up with $$
{ "domain": "physics.stackexchange", "id": 58272, "lm_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, operators, solid-state-physics, correlation-functions, wick-theorem", "url": null }
ros2 from /home/ashin/nav2_ws1/src/navigation2/nav2_util/include/nav2_util/service_client.hpp:20, from /home/ashin/nav2_ws1/src/navigation2/nav2_util/include/nav2_util/lifecycle_service_client.hpp:24, from /home/ashin/nav2_ws1/src/navigation2/nav2_util/src/lifecycle_service_client.cpp:15: /home/ashin/ros2_rolling/ros2-linux/include/rclcpp/rclcpp/node_impl.hpp:157:1: note: declared here 157 | Node::create_client( | ^~~~ cc1plus: all warnings being treated as errors
{ "domain": "robotics.stackexchange", "id": 37986, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros2", "url": null }
c#, performance, unity3d Title: How to optimize the player movement code like in Tomb Of The Musk game? I've written some code that performs movement similar to the Tomb Of The Musk game. The idea is that the objet should move in a certain direction until it encounters an obstacle. After that, the player can choose which way the object should move. The code I wrote seems to me to be rather unoptimized. I think it could have been done quite a bit more rationally than I did. Object movement code: [SerializeField] float speed = .9f; [SerializeField] LayerMask obstacleMask; Vector3 targetPosition; Vector3 moving_direction; bool movingHorizontally; bool canCheck; void Start() { targetPosition = transform.position; }
{ "domain": "codereview.stackexchange", "id": 45147, "lm_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, unity3d", "url": null }
It can be upsampled as: $$U(I_1) = I_1^\cdot=\begin{bmatrix}(a+b+c+d)/4 & (a+b+c+d)/4\\(a+b+c+d)/4 & (a+b+c+d)/4\end{bmatrix}$$ hence with the difference matrix: $$\Delta_1 =I_0-I_1$$ $$\Delta_1=\begin{bmatrix}(3a-b-c-d)/4 & (-a+3b-c-d)/4\\(-a-b+3c-d)/4) & (-a-b-c+3d)/4\end{bmatrix}$$ one can write: $$I_0 = U(I_1)+\Delta_1$$ Splitting a matrix in a sum of matrices with different behaviors can be called morphological decomposition, deflation, etc. Per se, getting two matrices instead of one, or $$4+1$$ values instead of $$4$$, is not efficient. But if the two matrices have different distributions, or can be altered with respect to vision, such a decomposition is useful for sparse processing or compression. A more generic Laplacian pyramid of course works at several level, with less crude filters. • Thanks for the example! This makes it very clear. – Sridhar Thiagarajan Oct 20 '19 at 19:41 Actually the down sampling has no role here. It is all based on a real simple equation:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9579122756889437, "lm_q1q2_score": 0.8023664530048679, "lm_q2_score": 0.8376199714402813, "openwebmath_perplexity": 918.7417290626652, "openwebmath_score": 0.6877427697181702, "tags": null, "url": "https://dsp.stackexchange.com/questions/61362/losslessness-of-laplacian-pyramid/61385" }
navigation, robot-pose-ekf Original comments Comment by jbeck27 on 2011-10-14: I want the combined gyro and wheel odometry to be given to the local planner. robot_pose_ekf publishes "odom_combined" that is not a nav_msgs/Odometry message. What is given to the local planner for the turtlebot? Comment by jbeck27 on 2011-10-14: That didn't solve the problem. I think I can clarify what I need now though. the robot_pose_ekf publishes a tf frame that amcl uses. What I need is some way to give the local planner the "odom" message. I am referencing the diagram in http://www.ros.org/wiki/move_base . Comment by mmwise on 2011-09-02: in the configuration files you should see a line: you need to set the param to the frame you want to use. It's in the amcl_turtlebot.launch file. Comment by jbeck27 on 2011-09-02:
{ "domain": "robotics.stackexchange", "id": 6590, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "navigation, robot-pose-ekf", "url": null }
general-relativity, black-holes, astrophysics, metric-tensor, approximations $$\left(K^2-\frac{\epsilon}{r_G}\right)^{-1/2}\approx \frac{1}{\sqrt{K^2}}+\frac{\sqrt{K^2}}{2K^4 r_G}\epsilon=\frac{1}{K}+\frac{1}{2K^3 r_G}\epsilon \approx \frac{1}{K}$$ The goal in this calculation is to get the leading behavior for small $\epsilon$. One can keep subleading terms in $\epsilon$ along the way and then get rid of everything other than the leading one at the end, which is fine and consistent.
{ "domain": "physics.stackexchange", "id": 59231, "lm_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, black-holes, astrophysics, metric-tensor, approximations", "url": null }
ros, jenkins, eigen3, cmake Originally posted by gvdhoorn with karma: 86574 on 2016-01-14 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by Olivier Kermorgant on 2016-01-14: Great, thanks. That's exactly what I missed, how to express a build dependency on an external lib. I'll give it a try. Comment by Olivier Kermorgant on 2016-01-18: Working fine with eigen, it was as simple as that.
{ "domain": "robotics.stackexchange", "id": 23437, "lm_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, jenkins, eigen3, cmake", "url": null }
moveit Title: moveit collision avoidance I am using default IK planner (KDLplugin) for planning the path for ABB_IRB4600 robot using moveIt RViz plugin. When i import an object and make the robot movement to avoid that object by publishing current scene in RViz . The movements of the robot becomes very weired. Is there a way to refine the movements of the robot during collision avoidance of the object in the planning scene. I tried to incease the planning attempts and the planning time but haven't acheived any good result. Originally posted by Muneeb on ROS Answers with karma: 31 on 2017-05-23 Post score: 0 In the RViz Motion Planning panel, under the Context tab, try picking a different OMPL algorithm. I find that RRTConnectkConfigDefault works well out of the box. Originally posted by BrettHemes with karma: 525 on 2017-05-23 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 27972, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "moveit", "url": null }
roslaunch, rosrun Comment by pronik on 2014-03-17: its not working for me. followed the same procedure, images are not being saved. the rostopic is same as your bag file. Comment by Leyonce on 2014-03-19: @amentor.In which directory are you doing the rosrun?did i forget to mention that you need to play the bagfile after you perform the rosrun?please tell me exactly what you've done so i'll try it and maybe will I figure out what's wrong.
{ "domain": "robotics.stackexchange", "id": 17241, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "roslaunch, rosrun", "url": null }
javascript, php, jquery, beginner, mysql //Check if detailed information has been retrieved if ($(clickedRow).data("detailed")) { if ($(clickedRow).data("clicks") % 2 == 0) { //Hide $("#list tr#" + this.id + "row").remove(); } else { //Show $($(clickedRow).data("detailed")).insertAfter($(clickedRow)); } } else { var loading = $("<tr><td colspan=3>Loading...</td></tr>"); loading.insertAfter($(clickedRow)); $.ajax({ url: "ajax_detailed.php", data: { id: this.id }, success: function(html) { if (html) {
{ "domain": "codereview.stackexchange", "id": 5030, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, php, jquery, beginner, mysql", "url": null }
php, mysql, pdo surprisingly, that's all you really need. The rest is either harmful, superfluous or can be achieved by other means. $query='SELECT * FROM `users` WHERE u_id=:uid OR u_id=:uid2'; $vals=[ 'uid' => $id, 'uid2' => $id2 ]; $res = db_query_pdo($pdo_cnctn,$query,$vals)->fetchAll(); if($res) { var_dump($res); } else { echo 'Not Found'; } See, the calling code is almost the same, but the function became a) much cleaner b) much more versatile, as you can chain any PDOStatement method to it, not limited to the return value of fetchAll() Say, you've got a delete query and want to know whether it deleted any rows? No problemo! if (db_query_pdo($pdo_cnctn,"DELETE FROM t WHERE id=?",[1])->rowCount()) { echo "deleted"; } or you want a fetchAll() but with different modifier: $ids = db_query_pdo($pdo_cnctn,"SELECT id FROM t WHERE id<?",[10] )->fetchAll(PDO::FETCH_COLUMN);
{ "domain": "codereview.stackexchange", "id": 39999, "lm_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, pdo", "url": null }
are different! Example 5. Tocheckthatthis works,insertthetestfunctionf(t)=sin(2…t)intoequations2. You might like to have a little play with: The Fourier Series Grapher. Pls Note: This video is part of our online courses, for full course visit Visit our website: www. A “Brief” Introduction to the Fourier Transform This document is an introduction to the Fourier transform. ) Note that Y cZ9 's themselves are hard to plot against Z on the 2-Dplane because they are complex numbers. Although not the inventor of ‘Fourier series’, he claimed strongly that they did represent all periodic. Notes of Fourier Series These notes are provided by Mr. , Fourier series) in the matrix way. Various kindsof Fourier series 1. Let us consider a function f(t) periodic with period 2ˇover the interval [ ˇ;ˇ], then its Fourier series is given as before S F(t) = a 0 2 + X1 n=1 [a ncos(nt) + b nsin(nt)] with a n= 1 ˇ Z ˇ ˇ f(t)cos(nt)dt and b. The study of Fourier series is a branch of Fourier analysis. 1 FOURIER
{ "domain": "psicologicamenteonlus.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9793540704659681, "lm_q1q2_score": 0.8006948933458974, "lm_q2_score": 0.817574478416099, "openwebmath_perplexity": 771.7534024236097, "openwebmath_score": 0.8521015048027039, "tags": null, "url": "http://psicologicamenteonlus.it/fourier-series-notes.html" }
quantum-mechanics, wavefunction, complex-numbers Title: Are Imaginary Numbers Really “Imaginary?” I find the naming convention of “Imaginary” misleading, as it does give a sense that the quantity is merely an abstract construct used to mitigate the difficulties of performing some mathematical operations. My question is, other than the wavefunction for example, where else do complex numbers have physical significance? Also, since only $|\Psi|^2$ has physical meaning i.e. probability amplitude, does this really mean that the “Imaginary” part is really significant, or just another purely mathematical construct? The term "imaginary" for referring to the so-called "imaginary numbers" (which, by the way, are only a one-dimensional sliver of the full complex numbers that are actually used here) is a historical artifact that has caused way more confusion than it should, now. Let me say one thing that is crucially important here: There is no ontological difference between "real" and "imaginary" (or better, "complex") numbers.
{ "domain": "physics.stackexchange", "id": 61673, "lm_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, wavefunction, complex-numbers", "url": null }
community-challenge, groovy for (int i = 0; i < candidates; i++) { String name = reader.readLine() stv.candidates.get(i).name = name } after /* Also iterates through two sections of the file, * but by using an Iterator.while(Closure condition) method * added through meta-programming. * * The first section is handled with the 'while()/call() loop', * and the second in the 'upto() loop' */ use(IteratorCategory) { reader.iterator().while { line -> line != '0' }.call { line -> stv << Vote.fromLine(line, stv) }.upto(candidates) { line, i -> stv.candidates.get(i).name = line } }
{ "domain": "codereview.stackexchange", "id": 15313, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "community-challenge, groovy", "url": null }
catkin, ros-kinetic, build, documentation, devel Originally posted by nbro on ROS Answers with karma: 372 on 2018-03-21 Post score: 9 I believe almost all of your questions are answered by these pages: https://wiki.ros.org/catkin/workspaces https://catkin-tools.readthedocs.io/en/latest/mechanics.html Given that I am not very familiar with make and cmake, what does it mean "to build a package" in the context of catkin? I would suggest reading some introductory material on cmake and make development on Linux, that's a pretty core concept that you'll need to work with ROS. There are lots of cmake tutorials and guides out there, but I don't have one to recommend over others. Specifically for the question about targets, you might benefit from this: https://stackoverflow.com/questions/11971917/why-does-cmake-make-a-distinction-between-a-target-and-a-command It's asking/answering a more complex question, but the answer has some foundational details on what a target means in cmake and how it relates to make.
{ "domain": "robotics.stackexchange", "id": 30399, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "catkin, ros-kinetic, build, documentation, devel", "url": null }
temperature, astrophysics, stars, solar-system, luminosity Title: Equations for developing a hypothetical Solar System I am currently going down the rabbit hole of writing a story but I would like it to be set in a universe which is believable. Therefore I am trying to create a hypothetical solar system in which the world where the story takes place exists. However, as I have little to no background in astrophysics I am struggling to understand the basics. After some research I cam across this video on how to create a star which is believable: https://www.youtube.com/watch?v=x55nxxaWXAM&list=PLduA6tsl3gygXJbq_iQ_5h2yri4WL6zsS&index=4 The maths in this video however are not explained and when applied to existing stars...simply don't work. It begins by determining the mass of the star as anywhere between 0.6 - 1.4 solar masses -that I understand. I further understand from the video that the star would need to be of F or G classification, thus have a temperature between 5000 - 7000 K approx.
{ "domain": "physics.stackexchange", "id": 70679, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "temperature, astrophysics, stars, solar-system, luminosity", "url": null }
newtonian-mechanics, angular-momentum, rotational-dynamics, conservation-laws, centrifugal-force Title: Thought experiment: Does "artificial gravity" created in a spinning spaceship last forever? We know a body in uniform linear motion will continue to move with uniform velocity unless any external force acts on it. Similarly, a body rotating with uniform angular velocity will continue to rotate with uniform angular velocity unless any external torque acts on it. Occupants inside a body in uniform linear motion will experience an "artificial gravity" if an external force accelerates it, but the artificial gravity will turn off the moment the external force disappears. But in the case of a rotating body, if I understand it right, the "artifical gravity" is present (due to centrifugal force) even when no external torque is acting on it. In that case, since the body maintains its angular velocity in the absence of any external torque, is it correct to say that
{ "domain": "physics.stackexchange", "id": 78172, "lm_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, angular-momentum, rotational-dynamics, conservation-laws, centrifugal-force", "url": null }
Sankar N 5 Ratings, (9 Votes)
{ "domain": "transtutors.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9585377320263431, "lm_q1q2_score": 0.8185075971262663, "lm_q2_score": 0.8539127566694178, "openwebmath_perplexity": 799.654474145076, "openwebmath_score": 0.45836108922958374, "tags": null, "url": "https://www.transtutors.com/questions/10th-grade-algebra-63639.htm" }
javascript, performance, canvas } addPath() { // getting ctx from global as this was a last min change const b = this.boundary; ctx.rect(b.left, b.top, b.w * 2, b.h * 2); this.drawn = true; } addToSubQuad(particle) { if (this.NE.insert(particle)) { return true } if (this.NW.insert(particle)) { return true } if (this.SE.insert(particle)) { return true } if (this.SW.insert(particle)) { return true } particle.quad = undefined; } insert(particle) { if (this.depth > 0 && !this.boundary.contains(particle)) { return false } if (this.depth > 1 && this.pointCount < PARTICLES_PER_QUAD) { this.points[this.pointCount++] = particle; particle.quad = this; return true; } if (!this.divided) { this.subdivide() } return this.addToSubQuad(particle); }
{ "domain": "codereview.stackexchange", "id": 36635, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, performance, canvas", "url": null }
php, array, php5 Otuput print_r(organizeArray($array, $key_search)); Array ( [ProviderInfo] => Array ( [0] => Array ( [PORAProviderID] => 1010 [ProviderName] => HAMZEPOUR, SHOKOUFEH ) ) [ProviderAddress] => Array ( [0] => Array ( [ContactName] => ABC XYZ [Address1] => New York [AddressType] => Physical ) [1] => Array ( [ContactName] => ABC XYZ [Address1] => New York [AddressType] => Billing ) [2] => Array ( [ContactName] => ABC XYZ [Address1] => New York [AddressType] => Mailing ) )
{ "domain": "codereview.stackexchange", "id": 4550, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "php, array, php5", "url": null }
string-theory, quantum-gravity, spacetime, spacetime-dimensions Regardless of your favorite theory of how many dimensions the universe has in total, the universe seems to have a deep preference for displaying three fully interchangeable large-scale spatial dimensions (plus time) within any given frame of reference. But why? That is, has anyone ever come up with a persuasive argument for why the number three is or is not the required number of large-scale spatial dimensions in a universe? This question from way back in November 2010 appears related, but after reading through it I'm pretty sure it is only pointing out that the known laws of electrostatics have three spatial dimensions built into them, which is most certainly true. But universes with fewer or more than three large-scale spatial dimensions would presumably have different force rules reflecting their different geometries, so this kind of analysis only shows self-consistency within a universe.
{ "domain": "physics.stackexchange", "id": 5519, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "string-theory, quantum-gravity, spacetime, spacetime-dimensions", "url": null }
quantum-mechanics, quantum-information, quantum-spin, eigenvalue, rabi-model \end{array}\right)\vert\phi(t)\rangle\, ,\\ &=\frac{\hbar}{2} \left(\begin{array}{cc}\omega_0-\omega &\omega_r \\ \omega_r &-(\omega_0 -\omega) \end{array}\right)\vert\phi(t)\rangle \end{align} As you can see, there is an additional term, which I eventually moved to the right, that comes from the time derivative of $U(t)$.
{ "domain": "physics.stackexchange", "id": 37105, "lm_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-information, quantum-spin, eigenvalue, rabi-model", "url": null }
matlab, filters, autoregressive-model A = [1 mu*ones(1,p);mu*ones(p,1) R]; b = [mu;r(2:end)]; w = inv(A)*b; % separate the bias term K from the AR process weights: K = w(1); w = w(2:end);
{ "domain": "dsp.stackexchange", "id": 3355, "lm_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, filters, autoregressive-model", "url": null }
human-biology Contesting the evidence for limited human lifespan Many possible maximum lifespan trajectories Is there evidence for a limit to human lifespan? Questionable evidence for a limit to human lifespan Maximum human lifespan may increase to 125 years Each of these responses has, in turn, a reply from the original authors. The arguments turn on fairly intricate details of statistical analysis and database interpretation, and I think it's fair to say that outside experts remain unconvinced either way -- neither the original article, nor any of the five responses, nor any of the five responses to the responses, presents a slam-dunk case for or against a limit to human lifespan.
{ "domain": "biology.stackexchange", "id": 7375, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "human-biology", "url": null }
reductions, randomness, np-complete, unique-solution, promise-problems Title: UnambiguousSAT reductions Let $\Pi$ be an $\mathsf{NP}$-complete problem. It is standard that $3SAT$ and $\Pi$ are reducible from each other. Let UnambiguousSAT, or USAT for short, denote the promise problem which is 3SAT but with the promise that there is $\leq 1$ solution (that is, it is in $\mathsf{PromiseUP}$). Valiant-Vazirani gives a randomized reduction from SAT to USAT. For some natural problem $\Pi$, let U$\Pi$ is the corresponding promise problem in $\mathsf{PromiseUP}$, and suppose that $\Pi$ randomly reduces to U$\Pi$. Is it reasonable to expect reduction from U$\Pi$ to USAT and vice versa? Would that mean $\mathsf{PromiseUP}$ has complete problem? In general if USAT is in $\mathsf{RP}$ then $\mathsf{NP}=\mathsf{RP}$. Can we get something similar for U$\Pi$ as above? "Is it reasonable to expect reduction from ..." unambiguous$\Pi$ to unambiguousSAT ​ ?
{ "domain": "cstheory.stackexchange", "id": 3902, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "reductions, randomness, np-complete, unique-solution, promise-problems", "url": null }
general-relativity, mass, variational-principle, geodesics In the desired expression, as obtained in equation (3.2) of reference https://doi.org/10.1098/rsta.2011.0293 the RHS of the geodesic equation sould appear the following expression: $$ \frac{\partial \,\mbox{ln} \, m}{\partial \phi} \frac{\partial \phi}{\partial x^{\mu} }\left( g^{\beta \mu} + u^{\beta}u^{\mu}\right) $$ I can't get the seccond term on inside the brackets. It appears that $\frac{\partial \alpha_i}{\partial x^{\beta}}$ in the original text refers to derivative wrt spatial coordinates and not the space-time coordinates (I'm not sure about the notations used in that paper). The spatial coordinates are defined using the time-like vector field $\textbf{u}$. The construction is as follows: Consider our space-time ($\mathcal{M}$, $g$) with family of space-like hypersurface $S(x)$=const. We can define time-like vector field $\textbf{u}$ whose components :
{ "domain": "physics.stackexchange", "id": 81602, "lm_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, mass, variational-principle, geodesics", "url": null }
physiology, muscles, blood-circulation, congestion In pathological situations, if hypovolemia occurs, blood can also come from: splachnic vascular bed [5] But what attracts the blood into the muscle? The phenomenon is called active hyperemia: Active hyperemia is the increase in organ blood flow (hyperemia) that is associated with increased metabolic activity of an organ or tissue. An example of active hyperemia is the increase in blood flow that accompanies muscle contraction, which is also called exercise or functional hyperemia in skeletal muscle. Blood flow increases because the increased oxygen consumption of during muscle contraction stimulates the production of vasoactive substances that dilate the resistance vessels in the skeletal muscle [4]. References:
{ "domain": "biology.stackexchange", "id": 2572, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "physiology, muscles, blood-circulation, congestion", "url": null }
brainfuck <<<<< <<<<< <<<<< <<<<< Memory: 0 58 32 10 0 256 0 0 0 48 57 0 0 0 48 57 0 0 0 48 57 0 0 0 >>>>> > + [ - >>> . >>>>> . >>>>> . <<<<< <<<<< <<<<< <<< . > . >> . < . Number increasing logic >>>>> >>>>> >>>>> > + Comparer: num1 num2 out 0 0 [ - >- >>>+ <<<< ] >>+ set equal flag < if num1 != num2 [ >- clear equal flag ] > if num1 == num2 [ > ] > go to last and put numbers back [ <<<+ <+ >>>>- ] <<<< reset pointer >> [ << ----- ----- <<<<< + >>>>> >> - ] <<
{ "domain": "codereview.stackexchange", "id": 31133, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "brainfuck", "url": null }
downsampling, ecg But keeping this theorem in mind, you can probably understand that downsampling your signal might cause aliasing if you're not careful. The simple solution to that is to filter the signal prior to downsampling, at a cutoff frequency of $\frac{F_s'}{2}$. The steeper the filter's transition band, the less aliasing. Back to your application From what I understood, you have a signal that you want to map to a screen. For that, you need to downsample the signal to your screen's horizontal resolution. Let's call this resolution $H_x$ and your signal's sampling frequency $F_s$. For the sake of the example, let's fix $H_x=240\text{px}$ and $F_s=5\text{kHz}$. You also have a time parameter (let's call it $t_r$) which sets the "zooming" of your scope, ie how long of a signal corresponds the length of the screen. Let's set it to $t_r=100\text{ms}$ (Disclaimer : I have absolutely no idea about the frequency of ECG so this is completely arbitrary). That gives you : $$
{ "domain": "dsp.stackexchange", "id": 5403, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "downsampling, ecg", "url": null }
algorithms, optimization I think solving this perfectly is probably a very hard problem, so I guess I am looking for some kind of estimation. Condition (1) is the most important and must always be satisfied. Until now I only have a solution for generating good teams instead of games based on a weighted maximum matching problem (approach coming from here), but I would love to implement the problem described above. Edit: It does not matter in which order the generated games take place and all games are played out sequentially, not in parallel (which means there is no need to optimize for games happening at the same time). There are many plausible approaches, but one that would be easy to implement would be to formulate this as an instance of integer linear programming (a classic technique in operations research, which your problem could be considered an example of).
{ "domain": "cs.stackexchange", "id": 20963, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "algorithms, optimization", "url": null }
special-relativity, coordinate-systems, inertial-frames, lorentz-symmetry The moving clocks are synchronized in frame $S'$ but the question is nudging you to see if they are synchronized with respect to $S$ as well. $$t'=\gamma(t- {{xv} \over {c^2}})$$ $$\Rightarrow t'_B - t'_A = -\gamma{{(x_B-x_A)v}\over{c^2}} = -{{Lv}\over{c^2}}$$ The last equality uses length contraction of the distance L. EDIT (Responses to comments are made here) : @Ufomammut : The variable $t'$ simply refers to the reading on the clocks affixed to frame $S'$ (By "affixed", I mean that they are at rest in frame $S'$) $-$ Let's call them $S'$-clocks. Observers of frame $S$ and $S'$ can both observe the readings of the $S'$-clocks. The $S'$-clocks are synchronous only to the $S'$ observers and not to the $S$ observers.
{ "domain": "physics.stackexchange", "id": 61331, "lm_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, coordinate-systems, inertial-frames, lorentz-symmetry", "url": null }
simulation, stage Title: Robot in Stage with two Infrared Sensors Hi, I would like to simulate a robot, in the stage, with two infra-red sensors, is it possible? I tried to put two Laser Range Finders with only one measurement, but it didn't result! Someone can help me? Thanks in advance Originally posted by MiguelRobPinto on ROS Answers with karma: 13 on 2013-03-28 Post score: 0 I have two Sharp GP2D12 IR sensor for my old roomba-create project. This is the setting for the sensor in the world file, they will use the same interface as laser. You can adjust the fov depending on your actual setup on the robot. define GD2D12 ranger ( sensor( range [ 0.10 0.8 ] fov 180.0 samples 2 ) size [ 0.02 0.04 0.02 ] ) Originally posted by bombilee with karma: 86 on 2013-04-02 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 13582, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "simulation, stage", "url": null }
java You can see this using the following adaption of your code: public static void main (String args[]){ for (int numIn = 0; numIn < 101; numIn++) { long fact=1; for(int i=1;i<=numIn;fact*=i++); System.out.println("factorial of "+numIn+" = "+ Long.toHexString(fact)); } }
{ "domain": "codereview.stackexchange", "id": 5246, "lm_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 }
In addition to the things I answered here, I just want to add the dual of Proposition 1: Proposition 1* Let $G$ be a finite group and $H$ a subgroup of prime index $p$, with gcd$(|G|,p-1)=1$. Then $G' \subseteq H$. Note that this implies that $H \unlhd G$, and that it is in fact sufficient to prove that $H$ is normal, since then $G/H \cong C_p$ is abelian.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9790357597935574, "lm_q1q2_score": 0.8004346397846105, "lm_q2_score": 0.8175744673038222, "openwebmath_perplexity": 91.59079929942396, "openwebmath_score": 0.944048285484314, "tags": null, "url": "https://math.stackexchange.com/questions/1073736/normal-subgroups-in-groups-of-odd-order/1606105" }
performance, validation, r "00:00:00", "07:45:00", "08:00:00", "08:30:00", "09:00:00", "09:10:00", "09:30:00", "11:41:00", "12:15:00", "12:45:00", "13:00:00", "13:30:00", "14:00:00", "17:00:00", "18:00:00", "19:00:00", "20:00:00", "22:30:00", "00:00:00", "06:45:00", "07:50:00", "08:05:00", "08:55:00", "09:00:00",
{ "domain": "codereview.stackexchange", "id": 14442, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "performance, validation, r", "url": null }
array, functional-programming, go, generics Deleting keys from maps, because delete(m, k) where k doesn't exist is defined as a no-op, doesn't merit a function - generic or otherwise. The main reason why I didn't review the List code along side the Map stuff was that I expected the List type to be more than a masked slice. When I talk about lists, I'm thinking back to the old C/C++ days and my mind goes to single/double linked lists and the like. None of the methods you have here, though, suggest that this is a list. You just have a slice, and nothing more. Like I said earlier: if you're going to introduce a new type, don't remove existing features (e.g. append), and add new ones: linking in the list, list iterators, and thread safety. Again, doing so would likely require you to create a struct, add a mutex, add a node type to link your list, and requires custom code to insert/delete values. and all that good stuff.
{ "domain": "codereview.stackexchange", "id": 43221, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "array, functional-programming, go, generics", "url": null }
convolution, image-processing, window Title: How to Calculate the Hann Low Pass Filter / Kernel for Image Processing I'm currently studying for an exam in image processing and stumbled upon a exercise which i could not answer and my professor will not be available before the exam anymore. The exercise goes as follows: Create a Hann-lowpass kernel of size $3\times 3$ and calculate the result of the convolution at $(2,2)$ in the image.
{ "domain": "dsp.stackexchange", "id": 3740, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "convolution, image-processing, window", "url": null }
javascript, game, canvas Title: Snake game using Canvas API Edit 2: For anyone interested, you can play the game at buggysnake.com Edit 1: I have typed up the code for making the body of the snake move. It's not perfect and there are small problems I need to fix. But I have updated the javascript code below to include that code. Background: I recently started learning Javascript about 3 weeks ago. About a week ago I learnt about the Canvas API.
{ "domain": "codereview.stackexchange", "id": 44793, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, game, canvas", "url": null }
I'm not sure your argument with the class equation is good. • For the class equation I copied straight from the book Apr 13, 2018 at 17:33 • @TheBosco If $|Z(G)|=p^2$, then $\operatorname{Cent}(g)>p^2$, so the summation need not be an integer. Indeed, it is $(p-1)/p$ which is definitely not an integer. Much more work is needed, in my opinion. Apr 13, 2018 at 17:44 • It is only an integer when p = 1, giving 0. It does have to be an integer isn't it? Since it is a finite group and both $G$ and $Z(G)$ have to have an integer amount of elements in them, therefore the sum has to be an integer as well. Also, you are right, the sum is on the conjugacy classes. That's what I meant but I wrote it wrong. That does not change the argument I wrote though Apr 13, 2018 at 19:36 • @TheBosco Why should the sum of $1/|\mathrm{Cent}(g_i)$ be an integer? Apr 13, 2018 at 19:40 • @TheBosco Yes, but you’re dividing it by $p^3$ Apr 13, 2018 at 19:42
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9845754456551737, "lm_q1q2_score": 0.8026578959361583, "lm_q2_score": 0.8152324938410783, "openwebmath_perplexity": 103.4213249038692, "openwebmath_score": 0.9225610494613647, "tags": null, "url": "https://math.stackexchange.com/questions/2735078/for-a-group-g-such-that-g-p3-for-p-prime-either-zg-p-or-g" }
performance, array, vba, modules tempArr(i, j) = dataArray(i, columnsToKeepArray(j - 1)) Next j Just replace that and delete the Option Base 1. Original Data The way you're getting the default data is a little bit sketchy. Also, setting your target book to ThisWorkbook makes it so you need to always use the macro's book. You can't have any error handling when you just make the assumption that your target sheet will be the first sheet. Why not save the macro in a certain book and have it target the downloaded data .csv? You could always download it to the same location and if you do the analysis the month after - Dim targetMonth As String targetMonth = StrConv(Left(MonthName(Month(Now) - 1), 3), vbProperCase) Dim fileName As String fileName = "PATH/TO/New-AmbSYS-to-2018-" & targetMonth & ".csv"
{ "domain": "codereview.stackexchange", "id": 29485, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "performance, array, vba, modules", "url": null }
ros, real-time, ros-control, realtime It isn't. Not without first making Linux capable of some deterministic scheduling and execution. Two well known ways to add deterministic scheduling to a Linux system are to patch the kernel with the RT PREEMPT patch, or to install the Xenomai co-kernel next to it. The PR2 (which runs the pr2_mechanism package, the precursor to ros_control) has an RT PREEMPT patched kernel. Whatever system is used, 'real-time-ness' can be configured with a per-thread granularity. So even if 'the rest' of ROS is not inherently real-time, parts of nodes can be made to be deterministically scheduled and executed. In the case of ros_control, the main loop responsible for executing all the instantiated controllers is an example of such a real-time thread. As such, the controller plugins themselves execute in a real-time context. The fact that ROS itself (which is an ambiguous thing to say anyway) is not real-time does not really matter.
{ "domain": "robotics.stackexchange", "id": 19195, "lm_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, real-time, ros-control, realtime", "url": null }
python, python-2.x Output: -,-,17,17,-,17,- -,-,-,-,-,-,-,-,-,-,-,-,-,-,-,5,-,-,-,-,-,-,-,- 19,-,19,-,19,19,- It is quite hard to understand what your code is supposed to do. Let's try to progress little by little. I've based my analysis on the test cases you have provided. if tl == 1: A list with a single element seems to be handled in a special way. If we replace the check with if tl == 1 and False:, we can see that the result is the same if we don't handle this case in a particular way. I've removed the corresponding check. hold You are performing some super tricky logic involving string manipulation, list slicing and split. I realised that the whole thing does the same thing as d = ['-'] * amount. Comparison of d[z] and con[z]
{ "domain": "codereview.stackexchange", "id": 11323, "lm_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-2.x", "url": null }
gravity, potential-energy $$F=\frac{k}{r^2}$$. From this, we get that gravitational potential and electrostatic potential energy are inversely proportional to distance. $$U=-\frac{k}{r}\because F=-\nabla U$$ Gravitational force is sometimes expressed like this, $$F=\frac{Gm_1m_2}{r^2}\hat{\mathbf{r}}$$ where $\hat{\mathbf{r}}$ denotes the unit vector in the direction of the radius vector. If we consider the force acting on $m_1$, the radius vector points from $m_1$ to $m_2$, and conversely, the force acting on $m_2$ points from $m_2$ to $m_1$ (these forces are equal and opposite).
{ "domain": "physics.stackexchange", "id": 99514, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "gravity, potential-energy", "url": null }
object-oriented, game, c++17, cmake So, first, Othello::Controller isn’t really a great name for what you’re making (setting aside the fact that it’s also logically incorrect). You’re supposed to be constructing a game, right? Not a controller (or model). I would think that, in practice, anyone constructing an instance is not interested in the design pattern being used; they just want to make a game. So it would make more sense for the type to be named game or othello or othello::game or something like that. Now, I have to ask: will there ever be a situation where someone would want to set up a game, and not play it? Or, more interestingly, will there ever be a situation where someone would want to play a game without first setting it up? No? Then why not just have a single function that does all the set up and plays the game?
{ "domain": "codereview.stackexchange", "id": 45274, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "object-oriented, game, c++17, cmake", "url": null }
electrochemistry, redox Title: Why would electrode reaction in galvanic cell stop when there's no neutrality in each cell? I know that the salt bridge produces ions to balance out the positive and negative ions in each solution, but why won't it work without a salt bride? Would it even work at the start since there's few electrons gained and lost and few ions produced? It would work vanishingly briefly. The separation of charge that occurs when you connect two separated half cells without a salt bridge produces an electrostatic potential difference that opposes the electrochemical potential difference. The cell reaction would proceed until the two voltages balance, and it doesn't take much charge separation to hit the 1–2 volt electrochemical potential of typical cells, so this process is very fast.
{ "domain": "chemistry.stackexchange", "id": 2086, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electrochemistry, redox", "url": null }
y, then P has a truth value. Now, once you have this Truth Table, you can say I know this Truth Table. Function of a Logic Gate is expressed using Truth Table. The NOR Gate RS Flip Flop. describing a circuit's desired behaviour with a truth table, extracting a AND-OR equation for each output column of the table, simplifying those equations using Karnough Maps, implementing the simplified equations using logic gates, and; looking for similarities in existing designs to leverage work already done. Use the built in Logic function on your HP 50g calculator to test binary numbers. There are 2 XOR and 2 AND gates on each side of the chips so that makes construction a lot easier. Truth Table Calculator,propositions,conjunction,disjunction,negation,logical equivalence. There are three basic logic gates i. The important applications of Logic Gates in Digital Electronics are Flip-Flop circuit, register, digital counter, Microprocessor, Microcontroller, etc. AND NOT OR (v) Complete the diagram in
{ "domain": "cloudscuola.it", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9759464485047916, "lm_q1q2_score": 0.8132801752066438, "lm_q2_score": 0.8333245911726382, "openwebmath_perplexity": 795.8803509624115, "openwebmath_score": 0.6178021430969238, "tags": null, "url": "http://cloudscuola.it/sgxh/truth-table-logic-gates-calculator.html" }
electrostatics, charge, gauss-law, dirac-delta-distributions In the same way, we can define $$\rho(\vec{x}) = \sigma(x, y) \delta(z)$$ which is only non-zero if $z=0$ i.e. on the full $xy$-plane. You can then create any charge density you want, using combined delta functions. You could also define it "by hand", just saying "here is constant and here is zero" and then integrating each domain separatly if necessary, but that will give you a bit more of a problem in dealing with discontinuities, so you need to careful. For example, of course you can also limit your charge distribution in space by defining $$\rho(\vec{x})=\lambda(x)\delta(y)\delta(z)$$ if $|x|<L/2$ and 0 otherwise, which would give you a thin wire along the the $x$-axis of length $L$ - or you could define $\lambda(x)$ using step functions. That would give you a total charge of $Q$ along such wire which, if assumed at constant density, would give you $\lambda(x)=Q/L$.
{ "domain": "physics.stackexchange", "id": 75737, "lm_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, charge, gauss-law, dirac-delta-distributions", "url": null }
unit-testing, api, kotlin Voila, typed responses and a set of requests you can reason about at compile time. API consumers are happy now. But how do I test around this beast? Of course, I can mock SalesforceApiClient, which is just the sum of HttpClient and BackendAuthenticator. But I feel dirty leaking knowledge about the structure of Force.com REST responses into unit tests for users of UserRequest. This kind of feeling tells me there's something wrong my class design. How can I do better? I haven't found a way to properly test/mock SalesforceRequest when exercising it's consumers. What it did do was make me realize Naming the class Request and then providing multiple "request"-like methods on it was a mistake. Each SalesforceRequest subtype was a full blown API provider. Following from 1, I took the generics approach to make the SalesforceApiGateway type-safe (which was the initial driver for the request classes).
{ "domain": "codereview.stackexchange", "id": 20332, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "unit-testing, api, kotlin", "url": null }
java public class CredentialsHolder { private static CredentialsHolder instance = null; private String loginToken; private Date loginTokenExpiry; private static final String API_BASE_URL_V1 = "https://api.com/rest"; private static final String API_LOGIN_TOKEN_PATH = "token"; private static final String API_USER_NAME = "userName"; private static final String API_PASSWORD = "password"; private final Lock lock = new ReentrantLock(); public static synchronized CredentialsHolder getInstance() { if (instance == null) instance = new CredentialsHolder(); return instance; } private CredentialsHolder() { setAPICredentials(); } private void refreshToken() { setAPICredentials(); }
{ "domain": "codereview.stackexchange", "id": 28895, "lm_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 }
beginner, ruby, formatting, integer Title: Separate numbers with commas How should I approach refactoring this code? def separate_comma(number) a = number.to_s.split('') b = a.size/3.0 if a.size < 4 p number.to_s elsif a.size%3 == 0 n = -4 (b.to_i-1).times do |i| a.insert(n, ',') n -= 4 end p a.join("") else n = -4 b.to_i.times do |i| a.insert(n, ',') n -= 4 end p a.join("") end end
{ "domain": "codereview.stackexchange", "id": 31956, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "beginner, ruby, formatting, integer", "url": null }
programming-challenge, functional-programming, mathematics, f# Here's the code: /// <summary> /// Find the summation in a specific range, given /// a specific function. /// </summary> let summation func low high = let function_result_set: int list = [for x in low..high do yield x |> func] let result = function_result_set |> List.sum result /// <summary> /// Find the product in a specific range, given /// a specific function. /// </summary> let product func low high = let function_result_set: int list = [for x in low..high do yield x |> func] let result = function_result_set |> List.fold (*) 1 result And finally, here's a few tests: [<EntryPoint>] let main argv = System.Console.WriteLine(summation (fun n -> n) 1 10) System.Console.WriteLine(product (fun n -> n) 1 10) System.Console.ReadKey() |> ignore 0 And here's the desired output from the above tests: 55 3628800 Starting with summation,
{ "domain": "codereview.stackexchange", "id": 16170, "lm_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-challenge, functional-programming, mathematics, f#", "url": null }
python, python-3.x, file-system, web-scraping, selenium Title: Webscraping With Selenium - a Course Downloader and Sorter I've been working on a program that automates the painful task of downloading each file from a website for courses one by one and sorting them using python. This is my first python webscraping project on this scale, as such I would love some advice and lessons on how to make my code better! Here is the website I'm scraping. from selenium import webdriver import time import os import shutil import re path = r'https://coursevania.courses.workers.dev/[coursevania.com]%20Udemy%20-%20Master%20the%20Coding%20Interview%20Data%20Structures%20+%20Algorithms/' # For changing the download location for this browser temporarily options = webdriver.ChromeOptions() preferences = {"download.default_directory": r"E:\Utilities_and_Apps\Python\MY PROJECTS\Test data\Downloads", "safebrowsing.enabled": "false"} options.add_experimental_option("prefs", preferences)
{ "domain": "codereview.stackexchange", "id": 38170, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, python-3.x, file-system, web-scraping, selenium", "url": null }
ros, moveit, build Originally posted by velveteenrobot on ROS Answers with karma: 136 on 2017-08-02 Post score: 1 I ended up fixing this by using https://github.com/ros-industrial/industrial_ci. To be honest I don't know why this works, it now takes way longer because it uses Docker. But it does work and a lot of projects seem to use it. sudo: required dist: trusty language: generic notifications: email: on_success: change on_failure: always env: global: - ROS_REPO=ros - NOT_TEST_INSTALL=true matrix: - ROS_DISTRO=indigo UPSTREAM_WORKSPACE=file - ROS_DISTRO=indigo UPSTREAM_WORKSPACE=debian matrix: allow_failures: - env: ROS_DISTRO=indigo UPSTREAM_WORKSPACE=debian install: - git clone https://github.com/ros-industrial/industrial_ci.git .ci_config script: - .ci_config/travis.sh Originally posted by velveteenrobot with karma: 136 on 2017-08-15 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 28513, "lm_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, moveit, build", "url": null }
quantum-algorithms, quantum-state Title: How to check a qubit's state? Is it possible to write an algorithm that returns a single bit that represents if a qubit is in superposition or not, without compromising the qubit's wavefunction? Example: is_in_superposition($\vert 0 \rangle$) = 0 is_in_superposition($\dfrac{1}{\sqrt{2}} \vert 0 \rangle + \dfrac{1}{\sqrt{2}} \vert 1 \rangle$) = 1 Even though this gate wouldn't be unitary, it wouldn't even be linear. Let us write this down. Let us call this gate $\mathbf{S}$. $\mathbf{S}$ has the following properties: $$\mathbf{S}\,|x\rangle=\begin{cases}|0\rangle&\text{if } |x\rangle=|0\rangle\text{ or }|1\rangle\\|1\rangle&\text{otherwise}\end{cases}$$ Then we would have: $$\mathbf{S}\,(\alpha\,|0\rangle+\beta\,|1\rangle)=|1\rangle$$ by assumption. But we also have: $$\mathbf{S}\,(\alpha\,|0\rangle+\beta\,|1\rangle)=\alpha\,\mathbf{S}\,|0\rangle+\beta\,\mathbf{S}\,|1\rangle = \alpha\,|0\rangle+\beta\,|0\rangle$$
{ "domain": "quantumcomputing.stackexchange", "id": 1530, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-algorithms, quantum-state", "url": null }
python, optimization, python-3.x, graph, breadth-first-search Optimality Criteria A pareto optimal path for my case is defined as one that is non-dominated by ANY other path in consideration. For our case, non-dominated means that a path should have more bandwidth, lesser latency and lesser cost than the one it is being compared to. If a decision cannot be made, we keep both paths. What is important
{ "domain": "codereview.stackexchange", "id": 6275, "lm_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, optimization, python-3.x, graph, breadth-first-search", "url": null }
electromagnetism, electric-current, maxwell-equations Title: Ampére-Maxwell's law in the absence of sources My question: If I have the Ampére-Maxwell law $$\oint_\gamma \mathbf{B}\cdot d\mathbf{l}=\mu_0\left(I_{\text{enc.}}+\epsilon_0\frac{d\Phi_S(\mathbf{E})}{dt}\right) \tag 1$$ where $I_{\text{enc.}}$ is the current due to a difference in potential $\Delta V$ and the $$\epsilon_0\frac{d\Phi_S(\mathbf{E})}{dt} \tag 2$$ is the displacement current $I_S$, why when we are in the absence of sources have I only the quantity $(2)$? If I have not a battery $\Delta V=0$ it's obvious that $I_{\text{enc.}}=0$. But the $(2)\neq 0$ why have I always a very small current near to zero that always circulates in a circuit or for other reasons?
{ "domain": "physics.stackexchange", "id": 68305, "lm_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, electric-current, maxwell-equations", "url": null }
evolution, theoretical-biology, population-dynamics, biostatistics Each of your topics mentioned has its own models and prevailing theories, so without an exact question it is very hard to answer as to which model you might find best. Having said that there are well established models of things like geometric growth of populations (proposed by Thomas Malthus in 1798). The United Nations does a lot of modeling of populations and the like. You might be interested in their freely available publications and information here.
{ "domain": "biology.stackexchange", "id": 11310, "lm_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, theoretical-biology, population-dynamics, biostatistics", "url": null }
javascript, jquery, beginner, object-oriented, html HTML <form id="signup" method="post" action="" autocomplete="off" novalidate> <input type="hidden" name="W6K5Y" value="1xcSQoRqBOLu2NxPQhar"> <div class="input"> <label for="first-name">Full Name</label><!-- --><input type="text" id="first-name" name="firstName" placeholder="First name" maxlength="35" autocomplete="off"><!-- --><input type="text" id="last-name" name="lastName" placeholder="Last name" maxlength="35" autocomplete="off"> <div> <div class="addition">- ADDITIONAL MESSAGE</div> </div> </div> <div class="input"> <label for="email">Your Email</label><!-- --><input type="text" id="email" name="email" maxlength="254" autocomplete="off"> <div> <div class="addition .error">- ERROR MESSAGE<</div> </div> </div> <div class="input"> <label for="password">Password</label><!-- --><input type="password" id="password" name="password" autocomplete="off">
{ "domain": "codereview.stackexchange", "id": 9385, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, jquery, beginner, object-oriented, html", "url": null }
java, game-of-life, javafx }); env.simGeneration(0, cellsWide, 0, cellsHigh); } }); mainLoop.start(); mainStage.show(); } public void setupTopBar(HBox toolBar) { Button pauseButton = new Button("Pause"); pauseButton.setOnMouseClicked(pauseHandler); toolBar.getChildren().add(pauseButton); Button clearButton = new Button("Clear"); clearButton.setOnMouseClicked(clearHandler); toolBar.getChildren().add(clearButton); Button toggleClearButton = new Button("Toggle ScreenClear"); toggleClearButton.setOnMouseClicked(toggleClearHandler); toolBar.getChildren().add(toggleClearButton); Label dropLabel = new Label("Drop n*n square:"); toolBar.getChildren().add(dropLabel); TextField birthRadText = new TextField(); birthRadText.setOnAction(birthRadHandler); toolBar.getChildren().add(birthRadText); }
{ "domain": "codereview.stackexchange", "id": 17786, "lm_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, game-of-life, javafx", "url": null }
- You set $\frac{n}{n+4}$ to its limiting value $1$ but not the exponent, that is, you are assigning different meanings to the $n$'s inside the parentheses and the $n$ outside the exponent. All the $n$'s must have the same value, no? –  Dilip Sarwate Nov 18 '11 at 20:59 Do you believe $(A+B)^n$ and $A^n + B^n$ are the same? –  Will Jagy Nov 18 '11 at 21:04 Then entire expression, both base and exponent, depend on $n$. Why treat the base first, and the exponent later? Or why not try the exponent first, and the base later? Then you would have that for a fixed $n$, $\frac{n+3}{n+4}$ is smaller than $1$, so raised to higher and higher powers will go to $0$. The point is: you can't just decide that you are going to treat the exponent as fixed and deal with the base separately, nor can you decide that you are going to treat the base as fixed and deal with the exponent first; both matter, so they cannot be dealt with separately. –  Arturo Magidin Nov 18 '11 at 21:16
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9796676481414185, "lm_q1q2_score": 0.8326892700907055, "lm_q2_score": 0.8499711832583695, "openwebmath_perplexity": 396.3257036298877, "openwebmath_score": 0.9344607591629028, "tags": null, "url": "http://math.stackexchange.com/questions/83473/why-lim-limits-n-to-infty-left-fracn3n4-rightn-neq-1" }
android, kotlin var data: List<ImageObject> = listOf() enum class ViewType { ONE_COLUMN, TWO_COLUMN, THREE_COLUMN } override fun getItemCount(): Int = data.size override fun getItemViewType(position: Int): Int { return when(layoutManager?.spanCount){ 2 -> ViewType.TWO_COLUMN.ordinal 3 -> ViewType.THREE_COLUMN.ordinal else -> ViewType.ONE_COLUMN.ordinal } } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return when (viewType) { ViewType.ONE_COLUMN.ordinal -> OneColumnViewHolder.from(parent) ViewType.TWO_COLUMN.ordinal -> TwoColumnViewHolder.from(parent) else -> ThreeColumnViewHolder.from(parent) } } override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { val item = data[position] (holder as HomeViewHolder).bind(item, requestManager) }
{ "domain": "codereview.stackexchange", "id": 38347, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "android, kotlin", "url": null }
ros your must add the lines below to your cmakelists.txt rosbuild_add_library(CameraPublisher src/CameraPublisher.cpp) target_link_libraries(CameraPublisher ${GAZEBO_libraries} CameraPlugin) Originally posted by PeterMilani with karma: 1493 on 2013-03-25 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 13532, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros", "url": null }
autoencoder, representation The most sensible way to do it in my opinion is to have a function at the start that converts the coordinates into an image and a function at the end to convert the recovered image to coordinates again. The way you would train it is to gather a large number of training examples, pass them as 16*16 tensors containing 1s and 0s to your autoencoder network, then use the reconstructed image to extract the coordinates where the value is 1. There’s a good article/tutorial here to get you started.
{ "domain": "datascience.stackexchange", "id": 7891, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "autoencoder, representation", "url": null }
limit theorems of probability, as well as into all sorts of practical. What is the expected number of sixes that will show? Answer: 12/36 = 1/3 3. Increasing ndecreases both and. For this example, the symbolic (internal) solution is shown next and composed of the terms shown in the following equations. f = observed frequency = 80. In reality, I'm not particularly interested in using this example just so that you'll know whether or not you've been ripped off the next time you order a hamburger! Instead, I'm interested in using the example to illustrate the idea behind a probability density function. If you're going to take a probability exam, you can better your chances of acing the test by studying the following topics. This introduction to probability and statistics explores probability models, sample spaces, compound events, random samples, and a whole lot more. A biased coin (with probability of obtaining a Head equal to p > 0) is tossed repeatedly and independently until the first
{ "domain": "24-aktuell.de", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9850429103332288, "lm_q1q2_score": 0.8229871369414111, "lm_q2_score": 0.8354835391516132, "openwebmath_perplexity": 577.1692155592605, "openwebmath_score": 0.7442626357078552, "tags": null, "url": "http://rqck.24-aktuell.de/probability-examples-and-solutions.html" }
For the sake of computing the numeric value, \ref{Eq06} was a good place to stop. With the given parameters $$\rho = 1/3$$ and $$\tau = 2/5$$, we have $$\mathbb{E}[ R ] = 23/6$$, $$Q_X = 22$$, and $$Q_Y = 16$$. That makes $$\mathbb{E}[ R^2 ] = 190/9$$ and the variance $$V_R \equiv \mathbb{E}[ R^2 ] - \mathbb{E}[R]^2 = \frac{77}{12}~.$$ See the end of Solution.2 for a Mathematica code block for the numerical evaluation and more. One can quickly check the value of $$\mathbb{E}[ R ] \approx 3.8333$$ relative to $$\mu_{_X} = 3$$ and $$\mu_{_Y} = 2.5$$, as well as $$V_R \approx 6.146667$$ in relation to $$V_X = 6$$ and $$V_Y = 15/4$$. Both of the quantities for $$R$$ are slightly larger than the max of $$X$$ and $$Y$$, which is reasonable.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9825575173068326, "lm_q1q2_score": 0.8554118856730828, "lm_q2_score": 0.8705972633721708, "openwebmath_perplexity": 988.824214576845, "openwebmath_score": 0.9992894530296326, "tags": null, "url": "https://math.stackexchange.com/questions/2544529/variance-of-alternate-flipping-rounds/2701095" }
cache = [[None for _ in range(len(pattern))] for _ in range(len(text))] return self.is_match_helper(text, pattern, cache, 0, 0) def is_match_helper(self, text, pattern, cache, text_idx, pattern_idx): # base cases if text_idx == len(text): if pattern_idx == len(pattern): return True if pattern_idx+1 < len(pattern) and pattern[pattern_idx+1] == '*': return self.is_match_helper(text, pattern, cache, text_idx, pattern_idx+2) return False if pattern_idx == len(pattern): return False if cache[text_idx][pattern_idx] is not None: return cache[text_idx][pattern_idx] # '*' if pattern_idx < len(pattern)-1 and pattern[pattern_idx+1] == '*': prev_char = pattern[pattern_idx] # many of prev_char after_pattern = text_idx if prev_char == ".": after_pattern = len(text) else: while after_pattern < len(text) and text[after_pattern] == prev_char: after_pattern += 1
{ "domain": "paulonteri.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9559813501370535, "lm_q1q2_score": 0.8218225111577803, "lm_q2_score": 0.8596637487122111, "openwebmath_perplexity": 6090.381773024074, "openwebmath_score": 0.30743175745010376, "tags": null, "url": "https://dsa.paulonteri.com/Data%20Structures%20and%20Algorithms%2016913c6fbd244de481b6b1705cbfa6be/Recursion%2C%20DP%20%26%20Backtracking%20525dddcdd0874ed98372518724fc8753.html" }
linear regression in the key sense of fitting a functional form linear in the parameters. The curve fits included in KaleidaGraph can be divided into three main categories: Least Squares curve fits, nonlinear curve fits, and smoothing curve fits. Modeling Data and Curve Fitting¶. Scherer, Least Squares Data Fitting with Applications, Johns Hopkins University Press, to appear (the necessary chapters are available on CampusNet) and we cover this material:. Least squares/Calculation using Excel. You can specify variables in a MATLAB table using tablename. Homework Statement Hi! I've been interpolating a data set using Legendre polynomials and Newton's method and now I've been asked to, given a data set, approximate the function using the Least Squares Method with the following fitting function: ##g(r)=a+be^{cr}##, where ##a##, ##b## and ##c## are parameters to be found and my objective is to find the set of equations in the form F(r)=0 that. For example, the force of a spring linearly
{ "domain": "from.bz", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.986151391819461, "lm_q1q2_score": 0.8239132569964246, "lm_q2_score": 0.8354835411997897, "openwebmath_perplexity": 896.0800361771716, "openwebmath_score": 0.7048426866531372, "tags": null, "url": "http://zepn.from.bz/curve-fitting-least-square-method-example.html" }
which looks complicated relative to your book's solution (typos corrected). Let's see what conditions we need to match to the book's simpler (and one less parameter $\beta$). I don't know why certain parameters (like $\beta$) aren't present in your books solution, so let's see if these two can match at all: Your book's solution with obvious typo corrected: bookSoln = {v[t] == vstar Exp[-u t], y[t] == ystar ( u Exp[-a t] - a Exp[- u t]) / (u - a)} Matching occurs when the following is zero: letsSee = bookSoln /. constXSol // FullSimplify {True, (E^(-t (2 + u)) (E^(2 t) - E^(t u)) (beta vstar xstar - 2 ystar))/(-2 + u) == 0}
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9643214480969029, "lm_q1q2_score": 0.8056747002860101, "lm_q2_score": 0.8354835432479661, "openwebmath_perplexity": 8741.540128868553, "openwebmath_score": 0.23895035684108734, "tags": null, "url": "https://mathematica.stackexchange.com/questions/154983/solving-system-of-differential-equations" }
android Title: why appmanandroid_voice_recog is not listed on the Android Market I'd like to use https://kforge.ros.org/appmanandroid/voice_recoghg, but could not find on the Android Market. Originally posted by Kei Okada on ROS Answers with karma: 1186 on 2011-10-11 Post score: 1 The voice recog app is not ready for market release. It interacts with software on the robot that is still under development. The android portion of the app mainly just uses the builtin Android APIs for voice recognition and publishes that as a string to a topic. Originally posted by kwc with karma: 12244 on 2011-10-12 This answer was ACCEPTED on the original site Post score: 2
{ "domain": "robotics.stackexchange", "id": 6940, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "android", "url": null }
homework-and-exercises, rotational-dynamics, frequency, oscillators The above relation can be substituted into your eqn of motion to eliminate the constant terms. Without doing so explicitly, the manual solution seems to have ignored the effect of gravity (the $mgb$ term). That might be a reasonable approximation because the spring is very stiff and dominates the motion : the compression force in the spring is $1000N$ which is $40\times$ the weight of each ball ($25N$). I don't see any reason why the $\Omega^2$ term has been ignored.
{ "domain": "physics.stackexchange", "id": 31856, "lm_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, rotational-dynamics, frequency, oscillators", "url": null }
quantum-field-theory, operators, wavefunction, fourier-transform, dirac-delta-distributions Title: What are Test Functions in QFT (physics context)? In terms of mode function solutions of the KG equation, the field operator can be written as $$ \hat{\phi}(x) = \int_{R^3} d^3\textbf{p}\space \left(u_\textbf{p} \hat{a}_\textbf{p}+ u^*_\textbf{p}\hat{a}^\dagger_\textbf{p}\right). \tag{1}\label{eq1}$$ The positive frequency mode functions span a one-particle Hilbert space from which the bosonic Fock space of the theory can be constructed. Mathematically, equation \eqref{eq1} is an abuse of notation as the "field operator" presented here is actually pointwise representation of the operator-valued distribution $\hat{\phi}[f]$, which yields an operator on the Fock space once smeared with a Schwartz function $f$ (see p.50 of Chatterjee’s lecture notes), i.e. $$ \hat{\phi}[f] = \int d^4\textbf{x}\space f(x) \hat{\phi}(x).\tag{2} $$
{ "domain": "physics.stackexchange", "id": 92825, "lm_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, operators, wavefunction, fourier-transform, dirac-delta-distributions", "url": null }
homework-and-exercises, gravity, projectile keeping in mind that $t_2$ has to obviously be greater than $t_1$ ... the second and the third options are eliminated ... well it surely cant be $\frac{1}{3}$(maybe) .. because that is a really big ratio ... is there some other extra formula or something other than the common formulae (like max height and range and splitting of vectors)i am supposed to know to solve this question am i missing out anything? Total time taken by the projectile, $$T=\frac{2u\sin\theta}{g}$$ So $$t_{2}=T-t_{1}$$ Solve for $t_{1}$ putting $H=\frac{\left(u \sin\theta\right)^2} {2g}$ in the quadratic equation. You will get two roots. With those values you will find out $t_{2}$. Actually, you will get two $t_{2}$'s, hence two ratios. Infact one will the inverse of the other. You will get two correct answers. I think this hint is sufficient to answer your question.
{ "domain": "physics.stackexchange", "id": 15680, "lm_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, gravity, projectile", "url": null }
ros, rosdep, gazebo-ros Which is expected because I already have Gazebo 4. And if I include <build_depend>gazebo4_ros</build_depend> <build_depend>gazebo4_plugins</build_depend> Then it fails because rosdep cannot find those packages. Originally posted by Javier V. Gómez on ROS Answers with karma: 1305 on 2015-07-13 Post score: 0 As gazebo is a system dependency, you would need to add it to the rosdep definitions, which are used to lookup the respective packages. There is a how-to about contributing rosdep rules. But I'm not sure how this would be handled by the maintainers, as it actually introduces depedency conflicts between different packages. This is out of my league ;-) Originally posted by mgruhler with karma: 12390 on 2015-07-14 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 22165, "lm_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, rosdep, gazebo-ros", "url": null }
Otherwise, if you're trying to learn it all for the first time, then I think it's best to follow a structured order because math instruction builds upon itself. That is, we often need to understand previous knowledge before we advance to new material. For example, the rules and properties in beginning algebra allow us to simplify expressions and solve equations. Later, we use those skills to learn about trigonometry, precalculus, and calculus. So, it makes sense to study math in order. (After all, we would not want a surgical intern slicing open our body first and then asking for help finding basic anatomy.) #### Indranil ##### Junior Member Yes. 2 is the third root of 8 because we need three factors of 2 to make 8. 8 = 2 ∙ 2 ∙ 2 Likewise 2 is the fourth root of 16 because we need four factors of 2 to make 16. 16 = 2 ∙ 2 ∙ 2 ∙ 2 How many factors of 3 do we need to make 243? We need five of them. This means that 3 is the fifth root of 243. 243 = 3 ∙ 3 ∙ 3 ∙ 3 ∙ 3
{ "domain": "freemathhelp.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9790357573468176, "lm_q1q2_score": 0.8071777043823503, "lm_q2_score": 0.8244619242200082, "openwebmath_perplexity": 1163.6368577392448, "openwebmath_score": 0.6287972331047058, "tags": null, "url": "https://www.freemathhelp.com/forum/threads/why-x-1-2-root-x-and-x-1-2-1-root-x.111633/" }
Questions concerning the correctness of a counting procedure adopted are quite common on this forum. ( I will add some links if you think it is necessary.) This is one reason this question,albeit subjective, has been asked.Also i have not come across any text which addresses how not to undercount or overcount. Any discussion of techniques on how to avoid undercounting/overcounting or how to check the enumeration will be highly appreciated. Note:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9799765604649332, "lm_q1q2_score": 0.8368144825747534, "lm_q2_score": 0.8539127529517043, "openwebmath_perplexity": 233.74365880704696, "openwebmath_score": 0.7523306608200073, "tags": null, "url": "https://math.stackexchange.com/questions/1966609/how-to-check-if-you-are-counting-right" }
java, object-oriented, interface, hibernate, overloading // ... boolean isClassnameEmpty = helper.getClassname().isEmpty(); Criteria currentCriteria = isClassnameEmpty ? criteria : processClassName(criteria, helper.getClassname(), CRITERIA); // ...
{ "domain": "codereview.stackexchange", "id": 20109, "lm_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, object-oriented, interface, hibernate, overloading", "url": null }
audio, finite-impulse-response, kernel Title: How to chose a kernel function for a FIR low pass filter in audio processing? As the answer of a previous question, I was suggested to use a FIR filter to act as a low-pass filter to reconstruct the envelope of a sound wave (edited, emphasis mine): As I said in a comment, you can get the envelope of a signal by running it through a lowpass filter [...] Implement a lowpass filter (FIR) by creating a filter kernel of appropriate length M (h(M) ). Note that your FIR filter (sin(x)/x) should normally be multiplied by a window function (e.g Hamming, Blackman, etc). Convolve your signal with the filter kernel. [...]
{ "domain": "dsp.stackexchange", "id": 8096, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "audio, finite-impulse-response, kernel", "url": null }
automotive-engineering, energy, regenerative-braking This way you can show him that he has to personally put in extra effort (energy) to generate electricity to light up the bulb. Taking this concept back to the vehicle: Tell him that if you connect that motor to the free-spinning wheels, the wheels won't be free spinning anymore, they will feel the same resistance he felt. Thus, to keep the rear wheels spinning at the same rate, you need to put more energy into the front (driving) wheels in order to overcome that resistance. If you need to add extra energy to the driving wheels, it is defeating the purpose of generating energy from the rear, "not-anymore-free-spinning", wheels. As @Fred said, he will probably still not change his mind, but I think this is a good illustration for someone that is open for persuasion or are just starting to learn these concepts.
{ "domain": "engineering.stackexchange", "id": 2512, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "automotive-engineering, energy, regenerative-braking", "url": null }
quantum-mechanics, photons, double-slit-experiment, wave-particle-duality Title: Size of a single dot on a screen in a double-slit experiment When a single photon hits a screen - it leaves a dot; and many dots of other photons later - an interference pattern emerges. My question is about size of a single dot. What are key factors varying this size? Is there any equation for it?
{ "domain": "physics.stackexchange", "id": 62483, "lm_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, photons, double-slit-experiment, wave-particle-duality", "url": null }
machine-learning, scikit-learn, random-forest, data-science-model Will the model be less accurate at predicting inventory needs because it is missing dates for items where quantity picked is 0? I have tried running the same model with the rows where quantity picked = 0 but the total number of rows changes from approximately 50k to 5 million and my computer literally can't handle it, it just freezes. Without the rows where quantity picked = 0, the model reports mean squared log error level of .39448 and runs successfully within 4 minutes 37 seconds. Any guidance on if that data is necessary or not would be very much appreciated and/or advice on how to improve performance/accuracy of such a model. A random forest trained on data whose labels are all positive integers cannot produce any prediction less than 1. So yes, the model will be less accurate.
{ "domain": "datascience.stackexchange", "id": 5584, "lm_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, scikit-learn, random-forest, data-science-model", "url": null }
python, python-3.x, regex, file-system what if the regexp does not match (no underscore or less than 3 numbers) ? what if we have more than 4 numbers ? Should we consider only the first 4 ? what if the pattern appears more than once ? In order to tests tests, I've defined the following list of file names from my invention. files = [ '.h5', '_.h5', 'foo_.h5', 'foo_123.h5', 'foo_1234.h5', 'foo_1240.h5', 'foo_12345.h5', 'foo_12340.h5', 'foo_12340.h5', 'foo_12400.h5', 'foo_12403.h5', 'foo_123_bar.h5', 'foo_1234_bar.h5', 'foo_1240_bar.h5', 'foo_12345_bar.h5', 'foo_12340_bar.h5', 'foo_12400_bar.h5', 'foo_12403_bar.h5', 'foo_1234_bar_1240.h5', 'foo_1240_bar_1234.h5', ]
{ "domain": "codereview.stackexchange", "id": 34544, "lm_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, regex, file-system", "url": null }
python, game, homework, playing-cards def dealer_draw(cards): #2 empty prints to maintain clear overview print() print() a = 0 #first 2 cards (same as for the player until.....) cd1 = rd.choice(cards) cards.remove(cd1) points_first, name_first = cd1 if points_first == 11: name_first = str('Jack'+' of '+name_first) points_first = 10 elif points_first == 12: name_first = str('Queen'+' of '+name_first) points_first = 10 elif points_first == 13: name_first = str('King'+' of '+name_first) points_first = 10 elif points_first == 14: name_first = str('Jack'+' of '+name_first) points_first = 11 print(points_first, name_first) s(0.7) cd2 = rd.choice(cards) cards.remove(cd2) points_second, name_second = cd2 if points_second == 11: name_second = str('Jack'+' of '+name_second) points_second = 10 elif points_second == 12:
{ "domain": "codereview.stackexchange", "id": 39688, "lm_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, game, homework, playing-cards", "url": null }
php, authentication NULL login script: <?php //filter email var before connecting to database function validateEmail($email) { if(filter_var($email, FILTER_VALIDATE_EMAIL)) { //echo "email is valid"; } else { //echo "Email not valid"; exit; } } //connect to database function db_connect($db_name, $db_username, $db_password) { $conn = new PDO($db_name, $db_username, $db_password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $conn; } // check login credentials function userLogin($email, $password,$PDO) { $stmt = $PDO->prepare(" SELECT student_table.user_id ,student_table.user_pass FROM student_table WHERE student_table.user_email = :EMAIL UNION SELECT teacher_table.user_id ,teacher_table.user_pass FROM teacher_table WHERE teacher_table.user_email = :EMAIL UNION SELECT management_table.user_id,management_table.user_pass FROM management_table WHERE management_table.user_email = :EMAIL");
{ "domain": "codereview.stackexchange", "id": 42925, "lm_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, authentication", "url": null }
electrostatics, electric-fields, charge, polarization, dipole I have an idea: $p=qd$ is for two point electrons, but in this example, we need to regard the electron cloud as a whole $-q$ in its center- and $p=qd$ still holds, for the integral $$\int r' \rho(r') d\tau'$$ does not change if you regard the electron cloud as that. Is my interpretation correct? Yes it is correct. Basically, the dipole moment: $$ P=\int d^3r \rho r $$ depends on the origin when the total charge: $$ Q=\int d^3r \rho $$ is does not vanish $Q\neq0$. Typically, in this case you take the origin to be the center of charge: $$ R=\frac{P}{Q} $$ Taking the origin to be $R$ you automatically cancel the dipole moment. When $Q=0$, the dipole moment becomes origin independent. One way to formalize your intuition is to set $\rho_\pm$ for the positive/negative charges defined by: $$ \rho=\rho_+-\rho_- \\ |\rho|=\rho_++\rho_- $$ note that they are both positive. You can then define: $$ q=\int d^3r \rho_\pm=\frac{1}{2}\int d^3r |\rho| $$
{ "domain": "physics.stackexchange", "id": 93047, "lm_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, charge, polarization, dipole", "url": null }
c#, .net, validation public static string LengthBetween(this string @value, int min, int max, [CallerArgumentExpression("value")] string? thisExpression = default) { if (value.Length < min) throw new ArgumentOutOfRangeException(thisExpression, $"Can't have less than {min} items"); if (value.Length > max) throw new ArgumentOutOfRangeException(thisExpression, $"Can't have more than {max} items"); return value; } public static IComparable<T> RangeWithin<T>(this IComparable<T> @value, T min, T max, [CallerArgumentExpression("value")] string? thisExpression = default) { if (value.CompareTo(min) < 0) throw new ArgumentOutOfRangeException(thisExpression, $"Can't have less than {min} items"); if (value.CompareTo(max) > 0) throw new ArgumentOutOfRangeException(thisExpression, $"Can't have more than {max} items"); return value; } }
{ "domain": "codereview.stackexchange", "id": 43048, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, .net, validation", "url": null }
c++, qt device_processes = newProcesses; } void MainWindow::updateProcessInfoTree() { // only update every 500 milliseconds and if the current tab is the tables if (clocks % 500 == 0 && ui->tabWidget->currentIndex() != 0) { updateProcessInfo(); int len = device_processes.size(); int len2 = processInfoTree->topLevelItemCount(); int len3 = len - len2; /*add or remove items based off new length*/ if (len3 > 0) { for (int i = 0; i < len3; i++) { new QTreeWidgetItem( processInfoTree, QStringList{" ", " ", " ", " "}); } } else if (len3 < 0) { for (int i = len2 - 1; i > (len2 - 1) - abs(len3); --i) { delete processInfoTree->takeTopLevelItem(i); } } auto sorted_device_processes = device_processes; /*Sort table based on current sort mode*/ switch (currentSortMode) {
{ "domain": "codereview.stackexchange", "id": 38036, "lm_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++, qt", "url": null }
Mathematica. I will use the convention [math]\hat{u}(\. However, whether or. However, in addition, we expect it to satisfy two other conditions. Appropriate initial and boundary conditions must be determined to solve equation (1 and the thermophysical properties known. Specified Flux: In this case the flux per area, (q/A) n, across (normal to) the boundary is specified. Note as well that is should still satisfy the heat equation and boundary conditions. Boundary Condition Types. Figure 3-2 Isotherms and heat flow lines in a rectangular plate. Transforming the differential equation and boundary conditions. Before presenting the heat equation, we review the concept of heat. Two classes of artificial boundary conditions (ABCs) are designed, namely, nonlocal analog Dirichlet-to-Neumann-type ABCs (global in time) and high-order Padé approximate ABCs (local in time). A nodal FEM when applied to a 2D boundary value problem in electromagnetics usually involves a second order differential
{ "domain": "umood.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9777138138113965, "lm_q1q2_score": 0.8210195020805188, "lm_q2_score": 0.83973396967765, "openwebmath_perplexity": 512.9019421213272, "openwebmath_score": 0.8403221964836121, "tags": null, "url": "http://pziq.umood.it/heat-equation-boundary-conditions.html" }
quantum-mechanics If one thinks of the spin correlation diagram in the article, one might interpret the possible outcomes as two possible system response curves (or possibly zero or one). It seems that if the apparatus is properly tuned to a particular type of particle system, one should always see the quantum result. Is there some clarity that can be brought to this issue? When one discusses with experimentalists building an apparatus creating entangled state, one quickly understands that violating Bell's inequalities is a key benchmark for them in order to be sure to have created entanglement. So the Bell's theorem is actually used as "quantum state detector", or more technically, as an entanglement witness. There exists other quantum witnesses, and they are also used, but a Bell's inequality violation is mainly used by experimentalist because:
{ "domain": "physics.stackexchange", "id": 1031, "lm_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", "url": null }
java, tcp } } TCPServer package socketUse; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.ServerSocket; import java.net.Socket; class TCPServer { public static void main(String[] args) throws Exception { try { String TCPclientMess; String returnMess; @SuppressWarnings("resource") ServerSocket input = new ServerSocket(22003);
{ "domain": "codereview.stackexchange", "id": 11861, "lm_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, tcp", "url": null }
ros, ros-melodic, pythonpath Hmm well that's unfortunate, I guess I can't use ROS then, since I do everything in Python 3 and nothing in 2 As I wrote earlier: search for posts regarding ROS and Python 3 compatibility. There have been many, and it's certainly possible. It's just not the default for now. Comment by gvdhoorn on 2018-12-11:\ I see two lines in my bashrc, source /opt/ros/melodic/setup.bash and source ~/ros_ws/devel/setup.bash, I should remove these in order to make Python3 work again, right?
{ "domain": "robotics.stackexchange", "id": 32149, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros, ros-melodic, pythonpath", "url": null }
newtonian-mechanics, acoustics, oscillators, string The formula speed of wave propagation in a string involves this tension $T$ in which it is a constant. Can tension in a string be constant when it's oscillating? Consider a small segment segment under tension
{ "domain": "physics.stackexchange", "id": 26255, "lm_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, acoustics, oscillators, string", "url": null }
ruby, ruby-on-rails def initialize(*args) raise 'This class cannot be initialized' if self.class == ArticleVote super end validate :user, presence: true before_create(prepend: true) do existing_record = article.article_votes.find_by(user_id: user_id) return false if existing_record && existing_record.class == self.class existing_record && existing_record.destroy true end end
{ "domain": "codereview.stackexchange", "id": 6834, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ruby, ruby-on-rails", "url": null }
performance, array, ecmascript-6 let aircraft = [ { tail: "9736968", status: "DRAFT" }, { tail: "5114419", status: "SERVICEABLE" }, { tail: "8395671", status: "OUTOFSERVICE" }, { tail: "332273", status: "SERVICEABLE" }, { tail: "6123961", status: "UNSERVICEABLE" }, ]; // http://stackoverflow.com/a/34890276 function groupBy(collection, attr) { return collection.reduce(function(result, item) { (result[item[attr]] = result[item[attr]] || []).push(item); return result; }, {}); } let aircraftByStatus = groupBy(aircraft, 'status'); console.log(aircraftByStatus);
{ "domain": "codereview.stackexchange", "id": 24725, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "performance, array, ecmascript-6", "url": null }
php, object-oriented } private function __apiCall($url){ $raw = file_get_contents($url); $json = json_decode($raw, true); return $json; } } This answer is in two sections. Firstly I am going to cover the Object Oriented nature of your solution and suggest possible architectural changes. Then I am going to look at your existing Code line by line for improvements. Object Oriented Your OO is good, you have nothing bad in there. Here are some of the features of OO that you have used: Data hiding (baseUrl property is private) Encapsulation (use of private __apiCall to minimize interface for callers)
{ "domain": "codereview.stackexchange", "id": 1651, "lm_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, object-oriented", "url": null }