text stringlengths 1 1.11k | source dict |
|---|---|
With non-probabilistic implications, e.g. $$P \implies Q$$ we can use contraposition to infer $$\neg Q \implies \neg P$$
Given the above definitions, and the statement $$b \overset{\mbox{90%}}{\implies} \neg T$$, it seems like we can infer the following: $$T \overset{\mbox{90%}}{\implies} \neg b$$ which I interpret as "If we ensure predicate $$T$$ is true, then we have prevented 90% of the events in $$B$$".
Is this inference valid? If not, why not?
Your question can be rephrased in conditional probability terms:
Suppose I know $$P(\neg T | b) = 0.9$$. Must it be true that $$P(\neg b | T) = 0.9$$?
The answer is "no"; even if we are given $$P(\neg T | b) = 0.9$$, $$P(\neg b | T)$$ can take any value between $$0$$ and $$1$$, depending on the individual likelihoods of $$b$$ and $$T$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429112114063,
"lm_q1q2_score": 0.803038980203481,
"lm_q2_score": 0.8152324848629215,
"openwebmath_perplexity": 389.6952037535969,
"openwebmath_score": 0.9957835078239441,
"tags": null,
"url": "https://math.stackexchange.com/questions/3870046/does-this-reasoning-using-a-combination-of-contraposition-and-probabilty-work"
} |
asymptotics
Title: Showing that $\lg(n!)$ is or is not $o(\lg(n^n))$ and $\omega(\lg(n^n))$ My instructor assigned a problem that asks us to determine which asymptotic bounds apply to a certain $f(n)$ for a certain $g(n)$, in my case $f(n) = \lg(n!)$ and $g(n) = \lg(n^n)$. For clarity, the convention we use in our class is that $\lg = \log_2$, the "binary logarithm".
I know that by Stirling's approximation, $\lg(n!)$ grows in $O(n\lg(n))$, and evaluating the limit $\lim_{n \to \infty} \frac{n\lg(n)}{n\lg(n)} = C$, some constant > 0, and so $\lg(n!)$ is in $\theta(\lg n^n)$.
$\theta$ also means that my $f(n)$ is is in $O(g(n))$ and $\Omega(g(n))$, but this does not mean that my $f(n)$ is in $o(g(n))$ or $\omega(g(n))$.
For that, I believe I would need to evaluate $\lim_{n \to \infty} \frac{\lg(n!)}{\lg(n^n)}$, but I am not certain. | {
"domain": "cs.stackexchange",
"id": 13355,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "asymptotics",
"url": null
} |
machine-learning, algorithms, beginner, reinforcement-learning, training
If you want to work with agents for playing video games, you will also want to learn about neural networks and probably in some detail - you will need deep, convolutional neural networks to process screen graphics.
A relatively new resource for RL is OpenAI Universe. They have done a lot of work to package up environments ready to train agents against, meaning you can concentrate on studying the learning algorithms, as opposed to the effort of setting up the environment.
Regarding your list of current skills: None of them are directly relevant to reinforcement learning. However:
If you can understand the maths and theory from your previous course, then you should also be able to understand reinforcement learning theory.
If you have studied any online or batch supervised learning techniques, then these can be used as components inside a RL framework. Typically they can be used to approximate a value function of the game state, based on feedback from successes and failures so far. | {
"domain": "datascience.stackexchange",
"id": 1362,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, algorithms, beginner, reinforcement-learning, training",
"url": null
} |
matlab, random-process, moving-average
Related is this post on the dynamic range of floating point systems: More Simultaneous Dynamic Range with Fixed Point or Floating Point? and this excellent presentation @RBJ has made at the 2008 AES Conference https://www.aes.org/events/125/tutorials/session.cfm?code=T19 which I am not sure is available anywhere online (Robert can comment). At that other post RBJ educated me about the additional hidden bit in the dynamic range result that I had confirmed with the results in my answer there.
Quantization Noise in an Accumulator
Regardless of fixed or floating point, the noise due to the accumulation that is present in both structures (Moving Average Filter and CIC Filter) is specific to any accumulator so worth-while providing full details of that operation.
For the case of the Moving Average Filter where the accumulation is done over a fixed number of iterations, the resulting noise due to precision is stationary, ergodic, band-limited and will approach a Gaussian distribution. | {
"domain": "dsp.stackexchange",
"id": 9383,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matlab, random-process, moving-average",
"url": null
} |
c#, sql, sql-server
return databases;
}
// same logic for these ...
public override HashSet<SchemaData> GetSchemas(DatabaseData Database) ...
public override HashSet<TableData> GetTables(DatabaseData database, SchemaData schema) ...
public override HashSet<ColumnData> GetColumns(DatabaseData database, SchemaData schema, TableData table) ...
}
Finally, the various SqlDataFetchers (there will be others - one that reads directly from the sys tables, for eg) can be constructed via methods the SqlDataFetcherBuilder static class, with variants provided for connecting via either Trusted Connection or UserID/Password:
public static class SqlDataFetcherBuilder
{
// Creates a new MetadataFetcher object. Uses Integrated Security (Trusted Connection) to connect.
public static MetadataFetcher CreateMetadataFetcher(string Server, string Database)
{
return new MetadataFetcher(BuildConnectionString(Server, Database));
} | {
"domain": "codereview.stackexchange",
"id": 13073,
"lm_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#, sql, sql-server",
"url": null
} |
molecular-orbital-theory, symmetry
Title: How derive g and u symmetry labels for orbitals? When asked whether a molecule has an inversion center, we "invert" the coordinates of all atoms; i.e. move each atom from its position through the center of symmetry and to a new position equidistant to the center of symmetry compared to its initial position, and see if the final configuration is indistinguishable from the initial configuration. Simple enough.
I am confused when trying to decide whether molecular orbitals have g or u symmetry. Should I move the atoms through the center of symmetry, should I move "each lobe" through the center of symmetry, or some other way? What is the most general way of describing the symmetry operation for orbitals? | {
"domain": "chemistry.stackexchange",
"id": 4619,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "molecular-orbital-theory, symmetry",
"url": null
} |
gravity, simulations, stars
Thus it can happen that a given pair has, initially, so much angular momentum as to violate the above condition, but it can also happen that angular momentum removal is still occurring (at the time your simulations end) so that more binary pairs will form than is apparent from your simulations. Since this involves processes which are, as of now, largely speculative, no one can claim to know the exact time-evolution of these torques. This is a fundamental element of ignorance, on our part. | {
"domain": "physics.stackexchange",
"id": 30797,
"lm_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, simulations, stars",
"url": null
} |
symmetry, symmetry-breaking, axion
If the PQ symmetry is spontaneously broken, as you say this results in an axion field which couples like the theta angle, $a(x) \text{Tr} F(x) \tilde{F}(x)$, and if the axion potential $V(a)$ has its minimum at $a=0$, this dynamically explains why we observe that the coefficient of $F(x) \tilde{F}(x)$ is extremely close to zero, which is the strong CP problem. This solves the strong CP problem using a spontaneously broken PQ symmetry which is 'high quality' (a good symmetry apart from the anomaly). | {
"domain": "physics.stackexchange",
"id": 98636,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "symmetry, symmetry-breaking, axion",
"url": null
} |
# How many subsets of size k exist such that no pair of elements is $R$
I saw this problem today:
In a round table there are 12 knights. Each pair of contiguous knights are enemies. How many different ways can 5 knights be chosen such that no pair of knights are enemies?
So I tried to count how many ways there are to pick 5 knights out of 12 and substract the number of ways 5 knights can be picked such that there is at least a pair of enemies. I think i did the second one wrong because I got a negative number. I figured maybe some abstraction woumd help, and I arrived at a generalization that is much more interesting:
Given a finite set $A$ of size $n$ and a symmetric relation $R$ in $A$, how many different subsets $B$ of size $k<n$ are there such that no pair of elements in $B$ are in $R$? | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9918120893722416,
"lm_q1q2_score": 0.8390159343095288,
"lm_q2_score": 0.8459424353665382,
"openwebmath_perplexity": 99.12349608349777,
"openwebmath_score": 0.8368520140647888,
"tags": null,
"url": "https://math.stackexchange.com/questions/2404157/how-many-subsets-of-size-k-exist-such-that-no-pair-of-elements-is-r"
} |
recursion, primitive-recursion, variable-binding
Hoping someone could explain these clearly, so I can go in the right direction. now I am struggling to figure out their "points".
Thanks in advance! The recursion combinator you mention seems to be the recursor associated to an inductive (or recursive) data type. In the paper this seems to be the type describing the syntax of lambda terms. Here, I'll take lists as a simpler recursive type.
Note that the "lists of naturals type" can be intuitively described as the "least" type admitting these constructors:
$$
\begin{array}{l}
nil : list \\
cons : nat \to list \to list
\end{array}
$$
Recursive types as the one above have an associated induction principle. For instance, if we wanted to prove a property on all lists $p(l)$, it would suffice to prove | {
"domain": "cs.stackexchange",
"id": 9379,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "recursion, primitive-recursion, variable-binding",
"url": null
} |
algorithms, complexity-theory, optimization
On this picture 2 orange items selected. all blue and green items are added to sum also, but green item, added only once( in other words any item on grid can be taken once in final sum).
So sum of selected subse: 2xOrange(selected)+9xBlue(adjacent)+1xGreen(taken only once into account).
When radius is 0 the problem is trivial: Just choose K best items,
But when radius 1 or more is following problem NP-hard?
If yes, what is the best way to prove it ?
If no, is there an algorithm that return optimal solution?
Many thanks for help! It seems very likely that it is $NP$-complete. | {
"domain": "cs.stackexchange",
"id": 4733,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, complexity-theory, optimization",
"url": null
} |
1. I’m glad the page is helpful!
Thanks for calling my attention to the fact that the Subscribe option had disappeared. I have made it available now.
1. Thank you. I guess to sum it up we use rise/run because we measure the ratio of a line based off the slope’s incline intensity.
2. first thank you to create this page that help people
i am also want to add my logic that in every ratio the order is important and when we want to know the ratio of something to other the thing we want to know its ratio must be come in numerator so slope is also a kind of ratio and we cannot write rise in denominator because that change our slope name
thank you
This site uses Akismet to reduce spam. Learn how your comment data is processed. | {
"domain": "themathdoctors.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.987946221548465,
"lm_q1q2_score": 0.8167467911526747,
"lm_q2_score": 0.826711791935942,
"openwebmath_perplexity": 477.810859627028,
"openwebmath_score": 0.7522429823875427,
"tags": null,
"url": "https://www.themathdoctors.org/why-isnt-slope-run-over-rise/"
} |
c#, beginner, console
Class
class PayRateCalculator
{
private float _payrate = 8.25f;
private float _withholdingRate = 0.20F;
public float hours { get; set; }
public float grossPay {
get {
return hours * _payrate;
}
}
public float netPay {
get {
return grossPay - (grossPay * _withholdingRate);
}
}
public float payrate {
get {
return _payrate;
}
set {
_payrate = value;
}
}
public string lastName { get; set; }
public PayRateCalculator (string lastName, float hours, float payRate)
{
this.hours = hours;
this.payrate = payrate;
this.lastName = lastName;
}
public PayRateCalculator ()
{
}
} | {
"domain": "codereview.stackexchange",
"id": 5434,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, beginner, console",
"url": null
} |
swift, quiz
Title: True or false quiz logic I am creating a true or false quiz game and when the user chooses an answer a tick or cross will appear on the screen telling the user whether they are right or wrong and then automatically bring the next question in.
Currently I am using 2 almost identical functions that draw the next question from my question array (one for each button). It appears to work but seems very cluttered and illogical. Is there a more elegant way to code the logic to this?
Also, the concept of a previous question button has caused a lot of issues. Through a lot of research I am still not sure how I would incorporate one into the program.
@IBAction func trueButton(sender: AnyObject) {
delay(2) {
nextQuestionTrue()
}
}
@IBAction func falseButton(sender: AnyObject) {
delay(2) {
nextQuestionFalse()
}
}
func nextQuestionTrue() -> QuizQuestion {
// initialize current question | {
"domain": "codereview.stackexchange",
"id": 13956,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "swift, quiz",
"url": null
} |
acid-base
Note that $\alpha$ is represented on the $y$-axis in a 0-1 scale. For each of the four states of the molecule, there is a different $\alpha$, and different values of $\alpha$ happen simultaneously.
$^1$ $\mathrm{p}K_\mathrm{a}$ values taken from Wikipedia. | {
"domain": "chemistry.stackexchange",
"id": 3106,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "acid-base",
"url": null
} |
pictures. ' 'The coin is just as likely to land heads as tails. Suppose you write each letter of the alphabet on a different slip of paper and put the slips into a hat. Probability of a tear is not provide already ahead. e head or tail. Indeed, much of probability theory can be based on this simple experiment, as we shall see in subsequent chapters. Calculus Calculus: An Applied Approach (MindTap Course List) Probability: Coin Toss A fair coin is tossed until a head appears. On any one toss, you will observe one outcome or another—heads or tails. Describe the. Word Problems on Coin Toss Probability: So, by definition, P(F) = 34. Related math problems and questions: One dice Calculate the probability of a roll of one dice with the numbers 1, 2, 3, 4, 5, 6 on the walls. I have a problem I need to do for school. The probability of a man hitting the target at a shooting range is 1/4. Most of the time questions are asked on Coins problem. 17, as is the probability of rolling any other | {
"domain": "luviaheventi.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9787126488274565,
"lm_q1q2_score": 0.827934559772497,
"lm_q2_score": 0.8459424334245617,
"openwebmath_perplexity": 369.53134766360745,
"openwebmath_score": 0.7722846269607544,
"tags": null,
"url": "http://luviaheventi.it/coin-probability-problems.html"
} |
(raising to powers), or extraction of roots. Factoring Cubic Polynomials March 3, 2016 A cubic polynomial is of the form p(x) = a 3x3 + a 2x2 + a 1x+ a 0: The Fundamental Theorem of Algebra guarantees that if a 0;a 1;a 2;a 3 are all real numbers, then we An important problems associated with polynomials is factoring. If the remainder is 0 or degree of remainder is less than divisor, then we cannot continue the division any further. Pascal's triangle. Goh Abstract. If the constant term = 4, then the polynomial form is given by f(x)= 4x 0. A polynomial having value zero (0) is known as zero polynomial. If a polynomial has no variable, it is called polynomial of zero variable. 4. Real Zeros. 5) becomes Hermite’s ODE and H n(x) are the Hermite polynomials. If f(x) = P n i=0 c ix i with c n 6= 0, then c n is the leading coefficient and c 0 is the constant term. Now we can plot the equation y=p(x) on the Cartesian plane by taking various values of x and y obtained by putting the values. This | {
"domain": "com.br",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9861513873424044,
"lm_q1q2_score": 0.8717965566269317,
"lm_q2_score": 0.8840392741081575,
"openwebmath_perplexity": 364.1644106487573,
"openwebmath_score": 0.7238003611564636,
"tags": null,
"url": "http://riosite.com.br/v4hyp/zero-polynomials.html"
} |
• If $D$ is diagonal with entries $\pm 1$ then $D^{-1} = D$. This is because ${1 \over 1} = 1$ and ${1 \over -1} = -1$. – copper.hat Dec 17 '19 at 22:06
• I'm not confident but I think that the determinant of $D$ would be $+-1$ which represent rotation or reflection. This makes geometric sense as to why successive transformations result in the identity. I'm not 100% sure but thought I'd add it if not for it to be corrected. – Karl Dec 17 '19 at 22:33
• It doesn't matter how many of the diagonal entries are $1$ and how many are $-1$. It will still be the case that $A^{-1}=A$. I show this in my solution below. – user729424 Dec 18 '19 at 1:58
• @Karl What? Knowing the determinant is $\\pm1$ certainly does not imply $A$ is a rotation or reflection... – David C. Ullrich Dec 18 '19 at 17:20
• @David C.Ullrich. thanks I am mistaken. I was referring to the $D$ matrix of eigenvalues and not $A$ thinking there should be a connection but regardless I am incorrect. – Karl Dec 18 '19 at 18:22 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.982013792143467,
"lm_q1q2_score": 0.8118423880977423,
"lm_q2_score": 0.8267117983401363,
"openwebmath_perplexity": 118.46364084628297,
"openwebmath_score": 0.9539782404899597,
"tags": null,
"url": "https://math.stackexchange.com/questions/3480173/how-to-prove-that-a-diagonalizable-matrix-with-eigenvalues-of-%C2%B11-is-equal-to-its/3480175"
} |
urdf
Title: Spawning urdf with a launch file & PID controls
Hi,
I am trying to launch my world file with my custom robot spawned at launch, I follow the urdf tutorial at Gazebo main page, but the model won't spawn.
<launch>
<!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find kuka_kr3_gazebo)/worlds/kuka_kr3.world"/>
<!-- more default parameters can be changed here -->
</include>
<!-- Spawn a robot into Gazebo -->
<param name="robot_description" textfile="$(find kuka_kr3_description)/urdf/model.urdf"/>
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-file $(find kuka_kr3_description)/urdf/model.urdf -urdf -param robot_description -x 0.0 -y 0.0 -z 0.1 -model kuka_kr3" respawn="false" output="screen"/>
</launch> | {
"domain": "robotics.stackexchange",
"id": 4191,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "urdf",
"url": null
} |
python
def wrap_patchfs(f):
@functools.wraps(f)
def wrapped(*args, **kwargs):
with Patcher(
additional_skip_names=additional_skip_names,
modules_to_reload=modules_to_reload,
modules_to_patch=modules_to_patch,
allow_root_user=allow_root_user) as p:
kwargs['fs'] = p.fs
return f(*args, **kwargs)
return wrapped
if _func:
if not callable(_func):
raise TypeError("Decorator argument not a function.\n"
"Did you mean `@patchfs(additional_skip_names=...)`?")
return wrap_patchfs(_func)
return wrap_patchfs
The if not callable: ... ensures you don’t accidentally try to use @patchfs(names_to_skip). Using * forces the remaining arguments to keyword only arguments; you cannot just list the four arguments, which makes the decorator a little less error-prone. | {
"domain": "codereview.stackexchange",
"id": 37701,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python",
"url": null
} |
timer
Comment by nlamprian on 2017-05-06:
Here is the last link. A TimerQueueCallback instance is created each time an iteration is scheduled for execution.
Comment by Winston on 2017-05-06:
"A TimerQueueCallback instance is created each time an iteration is scheduled for execution." Could you show me how did you come to this conclusion from the source code? Is it because threadFunc(), but I could not see where it is called? | {
"domain": "robotics.stackexchange",
"id": 27794,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "timer",
"url": null
} |
newtonian-mechanics, orbital-motion, rocket-science, satellites
Title: Change of orbit with tangential impulse I see a similar question: Change of orbit with a radial impulse. The answer to that question seems fine to me. In the answer, mention is made of this similar question, but it is not fully treated.
So, suppose a satellite is in a perfectly circular orbit. If you impart a brief forward impulse (in the direction of the orbit), what now happens to the orbit? (And what about a backward impulse?) See my answer here. Consider a satellite whose speed changes as $\vec {v}=k\vec {v}$ at some point of the trajectory. Figure 1 shows the trajectory before the speed has changed (blue) and after (orange). We see an elliptical trajectory that is getting farther from the central body at $k>1$ ant it is getting closer to the central body with decreasing $k$. When $k\ge \sqrt {2}$, the satellite leaves the central body. | {
"domain": "physics.stackexchange",
"id": 58434,
"lm_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, orbital-motion, rocket-science, satellites",
"url": null
} |
python, linked-list
Implement as many of the mutable sequence operations as possible.
Use the standard method names where possible: clear, extend, append, remove, etc.
Implement special dundermethods (method names with "double-underscores" in them: double-under-methods, or "dundermethods") as needed to make standard Python idioms work:
def __contains__(self, item):
for i in self:
...
def __iter__(self):
node = self.head
while node:
yield node.value
node = node.next
Implement your test code using standard Python idioms, to prove it's working:
llist = LinkedList([23, 98, 415, 123, 981, 454, 213, 198, ...])
while True:
item = int(raw_input("Enter a number to search for: "))
if item in llist:
print "It's in there!"
else:
print "Sorry, don't have that one." | {
"domain": "codereview.stackexchange",
"id": 29014,
"lm_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, linked-list",
"url": null
} |
pointcloud
Title: Understanding Pointcloud2 data
I'm trying to understand the pointcloud2 data extracted from a bag file. The contents of one sample message is as follows:
header:
seq: 0
stamp:
secs: 1317022486
nsecs: 689719915
frame_id: "velo_link"
height: 1
width: 119597
fields:
-
name: "x"
offset: 0
datatype: 7
count: 1
-
name: "y"
offset: 4
datatype: 7
count: 1
-
name: "z"
offset: 8
datatype: 7
count: 1
-
name: "i"
offset: 12
datatype: 7
count: 1
is_bigendian: False
point_step: 16
row_step: 1913552 | {
"domain": "robotics.stackexchange",
"id": 36156,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pointcloud",
"url": null
} |
moveit, ros-melodic, roslaunch
Title: Resource not found
Hi,
I am working within a simple ROS workspace where I have two packages.
I have included in my workspace (as a new package, "robotic_moveit_config") a configuration generated by MoveIt setup assistant. My question is about this particular package. The configuration generated by MoveIt setup assistant already creates different launch files.
I can build the workspace correctly, and then using roslaunch I can successfully run, for example.
roslaunch robotic_moveit_config demo.launch
and so I can test simple planning scenarios in rviz.
At the same time, I am trying to write some simple motion planning programs.
zahid_test_workspace
src
-- my_test_pkg
-- ur5_moveit_config
-- include
-- src
-- launch
-- smp.launch
Here, when I try to issue
roslaunch ur5_moveit_config smp.launch | {
"domain": "robotics.stackexchange",
"id": 34124,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "moveit, ros-melodic, roslaunch",
"url": null
} |
frequency-spectrum, transfer-function, frequency-response, bandwidth
$$B_i =
\left( \left(\omega_i + \log r_i \right) - \left( \omega_i - \log r_i \right) \right) \frac {f_s}{2 \pi} =
\log r_i \frac{f_s}{\pi}
\tag {12}$$
Which is what your book's author so blithely wrote in one sentence. | {
"domain": "dsp.stackexchange",
"id": 12517,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "frequency-spectrum, transfer-function, frequency-response, bandwidth",
"url": null
} |
performance, php, functional-programming, laravel
Title: Fetch Keywords from comment and assign keyword id to comment I have a small callback function which receives a comment in array like below:
$data[$count] = array(
'comment_id' => $comment['id'],
'comment_body' => $comment['message'],
'comment_author_id' => $comment['from']['id'],
'comment_author_name' => $comment['from']['name'],
'active' => 1,
'keyword_id' => null,
'live_video_id' => $liveVideo->live_vidoe_id
);
the I send this comment to a function AssignKeywords as below: | {
"domain": "codereview.stackexchange",
"id": 24837,
"lm_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, php, functional-programming, laravel",
"url": null
} |
The Freshman's Dream notwithstanding, the binomial expansion applied to the expression will produce terms of the form $$\ C·x^m·y^n \$$ where $$\ m + n \ = \ 7 \$$ and with all of the binomial coefficients $$\ \frac{7!}{m!n!} \ \ ,$$ $$m \ \neq \ 0 \ , \ 7 \ \ , \$$ being divisible by $$\ 7 \$$ since that is prime. So we can immediately see a factoring $$7x^6y \ + \ 21x^5y^2 \ + \ 35x^4y^3 \ + \ 35x^3y^4 \ + \ 21x^2y^5 \ + \ 7xy^6$$ $$= \ \ 7 \ · \ xy \ · \ ( \ x^5 \ + \ 3x^4y \ + \ 5x^3y^2 \ + \ 5x^2y^3 \ + \ 3xy^4 \ + \ y^5 \ ) \ \ .$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138099151278,
"lm_q1q2_score": 0.8329660162051339,
"lm_q2_score": 0.8519527982093666,
"openwebmath_perplexity": 372.55260846987693,
"openwebmath_score": 0.9981115460395813,
"tags": null,
"url": "https://math.stackexchange.com/questions/498584/factor-xy7-x7y7"
} |
observables
Title: Interpretation of two different observables, both with the same resolution of the identity Suppose you have a resolution of the identity $\hat{\mathbb{1}}=\sum_i\hat{p_i}$ (pairwise othogonal), and construct two (non-degenerate) pvm observables, $\hat{B}=\sum_ib_i\hat{p_i}$ and $\hat{C}=\sum_ic_i\hat{p_i}$, both using that same $\hat{p_i}$ resolution, but with $b_i\not=c_i$ (at least not all of them). However, all $b_i,c_i$ have the same kind of units, e.g., length or mass, etc.
Now, if there's some (dimensionless) constant, $k$, such that $c_i=kb_i$, then I think we can clearly interpret $\hat B$ as an observable measured in, say, meters, and interpret $\hat C$ as an observable measuring exactly the same physical quantity in, say, cm. | {
"domain": "physics.stackexchange",
"id": 31627,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "observables",
"url": null
} |
c++, performance, memory-management
//ERASE_FROM
//Input: Integer <Index>
//Deletes value from given index
void sequence::erase_from(int index) {
for (int j = index; j < seqSize; ++j) {
data[j] = data[j + 1];
}
int *newData = new int[seqSize - 1];
for (int k = 0; k < seqSize - 1; k++) {
newData[k] = data[k];
}
delete[] data;
data = newData;
seqSize = seqSize - 1;
} | {
"domain": "codereview.stackexchange",
"id": 22616,
"lm_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, memory-management",
"url": null
} |
c, console, makefile
Use the latest standards
The old version of grub uses the original multiboot standard, but things have moved on since then. The current is the multiboot2 standard which is implemented by grub2 among others. I modified your code to use the multiboot2 standard instead in just a few minutes.
Consider unit tests
Unit testing of code provides a higher level of assurence that things are working as you intend. For that reason, I'd highly recommend getting into the habit of introducing unit tests into the code base as early as possible. One way that can be simplified is by using the next suggestion.
Create and use libraries
The string.c file only contains a single function at the moment but is likely to grow as your project does. One efficient way to group and maintain such functions is via the use of libraries, either shared or static. As mentioned above, this also makes unit testing simpler, since one can write tests against a library.
Consider using compiler optimization | {
"domain": "codereview.stackexchange",
"id": 36215,
"lm_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, console, makefile",
"url": null
} |
So, if order matters in your decomposition, then you are correct: any sequence of (positive) integers adding to n can be made into a wall by building a tower with height the first integer, then starting over with the second integer, etc. Similarly, any wall produces such a sequence of integers, so this gives a bijection between the two sets being counted. If you are ignoring order, the number of walls is much larger.
-
There is one way of placing the first block.
There are three ways of placing the second block: to the left, on top, or to the right of the first block.
The number of ways of placing the third block will depend on the width of the two-block wall.
So let $f(n,w)$ be the number of ways of building an $n$-block wall of width $w$. You start with $f(1,1)=1$ and $f(1,w)=0$ for $w \not = 1$. Then you have $$f(n,w)=2f(n-1,w-1)+wf(n-1,w)$$
and the following table
w
f(n,w) 1 2 3 4 5 6 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985718065025999,
"lm_q1q2_score": 0.80125800189603,
"lm_q2_score": 0.8128673201042493,
"openwebmath_perplexity": 249.85989865365005,
"openwebmath_score": 0.7477810978889465,
"tags": null,
"url": "http://math.stackexchange.com/questions/61619/combinatorics-building-a-wall"
} |
image-processing, matlab, 3d, matrix
Title: Shortest geometric distance from surface in 3d dataset? I have a three-dimensional binary image of a collection of discrete, individual voxels ("seeds") contained in a connected 3-dimensional surface ("skin").
(Like a small fruit, with a surface delineated by a one-pixel boundary, that contains seeds.)
The binary matrix was derived from a three-dimensional intensity image of the same size (grayscale).
(It's easy to label the surface voxels "2", the seed voxels "1", and the background "0" using MATLAB's label function).
In MATLAB,
How do I compute the shortest geometric distance between each individual "seed" and the surface?
In the (crude) 2-dimensional diagram in the link below, each desired distance is represented by the magnitudes of the red lines (in number of voxels). Do you just need the distance, or do you need the closest point?
For the closest point, the FLANN library can help, and it has Matlab bindings. | {
"domain": "dsp.stackexchange",
"id": 370,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "image-processing, matlab, 3d, matrix",
"url": null
} |
angular-momentum, collision
So basically you had it right.
To get the released energy, you need to take into account both the kinetic and potential energy. I will call the sum of these two the total energy. Then the total energy of the final state will be less than the total energy of the initial state. So the energy released (the energy that will cause the final planet to be hot) will be the intial total energy minus the final total energy. | {
"domain": "physics.stackexchange",
"id": 12976,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "angular-momentum, collision",
"url": null
} |
I'm sure you've seen the comments by now but notice $$\begin{array}{ccccc} \frac{x \frac{n(n+1)}{2} - n}{n^2} & < & \frac{[x] + [2x] + \cdots + [nx]}{n^2} & \le & \frac{x \frac{n(n+1)}{2}}{n^2} \\ \downarrow && \Downarrow \text{Squeezed} \Downarrow && \downarrow \\ \frac{x}{2} && \frac{x}{2} && \frac{x}{2} \end{array}$$
• Both $\frac12n(n-1)$ should read $\frac12n(n+1)$. – Did Jun 11 '14 at 7:00
• @Did oops thanks! – DanZimm Jun 11 '14 at 10:05
By definition
$$a_n=\frac{x+2x+\ldots+nx-\{x\}-\ldots\{nx\}}{n^2}=\frac{n(n+1)}{2n^2}x-\frac{\{x\}+\ldots\{nx\}}{n^2}$$
and now just observe that
$$\{x\}+\ldots+\{nx\}\le n$$ and the left hand side is non-negative. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668690081643,
"lm_q1q2_score": 0.8111422204659171,
"lm_q2_score": 0.8267117919359419,
"openwebmath_perplexity": 233.39749545768316,
"openwebmath_score": 0.8845180869102478,
"tags": null,
"url": "https://math.stackexchange.com/questions/829637/prove-that-a-n-n-1-infty-converges-to-fracx2"
} |
python, tree, python-2.x
Walks through the quadtree generating nids.
If 'top' is not specified, the generator will walk through the entire
quadtree (only top node otherwise).
If 'topdown' is True, parent nodes will be generated before child nodes.
Otherwise, child nodes will be generated before all their parents are. eg:
parent : child nodes
0 : 1, 2, 3, 4
3 : 5, 6, 7, 8
4 : 9, 10, 11, 12
7 : 13, 14, 15, 16
topdown mode - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
bottomup mode - 1, 2, 5, 6, 13, 14, 15, 16, 7, 8, 3, 9, 10, 11, 12, 4, 0 | {
"domain": "codereview.stackexchange",
"id": 8763,
"lm_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, tree, python-2.x",
"url": null
} |
complexity-classes, randomized-algorithms
Title: Is uniform RNC contained in polylog space? Log-space-uniform NC is contained in deterministic polylog space (sometimes written PolyL). Is log-space-uniform RNC also in this class? The standard randomized version of PolyL should be in PolyL, but I don't see that (uniform) RNC is in randomized-PolyL.
The difficulty I see is that in RNC, the circuit can "look at the random bits" as much as it wants; i.e., the random inputs can have arbitrary fanout. But in the randomized version of PolyL, it's not like you get a tape of random bits you get to look at as much as you want; rather, you are only allowed to flip a coin at each time step. | {
"domain": "cstheory.stackexchange",
"id": 2173,
"lm_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-classes, randomized-algorithms",
"url": null
} |
python, c++, laserscan
Title: From c++ code to python code for a ROS program
Hello, I am not good in C++ (Not also good in Python, but better than in C++) I have a code in c++ which I would like to translate in Python but I don't have any idea of where to start (at least I already changed the imported packages) Can someone please help me providing me information about how to start or where to check (I already looked at ROS manuals about creating a publisher and a subscriber but this program has both of them in the same code and I didn't understand it)? It would be very good for me in order to start using it better
The following is the code (it's just a robot which moves with linnear speed of 0.2 and no angular speed (also stops before going to kick a wall) | {
"domain": "robotics.stackexchange",
"id": 20948,
"lm_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, c++, laserscan",
"url": null
} |
inverse-kinematics, kinematics
But let me suggest a simpler apporach to Jacobians in the context of arbitrary many DOFs: Basically, the Jacobian tells you, how far each joint moves, if you move the end effector frame in some arbitrarily chosen direction. Let $f(\theta)$ be the forward kinematics, where $\theta = [\theta_1, ... , \theta_n]$ are the joints, $f_{\text{pos}}$ is the positional part of the forward kinematics and $f_{\text{rot}}$ the rotational part. Then you can obtain the Jacobian by differentiating the forward kinematics with respect to the joint variables:
$$
J = \frac{\partial f}{\partial \theta} =
\begin{bmatrix}
\frac{\partial f_{\text{pos}}}{\partial \theta_1}, & \frac{\partial f_{\text{pos}}}{\partial \theta_2} & ..., \frac{\partial f_{\text{pos}}}{\partial \theta_n} \\
\frac{\partial f_{\text{rot}}}{\partial \theta_1}, & \frac{\partial f_{\text{rot}}}{\partial \theta_2} & ..., \frac{\partial f_{\text{rot}}}{\partial \theta_n}
\end{bmatrix}
$$ | {
"domain": "robotics.stackexchange",
"id": 2421,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inverse-kinematics, kinematics",
"url": null
} |
c#, null
Title: Selecting a thumbnail from among a large, medium, and small image I'm parsing some data in C# where I have an object with 3 properties: "large", "medium", "small"; each property may contain a string array with an image path, and I'm trying to extract that path.
The data should always have a large image, but not always a medium or small. I'm trying to generate thumbnail images, so I prefer the small, but if it's not there I want the medium, otherwise the large. The following code works and I understand it but I have the feeling there's a more expressive way:
var thumb = (images == null)
? null
: (images.small == null) || (images.small.Length == 0)
? (images.medium == null) || (images.medium.Length == 0)
? (images.large == null) || (images.large.Length == 0)
? null
: images.large[0]
: images.medium[0]
: images.small[0]; | {
"domain": "codereview.stackexchange",
"id": 25395,
"lm_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#, null",
"url": null
} |
fft, finite-impulse-response, window-functions, radar
What could be the cause of this? Is there some obvious aspect I'm missing? If any of this is unclear or some part of the information I've omitted is important for answering this question (e.g. the equation relating frequency to distance), please let me know and I'll include it. | {
"domain": "dsp.stackexchange",
"id": 8150,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fft, finite-impulse-response, window-functions, radar",
"url": null
} |
Last edited: Oct 24, 2015
3. Oct 24, 2015
### Ocata
Hi aikismos, thank you for responding. May I ask, what if I have a function:
f(t) = $\frac{-75}{5pi}cos(\frac{pi*t}{10})-t+5$
I graphed it on the program you suggested:
zoomed in:
Is it possible to determine the quantity of roots this function will have before graphing or solving for t?
4. Oct 24, 2015
### jbriggs444
There is the obvious way.
Take the first derivative of this function. Note that this derivative is periodic and solve for its two principle zeroes. The other zeroes can be found trivially. These are the places where the original function can have a local minimum or maximum. The original function must be either monotone increasing or monotone decreasing in the intervals between each pair of consecutive zeroes of its first derivative. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806540875628,
"lm_q1q2_score": 0.8106575938649998,
"lm_q2_score": 0.8267117962054048,
"openwebmath_perplexity": 369.60804372557885,
"openwebmath_score": 0.8477713465690613,
"tags": null,
"url": "https://www.physicsforums.com/threads/finding-the-number-of-solutions-to-a-given-function-equation.839374/"
} |
java
//Name object
public class NameVO {
final String firstName;
final String middleName;
final String lastName;
public NameVO(String firstName, String middleName, String lastName) {
// assignments
}
// getters
}
This effectively makes your NameVO immutable, making it more suitable for use as a key in a Map. It also makes it safer to pass NameVO objects around without having to fear side effects. | {
"domain": "codereview.stackexchange",
"id": 5035,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java",
"url": null
} |
c++, playing-cards
temp[i].setCard(cards[j].getCard());
swap(cards[j], cards[counter-1]);
counter--;
}
*cards = *temp; // Note: You have made a call to new.
// As a result you should call delete
// to avoid a memory leak.
//
// A better way to do this is:
// std::swap(cards, temp);
// delete [] temp;
// Note 2: Note your code here merely swaps
// the first card from the two arrays.
// Note 3: You should probably use std::vector<Card>
// for `temp`. It will handle the memory
// management correctly.
} | {
"domain": "codereview.stackexchange",
"id": 8041,
"lm_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++, playing-cards",
"url": null
} |
c++, linked-list, iterator
constexpr const_iterator end() const noexcept {
if (m_tail == nullptr) { return nullptr; }
return const_iterator(m_tail->next);
}
constexpr const_iterator cend() const noexcept {
if (m_tail == nullptr) { return nullptr; }
return const_iterator(m_tail->next);
}
constexpr bool empty() const noexcept {
return m_size == 0;
}
constexpr size_type size() const noexcept {
return m_size;
}
constexpr size_type max_size() const noexcept {
return std::numeric_limits<difference_type>::max();
}
//Modifiers
constexpr void clear() noexcept {
deallocate(*this);
} | {
"domain": "codereview.stackexchange",
"id": 40611,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, linked-list, iterator",
"url": null
} |
fft
How is it that the floppy systems lose their ability to have a DC component, but the stiff systems seem to have nothing but DC components? Would someone please give me some insight as to what this could possibly mean in the physical world? Thanks.
LM The "DC Component" of the FFT corresponds to a constant offset or bias in the time domain signal. These are very common both as measurement artifacts or in the physics as well.
Examples: A vertical vibration measurements with an accelerometer will have huge bias: that's just earth's gravity. The actual air pressure of a sound signal has a massive offset: that's the static air pressure. A transistor needs to operate around a bias voltage, etc.
What the underlying cause in your specific data is, I can't tell without having a lot more details about the underlying system/signals and your specific definition of "floppy". In general there is no direct relationship between a bias and mechanical compliance (for a linear spring). | {
"domain": "dsp.stackexchange",
"id": 11284,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fft",
"url": null
} |
parsing, rust, grammar
let mut open_quote = if text.is_empty() {
prev_open_quote
} else {
None
};
while new_hls.len() < text.len() {
let prev_is_sep = new_hls.is_empty() || is_separator(text[new_hls.len() - 1]);
if new_hls.is_empty() && prev_open_quote.is_some() ||
syntax.quotes.contains(text[new_hls.len()])
{
let active_quote = if new_hls.is_empty() && prev_open_quote.is_some() {
prev_open_quote.expect("Just checked_it")
} else {
let start_quote = text[new_hls.len()];
new_hls.push(EditorHighlight::String);
start_quote
};
open_quote = Some(active_quote);
while new_hls.len() < text.len() {
if text[new_hls.len()] == active_quote { | {
"domain": "codereview.stackexchange",
"id": 26776,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "parsing, rust, grammar",
"url": null
} |
clojure, playing-cards, shuffle
I've had a go at implementing my suggestions, and ended up with this:
(defn overhand-shuffle
"Shuffle the cards, using the overhand shuffle technique.
REFL https://en.wikipedia.org/wiki/Shuffling#Overhand_shuffle"
[cards]
(let [slice-sizes (make-slice-sizes (count cards))
; The first value returned by reductions is the initial value, so we
; drop it here.
[_ & slices] (map first
(reductions (fn [[_ remaining-cards] slice-size]
(split-at slice-size remaining-cards))
[nil cards]
slice-sizes))]
(apply concat (reverse slices)))) | {
"domain": "codereview.stackexchange",
"id": 17910,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "clojure, playing-cards, shuffle",
"url": null
} |
pcr, statistics, quantitative-genetics
That is not the right way to go about. You are calculating average expression of B in both samples. It does not mean there is 10x more B. There is just 4x more B in Sample-2 relative to Sample-1.
Gene-A does not change its expression between samples and can be used as a reference gene.
If you calculate by threshold cycle the fold change $ = 2^{8-6} = 4x$
See this post too.
The average is calculated between replicates, not between different experimental conditions.
Sometimes the average of two experimental samples is calculated — this is typically done in a MA-plot analysis which is done to filter out genes which show very high fold changes just because of their overall low expression (1:4 vs 100:300).
Answer to your Edit
You should not take the average (arithmetic mean) of Ct. They don't scale linearly with expression (and so is the converse).
For any non-linear function $f(x)$:
$$f(x+y) \ne f(x)+f(y)$$
$$f\left(\frac{x+y}{2}\right) \ne \frac{f(x)+f(y)}{2}$$ | {
"domain": "biology.stackexchange",
"id": 3015,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pcr, statistics, quantitative-genetics",
"url": null
} |
deep-learning, deep-neural-networks, hardware, facial-recognition
Size of each image (resolution)
Color/Monochrome image (color image has 3 times data if you consider RGB image)
Like you mentioned on the type of DNN.
No. of layers of DNN.
No. of neurons in each layer.
Total no. of images in the dataset. (2.6 million here)
GPU you are using (you didn't mention which GPU you are using. There are GPUs with wide range of capabilities, to predict the time, you need to know the exact specs of GPU).
Training time also depends on RAM on your machine and also how fast host PC can transfer data to GPU for processing.
Since you mentioned face recognition, i am assuming you are using CNN, but if you again use fully connected network, training time will change and will obviously increase manifold. | {
"domain": "ai.stackexchange",
"id": 1156,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning, deep-neural-networks, hardware, facial-recognition",
"url": null
} |
optimization, heuristics, packing
the "weight" of a shelf is its height,
the "value" of a shelf is the value of including that shelf in the bookcase (e.g., the number of books it'll enable you to store, or maybe just a fixed value that's the same for all shelves), and
the "capacity" of the knapsack is the total height of the bookcase. | {
"domain": "cs.stackexchange",
"id": 4047,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optimization, heuristics, packing",
"url": null
} |
robotic-arm
Are there such models available?
Is seems to me, that such arms as OWI-535 are only toys, i.e. they can just relocate lightweight objects and that's all. Am I right?
UPDATE
Also suppose that my AI can look at assembly area with multiple HD cameras and can perfectly "understand" what is sees. Yes, the OWI Robot arm is just a toy and doesn't have nearly enough accuracy, repeatability, sensor feedback, etc. to be able to do any sort of "real" assembly task. I'm sure you are aware of industrial arm like Kuka, ABB, etc. However, these arms are not suited to fine assembly either. A new class of robot arm is becoming more popular, one that is "human safe" and designed for assembly tasks with some human involvement. These are things like Universal Robotics, Rethink Robotics Sawyer, and ABB YuMi. | {
"domain": "robotics.stackexchange",
"id": 744,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "robotic-arm",
"url": null
} |
lathe
Conversely, the tools I was asking about in this question have "positive lead-angle". The reason these tools exist is to take advantage of this positive lead angle which cuts along a greater portion of the edge. This results in increased tool life since more of the edge is being utilized and distributes the cutting force along more area which helps reduce certain kinds of failures.
The disadvantage is increased cutting forces for the same depth of cut, increased radial forces, and greater potential for chatter. The increased radial forces result in more part deflection and less cut precision.
What this means is that tools with positive lead-angle tend to best for roughing where tool life and speed matter more than finish and precision. | {
"domain": "engineering.stackexchange",
"id": 4576,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lathe",
"url": null
} |
homework-and-exercises, electromagnetism, gauge-theory, dirac-equation, spinors
step in the right direction? What you have is a good start. If we make the usual assignments that ${\partial\over{\partial t}} \to -iE$ and $\nabla \to i{\bf p}$ then we get$$(E - e\Phi)\psi = (\alpha \cdot ({\bf p} - e{\bf A}) + m\beta)\psi.$$Now, pick a particular representation$$\beta = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix},\text{ }\alpha_i = \begin{pmatrix} 0 & \sigma^i \\ \sigma^i & 0\end{pmatrix}.$$It is easy to check that these give the correct anti-commutation relations. Then if we denote$$\psi = \begin{pmatrix} \chi \\ \varphi\end{pmatrix}$$and plug this into the Dirac equation we obtain$$(E - e\Phi)\begin{pmatrix} \chi \\ \varphi\end{pmatrix} = \sigma \cdot ({\bf p} - e{\bf A})\begin{pmatrix} \varphi \\ \chi\end{pmatrix} + m\begin{pmatrix} \chi \\ -\varphi\end{pmatrix}.$$If we note that the nonrelativistic energy $E'$ is related to the relativistic by $E' = E - m$ then the equation becomes$$E'\begin{pmatrix} \chi \\ \varphi\end{pmatrix} = \sigma \cdot ({\bf p} - E{\bf | {
"domain": "physics.stackexchange",
"id": 18659,
"lm_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, electromagnetism, gauge-theory, dirac-equation, spinors",
"url": null
} |
file-formats
So you should be able to use your base letters here and it will work OK as long as the columns and rows are formatted correctly. | {
"domain": "bioinformatics.stackexchange",
"id": 1566,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "file-formats",
"url": null
} |
rviz
...
File "/opt/ros/groovy/stacks/pr2_navigation/pr2_move_base/scripts/pr2_move_base.py", line 45, in
from pr2_msgs.msg import LaserTrajCmd
ImportError: No module named pr2_msgs.msg
[r_arm_controller/joint_trajectory_generator-12] process has died [pid 28721, exit code -6, cmd /opt/ros/groovy/stacks/pr2_common_actions/joint_trajectory_generator/bin/joint_trajectory_generator __name:=joint_trajectory_generator __log:=/home/jiwung/.ros/log/4f4c7f06-0aad-11e4-beb3-a01d48be97cc/r_arm_controller-joint_trajectory_generator-12.log].
log file: /home/jiwung/.ros/log/4f4c7f06-0aad-11e4-beb3-a01d48be97cc/r_arm_controller-joint_trajectory_generator-12*.log | {
"domain": "robotics.stackexchange",
"id": 18593,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rviz",
"url": null
} |
c++, memory-management, thread-safety
Set bogusIndex to std::numeric_limits<std::size_t>::max()
Even if you cannot think of a use case for an object pool of 65535 or more items now, consider that you might need it in the future, or someone else using your code might. If you are going to use a special value for index to indicate that an Item doesn't need to be released, give it a value that really can never be a valid index, like the maximum possible value for a std::size_t.
Use notify_one()
When you release an Item back to the pool, it doesn't make sense to wake up all threads that are waiting. Only one will be able to get the Item that was just released. So use notify_one() instead.
Consider supporting non-copyable value types
Since you store the objects in a std::vector, this requires T to be copy-assignable and copy-constructible. Consider storing them in some way that does not have this limitation, for example by using a std::deque instead.
Item's move constructor should std::move the object | {
"domain": "codereview.stackexchange",
"id": 42792,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, memory-management, thread-safety",
"url": null
} |
Question:
How can the author state $\mathbb{Z}_2\times\mathbb{Z}_2$ has order $4$? Is $\langle 1_2,1_2\rangle$ not a generator of order 2 of $\mathbb{Z}_2\times\mathbb{Z}_2$?
• Remember that the order of a group is a somewhat distinct concept from the order of an element. The order of a group is the cardinality of that group (in this case, 4---the elements can be explicitly written fairly easily), while the order of an element $a$ is the smallest natural number $n$ such that $a^n$ is the identity (here, the maximal order of an element is 2). – Xander Henderson Nov 29 '17 at 18:54
• The order of a group means its size. – Ittay Weiss Nov 29 '17 at 18:54
• $(1,1)$ does not generate the element $(0,1)$ – Doug M Nov 29 '17 at 18:55
• $\langle 1, 1\rangle$ only generates all of $\Bbb Z_n\times \Bbb Z_m$ if the greatest common factor of $n$ and $m$ is 1. Here it is 2. – MJD Nov 29 '17 at 18:57 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9907319863454374,
"lm_q1q2_score": 0.8709988169897213,
"lm_q2_score": 0.8791467611766711,
"openwebmath_perplexity": 134.47650964410383,
"openwebmath_score": 0.7105020880699158,
"tags": null,
"url": "https://math.stackexchange.com/questions/2543272/mathbbz-2-times-mathbbz-2-has-order-4-how-so/2543281"
} |
c, hash-map
#include "dictionary.h"
#undef calculate
#undef getrusage
// default dictionary
#define DICTIONARY "dictionaries/large"
// prototype
double calculate(const struct rusage* b, const struct rusage* a);
int main(int argc, char* argv[])
{
// check for correct number of args
if (argc != 2 && argc != 3)
{
printf("Usage: speller [dictionary] text\n");
return 1;
}
// structs for timing data
struct rusage before, after;
// benchmarks
double time_load = 0.0, time_check = 0.0, time_size = 0.0, time_unload = 0.0;
// determine dictionary to use
char* dictionary = (argc == 3) ? argv[1] : DICTIONARY;
// load dictionary
getrusage(RUSAGE_SELF, &before);
bool loaded = load(dictionary); // THIS IS LOAD
getrusage(RUSAGE_SELF, &after);
// abort if dictionary not loaded
if (!loaded)
{
return 1;
}
// calculate time to load dictionary
time_load = calculate(&before, &after); | {
"domain": "codereview.stackexchange",
"id": 22012,
"lm_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, hash-map",
"url": null
} |
python, algorithm, python-3.x, programming-challenge, recursion
# Draw the pegs
for i, row in enumerate(drawing):
for center in peg_centers:
drawing[i][center] = "P"
# Draw the base
drawing[-1][:] = ["G"] * total_width
# Draw the rings
for peg in peg_to_ring:
for i, ring in enumerate(peg_to_ring[peg], 2):
index = -i
center = peg_centers[peg]
drawing[index][center - ring : center] = [
"R"
] * ring
drawing[index][
center + 1 : center + ring + 1
] = ["R"] * ring
print("\r\n".join(["".join(row) for row in drawing]))
def visualize_tower_movements(
number_rings: int, moves: Iterable[Tuple[Peg, Peg]]
):
"""
Visualization tool for drawing the movement of rings in a Tower of Hanoi puzzle.
Parameters
----------
number_rings : int
The number of rings in the puzzle
moves : iterable
The set of moves performed while working on the puzzle
""" | {
"domain": "codereview.stackexchange",
"id": 35915,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, algorithm, python-3.x, programming-challenge, recursion",
"url": null
} |
the process slightly all the of! A shape, where the elastic neutral axes cross of gravity = 2.5 \, \text { in their! The points around and note how the centroids of each area are shown as pluses, and! Informally, it is the point at which a cutout of the triangle separates the in... 726 area enclosed by parabola and straigh line | centroid of an through. Why you remain in the case of plane figures, the notion of centre of area... Graphical Educational content for Mathematics, Science, Mathematics, Physics and Electrical Engineering basics the most sellers! Covered well is plastic behavior in bending, and in particular locating the plastic neutral axis defined the... Channel ’ s not typically covered well is plastic behavior in bending, and others use of. One of the triangle separates the median in the form of Java applets and visuals. Weighted by their respective values centroid formulas Engineering Mechanics centroid formulas Engineering centroid. The points around and note how the | {
"domain": "comosystems.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9597620585273154,
"lm_q1q2_score": 0.8176719803967575,
"lm_q2_score": 0.8519528076067262,
"openwebmath_perplexity": 2120.2227978662204,
"openwebmath_score": 0.48041167855262756,
"tags": null,
"url": "https://comosystems.com/rmmnrk0/a9d2d1-centroid-in-mechanics"
} |
c#, .net
public float Height
{
get { return height; }
}
public bool[] HasSides
{
get { return hasSides; }
}
public bool this[int i]
{
get { return hasSides[i]; }
}
}
Completely agree with Jesse concerning mutable structs - it's hard to always remember to mutate proper variable.
If you're very concerned about memory consumption (if that's the main reason for using mutable structs) I would rather use a bitmap for storing hasSides.
I'll also use simplification of CheckBounds proposed by Jesse (and ReSharper :)).
Dictionary (that MattDavey suggested to improve) is not needed at all... I don't see the reason for creating collection of hexagons just to iterate on it later, it's better to do the "EvaluateNeighbor" inline.
And the last simplification that will reduce most of the code: all your CheckBounds can be combined in a simple loop if you extract the definition of "neighbors" in a separate array. | {
"domain": "codereview.stackexchange",
"id": 3563,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, .net",
"url": null
} |
entropy, free-energy
However this seems counter-intuitive because when micelles form, they come together. Shouldn't this actually decrease the entropy? You are forgetting that the micelles form in water which is polar and forms hydrogen bonds. The micelle formation is primarily entropically driven. For isolated surfactant molecules the polar head groups can stabilise water molecules around them, but the hydrocarbon chain is hydrophobic and so polar water has to bridge over this part of the molecule forming specific hydrogen bonds to do so. This reduces the water's entropy as these water molecules are more or less fixed in place. As more surfactant is added more water is forced into in this relatively low entropy state. At and above the CMC it is entropically more favourable to form a micelle. Lots of water molecules are now free up to take their normal behaviour, with increase in entropy, as the surfactant tails largely cluster together inside the micelle and the polar head groups are on the surface and | {
"domain": "chemistry.stackexchange",
"id": 17931,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "entropy, free-energy",
"url": null
} |
That is, the rate of change function for $f(x)=b^x$ is a product of $b^x$ and the expression $\dfrac{b^h-1}{h}$. We cannot let $h=0$ because $\frac{b^0-1}{0}=\frac{0}{0}$, which is undefined.
The question we must answer, then, is whether $\frac{b^h-1}{h}$ represents a number when $h$ is indistinguishable from zero but not equal to zero.
\color{red}{\text{(Eq. 6.3.13)}}\qquad \begin{align} f(x)&=b^x,\,b\gt 0\\[2ex] r(x)&=\frac{f(x+h)-f(x)}{h},\, h\neq 0\\[1ex] &=\frac{b^{x+h}-b^x}{h}\\[1ex] &=\frac{b^xb^h-b^x}{h}\\[1ex] &=\frac{b^x\left(b^h-1\right)}{h}\\[1ex] &=b^x\left(\frac{b^h-1}{h}\right) \end{align}
Equation 6.3.13 ends with $b^x$ multiplied by $(b^h-1)/h$. At this moment we don't know what to make of $(b^h-1)/h$.
Figure 6.3.9 investigates the behavior of $\dfrac{b^x-1}{x}$ around $x=0$ for various values of b from 0 to 500.
• For $b=0$, $\dfrac{b^x-1}{x}$ has $x=0$ as a vertical asymptote. | {
"domain": "patthompson.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9899864276041908,
"lm_q1q2_score": 0.822820336777314,
"lm_q2_score": 0.8311430478583168,
"openwebmath_perplexity": 486.6490195661937,
"openwebmath_score": 0.9101719856262207,
"tags": null,
"url": "http://patthompson.net/ThompsonCalc/section_6_3.html"
} |
statistical-mechanics, ising-model
$$\frac{A}{2}N + \frac{A}{2}\sum_{i=1}^N S_i$$
the second one instead is:
$$\frac{1}{8}\sum_{i,j} B_{ij} + \frac{1}{8}\sum_{i,j} B_{ij} (S_i+S_j) + \frac{1}{8}\sum_{i,j} B_{ij}S_iS_j $$
Assuming $B_{ij}=B_{ji}$ you can write $\sum_{i,j} B_{ij} (S_i+S_j) = 2\sum_{i,j} B_{ij}S_i$ by simply swapping the indices' names in the sum. Finally, assuming $B_{ij} = B$ for nearest neighbours and $0$ otherwise, the interacting term becomes:
$$\frac{BzN}{8} + \frac{Bz}{4}\sum_{i} S_i + \frac{B}{8}\sum_{\left\langle i,j \right\rangle} S_iS_j $$
(Here $z$ is the number of nearest neighbours). Putting everything together you get:
$$ H = \left( \frac{AN}{2}+\frac{BzN}{8} \right) + \left( \frac{A}{2}+\frac{Bz}{4} \right) \sum_{i} S_i + \frac{B}{8}\sum_{\left\langle i,j \right\rangle} S_iS_j $$
Now you set $h=-\left( \frac{A}{2}+\frac{Bz}{4} \right)$; $J=-B/8$ and you have Ising hamiltonian rescaled by a constant, which is not important for any thermodynamical property. | {
"domain": "physics.stackexchange",
"id": 43622,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statistical-mechanics, ising-model",
"url": null
} |
quantum-mechanics, hilbert-space, wavefunction, schroedinger-equation, quantum-states
$$ \langle x|x'\rangle=\delta(x-x')\Rightarrow \langle x|x\rangle=\infty$$
But clearly $|x\rangle$ is a physical state as wavefunction collapses to that after measurement. So definitely the definition by Griffiths is not completely correct. I came across about Rigged Hilbert space while searching in Stack but I am still not completely sure whether all physical states lie in Rigged Hilbert space or all states in Rigged Hilbert space are physical. So, my question is what are the necessary and sufficient conditions for a wavefunction to be physically possible? If you want to use the theory of probability, a necessary condition for a wavefunction to be physically meanigful is $$\psi \in L^2(\mathbb{R}^3,d^3x)\:.$$ That is because, as a basic postulate of QM, we have that:
$\qquad\qquad\qquad\qquad$ $|\psi(x)|^2$ is the probability density to find the particle at $x$,
and the total probability must be $1$:
$$\int_{\mathbb{R}^3} |\psi(x)|^2 d^3x =1 <+\infty$$ | {
"domain": "physics.stackexchange",
"id": 76043,
"lm_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, hilbert-space, wavefunction, schroedinger-equation, quantum-states",
"url": null
} |
reinforcement-learning, ai, openai-gym
In reality the tree is huge, and running actual graph algos like breadth first search is unfeasible. You would likely need heuristics. Firstly symmetry can cut it down a few fold, but probably not by orders of magnitude (depending on the exact game rules). A very common strategy is to devise a way of "scoring" the board to figure out how strong is each player's position. This vastly simplifies the search, instead of trying to find a path you just try to go to the best adjacent node, and hope that if you keep doing that you'll automatically get to a win state. This is effectively a greedy strategy, and cannot so gambits by temporarily revealing weakness to trap the opponent. Also, it will only work as good as the scoring heuristic, which may or may not be hard to compose. You could try collecting statistics on past games as a naive way of finding states that seem like they tend to decide the outcome. | {
"domain": "datascience.stackexchange",
"id": 4480,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reinforcement-learning, ai, openai-gym",
"url": null
} |
php
Title: Retrieving user details from a custom form I have been working on a Magento module for sometime now (not because it is a large module, it's my first and I really struggled with it). I now have it working, which I was really pleased with at first, but now I would like to improve it by increasing the reusability of the code.
While making my module I have looked at other modules to learn from them and have seen that many actions are only a line or two and I have tried keeping in with the skinny controller approach but failed, my example is as follows:
I have a function that get a users details that they have inputted into a custom form.
protected function _setPostData()
{
$this->_salutation = $this->getRequest()->getPost('salutation');
$this->_f_name = $this->getRequest()->getPost('f_name');
$this->_l_name = $this->getRequest()->getPost('l_name');
$this->_email = $this->getRequest()->getPost('email'); | {
"domain": "codereview.stackexchange",
"id": 5173,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php",
"url": null
} |
c++, beginner, queue
}
explicit queue(queue<value_type> &&oth) noexcept : queue() {
if (std::is_destructible<value_type>::value)
clear();
m_Size = oth.size();
m_CheckOrAlloc(m_Size);
std::uninitialized_move(oth.begin(), oth.end(), m_RawData);
}
template <class It> queue(It begin, It end) noexcept : queue() {
assert(begin <= end);
size_type f_size = std::distance(begin, end);
m_CheckOrAlloc(f_size);
m_Size = f_size;
std::uninitialized_copy(begin, end, m_RawData);
}
explicit queue(const queue<value_type> &&oth) = delete;
iterator begin() noexcept { return iterator(m_RawData); }
iterator end() noexcept { return iterator(m_RawData + size()); }
reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
reverse_iterator rend() noexcept { return reverse_iterator(begin()); } | {
"domain": "codereview.stackexchange",
"id": 40871,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, beginner, queue",
"url": null
} |
ros-diamondback
deb http://archive.ubuntu.com/ubuntu maverick universe
deb-src http://archive.ubuntu.com/ubuntu maverick universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu maverick multiverse
deb-src http://archive.ubuntu.com/ubuntu maverick multiverse
## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team. | {
"domain": "robotics.stackexchange",
"id": 6380,
"lm_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-diamondback",
"url": null
} |
c++, multithreading, random, c++14, numerical-methods
for (std::size_t i=0;i<256;i++)
{
for (std::size_t j=0;j<16;j++)
{
st_c[16*i+j] = st_b[i]+off3[j];
st_c[16*i+j] = smix(st_c[16*i+j],sbox_i3);
}
} | {
"domain": "codereview.stackexchange",
"id": 23530,
"lm_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++, multithreading, random, c++14, numerical-methods",
"url": null
} |
• None of these are prime models of $T$ -- it can have no prime models, because it's not complete. – tomasz Apr 18 '13 at 18:54
• No, but they're all prime models of their complete theories. Since "prime model" only makes sense for complete theories, the assertion "M is prime" should mean "M is a prime model of Th(M)". – Alex Kruckman Apr 18 '13 at 19:20
• Ah, I see now that the question asked whether they are prime models of T. I missed that the first time. – Alex Kruckman Apr 18 '13 at 19:24
• I'm a little confused. Why are you saying "All four" of these models are saturated? – FPP Apr 22 '13 at 16:31
• I mean that each of your four models $\mathfrak{A}_0$, $\mathfrak{A}_1$, $\mathfrak{A}_2$, and $\mathfrak{A}_3$, is saturated. Which part is confusing you? – Alex Kruckman Apr 22 '13 at 17:32 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9752018398044143,
"lm_q1q2_score": 0.8147650785148002,
"lm_q2_score": 0.8354835330070838,
"openwebmath_perplexity": 229.01679077801822,
"openwebmath_score": 0.8790276050567627,
"tags": null,
"url": "https://math.stackexchange.com/questions/365150/classification-of-models"
} |
navigation, pose, rviz, amcl, 2d-pose-estimate
Frame: plate_link published by unknown_publisher Average Delay: -0.696657 Max Delay: 0
Frame: wheel_link_bl published by unknown_publisher Average Delay: -0.189068 Max Delay: 0
Frame: wheel_link_br published by unknown_publisher Average Delay: -0.189066 Max Delay: 0
Frame: wheel_link_fl published by unknown_publisher Average Delay: -0.189065 Max Delay: 0
Frame: wheel_link_fr published by unknown_publisher Average Delay: -0.189064 Max Delay: 0
All Broadcasters:
Node: unknown_publisher 199.909 Hz, Average Delay: -0.354249 Max Delay: 0 | {
"domain": "robotics.stackexchange",
"id": 31264,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, pose, rviz, amcl, 2d-pose-estimate",
"url": null
} |
java, object-oriented, minesweeper
GameParamsWindow.java
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.text.DocumentFilter;
import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException; | {
"domain": "codereview.stackexchange",
"id": 42314,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, object-oriented, minesweeper",
"url": null
} |
javascript, functional-programming
Maybe the usage example you show is not very meaningful, but I am having a hard time understanding function signature for gather().
What is the difference between the two key and value labels parameters and the columns specified passed from columns array parameter?
The signature does not make it clear to me as to which fields in the input data are to be assigned to the Letter and Value properties (for this example) in the output array.
The parameter naming doesn't seem to make sense. Why is one called key_label and one called value_label when both are used as keys in the output structure?
From looking at this signature, how is one to determine what the logic is that is to be applied in "splitting" apart the input records?
Do the with_fields() and split_record() methods have any value outside the context of the gather() function? If not, consider nesting them inside gather as "private" functions only in context of gather();
Stylistically: | {
"domain": "codereview.stackexchange",
"id": 22650,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, functional-programming",
"url": null
} |
parsing, haskell, homework, monads, prolog
operators = "()[];"
smileyOperator = ":-"
openParen = "("
closeParen = ")"
comma = ","
dot = "."
parse :: [Token] -> [Rule]
parse [] = []
parse ts =
let (rule, ts') = parseRule ts
in (rule : parse ts')
parseRule :: [Token] -> (Rule, [Token])
parseRule [] = error "No tokens to parse"
parseRule ts =
if null ts' || token (head ts') /= dot then
(rule, ts')
else
(rule, tail ts')
where (rule, ts') = parseRule' ts | {
"domain": "codereview.stackexchange",
"id": 19220,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "parsing, haskell, homework, monads, prolog",
"url": null
} |
black-holes, event-horizon, reversibility
Title: Is a black hole an ideal one-way function? Edit: while asking this question I had mixed up 'one way function' and (just in general) 'one way nature' (since, a black hole has this 'kind of nature', stuff can go in but not out) so, my apologies.
Just to add a example of 'why' black holes has this nature is, because all possible 'directions' a 'thing' can take, points into the black hole. This is probably where I got confused. A one way function is, something that takes a input, and produces a output, which by definition is hard to 'reverse' given only that output.
Where's a black hole takes in but does not output anything (or, not anything of 'value' that is) (maybe hawking radiation, but not any 'thing').
Even if this doesn't make the question re-openable I decided I would clarify it anyway.
Note I am studying Physics just for fun, I am in no university yet.
(As my other questions on this site point out.) | {
"domain": "physics.stackexchange",
"id": 92696,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "black-holes, event-horizon, reversibility",
"url": null
} |
c, assembly, fpga
outer: subi r4,r4,1 # decrement outer counter
#call pollkey
br delay
fin: ret
Update
I have updated the program which behaves as expected. The changes is that I needed one action every millisecond and one action every second, so I used a modulo 1000 count.
#include <stdio.h>
#include "system.h"
#include "altera_avalon_pio_regs.h"
extern void puttime(int* timeloc);
extern void puthex(int time);
extern void tick(int* timeloc);
extern void delay(int millisec);
extern int hexasc(int invalue);
#define TRUE 1
#define KEYS4 ( (unsigned int *) 0x840 )
int timeloc = 0x5957; /* startvalue given in hexadecimal/BCD-code */
int RUN = 0; | {
"domain": "codereview.stackexchange",
"id": 4477,
"lm_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, assembly, fpga",
"url": null
} |
organic-chemistry, reaction-mechanism
With a hypothetical atom mapping, now I can identify bonds broken and formed. C10 and its adjacent oxygens are being lost as carbon dioxide, which makes it easy to identify the bonds broken as C3-C10 and C6-O, with a shift of the pi-bond from C4-C5 to C5-C6. | {
"domain": "chemistry.stackexchange",
"id": 7989,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, reaction-mechanism",
"url": null
} |
bacteriology
These plasmids can be transfered between different bacterial cells, which then also get resistant. Plasmids are divided between daughter cells, when the parent cell divides. One of the few exceptions seems to be Mycobacterium tuberculosis, which does not seem to carry plasmids but also develops resistances. It has been hypothesized that they contain extrachromosomal single-stranded DNA ("Does Mycobacterium tuberculosis have plasmids?")
Regarding your question: Plasmids which carry antibiotic resistances will only disappear, when the antibiotic is not seen for a while, since the cells, which don't carry it, have a growth advantage over cells who are still carriers (since they save the energy of forming the plasmid). However, these resistance plasmids are nothing new, evolutionary speaking. They appeared as a countermeasure against fungal toxins. | {
"domain": "biology.stackexchange",
"id": 1955,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bacteriology",
"url": null
} |
array, go, comparative-review
The optimal implementation is still faster; it uses about 29% less CPU time (1496754 ns/op vs. average 2058088.5 ns/op) and about 99.9% less heap allocations (2 allocs/op vs. 2049 allocs/op). It's even faster for a zero initial value (32721 ns/op vs. average 2058088.5 ns/op).
In addition to the benchmarks, we could have used profiling.
File rectangle.go:
package rectangle
import (
"bytes"
)
// For loop using a for clause
func NewRectangleF(height, width int, value byte) [][]byte {
r := make([][]byte, 0, height)
for i := 0; i < height; i++ {
r = append(r, bytes.Repeat([]byte{value}, width))
}
return r
}
// For loop using a range clause
func NewRectangleR(height, width int, value byte) [][]byte {
r := make([][]byte, height)
for i := range r {
r[i] = bytes.Repeat([]byte{value}, width)
}
return r
} | {
"domain": "codereview.stackexchange",
"id": 8014,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "array, go, comparative-review",
"url": null
} |
aqueous-solution, solutions, concentration
Title: Finding the molarity of the combination of two solution reacting with each other I have a question that gives two concentrations and asks for the mass of $\ce{HCl}$ formed by the reaction.
$$\ce{H2SO4 + NaCl ->Na2SO4 + HCl}$$
I have two concentrations:
$\pu{250 mL}$ of $\pu{4.00 M}$ $\ce{H2SO4}$, and $\pu{250 mL}$ of $\pu{1.00 M}$ $\ce{NaCl}$.
Here is the balanced reaction equation:
$$\ce{H2SO4 + 2NaCl ->Na2SO4 + 2HCl}$$
I know how to find the mass once I find the moles, molecular weights and then grams by multiplying the two.
However, how do I add those two concentrations? I assume the mixture will be at least $\pu{500 mL}$, but how do I add the molarity? Your working equation is correct.
$$\ce{H2SO4 + 2NaCl ->Na2SO4 + 2HCl}$$
Find the amount of substance of protons of each solution via $n=c\cdot V$.
$n(\ce{H+})=2~\mathrm{mol}$, $n(\ce{Cl-})=0.25~\mathrm{mol}$
What is the limiting agent?
Chlorine
How many moles of hydrogen chloride can only be formed? | {
"domain": "chemistry.stackexchange",
"id": 1437,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "aqueous-solution, solutions, concentration",
"url": null
} |
newtonian-gravity, orbital-motion, geometry, approximations, celestial-mechanics
$$ y(x) = a_2^y x^2 +O(x^3)$$
because the absolute and linear terms were made to vanish by the choice of the coordinates. But neglecting the $x^3$ and other pieces, this is just an equation for a parabola.
(A similar comment would apply to $z(x)$ and one could actually rotate the coordinates in the $yz$ plane so that $a_2^z$ equals zero.)
So a "supershort piece" of a curve is always a straight line. With a better approximation, a "very short" piece is a parabola, and one may refine the acceptably accurate formulae by increasingly good approximations, by adding one power after another. | {
"domain": "physics.stackexchange",
"id": 11690,
"lm_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-gravity, orbital-motion, geometry, approximations, celestial-mechanics",
"url": null
} |
• This makes sense, thank you :) – Veta Feb 3 '15 at 7:24
FToA never claimed the roots were distinct.
And if both roots are zero, then does the FToA say we can have roots that are the same number?
Have you considered reading the FToA for yourself? http://en.wikipedia.org/wiki/Fundamental_theorem_of_algebra
Anyway, the point of the FToA is that every polynomial splits over $\mathbb C$ (into linear factors). This is not true over e.g. $\mathbb R$ where $f=x^2+1$ does not split.
• Thanks, I guess that's the disadvantage of reading less technical descriptions :) – Veta Feb 3 '15 at 7:23 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9873750525759487,
"lm_q1q2_score": 0.802604917401322,
"lm_q2_score": 0.8128673246376009,
"openwebmath_perplexity": 240.83057536983105,
"openwebmath_score": 0.9321878552436829,
"tags": null,
"url": "https://math.stackexchange.com/questions/1131525/fundamental-theorem-of-algebra-what-are-two-roots-for-x2"
} |
particle-physics, cosmology, standard-model, protons, quark-gluon-plasma
Question:
How exactly does the quark gluon plasma prevent protons from forming? A proton in a quark-gluon plasma would be like a water droplet underwater. The idea of a droplet includes a boundary and a surrounding non-water region. The higher the energy density of quark matter, the less likely it is that all of the quarks but three will separate from three of the quarks by enough distance, and for enough time, that you could reasonably say that a proton existed. It's not absolutely impossible, just very unlikely.
At a lower energy density, it becomes energetically favorable for pockets of vacuum to form, and the quark-gluon plasma breaks apart into hadrons. Before that happens, the quarks are "free" inside what amounts to a giant, universe-spanning hadron, not free in vacuum. It's impossible for quarks to be free in vacuum. | {
"domain": "physics.stackexchange",
"id": 81998,
"lm_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, cosmology, standard-model, protons, quark-gluon-plasma",
"url": null
} |
electrostatics, electric-fields, potential-energy
$$
For this example, evaluating at $\vec r = 0$ we have:
$$
U(0) = k_e q Q \left(\frac{1}{|L\hat x|} + \frac{1}{|L\hat x|}\right)
=k_e q Q \frac{2}{L}
\neq 0
$$
and we have:
$$
\phi(0) = k_e Q\left(\frac{1}{|L\hat x|} + \frac{1}{| L\hat x|}\right)
=k_e Q \frac{2}{L}
\neq 0
$$
and we have:
$$
\vec E(0) = k_e Q\left(\frac{(-L\hat x)}{|L\hat x|^3} + \frac{(L\hat x)}{|L\hat x|^3}\right)
=k_e Q \frac{(-L\hat x+ L\hat x)}{|L|^3}
= 0
$$ | {
"domain": "physics.stackexchange",
"id": 91684,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics, electric-fields, potential-energy",
"url": null
} |
electromagnetism, thermodynamics, entropy
Title: Second law of thermodynamics and a bunch of magnets Say I put a bunch of powerful square magnets on a nearly frictionless table in a disordered fashion. The second law of thermodynamics states that the system shall spontaneously get more disordered, yet the magnets will attract each other and form a chain (typically), thereby increasing the order of the system-and, seemingly, decreasing its entropy.
It would seem to me that the system is closed and the lattice is indeed the equilibrium state. Therefore, I suspect that by attracting each other, the magnets increase their own entropy by a larger amount than the decrease in entropy caused by the lattice formation. Is it true? If yes, what are the thermodynamics of magnets responsible for this? Is there a microscopic explanation? | {
"domain": "physics.stackexchange",
"id": 2013,
"lm_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, thermodynamics, entropy",
"url": null
} |
astrophysics, astronomy, stellar-physics, star-clusters
But, it is usually the case that several stars in a cluster are observed along the main sequence past the turnoff point, and these are referred to as blue stragglers. The most likely explanation for blue stragglers seems to be that they are the result of stellar collisions or mass transfer from another star. That way, a star which is red, cool and already somewhat old can get extra mass and turn bluer. It spent most of its life as a red star and therefore burnt its hydrogen at a slow enough rate to still be on the main sequence, but then at a certain point it gets extra mass and effectively "disguises" itself as a blue star, which makes us think it is younger than it really is. | {
"domain": "physics.stackexchange",
"id": 3156,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astrophysics, astronomy, stellar-physics, star-clusters",
"url": null
} |
Effective Annual Interest Rates • Here, we show how to calculate true, effective, annual interest rates. • We assume the year is the standard of measure for time. • The year can be comprised of various numbers of compounding periods (within the year). Convert a nominal interest rate from one compounding frequency to another while keeping the effective interest rate constant. For example, you have a loan at an annual rate of 4% that compounds monthly (m=12) however your payments are made quarterly (q=4) so your interest will be calculated quarterly. Calculate the effective annual rate (EAR) from the nominal annual interest rate and the number of compounding periods per year. Effective annual rate calculator can be used to compare different loans with different annual rates and/or different compounding terms. nominal and effective annual rates are equivalent for annual compounding true effective annual rate increases with increasing compounding frequency, up to a limit that occurs with | {
"domain": "netlify.app",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138092657495,
"lm_q1q2_score": 0.8060878085237139,
"lm_q2_score": 0.8244619242200082,
"openwebmath_perplexity": 997.5839552230835,
"openwebmath_score": 0.7044864892959595,
"tags": null,
"url": "https://topbinhxyow.netlify.app/albery11656lo/the-nominal-and-effective-rates-are-equivalent-for-annual-compounding-323.html"
} |
gravity, jupiter, roche-limit
Title: Is there any orbit at which the Roche limit can be "felt"? Do any of the planets have a Roche limit that is strong enough to be felt by an astronaut whilst in orbit? Roche limit happens where the gravity of the object, trying to pull the object together, becomes smaller than the tidal force (trying to pull the object apart).
But the astronaut is bound by not gravity, rather by the electromagnetic interaction between his/her atoms. The own gravity of the astronaut is negligible, compared to the electromagnetic interaction.
However, the tidal force affecting an astronaut, should require a little calculation. We can derive the formula of the gravitational acceleration around a point-like body ($F=\frac{GM}{r^2}$), we get
$$\frac{dF}{dr}=\frac{2GM}{r^3}$$
(We can ignore the sign on obvious reasons.)
Here $G$ is the gravitational constant, $M$ is the mass of the body, and $r$ is the distance. | {
"domain": "astronomy.stackexchange",
"id": 3028,
"lm_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, jupiter, roche-limit",
"url": null
} |
compilers, functional-programming, haskell, imperative-programming
What is considered a "functional" language? Every practical functional language has some facilities for mutable state: OCaml, Haskell, Scala, Lisp, Scheme, etc. Tail recursion gives something roughly equivalent to mutation inside of a for-loop. But when this is not enough, functional languages give the programmer access to mutable state. In the case of Haskell, this is controlled by the type system, so there is never implicit mutable state, but mutation is very much allowed and even encouraged in Haskell. Look at any Haskell code, and you will see the IO monad everywhere. Likewise, ML languages distinguish between types T and ref T, so you can tell by the types whether a variable is mutable or not. | {
"domain": "cs.stackexchange",
"id": 16868,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "compilers, functional-programming, haskell, imperative-programming",
"url": null
} |
general-relativity, metric-tensor
What are the components of $\partial_\mu$? For any basis, the components of the $\mu$-th basis vector in that basis is given by $(0,0,...,1,...0)$ where the 1 is in the $\mu$-th spot, so $(\partial_\mu)^\nu=\delta_\mu^\nu$ (in this coordinate system only), therefore $$ (\mathbf{e}_\alpha)^\mu=\frac{\delta_\alpha^\mu}{\sqrt{|g_{\alpha\alpha}|}}=\text{diag}\left(\sqrt{1-\frac{2GM}{r}}^{-1},\sqrt{1-\frac{2GM}{r}},\frac{1}{r},\frac{1}{r\sin\vartheta}\right). $$ | {
"domain": "physics.stackexchange",
"id": 37043,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, metric-tensor",
"url": null
} |
physical-chemistry, thermodynamics
Title: What is the reason behind the phenomenon of Joule-Thomson effect? For an ideal gas there is no heating or cooling during an adiabatic expansion or contraction, but for real gases, an adiabatic expansion or contraction is generally accompanied by a heating or cooling effect. What is the reason behind such a phenomenon? Is it related to the property of real gases or is it something else? In a reversible adiabatic expansion or compression, the temperature of an ideal gas does change. | {
"domain": "chemistry.stackexchange",
"id": 9838,
"lm_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
} |
bash, file-system, linux
[ $a="t" ] && sudo mount /dev/sba /media/ba # I'll actually use uuids.
[ $b="t" ] && sudo mount /dev/sbb /media/bb # Not direct paths, like here.
[ $c="t" ] && sudo mount /dev/sbc /media/bc
To me, this code is redundant. Is there any more efficient/better way to do it ?
Which language should I use for this task? Bugs
First of all, you have some bugs, all of this type:
[ $1="b"]
There are multiple problems here:
syntax error: there must be a space before the closing ]
syntax error: there must be spaces around the =
buggy: if $1 contains spaces, the script will crash
pointless: no need to quote "b"
This would be correct and better:
[ "$1" = b ]
But actually, [ ... ] is obsoleted in favor of [[ ... ]].
Today, it's recommend to use [[ ... ]],
which is less troublesome to write,
for example you don't need to quote $1, this is correct:
[[ $1 = b ]] | {
"domain": "codereview.stackexchange",
"id": 10743,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bash, file-system, linux",
"url": null
} |
java, concurrency
}
private final PassThrough simplepass = new PassThrough();
private final ConcurrentHashMap<K, V> store = new ConcurrentHashMap<>();
private final AtomicReference<PassThrough> core = new AtomicReference<>(simplepass);
public V get(K key) {
return core.get().get(key);
}
public V put(K key, V val) {
return core.get().put(key, val);
}
public V remove(K key) {
return core.get().remove(key);
} | {
"domain": "codereview.stackexchange",
"id": 9919,
"lm_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, concurrency",
"url": null
} |
java, graph, depth-first-search
I think my implementation is correct, but I'm very new to graphs and would appreciate a review of my implementation.
Here is the actual code:
DfsSimulator
public class DfsSimulator {
public static void main(String[] args) {
int[] vertices = {1,2,3,4,5,6,7};
int[][] edges = {{1,2},{1,6},{2,3},{2,4},{2,5},{3,5},{4,5},{5,1},{6,4},{6,7}};
Graph graph = new AdjacencyList(vertices.length);
for(int i = 0; i < edges.length; i++) {
graph.addEdge(edges[i][0], edges[i][1]);
}
Searcher search = new Searcher(graph);
search.dfs(graph.getAdj(), vertices[0]);
}
}
Graph
import java.util.List;
import java.util.ArrayList;
public interface Graph {
public void addEdge(int i, int j);
public void removeEdge(int i, int j);
public boolean hasEdge(int i, int j);
public List<Integer> outEdges(int i);
public List<Integer> inEdges(int i);
public int getNumberVertices();
public ArrayList<ArrayList<Integer>> getAdj();
} | {
"domain": "codereview.stackexchange",
"id": 15125,
"lm_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, graph, depth-first-search",
"url": null
} |
iau
Here's a typical schedule for almost every professional organization's large meeting: | {
"domain": "astronomy.stackexchange",
"id": 4261,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "iau",
"url": null
} |
cost O (n 2 ). Count ONLY comparisons in which one key is compared to another key (e. Insertion sort compares every single item with all the rest elements of the list, whereas shell sort uses a gap to compare items far apart from each other, and then recursively closes in the gap until all elements are sorted. Comparing the running of counting sort $$O(n + MAX)$$ vs selection sort $$O(n^2)$$, it is clear that counting sort is more efficient -- we say that counting sort is a linear time algorithm and selection sort is a quadratic time algorithm. Shifting items left or right is essentially swapping, but I want the optimal number for plucking an item out of line and switching its place with another. Answer: Bubble sort is sorting array element by comparing first element with the next one. Though the time complexity of Insertion sort is also O(n 2) but it is considered much faster than bubble sort because of less number of swaps and faster than Selection sort in. The algorithm sorts the | {
"domain": "recht-sozial-in-muenchen.de",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.96036116089903,
"lm_q1q2_score": 0.820064646301533,
"lm_q2_score": 0.8539127566694178,
"openwebmath_perplexity": 638.2732590261587,
"openwebmath_score": 0.31739869713783264,
"tags": null,
"url": "https://recht-sozial-in-muenchen.de/count-number-of-swaps-and-comparisons-in-insertion-sort.html"
} |
image-processing, matlab, estimation, dct
It is better suited to small patches, and possesses fast algorithms. There are other options, adaptations, but let's keep it simple for now.
So, assuming that one is working on patches, and computing covariance, DCT should be close to KLT in energy, and somehow better as one does not have to code vectors.
Below are previous answers related to properties of the DCT | {
"domain": "dsp.stackexchange",
"id": 8766,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "image-processing, matlab, estimation, dct",
"url": null
} |
javascript, timer, circular-list, callback
function limited() {
callQueue.push(() => {
invokeTimes.unshift(performance.now())
fn.apply(this, arguments);
});
It'll be simpler to just store the arguments lists in an array, instead of having an array of anonymous functions. You can update invokeTimes when you shift the callQueue in dequeue.
if (mayProceed()) {
return dequeue();
}
if (waitId === null) {
waitId = setTimeout(dequeue, timeToWait());
}
}
This logic is implemented in dequeue now. You can just call it.
function timeToWait() {
var ttw = RUN_WINDOW - timeForMaxRuns();
return ttw < 0 ? 0 : ttw;
}
The ternary expression can be replaced with Math.max(0, ttw).
limited.cancel = function() {
clearTimeout(waitId);
};
This cancels scheduled calls to the function, but they will be performed after calling the function again. Is this intended? | {
"domain": "codereview.stackexchange",
"id": 17035,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, timer, circular-list, callback",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.