text
stringlengths
49
10.4k
source
dict
#### Exercise 2 (By analambanomenos) Let $\varepsilon>0$. By Theorem 7.8 there is an integer $N$ such that for all $n,m\ge N$ and $x\in E$, $$\big|f_n(x)-f_m(x)\big|<\varepsilon/2\quad\quad\big|g_n(x)-g_m(x)\big|<\varepsilon/2.$$ Hence for all $n,m\ge N$ and $x\in E$, $$\big|(f_n+g_n)(x)-(f_m+g_m)(x)\big|\le\big|f_n(x)-f_m(x)\big|+\big|g_n(x)-g_m(x)\big|<\varepsilon.$$ Hence, also by Theorem 7.8, $\{f_n+g_n\}$ converges uniformly on $E$.
{ "domain": "linearalgebras.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9759464436075291, "lm_q1q2_score": 0.8001719767323273, "lm_q2_score": 0.8198933271118221, "openwebmath_perplexity": 55.2552102170771, "openwebmath_score": 0.9958506226539612, "tags": null, "url": "https://linearalgebras.com/baby-rudin-chapter-7a.html" }
ros, ros-melodic, package.xml, dependencies Why doesn't rospack list runtime dependencies? I explained what you observed.
{ "domain": "robotics.stackexchange", "id": 33801, "lm_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, package.xml, dependencies", "url": null }
quantum-mechanics, angular-momentum, conservation-laws, potential, commutator A scalar operator $A$ satisfies, by definition, $$ R^\dagger A R=A $$ where $R$ is any rotation. As $R= \exp[i \vec\theta\cdot\vec L]$, you can expand the relation above to first order in $\theta$ to check that it is equivalent to $$ R^\dagger A R=A \quad\Leftrightarrow\quad [A,\vec L]=0 $$ so yes: a rotationally invariant operator commutes with the three components of the angular momentum operator.
{ "domain": "physics.stackexchange", "id": 30837, "lm_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, angular-momentum, conservation-laws, potential, commutator", "url": null }
python, object-oriented, email Title: Program for sending emails Disclaimer: This question is very much like the one posted here. I gathered some opinions about my options from the answer there. Here, I just want validation about the choices I'm deciding to stick to and see what people think about the decisions specifically. Also, gather suggestions about other parts of the code I'm not specifically asking about, since I'm new to Python OOP. Scenario: I'm writing a program that will send emails. For an email, the to, from, text and subject fields will be required and other fields like cc and bcc will be optional. Also, there will be a bunch of classes that will implement the core mail functionality, so they will derive from a base class (Mailer). Following is my incomplete code snippet: class Mailer(object): __metaclass__ == abc.ABCMeta def __init__(self,key): self.key = key @abc.abstractmethod def send_email(self, mailReq): pass class MailGunMailer(Mailer): def __init__(self,key): super(MailGunMailer, self).__init__(key) def send_email(self, mailReq): from = mailReq.from to = mailReq.to subject= mailReq.subject text = mailReq.text options = getattr(mailReq,'options',None) if(options != None): if MailRequestOptions.BCC in options: #use this property pass if MailRequestOptions.CC in options: #use this property pass class MailRequest(): def __init__(self,from,to,subject,text): self.from = from self.to = to self.subject = subject self.text = text def set_options(self,options): self.options = options class MailRequestOptions(): BCC = "bcc" CC = "cc" I've made the following decisions about code designs. What do you think about them?
{ "domain": "codereview.stackexchange", "id": 12841, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, object-oriented, email", "url": null }
c++, game, socket, tcp // Now read the packet itself if (!readFromSocket(nextPacketSize)) { break; } // If this Connection has no packet factory, then it belongs to the relay server. The relay server doesn't care // about the contents of incoming packets, it just wraps them in RelayedPackets. std::shared_ptr<const Packet> packet = packetFactory ? packetFactory->deserialize(recvBuffer) : std::make_shared<RelayedPacket>(recvBuffer, remoteClientId); if (packet) { // Pass packets directly to the listener if present, otherwise queue them until requested if (listener) { listener->onPacketReceived(*this, packet); } else { std::scoped_lock lock(receivedPacketsMutex); receivedPackets.push_back(packet); } } } } bool Connection::readFromSocket(std::size_t numBytes) { recvBuffer.resize(numBytes); socket.receive(recvBuffer); // The socket may get closed during a call to `receive` bool success = !socket.isClosed(); return success; } std::vector<std::shared_ptr<const Packet>> Connection::getReceivedPackets() { std::vector<std::shared_ptr<const Packet>> packetsToReturn; { std::scoped_lock lock(receivedPacketsMutex); packetsToReturn = receivedPackets; receivedPackets.clear(); } return packetsToReturn; } BufferUtils Finally, here are a couple of utility methods that I use to add data to / extract data from a buffer: #pragma once #include <cstddef> // std::size_t #include <cstring> // std::memcpy #include <stdexcept> #include <vector> namespace Rival { namespace BufferUtils {
{ "domain": "codereview.stackexchange", "id": 44628, "lm_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++, game, socket, tcp", "url": null }
chemical-engineering, cfd, matlab The x axis in this case is the average residence time which should be proportional to the length along the tube, making our plots comparable.
{ "domain": "engineering.stackexchange", "id": 2148, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "chemical-engineering, cfd, matlab", "url": null }
digital-communications, frequency, phase, synchronization, pll Note that even after acquisition you would like the loop bandwidth to be as wide as possible depending on the dynamics of the link (you mention Doppler, of interest after acquisition would be the maximum possible rate of change of the Doppler offset), but you don't want it so wide that it starts to track out the phase variation inherent in the modulation itself. The phase noise of your local oscillator (LO) plays a big part too in optimizing this loop bandwidth for carrier tracking; if you make the loop bandwidth too tight then your LO and similar jitter sources (ADC clock) start contribution to your noise in detrimental ways. To this point consider the plot below showing the effect of local oscillator phase noise on a QAM signal and how it interacts with a carrier recovery loop:
{ "domain": "dsp.stackexchange", "id": 8545, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "digital-communications, frequency, phase, synchronization, pll", "url": null }
ros-melodic, message-filters Originally posted by gvdhoorn with karma: 86574 on 2018-11-08 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by D0l0RES on 2018-11-08: thanks I understand Comment by D0l0RES on 2018-11-08: I have a message that has its header file, I added it and still the error persists Comment by gvdhoorn on 2018-11-08: If you've changed your code/setup/build then I would suggest to update your question text to show exactly what you're doing now. Otherwise we cannot help you. Do not overwrite your current question. Just edit it and append the new information. Comment by D0l0RES on 2018-11-12: @gvdhoorn, added a new version of the code Comment by D0l0RES on 2018-11-12: @gvdhoorn, I created my custom message (msg).it's called mkzBlaFeedbackBla and he msg file contains the packet marker. Then I added my Cmake name to my message and got a header. and then I use it in my code to receive and receive messages. Comment by gvdhoorn on 2018-11-12: That sounds all fine, but the problem is with the .msg file. It does not contain a field with the name header and with the type std_msgs/Header. The problem is not with a C++ header file.
{ "domain": "robotics.stackexchange", "id": 32025, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros-melodic, message-filters", "url": null }
c++, tree } else return false; } /* findKthInorder @param mynode [in] -- the root of tree whose kth largest is to be found @param k [in] -- value k @param count [in] -- a counter to keep track of which node we're in @param result [in,out] -- returns mynode->elem once we're in kth node */ void findKthInorder(const node *mynode, const int k, int &count, int &result) const { if(mynode != NULL) { findKthInorder(mynode->left,k,count,result); if(!--count) { result = mynode->elem; return; } // if (!--count) findKthInorder(mynode->right,k,count,result); } // if (mynode != NULL) } // findKthInorder /* findKthInorder abstracts away previous function and is exposed to outside world */ int findKthInorder(const int k) const { int count = k,result = 0; findKthInorder(root,k,count,result); return result; } }; // class tree Here's some test code that I wrote: int main() { tree T = tree(5); T.insert(1); T.insert(7); T.insert(-1);T.insert(6); for(int i = 1;i != 5; ++i) printf("%d, " T.findKthInorder(i)); // -1, 1,5,6,7 return 0; } I'll be happy to listen to any suggestions for a more elegant findKthInorder() function. If you add a total count field to each node, you can find the k-th element efficiently (in logarithmic time) by writing a method like this (untested): node *kth(int k) { assert(k >= 0 && k < total);
{ "domain": "codereview.stackexchange", "id": 241, "lm_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++, tree", "url": null }
The geometric multiplicity is 2, whereas the algebraic multiplicity is 4, so $$T$$ is not diagonalizable. Thank you! Your conclusion is correct. (Your notation for elements of $$\mathbb R_4[x]$$ is a bit curious, but I'm assuming you're following a convention set by your textbook). If you just wanted to conclude the operator is not diagonalizable, you could get by a bit quicker by noting that your matrix is similar to $$\begin{bmatrix} 1 & -18 \\ & 1 \\ & & 1 & -6 \\ &&& 1 \end{bmatrix}$$ simply by writing your basis is a different order (namely $$x, x^3, 1, x^2$$). Since this matrix is in Jordan form and not already diagonal, it is not diagonalizable.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9811668723123672, "lm_q1q2_score": 0.8259714373461554, "lm_q2_score": 0.8418256472515683, "openwebmath_perplexity": 249.43554581694522, "openwebmath_score": 0.9447898864746094, "tags": null, "url": "https://math.stackexchange.com/questions/3079545/eigenspace-for-a-linear-transformation-diagonalizability" }
atmospheric-science Title: Why does the location of the north magnetic pole vary faster than that of the south magnetic pole? Noticing what Wikipedia asserts about the variation of the locations of the magnetic poles over time, e.g., 1998 $\sim$ 2000 to 2015, one would notice that the location of the north magnetic pole varies much faster than that of the south magnetic pole. What logic would justify this dissimilar variation? Have a look on how the earth's magnetic field is modeled presently: he Earth's magnetic field is attributed to a dynamo effect of circulating electric current, but it is not constant in direction. So the question becomes why the circulating currents have a higher effect on the northern hemisphere than the southern one. It evidently depends on how the magma in the center of the earth is oriented and the dynamo effect appears. Convection drives the outer-core fluid and it circulates relative to the earth. This means the electrically conducting material moves relative to the earth's magnetic field. If it can obtain a charge by some interaction like friction between layers, an effective current loop could be produced. The magnetic field of a current loop could sustain the magnetic dipole type magnetic field of the earth. Large-scale computer models are approaching a realistic simulation of such a geodynamo. So the details are not known, but the difference will be due to the geological topology of the earth. For an intuitive understanding, take a bar of magnet. The north and south are joined rigidly. Turn the middle portion to a fluid, with a different density from north to south, you could then in a rotation have the north turning in much larger circles than the south. In a sense , if the dynamo is fitted successfully we will learn something about the composition of the earth, solid-fluid.
{ "domain": "physics.stackexchange", "id": 56259, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "atmospheric-science", "url": null }
thermodynamics, enthalpy Title: Enthalpy and Internal Energy for Isothermal Expansion Considering a system with constant atmospheric pressure , i.e a massless piston sitting in a cylinder containing water. At constant temperature say $\rm 100\,^{\circ} C$, the water turns into vapour and pushes the piston up. Now shouldnt the $\Delta U=0$ as $Q = -p(V_2 - V_1)$, considering the Ideal Gas Behaviour And then as $\Delta H = \Delta U + \Delta n\cdot R\cdot T$, then shouldn't $\Delta H = \Delta n\cdot R\cdot T$? Then according to the question in image below, why isn't $\Delta U = 0$? You are right that an in in ideal gas, internal energy is a function of temperature only, and that in this problem, temperature is not changing. However, I think you are confused about how broadly the ideal gas law applies to this problem. The question states that the ideal gas law applies to the water vapor. But the question is about a phase change of water. Let's break down some of the components of the problem. In the question we have: Liquid water. The ideal gas law does not apply to liquid water. Water vapor. The ideal gas law does apply. A phase change of liquid water to water vapor. $\ce{H2O(l) <=> H2O(g)}$ The ideal gas law does not apply to the process of the phase change, simply because processes are not gases and cannot be modeled by the ideal gas law. Thus only one of three "components" of the problem is an ideal gas. As a look at any reasonable steam table will tell you, the internal energy of water vapor is higher than the internal energy of liquid water. This difference is the heat of vaporization (at constant volume).
{ "domain": "chemistry.stackexchange", "id": 4352, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics, enthalpy", "url": null }
particle-physics, standard-model, renormalization, quantum-chromodynamics, strong-force Title: Why does literature list the strong coupling at the scale of the Z-boson's mass? In the 2004 edition of the book "QCD as a Theory of Hadrons" by S. Narison, the author provides a value for the strong coupling at a scale of the mass of the Z boson, $$ \alpha_s (M_Z) = 0.1181 \pm 0.0027 \tag{11.68}$$ This is a footnote explaining the choice of the scale: [$\tau$ decays give] so far the most precise measurement of $\alpha_s$ at $M_Z$ as a modest accuracy at the $\tau$-mass becomes a precise value at the $Z$-mass because the errors decrease faster than the running of $\alpha_s$. Also, here, compared with some other determinations, we have relatively the best theoretical control including the perturbative corrections to order $\alpha_s^4$, the non-perturbative condensates and the resummation of the asymptotic series. (sic) Apart from a possible typo in the first sentence, I do not understand this reasoning. Also the PDG states on page 4 of their QCD review (PDF link) that it has become standard practice to quote the value of $\alpha_s$ at a given scale (typically the mass of the $Z$ boson, $M_Z$) [...] These are the measurements of the strong coupling constant . Running of the Strong Force Strength The plot shows the running, or evolution, of the strength of the strong interaction. This is characterized by the evolution of the strong coupling constant aS, plotted here versus energy scale in GeV. This plot is taken from the Particle Data Group.
{ "domain": "physics.stackexchange", "id": 56447, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "particle-physics, standard-model, renormalization, quantum-chromodynamics, strong-force", "url": null }
c, embedded Title: MicroC task switching My background for this review is a university course in embedded systems using MicroC and this question. Now my program appears to run ok, but I'd like to know what you think can be improved or if the solution I've done so far is not acceptable for some reason? #include <stdio.h> #include "system.h" #include "includes.h" #include "altera_avalon_pio_regs.h" #include "sys/alt_irq.h" #include "sys/alt_alarm.h" #define DEBUG 1 #define HW_TIMER_PERIOD 100 /* 100ms */ /* Button Patterns */ #define GAS_PEDAL_FLAG 0x08 #define BRAKE_PEDAL_FLAG 0x04 #define CRUISE_CONTROL_FLAG 0x02 /* Switch Patterns */ #define TOP_GEAR_FLAG 0x00000002 #define ENGINE_FLAG 0x00000001 /* LED Patterns */ #define LED_RED_0 0x00000001 // Engine #define LED_RED_1 0x00000002 // Top Gear #define LED_GREEN_0 0x0001 // Cruise Control activated #define LED_GREEN_2 0x0002 // Cruise Control Button #define LED_GREEN_4 0x0010 // Brake Pedal #define LED_GREEN_6 0x0040 // Gas Pedal /* * Definition of Tasks */ #define TASK_STACKSIZE 2048 OS_STK StartTask_Stack[TASK_STACKSIZE]; OS_STK ControlTask_Stack[TASK_STACKSIZE]; OS_STK VehicleTask_Stack[TASK_STACKSIZE]; // Task Priorities #define STARTTASK_PRIO 5 #define VEHICLETASK_PRIO 10 #define CONTROLTASK_PRIO 12 // Task Periods #define CONTROL_PERIOD 300 #define VEHICLE_PERIOD 300 /* * Definition of Kernel Objects */ // Mailboxes OS_EVENT *Mbox_Throttle; OS_EVENT *Mbox_Velocity;
{ "domain": "codereview.stackexchange", "id": 9878, "lm_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, embedded", "url": null }
ros, geometry, transform Title: Do transforms expire? Some code (such as amcl_player.cc) refers to an expiration time for transforms. How does the concept of transforms that expire interact with the transform library's attempts at interpolation/extrapolation? Is this documented anywhere? Originally posted by tfoote on ROS Answers with karma: 58457 on 2011-04-03 Post score: 2 The concept of expiring transforms is not actually supported. What amcl and a few others do is date their transforms in the future. This is to get around the problem that a chain of transforms is only as current as the oldest link of the chain. The future dating of a transform allows the slow transform to be looked up in the intervening period between broadcasts. This technique is dangerous in general, for it will cause tf to lag actual information, for tf will assume that information is correct until its timestamp in the future passes. However for transforms which change only very slowly this lag will not be observable, which is why it is valid for amcl to use this. It can safely be used for static transforms. I highly recommend being careful with future dating any measurements. Another technique available is to allow extrapolation. And either technique can creep up on you and cause unusual behavior which is untraceable. Originally posted by tfoote with karma: 58457 on 2011-04-03 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 5267, "lm_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, geometry, transform", "url": null }
1 of 4 #1) What is the magnitude of vector A? Here vector a is shown to be 2.5 times a unit vector. So if you have a vector given by the coordinates (3, 4), its magnitude is 5, and its angle is 53 degrees. The magnitude of a vector is the length of the vector. Vectors in 2D Vectors Example: Express each of the following vectors as a column vector and find its magnitude. They are labeled with a "", for example:. #2) What is the direction of vector A relative to the negative y-axis? then the magnitude of velocity is 20Km/hr. speed is scalar as it has no direction. A Unit Vector has a magnitude of 1: The symbol is usually a lowercase letter with a "hat", such as: (Pronounced "a-hat") Scaling.
{ "domain": "ferrao.org", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9867771759145342, "lm_q1q2_score": 0.8347566950224478, "lm_q2_score": 0.8459424431344437, "openwebmath_perplexity": 298.0396982008256, "openwebmath_score": 0.838137686252594, "tags": null, "url": "http://ferrao.org/tags/aeb464-what-is-the-magnitude-of-a-unit-vector" }
Learn what a zero matrix is and how it relates to matrix addition, subtraction, and scalar multiplication. is the additive identity in K. The zero matrix is the additive identity in ( i.e. We define –A = (–1)A. Matrix multiplication computation. Ask Question Asked 7 years, 11 months ago. Berechne die Entfernung, wenn die Winkel *alpha*= 62 Grad und *beta*= 51 Grad betragen. Both orderings would yield the same result. Verstehe nicht, warum die Diagonale da der Zauberschlüssel ist, die Diagonale kann doch aus 0 bestehen, und der rest sind werte ungleich 0. The zero matrix is the only matrix whose rank is 0. Check your intuition: Once again let’s list some facts about rows that lead from this interpretation of matrix multiplication. filter_none. Finden Sie 2 Matrizen B und C \ 0, so dass B*A = 0 und A*C = 0. dev. & . Table of contents. A is a square matrix. How to find the value of variables from a matrix. Among all types of matrices, only Zero Matrix rank is always zero in all cases of multiplication. Consider the following example for multiplication by the zero matrix. For example, $$A =\begin{bmatrix} 3 & -5 & 7\\ 0 & 4 & 0\\ 0 & 0 & 9 \end{bmatrix}$$ 10) Lower Triangular Matrix. 6. n As such, it enjoys the properties enjoyed by triangular matrices, as well as other special properties. A zero matrix is the additive identity of the additive group of matrices. Then which of the following is truea)A and B are both null matricesb)Either of A is or B is a null matrixc)Niether of them may be a zero matrixd)All of the above options are correct.Correct answer is option 'D'. In this video, I go through an easy to follow example that teaches you how to perform Boolean Multiplication on matrices. If A = A T, A is Symmetric Matrix. Question 9: Show that the equation O X = O OX = O O X = O and X O = O XO = O X O = O holds … Example 3.1. Let A =
{ "domain": "pascuet.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9711290905469752, "lm_q1q2_score": 0.8454623318718288, "lm_q2_score": 0.8705972667296309, "openwebmath_perplexity": 742.5291037043787, "openwebmath_score": 0.8836588263511658, "tags": null, "url": "https://www.pascuet.com/g2snmz42/518951-zero-matrix-multiplication" }
rosmake /home/labrobotica/ros_workspace_elec/pr2_controllers/pr2_mechanism_controllers/src/pr2_odometry.cpp:426:35: error: expected primary-expression before ‘>’ token /home/labrobotica/ros_workspace_elec/pr2_controllers/pr2_mechanism_controllers/src/pr2_odometry.cpp:426:54: error: ‘svdOfFit’ was not declared in this scope /home/labrobotica/ros_workspace_elec/pr2_controllers/pr2_mechanism_controllers/src/pr2_odometry.cpp:454:31: error: ‘class controller::OdomMatrix16x1’ has no member named ‘cwise’ make[3]: *** [CMakeFiles/pr2_mechanism_controllers.dir/src/pr2_odometry.o] Error 1 make[3]: se sale del directorio «/home/labrobotica/ros_workspace_elec/pr2_controllers/pr2_mechanism_controllers/build» make[2]: *** [CMakeFiles/pr2_mechanism_controllers.dir/all] Error 2 make[2]: se sale del directorio «/home/labrobotica/ros_workspace_elec/pr2_controllers/pr2_mechanism_controllers/build» make[1]: *** [all] Error 2 make[1]: se sale del directorio «/home/labrobotica/ros_workspace_elec/pr2_controllers/pr2_mechanism_controllers/build»
{ "domain": "robotics.stackexchange", "id": 8768, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "rosmake", "url": null }
c#, .net, xna return (char)key; } else { if ((int)key >= 0x41 && (int)key <= 0x5A) return (char)((int)key + 32); else if ((int)key >= 0x30 && (int)key <= 0x39) return (char)key; else { switch (key) { case Framework.Windows.Forms.Keys.Separator: return '-'; case Framework.Windows.Forms.Keys.Oemplus: return '='; case Framework.Windows.Forms.Keys.Divide: return '/'; case Framework.Windows.Forms.Keys.Multiply: return '*'; case Framework.Windows.Forms.Keys.Subtract: return '-'; case Framework.Windows.Forms.Keys.Add: return '+'; case Framework.Windows.Forms.Keys.NumPad0: case Framework.Windows.Forms.Keys.NumPad1: case Framework.Windows.Forms.Keys.NumPad2: case Framework.Windows.Forms.Keys.NumPad3: case Framework.Windows.Forms.Keys.NumPad4: case Framework.Windows.Forms.Keys.NumPad5: case Framework.Windows.Forms.Keys.NumPad6: case Framework.Windows.Forms.Keys.NumPad7: case Framework.Windows.Forms.Keys.NumPad8: case Framework.Windows.Forms.Keys.NumPad9: return key.ToString().Substring(6, 1)[0]; case Framework.Windows.Forms.Keys.OemPeriod: return '.'; case Framework.Windows.Forms.Keys.Oemcomma: return ','; case Framework.Windows.Forms.Keys.OemQuestion: return '/'; case Framework.Windows.Forms.Keys.OemPipe: return '\\'; case Framework.Windows.Forms.Keys.OemOpenBrackets: return '['; case Framework.Windows.Forms.Keys.OemCloseBrackets: return ']'; case Framework.Windows.Forms.Keys.OemSemicolon: return ';';
{ "domain": "codereview.stackexchange", "id": 15266, "lm_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, xna", "url": null }
electric-circuits, electric-current, electrical-resistance, voltage Title: Why isn't $V_L$ not equal to $i_LR_L$ according to Thevenin's theorem? According to Thevenin's Theorem $I_L= \frac{V_{th}-V_L}{R_g}$ whereas $I_L$= current through the load. $V_{th}$= The potential difference across the load resistance when the load resistance is disconnected. $V_L $=The potential difference across the load resistance when the load resistance is connected. $R_g$= The equivalent resistance of the curcuit between the load points. Now why can't we write $ V_L = i_LR_L$ by the ohm's law? Now why can't we write $V_L=i_LR_L$ by the superposition? All you need is Ohm's law to write that (superposition is typically used for circuits with more than one source so I'm not sure why you're attempting to apply it here). But this is consistent with Thevenin's theorem isn't it? The total series resistance is $$R_{eq} = R_g + R_L$$ thus $$I_L = \frac{V_{th}}{R_{eq}} = \frac{V_{th}}{R_g + R_L}$$ Now apply Ohm's law $$I_L = \frac{V_{th}}{R_g + \frac{V_L}{I_L}}$$ and it follows that $$I_L = \frac{V_{th} - V_L}{R_g} $$
{ "domain": "physics.stackexchange", "id": 57560, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electric-circuits, electric-current, electrical-resistance, voltage", "url": null }
r, seurat Title: How do I change the legend for a Violin Plot with median dot I'm plotting scRNA data using Violin Plots. I need to re-order the plots and add median dots. My code is: Vln_plot <- VlnPlot(object, features = c("Mcidas"), cols = c("coral1", "cadetblue", "cadetblue2"), split.by = "genotype", assay = "RNA", pt.size = 0, log = TRUE) + stat_summary(fun.y = median.stat, geom='point', size = 10, colour = "blue", position = position_dodge(0.9)) Vln_plot$data$split<- factor(x = Vln_plot$data$split, levels = c("WT", "F7KO", "F8HET")) Vln_plot median.stat <- function(x){ out <- quantile(x, probs = c(0.5)) names(out) <- c("ymed") return(out) } and my output looks like: Is there any way to fix the legend so those dots aren't in each box? I also need to figure out how to get rid of that x-axis tic mark and change the x axis label from Identity to something else. Can anyone point me in the right direction on how to accomplish this? Your command looks like it creates a ggplot2 object, so it should be possible to remove the symbol via guides, setting the associated aesthetic to "none": Vln_plot <- VlnPlot(object, features = c("Mcidas"), cols = c("coral1", "cadetblue", "cadetblue2"), split.by = "genotype", assay = "RNA", pt.size = 0, log = TRUE) + stat_summary(fun.y = median.stat, geom='point', size = 10, colour = "blue", position = position_dodge(0.9)) + guides(color = "none")
{ "domain": "bioinformatics.stackexchange", "id": 2408, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "r, seurat", "url": null }
exactly one over the other. Solution. In fact, all squares are similar, but only some are congruent. (i) All squares are congruent. False i True Cs have equal areas If the lengths of the corresponding sides of regular polygons are in ratio 1/2, then the ratio of their areas … 2+3 produces 5. Now if the rectangles are congruent then yes. It says that if the attributes of two geometrical figures are the same then the two figures are equal. So, Emma should find two squares whose side lengths are exactly the same. Two triangles, ABC and A′B′C′, are similar if and only if corresponding angles have the same measure: this implies that they are similar if and only if the lengths of corresponding sides are proportional. Two figures are congruent if their corresponding parts are congruent. AREAS OF PARALLELOGRAMS AND TRIANGLES 153 you can superpose one figure over the other such that it will cover the other completely . Two objects are congruent if they have the same shape, dimensions and orientation. iii) False Area of a rectangle = length × breadth Two rectangles can have the same area. For example: Two squares are congruent if their sides are equal, perimeters, or areas are equal. = True (iii) If two figures have equal areas, they are congruent. All four corresponding sides of two parallelograms are equal in length that does mean that they are necessarily congruent because one parallelogram may or may not overlap the other in this case because their corresponding interior angles may or may not be equal. Copyright © 2021 Multiply Media, LLC. To find whether one line segment is congruent to the other or not, we use the same method of superposition as discussed above. However, the lengths of their sides can vary and hence they are not congruent. All Rights Reserved. A square of $1 \times 1$ must have an area of $1$. (iii) False For example, if a triangle and a square have equal area, they cannot be congruent. For two polygons, including squares, to be congruent, all the pairs of corresponding angles must be congruent, but so must all the pairs of corresponding sides. -If two rectangles have equal areas, then they are congruent. Question 94: If the areas of
{ "domain": "mbjclothing.com", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9621075690244281, "lm_q1q2_score": 0.8306756080607899, "lm_q2_score": 0.8633916152464017, "openwebmath_perplexity": 421.66547954517074, "openwebmath_score": 0.6394241452217102, "tags": null, "url": "https://mbjclothing.com/3fs4hz/if-two-squares-have-equal-areas-then-they-are-congruent-4801b5" }
java, algorithm, game, pathfinding Node n = possibleNeighbors.remove(0); return n; } private void printSolution(ArrayList<Node> output) { System.out.println("Shortest Path:"); for (Node n : output) { int x=n.getX(); int y=n.getY(); System.out.println(n.toString()); matrix[x][y]=0; } System.out.println(""); for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix.length; j++) { if(matrix[i][j]!=0 && matrix[i][j]!=OBSTACLE) { matrix[i][j]=1; } if(matrixVisited[i][j]==false) { matrix[i][j]=1; } if(matrix[i][j]==OBSTACLE) { System.out.print("O "); } else { System.out.print(matrix[i][j]+" "); } } System.out.println(""); } } public static void main(String[] args) { LeeAlgorithm l = new LeeAlgorithm(); ArrayList<Node> output = l.findPath(new Node(0, 0), new Node(5, 4)); l.printSolution(output); } }
{ "domain": "codereview.stackexchange", "id": 31194, "lm_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, algorithm, game, pathfinding", "url": null }
python, beginner, sudoku if __name__ == '__main__': # You can test with this Sudoku puzzle or enter one yourself p = [[0, 9, 6, 0, 5, 7, 1, 0, 0], [0, 4, 0, 8, 2, 0, 9, 0, 0], [0, 3, 0, 0, 0, 0, 5, 0, 0], [0, 0, 9, 5, 0, 0, 4, 0, 0], [0, 1, 0, 0, 0, 0, 0, 9, 0], [0, 0, 8, 0, 0, 2, 6, 0, 0], [0, 0, 4, 0, 0, 0, 0, 2, 0], [0, 0, 3, 0, 7, 9, 0, 5, 0], [0, 0, 1, 2, 6, 0, 9, 8, 0]] # If you want to test another Sudoku puzzle uncomment 'test another' # and set 'p' in solve() to 'test_another' # Then you'll be prompted to enter the puzzle block, enter numbers # without spaces and enter 0 for empty slots # test_another = test_list_build() time1 = time() solve(p) time2 = time() print('%s seconds.' % (time2 - time1)) This is a lot of code so it's hard to prioritise which sections to review, so I'll do some fairly general stuff which is short and easy, then go a little more into the overall design. As a result, this won't be an exhaustive review. Follow PEP8 unless your employer has certain internal rules. Even then, try to follow standard style and only deviate when required. PEP8 is the standard for Python and makes your code more readable. print() takes a couple of arguments, one being end. The default is to end with a new line, end=\n but you can change this to no new line end='' or as many new lines as you want, end='\n\n'. You can also override the default behaviour for the whole file using functools.partial: from functools import partial
{ "domain": "codereview.stackexchange", "id": 35078, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, beginner, sudoku", "url": null }
async-await, promise, typescript Title: Parallel and Sequential array looping with async/await Are these good implementations of parallel and sequential "extension" methods, and do they accomplish what I think they do? My understanding is that the first one is parallel because the await applies to each invocation of the async lambda that is passed to map. So each invocation will block asynchronously and run in parallel. In contrast, the await in the sequential function applies to the outer function, so each iteration of the for loop will block, and the next iteration will only occur once the previous one completes. I based these implementations on the answer found at this SO question: https://stackoverflow.com/questions/37576685/using-async-await-with-a-foreach-loop Array.prototype.forEachParallel = async function ( func: (item: any) => Promise<void> ): Promise<void> { await Promise.all(this.map(async (item: any) => await func(item))); }; Array.prototype.forEachSequential = async function ( func: (item: any) => Promise<void> ): Promise<void> { for (let item of this) await func(item); }; Example usage: await someList.forEachParallel(item => this.SomeAsyncOperation(item)); A little additional code is: // type declaration interface Array<T> { ... forEachParallel(func: (item: T) => Promise<void>): Promise<void>; forEachSequential(func: (item: T) => Promise<void>): Promise<void>; } // make sure nothing is already defined on these members [ ... Array.prototype.forEachParallel, Array.prototype.forEachSequential ].forEach(maybeMember => { if (maybeMember) throw new Error("prototype extension collision"); }); JavaScript's execution model My understanding is that the first one is parallel because the await applies to each invocation of the async lambda that is passed to map.
{ "domain": "codereview.stackexchange", "id": 29713, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "async-await, promise, typescript", "url": null }
general-relativity, metric-tensor, cosmological-constant Title: Basic relativity problem: a limit on the cosmological constant I am working through a problem in Schutz's A First Course in General Relativity. With respect to Einstein's field equations, $$G^{\alpha\beta}+\Lambda g^{\alpha\beta}=8\pi T^{\alpha\beta},$$ he asks, "find the Newtonian limit and show that one recovers the motion of the planets only if $|\Lambda|$ is very small. Given that the radius of Pluto's orbit is $5.9\times 10^{12}\,\mathrm{m}$, set an upper bound on $|\Lambda|$ from solar system measurements." The answer he gives is $|\Lambda| < 4\times10^{-35}\mathrm{m}^{-2}$, but I am completely stumped. When I take the Newtonian limit, I get something like $$-\frac{1}{2}\nabla^2\bar{h}^{\alpha\beta} + \Lambda\left(\eta^{\alpha\beta}+h^{\alpha\beta}\right)=8\pi T^{\alpha\beta},$$ but cannot see a way to reduce further, let alone come up with an inequality. Rewrite the Einstein Equation as: $$ G^{\alpha\beta}=\frac{8\pi G}{c^2}(T^{\alpha\beta}-\frac{c^4\Lambda}{8\pi G}g^{\alpha\beta}) $$ Thus we can absorb the cosmological constant into our stress energy. We use the stress energy tensor of the solar system as that of a single point particle (the Sun), ignoring all the other planets and teapots and such: $T = diag(M_\odot c^2\delta(\vec r),0,0,0)$. We now examine the time-time component of the Einstein equation: $$
{ "domain": "physics.stackexchange", "id": 39511, "lm_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, metric-tensor, cosmological-constant", "url": null }
Computing the hypotenuse of the unit right triangle (same as the diagonal of the unit square) is significantly easier than the general Pythagorean Theorem, see, e.g., this For that matter, the so-called Babylonian method for extracting square roots doesn't rely on the Pythagorean Theorem. • How would they have figured this out naturally? – user614647 Nov 11 '18 at 17:27 • Figured what? The hypotenuse? That's really clear in this case. The square root method (Newton's method narrowed down to square roots) is, to my mind, much more impressive. – lulu Nov 11 '18 at 17:30 • Yes the square root method sorry – user614647 Nov 11 '18 at 17:51
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9748211582993981, "lm_q1q2_score": 0.8102158347416458, "lm_q2_score": 0.8311430541321951, "openwebmath_perplexity": 899.8426029893094, "openwebmath_score": 0.7156984806060791, "tags": null, "url": "https://math.stackexchange.com/questions/2994117/did-babylonians-know-the-pythagorean-theorem-before-his-time" }
ros, camera-info-manager, dynamic-reconfigure Originally posted by migueloliveira on ROS Answers with karma: 65 on 2011-05-30 Post score: 1 Original comments Comment by migueloliveira on 2011-05-30: I found the problem. I had a problem in the CMakeList.txt. Sorry for the trouble. Its solved. I found the problem. I had a problem in the CMakeList.txt. Sorry for the trouble. Its solved. - migueloliveira (May 30) Originally posted by Wim with karma: 2915 on 2011-08-02 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 5705, "lm_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, camera-info-manager, dynamic-reconfigure", "url": null }
temperature, light, heat Title: Why does sunburn cause fever? Today I found out that sunburns can cause fever. What I don't understand is how/why? In my understanding fever is the side effect of an immune reaction against an intruder, mainly bacteria (though I admit I can be wrong). Google searches like "can sunburn cause fever" only bring up that it is possible, but not why. Here is a good article on the topic. https://www.nlm.nih.gov/medlineplus/ency/article/003227.htm But it's most likely due to the fact that a sun burn is an actual burn on the skin that can cause inflammation, inflammation can in turn cause fever. Also having a really bad sunburn can open you up more to the possibilities of skin infections. If this happens then once again you might get a fever due to infection. If you really want to find out more on the cause of fever after sunburn you need to examine the pathophysiology of fever and why fever happens. I bet my money on fever due to skin inflammation after a sunburn, I guess the real question would be why does inflammation cause fever since sunburn = skin inflammation Here is a good article http://antranik.org/inflammation-and-the-pathophysiology-of-fever/
{ "domain": "biology.stackexchange", "id": 5396, "lm_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, light, heat", "url": null }
c, reinventing-the-wheel Don't: int res; int sign; res = 0; sign = 1; Don't reinvent the wheel Your first loop that skips over whitespace could use the standard library function isspace(): Edit: spot the bug in my original code... :/ Buggy (oops): while (isspace(*ato++)); Correct: while (isspace(*ato)) ato++; The condition check in the second loop can use the stdlib function isdigit(): while (isdigit(*ato)) { ... ato++; } If your instructor or assignment instructions prevent you from using isspace() and isdigit(), why not go ahead and define them yourself? You already have the logic!* * Except you have a minor bug in your check for space characters. You also need to check for vertical tab (\v). Edit: Chux points out that calling isspace(*ato) and isdigit(*ato) when *ato < 0 invokes undefined behavior (UB). Specifically, the C11 standard, section 7.4, Character Handling, states, The header <ctype.h> declares several functions useful for classifying and mapping characters. In all cases the argument is an int, the value of which shall be representable as an unsigned char or shall equal the value of the macro EOF. If the argument has any other value, the behavior is undefined. The correct usage, then, of the isspace() and isdigit() functions in this code would be: while (isspace(*(unsigned char *)ato)) { atoi++; } //... while (isdigit(*(unsigned char *)ato)) { //... ato++; } Chux also pointed out that your original code as written did not have this problem; you weren't invoking undefined behavior. Moral of the story: be careful of the advice you receive from strangers on the Internet...? =) Other than the issues mentioned, you have a decent implementation!
{ "domain": "codereview.stackexchange", "id": 20408, "lm_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, reinventing-the-wheel", "url": null }
# Probability of a survivor in chick-pecking tournament This is a follow up to this question: Suppose that $n$ chicks are arranged in a circle. Every chick randomly pecks either the chick to their right or the chick to their left. By the other question, the expected number of unpecked chicks is $n/4$. Instead of ending there, make a tournament out of it. Remove the pecked chicks from the circle and repeat the experiment with the remaining chicks. Iterate as long as possible. It is easy to see that the process ends with either $0$ or $1$ remaining chick. Question: Let $p(n)$ denote the probability that the process ends with $1$ chick. What can be said about $\lim_{n \rightarrow \infty}p(n)$? The following graph shows the result of Monte Carlo simulations which estimate $p(n)$ for all $n$ in the range $1$ to $1000$ (and using $1000$ tournaments for each $n$). The wave-like nature of the graph is interesting. To get a better handle on it, we need the exact probabilities. The following is based on a nice formula by @6005 in the comments to this answer to the other question: $p(0) = 0$ and $p(1) = 1$. For any $n \geq 2$ we have: $$p(n) = \begin{cases} \sum_{k=0}^\frac{n}{2} \left(\frac{\binom{n}{2k} + (-1)^k \binom{n/2}{k}}{2^{n-1}}\right) p(k) & \text{if n is even} \\ \sum_{k=0}^\frac{n-1}{2} \left(\frac{\binom{n}{2k}}{2^{n-1}}\right)p(k) & \text{otherwise}. \end{cases}$$ The following shows the graph of $p(n)$ from $n=1$ to $1000$:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9830850862376966, "lm_q1q2_score": 0.8355939921250544, "lm_q2_score": 0.849971181358171, "openwebmath_perplexity": 466.19788642716827, "openwebmath_score": 0.9050763249397278, "tags": null, "url": "https://math.stackexchange.com/questions/2318540/probability-of-a-survivor-in-chick-pecking-tournament" }
python, python-3.x, homework Here's the explanation and here's a picture. Big network: Small network: And here's my code: def to_dict(pairs): from collections import defaultdict paired = defaultdict(set) for k, v in pairs: paired[k].add(v) paired[v].add(k) return dict(paired) def to_pairs(network): return {(k, v) for k, vs in network.items() for v in vs if k < v} def n_friends(network, n): return {k for k , v in network.items() if len(v) == n} def lonely(network): return {k for k, v in network.items() if len(v) == 1} def most_known(network): return max(network, key=lambda k: len(network[k])) def common_friends(network, name1, name2): return set(network[name1].intersection(network[name2])) def by_n_friends(network): return {x: {k for k, v in network.items() if len(v) == x} for x in range(1, len(network))} def clique(network, names): import itertools as it return {tuple(sorted(y)) for y in (it.combinations(names, 2))} <= {tuple(sorted(x)) for x in to_pairs(network)} def most_commons(network): friends = {} for pair in to_pairs(network): for elem in pair: friends.setdefault(elem, set()).update(pair) return next(iter(({pair for pair in to_pairs(network) if ({pair: len(friends[pair[0]] & friends[pair[1]]) for pair in to_pairs(network)})[pair] == (max({pair: len(friends[pair[0]] & friends[pair[1]]) for pair in to_pairs(network)}.values()))})))
{ "domain": "codereview.stackexchange", "id": 23970, "lm_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, homework", "url": null }
t heta 1 = 0. The center is at (h, k). Radii and Rotation θis the angle in radians from positive x-axis to the ellipse's major axis in the counterclockwise direction. In mathematics, a rotation of axes in two dimensions is a mapping from an xy-Cartesian coordinate system to an x'y'-Cartesian coordinate system in which the origin is kept fixed and the x' and y' axes are obtained by rotating the x and y axes counterclockwise through an angle. Do the intersection points of two rotated parabolas lie on a rotated ellipse? 1. Are there any funky conversions I need to do? Here is the equations I'm using: An ellipse rotated from an angle phi from the origin has as. By default, the first two parameters set the location, and the third and fourth parameters set the shape's width and height. Equation of ellipse; 2018-02-03 15:26:12. The path of a heavenly body moving around another in a closed orbit in accordance with Newton’s gravitational law is an ellipse (see Kepler’s laws of planetary motion). Because the equation refers to polarized light, the equation is called the polarization ellipse. Accordingly, we can find the equation for any ellipse by applying rotations and translations to the standard equation of an ellipse. The major axis is 2a. You know that for an ellipse, the sum of the distances between the foci and a point on the ellipse is constant. Find the equation of ellipse with center C(0, 4), foci F 1 (0, 0) and F 2 (0, 8), and major axis of length 10 units. This equation is very similar to the one used to define a circle, and much of the discussion is omitted here to avoid duplication. In conclusion, we have used the perturbative density functional theory to calculate structural, as well as thermodynamical properties of a simple one-dimensional model of hard-ellipse fluid. Mean of a Random Variable. Rotated Parabolas and Ellipse. \displaystyle \frac { {x}^ {2}} { {b}^ {2}}+\frac { {y}^ {2}}
{ "domain": "rsalavis.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9848109538667758, "lm_q1q2_score": 0.8028498766201418, "lm_q2_score": 0.815232480373843, "openwebmath_perplexity": 546.9529436440415, "openwebmath_score": 0.7337966561317444, "tags": null, "url": "http://scjo.rsalavis.it/equation-of-a-rotated-ellipse.html" }
analytical-chemistry, aromatic-compounds Title: Phenyl group in proton NMR Suppose you have this spectrum and the molecular formula of $\ce{C10H12O}$ The structure is My problem is with the peak at ~7 which is an H-Benzene signal, with quartet splitting and a relative area of 4. Surely this means that: The benzene would have only one Hydrogen environment with 4 Hydrogens in that environment and 3 hydrogens on the adjacent carbon atoms But the answer has 2 H-Benzene environments. How come this goes against normal? Please can answers be not too technical as I am a pre-university student You asked to keep it simple, which is why I’m skipping explaining some details. Check the bottom of the answer to see the parts with superscript numbers explained. The signal at $7\,\mathrm{ppm}$ is not a quartet. It would only be a (typical; there are exceptions, however not in typical organic chemistry) quartet if both of the following two conditions are met: The signal ratio is $1\,:\,3\,:\,3\,:\,1$ and The distance between all four signals is equal (they have the same coupling constant[1]) Both reasons stem from the way quartets are created due to coupling. In your case, the signal is approximately $3.5\,:\,6.5\,:\,6.5\,:\,3.5$ (violating the first condition) and the distances are (enlarging the image on my screen and measuring with a ruler, so only a very rough approximation) $\mathrm{7\,mm, 12\,mm, 7\,mm}$ (violating the second condition). What you are in fact observing is a pair of doublets. (It could be a doublet of doublets[2] as suggested by bon, but it is not.) You can think of it as two signals, each being a doublet, that are very close together. And that fits perfectly with the theory: Each signal would have an integral of $2$ and would correspond to one set of aromatic protons: The two on the aldehyde’s side at lower field (slightly higher shift) The two on the ethyl group’s side at higher field (slightly lower shift).
{ "domain": "chemistry.stackexchange", "id": 3613, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "analytical-chemistry, aromatic-compounds", "url": null }
frequency, fsk Title: Orthogonality of FSK modulation for non-coherent detection For an FSK modulation with coherent detection, in order to ensure orthogonality, the frequency separation between symbols is $ \Delta f=f_2 - f_1 =1/2T$. However, in case of non-coherent demodulation, which must be this value $1/2T$ or $1/T$? For continuous-phase FSK, frequencies $f_1$ and $f_2$ and phases can be chosen so that a frequency spacing of $\frac{1}{2T}$ gives orthogonality. Note that it is not sufficient to have just $\Delta f = \frac{1}{2T}$; both $f_1$ and $f_2$ have to be integer multiples of $\frac{1}{2T}$ or $\frac{1}{4T}$ etc. Look for Sunde's FSK and minimum-shift keying (MSK) regarded as coherent FSK. If the phases are not carefully specified (as they indeed are for Sunde's FSK and MSK), orthogonality requires $\Delta f$ to be an integer multiple of $\frac{1}{T}$ and so of course the minimum spacing is $\frac{1}{T}$. The theory of noncoherent detection assumes that the phase of the received signal is arbitrary rather than carefully controlled, and it is guaranteed to give the specified error-rate vs SNR performance regardless of signal phase as long as the frequency-spacing is $\frac{1}{T}$. The noncoherent receiver will work and it will provide the specified error-rate vs SNR performance if its input is a continuous-phase FSK signal with minimum frequency spacing $\frac{1}{2T}$ etc. However, it is worth keeping in mind that if the received signal is such that coherent detection is possible, then use of noncoherent detection in lieu of coherent detection is a suboptimal choice as far as BER vs SNR is concerned, though it might be preferable for other reasons such as ease of implementation, cost, weight, power consumption, etc of the receiver.
{ "domain": "dsp.stackexchange", "id": 991, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "frequency, fsk", "url": null }
ros, path, message, rospack, source Title: Do I really need to $ source ~/catkin_ws/devel/setup.bash? Novice question: I've created a custom message, package, etc as the official tutorial does. But when i do: $ rosrun pkg_test1 pkg_test1_node it gives me: [rospack] Error: package 'pkg_test1' not found Indeed, if i do: $ source ~/catkin_ws/devel/setup.bash the problem is fixed. But do i really need to do that every time i want to use my custom programs? Is there any simple way to mantain them in the ROS path (i think that is what i am doing when i call these commands). Thanks in advance. Originally posted by thepirate16 on ROS Answers with karma: 101 on 2016-03-17 Post score: 1 Yes, you really do need to source a setup.bash file in every single terminal that you want to use ROS in. These scripts control many important ROS environment variables and non-ROS environment variables (PYTHONPATH, CMAKE_PREFIX_PATH, etc.). The setup.bash scripts provide a convenient way to control which version of ROS is "active" and which workspaces are "active" (see page on overlaying workspaces). If you want every terminal to automatically "source" a particular setup.bash script, you could put that command in your ~/.bashrc. See the Environment Setup section of the ROS installation instructions. Originally posted by jarvisschultz with karma: 9031 on 2016-03-17 This answer was ACCEPTED on the original site Post score: 6
{ "domain": "robotics.stackexchange", "id": 24151, "lm_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, path, message, rospack, source", "url": null }
Thus $\dfrac{1}{2}$ is an upper bound for our set. However close we are to $\dfrac{1}{2}$, but below $\dfrac{1}{2}$, we will have $\dfrac{x}{x+1}\lt\dfrac{1}{3}$. So there is no cheaper upper bound than $\dfrac{1}{2}$. Remark: For your other question, I think you intend to look at $\{-\frac{1}{n}\}$, where $n$ ranges over the positive integers. The smallest element of this set is $-1$. It is therefore the infimum. For the supremum, note that our numbers are all $\lt 0$, but can be made arbitrarily close to $0$ by choosing $n$ large enough. So the supremum is $0$.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9854964203086181, "lm_q1q2_score": 0.8010778319147963, "lm_q2_score": 0.8128673178375735, "openwebmath_perplexity": 150.56950709733104, "openwebmath_score": 0.9478328227996826, "tags": null, "url": "http://math.stackexchange.com/questions/265549/how-to-get-the-supremum-and-infimum-of-a-set" }
c#, strings, regex, xml Title: String Interpolation / Word Matching with XML in C# I'm working on a project where I need to map XML values to field names. Classic CS problem, I think I've got a pretty good approach but would like feedback. For example: breachReportType matches to Breach Report Type:. However, there are similar matches like: breachType or breachReportCause. The inputs are like ... Xml by Field Name: <xml><breachReportType> Field Name by ID: [ { Key: '1234', Value: 'Breach Report Type' } ] Content by Field ID: <xml><Field id='1234' Value='Email'> // this.MapValues //-> // Fields Example: [{ Key: '12345', Value: 'Breach Report Type' }] // XML Example: '<breachReportType />' private Dictionary<string, string> MapValues(Dictionary<string, string> fields, string xml) { var map = new Dictionary<string, string>(); var elements = XDocument.Parse(xml).Descendants(); foreach (XElement elm in elements) { string name = elm.Name.ToString(); string formattedName = this.SplitCamelCase(name); int currentMaxCount = 0; string bestMatchId = null; foreach (var field in fields) { string strippedFieldValue = field.Value.Substring(0, field.Value.Length - 1); // XML: breach Report Type // Field Name: Breach Type int match = this.MatchStrings(strippedFieldValue, formattedName); // once we find a match, update the index if (match > currentMaxCount) { if (bestMatchId != null) { // get the previous one string prevName; fields.TryGetValue(bestMatchId, out prevName); // compare the previous match int prev = this.MatchStrings(prevName, formattedName);
{ "domain": "codereview.stackexchange", "id": 4214, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, strings, regex, xml", "url": null }
of dots in the sum of squares in pascal's triangle row is twice the sum will be proven using the formula. See that this is where we stop - at least for Now: is numbers. Look at each row down to row 15, you will see that this is also formula... The signs start with 0 easily obtained by symmetry. ) many ways there are simple algorithms to all. A basketball team has 10 players and wants to know how many there... Are omitted, as opposed to triangles cell of Pascal 's triangle also, published the triangle last... For constructing it in a triangular array of the final number ( 1 ) are. Materials Blaise Pascal, a famous French Mathematician and Philosopher ) at the top square multiple... Top square a multiple of the given series row of the given series there are simple algorithms to compute the... Pascal ’ s triangle probability theory was known well before Pascal 's triangle the! General form: ∑ = = ( ) Blaise Pascal ( 1623-1662 did! Normalization, the coefficients of ( x ) then equals the middle element of sum of squares in pascal's triangle... Constructing Pascal 's triangle row-by-row arise in binomial expansions 10 choose 8 is 45 ; is... Confirm that it fits the pattern of numbers in bold are the first few rows of the terms in bottom! His book on business calculations in 1527: ∑ = = ( ), and the diagonals... Gersonides in the early 14th century, using the Principle of Mathematical Induction of the squares of the given.., published the full triangle on the frontispiece of his book on business in. Represents the number in row 10, which is 45 a method of finding nth roots based on frontispiece! Are omitted 1, 2, they are still Abel summable, which 45! Terms in the shape produces the same number numbers ( e.g be seen by applying Stirling 's formula the! The code in C program for Pascal ’ s triangle, calculate the sum of all the elements of row... By applying Stirling 's formula to the triangle, calculate the sum of all the elements its... Table ( 1 ) is more difficult to explain ( but see below ) the (. First is 1 as stated previously, the apex of the binomial theorem is not difficult to explain but! The binomial theorem tells us we can
{ "domain": "co.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.965899573306072, "lm_q1q2_score": 0.8209868013963152, "lm_q2_score": 0.8499711813581708, "openwebmath_perplexity": 906.4556793242757, "openwebmath_score": 0.857445240020752, "tags": null, "url": "https://www.aerotherm.co.com/ordu03v/9c5b5e-sum-of-squares-in-pascal%27s-triangle" }
c#, random public Single GetSingle() { return (Single)GetUInt64() / UInt64.MaxValue; } public Double GetDouble() { return (Double)GetUInt64() / UInt64.MaxValue; } public Int16 GetInt16() { return BitConverter.ToInt16(GetBytes(2), 0); } public Int32 GetInt32() { return BitConverter.ToInt32(GetBytes(4), 0); } public Int64 GetInt64() { return BitConverter.ToInt64(GetBytes(8), 0); } public UInt16 GetUInt16() { return BitConverter.ToUInt16(GetBytes(2), 0); } public UInt32 GetUInt32() { return BitConverter.ToUInt32(GetBytes(4), 0); } public UInt64 GetUInt64() { return BitConverter.ToUInt64(GetBytes(8), 0); } /// <summary> /// Generates random bytes of the specified length. /// </summary> /// <param name="count">The number of bytes to generate.</param> /// <returns>The randomly generated bytes.</returns> public abstract byte[] GetBytes(int count); } } Any suggestions for improvements would be welcome. I think the design is pretty good. A few comments: I'd rename the class to something a bit more descriptive, say RandomGenerator. Then when you implement the class you can declare it with CspGenerator: RandomGenerator or MersenneGenerator: RandomGenerator and it's obvious what the class does. Comment the get() methods. IMO all public elements should be documented. Get/set could be left out, but that is a matter of preference. In particular I'd like to know what kind of range min anf max is and is used for. Is getBytes() needed externally? If not, I would consider making it class-level rather than public.
{ "domain": "codereview.stackexchange", "id": 44, "lm_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#, random", "url": null }
Questions: 1. Is it true, then, that the possible amount of combinations is 3,024, because 9*8*7*6=3,024? 2. Is it also true that 24 of the combinations are correct, since you do not have to type the combination in any particular order? Therefore 1*2*3*4=24. 3. Is it true that the chances of guessing it right are 1 in 125 since 3,000/24=125? If order makes a difference then the answer is $9\cdot 8 \cdot 7\cdot 6=3024$. If order makes no difference then $\binom{9}{4}=\frac{9!}{4!\cdot 5!}=126$ • June 25th 2011, 12:07 PM FatalSylence Re: 9-Digit Combination Lock Chances And Probability Quote: Originally Posted by Plato If order makes a difference then the answer is $9\cdot 8 \cdot 7\cdot 6=3024$. If order makes no difference then $\binom{9}{4}=\frac{9!}{4!\cdot 5!}=126$ I'm not sure I understand your answer. 126 as in a 1 in 126 chance of guessing it right? • June 25th 2011, 12:12 PM Plato Re: 9-Digit Combination Lock Chances And Probability Quote: Originally Posted by FatalSylence I'm not sure I understand your answer. 126 as in a 1 in 126 chance of guessing it right? That is the combination of 9 things taken 4 at a time. By the way that is $\frac{3024}{24}$. • June 25th 2011, 12:24 PM FatalSylence Re: 9-Digit Combination Lock Chances And Probability Quote: Originally Posted by Plato That is the combination of 9 things taken 4 at a time. By the way that is $\frac{3024}{24}$. Hmm, okay. Can you direct me towards a resource that explains the "n things taken r at a time"? Also, were my other questions correct?
{ "domain": "mathhelpforum.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9811668723123672, "lm_q1q2_score": 0.859293189768998, "lm_q2_score": 0.8757869981319863, "openwebmath_perplexity": 633.8700922861218, "openwebmath_score": 0.5551171898841858, "tags": null, "url": "http://mathhelpforum.com/statistics/183602-9-digit-combination-lock-chances-probability-print.html" }
c++, algorithm Considering { 6, 9, 8, 7, 3, 2, 4 }, the longest descending-first subsequence that starts with 6 is { 6, 3, 4 } — it connects to the 2-element ascending-first we found in step 3. (We walk consider elements 3, 2, and 4, which are all smaller than 6. Of those, 3 is the one that starts the longest known ascending-first sequence.) The longest ascending-first subsequence is { 6, 9, 3, 4 } — connecting to the 3-element descending-first subsequence found in step 6. Considering { 5, 6, 9, 8, 7, 3, 2, 4 }, the longest descending-first subsequence that starts with 5 is { 5, 3, 4 } — it connects to the 2-element ascending-first we found in step 3. The longest ascending-first subsequence is { 5, 9, 3, 4 } — connecting to the 3-element descending-first subsequence found in step 6. Considering { 2, 5, 6, 9, 8, 7, 3, 2, 4 }, the longest descending-first sequence is { 2 }. The longest ascending-first sequence is { 2, 9, 3, 4 }. Considering { 3, 2, 5, 6, 9, 8, 7, 3, 2, 4 }, the longest descending-first sequence is { 3, 2, 9, 3, 4 }. The longest ascending-first sequence is { 3, 5, 3, 4 } — connecting to the descending-first sequence found in step 8. Considering { 4, 3, 2, 5, 6, 9, 8, 7, 3, 2, 4 }, the best descending-first sequence is { 4, 3, 2, 9, 3, 4 }. The best ascending-first sequence is { 4, 6, 3, 4 } — connecting to the descending-first sequence found in step 7. Considering { 7, 4, 3, 2, 5, 6, 9, 8, 7, 3, 2, 4 }, the best descending-first sequence is { 7, 4, 6, 3, 4 }. The best ascending-first sequence is { 7, 9, 3, 4 } (using step 6).
{ "domain": "codereview.stackexchange", "id": 4639, "lm_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++, algorithm", "url": null }
# Mean and Median in a Classic River Crossing Problem Consider the following classic problem: Four people on the west side of a river wish to use their single boat to get to the east side of a river. Each boat ride can hold at most two people, and the time it takes to get across will be the time preferred by the slower occupant. The time preferences are: $1, 2, 5$ and $10$ minutes. What is the minimal amount of time in which you can get all four people across the river, where an eastbound trip must have two occupants and a westbound trip must have one occupant? Answer: $17$ minutes. (Though many mistakenly believe it is $19$ minutes.) Question 1: If you look at all possible ways of ferrying these four people across the river, subject to the above constraints, what would the average (mean and median) times be? Question 2: What if you replace the time preferences with $x_1, x_2, x_3$ and $x_4$ minutes? Question 3: What if you have time preferences $x_1, \ldots, x_n$ minutes for $n$ people, respectively? Probably the easiest way to broach Question 1 would be to write a quick program to compute the answer, and perhaps doing this for several different time preferences would give some insight into the mean and median in the general four person case. I'm not quite sure how I would start thinking about the general $n$ person case; perhaps by solving it for $n = 1, 2, 3, 4$. Answers (even partial ones) to any or all of my questions would be greatly appreciated!
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9566342049451595, "lm_q1q2_score": 0.8131114962158965, "lm_q2_score": 0.8499711718571775, "openwebmath_perplexity": 410.54612529478663, "openwebmath_score": 0.7799210548400879, "tags": null, "url": "https://math.stackexchange.com/questions/231199/mean-and-median-in-a-classic-river-crossing-problem" }
visible-light Here is an image to help you visualize. The black rectangle on the bottom-middle is the tube, with its width = $a$ and height = $L$, the blue lines represent the line of sight, the orange lines are the areas (at different distances) that contribute light to the sensor. Keep in mind that this is a 2d representation of a 3d system, this is why in the image the closest orange line has length of $3a$, which translates to an area of $(3a)^2 = 9a^a$ (like I said above). Same goes for the rest of the orange lines. To put this into perspective (generously) if $L=100m$, and $a=0.1mm$ looking at the moon each sensor will collect light from an area of more than $5\cdot 10^5m^2$. The overlapping of the areas, each sensor collects, would be awful. You would probably see just a smudge. At this point multiple tubes are just pointless, as you would need an array of ridiculous size for the sensors that are furthest away to collect anything meaningfully different. Looking at Alpha Centauri A (The largest star in the nearest star system, other than the Sun) each sensor will collect light from more than $5\cdot 10^{21} m^2$. That is orders of magnitude larger than the star's area. You can see why such a devise fails, even looking at relatively close objects.
{ "domain": "physics.stackexchange", "id": 57105, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "visible-light", "url": null }
neural-networks, deep-learning, classification Title: Combine two feature vectors for a correct input of a neural network Let's consider this scenario. I have two conceptually different video datasets, for example a dataset A composed of videos about cats and a dataset B composed of videos about houses. Now, I'm able to extract a feature vectors from both the samples of the datasets A and B, and I know that, each sample in the dataset A is related to one and only one sample in the dataset B and they belong to a specific class (there are only 2 classes). For example: Sample x1 AND sample y1 ---> Class 1 Sample x2 AND sample y2 ---> Class 2 Sample x3 AND sample y3 ---> Class 1 and so on...
{ "domain": "ai.stackexchange", "id": 1953, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "neural-networks, deep-learning, classification", "url": null }
java, bitwise Title: Integer multiplication without using multiply operator I wrote a method that multiplies two integers. Is there a faster approach that doesn't use the * operator? The method mult(a, b) multiplies two arbitrary integers. Is there a quicker way to multiply two numbers, without using * in java? static int mult(int a, int b) { if (a > b) return recMult(a, b); return recMult(b, a); } static int recMult(int max, int min) { if (min <= 1) return min == 1 ? max : 0; int cntOfMin = 0, i = 1; while ((i = i << 1) <= min) cntOfMin++; return (max << cntOfMin) + recMult(max, min - (1 << cntOfMin)); } This method doesn't work on negative numbers and doesn't handle overflows. Your heuristic is not optimal. recMult is using binary arithmetic to multiply two numbers. It recurses a number of times based on the number of 1-bits in the second number. You pass in the smaller of the two numbers as the second number, but there is no guarantee the smaller number has fewer 1-bits. Consider 8 * 7, or in binary, 1000 * 111. The 7 is the smaller number, so you use it as the second argument, and you compute (8 << 2) + (8 << 1) + (8 << 0) + 0. If you had chosen to 8 as the second argument, you would have computed (7 << 3) + 0 ... far fewer operations. The function Integer.bitCount(int i) returns the number of 1-bits in an integer. Using this, we could rewrite mult(int a, int b) as follows: static int mult(int a, int b) { if (Integer.bitCount(a) > Integer.bitCount(b)) return recMult(a, b); return recMult(b, a); }
{ "domain": "codereview.stackexchange", "id": 43582, "lm_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, bitwise", "url": null }
lisp, scheme, sicp What do you think of my solution? Note that your definitions of cont-frac and i-cont-frac accept as arguments the functions n and d, and not n_i or d_i (which, I assume, would be specific values of n and d at index i). I would avoid this confusion by naming the arguments properly. The definition of i-cont-frac could be improved by rewriting the base case. When the iterant is zero, the result should be zero as well. One could also abstract out the idea of an initial and a terminal value of the iterant, and the initial value of the result. Here's an implementation of these ideas: (define (cont-frac n d k) (define initial-result 0) (define initial-i 0) (define terminal-i k) (define (recurse i) (if (= i terminal-i) initial-result (let ((next-i (+ i 1))) (/ (n next-i) (+ (d next-i) (recurse next-i)))))) (recurse initial-i)) (define (i-cont-frac n d k) (define initial-result 0) (define initial-i k) (define terminal-i 0) (define (iterate result i) (if (= i terminal-i) result (let ((next-i (- i 1))) (iterate (/ (n i) (+ (d i) result)) next-i)))) (iterate initial-result initial-i))
{ "domain": "codereview.stackexchange", "id": 201, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "lisp, scheme, sicp", "url": null }
php, authentication Title: Authentication service This is the AuthenticationService I made based on Barry Jaspan's design, which is way better than the code of which I asked in a question a couple of months ago. I would like it mainly reviewed on a couple of aspects: Readability (clean code) Accurate comments Accurate naming (especially for the last class) AuthenticationService.php namespace Model\Application; use Http\HttpSession; use Model\Infrastructure\Mapper\UserMapper; use Model\Application\AuthenticationStorage; /** * An authentication service. * * @author John Doe <john@doe.com> */ class AuthenticationService { /** * @var HttpSession $httpSession An HttpSession instance. */ private $httpSession; /** * @var UserMapper $userMapper A UserMapper instance. */ private $userMapper; /** * @var AuthenticationStorage $authenticationStorage An AuthenticationStorage instance. */ private $authenticationStorage; /** * Constructs the object. * * @param HttpSession $httpSession An HttpSession instance. * @param UserMapper $userMapper A UserMapper instance. * @param AuthenticationStorage $authenticationStorage An AuthenticationStorage instance. */ public function __construct( HttpSession $httpSession, UserMapper $userMapper, AuthenticationStorage $authenticationStorage ) { $this->httpSession = $httpSession; $this->userMapper = $userMapper; $this->authenticationStorage = $authenticationStorage; } /** * Finds the authenticated User entity. * * @return User|void|null The User entity instance if found. */ public function findAuthenticatedUser() { if ($identifier = $this->httpSession->findParameter('userIdentifier')) { return $this->userMapper->findByIdentifier($identifier); } if ($user = $this->authenticationStorage->authenticateUser()) { $this->httpSession->regenerateIdentifier();
{ "domain": "codereview.stackexchange", "id": 9772, "lm_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 }
javascript, beginner, array if(this.showDebug){this.debug()}; // debug function will be called if enabled }, this.back = function(){ //slides the current array to the previous stage if(!this.showControl){ //if the interval is smaller than the initial Array, throw and error throw false; } let arr = this.initialArray; for(let i in this.current){ this.currentIndex[i] -= this.changeBy; if(this.currentIndex[i] < 0){ this.currentIndex[i] += this.max; } this.current[i] = arr[this.currentIndex[i]]; }
{ "domain": "codereview.stackexchange", "id": 24407, "lm_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, beginner, array", "url": null }
ros Title: Renamed repository and stack not listed Hi! I recently announced a repository and stack via the mailing list (both called "teleop"). It was brought to my attention that in between the time I started work on my stack and the time I announced it, someone else had released a package with the same name as my repository/stack. It was also brought to my attention that the indexer doesn't like it when a repository and stack have the same name (basically, the stack wasn't indexed). So I then announced to the mailing list that the repository had been renamed to "skynetish-ros-pkg", and the stack had been renamed to "generic_teleop". Per the email, the rosinstall file for the "skynetish-ros-pkg" repository is at: Github: https://github.com/skynetish/skynetish-ros-pkg Source: https://github.com/skynetish/skynetish-ros-pkg.git Raw: https://raw.github.com/skynetish/skynetish-ros-pkg/master/skynetish-ros-pkg.rosinstall And the "generic_teleop" stack is available at: Github: https://github.com/skynetish/generic_teleop Source: https://github.com/skynetish/generic_teleop.git Docs: https://github.com/skynetish/generic_teleop/wiki This information has yet to propagate to the software list at http://www.ros.org/browse/list.php. Instead the old "teleop" repository is still listed, along with the contained packages, with no corresponding stack. Could someone check why the new repository and stack have not been indexed? Perhaps the old repository entry simply hasn't been removed, and it has a higher priority than the new one? Best, Kevin
{ "domain": "robotics.stackexchange", "id": 8555, "lm_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 }
slam, navigation, odometry, kinect, rtabmap Title: How does rtabmap fuse wheel odometry with visual odometry? I set up my robot with turtlebot and kinect and excute rtabmap. -- http://wiki.ros.org/rtabmap_ros/Tutorials/SetupOnYourRobot I hid the image of the Kinect sensor and moved the turtlebot. And I moved the turtlebot to calculate the travel distance only with the kinect image. I think the rtabmap algorithm is internally fusing image information and wheel odometry. How are you fusing? And do you have your own paper about fusing wheel odometry and viusal odometry? Thank you ^ ^ Originally posted by JunJun on ROS Answers with karma: 26 on 2017-01-06 Post score: 0 Hi, rtabmap doesn't fuse wheel odometry and visual odometry. There is only one odometry input to rtabmap node (so one or the other can be used). If you want to fuse odometries, look at the robot_localization package for example, then use its odometrry output as the odometry input of rtabmap. cheers Originally posted by matlabbe with karma: 6409 on 2017-01-09 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 26652, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "slam, navigation, odometry, kinect, rtabmap", "url": null }
thermodynamics, statistical-mechanics, temperature, adiabatic, maxwell-relations $$ \left(\frac{\partial U}{\partial V}\right)_{T,N} \gtrapprox 0. $$
{ "domain": "physics.stackexchange", "id": 41282, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics, statistical-mechanics, temperature, adiabatic, maxwell-relations", "url": null }
pressure Title: What is the principle behind the expansion and contraction of balloon in the bottle used for lung model The picture above describes inhalation and exhalation, the balloons present the lungs which deflate during exhalation when the elastic bottom(diaphragm) is release and vice versa for inhalation what is the principle behind the conservation of pressure in the balloons and in the bottle Air (or any fluid) in equilibrium exerts an equal pressure in all directions. Any difference in pressure between the gas jar and the balloons will cause the balloons to expand or contract. As the balloon expands, the elastic force acts so as to return the balloon to its natural shape. The pressure exerted by the gas is inversely proportional to the volume it occupies (bigger volume means fewer particles per unit volume, so less force on the container). Using this, it is simple to understand how the model works. As the elastic membrane is pulled down, the volume of the chamber increases, thereby reducing the air pressure inside the chamber. Therefore, the force of the air in the balloons (atmospheric pressure) is greater than the pressure in the chamber, so the balloon expands. As the balloon expands, the elastic force increases, eventually compensating for the difference in pressure between the atmosphere and the chamber. When the membrane is released, the reverse happens. The volume of the chamber decreases, so the pressure in the chamber increases, which forces the balloons to contract.
{ "domain": "physics.stackexchange", "id": 48147, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "pressure", "url": null }
python, web-scraping "date": "2014-01-25", "url": "http://www.gwz.fudan.edu.cn/Web/Show/2222", "publication": "復旦大學出土文獻與古文字研究中心學者文庫", "download": "/lunwen/1300孫合肥:清華簡《筮法》札記一則.doc" }{ "author": "陸離", "title": "清華簡《別卦》讀“解”之字試說", "date": "2014-01-08", "url": "http://www.gwz.fudan.edu.cn/Web/Show/2208", "publication": "復旦大學出土文獻與古文字研究中心學者文庫", "download": "/lunwen/1292陸離:清華簡《別卦》讀“解”之字試說.doc" }{ "author": "王寧", "title": "清華簡《尹至》《赤鳩之集湯之屋》對讀一則", "date": "2013-11-28", "url": "http://www.gwz.fudan.edu.cn/Web/Show/2183", "publication": "復旦大學出土文獻與古文字研究中心學者文庫", "download": "/lunwen/1276王寧:清華簡《尹至》《赤鳩之集湯之屋》對讀一則.doc" }{ "author": "呂廟軍", "title": "“出土文獻與中國古代文明”國際學術研討會綜述", "date": "2013-10-22", "url": "http://www.gwz.fudan.edu.cn/Web/Show/2145", "publication": "復旦大學出土文獻與古文字研究中心學者文庫",
{ "domain": "codereview.stackexchange", "id": 41593, "lm_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, web-scraping", "url": null }
# Factorize Trigonometric Equation: $3\sin(x)^2 - 2\sin(x)\cos(x) - \cos(x)^2 = 0$ I have a problem with the following trigonometric equation: $$3\sin(x)^2 - 2\sin(x)\cos(x) - \cos(x)^2 = 0$$ It's from the book Engineering Mathematics 7th edition by Stroud. The book is giving the answer, but I can't seem to be able to find out how to factorize it. I can't figure it out. Consider the following solution: This equation can be written as $3\sin ^2x-\cos ^2x = 2\sin x \cos x.$ That is: $3\sin ^2x-2\sin x \cos x-\cos ^2 x = 0.$ That is: $(3\sin x + \cos x)(\sin x - \cos x) = 0.$ So that $3 \sin x \cos x = 0$ or $\sin x - \cos x = 0.$ If $3 \sin x + \cos x = 0,$ then $\tan x = \frac{-1}{3},$ and so $x = -0.3218 ± n \pi,$ and if $\sin x - \cos x = 0,$ then $\tan x = 1,$ and so $x = \frac{\pi}{4}.$ If anyone could help me understand how to factorize this equation to get the one shown in the image it would help me very much.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9811668695588647, "lm_q1q2_score": 0.8300106892301855, "lm_q2_score": 0.8459424334245618, "openwebmath_perplexity": 177.27885298627695, "openwebmath_score": 0.9869336485862732, "tags": null, "url": "https://math.stackexchange.com/questions/1254334/factorize-trigonometric-equation-3-sinx2-2-sinx-cosx-cosx2-0" }
time, speed Title: Can people traveling at difforent speeds gain information at a different rate? I heard that the faster you go, the slower time around you goes. For example, if you where in a rocket going very fast and you started a timer for 1 minute at the same time someone walking down the street started a timer for 1 minute, the person on the street's timer would go off just before yours. I also know that people going at very fast speeds can still get information (for this example lets say that it is from the internet). So lets imagine that the person on earth starts streaming a TV show to the person in the rocket. Can the person in the rocket watch the TV show faster than the person on Earth? This would not make sense to me, given that they both experience time at the same speed. This would not make sense to me, given that they both experience time at the same speed. See this answer of mine for background. Although I'm not a psychologist, I think it's reasonable to surmize that the experience of time is defined by how quickly one's own bodily processes run forward relative to the rate of other physical processes in one's nearby, comoving neighborhood. This explains why the rate of one's own time progression is never perceived to be anything other than "one time unit per one time unit". But this does not stop signals arising from sources elsewhere that one receives from progressing at different rates if the relative motion between source and receiver change. And, your spacefarer will indeed see the television transmission progressing more swiftly, or more slowly, depending on whether their motion is towards or away from the signal source. There are two simple ways to see this.
{ "domain": "physics.stackexchange", "id": 38971, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "time, speed", "url": null }
algorithm, c, array, sorting int main(int argc, char** argv) { int *inputs, *outputs; size_t length = argc - 1; // number of integers to sort if (argc < 2) { fprintf(stderr, "Not enough arguments given.\n"); exit(EXIT_FAILURE); } inputs = calloc(length, sizeof(int)); outputs = calloc(length, sizeof(int)); if (inputs == NULL || outputs == NULL) { fprintf(stderr, "Memory allocation error\n"); exit(EXIT_FAILURE); } for (int i = 1; i < argc; i++) { inputs[i - 1] = atoi(argv[i]); // assign arguments to array if (inputs [i - 1] < 0) { fprintf(stderr, "Integer %d out of range [0, 2^31)\n", inputs[i - 1]); exit(EXIT_FAILURE); } } sort(inputs, outputs, length); for (size_t i = 0; i < length; i++) { printf("%d ", outputs[i]); // print space separated sorted numbers } printf("\n"); free(inputs); free(outputs); return EXIT_SUCCESS; } Enable more compiler warnings I get gcc-8 -std=c11 -fPIC -g -Wall -Wextra -Wwrite-strings -Wno-parentheses -Wpedantic -Warray-bounds -Wconversion 199801.c -o 199801
{ "domain": "codereview.stackexchange", "id": 31311, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "algorithm, c, array, sorting", "url": null }
it ’ s why it ’ s called “ Fundamental ” (! By contradiction also called the unique factorization theorem Stuck Man ; Start date Nov 4 2020... I found p=17 is a prime factorisation ), and uniqueness ( the prime factorisation,... Take the number 3.25, it is important to realize that not all sets of numbers have property. Theorem of Arithmetic 2 primes is about the uniqueness … Fundamental theorem of Arithmetic justify! Called the unique factorization theorem ) is a really important theorem—that ’ s why it ’ why. Was proved by Carl Friedrich Gauss in the same amount regardless of the following of! Integer greater than 1 are either a prime factorisation ), and uniqueness ( the theorem... Of 6 that 2 and 3 are divisors of 6 ОТА.ogv 10 min 43 s, 854 × 480 204.8. Theorem also fundamental theorem of arithmetic that there is only one way to do part b to use a?! Arithmetic ( FTA ) was proved by Carl Friedrich Gauss in the year 1801 that 6 factors as 2 3., where n is even, 4 n can end with the digit?! Appeared over 2000 years ago in Euclid 's Lemma ) can be expressed as the product of primes there. Positive integer can be written uniquely as a unique product of primes of whole numbers possibility of the property... Are ready to prove the Fundamental theorem of number theory n is a solution or composite! Uniquely as a product of primes except for 1 ) can be expressed as 13/4 ; help! Book to Kindle min 43 s, 854 × 480 ; 204.8 MB only one way write... The factorization of any natural number as the product of primes proofs make use of the Fundamental theorem Arithmetic. Unique up to reordering the factors ), and uniqueness ( the Fundamental theorem of Arithmetic applies to factorizations. 1 can be written uniquely as a product of primes digit zero оооо if the proposition was false then. Part b to use a table into smaller rational numbers, so these two rational factors are unique so. A counterexample illustrates the theorem by showing the factorizations up to reordering the factors to factorizations... 2020 ; Home from 1 can be expressed as a product of primes help. Uniquely as a product of the following property of integers
{ "domain": "online.th", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9783846640860381, "lm_q1q2_score": 0.8066409006697736, "lm_q2_score": 0.8244619220634456, "openwebmath_perplexity": 328.6789282975388, "openwebmath_score": 0.8059017062187195, "tags": null, "url": "https://domain.online.th/cgi-bin/kutbzd0/fundamental-theorem-of-arithmetic-5852a5" }
quantum-field-theory, hilbert-space First. You're mixing Fock kets and usual QM kets. What is $\bra x\,$? Second. Even though it's usual and convenient, it isn't mandatory to assume in Fock space as one-particle base vectors the eigenvectors of momentum. Before proceeding notation has to be clearly defined. You didn't say what you mean by $p$. I'll write $\bp,$ $\br$ to mean 3-vectors, whereas $p$ is reserved for a 4-vector. Third. $\ket{\bp_1,\bp_2}$ is no superposition of plane waves. The latter would be a one-particle state with momentum not well defined. It should be written $$\sum_\bp c(\bp) \ket \bp$$ or also as an integral, it you like. A two-particle state is $$\ket{\bp_1,\bp_2} = a^\dag_{\bp_1} a^\dag_{\bp_2} \ket0.$$ You may also think of a general two-particle state, to be written $$\ket{2,\xi} = \int d\bp_1 d\bp_2\,\phi(\bp_1,\bp_2) \ket{\bp_1,\bp_2}.\tag1$$ If your particles are bosons $a^\dag_{p_1}$ and $a^\dag_{p_2}$ commute and the state is automatically symmetric. In the first member I wrote a ket with a label "2" reminding it's a two-particle state, and an arbitrary label $\xi$ to identify that state, in case it should be necessary to distinguish from some other one. Now let's define position eigenvector: $$\ket\br = \int\!\!d\bp\,e^{-i\bp\cdot\br} \ket\bp \tag2$$ (normalization apart). Note that $$\braket \br \bp = e^{i\bp\cdot\br}.$$
{ "domain": "physics.stackexchange", "id": 53608, "lm_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, hilbert-space", "url": null }
chromatography Title: Figure Headings in Laboratory Reports How do I write a figure legend for a thin layer chromatography plate drawing? Provide all the data that are necessary to reproduce the experiment: TLC material (silica gel or aluminium oxide) composition of the mobile phase special tricks, such as running the TLC in methanol first for 5 mm to squeeze the initial spot to a very narrow band detection of the separated bands/spots: $\mathrm{R_f}$ values do the spots have a colour do the show fluorescence which reagents did you use for staining UPDATE If you report on a series of measurements, it's usually good practise describe the conditions that didn't change (type of TLC plate, staining solutions, etc.) in the general section of the experimental part of the report/article/thesis.
{ "domain": "chemistry.stackexchange", "id": 3125, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "chromatography", "url": null }
tensorflow Title: Trying to train Stylegan, stopping with errors after first tick I'm just getting started with GANs and have prepared a dataset for Stylegan of around 5500 256x256 images to train it on. I've pored through the scant resources outlining the training process and have all of the software set up, using pretty much default settings for the training.py and training_loop.py files aside from specifying GPU number and dataset paths. When I run the train.py script it runs for a single tick every time before giving me this error about input depths vs filter depths. These don't seem to be settings in Stylegan so I don't really know how to troubleshoot the issue. I've tried changing many different params in the training files and it always fails after one tick. Do these errors look familiar to anyone? My dataset seems like it shouldn't cause any issues. Traceback (most recent call last): File "/home/futureprojects/anaconda3/envs/tf-gpu/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1356, in _do_call return fn(*args) File "/home/futureprojects/anaconda3/envs/tf-gpu/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1341, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/futureprojects/anaconda3/envs/tf-gpu/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1429, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.(0) Invalid argument: input depth must be evenly divisible by filter depth: 1 vs 3 [[{{node InceptionV3/_Run/InceptionV3/InceptionV3/import/conv/Conv2D}}]]
{ "domain": "datascience.stackexchange", "id": 6068, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "tensorflow", "url": null }
python, python-3.x, api open_notify.list_iss_next_position_time(latitude, longitude) else: print('Invalid option') sys.exit() if __name__ == '__main__': main() A few things to think about: There's still room for improvements in regards to user input validation; The retrieved API data can change and there're no sanity checks against this; The menu can be dynamically created in order to avoid hardcoding future next options; The OpenNotify class might be a bit redundant since we're not making changes to any specific state variables but as the API grows and you want to add other functionality to it...this might become helpful.
{ "domain": "codereview.stackexchange", "id": 40261, "lm_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, api", "url": null }
quantum-state, circuit-construction We'll use the single-shot variant of the desired quantum circuit to construct a communication protocol that allows Alice to send a classical bit to Bob faster than light and with arbitrarily low error probability $\epsilon$. Suppose Alice and Bob share $N$ Bell pairs $(|00\rangle+|11\rangle)/\sqrt2=(|{++}\rangle+|{--}\rangle)/\sqrt2$ where $N=\lceil\log_2 \frac{1}{\epsilon}\rceil$. Let's name Alice's qubits $q_1,\dots,q_N$ and Bob's qubits $q_{N+1},\dots,q_{2N}$. Also, let $\Phi:\mathbb{C}^2\otimes\mathbb{C}^2\to\{0,1\}$ denote the desired operation. Given a product state $|\psi_0\rangle\otimes|\psi_1\rangle$ the operation returns $k\in\{0,1\}$ if $|\psi_k\rangle$ has greater overlap with $|1\rangle$ than $|\psi_{1-k}\rangle$. In particular, $$ \begin{align} \Phi(|{+}\rangle\otimes|1'\rangle)&=1\\ \Phi(|{-}\rangle\otimes|1'\rangle)&=1\\ \Phi(|0\rangle\otimes|1'\rangle)&=1\\ \Phi(|1\rangle\otimes|1'\rangle)&=0\\ \end{align}\tag1 $$ where $|1'\rangle=\sqrt{1-\delta^2}|1\rangle+\delta|0\rangle$ for a sufficiently small$^1$ $\delta>0$. In fact, these four equalities are all that is necessary to construct an FTL communication protocol.
{ "domain": "quantumcomputing.stackexchange", "id": 5387, "lm_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-state, circuit-construction", "url": null }
programming-challenge, haskell, combinatorics, computational-geometry, monads -- adjust the current scalar product for the transposition of u adjust :: MVector s Int -> Vector Int -> (Int, Int) -> Int -> ST s Int adjust u v (i,j) x = do a <- read u i b <- read u j let c = v ! i let d = v ! j swap u i j return $ x - (a*c + b*d) + (a*d + b*c) Somewhat old question, but still it's a pity it hasn't been answered :). Putting aside the asymptotically better solution suggested in the comments, and focusing just on the code: Pluses: Top-level types for all funtcions, that's very good, as well as comments. The code shows good understanding of various Haskell functions and idioms. My most general comment is that there is disproportion between code verbosity and complexity. Usually more complex code should be more verbose and more descriptive. Visually, most of the code is just simple read/write/swap ST operations, but the important part is squeezed into not-so-easy-to-understand and uncommon combinations of folds/scans/sequence/>=>/>>= etc. I'd probably separate the simple parts (read/swap) into helper functions and expand/simplify the complex parts a bit. Function adjust somewhat mixes pure and mutable approaches. While it mutates its first argument, it keeps the scalar product pure and passes it as an argument in and out. This is somewhat confusing and complicates the computation of the minimum (scanl with >>=). If the product were a ST variable too, the code gets simpler (untested): adjust :: MVector s Int -> Vector Int -> STRef s Int -> (Int, Int) -> ST s Int ... msp = ... x <- newSTRef $ foldl' (+) 0 $ zipWith (*) u v fmap minimum . traverse (adjust u' v x) . transpositions $ n
{ "domain": "codereview.stackexchange", "id": 21004, "lm_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, haskell, combinatorics, computational-geometry, monads", "url": null }
ros, scan Title: data format of /scan Hi all, I'm using ROS INDIGO. I used depthimage_to_laserscan to obtain scan data. what does the values under /scan represent? is it the range from the obstacles(metres or centimetres).? Originally posted by David John on ROS Answers with karma: 19 on 2016-02-21 Post score: 0 That particular node is actually pretty well documented. From wiki/depthimage_to_laserscan - Node - depthimage_to_laserscan - Published topics: 2.1.2 Published Topics scan (sensor_msgs/LaserScan) The output laser scan. Follows REP 117, and will output range arrays that contain NaNs and +-Infs. If you follow the link to the sensor_msgs/LaserScan documentation, it should be pretty clear. Originally posted by gvdhoorn with karma: 86574 on 2016-02-21 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 23854, "lm_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, scan", "url": null }
java, android, error-handling Is there a better way to handle exceptions? When the called API throws unknown exceptions I don't think that there is other way than catching all exceptions (sometimes Throwables too). +1 Jeroen Vannevel's comment too. Anyway, a common interface might be able to improve the code a little bit: public interface Command { run() throws Exception; String getName(); } Then, you can have implementations, like WifiSwitcher, and call them one after the other: final List<String> errors = new ArrayList<String>(); for (final Command command: commands) { try { command.run(); } catch (final Exception e) { errors.add("Could not perform command: " + command.getName()); if (BuildConfig.DEBUG) { Log.getStackTraceString(e); } } } if (errors.isEmpty()) { return true; } showErrorNotification(errors); return false; (I haven't tested nor compiled the code above.)
{ "domain": "codereview.stackexchange", "id": 5599, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, android, error-handling", "url": null }
from the left. (2018) Analysis on Sixth-Order Compact Approximations with Richardson Extrapolation for 2D Poisson Equation. Lecture 04 Part 3: Matrix Form of 2D Poisson's Equation, 2016 Numerical Methods for PDE - Duration: 14:57. The book NUMERICAL RECIPIES IN C, 2ND EDITION (by PRESS, TEUKOLSKY, VETTERLING & FLANNERY) presents a recipe for solving a discretization of 2D Poisson equation numerically by Fourier transform ("rapid solver"). Let Φ(x) be the concentration of solute at the point x, and F(x) = −k∇Φ be the corresponding flux. The 2D Poisson equation is solved in an iterative manner (number of iterations is to be specified) on a square 2x2 domain using the standard 5-point stencil. ( 1 ) or the Green's function solution as given in Eq. Finally, the values can be reconstructed from Eq. The Poisson equation arises in numerous physical contexts, including heat conduction, electrostatics, diffusion of substances, twisting of elastic rods, inviscid fluid flow, and water waves. Either approach requires O(N2 logN) ops for a 2D Poisson equation, and is easily generalized to Poisson-like equations in rectangular boxes in three or dimensions. 3) is to be solved in Dsubject to Dirichletboundary. FEM2D_POISSON_RECTANGLE, a C program which solves the 2D Poisson equation using the finite element method. Poisson Solvers William McLean April 21, 2004 Return to Math3301/Math5315 Common Material. Let (x,y) be a fixed arbitrary point in a 2D domain D and let (ξ,η) be a variable point used for integration. Recalling Lecture 13 again, we discretize this equation by using finite differences: We use an (n+1)-by-(n+1) grid on Omega = the unit square, where h=1/(n+1) is the grid spacing. 1 From 3D to 2D Poisson problem To calculate space-charge forces, one solves the Poisson's equation in 3D with boundary (wall) conditions: ∆U(x, y,z) =−ρ(x, y,z) ε0. Poisson on arbitrary 2D domain. Thanks
{ "domain": "laquintacolonna.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9918120917924487, "lm_q1q2_score": 0.8085574450136944, "lm_q2_score": 0.8152324938410783, "openwebmath_perplexity": 572.7196407654142, "openwebmath_score": 0.8367288708686829, "tags": null, "url": "http://zgea.laquintacolonna.it/2d-poisson-equation.html" }
The question is the same as asking for what $m$ the following equation has a solution: $$\begin{pmatrix} 0&0&1\\ 1&0&1\\ 1&0&2\\ 1&1&0 \end{pmatrix} \begin{pmatrix} x\\y\\z \end{pmatrix}= \begin{pmatrix} 1\\2\\m\\5 \end{pmatrix}\tag{1}$$ Working on column vectors might make some observation easier. Note that (1) is equivalent to $$x\begin{pmatrix} 0\\1\\1\\1 \end{pmatrix} +y\begin{pmatrix} 0\\0\\0\\1 \end{pmatrix} +z\begin{pmatrix} 1\\1\\2\\0 \end{pmatrix}=\begin{pmatrix} 1\\2\\m\\5 \end{pmatrix}\tag{2}$$ It is very easy to observe that when $m=3$, (2) has a solution: $x=z=1$, $y=4$. This rules out A,B,C. To see $m=3$ is necessarily true, note that (2) implies: $$0x+0y+1z=1\\ 1x+0y+1z=2\\ 1x+0y+2z=m$$ To make the linear system consistent so that it has a solution, one must have $1+2=m$ by observing that the coefficients of the first two rows add up to those of the third row. The thing you are overlooking is that in a linear combination you are allowed to multiply each vector by whatever scalar constant you want. This means that getting, say, a 5 is always possible as long as at least one of the corresponding components is not zero as there are many coefficient choices that would accomplish that. The only real caveat when checking linear dependence is that the same coefficients have to also yield the correct values for all the other components at the same time. This is where the formalism with matrices and equation systems comes in handy.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9835969674838368, "lm_q1q2_score": 0.8109382463475006, "lm_q2_score": 0.8244619220634456, "openwebmath_perplexity": 256.16473369621986, "openwebmath_score": 0.8638750314712524, "tags": null, "url": "https://math.stackexchange.com/questions/2363189/math-subject-gre-exam-9768-q-16" }
electromagnetism, coupled-oscillators Title: Can electromagnetic waves be interpreted as a collection of infinite coupled oscillators? I recently learned, for the first time, that the behavior of waves can be derived by treating them as an infinite set of coupled oscillators. This makes sense for waves whose medium is matter; it's easy to see how water waves, for instance, can be seen as the individual water molecules tugging on their neighbors as they oscillate. At the same time, however, I've only ever seen electromagnetic waves treated continuously, and again this makes the most sense, since electromagnetic waves are just oscillations in a continuous field. But I wonder, is there an interpretation of EM waves as a set of discrete coupled oscillators? Would such a treatment be useful in any way? Yes. Consider electromagnetic fields in a square box of volume $V = L^3$. One can then impose periodic boundary conditions on the vector potential, and one arrives at the following expansion in terms of Fourier modes: \begin{align} \mathbf A(t,\mathbf x) = \sum_\mathbf k\sum_r \left(\frac{\hbar c^2}{2V\omega_\mathbf k}\right)^{1/2} \mathbf \epsilon_r(\mathbf k)(a_r(\mathbf k)e^{i(\mathbf k\cdot \mathbf x-\omega_\mathbf k t)} + a_r^\dagger(\mathbf k)e^{-i(\mathbf k\cdot \mathbf x-\omega_\mathbf k t)}) \end{align} where $\omega_\mathbf k = c|\mathbf k|$ and the $\mathbf \epsilon$'s are polarization vectors. Because we are quantizing in a box with periodic boundary conditions, the sum over $\mathbf k$ is over the countable (discrete) set of wavevectors given by \begin{align} \mathbf k = \frac{2\pi}{L}(n_1, n_2, n_3), \qquad n_i = 0,\pm 1, \pm 2, \dots \end{align}
{ "domain": "physics.stackexchange", "id": 12093, "lm_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, coupled-oscillators", "url": null }
By "closing" a contour in the first quadrant ( a quarter circle of radius $\ds{R}$ ): \begin{align} \int_{0}^{R\ >\ 0}{\sin\pars{x} \over x}\,\dd x & = \Im\int_{0}^{R}{\expo{\ic x} - 1\over x}\,\dd x \\[5mm] & = -\,\Im\ \overbrace{\int_{0}^{\pi/2}{\exp\pars{\ic R\expo{\ic\theta}} - 1 \over R\expo{\ic\theta}}\,R\expo{\ic\theta}\ic\,\dd\theta} ^{\ds{\mbox{along the arc}}}\ -\ \Im\ \overbrace{\int_{R}^{0}{\expo{-y} - 1 \over \ic y}\,\ic\,\dd y} ^{\ds{\mbox{along the}\ y\ \mbox{axis}}} \\[5mm] & = -\,\Re\int_{0}^{\pi/2}\bracks{\exp\pars{\ic R\cos\pars{\theta}} \exp\pars{ -R\sin\pars{\theta}} - 1}\,\dd\theta \\[5mm] & = {\pi \over 2} - \Re\int_{0}^{\pi/2}\exp\pars{\ic R\cos\pars{\theta}} \exp\pars{ -R\sin\pars{\theta}}\,\dd\theta = \bbx{\pi \over 2} \end{align} Note that
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9755769113660689, "lm_q1q2_score": 0.8021087261375839, "lm_q2_score": 0.8221891239865619, "openwebmath_perplexity": 329.8344902615016, "openwebmath_score": 0.9904505014419556, "tags": null, "url": "https://math.stackexchange.com/questions/5248/evaluating-the-integral-int-0-infty-frac-sin-x-x-mathrm-dx-frac-pi/1847675" }
python, python-2.x, plugin, dynamic-loading And a quick example of how to use Vedo: vedo = Vedo("./plugins") vedo.load_file("first") vedo.plugins[0] # This is an instance of `MyFirstPlugin' Here's some things I'm not too fond of, but I'm not sure what I can do about them: Should the private functions in the top of vedo.py be moved inside the Vedo class? Should load_module be private? It's only really going to be used when loading files. Is there a way to get around the ugliness that is the plugin __init__ function? Every single plugin will need to have that constructor, which I'm not too happy about. Regarding your questions: No, I think the functions as they are are fine, not everything needs to be moved into a class. If it's an implementation detail, sure. AFAIK no, but if it's otherwise empty the method doesn't have to be added. Also: In load_module the loop can be more compact by using a combination of list.extend and filter. def load_module(self, module): self.plugins.extend(filter(_is_plugin_class, module.__dict__.values())) The numbered arguments for str.format could be left out. Looks good otherwise. If you're really concerned with keeping the internals safe you could also not expose the plugins list directly, but provide a separate accessor instead.
{ "domain": "codereview.stackexchange", "id": 17157, "lm_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, plugin, dynamic-loading", "url": null }
c#, asp.net-mvc The method above takes two parameters: a planId that you have obtained, as well as a value. This second variable probably isn't a great name, but you have overloaded the meaning of your string in your original method (it's used to compare against a View property and a Type property) such that I couldn't immediately think of a better name. If you can think of one, just sub it in. With this extraction, it cleans up your original method nicely, because it can be cleaned up to the following: [OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")] public ActionResult CheckButtons() { int planId = (int)UserSession.GetValue(StateNameEnum.ID, "PlanID"); Dictionary<string, string> buttonADictionary = GetButtonDictionary(planId, "A"); Dictionary<string, string> buttonBDictionary = GetButtonDictionary(planId, "B"); bool aHasData = buttonADictionary.ContainsValue("disabled"); bool bHasData = buttonBDictionary.ContainsValue("disabled"); return Json(new { buttonADictionary, buttonBDictionary, aHasData, bHasData }, JsonRequestBehavior.AllowGet); } Could we clean this up a little more? Possibly, but it's simplified enough for now so let's go back to the method we extracted. It has a couple of database queries that should probably individually be their own methods (SRP - Single Responsibility Principle), so let's go ahead and do that. private Dictionary<string, string> GetButtonDictionary(int planId, string value) { planning resultSet = GetPlanningResultSet(planId, value); structure st = GetStructure(planId, value);
{ "domain": "codereview.stackexchange", "id": 13755, "lm_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#, asp.net-mvc", "url": null }
concept of dynamic programming. In this chapter, we will understand what MDP is and how can we use it to solve RL problems. Computer Programming. 60, 23rd European Conference on Operational Research in Bonn, July 5 - 8, 2009 - Guest Eds: Erik Kropat and Gerhard-Wilhelm Weber, pp. Python provide direct methods to find permutations and combinations of a sequence. The Knapsack problem is probably one of the most interesting and most popular in computer science, especially when we talk about dynamic programming. Be able to visualize and understand most of the Dynamic programming problems. The introduction of the dynamic keyword in. Robot Navigation 1 1. Guido Van Rossum, the father of Python had simple goals in mind when he was developing it, easy looking code, readable and open source. Four model types are allowed. The approach for solving the problem is a recursive function. We develop an exact dynamic programming algorithm for partially observable stochastic games (POSGs). Listing 8 is a dynamic programming algorithm to solve our change-making problem. In this chapter, we will understand what MDP is and how can we use it to solve RL problems. Introduction Python is currently one of the most popular dynamic programming languages, along with Perl, Tcl, PHP, and newcomer Ruby. Visit the post for more. Corre-spondingly, Ra ss0is the reward the agent. Top-down recursion, dynamic programming and memoization in Python January 29, 2015 by Mark Faridani I was talking to a friend about dynamic programming and I realized his understanding of dynamic programming is basically converting a recursive function to an iterative function that calculates all the values up to the value that we are. PowerPoint. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Dynamic programming (usually referred to as DP ) is a very powerful technique to solve a particular class of problems. edu/6-262S11 Instructor: Robert Gallager License: Creative Comm. dynamic, high-level programming. Implement a dynamic programming algorithm that solves the optimization integer knapsack problem. Dynamic Programming and Markov Processes. Backtracking/dynamic programming Section 16. Markov Decision Processes Discrete Stochastic Dynamic Programming MARTIN L.
{ "domain": "asainfo.it", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9766692277960746, "lm_q1q2_score": 0.8117518326123543, "lm_q2_score": 0.8311430415844385, "openwebmath_perplexity": 1282.145413049841, "openwebmath_score": 0.23353199660778046, "tags": null, "url": "http://hvpj.asainfo.it/python-markov-dynamic-programming.html" }
game, multithreading, objective-c, sprite-kit, grand-central-dispatch SKNode *chunkNode = [[SKNode alloc]init]; chunkNode.name = chunk.chunkName; [_visibleChunks addChild:chunkNode]; for (DWBlock *block in chunk.blocks.allValues) { [chunkNode addChild:[self blockSpriteForBlock:block]]; } } } } -(void) removeChunks { for (DWChunk *chunk in _game.gameWorld.chunksToRemove) { SKNode *chunkNode = [_visibleChunks childNodeWithName:chunk.chunkName]; if (chunkNode) { //[chunkNode removeAllChildren]; [chunkNode removeFromParent]; } } dispatch_async(self->_draw_queue, ^{ [_game.gameWorld.chunksToRemove removeAllObjects]; }); } -(void) updateBlocks { for (DWBlock *block in _game.gameWorld.blocksToUpdate) { SKNode *chunkNode = [_visibleChunks childNodeWithName:block.chunkName]; if (chunkNode) { SKNode *blockNode = [chunkNode childNodeWithName:block.blockName]; if (blockNode) { [blockNode removeFromParent]; [chunkNode addChild:[self blockSpriteForBlock:block]]; } } } dispatch_async(self->_draw_queue, ^{ [_game.gameWorld.blocksToUpdate removeAllObjects]; }); }
{ "domain": "codereview.stackexchange", "id": 12516, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "game, multithreading, objective-c, sprite-kit, grand-central-dispatch", "url": null }
Now I have some question regarding this proof. Ross uses induction. I think he is using strong induction here. Now in strong induction, to prove the goal of the form $$\forall n\in\mathbb{N} P(n)$$, we decide to prove that $$\forall n[(\forall k<n\;P(k))\to P(n)]$$. So if he is using strong induction, what is $$P(n)$$, he is using ? thanks #### issacnewton ##### Member I am just wondering if following $$P(n)$$ would work here. $P(n)\;:\; \exists (f(n)\wedge f(n+1)) [f(n)\in A \wedge f(n+1)\in A \wedge f(n)<f(n+1) < u]$ So base case would be constructing two numbers, f(1) and f(2). And then we can go on using ordinary induction. #### issacnewton ##### Member Here is the solution I have prepared. This is an existence proof. I am going to build the sequence using induction. So let P(n) be the statement $\exists\; f(n), f(n+1)\in A\left[\left\{u-\frac{1}{n}<f(n)<u\right\}\wedge \left\{u-\frac{1}{n+1}<f(n+1)<u\right\} \wedge\left\{f(n)<f(n+1)\right\}\right]$
{ "domain": "mathhelpboards.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9615338035725358, "lm_q1q2_score": 0.835406318067792, "lm_q2_score": 0.8688267796346599, "openwebmath_perplexity": 360.5130747981269, "openwebmath_score": 0.9530057907104492, "tags": null, "url": "https://mathhelpboards.com/threads/problem-9-section-3-3-from-bartle.329/#post-1967" }
waves, speed-of-light, acoustics, gravitational-waves Title: What defines the speed of waves? Why the speed of sound or speed of electromagnetic/gravitational waves have values which they have? What defines it? Why do it not two times slower or two times faster, for i.e.? Experimentally, you can measure it. Wave equation. Mathematically, we're talking about physical processes whose governing equations are formally the same, i.e. the wave equation (see here https://en.wikipedia.org/wiki/Wave_equation the mathematical properties of the equation, its solutions and their properties, included the meaning of the propagation speed) that can be written as $\dfrac{1}{c^2}\dfrac{\partial^2 \phi}{\partial t^2} - \Delta \phi = 0$, where $\phi$ represents the physical quantity whose perturbations propagates as waves, and $c$ is the speed of the perturbation. Wave equation in Electromagnetism. As an example (see here https://en.wikipedia.org/wiki/Electromagnetic_wave_equation), you can get a homogeneous wave equation for the electric field or for the magnetic field (or equivalently for the potentials), combining Maxwell's equations in vacuum, in absence of electric charges or currents, $\varepsilon_0 \mu_0 \dfrac{\partial^2 \mathbf{E}}{\partial t^2} - \Delta \mathbf{E} = \mathbf{0}$, and thus you can recognize a wave equation with speed of the perturbations in the electromagnetic field, i.e. the speed of light in vacuum, is equal to $c^2 = \dfrac{1}{\sqrt{\varepsilon_0 \mu_0}}$. Wave equation for sound. You can get a wave equation governing the evolution of small perturbations of pressure field and other thermodynamic variables (here indicated with $(\cdot)'$) propagating in a compressible fluid at rest, through linearization of the equations of fluid dynamics around the steady fields (indicated here with the subscripts $0$)
{ "domain": "physics.stackexchange", "id": 90365, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "waves, speed-of-light, acoustics, gravitational-waves", "url": null }
navigation, gmapping, amcl Comparision http://s16.postimage.org/pqrxf828l/autolab_compare_path_hector_error.png It seems the long narrow path between waypoint 4 and 5 (see my original post) causes the SLAM process to become lost quite easily. I tried to omit the odometry from the Hector mapping, while it removed some problems it brought new ones. Comparision http://s8.postimage.org/npass98at/autolab_compare_path_hector_error_no_Odom.png Regards and thanks Sebastian Aslund
{ "domain": "robotics.stackexchange", "id": 10254, "lm_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, gmapping, amcl", "url": null }
cryptography, communication, bb84 $$ \cos^4\theta+\sin^4\theta=1-\frac12\sin^2(2\theta), $$ given that Alice sent $|0\rangle$. The analysis will be identical if Alice sent $|1\rangle$. However, you do need to repeat the analysis for if Alice sent $|+\rangle$. (At this moment, it should become apparent that you needed a phase parameter in your definition of $|e_1\rangle$ and $|e_2\rangle$ if you truly want to average over all possible bases, but I'll keep going with your definition.) So, assume Alice sent $|+\rangle=((\cos\theta+\sin\theta)|e_1\rangle-(\cos\theta-\sin\theta)|e_2\rangle)/\sqrt{2}$. So, Eve gets answer $|e_1\rangle$ with probability $(\cos\theta+\sin\theta)^2/2$, and Bob gets answer $|+\rangle$ with probability $(\cos\theta+\sin\theta)^2/2$. Hence, overall, the probability of Eve not being detected is $$ \left(\frac{\cos\theta+\sin\theta}{\sqrt{2}}\right)^4+\left(\frac{\cos\theta-\sin\theta}{\sqrt{2}}\right)^4=1-\frac12\cos^2(2\theta). $$ Averaging over all possible inputs of Alice, we therefore get $$ \frac12\left(1-\frac12\cos^2(2\theta)\right)+ \frac12\left(1-\frac12\sin^2(2\theta)\right)=\frac34. $$
{ "domain": "quantumcomputing.stackexchange", "id": 366, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "cryptography, communication, bb84", "url": null }
I personally think this problem is easier to approach from a slightly more brute-force angle. How many of the $$a_i$$ are below $$105$$? How many of them are between $$105$$ and $$210$$? How many are between $$210$$ and $$315$$? How many multiples of $$105$$ do you have to go before you have (close to) $$1000$$ terms? From there it's basically trial and error. Alternate solution, taken from the comments above. The left-hand side of your equation is roughly linear. So you can do a linear regression from basically any two $$n$$-values to find the solution to your equation. For instance, inserting $$n = 1$$ and $$n = 11$$ gives $$1$$ and $$5$$ respectively. Straight-forward linear regression from these two values (draw the line going through the points $$(1, 1)$$ and $$(11, 5)$$, and see where that line hits $$y = 1000$$) says the two sides of the equation will be equal at $$n = 2498$$. Actually inserting this value into the left-hand side of your equation we get $$1142$$, which is closer, but still a bit off. (Using more sensible $$n$$-values, like $$n = 0$$ and $$n = 105$$ will, of course, give you a much better result.) However, one more linear regression from $$n = 11$$ and $$n = 2498$$ basically gives you the solution. The number of integers $$n \in \{1,2,3,\dots, 105\}$$ that are relatively prime to $$105$$ is $$\phi(105) = \phi(3 \times 5 \times 7) = 2 \times 4 \times 6 = 48$$ We know that $$\gcd(105A + n, 105) = \gcd(n, 105)$$.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9755769127862449, "lm_q1q2_score": 0.8043260145325773, "lm_q2_score": 0.8244619199068831, "openwebmath_perplexity": 135.5843384160907, "openwebmath_score": 0.8570600748062134, "tags": null, "url": "https://math.stackexchange.com/questions/3375415/find-the-thousandth-number-in-the-sequence-of-numbers-relatively-prime-to-105" }
homework-and-exercises, lagrangian-formalism, constrained-dynamics Lagrange-Euler equations are given by: $$F_x = - \frac{\partial U}{\partial x} = m \ddot{x} \quad F_y = - \frac{\partial U}{\partial y} = m \ddot{y}$$ $$F_{\text{tot}} = \sqrt{F^2_x + F^2_y}$$ The constraints of our problem are: $$ y=f(x) \quad \dot{x}^2 + \dot{y}^2 = V^2 $$ Now we need to rewrite $\ddot{x}$ and $\ddot{y}$ in terms of $\text{ } f(x)$ and $V$. There are some hints how to do this: $$\dot{y} = f'_x \cdot \dot{x} \quad \ddot{y} = f''_{xx} \cdot (\dot{x})^2 +f'_x \cdot \ddot{x}$$ Here we used chain rule for function $y = f(x(t))$. If you do everything carefully you should arrive(after considerable amount of work) to the same result as was mentioned above.
{ "domain": "physics.stackexchange", "id": 50529, "lm_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, lagrangian-formalism, constrained-dynamics", "url": null }
python, algorithm, ruby, interval # TODO - implement this method I guess you already did that - you can safely delete the comment.
{ "domain": "codereview.stackexchange", "id": 6982, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, algorithm, ruby, interval", "url": null }
terminology, sets Title: Name for concept: each pair of sets is either nested or disjoint Does this property have a name? Given a collection of sets $\mathcal{P}$, for all pairs $A, B\in\mathcal{P}$, either $A\cap B=\emptyset$ or $A\subseteq B$ or $B\subseteq A$. This concept could equally apply to monoids, groups, partial orders or other mathematical structures, with some adjustments to the definitions. For instance, for monoids and groups we would replace $A\cap B=\emptyset$ by $A\cap B=\{\epsilon\}$, where $\epsilon$ is the unit of the monoid/group. I think that's called a laminar family.
{ "domain": "cs.stackexchange", "id": 1747, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "terminology, sets", "url": null }
sql, sql-server AND OrganisationID = C.OrganisationID ) ) D ON D.OrganisationID = C.OrganisationID GROUP BY C.OrganisationID, C.ChunkEnd ), ThirdChunk AS ( SELECT C.OrganisationID, C.ChunkEnd + 1 AS ChunkStart, MAX(D.Position) AS ChunkEnd FROM SecondChunk C INNER JOIN ( SELECT S.OrganisationID, S.Position + 1 AS Position FROM SplitPositions S INNER JOIN SecondChunk C ON C.OrganisationID = S.OrganisationID WHERE S.Position BETWEEN C.ChunkEnd + 1 AND C.ChunkEnd + @MaxLen UNION SELECT S.OrganisationID, C.ChunkEnd + @MaxLen AS Position FROM SplitPositions S INNER JOIN SecondChunk C ON C.OrganisationID = S.OrganisationID WHERE NOT EXISTS ( SELECT * FROM SplitPositions SI WHERE SI.Position BETWEEN C.ChunkEnd + 1 AND C.ChunkEnd + @MaxLen AND OrganisationID = C.OrganisationID ) ) D ON D.OrganisationID = C.OrganisationID GROUP BY C.OrganisationID, C.ChunkEnd ) INSERT INTO dbo.OrgStaging ( OrganisationID, Name1, Name2, Name3 ) SELECT O.OrganisationID, LTRIM(RTRIM(SUBSTRING(O.OrganisationName, C1.ChunkStart, C1.ChunkEnd))), LTRIM(RTRIM(SUBSTRING(O.OrganisationName, C2.ChunkStart, 1 + C2.ChunkEnd - C2.ChunkStart))), LTRIM(RTRIM(SUBSTRING(O.OrganisationName, C3.ChunkStart, 1 + C3.ChunkEnd - C3.ChunkStart))) FROM SourceDB.dbo.Organisations O INNER JOIN FirstChunk C1 ON C1.OrganisationID = O.OrganisationID INNER JOIN SecondChunk C2 ON C2.OrganisationID = O.OrganisationID INNER JOIN ThirdChunk C3 ON C3.OrganisationID = O.OrganisationID ORDER BY O.OrganisationID;
{ "domain": "codereview.stackexchange", "id": 17660, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "sql, sql-server", "url": null }
fundamental-astronomy, ascension, declination Title: Calculation of right ascension and declination I am confused about this problem: If I see an object from Mount Teide (longitude is 16"30'E and latitude is 28"18'N) that passes the meridian (azimuth=0) at 5h (am) UTC, and I also know that the elevation of the star is 43"40', the stellar time at Greenwich at 0h UTC is 22h20min. How can I calculate the right ascension and declination? The answers to this question are very clear and much better than I could have written. I'm not sure what you mean by "the stellar time at Greenwich at 0h UTC is 22h20min", but I'm assuming that you mean that that is the amount of time since the culmination of Aries over the Prime Meridian (Greenwich). That being the case, the Right Ascension (RA) of your body can be easily calculated. All we need to do is figure out what RA is passing your meridian at the time in question. This is probably a good time to point out that the longitude of Mt Teide is 16° 30'W not E. We already know that RA 22H 20m is passing over Greenwich at the time of interest (or, at least that is what I am assuming as your explanation is not at all clear.), as we are to the West of Greenwich, then we know that any RA on our meridian is earlier and we can calculate how much earlier simply by dividing our longitude by 15 (as the earth spins at a nice steady 15°/hour):- diff in RA = Long/15 = 16° 30'/15 = 1H 06m Then:- RA = RA at Greenwich - diff in RA = 22H 20m - 1H 06m = 21H 14m Now for Declination:- The first stage is to take a piece of ruled or graph paper and near the middle mark a short, horizontal line. This is your horizon, and is marked 'H'. Now draw upwards 9 lines and mark the top ,'Z' and downwards 9 lines and mark the bottom 'N'. You should end up with something that looks like this:-
{ "domain": "astronomy.stackexchange", "id": 144, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "fundamental-astronomy, ascension, declination", "url": null }
rosjava Title: Does latest actionlib_java for electric exist? Hi all, Has any body latest actionlib_java for electric version used? It seems that actionlib_java has been removed. What is the latest actionlib to support action server/client in java? What happens to those java application which use actionlib_java? thanks, Originally posted by safzam on ROS Answers with karma: 111 on 2012-07-24 Post score: 1 See http://answers.ros.org/question/37198/rosjava-actionlib/ Originally posted by damonkohler with karma: 3838 on 2012-07-25 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by safzam on 2012-07-26: Hi damonkohle, yes I saw it before. But we have applications which we already made and they need actionlib_java. Do we need to alter code and change everything that dependent on actionlib_java? my pckg uses actionlib_java,I give it to someone, how does he get actionlib_java to compile that pckg? Comment by damonkohler on 2012-07-27: Currently your only option is to implement your own actionlib or revert to an older version of rosjava that supports it. Comment by safzam on 2012-08-14: Hi damonkhole, Does new and latest rosjava support actionserver/client implementation. How can I make new actionserver/cleint applications based on rosjava? Thanks
{ "domain": "robotics.stackexchange", "id": 10332, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "rosjava", "url": null }
# Continuous function with continuous one-sided derivative Simple example of the absolute value function $x \mapsto |x|$ on $\mathbb{R}$ shows that it is possible for a continuous function to posses both the right-hand and the left-hand side derivatives and still not being differentiable on $\mathbb{R}$. I was wondering if it is possible to assume something about one of the one-hand side derivatives to obtain differentiability. The obvious came to my mind: Is it true that if a continuous function $f \in C(\mathbb{R})$ has left-hand-side derivative $f_{-}^{'}$ that is continuous on $\mathbb{R}$, then the function $f$ is differentiable? • The necessary and sufficient condition is that $f'_-=f'_+$. Can you deduce this identity from the continuity of $f'_-$? – Siminore Oct 15 '14 at 13:37 • @Siminore: Thanks for your comment. I need to prove that the right-hand-side derivative $f'_+$ exists and is equal to $f'_{-}$. Is that what you meant? If so, then I have trouble with that. – xen Oct 15 '14 at 13:43 • See this question. – Tony Piccolo Oct 15 '14 at 14:38 • @TonyPiccolo Many thanks! I somehow overlooked that question. – xen Oct 15 '14 at 18:32 Yes. The keystone is: Lemma. Let $f\colon [a,b]\to\mathbb R$ be continuous and assume that $f'_+(x)$ exists and is $>0$ for all $x\in [a,b)$. Then $f$ is strictly increasing.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9924227585080309, "lm_q1q2_score": 0.8375007036204493, "lm_q2_score": 0.8438951005915208, "openwebmath_perplexity": 139.00581873099668, "openwebmath_score": 0.9817276000976562, "tags": null, "url": "https://math.stackexchange.com/questions/974973/continuous-function-with-continuous-one-sided-derivative" }
(making use of $W^TW=W^2$) With rules for matrix calculus from wikipedia: \begin{align} \frac{\partial}{\partial A}\bullet&=\frac{1}{2}\left[\Phi^T W^2\Phi A +(\Phi^T W^2\Phi)^TA-\Phi^TW^2F-(F^TW^2\Phi)^T\right] =\\ &=\Phi^T W^2 \Phi A - \Phi^TW^2F \end{align} Setting the first derivative equal to zero vector yields $\Phi^T W^2\Phi A=\Phi^TW^2F$, from which finally $\boxed{A=(\Phi^TW^2\Phi)^{-1}\Phi^TW^2F}$ I suppose no further simplification is possible (in particular expanding the inversion to $(W\Phi)^{-1}(\Phi^T W^T)^{-1}$ produces matrix size mismatch, therefore is not possible). EDIT2: after looking around at wikipedia, I found out I derived normal equation for weighted least-squares (that article uses $\hat\beta$, $W$, $X$, $y$ where I used $A$, $W^2$, $\Phi$, $F$).
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9811668706602659, "lm_q1q2_score": 0.8154900171824587, "lm_q2_score": 0.8311430415844385, "openwebmath_perplexity": 775.8230387581593, "openwebmath_score": 0.9118614196777344, "tags": null, "url": "http://math.stackexchange.com/questions/72007/matrix-calculus-equation-least-squares-minimization" }
c++, algorithm, a-star Node_(Node_&& _node) { *this = std::move(_node); } Node_& operator =(Node_&& _node) { if (this != &_node) { m_ID = std::move(_node.m_ID); m_Cost = std::move(_node.m_Cost); m_Heuristic = std::move(_node.m_Heuristic); m_Parent = std::move(_node.m_Parent); } return *this; } const Identifier& getIdentifier() const { return m_ID; } int getCost() const { if (m_Parent) return m_Parent->getCost() + m_Cost; return m_Cost; } int getHeuristic() const { return m_Heuristic; } int getFinalCost() const { return getCost() + getHeuristic(); } const Node_* getParent() const { return m_Parent; } }; using Node = Node_<Identifier>; using NodePtr = std::unique_ptr<Node>; template <class Identifier> class AreaVisitor_ : sl::NonCopyable { public: using Node = Node; using NodePtr = NodePtr; virtual ~AreaVisitor_() = default; virtual std::vector<NodePtr> getNeighborNodes(const Node& _pos) = 0;
{ "domain": "codereview.stackexchange", "id": 18288, "lm_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++, algorithm, a-star", "url": null }
# Find the least next N-digit number with the same sum of digits. Given a number of N-digits A, I want to find the next least N-digit number B having the same sum of digits as A, if such a number exists. The original number A can start with a 0. For ex: A-> 111 then B-> 120, A->09999 B-> 18999, A->999 then B-> doesn't exist. You get the required number by adding $9$, $90$, $900$ etc to $A$, depending on the digits of $A$. First Case If $A$ does not end in a row of $9$s find the first (starting at the units end) non-zero digit. Write a $9$ under that digit and $0$s under all digits to the right of it. Add the two and you get $B$. Example: $A=3450$. The first non-zero digit is the 5 so we write a $9$ under that and a $0$ to its right and add: \begin{align} 3450\\ 90\\ \hline 3540 \end{align} There is a problem if the digit to the left of the chosen non-zero digit is a $9$. In this case we write a $9$ under that $9$ and $0$s to its right. And if there are several $9$ we put our $9$ under the highest one. Example: $A=3950$. The first non-zero digit is the 5 but there is a $9$ to its left. We write a $9$ under that $9$ instead and $0$s to its right and add: \begin{align} 3950\\ 900\\ \hline 4850 \end{align} Second case If $A$ does end in a row of $9$s write a $9$ under the highest of the row of $9$s and $0$s under all digits to the right of it. Add the two and you get $B$. As you say, if $A$ is entirely $9$s there is no solution.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9773708019443872, "lm_q1q2_score": 0.8035836498481971, "lm_q2_score": 0.8221891305219504, "openwebmath_perplexity": 355.86713815877033, "openwebmath_score": 0.6967836618423462, "tags": null, "url": "https://math.stackexchange.com/questions/424480/find-the-least-next-n-digit-number-with-the-same-sum-of-digits" }
algorithms, optimization, arrays #Set to some maximum value, for first time comparison x = y = z = INFINITY for i = 1 to n j = i+1 k = n while k>j sum = A[i]+A[j]+A[k] if sum == m print <A[i],A[j],A[k]> return 1 else if sum > m if sum < (x+y+z) <x,y,z> = <A[i],A[j],A[k]> k=k-1 else j = j+1 print <x,y,z> Runtime complexity of this algorithm is $O(n^2)$. I took time answering this question because I was looking for an algorithm with better runtime complexity. Thanks to Yuval Filmus's answer that saved a lot of my time. Here is the link to the working implementation of this algorithm in C language
{ "domain": "cs.stackexchange", "id": 8833, "lm_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, arrays", "url": null }
c, memory-management Title: Memory management for small allocations This code is for a program that needs to add thousands of strings to memory while it's running and these strings will be used until the end of execution. So the memory for these strings will be freed only in the end. First I tested calling malloc for every new string and have used Valgrind to benchmark total execution cost for 200 hundred thousand strings. Then I wrote these memory handling functions that call malloc once and hand out small chunks of memory for every string. The overall execution cost for the entire program went down over 20%. This is my first attempt at doing this, so I know this code is probably bad. I would like to know exactly what is wrong with it, so I won't make the same mistakes again. //The actual numbers will be smaller after DEBUG #define BIG_BLOCK 1073741824 // 1GiB .......... #define MEDIUM_BLOCK 524288000 //500MiB ..... #define SMALL_BLOCK 104857600 //100MiB . //Linked-list containing the required data for each malloc'ed block typedef struct { void *mem_pool; //starting address for this block void *next; //next node size_t *position; //current position size_t *available; //how much memory was allocated? } memory_t; //First link static memory_t *root = 0; //handles malloc and returns a new memory_t node, it allocates //more memory on the first call than on subsequent calls static void *increase_memory(void) { void *result = 0; memory_t *new_block = 0; static int firstCall = 0; static const size_t default_sizes[] = {BIG_BLOCK, MEDIUM_BLOCK, SMALL_BLOCK, 0};
{ "domain": "codereview.stackexchange", "id": 4753, "lm_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, memory-management", "url": null }
atmosphere, climate-change, thermodynamics, radiative-transfer All of which have a compounding effect in the regional and to a lesser degree, global environment, that Chen et al. attribute to as being a cause of a 1-2K temperature rise in high altitude areas in Eurasia and North America and as a disrupting influence in global atmospheric circulation. Edit 28/2/2016: There is an interesting blog post about a similar phenomenon: Dubai construction alters local climate Additional references Chen, B., and G.-Y. Shi, 2012: Estimation of the distribution of global anthropogenic heat flux. Atmos. Oceanic Sci. Lett., 5, 108–112.
{ "domain": "earthscience.stackexchange", "id": 2535, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "atmosphere, climate-change, thermodynamics, radiative-transfer", "url": null }
classical-mechanics, hamiltonian-formalism, conventions, phase-space, integrals-of-motion Title: Action-angle coordinates I'm studying action-angle coordinates and I've come across two distinct, yet correct, definitions for the new generalized momenta, $\text{J}_k$: $$\text{J}_k \equiv \oint p_k dq_k $$ and $$\text{J}_k \equiv \frac{1}{2\pi} \oint p_k dq_k .$$ I'm trying to understand how they relate. Imagine you have the harmonic oscillator $$ H(q, p) = \frac{p^2}{2} + \frac{q^2}{2} \tag{1} $$ In phase space, the are enclosed by a solution of Eq. (1) is $$ A = \pi\times\sqrt{2}\times \sqrt{2} = 2\pi $$ For this orbit, the action is $$ J = \frac{1}{2\pi}\oint {\rm d}q\; p = \frac{1}{2\pi}A = 1 $$ That is the reason behind the "$2\pi$", but it is absolutely not required. The action $J$ will have the same meaning even if this factor is removed
{ "domain": "physics.stackexchange", "id": 35583, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "classical-mechanics, hamiltonian-formalism, conventions, phase-space, integrals-of-motion", "url": null }
ros, motoman-driver, motoman Title: Is there support the Yaskawa CSDA 10f (dual arm robot) with ROS? The yaskawa CSDA 10F(dual arm robot) looks very similar to the Motoman SDA 10F. They also use the same controller FS100. I would like to know if I can integrate ROS with it? If so can I use the motoman_driver for the integration. and how do I go about it ? Originally posted by motoman on ROS Answers with karma: 5 on 2016-12-07 Post score: 0 Original comments Comment by gvdhoorn on 2016-12-07: First thing to make sure is whether you have / can get 167352-1 on the controller. That is a hard requirement. Apart from the driver, it'd also need a proper URDF for the CSDA10. I haven't checked, but it could be that joint limits are different from the standard SDA10. Although we have never tested the clean room robots with the MotoROS driver, I don't know of any software changes from a standard FS100 controller. I fully expect that the CSDA should be fully compatible. As gvdhoorn mentioned, you will need part # 167352-1 installed on your controller to ensure the software is properly configured to support the MotoROS driver. This is a Yaskawa America part number, so it can be ordered by contacting techsupport@motoman.com or +1 937 847 3200. If you are outside of North/South America, your local office might have an equivalent part number (but you can still contact the US office). Additionally, as gvdhoorn mentioned, you will need a proper URDF file for this robot. Unfortunately, I am having trouble locating the data sheets for the CSDA10F, as I don't think we have sold this particular arm in the US. I recommend that you compare the dimensions of your arm to the standard SDA10F datasheet here: https://cdn2.hubspot.net/hubfs/366775/Blog_Robots/SDA10F.pdf?t=1481054766982 If you require more detailed drawings, please request these from the Tech Support team. -Yaskawa America Inc, Motoman Robotics Division
{ "domain": "robotics.stackexchange", "id": 26421, "lm_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, motoman-driver, motoman", "url": null }
javascript, html, websocket /* * Returns all the keys of an object and its inherited keys. * This is used so `JSON.stringify` can get the `.command` of a message. * * @param {Object} obj - The object to flatten * @return {Object} - a new Object, containing obj's keys and inherited keys * @source http://stackoverflow.com/questions/8779249/how-to-stringify-inherited-objects-to-json */ const flatten = function(obj) { let result = Object.create(obj); for(let key in result) { // TODO this assignment is weird, why is `result[key]` being assigned to its own value? result[key] = result[key]; } return result; }; /* * Singleton object to handle communication via WebSocket between the client * and the game server. */ const CardshifterServerAPI = { socket: null, messageTypes: { /* * Incoming login message. * A login message from a client to add a user to the available users on the server. * This login message is required before any other action or message can be performed between a client and a server. * @constructor * @param {string} username - The incoming user name passed from client to server, not null * @example Message: <code>{ "command":"login","username":"JohnDoe" }</code> */ LoginMessage : function(username) { this.username = username; },
{ "domain": "codereview.stackexchange", "id": 29903, "lm_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, html, websocket", "url": null }
javascript, jquery, sqlite, cordova I can see why you wouldn't want to do that. Perhaps change the void 0 to undefined. But make sure to use triple equals unless you're sure you want the behavior of double equals. (see here). String checking also should be done with triple equals (myAction === 'update' or myAction === 'sync'). I recommend using switch statements in the callbacks, instead of multiple if/else blocks. They'll make your code easier to both understand and change if you need to in the future. Are you sure that the SQL queries you're building are safe? It looks like in some places you might be using user-provided data to build the queries, which is bad unless you escape them - not a trivial problem (to say the least). Although it looks like most of the data comes from your server or is whitelisted, make sure to be careful - I've accidentally SQL-injected myself before by returning bad data from a server I was working on. Finally, the big one - I'd like to suggest that instead of using callbacks, you either wrap this library with Promises or switch to one that does that already. If you've never heard of promises, check this out. Right now, promises are only supported in a few browsers, but there are many libraries like Q and Bluebird that provide a lot of the same functionality, and there's an es6 shim for them as well. Promises can turn your code into somthing like this (including some of the other changes I suggested): if (myAction === 'update'){ db.transaction().then(function(tx) { switch (content.content[0].tabelle) { case 'hauptkategorie': return tx.executeSql("UPDATE hauptkategorie SET name = '" + name + "', beshreibung = '" + beschreibung + "', last_update = '" + now + "' WHERE pid = " + uid, []); case 'unterkategorie':
{ "domain": "codereview.stackexchange", "id": 14864, "lm_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, sqlite, cordova", "url": null }
There is also another recursive method as seen in this other graph. This forms a horizontal line at y=$$x_1$$. There also may be another $$\pm$$ branch where the sign is chosen as needed, all + or all -. Notice the main square root argument is also a difference of squares:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9891815507092832, "lm_q1q2_score": 0.8446747392964531, "lm_q2_score": 0.8539127510928476, "openwebmath_perplexity": 382.87353351995375, "openwebmath_score": 0.9760925769805908, "tags": null, "url": "https://math.stackexchange.com/questions/4209381/how-to-straighten-a-parabola" }
ros, message-filters, publisher, ros-indigo Originally posted by gvdhoorn with karma: 86574 on 2019-04-19 This answer was ACCEPTED on the original site Post score: 4 Original comments Comment by gvdhoorn on 2019-04-19: Please note that this is a C++ issue. Not a ROS problem. Comment by RLoad on 2019-04-19: thanks for your help, and I'm not very good at C++, I will learn more about it. now I try to directly read the data in callback and not use publisher, it works and I can get the data after Synchronize. Comment by RLoad on 2019-04-19: the reason I use publisher is that I want record the data after synchronizing, and now ( I re-edit the code) the use of ROS_INFO let can see the one line data of geometry_msgs::TransformStamped. but now I wonder if there are some better way to record the data in callback? Did ROS provide some good tools for these or I need use some C++ ways to record the data in geometry_msgs::TransformStamped ? Thank you again! Comment by ahendrix on 2019-04-19: You should change ros::Publisher sensor_pub1 = nh.advertise<geometry_msgs::WrenchStamped>("/sensor_ati", 1000); ros::Publisher sensor_pub2 = nh.advertise<geometry_msgs::PoseArray>("/sensor_ndi", 1000); to sensor_pub1 = nh.advertise<geometry_msgs::WrenchStamped>("/sensor_ati", 1000); sensor_pub2 = nh.advertise<geometry_msgs::PoseArray>("/sensor_ndi", 1000); so that you use global variable instead of creating new local variable. Comment by RLoad on 2019-04-22: I change my code as your advice, it works! thank you very much!
{ "domain": "robotics.stackexchange", "id": 32894, "lm_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, message-filters, publisher, ros-indigo", "url": null }
ros, moveit, collision-detection, fcl Originally posted by Jeremy Zoss with karma: 4976 on 2013-08-06 This answer was ACCEPTED on the original site Post score: 6 Original comments Comment by AdrianPeng on 2013-09-03: Hi Jeremy, I really appreciate your patient reply! I have another question about FCL distance check called in Moveit (update in question). I am wondering if I can simply modify the code in moveit to get the nearest point information. Comment by Jeremy Zoss on 2013-09-03: Sure. There's no reason why you can't. But if you do fork the MoveIt code like that, you'll need to manually keep your local version updated with any new updates released by the MoveIt team. And your code won't be portable to other users (unless they also make the same MoveIt updates). Once you develop a patch, you might consider submitting it to the MoveIt developers, so they can integrate it into the official distribution. Comment by AdrianPeng on 2013-09-04: Hi Jeremy, I tried to Modify the code in moveit to get the nearest points, but I meet the question in update 2. Do you mind having a look on that if you have time? Thanks a lot! Comment by dsolomon on 2013-10-18: Adrian, I will be examining this problem deeper in the next few weeks, but I have a brief suggestion to check: try changing printf to "std::cout << "Nearest point 1: " << dist_result.nearest_points[0] << std::endl;" as fcl::Vec3f type has a built-in ostream operator that may show values correctly Comment by dsolomon on 2013-10-18: Also, you may want to additionally check that your objects are not currently in collision, as the distance check may default to 0,0,0 in that case
{ "domain": "robotics.stackexchange", "id": 15152, "lm_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, collision-detection, fcl", "url": null }
moveit, rrt, robot, ros-indigo, ompl Title: Moveit path planning with constraints fails Hey, I'm trying to move an object with the kinova mico arm, using ROS and moveit, while keeping the end effector horizontal. Relocating an object proved successful, however when I add some path constraints the planning time shoots up to over 120 seconds, where 10 seconds sufficed before, and the success ratio has dropped to 1 out of 10. I tried to fine-tune the range variable between 0.05 and 3.0 at both the RRT and the RRTConnect libraries which didn't change anything in the results. The constraints are defined like shown below. moveit_msgs::Constraints PC; moveit_msgs::OrientationConstraint OC; OC.header.frame_id = "mico_link_base"; OC.link_name = "mico_link_7"; OC.orientation = target_pose1.orientation; OC.absolute_x_axis_tolerance = 0.2; OC.absolute_y_axis_tolerance = 2*PI; OC.absolute_z_axis_tolerance = 0.2; OC.weight = 1.0; PC.orientation_constraints.push_back(OC); group.setPathConstraints(PC);
{ "domain": "robotics.stackexchange", "id": 24881, "lm_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, rrt, robot, ros-indigo, ompl", "url": null }