text
stringlengths
49
10.4k
source
dict
ros, homebrew, mavericks, osx if ((int)m.data.size() != e.size()) ~~~~~~^~~~~ /Users/sagar/workspace/ros_catkin_ws/src/eigen_conversions/include/eigen_conversions/eigen_msg.h:104:11: error: member reference base type '_data_type' (aka 'int') is not a structure or union m.data.resize(e.size()); ~~~~~~^~~~~~~ /Users/sagar/workspace/ros_catkin_ws/src/eigen_conversions/include/eigen_conversions/eigen_msg.h:108:13: error: subscripted value is not an array, pointer, or vector m.data[ii++] = e.coeff(i, j); ~~~~~~^~~~~ 7 errors generated. make[2]: *** [CMakeFiles/eigen_conversions.dir/src/eigen_msg.cpp.o] Error 1 make[1]: *** [CMakeFiles/eigen_conversions.dir/all] Error 2 make: *** [all] Error 2 <== Failed to process package 'eigen_conversions': Command '/Users/sagar/workspace/ros_catkin_ws/install_isolated/env.sh make -j4 -l4' returned non-zero exit status 2 Reproduce this error by running: ==> cd /Users/sagar/workspace/ros_catkin_ws/build_isolated/eigen_conversions && /Users/sagar/workspace/ros_catkin_ws/install_isolated/env.sh make -j4 -l4 Command failed, exiting.
{ "domain": "robotics.stackexchange", "id": 16517, "lm_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, homebrew, mavericks, osx", "url": null }
machine-learning, deep-learning Title: Pattern Recognition on Financial Market Which machine learning or deep learning model(has to be supervised learning) will be best suited for recognizing patterns in financial markets ? What I mean by pattern recognition in financial market : Following Image shows how a sample pattern (i.e. Head and shoulder) looks like: Image 1: And Following Image shows how it actually forms in real chart events: Image 2: What I'm trying to do is: Any pattern similar to Image 1 can be defined as Head and Shoulder Pattern but in a Chart (Price Chart) it will not form as clearly as Image 1. Image 2 is the sample of Head and Shoulder Pattern form in Chart (Price Chart). As it seems in Image 2, it can not be identified as Head and Shoulder Pattern by normal algorithms or analysis (Because there are a lot of highers and low forming a lot of structure, which can easily mislead into a lot of shoulders or head or any other structures). I'm expecting to train machine to recognize the Head and Shoulder Pattern when similar (as Image 2) pattern is formed. Thank you for your time. Let me know if I'm taking it to wrong way. I only have beginners knowledge on Machine Learning. These are some suggestions that might be useful. The data on the curve are bumpier than the roads in my country. So I think you should start by smoothing the curve. There are many smoothing filters like from the simplest median smoothing to Local Regression models like LOESS. There are some parameters to tweak. Take a look at the example. Finding the local maxima. Python's numpy has an implementation for this and this should help.
{ "domain": "datascience.stackexchange", "id": 4369, "lm_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, deep-learning", "url": null }
c++, beginner, playing-cards, vectors return; } Players SumCard(Players Player) { Player.Sum = 0; for (unsigned int CardCount = 0; CardCount < Player.Cards; CardCount++) { if (Player.IndexCard[CardCount] < 10) { std::cout << (Player.IndexCard[CardCount] + 1); Player.Sum = Player.Sum + (Player.IndexCard[CardCount] + 1); } else if (Player.IndexCard[CardCount] == 0) { std::cout << "You have an Ace, (H)igh or (L)ow? \n:" << std::endl; char Answer = ' '; std::cin >> Answer; if (Answer == 'H') { std::cout << "11"; Player.Sum = 11; } else { std::cout << "1"; Player.Sum = 1; } } else { std::cout << "10"; Player.Sum = Player.Sum + 10; } if ((CardCount + 1) == Player.Cards) std::cout << " = "; else std::cout << " + "; } std::cout << Player.Sum << std::endl; return Player; } You should write self documenting code. This basically means breaking your code up into logical well named units. Units are functions and classes. Classes should represents objects in your system. I would have layed out main something like this: int main() { std::vector<Player> players = getPlayers(); Shoe cards(6); // initialize with 6 decks. for(;;) { Game game(players, cards); game.dealCards(); for(player: players) { game.getExtraCards(player); } game.getExtraCards(); // for the dealer. game.payWinners(); } }
{ "domain": "codereview.stackexchange", "id": 17212, "lm_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, playing-cards, vectors", "url": null }
discrete mathematics, which, broadly conceived, underpins about half of pure mathematics and of operations research as well as all of computer science. In contrast to real numbers that have the property of varying "smoothly", the objects studied in discrete mathematics – such as integers, graphs, and statements in logic – do not vary smoothly in this way, but have distinct, separated values. This type of data can’t be measured but it can be counted. See more. Discrete definition: Discrete ideas or things are separate and distinct from each other. The mathematics of modern computer science is built almost entirely on Discrete Math. The class limits in discrete data are true class limits; there are no class boundaries in discrete data. Pausing between trials can provides an opportunity for data collection. Discrete math emphasizes sets, and operations over sets that are (or can be expressed in terms of) a subset of the integers. class room students. Now that you have moved through the whole lesson, you are able to recall and state the definition of a line graph, identify the features of a line graph, including the x-axis, y-axis, titles, labels, and line for discrete data points, construct your own line graph, and interpret results recorded on an existing line graph. Nevertheless, discrete math forms the basis of many real-world If you have quantitative data, like time to complete a task or number of questions correct on a quiz, then the data can be either continuous or discrete. With discrete data we may group by choosing convenient values. Definition: A set of data is said to be continuous if the values belonging to the set can take on ANY value within a finite or infinite interval. On a graph the ordered pairs are at specific locations, so the graph is not connected, but Know what is Discrete data and solved problems on Discrete data. Discrete Mathematics is a branch of mathematics involving discrete elements that uses algebra and arithmetic. One group is rows and other group is columns. A discrete random variable is a random variable that has countable values, such as a list of non-negative integers. The sample space of a discrete distribution is composed of discrete values, whereas the sample space of a continuous distribution is composed of continuous values within a range. Discrete data have finite values, or buckets. org are unblocked. Discrete data only includes values that can only be counted in integers or whole numbers. Discrete mathematics is the study of mathematical structures that are discrete rather than continuous. This resource is designed for UK
{ "domain": "marcoiacobini.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9744347905312774, "lm_q1q2_score": 0.8055767255643665, "lm_q2_score": 0.8267117855317474, "openwebmath_perplexity": 763.2799253174638, "openwebmath_score": 0.463134765625, "tags": null, "url": "http://www.marcoiacobini.com/poyar/discrete-data-definition-math.html" }
# Calculus 2 - $\int(\sqrt{72+36x^2}dx$ I have done this problem several times and this is the only answer i ever come to. My schools webwork gives me incorrect for my answer (answer is not simplified but it should be accepted in this format). Did i do this correctly? Here is my work: \begin{align} \int \sqrt{72+36x^2}\, dx&=\sqrt {36}\int \sqrt{2+x^2}\,dx\\ &=6\int \sqrt{2+x^2}\,dx\\ &=6\int \sqrt 2 \sec \theta \sqrt 2 \sec^2 \theta \, d\theta\\ &=12 \int sec^3 \theta=12\left[\frac{\tan \theta \sec \theta}2 +\frac 12 \int \sec\theta \, d\theta\right]\\ &=12\left[\frac{\tan\theta\sec\theta}2+\frac 12 \ln|\sec\theta+\tan\theta|\right]+C\\ &=6\tan \theta\sec\theta+6\ln|\sec\theta+\tan\theta|+C\\ &=6\tan\left(\tan^{-1}\frac{x}{\sqrt 2}\right)\sec\left(\tan^{-1}\frac{x}{\sqrt 2}\right)\\ &+6\ln \left|\sec\left(\tan^{-1}\frac{x}2\right)+\tan\left(\tan^{-1}\frac{x}{\sqrt 2}\right)\right|+C \end{align} Any help is appreciated. Thanks
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9783846703886661, "lm_q1q2_score": 0.8174242810562939, "lm_q2_score": 0.8354835330070839, "openwebmath_perplexity": 1152.4102653736397, "openwebmath_score": 0.952872097492218, "tags": null, "url": "https://math.stackexchange.com/questions/1343481/calculus-2-int-sqrt7236x2dx" }
ros-melodic Originally posted by gvdhoorn with karma: 86574 on 2019-06-17 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by AlexRibeiro on 2019-06-19: I've updated the key, but then, aftersudo apt update, I still get the "release file" problems. I've added the response to the code in the original question. Comment by gvdhoorn on 2019-06-20: Seeing as you've made quite a few changes to various related settings, can you please make sure that things are back to how they were? What is the output of cat /etc/apt/sources.list.d/ros-latest.list and cat /etc/apt/sources.list for instance? What was the output when updating the key? It still looks like the key has not been updated. Comment by AlexRibeiro on 2019-06-20: This is the output of the updating key command: `Executing: /tmp/apt-key-gpghome.UB4RUijhZn/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 gpg: chave F42ED6FBAB17C654: "Open Robotics info@osrfoundation.org" não mudada gpg: Número total processado: 1 gpg: não modificados: 1 ` Comment by gvdhoorn on 2019-06-20: can you please always just add such updates to your original question? Comments are not suited for such things. And can you then include the output of the two cat commands? Comment by AlexRibeiro on 2019-06-20: I've reset thing to the way they were before, and also disabled proxy, following another comment's sugestion. The response changed slightly, I've updated it above. But still the response to the instaliing command was the same, and after I tried sudo apt update again, the response returned to the way it was before. Comment by gvdhoorn on 2019-06-20:\
{ "domain": "robotics.stackexchange", "id": 33102, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros-melodic", "url": null }
cpt-symmetry We also have that $\left(\mathcal{PT}\right)^2\phi_n\left(x\right) = \mathcal{PT}\phi^*_n\left(-x\right) = \phi_n\left(x\right)$, giving eigenvalues $e^{-i\omega_n}$ as $\mathcal Te^{-i\omega_n} = e^{i\omega_n}\mathcal T$. This eigenvalue is absorbed into the definition of the eigenvector so that $\phi_n\left(x\right)\rightarrow e^{-\frac{1}{2}i\omega_n}\phi_n\left(x\right)$ and now $\mathcal{PT}\phi_n\left(x\right) = \phi_n\left(x\right)$. This gives that $\left\langle\phi_n|\phi_m\right\rangle^{\mathcal{PT}} = \int dx\,\phi_n\left(x\right)\phi_m\left(x\right)$. However, this is not necesarily positive, so we define an additional operator, $\mathcal C$, alongside the $\mathcal{CPT}$ inner product, in order to satisfy the completeness relation: \begin{align}\mathcal C\left(x, y\right) &= \sum_{n=0}^\infty \phi_n\left(x\right)\phi_n\left(y\right) \\ \mathcal C\phi_n\left(x\right) &= \left(-1\right)^n\phi_n\left(x\right) \\ \psi^{\mathcal{CPT}}\left(x\right) &= \int dy\, \mathcal C\left(x, y\right)\psi^*\left(-y\right) \\
{ "domain": "quantumcomputing.stackexchange", "id": 563, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "cpt-symmetry", "url": null }
complex-random-variable Title: Distribution of $e^{j\theta}$ Is there a canonical or analytic expression for the probability distribution for the circularly-symmetric complex random variable $Z$: $$ Z = e^{j\theta}, $$ where $\theta \sim \mathcal U(0, 2\pi)$? Side notes: It is known that the real and imaginary parts, i.e.: $$ \Re(Z) = \cos \theta \\ \Im(Z) = \sin \theta $$ have marginal densities given by: $$ f_{\Re(Z)}(z) = f_{\Im(Z)}(z) = \frac{1}{\pi\sqrt{1-z^2}}, \quad -1 < z < 1, $$ but because they are not independent, computing their joint PDF is nontrivial. EDIT: $Z$ is different from a complex normal in that here, the amplitude $|Z|$ is deterministic and identically 1, whereas if $Z$ were complex normal, $|Z|$ would be Rayleigh distributed. Since the real and imaginary parts are very much dependent on one another (if you have the value of one, you know the value of the other exactly), it seems like you could apply the marginal pdf of the real part $r$, given a value of the imaginary part $i$: $$ f_{ri}(r, i) = f_{r | i}(r\ |\ i) f_i(i) $$ You noted the pdf of the real and imaginary parts individually: $$ f_r(z) = f_i(z) = \frac{1}{\pi\sqrt{1-z^2}} $$ That leaves the marginal pdf $f_{r | i}(r\ |\ i)$. Remember that for a given realization of the random variable $Z$, the two components are deterministically related: $$ r^2 + i^2 = \cos^2(\theta) + \sin^2(\theta) = 1 $$ Given this relationship, we can solve for $r$ in terms of $i$: $$
{ "domain": "dsp.stackexchange", "id": 6932, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "complex-random-variable", "url": null }
electromagnetism, classical-electrodynamics, electromagnetic-induction According to Faraday's law as expressed above, the answer surely should be yes. The integral on the right hand side will not return 0, so therefore the left hand side cannot be 0 and an EMF should be induced in the coil. Physically, however, the answer surely should be no. An EMF is induced in the wire ultimately because of the magnetic force that acts on the charges in the loop itself, moving them along the loop and producing a potential difference. If the loop itself is not in the magnetic field, then how can the field exert a force on the charges in it? There is an error in reasoning somewhere here. Where am I going wrong? (a) It's not the magnetic field that exerts forces on the charges in the loop, but the electric field given by your second equation. [For one thing the charges in the wire are (on average) stationary, so wouldn't experience forces from a magnetic field even if it were local to the charges.] (b) The line integral of the electric field around the loop gives the emf in the loop, but the concept of potential difference doesn't apply because the field is not conservative: if we take two points A and B on the loop, the work done by a charge going from A to B depends on the route by which it goes from A to B.
{ "domain": "physics.stackexchange", "id": 57027, "lm_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, classical-electrodynamics, electromagnetic-induction", "url": null }
python, beginner, random i_quality = random.choice(all_qualities) i_base = random.choice(all_bases) i_element = random.choice(all_elements) Be careful how you name things and what the responsibilities of functions are. create_Item does create an Item, but it also prints it out then discards it. Such a function isn't very useful. The caller could have just called the Item constructor themselves and then printed the object if they wanted to. Your function does some formatting, but that would be better off in the __str__ method of Item. What would make for a useful factory function though would be a create_random_item function that returns a random Item. Taking all that together, I'd change this code to something closer to: import random all_qualities = ["Good", "Bad"] all_bases = ["Sword", "Gun"] all_elements = ["Fire", "Water"] class Item(object): def __init__ (self, quality, base, element): self.quality = quality self.base = base self.element = element # What Python will call when you ask it to # display an Item using str def __str__(self): return self.quality + " " + self.base + " of " + self.element def create_random_item(): quality = random.choice(all_qualities) base = random.choice(all_bases) element = random.choice(all_elements) return Item(quality, base, element) for _ in range(10): # We'll create 10 random weapons and print them out item = create_random_item() print(str(item)) # str calls item's __str__ Good Gun of Fire Good Sword of Fire Bad Sword of Water Good Sword of Fire Good Sword of Water Good Sword of Fire Bad Gun of Water Bad Sword of Water Bad Gun of Water Bad Sword of Water
{ "domain": "codereview.stackexchange", "id": 35103, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, beginner, random", "url": null }
performance, c, matrix Title: Transpose matrix in ANSI C Is there a way to transpose a matrix in ANSI C way much better than this ANSI C code? Can I do transpose in a different and faster way? The focus of this aim is: Speed /* * Turn A into transponse A^T * A[row * column] */ void tran(float A[], size_t row, size_t column) { /* Decleration */ float *B = (float*)malloc(row * column * sizeof(float)); float* transpose = NULL; float *ptr_A = A; size_t i, j; for (i = 0; i < row; i++) { transpose = &B[i]; for (j = 0; j < column; j++) { *transpose = *ptr_A; ptr_A++; transpose += row; } } /* Copy! */ memcpy(A, B, row*column*sizeof(float)); /* Free */ free(B); } Performance To get the best performance on contemporary CPUs you need a very good understanding of the memory and cache systems, the prefetcher, and if vector instructions can be used. The best algorithm to use will also depend on the size of the matrix. There are also some performance issues caused by the language itself, and I recommend you target at least C99 so you can use restrict. You are also creating a temporary matrix and copying it back at the end. This has some overhead that could be avoided in two ways: Don't modify A[] at all, but let the caller supply a B[] where the result will be stored. Modify A[] in-place. This is rather easy for square matrices, but it will quickly become complicated for non-square matrices. Still, you could do the in-place method for square ones and fall back to your original code for non-square ones.
{ "domain": "codereview.stackexchange", "id": 45275, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "performance, c, matrix", "url": null }
mechanical-engineering, materials, plastic, building-design, adhesive Title: Adhesion of Super Glue (containing ethyl cyanoacrylate) and PVDF (polyvinylidene fluoride) film Would it be considered safe to use super glue, which contains ethyl cyanoacrylate, to attach a PVDF film to a metal alloy? It says super glue is not recommended for polyethylene or polypropylene. However, I am not sure about the hazards for polyvinylidene fluoride. Thanks! The issue is not one of safety; it is just that PE, PP and PVDF are almost impossible to get anything to stick to, including glue. It is doubtful that crazy glue would work on it. you can try latex-based glue, this is what's used in stickytape. There are industrial-strength versions which fall under the category of pressure-sensitive adhesives. 3M makes these.
{ "domain": "engineering.stackexchange", "id": 2769, "lm_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, materials, plastic, building-design, adhesive", "url": null }
statistical-mechanics, cosmology, pressure, phase-space Step 5 is the part I'm having trouble understanding and specifically the red term in Eq. (3.2.20). $${\color{red} {|\hat{\mathbf{v}}\cdot \hat{\mathbf{n}}|\times \frac{dA}{4\pi R^2}}}$$ The way I'm trying to understand this term is like this. Imagine you are a particle in the spherical shell of radius $R$ (e.g. the shaded region in the figure). After some time $t$ I could be anywhere on a sphere of radius $R$ centered on my current location. The $dA / 4 \pi R^2$ factor is the probability that the direction I randomly decide to go in will land me inside the area element $dA$. But from this context I don't understand: why there is an $|\hat{\mathbf{v}}\cdot \hat{\mathbf{n}}|$ factor flying around? The factor $\hat{\mathbf{v}}\cdot\hat{\mathbf{n}}$ is just equal to $\cos \theta$. It takes into account the foreshortening of the "effective area" of the surface element $dA$ as "seen" by particles approaching from the direction $\mathbf{v}$. In an extreme example, as $\theta \to \pi/2$ (and $\hat{\mathbf{v}}\cdot\hat{\mathbf{n}} \to 0$), almost none of the particles in the given volume element actually impact the area $dA$, because they're all traveling nearly parallel to its surface.
{ "domain": "physics.stackexchange", "id": 92813, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "statistical-mechanics, cosmology, pressure, phase-space", "url": null }
rospy Originally posted by Ruben Alves with karma: 1038 on 2017-07-24 This answer was ACCEPTED on the original site Post score: 4 Original comments Comment by j1337 on 2017-07-24: Thank you. This was extremely helpful. Comment by jayess on 2017-08-09: Why not explain exactly how to solve this question here? The problem with linking to a video for more steps is that now part of the answer is external and this answer is not self-contained. What if the video gets taken down? Comment by Ruben Alves on 2017-10-09: Ok, now the answer is self contained, @jayess. Thanks for the advice. Comment by AlessandroSaviolo on 2020-03-19: THANK YOU!
{ "domain": "robotics.stackexchange", "id": 28424, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "rospy", "url": null }
python, python-3.x, sqlite, rock-paper-scissors def results(self): difference = self.computer_num - self.player1_num if difference == 0: print ("It's a tie!") elif difference % 3 == 1: Choices.computer_games_won+=1 print (self.computer_win_message) elif difference % 3 == 2: Choices.player1_games_won+=1 print (self.player1_win_message) print ("So far {0} has won {1} times, and computer has won {2} times".format(self.player1_username_input,self.player1_games_won,self.computer_games_won)) eka = RockPaperScissors() eka.welcome() eka.menu() toka = signIn() kolmas = Stats() neljas = Messages() neljas.win_messages() viides = playAgain() kuudes = Choices() seitsemas = Users() while True: if kuudes.player1_games_won == 3: neljas.player1_congrats() neljas.congrats() viides.new_game() break elif kuudes.computer_games_won == 3: neljas.computer_congrats() neljas.congrats() viides.new_game() break else: kuudes.player1_choice() kuudes.computer_choice() kuudes.results() Structure This is a very weird way to define your classes: while True: class A: ... a = A() ... You would normally want to define your classes first, and only once (instead of re-defining them every loop iteration): class A: ... while True: a = A() ...
{ "domain": "codereview.stackexchange", "id": 26796, "lm_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, sqlite, rock-paper-scissors", "url": null }
python, django Title: Doubts about db_index, primary_key and unique parameters I'm trying to improve my code. I've some doubts about db_index, primary_key and unique parameters. # -*- coding: UTF-8 -*- from django.db import models from django.contrib.auth.models import User #=================================================================================# class Country(models.Model): country_id = models.IntegerField(primary_key=True, unique=True, verbose_name="Id", editable=False) name = models.CharField(unique=True, db_index=True, max_length=50, verbose_name="Nome") short_name = models.CharField(unique=True, max_length=5, verbose_name="Abreviatura") class Meta: verbose_name = "País" verbose_name_plural = "Países" ordering = ['name'] def __unicode__(self): return self.name #=================================================================================#
{ "domain": "codereview.stackexchange", "id": 1726, "lm_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, django", "url": null }
c++, beginner if (pieces < 0) { std::cout << "Cannot have negative pieces!\n"; return -1; } std::cout << "Price per Piece?\n"; std::cin >> unit_price; if (unit_price < 0) { std::cout << "Cannot have negative unit price!\n"; return -1; } // Calculate total price gesamt = pieces * unit_price; // Apply discount, if applicable if (pieces > 10) { if (pieces > 50) //10% discount { gesamt *= 0.9; } else //5% discount { gesamt *= 0.95; } } std::cout << gesamt << '\n'; return 0; }
{ "domain": "codereview.stackexchange", "id": 22249, "lm_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", "url": null }
arduino Title: serial monitor of arduino IDE showing different output I am accessing ros messages in arduino by serializing it through ros serial. But when i am sending some text from arduino code through serial it is showing different output in serial monitor of arduino ide. Seems all the text have mixed with some other data .What can be possible reason?Thanks Originally posted by Mind_hunter on ROS Answers with karma: 51 on 2014-12-19 Post score: 0 Original comments Comment by Andromeda on 2014-12-19: Please copy and paste both outputs. Could it be that you use const char* in Arduino and String in ROS? rosserial encodes the messages. It does not just send the raw data as when you use serial directly. That is why you see different things. Originally posted by dornhege with karma: 31395 on 2014-12-19 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by Mind_hunter on 2014-12-19: I thought if it send message data then only it encodes it , like in case when we advertise a topic....So does it encode the normal message also before sending it through serial?
{ "domain": "robotics.stackexchange", "id": 20382, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "arduino", "url": null }
newtonian-mechanics, newtonian-gravity, estimation, centrifugal-force, moon Title: Could the moon's centrifugal force generate the same acceleration as 9.8 m/s$^2$? If one dug into the moon, could one reach a point where the centrifugal force is close to that of Earth's gravitational pull? If so, how deep would one have to dig? If not, how close could one get to an acceleration of 9.8 m/s$^2$? The centrifugal force will decrease as you move towards the center of the moon, not increase.$^*$ So this would not be possible, as the centripetal acceleration is not even $9.8\,\rm{m/s^2}$ at the moon's surface. $^*$The centrifugal acceleration from a reference frame rotating with the moon is directly proportional to the square of the angular velocity of the moon $\omega$ as viewed from an inertial reference frame, and is also directly proportional to the distance from the center of rotation $r$, so then $a_c=\omega^2 r$
{ "domain": "physics.stackexchange", "id": 82514, "lm_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, newtonian-gravity, estimation, centrifugal-force, moon", "url": null }
### Show Posts This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to. ### Messages - Victor Ivrii Pages: 1 ... 162 163 [164] 165 166 ... 171 2446 ##### Home Assignment 2 / Re: Problem 1 -- not done yet! « on: October 07, 2012, 11:15:56 AM » Posted by: Rouhollah Ramezani C) Contains a logical error in the domain $\{−2t<x<2t\}$ (middle sector) which should be found and fixed. Note that the solution of RR there is not in the form $\phi(x+2t)+\psi(x-2t)$ C) is also amended, but I probably failed to spot the "logical error" and it is still there. You presume that $u$ should be continuous, which is not the case. In fact in the framework of the current understanding you cannot determine $C$ in the central sector, so solution is defined up to $\const$ here. One needs to dig dipper in the notion of the weak solution. Quote PS MathJax is not a complete LaTeX and does not intend to be, so it commands like \bf do not work outside of math snippets (note \bf); MathJax has no idea about \newline as it is for text, not math. For formatting text use either html syntax (in plain html) or forum markup Yes, I realized that after. And I found out from your other post that we can actually use an html editor+MathJax instead of LaTeX. right? Not really: you do not use html syntax but a special SMF markdown which translates into html (so you cannot insert a raw html-- but Admin  can if needed. 2447 ##### Technical Questions / Re: Printing from the website « on: October 06, 2012, 03:51:11 PM » Has any one tried printing from the website (the lec notes)-- the math codes come out very strange when printed. Does any one have a solution?? Thanks Kanita
{ "domain": "toronto.edu", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9715639653084245, "lm_q1q2_score": 0.8296308584791927, "lm_q2_score": 0.8539127510928476, "openwebmath_perplexity": 1528.33136735588, "openwebmath_score": 0.8067551255226135, "tags": null, "url": "http://forum.math.toronto.edu/index.php?action=profile;u=4;area=showposts;start=2445" }
space-expansion, relativity Bob should not have traveled towards Alice. Suppose Bob sent a light signal 1 when he started. Then Bob has to travel slower than light, so he must fall behind signal 1. At any intermediate stage, he sent a light signal 2. Whatever the shape of light cones, signal 2 must arrive latter than signal 1. We can see this from the geodesic equation of the light ray $ds^2 =0 $, the slope \begin{equation} \frac{dt}{dr} = \frac{R(t)}{\sqrt{1-kr^2}} \end{equation} is increasing. Alternatively, before signal 1 bypass signal 2, they must meet at the spacetime diagram. However the geodesic equation is general covariant, once they merge, they will be a single geodesic forever. Hence signal 1 will arrive no latter then signal 2. Actually, they can't merge at all, because the proper distance of these two light signals will keep fixed. Alice can't help Bob to speed up the signal. Let's analyze signal 1. By assumption, Alice was within the event horizon of Bob. Hence (without any technical problem of course ) she would receive the signal. But the new signal she sent out had the same trajectory on spacetime diagram as if signal 1 were never been blocked. The reason is the trajectory of the light signal is determined by geodesic equation \begin{equation} ds^2 = 0 = g_{\mu\nu} dx^{\mu}dx^{\nu} = g_{\hat{\mu}\hat{\nu}} dx^{\hat{\mu}}dx^{\hat{\nu} } \end{equation} The proper distance is invariant under Lorentz transformation. And a bonus for light ray, the proper distance is zero, it is actually general covariant, which means the slope of the trajectory at any point is independent of the coordinate system we are using. The light signal forwarded by Alice would propagate as if it was the original signal 1. By assumption, Charlie was outside the event horizon of Bob, the light signal will never reach him. Event horizon is shrinking due to expansion
{ "domain": "physics.stackexchange", "id": 14540, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "space-expansion, relativity", "url": null }
object-oriented, unit-testing, vba, library Of course, this means we need to add a message property to TestResult. Private Type TTestResult outcome As TestOutcome output As String message As String End Type Private this As TTestResult Public Property Get Message() As String Message = this.Message End Property Friend Property Let Message(ByVal value As String) this.message = value End Property So now TestClass has only one event, Completed, so there's no longer a reason to make sure no other events have fired. It becomes this easy. Private Sub assertion_Completed(ByVal result As TestResult) testOutput.WriteResult currentTest, result End Sub But what about Inconclusive results? As it is, we'll only ever get success or failure. Well, that's easy enough to deal with in your existing error handler by directly passing a result to the output. CleanFail: If Err.Number = AssertError Then testOutput.WriteResult TestResult.Create(Failed, Err.Description) Resume CleanExit ElseIf Err.Number = InconclusiveAssertError Then testOutput.WriteResult TestResult.Create(Inconclusive, Err.Description) Resume CleanExit Else testOutput.WriteResult TestResult.Create(Inconclusive, "Test raised an error: " & Err.Description) Resume CleanExit End If End Sub There's one other that took me way too long to notice: the lack of a ITestResult and IAssert for injection purposes. You probably don't need it, but it would make it easier to change and build IOutput classes and TestClasses if you have complete control over their dependencies.
{ "domain": "codereview.stackexchange", "id": 9570, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "object-oriented, unit-testing, vba, library", "url": null }
rviz Title: rviz camera orientation controlled by oculus rift Hello, I am interested in displaying a pointcloud in rviz and allowing a user to view the point cloud using the oculus rift. Is there a plugin which displays rviz views to the oculus and publishes pose from the oculus? Googling has produced no solutions for me thus far. I am using ubuntu 16.04 and ROS Kinetic. Thanks. Originally posted by hasfuraa on ROS Answers with karma: 1 on 2016-06-23 Post score: 0 The oculus_rivz_plugins package displays the 3D view in rviz within the oculus rift, allows the user to move their head to change the orientation of the view, and publishes the /oculus TF frame representing the pose of the oculus. It's been released on ROS Indigo, but it should work reasonably well on later versions of ROS too. The wiki page provides only minimal documentation; you can learn more by reading the source code on github and by reading the issues in their issue tracker Originally posted by ahendrix with karma: 47576 on 2016-06-23 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 25041, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "rviz", "url": null }
Set to use a.... 100, 110, 120, 130, 140, 150 calculator to find degree... May be in degrees top input of quadrilaterals with some of their sides and angles of up to a radius. Want to give credit to the opposite ( i.e, usually involve triangles because triangles are rigid full rotation click... The 90° angle 30,45,75,105,135 share with your friends: 1: construct an angle of at. And the other step is given below learn how to construct a 60° 60 ° angle regular semicircular protractor measure... Measuring this angle right over here from the Chrome web Store, with radius more than 180° using protractor. To any convenient length are three other types such as straight, and! Of any convenient radius on the radian measure of acute angle of size 1° has radian measure reflex... You temporary access to the opposite ( i.e try and learn this properly solve with the ratio of sides angles... 2Π, so it follows that an equilateral triangle, AB - AC = cm. 65 degrees and radians left end as point O and the other is... Op intersects the arc 8 credit to the radius similar to the radius to... The basics of this is shown in constructing the sum of ABC triangles... An acute angle = 360° – a measure of an angle bisector construct... Teach you to click on the paper for new subjects a Set of congruent triangular braces as. Together they form a right angle is half of a triangle measure 30 degrees a... + 65° = 180° mark a point ‘ O ’ on it get the 60. Angles add up to 180^\circ 180^\circ 180^\circ Academy... And its done in the future is to use angles measured with either degrees or radians = 110° the... Step is given below the steps above to construct some angles without using a protractor: 1 3 O., there are 360 degrees then measure the angle into two equal parts 60°... 15˚ angle can be shown that the angle of 30° or outer Scale the! Of different lengths and angles of triangle ABC = 60° + 55° + 65° =.... Degrees are complementary angles because together they form a
{ "domain": "xiaoruboke.com", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9504109826342961, "lm_q1q2_score": 0.8257425133715682, "lm_q2_score": 0.8688267796346599, "openwebmath_perplexity": 931.3162684767892, "openwebmath_score": 0.7387092709541321, "tags": null, "url": "http://www.xiaoruboke.com/beau-monde-awp/6713c0-construct-the-angles-of-the-following-measurements-30-degree" }
ros-package-path Here is the error message I get from Eclipse 00:38:52 **** Incremental Build of project fieldnode-RelWithDebInfo@fieldnode **** /usr/bin/make -j8 all mkdir -p bin cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=/opt/ros/groovy/share/ros/core/rosbuild/rostoolchain.cmake .. Re-run cmake no build system arguments [rosbuild] Building package fieldnode Failed to invoke /opt/ros/groovy/bin/rospack deps-manifests fieldnode -- Configuring incomplete, errors occurred! [rospack] Error: package/stack 'fieldnode' depends on non-existent package 'atlas_msgs' and rosdep claims that it is not a system dependency. Check the ROS_PACKAGE_PATH or try calling 'rosdep update' CMake Error at /opt/ros/groovy/share/ros/core/rosbuild/public.cmake:129 (message): Failed to invoke rospack to get compile flags for package 'fieldnode'. Look above for errors from rospack itself. Aborting. Please fix the broken dependency! Call Stack (most recent call first): /opt/ros/groovy/share/ros/core/rosbuild/public.cmake:203 (rosbuild_invoke_rospack) CMakeLists.txt:12 (rosbuild_init) make: *** [all] Error 1 00:38:53 Build Finished (took 509ms) Originally posted by rocklobster on ROS Answers with karma: 16 on 2013-05-25 Post score: 0 Fixed I had to manually update the ROS_PACKAGE_PATH data in the project properties under C/C++ Make Project->Environment. Originally posted by rocklobster with karma: 16 on 2013-05-25 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 14291, "lm_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-package-path", "url": null }
deep-learning Title: Deep Learning 2D-Convol Layer: When does the Channel =1? Sorry if this sounds basic. But for input_shape, understand that the channel =3 for colored images. But for black-white and grey-scale images, channel =1? Thank you model.add(Conv2D(filters=32, kernel_size=(4,4),input_shape=(28, 28, 1), activation='relu',)) input_shape = image_height, image_width, channels ``` This is indeed correct, when talking about single images a colored RGB image has three channels (R, G, and B) and a black and white has one channel indicating the pixel luminance.
{ "domain": "datascience.stackexchange", "id": 10439, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "deep-learning", "url": null }
given that our complex number is equal to eight plus four , then eight is actually going to be our . How to calculate the modulus of a complex number? The module can be interpreted as the distance separating the point (representing the complex number) from the origin of the reference of the complex plane. There r … The calculator will generate a step by step explanation for each operation. Modulus and argument. This leads to the polar form of complex numbers. This calculator extracts the square root, calculate the modulus, finds inverse, finds conjugate ,$\color{blue}{\text{ 2r3 } = 2\sqrt{3}}$ Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share … This calculator extracts the square root, calculate the modulus, finds inverse, finds conjugate and transform complex number to polar form. For calculating modulus of the complex number following z=3+i, enter complex_modulus(3+i) or directly 3+i, if the complex_modulus button already appears, the result 2 is returned. If is a real number, its modulus just corresponds to the absolute value. The modulus of complex numbers is the absolute value of that complex number, meaning it's the distance that complex number is from the center of the complex plane, 0 + 0i. Sigma resource Unit 9. It allows to perform the basic arithmetic operations: addition, subtraction, division, multiplication of complex numbers. (Definition). The Typeset version of the abs command are the absolute-value bars, entered, for example, by the vertical-stroke key. Absolute value: abs ( the result of step No. For example the modulus of the complex number: 2 + 3i is: |2 + 3i| = √ (2 - 0)2 + (3 - 0)2. By … This calculator does basic arithmetic on complex numbers and evaluates expressions in the set of complex numbers. The argument of a complex number is the direction of the number from the origin or the angle to the real axis. Details. But before that, a bit about complex number and its modulus. The calculator will generate a step by step explanation for each operation. This calculator does basic arithmetic on complex numbers and evaluates expressions in the set of
{ "domain": "communityresiliencechallenge.org", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9702399051935106, "lm_q1q2_score": 0.824675958418168, "lm_q2_score": 0.849971181358171, "openwebmath_perplexity": 624.5477570094517, "openwebmath_score": 0.6651411056518555, "tags": null, "url": "http://communityresiliencechallenge.org/agricultural-aircraft-qyu/modulus-of-a-complex-number-calculator-6bdaea" }
ros, camera1394 ROS path [2]=/opt/ros/fuerte/share ROS path [3]=/opt/ros/fuerte/stacks ROS path [4]=/Downloads/drivers CMake Error at /opt/ros/fuerte/stacks/dynamic_reconfigure/cmake/cfgbuild.cmake:68 (string): string sub-command REPLACE requires at least four arguments. Call Stack (most recent call first): /opt/ros/fuerte/stacks/dynamic_reconfigure/cmake/cfgbuild.cmake:89 (gencfg_cpp) CMakeLists.txt:22 (include) -- Configuring incomplete, errors occurred!
{ "domain": "robotics.stackexchange", "id": 10429, "lm_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, camera1394", "url": null }
deep-learning, neural-network, gan, mlp Title: Is a multi-layer perceptron exactly the same as a simple fully connected neural network? I've been learning a little about StyleGans lately and somebody told me that a Multi-Layer Perceptron, MLP, is used in parts of the architecture for transforming noise. When I saw this person's code, it just looked like a normal 8-layer fully connected network (i.e. linear-->relu-->linear-->relu-->...) Last year, I read Hands-on Machine Learning with Scikit-Learn, Keras, and TensorFlow 2 by Aurelien Geron and he talks about MLPs. When I read about it, I interpreted his description as that an MLP is not exactly the same as a vanilla fully connected neural network. I didn't fully understand the text and don't have the book anymore so, unfortunately, can't recall exactly what I read so I might have been completely wrong in my understanding of what he wrote. Is an MLP the same thing as very basic fully connected network? Yes, a multilayer perceptron is just a collection of interleaved fully connected layers and non-linearities. The usual non-linearity nowadays is ReLU, but in the past sigmoid and tanh non-linearities were also used. In the book, the MLP is described this way: An MLP is composed of one (passthrough) input layer, one or more layers of TLUs, called hidden layers, and one final layer of TLUs called the output layer (see Figure 10-7). The layers close to the input layer are usually called the lower layers, and the ones close to the outputs are usually called the upper layers. Every layer except the output layer includes a bias neuron and is fully connected to the next layer. ("TLU" stands for threshold logic unit)
{ "domain": "datascience.stackexchange", "id": 9278, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "deep-learning, neural-network, gan, mlp", "url": null }
quantum-gate, mathematics, unitarity, terminology-and-notation Title: What are the physical meanings of the outer product when writing expressions for unitary gates? I'm really confused with the interpretation of those equations: $1.$ The evolution of states under unitary operations can be expressed as $$ U = \sum_k\exp(i\phi_k)|\psi_k\rangle\langle\psi_k| $$ $2.$ The controlled operation in quantum computing is defined as $$ |0\rangle\langle0|\otimes I + |1\rangle\langle1|\otimes e^{i\alpha}I = \begin{bmatrix} 1 & 0\\ 0 & e^{i\alpha} \end{bmatrix} \otimes I $$ I'm not pretty sure how to understand them. Also, the outer product is present in both equations, so I'm wondering could those equations be explained in terms of the projection operator? What are the physical meanings of the outer product? Thanks:) This is simply the spectral decomposition of a unitary operator. The eigenvalues of a unitary operator are phases, i.e., of the form $e^{i \theta}$. And the rank-1 projectors are the eigenprojectors (again from the spectral theorem) and have the form $| \psi_{k} \rangle \langle \psi_{k} |$ for a non-degenerate spectrum (otherwise, their rank is greater than one and they cannot be written as the outer product of a state vector). This is clearly wrong. The action of this is to provide a trivial global phase. I think you mean something like $|0\rangle\langle 0|\otimes I+| 1\rangle\langle 1| \otimes R_z(\alpha)$, where $R_z(\alpha)$ is a phase-shift gate? Or more generally, any two-qubit controlled-$U$ gate can be written as $|0\rangle\langle 0|\otimes I+| 1\rangle\langle 1| \otimes U$. Does this help?
{ "domain": "quantumcomputing.stackexchange", "id": 2076, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-gate, mathematics, unitarity, terminology-and-notation", "url": null }
lagrangian-formalism, field-theory, gauge-theory, chern-simons-theory, boundary-terms The action $S[A]$ may not well-defined on $M$ because, in general, $A$ isn't globally defined and the Lagrangian density of action $S[A]$ depends the choice of coordinate charts. The action $S[A]$ is not gauge-invariant. For the first problem, since the Chern-Simons form is only locally defined, one must use these local data to glue them together so that the action makes sense. The local data is related with the Cech-Deligne cohomology, and is explained in this book. In one of Witten's paper on Chern-Simons theory, he defined the theory in the following way: Find a four dimensional manifold $N$, such that $M$ is the boundary of $N$. This is always possible because any closed oriented three dimensional manifold can be realized as the boundary of an oriented four dimensional manifold. The proof can be found in this book. Then, using the Stoke's theorem, one defines the Chern-Simons theory as $$S[A]=\frac{k}{4\pi}\int_{M}\mathrm{tr}\left(A\wedge dA+\frac{2}{3}A\wedge A\wedge A\right):=\frac{k}{4\pi}\int_{N}\mathrm{tr}(F\wedge F),$$ where $F=dA+A\wedge A$ is the curvature tensor defined over $N$.
{ "domain": "physics.stackexchange", "id": 88713, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "lagrangian-formalism, field-theory, gauge-theory, chern-simons-theory, boundary-terms", "url": null }
particle-physics, symmetry, notation, quantum-chromodynamics, isospin-symmetry Title: Do Halzen and Martin use p and n to represent complex numbers? In Halzen and Martin's Quarks and Leptons, on page 42, the $SU(2)$ isospin transformation represented by $e^{i\boldsymbol{\theta}\cdot\boldsymbol{\tau}/2}$ is said to act on the column represented by $$|\psi\rangle=\begin{pmatrix}\mathrm{p} \\\mathrm{n}\end{pmatrix}\tag{1}$$ with $$\mathrm{p}=\begin{pmatrix}1\\0\end{pmatrix}\hspace{0.3cm} \text{and}\hspace{0.3cm}\mathrm{n}=\begin{pmatrix}0 \\1\end{pmatrix}\tag{2}$$ I think this notation i.e., Eq, (1) used in conjunction with Eq.(2), is confusing. In the basis $|\mathrm{p}\rangle=\begin{pmatrix}1\\0\end{pmatrix}$, $|\mathrm{n}\rangle=\begin{pmatrix}0 \\1\end{pmatrix}$, the state $|\psi\rangle$ should be represented by a 2-component column (1) with its entries $\mathrm{p}$ and $\mathrm{n}$ being complex numbers. So are they using the notation that $$|\psi\rangle=\mathrm{p}|\mathrm{p}\rangle+\mathrm{n}|\mathrm{n}\rangle?\tag{3}$$
{ "domain": "physics.stackexchange", "id": 43128, "lm_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, symmetry, notation, quantum-chromodynamics, isospin-symmetry", "url": null }
Recognitions: Gold Member Homework Help ## Pendulum on a cart. If the parameter $$\frac{v^{2}}{2gl}\geq{1}$$, the pendulum will swing in circles. (g is the acceleration due to gravity, l the length of the pendulum, v being the initial velocity) Mentor Blog Entries: 1 I don't see any implication in the professor's question that he thinks the pendulum cannot swing in a circle if v is large enough. He merely asks you to do the calculation for arbitrary v (note that v may or may not be large enough to swing over the top). He's being "coy" because he probably wants you to realize on your own that for speeds above some minimum the pendulum will make a complete swing. Specify that minimum speed and, for speeds below that limit, specify the maximum angle. Mentor Blog Entries: 1 Quote by arildno If the parameter $$\frac{v^{2}}{2gl}\geq{1}$$, the pendulum will swing in circles. (g is the acceleration due to gravity, l the length of the pendulum, v being the initial velocity) How did you arrive at that relationship? Recognitions: Gold Member Homework Help Quote by Doc Al How did you arrive at that relationship? Well, I made a quick idealization: After the collision (conceived as instantaneous), the fulcrum is at rest. Since the collision was perceived as instantaneous, no change in the position of the (mathematical) pendulum has occurred, i.e, it is hanging straight down. Therefore, the bob of mass m has retained its velocity v, since it has experienced no horizontal force during the collision. (The pendulum string could, and have, only have transmitted forces in the vertical direction during the collision). The relation follows easily from that, by conservation of mechanical energy, and the requirement that the value of, say, the cosine function, must be less than 1. Mentor Blog Entries: 1 Quote by arildno The relation follows easily from that, by conservation of mechanical energy, and the requirement that the value of, say, the cosine function, must be less than 1. Looks to me like you set the initial KE equal to just enough for the pendulum bob to reach the height of the support, not necessarily enough to swing through a complete circle.
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9693242018339897, "lm_q1q2_score": 0.8077616962132564, "lm_q2_score": 0.8333245932423308, "openwebmath_perplexity": 642.0889060644628, "openwebmath_score": 0.8209068179130554, "tags": null, "url": "http://www.physicsforums.com/showthread.php?t=291160" }
ros, kinect, create-robot Thanks! patrick Originally posted by Pi Robot on ROS Answers with karma: 4046 on 2011-03-07 Post score: 2 Original comments Comment by Pi Robot on 2011-03-08: Just an update that using pins 12 and 25 plus a 12V regulator works like a charm with the Kinect. I'm also using pins 14 and 10 together with a 5V regulator to power a small USB hub since my onboard laptop only has a single USB port and I am also using a Hokuyo laser scanner and an IMU. Comment by Pi Robot on 2011-03-07: Thanks Murph--that's good to know! I like the idea of hooking up to the 25-pin connector directly so I'll give that a try. Comment by Murph on 2011-03-07: That tutorial is incorrect about using the Serial connectors. They will not supply enough amperage and your kinect will have many transient issues as it fails to power the video cameras properly. I'm not sure about the command module, but I used the DB25 connector that the command module plugs into directly without any issue. I used pin 12 for vin and pin 25 for ground. Someone (who knows more than me) did say that I should be careful about it drawing the battery too low and should add an 'enable' pin to the regulator, but I have not looked into that yet, so I'll pass the warning on to you. Comment by lifelonglearner on 2013-07-25: I am having problem while connecting the kinect power using DB25 connector of Irobot create base. The connector circuit is designed by clearpath robotics to provide 12V DC power to kinect by taking power from pin 10 and 14 of DB25 connector of irobot create base. The manual for the Create can be found here: http://www.irobot.com/filelibrary/create/Create%20Manual_Final.pdf The 5V switched output in the cargo bay is rated at only 100mA. I imagine that the command module is similar in rating. You'll note that the battery voltage is about 14-15V, far too high for the Kinect. However, adding a 12V regulator as shown in the tutorial you reference will solve that problem.
{ "domain": "robotics.stackexchange", "id": 4979, "lm_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, kinect, create-robot", "url": null }
python, beginner, parsing, csv Full text: On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
{ "domain": "codereview.stackexchange", "id": 15859, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, beginner, parsing, csv", "url": null }
java, serialization for (E element : collection) { String line = serializer.serialize(element); if (line.contains("\n")) { throw new IllegalArgumentException( "The line serializer may not return the new line " + "character in its output."); } sb.append(line).append("\n"); } return sb.toString(); } /** * Deserializes the list from the input text <code>text</code>. Each line * is expected to produce exactly one element. * * @param <E> the actual deserialized element type. * @param text the entire string holding the encoding of the entire * list. * @param deserializer the deserializer converting each input line to an * element whose state is encoded by that line. * @return the list of elements encoded by <code>text</code> in * the same order as their respective encoding lines. */ public static <E> List<E> deserialize(String text, LineStringDeserializer<E> deserializer) { List<E> ret = new ArrayList<>(); Scanner scanner = new Scanner(text); while (scanner.hasNextLine()) { ret.add(deserializer.deserialize(scanner.nextLine())); } scanner.close(); return ret; } } LineStringSerializer.java: package net.coderodde.lists.serial; /** * This interface defines the API for serializing an object to a string. * * @author Rodion "rodde" Efremov * @version 1.61 * @param <E> the object type. */ @FunctionalInterface public interface LineStringSerializer<E> { /** * Returns the textual representation of the input object. * * @param object the object to serialize. * @return the textual representation of the input object. */ public String serialize(E object); } LineStringDeserializer.java: package net.coderodde.lists.serial;
{ "domain": "codereview.stackexchange", "id": 14240, "lm_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, serialization", "url": null }
they are devoid of a group first. An idea of how well the measures of central tendency represent the data Q3! Dispersion ’ 3 dispersion … in this lesson, you will read about distribution! 2 above were sampled from a population comprising 100 returns surprisingly, the term statistic first came into as! Cm of a set of measures of dispersion the range is 98 – 58 = 40 square root variance... Simply the square root of variance final math exam scores for 20 students: the measurement! – Q1 why we are using the absolute values Statistics easy by explaining topics in simple and straightforward.... Individual observations from their average are called the dispersion ) is 0.003767 cited example, we observe that re of! Largest and smallest value in a sample or population – 1 is complete data from population! Much easier to comprehend, variance, denoted by σ2, is the difference between the value. 10 ) obtained by 20 people in a set of values ; in of. The term statistic first came into use as late as 1817 Financial Analyst® are registered trademarks owned by Institute. Is 13.67 and the standard deviation, the average variation from the mean may not representative. Dataset of final math exam scores for 20 students: the largest is! Of describing this dataset students were recorded to indicate the amount of variation a. Is large then there are different measures of central tendency such as height weight! Cited example, What is Cochran ’ s Q test you subtract the lowest scores a... This is complete data from one another and gives a clear idea about the following measures of dispersion ’.... The highest and the third quartile in a sample or population of aggregating data is the average with homework. Scatter of the following distribution shows the homogeneity or the heterogeneity of the average of the units observations! Distinguished here ) S2 = { Σ ( Xi – X hence possible relative or... Outliers ( i.e Rights ReservedCFA Institute does not endorse, promote or warrant the accuracy quality... Called as dispersion or variation in the above cited example, What is Cochran ’ s the most way... We ’ ve started colonizing and populating new planets suppose we have this dataset of exam scores: 1 easy. Centimeters, Marks etc ( 0.12 ) is
{ "domain": "marymorrissey.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9802808701643914, "lm_q1q2_score": 0.8351530266828452, "lm_q2_score": 0.8519527944504227, "openwebmath_perplexity": 681.8413820680182, "openwebmath_score": 0.7993106245994568, "tags": null, "url": "http://www.marymorrissey.com/davinci-raspberry-rdcxs/1e3f95-measures-of-dispersion-examples" }
c#, algorithm, machine-learning, clustering Title: A Tiny Nearest Neighbor Classification Implementation in C# I am practicing to implement the KNN classification tool in C#. The basic point structure is constructed by the class Point, and there are two members in Point class: a list of double number and a string. A list of double number is used in order to represent location data in multi-dimensional space. A string is to represent the point label. For example, there are five points (on X-Y plane) here: A(0, 0), B(1, 0), C(0,1), D(10, 0) and E(10, 1). Moreover, point A, B and C are belong to class1, and point D and E are belong to class 2. They can be constructed as the following code. var pointA = new Point(new List<double>() {0, 0}, "class1"); var pointB = new Point(new List<double>() {1, 0}, "class1"); var pointC = new Point(new List<double>() {0, 1}, "class1"); var pointD = new Point(new List<double>() {10, 0}, "class2"); var pointE = new Point(new List<double>() {10, 1}, "class2"); The Point class implementation. public class Point { List<double> location; string label; public Point(List<double> newLocation, string newLabel) { this.location = newLocation; this.label = newLabel; } public Point(List<double> newLocation, char newLabel) { this.location = newLocation; this.label = newLabel.ToString(); } public Point(List<double> newLocation, int newLabel) { this.location = newLocation; this.label = newLabel.ToString(); } public Point(List<double> newLocation, long newLabel) { this.location = newLocation; this.label = newLabel.ToString(); }
{ "domain": "codereview.stackexchange", "id": 39572, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, algorithm, machine-learning, clustering", "url": null }
Oh, Cayley-Hamilton. The automorphism group generator matrix $$A= \left( \begin{array}{rr} 1 & 1 \\ 1 & 2 \end{array} \right)$$ gives us the rule for the sequence of solution pairs, $$\left( \begin{array}{rr} 1 & 1 \\ 1 & 2 \end{array} \right) \left( \begin{array}{r} x_n \\ y_n \end{array} \right) = \left( \begin{array}{r} x_{n+1} \\ y_{n+1} \end{array} \right).$$ Do this twice and you get $(x_{n+2}, y_{n+2})^T.$ However, $A$ has determinant $1$ and trace $3,$ so Cayley-Hamilton says $$A^2 - 3 A + I = 0.$$ In turn, this gives separate rules, $$x_{n+2} = 3 x_{n+1} - x_n,$$ $$y_{n+2} = 3 y_{n+1} - y_n.$$ In the opposite direction, actually the same rule $$x_{n} = 3 x_{n+1} - x_{n+2},$$ $$y_{n} = 3 y_{n+1} - y_{n+2}.$$ We also have $$p = x+2y, \; q = y,$$ therefore we have $$p_{n+2} = 3 p_{n+1} - p_n,$$ $$q_{n+2} = 3 q_{n+1} - q_n.$$ $$p_{n} = 3 p_{n+1} - p_{n+2},$$ $$q_{n} = 3 q_{n+1} - q_{n+2}.$$ Finally, Hagen's comments about twin primes, from Wikipedia,
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9859363708905831, "lm_q1q2_score": 0.8320268690187184, "lm_q2_score": 0.8438950966654772, "openwebmath_perplexity": 246.76685947509196, "openwebmath_score": 0.6340615749359131, "tags": null, "url": "https://math.stackexchange.com/questions/1107129/are-there-infinitely-many-pairs-of-primes-where-each-divides-one-more-than-the-s" }
thermodynamics, gravity, black-holes, orbital-motion, galaxies If instead of black holes we use other bodies such as white dwarfs, neutron stars or even ordinary stars, then the type of gravitational assist described here would have a builtin speed limit in the form of escape velocity on the surface of a body. The lowest of such velocities would determine the maximum velocity of a probe that completes almost complete turnover near such body (for bodies like neutron stars, that need GR to describe orbits around them, the relationship between surface escape velocity and orbital velocity is nontrivial). This limit explains why this type of maneuver would not work for small planets: escape velocity of e.g. Mercury is $4.25\,\text{km/s}$, while Mercury's orbit velocity is $47.4\,\text{km/s}$, so Mercury cannot turn around a probe so that it can fully benefit from its large orbit velocity. Of course, there are a lot of technical issues that could complicate and impose limitations for such type of travel: tidal accelerations on a probe near a black hole or neutron star could be very large, the maneuvering must be very precise, especially as velocities grow, etc.
{ "domain": "physics.stackexchange", "id": 77042, "lm_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, gravity, black-holes, orbital-motion, galaxies", "url": null }
java, strings, array, regex, io public static void main(String[] args) { String textString = null; try { textString = readUrlTextContent("http://textfiles.com/stories/antcrick.txt"); } catch (IOException e) { e.printStackTrace(); } List<String> wordList = splitTextStringIntoWordList(textString); /* Print each word along with its index */ int wordIndex = 0; for (String word : wordList) { System.out.println("[" + wordIndex++ + "] " + word); } } } The output of the program, using The Ant and the Cricket as a source, is as follows: [0] THE [1] ANT [2] AND [3] THE [4] CRICKET [5] ONCE [6] UPON [7] A [8] TIME ... [368] WELL [369] TRY [370] DANCING [371] NOW
{ "domain": "codereview.stackexchange", "id": 15514, "lm_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, strings, array, regex, io", "url": null }
$$F_{Y}(y) = P(Y \leq y) \\ P(\frac{X}{2} \leq y) \\ = P(X \leq 2y) \\ = F_{X}(2y) = 2y \tag{5}$$ You are simply taking the reciprocal. To find the pdf, we differenitate. F_{Y}(y) = \begin{align}\begin{cases} 0 & y< 0 \\ \\ 2y & 0 \leq y \leq \frac{1}{2} \\ 1 & y > \frac{1}{2} \end{cases} \end{align} \tag{6} to find the pdf f_{Y}(y) = F_{Y}^{'}(y) = \begin{align}\begin{cases} 2 & 0 \leq y \leq \frac{1}{2} \\ 0 & \textrm{ otherwise} \end{cases} \end{align} \tag{7} Visually the difference in the two uniform distributions can be seen below. $$X\sim \textrm{Unif}(0,1) \tag{8}$$ $$X\sim \textrm{Unif}(0,1) , Y = \frac{X}{2} , Y \sim \textrm{Unif}(0,\frac{1}{2}) \tag{9}$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9835969708496457, "lm_q1q2_score": 0.8492293825994773, "lm_q2_score": 0.8633916205190225, "openwebmath_perplexity": 304.83411328650135, "openwebmath_score": 0.9999562501907349, "tags": null, "url": "https://math.stackexchange.com/questions/2907001/getting-p-yy-p-xg-1y-left-dfrac-partialx-partialy-right" }
javascript, html, strings, css //What happens when we click that button button.addEventListener( 'click' , function( e ) { var lines = editor.value.split('\n'), columnSizes = {}; //Collect for each line the size of each column, keep the largest column size lines.forEach( function( line ) { var columns = line.split( token.value ); columns.forEach( function( column , index ) { columnSizes[index] = Math.max( column.length , columnSizes[index] || 0 ); }); }); //Build up the new text with aligned columns output.value = lines.map( function( line ) { var columns = line.split( token.value ); return columns.map( function( column , index ) { return column + spaces( columnSizes[index] - column.length ); }).join( token.value ); }).join('\n'); //Make sure Firefox does not go haywire e.preventDefault(); }, false); //Return a string with count spaces function spaces( count ) { return new Array( count + 1 ).join( " " ); } </script> </body> </html> Please review for style and maintainability. I recommend splitting your function into a DOM-and-event-handling function and a text-analysis function. function alignTextColumns( text, delimiter ) { … } button.addEventListener( 'click' , function( event ) { output.value = alignTextColumns( editor.value, token.value ); //Make sure Firefox does not go haywire event.preventDefault(); }, false); That way, the alignTextColumns() function could be reused if the more text areas are added, or if you change the user interface to want to dump the output to the same text area as the input. I would also bury the spaces() helper function inside the alignTextColumns() function.
{ "domain": "codereview.stackexchange", "id": 5815, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, html, strings, css", "url": null }
(Basically, $z$ tags the total number of blocks, so the g.f. is exponential in $z$, and $x$ tags the lengths of the blocks. The $m$ turns into $m+1$ because of the extra empty cell we added.) Bringing things full circle, this says $$f(m,n,k) = \left[\frac{x^{m+1}\,z^{m+1-n}}{(m+1-n)!} \right]\left( G_k(x,z) - G_{k-1}(x,z)\right).$$ There is no simple formula, but you can use a simple recursive property to efficiently compute $f$. Border conditions : 1. if $k>n$ or $n>m$ then $f(m,n,k)=0$ 2. if $k=m=n$ then $f(m,n,k)=1$ Then, any valid (m,n,k) configurations either : 1. begins with $i$ occupied cells followed by an empty cell and a $(m-i-1,n-i,k)$ configuration (for any $i\le k$) 2. begins with $k$ occupied cells followed by an empty cell and a $(m-k-1,n-k,i)$ configuration (for any $i<k$) $$f(m,n,k)=\sum_{i=0}^kf(m-i-1,n-i,k)+\sum_{i=0}^{k-1}f(m-k-1,n-k,i)$$ Using that, you can very efficiently compute $f$ with some dynamic programming. An example in python :
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9867771751368138, "lm_q1q2_score": 0.836755234906066, "lm_q2_score": 0.847967764140929, "openwebmath_perplexity": 265.2935456394739, "openwebmath_score": 0.6601563096046448, "tags": null, "url": "https://math.stackexchange.com/questions/1085808/number-of-ways-to-arrange-n-items-in-m-positions-having-exactly-k-items-ad" }
c#, beginner, game, wpf, xaml Title: WPF Content Navigation and Button management I have been working on my first ever C# project and I'd love some feedback of the any and all aspects variety. I am building a game called Fleet Command. In the MainWindow I use a ContentControl to use various UserControls based on user interaction. The screen navigation is pretty simple so for the most part I am leaving it out. But for context I would like to give you this: MainWindow.xaml <Window x:Class="FleetCommand.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Title="Fleet Command" Height="700" Width="1200" Background="DarkSlateGray"> <Grid> <ContentControl x:Name="MainScreenContent"/> </Grid> </Window> and MainWindow.xaml.cs using System.Windows; using System.Windows.Controls; namespace FleetCommand { /// <summary> /// Struct to encapsulate initialization state from Custom game settings. /// Used to simplify passing many parameters to initialization function and minimize errors. /// </summary> public struct InitialState { public int NumberPlayerCharacters; public int NumberNonPlayerCharacters; public int StartingOil; public int StartingCash; public int StartingResearch; public Difficulty Difficulty; } public enum Difficulty { Easy, Normal, Hard } /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); SetScreen(SplashScreen); }
{ "domain": "codereview.stackexchange", "id": 33070, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, beginner, game, wpf, xaml", "url": null }
inorganic-chemistry Fabien Tran, Peter Blaha, "Accurate Band Gaps of Semiconductors and Insulators with a Semilocal Exchange-Correlation Potential," Phys. Rev. Lett. 2009, 102, 226401, 4 pages (DOI: 10.1103/PhysRevLett.102.226401).
{ "domain": "chemistry.stackexchange", "id": 13435, "lm_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", "url": null }
electricity, electric-circuits, electrons, electrical-resistance, velocity This won't happen if your resistor has finite resistance, in that case there will be electrons drained out of the wire all the time, which creates a slightly little potential gradient at that part of the wire, and at the same time there are electrons pushed into the wire out of the battery, which also creates a tiny potential gradient. The resistance being zero will just make the electron movement faster, and therefore they can balance out the potential difference between the start of the resistor and the battery faster. But as long as there is a current flowing, the potential difference between start of the resistor and the battery will not be zero, but a little bit more. You are right, forces can only act on the electron when there is a potential gradient, but since there is no resistance throughout the wire, it is sufficient if the electron is accelerated at the start of the wire and slowed down at the end (for example). Voltage drop means that electrons have lost potential energy throughout the resistor. This doesn't neccesarrily mean that there are more electrons on one side of the resistor compared to the other side, it just can mean that. The question here is the geometry of the resistor: The charges in the wire before and after, and the ones in the resistor have to create a potential (via 1. Maxwell equation) that has the mentioned potential difference throughout the resistor. However, I usualy would also think that there is a potential gradient pushing electrons through a wire when there is more of them on the first side than on the second. So in principle the answer is "yes", but I don't know if it always has to be like that.
{ "domain": "physics.stackexchange", "id": 35262, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electricity, electric-circuits, electrons, electrical-resistance, velocity", "url": null }
c#, algorithm, linq or use linq (like the first example) Now, assuming you'll have a global List<JoinedShopItemData> named _joinedShopItemData that will hold GetJoinedShopItemData results. In this case, your GetLockedItems method would be : public IEnumerable<ShopItemData> GetLockedItems() { return _joinedShopItemData .Where(item => !item.Unlocked && (item.ItemRarity == ItemRarity.Common || item.ItemRarity == ItemRarity.Rare || item.ItemRarity == ItemRarity.Epic)) .Select(item => new ShopItemData { ItemId = item.ItemId, ItemSprite = item.ItemSprite, ItemRarity = item.ItemRarity, InGamePrefab = item.InGamePrefab, PreviewPrefab = item.PreviewPrefab }).ToArray(); } This will elemnate the need of creating a separate collection for each property condition (like _codaCommonShopItems, _codaRareShopItems ..etc.). As you will always have a joined object which you can access easily.
{ "domain": "codereview.stackexchange", "id": 40255, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, algorithm, linq", "url": null }
urdf combining the xyz and rpy attributes, here is how one can change the coordinates of a point "p" from the child frame to the parent frame: p_parent = [x;y;z] + Rz(yaw)*Ry(pith)*Rx(roll)*p_child Rx(a) = [1, 0, 0; 0, cos(a), -sin(a); 0, sin(a), cos(a)] Ry(a) = [cos(a), 0, sin(a); 0, 1, 0; -sin(a), 0, cos(a)] Rz(a) = [cos(a), -sin(a), 0; sin(a), cos(a) 0; 0, 0, 1] thanks! Originally posted by barthelemy on ROS Answers with karma: 56 on 2014-09-23 Post score: 4 Original comments Comment by Dave Coleman on 2015-11-30: hi @barthelemy, i like your idea to contribute those new details on URDF origin calculations - were they correct and could you still do that? Hi, John an Ioan, thank you a lot for the answers, and sorry for replying myself so late. @John: yes the new addition was just the small section. I do prefer my version, which I do find more explicit. Thus it's clear we're not using fixed axis rotations or so. I'm digging into this because I got inconsistent results while using the urdfdom library to generate urdf xmls, which I first attributed to a misunderstanding of the convention used. Now, I think I've nailed it to a bug in urdfdom quaternion/rpy conversion code (so, Ioan, pasting the code as a reference did not help much :-), thank you for the effort nonetheless) I filed an issue about this here https://github.com/ros/urdfdom/issues/49 the test demonstration the issue is there https://github.com/ros/urdfdom/pull/51 (I hoped github would kind of merge the two.)
{ "domain": "robotics.stackexchange", "id": 19488, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "urdf", "url": null }
computability, halting-problem In the second case, we can create an oracle enriched TM which checks if the non-enriched TM halts. So the enriched TM can give a yes-or-no answer. Of course, there will be new languages which are recursively enumerable in the oracle-enriched world, but not recursive. In the non-enriched world, these languages were not enumerable in any way. NB: In general, the phrase 'oracle' can mean any addition to enrich a Turing machine, not just one to solve the halting problem. If the type of oracle isn't clear from context a phrase like "a Turing machine with an oracle for the halting problem" should be used to avoid confusion.
{ "domain": "cs.stackexchange", "id": 3117, "lm_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, halting-problem", "url": null }
astrophysics, solar-system, galaxies, milky-way Title: What will happen to the Earth when Milky Way and Andromeda merge? Hypothetically, if our solar system survived into the far future and human was still around, is the merge between 2 galaxies were a disaster for lives on Earth? Were the Sun get thrown away from the galaxy? Or were there a planets-type-heavybombardment? Could human hypothetically survive on Earth or any other planet for that matter? Were the system of planets and star get destroyed? P.S. Forgive me for inappropriate tags. I couldn't find a better one. It all depends on the closest approach of any stars to the Sun. When galaxies collide it is not that their stars crash into each other, because their individual cross-sections are extremely small when compared to the space between them. This is dealt with in qualitative terms on the wikipedia page on the likely collision. The Milky Way disk at the position of the Sun has of order $n=0.1$ stars $pc^{-3}$ and is about $L=200$ pc thick. If we say the cross-section for something catastrophic to happen is a disk of radius 100 au around the Sun (at closer than this separation, another star would start to disrupt the quasi-equilibrium of the solar system planets) - this gives $\sigma \simeq 10^{-6}$ pc$^2$. If we then assume that the Andromeda disk is similar to ours (in terms of stellar density) and they have a disk-to-disk collision, then the "optical depth" for a collison is $n \sigma L \simeq 2\times 10^{-5}$, which is roughly the (small) chance of direct collision.
{ "domain": "physics.stackexchange", "id": 24641, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "astrophysics, solar-system, galaxies, milky-way", "url": null }
Heat transport in 1d, two different materials at point contact with NDsolve - I have two materials touching at a point x=0. 1) The first material lies within the interval [-L1, 0], has diffusion constant D1, and the heat conductivity kappa1. Its left end is kept on time dependent heat flux Cos[2 omega t] 2) The second material lies within the interval [0,L2], has diffusion constant D2, and the heat conductivity kappa2. Its right end is kept at constant temperature Temp. Denoting temperatures in the first material as u1[x,t], and in the second as u2[x,t], I want the following continuity at x=0: Continuity of Temperature: u1[0,t]==u2[0,t] Continuity of Energy flow: kappa1 Derivative[1,0][u1][0,t]==kappa2 Derivative[1,0][u2][0,t] The initial condition just requires that both u1[x,0] and u2[x,0] are equal to Temp. I formalized my problem as follows: heateqs = { D[u1[x, t], t] == D1 D[u1[x, t], {x, 2}], D[u2[x, t], t] == D2 D[u2[x, t], {x, 2}]}; bcs = { Derivative[1, 0][u1][-L1, t] == Cos[2 omega t], u1[0,t]==u2[0,t], kappa1 Derivative[1, 0][u1][0, t] == kappa2 Derivative[1, 0][u2][0, t], 2[L2, t] == Temp }; ics = {u1[x, 0] == Temp, u2[x, 0] == Temp}; sol = NDSolve[{heateqs, ics, bcs}, {u1, u2}, {x, L1, L2}, {t, 0, 1000}] PROBLEM: mathematica wrote:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9688561721629776, "lm_q1q2_score": 0.8115332792568936, "lm_q2_score": 0.8376199714402813, "openwebmath_perplexity": 2076.4599701411735, "openwebmath_score": 0.40569809079170227, "tags": null, "url": "https://mathematica.stackexchange.com/questions/208633/heat-transport-in-1d-two-different-materials-at-point-contact-with-ndsolve" }
468057598259133100691994190465190653117190892607794911921794640735512963386452\ 303567334558803331319708036545718479155043265489955970586288828686660661802188\ 224860214499997312216413817065348017551043840662441282280361664890425737764095\ 632648282525840766904560843949032529052633753231650908768133661424239830953080\ 654966187938194912003391948949406513239881664208008839555494223709673484007264\ 270570116508907519615537018626479745638118785617545711340047381076276301495330\ 973517418065547911266093803431137853253288353335202493436597912934128485497094\ 682632907583019307266533778255931433111096384805394085928398890779621047984791\ 968687653998747709591278872747587443980677982496827827220092644994455938041460\ 877064194181044075826980568803894965461658798390466058764534181028990719429302\
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9773708032626702, "lm_q1q2_score": 0.8787749774490344, "lm_q2_score": 0.8991213718636754, "openwebmath_perplexity": 1243.9051674087075, "openwebmath_score": 0.6473212838172913, "tags": null, "url": "https://math.stackexchange.com/questions/2189700/how-do-you-calculate-22222" }
gazebo, navigation Title: Gazebo skid steer drive and navigation stack I want to use gazebo skid steering drive plugin for my 4 wheelled robot and then use navigation stack like in ROS Tutorials. The question is whould it work or I need something else for working?(maybe another controller) Now I've created urdf of my robot with skid steering drive controller, I see that it publish to odom and tf, and it seems ground thuth, but I'm not shure about that because didn't find a lot of information. also I want to see a code of skid steering plugin, but I found only old version =( Originally posted by denzist on ROS Answers with karma: 11 on 2014-04-28 Post score: 1 I've solved following this tutorial. http://gazebosim.org/wiki/Tutorials/1.9/ROS_Control_with_Gazebo Originally posted by Dani C with karma: 126 on 2014-04-29 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 17808, "lm_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, navigation", "url": null }
algorithms, graphs, weighted-graphs, minimum-spanning-tree, depth-first-search Let $T$ be a MST of $G$ that only uses edges in $I$. Consider an edge $f=(u,v)$ such that $w'(f)$ is odd and notice that $f$ does not belong to $T$. Let $P$ be the unique path between $u$ and $v$ in $T$. From the cycle property and the fact that $w(e) \neq w(f)$ it follow that all edges $e \in P$ satisfy $w(e) < w(f)$. Then: $w'(e) = 2w(e) < 2w(f) < 2\lfloor w(f) \rfloor + 2 = w'(f) + 1$, which implies $w'(f) > w(e)-1$. Since $w'(e)$ is even and $w'(f)$ is odd, we must have $w'(f) > w(e)$, and hence $f$ cannot belong to any MST of $G'$. $\square$ To check whether there is an MST of $G'$ that only uses edges of even length, compare the weight of a MST of $G'$ (with weight function $w'$) with the weight of a MST of the subgraph of $G'$ containing only the edges in $I$ (and weight function $w'$). Since both these graphs contain $O(n)$ edges with weights between $0$ and $2n+1 = O(n)$, their MSTs can be computed in time $O(n)$.
{ "domain": "cs.stackexchange", "id": 19675, "lm_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, graphs, weighted-graphs, minimum-spanning-tree, depth-first-search", "url": null }
quantum-computing, time-complexity, boolean-functions, fourier-analysis, analysis-of-algorithms A Fourier theoretic approach: Lets not try to learn $s$ all at once; that way we make no measurable progress up until we actually solve the problem. How about we try to learn s bit by bit. I will use A,B to denote the subsets of $\{0,1\}^d$ as well as the corresponding indicator functions. We have $$\hat{A}(u) = \hat{B}(u)(-1)^{\langle u, s\rangle}$$ If we pick a random $u\in\{0,1\}^d$, by the above equation in linear time we will learn 1 bit of information about $s$, unless $\hat{A}(u) = 0$. Note that this already solves the problem when $d\gg \log n$ due to the uncertainty principle in Fourier analysis: it will imply that at most $2^d/n$ Fourier coefficients are zero. Therefore the hardest case is when $d\approx \log n$. What can we do in this case? Question 2: What is the randomized RAM complexity of this problem? Question 3: What is the quantum complexity? Here is an $O(nd)$ time randomized solution. We will use the shifting (aka compression) technique from combinatorics, in a seemingly new algorithmic way, which I have never seen done before (see this post for the definition of the compression technique). Let us define a partial order on $\{0,1\}^d$ called the set inclusion partial order, denoted $\preceq$, as so: Two strings $x,y$ satisfy $x\preceq y$ if $x_i = 1 \implies y_i = 1$ for all $i\in[d]$. A subset $S\subseteq\{0,1\}^d$ is called downward closed, or downset for short, if $y\in S \land x\preceq y\implies x\in S$.
{ "domain": "cstheory.stackexchange", "id": 4709, "lm_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-computing, time-complexity, boolean-functions, fourier-analysis, analysis-of-algorithms", "url": null }
open(joinpath(@__DIR__, "transp.txt"), "w") do io print( io, """ . FRA DET LAN WIN STL FRE LAF SUPPLY GARY 39 14 11 14 16 82 8 1400 CLEV 27 . 12 . 26 95 17 2600 PITT 24 14 17 13 28 99 20 2900 DEMAND 900 1200 600 400 1700 1100 1000 0 """, ) return end Here the rows are the origins, the columns are the destinations, and the values are the cost of shipping one pogo stick from the origin to the destination. If pogo stick cannot be transported from a source to a destination, then the value is .. The final row and final column are the demand and supply of each location respectively. We didn't account for arcs which do not exist in our formulation, but we can make a small change and fix $x_{i,j} = 0$ if $c_{i,j} = "."$. Our first step is to convert this text format into an appropriate Julia datastructure that we can work with. Since our data is tabular with named rows and columns, one option is JuMP's Containers.DenseAxisArray object: function read_data(filename::String) rows, columns = data[2:end, 1], data[1, 2:end] return Containers.DenseAxisArray(data[2:end, 2:end], rows, columns) end data = read_data(joinpath(@__DIR__, "transp.txt")) 2-dimensional DenseAxisArray{Any,2,...} with index sets: Dimension 1, Any["GARY", "CLEV", "PITT", "DEMAND"] Dimension 2, Any["FRA", "DET", "LAN", "WIN", "STL", "FRE", "LAF", "SUPPLY"] And data, a 4×8 Matrix{Any}: 39 14 11 14 16 82 8 1400 27 "." 12 "." 26 95 17 2600 24 14 17 13 28 99 20 2900 900 1200 600 400 1700 1100 1000 0 ## JuMP formulation
{ "domain": "jump.dev", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9715639669551474, "lm_q1q2_score": 0.8032033839538257, "lm_q2_score": 0.8267117876664789, "openwebmath_perplexity": 3376.230680425771, "openwebmath_score": 0.892329216003418, "tags": null, "url": "https://jump.dev/JuMP.jl/stable/tutorials/linear/transp/" }
c#, stack, collections, iterator Title: StackList implementation I needed a structure that works really similar to the predefined Stack<T> but with a few extra functionalities. Examples include getting the index of value in the collection and being able to index the structure itself. Any flaws or improvement notes are welcome! public class StackList<T> : IEnumerable<T> { private readonly List<T> _stackList = new List<T>(); public T Pop() { if (_stackList.Count == 0) { throw new InvalidOperationException("The stack is empty"); } T value = _stackList[0]; _stackList.Remove(value); return value; } public void Push(T item) { _stackList.Insert(0, item); } public T Peek() { if (_stackList.Count == 0) { throw new InvalidOperationException("The stack is empty"); } return _stackList[0]; } public IEnumerator<T> GetEnumerator() { return _stackList.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public T this[int index] { get { return _stackList[index]; } set { _stackList[index] = value; } } public int Count { get { return _stackList.Count; } } public void Clear() { _stackList.Clear(); } public bool Contains(T item) { return _stackList.Contains(item); } public int IndexOf(T item) { return _stackList.IndexOf(item); } } Issues public void Push(T item) { _stackList.Insert(0, item); } The hurts the stack list. It would be much easier if you just added new items at the end of the list. The Insert needs to rebuild the entire list: This method is an O(n) operation, where n is Count. For an addition this is a real bottleneck. The same applies to the Pop method which internally uses List.Remove: This method performs a linear search; therefore, this method is an O(n) operation, where n is Count.
{ "domain": "codereview.stackexchange", "id": 22922, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, stack, collections, iterator", "url": null }
c++, linked-list system("PAUSE"); return 0; } Considering the following code head_insert(&alist, -1); int result = tail_return(&alist); if (result == -1) std::cout << "error" << std::endl; Is this the correct result? No, you can't have an allowed payload that is also the error code. bool ordered_list(node_ll** list) { if (!*list || !(*list)->next) { return true; } if ((*list)->payload < (*list)->next->payload) { return ordered_list(&(*list)->next); // extremely inefficient recursive call } else { return false; } } Use a while loop instead. bool ordered_list(node_ll** list) { if (!*list || !(*list)->next) { return true; } node_ll *test = *list; // no reason to run around with the double deref. while (test->next && (test->payload < test->next->payload) { test = test->next; } // if there is a next its not ordered if (test->next) { return false; } return true; } Not having a separate tail pointer makes all operations involving tail cost O(N) instead of O(1). Not having a separate tail pointer makes the code easier as it doesn't need to be maintained to insure consistency.
{ "domain": "codereview.stackexchange", "id": 9932, "lm_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 }
c++, object-oriented, matrix, template intResults.push_back(imats[5] + 2 == imats[11]); intResults.push_back(imats[5] - 2 == imats[12]); intResults.push_back(imats[5] * 2 == imats[13]); intResults.push_back(imats[5] / 2 == imats[14]); intTest.push_back("== fail test"); intTest.push_back("!= test"); intTest.push_back("!= fail test"); intResults.push_back(!(imats[0] == imats[1])); intResults.push_back(imats[0] != imats[1]); intResults.push_back(!(imats[1] != imats[1])); intTest.push_back("element read"); intResults.push_back(imats[15].at(0,2) == 2 && imats[15].at(1,0) == 2 && imats[15].at(3,1) == imats[15].at(2,3)); imats[15].at(0, 2, 0); imats[15].at(1, 0, 0); imats[15].at(3, 1, 0); imats[15].at(2, 3, 0); intTest.push_back("element access"); intResults.push_back(imats[15].at(0,2) == 0); intTest.push_back("element access"); intResults.push_back(imats[16] == imats[15]); intTest.push_back("negation"); intResults.push_back(-imats[16] == imats[17]);
{ "domain": "codereview.stackexchange", "id": 32468, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, object-oriented, matrix, template", "url": null }
beginner, ruby, git # Execute git diff to determine files includes as part of commit. out_data = %x{git diff --cached --name-only} pri_branch = "master" # Iterate through the zone files, and check if any are found in the output. # Only one needs to be found. No need to find all. zone_files.keys.each do |key| if out_data.include?zone_files[key] current_branch = %x{git branch}.match(/\* (.+?)\n/m) if current_branch[1].include?pri_branch break else puts "Warning: You have triggered a git pre-commit hook." puts "Warning: Your current branch is: #{current_branch[1]}." puts "Warning: For dns, ensure you commit on branch: #{pri_branch}" puts "Warning: Include '-n' to bypass this check." puts "Exiting..." exit 1 end end end Use fewer abbreviations. It's certainly not bad in this case, but small stuff like production instead of prod (unless perhaps it's a naming convention for your production environment/server), and primary_branch (I guess?) instead of pri_branch. Or, at any rate, be consistent: You have development spelled out, but you shorten production? Use parenthenses or at the very least spaces in method calls - and include? is just a method call. So this expression out_data.include?zone_files[key] looks weird right now. When iterating a hash, the block will be passed the elements as [key, value] arrays. If you add a bit of array destructuring, you get key and value separately. zone_files.each do |environment, file| # ... end
{ "domain": "codereview.stackexchange", "id": 8418, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "beginner, ruby, git", "url": null }
### Author Topic: W3L3 Exact solutions to inexact equations  (Read 285 times) #### Julian • Newbie • Posts: 2 • Karma: 0 ##### W3L3 Exact solutions to inexact equations « on: September 28, 2020, 12:45:14 PM » In week 3 lecture 3, we get the example $(-y\sin(x)+y^3\cos(x))dx+(3\cos(x)+5y^2\sin(x))dy=0$. We determine that this equation is not exact, but that we can make it exact by multiplying the equation by $y^2$. We then find the general solution to the new equation is $y^3\cos(x)+y^5\sin(x)=C$. My question is why is this good enough? We didn't answer the original question. We answered a modified version which we chose specifically because it seems easier to us. Shouldn't we still find a solution to the original equation $(-y\sin(x)+y^3\cos(x))dx+(3\cos(x)+5y^2\sin(x))dy=0$? Is there some way we can "divide out" $y^2$ from $y^3\cos(x)+y^5\sin(x)=C$ to get it? #### Victor Ivrii
{ "domain": "toronto.edu", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9688561694652216, "lm_q1q2_score": 0.8310539257742116, "lm_q2_score": 0.8577681104440171, "openwebmath_perplexity": 240.39384777281464, "openwebmath_score": 0.8428514003753662, "tags": null, "url": "https://forum.math.toronto.edu/index.php?PHPSESSID=3ptc7oe1f7i9uhih3m0tmm1kc0&topic=2404.0" }
• Deleted a comment - I misunderstood. You're right that there's more structure: every morphism has to have a domain and codomain. Informally, $1_A$ belongs to $\hom_{\mathbf{C}/B}(g, g)$ and $\hom_{\mathbf{C}/B}(f, f)$ (and is the identity arrow in both of those hom sets). But one copy has domain/codomain f, and the other has domain/codomain g. Jul 4 at 18:07 Your question makes perfect sense in that if we look at the definition in Wikipedia even Nlab, a category is defined as the "set of objects" $$C_0$$ plus the "set of morphisms" $$C_1$$ with two maps $$s,t: C_1 \to C_0$$. With this definition, one has to be careful when describing arrows in $$C/B,$$ for indeed if there is only one arrow $$1_A \in (C/B)_1$$ (and there was only one arrow in $$1_A \in C_1!)$$, then it is not clear what is $$s$$ and $$t$$ of it. So really then the arrow set $$(C/B)_1$$ has to be defined as the set of triangles $$A \to C \to B$$. In particular, $$1_A$$ then figures in two such triangles. In the definition of a category, you could alternatively ask for a set of arrows $$Mor(A,B)$$ for every pair of objects $$A, B$$, which looks like a better definition to me. Then you can not speak of an arrow without specifying what its domain and codomain are. This is the second definition in the Nlab article above. You can also see a note there in the last paragraph of "Equivalence between the two definitions" speaking basically about the issue you put forward here. Yes, you are absolutely correct! The arrows in $$C/B$$ should be thought of as triples. Here is a common definition of $$C/B$$:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9653811641488383, "lm_q1q2_score": 0.8186121017434663, "lm_q2_score": 0.8479677583778258, "openwebmath_perplexity": 134.21341697294247, "openwebmath_score": 0.963994026184082, "tags": null, "url": "https://math.stackexchange.com/questions/4486164/what-exactly-are-the-arrows-in-a-slice-category" }
gazebo, roboearth Title: roboearth, can't do rosmake. Other image recognition options? Hi to everyone! I follow the steps to install roboearth: http://www.ros.org/wiki/roboearth I'm working with diamondback, not with electric, so I change some things and I install changing the 1rst sentence to: rosinstall ~/ros /opt/ros/diamondback 'http://www.ros.org/wiki/roboearth?action=AttachFile&do=get&target=roboearth.rosinstall' At the end of the installation it says this: Now, type 'source /home/albert/ros/setup.bash' to set up your environment. Add that to the bottom of your ~/.bashrc to set it up every time. If you are not using bash please see http://www.ros.org/wiki/rosinstall/NonBashShells I do what it's said, actually I added this setup.bash to my .bashrc. The question is: is it possible to have two diferent sources in your basharc? One would be source /home/albert/ros/setup.bashsource /home/albert/ros/setup.bash and the otherone would be source /opt/ros/diamondback/setup.bash. After that I install the knowrob and ias_common as said in the tutorial but changing electric to diamondback. No problem. When I try to do the rosmake roboearth it happends an error: [rosbuild] Building package re_ontology Failed to invoke /opt/ros/diamondback/ros/bin/rospack deps-manifests re_ontology [rospack] couldn't find dependency [gazebo] of [re_ontology] [rospack] missing dependency CMake Error at /opt/ros/diamondback/ros/core/rosbuild/public.cmake:113 (message): Failed to invoke rospack to get compile flags for package 're_ontology'. Look above for errors from rospack itself. Aborting. Please fix the broken dependency!
{ "domain": "robotics.stackexchange", "id": 6926, "lm_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, roboearth", "url": null }
tensor-calculus, dielectric, liquid-crystal UPDATE 2. I am more and more enjoying the possibility of using the ordering matrix $S^{\alpha\beta}_{ ij}$. UPDATE 1. In [2] it is said that the diamagnetic anisotropy is written as $\Delta\chi=\chi_{zz}+\frac{1}{2}\left(\chi_{xx}+\chi_{yy}\right)$. If $\vec{a}, \vec{b}, \vec{c} $ are aligned to $\hat{x}, \hat{y}, \hat{z}$, can I regard $B\equiv\Delta\chi=\chi_{zz}+\frac{1}{2}\left(\chi_{xx}+\chi_{yy}\right)$ as the combination I'm looking for? The answer is it depends on the molecule. If it is parallelogram, one can set three director fields $\mathbf{n}$, $\mathbf{l}$ and $\mathbf{m}$ and a tensor order parameter $Q_{ij}=(-1/3)(Q-P) l_{i} l_j+(-1/3)(Q+P)m_im_j+(2/3)Qn_in_j$, as in the equation (B.I.9) of Oswald, Patrick, and Pawel Pieranski. Liquid Crystals: Concepts and Physical Properties Illustrated by Experiments, Two Volume Set. Crc Press, 2018. For bent-core molecules, one can use PhysRevE.66.031704 - Theory of bent-core liquid-crystal phases and phase transitions
{ "domain": "physics.stackexchange", "id": 81412, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "tensor-calculus, dielectric, liquid-crystal", "url": null }
kinematics, symmetry, projectile Title: With air resistance, why does the horizontal range decrease and why is it steeper during the descent phase? IN RELATION TO PROJECTILE MOTION I've been trying to grasp this concept but cannot figure it out. From what i understand, the x-component only has air resistance acting on it so it slows it down quite a bit in the horizontal direction. I'm not sure how to correlate this concept with explaining the distorted shape of the curve though. That’s because air resistance is acting in both directions. Air surrounds the entire projectile and not just the surface facing the x-direction. If you look at the diagram above you will note that the vector $\vec F_{ar}$ has components in both the $x$ and $y$ directions. It gets steeper in the later phase of its flight since it is experiencing this resistance force - which is proportional to $v^2$ - for the greatest amount of time (prior to just falling almost straight to the ground).
{ "domain": "physics.stackexchange", "id": 73392, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "kinematics, symmetry, projectile", "url": null }
vba, excel "Make sure that the spreadsheet was opened from server." & chr(10) & chr(10) & _ "Contact <redacted> if the problem persists.", vbExclamation, "OFFLINE") End If Call Unvisible End Sub
{ "domain": "codereview.stackexchange", "id": 17407, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "vba, excel", "url": null }
c++, c++11, thread-safety, collections, lock-free static void test_15() { { lock_free_forward_list<int> a; std::vector<std::thread> threads1; std::vector<std::thread> threads2; int const threadCount = 5; int const perThreadOpCount = 100000; bool done = false; for (int i = 0; i < threadCount; i++) { threads1.emplace_back([&, i]() { for (int j = 0; j < perThreadOpCount; j++) { int op = rand() % (perThreadOpCount / 100); if (op == 0) { std::cout << "\n" << a.clear() << "\n"; } else { a.push_front(rand() % 20, std::memory_order_relaxed, std::memory_order_relaxed); } } }); } for (int i = 0; i < threadCount; i++) { threads2.emplace_back([&, i]() { auto iterator = a.begin(); while (!done) { if (iterator != a.end()) { std::cout << *iterator << " "; } if (iterator == a.end()) { iterator = a.begin(); } else { ++iterator; } } }); } for (auto &thread : threads1) { thread.join(); } done = true; for (auto &thread : threads2) { thread.join(); } } DUMP; } //static void test_() { // { // lock_free_forward_list<int> a; // } // DUMP; //}
{ "domain": "codereview.stackexchange", "id": 12394, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, c++11, thread-safety, collections, lock-free", "url": null }
energy, electronic-band-theory \begin{equation} \begin{split} \phi_{\pm} &= \psi_{\pi/a} \pm \psi_{-\pi/a} \\ &\propto e^{i\pi x/a} \pm e^{-i\pi x/a} \end{split} \end{equation} resulting in standing waves $\phi_{+} \propto \cos{\pi x/a}$ and $\phi_{-} \propto \sin{\pi x/a}$. Now, why does this imply that the energy dispersion should be flat near the zone boundaries, i.e. why does $|\frac{\partial E_{n,k}}{\partial k}|_{k=\pm \pi/a} = 0$? Well the solutions at the BZ boundary do not depend on $k$, therefore the first derivative is $0$ and the dispersion goes flat. A slightly more hand wavey explanation is that $v_{g} = \frac{1}{\hbar}\frac{\partial E_{n,k}}{\partial k}$ where $v_{g}$ is the group velocity. A standing wave is necessarily not a travelling wave and therefore has $v_{g} = 0$ meaning that the dispersion is flat at those points.
{ "domain": "physics.stackexchange", "id": 88835, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "energy, electronic-band-theory", "url": null }
called a mixed partial derivative) is a second order derivative of a function of two or more variables. The first interpretation we’ve already seen and is the more important of the two. First, the always important, rate of change of the function. In the section we will take a look at a couple of important interpretations of partial derivatives. If fhas partial derivatives @f(t) 1t 1;:::;@f(t) ntn, then we can also consider their partial delta derivatives. As we saw in the previous section, $${f_x}\left( {x,y} \right)$$ represents the rate of change of the function $$f\left( {x,y} \right)$$ as we change $$x$$ and hold $$y$$ fixed while $${f_y}\left( {x,y} \right)$$ represents the rate of change of $$f\left( {x,y} \right)$$ as we change $$y$$ and hold $$x$$ fixed. Partial derivatives of order more than two can be defined in a similar manner. “Mixed” refers to whether the second derivative itself has two or more variables. Geometric Interpretation of the Derivative One of the building blocks of calculus is finding derivatives. if we allow $$y$$ to vary and hold $$x$$ fixed. Resize; Like. Since we know the $$x$$-$$y$$ coordinates of the point all we need to do is plug this into the equation to get the point. Geometry of Differentiability. To get the slopes all we need to do is evaluate the partial derivatives at the point in question. Fig. The partial derivative of a function of $$n$$ variables, is itself a function of $$n$$ variables. Application to second-order derivatives One-sided approximation This is a useful fact if we're trying to find a parametric equation of Recall the meaning of the partial derivative; at a given point (a,b), the value of the partial with respect to x, i.e. If we differentiate with respect to $$x$$ we will get a tangent vector to traces for the plane $$y = b$$ (i.e. We’ve already computed the derivatives and their values at
{ "domain": "ochorvatsku.cz", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9724147201714923, "lm_q1q2_score": 0.8226068841217686, "lm_q2_score": 0.8459424431344437, "openwebmath_perplexity": 277.3219350886113, "openwebmath_score": 0.8812790513038635, "tags": null, "url": "http://www.apartaments.ochorvatsku.cz/vzq0gvh/01cny.php?id=03f69c-geometric-interpretation-of-second-order-partial-derivatives" }
java, jsf-2 @Inject ContactPersonEditController contactPersonEditController; @Inject CustomerDetailsController customerDetailsController; @Inject ContactPersonDistributor businessInterface; public String addContactPerson() { return redirectToContactPersonView(0); } public String editContactPerson(final long contactPersonId) { return redirectToContactPersonView(contactPersonId); } private String redirectToContactPersonView(final long contactPersonId) { contactPersonEditController.recieveContactPersonById(contactPersonId, customerDetailsController.getCustomerId(), Pages.CUSTOMER_DETAILS); return Pages.CONTACTPERSON_EDIT; } public String deleteContactPerson(final long contactPersonId) { businessInterface.delete(contactPersonId); customerDetailsController.reloadCurrentCustomer(); return Pages.CUSTOMER_DETAILS; } } CustomerDetailsContractTabController.java: (46 lines, 1350 bytes) @Named @RequestScoped public class CustomerDetailsContractTabController implements Serializable { private static final long serialVersionUID = 4857482696383153934L; @Inject ContractEditController contractEditController; @Inject CustomerDetailsController customerDetailsController; @Inject ContractDistributor businessInterface; public String addContract() { contractEditController.recieveCustomerToEditContracts( customerDetailsController.getCustomerId(), 0l, Pages.CUSTOMER_DETAILS); return Pages.CONTRACT_EDIT; } public String editContract(final long contractId) { contractEditController.recieveCustomerToEditContracts( customerDetailsController.getCustomerId(), contractId, Pages.CUSTOMER_DETAILS); return Pages.CONTRACT_EDIT; }
{ "domain": "codereview.stackexchange", "id": 7815, "lm_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, jsf-2", "url": null }
1. ## Circle Geometry Help Please A (-6,2) and B (-4,-2) are endpoints of a chord of a circle. C (2.-4) and D (8,4) are endpoints of a second chord. a) Determine the coordinates of the center of the circle. b) Determine the radius of the circle. 2. Hi The center of the circle is equidistant from A and B therefore is on the mediator of [AB] It is also on the mediator of [CD] 3. Originally Posted by PiratePrincess A (-6,2) and B (-4,-2) are endpoints of a chord of a circle. C (2.-4) and D (8,4) are endpoints of a second chord. a) Determine the coordinates of the center of the circle. b) Determine the radius of the circle. An alternative way is... The centre of the circle is the same distance away from all 4 points. If the centre is (x,y) then we can use the distance formula on any 3 of the 4 points to find (x,y). $[x-(-6)]^2+[y-2]^2=[x-(-4)]^2+[y-(-2)]^2=[x-2]^2+[y-(-4)]^2$ $(x+6)^2+(y-2)^2=(x+4)^2+(y+2)^2=(x-2)^2+(y+4)^2$ Multiply this out $x^2+12x+36+y^2-4y+4=x^2+8x+16+y^2+4y+4=x^2-4x+4+y^2+8y+16$ Since $x^2+y^2$ is common to all three, we can eliminate them $12x-4y+40=8x+4y+20=-4x+8y+20$ Combining the first two equations to write x in terms of y
{ "domain": "mathhelpforum.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9840936106207203, "lm_q1q2_score": 0.8284352485273468, "lm_q2_score": 0.8418256551882382, "openwebmath_perplexity": 812.5110858057245, "openwebmath_score": 0.8742784261703491, "tags": null, "url": "http://mathhelpforum.com/geometry/130913-circle-geometry-help-please.html" }
pressure, everyday-life, physical-chemistry, vacuum Extra: Is this (your answer) also a reason for not semi-compressing half-full flexible plastic cola bottles before closing them? Creating a vacuum above carbonated drinks causes the CO2 to outgas faster--simply because there is no CO2 above the drink to diffuse back into the liquid. In physical terms this means there is no vapor pressure of CO2 above the liquid, so net movement of CO2 is from the drink to the space above it. If you leave a closed carbonated drink bottle long enough, the partial pressure of CO2 in the drink and in the space above the drink are the same--rate of gas that escapes the drink is equal to the rate that dissolves back into it--equilibrium. Note that it is not solely about gas pressure but partial pressure of the gas you are interested in. Pressurising your champagne bottle with pure air to above atmospheric and sealing it wont extend the bubblyness. You need to pressurise with CO2 gas. For soft drinks you need 2 bar CO2 (in a typical coke bottle left alone for awhile, the space above the drink is almost pure CO2 and is at 2bar). Your question about PET bottles is a good one. As mentioned, without a CO2 pump you cant extend the life of your sodas. Squeezing a half full bottle and sealing it removes the volume of available space above the drink, so when CO2 inevitably escapes the liquid to form equilibrium vapor pressure above it, less CO2 is required for this to happen--if the bottle doesnt expand back. The problem is that the bottle has structurual integrity and is designed to spring back. This creates low pressure in the bottle, causing CO2 to outgas faster than if you hadn't done all this in the first place. The upside is that equilibrium is the same--you lose the same amount of CO2 from the drink as if you had not done this. To really save gas, when you squeeze the bottle and seal it, you have to find a way to keep the bottle from springing back. Or just store unfinished soda in bottles where there is very little space for CO2 to outgas into.
{ "domain": "physics.stackexchange", "id": 10647, "lm_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, everyday-life, physical-chemistry, vacuum", "url": null }
Hint: Start your proof like this: Let $k$ be any arbitrary odd integer. Then by the definition of an odd integer, we have $k=2a+1$ for some integer $a$. Thus... Then consider $-k=-(2a+1)$ and perform some algebraic manipulations. Your final step should look something like: ...hence, since $-k=2b+1$ where $b$ is an integer, it follows by definition that $-k$ is also an odd integer, as desired. - One could prove this inductively: Assume that the $n^\text{th}$ odd positive integer, $2n-1$, has an odd negation. Then $-2n+1$ is odd, so $$\underbrace{-2n+1}_{\text{odd}}-\underbrace{2}_{\text{even}}=\underbrace{-2n-1}_{\text{odd}}.$$ Thus the statement holds for the $(n+1)^\text{th}$ positive integer, $2n+1$. - I like the simplicity of this approach. Pedantic: you still also need to prove the base case. –  Lie Ryan Jun 23 '13 at 17:12 Here's my proof of the equivalent statement for even integers. I'll let you figure out what to do for odds. Let $n$ be an even integer. By definition of "even", $\exists m \in \mathbb{Z}: n=2m$. Then $-n = -2m = 2(-m)$. Because $\mathbb{Z}$ is closed under additive inverse, $-m$ is an integer. By the definition of "even", $2(-m) = -n$ is also even, Q.E.D. - Let our odd number be $o$. Since $-1\equiv 1 \pmod{2}$, $-o\equiv o \pmod{2}$. By the definition of odd numbers, $o\equiv 1 \pmod{2}$. Combining this with the earlier statement, one gets
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9706877717925422, "lm_q1q2_score": 0.8151194959249042, "lm_q2_score": 0.8397339696776499, "openwebmath_perplexity": 355.84346631379634, "openwebmath_score": 0.9768029451370239, "tags": null, "url": "http://math.stackexchange.com/questions/427256/prove-that-the-additive-inverse-of-an-odd-integer-is-an-odd-integer" }
c++, reinventing-the-wheel Finally, your data members: T *data_ = nullptr; size_type size_ = 0; size_type capacity_ = 0; allocator_type allocator_; data_ should really be pointer, not T*. As for allocator_… the thing is that allocators quite often are empty. However, if you include an allocator data member like this, then it takes up space in your class even though it doesn’t need to. In C++20, you can use [[no_unique_address]]. Prior to that, you’d use the empty base optimization trick. Frankly, I’d suggest not bothering with EBO; it’s going to be obsolete in a few months. I think that’s it! Summary There are only a very small number of critical bugs in the code: Your custom helper::distance() function only supports random access iterators, though you use it for other iterator categories. In a couple places, you copy/move pointers without copying the allocators as well. This could cause a situation where you’re deallocating memory with the wrong allocator. In shrink_to_fit() you set the capacity to zero… which is almost sure to lead to crashes and/or leaks. In the const version of back(), you dereference past-the-end. There are a few potential problems that aren’t necessarily bugs (though could become bugs depending on your intended usage): There are a few places where exception safety doesn’t even meet the minimal weak guarantee (where an exception will not only leave the object in an unknown state, it will almost certanly lead to UB). There are a few places where you don’t keep track of which parts of your memory are initialized and which are not, and possibly use the wrong type of algorithm. There are a few places where you seem to intend to use iterator categories your code doesn’t actually support (for example, making multiple passes through what are supposed to be input iterators). There are a few functions that don’t offer the same guarantees as the std::vector versions, like where std::vector promises they will work even with non-default constructible types, but your versions do default constructions.
{ "domain": "codereview.stackexchange", "id": 38736, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, reinventing-the-wheel", "url": null }
quantum-mechanics, wavefunction, probability, quantum-interpretations, born-rule Now this is a set of mathematical prescriptions that works. We have rules for how the system behaves in between measurements and rules for how to predict measurement results and what the state immediately after a measurement is. But there is a large void to be filled: what is truly happening? Now, there are different interpretations of this. None of which change the mathematical framework, just the way this mathematics is to thought about. Copenhagen takes everything quite literal: there is unitary evolution and then a measurement is like a sledgehammer, smashing the quantum egg the system is in and giving us a classical result. There is many worlds theory that says that the superposition that is encoded in the unitary evolution isn't actually destroyed but that the world is constantly in superposition, it's just our minds that cannot perceive it. And that, unfortunately, is just the distinction you want to clarify in your question. Is the probability a feature that is introduced by measurement or is everything probabilistic? For many worlds, superposition permeates reality and measurement doesn't change anything about it. It just branches reality further and further. For Copenhagen, superposition exists at the microscopic level, but is destroyed once we do a measurement to get a macroscopically readable results, and complex probability is replaced by real probability. So, I'm sorry that there isn't a more definite answer to your question. I rather took the effort to show why it's hard to answer.
{ "domain": "physics.stackexchange", "id": 74552, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, wavefunction, probability, quantum-interpretations, born-rule", "url": null }
# Simplifying $\sqrt{4+2\sqrt{3}}+\sqrt{4-2\sqrt{3}}$ How do I simplify $\sqrt{(4+2\sqrt{3})}+\sqrt{(4-2\sqrt{3})}$? I've tried to make it $x$ and square both sides but I got something extremely complicated and it didn't look right. I got $2\sqrt{3}$ on wolframalpha, but I'm not sure how is it possible? Help would be appreciated! Thanks! \begin{align} &\ \ \ \sqrt{4+2\sqrt{3}}+\sqrt{4-2\sqrt{3}} \\ \\ &=\sqrt{(\sqrt{3}+1)^2}+\sqrt{(\sqrt{3}-1)^2}\ \\ \\ &=\sqrt{3}+1+\sqrt{3}-1 \\ \\ &=\boxed{2\sqrt{3}} \end{align} You have the right idea in squaring and then taking the square root. Note that $k = (\sqrt{4 + 2\sqrt{3}} + \sqrt{4 - 2\sqrt{3}})^{2} = 4 + 2\sqrt{3} + 2\sqrt{(4+2\sqrt{3})(4-2\sqrt{3})} + 4 - 2\sqrt{3}$ But this is just: $k = 8 + 2\sqrt{16 - 12} = 12$ So $\sqrt{k} = 2\sqrt{3}$ • Good solution, certainly much better than mine. – André Nicolas May 7 '13 at 1:31 • I wouldn't say that @AndréNicolas, just less observant than yours ;) – Alex Wertheim May 7 '13 at 1:31 • +1 Much better explanation than the "rabbit out of a hat" accepted answer. – wim May 7 '13 at 4:35
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9835969679646668, "lm_q1q2_score": 0.8238804622218082, "lm_q2_score": 0.8376199694135332, "openwebmath_perplexity": 795.1547546324759, "openwebmath_score": 0.999964714050293, "tags": null, "url": "https://math.stackexchange.com/questions/383975/simplifying-sqrt42-sqrt3-sqrt4-2-sqrt3/383979" }
electronic-configuration What is the maximum number of electrons that can be found in an atom when its last electron has the following quantum numbers: n=4,ml=+3 The answer depend on how you interpret "last electron". Going from Thulium to Ytterbium, you could argue the last electron is going into $4f$, whereas from Ytterbium to Lutetium, the last electron is going to $5d$. On the other hand, the $5d$ is filled before $5f$ going from Barium to Lanthanum. Comparing Lanthanum to Lutetium, all 14 electrons seem to be going into the $4f$ subshell, supporting the notion that the answer to the question is 71. In the end, it is not the best question - it does not have a clear answer, and you don't really learn anything from the answer other than that the energies of $4f$ and $5d$ are close to each other.
{ "domain": "chemistry.stackexchange", "id": 12941, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electronic-configuration", "url": null }
javascript, interview-questions, angular.js cards: {data: { response: [{"id":1117967,"slug":"quell-the-world-s-first-pain-relief-wearable","created_at":"2015-02-03T12:59:31-08:00","updated_at":"2015-03-04T21:23:13-08:00","title":"Quell: The World's First Pain Relief
{ "domain": "codereview.stackexchange", "id": 12537, "lm_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, interview-questions, angular.js", "url": null }
python, algorithm, object-oriented, python-3.x Title: Condorcet voting method in OOP Python For learning purposes, I made this little class which determines the Condorcet winner of a rank voting election (basically, a Condorcet winner is a candidate that would beat every other candidate in a head-to-head election). This code does work, but I'd like to learn two-three things by posting it here: Is this class written in a correct Pythonic way? Do you see any ways to improve this code? (bonus) If there are voting specialists among you, could you tell if that way of going through a Condorcet algorithm seems correct? Condorcet.py: import itertools
{ "domain": "codereview.stackexchange", "id": 6213, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, algorithm, object-oriented, python-3.x", "url": null }
algorithms, graphs In practice, the second approach is too difficult for us to come up with results that we can understand or that could be beautiful. So, while I like the second approach very much as a challenge, I would suggest that you go with the first approach in a casual setting. Note that there are a few ambiguities inherent in the question that needs to be defined formally (a.k.a. rigorously) before we can agree what is the way to count. For example, what does it mean by an "unlabelled weighted tree"? Do we require that the same weight be assigned to all edges that could be mapped to each other under an graph isomorphism (which happens to be the cases here)? How will we distinguish two "unlabelled weighted" trees? These questions should have been answered before we can count the number of distinct MSTs in a definitive way.
{ "domain": "cs.stackexchange", "id": 12789, "lm_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, graphs", "url": null }
thermal-radiation Title: Problem on Emissivity and absorptivity I have read the radiation chapter, where I have been introduced with the terms emissivity and absorptivity. emissivity tells about the ability to emit heat energy as thermal radiation compare to a black body. and absorptivity is the amount of heat absobed by body devided by the incident heat energy .but my question is ,are these emissivity and absorptivity constant or depends on temperature? Actually I had a misconception that these quantities are intrinsic property of body If I have really wrong concept and they depends on temperature then tell me and Tell me how they depends on temperature I mean I need The mathematical expression In a way, these are intrinsic properties of a material that depend on temperature. The temperature of the object dictates what a black body curve looks like and which wavelengths are emitted in what amounts. The emissivity of a material is not always uniform across all wavelengths, which means at different temperatures, you might get different emission profiles depending on the emissivity of the material at each wavelength along the curve. Similarly, the absorptivity can differ with wavelength. This means the absorptivity and emissivity values for a material might be not just different, but variably different. So the material might absorb well at the wavelength of incident radiation and emit poorly at its current temperature, but as a result, it may then heat up into a blackbody range where it is a good emitter. Furthermore, it also means the amount of energy the material absorbs (when pointed at a blackbody object) could depend on the temperature of the object it is pointed at. There is no mathematical relation to provide you. Absorptivity and emissivity are intrinsic properties of a material. We test materials and empirically find the wavelength dependence of those values. It varies greatly from material to material, which means any time you want to use a different material, you should look up the $\alpha$ and $\epsilon$ values for the wavelengths you expect to be relevant. Usually, however, it is sufficient to look up wavelength ranges, such as visible light, near IR, UV, etc.
{ "domain": "physics.stackexchange", "id": 36367, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermal-radiation", "url": null }
$\begin{array}{cccccccc}\text{Substitute into [8]:} & 12\left(\tfrac{1}{3}\right) + 2b \;=\;5 & \Rightarrow &\boxed{ b \:=\:\tfrac{1}{2}} \end{array}$ $\begin{array}{ccccccc}\text{Substitute into [5]:} & 7\left(\tfrac{1}{3}\right) + 3\left(\tfrac{1}{2}\right) + c \:=\:4 & \Rightarrow &\boxed{ c \:=\:\tfrac{1}{6}} \end{array}$ $\begin{array}{cccccc}\text{Substitute into [1]:} & \tfrac{1}{3} + \tfrac{1}{2} + \tfrac{1}{6} + d \:=\:1 & \Rightarrow & \boxed{d \:=\:0} \end{array}$ Therefore: . $f(n) \;=\;\tfrac{1}{3}n^3 + \tfrac{1}{2}n^2 + \tfrac{1}{6}n \quad\Rightarrow\quad\boxed{ f(n) \;=\;\frac{n(n+1)(2n+1)}{6}}$
{ "domain": "mathhelpforum.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.986777175331244, "lm_q1q2_score": 0.8157803373921011, "lm_q2_score": 0.8267118026095991, "openwebmath_perplexity": 288.89629659031084, "openwebmath_score": 0.8472750782966614, "tags": null, "url": "http://mathhelpforum.com/algebra/61419-chessboard-equation-please-help.html" }
javascript, jquery this.i = 0; } s = $(this).find('p').text() current_max = parseInt(s.substr(s.length - 1)) if ( $(this).is($(':nth-child(1)')) || $(this).is($(':nth-child(2)')) || $(this).is($(':nth-child(3)')) || $(this).is($(':nth-child(4)')) ) { if(this.i < current_max) { this.i = this.i+1 total_off = total_off + 1 spent_points = spent_points + 1 $(this).find('span').text(this.i); $('span.offensive').text(total_off); $('span.spent').text(spent_points); } console.log(this.i); } else if ( $(this).is($(':nth-child(5)')) || $(this).is($(':nth-child(6)')) || $(this).is($(':nth-child(7)')) || $(this).is($(':nth-child(8)')) ) { if(this.i < current_max) { this.i = this.i+1 total_def = total_def + 1 spent_points = spent_points + 1 $(this).find('span').text(this.i); $('span.defensive').text(total_def); $('span.spent').text(spent_points); } console.log(this.i); } else if ( $(this).is($(':nth-child(9)')) || $(this).is($(':nth-child(10)'))
{ "domain": "codereview.stackexchange", "id": 9019, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "javascript, jquery", "url": null }
quantum-mechanics, statistical-mechanics Title: Misconception about the expectation of a quantum system For a two-level quantum system with energy eigenstates $|\phi_1\rangle$ and $|\phi_2\rangle$ at finite temperature, we can write a general state as $$|\Phi\rangle=c_1|\phi_1\rangle+c_2|\phi_2\rangle.$$ In quantum mechanics, we know that the expectation of an operator $\hat{O}$ is given by $$\langle\Phi|\hat{O}|\Phi\rangle = |c_1|^2\langle\phi_1|\hat{O}|\phi_1\rangle +|c_2|^2\langle\phi_2|\hat{O}|\phi_2\rangle +c_1^*c_2\langle\phi_1|\hat{O}|\phi_2\rangle +c_2^*c_1\langle\phi_2|\hat{O}|\phi_1\rangle.$$ However, in statistical mechanics, the expectation value is instead $$\text{probability}(\phi_1)\langle\phi_1|\hat{O}|\phi_1\rangle + \text{probability}(\phi_2)\langle\phi_2|\hat{O}|\phi_2\rangle,$$ which simplifies to only the first two terms of the expression obtained from quantum mechanics. What is wrong here? Your formula for the expectation value in statistical mechanics is wrong.
{ "domain": "physics.stackexchange", "id": 3943, "lm_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, statistical-mechanics", "url": null }
thermodynamics, energy, entropy $$\alpha = \frac{1}{V}\left(\frac{\partial V}{\partial T}\right)_{P,N},$$ but it seems to me that even defining this assumes that we can speak about $V$ as a function of $T,P,N$? The most basic postulate of equilibrium thermostatics as presented by Callen is that given a system in equilibrium it is completely described by its macroscopic parameters and said description is a functional relationship between a thermal parameter called entropy $S$, conserved mechanical parameters $X_k;k=1,2,..M$ and the internal energy is given as $U=f^u(S,X_1,..X_M)$, the so-called caloric equation of state. Note below $^\#$. In Callen's treatment, the function $U=f^u(X_0, X_1,X_2,...X_M)$ is supposed to be piece-wise smooth, continuous and continuously differentiable function, of the variables ${X_0,X_1,...X_M}$, say, $X_0=S$, $X_1=V, X_2=N, X_3=\text{electric charge}, X_4=\text{electric dipole moment},etc....$ The possibly several smooth, continuous/continuously differentiable pieces, over discrete non-overlapping domains $\mathcal D_m$ of the configuration variables ${X_0,X_1,...X_M}$ are the various phases of the system. The boundaries that separate these neighboring domains $\mathcal D_m$ are described by equilibrium equations formed by these smooth functions similar to the case of $M=2$ resulting in the usual formulation of the Clausius-Clapeyron equation.
{ "domain": "physics.stackexchange", "id": 95249, "lm_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, energy, entropy", "url": null }
ros return launch_me Is it possible to use a launch argument as a conditional in a launch file? EDIT: Solved thanks to djchopp! To properly add the conditional, I had to do four things: Add an import statement for IfCondition Add a launch configuration, which I called should_launch_hardware. Add the condition to the hardware_launch launch action. Remove the useless if-statement around adding the hardware_launch action to launch_me. It will be added every time, but using the condition should_launch_hardware, ROS will decide if it actually gets executed or not. A summary of the additions I made to the code are shown below: from launch.conditions import IfCondition #1 .... should_launch_hardware = LaunchConfiguration('should_launch_hardware') #2 .... hardware_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource([launch_directory, '/hardware_nodes.launch.py']), launch_arguments={'car_name': LaunchConfiguration('car_name')}.items(), condition=IfCondition(should_launch_hardware) #3 ) The entire new launch file looks like this: # Standard library imports from os.path import join # Third-party imports from ament_index_python.packages import get_package_share_directory from launch_ros.actions import Node from launch import LaunchDescription from launch.actions import DeclareLaunchArgument from launch.actions import IncludeLaunchDescription from launch.conditions import IfCondition #1 from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import LaunchConfiguration def generate_launch_description(): bridge_topics = join(get_package_share_directory('piracer'), 'config', 'ackermann_bridge_topics.yaml') launch_directory = get_package_share_directory('piracer') should_launch_hardware = LaunchConfiguration('should_launch_hardware') #2 launch_me = LaunchDescription()
{ "domain": "robotics.stackexchange", "id": 36678, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros", "url": null }
c++, email, socket, windows, state-machine Title: POP3 message downloader using state machine processor This simple program uses a socket class I wrote, class socket, to retrieve a users pop3 emails and print to stdout. I would like feedback on the socket class and the code to download the pop3 emails. My main focus is on the simple state machine to go through the steps required to download the messages. It looks a bit ugly. There are probably better ways to do it. main.cpp: #include <iostream> #include <algorithm> #include <sstream> #include "socket.hpp" bool message_ok(int result, const char* buffer) { return result != -1 && result > 3 && strncmp(buffer, "+OK", 3) == 0; } int main(int argc, char* argv[]) { for (int i = 1; i < argc; ++i) std::cout << "param: " << i << ' ' << argv[i] << '\n'; if (argc != 5) { std::cout << "Usage pop3puller hostname port username pop3password\n"; return 0; } itl::socket sock; std::cout << "Attempting to open connection\n"; int ret = sock.connect(argv[1], atoi(argv[2])); std::cout << "Connection " << (ret == 0 ? "successfully opened\n" : "failed!\n"); const int MAX_BUFFER = 4096; char buffer[MAX_BUFFER+1] = { 0 }; ret = sock.recv(buffer, MAX_BUFFER); std::for_each(buffer, buffer + ret, [](const char ch) { std::cout << ch; });
{ "domain": "codereview.stackexchange", "id": 16210, "lm_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++, email, socket, windows, state-machine", "url": null }
performance, beginner, php, strings, file-system $previousNames=array_reverse(UpdateStocks::searchFilenames(glob($dir."/*"),$p)); $lurl .= "$cn-$sc-$mk-$enc"; But I am not sure if I got everything strait, lol. So make sure to test it. Kind of hard just working it out in my head. Still need a condition but it's a lot shorter and easier to read. For this one: searchFilenames /** * * @return an array with values of paths of all front md files stored */ public static function searchFilenames($array,$re){ $arr= array(); foreach($array as $k=>$str){ $pos=strpos($str, $re); if($pos!==false){ array_push($arr, $str); } } return $arr; } You can use preg_grep. For example: public static function searchFilenames($array,$re){ return preg_grep('/'.preg_quote($re,'/').'/i',$array); } //or array_filter public static function searchFilenames($array,$re){ return array_filter($array,function($item)use($re){ return strpos($re)!==false;}); }
{ "domain": "codereview.stackexchange", "id": 33861, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "performance, beginner, php, strings, file-system", "url": null }
ros, moveit, ros-melodic, move-group-interface, move-group Is there a way to fix a start state in rviz that correspond to the initial pose of our robotic arm? will this guarantee that trajectories found on the simulator and the arm will be the same. edit to the question I am using move_group_interface and I use the relevant APIs to plan and execute simple goals (pose goal or a joint-space goal). I write a simple launch file which sort of replicates the functionality that comes within demo.launch. In this launch file, I invoke my motion planning node. In rviz, I see the trajectory followed by the ur5. At the startup, the arm appears lying down, and then it follows the path to the desired goal pose. Concerning the initial configuration was all zeros [0,0,0,0,0,0], I checked this, in my code. std::vector<double> jointVals; // a joint-space target double refVals[] = {-3.05938765, -1.2903219, 1.662077, -0.36599554, -1.484228, 3.14752677}; for (int j=0; j<6; j++) { jointVals.push_back(refVals[j]); } move_group.setJointValueTarget(jointVals); success = (move_group.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS); I can retrieve the trajectory my_plan.trajectory_ and inspect the points. I will try setting a different start configuration, and check the results. I will try to test this in a collision-free environments (no obstacles). I have not yet loaded (from a file) and executed any trajectories yet. But I can save the trajectory points. I have a follow up question on this topic here question. thanks, zahid Originally posted by zahid990170 on ROS Answers with karma: 135 on 2021-02-26 Post score: 0
{ "domain": "robotics.stackexchange", "id": 36146, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros, moveit, ros-melodic, move-group-interface, move-group", "url": null }
c++, object-oriented, game, mvvm constexpr float card_width = 128.f; constexpr float card_height = 128.f; constexpr unsigned max_pairs = 16u; constexpr float win_width = screen_width - 300.f; constexpr float win_height = screen_height - 150.f; constexpr float win_x = 150.f; constexpr float win_y = 75.f; constexpr float winstring_x = 400.f; constexpr float winstring_y = 100.f; constexpr float player_winstring_x = winstring_x - 50.f; constexpr float player_winstring_y = winstring_y + 200.f; enum class DeckSize { six = 6, eight = 8, twelve = 12, sixteen = 16 }; enum class CardState { unmatched, checking, matched }; enum class menuMouseIn { play, six, eight, twelve, sixteen, none }; enum class gameMouseIn { pause, reset, none }; enum class winState { none, draw, playerOne, playerTwo }; #endif // !BRUGLESCO_MEMORY_EXPRESSIONS_H One of the concepts I used in designing this project was the idea of Top-Down Design. I welcome any feedback on this approach as a whole and its fit in a project like mine as well as my implementation of it. As this was my approach in building the project I will also present it to you in this manner. Main.cpp #include "Memory.h" int main() { Memory memory; memory.run(); } Memory is the name of the class that is essentially the entire application. Memory.h #ifndef BRUGLESCO_MEMORY_MEMORY_H #define BRUGLESCO_MEMORY_MEMORY_H #include "Expressions.h" #include "ModelData.h" #include "Viewport.h" #include <SFML\Graphics.hpp> class Memory { public: void run(); private: ModelData data; Viewport view{ data }; bool playing{ true }; void input(); void update(); void draw(); };
{ "domain": "codereview.stackexchange", "id": 30624, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, object-oriented, game, mvvm", "url": null }
It is then a simple exercise of induction to show that $x_n$ is either $(0, 0)$ or of the form $\frac{1}{2^m}(a, b)$ where $m \leq n$, and $a$, $b$ are odd integers with absolute value below $2^m$. In other words, the coordinates are dyadic, with common minimal denominator, and inside the unit square. A more interesting exercise is to show that this is exactly the support of our distribution. Indeed, if we restrict ourselves to $a_n \neq (0, 0)$, each coordinate with common minimal denominator $2^m$ can be reached in exactly one way after $m$ iterations (which would give a uniform distribution on the support, converging to a uniform distribution on the unit square). Hint: Work backwards from $x_m$ to $x_0 = (0, 0)$. Coming back to our original situation, after solving for $x_n$: $$x_n = \sum_{k=0}^{n-1} 2^{k-n} a_k,$$ we can easily compute, approximate and sketch its distribution. Indeed, denoting by $\alpha$ the distribution of $a_k$ and by $\xi_n$ the distribution of $x_n$, the above equation means $$\xi_n = \sum_{k=1}^n 2^{-k}\alpha,$$ where sum of distributions represents the distribution of the sum of independent variables. From that we arrive at the essential property $$\xi_{m+n} = \xi_m + 2^{-m}\xi_n.$$ This property is useful in several ways. For instance, we can iteratively compute/sketch $\xi_8$ from $\xi_4$. Also, it shows that $\xi_m$ approximates $\xi_n$ for arbitrarily large $n$ to precision $2^{-m}$.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9796676419082933, "lm_q1q2_score": 0.8421847540126272, "lm_q2_score": 0.8596637451167997, "openwebmath_perplexity": 298.8489057032838, "openwebmath_score": 0.9700760245323181, "tags": null, "url": "https://math.stackexchange.com/questions/1795276/does-this-fractal-have-a-name" }
bobbym 2013-02-10 03:43:18 Johnathon bresly 2013-02-09 22:49:33 What is the difference between absolute and conditional convergence?[examples will be appreciated]
{ "domain": "mathisfunforum.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9621075766298657, "lm_q1q2_score": 0.8017479129155147, "lm_q2_score": 0.8333246015211008, "openwebmath_perplexity": 11058.272120106383, "openwebmath_score": 0.7947797775268555, "tags": null, "url": "http://www.mathisfunforum.com/post.php?tid=18963&qid=252586" }
java, beginner, object-oriented, chess } // This if for normal pawn captures. // this is for Enpassant. return false; } @Override public Coordinate[] getPath(Coordinate initPos, Coordinate finalPos) { //This is for pawn captures if (initPos.getX()!=finalPos.getX()){return new Coordinate[]{initPos,finalPos};} //This is for normal pawn moves and first pawn moves. int pathLength = Math.abs(initPos.getY() - finalPos.getY()) + 1; Coordinate[] path = new Coordinate[pathLength]; for (int cnt = 0; cnt < pathLength; cnt++) { path[cnt] = new Coordinate(initPos.getX(), Math.min(initPos.getY(), finalPos.getY()) + cnt); } return path; } } Queen.java package pieces; import player.PlayerType; import game.Coordinate; /** * @author gnik * */ public class Queen extends Piece{ /** * Create a Queen * @param player The player the queen belongs to */ public Queen(PlayerType player){ super(player,PieceType.QUEEN); } @Override public boolean isValidMove(Coordinate initPos,Coordinate finalPos) { if (initPos.equals(finalPos)){return false;} //This is the bishop move. int diffX=Math.abs(initPos.getX()-finalPos.getX()); int diffY=Math.abs(initPos.getY()-finalPos.getY()); if (diffX==diffY) return true; //This is the rook move. if (initPos.getX()==finalPos.getX() || initPos.getY()==finalPos.getY()) {return true;} return false; }
{ "domain": "codereview.stackexchange", "id": 30698, "lm_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, object-oriented, chess", "url": null }
formal-languages, formal-grammars Let me give another approach to think about this. Might be a little bit to much theory, but just for education and reasoning. Note that the famous Dyck language is defined as $$ D := \{ w \in \{a,b\}^{\ast} : |u|_a \le |u|_b \mbox{for each prefix $u$ of $w$ and } |w|_a = |w|_b \}. $$ It is quite simple to give a grammar for this language, for example $$ S \to \varepsilon \mid SS \mid aSb. $$ Now if we denote by $\mbox{pref}(L)$ the set of prefixes of some language $L$ then your initial language of words having at most as many $a$'s as $b$'s in any prefix is $\mbox{pref}(D)$. And it is quite easy to derive a grammar from it, just make sure every production could be finished any time on the right (for a general argument see this post), hence we could give the grammar $$ S \to \varepsilon \mid SS \mid aSb \mid aS \mid a $$ where the production $S \to aS$ could also be leaved out. Now simply note that words fulfilling your restriction have to start with an $a$ and proceed as above.
{ "domain": "cs.stackexchange", "id": 12689, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "formal-languages, formal-grammars", "url": null }
python, beginner, python-3.x, comparative-review, game-of-life Title: Conway's Game of Life in Python3 I've implemented Game of Life in Python for a programming problem, in two different versions: one is a simple script and the other uses a class with a dictionary to initialize the various parameters. Here is the version with a class: # Object oriented implementaition of Conway's Game of life import random import time import os class GOL(): def __init__(self, rows, cols, delay, num_generations,\ alive_cell="*", dead_cell="."): self.rows = rows self.cols = cols self.delay = delay self.generations = num_generations self.alive_cell = alive_cell self.dead_cell = dead_cell def read_grid(self, array): """ Reads a given grid from a text file and sanitizes it to be used with the script. Keyword arguments: array -- the array into which the grid is loaded. Using python's with keyword the values of the grid are loaded into the array line by line. Once the values are loaded, it checks for the boundaries and sets them to -1 """ with open("grid.txt", 'r') as f: for line in f: temp = [] for i in range(len(line) - 1): if line[i] == "*": temp.append(1) elif line[i] == ".": temp.append(0) array += [temp] print(array) for i in range(len(array)): for j in range(len(array[0])): if (i == 0 or j == 0 or (i == len(array) - 1) or (j == len(array[0]) - 1)): array[i][j] = -1
{ "domain": "codereview.stackexchange", "id": 12343, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, beginner, python-3.x, comparative-review, game-of-life", "url": null }
ros-melodic Originally posted by hitesh khanna on ROS Answers with karma: 1 on 2020-03-28 Post score: 0 Original comments Comment by gvdhoorn on 2020-03-28:\ I have attached the screenshot as well there is no screenshot attached. This is a good thing, as error messages are text. Text should not be shown in a screenshot, but just copied into your question, verbatim. Please copy-paste the error message into your question, select the lines of the error and press ctrl+k or click the Preformatted Text button (the one with 101010 on it). It looks like Catkin detects Python 3 as the default interpreter. ROS Python packages are installed for the default version of Python which is Python 2 on Ubuntu Bionic (since you tagged melodic). Please see #q337135 and #q340510. The answers are clear and comprehensive. In short, you will either need to make Catkin use the Python 2 interpreter (recommended) or install catkin_pkg for the Python 3 interpreter. Originally posted by karenchiang with karma: 241 on 2020-03-28 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 34652, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros-melodic", "url": null }
quantum-state, textbook-and-exercises, linear-algebra If a matrix is not invertible, its determinant is nil. Reciprocally, it is invertible if its determinant isn't nil. If there is a non-zero vector $x$ such that $Mx$ is the zero vector, then $M$ isn't invertible. Reciprocally, if the only $x$ such that $Mx=0$ is $x=0$, then $M$ is invertible. If there is a non-zero vector $x$ such that $Mx=\lambda x$ for a certain $\lambda$, then $\lambda$ is an eigenvalue of $M$.
{ "domain": "quantumcomputing.stackexchange", "id": 5359, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-state, textbook-and-exercises, linear-algebra", "url": null }
python, performance for c in Centroid: Centroid[c] = [] # Reset list of points to empty In the next section, you iterate over all your points (here you go again, segregating ordinates from abscissas!) computing a distance metric. You store the distances in a list. After creating the distances list, you then find the min value. After finding the min value, you then try to map back to the index of that value. After finding the index, you use that to figure out what centroid was closest to the point, and tie the point to the centroid. You overlook the min function's key= argument. The key is a function (or lambda-expression) that returns a value. Given the input, the min function determines what to compare by calling the key function. If the key function is not provided, then a simple identity function ( f(x) = x ) is used. In your case, you can replace all that code by judicious use of a lambda-expression: # This should be your global Point store, not x[] and y[] Points = [ (_x, _y) for _x, _y in zip(x,y) ] for p in Points: x,y = p nearoid = min(Centroid, key=lambda c: distance(x,c[0],y,c[1])) Centroid[nearoid].append(p) And if you recode your distance function to take tuples, you don't need to do even that much work: for p in Points: nearoid = min(Centroid, key=lambda c: distance(p, c)) Centroid[nearoid].append(p)
{ "domain": "codereview.stackexchange", "id": 24849, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, performance", "url": null }
bose-einstein-condensate, superfluidity, ground-state Title: Ground state energy of Bose Einstein gas I am wondering why BE gas ground state contribute no energy.if so, then dose it mean that if we drive the Bose gas to absolute zero,then it doesn't own any energy? It means that all atoms are in the ground state, then since potential energy is defined up to a constant you can say ground state has zero energy
{ "domain": "physics.stackexchange", "id": 22630, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "bose-einstein-condensate, superfluidity, ground-state", "url": null }