text
stringlengths
49
10.4k
source
dict
inorganic-chemistry, everyday-chemistry, experimental-chemistry, home-experiment, carbon-allotropes 1) Pencil lead isn't graphite (neither is it "lead" for that matter ;P); it's a mixture of graphite and clay. So unless you know for sure that the impurities in your sample are clay, this doesn't really serve as a good baseline. Besides, the graphite particles aren't all aligned in that plane I was talking about. 2) Your makeshift resistor ("thick line on a piece of paper") is a poor standard for another reason: dimensions. Your line has no uniform dimensions (length, breadth or even depth). If you need resistance from resistivity of a given material, or the other way around, you need the sample's dimensions. Neither your line nor your powder have fixed dimensions in this test. Trying to figure out what your sample is by comparing its resistivity with that of another substance is a really neat idea, so don't get me wrong; the issue here is (1) the design of the experiment, (2) of the two substances you're trying to compare (graphite and charcoal), the latter's electrical properties are altered because it's been powdered and (3) your "control-test/sample" (the line-resistor) is neither graphite nor charcoal, making it a rather pointless "control sample". Conclusion: No useful data. Rubbing it into paper it has a much blacker colour than the graphite (which to me looks like a really dark gray). However, I don't know if that is a reliable indicator. I don't need to tell you how poor a test this is (you already seem to doubt the validity of the test yourself) Conslusion: No useful data. EDIT: Ok, I've made a paste using Isopropyl Alcohol and the carbon powder and made a small "stick" or rod of the stuff. I have now been able to achieve solid continuity at around 2 centimeters in distance and the resistance dropped from the high 40 - 50 kOhms for the loose powder, to the low 10s (ie 40 Ohms). If this helps anyone.
{ "domain": "chemistry.stackexchange", "id": 9128, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "inorganic-chemistry, everyday-chemistry, experimental-chemistry, home-experiment, carbon-allotropes", "url": null }
javascript, cryptography, ecmascript-6 /** * Checks the key is the correct size */ checkKeyLength: function(keyLength) { // If key is 16 bytes (128 bits) or 32 bytes (256 bits) if ((keyLength === 16) || (keyLength === 32)) { return true; } return false; }, /** * Converts a message from a hexadecimal string or UTF-8 to a byte array */ parseMessage: function(message, options) { try { var messageBytes = []; // If an array of bytes if ((message instanceof Uint8Array) || (message instanceof Array)) { // Convert the typed array to a regular array messageBytes = Array.prototype.slice.call(message); } else if (typeof message === 'string') { // Check it is a hex string by checking the options property if ((typeof options !== 'undefined') && (options.hasOwnProperty('inputTextType')) && (options.inputTextType === 'hex')) { // Convert from hexadecimal string messageBytes = this.hexToBytes(message); } else { // Convert from UTF-8 string messageBytes = this.utf8StringToBytes(message); } } else { throw new Error('Incorrect parameter type for the message, it should be a string, hex string or array of bytes'); } // The maximum counter in the spec is 2^64, but JavaScript can't go higher than 2^53 for an integer. Multiply // this max counter by the output bytes of Salsa20 function (64 bytes) which gives 576460752303424000 bytes = 512 PiB if (messageBytes.length > (this.maxInteger * this.outputByteLength)) { throw new Error('Should not encrypt more than 512 petabytes of data under a single nonce, try splitting the data and encrypting under separate nonces'); }
{ "domain": "codereview.stackexchange", "id": 12143, "lm_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, cryptography, ecmascript-6", "url": null }
selection-problem, comparison Title: Minimum number of comparision to find the third largest element in an array of distinct integers? For the second largest element, I know that the formula is $n+ \lceil\log n \rceil -2 $ Is there any formula for the third largest element? and if so, what is the derivation? For the problem of computing the $k$-th rank element, a lower bound of $n-k+\log \binom{n}{k-1}$ can be proven with decision trees. For simplicity this proof assumes that the element set $X$ is of size $n$ and its elements are distinct (which makes the problem harder). Moreover, the algorithm may only compare any two elements, and conclude one is either smaller or greater than the other. First, let us claim the following: For computing the $k$-th rank element (denoted $x_k$) (using comparisons only), every other element $x_i$ must be involved in a comparison that sets it lesser or greater than the $k$-th rank element. Formally: for any $x_i$ lesser than $x_k$, $x_i$ must be involved in a comparison of the sort $x_i < x_j \leq x_k$. For any $x_i$ greater than $x_k$, it must be involved in the comparison $x_i > x_j \geq x_k$ The proof by contradiction: Suppose $x$ was not involved in either those comparisons. Then $x$ can be either greater or smaller than $x_k$, which means the $k$-th rank element can change depending on $x$.
{ "domain": "cs.stackexchange", "id": 14301, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "selection-problem, comparison", "url": null }
waves, acoustics, velocity Title: What is the difference between velocity of wave and velocity of pulse on a string wave? I have read in my textbook that velocity of a wave remains constant but then there was a question to find velocity of pulse as a function of x in a vertically hanged rope.(where x is the position of particle as we move up a rope ) now that came out v=√xg But that means velocity of pulse changes as we move up ? I am confused For a non-dispersive system the velocity of a wave and a pulse are the same. In the particular case of a string the velocity is given by: $$ v = \sqrt{\frac{T}{\rho}} $$ where $T$ is the tension in the string and $\rho$ is the linear density (mess per unit length). Both a continuous wave and an isolated pulse will travel along the string at this speed. The reason that the velocity (of both a wave and a pulse) changes in your problem is because the tension in the rope changes. The topmost part of the rope has to support the whole mass of the rope so the tension is $mg$ where $m$ is the mass of the rope, while the bottom most part of the rope isn't supporting anything so the tension is zero. Since the tension increases as we move up the rope the wave and pulse velocity increase as well.
{ "domain": "physics.stackexchange", "id": 87072, "lm_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, acoustics, velocity", "url": null }
orbit, galaxy, stellar-dynamics Title: Does the Sun orbit the Milky way in a (kind of) flat or inclined orbit or more of a sine wave? I know it can't be a perfect ellipse or smooth orbit due to all the matter in every direction, and our Sun could be affected by a gravity assist of sorts if it passes close enough to another massive star. I also know that galaxy orbits are different than Solar System orbits because most of the mass is in the dark matter halo and as a result, the outer stars orbit faster than in a standard orbit, so there's a number of variables. But, if we ignore gravity assists, is the sun mostly in a standard, or lightly inclined orbit around the center of the Milky way or more sinusoidal? Reason I'm asking - see (attached and in my opinion, bad) article, and picture included.
{ "domain": "astronomy.stackexchange", "id": 1200, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "orbit, galaxy, stellar-dynamics", "url": null }
simple calculate... Derivatives by replacing the differential operator d with a ∂ '' symbol ⋅ xy ⋅ while... Differentiation solver step-by-step this website uses cookies to ensure you get the best experience, and do the same as... Is total which the function and the value of it at each point in the last step to is... Derivative calculator - partial differentiation solver step-by-step this website, you agree to our Cookie.!: Notations be positive integers when we 've only one variable, like f (,..., or fundamental just the directional derivative is used when the function value as! That @ 2z @ x @ y is as important in applications as the others we. Function just the directional derivative is very similar to the definition of the derivative. ; not radical, original, or fundamental derivative as the others derivatives and. One variable and leaving the other constant equivalent formula for taking directional derivatives ( Introduction directional... Agree to our Cookie Policy like partial derivative vs derivative ( x, y ) ( going ). Or more variables is held constant the terms and substituting t=x in the last equal sign x and y it... N'T matter whether you write a total or partial derivative is a function just the directional derivative is similar! ∂ '' symbol tried to get an expression for it before which used the koszul formula and it needed vectors! N and m partial derivative vs derivative be symbolic and they are assumed to be positive integers in the last step ( )... To get an expression for it before which used the koszul formula and it needed two vectors to positive... ), … partial differentiation involves taking the derivative of the partial.. ; Tags derivative normal partial ; Home becomes ( ∂f/∂t ) ( )... Repo is ( informal ) repossess which the function value changes as its input changes part turns..
{ "domain": "sv-kyubin.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9828232940063591, "lm_q1q2_score": 0.8035312419724414, "lm_q2_score": 0.817574478416099, "openwebmath_perplexity": 594.1676292675085, "openwebmath_score": 0.8390728831291199, "tags": null, "url": "http://www.sv-kyubin.com/peaches-of-tib/49a27a-partial-derivative-vs-derivative" }
vectors, classical-electrodynamics, vector-fields Title: Prove a connection from Divergence-less (or "solenoidal") Fields Theorem from textbook by Griffiths The following is the excerpt from 'Introduction to Electrodynamics' textbook by David J. Griffiths(p. 54): Theorem 2 Divergence-less (or "solenoidal") fields. The following conditions are equivalent: (a) $\nabla\cdot$F = 0 everywhere. (b) $\int$F ·da is independent of surface, for any given boundary line. (c)..... (d) ..... How to derive (a) from (b)? I got the answer myself. If we are given a boundary line, then we can integrate say vector potential A over it, which equals to the integral of derivative of the latter, according to Stokes' theorem: $\oint\limits_{\mathscr{P}}$ A $\cdot$ dl= $\int\limits_{\mathscr{S}}$ ($\nabla$$\times$ A) $\cdot$ da Hence, comparing the integral from (b),to the r.h.s. of Stokes' theorem we come to the conclusion that, F=$\nabla$$\times$ A. But, as it known from vector analysis, the divergence of a curl always equals zero. Thus, we derived condition (a) from (b).
{ "domain": "physics.stackexchange", "id": 33435, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "vectors, classical-electrodynamics, vector-fields", "url": null }
mammals, sex-chromosome, gender Possibly it is just because they choose males that are more likely to have more Y spermatozoa than X Yes, this is possible. But considering cryptic female choice we may say the same for males. Some of them may seek those females who are more likely to get pregnant with particular sex spermatozoon. Answering by my own since only now I occasionally came across with "Cryptic female choice" article.
{ "domain": "biology.stackexchange", "id": 8592, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "mammals, sex-chromosome, gender", "url": null }
computability, turing-machines, terminology Theorem: A language $A$ is recursively enumerable if, and only if, there is a partial computable $f$ and a recursive set $B$ such that $A = f^{-1}(B)$. You are close to reinventing the notion of many-one reduction, by the way.
{ "domain": "cs.stackexchange", "id": 8282, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "computability, turing-machines, terminology", "url": null }
java, beginner, game, number-guessing-game return getSecretNumber(MAX, MIN); } //converts a string variable to a int and returns a secret number private int getSecretNumber(String strMax, String strMin){ //code to convert string to int getSecretNumber(max, min); } //generates a secret number between 2 numbers private int getSecretNumber(int MAX, int MIN){ return random.nextInt(MAX - MIN + 1) + MIN; } Now you will have saved your self some time in the future if/when the design requirements change. if implemented correctly you might not have any code changes.. say something like this. public static void main(String args[]) { int comp = getSecretNumber(); //gets default if (args.length == 2) comp = getSecretNumber(args[0], args[1]); //etc... It is always a good idea to seperate your business code and your logic code. The business code is the rules for your code. "Do A,B,C give me D, and Save to E" the logic code is the nitty gritty details of how to do A-E. Everyone calls it something different but the concept is always the same. Keep the two as seperate as possible it makes changing your code easier. Those are my tips. Other than that I don't see any problems with your code other than you don't have a way to escape the loop other than guessing the correct number.
{ "domain": "codereview.stackexchange", "id": 10052, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, beginner, game, number-guessing-game", "url": null }
mole Title: How many moles of aspartame are present in 4.00mg of aspartame? (3 sig figs) This is a part of my online chemistry homework (mastering chemistry) I know how to do it but when I enter $\pu{1.36E-5}$ into the program, it says that it's incorrect and that the correct answer does not depend on $\times10$. I'm not sure what it wants from me. The answer should be given in moles with $3$ sig figs. Try putting in 0.0000136. Remember that zeroes between the decimal point and the last numbers do not contribute to significant figures. Good luck.
{ "domain": "chemistry.stackexchange", "id": 1898, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "mole", "url": null }
python, python-3.x, console, authentication @staticmethod def version() -> None: version = read_version() print(f"Pylect {version} (pylect{version})") @staticmethod def run() -> None: os.system(f"pylect {' '.join(sys.argv[1:])}") if sys.argv[1] in {"list", "-l"}: Main.list() elif sys.argv[1] in {"version", "-v"}: Main.version() elif sys.argv[1] in {"run", "-r"}: Main.run() I think you could possibly benefit from argparse to make more complicated CLI interfaces easier. We can add a flag to allow using -v and --version as to get the version information: parser = argparse.ArgumentParser() parser.add_argument("-v", "--version", action="store_true") print(parser.parse_args(["-v"])) Namespace(version=True) Rather than using "store_true" and having to build the if elif else we can use "store_const" to store Main.version. parser = argparse.ArgumentParser() parser.add_argument("-v", "--version", action="store_const", const=Main.version) print(parser.parse_args(["-v"])) Namespace(version=<function Main.version at 0x7f0c36e99440>)
{ "domain": "codereview.stackexchange", "id": 45082, "lm_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, console, authentication", "url": null }
algorithms, complexity-theory, graphs, np-complete, hamiltonian-path Title: Which of the following problems can be reduced to the Hamiltonian path problem? I'm taking the Algorithms: Design and Analysis II class, one of the questions asks: Assume that P ≠ NP. Consider undirected graphs with nonnegative edge lengths. Which of the following problems can be solved in polynomial time? Hint: The Hamiltonian path problem is: given an undirected graph with n vertices, decide whether or not there is a (cycle-free) path with n - 1 edges that visits every vertex exactly once. You can use the fact that the Hamiltonian path problem is NP-complete. There are relatively simple reductions from the Hamiltonian path problem to 3 of the 4 problems below. For a given source s and destination t, compute the length of a shortest s-t path that has exactly n - 1 edges (or +∞, if no such path exists). The path is allowed to contain cycles. Amongst all spanning trees of the graph, compute one with the smallest-possible number of leaves. Amongst all spanning trees of the graph, compute one with the minimum-possible maximum degree. (Recall the degree of a vertex is the number of incident edges.) For a given source s and destination t, compute the length of a shortest s-t path that has exactly n - 1 edges (or +∞, if no such path exists). The path is not allowed to contain cycles.
{ "domain": "cs.stackexchange", "id": 12966, "lm_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, complexity-theory, graphs, np-complete, hamiltonian-path", "url": null }
condensed-matter, hamiltonian, parity \end{bmatrix} \tag{A-07a}\label{A-07a}\\ U_{2} & \e\tfrac{\sqrt{2}}{2}\left(\du\p\mathrm i\sigma_2\right)\e\tfrac{\sqrt{2}}{2} \begin{bmatrix} \hphantom{\m} 1 & \:\:1\: \vphantom{\tfrac{a}{b}}\\ \m 1 & \:\: 1 \:\vphantom{\tfrac{a}{b}} \end{bmatrix} \tag{A-07b}\label{A-07b}\\ \texttt{so} \qquad U_{2}^{\m 1} & \e\tfrac{\sqrt{2}}{2}\left(\du\m\mathrm i\sigma_2\right)\e\tfrac{\sqrt{2}}{2} \begin{bmatrix} \:\:1 & \m 1 \:\vphantom{\tfrac{a}{b}}\\ \:\:1 & \hphantom{\m} 1 \:\vphantom{\tfrac{a}{b}} \end{bmatrix} \tag{A-07c}\label{A-07c} \end{align} Using above equations the unitary transformation $\:U_{FG}\:$ is \begin{align} U_{FG} & \e\tfrac12\left[\left(1\p\hat{\rm R}\right)U_{13}\p\left(1\m\hat{\rm R}\right)U_{2}^{\m 1}\right] \nonumber\\ & \e\tfrac{\sqrt{2}}{4}\left[\left(1\p\hat{\rm R}\right) \begin{bmatrix}
{ "domain": "physics.stackexchange", "id": 83102, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "condensed-matter, hamiltonian, parity", "url": null }
quantum-field-theory, feynman-diagrams, fermions, interactions the familiar-looking symmetry factors of (a) 1, (b) 2, (c) 1. Explicitly, consider diagram (a). From the Taylor expansion, Lagrangian, and antisymmetrization of indices, we have in the denominator $2!*(2*2)^2=32$. The $k$ leg can be contacted into the upper vertex 2 ways. The $l$ leg, another 2 ways. Similarly 2 for $i$ and 2 for $j$. There is only one remaining way to contract the legs together in the loop. Finally, we get a factor of $2!$ from the interchange of contractions into the upper and lower vertices. Overall that puts a factor of 32 in the numerator. Thus with the vertex normalized to $ig^2*$(delta functions) we see the symmetry factor for (a) is 1. Diagram (b) is a little different. We get $2!$ from vertex interchange. Leg $k$ can contract in the left vertex 2 ways. Leg i then only has one option. Similarly, 2 for $l$ and 1 for $j$. Then there are 2 ways to contract the internal legs in the loop. We are left with 16 in the numerator, giving the diagram overall a factor of $16/32$=$1/2$. Thus we interpret the remaining 2 in the denominator as the symmetry factor. (3) This is resolved by the minus sign in (1).
{ "domain": "physics.stackexchange", "id": 93480, "lm_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, feynman-diagrams, fermions, interactions", "url": null }
c, linked-list Missing Error Checking There are two places where error checking in this program, first, it is generally a best practice to error check all user input before using the input values. Users can make mistakes when entering data, they may just hit the enter key without entering data, they may enter a string instead of a number, they may enter a number that is not in the list which could cause problems while searching the list. The second place where error checking is necessary is after any memory allocation in the C programming language, some or most high level languages will throw exceptions if memory allocation fails. In C programming if memory allocation fails the call to malloc(), calloc() or realloc() returns NULL. It is very important to check the value returned to make sure it is not NULL before using the memory, access through a NULL pointer causes unknown behavior. This can cause a number of problems including the crashing of the program or the corruption of data in the program. node_t *create_new_node(int val) { node_t *result = malloc(sizeof(node_t)); if (result == NULL) { fprintf(stderr, "malloc failed in create_new_node()\n"); return result; } result->val = val; // Unknown behavior here if malloc() failed result->next = NULL; return result; }
{ "domain": "codereview.stackexchange", "id": 36889, "lm_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, linked-list", "url": null }
python, python-3.x, tree But the question is: what would you like to do if the value to insert is already present? Just let the tree as it is, or insert the value and get it twice in the tree? In the standard binary tree, nodes have a key and a value, and you insert a pair key/value: if the key is already present, the previous value is replaced by the new value. You can create a simplified version where the key is the value value itself, and thus just ignore the duplicate values, or allow duplicate values, but I think the best is to create a regular BST with keys and values since it's as easy as create one with only values. Implementation consistency You do not choose between a recursive implementation and an iterative one: insert, search, get_min/max are iterative while get_height and delete are recursive. For a first implementation, I would use only recursion because it's easier to understand. Once the code works, you can improve the speed by removing recursion if and only if it is mandatory. Misc Double underscores Do not use them as a synonym for private in other OOP languages: Generally, double leading underscores should be used only to avoid name conflicts with attributes in classes designed to be subclassed ~ PEP8 __repr__ For many types, this function makes an attempt to return a string that would yield an object with the same value when passed to eval(), otherwise the representation is a string enclosed in angle brackets that contains the name of the type of the object together with additional information often including the name and address of the object. ~ repr
{ "domain": "codereview.stackexchange", "id": 34197, "lm_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, tree", "url": null }
navigation, rosbag, amcl Here, scan is a dict made by parsing the raw csv data. lsmsg is a LaserScan message, with header.stampassigned to ... Comment by zkytony on 2016-12-18: rospy.Time.from_sec(scan['time_stamp']) as well Comment by ahendrix on 2016-12-19: It looks like you're writing timestamps to the bag file correctly. The localization in your video definitely looks poor. rostopic echo doesn't print timestamps by default, so I'm still don't understand what you're running to observe this timestamp issue. Comment by ahendrix on 2016-12-19: I hope you're not trying to use this to do localization in real time, while the robot is driving. Comment by zkytony on 2016-12-19: Thanks @ahendrix. LaserScan message has a header field, and rostopic echo can display that, isn't it? Because each individual reading is almost unique (lots of decimal digits), I basically used a reading to search for the row for that reading in the csv file. (I read those reading from shell screen) Comment by zkytony on 2016-12-19: Localization for the real robot works pretty well for us, and it's not relevant to the problem here. Here I'm just trying to restore the pose of the robot when the robot collected these data (as you can see from the time stamp, it's several years ago). Comment by zkytony on 2016-12-19: I was wondering if this problem has anything to do with "wheelbase width", because it seems that, besides the strange delay problem, the localization is off when the robot is rotating, but not when it moves in a straight line. But, I don't know how to configure the wheelbase width in my case. Comment by ahendrix on 2016-12-19: That seems like a pretty inexact way to measure the timestamp, and it doesn't make much sense to see rosbag playback producing a timestamp that's different from the input data (the header timestamp should come directly from the recorded message) Comment by ahendrix on 2016-12-19:
{ "domain": "robotics.stackexchange", "id": 26512, "lm_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, rosbag, amcl", "url": null }
mechanical-engineering, applied-mechanics, acceleration mass 10 On the large mass the following equation describes the motion: $$m_{10} \ddot{x}_{10} = F -N-T$$ That can be rearranged to: $$ F = m_{10} \ddot{x}_{10} +N + T = m_{10} \ddot{x}_{10} +m_{2} \ddot{x}_{10|O} + T= m_{10} \ddot{x}_{10} +m_{2} \ddot{x}_{10} +T $$ $$ F = (m_{10} +m_2) \ddot{x}_{10} + T=188 [N] $$
{ "domain": "engineering.stackexchange", "id": 3860, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "mechanical-engineering, applied-mechanics, acceleration", "url": null }
moon-phases Here is an example implementation in JavaScript. As far as an explanation of what all of the contants, etc mean... Sadly there is no deep dark secret explanation guarded by mythical creatures in funny hats who require you to solve puzzles to enter their chamber. Rather, they're just a least squares fit to observations to find the coefficients $a_i$ of a function of the form: $$ f(x) = a_1f_1(x) + a_2f_2(x) + a_2f_2(x) + ... a_if_i(x) $$ For the Delaunay arguments, $f_i(x)$ are just the powers of $T$. For $i$ the $f_i(x)$ are trig functions of integer multiples of the Delaunay arguments. This method has been used in many ephemeris algorithms, most notably VSOP87. Again, it might seem like there's a deep scientific method involved in figuring out which ones to use. But as described in "Synthetic representation of the Galilean satellites' orbital motions from L1 ephemerides", it's largely a matter of performing a Fourier transform to find good candidates, then trying almost every integer multiple of each argument and just picking the one which fits the observations best. Which solution to pick is largely a balance between computational complexity and accuracy over a desired time frame.
{ "domain": "astronomy.stackexchange", "id": 6832, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "moon-phases", "url": null }
audio, dsp-core } When I apply this function to any signal I get nothing resembling a widened stereo version of the input. I've tried applying values from 1 to 4 as the Width and it just sounds distorted. I'm wondering if this code example is only part of the implementation. I can't see how one side of the signal is delayed in the above which seems (to me) to be a critical element of stereo widening? Also I would think that the output of this signal would be required to be mixed with the original input? Are these correct assumptions? Can someone explain what this code is doing and what I must do to get a stereo widening effect from it? This code is splitting a stereo signal with left and right components into a stereo signal with mid and side components, scaling the mid and side components and converting back to left and right components. To convert left (L) and right (R) stereo into mid (M and side (S): $$ M = \frac{L + R}{2} $$ $$ S = \frac{L - R}{2} $$ And back: $$ L = M + S $$ $$ R = M - S $$ The code is scaling the M and S before converting back to L and R. This is a fairly common approach to stereo widening. To widen you reduce M (the bit of signal in common to L and R) and/or increase S (the bit of signal that is the difference between L and R). The less the difference between L and R in the first place, the less effective this technique is i.e. it won't work if L and R are the same (i.e. mono sent to two channels). To widen when L and R are the same generally starts with delaying one channel by a small amount (but is a bit of a psycho-acoustic hack). As to why your sound is distorted is another matter. It is most likely that you are scaling so that L and R are outside the range of values that can be played back over a speaker. Normally digital audio samples are in the range -1 to 1 so if you scale the samples beyond this range you will get clipping/saturation. You won't need to mix it back with the original signal. The concept of dry/wet would be pointless as the stereo width is fully controlling the amount of effect applied to the original audio.
{ "domain": "dsp.stackexchange", "id": 4111, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "audio, dsp-core", "url": null }
fluid-dynamics, cosmology, cosmic-microwave-background Yes you are. A given $k$ roughly corresponds to a given $l$ (ell) only because of the integral: $ \Theta_l(k,\eta_0) = \int_0^{\eta_0} S(k, \eta) j_{l}(k (\eta_0 - \eta)) d\eta$ The peak of the Bessel function is roughly at $ l \approx k(\eta_0 - \eta) $ and $\Theta_l(k,\eta_0)$ gets most of its contribution close to that peak. This way we can roughly associate a given $k$ with a given $l$. But you should not make this association when trying to understand the physics of CMB fluctuations about anything not related to the integral. For Cls the association works, for anything else it will lead you astray. (7) I did not answer why successive higher order moments keep getting smaller. Leave that for another post. (8) The differential equations describing the CMB temperature fluctuations are numerically unstable when the scattering rate between photons and electrons is large. This is fixed by ignoring the moments higher then the dipole with a theoretical justification that a tightly coupled fluid approximation is good enough.
{ "domain": "physics.stackexchange", "id": 11417, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "fluid-dynamics, cosmology, cosmic-microwave-background", "url": null }
image-processing, image-compression, jpeg Title: Does decoding jpeg images uncompresses them? I train a convolutional neural network on compressed jpeg images. I noticed that my code takes pretty much the same amount of space in memory whether I use high quality jpeg images or the same jpeg images but compressed. I know that processing a jpeg image starts by decoding it, so my question is: does 'decoding' a jpeg image uncompresses it? In other words, does a compressed image regain its original size (in bytes) when decoded? Image processing is mostly done on frames. The digital image frame is a rectangular raster of pixels, either in an RGB color space or a color space such as YCbCr. So, as you noticed, you can be sure that your compressed images are decoded to rectangular rasters in your application. Each encoded image file stores with its data the source bitmap size (width and height) and the source color space (pixel format and bitness). When decoding, these parameters are restored. So, irrespective of what lossless/lossy algorithms are used, the sizes (in bytes) of recovered raster rectangles are identical, if both lo-res and hi-res compressed image files are received by encoding the same source bitmap data. EDIT: A "multiresolution" comment fairly corrects my answer, and there is the other explanation why the application may not allocate in CPU memory the entire memory occupied by a source raster: a decoder can use GPU memory. But OP notices that decompressed images take "pretty much the same amount of space in memory" irrespective of encoded image quality. Even with multiresolution, the application can decode the image to source dimensions. Also, code performance dependence on image quality is not part of the question. Still, the "multiresolution" comment is absolutely necessary for completeness.
{ "domain": "dsp.stackexchange", "id": 9111, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "image-processing, image-compression, jpeg", "url": null }
classification, class-imbalance Title: Why does the test set class imbalance influences my model's performance? Considering a balanced training set, I noticed that the results of a classification primarily depend on the class imbalance of the test set. As shown in this article, unless the classes are perfectly separable, the performance (precision & recall) of a model for a given class will always decrease based on the imbalance of the class. Ie: the more the test set is imbalanced, the less the model is capable of classifying the minority class. This means that for any given model, the classification performance will always primarily depend on the balance of the data you are testing it with. How can the imbalance of a test set define the predictive capabilities of my model once it is already trained? Does the performance of a classifier always depend on the class balance of the target population? What is the mathematical reasoning behind this? There is a confusion between the "true" performance of the classifier, which is indeed fixed once the classifier is trained, and the observed performance on a particular test set. The "true" performance can only be estimated, and it should be estimated using a random sample which follows the "true" distribution of the data. Supervised learning always assumes a "true population" and both the training set and test set are supposed to be subsets of this true population. If one uses a the test set with a different distribution then there's no guarantee that the performance will be the same as the true performance. This can be relevant in some experiments, but it's not a proper evaluation of the classifier itself. Intuitively this can be compared to a test given to some students after they have studied some exercises: If the test questions are similar to the questions they studied in the exercises then their mark reflects their true performance, i.e. how well they learned from the exercises. If the professor makes the test with questions which are not seen or rarely seen in the exercises, then the mark is likely to be lower even for the good students.
{ "domain": "datascience.stackexchange", "id": 9921, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "classification, class-imbalance", "url": null }
navigation, navfn, move-base, carrot-planner, baseglobalplanner Title: switching global planner Hi, In nav_core default global planner is navfn, but I want to change it to carrot planner or something else (in future it will be my global planner). What I have to change and where? Originally posted by Jacek on ROS Answers with karma: 11 on 2012-01-19 Post score: 1 Original comments Comment by Jacek on 2012-01-19: It was first thing I've done. Now it looks like this: private_nh.param("base_global_planner", global_planner, std::string("carrot_planner/CarrotPlanner")); You'll have to change the base_global_planner parameter of move_base. See the move_base docs for more details. Originally posted by Eric Perko with karma: 8406 on 2012-01-19 This answer was ACCEPTED on the original site Post score: 4
{ "domain": "robotics.stackexchange", "id": 7938, "lm_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, navfn, move-base, carrot-planner, baseglobalplanner", "url": null }
c++, performance // Swap the old and new State. std::swap(newData, data) std::swap(newSize, size) // Release the old state // Don't need to do anything. // `newData` is a smart pointer and will deallocate // the associated memory in the destructor when it // goes out of scope. So it works even if an exception // is thrown so memory is never leaked. } // Recursively add new arguments. append(arguments...); Pre-Allocating Your way of appending is very inefficient. Each number that you add forces a call to re-allocate memory. If you pre-allocate memory (that is not used immediately) then you can use that up over several items and don't need to re-allocate each time. This means you need to keep another member in your structure (capacity) to remember how much unused space you have. I wrote an article about re-sizeing Template recursion. This is very inefficient way (though the obvious one) to use variable argument templates. I would rather use a loop to capture all the inserts. And do a single resize (if you run out of capacity). template <typename... Args> void DoubleArray::append(Args... arguments) { append(std::initializer_list<double>(arguments...)); } void DoubleArray::append(std::initializer_list<double> const& arguments) { increaseCapacityTo(size + arguments.size()); for(auto const& item: arguments) { // This is probably a private member // You can call it when you have already guaranteed there is // enough space in your array (see call to increaseCapacityTo()) appendNoResize(item); } } PS: Some reading (my Blog) on how to write container like objects and do the memory management correctly.
{ "domain": "codereview.stackexchange", "id": 20497, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, performance", "url": null }
c++, game, console, windows, snake-game void Snake::options() { char selection; system("cls"); while(true) { system("cls"); std::cout << std::endl; std::cout << " Options" << std::endl << std::endl; std::cout << " Choose dificulty <1>" << std::endl; std::cout << " Rules <2>" << std::endl; std::cout << " Credits <3>" << std::endl << std::endl; std::cout << " Go back <4>" << std::endl << std::endl; std::cin >> selection; if(selection=='1') difficulty(); else if(selection=='2') rules(); else if(selection=='3') credits(); else if(selection=='4') return; else system("cls"); } } void Snake::pause() { char c; std::cout << std::endl; std::cout << "Game paused. Press 'p' to return. "; std::cin >> c; if(c=='p') return; } bool Snake::poison_snake(char map[][height],int snake_parts[][height], int x1, int x2, int y1, int y2) { int c = 0;; int x,y; for(x=0;x<width;x++) for(y=0;y<height;y++) if(((x==x1 && y==y1) || (x==x2 && y==y2)) && map[x][y]==char(254)) c=1; if(c==1) return true; else return false; }
{ "domain": "codereview.stackexchange", "id": 11850, "lm_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, console, windows, snake-game", "url": null }
amortized-analysis Title: amortized analysis of max heap Q) Consider an ordinary binary max-heap data structure with n elements that supports insert and extract-max in $O(log(n))$ worst-case time. Give a potential function $\Phi$ such that the amortized cost of insert is $O(log(n))$ and the amortized cost of extract-max is $O(log(n))$, and show that it works. solution The formula of amortized cost is $a_n = c_n + \Phi(D_n) - \Phi(D_{n-1})$ Where the potential function: $\Phi (D_n) = n log(n)$. for insert: $= c_n + \Phi(D_n) - \Phi(D_{n-1}) \leq log(n) + n log(n) - (n-1)log(n-1) \leq 3 log(n+1) = O(log(n))$ So, the amortized cost of insert is $O(log(n))$ extract max: $a_n = c_n + \Phi(D_n) - \Phi(D_{n-1}) \leq log(n) + n log(n) - (n+1)log(n+1) = log(n) + n(log(n)) - n log(n+1) - log(n+1) < 0$ So, the amortized cost of extract-max is $O(1)$
{ "domain": "cs.stackexchange", "id": 13466, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "amortized-analysis", "url": null }
ros2 Originally posted by balazs-bamer on ROS Answers with karma: 15 on 2021-04-02 Post score: 1 Original comments Comment by shonigmann on 2021-04-02: What you are describing sounds more like it would be better accomplished in ROS2 than as a Gazebo plugin... Have you considered trying gazebo_ros2_control for the gazebo joint interfaces? Then you can write a custom controller if you want as a ROS2 package. This library has some tutorials and examples that could help you get started. Comment by balazs-bamer on 2021-04-03: I've seen this package, but I have very little background in ROS and Gazebo, and did not realize why it is good for me. I need the physics from Gazebo. On the other hand, once I've found a CDPR example as a Gazebo plugin (for ROS1) and used it in an older project.I know this works and wanted something similar. This repository has an example of a robot description with a Gazebo plugin and a launch file to spawn them for ROS 2: https://gitlab.com/boldhearts/ros2_boldbot This was used amongst others in this workshop: https://gitlab.com/boldhearts/ros2_workshop Without more info it is difficult to know where you're exactly stuck, but for me the trickiest was to get all the paths set up correctly so that everything was loaded correctly. Note for instance the model path set in the package.xml file of the description package: <export> <build_type>ament_cmake</build_type> <gazebo_ros gazebo_model_path="${prefix}/.." /> </export> , which is then picked up in the launch file using GazeboRosPaths: model_path, plugin_path, media_path = GazeboRosPaths.get_paths()
{ "domain": "robotics.stackexchange", "id": 36269, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros2", "url": null }
acoustics, frequency, software, harmonics The calculation shows that the artifacts should diminish, if you reduce the generated frequency from 55Hz to approximately 54.93Hz. Alternatively you can increase the sampling frequency to 48.06k. However, you cannot change the FFT size just slightly, because it must be a power of 2.
{ "domain": "physics.stackexchange", "id": 43773, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "acoustics, frequency, software, harmonics", "url": null }
range the... Have been using as examples, only f ( x ): ℝ→ℝ be a real-valued function (! Right-Sided, and two-sided cc by-sa that you need to tell me what the$. Well, that will be the positive reals '' that $g ( 0 ) is. Ride across Europe, Dog likes walks do surjective functions have inverses but the answers given below seem to surjective!, yet not bijective, functions have an inverse must be bijective clarification, responding! ): ℝ→ℝ be a real-valued function y=f ( x ) of real-valued! You describe given by the same logic, we can reduce any function 's codomain to its range Force. Go into the function, codomain states possible outcomes and range denotes the actual outcome of domain... The unfortunate conclusion is that terms like surjective and bijective are meaningless unless the domain is basically what can into! = \text { range } ( f ) ( x_2 )$ is precisely set! Force it to be invertible only f ( 0 ) \$, i.e graph of f in at one. “ Post your answer ”, you agree to our terms of service privacy. Should be clear to you??????? ), one-sided inverses not. Access written and spoken language given in the other answer, i.e a law enforcement officer temporarily 'grant his... Be bad for positional understanding it very tiring much by using the injective! To get my point across x+1 from ℤ to ℤ is bijective if it is both one-to-one/injective onto/surjective! Yet not bijective, functions have inverses ( while a few disagree ) will just blocked.
{ "domain": "sandrapassinhas.eu", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.971992481016635, "lm_q1q2_score": 0.846214002149974, "lm_q2_score": 0.870597271765821, "openwebmath_perplexity": 503.0207405431155, "openwebmath_score": 0.6887816786766052, "tags": null, "url": "https://sandrapassinhas.eu/tdc-usa-hvn/ac0dd3-do-surjective-functions-have-inverses" }
python Why do you define a function inline and then just call it? Either get rid of the function or move the function outside of the loop and call it. cmnd = ['ffprobe', '-show_format', '-show_streams', '-pretty', '-loglevel', 'quiet', fpath] Don't needlessly abbreivate, call it command p = subprocess.Popen(cmnd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) print files out, err = p.communicate() print "===============================OUTPUT START: %s ===============================" % files print out See subprocess.check_output. It calls the command returns the string so you can simplify this last but of code. for line in out.split('\n'): line = line.strip() if line.startswith('codec_name='): s = line codec_name = s.split('codec_name=', 1) print "Codec is: %s" % codec_name[1] codec_1 = codec_name[1] Rather then repeating this bunches of times, do something like decoder_configuration = {} for line in out.splitlines(): if '=' in line: key, value = line.split('=') decoder_configuration[key] = value Then all of the pieces of data will be held in decoder_configuration. You can do what you want with it from there.
{ "domain": "codereview.stackexchange", "id": 3294, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python", "url": null }
c++, performance, c++11, collections, skip-list It is unwise to use something like IT as an identifier. All caps (or "screaming snake case") is conventionally assumed to be the domain of the preprocessor. (Granted, anyone defining macros with names like IT deserves whatever grief they get.) You could use It instead. But IT/It is not a very helpful name here. That parameter really represents the iterator's value type. So you could use ValueType. Just as a suggestion, since you're declaring the const-ness with the value type, you don't really need the is_const parameter. That's really just duplicating information. You could do: template <typename ValueType> class iterator_base { using value_type = ValueType; using node_type = std::conditional_t<std::is_const_v<ValueType>, Skip_node const, Skip_node>; // ... }; using iterator = iterator_base<value_type>; using const_iterator = iterator_base<value_type const>; and then you wouldn't have to worry about what iterator_base<value_type const, false> is. iterator_base() : curr{ nullptr } { };
{ "domain": "codereview.stackexchange", "id": 31334, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, performance, c++11, collections, skip-list", "url": null }
biochemistry, molecular-biology, cell-biology, cell-membrane Once you have a firm grasp on that, consider that in order for a hydrophobic molecule to reach a plasma membrane, it must already be solvated by water. The transfer of a hydrophobe from one hydrophillic environment (water) to another (head groups of the phospholipids in the plasma membrane) should be energetically negligible. The limiting step for passive diffusion across a membrane is transfer from the hydrophillic environment of the phospholipid head groups to the hydrophobic environment of their tails. In fact, the rate of diffusion across a plasma membrane increases with hydrophobicity.
{ "domain": "biology.stackexchange", "id": 9290, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "biochemistry, molecular-biology, cell-biology, cell-membrane", "url": null }
ros, talker, ssh, rospy Originally posted by ahendrix with karma: 47576 on 2014-07-29 This answer was ACCEPTED on the original site Post score: 2 Original comments Comment by mattc12345 on 2014-07-30: It seems strange that if I run the listener through ssh on the master, after I set the master URI I can see the listener on the slave rosnode list. But when I try to ping the node, I get this error: ERROR: Unknown host [baxterbox] for node [/listener_6260_1406746344405] Comment by mattc12345 on 2014-07-30: I just tried switching master and slave, and the old process worked. When I try only exporting ROS_MASTER_URI on the slave computer, I get this error in roscore on the ssh of the master: Couldn't find an AF_INET address for [robotics] robotics is the hostname of the slave. Comment by mattc12345 on 2014-07-30: answers.ros.org/question/163556/how-to-solve-couldnt-find-an-af_inet-address-for-problem/ looks like it is a ROS_IP problem then. EDIT: Solved, solution at bottom of answer above. Thanks, ahendrix.
{ "domain": "robotics.stackexchange", "id": 18794, "lm_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, talker, ssh, rospy", "url": null }
algorithms, closure-properties Title: Calculate the number of distinct permutations of length n in the closure of a language I am studying a distance CS course, but there is no tutor available, so I would appreciate your help... Consider the language $S = \{a, aa, ab\}$ How many distinct words of length $n$ will appear in $S^*$? Is there a way to do this without having to "enumerate" $S^*$ until the answer is found? D.W. has shown how to solve the problem in a general setting. Let me show the simplest way for this particular problem. What is $S^*$? $S^*=\{w\in\{a,b\}^*: w\text{ does not contain }bb\text{ and }w \text{ does not start with } b\}$. The description above can be shown, for example, by demonstrating that the right hand side contains $\epsilon, a, aa, ab$ and its concatenation with itself. Recurrence relation Let $f_n$ be the number of words of length $n$ in $S^*$. Then $f_0=1$ and $f_1=1$. Let $w$ be a word of length $n+1$, $n\ge1$. $w$ ends with $a$. Then $w=xa$ for $x\in S^*$ of length $n$. Otherwise, $w$ ends with $b$. Then $w=yab$ for $y\in S^*$ of length $n-1$. The above shows that $f_{n+1}=f_n+f_{n-1}$. So $f_n$ is the famous Fibonacci sequence. Final formula $$f_n=\frac{\left(\dfrac{1+\sqrt5}2\right)^n-\left(\dfrac{1-\sqrt5}2\right)^n}{\sqrt5}$$ Exercise. (One minute or less if you find the shortcut.) How many distinct words of length $n$ appear in $\{a,bb\}^*$?
{ "domain": "cs.stackexchange", "id": 13437, "lm_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, closure-properties", "url": null }
c++, trie This would also be one line using for_each on iterators and passing traversal_trie. void Trie::destroy(Trie_node* root) You won't need destory anymore as a result; also, there's a chance you might not need pointers. static int comp_char(const void* x, const void* y) { const char* c1 = (const char*)x; const char* c2 = (const char*)y; return *(c1) - *(c2); } This is messsy, you are doing useless C style voids and casts and not using C++ overloading. This body would have been something along the line of just the line return c1 < c2; for(i = 0; i < size; ++i) { int len = strlen(word_arr[i]); buffer = new char [len+1]; memcpy(buffer, word_arr[i], len+1); qsort(buffer, strlen(buffer), 1, comp_char); trie->insert_trie_node(buffer, i); delete buffer; } memcpy? Not necessary, std::string allows you to copy the string and not mess with memory.
{ "domain": "codereview.stackexchange", "id": 2715, "lm_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++, trie", "url": null }
coronavirus, immune-system Title: How T-Cell recognizes a cell infected by a virus? According to few articles I read (like BBC about The people with hidden immunity against Covid-19 ): starting out about four or five days after infection, you begin to see T cells getting activated, and indications they are specifically recognising cells infected with the virus,” says Hayday. These unlucky cells are then dispatched quickly and brutally – either directly by the T cells themselves, or by other parts of the immune system they recruit to do the unpleasant task for them – before the virus has a chance to turn them into factories that churn out more copies of itself.
{ "domain": "biology.stackexchange", "id": 10742, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "coronavirus, immune-system", "url": null }
acceleration, relativity, inertial-frames Calculate required acceleration Because the initial forward component of the velocity of both the laser and detector are the same, we can disregard it: $$r=\frac{a\cdot t^2}{2}$$ $$a=\frac{2r}{t^2}=\frac{2\cdot 1\text{m}}{{\left(3.34\cdot 10^{-7}\text{s}\right)}^2}=1.78\cdot 10^{13}\frac{\text{m}}{\text{s}^2}$$
{ "domain": "physics.stackexchange", "id": 44313, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "acceleration, relativity, inertial-frames", "url": null }
c#, .net, sql, wcf Title: Exposing WCF Service with dynamic search operation I have this WCF service providing search functionality - to be used by our client in his web application. There can be any number of search parameters and possible nesting of AND/OR operations. Could you please have a look and share some ideas on if I can make it more client-friendly? <con:Search> <con:clientID>xxx</con:clientID> <con:propertyQueries> <wil:PropertyQuery Id="0"> <wil:PropertyID>DocumentType</wil:PropertyID> <wil:Value>Statement</wil:Value> <wil:Operator>EQUALS</wil:Operator> </wil:PropertyQuery> <wil:PropertyQuery Id="1" AND="0"> <wil:PropertyID>BANK</wil:PropertyID> <wil:Value>HSBC</wil:Value> <wil:Operator>EQUALS</wil:Operator> </wil:PropertyQuery> <wil:PropertyQuery Id="2" OR="1"> <wil:PropertyID>BANK</wil:PropertyID> <wil:Value>BARCLAYS</wil:Value> <wil:Operator>EQUALS</wil:Operator> </wil:PropertyQuery> <wil:PropertyQuery Id="3" AND="0"> <wil:PropertyID>Date</wil:PropertyID> <wil:Value Start="1">11/01/2014</wil:Value> <wil:Value End="1">11/02/2014</wil:Value> <wil:Operator>BETWEEN</wil:Operator> </wil:PropertyQuery> </con:propertyQueries> </con:Search> The values in AND and OR attribute indicates the Id of PropertyQuery to which the condition to be added. For example: <wil:PropertyQuery Id="2" OR="1">
{ "domain": "codereview.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": "c#, .net, sql, wcf", "url": null }
c++, primes, factors Title: Factorize All Numbers Up to a Given Number this post is sort of a continuation of my answer on the following question: Fast Algorithm to Factorize All Numbers Up to a Given Number. As this post explains - We need to factorize all the numbers up to a large N. At first I gave a python solution which was pretty slow (since - you know, python), than I decided to write it in C++. I am not that good with C++ and I would like to have a code review about that answer: #include <math.h> #include <unistd.h> #include <list> #include <vector> #include <ctime> #include <thread> #include <iostream> #include <atomic> #ifndef MAX #define MAX 200000000 #define TIME 10 #endif std::atomic<bool> exit_thread_flag{false}; void timer(int *i_ptr) { for (int i = 1; !exit_thread_flag; i++) { sleep(TIME); if (exit_thread_flag) { break; } std::cout << "i = " << *i_ptr << std::endl; std::cout << "Time elapsed since start: " << i * TIME << " Seconds" << std::endl; } } int main(int argc, char const *argv[]) { int i, upper_bound, j; std::time_t start_time; std::thread timer_thread; std::vector< std::list< int > > factors; std::cout << "Initiallizating" << std::endl; start_time = std::time(nullptr); timer_thread = std::thread(timer, &i); factors.resize(MAX); std::cout << "Initiallization took " << std::time(nullptr) - start_time << " Seconds" << std::endl;
{ "domain": "codereview.stackexchange", "id": 38803, "lm_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++, primes, factors", "url": null }
navigation, mapping, ros-melodic Title: is there some problem when using the 2d map built by slam in uneven ground? I think the 2d map has't the height item. Is there some problem when using the 2d map built by slam in uneven ground? Originally posted by wyfeng2013 on ROS Answers with karma: 19 on 2021-11-19 Post score: 0 There are different solutions to work with uneven grounds while performing SLAM. For example there is ROS package from ANYbotics for elevation mapping: https://github.com/ANYbotics/elevation_mapping The software is designed for (local) navigation tasks with robots which are equipped with a pose estimation (e.g. IMU & odometry) and a distance sensor (e.g. structured light (Kinect, RealSense), laser range sensor, stereo camera). The provided elevation map is limited around the robot and reflects the pose uncertainty that is aggregated through the motion of the robot (robot-centric mapping). Another solution is to use 3D octomap to capture elevation information as well: https://octomap.github.io/ The OctoMap library implements a 3D occupancy grid mapping approach, providing data structures and mapping algorithms You may also look at another ROS package Cartographer. Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations. Originally posted by osilva with karma: 1650 on 2021-11-22 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by wyfeng2013 on 2021-11-23: @osilva Thanks for your very much!
{ "domain": "robotics.stackexchange", "id": 37153, "lm_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, mapping, ros-melodic", "url": null }
homework-and-exercises, newtonian-mechanics, forces, string Title: Finding the acceleration of the system I uploaded a picture with the problem from the textbook and its solution First of all, i understood the solution from the solution manual, but in my solution the only thing that is different is that i choose the positive x direction to be upwards the ramp , which is the oposite direction choosen in the solution manual With said, i got the following equation for the NET force on each box T-m1•g=m1•a T-m2•g•sin55=m2•a Doing the álgebra, i get a=-7.4, which is in the same direction as the a from the solution, but with a different magnitude, so my question is, are my 2 equations above wrong? and shouldn't every choice of coordinate system give us a correct anwser? problem Your sign on one of the $a$'s is wrong. In $T-m_1g=m_1 a$ you assume $a$ positive upwards. In $T-m_2g\sin(55)=m_2a$ you assume $a$ positive upwards along the incline as well. Both can't be possible at the same time. If you choose a positive axis up along the ramp for the latter equation and added up the forces with signs based on that, then the acceleration must be negative. If you chose it down along the ramp, the acceleration would be positive, but the forces would also change signs. So no, the chosen coordinate system doesn't matter, but the signs must be set consistently both throughout all variables within one equation/coordinate system and also across different coordinate systems. Otherwise you have set up an impossible/unphysical situation which will only give you correspondingly impossible/unphysical answers.
{ "domain": "physics.stackexchange", "id": 42727, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "homework-and-exercises, newtonian-mechanics, forces, string", "url": null }
ros, turtlebot, ros-kinetic, turtlebot-bringup I have reinstalled turtlebot package more than thrice. I am still facing this issue. I have create_node package installed. All the three files (turtlebot_node.py,kinect_breaker_enabler.py,load_calib.py) are present in /opt/ros/kinetic/lib/create_node folder. When I move these files from lib folder to share/create_node I get below error: [turtlebot_node-4] process has died [pid 5091, exit code 1, cmd /opt/ros/kinetic/share/create_node/turtlebot_node.py --respawnable cmd_vel:=mobile_base/commands/velocity turtlebot_node/sensor_state:=mobile_base/sensors/core imu/data:=mobile_base/sensors/imu_data imu/raw:=mobile_base/sensors/imu_data_raw __name:=turtlebot_node __log:=/home/nvidia/.ros/log/ca2facc4-1432-11e8-91f4-00044b8c7fdc/turtlebot_node-4.log]. log file: /home/nvidia/.ros/log/ca2facc4-1432-11e8-91f4-00044b8c7fdc/turtlebot_node-4*.log Any help with this issue is really appreciated. Thanks in advance Originally posted by samiksha on ROS Answers with karma: 1 on 2018-02-17 Post score: 0 You should not modify the setup.bash file. You need to source both of the setup.bash files of your distribution and your workspace. Please see the tutorial on the creating a catkin workspace. Originally posted by jayess with karma: 6155 on 2018-02-17 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by samiksha on 2018-02-19: Okay. I have reverted the changes.
{ "domain": "robotics.stackexchange", "id": 30072, "lm_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, turtlebot, ros-kinetic, turtlebot-bringup", "url": null }
particle-physics, nuclear-physics, quantum-spin Title: Orbital angular momentum of nucleus? For nuclei, I know that it is the $J^{\pi}$ that is usually measured/calculated, which is the spin-parity. I don't see "orbital angular momentum" of a nucleus very often. Now my notion of spin vs. orbital angular momentum is that spin is entirely instrisic, while orbital angular momentum is more of a classical characteristic (by movement/orbit in a bit more of a literal sense). Do nuclei even have orbital angular momentum? Is their magnetic moment-like properties only derived from its spin-parity, or am I mistaken? What's really throwing me off is that spin is always in half-integer units, whereas orbital angular momentum is 'always' in whole-integer units. For a famous example of a nucleus with internal orbital angular momentum, consider the deuteron. Considerations of exchange symmetry, spin, and isospin demand that the deuteron have unit spin, rather than zero spin. However the pion-nucleon interaction, gleaned from neutron-proton scattering and deuteron formation, suggests that about 4% of the deuteron wavefunction is $D$-wave, with orbital angular momentum $L=2$. (The $P$-wave component, with $L=1$, would have negative parity, $(-1)^L$; the deuteron's parity is positive.)
{ "domain": "physics.stackexchange", "id": 21680, "lm_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, nuclear-physics, quantum-spin", "url": null }
electromagnetism, electric-circuits, electricity, electromagnetic-induction Title: Does the induced EMF depend on the rate if change in the total flux affecting the coil or the external flux only? If we get a coil which is put in a changing magnetic field that increases at a constant rate, then it is known that this increase in magnetic field induces an EMF, now if the circuit is closed then this EMF creates an induced current that flows in the coil. This induced current - like any other current - creates a magnetic field around the coil. Does this magnetic filed due to the induced current interact with the external magnetic field that changes at a constant rate, hence, changing the total rate of change in magnetic flux affecting the coil and hence affecting the induced EMF value? --Or-- Does the induced EMF value depend on the rate of change of the external field and not the rate of change of total flux? The induced EMF depends upon the rate of change of the total flux, and not just the externally applied flux. If a current present in a wire, that current induces a magnetic field. If the current is varying the magnetic field induced by the current will vary. That varying magnetic field will in turn induce an EMF. That is the basis for the phenomenon known as self-inductance. When a coil of wire is used as an inductor in an electric circuit, it's principle of operation is self-inductance. When a voltage is applied across the terminals of the (stand-alone) coil, current begins to flow. However, that current creates a changing magnetic field, which causes an EMF to be created which opposes the originally applied voltage. The result is that the current in the coil/inductor rises over time rather than suddenly. So, once again, the EMF induced in a coil depends not only on an externally applied changing magnetic field, but upon the total magnetic field, including that created by the changing electric current in the coil.
{ "domain": "physics.stackexchange", "id": 86739, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electromagnetism, electric-circuits, electricity, electromagnetic-induction", "url": null }
general-relativity, differential-geometry, tensor-calculus, curvature, clifford-algebra Title: Weyl Tensor in Geometric Algebra In Gravity, Gauge theories and Geometric Algebra, p.39, they derive the Weyl Tensor in the following manner:
{ "domain": "physics.stackexchange", "id": 93424, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "general-relativity, differential-geometry, tensor-calculus, curvature, clifford-algebra", "url": null }
ros, turtlebot, asus Title: Running ros-diamondback-turtlebot (or anything, really) on the Eee 1215N We bought an Asus 1215N Eee PC with the intention of rebuilding our Turtlebot on it. Bizarrely, I can't get the default build of Ubuntu 10.04 to work correctly; in particular, the Broadcom wireless NIC and the Atheros Fast Ethernet interface are not supported. Ubuntu (including the kernel) are now up to date with the software update. After fighting with it, I used a USB stick and my Mac to download the common-wireless drivers. I can build for the Atheros and Broadcom devices, but I can only make one of them work at a time. Once I got FastE working with common-wireless, I tried to install the default Broadcom hardware drivers... that didn't work either. The driver is active but I am unable to connect to any wi-fi network. Isn't the 1215N the exact machine that Willow Garage is distributing? If so, does anybody know if a) Asus changed the hardware; or b) there's a simple way to get both network interfaces working at the same time? Originally posted by Alaina on ROS Answers with karma: 121 on 2011-07-25 Post score: 0 We have updated the ISO to include support for the Asus 1215N-PU27 as well as the 1215N-PU17. Give it a try with the new version. mailing list post Originally posted by tfoote with karma: 58457 on 2011-08-04 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 6247, "lm_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, turtlebot, asus", "url": null }
$$^1$$From the wording of the question alone, you can deduce that the only possible answers are (a) and (b), since "the length is less than that of a second's pendulum" or less than 2 seconds, since we know that the period of a simple pendulum is proportional to $$l^{\frac 12}$$. And one could have even deduced the correct answer from this information alone. The equation you quoted is a transpose of the equation $$\frac 1T=\frac 1T_1-\frac 1T_2$$ and by adding $$\frac{1}{18}$$ and $$\frac 12$$ $$(=\frac{9}{18})$$ to each other and then just flipping the fraction to get 1.8 seconds. • I get why 1.8 seconds is an answer; I'm asking whether 0.9 seconds is also an answer or not, and if not, why not? Apr 3 at 9:52 • It can't be the correct answer because you are already told that one pendulum has a period of two seconds, then you are asked to calculate the period of the other pendulum. It's not an answer, it's the only answer. Apr 3 at 9:54 • Could you please justify that without directly using the formula? On trying it manually, $0.9$ seconds seems to work for me Apr 3 at 10:09 • I agree this answer doesn’t explain why answer a. is invalid. Another answer clarifies succinctly. Apr 3 at 21:22 • But why can there be only one possible answer? An assertion is not the same as an explanation. Apr 3 at 23:33 Let's look at the equations $$x_1(t)=\sin\left(\frac{2\pi}{T_1}\,t\right)\\ x_2(t)=\sin\left(\frac{2\pi}{T_2}\,t\right)$$ for $$~t=T~$$ is $$~x_1(T)=0~$$ only if
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9808759632491111, "lm_q1q2_score": 0.8997601331384014, "lm_q2_score": 0.9173026629768591, "openwebmath_perplexity": 462.6578848021551, "openwebmath_score": 0.7544134855270386, "tags": null, "url": "https://physics.stackexchange.com/questions/701918/does-this-question-have-two-answers-correct" }
forces, potential-energy, conventions, vector-fields, conservative-field Title: Can anyone tell me how does conservative forces work? Confused From vector calculus, I'd learnt that a conservative vector field satisfies $$ \textbf{F} = \boldsymbol{\nabla} g $$ which $\textbf{F}$ is the gradient of some scalar-valued function, and $g$ is the function. But in physics, I see someone saying "definition of conservative forces is that is there exists a scalar function $V$ for a field $\textbf{F}$ which satisfies this condition" $$ \textbf{F}=- \boldsymbol{\nabla} V$$ Why does a negative sign exist and why does $\textbf{F} = \boldsymbol{\nabla} g$ in the first place? I don't want to take it as it be. Thanks a lot. The answer is very simple: if $\vec{F}$ is a conservative vector field, then $\vec{G} = -\vec{F}$ is also a conservative vector field. So mathematically, the choice to include the minus sign or not doesn't change anything. But physically, the minus sign is important because it lets the physical quantities match our physical intuition. When we write $\vec{F} = -\nabla V$, we mean physically that the force $\vec{F}$ arises from a potential energy function $V$. Intuitively, we like to think that such a force pushes from high to low potential energy -- think about how gravity causes an object to fall from high to low gravitational potential energy, or a spring pushes a block from high to low elastic potential energy. Since $\nabla V$ is a vector that points in the direction of the sharpest increase in $V$, then $\vec{F} = -\nabla V$ pushes the object in the direction of the sharpest decrease in $V$.
{ "domain": "physics.stackexchange", "id": 78700, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "forces, potential-energy, conventions, vector-fields, conservative-field", "url": null }
special-relativity, coordinate-systems, group-theory, rotation \begin{equation} \mathrm R= \begin{bmatrix} R_{11} & R_{12} & R_{13} \vphantom{\dfrac{\tfrac{a}{b}}{\tfrac{a}{b}}}\\ R_{21} & R_{22} & R_{23}\vphantom{\dfrac{\tfrac{a}{b}}{\tfrac{a}{b}}}\\ R_{31} & R_{32} & R_{33} \vphantom{\dfrac{\tfrac{a}{b}}{\tfrac{a}{b}}} \end{bmatrix}= \begin{bmatrix} \Lambda_{11}-\dfrac{\Lambda_{14}\Lambda_{41}}{\Lambda_{44}+1} & \Lambda_{12}-\dfrac{\Lambda_{14}\Lambda_{42}}{\Lambda_{44}+1} & \Lambda_{13}-\dfrac{\Lambda_{14}\Lambda_{43}}{\Lambda_{44}+1} \vphantom{\dfrac{\tfrac{a}{b}}{\tfrac{a}{b}}}\\ \Lambda_{21}-\dfrac{\Lambda_{24}\Lambda_{41}}{\Lambda_{44}+1} & \Lambda_{22}-\dfrac{\Lambda_{24}\Lambda_{42}}{\Lambda_{44}+1} & \Lambda_{23}-\dfrac{\Lambda_{24}\Lambda_{43}}{\Lambda_{44}+1} \vphantom{\dfrac{\tfrac{a}{b}}{\tfrac{a}{b}}}\\
{ "domain": "physics.stackexchange", "id": 76221, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "special-relativity, coordinate-systems, group-theory, rotation", "url": null }
A: 3/40000 B: 1/3600 C: 9/2000 D: 3/20000 E: 1/15 How do we decide whether the solution is 60/1000 * 1/800 = 3/40,000 OR 60/1000 * 1/800 * 2 = 3/20,000 There are 6 cards numbered from 1 to 6. They are placed into a box, and then one is drawn and put back. Then another card is drawn and put back. If the sum of the two cards was 8, what is the probability that one of the cards drawn was a 5? * 1 * $$\frac{2}{3}$$ * $$\frac{1}{2}$$ * $$\frac{2}{5}$$ * $$\frac{1}{3}$$ This has yet another method to calculate!! Manager Joined: 25 Aug 2009 Posts: 175 Location: Streamwood IL Schools: Kellogg(Evening),Booth (Evening) WE 1: 5 Years Followers: 11 Kudos [?]: 161 [8] , given: 3 ### Show Tags 20 Oct 2009, 13:46 8 KUDOS Answer to the first question - 0.3*0.3*0.7 is equivalent to saying the the first person picks candy and second person picks candy and third person doesn't pick candy. however this is a different case compared to 0.3*0.7*0.3 is equivalent to saying the the first person picks candy and second person doesn't pick candy and third person picks candy. which in turn is a fifferent case compared to 0.7*0.3*0.3 (I'll skip the verbose comments) Answer to the second question - Probability of picking a sibling from the junior class is 60/1000 and Probability of picking the corresponding sibling from the senior class is 1/800. However in this case if we flip the case we still end up with the same sibling pair since the order is not important. Hence we don't multiply by 2 Answer to the third question - We just list the various cases where the sum will be 8 6 2 2 6 5 3 3 5 4 4 Total = 5 5 occurs in 2 cases. hence prob is 2/5. _________________
{ "domain": "gmatclub.com", "id": null, "lm_label": "1. Yes\n2. Yes\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 1, "lm_q1q2_score": 0.8705972751232809, "lm_q2_score": 0.8705972751232809, "openwebmath_perplexity": 1810.2808087801413, "openwebmath_score": 0.6559093594551086, "tags": null, "url": "http://gmatclub.com/forum/the-probability-that-a-visitor-at-the-mall-buys-a-pack-of-85523.html" }
java, memory-management, factory-method setMessageParser(schema.getMessageFormat()); // Strategy pattern return messageParser.parse(msg, schema); } private static void setMessageParser(MessageFormat msgFormat) { // Strategy pattern messageParser = ParserFactory.getMessageParser(msgFormat); // Factory pattern } private static void setSchemaParser(SchemaFormat configFileFormat) { // Strategy pattern schemaParser = ParserFactory.getSchemaParser(configFileFormat); // Factory pattern } } Factory: public class ParserFactory { private static final XMLSchemaParser XML_SCHEMA_PARSER = new XMLSchemaParser(); private static final FixedLengthStringMessageParser FIXED_LENGTH_STRING_MESSAGE_PARSER = new FixedLengthStringMessageParser(); private ParserFactory() {} // imitating a static class public static MessageParser getMessageParser(MessageFormat msgFormat) { switch (msgFormat) { case FIXED_LENGTH_STRING: return getFixedLengthStringMessageParserInstance(); default: return null; } } public static SchemaParser getSchemaParser(SchemaFormat schemaFormat) { switch (schemaFormat) { case XML: return getXmlSchemaParser(); default: return null; } } private static XMLSchemaParser getXmlSchemaParser() { return XML_SCHEMA_PARSER; } private static FixedLengthStringMessageParser getFixedLengthStringMessageParserInstance() { return FIXED_LENGTH_STRING_MESSAGE_PARSER; } } I've been suggested to wrap all of the parsers inside the enums like so: enum SchemaFormat { XML(new XMLSchemaParser()); final SchemaParser schemaParser; SchemaFormat(SchemaParser schemaParser) { this.schemaParser = schemaParser; } }
{ "domain": "codereview.stackexchange", "id": 26797, "lm_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, memory-management, factory-method", "url": null }
c++, parsing, tcl Title: tcl script to parse C++ source code for type identifiers Experimenting with vera++ to validate some C++ source files. https://bitbucket.org/verateam/vera/wiki/Home vera++ is expandable by providing your own rules in tcl. To interface with the vera++ parser the following interface is provided: https://bitbucket.org/verateam/vera/wiki/ScriptAPI Using the above I have written a rule to look for type identifiers and validate that they have an initial uppercase letter. #!/usr/bin/tclsh # Check that Type identifiers have an initial uppercase letter. # namespace TypeName # class TypeName # struct TypeName # enum TypeName { EnumTypeName1, EnumTypeName2 } # # Will ignore `using clauses` # using <Stuff> ; # # Thus when "using" stuff from other namespace we don't check (as they don't belong to us) # Also it allows you to convert any external types to local names. # # #include <sys/socket.h> # #include <sys/types.h> # // STUFF # sockaddr_in serv_addr; # // STUFF # if (::connect(socket, reinterpret_cast<struct sockaddr*>(&serv_addr), sizeof(serv_addr)) < 0) # ^^^^^^^^^^^^ this fails. # But you can write it like this: # # using SockAddr = struct sockaddr; // Allowed because >using <stuff>;< is ignored. # if (::connect(socket, reinterpret_cast<SockAddr*>(&serv_addr), sizeof(serv_addr)) < 0) #
{ "domain": "codereview.stackexchange", "id": 19363, "lm_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++, parsing, tcl", "url": null }
### Limit Comparison Test $$\displaystyle{ a_n = \frac{\abs{\sin(n)}}{n^3+n+1} }$$ For large $$n$$ the $$n^3$$ term dominates in the denominator and $$\abs{\sin(n)} \leq 1$$. So let's compare this series with the test series $$\sum{t_n}$$ where $$\displaystyle{t_n = \frac{1}{n^3} }$$. Since $$t_n$$ is a p-series with $$p=3$$, the test series converges. The limit comparison test requires us to set up the limit $$\displaystyle{ \lim_{n \to \infty}{\frac{a_n}{t_n}} }$$. $$\begin{array}{rcl} \displaystyle{\lim_{n \to \infty}{\frac{a_n}{t_n}}} & = & \displaystyle{\lim_{n \to \infty}{ \frac{\abs{\sin(n)}}{n^3+n+1} \frac{n^3}{1} }} \ & = & \displaystyle{\lim_{n \to \infty}{ \frac{\abs{\sin(n)}}{1+1/n^2+1/n^3} }} \end{array}$$ This last limit does not exist since the limit of the numerator does not exist. So the limit comparison test cannot be used to prove convergence or divergence. ### Direct Comparison Test $$\displaystyle{ a_n = \frac{\sin(n)}{n^3+n+1} }$$
{ "domain": "17calculus.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9790357549000774, "lm_q1q2_score": 0.8158545701955023, "lm_q2_score": 0.8333245911726382, "openwebmath_perplexity": 255.00699556235594, "openwebmath_score": 0.8753803372383118, "tags": null, "url": "https://17calculus.com/infinite-series/practice/2435/" }
Conversely, when $(q-1)^2=0$, it is easy to prove the relation by induction: $$q^0=1$$ $$q^{n+1}=q(1+n(q-1))=nq^2-q(n-1)=1+(n+1)(q-1)$$ There is also a direct proof by seeing that $q^n=(1+(q-1))^n=\sum_{i=0}^n \tbinom{n}{i} (q-1)^i=1+n(q-1)$. Application: in $\mathbb Z/25\mathbb Z$, if $q=4^2$, $(q-1)^2=15^2=0$, so $4^{2n}=1+15n$, or equivalently $4^{2n}+10n-1=0$. - More generally one has (implicit in my answer) $$\rm \dfrac{f(x)-f(a)}{x-a}\, \equiv\, f{\,}'(a)\pmod{x-a}$$ –  Bill Dubuque Jun 8 '12 at 17:34 It's true (and a very nice equality!), but I was especially interested in the reciprocal of the theorem, which only makes sense when $a=1$. –  Generic Human Jun 8 '12 at 18:02
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9802808724687407, "lm_q1q2_score": 0.8082042628477941, "lm_q2_score": 0.824461932846258, "openwebmath_perplexity": 229.4529277411665, "openwebmath_score": 0.9371822476387024, "tags": null, "url": "http://math.stackexchange.com/questions/155637/prove-that-42n-10n-1-is-a-multiple-of-25" }
javascript, beginner '</td><td class="text-center">' + newMessage['args']['info'][controller]['data']['dynamic']['phase3'] + '</td><td class="text-center">' + newMessage['args']['info'][controller]['data']['dynamic']['phase4'] + '</td></tr></tbody></table></span>'); }
{ "domain": "codereview.stackexchange", "id": 18239, "lm_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", "url": null }
Can you find a four by four arrangement with no rectangle? • Thank you very much for your answer. I have found such a four by four arrangement. – michaelhowes Jun 5 '17 at 12:34 The number of points occupied by a colour in a given column implies that a certain number of possible pairings have been produced, for possible matching to the same pair in another column. So with $\{0,1,2,3,4,5,6\}$ points of a single colour you have $\{0,0,1,3,6,10,15\}$ pairings respectively. For a six-by-six rectangle, there are $\binom 62 = 15$ possible pairings in a column. As soon as one colour has enough entries to accumulate $16$ pairings from its column entries, as above, there will be a matched pairing between columns giving the monochrome rectangle. Between the two colours, once total pairings reaches $31$ there will be a monochrome rectangle. Splitting the colours evenly ($3$ each) produces the lowest net pairings of $6$ per column, but clearly with six columns we have at least $36$ net pairings and must have a monochrome rectangle. For a five-by-six rectangle, using the same arguments, we have $\binom 52 = 10$ possible pairings per column and at least $4$ net pairings per column, reaching at least $24(>2{\times} 10)$ net pairings by the sixth column and the certainty of a monochrome rectangle. For a five-by-five square, one colour will have at least $13$ entries which you can show leads to at least $11$ pairings across the $5$ columns:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.986777179414275, "lm_q1q2_score": 0.8723497813958908, "lm_q2_score": 0.8840392741081575, "openwebmath_perplexity": 187.22312882671133, "openwebmath_score": 0.505984365940094, "tags": null, "url": "https://math.stackexchange.com/questions/2310558/two-colouring-of-a-6-by-6-grid-without-a-monochromatic-rectangle" }
cosmic-microwave-background Title: Relationship between the cosmic microwave background (CMB) radiation and the visible universe I know that the cosmic microwave background radiation (CMBR) is the leftover radiation from the Big Bang. Have we been able to make a concrete map of the radiation and the objects in the visible universe? (Something like "this point in the CMBR map evolved into this particular region of the visible universe".) Sadly we can't do that. What we see of the CMB is a different part of the Universe, the galaxy clusters that have evolved from the clumps that we see in the CMB are beyond our capability to see (they are farther away than it would take light to travel since their creation). Theoretically we will eventually see those galaxies if we keep observing for a few billion more years (as well as other parts of the CMB). For now our studies relating structure in the CMB to galaxy formation are entirely based on modelling and statistics.
{ "domain": "physics.stackexchange", "id": 3126, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "cosmic-microwave-background", "url": null }
quantum-mechanics, quantum-information, probability Title: Why can we predict any experimental outcome, given a probability density over quantum states? There is a very interesting answer given by Peter Shor in this website here. However, I admit I don't fully understand it. In particular, I don't understand: If we have a probability density μv on quantum states v, we can predict any experimental outcome from the density operator What is the formula given? Is it $\operatorname{trace}{\left(\rho A\right)}$ for an observable $A$? a probability distribution on quantum states is an overly specified distribution, and it is quite cumbersome to work with How can we work with the density operator if, from an experimental point of view, all we can measure is the probability distribution? From your question, it sounds like you've learned about observables but maybe not von Neumann measurements and POVMs. In my previous answer, when I mentioned "experimental outcome", I was referring to these types of measurement. If you want to understand my previous answer completely, you probably should learn about them. For your first question, the expectation valuable of an observable $A$ on a density matrix $\rho$ is indeed $\mathrm{Tr}\, (\rho A)$. For the second question, if you can prepare a mixed quantum state (represented by a density matrix) repeatedly, you can measure the density matrix by doing quantum state tomography on it. If you only have one instance of a quantum state, you can't even get a probability distribution by measuring it ... you just get one measurement outcome. The probability distribution I referred to in my previous answer is a probability distribution that the OP was asking about. This is related to how the state was prepared, and you can't measure this probability distribution even if you can prepare arbitrarily many copies of the quantum state.
{ "domain": "physics.stackexchange", "id": 52923, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, quantum-information, probability", "url": null }
c#, https, azure-cosmosdb detailedDataResponse = (JObject)productList["articlesList"][selectedIndex]; } } singleDocument.SetPropertyValue("DetailedData", detailedDataResponse); singleDocument.SetPropertyValue("InventoryData", inventoryData); singleDocument.SetPropertyValue("consumer", "akqa"); } } formattedList.Add(Newtonsoft.Json.JsonConvert.SerializeObject(singleDocument)); } } return formattedList; } } static public async Task<JObject> DataFetcher(string apiUrl, string fetchType) { try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiUrl); request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; request.UserAgent = "Test"; request.ContentType = "application/json; charset=utf-8"; request.Method = fetchType; request.Proxy = null; using (HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync()) using (Stream stream = response.GetResponseStream()) using (StreamReader reader = new StreamReader(stream)) { string apiReturnStr = await reader.ReadToEndAsync(); JObject apiReturnObjectJobject = JObject.Parse(apiReturnStr); return apiReturnObjectJobject; } } catch (WebException e) { JObject emptyObject = null; return emptyObject; } }
{ "domain": "codereview.stackexchange", "id": 36408, "lm_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#, https, azure-cosmosdb", "url": null }
concurrency, go, lock-free // Recv blocks until a value is available and returns v, true, or if the channel is closed and // the buffer is empty, it will return nil, false func (ch Chan) Recv(block bool) (interface{}, bool) { if !block && ch.Len() == 0 { // fast path return nilValue, false } ln, cnt := uint32(len(ch.q)), uint32(0) for !ch.Closed() || ch.Len() > 0 { if ch.Len() == 0 { if !block { return nilValue, false } runtime.Gosched() continue } i := atomic.AddUint32(&ch.recvIdx, 1) if v, ok := ch.q[i%ln].SwapWithNil(); ok { atomic.AddUint32(&ch.rlen, 1) return v, true } if block { if i%250 == 0 { pause(1) } } else if cnt++; cnt == ln { break } runtime.Gosched() } return nilValue, false } Out of order bug It appears that there could be a case where the items inserted into the channel can be read out of order. From reading your test code, it seems that you want to maintain a FIFO ordering, so I am guessing this is unwanted behavior. Here's the sequence of events that can trigger the behavior:
{ "domain": "codereview.stackexchange", "id": 19221, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "concurrency, go, lock-free", "url": null }
electrical-engineering \varepsilon_{6} & = E_1 d_{16} + E_2 d_{26} + E_3 d_{36} \end{align} $$ In matrix form, $$ \begin{bmatrix} \varepsilon_{1} \\ \varepsilon_{2} \\ \varepsilon_{3} \\ \varepsilon_{4} \\ \varepsilon_{5} \\ \varepsilon_{6} \end{bmatrix} = \begin{bmatrix} d_{11} & d_{21} & d_{31} \\ d_{12} & d_{22} & d_{32} \\ d_{13} & d_{23} & d_{33} \\ d_{14} & d_{24} & d_{34} \\ d_{15} & d_{25} & d_{35} \\ d_{16} & d_{26} & d_{36} \end{bmatrix} \begin{bmatrix} E_1 \\ E_2 \\ E_3 \end{bmatrix} $$ or $$ [\boldsymbol{\varepsilon}] = [\mathbf{d}]^T [\mathbf{E}] $$ where $$ [\mathbf{d}] = \begin{bmatrix} d_{11} & d_{12} & d_{13} & d_{14} & d_{15} & d_{16} \\ d_{21} & d_{22} & d_{23} & d_{24} & d_{25} & d_{26} \\d_{31} & d_{32} & d_{33} & d_{34} & d_{35} & d_{36} \end{bmatrix} $$ Double to triple index map From the above we see that, in Abaqus, the matrix $[\mathbf{d}]$ is $$ \begin{align}
{ "domain": "engineering.stackexchange", "id": 2117, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electrical-engineering", "url": null }
python, game, interface, callback Note that these bugs would have been easy for you to spot had you actually finished writing the game and tried to run it. Inserting an item at the beginning of a list: self.tail.insert(0, (x, y)) takes time proportional to the length of the list (see the TimeComplexity page on the Python wiki). It would be better to use a collections.deque and call the appendleft method. This line of code: game_field = set([(x, y) for x in range(self.width) for y in range(self.height)]) doesn't need the list comprehension, as you can pass a generator expression directly to set: game_field = set((x, y) for x in range(self.width) for y in range(self.height)) This avoids constructing a list and then immediately throwing it away again. You can further simplify that line of code using itertools.product: from itertools import product game_field = set(product(range(self.width), range(self.height))) In _new_food_location you convert possible into a list so that you can call random.choice on it. But if you used random.sample instead, you wouldn't have to do that. In _new_food_location you build a set containing every location in the game not occupied by the snake. It would be better to build this set just once per game, and keep it up to date as the snake moves. In detail, in reset you'd write something like: self.growth_pending = 0 self.empty = set(product(range(self.width), range(self.height))) self.empty.remove(self.head) self.empty.difference_update(self.tail) (Note the use of difference_update to avoid having to convert self.tail to a set.) In _move_snake you'd write something like: self.tail.appendleft(self.head) self.head = newX, newY self.empty.remove(self.head) if self.growth_pending: self.growth_pending -= 1 else: self.empty.add(self.tail.pop())
{ "domain": "codereview.stackexchange", "id": 5437, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, game, interface, callback", "url": null }
machine-learning, python, classification, cross-validation, pipelines and sample data in semicolon-separated format: Src;Text;Type;Target A99;hi i love python very much;c;1 B07;which programming language should i learn;b;0 A12;what is the difference between python django flask;b;1 A21;i want to be a programmer one day;c;0 B11;should i learn java or python;b;1 C01;how much can i earn as a programmer with python;a;0 c01;hello <FLAG> <FLAG> I m from france i enjoyed this lecture thank u very much HEAVY BLACK HEART HEAVY BLACK HEART HEAVY BLACK HEART HEAVY BLACK HEART;b;1 ssa;hi hola salut <FOREIGN> <FOREIGN> <FOREIGN> <FOREIGN> SMILING FACE WITH HALO HEAVY BLACK HEART CLINKING GLASSES <FLAG> <FLAG>;a;1 This can be solved by simply changing the method that is called within transform to the transform method of the vectorizer. In addition you would also have to add a call to fit within the fit method to make sure that the vectorizer is actually fitted before being used to transform any data: class Vectorizer(BaseEstimator, TransformerMixin): def __init__(self, vectorizer:Callable=CountVectorizer(), ngram_range:tuple=(1,1)) -> None: super().__init__() self.vectorizer = vectorizer self.ngram_range = ngram_range def fit(self, X, y=None): print(f">>> Vectorizer.fit() called with vectorizer={self.vectorizer} and ngram_range={self.ngram_range}.") self.vectorizer.fit(X) return self def transform(self, X, y=None): print(f">>> Vectorizer.transform() called with vectorizer={self.vectorizer} and ngram_range={self.ngram_range}.") X_ = X.copy() X_vect_ = self.vectorizer.transform(X_) X_vect_ = X_vect_.toarray() return X_vect_
{ "domain": "datascience.stackexchange", "id": 10404, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "machine-learning, python, classification, cross-validation, pipelines", "url": null }
frequency, downsampling, nyquist Title: The relationship between downsampling and frequency resolution I am having trouble understanding a concept that I have seen in many published papers. For example, in this paper (http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0082748) they wrote in their methods that to "obtain adequate frequency resolution we downsampled from 44.1 kHz to 8 kHz". My understanding is that the sample rate is how many times (per second) the actual sound wave was "sampled", and that the maximum frequency that can be detected is 1/2 the sampling rate (or the Nyquist frequency). So by downsampling, you will lose the ability to detect higher frequencies, and in a sense downsampling acts as a sort of filter, as it gets rid of the higher frequency sounds from the recording. This makes sense to do if your signal of interest is at lower frequencies, but I still don't understand how this gives "adequate frequency resolution". Does downsampling have any influence on the ability to detect lower frequencies? What do they mean by "frequency resolution"? Thank you so much in advance! Your understanding is correct. I don't have the full text of the paper, but it sounds like they aren't being very precise with their description. As you pointed out, downsampling doesn't improve frequency resolution in and of itself, it merely reduces the amount of bandwidth that can be represented unambiguously. However, I can take a guess at what they were referring to. Assuming they are using a DFT for spectral analysis (the common choice), note that the fact that for a given DFT size $N$, the output bin spacing is a function of the sample rate: $$ f_{res} = \frac{f_s}{N} $$
{ "domain": "dsp.stackexchange", "id": 3757, "lm_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, downsampling, nyquist", "url": null }
python, comparative-review, serialization Title: Convenience function to save and load pickle objects I want to come up with a simple convenience function to save and load pickle objects. A secondary objective is to simply execute the function without the above function. I have come up with two versions so far. Just want some opinions, which of the following will be better from a software engineering point of view. Or more pythonic. If possible please suggest a still better version, with changed parameter names or something already out there. def test(filename, func, exec_only=False, ignore_file=False, **kwargs): if exec_only: obj = func(**kwargs) else: fname = Path(filename) if fname.exists() and not ignore_file: obj = jl.load(filename) else: obj = func(**kwargs) jl.dump(obj, fname, compress=True) return obj Another version: def test2(filename, func, exec_only=False, ignore_file=False, **kwargs): if Path(filename).exists() and not ignore_file and not exec_only: obj = jl.load(filename) else: obj = func(**kwargs) if not exec_only: jl.dump(obj, fname, compress=True) return obj Thanks a lot in advance. EDIT: I created this function as a machine learning utility, since execution is typically very costly and the decision to execute is dependent on the presence of the file. I will be incorporating some features from Sam's answer. Thanks. A few general tips:
{ "domain": "codereview.stackexchange", "id": 37280, "lm_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, comparative-review, serialization", "url": null }
quantum-field-theory, lagrangian-formalism, renormalization, propagator, effective-field-theory $$\int\mathcal{L} = \frac{1}{2} \int_{b\Lambda \leq |k| < \lambda} \frac{d^dk}{(2\pi)^d} \hat{\phi}^*(k)k^2\hat{\phi}(k). \tag{12.7}$$ This is where I begin to become confused. They state that (12.7) leads to a propagator, but how? Furthermore, by keeping the remaining $\hat{\phi}$ terms in (12.5) as perturbations, they claim that one can use this propagator along with Wick's theorem to determine their contributions. They somehow get some Feynman diagrams out of this approach. What exactly is going on here? I'm hoping that I can follow the rest of the chapter once I understand what they are doing in these early steps. Also, are there another resources available to learn Wilsonian renormalization and the renormalization group from that covers similar material? More specifically, these are my questions:
{ "domain": "physics.stackexchange", "id": 94450, "lm_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, lagrangian-formalism, renormalization, propagator, effective-field-theory", "url": null }
newtonian-mechanics, forces, classical-mechanics Title: Calculating the force We've just started with the topic "Forces in Mechanics" in Physics, so my knowledge so far regarding Forces is restricted to the three Newton's axioms. I was given the following problem A $300g$ hammer with an initial speed of $4\frac{m}{s}$ hits a nail $5mm$ deep in the wood. Determinate the force $F_{H\to N}$ that the hammer exerts to the nail. My approach so far It is a well-known fact that $$F[N]=m[kg]·a\bigg[\frac{m}{s^2}\bigg]$$ Here we know that $m=0,3kg$ and that $v_{init}=4\frac{m}{s}$ . However, how should I determine the acceleration? Any help is accepted;) We know the energy of hammer has turned into the work and moved the nail by 5mm into the wall. Energy of the hammer is $E = \frac{1}{2}mv^2$. And the work done by the force F is $W = F*x $ So there you go.
{ "domain": "physics.stackexchange", "id": 55558, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, forces, classical-mechanics", "url": null }
sql, sql-server, t-sql /* deduplication variables: */ declare @val1Deduplicator char(1); declare @val2Deduplicator char(1); /* table to hold result set until end of query: */ declare @resultSet table (val1 char(1), val2 char(1)); while @i <= @max begin /* assign values to deduplicate across columns: */ select /* inversion between val1 and val2 happens here: */ @val1Deduplicator = val2, @val2Deduplicator = val1 from @holdingTable where rownum = @i; /* verify we are not inserting a duplicate: */ if not exists ( select 1 from @resultSet where val1 = @val1Deduplicator and val2 = @val2Deduplicator ) /* if confirmed not a duplicate, insert the values from the current row: */ begin insert into @resultSet (val1, val2) select val1, val2 from @holdingTable where rownum = @i; end; /* increment loop: */ set @i = @i + 1; end; /* obtain the final results: */ select * from @resultSet; The performance seems OK for this few records, but it's not set-based and might get really slow for a large number of records. Is there a smarter way to do this? Is there anything else I can improve? Output is correct: val1 val2 ---- ---- A B A C B C (3 row(s) returned) If val1 and val2 are comparable it is easy to find the distinct values, using set-based operations, by normalizing first and then taking distinct rows. Given: CREATE TABLE [TestTable] ( [TestID] INT NOT NULL IDENTITY(1,1), [Value1] NCHAR(1) NOT NULL, [Value2] NCHAR(1) NOT NULL, )
{ "domain": "codereview.stackexchange", "id": 18540, "lm_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, t-sql", "url": null }
reference-frames, moment-of-inertia, linear-algebra Title: Diagonalization of inertia tensor Imagine a part with an inertia matrix $I$. This matrix is symmetric and thus can be diagonalized. This means that a base $B$ exists where the $I$ matrix is diagonal (i.e $I=BDB^{-1}$), which is actually eigen vectors or $I$ This also means that a rotation matrix $R$ exists such that the part get its principal axes aligned with $x$, $y$ and $z$ Are $B$ and $R$ actually the same thing? If yes, why? If no, how can $R$ be found? The answer is yes. To understand why, recall that the inertia matrix is the matrix of the linear function that maps the angular velocity vector to the angular momentum vector: $$\vec{L} = I\,\vec{\omega}\tag{1}$$ Now rotate the co-ordinate basis, so that the components of $\vec{L}$ and $\vec{\omega}$ transform like $\vec{L}^\prime = R\,\vec{L}$ and $\vec{\omega}^\prime = R\,\vec{\omega}$. Now plug these equations (in the form $\vec{L} = R^{-1}\,\vec{L}^\prime$, $\vec{\omega} = R^{-1}\,\vec{\omega}^\prime$) into (1) to show that, in these co-ordinates, the inertia matrix must have elements given by: $$I^\prime = R\,I\,R^{-1}\tag{2}$$ Next, we witness that $I$ is a symmetric, real matrix; therefore its eigenvalues are all real, therefore its eigenvectors are all real and:
{ "domain": "physics.stackexchange", "id": 33006, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "reference-frames, moment-of-inertia, linear-algebra", "url": null }
gazebo <cast_shadows>0</cast_shadows>\ </visual>\ </link>\ <static>0</static>\ </model>\ </sdf>"); sdf::ElementPtr model = modelSDF.Root()->GetElement("model"); for(int i=1; i<=this->num_particles; i++) { //do other stuff }
{ "domain": "robotics.stackexchange", "id": 4340, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "gazebo", "url": null }
c++, simulation, pthreads Title: Vehicle-crossing simulation It seems like this code should be shorter, but with all the error checking it is long and hard to follow. This is for a simulation of vehicles crossing a bridge, and this part is dealing with mutexes. I tried extracting a function that is passed the mutex and locks/unlocks it and prints any errors, but when I did that it broke the code (it's been my experience on this site to not include any broken code so I won't elaborate on what I tried). /*global variables*/ pthread_mutex_t Bridge = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t okToOutput = PTHREAD_MUTEX_INITIALIZER; /*...*/ /*this is the function that gets passed to pthread_create()*/ void* startSim(void *arg) { Vehichle* inData = (Vehichle*)arg; if(usleep(inData->sleepT1)) cerr << "Vehichle " << inData->licencePlate << " failed to sleep" << endl; if(pthread_mutex_lock(&okToOutput)) cerr << "failed to lock output" << endl; cout << "Vehichle " << inData->licencePlate << " is ready to go " << dirToStr(inData->direction) << endl; if(pthread_mutex_unlock(&okToOutput)) cerr << "failed to unlock output" << endl;
{ "domain": "codereview.stackexchange", "id": 10286, "lm_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++, simulation, pthreads", "url": null }
earth, solar-system, gravity, jupiter Title: Why is every year the same number of days despite the gravity in the solar system? I was just watching a Geoff Marcy talk on YouTube showing how they infer the presence of planets transiting distant stars. The supposed periodicity wasn't always quite regular from what I could see, and so I wondered if there might be something tugging at the planets as they orbit their star. Then I thought of the earth: Surely there are some years when we are aligned with Jupiter so much so that it would exert some sort of perceptible influence on the planet, thus lengthening the year, even if only by some hours or days, considering that the sun is much more massive. And what would happen every few thousand (?) million (?) years when all the planets and even some of the larger asteroids, Kuiper Belt Objects - everything but the kitchen sink - come into alignment? Wouldn't the earth be drawn outwards to some extent, thus making a year perhaps 370 days long (or whatever)? And maybe temperatures would drop with the planet a fraction of an AU farther from the sun? I know that this is a website for the already enlightened, but I would appreciate an answer that even Josephine Bloggs would understand. Derived from this paper the interval between March equinoxes for 1989/1990 has been 4 minutes 28 seconds longer than the corresponding interval for 1987/1988. So the length of a year can vary several minutes, e.g. by gravitational effects of other planets. For calendars a mean year is used. Atomic clocks run far more precise than the more or less periodic motion of Earth. All planets aligned don't cause anything grave. A similar kind of sysygy has been 1982.
{ "domain": "astronomy.stackexchange", "id": 4872, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "earth, solar-system, gravity, jupiter", "url": null }
thermodynamics ENERGY BALANCE $$\frac{dU}{dt}=-\dot{m}_{out}h_V-\dot{Q}$$where$$U=m_Lu_L+m_Vu_V$$and $h_V=u_V+Pv_V$ is the enthalpy per unit mass of the vapor. So, $$\frac{dU}{dt}=-\dot{r_e}u_L+(r_e-\dot{m}_{out})u_V=-\dot{m}_{out}h_V-\dot{Q}$$In addition, the volume of liquid in the pot plus the volume of vapor in the pot must away add up to the (constant)total pot volume $V_P$: $$m_Lv_L+m_Vv_V=V_P$$or $$\frac{dm_L}{dt}v_L+\frac{dm_V}{dt}v_V=-\dot{r_e}v_L+(r_e-\dot{m}_{out})v_V=0$$where $v_L$ is the specific volume of the liquid and $v_V$ is the specific volume of the vapor. If we combine the above equations and solve for the vaporization rate, we obtain simply $$\dot{r}_e=-\frac{dm_L}{dt}=\frac{\dot{Q}}{\Delta h_{vaporization}}=\frac{Q}{h_V-h_L}$$with$$h_V=u_V+Pv_V$$and$$h_L=u_L+Pv_L$$ This rate of liquid water vaporization is exactly what we would expect. In addition, $$\dot(m)_{out}=\left(1-\frac{v_L}{v_V}\right)\dot{r}_e$$
{ "domain": "physics.stackexchange", "id": 95574, "lm_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", "url": null }
# Number of rolls with m many n-sided dice 1. Feb 29, 2008 ### mathboy [SOLVED] Number of rolls with m many n-sided dice How many different rolls are there with m many n-sided dice, if order is not important? If order was important, the answer would simply be n^m. But if order is not important? If two 6-sided dice are rolled, there are C(6,2)+C(6,1) = 21 different rolls. If three 6-sided dice are rolled, there are C(6,3)+C(6,1)C(5,1)+C(6,1) = 56 different rolls. Is there a general method for rolling m many n-sided dice? Or do you have to continue adding up all the cases? Perhaps a general method involving a matrix with m indices (e.g. a tensor) and simply excluding all permutations of the indices? Last edited: Feb 29, 2008 2. Feb 29, 2008 ### e(ho0n3 Wouldn't it be n^m/m!? For example, say you have a black die and a red die, both 6-sided. The number of possible rolls is 6^2. If you ignore the color of the dice, then you have to divide by 2. 3. Feb 29, 2008 ### mathboy No. The number of rolls with 2 six-sided dice (if order is unimportant) is 21, not 18. Rolls with doubles are not being counted twice if order is considered important. 4. Feb 29, 2008 ### e(ho0n3 Oh that's right. Sorry about that. I don't know of a general method. I'm thinking that you would first have to count the number of rolls where all dice show the same side, then for m-1 dice showing the same side, then for m-2 dice, etc. 5. Feb 29, 2008 ### mathboy That's exactly what I did in my opening post. But it gets awkward after a while (e.g. for 7 dice, you can have 2 doubles and 1 triple). I'm looking for a better method that gives a single formula for arbitrarily values of m and n, e.g. m^n minus something.
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9910145701859179, "lm_q1q2_score": 0.8792326864985249, "lm_q2_score": 0.8872046011730965, "openwebmath_perplexity": 1372.3795343939735, "openwebmath_score": 0.5238118767738342, "tags": null, "url": "https://www.physicsforums.com/threads/number-of-rolls-with-m-many-n-sided-dice.218931/" }
visible-light, biophysics, vision A material absorbing "green" light looks purple, for the impression see the overlapping sections in the following picture. The first image shows what happens if you overlay luminous light (additive colors), the second image shows what happens if you mix paint (subtractive colors). First image taken from en.wikipedia.org by SharkD, Public Domain; second image taken from de.wikipedia.org by Quark67 CC BY-SA 2.5 If I mix the pigments of paints, each component will absorb its wavelength component(s). In case of "blue" paint mostly "red" light is absorbed, in case of "yellow" paint mostly "blue" light is absorbed, so the dominant remaining color is green. This is the exact reason plants are looking green because plants are mainly absorbing "red" and "blue" light; plant lights are emitting therefore mainly "red" and "blue" light, the color of a plant light looks purple. If every component is absorbed, mixing yellow, purple and cyan together should give black. In real-life you get a dark brown because the pigments are not mixing perfectly so a color tint is remaining. For that reason we use black ink in our printers for printing grey or black.
{ "domain": "physics.stackexchange", "id": 32585, "lm_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, biophysics, vision", "url": null }
ros, libuvc-camera, uvc-cam discrete: 416x240: 1/30 1/25 1/20 1/15 1/10 2/15 discrete: 640x360: 1/30 1/25 1/20 1/15 1/10 2/15 discrete: 800x448: 1/30 1/25 1/20 1/15 1/10 2/15 discrete: 800x600: 1/30 1/25 1/20 1/15 1/10 2/15 discrete: 848x480: 1/30 1/20 1/15 1/10 2/15 discrete: 960x544: 1/30 1/25 1/20 1/15 1/10 2/15 discrete: 960x720: 1/30 1/25 1/20 1/15 1/10 2/15 discrete: 1280x720: 1/30 1/25 1/20 1/15 1/10 2/15 discrete: 1920x1080: 1/30 1/25 1/20 1/15 1/10 2/15 discrete: 640x480: 1/30 1/25 1/20 1/15 1/10 2/15 int (Brightness, 0, id = 980900): -64 to 64 (1) int (Contrast, 0, id = 980901): 0 to 50 (1) int (Saturation, 0, id = 980902): 0 to 100 (1) int (Hue, 0, id = 980903): -100 to 100 (1) bool (White Balance Temperature, Auto, 0, id = 98090c): 0 to 1 (1) int (Gamma, 0, id = 980910): 100 to 300 (1) menu (Power Line Frequency, 0, id = 980918): 0 to 2 (1) 0: Disabled 1: 50 Hz 2: 60 Hz int (White Balance Temperature, 16, id = 98091a): 2800 to 6500 (10) int (Sharpness, 0, id = 98091b): 0 to 10 (1) int (Backlight Compensation, 0, id = 98091c): 0 to 1 (1) menu (Exposure, Auto, 0, id = 9a0901): 0 to 3 (1)
{ "domain": "robotics.stackexchange", "id": 28940, "lm_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, libuvc-camera, uvc-cam", "url": null }
organic-chemistry, hydrocarbons, conformers Title: All-Gauche Alkane: Is It Possible? I've learned about anti and gauche conformations throughout my scholastic journey, and I have heard often that straight-chain alkanes always adopt an all-anti conformation in their lowest energy state. I also know that, in a pure sample of any given straight-chain alkane, (eg. hexane) the anti and gauche conformations are in a certain equilibrium with each other, And that this ratio of gauche to anti shifts towards gauche as the available energy of the sample (i.e. temperature/heat/ pressure) approaches infinity. My question is as follows: Has anyone in the scientific community to date successfully forced an entire sample of straight-chain alkanes into the all-gauche conformation without significantly raising the conditions above STP? I have scoured the internet but have not surfaced with a definitive answer, so I now turn to the scientific community. All contributions are greatly appreciated. At Last! Success! I found this research paper, which describes a "Self-assembling nanocapsule", which is held together by plenty of hydrogen bonding, and can assemble around a linear molecule of all-anti tetradecane, $\ce{(C14H20)}$ using the energy afforded by the hydrogen bonding to squeeze/twist the alkane into a helical all-gauche conformation. Have a look: Cool, right? Sources: Scarso A, Trembleau L, Rebek J Jr. Helical folding of alkanes in a self-assembled, cylindrical capsule. J Am Chem Soc. 2004 Oct 20;126(41):13512-8. PubMed PMID: 15479107. Note: Other answers are still greatly appreciated!
{ "domain": "chemistry.stackexchange", "id": 13506, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "organic-chemistry, hydrocarbons, conformers", "url": null }
it in the figure below: need. In this case, we ’ ll say the base and height, SSS, ASA, SAS SSA. Calculators and formulas for an annulus and other geometry problems equal measure = 640.2 * 0.923 other problems... Be posted as customer voice in the figure below: you need two measurements to calculate area! Length of horizontal sides into length 1 and Width 2 over to the point. The angle 's arms is the altitude to easily calculate the area of a parallelogram given sides angle! For each calculation 53.35 * 12 * sin ( a ) parallelogram area calculator without height.! A, b, \theta\rightarrow s ) \\ may be posted as customer voice, then area... 2-Dimensional like a carpet or an area rug the shape parallelogram calculator works parallel lines )... Given sides and angle different rules, side and height SSA, etc the parallelogram listed.! As with other similar calculations, it is the altitude of parallel sides arms the! Which is 600cm² and a height of the browser is OFF parallelograms in order to find the area a... Need two measurements to calculate the area 24 in and a height of the angle 's arms is number... Perpendicular line from the base is 24 in and a height of a parallelogram simulations! ( 53.35 + 12 ) = 2 ( 53.35 + 12 ) = 640.2 * 0.923 rules side... Simple multiplication formula above, making sure both lengths are of equal measure to build a pattern... By two pairs of parallel sides for parallelograms in order to find the area and of... A carpet or an area rug this calculator to easily calculate the area a. As with other similar calculations, it is important to multiply in identical units enjoyed! You for your questionnaire.Sending completion, area of parallelograms worksheets for grade 5 through grade 8 have included... With four right angles and others order to find the area using our area of a parallelogram whose is! = 53.35 * 12 * sin ( a, b, \theta\rightarrow s ) \\ to.. Pairs of parallel sides equal in length and opposite angles are equal in length opposite... Horizontal sides into length 1
{ "domain": "cykelfabriken.se", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.971129090546975, "lm_q1q2_score": 0.881117285070338, "lm_q2_score": 0.907312213841788, "openwebmath_perplexity": 922.1200568129765, "openwebmath_score": 0.7760113477706909, "tags": null, "url": "http://cykelfabriken.se/methyl-nrb/parallelogram-area-calculator-without-height-fb35c6" }
ros, message-filters, message /opt/ros/hydro/include/message_filters/synchronizer.h:290:5: instantiated from ‘void message_filters::Synchronizer<Policy>::connectInput(F0&, F1&, F2&, F3&, F4&, F5&, F6&, F7&, F8&) [with F0 = message_filters::Subscriber<coop_est::FeatureBArray_<std::allocator<void> > >, F1 = message_filters::Subscriber<nav_msgs::Odometry_<std::allocator<void> > >, F2 = message_filters::NullFilter<message_filters::NullType>, F3 = message_filters::NullFilter<message_filters::NullType>, F4 = message_filters::NullFilter<message_filters::NullType>, F5 = message_filters::NullFilter<message_filters::NullType>, F6 = message_filters::NullFilter<message_filters::NullType>, F7 = message_filters::NullFilter<message_filters::NullType>, F8 = message_filters::NullFilter<message_filters::NullType>, Policy = message_filters::sync_policies::ExactTime<coop_est::FeatureBArray_<std::allocator<void> >, nav_msgs::Odometry_<std::allocator<void> >, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType>]’
{ "domain": "robotics.stackexchange", "id": 20098, "lm_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, message", "url": null }
javascript, animation, data-visualization, d3.js Title: D3js: transition from stacked bar chart to bar chart with different datasets Could I get some advice on the following D3 code that transitions a stacked bar chart into a bar chart with two different datasets? I would like to know how to write cleaner and more efficient code. And could you also check if the enter, update, exit pattern is being used correctly? var value = 'stack'; var data = [{ name: "Shihuahuaco", value: 1067, china: 772 }, { name: "Cachimbo", value: 283, china: 1 }, { name: "Estoraque", value: 204, china: 150 }, { name: "Cumala", value: 154, china: 0 }, { name: "Ishpingo", value: 108, china: 3 }, { name: "Huayruro", value: 108, china: 1 }, { name: "Tornillo", value: 61, china: 4 }, { name: "Congona", value: 54, china: 0 }, { name: "Capirona", value: 37, china: 5 }, { name: "Tahuari", value: 33, china: 14 }, { name: "Marupa", value: 33, china: 1 }, { name: "Quinilla", value: 28, china: 4 }, { name: "Azucar huayo", value: 22, china: 15 }, { name: "Protium sp.", value: 19, china: 0 }, { name: "Nogal", value: 15, china: 6 }, { name: "Ana Caspi", value: 14, china: 2 }, { name: "Cedro", value: 14, china: 0 }, { name: "Carapa guianensis", value: 12, china: 0 }];
{ "domain": "codereview.stackexchange", "id": 28679, "lm_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, animation, data-visualization, d3.js", "url": null }
java, converting ConversionPath currentPath = visited.get(unit1); // If unit1 and unit2 are the same, then we've reached the destination, return the path so far if (unit1.equals(unit2)) { return currentPath; } // Find all possible conversions one level deep from this unit Set<Conversion> possibleConversions = conversionMap.get(unit1); int minLength = Integer.MAX_VALUE; ConversionPath smallestPath = null; // Loop through each conversion for (Conversion conversion : possibleConversions) { ConversionPath path = visited.get(conversion.getUnitName()); // If going to the unit through this unit is shorter than what was previously there // then search for the destination from that unit if (path == null || path.pathLength() > currentPath.pathLength() + 1) { // Update the path on the other unit, because there is now a shorter way to get there visited.put(conversion.getUnitName(), currentPath.addUnit(conversion.getUnitName())); // Get the path from the new unit to the destination unit ConversionPath newPath = getConversionPath(conversion.getUnitName(), unit2, visited); // If such a path exists and its length is less than the shortest length so far // update the shortest path and smallest length if (newPath != null && newPath.pathLength() < minLength) { minLength = newPath.pathLength(); smallestPath = newPath; } } } return smallestPath; }
{ "domain": "codereview.stackexchange", "id": 9656, "lm_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, converting", "url": null }
cc.complexity-theory, reference-request, graph-theory, np-hardness, csp Title: What is known about the H-factor problem? Background The $\mathcal{H}$-factor problem (a.k.a. the degree prescribed factor problem, or the degree prescribed subgraph problem) is defined as follows: Given a graph $G=(V,E)$ and a set $H_v \subseteq \mathbb{N}$ for each vertex $v \in V$, does $G$ contain a spanning subgraph $F$ such that $\operatorname{deg}_F(v) \in H_v$ for all $v \in V$? (I would also say that $H_v \in \mathcal{H}$ for all $v \in V$, but I have never seen it stated this way. Thus, the $\mathcal{H}$-factor problem is defined by $\mathcal{H}$ and the input is a graph $G=(V,E)$ and a mapping $f : V \to \mathcal{H}; v \mapsto H_v$.) A spanning subgraph is also known as a factor, hence the name. This framework of problems captures many classic problems. For example, when $H_v = \{1\}$ for all $v \in V$, the problem is to determine if $G$ contains a perfect matching, also called a 1-factor. Question What is currently known about the complexity of this problem for different $\mathcal{H}$? What about the special case when $\mathcal{H}$ is a singleton set (so $H_v$ is the same for all $v \in V$)? Strongest Results I Know Tractability: If each set in $\mathcal{H}$ does not contain two consecutive gaps, then the $\mathcal{H}$-factor problem is in P (Cornuejols 1988). A integer $h$ is a gap in $H \subseteq \mathbb{N}$ if $h \not\in H$ but $H$ contains an element less than $h$ and an element greater than $h$.
{ "domain": "cstheory.stackexchange", "id": 1589, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "cc.complexity-theory, reference-request, graph-theory, np-hardness, csp", "url": null }
entanglement, textbook-and-exercises, density-matrix A_1^*A_2 B_1^*B_2 & A_2A_1^* |B_2|^2 & |A_2|^2B_2B_1^* & |A_2|^2 |B_2|^2 \\ \end{pmatrix}$$ And therefore, $|\psi \rangle \langle \psi |= \rho_A \otimes \rho_B$
{ "domain": "quantumcomputing.stackexchange", "id": 2660, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "entanglement, textbook-and-exercises, density-matrix", "url": null }
slam, navigation, kinect, rgbd6dslam, bagfiles Title: Minimal Topics for RGBDSLAM? I'd like to record some bag files of Kinect data and then run RGBDSLAM on them later. (The computer I'm doing the collection with isn't up to doing the RGBDSLAM itself.) The problem is that I want to keep the bag files as small as possible, so I want to collect the minimal amount of data necessary. In particular, that means I would like to record to the bag file the smallest number of topics possible, and preferably only image topics and the like -- PointCloud2 messages are quite large in comparison. Can someone tell me exactly which topics are necessary for running RGBDSLAM off a bag file, and walk me through how to get RGBDSLAM to use only them? (Also, I'm a little confused about whether I should be using the dynamic_reconfigure reconfigure_gui to turn on OpenNI's depth registration or not...) I thought I needed only RGB and depth image and possibly camera info topics, but when I tried running RGBDSLAM off of only those, it kept saying it was waiting for various other things. I think maybe I just need to change the parameters in the launch file to tell it that those are the only things I want it to work with, but I can't figure out how to do that properly. Any help would be greatly appreciated! :) Edit: As a specific example of one of the things I've tried, I ran the following: $ rosbag record /camera/depth_registered/image_rect_raw /camera/rgb/image_rect_color /camera/rgb/camera_info I then ran the RGBDSLAM GUI and pressed the space key. The status bar displayed: Processing. Waiting for motion information. I then started playback of the bag file. Nothing changed. Edit 2: I followed Felix's directions, and everything worked swell... except for one problem. The depth images were not registered with the RGB images, so the textures in the resulting map were all incorrect.
{ "domain": "robotics.stackexchange", "id": 8681, "lm_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, kinect, rgbd6dslam, bagfiles", "url": null }
quantum-mechanics, thermodynamics, thermal-radiation \end{align} \tag{4}$$ Here you see, the integral stays finite, because the integrand quickly approaches $0$ at large frequencies $\nu$. By evaluating the integral you arrived at the Stefan-Boltzmann law, in accordance with experimentally observed reality.
{ "domain": "physics.stackexchange", "id": 89240, "lm_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, thermodynamics, thermal-radiation", "url": null }
ros, gazebo, gazebo-plugin <maintainer email="wilmer@todo.todo">wilmer</maintainer> <license>TODO</license> <buildtool_depend>catkin</buildtool_depend> <build_depend>roscpp</build_depend> <build_depend>rospy</build_depend> <build_depend>gazebo_ros</build_depend> <build_depend>std_msgs</build_depend> <build_depend>geometry_msgs</build_depend> <run_depend>roscpp</run_depend> <run_depend>rospy</run_depend> <run_depend>gazebo_ros</run_depend> <run_depend>std_msgs</run_depend> <run_depend>geometry_msgs</run_depend> <!-- The export tag contains other, unspecified, tags --> <export> <!-- Other tools can request additional information be placed here --> </export> </package> Originally posted by wilmer with karma: 1 on 2017-01-04 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 4031, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros, gazebo, gazebo-plugin", "url": null }
organic-chemistry, nomenclature, alcohols P-44.1 SENIORITY ORDER FOR PARENT STRUCTURES When there is a choice, the senior parent structure is chosen by applying the following criteria, in order, until a decision is reached. These criteria must always be applied before those applicable to rings and ring systems (see P-44.2) and to chains (see P-44.3). Then criteria applicable to both chains and rings or ring systems given in P-44.4 are considered. P-44.1.1 The senior parent structure has the maximum number of substituents corresponding to the principal characteristic group (suffix) or senior parent hydride in accord with the seniority of classes (P-41) and the seniority of suffixes (P-43). (…) Therefore, the correct name for the compound given in the question is ‘1-cyclohexylpropan-2-ol’ (not: ‘(2-hydroxypropyl)cyclohexane’). (Note that in ‘(2-hydroxypropyl)cyclohexane’, the locant ‘1’ of ‘1-(2-hydroxypropyl)cyclohexane’ is omitted since, according to Subsection P-14.3.4.2, the locant ‘1’ is omitted in monosubstituted homogeneous monocyclic rings.) If there is still a choice (for example, if the ring and the chain each have a substituent corresponding to the principal characteristic group), the ring or the chain can be the senior parent structure; however, for the preferred IUPAC name, the ring is always selected as the senior parent structure.
{ "domain": "chemistry.stackexchange", "id": 5390, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "organic-chemistry, nomenclature, alcohols", "url": null }
read-mapping, reads, identifiers Title: Does read sequence identifier need to be unique for proper alignment? I am preprocessing a set of scTHSSeq reads in which each read sequence identifier has been replaced with the cell barcode, e.g.: @CGAGGCTG_TATCCTCT_AGTCCA ... ... ... @CGAGGCTG_TATCCTCT_GGTACG ... The read sequence identifier has been replaced with the cell barcode to be able to demultiplex alignments after bwa into a different bamfile for each cell. I ran the alignment using bwa mem and I received no errors. However I would like to know if there are caveats or reasons why this approach may lead to misleading results. I will then proceed to remove PCR duplicates with samtools rmdup executed in each cell's bamfile and then I'd run peak calling using spp. What tool did you use to replace the read names? Can you modify that to split up the reads into separate files or encode the cell barcode in the read description instead of the read name? Typically is it assumed by many tools that the FASTQ read names are unique. you could have issues with BWA and split alignments but I don't know if that pertains to your data. I think the best you can do is the sanity check the results at each step of the process. In the fastq format (https://en.wikipedia.org/wiki/FASTQ_format) on the first line denoted by the '@' there can be two values separated by a space. The first is the name and the second is the description. So an example would be: @Original_read_name CGAGGCTG_TATCCTCT_AGTCCA ATCGATCATGATGACA + @&%*@(%@%*($!##!
{ "domain": "bioinformatics.stackexchange", "id": 738, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "read-mapping, reads, identifiers", "url": null }
python, pandas, object-detection, geospatial bounding box area: measure the number of pixels in the bounding box (this assumes the fish also didn't change orientation drastically, as fishes are pretty flat so the area from the side will be very different from the area from the front. You could consider using the longest side of the bounding box to mitigate this color composition: create a binned RGB histogram from all the pixels in the fish (ideally you would have access to a finer segmentation than just a bounding box to make it less sensitive to the background color) You could also use feature descriptors such as SIFT, AKAZE, etc... But it all comes down to the same two steps: find a good way to compare any pair of objects across frames make an optimal decision about how to match them across frames and how to decide which are missing The second part will always be a linear sum assignment problem. So the only thing now is that the scipy version doesn't offer the option to specify the unassignedTrackCost or unassignedDetectionCost like the Matlab version does. And this is actually what will allow you to handle fishes appearing or disappearing the way the Matlab version does. So you will need to modify it. Looking at the picture below, you now have the costMatrix and you need to build the bigger matrix to be able to handle the cases when fish appear or disappear. Once you have managed to create the full cost matrix you can solve it using linear_sum_assignment and then find the tracks (resp. detections) that were assigned to dummy detections (resp. tracks). Implementation Getting the Cost matrix (distance only) import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from scipy.spatial.distance import cdist from scipy.optimize import linear_sum_assignment def transform(df): df["centroid_x"] = (df["xmax"] + df["xmin"]) / 2 df["centroid_y"] = (df["ymax"] + df["ymin"]) / 2 return df
{ "domain": "datascience.stackexchange", "id": 11530, "lm_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, pandas, object-detection, geospatial", "url": null }
pressure, ideal-gas, kinetic-theory Title: Why we take time between consecutive collisions on the same wall in derivation of pressure exerted by ideal gas on container by one molecule? My doubt is why we take time between two consecutive collision $2L/v_{x}$ on the same wall if distance between two parallel face of wall is $L$ instead of the time molecule takes to hit the wall and rebound which is very very small say $t^{'}$ which is almost instantaneous while calculating the pressure exerted by an ideal gas on container. I think when molecule collides with the wall in case of elastic collision it starts to move in opposite direction so change in momentum is $-2mv_{x}$ but according to the conservation of momentum change in momentum of wall(or momentum imparted as written in my book) is $2mv_{x}$ then force on the wall is $$2mv_{x}/t^{'}$$ but in my book it is given as $$mv^2_{x}/l$$ and I know this is right but I want to know why and what it actually mean by momentum imparted ?
{ "domain": "physics.stackexchange", "id": 75040, "lm_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, ideal-gas, kinetic-theory", "url": null }
radiation, topology, topological-field-theory, duality, cosmic-string Title: Kalb-Ramond action and topological string radiation Let's have simple scalar $\Phi$ action involves spontaneously symmetry breaking in a form $$ \tag 1 S = \int d^{4}x\left( |\partial_{\mu}\psi|^{2} + \psi^{2}|\partial_{\mu}\theta |^{2} - \frac{\lambda}{4} (\psi^{2} - v^{2})^{2}\right) $$ It is usual higgs-like action where complex scalar field is represented in a form $\Phi = \psi e^{i\theta}$. E.o.m. generated by $(1)$ implies string-like solutions $$ \tag 2 \Phi = vf(r)e^{in\varphi}, \quad f(0) = 0, \quad f(\infty ) = 1 $$ ($r, \varphi$ denote polar coordinates). From substituting $(2)$ in $(1)$ and calculating of stress-energy tensor follows that strings have nonzero tension, thus they have to radiate. One says (see, for example, this article, p.5, section "Dual representation...") that by using duality relation $$ \tag 3 \psi^{2}\partial_{\mu}\theta = \frac{1}{2}f_{a}\epsilon_{\mu \nu \alpha \beta}\partial^{\nu}B^{\lambda \rho} $$ one provides analytical description of radiation of $\theta $ bosons by string-like solutions $(2)$.
{ "domain": "physics.stackexchange", "id": 23123, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "radiation, topology, topological-field-theory, duality, cosmic-string", "url": null }
quantum-mechanics, homework-and-exercises, mathematical-physics, symmetry (* the subscript $0$ meant measure at time $t=0$) Your text instructs you to heed "with a suitable choice of the time origin". Certainly not to nullify the extra term $$A_0 t\equiv \frac{t}{m} \langle \{(p-\langle p\rangle_0),( x-\langle x\rangle_0) \}\rangle_0 $$ you correctly found. Instead, to absorb it into a shifted time variable. To wit, from your original $$(\Delta X)^2 _t=\frac{1}{m}(\Delta p)_0^2~t^2+(\Delta X)_0^2 +A_0 ~t,$$ pick a time $\tau$, so $$(\Delta X)^2 _\tau=\frac{1}{m}(\Delta p)_0^2~\tau^2+(\Delta X)_0^2 +A_0 ~\tau,$$ which you may subtract from the above to get $$(\Delta X)^2 _t -(\Delta X)^2 _\tau =\frac{1}{m}(\Delta p)_0^2~(t^2 -\tau^2)+A_0 ~(t-\tau)\\ = \frac{1}{m}(\Delta p)_0^2~(t -\tau ) ^2 + \left ( \frac{2\tau}{m}(\Delta p)_0^2 +A_0\right ) ~(t-\tau) . $$ You then solve for $\tau$ to nullify the big parenthesis, $$
{ "domain": "physics.stackexchange", "id": 52113, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, homework-and-exercises, mathematical-physics, symmetry", "url": null }
quantum-field-theory, particle-physics, charge, standard-model, electroweak -\sqrt{E+p^3\left(\begin{array}{c}0\\1\end{array}\right)} \end{array}\right) \rightarrow \sqrt{2E}\left(\begin{array}{c}0\\1\\0\\0\end{array}\right). \end{equation} In short, there are no states that have good quantum numbers for both charge and handedness so there are no states that have good quantum numbers for all three of charge, weak hypercharge and weak isospin. Then why can we find tables for these three quantum numbers? Now this is essentially a quantum mechanical analysis of the relationship between charge, weak hypercharge and weak isospin. Is it that this problem goes away in a field theory analysis? And what exactly is the reason for the difference? For a quantum field, and comparably for a Dirac spinor, representing the electron, $$ \psi= \frac{1+\gamma^5}{2}\psi + \frac{1-\gamma^5}{2}\psi . $$ So, then, $$ I_3=-\frac{1}{2} \frac{1-\gamma^5}{2}~~, $$ (while $\frac{1}{2} \frac{1-\gamma^5}{2}$ for the neutrino), $$ Y= -1 \frac{1-\gamma^5}{2} - 2\frac{1+\gamma^5}{2} ~~, $$ whence $$ Q= I_3+Y/2= -(1/2+1/2) \frac{1-\gamma^5}{2} - 1\frac{1+\gamma^5}{2}= - 1\!\! 1. $$ So you may check the respective eigenvalues on $\psi$. All three mutually commute and are Lorentz invariant.
{ "domain": "physics.stackexchange", "id": 67612, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-field-theory, particle-physics, charge, standard-model, electroweak", "url": null }
ros, raspberrypi, build-from-source execute_process(/home/pi/catkin_ws/build/std_msgs/catkin_generated/env_cached.sh "/usr/bin/python3" "/usr/lib/python3/dist-packages/em.py" "--raw-errors" "-F" "/home/pi/catkin_ws/build/std_msgs/cmake/std_msgs-genmsg-context.py" "-o" "/home/pi/catkin_ws/build/std_msgs/cmake/std_msgs-genmsg.cmake" "/home/pi/catkin_ws/install/share/genmsg/cmake/pkg-genmsg.cmake.em") returned error code 1 Call Stack (most recent call first): /home/pi/catkin_ws/install/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process) /home/pi/catkin_ws/install/share/genmsg/cmake/genmsg-extras.cmake:303 (em_expand) CMakeLists.txt:43 (generate_messages) cd /home/pi/catkin_ws/build/std_msgs; catkin build --get-env std_msgs | catkin env -si /usr/bin/cmake /home/pi/catkin_ws/src/std_msgs --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/pi/catkin_ws/devel/.private/std_msgs -DCMAKE_INSTALL_PREFIX=/home/pi/catkin_ws/install -DCMAKE_BUILD_TYPE=Release; cd -
{ "domain": "robotics.stackexchange", "id": 37430, "lm_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, raspberrypi, build-from-source", "url": null }
homework-and-exercises, statistical-mechanics, hamiltonian-formalism, hamiltonian, approximations It can be shown that the Hamiltonian can be written in the form $$\mathcal{H}(\{x_i,y_i \})=\mathcal{H}_0-\mathbf{f} \cdot \mathbf{R}=-l\sqrt{2}\sum_{i=1}^N \mathbf{f}_i \cdot \hat{\mathbf{b}}_i+E_0$$ where $\displaystyle \mathbf{f}_i=\sum_{j=1}^N \frac{K}{l\sqrt{2}}\hat{\mathbf{b}}_j-\mathbf{f}$ and it is easy to show that $\langle \mathbf{f}_i\rangle=\mathbf{f}+\Delta \mathbf{f}$ and $\Delta \mathbf{f}=KA \langle \mathbf{R} \rangle$ where $A=\frac{1}{2l^2}$. A mean field Weiss approximation involves replacing the instantaneous force felt by each bond by its average. I am then asked to find the mean field Hamiltonian. I get the mean field Hamiltonian will be $$\begin{align}\mathcal{H}_{mf} &= -l\sqrt{2}\sum_{i=1}^N (\mathbf{f}+\Delta \mathbf{f})\cdot \hat{\mathbf{b}}_i+E_0 \\ &= -l\sqrt{2} \left(\frac{K}{2l^2}\langle \mathbf{R} \rangle + \mathbf{f}\right)\cdot \sum_{i=1}^N \hat{\mathbf{b}}_i+E_0 \\ \end{align}$$ I then try to calculate the Helmholtz free energy $F=-k_BT \ln Z$
{ "domain": "physics.stackexchange", "id": 22238, "lm_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, statistical-mechanics, hamiltonian-formalism, hamiltonian, approximations", "url": null }
c#, beginner, winforms I see you use String.IsNullOrEmpty, but have you considered that if I was to enter only white spaces in your code, it would pass this input validation. If it is not the desired behavior, you can use String.IsNullOrWhiteSpace. Finally, you should not put everything static in a class that isn't static itself. But in this situation, I think that most of your code shouldn't be static. When you put something static, ask yourself if it needs to be used by all instances of your class, in this situation your static code is the whole content of your class, so you shouldn't set this to static. You should declare instances of your class instead.
{ "domain": "codereview.stackexchange", "id": 11136, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, beginner, winforms", "url": null }
reinforcement-learning, comparison, value-functions, bellman-equations, optimality Title: How are these two equations for the optimal state-value function equivalent? By substituting the optimal policy $\pi_{\star}$ into the Bellman equation, we get the Bellman equation for $v_{\pi_{\star}}(s)=v_{\star}(s)$: $$ v_{\star}(s) = \sum\limits_a \pi_{\star}(a|s) \sum\limits_{s'} \sum_r p(s', r | s, a)[r + \gamma v_{\star}(s')]$$ From the above equation, how can we obtain the this one? $$ v_{\star}(s) = \max\limits_a \sum\limits_{s'} \sum\limits_r p(s', r|s,a) [r + \gamma v_{\star}(s')]$$ Your first equation is the definition of any state value function, so it must also be definition of the optimal state value function $v_*$. The second equation is the definition of $v_*$ in terms of the state-action value function $\color{green}{q_*}$. In reality, the first equation is also the definition of $v_*$ in terms of $\color{green}{q_*}$, which is what you want to see :) First, note that \begin{align} v_\pi(s) &= \sum_a \pi(a \mid s) \color{blue}{\sum_{s'} \sum_r p(s', r|s, a) [r + \gamma v_\pi(s')]} \\ &= \sum_a \pi(a \mid s) \color{blue}{q_\pi(s, a)} \tag{1}\label{1}. \end{align}
{ "domain": "ai.stackexchange", "id": 3643, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "reinforcement-learning, comparison, value-functions, bellman-equations, optimality", "url": null }
java /** * Load training data * * @param sc */ private void loadTrainingData(Scanner sc) { String[] trainingDimString = sc.nextLine().split("\\s"); numTrainingExamples = Integer.parseInt(trainingDimString[0]); numFeatures = Integer.parseInt(trainingDimString[1]); yTraining = new double[numTrainingExamples]; xTraining = new double[numTrainingExamples][numFeatures]; for (int i = 0; i < numTrainingExamples; i++) { String[] trainingPoint = sc.nextLine().split("\\s"); // read training targets and convert from -1/+1 to 0/1 yTraining[i] = (Double.parseDouble(trainingPoint[1]) + 1) / 2; // read training predictors for (int fIndex = 0; fIndex < numFeatures; fIndex++) { String featureString = trainingPoint[2 + fIndex]; xTraining[i][fIndex] = Double.parseDouble(featureString .substring(featureString.indexOf(":") + 1)); } } }
{ "domain": "codereview.stackexchange", "id": 1146, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java", "url": null }