text stringlengths 1 1.11k | source dict |
|---|---|
complexity-theory, computability
But I'm quite sure "Is 6 equal to 2 * 3?" is a mathematical statement and can be validated by a computer.
So what did the text mean by that? I'm confused!
PS: Sorry if the Complexity theory tag is misplaced here. As I said I'm new to the field and on the same page the author of the book stated that the theories of computability and complexity are closely related. The claim is not that a computer cannot determine the validity of some mathematical statements. Rather, the claim is that there is a class $\mathcal{C}$ of mathematical statements such that no algorithm can decide, given a statement from class $\mathcal{C}$, whether it is valid or not.
The standard choice for the class $\mathcal{C}$ is statements about natural numbers, for example: | {
"domain": "cs.stackexchange",
"id": 18701,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, computability",
"url": null
} |
electromagnetism, electromagnetic-radiation, everyday-life, scattering, polarization
The radiation fields due to such a system are described in any Electromagnetism textbook.
The oscillating charge acts like an oscillating current, backwards and forwards in the direction of oscillation. One then solves the inhomogeneous wave equation using its general solution, that tells us that the magnetic vector potential generated by the oscillating current is in the same direction as that current. The magnetic field is the curl of this vector potential and so is directed azimuthally curling around the oscillating current. The electric field of the transverse waves is then perpendicular to the magnetic field and also to the radial vector pointing away from the oscillating dipole - i.e. in a poloidal direction (the $\theta$ direction in spherical coordinates). | {
"domain": "physics.stackexchange",
"id": 63623,
"lm_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, electromagnetic-radiation, everyday-life, scattering, polarization",
"url": null
} |
c#, mvvm
}
public void addAccount(AccountVM vM)
{
this.Add(vM);
}
public ObservableCollection<AccountVM> GetAccounts()
{
return this;
}
public void deleteAllAccounts()
{
this.Clear();
}
}
} MVVM
MVVM is normally structured as following:
View // user interface
↑ ↓
Viewmodel // handles user interaction, makes data ready for display, 'glue' layer
↑ ↓
Model // actual business logic | {
"domain": "codereview.stackexchange",
"id": 29163,
"lm_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#, mvvm",
"url": null
} |
natural-language-processing, pig-latin, apl
Is this a good way of handling the edge case ''?
Would it be better if I had a dfn guard for the '' case?
Would you handle it in a different way?
Is ≠⊆⊢ an idiom in APL to split the right vector on the left arguments? It even shows in the tooltip for the Partition ⊆ glyph.
Any further comments, suggestions, etc that don't necessarily address my questions are also welcome. Overall
Your approach is fine, and your code (including ≠⊆⊢) is fairly idiomatic. Handling the edge case by always appending a space and dropping it at the end is standard procedure, so no, you don't need a branch here.
Split up your code in sections
You begin with setting up a couple of constants. Consider inserting a blank line to gently separate these from the main code.
Inline comments
Well-written APL code tends to have short lines, so there's generally enough space to include comments. This allows a simple hierarchy of comments: | {
"domain": "codereview.stackexchange",
"id": 37914,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "natural-language-processing, pig-latin, apl",
"url": null
} |
python, python-3.x, multithreading
An astute reader may notice that this is Python 3's print function. Suppose we changed it just a little bit, to not use
sys.stdout as the default stream and instead use a thread-local stream. Now we may be tempted to use the builtin threading.local function,
however that will make it hard to recover the output after the fact. Let's start by making a mechanism for getting a thread-local output stream.
thread_local_data = {
'stdout': {},
'stderr': {}
}
def register_thread(thread_ident=None):
"""Register a thread with the monitor."""
thread_ident = thread_ident or threading.get_ident()
thread_local_data['stdout'][thread_ident] = io.StringIO()
thread_local_data['stderr'][thread_ident] = io.StringIO()
def unregister_thread(thread_ident=None):
"""Unregister a thread with the monitor."""
thread_ident = thread_ident or threading.get_ident()
thread_local_data['stdout'][thread_ident].close()
thread_local_data['stderr'][thread_ident].close() | {
"domain": "codereview.stackexchange",
"id": 28328,
"lm_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, multithreading",
"url": null
} |
quantum-mechanics, atomic-physics, tensor-calculus, linear-algebra, bloch-oscillation
$$i\frac{d}{dt}m_{1,1}=-m_{1,1}\omega_{0}+m_{1,0}\omega_{+1}\sqrt{2}$$
Now to go to Cartesian coordinates I use the conversion of spherical basis, which are:
$$m_{1,+1}=\frac{m_{x}-im_{y}}{\sqrt{2}}$$
$$m_{1,0}=m_{z}$$
$$m_{1,-1}=-\frac{m_{x}+im_{y}}{\sqrt{2}}$$
But this doesn't give the Bloch equations! When I substitute those in the last result I get (by also adding and subtracting the first and last equations to separate mx and my equations)
$$\frac{d}{dt}m_{x}=-\sqrt{2}m_{z}\left(i\omega_{x}\right)-m_{y}\omega_{z}$$
$$\frac{d}{dt}m_{y}=-\sqrt{2}m_{z}\left(i\omega_{y}\right)-m_{x}\omega_{z}$$
$$\frac{d}{dt}m_{z}=\sqrt{2}m_{x}\left(i\omega_{x}\right)-\sqrt{2}m_{y}\left(i\omega_{y}\right)$$
Which are weird and I don't understand... could someone please explain where I did a mistake? Why am I not getting the Bloch equations? Thanks to the people who've helped, though the problem was pointed to me by my Professor and also in a comment by Bubble. | {
"domain": "physics.stackexchange",
"id": 14325,
"lm_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, atomic-physics, tensor-calculus, linear-algebra, bloch-oscillation",
"url": null
} |
rviz, ros-kinetic, mesh, uwsim, ogre
with an absolute path RViz can still not load the file? That seems strange.
Comment by gvdhoorn on 2018-02-14:
@Javier Perez: if this is UWSim specific behaviour, then perhaps you should post your comment as an answer?
Comment by thepirate16 on 2018-02-14:
@Javier Perez what do you mean with "not loadable"? .uwsim is a hidden folder, a part from that if the absolute path is given the file should be found.
Comment by Javier Perez on 2018-02-14:
UWSim expects to find a relative path from ~/.uwsim, while rviz expects a "package://XXX" or "file://XXX" prefix so the same .urdf will not load on both systems if I'm not wrong, It has been some months without working on this.
Comment by gvdhoorn on 2018-02-14:
It's not too nice, but perhaps a symlink linking the mesh in a package to a subdir in the .uwsim dir could work.
Comment by Javier Perez on 2018-02-14: | {
"domain": "robotics.stackexchange",
"id": 30043,
"lm_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, ros-kinetic, mesh, uwsim, ogre",
"url": null
} |
complexity-theory, optimization, np, traveling-salesman
Title: How can TSP be an NP-optimization problem, when a feasible solution $s$ must be polynomial bounded in the instance size $|I|$? How can TSP be an NP-optimization problem ?
The definition of an NP-optimization problem $\Pi$ states that for each instance $I \in \Pi$ , the set of feasible solutions $S_\Pi(I)$ is non-empty and that the size of each $s \in S_\Pi(I)$ is polynomial bounded in $|I|$, where $|I|$ denote the size of $I$.
However, in the case of TSP an instance will be encoded using $n^2$ bits, where $n$ is the number of vertices in the instance graph, using the adjacency matrix representation.
But there are $n!$ feasible solutions ? In order to encode these one must use $n! \setminus 2^n$ bits. This number increase as $n$ increase, but $p(|I|)$ is fixed ?
How I overseen something ? A solution in the TSP problem is a sequence of $n$ vertices.
Consider a labeling $1,\dots, n$ of the $n$ vertices.
We need $O(\log{n})$ bits to encode the label of each vertex. | {
"domain": "cs.stackexchange",
"id": 4289,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, optimization, np, traveling-salesman",
"url": null
} |
computability, reference-request, proof-techniques, turing-completeness, cellular-automata
For a good survey on universality in cellular automata and other ideas for proving universality:
Nicolas Ollinger: Universalities in Cellular Automata*. Handbook of Natural Computing pp 189-229
Finally a *personal* idea on an alternative approach that could be investigated:
Proving universality of larger CAs (with larger neighbourhood or more states) is much easier and you can even get rid of the intermediate tag-system simulation, so you could investigate if using rule 110 gliders it is possible to simulate an arbitrary larger CA; a slightly similar approach has been used by Nicolas Ollinger and Gaétan Richard in A Particular Universal Cellular Automaton to prove the universality of colliding particles systems (they prove that a particular system can simulate an arbitrary CA)
And don't forget that instead of working on a different proof for rule 110 universality, you can work on the open problem regarding rule 54 ... is it (weakly) universal ? :-) | {
"domain": "cs.stackexchange",
"id": 5463,
"lm_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, reference-request, proof-techniques, turing-completeness, cellular-automata",
"url": null
} |
python, ros-kinetic, callback, spin, topic
Title: How to wait a method until a callback finishes?
Hi all,
I'm trying to stop a method until a particular callback is executed, because this method uses data that is updated in the callback, but I don't know how to do this task. I'm using ros kinetic and python.
Thanks for your help!!
Originally posted by Ivan_Sanchez on ROS Answers with karma: 41 on 2018-11-04
Post score: 0
Your main method executes on one thread, and callbacks are called on a different thread, so you should use the python threading library to coordinate between those threads.
Since you have a data structure that you want to protect against concurrent modification, you should probably use a lock:
my_data = []
my_lock = threading.Lock()
def callback(msg):
global my_lock
global my_data
with my_lock:
# do something with my_data
while True: # main loop; or however you want to do it
with my_lock:
# do something else with my_data | {
"domain": "robotics.stackexchange",
"id": 32004,
"lm_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, ros-kinetic, callback, spin, topic",
"url": null
} |
javascript, jquery
function setUpSectionOne(el1, el2) {
var toggle = true;
if (settings.subcount == 1) {
activate($('.pagination ul li:nth-child(1)'));
} else if (settings.subcount != 1 && settings.subcount < (projectCount + 2)) {
activate($('.pagination ul li:nth-child(4)'));
} else if (settings.subcount == (subcounter - 3)) {
activate($('.pagination ul li:nth-child(7)'));
} else if (settings.subcount == (subcounter - 2)) {
activate($('.pagination ul li:nth-child(10)'));
} else if (settings.subcount == (subcounter - 1)) {
activate($('.pagination ul li:nth-child(13)'));
} else if (settings.subcount == subcounter) {
activate($('.pagination ul li:nth-child(16)'));
} else {
toogle = false;
}
if (toggle) {
toggle(el1, el2);
}
}
This is just for the first section, but it should be easy to apply it for the others as well. | {
"domain": "codereview.stackexchange",
"id": 1890,
"lm_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
} |
ros, communication, ros2
If you can assume it's more like a serial link, another common way to go over lower bandwidth links is via Micro-ROS which is optimized for serial types of links.
However if your link gets down to the range of highly custom, broadcast only that's not a use case where ROS is designed to work and I don't think that you'll find anything general purpose for that case as it's very specific to your system doing customized partial serialization. If you're optimizing to that level general purpose frameworks likely aren't the right tool. | {
"domain": "robotics.stackexchange",
"id": 2648,
"lm_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, communication, ros2",
"url": null
} |
thermodynamics, statistical-mechanics, fluctuation-dissipation
Title: Heat capacity in statistical mechanics A known result from statistical mechanics is the following fluctuation-dissipation relation:
\begin{equation}
\frac{\partial^2S}{\partial E^2} = - \frac{1}{C_v T^2} \tag{1}
\end{equation}
where $C_v$ is the heat capacity of the system.
This equation looks to me a bit odd, since $S$ is additive and $C_v$ is also supposed to be additive in some generalized sense (for instance, through Kopp's law).
This behaviour is made explicit, for instance, in exercise 3.8 of "Entropy, Order Parameters and Complexity" from J. P. Sethna, where the final result to be shown is that, if there are two subsystems (1) and (2), then:
\begin{equation}
\frac{1}{C_v^{(1)}}+\frac{1}{C_v^{(2)}}=-T^2\Big{(}\frac{\partial^2S_1}{\partial E_1^2}+\frac{\partial^2S_2}{\partial E_2^2}\Big{)} \tag{2}
\end{equation} | {
"domain": "physics.stackexchange",
"id": 86842,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, statistical-mechanics, fluctuation-dissipation",
"url": null
} |
sorting, swift, ios, hash-map
while !Done {
for i in imageUrlString {
let key = Int(String(i.key.last!))
if j == key {
values.append(i.value)
keys.append(i.key)
print(i, " This is the i for in if ")
if imageUrlString.count == j {
print("Done yet: yes", values[0], " ", values[3])
Done = true
break;
}
j+=1
} else {
print("No,,.")
}
}
} Making it to the promised land of O(n)
To reproduce your code in a playground, a Media struct could be defined this way:
struct Media {
let mediaUrl: String
let postTimeStamp: String?
let timeStamp: String //A double would be more appropriate
init(mediaUrl: String, timeStamp: String, postTimeStamp: String? = nil) {
self.mediaUrl = mediaUrl
self.timeStamp = timeStamp
self.postTimeStamp = postTimeStamp
}
} | {
"domain": "codereview.stackexchange",
"id": 33838,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sorting, swift, ios, hash-map",
"url": null
} |
organic-chemistry, carbon-allotropes
cyclo-$\ce{C18}$ appeared to be a very elusive compound to isolate (on macroscoping scale typical products are anthracene and polymers), therefore only its derivatives were synthesized and characterized. Synthetic methods include the following paths: Retro-Diels-Alder; 3-Cyclobutene-l,2-dione route; transition metal complexation [2]:
Generally, cyclic cumulenes have two types of strains: distortion from linearity imposed by $\mathrm{sp}$-hybridization and distortion from orthogonality of adjacent double bonds (cyclo[2n]carbons). [6]
Attempts to liberate the cyclocarbons strain in cyclic cumulenes is similarly relieved by complexing one of the double bonds directly to a transition metal. For example, like in this zirconocene-hexapentaene complex, where $\ce{C=C=C}$ angle is reduced to approx. $130^\circ$ by complexation with $\ce{Zr}$ [7]: | {
"domain": "chemistry.stackexchange",
"id": 8565,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, carbon-allotropes",
"url": null
} |
otherservos
The only part I'm not sure on is how to setup the camera drive. It looks like I can buy a similar timing belt here, but I'm not sure how to set up the servo to drive the slider. Particularly how to keep the belt in contact with the drive pulley.
My fabrication skills are very limited so I need a simple or out of the box solution. As can be seen in the following two photos from pages 1 and 3 of David Hunt's article mentioned in question, the timing belt forms a U-bend as it passes the motor's drive pulley. Sets of bearings support the back of the belt on each side of the drive pulley. It looks like the centerline of the drive pulley is in line with the rest of the belt. A deeper U than is shown probably would be a good idea. | {
"domain": "robotics.stackexchange",
"id": 697,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "otherservos",
"url": null
} |
javascript, html, css, calculator
Maintain a consistent style. In some places you neglected to add semi colon to the end of lines.
Use functions to reduce the amount of repeated code. (see rewrite)
Avoid single use variables.
Use textContent rather than innerText to set an elements text.
The code that check for gender is a very obscure. Make sure that the code is not ambiguous and that you do not need to hunt around to find out what the code does.
CSS
Use a style class rather than directly setting the style property. For example hiding and showing the results you have
document.getElementById('results').style.display = 'none';
// then later in a function
document.getElementById('results').style.display = 'block';
Rather create a style rule. Add the class to the HTML as default. Then remove the rule when you need to show the content
/* CSS */
.hidden {display: none}
<!-- HTML -->
<div id="results" class="hidden">
// JavaScript
document.getElementById('results').classList.remove("hidden") | {
"domain": "codereview.stackexchange",
"id": 40599,
"lm_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, css, calculator",
"url": null
} |
water, crystal-structure, solvents
Title: Approach to model solvent in a lattice: e.g. H2O in NaCl If a lattice contains a solvent, lets say $\ce{NaCl}$ and water of crystallisation, what is the condition for a solvent molecule to change it's location?
From my current point of view I assume that such a water molecule is bound to a lattice ion by ion-dipole forces. It vibrates at that location until, randomly, the particle energy exceeds the binding energy. Then it goes to a new location, in the direction that minimizes Gibbs free energy.
How is the water molecule energy distributed? Currently I use Maxwell-Boltzmann distribution. However, Maxwell-Boltzmann is for non-interacting particles and therefore not quite a good fit for molecules that interact with a ion. Further, my chemistry book suggest that ion-dipole bonds have a binding energy of >$50~\mathrm{kJ~mol^{-1}}$, which will in my calculations rarely allow a jump at all. | {
"domain": "chemistry.stackexchange",
"id": 1882,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "water, crystal-structure, solvents",
"url": null
} |
complexity-theory, complexity-classes
Title: Counting approximate solutions Many of us are familiar with the $P$ class. Counting solutions is believed to be a difficult task and that is why we usually end up approximating the number of solutions (we relax the accuracy of the counting). I want to ask, if relaxing the quality of the solutions counted has been addressed as a problem. Is there for example, any algorithms able to answer the question: How many vertex covers there are, with 3 times the cardinality of the minimum vertex cover? Is the problem $P-$ complete? Let $(G,k)$ be an instance of vertex cover, where $G$ is a graph on $n$ vertices, and $k$ is the threshold. Suppose furthermore that the minimum vertex cover of $G$ has size either at most $k$ or at least $ck$ for some $c > 1$; this version is already NP-hard. | {
"domain": "cs.stackexchange",
"id": 2633,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, complexity-classes",
"url": null
} |
electrostatics, electric-fields, potential
Title: Distribution of charge when 2 metallic spheres are connected It is given in my textbook that when 2 charged conducting sphere of different radius are connected by finite wire the redistribution of charges takes place such that the potential just outside of both spheres become equal.
But why potential is the necessary condition?
Like if net electric field just outside one sphere is 0 then even if there is some potential difference charge will not flow ,so why doesn't electeic field is necessary condition ??
And what should be the relation between the charges of two sphere after equillibrium is established when they are just touched? When you touch two spheres, you can consider them as one system, in other words, one big conductor. Now, if a conductor has different potentials on either side, then current (charges) flows through it from higher potential to lower potential. | {
"domain": "physics.stackexchange",
"id": 77359,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics, electric-fields, potential",
"url": null
} |
mathematics, quantum-phase-estimation, state-preparation
So, it seems it is best to look at individual eigenvectors.
Let $|\psi\rangle$ be an eigenvector of $H_{obj}$ with eigenvalue $E_{obj}$. For simplicity, let's consider the best case when $E_{obj}=E$. Then, the probability of measuring $|1\ldots 1\rangle |\psi \rangle$ is:
$$\tag{1} \prod_{n=1}^{N} \cos^2 \left[ \left( E_{obj} - E \right) \frac{t_n}{2} \right] = \prod_{n=1}^{N} \cos^2 \left( 0 \right) = 1.$$
So, the eigenvector whose eigenvalue is very close to $E$ will have a high probability of being observed. If our initial guess is a superposition of eigenvectors of $H_{obj}$ then the vector whose eigenvalue is closest to $E$ gets a probability boost.
The authors claim that for every other eigenvector that satisfy $E_{obj} \neq E$, we have:
$$\tag{2} \prod_{n=1}^{N} \cos^2 \left[ \left( E_{obj} - E \right) \frac{t_n}{2} \right] = \prod_{n=1}^{N} \cos^2 \left[ c \frac{t_n}{2} \right] = \mu^{N}.$$ | {
"domain": "quantumcomputing.stackexchange",
"id": 4026,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mathematics, quantum-phase-estimation, state-preparation",
"url": null
} |
gazebo, navigation, ros-kinetic, husky, move-base
acc_lim_theta: 3.2
acc_lim_x: 2.5
acc_lim_y: 2.5
holonomic_robot: false
meter_scoring: true
costmap common params
obstacle_range: 2.5
raytrace_range: 3.0
#footprint: [[-0.5, -0.33], [-0.5, 0.33], [0.5, 0.33], [0.5, -0.33]]
#robot_radius: ir_of_robot
inflation_radius: 0.55
observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: front_laser, data_type: LaserScan, topic: front_laser/scan, marking: true, clearing: true}
local costmap params
local_costmap:
global_frame: odom
robot_base_frame: base_link
update_frequency: 5.0
publish_frequency: 2.0
static_map: false
rolling_window: true
width: 6.0
height: 6.0
resolution: 0.05
global costmap params
global_costmap:
global_frame: /map
robot_base_frame: base_link
update_frequency: 5.0
static_map: true
Originally posted by topkek on ROS Answers with karma: 27 on 2018-06-15
Post score: 0
Original comments
Comment by stevejp on 2018-06-16:\ | {
"domain": "robotics.stackexchange",
"id": 31021,
"lm_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, ros-kinetic, husky, move-base",
"url": null
} |
special-relativity, spacetime
Title: Order of events for an observer separated by space This is a fairly simple question, but one that I'm a bit confused on. I have five lamps at positions $x_A,x_B,x_C,x_D,x_E$ which turn on at times $ct_A, ct_B, ct_C, ct_D,ct_E$ in the ground's rest frame.
The problem is, given a space-time diagram of these events, what order does the observer on the ground at $x=0$ see the lamps turn on? The lamps are at rest in the ground's rest frame, and so is the observer.
Intuition leads to three possible interpretations, and I'm not sure which is correct.
What order does the line $y=t$ intersect each of the lamps' events on the space-time diagram? That is, draw a horizontal line on the diagram, and move the line up, noting the order it reaches each event. This seems the simplest interpretation. | {
"domain": "physics.stackexchange",
"id": 33180,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, spacetime",
"url": null
} |
time-complexity, search-algorithms, randomized-algorithms
On a side note, the complexity class associated with decision problems solvable with zero-sided error probabilistic TMs is the class ZPP (though this is only tangential to your question since, as I have explained above, you are not working in the realm of decision problems anyway). | {
"domain": "cs.stackexchange",
"id": 13424,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "time-complexity, search-algorithms, randomized-algorithms",
"url": null
} |
sound-recognition
And if you want to react to a specific volume, then just sum the 3 microphones together and compare that to some trigger value. The mean value of the microphones would be their sum divided by 3, but you don't need to divide by 3 if you increase the trigger value by a factor 3.
I'm having issues with marking the code as C/C#/C++ or JS or any other, so sadly the code will be black on white, against my wishes. Oh well, good luck on your venture. Sounds fun.
Also there is a 50/50 chance that the direction will be 180 away from the source 99% of the time. I'm a master at making such mistakes. A correction for this though would be to just invert the if statements for when 180 degrees should be added. | {
"domain": "dsp.stackexchange",
"id": 6077,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sound-recognition",
"url": null
} |
botany, taxonomy, nomenclature
To be complete, there are also trinomial names (e.g. subspecies, varieties and forms): the first two part are the specie name (so binomial) plus an abbreviation of rank plus the detailed name. Also in this case it has meaning only together with the first two names.
You choose two species with nigrum, and luckily both had black berries. But it is not always so. Helleborus niger (niger is the masculine, nigrum the neutral) has nothing related to black, but if you dig the roots.
Often the specific epithet is about a botanist, and some time just to honour him/her, so there is no common characteristics on such plants sharing the same specific epithet.
Source: The International Code of Nomenclature: http://www.iapt-taxon.org/nomen/main.php?page=title and his companion book: The Code Decoded (where you see such exception and examples, but many of them are put as example directly in the ICN). | {
"domain": "biology.stackexchange",
"id": 8184,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "botany, taxonomy, nomenclature",
"url": null
} |
navigation, move-base
Original comments
Comment by Ammar on 2012-11-12:
Awesome! That makes a lot of sense now. Just one last question. When I remove planning on the static map and not use map_server to publish, move_base says it is waiting on to find a transform between /base_link and /map. In stage I have ground truth pose, I would like move_base to use that. Thanks!
Comment by Lorenz on 2012-11-12:
You might be able to use fake_localization, I'm not sure though. I would still just run map_server and amcl, it shouldn't interfere with move_base if you don't use a static costmap.
Comment by Ammar on 2012-11-12:
Hi... I am not sure what is exactly happening, though I get this error when I disable using a static map. "Waiting on transform from /robot_0/base_link to /map to become available before running costmap, tf error:" Do I need to manually publish to /tf or is there an easier way to specify? Thanks! | {
"domain": "robotics.stackexchange",
"id": 11698,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, move-base",
"url": null
} |
botany, ecology, photosynthesis, marine-biology, energy
Citations:
Field, C. B., Behrenfeld, M. J., Randerson, J. T., and Falkowski, P. G. (1998). Primary production of the biosphere: integrating terrestrial and oceanic components. Science 281, 237–240. doi: 10.1126/science.281.5374.237
Fox, J., Behrenfeld, M.J., Haëntjens, N., Chase, A., Kramer, S.J., Boss, E., Karp-Boss, L., Fisher, N.L., Penta, W.B., Westberry, T.K. and Halsey, K.H., 2020. Phytoplankton Growth and Productivity in the Western North Atlantic: Observations of Regional Variability From the NAAMES Field Campaigns. Frontiers in Marine Science.
McNichol, J., Stryhanyuk, H., Sylva, S.P., Thomas, F., Musat, N., Seewald, J.S. and Sievert, S.M., 2018. Primary productivity below the seafloor at deep-sea hot springs. Proceedings of the National Academy of Sciences, 115(26), pp.6756-6761.
Sigman, D. M. & Hain, M. P. (2012) The Biological Productivity of the Ocean. Nature Education Knowledge 3(10):21 [see here] | {
"domain": "biology.stackexchange",
"id": 11015,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "botany, ecology, photosynthesis, marine-biology, energy",
"url": null
} |
the ratios are at! Multiplying vectors by a scalar be solved using the rules for adding and vectors! C. subtracting a vector is the null vector so v will look v1. Parallel to CD by alternate interior angles of a transversal intersecting parallel lines have the same direction or in. ( iv ) Write down the position vectors, then the second left image can. In 3-space as an arrow from the origin origin to that point real... Other vector check whether a vector is the null vector parallel vectors is then! 180 degrees ; cos 180 equals -1 parral lines are parrel for two vectors to be.. On EduRev Study Group by 168 Class 11 Question is disucussed on EduRev Group! ; s false the geometric interpretation of scalar multiplication also know that the angle them! K equals 1/2, and this is the general pattern for a lot of these vector proofs + 2 3! Note as well that often we will use the term orthogonal in place of perpendicular see quite a bit the. To improve our educational resources effect the | {
"domain": "toygarisikli.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9579122708828602,
"lm_q1q2_score": 0.8270534228219014,
"lm_q2_score": 0.8633916152464017,
"openwebmath_perplexity": 421.43791195212685,
"openwebmath_score": 0.6735721826553345,
"tags": null,
"url": "http://toygarisikli.com/mydss-check-upm/35aaed-how-to-prove-vectors-are-parallel"
} |
scheme, makefile, make
In my first attempt, I tried to write the recursion with pure GNU Makefile syntax. Besides the headache this was causing for me, this quickly started to look unreadable. So I switched to generating the dependency rules with Guile.
# - Compiles scss files in $(sass-dir) to $(css-dir). $(sass-lib-dir)
# may contain extra libraries not immediately part of the project for
# inclusion. This tracks `@import` directives. CAUTION: With the
# current implementation this may break if any path involves spaces. | {
"domain": "codereview.stackexchange",
"id": 30289,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "scheme, makefile, make",
"url": null
} |
thermodynamics, entropy
As we can ask what is the variation of the temperature of each of the bodies, but not of the total system, we can compute the variation of entropy of body 1 and body 2, but not of them together. What's wrong with this thought? The initial state is a composite system made by two subsystem each one at equilibrium. Entropy is an additive quantity: the entropy of the composite system is the sum of the entropy of each subsystem. Notice that the situation is different for temperatures: temperature is not an additive quantity and it is meaningless to add temperatures of each subsystem as well as there is not a temperature which can be considered a property of the combined system. | {
"domain": "physics.stackexchange",
"id": 70032,
"lm_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, entropy",
"url": null
} |
python, homework, tic-tac-toe
That's it for the board class. Most of the stuff like format, not using class variables etc also applies to the TicTacToe class.
resetGame(self) should probably be a method on the class so you can do self.reset_game() or similar.
Typo in corretChoice -> correct_choice.
b is a really inexpressive variable name for the board. Why don't you name it board? Especially if it's used across the whole class (rather than being just a local variable) that would make the code a lot clearer.
You're catching everything here:
try:
x = int(input(self.choicePlayer1 + ' Where do you want to place your piece? '))
break
except:
print('Input has to be a number, try again')
which is really bad style. It will for example also catch stuff like keyboard interrupts. Since you want to catch errors in the conversion what you probably want is except ValueError:. | {
"domain": "codereview.stackexchange",
"id": 34028,
"lm_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, homework, tic-tac-toe",
"url": null
} |
quantum-state, probability, haar-distribution
Title: Conditional expectation for Haar random states Let $U$ be an $n$ qubit Haar random circuit applied to $|0^n \rangle$. Thereafter, the state is measured in the standard basis. Let $p_0$ be the probability of getting $0$ in the first qubit. We know that,
\begin{equation}
\mathbb{E}_U[p_0] = \mathbb{E}_U\big[\text{Tr}(|0\rangle \langle 0| \otimes I_{n-1} ~U|0^n\rangle \langle0^n| U^{*}\big] = \frac{1}{2},
\end{equation}
where $I_{n-1}$ is the identity operator on the remaining $n-1$ qubits. | {
"domain": "quantumcomputing.stackexchange",
"id": 4446,
"lm_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, probability, haar-distribution",
"url": null
} |
# Number of ways to distribute objects, some identical and others not, into identical groups
The question I initially thought of that prompted this was "How many distinct integer-sided cuboids are there with a volume of $60^3$?".
A small example to clarify: There are $3$ integer-sided cuboids with a volume of $8$, namely $8\times 1\times 1$, $4\times 2\times 1$, $2\times 2\times 2$.
I realised that since the prime-factorisation of $60^3$ is
$60^3=(2^2\times 3\times 5)^3=2^6\times 3^3\times 5^3$
Then the problem is equivalent to "How many ways can we distribute $6$ identical objects (i.e. the $2$s), and $3$ identical objects of a different kind (i.e. the $3$s), and $3$ identical objects of a different kind again (i.e. the $5$s) into $3$ identical groups?"
For example, $60^3=(2^4\times 3)\times (2\times 5^2)\times (2\times 3^2\times 5)$ would be one possible cuboid. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9869795087371921,
"lm_q1q2_score": 0.8203211653217863,
"lm_q2_score": 0.8311430562234877,
"openwebmath_perplexity": 449.83617945721505,
"openwebmath_score": 0.7371090650558472,
"tags": null,
"url": "https://math.stackexchange.com/questions/2890989/number-of-ways-to-distribute-objects-some-identical-and-others-not-into-identi"
} |
machine-learning, neural-network, classification, audio-recognition
if your accuracy changes randomly by changing your randomState of your classifier, on a certain test set, what does this tell you about your data?
And second what would be my approach now? Totally lost.
ps: My features are first 20 of the mfcc coefficients. OR 60 band of mel spectogram. I try different things.
I am also wondering if all these code examples, academic papers about sound classification which uses the sound samples from UrbanSounds and ESD50 sets, did they ever test their accuracy with completely random real world sounds, recorded and processed with different tools ?!
Below is when I plot these 2 different sound sets(only the positive class) with:
plt.plot(car_features_1,'.')
plt.plot(car_features_2,'.') | {
"domain": "datascience.stackexchange",
"id": 4392,
"lm_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, neural-network, classification, audio-recognition",
"url": null
} |
computability, reductions, undecidability
Title: Machines whose languages are their own encoding Is the language $S = \{\langle M \rangle \mid M \text{ is a Turing Machine and } L(M) = \{\langle M \rangle\}\,\}$ decidable, recognizable and/or co-recognizable?
I tried diagonalization but can only prove that $R = \{\langle M \rangle \mid M \text{ is a Turing Machine and } \langle M \rangle \notin L(M)\}$ is not recognizable, which does not seem to help in this case... Using the recursion theorem, for any Turing machine $T$ you can construct a Turing machine $M$ such that on input $\langle M \rangle$, $M$ executes $T$ (on the empty tape), and otherwise $M$ immediately rejects. You can use this to show that $S$ is not decidable. Using the same ideas you can explore its recognizability and co-recognizability. | {
"domain": "cs.stackexchange",
"id": 5718,
"lm_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, reductions, undecidability",
"url": null
} |
electromagnetism
So, just as one speaks of mass density at a point and not mass at a point (for extended bodies), one speaks of charge density at a point and not charge at a point or current density at a point and not current at a point (we're ignoring point particles for now - they do fit into this formalism, but you need Dirac delta functions).
(2) Now, in analogy with mass flow, your picture of flow of charge is correct. Mass density times velocity gives a mass current density. $\vec{j}_{m}(t,\vec{x}):=\rho_{m} (t,\vec{x}) * \vec{v} (t,\vec{x})$. If you have a mass current density $\vec{j}_{m}$ and want to know the mass flow $\dot{m}$ through some area A, then you take
\begin{equation}
\dot{m} = \int \vec{j}_{m} \cdot d\vec{A}
\end{equation} | {
"domain": "physics.stackexchange",
"id": 15649,
"lm_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",
"url": null
} |
navigation, ros-melodic, move-base
Reference: http://wiki.ros.org/move_base
For turtlebot3 implementation, take a look at this example: https://github.com/NVIDIA-AI-IOT/turtlebot3/blob/master/turtlebot_apps/turtlebot_navigation/param/global_planner_params.yaml. Notice the initial parameters:
GlobalPlanner: # Also see: http://wiki.ros.org/global_planner
old_navfn_behavior: false # Exactly mirror behavior of navfn, use defaults for other boolean parameters, default false
use_quadratic: true # Use the quadratic approximation of the potential. Otherwise, use a simpler calculation, default true
use_dijkstra: true # Use dijkstra's algorithm. Otherwise, A*, default true
use_grid_path: false # Create a path that follows the grid boundaries. Otherwise, use a gradient descent method, default false | {
"domain": "robotics.stackexchange",
"id": 37158,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, ros-melodic, move-base",
"url": null
} |
slam, navigation, octomap, octomap-server
Originally posted by jwrobbo with karma: 258 on 2012-02-04
This answer was ACCEPTED on the original site
Post score: 3
Original comments
Comment by Felix Endres on 2012-02-07:
Have a look at the file "/opt/ros/electric/stacks/octomap_visualization/rosdep.yaml" and install the mentioned packages manually using "apt-get install "
Comment by Mike Moore on 2012-02-04:
Thanks jwroobo, experimental for color OCTOMAPS. Definitely isnt building properly as I still get these missing dep. errors: "Failed to find rosdep qglviewer-qt4 for package octovis on OS:ubuntu version:oneiric" and "Failed to find rosdep qt4-opengl for package octovis on OS:ubuntu version:oneiric"? | {
"domain": "robotics.stackexchange",
"id": 8106,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam, navigation, octomap, octomap-server",
"url": null
} |
using the entries of a matrix, -1, 0 1. Inverse of A. I is the scalar to all matrix elements subtracted only if they have the same of. Defined matrices, we will define their arithmetic operations A-1 is the transpose and A-1 is inverse! Obtained in MATLAB, e.g could also be considered addition for matrices, such as direct. One calculate the __product of two matrices in MATLAB, e.g 0 2 the application can work with -... Calculate the elements of [ C ] matrix long as they are the “ obvious ”.! Could also be considered addition for matrices, we used the entries of addition and scalar multiplication of matrices calculator a and b given matrices to all elements. Home / Linear Algebra / matrix operation ; Calculates the addition of the above properties we. Another story, multiplication and transpose in java Linear Algebra / matrix operation Calculates... Let C, d be scalars MATLAB, e.g will define their arithmetic.. Also be considered addition for matrices, with the addition of the scalar | {
"domain": "co.uk",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9005297754396141,
"lm_q1q2_score": 0.818237461771786,
"lm_q2_score": 0.9086178870347122,
"openwebmath_perplexity": 622.7558941450479,
"openwebmath_score": 0.8550291657447815,
"tags": null,
"url": "https://housetosellfast.co.uk/harris-corporation-uzx/addition-and-scalar-multiplication-of-matrices-calculator-a-and-b-4b30af"
} |
c++, algorithm, c++11
But this isn't totally generic either. What if we want to generalise the accumulation to not just sums but any given fold operator f: X x X -> X (we can not use f: Y x X -> Y in max_crossing) where summation and less-comparison are default behaviour. It would look like this:
template <
typename I,
typename T = value_type_t<I>,
typename F = std::plus<>,
typename P = std::less<>
>
constexpr std::pair<I, T> max_accumulation_not_empty(
I first, I last, const T& init = T{}, F op = F{}, P pred = P{})
noexcept (
std::is_nothrow_callable_v<F(const T&, reference_t<I>)> &&
std::is_nothrow_callable_v<P(const T&, const T&)>
)
{
assert(first != last);
auto max = std::make_pair(first, std::invoke(op, init, *first));
auto current_sum = max.second;
for (auto iter{std::next(first)}; iter != last; ++iter) {
current_sum = std::invoke(op, current_sum, *iter);
if (std::invoke(pred, max.second, current_sum)) { | {
"domain": "codereview.stackexchange",
"id": 24572,
"lm_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, c++11",
"url": null
} |
experimental-physics, mathematics
So in practice, $\pi\approx 3.141592654$ would be OK everywhere in the part of physics that is testable. However, theoretical physicists of course often need to make calculations more accurately if not analytically, to figure out what's really happening with the formulae. | {
"domain": "physics.stackexchange",
"id": 964,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "experimental-physics, mathematics",
"url": null
} |
experimental-physics, pressure, fluid-statics, vacuum, home-experiment
I am aware I could also lower the tube into the tank, seal it, then lift it up, but this isn't viable for me as I won't have a deep enough tank to be able to get the water far enough up the tube.) Find a veterinarian to give you a syringe used on large animals. Drill a small hole in the side of the tube about an inch from the top, and fill it with silicone sealer. This will let you insert the needle of the syringe without leakage. Stretch a balloon tightly over the top of the tube. If need be, put a small funnel into the top of the tube (sealed with silicone sealer) so you can stretch the balloon better. Use the syringe to pull air out of the tube until the water reaches the desired height, then pop the balloon with a broken razor blade. Holding the tube in place amd measuring the oscillations is up to you! | {
"domain": "physics.stackexchange",
"id": 75361,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "experimental-physics, pressure, fluid-statics, vacuum, home-experiment",
"url": null
} |
gazebo, simulation, simulator-gazebo, ros-electric, fedora
UPDATE: It seems that the warning is thrown only because it can't really find it by the name it's looking for. For example, after a little playing around, I could get vision_opencv working.
UPDATE 2 : Now after quite a few hours, I'm stuck at a cmake stage. Had to install yampl-cpp-devel, tinyxml-devel, vtk-devel, libyaml-devel, rosdep install for gazebo_tools, build assimp, copied the /usr/include/ffmpeg/* to /usr/include (to fix missing avformat.h), hdf5-devel, [added -ltinyxml flag to /gazebo/build/CMakeCache.txt (and in gazebo_tools), added a VTK_DIR:FILEPATH=/usr/lib64/vtk-5.6 to pcl_ros/CMakeCache.txt ... Didnt work], used http://www.cmake.org/pipermail/cmake/2006-March/008633.html and changed VTK REQUIRED to VTK5 required in the cmake files. Also changed the path in the URL file to point to lib64/vtk-5.6
This fixed the missing VTK errors, but I'm repeatedly stuck with the tinyXML errors. | {
"domain": "robotics.stackexchange",
"id": 7081,
"lm_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, simulation, simulator-gazebo, ros-electric, fedora",
"url": null
} |
vba, excel
End Sub
Get the base query (which is pasted onto the spreadsheet) and maintain its existing readability:
Standard Module: M0310QueryPreparation (same as GetQueryReplacementsFromGlossaryAndQueryLogicSheet above)
Option Explicit
Function PrepareOriginalQuery(ByVal QuerySheet As Worksheet) As String | {
"domain": "codereview.stackexchange",
"id": 29912,
"lm_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
} |
electromagnetism, electrostatics, maxwell-equations, coulombs-law
Title: Information content of the electrostatic Maxwell equations vs Coulomb's Law vs Poisson's Equation In electrostatics, we have Maxwell's equations:
$\nabla \cdot E = \rho$
$\nabla \times E = 0$
These four equations (the second line standing for three equations) can also be written in terms of the electrostatic potential:
$ -\nabla^2 V=\rho $
$ E = -\nabla V $
Now if we know the positions of every charge in our system, we can find the electrostatic field (completely and entirely, with no additional information required) using Coulomb's law:
$ E(x) = -\nabla \int \frac{\rho(x')}{4\pi|x-x'|} \mathrm{d}^3 x' $ | {
"domain": "physics.stackexchange",
"id": 9652,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, electrostatics, maxwell-equations, coulombs-law",
"url": null
} |
control, ros, communication
Is TCP/IP really a no go because of its non-deterministic characteristics? It is so easy to use…
At the moment no solution really seems obvious to me. And as I can find no serious robot exemple using a specific reliable and scalable solution, I do not feel confident to make a choice. Anyone has a clear view on this point or literature to point to?
Kind regards,
Antoine.
Originally posted by arennuit on ROS Answers with karma: 955 on 2013-01-16
Post score: 5 | {
"domain": "robotics.stackexchange",
"id": 12447,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "control, ros, communication",
"url": null
} |
navigation, robot-pose-ekf
How do I debug thsi error?
Originally posted by Anurag on ROS Answers with karma: 1 on 2017-06-19
Post score: 0
I ran into the same problem because I had downloaded the source codes into my catkin workspace and compiled it. Deleting all the associated files and folders from the build/ and devel/ directories in my workspace and running catkin_make clean solved it for me.
Originally posted by emilyfy with karma: 26 on 2018-01-26
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 28139,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, robot-pose-ekf",
"url": null
} |
newtonian-mechanics, reference-frames, centrifugal-force, centripetal-force
Title: Does centrifugal force exist? Currently in my last year of high school, and I have always been told that centrifugal force does not exist by my physics teachers. Today my girlfriend in the year below asked me what centrifugal force was, I told her it didn't exist, and then she told me her textbook said it did, and defined it as "The apparent force experienced towards the outside of a circle is the centrifugal force and is due to the mass of the object resisting the inward centripetal acceleration that the object is experiencing". I was pretty shocked to hear this after a few years of being told that it does not exist.
I did some reading and found out all sorts of things about pseudo forces and reference frames. I was wondering if someone could please explain to me what is going on? Is it wrong to say that centrifugal force does not exist? | {
"domain": "physics.stackexchange",
"id": 65106,
"lm_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, reference-frames, centrifugal-force, centripetal-force",
"url": null
} |
astrophysics, universe, space-time, observable-universe
My question is, how do we know that these physical laws which we tested within a tiny area of the universe are consistently working in the distant parts of it? Is there any probability that the distant part of our universe obeys physical laws differently and our prediction based on applied physical laws gave us an unreal illusion of the actual reality, yet consistently? We don't know in general but to the extent we can measure, the laws seem to be the same, even if conditions are not.
For example radioactive decay: We know how fast various elements decay, and we can observe the results of radioactive decay in distant supernovae. The conclusion is that, for at least some elements, the rate of radioactive decay is the same on Earth as it is in distant supernovae.
After accounting for redshift, spectral emission lines remain unchanged by distance. This implies that the fine-structure constant is indeed constant. | {
"domain": "astronomy.stackexchange",
"id": 5453,
"lm_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, universe, space-time, observable-universe",
"url": null
} |
clojure
Title: Calculating a factorial with parallel sub-computations using pmap, pvalues and pcalls In an attempt to learn more about Clojure's parallel computation functions, I devised the following task: calculate a factorial in parallel using pmap, pcalls and pvalues.
The idea is to split the factorial sequence into sub-computations, reducing the final output of each.
Here is the obvious non-parallel function:
(defn factorial [n] (reduce * (range 1 (inc n))
pmap is fairly straight-forward:
(defn pmap-factorial [n psz]
(let [parts (partition-all psz (range 1 (inc n)))]
(reduce * (pmap #(apply * %) parts))))
However, with pvalues I had to resort to macros that return a computation function.
(defmacro pvalues-factorial [n psz]
(let [exprs (for [p (partition-all psz (range 1 (inc n)))]
(cons '* p))]
`(fn [] (reduce * (pvalues ~@exprs))))) | {
"domain": "codereview.stackexchange",
"id": 2293,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "clojure",
"url": null
} |
quantum-mechanics, quantum-optics
I fail to connect the dots. Does someone have some insight?
EDIT: As it has been asked, $\hat{H}_I $ is the interaction Hamiltonian in the interaction picture and it has the form of
\begin{equation}
\hat{H}_I(t)\propto\frac{r}{2}(\hat{a}^{\dagger 2}e^{(2\omega-\omega_p)}-\hat{a}^2e^{-(2\omega-\omega_p)})
\end{equation}
and it basically accounts for the energy conservation. This Hamiltonian and the derivation can be found in Gerry, Knight - Introduction to Quantum Optics. The free Hamiltonian is not explicitly accounted for because it doesn't influence the dynamics of the interaction. In the Schrödinger picture the free evolution simply results in a phase shift, and in the phase-space picture this corresponds to a rotation of the quadratures. One usually therefore (sometimes implicitly) considers a rotating reference frame where the free evolutions of the quadrature operators are trivial. | {
"domain": "physics.stackexchange",
"id": 96404,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-optics",
"url": null
} |
Staff Emeritus
The elements in A need not be linearly independent. On the contrary, if V is of finite dimension n, A contains at most n linearly independent elements.
3. Jun 30, 2015
### HallsofIvy
Staff Emeritus
What, exactly, is the definition of "linear combination" in your text? I suspect that a "linear combination" of vectors is required to be a sum of a finite sum of scalars times vectors. Also, this does not say "the sum of its linear combinations", it says "the sum of two linear combinations". If a linear combinations is required to be a sum of a finite number of vectors, selected from A, then a sum of two (or any finite number) of linear combinations still involves only a finite number of vetors from A.
4. Jul 1, 2015
### Fredrik | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9648551546097941,
"lm_q1q2_score": 0.8142365415437429,
"lm_q2_score": 0.8438951045175643,
"openwebmath_perplexity": 446.3996090054569,
"openwebmath_score": 0.8207612633705139,
"tags": null,
"url": "https://www.physicsforums.com/threads/smallest-subspace-of-a-vector-space.821461/"
} |
c#, performance, algorithm
Now this does what I need, but for 100k items it takes minutes to complete. I am processing 1M items daily so it's not that I can't wait several minutes, but it would be great to optimize it. Can I parallelize this? Compound words like firstitem should be camelCase.
Why is the Resource property of TimelineDto a string, when you seem to be filling it with ints?
allItems is a bad name, item is even worse. I have no idea what this represents.
I also have to object to TimelineDto, especially when timeline = new List<TimelineDto>.
var firstitem = allItems.FirstOrDefault(); can return a null, yet you never check this.
Why are you even using the OrDefault version, considering that the first line sorts the result of GetInterestingItems() by StartDate, which would throw an exception if one of the items was null. | {
"domain": "codereview.stackexchange",
"id": 18905,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, algorithm",
"url": null
} |
c++, ros-melodic, actionlib
If you want to initiate the action server at another moment
you mean it may be desirable to not have the ActionServer instantiated then delaying construction by using a (smart) pointer is indeed an option.
If you were instead thinking of "initiate" as: placing the server in the active state, then perhaps setting auto_start to false (ctor docs) would be a better approach.
Comment by Mbuijs on 2019-10-21:
Good point, I was not thinking of the auto_start option, which is indeed a better approach.
You are correct; this is a C++ question.
The actionlib::SimpleActionServer class does not have a default constructor: http://docs.ros.org/melodic/api/actionlib/html/classactionlib_1_1SimpleActionServer.html
Therefore, you must provide constructor arguments when the SimpleActionServer object is constructed. If this object is a member of another class, then the C++ standard states that the constructor arguments must be passed in the initializer list. | {
"domain": "robotics.stackexchange",
"id": 33908,
"lm_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++, ros-melodic, actionlib",
"url": null
} |
nomenclature, terminology, drugs
P-25.3.3.1 Numbering of peripheral skeletal atoms
P-25.3.3.1.1 The numbering of peripheral atoms in the preferred orientation starts from the uppermost ring. If there is more than one uppermost ring, the ring furthest to the right is chosen. Numbering starts from the nonfused atom most counterclockwise in the ring selected and proceeds in a clockwise direction around the system, including fusion heteroatoms but not fusion carbon atoms. Each fusion carbon atom is given the same number as the immediately preceding nonfusion skeletal atom, modified by a Roman letter ‘a’, ‘b’, ‘c’, ‘d’, etc.
When the numbering of a system is fixed like that, this numbering must be used. Suffixes and prefixes are added to the name, as required, using the new locants characterizing the fused system. In particular, the saturation of the compound that is given in the question is indicated using hydro prefixes as 4,6,6a,7,8,9-hexahydroindolo[4,3-fg]quinoline. | {
"domain": "chemistry.stackexchange",
"id": 17092,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nomenclature, terminology, drugs",
"url": null
} |
breathing
Metronome is a device that produces any perceivable ticks (sound clicks or, maybe, light flashes can be used) with given and constant frequency. So patients were asked to synchronize their breathing with metronome clicks.
Only precaution in mentioned experiment is that high frequency of breathing can cause voluntary hyperventilation. Or if preset frequency is low and patient is trying to follow it, hypoventilation might occur. Fainting seems among the worst of consequences in both conditions (if person is relatively healthy). | {
"domain": "biology.stackexchange",
"id": 3787,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "breathing",
"url": null
} |
c, strings, array, constants
Is there a better way to do this? Is there a cleaner way to initialize an constant array of strings, and a constant array of the equivalent lenghts? I'm mainly looking at the last one. How can I improve that one? To expand on my comment, the X macro technique can be used for this. See here, for example
The idea is that we define the list once, for example
#define STRINGLIST \
X( "alice") \
X( "bob") \
X( "cat")
When we want to use this list, we invoke the above macro, having defined the macro X:
static const char *const DStr[] = {
#define X(S) S,
STRINGLIST
#undef X
};
static const unsigned short DLen[] = {
#define X(S) sizeof( S)-1,
STRINGLIST
#undef X
};
This way we only have to define the strings once, and guarantee that the arrays DStr and DLen are in the same order. The disadvantage is that it looks pretty bizarre first time you see it, and others maintaining your code might be boggled. | {
"domain": "codereview.stackexchange",
"id": 39443,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, strings, array, constants",
"url": null
} |
homework-and-exercises, quantum-electrodynamics, differentiation
Title: Math in deriving Pauli Equation When deriving the Pauli Equation, it has the following step:
$$i\frac{e}{c}\hbar[\vec{A}\times\nabla+\nabla\times\vec{A}]\phi=i\frac{e}{c}\hbar\space curl\vec{A}\cdot \phi$$
$\phi$ is one of the spinors in the bispinor of the electron. $\vec{A}$ is the vector potential. How does it go from the LHS to the RHS? I thought $\nabla\times\vec{A}$ is just $\text{curl}\ \vec{A}$? You need to show $\overbrace{\vec{A} \times \nabla \phi + \nabla \times (\vec{A}\phi)}^{LHS}=\overbrace{\phi \nabla\times \vec A}^{RHS} $
or equivalently $ \nabla \times (\vec{A}\phi)=\phi \nabla\times \vec A -\vec{A} \times \nabla \phi$
To show this we write
\begin{eqnarray}
\nabla \times (\vec{A}\phi) &=& \varepsilon_{ijk }\partial_i (A_j\,\phi)\;,
\\&=&\Big[\varepsilon_{ijk }\partial_i (A_j)\,\phi+\varepsilon_{ijk }A_j\,\partial_i (\phi)\Big]\;,\\
&=&\Big[\varepsilon_{ijk }\partial_i (A_j)\,\phi-\varepsilon_{jik }A_j\,\partial_i (\phi)\Big]\;,\\ | {
"domain": "physics.stackexchange",
"id": 38067,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, quantum-electrodynamics, differentiation",
"url": null
} |
quantum-gate, linear-algebra
Title: Conjugation of $R_x(\theta)$ with $CNOT$ Section 2.5 (4.3) of the Qiskit textbook, see here, discusses the conjugation of $R_x(\theta)$ by $CNOT$. The following expression is given:
$$CX_{j,k}(R_x(\theta)\otimes 1) CX_{j,k}=\color{brown}{CX_{j,k}e^{i\frac{\theta}{2}(X\otimes1)}CX_{j,k}=e^{i\frac{\theta}{2}CX_{j,k}(X\otimes 1)CX_{j,k}}}=e^{i\frac{\theta}{2}X\otimes X}$$
I am confused by the part highlighted in yellow. What exponentiation rules allow this? Could someone show me the intermediate steps or the relevant identities/rules to take us from the LHS to RHS of the highlighted part? This is an application of the following identity
$$
Be^AB^{-1} = e^{BAB^{-1}}\tag1
$$
where $A$ is any $n\times n$ real or complex matrix and $B$ is any invertible $n\times n$ real or complex matrix.
Proof of $(1)$. First, recall that the matrix exponential of $A$ is defined as
$$
e^A = \sum_{k=0}^\infty \frac{1}{k!}A^k.
$$
Next, note that for any integer $k$
$$ | {
"domain": "quantumcomputing.stackexchange",
"id": 2305,
"lm_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, linear-algebra",
"url": null
} |
genetics, snp
How can such records be compared to identify similarities for a given phenotype? Does RSID uniquely identify a mutation, or is it a combination of rsid and position?
In other words, if one user has rsid 123 at position 555 and another one has rsid 123 at position 666, and the mutation is the same, is this a similarity, or does position matter? Each rsid identifies a unique SNP in the genome. Thus there should not be any entry in the files that have the same rsid but different chromosomes and/or positions. If you do find this, it is likely that you have data from different versions of the assembled genomes. | {
"domain": "biology.stackexchange",
"id": 1248,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "genetics, snp",
"url": null
} |
newtonian-mechanics, angular-momentum, reference-frames, rotational-dynamics, torque
Title: Derivative of angular momentum in a rotating frame of reference I keep seeing that when taking the time derivative of the angular momentum in a rotating reference frame, we get: $$\frac{d\vec{L}}{dt} = \vec{\tau} + \vec{\omega} \times \vec{L}$$ meaning the torque as the rotating frame sees it, plus another term. | {
"domain": "physics.stackexchange",
"id": 65362,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, angular-momentum, reference-frames, rotational-dynamics, torque",
"url": null
} |
optics, electromagnetic-radiation, geometric-optics, camera
Why was it not a uniformly illuminated circular patch on the screen? Why was it undergoing an eclipse? The light was passing through all the portions of the hole, so why was an eclipse showing on the screen?
In summary, how does a pinhole create an image of the Sun? And not always a circular illumination?
Edit1: If we place a single point source of light in front of the pinhole then it creates a circular illumination on the screen, but if we put an extended object in front of the pinhole then it creates an inverted image of the object on the screen, how? An extended object can also be considered as a collection of infinite point sources of light. If one source produces a circular patch then infinite sources should also produce the same circular patch, just of greater intensity. The shape of the patch should not change. Why does the shape of the patch change to the shape of the object on the screen? | {
"domain": "physics.stackexchange",
"id": 65545,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, electromagnetic-radiation, geometric-optics, camera",
"url": null
} |
pandas, numpy
Now, i used alpha.T to get this in 8046 rows and 2 columns.
Why i am getting 2 columns not one? and how should i convert it into one column? You are not getting 2 columns. You are getting 2 rows.
The function alpha = (np.log([dataset.m38,dataset.m78])/np.math.log(38,78.7)) returns a 2-dimensional array. Putting in:
m38 m78
0 4.4717 4.8745
1 4.4569 4.6491
2 4.5101 4.7262
3 4.4407 4.8234
4 4.1184 4.3862 | {
"domain": "datascience.stackexchange",
"id": 4726,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pandas, numpy",
"url": null
} |
EDIT: Sure, even if $$C$$ is true, we still don't know whether the 1st card was a Spade, or not. But because all Spades are Black (although not the other way around), knowing that the 1st card was already Black, gives us some additional relevant information, about the chance that the 2nd card will be a Spade. In contrast, knowing that the 1st card was an Ace isn't really relevant to the question of whether the 2nd card will be a Spade, because Spades are $$\tfrac{1}{4}$$ of all Aces, but Spades are also $$\tfrac{1}{4}$$ of the deck as a whole. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138144607744,
"lm_q1q2_score": 0.8038656710108036,
"lm_q2_score": 0.8221891305219504,
"openwebmath_perplexity": 143.52478362220046,
"openwebmath_score": 0.6648557186126709,
"tags": null,
"url": "https://math.stackexchange.com/questions/3513168/suppose-we-draw-two-cards-without-replacement-out-of-a-standard-deck-of-52-cards"
} |
quantum-gate, quantum-state, textbook-and-exercises, unitarity
Therefore, if you apply $U = CNOT \cdot H\otimes I$ to the state $|S\rangle = |00\rangle$ then you get
$$ \big( CNOT \cdot H\otimes I\big) |00\rangle = CNOT \cdot \bigg( \big(H \otimes I \big) |00\rangle \bigg) = CNOT \cdot \bigg(\dfrac{|00\rangle + |10\rangle}{\sqrt{2} } \bigg) = \dfrac{|00\rangle + |11\rangle}{\sqrt{2} } $$
That is, $U |00\rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2} } $. On a quantum circuit, this can be realized as:
Note that for the figure above, $|\psi_0 \rangle = |S\rangle = |00\rangle$, $|\psi_1 \rangle = \dfrac{|00\rangle + |10\rangle}{\sqrt{2} } $, and $|\psi_2 \rangle = |S'\rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2} } $. | {
"domain": "quantumcomputing.stackexchange",
"id": 2283,
"lm_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, quantum-state, textbook-and-exercises, unitarity",
"url": null
} |
machine-learning, deep-learning, probability-distribution, variational-autoencoder
What I get as a take away is that the VAE forces the learned latent space to be Gaussian due to the KL divergence term in the loss function. So, now we have a known distribution to sample from to create input vectors to feed to the decoder, to produce say images of dogs, if the VAE was trained on images of dogs. As you sample from the distribution, you will produce images of different types of dog images.
I assume a different type of distribution could be selected if one uses the proper loss function for that type of distribution, that is, the loss function which would measure the difference in the distribution of the latent space and the desired distribution. | {
"domain": "ai.stackexchange",
"id": 1762,
"lm_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, probability-distribution, variational-autoencoder",
"url": null
} |
c#, casting, callback
public class ScaleDveCommand : ICommand
{
public CgManager CgManager { get; set; }
public string FirstString { get; set; } //TODO:Rename to meaningful name
public string SecondString { get; set; } //TODO:Rename to meaningful name
public bool SomeBool { get; set; } //TODO:Rename to meaningful name
public void Execute()
{
dispatcher.Invoke(() => CgManager.ScaleDVE(FirstString, SecondString, SomeBool));
}
}
public class PlayAnimationCommand : ICommand
{
public CgManager CgManager { get; set; }
public VideoTemplate VideoTemplate { get; set; }
public string SomeMeaningfulNameHere { get; set; } //TODO:Rename to meaningful name
public void Execute()
{
dispatcher.Invoke(() => { CgManager.playAnimation(VideoTemplate, SomeMeaningfulNameHere); });
}
}
And your "queue" class will look like:
public class RfxQ
{
private readonly SortedList<long, ICommand> _queue = new SortedList<long, ICommand>(); // The queue of events | {
"domain": "codereview.stackexchange",
"id": 2991,
"lm_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#, casting, callback",
"url": null
} |
java, object-oriented, csv
Here's an example of the CSV. The one I pulled this from is about 35,000 lines, but they all follow the same format. I deleted some irrelevant columns for simplicity, but the important information are the levels and part numbers. They won't change position, and searching through an entire CSV only takes a few seconds. To pull a group of parts I first check if its level is 2 (denoting a "top" level) then I pull all subsequent parts until the next 2.
Edit | {
"domain": "codereview.stackexchange",
"id": 4248,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, object-oriented, csv",
"url": null
} |
ros, c++, eigen
Title: Based on ROS, I want to run a cpp file which use Eigen
Since the matrix geometry is complicated on C++, I download Eigen online and type #include <Eigen\Dense> in my cpp code file. Based on Visual Studio, I can just add path of Eigen by modifying the property of project. However, I want to run the cpp file on Ros and I cannot add path by modifying the property of project just like the visual studio. I have no idea. Please help me.
Originally posted by ZYS on ROS Answers with karma: 108 on 2016-02-01
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 23615,
"lm_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, c++, eigen",
"url": null
} |
electric-circuits, electrical-resistance, electromagnetic-induction, inductance
Title: In a LR circuit, Why do the current rate of increase decreases with time? In a LR circuit, the current rate of increase decreases with time until it reaches zero eventually and that is when the current become steady. My question is why the current rate of increase decreases with time? At t=0, the current is equal zero and the induced emf work in an opposite sense of polarity to that's of the source, my question is why this initial current instantaneous rate of increase doesn't stay at the same value instead of diminishing with time? And I don't think it is because the magnetic flux rate of increase decreases with time, cause what I understand is that the magnetic flux rate of increase is the result of the current rate of increase and not the other way around. And if it is indeed the other away around and the decrease of magnetic flux rate of increase is the reason, then What makes the magnetic flux rate of increase decreases with time? | {
"domain": "physics.stackexchange",
"id": 92476,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electric-circuits, electrical-resistance, electromagnetic-induction, inductance",
"url": null
} |
machine-learning, long-short-term-memory, autoencoders
trainX, trainY = to_sequences(train[['EnergyInWatts']], train['EnergyInWatts'], seq_size)
testX, testY = to_sequences(test[['EnergyInWatts']], test['EnergyInWatts'], seq_size)
model = Sequential()
model.add(LSTM(128, input_shape=(trainX.shape[1], trainX.shape[2])))
model.add(Dropout(rate=0.2))
model.add(RepeatVector(trainX.shape[1]))
model.add(LSTM(128, return_sequences=True))
model.add(Dropout(rate=0.2))
model.add(TimeDistributed(Dense(trainX.shape[2])))
model.compile(optimizer='adam', loss='mae')
model.summary() | {
"domain": "ai.stackexchange",
"id": 2705,
"lm_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, long-short-term-memory, autoencoders",
"url": null
} |
c++, c++11, graphics
typedef MeshImp const& Mesh;
class TextureImp
{
public:
friend class ResourceManager;
friend std::unique_ptr<TextureImp>::deleter_type;
std::unique_ptr<glDetail::CTexture> const& operator->() const
{
return m_texture;
}
private:
explicit TextureImp(const char* texturePath, GLenum texTarget = GL_TEXTURE_2D, GLfloat filter = GL_LINEAR, GLfloat pattern = GL_REPEAT,
GLenum attachment = GL_NONE)
:
m_texture(std::make_unique<glDetail::CTexture>(texturePath, texTarget, filter, pattern, attachment))
{
} | {
"domain": "codereview.stackexchange",
"id": 15949,
"lm_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, graphics",
"url": null
} |
algorithms, python
return memo[(m, n)]
if __name__ == '__main__':
print(travellingSalesman(m=3, n=3, rewards=[[0,4,2],
[3,2,0],
[4,1,0]]))
The function below returns 6, but it should return 8 with the path: 0-> 3 -> 4 -> 1 -> 0
Can you enlighten me about the problematic/missing part of this code? Thanks! In the 3rd if statement your code assumes that the optimal solution when starting from coordinates $(m, n)$ is equal to the optimal solution when starting from coordinates $(n, m)$. This is clearly false in general. | {
"domain": "cs.stackexchange",
"id": 17991,
"lm_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, python",
"url": null
} |
star, coordinate
Title: Given a star's ra, dec how can I compute one pair of lat, long and time where the star would be at zenith? As the questions says, I have the celestial coordinates of a star(ra, dec). My trigonometry is not so great so I haven't managed to figure out a solution to this. I want to find a place (lat, long) and a time when the star will be right above the computed point?
I.e. star coordinates: 7h 23m 23.97s -13° 25' 2.64", where would be the point(lat, long) and time where the star would be right above? Latitude is the easiest; it's the same as the star's declination: -13° 25' 2.64".
Longitude and time depend on each other. A star with right ascension 7h 23m 23.97s will be at the zenith point at 7h 23m 23.97s local sidereal time (by definition). You need to convert sidereal time to local time (at a given day), e.g. with the script described here. On September 23rd (or whatever day the Fall equinox falls, thanks @MikeG) on the Greenwich meridian, this will happen at 7:23am UTC. | {
"domain": "astronomy.stackexchange",
"id": 2813,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "star, coordinate",
"url": null
} |
thermodynamics, equilibrium, aqueous-solution, solubility
Or is the activity independent of the ionic strength such that in order to keep the activity the same under higher concentrations, the activity coefficient must be smaller? This would then bring up the question: is the equilibrium constant, $K$, (determined by the activities of the components in the equilibrium expression) constant even under different ionic strengths, while the "concentration coefficient" (determined merely by the concentrations of the components in equilibrium with one another) does vary under different ionic strengths? I'm not sure I'm getting this very well. Thermodynamic activity is essentially the same the chemical potential. At the solubility limit of a compound, the dissolved species is in equilibrium with the solid species. For example, a saturated solution of sodium chloride is in equilibrium with solid sodium chloride crystals. In such equilibria, the chemical potential of the dissolved sodium chloride is equal to the chemical potential of the solid sodium | {
"domain": "chemistry.stackexchange",
"id": 5060,
"lm_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, equilibrium, aqueous-solution, solubility",
"url": null
} |
electromagnetism, magnetic-fields
A superposition of classical fields results in a single continuous geometry. There is no difference between these two concepts. In Figure 1 of the question, the fields created by the two dipoles will sum together into a continuous field. At every point in space, there will be a single magnetic field vector with a single direction and a single magnitude. That vector can be found by adding the magnetic field vectors that would be created by each coil of wire alone. | {
"domain": "physics.stackexchange",
"id": 94039,
"lm_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, magnetic-fields",
"url": null
} |
ros, buildfarm, release
Title: Steps to cancel already-released packages
For a set of packages / a meta package that we already released into buildfarm (openrtm_common), we've figured out that we want to split it into multiple smaller sets / meta packages and fresh release each of them (for better modularity and moreover for easier handling of buildfarm error currently happening).
What step should we take before releasing the new sets of packages?
I'm afraid releasing new sets would cause conflicts if there already exist packages of the same names. Some packages have already been built and available on .deb binary repository. And just cancelling the commits for release.yaml on rosdistro seems not sufficient either.
Thanks!
Originally posted by 130s on ROS Answers with karma: 10937 on 2013-08-10
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 15218,
"lm_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, buildfarm, release",
"url": null
} |
c++, optimization, beginner, parsing, node.js
Title: Optimizing simple xHTML parser I'm writing a simple xHTML parser which parses a data without nested tags.
Example input code will look like:
<h2>Header</h2>
<p> atsatat </p>
<h2>asdsaad</2><p>s32532235</p>
I've wrote the following code:
#include <node.h>
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
using namespace v8;
enum Tags {
Closing = 0,
Paragraph,
Heading
};
int tagDetect(char *ptr){
if (*ptr == '/') {
return Tags::Closing;
}
if (*ptr == 'p') {
return Tags::Paragraph;
}
if (*(ptr + 1) == '2' || *(ptr + 1) == '3')
return Tags::Heading;
return -1;
}
Handle<Value> Callback(const Arguments& args) {
HandleScope scope;
if (!args[0]->IsString() || !args[1]->IsFunction()) {
return ThrowException(Exception::TypeError(
String::New("Invalid arguments! First parameter must be [string], second must be a callback [function].")));
} | {
"domain": "codereview.stackexchange",
"id": 7278,
"lm_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++, optimization, beginner, parsing, node.js",
"url": null
} |
In your case, you need the opposite (the number of ways the people DON'T receive the same prize) so what you need to do is to subtract from the total ways you can distribute the prizes |S|. Total number of ways to distribute the n prizes is $$n^n$$ (not n-1 since you need to count for the case when the person is not receiving anything. Hence:
$$n^n - |S|$$
Derangements count the situation where every guest gets exactly 1 prize. However, the OP wording says that every guest can get ANY number of prizes (i.e. $$0$$ to $$n-1$$ since he/she cannot get his/her own prize). In this case, the correct answer is indeed $$(n-1)^n$$, because each of $$n$$ prizes can go to any of $$(n-1)$$ recipients. I.e., your teacher is wrong to mark you wrong.
If your teacher insists on using Inclusion Exclusion, then let $$A_i$$ be the set of arrangements s.t. person $$i$$ gets his/her own gift. Then I-E gives:
$$answer = n^n - \sum_i |A_i| + \sum_{i | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9752018376422665,
"lm_q1q2_score": 0.8062108545328734,
"lm_q2_score": 0.8267117876664789,
"openwebmath_perplexity": 415.14872307233065,
"openwebmath_score": 0.659509003162384,
"tags": null,
"url": "https://math.stackexchange.com/questions/3003917/n-guests-each-guest-brings-a-prize-how-many-ways-may-the-prizes-be-given-out"
} |
beginner, jquery, html
<button class="accordion">Different diets</button>
<div class="panel">
<p>As we will be a culturally diverse bunch we have made arrangements for all sorts of diets.
Whether you like kosher, halaal, vegetarian or gluten- or lactose-free we will have you covered.</p>
</div>
<button class="accordion">Gifts & presents</button>
<div class="panel">
<p>Your presence at our wedding is all that we wish for. However, if you want to give a gift, we will be grateful
for a cash donation towards our honeymoon trip.</p>
</div>
</div>
</div>
</div>
</div>
<!--End of: FAQ-->
</div>
<script>
var acc = document.getElementsByClassName("accordion");
var i; | {
"domain": "codereview.stackexchange",
"id": 21208,
"lm_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, jquery, html",
"url": null
} |
beginner, c, console, windows, text-editor
_maxLines++;
char **temp = *lines;
*lines = (char**)malloc(sizeof(char*) * (_maxLines+2));
for (int i = 0; i < _cursor+1; i++)
(*lines)[i] = temp[i];
(*lines)[_cursor] = tempLine;
for (int i = _cursor; i <= _maxLines; i++)
(*lines)[i+1] = temp[i];
free(temp);
}
void deleteLine(char ***lines) {
system("CLS");
if (_maxLines == 0 || _cursor == _maxLines) {
printf((_maxLines == 0) ?
"no lines to delete.. YET!\n" :
"you cant delete the control line.\n");
getchar();
clearBuffer();
return;
}
_maxLines--;
char **temp = *lines;
*lines = (char**)malloc(sizeof(char*) * (_maxLines+1));
for (int i = 0; i < _cursor; i++)
(*lines)[i] = temp[i];
for (int i = _cursor; i <= _maxLines; i++)
(*lines)[i] = temp[i+1];
free(temp[_cursor]);
free(temp);
}
void changeLine(char ***lines) {
system("CLS"); | {
"domain": "codereview.stackexchange",
"id": 29767,
"lm_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, c, console, windows, text-editor",
"url": null
} |
c++, c
return count;
}
void break_heap()
{
struct lnode* head = NULL;
int i=0;
while(1)
{
i++;
lnode_push(head,1);
}
}
int main()
{
sl_list<int> list1;
list1.push(10);
list1.push(20);
list1.push(30);
list1.push(40);
list1.push(50);
list1.push(60); | {
"domain": "codereview.stackexchange",
"id": 809,
"lm_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",
"url": null
} |
rna-seq, gene
Here is one potential solution: https://github.com/WormBase/website/issues/4297
After you convert, you have to make sure that you have ERCC spike-ins in your gene table (probably not) and you mitochondrial genes start with "mt-". | {
"domain": "bioinformatics.stackexchange",
"id": 332,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rna-seq, gene",
"url": null
} |
javascript, programming-challenge, sorting, time-limit-exceeded
Title: New Year Chaos JavaScript, needs to be sped up Similar to this question but this is for Python
Original problem with description on hacker rank
I am currently trying to iterate through a large number of arrays and count how many times numbers have been swapped.
A sorted array looks like this: [1,2,3,4,5] and a number can be swapped only towards the front (counting down to 0) twice.
If a number is more than 2 out of order the array is deemed 'Too chaotic' and the process should stop.
Instead of bubble sorting I am simply going through and counting the actual swaps. As a sorted array is not actually required, my code works except for a couple of the tests where it times out due to large arrays.
Any ideas on how to speed this process up?
function minimumBribes(q) {
console.log(sort(q));
function sort(items) {
let bribes = 0; | {
"domain": "codereview.stackexchange",
"id": 43252,
"lm_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, programming-challenge, sorting, time-limit-exceeded",
"url": null
} |
Multiply the corresponding entries from the rows and columns together and then add the resulting multiplication results. ’). So, it's now going to be a 3 by 4 matrix. The transpose of a matrix interchanges its rows and columns; this is illustrated below: Here is a simple C loop to show the transpose: for (i = 0; i < 3; i++) {for (j = 0; j < 3; j++) {output[j][i] = input[i][j];}} Assume that both the input and output matrices are stored in the row major order (row major order means that the row index changes fastest). All Rights Reserved by Suresh, Home | About Us | Contact Us | Privacy Policy. The new matrix obtained by interchanging the rows and columns of the original matrix is called as the transpose of the matrix. Some laws on matrix multiplication: If A, B, C matrix meet the required matrix multiplication … A related matrix form by making the rows of a matrix into columns and the columns into rows is called a ____. The matrix B is called the transpose of matrix A if and only if b | {
"domain": "thelaunchpadtech.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9648551566309688,
"lm_q1q2_score": 0.8330478538582039,
"lm_q2_score": 0.8633916170039421,
"openwebmath_perplexity": 368.5576146674933,
"openwebmath_score": 0.6036203503608704,
"tags": null,
"url": "https://www.thelaunchpadtech.com/forum/d96go/r9w2t0.php?a3a973=transpose-of-row-matrix-is-called"
} |
filters, filter-design, infinite-impulse-response, optimization, approximation
w = 0.0001:0.001:pi;
as = [-1:0.001:-0.001 0.001:0.001:1];
E = zeros(size(as));
for idx=1:length(as)
fJ = J(w,as(idx),K);
E(idx) = sum(fJ);
end
[Emin, indx] = min(E)
a = as(indx)
function f = J(w,a,K)
num = 2*(2-a)*(1-cos(w*K)) + 2*(cos(w*(K-1)) - cos(w)) - 2*(1-a)*(cos(w)-cos(w*(K+1)));
den = (2-a)^2 + 1 + (1-a)^2 + 2*(1-a)*cos(2*w) - 2*(2-a)^2*cos(w);
f = -(a/K)*num./den;
f = f+(1/K^2)*(1-cos(w*K))./(1-cos(w))+a^2./(1+(1-a)^2-2*(1-a)*cos(w));
end
end | {
"domain": "dsp.stackexchange",
"id": 5905,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filters, filter-design, infinite-impulse-response, optimization, approximation",
"url": null
} |
waves, acoustics
When I speed it up to 200% of its original speed. When stored digitally, audio is a bunch of data points where each data point is an amplitude sample and an associated time that it occurs at.
To speed something up (or slow it down) you just change the time that the sample occurs at (i.e. decrease or increase the time between each sample).
It's the digital equivalent of literally turning the casette tape reel or vinyl record faster (you know what those are right?)
It's almost identical to just hitting the notes on a piano faster when reading sheet music. | {
"domain": "physics.stackexchange",
"id": 81060,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "waves, acoustics",
"url": null
} |
formal-languages, automata, finite-automata
Well, in a way, every DFA is also an NFA, and every NFA is also an NFA with $\epsilon$ transitions (it just so happens that the former does not use these transitions).
A caveat here is that if you really stick to the standard definitions, then in a DFA the "type" of the transition function returns a state, whereas in an NFA it returns a subset.
This is just a technicality, of course, as you can define a DFA to be an NFA whose transition function only returns singletons.
I would look at things this way:
An $\epsilon$-NFA would be the "standard".
Then, define an NFA to be an $\epsilon$-NFA that does not use the $\epsilon$ transitions.
Finally, define a DFA to be an NFA with a single initial state and a transition function that only returns singletons. | {
"domain": "cs.stackexchange",
"id": 1844,
"lm_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, automata, finite-automata",
"url": null
} |
python, python-3.x
Second, having a list to keep the dictionary words in is unnecessarily slow. For every new word found, it's being compared to each word in that list. A faster option would be to store them in a set. Sets can't contain duplicates, so you could simply add each word without having to worry if you've seen it before:
found_words = set()
for item in perm_words:
word = "".join(item).lower()
if dictionary.check(word):
found_words.add(word) | {
"domain": "codereview.stackexchange",
"id": 34553,
"lm_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",
"url": null
} |
javascript, asynchronous
And that's all.
However, if you want to have one callback-function which is called after all files have been loaded, this gets a bit tricky. You don't know which file is the last one, and which file should trigger the actual callback-function.
function loadScriptArray(contentArray, contentLoadedCallback){
var contentQuantity = contentArray.length; //Number of Files that needs to be loaded
var contentCompleted = 0; //Number of Files, that have already been loaded
var returnParamList = {}; //List with return-Parameters
if(contentQuantity == 0){ //We don't have anything to load
return contentLoadedCallback({});
} | {
"domain": "codereview.stackexchange",
"id": 8597,
"lm_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, asynchronous",
"url": null
} |
quantum-mechanics, schroedinger-equation, wavefunction
Title: Meaning of instantaneous probability densities in time dependent wavefunctions For a time dependent wavefunction, are the instantaneous probability densities meaningful? (The question applies for instances or more generally short lengths of time that are not multiples of the period.)
What experiment could demonstrate the existence of a time dependent probability density?
Can an isolated system be described by a time dependent wavefunction? How would this not violate conservation of energy?
I see the meaning of the time averaged probability density. Is the time dependence just a statistical construct? 1) Why do you believe that instantaneous probability densities are not meaningful?
2) Essentially any non-stationary state for which you need to compute time-dependent wavefunctions: e.g. chemical reaction dynamics, particle scattering, etc.
3) Yes, the time dependant Schrödinger equation applies to isolated systems. | {
"domain": "physics.stackexchange",
"id": 5329,
"lm_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, schroedinger-equation, wavefunction",
"url": null
} |
c++, skip-list
// Helper functions
/*
Function: randomLevel()
Use: implicit in class Skip_list
It generates node levels in the range
[1, maxLevel).
It uses rand() scaled by its maximum
value: RAND_MAX, so that the randomly
generated numbers are within [0,1).
*/
int Skip_list::randomLevel () {
int v = 1;
while ((((double)std::rand() / RAND_MAX)) < probability &&
std::abs(v) < maxLevel) {
v += 1;
}
return abs(v);
}
/*
Function: nodeLevel()
Use: Implicitly in most of the member functions.
It returns the number of non-null pointers
corresponding to the level of the current node.
(the node that contains the checked vector of
forward pointers)
If list empty returns 1.
*/
int Skip_list::nodeLevel (const std::vector<Skip_Node*>& v) {
int currentLevel = 1;
// last element's key is the largest
int nilKey = std::numeric_limits<int>::max(); | {
"domain": "codereview.stackexchange",
"id": 17839,
"lm_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++, skip-list",
"url": null
} |
• Of course whether a proof is simple or complex depends on your definition of $\binom{n}{r}$ – GEdgar Oct 27 '15 at 18:28
• For more proofs of this identity, see: Proving Pascal's Rule : ${{n} \choose {r}}={{n-1} \choose {r-1}}+{{n-1} \choose r}$ when $1\leq r\leq n$. – Martin Sleziak Feb 4 at 11:30 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9724147193720649,
"lm_q1q2_score": 0.8017189085762787,
"lm_q2_score": 0.8244619220634456,
"openwebmath_perplexity": 253.8682175722705,
"openwebmath_score": 0.8144630193710327,
"tags": null,
"url": "https://math.stackexchange.com/questions/1125923/proving-pascals-identity"
} |
c#, object-oriented
public ContributionTotal(string contributionType, string contributionDescription, decimal total, DateTime lastContributionDate, decimal lastContributionAmount)
{
ContributionType = contributionType;
ContributionDescription = contributionDescription;
Total = total;
LastContributionDate = lastContributionDate;
LastContributionAmount = lastContributionAmount;
}
public static List<ContributionTotal> GetContributionTotals(Member member)
{
var contributionTotals = new List<ContributionTotal>();
using (var connection = new SqlConnection(Common.GetConnectionString()))
{
var cmd = new SqlCommand("GetMemberTotalContributions", connection) {CommandType = CommandType.StoredProcedure};
cmd.Parameters.AddWithValue("@MemberNumber", member.MemberNumber);
cmd.Parameters.AddWithValue("@SchemeCode", member.SchemeCode);
connection.Open(); | {
"domain": "codereview.stackexchange",
"id": 26767,
"lm_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",
"url": null
} |
lagrangian-formalism, conservation-laws, symmetry, conformal-field-theory, noethers-theorem
What am I missing? Have I made a mistake in my analysis? In these types of problems, it is very useful to work on a generic spacetime with metric $g$. For instance, we can promote the usual free-field Lagrangian
$$S=\int\mathrm{d}^dx\,\mathcal{L}=\int\mathrm{d}^dx\,\partial_{\mu}\phi\,\partial^{\mu}\phi$$
to one on a general curved spacetime as
$$S=\int\mathrm{d}^dx\,\mathcal{L}=\int\mathrm{d}^dx\,\sqrt{g}\,g^{\mu\nu}\nabla_{\mu}\phi\nabla_{\nu}\phi.$$
The general recipe here is to replace the volume form with $\mathrm{d}^dx\,\sqrt{g}$ and replace all derivatives with covariant derivatives.
Once this is done, the energy-momentum tensor is simply defined as
$$T_{\mu\nu}=\frac{1}{\sqrt{g}}\frac{\delta\mathcal{L}}{\delta g^{\mu\nu}}$$
(up to a possible uninteresting factor of 2).
For any coordinate (infinitesimal) transformation $x\to x+\epsilon(x)$, the variation of the metric tensor takes the form
$$\delta g_{\mu\nu}=\nabla_{\mu}\epsilon_{\nu}+\nabla_{\nu}\epsilon_{\mu}.$$ | {
"domain": "physics.stackexchange",
"id": 59761,
"lm_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, conservation-laws, symmetry, conformal-field-theory, noethers-theorem",
"url": null
} |
ros, answers.ros.org
That is actually weird, I have 'delete', but I can't use it -- it says that over 1000 karma is required.
Comment by Chik on 2013-03-26:
very funny :-D
Comment by Ben_S on 2013-03-27:
I have edit, delete and link on this answer and edit, retag, close, delete on the question. No flag offensive. (But since i got >1000 karma, i probably dont need it anymore) Is there a possibility to see the moderators? And all my flagged posts remained visible in the past. (at least to me...)
Comment by felix k on 2013-03-27:
Nice to see I'm not the only one. Askbot upstream post done.
Comment by Evgeny on 2013-03-27:
@Boris the "delete" button issue is a bug indeed, I will try to fix it asap on this site.
Comment by Evgeny on 2013-03-27:
@felix k thank you for bringing these up, I will fix these within 3 days (possibly need to do some work to update the theme to the current version of Askbot as well). | {
"domain": "robotics.stackexchange",
"id": 13553,
"lm_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, answers.ros.org",
"url": null
} |
# What is meant by tridiagonal linear equation system?
I have to implement the SOR (Successive Over-Relaxation) method, using sparse matrices, to find the solution vector of these linear equations systems (for quite huge matrices):
What does that tridiag(-1,3,-1) or tridiag(1,2,1) mean? For the 1st example, what are the -1, 3 and -1? For the 2nd, what does the 1, 2 and 1 mean? Is it a matrix with a diagonal of (-1,3,1) or what could that be? | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9861513910054508,
"lm_q1q2_score": 0.8016102384236784,
"lm_q2_score": 0.8128673201042492,
"openwebmath_perplexity": 580.3655559532475,
"openwebmath_score": 0.7391794919967651,
"tags": null,
"url": "https://math.stackexchange.com/questions/3233388/what-is-meant-by-tridiagonal-linear-equation-system"
} |
ros, lidar, sicklms, sicktoolbox-wrapper
Title: SICK LMS500 connection and drivers
Hello everyone.
I would like to ask the ROS community, if anyone had any success on compiling a node or wrapper for the SICK LMS500 Lidar scanner. I have already examined the sicktoolbox and the links from adept robotics and github but still I can't receive any data from the scanner. Apparently the problem occurs because the LMS200 and LMS500 use different connection interfaces, RS232 & Ethernet respectively. Does anyone have any thoughts or experience to share regarding this scanner?
My Os is Ubuntu 12.04 and my distro is Fuerte.
Thank you all in advance.
Originally posted by dkc on ROS Answers with karma: 13 on 2013-02-26
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 13088,
"lm_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, lidar, sicklms, sicktoolbox-wrapper",
"url": null
} |
c++, performance, beginner
for(i=999;i>=100;i--)
{if(a[i]!=1)
{ missing_numbers[j] = i;
found_missing_numbers++;
j++;
}
if (found_missing_numbers == 2)
break;
}
if (found_missing_numbers == 2)
{
cout << "The two largest numbers of three digits that are missing from the file are:";
cout << missing_numbers[0] << " and " << missing_numbers[1];
}
else if (found_missing_numbers == 1)
cout << "Only one three digit number is missing from the file:" << missing_numbers[0];
else
cout << "There are no three digit numbers missing from the file.";
cin.get();
in.close();
return 0;
}
Example of Input: | {
"domain": "codereview.stackexchange",
"id": 19954,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, performance, beginner",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.