text stringlengths 1 1.11k | source dict |
|---|---|
quantum-field-theory, dirac-equation
The resulting infinite negative charge density of real electrons not only doesn't matter but is in fact completely and totally invisible for some reason, and...
The resulting infinite mass density of electrons (recall that these are quite real electrons, only in odd negative-energy kinetic states) also doesn't matter, and...
Unlike the Fermi sea of a metal conduction band, removing an electron from this infinitely dense sea of electrons for some reason doesn't cause other electrons to collapse into it and fill it, even though the negative kinetic velocity electrons are pushed by exactly the same Pauli exclusion forces as the ones in a Fermi band; in short, for reasons not clear, semiconductor-style hole stabilization applies while metal-style hole filling does not (is there a band gap going on here?), and... | {
"domain": "physics.stackexchange",
"id": 14090,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, dirac-equation",
"url": null
} |
thermodynamics
Title: Calculating the $\frac{dp}{dT}$ slope using Clausis-Clapeyron I've produced experimental data over how the boiling point of water varies with pressure and temperature and plotted this in a PT graph. I would like to verify my results using theory. The Clausius-Clapeyron equation appears to be exactly what I want. I did manage to find a table over heat of vaporization depending on pressure, so that this version of Clausius-Clapeyron is almost applicable:
$$
\frac{dP}{dT}=\frac{L}{T\Delta v}
$$
However, I don't have any values for $\Delta v$. So what are my options? Is there some approximation I can make to find the value for $\Delta v$ or is there another version of Clausius-Clapeyron I can use to find $\frac{dP}{dT}$ using freely available tables? Or would someone suggest another way of verifying my results? The usual approximation is to disregard liquid volume against vapor volume, and to consider the latter to be that of an ideal gas, so you get $\Delta v = RT - 0 = RT$ and so | {
"domain": "physics.stackexchange",
"id": 5900,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics",
"url": null
} |
quadcopter, raspberry-pi
I have already developed a Python script that decides whether the quadcopter dron has to turn left/right, move straight on or to stop.
Is there a way to connect the Raspberry Pi to the flight controller to send it the commands?
Is it as easy as it sounds?
Edit: I can change the flight controller if necessary. The easiest way to do this would be using UART for serial communication. The CC3D has TX/RX/GND pins which you connect to Raspberry Pi.
Now you will need some sort of protocol or data framing to send pitch/roll/yaw/throttle values to the flight controller and differentiate these values somehow. You can implement and use the MultiWii Serial Protocol for this purpose. Flight controller firmware such as CleanFlight already support MSP. On the RaspPi, PyMultiWii can be used to handle MSP frames. | {
"domain": "robotics.stackexchange",
"id": 1439,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quadcopter, raspberry-pi",
"url": null
} |
beginner, c, strings
Title: isRotation and isSubstring method I have written an isRotation function that calls on isSubstring only once(I am allowed to call it only once). I have implemented my own version of isSubstring as well. Any advice is much welcome!
//Checks if one string is a rotation of the other
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
bool isRotation(char *, char *);
bool isSubstring(char *, char *);
int main(int argc, char **argv)
{
if(argc == 3)
{
printf("%s %s a rotation of %s.\n", argv[2], isRotation(argv[1], argv[2])
? "is" : "is not", argv[1]);
}
else
{
fprintf(stderr, "Incorrect number of inputs\n");
return -1;
}
return 0;
}
bool isRotation(char* s1, char* s2)
{
size_t len1 = strlen(s1);
size_t len2 = strlen(s2);
if(len1 != len2 || len1 == 0 || len2 ==0)
return 0;
char s3[len2*2];
bool secondCopy = false;
int j = 0; | {
"domain": "codereview.stackexchange",
"id": 17707,
"lm_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, strings",
"url": null
} |
pcl, ros-hydro
Originally posted by Tim Sweet with karma: 267 on 2014-01-01
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by ahendrix on 2014-01-02:
Added to that, the upstream PCL package is called pcl, which is a valid rosdep dependency. | {
"domain": "robotics.stackexchange",
"id": 16550,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pcl, ros-hydro",
"url": null
} |
The thumbs-up icon indicates that you approve, you're happy, you like, etc.
The thumbs-down icon indicates that you don't approve, you're not happy, you don't like, etc.
I am preparing for the medical entrance exam for 2019. It needs basic mathematics, Trigonometric, calculus, graph, etc for physics and chemistry … I appreciate all of your kind efforts which are helping me to learn math in an easy way …
Thanks for this information. Have you studied these topics before? That is, are you refreshing your memory on some points, but you recognize most of what you see at your study site? I ask because, if you're refreshing your memory, then perhaps it's not bad that you're jumping back and forth within the topics. (You said that you're learning math in an easy way here; that's good. You're the ultimate judge as to whether you're ready for exams.) | {
"domain": "freemathhelp.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9790357573468176,
"lm_q1q2_score": 0.8071777043823503,
"lm_q2_score": 0.8244619242200082,
"openwebmath_perplexity": 1163.6368577392448,
"openwebmath_score": 0.6287972331047058,
"tags": null,
"url": "https://www.freemathhelp.com/forum/threads/why-x-1-2-root-x-and-x-1-2-1-root-x.111633/"
} |
java, array, recursion, mathematics, combinatorics
The sum gives and indices act like a stack, and the depth is how deep the stack is (again, assume sorted data):
Arrays.sort(data);
while (depth >= 0) {
lastindex++;
if (lastindex == data.length) {
// we have run out of data.
do {
// walk up the stack till we find some data.
depth--;
while (depth >= 0 && (lastindex = indices[depth] + 1) < data.length);
}
if (depth >= 0) {
.....
you then add your code in here to check the target,
keep it updated in your 'stack'.
go down a level and move on....
}
} | {
"domain": "codereview.stackexchange",
"id": 15891,
"lm_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, array, recursion, mathematics, combinatorics",
"url": null
} |
python, python-3.x, console
milk = input("How Much Milk Would You Like? SMALL/MEDIUM/LARGE ")
print ("Order is being processed, next order:\n")
orders.append({'sugar': sugar, 'milk': milk })
print('The orders has been processed with these data:')
for i in range(num_orders):
order = orders[i]
print (' - Person', i + 1, 'wants tea', ('with %i' % int(order['sugar']) if
order['sugar'] else 'without'), 'sugar and ', order['milk'], 'milk')
print('')
restart = input('Would you like to Re-Order? Y/N')
if restart in ('n', 'N'):
print('')
print ('Okay, Thank You, Enjoy Your Tea') Some notes: | {
"domain": "codereview.stackexchange",
"id": 6630,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x, console",
"url": null
} |
feynman-diagrams, spinors, majorana-fermions
Title: Where do I see the difference in Majorana vs. Dirac pair annihilation? If I have a Lagrangian density $\cal{L}=\bar{\chi}\gamma^{\mu}{\rm A}_{\mu}\chi+\bar{f}\gamma^{\mu}{\rm A} _{\mu}f$ and I calculate the diagram $\chi \bar{\chi}\to f \bar{f}$ where $f$ is (let's say) a Dirac fermion, where will I see the effect of whether $\chi$ is Majorana or Dirac?
Naively, I would calculate the $s$-channel diagram normally in either case and I can't see how the Majorana nature would manifest. When I average over the spins, I guess there would be a $\frac{1}{2} or \frac{1}{4}$ factor for Majorana or Dirac, respectively, but surely that can't be all?
If I instead calculate $\bar{\chi} \chi \to A A$, would the Majorana nature be different? Again, the only change I can foresee is the prefactor that I mentioned. My question does not concern just annihilation, so other answers concerning some decay or other process would also be useful. | {
"domain": "physics.stackexchange",
"id": 83322,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "feynman-diagrams, spinors, majorana-fermions",
"url": null
} |
genetics, reproduction
Here, the term "genetically similar" is used.
So, clones (offspring produced through asexual reproduction- involvement of one parent) are "genetically exact" to their parents or genetically similar? | {
"domain": "biology.stackexchange",
"id": 10584,
"lm_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, reproduction",
"url": null
} |
particle-physics, standard-model, quarks
Title: Top, bottom, charm, and strange? Of course I know about up and down quarks, but I cannot seem to find that much about the other four (of course being eight if we're including antiquarks). Is mass the only difference between the quarks? Can the other quarks form hadrons of their own? Is there some interesting matter or reaction or anything that any of them can make or do, or are they really as boring as the Internet has been telling me? First of all, where did you find those "boring materials on the internet" about the quarks? Quarks are not boring at all; in fact they are of a major importance in the Standard Model.
There are 6 types of quarks (plus their anti-quarks): up,down,charm,strange, top and bottom. Each one has different properties, such as electric charge, mass, color charge and spin.
There are so many materials where you can read about them, that I don't even know which one should I recommend, so I'll just go with a safe bet: wikipedia | {
"domain": "physics.stackexchange",
"id": 42000,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "particle-physics, standard-model, quarks",
"url": null
} |
is an integer. This is equivalent to saying that the above number, times $40^4$, is a multiple of $40^4$. In other words,
$${(40 \cdot 515391 + 33)}^4 - {(40 \cdot 384140 + 39)}^4 \equiv 0 \pmod {40^4}.$$
Let's expand those numbers for the time being, and also move the $\equiv$ sign to the middle:
$$20615673^4 \equiv 15365639^4 \pmod {40^4}.$$
Now, since we're working modulo $40^4$, we can disregard any multiple of $40^4$ in the above expression. So this identity reduces down to:
$$135673^4 \equiv 5639^4 \pmod {40^4}.$$
The number $40$ factors into prime powers as $8 \cdot 5$, so by the Chinese remainder theorem, the above identity is equivalent to these two identities:
$$135673^4 \equiv 5639^4 \pmod {8^4};\\ 135673^4 \equiv 5639^4 \pmod {5^4}.$$
Again, we can disregard multiples of $8^4$ and $5^4$, so these identities reduce further down to:
$$505^4 \equiv 1543^4 \pmod {8^4};\\ 48^4 \equiv 14^4 \pmod {5^4}.$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9744347897888529,
"lm_q1q2_score": 0.8011696946896065,
"lm_q2_score": 0.8221891327004133,
"openwebmath_perplexity": 178.4969787786939,
"openwebmath_score": 0.8240457773208618,
"tags": null,
"url": "https://math.stackexchange.com/questions/2337440/why-is-this-expression-an-integer"
} |
He then goes on to prove the special case with z0 = 0 and z1 = t1 > 0. Why does having proved this special case imply the general case for any point on the boundary of a region of convergence centered at any complex point? I think it may have something to do with shifting the power series and dividing/multiplying, but I'm not sure quite how to make it work.
2. Suppose you have a complex power series $\sum_{n=0}^\infty b_n(z-z_0)^n$ with radius of convergence $R>0$ which converges at some point $z_1$ on the boundary of the disk $D=D(z_0,R)$. By shifting and rotating the axes, you obtain another power series $\sum_{n=0}^\infty a_nz^n$ with radius of convergence $R$ which converges at the point $z=R$. (If $z_1=z_0+R\mathrm e^{\mathrm i\theta}$ then $a_n=b_n\mathrm e^{\mathrm in\theta}$.) | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9877587265099557,
"lm_q1q2_score": 0.8395664460376959,
"lm_q2_score": 0.8499711756575749,
"openwebmath_perplexity": 93.35437705924645,
"openwebmath_score": 0.979404628276825,
"tags": null,
"url": "http://mathhelpforum.com/differential-geometry/94231-complex-power-series-boundary-property.html"
} |
• Write the function given the transformations.Absolute value function that is reflected over the xaxis, vertically compressed by a factor of .25, shifted down 2 units, and shifted left 3 units. The graphed blue function is the parent function.Describe the transformation(s) from the parent function (blue) to the function given (green). When working with functions resulting from
• When the graph of a function is changed in appearance and/or location we call it a transformation. There are two types of transformations. A rigid transformation changes the | {
"domain": "kleine-maultierfarm.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429129677613,
"lm_q1q2_score": 0.8098915697021347,
"lm_q2_score": 0.8221891239865619,
"openwebmath_perplexity": 1674.2689607821544,
"openwebmath_score": 0.5267004370689392,
"tags": null,
"url": "https://taoxlm.kleine-maultierfarm.de/transformations-of-graphs.html"
} |
Step 2.
"Theorem" 2. For any $p$ and $H(X|Y)$, $$H(X|Y) - H(X|Y,X\neq Y) \geq -\frac{(1-p)H(X|Y)}{p}$$ and there are examples arbitrarily close.
Proof. Again we have $p\cdot H(X|Y,X\neq Y) = H(X|Y,Z)$, so by the previous claim, $$H(X|Y) - p\cdot H(X|Y,X\neq Y) \geq 0 .$$ Again let $H(X|Y) = p\cdot H(X|Y) + (1-p)H(X|Y)$ and rearrange. By the previous claim, we have arbitrarily close examples (since we have only rearranged the inequality). $\square$
• The lower bound can be simplified: Let $Y=0$ be constant. Let $X=Y=0$ with probability $1-p$ and $X\ne Y=0$ with probability $p$. Let $k=H(X|X\ne Y)=H(X|Y,X \ne Y)$. Then $H(X|Y)=H(X)=H_2(p)+p\cdot k \leq 1 + p k$. Clearly, as $k \to \infty$, $H(X|Y,X \ne Y) - H(X|Y) \to \infty$, so long as $p < 1-\omega(1/k)$. Dec 9 '14 at 4:09 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.981453438742759,
"lm_q1q2_score": 0.8361520071383272,
"lm_q2_score": 0.8519528019683105,
"openwebmath_perplexity": 148.32620846781228,
"openwebmath_score": 0.9909932613372803,
"tags": null,
"url": "https://cstheory.stackexchange.com/questions/27739/conditional-entropy-hx-y-large-implies-hx-y-x-neq-y-large/27754"
} |
computational-chemistry, molecular-orbital-theory
Configuration interaction (CI) methods apply the HF method not only to the ground state but also to a number of excited states, and then find the correct solution to the system variationally, as a linear combination of those configurations. This method is in principle exact - and it's variational, so we are guaranteed not to underestimate the energy - the problem is that it is a series expansion, in which we add a term for each possible configuration state function (CSF). Still, even a full CI taking into account all the possible CSFs won't account for all of the correlation - CI is only exact in the limit of a complete basis set. In practice, expanding the series is computationally very expensive, and it is truncated relatively early - full CI is only practical for the simplest of systems.
When it's applicable, however, difference in energy between alpha and beta electrons should be negligible.
Coupled cluster | {
"domain": "chemistry.stackexchange",
"id": 9779,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computational-chemistry, molecular-orbital-theory",
"url": null
} |
nanopore, fast5
# converts/collects all single files in the original folder
single_to_multi_fast5 -i $orig_path/ -s $final_path/ --filename_base $output_name --batch_size 1000 --recursive | {
"domain": "bioinformatics.stackexchange",
"id": 2625,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nanopore, fast5",
"url": null
} |
python, game, pygame
# break hard when you deccelerate
if self._ax * self._vx < 0 and self._ay * self._vy < 0:
self._vx = self._vx * 0.8
self._vy = self._vy * 0.8
def draw(self, display):
pygame.draw.rect(display, self.color, (self.x, self.y, self._width, self._width))
screen.py
"""
Written by Nathan van 't Hof
9 January 2018
The screen object all the objects are drawn on.
"""
import pygame
from win32api import GetSystemMetrics
class display:
def __init__(self):
self.BLACK = (0, 0, 0)
self.WIDTH = GetSystemMetrics(0)
self.HEIGHT = GetSystemMetrics(1)
# full screen
self.windowSurface = pygame.display.set_mode((self.WIDTH, self.HEIGHT), pygame.FULLSCREEN)
self.windowSurface.fill(self.BLACK)
self.font = pygame.font.Font(None, 32) | {
"domain": "codereview.stackexchange",
"id": 28953,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, game, pygame",
"url": null
} |
electric-fields, conservation-laws, electric-current, vectors, batteries
I want to know what is the reason behind this, or where does the force which changes direction and magnitude of drift velocity come from, since battery's emf only accelerates them along the direction of wire, and thus whenever wire is curved or junction is present, I encounter this problem. Think of pipes of varying diameter (resistance) with constant mass flow rate. Here the flow is faster for smaller diameter and vice versa. This is an effect of the continuity equation. So in some sense the velocity is faster in some places because momentarily there would be accumulation of charges over there. These accumulations would push charges away faster. So in the steady state there is an equilibrium. | {
"domain": "physics.stackexchange",
"id": 65285,
"lm_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-fields, conservation-laws, electric-current, vectors, batteries",
"url": null
} |
regression, reinforcement-learning, dqn
To get more samples, we have to return back to step 2) and re-run the forward pass with some another scalar $\tau$ once again sampled from [0,1] range. Or, of course, we can re-use our IQN, to run the needed number of such forward-passes in parallel, if hardware allows. No need to start all the way from step 1) because we only care about the end-layers where $\tau$ actually enters the system. "Any preceding layers" would be re-computed to the same values anyway. | {
"domain": "datascience.stackexchange",
"id": 7277,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "regression, reinforcement-learning, dqn",
"url": null
} |
1. Write $$\; \cos(2\theta)\cos(6\theta) \;$$ as a sum.
2. \Write $$\; \sin(\theta) - \sin(3\theta) \;$$ as a product.
Solution
1. Identifying $$\alpha = 2\theta$$ and $$\beta = 6\theta$$, we find
$\begin{array}{rcl} \cos(2\theta)\cos(6\theta) & = & \frac{1}{2} \left[ \cos(2\theta - 6\theta) + \cos(2\theta + 6\theta)\right]\\ & = & \frac{1}{2} \cos(-4\theta) + \frac{1}{2}\cos(8\theta) \\ & = & \frac{1}{2} \cos(4\theta) + \frac{1}{2} \cos(8\theta), \end{array}$
where the last equality is courtesy of the even identity for cosine, $$\cos(-4\theta) = \cos(4\theta)$$.
1. Identifying $$\alpha = \theta$$ and $$\beta = 3\theta$$ yields
$\begin{array}{rcl} \sin(\theta) - \sin(3\theta) & = & 2 \sin\left( \dfrac{\theta - 3\theta}{2}\right)\cos\left( \dfrac{\theta + 3\theta}{2}\right) \\ & = & 2 \sin\left( -\theta \right)\cos\left( 2\theta \right) \\ & = & -2 \sin\left( \theta \right)\cos\left( 2\theta \right), \\ \end{array}$ | {
"domain": "libretexts.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9937100967454597,
"lm_q1q2_score": 0.8344521202632329,
"lm_q2_score": 0.8397339656668287,
"openwebmath_perplexity": 235.8874990521153,
"openwebmath_score": 0.9533764123916626,
"tags": null,
"url": "https://math.libretexts.org/Bookshelves/Precalculus/Book%3A_Precalculus_(Stitz-Zeager)/10%3A_Foundations_of_Trigonometry/10.4%3A_Trigonometric_Identities"
} |
python, datetime, gui, pyqt, pyside
activities = {
"Learn Language": {
'options': ["French", "German"],
'occurrence': 1,
'occur_time': "Week",
'postpone_cost': 2,
'add_credit': 1
},
"Learn Programming": {
'options': ["Python", "C", "C#"],
'occurrence': 1,
'occur_time': "Week",
'postpone_cost': 2,
'add_credit': 1
},
"Running/Exercise": {
'occurrence': 2,
'occur_time': "Week",
'postpone_cost': 2,
'add_credit': 1
},
"Clean Room": {
'occurrence': 1,
'occur_time': "Week",
'postpone_cost': 2,
'add_credit': 1
},
"Study": {
'occurrence': 3,
'occur_time': "Week",
'postpone_cost': 2,
'add_credit': 1
},
"Read a Book": {
'occurrence': 1,
'occur_time': "Month",
'postpone_cost': 2,
'add_credit': 1
},
"Meditate": {
'occurrence': 1,
'occur_time': "Week", | {
"domain": "codereview.stackexchange",
"id": 11984,
"lm_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, datetime, gui, pyqt, pyside",
"url": null
} |
assembly, bacteria
if len(sequence) > 0:
process_record(header, sequence, low, high)
To use it:
$ ./13879.py 1000 15000 < in.fa > out.fa
Fragments will be disjoint (non-overlapping, contiguous) subsequences.
I add a check to determine if the last fragment of a FASTA record would be shorter than low (1kb) in length, and, if so, append that fragment to the final subsequence. It is possible for that last fragment to be up to 16 kb - 1 nt in length, given your parameters:
if new_next > len(sequence) - high:
new_next = len(sequence)
You could change this logic to discard the last fragment (i.e. break), or simply allow fragments less than 1kb in size, depending on what you need.
EDIT
Here's a slight modification that should allow to you preserve fragment sizes within your bounds.
A cartoon may help illustrate the problem. Let's set up a FASTA record, which has been broken up into n fragments:
1 2 n-2 n-1 n
|-----|---------|...|-------|---------|-----| | {
"domain": "bioinformatics.stackexchange",
"id": 1485,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "assembly, bacteria",
"url": null
} |
differential-geometry, symmetry, noethers-theorem
I have not yet completely understood the theorem depicted above so I am looking for some conceptual toeholds. Woit appears to be talking about situations where you have a symmetry of phase space that doesn't arise from a symmetry of the configuration space variables. Noether's theorem in terms of symmetries of the action only deals with the latter types of symmetries, since the action is a functional of configuration space. Woit specifically mentions the case of the 3D harmonic oscillator. He notes that while the action has $SO(3)$ rotational symmetry leading to conserved quantities associated with angular momentum via Noether's theorem, the phase space actually admits a larger symmetry group $U(3)$. These additional symmetries involve transformations that mix momenta and positions, and hence are not present as symmetries of the action. These symmetries are sometimes called hidden symmetries due to not being manifest in the action. | {
"domain": "physics.stackexchange",
"id": 78001,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "differential-geometry, symmetry, noethers-theorem",
"url": null
} |
c#, game, asp.net-core, checkers-draughts, signalr
private string GetClientConnection(Guid id)
{
return _context.Players.Find(id).ConnectionID;
}
Dictionary<string, object> GetViewData(Guid localPlayerID, Player orientation)
{
return new Dictionary<string, object>
{
["playerID"] = localPlayerID,
["orientation"] = orientation
};
}
public Task Handle(OnMoveNotification request, CancellationToken cancellationToken)
{
var lastMoveDate = _mediator.Send(new GetLastMoveDateMessage(request.ViewModel)).Result;
var blackConnection = GetClientConnection(request.ViewModel.BlackPlayerID);
var whiteConnection = GetClientConnection(request.ViewModel.WhitePlayerID); | {
"domain": "codereview.stackexchange",
"id": 35461,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, game, asp.net-core, checkers-draughts, signalr",
"url": null
} |
galaxy-cluster
The total number density of galaxies is thus found by integrating the HMF. Luckily, the online HMF tool can do that as well. The result, i.e. the number density of halos above a given mass, looks like this: | {
"domain": "astronomy.stackexchange",
"id": 766,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "galaxy-cluster",
"url": null
} |
game, objective-c
Also, notice that we don't need the default if we're switching on an enum and handling all cases.
- (NSMutableSet *) rowsWithChanges {
NSMutableSet *rowsWithChanges = [[NSMutableSet alloc]init];
for (DMRow *row in _board.rows) {
for (DMOrb *orb in row.orbs) {
if (orb.markedForDestruction) {
[rowsWithChanges addObject:row];
}
}
}
return rowsWithChanges;
}
We're using a set, which means that adding an object multiple times does nothing. So, let's save some iterations and checks:
- (NSMutableSet *)rowsWithChanges {
NSMutableSet *rowsWithChanges = [NSMutableSet set];
for (DMRow *row in _board.rows) {
for (DMOrb *orb in row.orbs) {
if (orb.markedForDestruction) {
[rowsWithChanges addObject:row];
break;
}
}
}
return rowsWithChanges;
} | {
"domain": "codereview.stackexchange",
"id": 11301,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "game, objective-c",
"url": null
} |
ros, rosaria, pioneer
Comment by anirban on 2015-07-07:
I cannot connect to pioneer robot using rosaria for several days. Although I was able to connect when I installed first. I tried powering of and turning power on of the robot but nothing changed. I also used restart button that also did not work. can any one help?
Comment by RND on 2015-07-08:
@anirban you can either follow the above comments, or check that the port you are using is valid. How are you connecting to rosaria?
Comment by anirban on 2015-07-08:
I am connecting P3 using a serial cable. I am running the following command line
$ rosrun rosaria RosAria _port:=/dev/ttyS2
S2 because I know this port worked well with aria example codes those are provided by Mobile robot.
So basically I am using a USB serial converter to connect to the robot.
Comment by RND on 2015-07-08:
can you specify the error that you are getting?
Comment by anirban on 2015-07-08:
I am getting a similar error as above but without the lines
Syncing 0
No packet. | {
"domain": "robotics.stackexchange",
"id": 20713,
"lm_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, rosaria, pioneer",
"url": null
} |
the list of values is the graph of the parametric equations via of the coordinates. 13 1 Space Curves. y = -3 + 2t. The graph of the vector-valued function then shows each of these parametric plots as their orthogonal projections onto each of the coordinate planes. For example, consider the parametric equations of a circle. Etc I wanted to make a grapher once I had that 3D to 2D function from a little bit ago. The word 'parametric' is used to describe methods in math that introduce an extra, independent variable called a parameter to make them work. A square with the side 4a has the same one. MathGV is a mathematical function graphing software program for Windows XP, Vista and Windows 7. Find more Mathematics widgets in Wolfram|Alpha. This circle needs to have an axis of rotation at the given axis with a variable radius. For the second, specify a dashed red line style with circle markers. Good Grapher. With 3D Grapher you can easily plot high-quality equation and table-based graphs, | {
"domain": "prolocomontecastrilli.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9724147169737825,
"lm_q1q2_score": 0.8165696743575444,
"lm_q2_score": 0.8397339736884711,
"openwebmath_perplexity": 1545.129168880018,
"openwebmath_score": 0.4409862756729126,
"tags": null,
"url": "http://prolocomontecastrilli.it/axsc/3d-parametric-grapher.html"
} |
qiskit, ibm-q-experience
Thanks
FAILURE: Can not get job id, Resubmit the qobj to get job id.Error: 403 Client Error: Forbidden for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs?access_token=.... Your credits to run jobs are not enough, Error code: 3458.
Traceback (most recent call last):
File "file.py", line 307, in <module>
QSVMsetup(featuremap)
File "file.py", line 284, in QSVMsetup
training_result = svm.train(df_train_test_x_Q, df_train_test_y_Q, quantum_instance)
File "vqc.py", line 437, in train
gradient_fn=grad_fn # func for computing gradient
File "/home/user/.local/lib/python3.6/site-packages/qiskit/aqua/algorithms/adaptive/vq_algorithm.py", line 118, in find_minimum
gradient_function=gradient_fn)
File "/home/user/.local/lib/python3.6/site-packages/qiskit/aqua/components/optimizers/spsa.py", line 131, in optimize
max_trials=self._max_trials, **self._options) | {
"domain": "quantumcomputing.stackexchange",
"id": 1124,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "qiskit, ibm-q-experience",
"url": null
} |
haskell
isValidSize :: Int -> Int -> Int -> Bool
isValidSize int from to =
int >= from && int <= to && int `mod` 2 == 0
possibleMoves :: Game -> [Position]
possibleMoves (Game _ board cur) =
List.nub $ possiblePositions =<< cellsToProof
where
cellsToProof = Map.keys $ Map.filter (cur ==) $ cells board
possiblePositions pos = id =<< map (checkDirection pos) directions
checkDirection pos f
| isCurPlayer = []
| otherwise = loop $ f (x newPos) (y newPos)
where
newPos = f (x pos) (y pos)
isCurPlayer = not (isOfPlayer board newPos $ nextPlayer cur)
isInvalid pos = not (board `isInRange` pos) || isOfPlayer board pos cur || board `isHole` pos
loop pos
| isInvalid pos = []
| board `isFree` pos = [pos]
| otherwise = loop $ f (x pos) (y pos) | {
"domain": "codereview.stackexchange",
"id": 1463,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "haskell",
"url": null
} |
c++, windows, embedded
This code is currently working with no issues, but it feels to me that it is unsafe, incorrect, or in a poor location.
Here's the header file:
// SysLat_SoftwareDlg.h : header file
//
// created by Unwinder
// modified by Skewjo
/////////////////////////////////////////////////////////////////////////////
#ifndef _SYSLAT_SOFTWAREDLG_H_INCLUDED_
#define _SYSLAT_SOFTWAREDLG_H_INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "RTSSSharedMemory.h"
#include "RTSSClient.h"
#include "SysLatData.h"
#include "HardwareID.h"
#include "MachineInfo.h"
#include "USBController.h"
class CSysLat_SoftwareDlg : public CDialogEx
{
// Construction
public:
CSysLat_SoftwareDlg(CWnd* pParent = NULL); // standard constructor
~CSysLat_SoftwareDlg();
// Dialog Data
//{{AFX_DATA(CSysLat_SoftwareDlg)
enum { IDD = IDD_SYSLAT_SOFTWARE_DIALOG };
//}}AFX_DATA | {
"domain": "codereview.stackexchange",
"id": 40674,
"lm_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++, windows, embedded",
"url": null
} |
experimental-physics, speed-of-light, measurements, jupiter
Calculations
Once you collected the observations you should determine the position of Earth and Jupiter at the times of the observations (for example using JPL's Horizons system). You can then use the positions to determine the distance between the planets at the time the observations were made. Finally, you can use the distance and the variation in Io's perceived revolution period to compute the speed of light.
You will notice that roughly every 18 millions kms change in the distance of Earth and Jupiter makes an observation happen 1 minute earlier or later.
Cost
The cost of the experiment is largely the cost of buying a telescope that allows you to see Io. Note that the experiment takes a few months and requires measuring time of the observations with the accuracy of seconds.
History
See this wikipedia article for historical account of the determination of the speed of light by Rømer using Io. | {
"domain": "physics.stackexchange",
"id": 2073,
"lm_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, speed-of-light, measurements, jupiter",
"url": null
} |
quantum-field-theory, string-theory, path-integral, gauge-invariance
$$ H_\textrm{fix} = \sum_{n=1}^{N-1} X_n X_{n+1} + X_N \sigma^z_{1/2} X_1 + g \sum_{n=1}^N Z_n. $$
This looks exactly like our orbifold Hamiltonian, $H_\textrm{orb}$! Indeed, if we simply omit the polarized link variables in our description, we see that our Hilbert space of gauge-fixed states is simply $\mathcal H_\textrm{orb}$ if we identify $\lambda = \sigma^z_{1/2}$. To fact that our gauge-fixed states satisfy $\prod_n Z_n = +1$ follows from the fact that the original state obeys this (since $\prod_n Z_n = \prod_n G_n$) and our projectors commute with $\prod_n Z_n$. Conversely, we can see that any state of this orbifold space gives a gauge-invariant state after acting with $\prod_{n=2}^N (1+G_n)$: by construction this state is invariant under $G_{n=2,\cdots,N}$, as for $G_1$ simply observe that $G_1 = \prod_{n=2}^N G_n \times \prod_{n=1}^N Z_n$. | {
"domain": "physics.stackexchange",
"id": 68359,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, string-theory, path-integral, gauge-invariance",
"url": null
} |
gazebo-ignition
*-display
description: VGA compatible controller
product: SVGA II Adapter
vendor: VMware
physical id: f
bus info: pci@0000:00:0f.0
version: 00
width: 32 bits
clock: 33MHz
capabilities: vga_controller bus_master cap_list rom
configuration: driver=vmwgfx latency=64
resources: irq:16 ioport:1070(size=16) memory:e8000000-efffffff memory:fe000000-fe7fffff memory:c0000-dffff
*-display
description: VGA compatible controller
product: NVIDIA Corporation
vendor: NVIDIA Corporation
physical id: 0
bus info: pci@0000:0b:00.0
version: a1
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress vga_controller bus_master cap_list
configuration: driver=nvidia latency=64
resources: irq:64 memory:fc000000-fcffffff memory:d0000000-dfffffff memory:e4000000-e5ffffff ioport:5000(size=128)
Originally posted by Nils_ on Gazebo Answers with karma: 1 on 2021-11-23
Post score: 0
Things I've tried: | {
"domain": "robotics.stackexchange",
"id": 4626,
"lm_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-ignition",
"url": null
} |
c++, statistics
Critique request
Please tell me anything there is to improve. Some general comments:
If you compile with gcc, use -Wall -Wextra -pedantic (or every warning turned on, with extensions disabled) - As posted, your code generates 2 warnings:
main.cpp: In function 'int main(int, const char**)':
main.cpp:113:14: warning: unused parameter 'argc' [-Wunused-parameter]
int main(int argc, const char * argv[]) {
^~~~
main.cpp:113:38: warning: unused parameter 'argv' [-Wunused-parameter]
int main(int argc, const char * argv[]) {
^ | {
"domain": "codereview.stackexchange",
"id": 25392,
"lm_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++, statistics",
"url": null
} |
performance, sql, mysql
I am using PHP with MySQLi.
SELECT `u`.`first`, `u`.`last`,
`i`.`id`, IFNULL(`i`.`vendor`, `d`.`unattached_vendor`) AS `vendor`, IFNULL(`i`.`originalskunumber`, `d`.`skunumber`) AS `skunumber`,
`d`.`date_sent`, `d`.`document_type`, `d`.`document_id`, `d`.`description`, `d`.`qty`, `d`.`triage_notes`, `d`.`status`, `d`.`arrival_date`, `d`.`id` AS `document_row`
FROM `documents` AS `d`
LEFT JOIN `inventory` AS `i`
ON (CASE
WHEN `d`.`document_type` = 'Invoice'
THEN `i`.`skunumber` = `d`.`skunumber`
WHEN `d`.`document_type` = 'Purchase Order'
THEN `i`.`originalskunumber` = `d`.`skunumber`
END)
INNER JOIN `users` AS `u`
ON `u`.`uid` = `d`.`customer_id`
WHERE `d`.`document_type` <> 'Quote'
AND `d`.`header_item` = '0'
AND `d`.`active_document` = '1'
AND `d`.`active_item` = '1'
AND (CASE | {
"domain": "codereview.stackexchange",
"id": 19939,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, sql, mysql",
"url": null
} |
"saved for later use", and will be executed later, when they are invoked. First, if we are just interested in E[g(X,Y)], we can use LOTUS: Let X and Y be two jointly continuous random variables with joint PDF fXY(x,y) ={x+y 0 ≤ x,y ≤ 1 0 otherwise Find E. The process of linearization is where we convert the equations so that they contain only linear terms. Here's a secret: linearization is just a different word for tangent line. If there is no value of corresponding to the point , then it is not in the domain of the function. A one-dimensional array is like a list; A two dimensional array is like a table; The C language places no limits on the number of dimensions in an array, though specific implementations may. FUNCTIONS OF SEVERAL VARIABLES AND PARTIAL DIFFERENTIATION (2) The simplest paths to try when you suspect a limit does not exist are below. com To create your new password, just click the link in the email we sent you. Linear regression models data using a straight line where | {
"domain": "giacomagiacalone.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9888419671077918,
"lm_q1q2_score": 0.8152625488186886,
"lm_q2_score": 0.8244619220634457,
"openwebmath_perplexity": 504.17456154686255,
"openwebmath_score": 0.6199976801872253,
"tags": null,
"url": "http://giacomagiacalone.it/zwha/linearization-of-a-function-of-two-variables.html"
} |
electromagnetism, gravity, optics, electromagnetic-radiation, fourier-transform
i have looked through various articles and presentations such as
http://www.colorado.edu/physics/phys4510/phys4510_fa05/Chapter5.pdf (and others i can't post links too because of my low reputation) and haven't seen mention of said complex amplitude parameter anywhere else. Lots of complex amplitudes, but not parameters. I don't think they are the same thing, are they? Turns out that due to orthogonality relations of Hermite-Gauss poly's, Hermite-Gauss modes are orthonormal, so
$$
\int \int u_{n,m} \left(u_{n',m'}\right){}^*dxdy=\delta _{m,m'} \delta _{n,n'}
$$
Then a's can be found by multiplying both sides by conjugate of u and integrating ... | {
"domain": "physics.stackexchange",
"id": 22029,
"lm_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, gravity, optics, electromagnetic-radiation, fourier-transform",
"url": null
} |
java, beginner, object-oriented
public void workout()
{
createListOfWorkouts();
if(isWorkingOut())
{
createFile();
do
{
exercise = whatExercise();
sets = numSets();
reps = numReps();
weight = weightUsed();
totalWeightLifted += weight;
tracker.add(new FirstWorkoutTracker(exercise, sets, reps, weight));
//System.out.println(tracker.get(0));
}while(isStillLifting());
// logWorkout(tracker);
}
else
{
System.out.println("Okay maybe tomorrow.");
}
}
public void printResults()
{
System.out.println(todaysDate + "\n");
for(FirstWorkoutTracker stat : tracker)
{
System.out.println(stat);
}
System.out.println("\nTotal weight lifted today: " + totalWeightLifted + " pounds!");
} | {
"domain": "codereview.stackexchange",
"id": 21587,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, object-oriented",
"url": null
} |
\\ \left( \begin{array}{cc} 1 & 2 \\ 2 & 1 \\ \end{array} \right) & \left( \begin{array}{cc} 2 & 1 \\ 1 & 0 \\ \end{array} \right) & \left( \begin{array}{cc} 2 & 1 \\ 1 & 1 \\ \end{array} \right) & \left( \begin{array}{cc} 2 & 1 \\ 1 & 2 \\ \end{array} \right) \\ \end{array}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9579122756889438,
"lm_q1q2_score": 0.821666600947377,
"lm_q2_score": 0.8577681086260461,
"openwebmath_perplexity": 1541.8771751331558,
"openwebmath_score": 0.2597038149833679,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/211106/generating-all-2x2-matrices-with-entries-from-0-to-3-whose-det-is-1-with-mod-2-a"
} |
ruby, array
Title: FixedArray Class In Ruby I had an assignment recently to build a FixedArray using Ruby. It's supposed to simulate a FixedArray in C, that is, an array that allocates a certain amount of arbitrary memory when initialized, and that this amount of memory can neither increase nor decrease. It cannot dynamically resize itself like Ruby's default Array (because at a low-enough level, there's no such thing as arrays that can resize themselves...only FixedArrays). If you try to access an index that is out of bounds, you get an exception.
Note that I cannot use Ruby's default Array (since that's kinda misses the point of the assignment, in my opinion), so you get something like this:
class OutOFBoundsException < RuntimeError
end
class FixedArray
attr_reader :size
def initialize(size)
@size = size
size.times do |index|
self.instance_variable_set(:"@index#{index}", nil)
end
end | {
"domain": "codereview.stackexchange",
"id": 24382,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, array",
"url": null
} |
r, phylogenetics
Title: Unable to use phangorn::phyDat I am following an example from ‘Analysis of Phylogenetics Second Edition and Evolution with R’ from Emmanuel Paradis.
He is doing:
I am doing pretty much the same:
x=c('garras','garras','garras', 'tejido','tejido','tejido')
y <- phyDat(matrix(x), "USER", levels = unique(x))
but I get:
Error in phyDat.default(data, levels = levels, return.index =
return.index, : data object must contain taxa names
Screenshot:
What am I doing wrong? how come the example from the book works... I cannot access the book, it might be an older version or there are some steps in between. The screen shot doesn't help.
If you look at the vignette and the error, what you need to provide is a matrix of characters with defined row names, for example:
set.seed(111)
x = sample(letters,100,replace=TRUE)
phyDat(matrix(x),"USER",levels=unique(x))
Error in phyDat.default(data, levels = levels, return.index = return.index, :
data object must contain taxa names | {
"domain": "bioinformatics.stackexchange",
"id": 1525,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "r, phylogenetics",
"url": null
} |
experimental-physics, electric-circuits, light-emitting-diodes
Substituting for $D$ and rearranging the equation one gets $d = \sqrt{k}\cdot \frac{1}{\sqrt I} -e$.
So perhaps you should see what happens if you draw a graph of $d$ against $\frac {1}{\sqrt I}$? | {
"domain": "physics.stackexchange",
"id": 34345,
"lm_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, electric-circuits, light-emitting-diodes",
"url": null
} |
ruby, ruby-on-rails, mvc, controller
Title: Rails controller method that conditionally filters results This code for my blog checks to see if tags are in the params hash. If they are, then only posts that are tagged will be paginated. Otherwise, all of the posts are paginated.
class PostsController < ApplicationController
def index
if params[:tag]
@posts = Post.tagged_with(params[:tag]).paginate(page: params[:page])
else
@posts = Post.all.paginate(page: params[:page])
end
end
end
I feel like this checking of params shouldn't be the concern of the controller, but of some other model like PostParameterChecker. How do you feel about this? Where does this code actually belong? Creating a model just to check the parameters is overkill and not idiomatic in Rails. If you need some extra logic, use the existing model. In this case, I'd make Post#tagged_with accept a nil value which wouldn't filter anything:
def Post
scope :tagged_with, ->(tag) { tag ? <code to filter> : all }
end | {
"domain": "codereview.stackexchange",
"id": 9551,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, ruby-on-rails, mvc, controller",
"url": null
} |
turtlebot
Original comments
Comment by Tirjen on 2013-12-03:
Could it be some problem with costmaps? Did you try to visualize them in rviz?
Comment by Strav on 2013-12-03:
costmaps? Forgive me if this is obvious, but I thought I could use move_base without providing any map nor transformation frame other than base_link. I am somewhat loosely following this tutorial: http://wiki.ros.org/navigation/Tutorials/SendingSimpleGoals; haven't saw anything in that code that involved a map of any kind.
Honestly I never tried to use the navigation stack without a map, but I'm pretty sure it isn't possible. Moreover, reading the first line of the description of the tutorial ("The Navigation Stack serves to drive a mobile base from one location to another while safely avoiding obstacles.") makes me think so. Also in the pre-requisites is written "This tutorial assumes basic knowledge of how to bring up and configure the navigation stack.". | {
"domain": "robotics.stackexchange",
"id": 16312,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "turtlebot",
"url": null
} |
c#, graph
I'm going to assume that this isn't used in anyplace other than your unit tests. Part of the reason you wrote it is because your class isn't testable. I would rather see maybe another class created that represents a point on your graph that would contain its point in space and its color. Than you'd return the two points and test that the colors are the same. Some pseudo code.
[Test]
public void ConnectedComponentsHaveSameColor()
{
var myGraph = new UndirectedGraph();
myGraph.AddUndirectedEdge(1, 2);
myGraph.AddUndirectedEdge(3, 4);
myGraph.Color();
Assert.That(myGraph[1].Color, Is.EqualTo(myGraph[2].Color));
Assert.That(myGraph[3].Color, Is.EqualTo(myGraph[4].Color));
Assert.That(myGraph[1].Color, Is.Not.EqualTo(myGraph[3].Color));
//...
}
Note that the syntax above is using NUnit | {
"domain": "codereview.stackexchange",
"id": 20578,
"lm_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#, graph",
"url": null
} |
java, beginner, game, playing-cards
Title: Blackjack Strategy I am creating a Blackjack simulator in Java in order to better understand the language. I have written the basic strategy section for a player and it is terribly long.
Is there a better way to do this other than if/else statements? I know a switch might work but that wouldn't make it much shorter. The reality is that there are quite a few situations and reactions when playing Blackjack.
public void play(Card upCard){
//Use this block to check for situations that happen right after dealing
//like blackjack, doubledown and splits.
if (getHand().size() == 2){
if (getHandValue() == 21){
blackjack();
}
//scenario with ace as one of the cards.
else if (getHand().get(0).getName().equals("Ace") |
getHand().get(1).getName().equals("Ace")){ | {
"domain": "codereview.stackexchange",
"id": 8664,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, game, playing-cards",
"url": null
} |
series for example half range cosine series f(x)=a1/2+sigma n=0to1. Sum-to-Product Formulas. cos(b(x−c))+d. Using your knowledge of the unit circle, complete the following chart for f(x)=sin x. Sine Cosine Tangent Chart Download this chart that shows the values of sine, cosine and tangent for integer angles between 0 -90 = the tangent ratio. Since these sinusoids add to form the input signal, they must be the same length as the input signal. Let's get to it. Let me do this in a new color-- by definition-- and we're going to extend this definition in the future-- this is sine of theta. Thus, we have. The basic hyperbolic functions are hyperbola sin and hyperbola cosine from which the other functions are derived. All other functions are expressed via sine and cosine as follows: Tangent:. The following are graphs of sin, cos & tan. // Sine Cosine Table // // This macro displays a sine/cosine table in the Results window. This table of sines and cosines of the latitude is needed for the | {
"domain": "vigolzonecalcio.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9877587247081928,
"lm_q1q2_score": 0.8335647464087809,
"lm_q2_score": 0.8438950986284991,
"openwebmath_perplexity": 765.0087309333758,
"openwebmath_score": 0.8701221346855164,
"tags": null,
"url": "http://omzo.vigolzonecalcio.it/sine-cosine-chart.html"
} |
algorithms, trees, search-algorithms, decision-tree
An algorithm is legal if for any sorted array $A$ and for any $x$, if we traverse the decision tree then we get the correct answer (this can be formalized more carefully).
The running time of the algorithm is the depth of the decision tree (maximal number of edges in any root-to-leaf path).
Every legal algorithm has at least $n + 1$ different leaves, since for any array $A$ whose elements are distinct, we can find $n+1$ inputs for which the only correct outputs are $1,\ldots,n,\bot$.
Since every internal node has fan-out $3$, a decision tree of depth $d$ has at most $3^d$ leaves. Since $3^d \geq n + 1$, we conclude that $d \geq \log_3 (n+1)$.
This is achieved by binary search, up to a constant factor. With more work, we can show that binary search (probably defined) is strictly optimal. This requires an adversary argument. | {
"domain": "cs.stackexchange",
"id": 19936,
"lm_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, trees, search-algorithms, decision-tree",
"url": null
} |
special-relativity
And I'm puzzeled. There is flaw in the logic but I don't see it.
Thanks for help. There are actually more than one ways to look at this problem. I am going to explain why the light must not go straight upward in the ground frame if the light clock is moving horizontally wrt ground frame.
The fundamental postulates of relativity is: | {
"domain": "physics.stackexchange",
"id": 85710,
"lm_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",
"url": null
} |
A word which contains exactly one $aa$ has the form $xaay$, where $x,y$ contain no $aa$, $x$ doesn't end with $a$, and $y$ doesn't start with $a$. This suggests first determining how to write a regular expression for the set of words avoiding $aa$.
If a word avoids $aa$, then any two occurrences of $a$ are separated by $b^+$. We can describe all such words by the following infinite regular expression: $$b^* + b^*ab^* + b^*ab^+ab^* + b^*ab^+ab^+ab^* + \cdots.$$ This can be represented by the finite regular expression $b^* + b^*(ab^+)^*ab^*$.
For the sake of our original problem, we need to impose the further constraint that the word not end with $a$. We obtain the following infinite regular expression for the set of all words avoiding $aa$ and not ending with $a$: $$b^* + b^*ab^+ + b^*ab^+ab^+ + \cdots = b^*(ab^+)^*.$$ Similarly, a regular expression for the set of all words avoiding $aa$ and not starting with $a$ is $(b^+a)^*b^*$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.983596967003007,
"lm_q1q2_score": 0.8041637794551407,
"lm_q2_score": 0.8175744806385543,
"openwebmath_perplexity": 75.98467274718676,
"openwebmath_score": 0.6665124893188477,
"tags": null,
"url": "https://cs.stackexchange.com/questions/84896/how-to-find-a-regular-expression"
} |
homework-and-exercises, general-relativity, differential-geometry, metric-tensor, perturbation-theory
Title: How do I calculate the perturbations to the metric determinant for 3º order? From the post How do I calculate the perturbations to the metric determinant?,
I'm trying to calculate the expansion of the metric's determinant $\sqrt{-g}$ up to 3rd order. I saw in another post the procedure until further notice. but I'm not understanding this step:
\begin{align}
&= \sqrt{-\det{b}}\left(1 + \frac{1}{2}\operatorname{tr}(b^{-1}h)-\frac{1}{4}\operatorname{tr}{(b^{-1}h)^2} + \frac{1}{2}\left(\frac{1}{2}\operatorname{tr}(b^{-1}h)-\frac{1}{4}\operatorname{tr}{(b^{-1}h)^2}\right)^2\right) + \mathcal O(h^3)\\
&= \sqrt{-\det{b}}\left(1 + \frac{1}{2}\operatorname{tr}(b^{-1}h)-\frac{1}{4}\operatorname{tr}{(b^{-1}h)^2} + \frac{1}{8}\operatorname{tr}^2{(b^{-1}h)}\right) + \mathcal O(h^3)\\
\end{align} | {
"domain": "physics.stackexchange",
"id": 90244,
"lm_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, general-relativity, differential-geometry, metric-tensor, perturbation-theory",
"url": null
} |
c++, file-system, windows, batch
for (std::pair<const std::string, std::string>& p : table) {
std::string tag = p.first;
std::string lowercase_tag = tag;
string_to_lowercase(lowercase_tag);
if (lowercase_tag == prev_tag) {
next_directory = trim(p.second);
std::ofstream file_out(
table_file_name.c_str(),
std::ofstream::out | std::ofstream::trunc);
// Map tag 'prev' to 'current_path':
std::string current_path = get_current_path();
table[prev_tag] = current_path;
char* separator = "";
for (std::pair<const std::string, std::string>& pp : table) {
std::string tag = pp.first;
std::string path = pp.second;
trim(tag);
trim(path);
file_out << separator << tag.c_str() << " " << path.c_str();
separator = "\n";
} | {
"domain": "codereview.stackexchange",
"id": 27303,
"lm_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++, file-system, windows, batch",
"url": null
} |
fermions, calculus, grassmann-numbers, superalgebra
Title: Logarithm of Grassmann numbers What is $\log \theta$ where $\theta$ is a Grassmann number such that $\theta^2 = 0$. How does one then look at its logarithm? Does it even make sense?
In general, if $f: \Omega \subseteq \mathbb{C}\to \mathbb{C}$ is a complex analytic function, then we can define the value
$$ f(z)~:=~ \sum_{n\in\mathbb{N}_0} \frac{f^{(n)}(z_B)}{n!}z_S^n\tag{1.1.6}$$ to a supernumber $$z~=~\underbrace{z_B}_{\text{body}}+\underbrace{z_S}_{\text{soul}}\tag{1.1.2}$$
if the body
$$z_B~\in~\Omega$$
belongs to the open neighborhood $\Omega\subseteq \mathbb{C}$.
The problem with OP's example $\log\theta$ is that the body of the Grassmann number $\theta$ is $0$, but $f=\log$ is not defined in $0\notin \Omega$, so we cannot apply definition (1.1.6).
References:
Bryce DeWitt, Supermanifolds, Cambridge Univ. Press, 1992. | {
"domain": "physics.stackexchange",
"id": 78759,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fermions, calculus, grassmann-numbers, superalgebra",
"url": null
} |
physical-chemistry, covalent-compounds, carbon-allotropes
Not every arrangement of C-C bonds is equally stable: many will fall apart into other structures because there are mechanisms that make the rearrangement easy. But there are no easy mechanisms for rearranging the bonds in diamond or graphite into something more stable. Buckminsterfullerene is only formed from a plasma of carbon atoms when it is allowed to cool: you can't just make it by simple routes from other allotropes of carbon. | {
"domain": "chemistry.stackexchange",
"id": 10000,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry, covalent-compounds, carbon-allotropes",
"url": null
} |
java, c, functional-programming, lisp, compiler
Function next_integer_literal has the problem that it treats c == ')' as a special case. I'm pretty sure you should be using that codepath for any non-digit character. And then rewrite to avoid non-local control flow:
bool next_integer_literal(char *dst, FILE *src)
{
int i = sprintf(dst, "new BigInteger(\"");
int c;
while ((c = getc(src)) != EOF) {
if (isdigit(c)) {
dst[i++] = c;
} else {
ungetc(c, src);
sprintf(dst + i, "\")");
return true;
}
}
return false;
} | {
"domain": "codereview.stackexchange",
"id": 18391,
"lm_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, c, functional-programming, lisp, compiler",
"url": null
} |
c#, parsing, antlr
var module = parser.Parse("project", "component", code);
var procedure = (ProcedureNode)module.Children.First();
Assert.AreEqual(procedure.Accessibility, VBAccessibility.Implicit);
}
[TestMethod]
public void UnspecifiedReturnTypeGetsFlagged()
{
IRubberduckParser parser = new VBParser();
var code = "Function Foo()\n Dim bar As Integer\nEnd Function";
var module = parser.Parse("project", "component", code);
var procedure = (ProcedureNode)module.Children.First();
Assert.AreEqual(procedure.ReturnType, "Variant");
Assert.IsTrue(procedure.IsImplicitReturnType);
}
[TestMethod]
public void LocalDimMakesPrivateVariable()
{
IRubberduckParser parser = new VBParser();
var code = "Sub Foo()\n Dim bar As Integer\nEnd Sub"; | {
"domain": "codereview.stackexchange",
"id": 11809,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, parsing, antlr",
"url": null
} |
Claim For every $N \in \mathbb{N}$, there exists $(a,b) \in (A \cap \mathbb{N}_{>N}) \times (B \cap \mathbb{N}_{>N})$ such that $\displaystyle \left| r - \frac{a}{b} \right| < \epsilon$.
Proof of claim By way of contradiction, assume that the claim is false. Then there exists an $N \in \mathbb{N}$ such that the inequality $\displaystyle \left| r - \frac{a}{b} \right| < \epsilon$ has no solution for $(a,b) \in (A \cap \mathbb{N}_{>N}) \times (B \cap \mathbb{N}_{>N})$. As the inequality $\displaystyle \left| r - \frac{a}{b} \right| < \epsilon$ is equivalent to $b(r - \epsilon) < a < b(r + \epsilon)$, it follows that $(b(r - \epsilon),b(r + \epsilon)) \cap \mathbb{N} \subseteq B$ for all $b \in B \cap \mathbb{N}_{>N}$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9828232894783427,
"lm_q1q2_score": 0.8147003642940314,
"lm_q2_score": 0.828938806208442,
"openwebmath_perplexity": 86.03344349640952,
"openwebmath_score": 0.9263238310813904,
"tags": null,
"url": "http://math.stackexchange.com/questions/212065/is-every-positive-real-number-the-limit-of-a-sequence-of-ratios-obtained-from-a"
} |
forces, centripetal-force
Needless to say, this is a sneaky move that will only work if the finish line is incredibly near to, or is in the middle of, a turn, and only if he is doing it in the last lap, so that nobody else is copying his trick. | {
"domain": "physics.stackexchange",
"id": 96077,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "forces, centripetal-force",
"url": null
} |
ros-fuerte, rosbridge
</script>
</head>
<body onload="start()" style="margin:0;padding:0;background-color:white;overflow:hidden">
<div style="font-family: fixed-width; font-size: small;" id="log"></div>
</body>
</html>
Originally posted by Saphrosit with karma: 197 on 2012-11-20
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by suhar on 2013-03-17:
hello how would you run this
Comment by Toucan on 2019-03-18:
The javascript link appears to be dead. | {
"domain": "robotics.stackexchange",
"id": 11784,
"lm_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-fuerte, rosbridge",
"url": null
} |
## Integration
A better estimate is given by integration: $$\int_c^n f(x) dx \leq \sum_{m=c+1}^n f(m) \leq \int_{c+1}^{n+1} f(x) dx.$$ For $f(m) = m$, this gives the correct value of the sum up to lower order terms: $$\frac{1}{2} n^2 - \frac{1}{2} c^2 \leq \sum_{m=c+1}^n m \leq \frac{1}{2} (n+1)^2 - \frac{1}{2} (c+1)^2.$$ When $f(m) = m$ we can calculate the sum explicitly, but in many cases explicit computation is hard. For example, when $f(m) = m\log m$ the antiderivative of $f$ is $(1/2) x^2\log x - (1/4) x^2$, and so $$\sum_{m=c+1}^n m\log m = \frac{1}{2} n^2 \log n \pm \Theta(n^2).$$
The Euler–Maclaurin formula gives better estimates. This formula can be used, for example, to prove strong forms of Stirling's formula, by estimating the sum $\log n! = \sum_{m=1}^n \log m$.
# Non-increasing $f(n)$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854103128328,
"lm_q1q2_score": 0.8390816818236664,
"lm_q2_score": 0.865224072151174,
"openwebmath_perplexity": 568.4012933743602,
"openwebmath_score": 0.9995046854019165,
"tags": null,
"url": "https://cs.stackexchange.com/questions/2789/solving-or-approximating-recurrence-relations-for-sequences-of-numbers/24082"
} |
c#, performance, image
Move your ToArray() statements outside the loop so that you only execute them once and then reuse them:
float[] RH = RevisedListMeanH.ToArray();
float[] RV = RevisedListMeanV.ToArray();
for (int s = 0; s < u1.Length; s++ )//iterate through uniquelist
{
... etc ...
In the second loop, you convert a List to a HashSet:
HashSet<int> i = new HashSet<int>(ArrayOfConnectedBlocksH[a]);
You could avoid that by making ArrayOfConnectedBlocksH[a] i.e. ConnectedBlocksH a HashSet instead of a List to begin with.
Might it be any faster if you cached the Length and Count property values instead of calling them repeatedly? For example:
for (int s = 0, int length = u1.Length; s < length; s++ ) | {
"domain": "codereview.stackexchange",
"id": 6498,
"lm_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, image",
"url": null
} |
human-anatomy
Title: Does the anterior primary ramus of T6 innvervate the Rectus abdominis? Anatomy and Human Movement Structure and Function writes in the section about Rectus abdominis:
Nerve supply
By the anterior primary rami of the lower six or seven thoracic
nerves (T6/7 to T12).
What does "or" mean? Does it means that in some humans this happens and in some it doesn't? Because muscle (mesoderm) and peripheral nerves (ectoderm) develop from different embryonic germ layers, the pattern of innervation is somewhat variable. The muscles are condensing from mesenchymal tissues more or less in place, and nerves are growing out into the muscle masses to innervate them. Because of this, the specific spinal segments that innervate muscles can vary somewhat. This is particularly true in the brachial and lumbosacral plexuses. In the brachial plexus for example: | {
"domain": "biology.stackexchange",
"id": 6075,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-anatomy",
"url": null
} |
quantum-mechanics, mathematical-physics, quantum-spin, berry-pancharatnam-phase
More generally, for a spin state $\vert j,m,+z\rangle$, we will have
$$\frac{\left\langle j,m,+z\middle\vert j,m,+y\right\rangle\left\langle j,m,+y\middle\vert j,m,+x\right\rangle\left\langle j,m,+x\middle\vert j,m,+z\right\rangle}{\vert\left\langle j,m,+z\middle\vert j,m,+y\right\rangle\left\langle j,m,+y\middle\vert j,m,+x\right\rangle\left\langle j,m,+x\middle\vert j,m,+z\right\rangle \vert} = e^{2i n_{jm} \pi/8}$$
where $n_{jm}$ is an integer. The same phase is picked up for a spin$-1$ state with $m=1$, but a spin$-1$ state with $m=0$ picks up no phase at all. (In fact the m=0 states do not depend on the orientation.) At the moment, I believe that the $j=1,m=-1$ state will pick up $n=-1$ (in analogy with the spin$-1/2$ case), but I haven't bothered to actually run the computation. | {
"domain": "physics.stackexchange",
"id": 320,
"lm_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, mathematical-physics, quantum-spin, berry-pancharatnam-phase",
"url": null
} |
complexity-theory, turing-machines
else, I reject." This is because, if all of the simulator's paths accepted, that means all of $M$'s paths rejected, so $M$ rejected, so the simulator needs to accept. But the simulator isn't a valid nondeterministic Turing machine because it isn't using the legally mandated acceptance criterion. It can't do that. | {
"domain": "cs.stackexchange",
"id": 2378,
"lm_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, turing-machines",
"url": null
} |
time-complexity, np-complete, knapsack-problems
Title: Knapsack: there is a polynomial solution in bit terms? I'm reading about Knapsack problem. The approaches to solve that I found:
Branch and bound
Brute force
Dynamic programming
Memory functions
Greedy
All solutions have exponential time in terms of bits. There is a solution (maybe an approximation algorithm) that solve Knapsack problem with polynomial time in bit terms? Your question is answered in the Wikipedia article on the knapsack problem: https://en.wikipedia.org/wiki/Knapsack_problem#Computational_complexity, https://en.wikipedia.org/wiki/Knapsack_problem#Approximation_algorithms. | {
"domain": "cs.stackexchange",
"id": 6888,
"lm_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, np-complete, knapsack-problems",
"url": null
} |
fluid-dynamics, everyday-life, water, surface-tension, adhesion
$$V_c\sim 20\,\mathrm{\mu L}$$
More precise modelling requires knowing the contact angles of the bottom and top of the drop which tell us about the water-glass adhesion, e.g. see "On the ability of drops or bubbles to stick to non-horizontal surfaces of solids". A study of "Drops at Rest on a Tilted Plane" gave values in the range of $10-20\,\mathrm{\mu L}$ for the 90° critical angle for pure water on glass substrates treated in different ways. I'd estimate slightly smaller values ($\sim 5\,\mathrm{\mu L}$) from a quick experiment with my hand mirror, but it is pretty warm and humid.
This all assumes a drop of pure liquid water at room temperature and pressure on clean common window glass, but the results are reasonably robust to small variations. | {
"domain": "physics.stackexchange",
"id": 96844,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, everyday-life, water, surface-tension, adhesion",
"url": null
} |
nomenclature, hydrocarbons, chirality
Title: Why is the name 'propylene oxide' preferred for epoxypropane? This is the molecule I know as epoxypropane:
In my neck of the woods (example), this molecule is used as one of the standard examples of small chiral molecules. The name 'epoxypropane' makes a heck of a lot of sense to me $-$ an epoxy bridge spanning a single bond of what would otherwise be propane.
It seems, however, that most everyone thinks that a better name for this is propylene oxide, from Wikipedia upwards. Now, I'm an atomic physicist, so bear with me:
I can see how the name 'propylene oxide' fits that structure. You've taken propylene and you've oxidized it.
However, I cannot see why the name 'propylene oxide' doesn't also apply to other ways to oxidize propylene, say, sticking that oxygen over at one end or in the middle,
i.e. what Wikipedia calls propionaldehyde (also propanal) and acetone, or making that bridge over the (1,3) combination in what Wikipedia calls oxetane,
none of which is chiral. | {
"domain": "chemistry.stackexchange",
"id": 12956,
"lm_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, hydrocarbons, chirality",
"url": null
} |
localization, navigation, ros-kinetic, rgbd, rtabmap-odometry
<!-- encoder odometry -->
<node pkg="robot_slam" name="encoder_odometry" type="odometry.py" output="screen">
<remap from="odom" to="/planner/odom"/>
<param name="odom_frame_id" type="string" value="odom"/>
<param name="robot_frame_id" type="string" value="base_footprint"/>
</node> | {
"domain": "robotics.stackexchange",
"id": 31732,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "localization, navigation, ros-kinetic, rgbd, rtabmap-odometry",
"url": null
} |
{x'[t] -> v[x], x''[t] -> v'[x] v[x], x[t] -> x}
The result differential equation is integrated and the solution is equated to x'[t]; this new equation can then be integrated. The default DSolve command results in an equivalent general solution. The two methods below give equivalent general solutions. The results are long and have been omitted.
xde = x[t] x''[t] + x'[t]^2 - g x[t] == 0;
gensol = DSolve[{x[t] x''[t] + x'[t]^2 - g x[t] == 0}, x, t]
DSolve[xde /. {x'[t] -> v[x], x''[t] -> v'[x] v[x], x[t] -> x}, v, x]
gensol2 = DSolve[x'[t] == v[x[t]] /. #, x, t] & /@ %
One can insert the initial condition into the second method, which is how I interpret Dr. Wolfgang Hintze's comment. The result is nontrivial desired solution.
DSolve[{xde /. {x'[t] -> v[x], x''[t] -> v'[x] v[x], x[t] -> x}, v[0] == 0}, v, x]
DSolve[{x'[t] == v[x[t]] /. #, x[0] == 0}, x, t] & /@ % | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.953275045356249,
"lm_q1q2_score": 0.8282308829062911,
"lm_q2_score": 0.8688267745399466,
"openwebmath_perplexity": 2462.9419789777257,
"openwebmath_score": 0.38798898458480835,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/58774/how-can-i-get-dsolve-to-solve-my-ode"
} |
java, error-handling, tic-tac-toe, exception
if (isVictory(gameBoard, playerOne)) {
System.out.println(playerOne + "'s win!");
gameOver = true;
} else if (isVictory(gameBoard, playerTwo)) {
System.out.println(playerTwo + "'s win!");
gameOver = true;
} else if (fullBoard(gameBoard)) {
System.out.println("Game ended in a draw");
gameOver = true;
}
return gameOver;
}
} Overall, the structure of the app is reasonable. Methods are named clearly and do what the name suggests. It misses some of the benefits of object-oriented programming because all the pieces that make up the state of the game (like the game board) are declared in main and must be passed to each other method.* Additionally, methods should generally have the most restrictive viable access modifier; in this case, all the methods except main can be private instead of public. | {
"domain": "codereview.stackexchange",
"id": 44738,
"lm_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, error-handling, tic-tac-toe, exception",
"url": null
} |
semiconductor-physics
Title: Comparison of semiconductors What quantitative measures could I use to compare semiconductors? I.e. what properties are useful when comparing semiconductors? That seems very non-specific, especially because which properties to compare will depend on what the semiconductor is to be used for. But that's the question as given. I thought bandgap energy, maybe breakdown electric field, but I can't really think of any others. Whether it's n or p type, maybe. Thanks for any suggestions, I appreciate it's fairly vague! Important parameters to compare semiconductors are, as you mentioned, band gap energy Eg and doping concentration Nd or Na, very important are also intrinsic carrier density ni, densities of state of conduction and valence band, and electron and hole mobilities, n and p. | {
"domain": "physics.stackexchange",
"id": 34197,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "semiconductor-physics",
"url": null
} |
# Desmos 3d projection
Desmos is an interesting mathematical tool. Can it solve differential equations? Can it make your plots yellow? Is it optimized competently? Definitely not. So, of course, I set out to draw my own, mutableinfinite grid. To plot the infinite lines in a grid would require an infinite set of equations, but Desmos does not offer a simple way to define sets of equations. And with two of these infinite sets, I was able to make my grid!
This means that we can get an infinite number of equations by only typing one. The lines you are seeing come from the two sine equations above. With my new mutable grid in place, I set out to find ways to transform the grid. To swirl, we have to rotate a point about our swirl center some point defined as p, q by an amount that shrinks as the point in question gets further and further from the swirl center. | {
"domain": "cvnn.eu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9802808736209154,
"lm_q1q2_score": 0.825225577034177,
"lm_q2_score": 0.8418256432832333,
"openwebmath_perplexity": 1077.1926022848313,
"openwebmath_score": 0.3530292510986328,
"tags": null,
"url": "https://cvnn.eu/desmos-3d-projection.html"
} |
python, beginner, file-system, modules, makefile
def MirrorSet(self, orig = None, new = None, addl = None):
if type(orig) is not str:
raise TypeError('orig list is a required argument')
if type(new) is not str:
raise TypeError('new is a required argument')
Again, don't provide defaults and then reject them. Python can do a perfectly good job of rejecting missing parameters. Also, don't check types. Document what the types are supposed to be, but let trust the user of your code.
try:
files = copy.deepcopy(self.file_set[orig]['files'])
Why are you making a deepcopy?
skin_path = os.path.join(self.root, new)
out = os.path.join(skin_path, orig)
for i, filename in enumerate(files):
filePath = os.path.join(skin_path, filename)
if (os.path.exists(filePath)):
files[i] = os.path.join(new, files[i]) | {
"domain": "codereview.stackexchange",
"id": 3181,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, file-system, modules, makefile",
"url": null
} |
python, python-2.x, heap
Functions should have an empty line above and below them.
Function calls should have their bracket immediately after the name. So fn( not fn (.
Assignment operators should have a space either side of them.
Try to keep code less than 80 characters long.
You also have a couple of naming problems:
compar should be compare or comparer, since compar is not a word. If you wanted to shorten it comp would be the best shortened version, but is worse than both the written out versions.
Lists and arrays don't have IDs, they have indexes. And so element_id is confusing. At first I used item_index or element_index, but decided to instead use parent and child to better describe the parent child relationship.
In heapify I'd change el_id to child and element_id to parent. (And you should use child rather than parent * 2)
For better readability, and for a minor performance boost, I used heap = self.heap.
Other things I'd change: | {
"domain": "codereview.stackexchange",
"id": 37700,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-2.x, heap",
"url": null
} |
gazebo-1.8, sdformat
process[tf2_buffer_server-11]: started with pid [21014]
Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
process[multisense_sl/camera/stereo_proc-12]: started with pid [21039]
Error [ModelDatabase.cc:404] Unable to download model[model://drc_vehicle]
Error [ModelDatabase.cc:404] Unable to download model[model://drc_vehicle]
Error [parser.cc:544] Unable to find uri[model://drc_vehicle]
Error [ModelDatabase.cc:404] Unable to download model[model://vrc_firehose_long]
Error [ModelDatabase.cc:404] Unable to download model[model://vrc_firehose_long]
Error [parser.cc:544] Unable to find uri[model://vrc_firehose_long]
Error [ModelDatabase.cc:404] Unable to download model[model://vrc_standpipe]
Error [ModelDatabase.cc:404] Unable to download model[model://vrc_standpipe]
Error [parser.cc:544] Unable to find uri[model://vrc_standpipe] | {
"domain": "robotics.stackexchange",
"id": 3355,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo-1.8, sdformat",
"url": null
} |
quantum-mechanics, topology, berry-pancharatnam-phase
I guess the general question is, how do I guarantee that the loop that I generate actually "contains" the conical intersection (practically)? A conical intersection in an multidimensional parameter space of dimension $M$ is an $M-2$ dimensional hypersurface. (In your example $M$ should be $3N-6$ after the removal of the center of mass translations and rigid rotations).
This is because every energy constraint is an $M-1$ dimensional hypersurface and the conical intersection is $M-2$ dimensional being the intersection of two constraints.
Assuming that the conical surface equation in the parameter space is:
$$V^2(x) = U^2(x) + W^2(x)$$
Then the conical intersection is given by
$$U(x_s) = W(x_s)=0$$
together with:
$$\nabla U(x_s) \ne 0, \nabla W(x_s) \ne 0$$
since the intersection is conical, ($x_s$ are the coordinates of the points on the conical intersection). | {
"domain": "physics.stackexchange",
"id": 29864,
"lm_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, topology, berry-pancharatnam-phase",
"url": null
} |
EDIT: Note that the above proof does not work for $t=-\infty$ (it does not make sense to write $-\infty-\varepsilon$), but in this case the inequality is clear. (Of course, we have to omit indeterminate case $\infty-\infty$, i.e., in this case we assume that $\limsup s_n$ is finite.)
Or if you use $\liminf\limits_{n\to\infty} x_n= \lim\limits_{n\to\infty} \inf\limits_{n\ge n_0} x_n$ and $\limsup\limits_{n\to\infty} x_n= \lim\limits_{n\to\infty} \sup\limits_{n\ge n_0} x_n$ as the definition of limit inferior/superior then you can use $$\sup_{n\ge n_0} (x_n+y_n) \ge \sup_{n\ge n_0} x_n + \inf_{n\ge n_0} y_n$$ to get $$\lim_{n\to\infty}\sup_{n\ge n_0} (x_n+y_n) \ge \lim_{n\to\infty}\sup_{n\ge n_0} x_n + \lim_{n\to\infty}\inf_{n\ge n_0} y_n\\ \limsup_{n\to\infty} (x_n+y_n) \ge \limsup_{n\to\infty} x_n + \liminf_{n\to\infty} y_n.$$
-
This is an important result, so I would guess that most books and courses will probably mention it and either give a solution or left it as an exercises. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9770226314280634,
"lm_q1q2_score": 0.8265049004437698,
"lm_q2_score": 0.8459424314825853,
"openwebmath_perplexity": 211.28167326561095,
"openwebmath_score": 0.8670991659164429,
"tags": null,
"url": "http://math.stackexchange.com/questions/70478/properties-of-liminf-and-limsup-of-sum-of-sequences/70550"
} |
specific-reference
Title: Saturation and coarsening for in a model for epitaxial growth I am interested in upper bounds on the coarsening rate for a model of epitaxial growth. The problem I am having with the paper I am reading is that even if "coarsening" is in the title, I can't find anything about it, other than a lower bound on the free energy. The rest of the paper is devoted to finding bounds on the saturation interface width and the corresponding saturation time.
The little I know about coarsening and saturation tells me that these two processes are quite different, but what I said above leads me to think that they are somehow more related than I expect them to be. Can any of you please elaborate on the relation between these two concepts?
I really appreciate your help!
(please, feel free to add any tag that you think would be appropriate) In a typical layer-by-layer epitaxial growth that begins with a flat substrate, surface morphological | {
"domain": "physics.stackexchange",
"id": 18043,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "specific-reference",
"url": null
} |
fourier-transform, fourier-series
I just wanted to confirm the following
If I sample the $\operatorname{sinc}()$ i obtain from the fourier transform of a $\operatorname{rect}()$, and use those values to reconstruct a fourier series, will i end up getting a square wave ? Regarding reciprocal domains, such as the "time" domain and "frequency" domain, that are related to each other by the Fourier Transform, whenever you uniformly sample in one domain, it causes periodic extension in the other domain. It does that always.
So the Fourier Series is an example of sampling in the frequency domain causing periodicity in the time domain. The corresponding example (using duality of the Fourier Transform) is the so-called DTFT (Discrete-Time Fourier Transform) $X(e^{j\omega})$ of a sampled sequence $x[n]$ which is naturally periodic with period $2 \pi$. And normally we consider $X(e^{j\omega})$ with $-\pi < \omega \le +\pi$ . | {
"domain": "dsp.stackexchange",
"id": 3561,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fourier-transform, fourier-series",
"url": null
} |
gravity, cosmology
only dependent on the total amount of mass there. Since these density fields change slowly I ignore lateral variations. Again there should be a correction for declination, but it does not make a great difference in the picture. | {
"domain": "astronomy.stackexchange",
"id": 4100,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gravity, cosmology",
"url": null
} |
electromagnetism, kinematics
Title: In what direction does a static electron moves in presence of plane electromagnetic wave? Consider that we have the electric field,
$$\mathbf{E}=E_0\cos(kz-\omega t)\hat{\mathbf{x}}\tag{1}$$
and the magnetic field,
$$\mathbf{B}=\frac{B_0}{c} \cos(kz-\omega t)\hat{\mathbf{y}}\tag{2}$$
These are the plane wave solution in vacuum, for an electromagnetic wave moving in the $z$ direction. The Maxwell stress tensor for this electromagnetic field has only one component given by,
$$T_{zz}=-u=-\epsilon_0E_0^2\cos^2(kz-\omega t)\tag{3}$$
Where $u$ is energy density of the field. What this means is that the momentum transported by the field should be in the $z$ direction only. That should be evident. However I have some confusion regarding this.
Say a static electron free from any other forces is placed in the path of the given electromagnetic wave. Should this electron move along the $z$ direction then because the stress tensor says that a force acts perpendicular to the $z$ surface? | {
"domain": "physics.stackexchange",
"id": 71366,
"lm_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, kinematics",
"url": null
} |
general-relativity, string-theory, quantum-gravity, spacetime
It is well known that General Relativity requires a spin-2 massless particle as the "force mediation" particle (similar to the photon as the spin-1 massless force mediation particle of electromagnetism). It is also well know that String Theory can accommodate the purported spin-2 massless particle as the oscillation of a closed string. But how does this graviton particle relate to the curvature of the large dimensions of space-time?
I am aware that " How does String Theory predict Gravity? " is somewhat similar to this question, but I do not think it actually contains an answers to this question so please don't mark it as a duplicate question. I would especially appreciate an answer that could be understood by a non-theoretical ("String Theory") physicist - hopefully the answer would be at a level higher than a popular non-mathematical explanation. In other words, assume the reader of the answer understands General Relativity and particle physics, but not String Theory. | {
"domain": "physics.stackexchange",
"id": 63109,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, string-theory, quantum-gravity, spacetime",
"url": null
} |
slam, navigation
Title: Error when "rosmake rgbdslam"
I have edited the question basing on the first answer.
Ubuntu 12.04 and Fuerte
Followed the wiki and resolved all the dependencies for rgbdslam_freiburg
rosdep install rgbdslam_freiburg
Then
nutan@nutan-HP-EliteBook-8460w:~/fuerte_workspace$ rosmake rgbdslam | {
"domain": "robotics.stackexchange",
"id": 11817,
"lm_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",
"url": null
} |
haskell, primes
Still too much garbage collection, but that's fine for a start.
Additional discussion
Try to avoid last. Instead, you could have used
multiples <- [i * p | i <- [1..nmax`quot`p]]
or similar. last has to traverse all the list.
Next, it's great that you've added type signatures, but make sure that you can actually need Integer. On your platform, Int will probably go up to \$2^{63}-1\$, which is more than enough. It will also make your program a lot faster, since Integer has an overhead.
And last but not least, make the code slightly more readable by adding whitespace. If you get a vertical scrollbar on CR, it's usually a sign that your lines are too long.
Oh, and by the way: this variant will still be too slow compared to Java, but you're probably using another data structure with random access abilities in Java, whereas we're creating a "new" list in Haskell all the time.
TL;DR
Verify that you actually implemented the algorithm that you want to implement. | {
"domain": "codereview.stackexchange",
"id": 21889,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "haskell, primes",
"url": null
} |
large-hadron-collider, particle-physics
Observation of Long-Range, Near-Side Angular Correlations in Proton-Proton Collisions at the LHC
which kind of explains what was seen, too. But see my blog above for more details. | {
"domain": "physics.stackexchange",
"id": 301,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "large-hadron-collider, particle-physics",
"url": null
} |
biochemistry, nucleotide
Answer
The numbering of the carbon and nitrogen atoms in uridine and pseudouridine is perfectly consistent. The numbering is for the pyrimidine ring, which is the same — uracil — in each case. The different positions of attachment to ribose (N1 or C6)) results in two different structures (and hence names) for the resulting nucleoside, but does not alter the numbering of the components. | {
"domain": "biology.stackexchange",
"id": 11424,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "biochemistry, nucleotide",
"url": null
} |
newtonian-mechanics, energy, harmonic-oscillator, home-experiment
Title: Energy transfer in a coupled pendulum If you take a look at this video you will see what kind of a coupled pendulum I'm talking about.
So I made a similar one in my high school's physics lab, using light metal bobs(much lighter than the Easter eggs he's used in the video) and thin copper wire.
Some Data About My Experiment:
My pendulum did work the same way, i.e. one would stop as the other would swing with max amplitude, which continues periodically without much damping. But the frequency of the combined periodic motion in my case was much slower than that in the video. His pendulum stops after a few oscillations while mine took 10-15 oscillations to completely transfer the energy(I think this is because I used a lighter weight)
My Question: | {
"domain": "physics.stackexchange",
"id": 8691,
"lm_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, energy, harmonic-oscillator, home-experiment",
"url": null
} |
general-relativity, special-relativity, spacetime, speed-of-light, inertial-frames
The readout of an accelerometer is a local measurement. That is important in this stipulation about the rigid rods. The demand is not about being unaccelerated with respect to some other object that may be at some distance, it's about strap-on accelerometers giving a readout of zero. | {
"domain": "physics.stackexchange",
"id": 12311,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, special-relativity, spacetime, speed-of-light, inertial-frames",
"url": null
} |
convolutional-neural-networks, u-net, skip-connections
Without the skip connections, there may be a loss of information from layer to layer. It's possible that the output of the net must be a function of both the input image and some very fine-grained deep features. Without skip connections, this would not be possible. A concrete example could be that in order to detect an emergency vehicle, you need to detect both the larger feature (the vehicle) and the more fine-grained feature (the siren) and combine them later in the network. | {
"domain": "ai.stackexchange",
"id": 3522,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "convolutional-neural-networks, u-net, skip-connections",
"url": null
} |
Finally, we show that $\overline{\eta}_{\hspace{0cm}_{\large{S}, \mathbf{G}}}$ is a homomorphism from $\Psi_\mathbf{G}$ to $\Psi_{\eta_{\hspace{0cm}_{\large{S}}}(\mathbf{G})}$. It suffices to show that $\overline{\vee}$ and $\overline{\neg}$ are homomorphic (why?). | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9715639694252315,
"lm_q1q2_score": 0.823854921274176,
"lm_q2_score": 0.8479677583778258,
"openwebmath_perplexity": 289.99836342887994,
"openwebmath_score": 0.9999847412109375,
"tags": null,
"url": "https://math.stackexchange.com/questions/1985539/is-2-frakc-separable"
} |
python, optimization, performance, strings, programming-challenge
elapsed_time = (timer() - start) * 1000 # s --> ms
print "Found %d in %r ms." % (ans, elapsed_time) You can make a few quick improvements without altering the algorithm significantly:
Remove one of the redundant calls to timer().
Store the list of primes instead of calculating it for every call to follows_property.
Convert the digits to strings in the list passed to permutations so you can simplify the calculation of num.
Run through all permutations instead of 9-tuples and remove the Counter and missing parts.
These are minor changes, but they clean up the code a bit. I also renamed ans to sum to clarify what it holds. They also cut the running time by more than half.
from itertools import permutations
from primes import primes_upto
from collections import Counter
from timeit import default_timer as timer
divisors = primes_upto(17)
def follows_property(n):
for k in range(7):
if int(n[k+1:(k+4)]) % divisors[k] != 0:
return False
return True | {
"domain": "codereview.stackexchange",
"id": 7594,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, optimization, performance, strings, programming-challenge",
"url": null
} |
# Understanding Negative Binomial Random Variables
I'm trying to understand Negative Binomial Random Variables and have across the following:
$Z\sim \mathrm{NegBin}(n,p)$ if $Z = X_1 +\cdots+ X_r$ where $X_i's$ are independent identically distributed variables, $\mathrm{Geo}(p)$.
Apparently, $Z$ refers to the time when the $r^\text{th}$ success occurs.
Q.1 However, I don't understand the following:
$$Z \in \mathbb \{r, r+1, r+2,\ldots\}$$
Q.2 And this bit: $$P(Z=k) = p \binom{n-1}{k-1}p^{k-1}(1-p)^{n-k}$$
Q.3 I also got why this is the case: $\sum\limits_{k=0}^n k\binom{n}{k} p^k (1-p)^{n-k} = np$ from $\mathrm{Bin}(n,p)$
Thanks a lot | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9840936101542134,
"lm_q1q2_score": 0.8045698134731346,
"lm_q2_score": 0.817574471748733,
"openwebmath_perplexity": 238.80654120879868,
"openwebmath_score": 0.9310566186904907,
"tags": null,
"url": "https://math.stackexchange.com/questions/918709/understanding-negative-binomial-random-variables"
} |
physical-chemistry, thermodynamics
Title: What is the physical interpretation of "internal pressure"?
$$ \require{begingroup}
\begingroup
\newcommand{\md}[0]{\mathrm{d}} \md U = \pi_T\,\md V + C_V \,\md T$$
where $\pi_T$ is the internal pressure and is given by $\displaystyle {\left(\partial U \over \partial V\right)_T}$.
What does the internal pressure actually physically mean? I can see it is the slope of the $U$-$V$ graph at constant temperature but that does not clear things up.
Also why is this quantity called the internal pressure and not something else? $\endgroup$ See orthocresol's derivation of an internal pressure $\pi_T$ relation $(1)$ here.
$$\pi_T = T\left(\frac{\partial P}{\partial T}\right)_V - P\tag{1}$$ | {
"domain": "chemistry.stackexchange",
"id": 7602,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry, thermodynamics",
"url": null
} |
c++, algorithm, image, geospatial, mapreduce
RETURNIF(gdalDriver == NULL, 1, "Could not initialise Geotiff driver")
char **optionStrArray;
optionStrArray = CSLSetNameValue(optionStrArray, "TILED", "YES");
optionStrArray = CSLSetNameValue(optionStrArray, "COMPRESS", "LZW");
if (skipHoles) {
optionStrArray = CSLSetNameValue(optionStrArray, "SPARSE_OK", "TRUE");
}
dstDataset = gdalDriver->Create(outputPathStr, srcDataset->GetRasterXSize(), srcDataset->GetRasterYSize(),
srcDataset->GetRasterCount(), srcDataset->GetRasterBand(1)->GetRasterDataType(),
optionStrArray);
RETURNIF(dstDataset == NULL, 1, "Could not create output dataset");
double geotransform[6];
srcDataset->GetGeoTransform(geotransform);
dstDataset->SetGeoTransform(geotransform);
dstDataset->SetProjection(srcDataset->GetProjectionRef()); | {
"domain": "codereview.stackexchange",
"id": 21278,
"lm_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, image, geospatial, mapreduce",
"url": null
} |
ros, gazebo, rviz, moveit, collision
Title: Multi-Robot MoveIt collision management
I'm trying to simulate a multi robot system with 2 UR3. So far I've managed to launch the simulation with both robotic arms and start a single instance of rviz with MoveIt for each robot. At this point i can plan the motion for each robot simultaneously, as they have a separate instance of MoveIt running within their proper namespace.
The problem I'm facing is that the robots can collide with each other (They are close enought in the simulation). As MoveIt is running independently for each robot the motion planning is not able to "see" the other robotic arm. So I'm wondering if there's a way to make each robot aware of the position of the other in Rviz in order to be able to plan motion without collision.
I'm working in ubuntu 20.04, with ROS1 noetic and 2 UR3. | {
"domain": "robotics.stackexchange",
"id": 36210,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, gazebo, rviz, moveit, collision",
"url": null
} |
way to solve a system of linear equations is by graphing each linear equation on the same -plane. To solve the system of equations, you need to find the exact values of x and y that will solve both equations. If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked. Below is an example that shows how to use the gradient descent to solve for three unknown variables, x 1, x 2, and x 3. You really, really want to take home 6items of clothing because you “need” that many new things. Systems of Linear Equations. Solve the following system of equations by elimination. For problems 1 – 3 use the Method of Substitution to find the solution to the given system or to determine if the system … 9,000 equations in 567 variables, 4. etc. Gradient descent can also be used to solve a system of nonlinear equations. Looking for fun activities to teach kids about Solving Word Problems Involving Linear Equations and Linear Inequalities? Systems of | {
"domain": "com.br",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464471055738,
"lm_q1q2_score": 0.8802262727546012,
"lm_q2_score": 0.9019206692796967,
"openwebmath_perplexity": 666.4782717917759,
"openwebmath_score": 0.7244647741317749,
"tags": null,
"url": "https://mundogeografico.com.br/79wyw/axxtibs.php?page=2e1b59-system-of-linear-equations-problems"
} |
- | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9566341987633822,
"lm_q1q2_score": 0.8187364779983798,
"lm_q2_score": 0.8558511488056151,
"openwebmath_perplexity": 309.05850480649764,
"openwebmath_score": 0.9178386926651001,
"tags": null,
"url": "http://math.stackexchange.com/questions/4270/is-a-field-ring-an-algebra-over-itself"
} |
physical-chemistry, equilibrium, concentration
Anyways, the first formula will still work. The main problem here is that $[\ce{IBr}]=\color{blue}{\text{total }}\text{concentration of}~\ce{IBr}$. When you put any reactant/product inside the square brackets, you're supposed to write their total concentration, even if they have been split up in parts. So, when in the derivation of $K_\mathrm c$, you write:
$$K_\mathrm c = \frac{([\ce{C}]\cdots[\ce{C}])([\ce{D}]\cdots[\ce{D}])}{([\ce{A}]\cdots[\ce{A}])([\ce{B}]\cdots[\ce{B}])}= \frac{[\ce{C}]^c.[\ce{D}]^d}{[\ce{A}]^a.[\ce{B}]^b}$$
for the reaction: $$\ce{aA + bB —> cC + dD}$$
each of those individual $[\ce{C}]$'s will refer to the total concentration of $\ce{C}$. That means, as $\ce{C}$ was separately written $c$ times by you in the reaction, the final $[\ce{C}]$ that you use will be the sum of all those $c$ $[\ce{C}]$s.
So, in the end of your second method, while applying the correct formula for $K_\mathrm c$, you must add those $x$ and $x$ together, and then write: | {
"domain": "chemistry.stackexchange",
"id": 9687,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry, equilibrium, concentration",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.