text stringlengths 1 1.11k | source dict |
|---|---|
transform
In this case: rosrun tf_echo view_frames shows the frames and they are great.
And rosrun tf tf_echo map base_link gives:
At time 1409742686.330
- Translation: [4.626, -0.504, 0.000]
- Rotation: in Quaternion [0.000, 0.000, -0.205, 0.979]
in RPY [0.000, 0.000, -0.413]
At time 1409742687.237
- Translation: [4.626, -0.504, 0.000]
- Rotation: in Quaternion [0.000, 0.000, -0.205, 0.979]
in RPY [0.000, 0.000, -0.413]
At time 1409742688.337
- Translation: [4.626, -0.504, 0.000]
- Rotation: in Quaternion [0.000, 0.000, -0.205, 0.979]
in RPY [0.000, 0.000, -0.413]
At time 1409742689.247
- Translation: [4.626, -0.504, 0.000]
- Rotation: in Quaternion [0.000, 0.000, -0.205, 0.979]
in RPY [0.000, 0.000, -0.413]
^CAt time 1409742689.664
- Translation: [4.626, -0.504, 0.000]
- Rotation: in Quaternion [0.000, 0.000, -0.205, 0.979]
in RPY [0.000, 0.000, -0.413] | {
"domain": "robotics.stackexchange",
"id": 19280,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "transform",
"url": null
} |
Simplified variant of Collatz conjecture.
I came across the Collatz conjecture. So apparently the idea is to see if all prime factors of a number can be 'annihilated' by successive steps of either removing a factor of two, if n is even or in case it is not to transform it by a simple '(e.g. linear) transformation' to an even number. Now the algorithm to accomplish that is:
Take $n$ and generate the sequence $f^i(n)$, with
$$f(n) = \begin{cases} n/2 &\text{if } n \equiv 0 \pmod{2}\\ 3n+1 & \text{if } n\equiv 1 \pmod{2} .\end{cases}$$
It seems a tough problem. I thought about the following simplified version:
$$g_0(n) = \begin{cases} n/2 &\text{if } n \equiv 0 \pmod{2}\\ n+1 & \text{if } n\equiv 1 \pmod{2} .\end{cases}$$
The first question is can one show that all the sequences $g_0^i$ go to orbits $...,1,2,1,2,...$? | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9736446463891303,
"lm_q1q2_score": 0.8155441930081166,
"lm_q2_score": 0.8376199633332893,
"openwebmath_perplexity": 369.89647905243805,
"openwebmath_score": 0.8580964803695679,
"tags": null,
"url": "https://math.stackexchange.com/questions/1886290/simplified-variant-of-collatz-conjecture"
} |
c#, asp.net-mvc-4, dependency-injection
public ActionResult New()
{
var vm = new NewUserViewModel();
PopulateListItems(vm);
return View(vm);
}
[HttpPost]
public ActionResult Create(NewUserViewModel vm)
{
if (ModelState.IsValid)
{
userRepository.Add(vm.User);
return RedirectToAction("Index");
}
else
{
PopulateListItems(vm);
return View(vm);
}
}
private static void PopulateListItems(NewUserViewModel vm)
{
vm.Cities = _addressRepository.GetAllCities().Select(c => new SelectListItem() { Text = c.Name, Value = c.Id });
}
} | {
"domain": "codereview.stackexchange",
"id": 4661,
"lm_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#, asp.net-mvc-4, dependency-injection",
"url": null
} |
circuit-construction, measurement, projection-operator
I don't see why this is easy. How do we write down this circuit?
Also, I do not see why we need the fourier transform for this implementation. Why can't we just have $|{0} \rangle \langle{0}| $ for the second register. I am guessing its necessary for the implementation but I do not see why. The point of the second register is to initialize it in some state with an equal probability of being found in any basis state $|i\rangle$.
Then, conditioned on the state of the second register, one chooses which of the measurement procedures $M_i$ to perform on the state. Then the Fourier transform sets each of the projectors $\Lambda_i$ to have equal weight for the $|0\rangle$ state in the second register, and we can project onto that one to proceed. One could also project onto a different register state to avoid requiring $Q$ here. | {
"domain": "quantumcomputing.stackexchange",
"id": 5066,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "circuit-construction, measurement, projection-operator",
"url": null
} |
gravity, general-relativity, dark-matter
Title: How would "dark matter", subject only to gravity, behave? If we were to hypothesise that the Universe contained a significant mass of "dark matter" particles subject only to gravity, presumably general relativity would give us a good idea of how they would behave.
For example, what would happen in a region where they were the only mass? What you describe is the standard paradigm in cosmological physics, so it has been studied extensively. The basic consequence of dark matter not having significant nongravitational interactions is that it has no way to shed its orbital energy. Dark matter particles that cluster due to gravity cannot coalesce into disks or compact objects, because they retain the orbital velocities that they acquired upon first infall into a system. Thus, dark matter remains in the form of hot, diffuse "halos". | {
"domain": "astronomy.stackexchange",
"id": 6798,
"lm_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, general-relativity, dark-matter",
"url": null
} |
and do not require the walk to be closed, we call it an Euler path, and if a graph $$G$$ has an Eulerian path but not an Eulerian cycle, we say $$G$$ is semi-Eulerian Eulerian concepts and methods are thus used side-by-side in many investigations, and the premise of this essay is that an understanding of both systems and the relationships between them can help form the framework for a study of fluid mechanics. X-ray opaque tracers in human blood. Eulerian graph or Euler’s graph is a graph in which we draw the path between every vertices without retracing the path. v5 ! Nonetheless, the Eulerian model would spend less time if a grid with a low number of mesh cells is used, due to the mesh independency. Save. 2. Check Whether an Undirected Graph Contains a Eulerian Path Coordinate Point in XY Coordinate System C Program to read a coordinate point in a XY coordinate system & determine its quadrant. Eulerian models define specific reference points in a gridded system that monitors | {
"domain": "knhevelius.pl",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9441768588653856,
"lm_q1q2_score": 0.8080748545428159,
"lm_q2_score": 0.855851154320682,
"openwebmath_perplexity": 1173.8025448907829,
"openwebmath_score": 0.4884713590145111,
"tags": null,
"url": "http://knhevelius.pl/ueazq3s9/semi-eulerian-vs-eulerian-f2acbd"
} |
The proof of the main theorem uses the notion of shrinkable open covers.
Remarks
The main theorem is a classic result and is often used as motivation for more advanced results for products of normal spaces. Thus we would like to present a clear and complete proof of this classic result for anyone who would like to study the topics of normality (or the lack of) in product spaces. We found that some proofs of this result in the literature are hard to follow. In A. H. Stone’s paper [2], the result is stated in a footnote, stating that “it can be shown that the topological product of a metric space and a normal countably compact space is normal, though not necessarily paracompact”. We had seen several other papers citing [2] as a reference for the result. The Handbook [1] also has a proof (Corollary 4.10 in page 805), which we feel may not be the best proof to learn from. We found a good proof in [3] using the idea of shrinking of open covers. | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9914225128122336,
"lm_q1q2_score": 0.8082398475701057,
"lm_q2_score": 0.8152324938410784,
"openwebmath_perplexity": 1637.948484019525,
"openwebmath_score": 1.0000100135803223,
"tags": null,
"url": "https://dantopology.wordpress.com/tag/normal-space/"
} |
information-theory, terminology, kolmogorov-complexity
$A = 1010$ $1010$ $1010$ $1010$, and
$B = 1011$ $0110$ $0111$ $1001$. | {
"domain": "cs.stackexchange",
"id": 383,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "information-theory, terminology, kolmogorov-complexity",
"url": null
} |
c++
BookingSystem::BookingSystem(int capacity)
:reservationCount(0), capacity(capacity)
{
this->reservations = new Reservation * [this->capacity] {nullptr};
}
BookingSystem::~BookingSystem()
{
for (int i = 0; i < this->reservationCount; i++)
{
delete this->reservations;
}
delete[]this->reservations;
}
BookingSystem::BookingSystem(const BookingSystem& other)
{
this->capacity = other.capacity;
this->reservationCount = other.reservationCount;
this->reservations = new Reservation * [other.capacity] {nullptr };
for (int i = 0; i < reservationCount; i++)
{
this->reservations[i] = new Reservation(*other.reservations[i]);
}
}
BookingSystem& BookingSystem::operator=(const BookingSystem& other)
{
if (this != &other)
{
for (int i = 0; i < this->reservationCount; i++)
{
delete this->reservations[i];
}
delete[]this->reservations; | {
"domain": "codereview.stackexchange",
"id": 44114,
"lm_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++",
"url": null
} |
python, unit-testing, observer-pattern
The Observer abstract class has an abstract method update(), but two other non-abstract methods register_subject(self, subject) and remove_subject(self). So when I implement the concrete observers, it inherits these two methods. Is this a wrong way of using the Abstract Base Class?
I've recently started to unit test and have had some trouble formulating my tests (for this particular example I wrote the tests after the code, although I know it's better to write the tests first). A particular example: I test that the Observers are in fact registered with the Subject by looking to see that the observer instance is in the Subject._observer_list, but this list is hidden. Is it ok for the test to be looking there?
Any other comments or suggestions on the code?
Code
#!/usr/bin/env python
from abc import ABCMeta, abstractmethod
import unittest | {
"domain": "codereview.stackexchange",
"id": 3057,
"lm_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, unit-testing, observer-pattern",
"url": null
} |
kinect, openni, turtlebot, openni-kinect, ros-electric
There are a bunch of similar errors all with libraries from the same stack. I've tried reinstalling that stack but to no avail. Hopefully this is something really obvious that I'm missing.
Thanks!
Originally posted by selliott on ROS Answers with karma: 51 on 2012-05-16
Post score: 0
This looks like trouble between the version of libmysql that the debian packages were linked against at compile time and the version of libmysql that's installed on your system.
I can see a couple of possible causes here: | {
"domain": "robotics.stackexchange",
"id": 9423,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kinect, openni, turtlebot, openni-kinect, ros-electric",
"url": null
} |
##### Proof of Constant Step Size
With Descent Lemma, $f(x^{k + 1}) - f(x^k) \le - \overline{\alpha} \left| \nabla f(x^k)\right|^2 + \frac{L\overline \alpha^2}{2} \left| \nabla f(x^k)\right|^2 = \left[\frac{L\overline \alpha}{2} - 1\right]\overline \alpha \left| \nabla f(x^k)\right|^2$ As long as $\overline \alpha \in (0, \frac{2}{L})$, $(f(x^k))_k$ is decreasing and it must converge to some $\xi \in \mathbb R \cup {-\infty}$. We can ignore the unbounded cases. Since we meet the rolling sum again, and why not sum them up again?
$\left[\frac{L\overline \alpha}{2} - 1\right]\overline \alpha \sum_{k = 0}^M\left| \nabla f(x^k)\right|^2 \le \sum_{k = 0}^M \left[f(x^{k + 1}) - f(x^k)\right] = f(x^0) - f(x^{M + 1}) \le f(x^0) - \xi$
As $M \to \infty$, we can see that $\sum_{k = 0}^M\left| \nabla f(x^k)\right|^2$ convergent, so $\nabla f(x^k) \to 0, k \to \infty$
##### Proof of Armijo Linear Search and Exact Line Search | {
"domain": "zhuyi.fan",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9901401423688665,
"lm_q1q2_score": 0.8000997835824437,
"lm_q2_score": 0.8080672112416737,
"openwebmath_perplexity": 513.060857223317,
"openwebmath_score": 0.989271879196167,
"tags": null,
"url": "https://zhuyi.fan/post/selected-topics-on-gradient-descent-method.html"
} |
smach, ros-electric
self._publish_status('HEARTBEAT')
File "/opt/ros/electric/stacks/executive_smach/smach_ros/src/smach_ros/introspection.py", line 225, in _publish_status
self._status_pub.publish(state_msg)
File "/opt/ros/electric/stacks/ros_comm/clients/rospy/src/rospy/topics.py", line 695, in publish
self.impl.publish(data)
File "/opt/ros/electric/stacks/ros_comm/clients/rospy/src/rospy/topics.py", line 872, in publish
serialize_message(b, self.seq, message)
File "/opt/ros/electric/stacks/ros_comm/clients/rospy/src/rospy/msg.py", line 151, in serialize_message
msg.serialize(b)
File "/opt/ros/electric/stacks/executive_smach/smach_msgs/src/smach_msgs/msg/_SmachContainerStatus.py", line 120, in serialize
buff.write(struct.pack('<I%ss'%length, length, _x.encode()))
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128) | {
"domain": "robotics.stackexchange",
"id": 6568,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "smach, ros-electric",
"url": null
} |
human-biology, physiology, respiration, breathing, lungs
Title: Why does hyperventilation make you feel like you need to breathe more? Calm Clinic claims:
"The problem is that hyperventilation makes your body feel like you're not getting enough oxygen. Essentially, it makes you feel like you need to take deeper breaths and take in as much air as possible. This makes all of the symptoms of hyperventilation worse."
As far as I know, the brain controls breathing rate by measuring the amount of carbon dioxide in the blood. So is this true? If so, why? Hyperventilation alone does not cause you to feel that you're not getting enough oxygen. Rather, it's what causes hyperventilation that does that (thus resulting in hyperventilation.)
The Calm Clinic explains this quite well (while only mildly contradicting your quote): | {
"domain": "biology.stackexchange",
"id": 12242,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-biology, physiology, respiration, breathing, lungs",
"url": null
} |
thus to measure how far a region is from being simply connected, one can ask how many closed differentials in it fail to be exact.
for example, if we remove n points from the plane, there will still be exactly an n dimensional vector space of closed forms in that region, after we consider all exact forms to be zero.
\this measuring device is a big tool in topology called derham cohomology.
work done by gravity for example is exact so does not depend on the path taken by the object. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9702399060540359,
"lm_q1q2_score": 0.8085247750599567,
"lm_q2_score": 0.8333245932423308,
"openwebmath_perplexity": 509.6250525287462,
"openwebmath_score": 0.8162911534309387,
"tags": null,
"url": "https://www.physicsforums.com/threads/a-question-about-path-independence-and-curl-of-a-vector-field.54519/"
} |
homework-and-exercises, newtonian-mechanics, harmonic-oscillator, spring, oscillators
It's a little hard to follow your question because you haven't specified where you're measuring all these $x$ values from. I think, based on some of your equations, that you're measuring all distances from the original mass position and that positive $x$ points from that position to the driven end. Let's say that the force points in that direction too.
Then, a force balance at the mass end gives $k(x_D-x_S-l_0)=m\frac{d^2x_S}{dt^2}$.
A force balance at the driven end gives $k(x_D-x_S-l_0)=F\sin(\omega t)$.
Thus, we obtain $F\sin(\omega t)=m\frac{d^2x_S}{dt^2}$, reflecting the fact that the driven surface (having no inertia) moves instantly and that the spring (having no inertia) compresses or extends instantly to transmit the driving force immediately to the mass. | {
"domain": "physics.stackexchange",
"id": 95612,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, harmonic-oscillator, spring, oscillators",
"url": null
} |
homework-and-exercises, classical-mechanics, kinematics, projectile
Title: Formula - Bounce height with respect to time I'm trying to graph a bounce with respect to time. I have these formulas:
$\frac 12 mV_2^2 = mgH_2$
and
$H_2 = \frac{1}{2} \frac{V_2^2}{g}$
I will have a series of $H(t)$ formulas as I know how to get the next bounce's initial velocity (last bounce's final velocity * -(coefficient of restitution)).
Is there a way to get an H(t) formula from these? I am not a physicist, but a computer science teacher. I have thoughts, but I am not sciencey enough to figure it out.
Thoughts:
Velocity is distance / time (position? / time). Would that mean that:
$\frac 12 mV_2^2 = mgH_2$ =>
$mV_2^2 = 2mgH_2$ =>
$V_2^2 = 2gH_2$ =>
$V_2 = \sqrt{2gH_2}$ =>
$d/t = \sqrt{2gH_2}$ =>
$d = \frac{\sqrt{2gH_2}}{t}$ | {
"domain": "physics.stackexchange",
"id": 26425,
"lm_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, classical-mechanics, kinematics, projectile",
"url": null
} |
php, pdo
prepare once execute multiple will gain you like 2-5% speed
(however, in order to get that small speed improvement from prepared statements, you have to disable the emulation mode. But in this case you'll be unable to reuse the placeholder name in the same query. Luckily, there is a values() keyword to the rescue)
wrapping all DML queries in a transaction can boost the speed up to 70 times (though depends on the software settings and hardware configuration) and is overall a sensible move. You either want all rows to be inserted or none.
Error reporting
Another issue to address is error reporting which is completely flawed and far from being any helpful in the real life (I have to admit, it's hard to master this skill as your code most of time works as intended) but, unlike what most people think, it's really simple to make it right.
The first thing you have to realize is that there are two kinds of errors that require absolutely different treatment: | {
"domain": "codereview.stackexchange",
"id": 38690,
"lm_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, pdo",
"url": null
} |
homework-and-exercises, electric-circuits, electrical-resistance, voltage
That is to say, the ratio $V_1 / V_2$ of the voltage drops across the resistors is equal to the ratio $R_1 / R_2$ of their resistance. Since the total voltage $V_1 + V_2$ dropped across the resistors is fixed, this means that, when $V_1$ goes up, $V_2$ must go down, and vice versa.
In particular, this means that, when you keep $R_1$ fixed and decrease $R_2$, you're increasing the ratio $R_1 / R_2$, and thus $V_1 / V_2$. Since the sum of $V_1$ and $V_2$ is constant, increasing the ratio means that $V_1$ must increase and $V_2$ must decrease by the same amount.
For example, if, as in your first experiment, $R_1$ equals $R_2$, then $V_1$ also equals $V_2$, and thus both must be half of the total voltage drop $V_3 = V_1 + V_2$.3
Similarly, if $R_1$ is twice $R_2$, as in your second experiment, then $V_1$ will also have to be twice $V_2$. Thus, $V_1$ will be two thirds of the total voltage drop $V_3$, while $V_2$ will be one third of $V_3$. | {
"domain": "physics.stackexchange",
"id": 14534,
"lm_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, electric-circuits, electrical-resistance, voltage",
"url": null
} |
As you have stated:
Checking a number is even will automatically give you the factor of $2$.
Summing the digits, if the digit sum is a multiple of $3$ or $9$, the number is also a multiple of $3$ or $9$.
Multiples of $5$ end in $5$, multiples of $10$ end in $0$.
For my extra method, let's consider $473$. It has no obvious factors based on those rules, so here I would use prime multiple subtraction. Start with $7$, the multiple of $7$ that ends in $3$ is $7\cdot9=63$, so subtract $63$ to get $410$. $41$ is not a multiple of $7$ or $9$, so neither are factors. Then consider $11$. $3\cdot 11=33$ so subtract $33$ to get $440$. $440=40\cdot 11$, hence we can see that $473=43\cdot 11$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806484125338,
"lm_q1q2_score": 0.853690843838832,
"lm_q2_score": 0.8705972784807408,
"openwebmath_perplexity": 270.63407062838064,
"openwebmath_score": 0.8441216945648193,
"tags": null,
"url": "https://math.stackexchange.com/questions/2776463/mentally-finding-factors-of-an-integer-of-up-to-three-digits"
} |
You just need to actually apply the equation. First pick two values for ##i,j##, let's say ##i=j=x## and apply the formula exactly as it is written. Let us know if it is still unclear.
So you take the second derivative of ##E(\mathbf k)## with respect to all nine combinations of ##i, j##, and add them together? The cross terms would vanish, and we are left with
$$\frac {\partial^2 E(\mathbf k)} {\partial k_x \partial k_x} = Aa^2cos(k_xa)$$
and similarly for yy and zz. Thus
$$\left( \frac{1}{m^*} \right)_{ij} = \frac{1}{\hbar ^2} \left( Aa^2cos(k_xa) + Bb^2cos(k_yb) + Cc^2cos(k_zc) \right)$$
Is this correct?
nrqed
Homework Helper
Gold Member
So you take the second derivative of ##E(\mathbf k)## with respect to all nine combinations of ##i, j##, and add them together? The cross terms would vanish, and we are left with
$$\frac {\partial^2 E(\mathbf k)} {\partial k_x \partial k_x} = Aa^2cos(k_xa)$$
and similarly for yy and zz.
This is correct.
Thus | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9711290897113961,
"lm_q1q2_score": 0.8113623668561181,
"lm_q2_score": 0.8354835371034368,
"openwebmath_perplexity": 582.4384933314042,
"openwebmath_score": 0.8741441369056702,
"tags": null,
"url": "https://www.physicsforums.com/threads/how-to-evaluate-the-effective-mass-tensor-band-structure.947844/"
} |
python, python-3.x, regex
for arg in args:
# arg represents a pattern.
start = arg[0]
end = arg[1]
collision = (start + end in args and end + start in args)
if collision:
self._err("Collision: {}{} / {}{}".format(start, end, end, start))
return
final[start + end] = Crucial()._asymmetric(raw, start, end, filter_first)
return final
def tag(self, raw, tags, seperator=" "):
"""Encapsulate words based on a 'tags' enum.
Arguments:
* raw: A raw string containing words to be tagged
* tags: Dictionary containing key:value pairs like "spam":"[]".
Each "spam" in raw will be surrounded by "[" ... "]".
* seperator: Optional argument for seperating words (string.split()).
Defaults to a single space " ".
"""
return Crucial()._tag(raw, tags, seperator) | {
"domain": "codereview.stackexchange",
"id": 26188,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x, regex",
"url": null
} |
java, algorithm, tree, formatting
Title: PrettyPrint a Binary Tree (Follow Up) I have improved the Pretty Printing of binary tree that I implemented previously. In this follow up I have made changes such that every tree is printed (not just a Complete binary tree).
Here is my changed implementation. Please suggest any improvements that are required.
public class PrettyPrintTree {
public TreeNode root;
public PrettyPrintTree(List<Integer> list) {
root = createTree(list);
}
public static class TreeNode {
TreeNode left;
TreeNode right;
int value;
public TreeNode(int value) {
this.value = value;
}
} | {
"domain": "codereview.stackexchange",
"id": 11746,
"lm_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, algorithm, tree, formatting",
"url": null
} |
javascript, jquery, json, ajax, callback
Regarding the AJAX, I am not looking for any return data and nor do I care about success or failure as should it fail. I'm not going to ask someone to apply for the job again. I do have error logging in my PHP file, though. This looks pretty good, not much room for improvement I think. LinkedIn's JavaScript is calling linkedInApplySuccess, correct? All you have to do is specify data-success-callback, or something similar, in your HTML?
The only minor thing I would do is instead of sending just the job ID, send the entire JSON object. As long as resources aren't an issue, it's always best to capture all data and disregard the stuff you don't use rather than only collect the stuff you're currently using; this is because requirements change, and in the future you may want to do something with the data you've been ignoring. For instance, you may want to calculate how many people are applying for jobs with the position "Chief Weasel Wrangler". | {
"domain": "codereview.stackexchange",
"id": 3784,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, json, ajax, callback",
"url": null
} |
c++, memory-management, c++17, pointers
Node* prev = nullptr, *next = nullptr;
std::any obj{};
std::uint16_t ref_count = 1;
template<typename T, typename... Ts>
friend gcpointer<T> gcnew(Ts&&...);
};
Node* head{nullptr};
static enum class State : std::uint8_t {weak, strong} weak_state;
public:
~garbage_collector(){
weak_state = State::weak;
Node* tmp = nullptr;
while(head){
tmp = head->next;
delete head;
head = tmp;
}
}
};
garbage_collector::State garbage_collector::weak_state = garbage_collector::State::strong;
garbage_collector garbage_collector::global_gc = {}; | {
"domain": "codereview.stackexchange",
"id": 42383,
"lm_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, c++17, pointers",
"url": null
} |
I think your problem is underdetermined. Why? f(x) = 0 satisfies the function equation, and f(x) = 1 satisfies the function equation, for all x. Therefore, with the information you have, you cannot uniquely determine f.
Reply to pickslides: unfortunately, the exponential function is neither even nor odd, so I don't think the exponential function fits here.
4. Originally Posted by Ackbeet
Fun problem! I'm not sure I've solved it, but I have made some progress, or at least found a few things out. First, suppose you set y = 0. Then you get f(x) = f(x) f(0) for all x. Then either f(0) = 1 or f(x) = 0 for all x. Suppose f(0) = 1. Then we could set x = 0, and get f(-y) = f(0) f(y) = f(y), thus making f even. But the f(x) = 0 case was also even. Hence, we conclude that f is even. | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9896718499176856,
"lm_q1q2_score": 0.8372054168549935,
"lm_q2_score": 0.8459424373085146,
"openwebmath_perplexity": 273.1098955819726,
"openwebmath_score": 0.8072821497917175,
"tags": null,
"url": "http://mathhelpforum.com/math-topics/179652-if-f-x-y-f-x-f-y-what-value-f-4-a.html"
} |
java, object-oriented, multithreading, networking, multiprocessing
A few things here...
catch (Exception e) is generally a bad idea, because it's too unspecific. You should catch IOException here. There's things that you'll catch here, that won't change even after waiting a second.
This includes: SecurityException, IllegalArgumentException, NullPointerException and a handful of Runtime exceptions that could occur.
Additionally making your thread sleep for a whole second (and incorrectly assuming it cannot be interrupted during that time) is wrong on so many levels.
You're basically assuming, nobody cancels your task when you try to create the connection for the 20th time. Additionally you make the assumption that the caller actually wants to retry in the first place instead of throwing an Exception or trying a different mechanism.
This makes this problematic to use. Also you could just have used your ScheduledExecutorService to run the same task again in a second, if creating the necessary connections failed. | {
"domain": "codereview.stackexchange",
"id": 19653,
"lm_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, multithreading, networking, multiprocessing",
"url": null
} |
genomes, human-genome, codon
Title: Does GC content determine codon bias or does codon bias determine GC content I was wondering if someone knows the answer to this quenstion, because I can't find a clear answer, maybe there isn't a clear answer :).
question
Which of these two is right? or maybe both influence each other
GC% determines codon bias
codon bias determines GC% | {
"domain": "biology.stackexchange",
"id": 5375,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "genomes, human-genome, codon",
"url": null
} |
waves, fourier-transform, imaging, image-processing
Am I correct in thinking that the intensity of the center pixel represents the mean value of all the pixels in the original image?
at least according to this Web page, Intuitive Explanation of Fourier Theory.
It seems to me, as an almost total beginner, but from reading a little on the subject, and having a past interest in data compression on analogue music files, that the answers to your question 2 and 3 are completely dependent on the input you use.
For example if the input image is a sinusoidal grating, as shown below, the resultant Fourier image will have a bright spot at the center, the DC term, with two flanking peaks on either side, whose distance from the center will vary with the spatial frequency of the sinusoid.
I have seen this answer on other related pages, such as 2D Image Transformation, where it states that: | {
"domain": "physics.stackexchange",
"id": 34615,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "waves, fourier-transform, imaging, image-processing",
"url": null
} |
special-relativity, speed-of-light, mass, faster-than-light
The reason I think he's saying that this is as a result of $E = mc^2$ is because he's talking about the equivalence of $E$ and $c$ from the equation.
I read somewhere that $E=mc^2$ shows that if something was to travel faster than the speed of light then they would have infinite mass and would have used infinite energy. | {
"domain": "physics.stackexchange",
"id": 2810,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, speed-of-light, mass, faster-than-light",
"url": null
} |
lagrangian-formalism, rigid-body-dynamics
generalized force can be written as the total force on the body times the displacement of the center of mas with respect to the generalized coordinate
is clearly wrong.
Now if you are asking, why the gravitational potential enenrgy of a rigid body is given by $mgy_{c.o.m.}$ and whether this formula is valid even if the gravitational potential was not uniform then that is a different question. | {
"domain": "physics.stackexchange",
"id": 34490,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lagrangian-formalism, rigid-body-dynamics",
"url": null
} |
Then $f-g$ has degree no bigger than $n$, so if $f-g\ne 0$ then $f-g$ has at most $n$ roots, but $f-g$ has at least $n+1$ roots so $f=g$.
johannesvalks' answer proves existence but not uniqueness. The Lagrange interpolation polynomials used will have degree $\le n$, as each is the sum of polynomials. Given two polynomials $P,Q$ with $\deg(P),\deg(Q)\le n$ both passing through $n+1$ distinct points $(x_i,y_i)$ with $1\le i\le n+1$, divide to get $P=(x-x_i)P_i+y_i$ and $Q=(x-x_i)Q_i+y_i$, for some $P_i,Q_i$, so that $$P-Q=(x-x_i)(P_i-Q_i).$$ Then $P-Q$ has $n+1$ distinct roots, while $P$ and $Q$ have at most $n$, so $P-Q$ must be the zero polynomial. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9865717472321278,
"lm_q1q2_score": 0.8221345040503888,
"lm_q2_score": 0.8333245973817158,
"openwebmath_perplexity": 131.1517845890695,
"openwebmath_score": 0.88434898853302,
"tags": null,
"url": "https://math.stackexchange.com/questions/837902/prove-there-exists-a-unique-n-th-degree-polynomial-that-passes-through-n1-p"
} |
sql, sql-server, t-sql, stackexchange, clustering
DECLARE @UserId INT;
SET @UserId = ##UserId##;
-- Temp table to hold all relevant activity dates
CREATE TABLE #UserActiveDays
(
UserId INTEGER
, ActivityDate DATE
, Source VARCHAR(50)
); | {
"domain": "codereview.stackexchange",
"id": 11324,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sql, sql-server, t-sql, stackexchange, clustering",
"url": null
} |
quantum-state, ibm-q-experience
In your case, you will always get two state vectors, one for the case where the state after reset is $|00\rangle$, and the other for the case where the state is $|10\rangle$. Unless, of course, you prepared the state without non-unitary operations. | {
"domain": "quantumcomputing.stackexchange",
"id": 5091,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-state, ibm-q-experience",
"url": null
} |
life applications of trigonometry - Embibe Exams Real life applications of trigonometry Trigonometry simply means calculations with triangles (that's where the tri comes from). The domain of the sine function is the set of real numbers, that is, every real number is a first element of one pair of the function. c) How many minutes, from t = 0, does it take the rider to reach the. Euler's formula. Aim: How do we use the law of cosine in real life? Prior Knowledge: All the trigonometric functions. We will find the equation of tangent planes to surfaces and we will revisit on of the more important applications of derivatives from earlier Calculus classes. Land surveying makes an extensive use of the sine and cosine law. You may receive emails, depending on your notification preferences. Here's an example: San Diego, California, is a gorgeous […]. Interpret the sine function as the relationship between the radian measure of an angle formed by the horizontal axis and a terminal ray on the | {
"domain": "marcodoriaxgenova.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9902915223724212,
"lm_q1q2_score": 0.820891080723575,
"lm_q2_score": 0.8289388146603365,
"openwebmath_perplexity": 518.6406767028611,
"openwebmath_score": 0.7474116683006287,
"tags": null,
"url": "http://marcodoriaxgenova.it/qski/real-life-applications-of-sine-and-cosine-functions.html"
} |
c++, file, formatting, logging, c++20
Title: Logger that writes to text file with std::vformat This class has a Log function that appends text to a log text file. It takes a format string and a variable amount of arguments, much like a printf sort of function. It then writes the formatted string with the interpolated arguments to the file.
I wanted to know if there are any edge cases I might've missed, or if anything can be done to improve this code?
class Logger {
private:
Logger() = delete;
Logger(const Logger&) = delete;
public:
template <class... FormatArgs>
static void Log(const std::string_view format, FormatArgs&&... args) {
std::ofstream logfile("log.txt", std::ios::app);
logfile << std::vformat(format, std::make_format_args(args...)) << std::endl;
}
};
Edit
Here are some usage examples*.
Logger::Log("This is an example log message");
Logger::Log("This is a log message with {}", "one argument");
Logger::Log("This is a log message with {} {}", 2, "arguments"); | {
"domain": "codereview.stackexchange",
"id": 44131,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, file, formatting, logging, c++20",
"url": null
} |
quantum-mechanics, angular-momentum, group-theory, rotation, classical-field-theory
-1&\hphantom{\!\!\!-}0&\hphantom{\!\!\!-}0
\end{bmatrix}
,\quad
\mathcal{S}_{3}\equiv i
\begin{bmatrix}
0&-1&\hphantom{-}0\\
1&\hphantom{-}0&\hphantom{-}0\\
0&\hphantom{-}0&\hphantom{-}0
\end{bmatrix}
\tag{01}
\end{equation}
These matrices have nothing to do and have no relation with angular momentum or any other quantity in classical mechanics.
In quantum mechanics if you suppose that a point particle possesses internal degrees of freedom then a first simple assumption is to represent its state not by a scalar wave function $\:\psi(\mathbf{x})\:$
but by a 3-vector wave function $\:\boldsymbol{\Psi}(\mathbf{x})$.Further, we assume that, when the state is rotated by $\:R(\mathbf{n},\theta)\:$, not only does $\:\mathbf{x}\:$ change into $\:\mathbf{x}'=R\mathbf{x}\:$ but also $\:\boldsymbol{\Psi}\:$ as a 3-vector | {
"domain": "physics.stackexchange",
"id": 48021,
"lm_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, angular-momentum, group-theory, rotation, classical-field-theory",
"url": null
} |
ruby, game-of-life
Rule evaluation
The rules are all about the amount of neighbours that is alive. A cell could check this for himself if he knew who his neighbours are. For this reason I would leave the placement and neighbour assignment up to the Grid, but I would leave the state checking to the Cell itself. This would also eliminate a lot of the coordinate usage, since a cell doesn't care if a neighbour lives above, next or under him. The only thing that matters is the amount of neighbours alive. The only place where you still need the coordinates is when placing the cells and when assigning the neighbours of each cell.
In my opinion the code becomes a lot more readable when it speaks for itself.
Advantages of working with classes
Working with classes comes most of the time with some overhead (which can be seen in my example below), but has several advantages. | {
"domain": "codereview.stackexchange",
"id": 32892,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, game-of-life",
"url": null
} |
$$=a^2+ab+ac+ab+b^2+bc+ac+bc+c^2$$
$$=a^2+b^2+c^2+2ab+2ac+2bc$$
Faraj Razem
razemsoft21
Posts: 2
Joined: Fri Jan 07, 2011 5:07 am
Reputation: 1
Re: What is the short multiplication formula for (a + b + c)
(a+b+c)^2
Here is a solution for equation :
(a+b+c)(a+b+c)
Now we are multiplying each letter of both multiplier :
a(a+b+c) + b(a+b+c) + c(a+b+c)
=> a^2 + ab + ac + ba + b^2 + bc + ca + cb + c^2
=> a^2 + b^2 + c^2 + 2ab + 2bc + 2ca
Guest
Re: What is the short multiplication formula for (a + b + c)
What about $$(a-b+c)^2,(a+b-c)^2,(a-b-c)^2,(b+c-a)^2$$ ?
perfectmath
Posts: 25
Joined: Fri Jun 29, 2012 12:21 am
Location: Vietnam
Reputation: 1
Re: What is the short multiplication formula for (a + b + c)
Formula for (a+b+c)²
(a+b+c)² = a²+b²+c²+2ab+2bc+2ca
leesajohnson
Posts: 208
Joined: Thu Dec 31, 2015 7:11 am
Location: London
Reputation: -33 | {
"domain": "math10.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9867771782476948,
"lm_q1q2_score": 0.8067638390118372,
"lm_q2_score": 0.8175744806385543,
"openwebmath_perplexity": 1415.407719746608,
"openwebmath_score": 0.93085116147995,
"tags": null,
"url": "https://www.math10.com/forum/viewtopic.php?f=8&t=529"
} |
occurs arrival pattern in the following sense: 1 the time elapsed between events in Poisson! », and derive its mean and variance distribution are special cases of the exponential distribution is a particular of. Case, the maximum likelihood estimator can be approximated by a normal distribution with mean and expected value a. Cases of the exponential distribution or negative exponential distribution and a gamma distribution are special cases of exponential. Typically experience wearout type failures special distribution simulator and select the exponential-logarithmic distribution a commonly used distribution in engineering. Expected value a probability distribution to describe the time between events in a Poisson is! Electronic systems, which do not typically experience wearout type failures form a Poisson process is one of the distribution... ( Y\ ) are independent, a special case of the isotope will have decayed, every exponential distribution,! Mean and variance waiting time for | {
"domain": "ibizasailing.net",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854120593483,
"lm_q1q2_score": 0.82999195900592,
"lm_q2_score": 0.8558511488056151,
"openwebmath_perplexity": 679.9590414879955,
"openwebmath_score": 0.8454276919364929,
"tags": null,
"url": "https://ibizasailing.net/aatwy2/69a78e-exponential-distribution-mean"
} |
If you wish you may multiply both sides by 5, 8 and x to get
$\frac{40x}{5}-\frac{40x}{8}=\frac{40x}{x}$
$8x-5x=40\ \Rightarrow\ 3x=40\ \Rightarrow\ x=\frac{40}{3}$
Alternatively
$\frac{1}{5}-\frac{1}{8}=\frac{8}{8}\ \frac{1}{5}-\frac{5}{5}\ \frac{1}{8}=\frac{8}{40}-\frac{5}{40}=\frac{8-5}{40}=\frac{3}{40}$
$\frac{3}{40}=\frac{1}{x}\ \Rightarrow\ \frac{40}{3}=\frac{x}{1}=x$
5. Ok now I think it's starting to make more sense to me now. So both methods work in any given situations to get the denominators to be equal. I hope I got that right. | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9802808707404788,
"lm_q1q2_score": 0.8168921659885673,
"lm_q2_score": 0.8333246015211009,
"openwebmath_perplexity": 393.4918544776602,
"openwebmath_score": 0.8028103113174438,
"tags": null,
"url": "http://mathhelpforum.com/algebra/145017-solved-fractions-when-multiply-top-bottom-only-top.html"
} |
quantum-entanglement, conformal-field-theory, spin-models, critical-phenomena
Addendum 1: Accuracy of CFT formula?
[*] I said the formula $S(l) = \frac{c}{3}\ln \left(\frac{L}{\pi} \sin{\frac{\pi l}{L} }\right) +C$ is simply wrong for small $l$. That might seem surprising if you look at the figure in the question you linked, where the entropies are calculated for a spin chain of length 12, and even for regions of size $l=1,2,\dots$ the fit looks perfect. Apparently, for this particular critical spin chain Hamiltonian, the long-distance scaling of entropy already provides a very accurate approximation at short distances. See Fig. 1 of Calabrese et al. where they plot the error between an exact spin chain calculation of $S(l)$ and the CFT formula above; in their particular case they also find a very good match at short distances. Maybe that's somehow related to the exact solvability of these particular lattice Hamiltonians? | {
"domain": "physics.stackexchange",
"id": 84797,
"lm_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-entanglement, conformal-field-theory, spin-models, critical-phenomena",
"url": null
} |
electromagnetism, induction
$$ A_{triangle} = \frac 1 2 \cdot \frac 4 5 \cdot \frac 1 5 = \frac 2 {25} $$
Now $ 4A_{triangle}\neq A_{square}$ and thus the two approaches lead to different values for $\mathcal E$. How is that possible? Here, you are using implicitely the fact that for any points $P$ and $Q$ and any path $\Gamma$ going from $P$ to $Q$,
$$
\int\limits_\Gamma \mathbf{E}\cdot \textrm{d}\mathbf{l} = C^{te} = \Delta V_{PQ}
$$
We could find an even more convincing contradiction: let's consider an arbitrary point $A$ on the wire. Let's call $\Gamma$ the path that travels along the whole loop from $A$ to $A$, then $\mathcal{E}$ is defined by:
$$\mathcal{E} = \int\limits_{\Gamma} \mathbf{E}\cdot \textrm{d}\mathbf{l} = -\frac{\textrm{d}AB}{\textrm{d}t} = -kA \ne 0$$
Now, consider $\Gamma'$ the trivial path going from $A$ to $A$, ie. $\forall t,\,\Gamma'(t) = A$, then according to the first equation,
$$\mathcal{E} = \int\limits_{\Gamma'} \mathbf{E}\cdot\textrm{d}\mathbf{l} = 0$$ | {
"domain": "physics.stackexchange",
"id": 40259,
"lm_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, induction",
"url": null
} |
"If the third qubit is $$\left|0\right>$$ leave the ninth qubit alone:" $$I \otimes I \otimes \left|0\rangle\langle0\right| \otimes I \otimes I \otimes I \otimes I \otimes I \otimes I \otimes I$$
"If the third qubit is $$\left|1\right>$$ apply X to the ninth qubit": $$I \otimes I \otimes \left|1\rangle\langle1\right| \otimes I \otimes I \otimes I \otimes I \otimes I \otimes X \otimes I$$
Add those two expression together and you have your 10 qubit CNOT gate.
The above algorithm is straightforward to implement in Python. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9669140197044659,
"lm_q1q2_score": 0.8099064916103712,
"lm_q2_score": 0.8376199694135332,
"openwebmath_perplexity": 665.4485223028765,
"openwebmath_score": 0.9899222254753113,
"tags": null,
"url": "https://quantumcomputing.stackexchange.com/questions/5179/how-to-construct-matrix-of-regular-and-flipped-2-qubit-cnot"
} |
ros, roscd, catkin
Originally posted by Pi Robot on ROS Answers with karma: 4046 on 2013-04-27
Post score: 2
Patrick,
That is the expected behavior. Files for a catkin package are no longer installed in a single directory. The place where roscd takes you is a directory containing miscellaneous files for that package, mainly its package.xml.
REP-0122 explains the new layout in detail and the reasons for changing it.
These changes were not made for casual reasons. One of the goals of catkin was to build binary packages that install using the Linux filesystem hierarchy standard. That will be necessary if we ever want to distribute ROS packages through the various Linux distribution channels.
Because the sources are no longer included in binary packages, using roscd to study the packages you use is no longer particularly useful. Instead, you can install the corresponding Debian source package, from which that binary was built. | {
"domain": "robotics.stackexchange",
"id": 13976,
"lm_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, roscd, catkin",
"url": null
} |
python, performance, beginner, multithreading, python-2.x
Title: Streaming floating point data in Python2 I am in the process of creating a brain-computer interface, and one task is to stream electroencephalograph (EEG) data into a Python script for real-time analysis. Included in this question are two Python scripts: (1) to generate and stream fake EEG data (32 random floating points for testing purposes), and (2) to receive the EEG data and convert it to a numpy array of the shape (n_channels, n_samples). The second script extracts a sliding window of the last X seconds of data.
Generate and stream synthetic EEG data
# file is named "stream_eeg_realtime.py"
import random, threading, time
nominal_srate = 500. # sampling rate in Hz. Must be float.
sleep_time = 1/nominal_srate
# Define all of the channel names.
channels = ['Fp1','Fp2','AF3','AF4','F3','F4','F7','F8','FC5','FC6','T7','T8',
'FC1','FC2','C3','C4','CP5','CP6','P7','P8','CP1','CP2','P3','P4','01','02',
'PO3','PO4','Oz','Pz','Cz','Fz'] | {
"domain": "codereview.stackexchange",
"id": 22327,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, beginner, multithreading, python-2.x",
"url": null
} |
rviz, moveit, ros-kinetic, gripper, abb
gripper URDF
<link name="palm">
<visual>
<geometry>
<box size="0.15 0.05 0.05"/>
</geometry>
<material name="">
<color rgba="0.7372549 0.3490196 0.1607843 1"/>
</material>
</visual>
<collision>
<geometry>
<box size="0.15 0.05 0.05"/>
</geometry>
</collision>
</link>
<!-- <link name ="sucker">
<visual>
<geometry>
<cylinder length ="0.05" radius ="0.025"/>
</geometry>
<material name="">
<color rgba="0.7372549 0.3490196 0.1607843 1"/>
</material>
</visual>
<collision>
<geometry>
<cylinder length ="0.05" radius ="0.025"/>
</geometry>
</collision>
</link> -->
<link name="right_finger">
<visual>
<geometry>
<box size="0.02 0.1 0.05"/>
</geometry>
<material name="">
<color rgba="0.0 0.3490196 0.0 1"/>
</material>
</visual>
<collision>
<geometry> | {
"domain": "robotics.stackexchange",
"id": 33287,
"lm_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, moveit, ros-kinetic, gripper, abb",
"url": null
} |
quantum-field-theory, special-relativity, lorentz-symmetry
Observables cannot mix states of the form $(\psi_k(x))^+|0\rangle$ with states of the form $(\psi^*_k(x))^+|0\rangle$, even though both are single-particle states. We can say that the state $(\psi^*_k(x))^+|0\rangle$ has a single electron and that $(\psi_k(x))^+|0\rangle$ has a single positron. Any linear combination of single-electron states is another single-electron state, and likewise for positrons.
F. From non-QFT to zitterbewegung
The question asks for the modern perspective on zitterbewegung. Zitterbewegung comes from trying to interpret the $\bfx$ in the Dirac equation (1) as the position observable of a particle. The modern perspective is that that interpretation is a mistake. Zitterbewegung is just one of the consequences of that mistake. | {
"domain": "physics.stackexchange",
"id": 62346,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, special-relativity, lorentz-symmetry",
"url": null
} |
java, security, android, aes
public SecretKey getSecretKey(String password) {
try {
PBEKeySpec pbeKeySpec = new PBEKeySpec(password.toCharArray(), Salt.getBytes("UTF-8"), PBE_ITERATION_COUNT, PBE_KEY_LENGTH);
SecretKeyFactory factory = SecretKeyFactory.getInstance(SECRET_KEY_ALGORITHM);
SecretKey tmp = factory.generateSecret(pbeKeySpec);
SecretKey secret = new SecretKeySpec(tmp.getEncoded(), KEY_ALGORITHM);
return secret;
}
catch (Exception e) {
return null;
}
} | {
"domain": "codereview.stackexchange",
"id": 16218,
"lm_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, security, android, aes",
"url": null
} |
electromagnetism, magnetic-fields, earth, geophysics, geomagnetism
Title: Does the geomagnetic field rotate? The Earth rotates about it's own axis. Do the geomagnetic field lines rotate due to this rotation or not? Yes, the Earth's magnetic field does rotate with the Earth. There is a simple way and a complicated way to explain this.
Firstly the simple way: the magnetic north pole and the North Pole are not at the same point. That means if the magnetic field did not rotate with the Earth the magnetic north pole would rotate once around the North pole every 24 hours. Since the position on the Earth's surface doesn't rotate every 24 hours that must mean the field is rotating along with the Earth. | {
"domain": "physics.stackexchange",
"id": 15096,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, magnetic-fields, earth, geophysics, geomagnetism",
"url": null
} |
Would this mean that when solving for the centripetal force at the top of the ferris wheel, we use:
$F_g+N = m*a_c$ ?
Also, how would you easily solve for $a_c$?
4. Jul 11, 2013
### Simon Bridge
Ferris wheels are a bit trickier in that they generally suspend the passengers so they can go more slowly around the circle... they also typically move at a constant angular velocity. You can calculate the centripetal acceleration from that.
The typical question will ask about the slowest speed that will get a toy car around a loop of track.
Since N depends on speed, this will happen for the speed where N=0.
5. Jul 12, 2013
### CWatters
Roller coasters and ferris wheels are rigid (the object is forced to follow a circular path radius r with velocity v) so the centripetal acceleration must be v2/r at all times.
The sum of all forces acting on the object must provide that acceleration. What changes between top and bottom is the balance of the forces that provides the acceleration: | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9732407191430024,
"lm_q1q2_score": 0.8192990041173576,
"lm_q2_score": 0.8418256532040708,
"openwebmath_perplexity": 502.9434117827169,
"openwebmath_score": 0.5691366195678711,
"tags": null,
"url": "https://www.physicsforums.com/threads/roller-coaster-physics.700936/"
} |
electromagnetism, electromagnetic-radiation, maxwell-equations, superposition, linear-systems
Title: Superposition of two electromagnetic waves If an electromagnetic wave in isolation with vector potential $A^1_{\alpha}$ satisfies the wave equation $\Box A^1_{\alpha}=0$, how do we construct the total electromagnetic wave that results from superposing such electromagnetic waves with individual vector potentials $A^1_{\alpha},A^2_{\alpha}$. Is the total solution then simply $A_{\alpha}=A^1_{\alpha}+A^2_{\alpha}$ and satisfies $\Box A_{\alpha}=0$? Or is the total solution more complicated than that and I am mistaken in simply calculating the solution as the sum of its individual solutions?
The aim of this question is to consider a light pulse with vector potential $A^1_{\alpha}$ brought close to another light pulse with vector potential $A^2_{\alpha}$. Since the Maxwell equations are linear, the sum of two solutions is a solution. Hence, you are correct in stating that the superposition of two solutions is simply their sum. | {
"domain": "physics.stackexchange",
"id": 89636,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, electromagnetic-radiation, maxwell-equations, superposition, linear-systems",
"url": null
} |
to be congruent. How to construct a congruent triangle using the side-angle-side congruence postulate. Mathematics. Real World Math Horror Stories from Real encounters, $$\angle$$ACB = $$\angle$$XZY (angle). In the School Mathematics Study Groupsystem SASis taken as one (#15) of 22 postulates. So if you have two triangles and you can transform (for example by reflection) one of them into the other (while preserving the scale! Two triangles are congruent if they are exactly the same size and shape, which means they have the same angle measures and the same side lengths. This Congruence Postulate is … If lengths of two sides and an angle between them of one triangle are equal to the lengths of corresponding sides and an included corresponding angle of other triangle, then the two triangles are congruent geometrically. Both triangles are congruent and share common point C. Triangle A B C is slightly lower than triangle X Y C. Triangles X Y Z and A B C are shown. Show Answer. The | {
"domain": "planetjazz.fm",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9732407121576652,
"lm_q1q2_score": 0.8329491869320202,
"lm_q2_score": 0.8558511543206819,
"openwebmath_perplexity": 804.7215987131874,
"openwebmath_score": 0.582332193851471,
"tags": null,
"url": "https://planetjazz.fm/1c47b/sas-congruent-triangles-26b2b2"
} |
atmospheric-science, moon
; yet Titan maintains an atmosphere.
Why? What have I missed? Does Luna's relative proximity to Sol make the difference? There are a few differences between Luna and Titan.
One of the primary mechanisms for atmospheric loss is thermal escape. Titan is much colder. The particles which escape are essentially the tail of the Maxwell-Boltzmann distribution, the portion with velocity higher than the escape velocity. This end of the distribution is dominated by an $e^{-E/kT}$ contribution, so as you'd expect, lower temperature means fewer particles with enough kinetic energy to escape. Note also that since we care about escape velocity, while the distribution is really about energy, more massive particles won't escape as easily. Titan's atmosphere is mostly nitrogen, while the moon is mostly helium and argon. The helium in the moon's atmosphere is easily lost, since it's so much lighter. | {
"domain": "physics.stackexchange",
"id": 4012,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "atmospheric-science, moon",
"url": null
} |
probability, quasiprobability-distributions
This result is very fascinating and so, I would like to find the proofs or the papers mentioned about this, However, it is too tough to find because Wikipedia doesn't cite anythings.
Hence, I would like to know where this result is proven. I don't know if the following is what you need, but if one smooths Wigner function over a volume $h$ of phase space, one obtains Husimi function, which is non-negative everywhere (see, e.g., Ballentine, Quantum mechanics, Chapter 15). | {
"domain": "physics.stackexchange",
"id": 90981,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "probability, quasiprobability-distributions",
"url": null
} |
astrophysics, planets
Recent tectonic activity on Pluto driven by phase changes in the ice shell. N.P. Hammond et al. Geophys. Res. Lett. 43, 6775 (2016).
which Ars Technica nicely summarizes here.
The same paper indicates through simulations that radioactive heating is a viable scenario:
The core is heated by long lived radioisotopes $^{238}$U, $^{235}$U, $^{232}$Th and $^{40}$K. We assume an initial abundance of parent isotopes appropriate for CI chondrites.
Also, according to this old NewScientist article:
If the core contains potassium at a concentration of 75 parts per billion, its decay could produce enough heat to melt some of the overlying ice, which is made of a mixture of nitrogen and water. It should have at least that much potassium and probably more, says William McKinnon at Washington University in St Louis, Missouri. | {
"domain": "physics.stackexchange",
"id": 42902,
"lm_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, planets",
"url": null
} |
java, regex
In (?:[ ]*)?, the square brackets are pointless. The ? is redundant with *. So, you can just write a space followed by *.
In ([\d][\d]), the square brackets are pointless, and I would slightly prefer seeing (\d{2}) to (\d\d), since it can more easily be modified to accommodate different numbers of digits.
You might want to consider naming the capture groups for clarity:
String regex = "\\( *(?<numerator>\\d{2}) *(?:/ *(?<denominator>\\d{2}) *)?\\)"; | {
"domain": "codereview.stackexchange",
"id": 20028,
"lm_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, regex",
"url": null
} |
php, recursion, wordpress
echo '</ul>';
echo '</li>';
} else {
echo '<li><a href="'. get_term_link( $child_term ) .'">'. $child_term->name.'</a></li>';
}
}
echo '</ul>';
echo '</li>';
} else {
echo '<li><a href="'. get_term_link( $parent_term ) .'">'. $parent_term->name.'</a></li>';
} | {
"domain": "codereview.stackexchange",
"id": 37690,
"lm_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, recursion, wordpress",
"url": null
} |
python, performance
if type(players) != list:
raise BoardError("Players argument must be a list")
elif len(players) < 2:
raise BoardError("Players list msut have at least two items")
elif False in [type(player) == Player for player in players]:
raise BoardError("""Players argument must be a list of player
objects""")
player_letters = [player.letter for player in players]
if any(player_letters.count(letter) > 1 for letter in player_letters):
raise BoardError("Players can't use the same letter as each other")
if type(win_length) != int:
raise BoardError("Winning length must be integer")
elif win_length > size[0] or win_length > size[1]:
raise BoardError("""Winning win_length cannot be larger than the
board""")
elif win_length < 1:
raise BoardError("Winning length cannot be less than 1") | {
"domain": "codereview.stackexchange",
"id": 13034,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance",
"url": null
} |
$C$ above as the matrix variable $\left[C\right]$. We are also given the prices of the equipment, as shown in the table below. The exponential of A, denoted by eA or exp(A) , is the n × n matrix … $$AB=C\hspace{30px}\normalsize c_{ik}={\large\displaystyle \sum_{\tiny … Matrix multiplication in C language to calculate the product of two matrices (two-dimensional arrays). The product of two matrices A and B is defined if the number of columns of A is equal to the number of rows of B. in a single step. In this post, we will be learning about different types of matrix … So, if A is an m × n matrix, then the product A x is defined for n × 1 column vectors x. $\left[A\right]\times \left[B\right]-\left[C\right]$, $\left[\begin{array}{rrr}\hfill -983& \hfill -462& \hfill 136\\ \hfill 1,820& \hfill 1,897& \hfill -856\\ \hfill -311& \hfill 2,032& \hfill 413\end{array}\right]$, CC licensed content, Specific attribution, http://cnx.org/contents/fd53eae1-fa23-47c7-bb1b-972349835c3c@5.175:1/Preface. | {
"domain": "org.co",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9790357604052423,
"lm_q1q2_score": 0.8262034757442724,
"lm_q2_score": 0.8438950947024555,
"openwebmath_perplexity": 408.74005599903836,
"openwebmath_score": 0.8378878235816956,
"tags": null,
"url": "http://asomef.org.co/7au79xce/product-of-matrix-ed6f68"
} |
virology
Title: Virus cannot survive on surface after certain time period, but why and how? I'm not a biology student at all, but I'm trying to get a clearer picture on what is meant by "virus cannot survive after a certain period".
To my understanding, a virus cannot be killed it can only be inactivated (for example, by means of heat and lowered pH).
So I really don't understand how can virus get inactivated by just being on a certain surface for an extended period.
I've come across numerous articles which told me virus won't survive on a surface. They usually focus on comparing the survival time between different types of surfaces but never touch on how the virus gets inactivated. | {
"domain": "biology.stackexchange",
"id": 10447,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "virology",
"url": null
} |
kinetics, catalysis, surface-chemistry
If anyone knows any other good questions that are unique, or if my question seems worthy of putting into a hypothesis, I would greatly appreciate any input. Thanks in advance to anyone who reads all of this and helps me, you are a legend! The greater the surface area, the more accessible the reagent in a heterogeneous reaction. Hence, assuming the same chemical purity, Zn (metal) is less reactive than Zn (shot), and this is less reactive as Zn (dust) e.g. in the course of a Barbier reaction (e.g., THF/aqueous $\ce{NH4Cl}$, Zn, allyl bromide and carbonyl compound; it carries some similarities to the Grignard reaction). It equally «works» the less obvious way, i.e. old turnings of Mg (exposed for long to air) frequently have to be etched by a little of iodine to get past the oxidative layer to initiate the wanted Grignard reaction; finer shot is more prone to this, than coarse fresh turnings. | {
"domain": "chemistry.stackexchange",
"id": 17538,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kinetics, catalysis, surface-chemistry",
"url": null
} |
reinforcement-learning, comparison, deep-rl, multi-armed-bandits
Edit: since the answer got popular, I'll address the comments and the question edit.
Being a special simplified subset of Markov Decision Processes, Multi Armed Bandit problems allow deeper theoretical understanding. For example, (as per @NeilSlater comment) the optimal policy would be to always go for the best arm. So it makes sense to introduce "regret" $\rho$ - the difference between a potential optimal reward and the actual collected reward by agent following your strategy:
$$\rho(T) = \mathbb{E}\left[T\mu^* -\sum_{t=1}^T\mu(a_t)\right]$$
One can then study asymptotic behavior of this regret as a function of $T$ and devise strategies with different asymptotic properties. As you can see, the reward here is not discounted ($\gamma=1$) - we usually can study the behavior of it as a function of $T$ without this regularization. | {
"domain": "ai.stackexchange",
"id": 4075,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reinforcement-learning, comparison, deep-rl, multi-armed-bandits",
"url": null
} |
liver, fat-metabolism, insulin
That said, your basic idea is similar to the arguments for low-carbohydrate diets. How well they work and, if they do, through what mechanisms are still somewhat controversial, as I understand. Insofar as they work through excreting some of the ingested fat through urinary loss of ketoacids, however, the associated risks need to be considered. | {
"domain": "biology.stackexchange",
"id": 4144,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "liver, fat-metabolism, insulin",
"url": null
} |
waves, electromagnetic-radiation, doppler-effect
Title: Why doesn't the motion of a car affect the frequency of radio stations? When we go in a car and tune to an FM radio station, why doesn't our motion disturb the frequency?
Like the Doppler effect? It does! However it doesn't change the frequency enough to matter.
An FM transmission is not a precise frequency. Instead it spans a range of about 100 or 200 kHz depending on which country you are in. So your FM radio actually accepts a range of frequencies either side of the central frequency.
Let's suppose you're travelling at the maximum speed permitted in the UK, which is 70 mph or just over 30 m/s. This will Doppler shift the frequency of the FM station by a factor of about 1.0000001. In the UK the FM frequency is around 100 MHz, so the shift in frequency is about 10 Hz. This is only 0.01 % of the range of frequencies the transmission uses, so the frequency shift does not affect reception.
To seriously affect reception you'd need to be travelling at around 100 000 miles per hour. | {
"domain": "physics.stackexchange",
"id": 22448,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "waves, electromagnetic-radiation, doppler-effect",
"url": null
} |
co.combinatorics, linear-programming
A rational matrix $A$ is good iff $A$ is $1$-regular.
Here is an example of a non-trivial good matrix.
$$\left(
\begin{array}{cc}
\frac{1}{2} & -\frac{1}{2} \\
-\frac{1}{2} & -\frac{1}{2} \\
\end{array}
\right)$$ | {
"domain": "cstheory.stackexchange",
"id": 3947,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "co.combinatorics, linear-programming",
"url": null
} |
python
Title: velocity profile of laminar flow in a pipe for a university project I want to compute the laminar flow velocity at 7 points in a cross-section of a pipe. Later we want to use this data for a flow animation.
Inputs of my function are the diameter and length of the pipe, the viscosity of the fluid, the pressure difference and the average velocity.
For the calculation I only need the pressure difference or the average velocity. So I have to set either the pressure difference or the average velocity to False.
Do you have any idea how I can improve the code?
import numpy as np
def flow(diameter, viscosity, len_pipe, dp, v_average):
radius = diameter / 2.
x = np.linspace(-radius, radius, 7) | {
"domain": "codereview.stackexchange",
"id": 28407,
"lm_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
} |
beginner, playing-cards, go
// printGameOverMessage prints the appropriate end message.
func (gm *GoFishGame) printGameOverMessage() {
fmt.Printf("Final score is %d to %d.\n", gm.scores[0], gm.scores[1])
if gm.scores[0] > gm.scores[1] {
fmt.Println("Player wins!")
} else if gm.scores[0] == gm.scores[1] {
fmt.Println("It's a tie.")
} else {
fmt.Println("Computer wins!")
}
}
// printHand print's the player's hand and current score.
func (gm *GoFishGame) printHand() {
sort.Strings(gm.hands[0])
fmt.Printf("You have: %s.\n", gm.hands[0])
fmt.Printf("Score is %d to %d.\n", gm.scores[0], gm.scores[1])
} | {
"domain": "codereview.stackexchange",
"id": 23217,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, playing-cards, go",
"url": null
} |
molecular-biology, proteins, molecular-genetics, transcription, transcription-factor
Figure 2: DNA sequence identification by zinc finger proteins. This example considers the Zif268 protein. Reproduced from Paro and Sauer (1992) [1].
Figure 3: A more detailed depiction of Zif268-DNA interaction. Reproduced from Durai et al. (2005) [4].
References: | {
"domain": "biology.stackexchange",
"id": 4507,
"lm_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-biology, proteins, molecular-genetics, transcription, transcription-factor",
"url": null
} |
asymptotics
$O(g(n))=\{f(n):$ there exist positive constants $c$ and $n_0$ such that $0 \leq f(n)\leq c\cdot g(n)$ for all $n\geq n_0\}$
Considering the counter example whereby $f(n)=n$ and $g(n)=n^2$. Then $O(n)=O(n^2)$ and $n^2=O(n^2)$ hold, but $n^2\neq O(n)$, thereby contradicting the assertion given in the accepted answer. Note: "$\neq$" in this case refers to "$\not \in$".
Therefore, I would like to ask if the answer provided is wrong or my interpretation and/or reasoning is wrong. The notations $a(n) = O(b(n))$ and $O(a(n)) = O(b(n))$ have different meanings:
$a(n) = O(b(n))$ means that $a(n)$ belongs to the collection of functions $O(b(n))$. That is, $a(n) \in O(b(n))$.
$O(a(n)) = O(b(n))$ means (in this particular case) that the two collections of functions $O(a(n))$ and $O(b(n))$ are the same. That is, $c(n) = O(a(n))$ iff $c(n) = O(b(n))$. (Usually $O(a(n)) = O(b(n))$ actually means $O(a(n)) \subseteq O(b(n))$.) | {
"domain": "cs.stackexchange",
"id": 14361,
"lm_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
} |
ros, c++, ros-kinetic, ubuntu, tf2
// see the comment below, either uncomment this or
// the static one below. see the explanation for more details
//tf2_ros::TransformBroadcaster broadcaster;
auto callback_fn = [&](turtlesim::PoseConstPtr pose)
{
// read https://answers.ros.org/question/381937/
// short story: it doesn't have to be defined as static or be shared!
// what matters is that they shouldn't be created/destroyed very fast
// that is every few milliseconds e.g.
// or as jvdhoorn says :
// "What is important is to make sure it has a sane lifecycle
// (ie: it does not get created and destroyed every few milliseconds)."
// otherwise, you will end-up with all sorts of nonsensical weird happenings
// previously I forgot about this and when I ran the listener app which relies
// on this, the trutle2 was moving erratically, in circles, it would get close to | {
"domain": "robotics.stackexchange",
"id": 36651,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, c++, ros-kinetic, ubuntu, tf2",
"url": null
} |
cell-biology
Other critics, including Sean Eddy, focus a great deal on what is called the C-value paradox: Given a genome of a certain size, if it was all functional — or a lot of it functional, as the ENCODE consortium has claimed — then it would all be under evolutionary pressure, i.e., you'd expect certain mutation rates to occur, but they don't. Evolutionary biology would say about 5-10% is functional, I believe, based on how much selection takes place and where. So those critics would say (and have had indeed said) a lot of negative things about results reported by ENCODE.
I suspect that the true answer, if there is one, depends on what one defines as functional and as evolutionarily conserved, by what means you measure it, and what the balance is between functionality and conservation. You pick your definitions and processes, and you accept the compromises and limitations that go along with those choices.
Caveat: I am a contributing author to ENCODE papers released in Nature in 2012. | {
"domain": "biology.stackexchange",
"id": 9710,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cell-biology",
"url": null
} |
general-relativity, gravity, spacetime, equivalence-principle
$$ ds^2 = -\left(1-\frac{r_s}{r}\right)dt^2 + \frac{dr^2}{\left(1-\frac{r_s}{r}\right)} + r^2 d\Omega^2 \tag{1} $$
In this form the coordinates $t$ and $r$ are the times and distances measured by an observer far from the black hole, so it's an obvious choice. As written in this form there is no suggestion that spacetime is flowing in any sense.
However the Schwarzschild coordinates have a singularity at the event horizon and they're difficult to use if you're trying to work out what happens at the event horizon. To get round this we use a different set of coordinates called the Gullstrand-Painlevé coordinates. Using these coordinates the metric looks like:
$$ ds^2 = -dt_{ff}^2 + \left(dr + \frac{2M}{r} dt_{ff} \right)^2 + r^2 d\Omega^2 \tag{2} $$ | {
"domain": "physics.stackexchange",
"id": 49175,
"lm_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, gravity, spacetime, equivalence-principle",
"url": null
} |
ros, performance, topics
Originally posted by FPape with karma: 26 on 2011-09-30
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by Lorenz on 2011-09-30:
I think one problem you have is caused by starting up/shutting down all nodes at the same time because they all need to register/unregister at the master. Maybe the master cannot handle all connections at the same time. Also, to get rid of dead nodes, you can do a rosnode cleanup. | {
"domain": "robotics.stackexchange",
"id": 6739,
"lm_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, performance, topics",
"url": null
} |
quantum-mechanics, angular-momentum
The results obtained thus far can be summarized as follows: the eigenvalues of $\hat{\vec{J}}^2$ and $J_z$ corresponding to the joint eigenvectors $\lvert j, m\rangle$ are given, respectively, by $\hbar^2 j(j+1)$ and $\hbar m$:
$$\boxed{\hat{\vec{J}}\vphantom{J}^2 \lvert\ j, m\rangle = \hbar^2 j(j+1)\lvert\ j, m\rangle\qquad\text{and}\qquad\hat{J}_z\lvert\ j, m\rangle = \hbar m\lvert\ j, m\rangle,}\tag{5.48}$$ | {
"domain": "physics.stackexchange",
"id": 20794,
"lm_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, angular-momentum",
"url": null
} |
theory IAppeared as a branch algebraic. Characterizing protein structure networks. [ 5 ] by the survey Recent results in spectral graph theory the. State University approach for characterizing protein structure networks by means of the original problems of graph. Labeling, its spectrum is a result of studies of linear algebra the... Use results developed by spectral graph theory ; Part of the graphs have equal multisets of eigenvalues of graphical of! K cycles is explored useful outside the world of mathematics as well framework. Eigenvalue -2 was one of the graph energy is a graph G, 2=2 ˚ G... Author: Stephan Wagner File Size: 36.77 MB Format: PDF, Download... Of CONTENTS chapter 1 provides a historical setting for the current upsurge of interest in chemical theory!: PDF, ePub Download: 244 Read: 742 the 3rd edition of of! 21, 63–77, 1957. harvtxt error: no target: CITEREFHooryLinialWidgerson2006.. All graphs the survey Recent results in spectral graph theory June 1994 at Fresno | {
"domain": "openquestionspodcast.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9883127409715956,
"lm_q1q2_score": 0.8125800017952117,
"lm_q2_score": 0.8221891392358014,
"openwebmath_perplexity": 1161.143805608858,
"openwebmath_score": 0.5253098607063293,
"tags": null,
"url": "http://openquestionspodcast.com/wearable-spy-dso/ccdba5-landlord-tenant-hotline-georgia"
} |
c++, c++11, game, random, timer
//create array with all recorded time
microseconds a_sort[num_split];
split *i = head;
for (int j = 0; j < num_split; j++) {
a_sort[j] = i->elapsed;
i = i->next;
}
//using vectors, partial sort for top 5 spllit
std::vector<microseconds> v_sort(a_sort, a_sort + num_split);
std::partial_sort (v_sort.begin(), v_sort.begin()+5, v_sort.end());
//total time for top 5 split
microseconds top5;
for (int i = 0; i < 5; i++) {
top5 += v_sort[i];
}
//find avg of top 5
split avg_of_5;
avg_of_5.elapsed = top5/5;
display (avg_of_5);
return;
}
void times::avg10() {
//find avg of top 10 time
using namespace std::chrono;
if (num_split < 10) {
std::cerr << "Less than 10 recorded splits." << std::endl;
return;
}
//create array with all recorded time
microseconds a_sort[num_split];
split *i = head;
for (int j = 0; j < num_split; j++) {
a_sort[j] = i->elapsed;
i = i->next;
} | {
"domain": "codereview.stackexchange",
"id": 17867,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, game, random, timer",
"url": null
} |
python, postgresql, automation
with open('./poke/resources/natures.json') as natures_file:
global natures
natures1 = json.load(natures_file)
global pokes
pokes = {}
for pokesm in pokemon_list['pokemons']:
name = pokesm['name']
pokes[name] = {}
pokes[name]['image_url'] = pokesm['image']
pokes[name]['hp'] = pokesm['hp']
pokes[name]['attack'] = pokesm['attack']
pokes[name]['defense'] = pokesm['defense']
pokes[name]['special_attack'] = pokesm['special_attack']
pokes[name]['special_defense'] = pokesm['special_defense']
pokes[name]['speed'] = pokesm['speed']
global natures
natures = {}
for naturesm in natures1['natures']:
nature = naturesm['name']
natures[nature] = {}
natures[nature]['boost'] = naturesm['boost']
natures[nature]['remove'] = naturesm['remove'] | {
"domain": "codereview.stackexchange",
"id": 36084,
"lm_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, postgresql, automation",
"url": null
} |
Kudos [?]: 118 [1], given: 23
Math Expert
Joined: 02 Sep 2009
Posts: 42247
Kudos [?]: 132662 [2], given: 12331
Re: Concept doubt from number property [#permalink]
### Show Tags
18 Dec 2012, 04:00
2
KUDOS
Expert's post
Aristocrat wrote:
I came across these concept of number property ,which i read but still not able to understood properly...as WHY and HOW can i implement those concepts
The concept which i read is from MGMAT number property chapter 10:
1) Consecutive multiples of 'n' have a G.C.F of 'n'
2) The G.C.F of two numbers cannot be larger than difference between two number.
Why these concepts are formulated in these way and How to implement on the questions?
Regards,
Aristocrat
Consecutive multiples of 'n' have a G.C.F of 'n' | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 1,
"lm_q1q2_score": 0.8311430457670241,
"lm_q2_score": 0.8311430457670241,
"openwebmath_perplexity": 1873.9175549630347,
"openwebmath_score": 0.47573745250701904,
"tags": null,
"url": "https://gmatclub.com/forum/concept-doubt-from-number-property-144325.html?oldest=1"
} |
reinforcement-learning, dqn, deep-rl, implementation
def cartpole():
env = gym.make(ENV_NAME)
#score_logger = ScoreLogger(ENV_NAME)
observation_space = env.observation_space.shape[0]
action_space = env.action_space.n
dqn_solver = DQNSolver(observation_space, action_space)
checkpoint = tf.train.get_checkpoint_state(os.getcwd()+"/saved_networks")
print('checkpoint:', checkpoint)
if checkpoint and checkpoint.model_checkpoint_path:
dqn_solver.model = keras.models.load_model('cartpole.h5')
dqn_solver.model = model.load_weights('cartpole_weights.h5')
run = 0
i = 0
while i<5:
i = i + 1
#total = 0
run += 1
state = env.reset()
state = np.reshape(state, [1, observation_space])
step = 0
while True:
step += 1
#env.render()
action = dqn_solver.act(state)
state_next, reward, terminal, info = env.step(action)
#total += reward | {
"domain": "ai.stackexchange",
"id": 2255,
"lm_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, dqn, deep-rl, implementation",
"url": null
} |
php, sql, array
$matched = array_intersect_key($new_array, $split);
$join = implode('/', $matched); // join $matched as string.
echo $join; $string = '1/2/3/4';
$change = str_replace('/',',',$string);
$result = $connection->query("SELECT id, filename FROM pages WHERE id IN($change) ORDER BY FIELD(id,$change)");
$new_string = "";
while($row = $result->fetch_assoc()) {
$new_string .= $row['filename']."/";
}
$new_string = substr($new_string,0,-1);
echo $new_string;
Less looping - the match[] = $row was unnecessary IMO because you want a string back only...so you concatenate the file name with a / delimiter and then the last slash is removed with sub_str.
Updated the fixes including single query match. | {
"domain": "codereview.stackexchange",
"id": 6663,
"lm_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, sql, array",
"url": null
} |
gazebo
Thanks in advance.
Originally posted by munnveed on Gazebo Answers with karma: 45 on 2013-08-20
Post score: 3
Question 1
When using ros_control, the /joint_states topic is published by an instance of the JointStateController. This is a read-only controller that does not command any joint, but rather publishes the current joint states at a configurable frequency.
To run this controller you need to load its configuration to the ROS parameter server and load/start it in the controller manager. This launch file in the controller's repository does just that.
Once you have a valid joint_states topic, tf should start publishing frame data, and tf-dependent Rviz plugins like RobotModel should also work.
Question 2
These resources are currently available:
Tutorial on ros_control with Gazebo
ros_control overview on the ROS wiki
ros_control repository wiki | {
"domain": "robotics.stackexchange",
"id": 3435,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo",
"url": null
} |
• What would be a good source to understand more precisely the definition of the ∈ relationship? Would you recommend any book or some other material? – César D. Vázquez Jan 17 '20 at 12:30
• My absolute favourite is 'Naive Set Theory' by P R Halmos, which to my mind is a very good read. I don't recall if he actually goes very much into the $\in$ relation; though. Or, if you want a more rigorous treatment, try youtube.com/watch?v=V49i_LM8B0E - the first lecture in a series by Frederic Schuller: "Lectures on the Geometric Anatomy of Theoretical Physics" - he starts right from the bedrock with propositional logic. It isn't easy, but he is a breathtakingly brilliant lecturer and well worth listening to. Plus, you end up understanding fundamental set theory. – j4nd3r53n Jan 17 '20 at 12:53 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.96323053709097,
"lm_q1q2_score": 0.8068211330163195,
"lm_q2_score": 0.8376199694135333,
"openwebmath_perplexity": 294.02615598790885,
"openwebmath_score": 0.6585481762886047,
"tags": null,
"url": "https://math.stackexchange.com/questions/3512341/why-is-it-that-given-e-1-2-3-2-4-we-have-1-in-e-but-2-not-i"
} |
c#, object-oriented, enum
public static IEnumerable<string> GetNames<TEnumeration>()
where TEnumeration : Enumeration
{
return EnumerationCacheProvider<TEnumeration>.Get().Names.Keys;
}
}
internal class EnumerationCache<TEnumeration>
where TEnumeration : Enumeration
{
public readonly IReadOnlyCollection<TEnumeration> All;
public readonly IReadOnlyDictionary<string, TEnumeration> Names;
public readonly IReadOnlyDictionary<object, TEnumeration> Values; | {
"domain": "codereview.stackexchange",
"id": 33716,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, object-oriented, enum",
"url": null
} |
In order to get the third corner we once again deduct 2n, and the same thing for the fourth corner.
Summing all the corners we get
4(2n+1)2 – 12n
That means the sum of the diagonals can be written as
f(n) = 4(2n+1)2 – 12n + f(n-1)
Now it should be pretty easy to make a for loop for calculating f(500). However, I want to take a bit further.
## Deriving a non-iterative formula
Since we are working with a fairly nice formula, there is good chance that we can fit a polynomial to get an analytical solution for f(n). We used the same trick in the solution for problem 6 though we never proved it. The method uses differences and can also be seen at Ken Ward’s Mathematics Pages.
In order to figure out what order polynomial we need, we need to calculate the function value of f(n) and we need to calculate the differences. Δ1(n) represents the differences between f(n) and f(n-1). Δ2(n) = Δ1(n) – Δ1(n-1). and so on | {
"domain": "mathblog.dk",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9925393571981168,
"lm_q1q2_score": 0.8183109104401226,
"lm_q2_score": 0.8244619263765707,
"openwebmath_perplexity": 1216.102954213286,
"openwebmath_score": 0.571171760559082,
"tags": null,
"url": "https://www.mathblog.dk/project-euler-28-sum-diagonals-spiral/"
} |
frequency-spectrum, python, wavelet, hilbert-transform
Thanks! One technique that I've seen used in determining bearing faults is using the kurtosis of the vibration signal.
You can track as a function of time what Wikipedia calls the sample excess kurtosis. This is the kurtosis that is different from the kurtosis you would see if the signal was Gaussian distributed.
The sample excess kurtosis is defined as:
$$
\frac{m_4}{m_2^2} - 3 = \frac{\frac{1}{N} \displaystyle \sum_{n=0}^{N=1} (x_n - \bar{x})^4}{\left(\frac{1}{N} \displaystyle \sum_{n=0}^{N=1} (x_n - \bar{x})^2\right)^2} - 3
$$
where $\bar{x}$ is the sample mean, $m_2$ is the sample second order moment, and $m_4$ is the sample fourth order moment.
Brüel & Kjær have a nice writeup about using kurtosis, though they use the actual kurtosis rather than the excess kurtosis.
Why? | {
"domain": "dsp.stackexchange",
"id": 8448,
"lm_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, python, wavelet, hilbert-transform",
"url": null
} |
python, beginner, console
import random
import math
import time
import datetime
import pickle
import sys
import os
#miscellaneous functions + procedures
def w(t):
time.sleep(t)
def version_counter(filename="adventure_colussus_version_counter.dat"):
with open(filename, "a+") as f:
f.seek(0)
val = int(f.read() or 0) + 1
f.seek(0)
f.truncate()
f.write(str(val))
return val
counter = version_counter()
def t(text):
for char in text:
sys.stdout.write(char)
sys.stdout.flush()
time.sleep(0.021)
def save_character(save_name, character):
save_name_pickle = save_name + '.pickle'
t('> saving character')
w(1)
with open(save_name_pickle, 'wb') as f:
pickle.dump(character, f)
t('> character saved successfully') | {
"domain": "codereview.stackexchange",
"id": 40675,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, console",
"url": null
} |
By the Schwarz reflection principle, the formula $f(z)=\overline{f(1/\overline{z})}$ for $|z|>1$ extends $f$ analytically to the entire complex plane. Then by definition of the extension, $f(\mathbb{C})\subset f(\overline{\mathbb{D}}) \cup \overline{f(\overline{\mathbb{D}})}$, which is bounded by compactness. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9802808707404788,
"lm_q1q2_score": 0.8312465650098535,
"lm_q2_score": 0.8479677506936878,
"openwebmath_perplexity": 143.23199260161343,
"openwebmath_score": 0.8535443544387817,
"tags": null,
"url": "https://math.stackexchange.com/questions/1851114/showing-complex-function-is-constant"
} |
java, multithreading, thread-safety
return jsonResponse;
}
// create a URL
private String createURL(String userId) {
String generateURL = somecode;
return generateURL;
}
}
Is this the correct and efficient way of doing this problem?
How about the exception handling?
Do I need any other catch blocks at any places? Late answer to this question.....
There are a few things which should be considered when implementing a solution like this, and best-practice comes in to play here.
One nit-pick ... before we go further, your interface the methods
executeAsynchronous and executeSynchronous, whereas your
implementation has executeAsync and execute. This is a carelessly
posted question?
What you have, at the moment, works, but is it the best way? I don't think so.
You code has a few features that are important: | {
"domain": "codereview.stackexchange",
"id": 6039,
"lm_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, multithreading, thread-safety",
"url": null
} |
electromagnetism, magnetic-fields, electric-circuits, electric-current, electromagnetic-induction
reluctance is independent of $N$? Any help on this issue would be most appreciated! Reluctance is independent of the number of turns. Your confusion results from the fact that people use the word flux to refer to two closely related but different quantities. Recall that magnetic flux is the integral of $\vec B$ through a surface. To speak of a flux, we must first define what this surface is. In the analysis of magnetic circuits, this surface is usually the cross section of a relevant part of the magnetic circuit. In this case, this would be the cross section of the inductor winding with area $\pi r^2$. With this definition, the flux is $\Phi_1 = \pi r^2 B$ where $\vec B$ is the magnetic field within the coil (assumed uniform here for simplicity). From the reluctance of the magnetic circuit, we have $\mathcal F=\mathcal R\Phi_1 $, where $\mathcal F=NI$ is the mmf and $\mathcal R$ is the reluctance. | {
"domain": "physics.stackexchange",
"id": 88192,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, magnetic-fields, electric-circuits, electric-current, electromagnetic-induction",
"url": null
} |
### What does this answer mean?
Wikipedia traces the modern version of Bridge to 1904, states that it used to be more popular in the US, and reports there are around 25 million players today in the US. Although it's difficult to know exactly what it means to be a Bridge player, we might expect each one on average to play between a few hands and a few hundred hands annually, with each hand involving four players. (In Duplicate Bridge some deals are played multiple times, but let's ignore that complication and just absorb it into the "few to a few hundred" estimate.) The expected number of Bridge deals annually in the US in which a suit is dealt therefore is on the order of ten to a hundred times the product
$$p(4,13) \times 25 \times 10^6 \approx \frac{1}{1588}.$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9852713874477227,
"lm_q1q2_score": 0.8123187375996685,
"lm_q2_score": 0.8244619177503205,
"openwebmath_perplexity": 742.6071546877685,
"openwebmath_score": 0.8279216289520264,
"tags": null,
"url": "https://stats.stackexchange.com/questions/288200/what-is-the-chance-that-someone-is-dealt-a-suit-in-the-game-of-bridge"
} |
2.考虑一个从0开始以财富wealth0开始的一期投资者。他们必须选择
𝑅=
2,概率𝑝1= 1
2个
;
1,概率𝑝2= 1
4
;
0,概率𝑝3= 1
4
(a)从问题描述中确定时间1𝑉1处的值函数。 [1分]
(b)用𝑤0,𝑎和𝑅记下时间1的财富演化方程。推断
(c)使用您的最优性方程,否则找到𝑉0(𝑤0),即期望的最大混合
log(𝑊)的值,其中𝑊是时间1的财富。[8分]
(d)陈述𝑉𝑛−1(𝑥)的公式并描述𝑉𝑛−𝑖的一般模式
。 [6分]
(e)不用证明,以𝑤0和terms表示𝑉0(𝑤0)的公式。 [2分]
(f)如果𝑝1=𝑝2=𝑝3= 1,则解如何变化
3
?解释你的答案。 [4分]
(g)如果我们固定𝑝2= 1
3
3
−𝑝1描述了在时间− − 1时的最佳投资为
𝑝1在2之间变化
3
2. Consider a one-period investor who begins at time 0 with wealth 𝑤0. They must choose
at time 0 to invest a quantity 𝑎 ∈ [0,𝑤0] which provides multiplicative returns 𝑅, i.e. 𝑎
becomes 𝑎𝑅, where
𝑅 = | {
"domain": "easy-due.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109489630493,
"lm_q1q2_score": 0.820667179388715,
"lm_q2_score": 0.8333245891029456,
"openwebmath_perplexity": 12092.053587432752,
"openwebmath_score": 0.8913640975952148,
"tags": null,
"url": "https://www.easy-due.com/%E9%87%91%E8%9E%8D%E5%BB%BA%E6%A8%A1%E4%BB%A3%E5%86%99-math4018-stochastic-financial-modelling-2/"
} |
organic-chemistry, acid-base, carbonyl-compounds, amines, amides
The one difference between the mono and the di systems is that the mono system has no of polymerising or cyclising. So the amide bond will always consist of one acid fragment and one amine fragment while in the case of a diamine and a diacid polymerisation or cyclisation can occur. | {
"domain": "chemistry.stackexchange",
"id": 11321,
"lm_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, acid-base, carbonyl-compounds, amines, amides",
"url": null
} |
Interesting things, infinite sums.
13. ### diazona
2,156
It is, actually, why would you say it's not? (Yes this is weird at first sight)
14. ### HallsofIvy
40,967
Staff Emeritus
Are you simply saying that it should be written as "1"? "Technically", 0.999999999... (NOT "0,9999999999") is equal to 9/9 which is the same as 1.
15. ### TauCrouton
9
I'm not saying its not, I'm saying 0.999999999.... isn't technically 1, just infinitesimally close to 1. (see below)
I meant to say the 0.99999... is a repeating 9 not a discreet value of "0.999999999", if that clears things up.
Either way, it is an interesting technicality. The way I was taught to understand infinite sums of sequences is that they come infinitesimally close to a value, but never actually reach the value. Similar in conundrum to the definition of an asymptote, or a limit. They just come so close to the value that we might as well call it that value.
16. ### Dick | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9830850857421198,
"lm_q1q2_score": 0.8213514067229936,
"lm_q2_score": 0.8354835391516133,
"openwebmath_perplexity": 1259.068999820337,
"openwebmath_score": 0.9090983271598816,
"tags": null,
"url": "https://www.physicsforums.com/threads/converting-recurring-decimals-to-fractions.366804/"
} |
statistical-mechanics, biophysics
Title: Free energy and stability I am currently reading up on the formation of $\beta$-sheets. The following text describes its formation from a free energy point of view:
The edge of a β-sheet consists of (a) edge β-strands, and (b) bends or
loops connecting the β-strands [...]. Let the coil free energy be zero
(i.e., the reference point); $f_{\beta}$ , the free energy of a
residue in the center of the β-sheet; $f_{\beta}$ + $\Delta f_{\beta}$
, the free energy of an edge β-strand residue (i.e., $\Delta f_{\beta}$ is
the edge effect); and U, the free energy of a bend. Since the β-sheet
forms, it is stable (i.e., $f_{\beta}$ < 0), and the edge effects
prevent it from falling into pieces (i.e., $\Delta f_{\beta}$ > 0
and U > 0) (Finkelstein, Protein Physics) | {
"domain": "physics.stackexchange",
"id": 37450,
"lm_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, biophysics",
"url": null
} |
lagrangian-formalism, symmetry, field-theory, interactions
$$\psi \to e^{-i a} \psi, \quad \chi \to e^{-2 i a} \chi$$
could certainly be a $U(1)$ symmetry. However, since the $\chi$ field transforms twice as much, the corresponding conserved charge would count the number of $\psi$ particles plus twice the number of $\chi$ particles. So this would not count the total number of particles, but it could be the electric charge if $\chi$ has twice the charge of $\psi$.
If you want the symmetry whose corresponding conserved quantity is the number of $\psi$ particles plus the number of $\chi$ particles, then you have to choose
$$\psi \to e^{-i a} \psi, \quad \chi \to e^{-i a} \chi.$$
This is what is usually called $U(1)_V$. | {
"domain": "physics.stackexchange",
"id": 53769,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lagrangian-formalism, symmetry, field-theory, interactions",
"url": null
} |
c#
public static bool IsValid(DateTime candidate)
I don't support the idea of having this method public and I cannot think of any case where it would be useful. If I create my value-object I either expect it to throw an exception or to have an exception-free TryDoSomething. IsValid woudld mean I have to implement TryDoSomething myself.
"Age must be greater than 21."
Because of this strange constraint this class shouldn't be named just DateOfBirth. It looks more like a CanHaveDrivingLicenseDateOfBirth or CanDrinkAlcoholDateOfBirth. It needs a much stronger name.
Implementing such types means a lot of work in terms of overriding all the equality methods. In order to save you some time you should have a base type Date or Name that already implements all the basic and mandatory logic and if necessary just override it in the derived class and add to it in your CanMarryDateOfBirth or LastName.
Other issues in your code are in the constructors. | {
"domain": "codereview.stackexchange",
"id": 29342,
"lm_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#",
"url": null
} |
thermodynamics, statistical-mechanics, kinetic-theory
Title: Can the specific heat of a substance depend on its amount? We define specific heat of a substance as,
$$s=\frac{S}{m}=\frac{1}{m} \frac{dQ}{dT}$$
where $s$ is the specific heat, $S$ is the heat capacity and $m$ is the mass of the substance. Since the derivative of heat $Q$ with respect to the temperature $T$ is not a partial derivative, so I assumed that $Q$ is only a function of the temperature. So the specific heat will als be only a function of the temperature. And there is nothing wrong with this, as the specific heast $s$ can vary with varying temperature for non-ideal gases or even solids and liquids. | {
"domain": "physics.stackexchange",
"id": 63448,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, statistical-mechanics, kinetic-theory",
"url": null
} |
-
(My algebras have $1$) – Mariano Suárez-Alvarez Jul 25 '13 at 7:12
For the 2nd question, you can start as follows: suppose $A$ is as above, and that $f$, $g:A\to M_n(\CC)$ are two $*$-injections. Then $\CC^n$ is an $A$-module, compatibly with the star, in two ways. Now $A$ has excatly one $n$-dimensional faithful module, so the two modules are isomorphic, and that gives us a matrix $U\in M_n(\CC)$ realizing the iso. &c. (I guess this is a $*$-version of Noether-Skolem's theorem...) – Mariano Suárez-Alvarez Jul 25 '13 at 7:26
This is a nice succinct explanation of the fact. I needed to use this to simplify some argument I was doing, and if someone asks why, this kind of logic/perspective will be useful. – J. E. Pascoe Jul 26 '13 at 3:44
If your main concern is to have a reference to quote, then 1) is Theorem III.1.1 and 2) is essentially Corollary III.1.2 or Lemma III.2.1 in Davidson's book, as mentioned by Mike Jury. | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9525741214369554,
"lm_q1q2_score": 0.8188934418731819,
"lm_q2_score": 0.8596637505099167,
"openwebmath_perplexity": 254.7846428973272,
"openwebmath_score": 0.948934018611908,
"tags": null,
"url": "http://mathoverflow.net/questions/137655/structure-theorem-for-finite-dimensional-c-algebras-and-their-representation"
} |
electromagnetism, dielectric
Also note that we have calculated the time averaged energy density. As mentioned above, this is usually what is meant when referring to the energy density in time-varying problems. However, if you want the complete instantaneous energy density at any given time, you will have to find the complete field (phasor) distribution using your $\tilde {\epsilon}_r$ relation (and boundary conditions, etc.), and then calculate the time domain fields and use our first equation for the instantaneous energy. This is because there is no practical equation connecting $\mathscr U_e(t)$ to the field phasors. | {
"domain": "physics.stackexchange",
"id": 45659,
"lm_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, dielectric",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.