text stringlengths 1 1.11k | source dict |
|---|---|
machine-learning, scikit-learn, random-forest, decision-trees
So, if you want to replicate the predict() method using only the decision paths, you would need to do the following: | {
"domain": "datascience.stackexchange",
"id": 11795,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, scikit-learn, random-forest, decision-trees",
"url": null
} |
slam, navigation, visual-odometry, ros-kinetic, rtabmap-odometry
Originally posted by EduardoCota on ROS Answers with karma: 3 on 2018-03-14
Post score: 0
Original comments
Comment by jayess on 2018-03-14:
Are you sure that base_link exists? Can you post your tf tree?
Comment by EduardoCota on 2018-03-15:
Thank you for answering! @matlabbe suggestion worked for me.
Try:
$ rosrun rtabmap_ros rgbd_odometry rgb/image:=/camera/rgb/image_raw depth/image:=/camera/depth/image rgb/camera_info:=/camera/rgb/camera_info _frame_id:=camera_link
However, make sure the depth image topic is registered to RGB camera. Like in this tutorial:
$ roslaunch openni_launch openni.launch depth_registration:=true
$ rosrun rtabmap_ros rgbd_odometry rgb/image:=/camera/rgb/image_rect_color depth/image:=/camera/depth_registered/image_raw rgb/camera_info:=/camera/rgb/camera_info _frame_id:=camera_link
Originally posted by matlabbe with karma: 6409 on 2018-03-15
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 30322,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam, navigation, visual-odometry, ros-kinetic, rtabmap-odometry",
"url": null
} |
javascript, node.js, mongodb, chat, socket.io
Title: Realtime chat service I am new to Node.js and Socket.io. I implemented a realtime chat service that has a chatroom feature. When the actual product is launched, there will be at least 200 concurrent users with 50 groups of 4 people. I would appreciate any advice on its performance and any recommendations.
Server (remote server)
var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.use(express.static(__dirname + '/')); | {
"domain": "codereview.stackexchange",
"id": 14463,
"lm_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, node.js, mongodb, chat, socket.io",
"url": null
} |
java, serial-port
GridBagConstraints gbc_alarm3Button = new GridBagConstraints();
gbc_alarm3Button.insets = new Insets(0, 0, 5, 0);
gbc_alarm3Button.gridx = 9;
gbc_alarm3Button.gridy = 4;
getContentPane().add(alarm3Button, gbc_alarm3Button);
JLabel lblStopBits = new JLabel("Stop Bits");
GridBagConstraints gbc_lblStopBits = new GridBagConstraints();
gbc_lblStopBits.insets = new Insets(0, 0, 5, 5);
gbc_lblStopBits.anchor = GridBagConstraints.EAST;
gbc_lblStopBits.gridx = 0;
gbc_lblStopBits.gridy = 5;
getContentPane().add(lblStopBits, gbc_lblStopBits); | {
"domain": "codereview.stackexchange",
"id": 12793,
"lm_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, serial-port",
"url": null
} |
quantum-state, quantum-operation
Basically we replace: $|i\rangle \langle j | \in \mathcal{L}(H_0,H_1) \leftrightarrow |i,j \rangle \rangle \in H_1 \otimes H_0$
C.J isomorphism: mixed case
The mixed case consist in associating linear operator to quantum map. Let $\mathcal{M} \in \mathcal{L}(\mathcal{L}(H_0),\mathcal{L}(H_1))$. We define the Choi matrix $M \in \mathcal{L}(H_1 \otimes H_0)$ such that:
$$\mathcal{C}(\mathcal{M}) \equiv (\mathcal{M} \otimes \mathcal{I}_{H_0}) (|\mathcal{I}_{H_0} \rangle \rangle \langle \langle \mathcal{I}_{H_0} | )$$
We notice the strong analogy with the definition of the Choi isomorphism for the pure case.
My questions | {
"domain": "quantumcomputing.stackexchange",
"id": 1835,
"lm_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, quantum-operation",
"url": null
} |
In a similar fashion $$d \divides b$$, therefore by the divisibility property #4
$d \divides sa + tb$
The next thing to prove is that $$d$$ is the greatest common divisor of $$a$$ and $$b$$. To prove this lets show that if $$d'$$ is any other common divisor of $$a$$ and $$b$$ then $$d' \le d$$.
If $$d' \divides a$$ and $$d' \divides b$$ then by the divisibility property #4 it divides any other linear combination of $$a$$ and $$b$$, since $$d = sa + bt$$ is one linear combination of $$a$$ and $$b$$ it follows that $$d' \divides d$$ so either $$d' \lt d$$ or $$d' = d$$, finally we can conclude that
$d = (a,b)$
### Euclidean Algorithm
A very efficient method to compute the greatest common denominator
theorem
Suppose $$a, b$$ be integers with $$a \ge b \gt 0$$
1. Apply the division algorithm $$a = bq + r, 0 \le r \lt b$$
2. Rename $$b$$ as $$a$$ and $$r$$ as $$b$$ and repeat 1 until $$r = 0$$
The last nonzero remainder is the greatest common divisor of $$a$$ and $$b$$ | {
"domain": "mauriciopoppe.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.996115523105284,
"lm_q1q2_score": 0.8322381206076429,
"lm_q2_score": 0.8354835371034368,
"openwebmath_perplexity": 185.70392430295874,
"openwebmath_score": 1.0000098943710327,
"tags": null,
"url": "https://www.mauriciopoppe.com/notes/mathematics/number-theory/divisibility/"
} |
c++, beginner, object-oriented, game
six1 = six1 + randoml;
cout << "You had a recruit visiting and you won! The recruit's liking of your school has increased by " << randoml << endl;
sixv = 0;
}
if(sevenv == 1){
randoml = 0;
randoml = rand() % 20 + 1;
seven1 = seven1 + randoml;
cout << "You had a recruit visiting and you won! The recruit's liking of your school has increased by " << randoml << endl;
sevenv = 0;
}
if(eightv == 1){
randoml = 0;
randoml = rand() % 20 + 1;
eight1 = eight1 + randoml;
cout << "You had a recruit visiting and you won! The recruit's liking of your school has increased by " << randoml << endl;
eightv = 0;
}
if(ninev == 1){
randoml = 0;
randoml = rand() % 20 + 1;
nine1 = nine1 + randoml;
cout << "You had a recruit visiting and you won! The recruit's liking of your school has increased by " << randoml << endl;
ninev = 0;
}
if(tenv == 1){
randoml = 0;
randoml = rand() % 20 + 1;
ten1 = ten1 + randoml; | {
"domain": "codereview.stackexchange",
"id": 39714,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, beginner, object-oriented, game",
"url": null
} |
c++, game
if (utility::check_key())
{
char key = utility::get_key();
switch (key)
{
case 'w':
{
player->SetYSpeed(-3);
break;
}
case 'a':
{
player->SetXSpeed(-3);
break;
}
case 's':
{
player->SetYSpeed(3);
break;
}
case 'd':
{
player->SetXSpeed(3);
break;
}
case' ':
{
shoot(player, true);
break;
}
case 'x':
{
Engine.Exit();
break;
}
default:
{
break;
}
}
}
} | {
"domain": "codereview.stackexchange",
"id": 30067,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, game",
"url": null
} |
ros, moveit, kuka
Thanks.
Originally posted by Ranjit Kathiriya on ROS Answers with karma: 1622 on 2021-02-17
Post score: 1
Original comments
Comment by fvd on 2021-02-17:
Please show how you changed the URDF file and what error you received.
Comment by gvdhoorn on 2021-02-17:
Apart from the fact you're using a KUKA, this reads like a duplicate of #q321902.
If you agree, please close your question as such.
Edit: it might be good to change the title of your question to "I want to attach my robot upside-down". The current title asks about a possible solution, which is typically regarded as an xy-problem.
Comment by gvdhoorn on 2021-02-17:
Please post updates by appending to in your original question text. Do not use comments for this.
Use the edit button/link under your original post to update it.
Comment by Ranjit Kathiriya on 2021-02-17:
I am sorry was not knowing that we can edit the original question post. I am not able to delete this comment. I am getting 10 minutes posting error. | {
"domain": "robotics.stackexchange",
"id": 36096,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, moveit, kuka",
"url": null
} |
or enquiries via our feedback page done. As a function defined IMPLICITLY be differentiated using implicit differentiation and the crew of the following solve... A ) find dy dx and solve for x, Since, ⇒. The equation with respect to x and y, and viewing y as an functio…... D dx of both x and then solving the resulting equation for y 0 find dy/dx implicit. Finding dy/dx, you can ’ t already read about implicit differentiation is nothing more than a case... Circle ( Fig done using the product rule sometimes you will need to solve an equation for y and is... Y and y, and form is explicit differentiation where x is given on one and! Feedback, comments and questions about this site or page your word or phrase where you to. 4 + 2x 2 y 2 + y 3 = implicit differentiation examples solutions x 2 + 3y 2 y ' =,... Function is known as an implicit function is known as an implicit functio… Worked example: implicit.. Or type in your word or phrase where you want to differentiate a defined! The point ( 3,4 | {
"domain": "org.in",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9674102571131692,
"lm_q1q2_score": 0.8279591728028647,
"lm_q2_score": 0.8558511414521923,
"openwebmath_perplexity": 1022.0094242350707,
"openwebmath_score": 0.8192722797393799,
"tags": null,
"url": "http://chetnaorganic.org.in/wn96qop/e19816-implicit-differentiation-examples-solutions"
} |
python
Let's talk about computing those angles.
The hours_angle and minutes_angle signatures
look a little suspect to me.
They omit seconds, or rather they implicitly
treat it as zero seconds.
I guess that for some clocks that's the appearance they offer.
I would be happier if we were passing a time object
into these helpers and letting each helper decide
if it implements a clock style which prohibits
movement of the other hands for sixty seconds.
Usually I'm a big fan of "make it smaller!", "extract more helpers!".
But here I wonder if we've maybe gone too far in that direction.
Computing total seconds can look a bit like
Horner's method:
seconds_since_midnight = ((h) * 60 + m) * 60 + s
With that representation in hand we might multiply by a conversion factor of six:
degrees_since_midnight = seconds_since_midnight * 360 / 60 | {
"domain": "codereview.stackexchange",
"id": 45176,
"lm_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
} |
python, beginner, python-2.x, graph
def DFS(theGraph,source):
n=len(theGraph)
explored=np.empty(n,bool)
for i in range(0,n):
explored[i]=False
explored[source]=True
stack = [source]
while len(stack)!=0:
v=stack.pop()
print "theNode: ", v
for i in theGraph[v]:
if(not explored[i]):
explored[i]=True
stack.append(i)
return explored
def DFSrec(theGraph,explored,source):
explored[source]=True
print "theNode: ",source
for i in theGraph[source]:
if(not explored[i]):
DFSrec(theGraph,explored,i)
return explored
n=6 #number of nodes
theGraph=[set() for i in range(n)]
theGraph[0].add(1)
theGraph[0].add(2)
theGraph[1].add(0)
theGraph[1].add(3)
theGraph[2].add(0)
theGraph[2].add(4)
theGraph[3].add(1)
theGraph[3].add(5)
theGraph[4].add(2)
theGraph[4].add(5)
theGraph[5].add(3)
theGraph[5].add(4)
print theGraph
print "DFS: "
print DFS(theGraph,0) | {
"domain": "codereview.stackexchange",
"id": 9709,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, python-2.x, graph",
"url": null
} |
java, algorithm, bitwise
A method that doesn't need data in member fields can be static. The IPAddress method looks like a good candidate for a static utility method in an IPAddressUtils class.
The Java convention is camelCase for method names (violated by IPAddress)
Poor naming: the IPAddress method takes a dotted decimal notation and returns a 32-bit integer representation. The name "IPAddress" does very little to describe that
finalByte is unused, unnecessary
Unusual declaration: instead of int numbers[], the convention is int[] numbers
Unusual formatting
Simplification
You don't need an int[] to calculate the value. You need just one value, and shift it to the left by 8 bits for each parsed byte value.
Instead of the number 48 for '0', you can just use '0' to make the meaning obvious.
Suggested implementation
Applying the above suggestions, here's a utility class:
public class IPAddressUtils { | {
"domain": "codereview.stackexchange",
"id": 19076,
"lm_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, bitwise",
"url": null
} |
c++, c++11
I will later dissociate definitions and implementations of member functions but only when I am satisfied with them.
I also implemented a multi-association class in the same way so that I can can either pass Association or MultiAssociation in template. I hid it to be more concise. Naming should describe operation
I have no idea what this code is trying to achieve (that's a bad sign).
Naming types A1 and A2 when they have some deterministic meaning (that I don't understand) is confusing. Normal I go for very short types names myself ('T' for example). But only when the type does not matter. Here I feel the type does matter.
But this code definitely needs some heavy commenting on what it is trying to achieve. As written this is un-maintainable because any maintainer will struggle to work out what is happening.
std is sacrosanct
This is illegal:
namespace std
{
template <std::size_t I, typename D, typename... Ts> | {
"domain": "codereview.stackexchange",
"id": 15390,
"lm_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",
"url": null
} |
Here we will solve the problem directly, in term of 'pure' point-set topology; it won't be necessary to use the concept of a function.
To define the topological product of two spaces we specify a 'cartesian product' base. For $\mathbb R^2$ it is not difficult to show that a different base can be chosen that generates the result - we can use open disks.
Exercise: Show that all lines and line segments (can be either open or closed at an endpoint) in $\mathbb R^2$ are connected.
Let $(L_\alpha)$ be the family of all lines passing through the point $(1,0)$. Let
$\tag 1 S_\alpha = L_\alpha \bigcap X$
It is easy to see that each $S_\alpha$ is a line ($x = 1$) or a line segment. Moreover,
$\tag 2 \bigcup S_\alpha =X$ and $\tag 3 \bigcap S_\alpha = \{(1,0)\}$
But a well known result allows us to now conclude that $X$ is connected. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429147241161,
"lm_q1q2_score": 0.8392100675555212,
"lm_q2_score": 0.8519527982093666,
"openwebmath_perplexity": 196.15369526298102,
"openwebmath_score": 0.858590841293335,
"tags": null,
"url": "https://math.stackexchange.com/questions/2725492/let-p-x-y-in-mathbb-r2-x2y21-and-q-1-x-x-in-mathb"
} |
gazebo, pr2
Comment by dornhege on 2013-01-17:
For simulation you could use fake localization: http://www.ros.org/wiki/fake_localization
Comment by jys on 2013-01-17:
That looks great. But still confused.. What is correct step of launching stuff.. I launch pr2_emptyworld and run fake_localization? Is something missing inbetween? Do you know why fake_localization complains about Dropped 100.00% of messages so far. Please turn the [ros.fake_localization. blah blah | {
"domain": "robotics.stackexchange",
"id": 12463,
"lm_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, pr2",
"url": null
} |
ros, roslaunch, rplidar, rosrun
NODES
/
rplidarNode (rplidar_ros/rplidarNode)
ROS_MASTER_URI=http://localhost:11311
core service [/rosout] found
process[rplidarNode-1]: started with pid [7032]
RPLIDAR running on ROS package rplidar_ros
SDK Version: 1.5.7
Error, cannot bind to the specified serial port /dev/ttyUSB0.
[rplidarNode-1] process has died [pid 7032, exit code 255, cmd /home/ubuntu/catkin_ws/devel/lib/rplidar_ros/rplidarNode __name:=rplidarNode __log:=/home/ubuntu/.ros/log/687ff54e-e312-11e6-a5f7-0022cffa2d4b/rplidarNode-1.log].
log file: /home/ubuntu/.ros/log/687ff54e-e312-11e6-a5f7-0022cffa2d4b/rplidarNode-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done
Originally posted by sophie.shin on ROS Answers with karma: 15 on 2017-01-28
Post score: 0
$ roslaunch rplidar_ros rplidar.launch
it shows | {
"domain": "robotics.stackexchange",
"id": 26854,
"lm_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, roslaunch, rplidar, rosrun",
"url": null
} |
physical-chemistry, theoretical-chemistry, recrystallization
I'm really struggling to understand this phenomenon — I've looked in textbooks and online, but I'm struggling to find anything, probably because capillary is a very common word.
I understand classical nucleation theory (I think), so I tried to relate that, but I'm struggling to see how the shape of a container would influence the clusters forming — surely even a very narrow capillary is huge to an atom! And as touched on in some of the answers, is it just nucleation that's slow to proceed, or crystal growth as well? I'm no expert, but I think it likely IS related to both the shape and dimension. If I understand how the capillary tube method (I referred to 2.2.15. MELTING POINT - OPEN | {
"domain": "chemistry.stackexchange",
"id": 15911,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry, theoretical-chemistry, recrystallization",
"url": null
} |
computability, terminology, kolmogorov-complexity, descriptive-complexity
So is this sum well-defined? In other words, is the domain of $K$ well defined? I think you are right; $K$ is a specific function which can not be computed. The author likely means to use some (arbitrary) approximative implementation; so no, this does not seem to be well-defined, if you are pedantic. You can also call it abuse of notation.
Consider this instead:
$\qquad \displaystyle \forall {M \in \mathcal{M}_K}.\ \sum_{M(\sigma)\downarrow} 2^{-K(\sigma)} \leq 1$
with $\mathcal{M}_K = \{M\ \mathrm{TM} \mid M(\sigma)\!\downarrow\ \implies\ M(\sigma)=K(\sigma) \}$ the set of all Turing machines that compute subfunctions of $K$.
In essence, this means: the bound holds no matter for which strings your implementation can compute the Kolmogorov complexity. | {
"domain": "cs.stackexchange",
"id": 322,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computability, terminology, kolmogorov-complexity, descriptive-complexity",
"url": null
} |
In the annulus $$1<|z|<\infty$$, we have
\begin{align} \frac{1}{z(1-z)}&=\frac{1}{z}+\frac1{1-z}\\\\ &=\frac{1}{1+(z-1)}+\frac1{1-z}\\\\ &=\frac1{z-1}\frac{1}{1+\frac1{z-1}}-\frac1{z-1}\\\\ &=\frac1{z-1}\sum_{n=0}^\infty (-1)^n \left(\frac{1}{z-1}\right)^n-\frac1{z-1}\\\\ &=\sum_{n=1}^\infty (-1)^{n-1}\left(\frac1{z-1}\right)^{n+1} \end{align} | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9711290922181331,
"lm_q1q2_score": 0.8092657497286537,
"lm_q2_score": 0.8333245870332531,
"openwebmath_perplexity": 787.3055692917452,
"openwebmath_score": 0.9999314546585083,
"tags": null,
"url": "https://math.stackexchange.com/questions/3045468/finding-the-laurent-series-complex-numbers"
} |
Theorem 1 (Morita)
Let $X$ be a space. Then $X$ is a normal P-space if and only if $X \times Y$ is normal for every metric space $Y$.
In light of Theorem 1, both perfectly normal spaces and normal countably compact spaces are P-spaces (see here). According to Theorem 1 and Dowker’s theorem, it follows that any normal P-space is countably paracompact.
____________________________________________________________________
Reference
1. Morita K., On the Product of a Normal Space with a Metric Space, Proc. Japan Acad., Vol. 39, 148-150, 1963. (article information; paper)
2. Morita K., Products of Normal Spaces with Metric Spaces, Math. Ann., Vol. 154, 365-382, 1964.
____________________________________________________________________
$\copyright \ 2017 \text{ by Dan Ma}$
# The product of a normal countably compact space and a metric space is normal | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9780517469248845,
"lm_q1q2_score": 0.8293563511751529,
"lm_q2_score": 0.8479677622198946,
"openwebmath_perplexity": 99.66562212800767,
"openwebmath_score": 0.9851532578468323,
"tags": null,
"url": "https://dantopology.wordpress.com/tag/metrizable-spaces/"
} |
homework-and-exercises, newtonian-mechanics, free-body-diagram, string
If so, then mass 2 will also accelerate, this implies that net force on m2 is not zero. But if you put T = W for mass 2, then net force will become zero. Thus the assumption that T=W for m2 is wrong.
And yes your assumption that m2a = W - T and m1a = T, are correct. | {
"domain": "physics.stackexchange",
"id": 52959,
"lm_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, free-body-diagram, string",
"url": null
} |
c++, multithreading, concurrency, queue, producer-consumer
The Circular Buffer Nodes & Spin-locks | {
"domain": "codereview.stackexchange",
"id": 42825,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, multithreading, concurrency, queue, producer-consumer",
"url": null
} |
thermodynamics, statistical-mechanics, probability, partition-function
Title: Confusion about using single particle or $N$ particle partition function in Boltzmann probability in canonical ensemble Suppose we have a canonical ensemble, where $N$ particles have been divided among $\epsilon_i$ energy levels, each with degeneracy $g_i$. The partition function for a single particle is given by : $$Z_{sp}=\sum_{i}^{r} g_i e^{-\beta\epsilon_i}$$
There are $r$ total energy levels here.
Anyway, the partition function for all the $N$ particles can be found using the same formula, by checking all the possible combinations and values of total energy due to each of these particles, which would be a long and tedious process. However, we can write the $N$ particle partition function as follows :
$$Z_{N}=\prod_{i}^{N}(Z_{sp})_i$$
Now we know that the probability of the system being in a particular 'energy level' is :
$$P(\epsilon_i)=\frac{g_i e^{-\beta \epsilon_i}}{Z}$$ | {
"domain": "physics.stackexchange",
"id": 84027,
"lm_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, probability, partition-function",
"url": null
} |
ros, gazebo, multimaster, roscore, parallel
<group ns="ns_B">
<!-- start gazebo server-->
<node name="gazebo_B" pkg="gazebo_ros" type="gzserver" respawn="false" output="screen"
args="$(arg command_arg1) $(arg command_arg2) $(arg command_arg3) $(arg world_name)" />
<!-- start gazebo client -->
<node name="gazebo_gui_B" pkg="gazebo_ros" type="gzclient" respawn="false" output="screen"></node>
</group>
</launch>
When I execute all this I get one instance of Gazebo running, in which I insert a box.
Then, when I launch the second instance (test_B.launch) I get a new Gazebo window in which I see the box inserted on the first. In other words, as I understand it, I got another client connected to the same server, even running from different ros masters. This is the exception the second instance trows:
Exception [Master.cc:50] Unable to
start server[Address already in use].
There is probably another Gazebo
process running. | {
"domain": "robotics.stackexchange",
"id": 19456,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, gazebo, multimaster, roscore, parallel",
"url": null
} |
javascript, react.js
Update Took out logic and explanation having to do with a faulty assumption of how the O.P.'s three booleans were used. (The O.P. corrected me in the comments). Also added more feedback because the O.P. provided the entire component to review, and fixed some bugs (also mentioned in the comments). | {
"domain": "codereview.stackexchange",
"id": 40567,
"lm_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, react.js",
"url": null
} |
python, performance, beginner, image, tower-of-hanoi
def solve_tower(disks):
source = list(range(disks, 0, -1))
target = list()
helper = list()
yield tuple(source), tuple(target), tuple(helper)
state = dict(
source=source,
target=target,
helper=helper,
)
yield from hanoi_gen(disks, source, helper, target, state)
steps = tuple(solve_tower(2))
assert steps == (
((2, 1), (), ()),
((2,), (), (1,)),
((), (2,), (1,)),
((), (2, 1), ()),
)
Magic numbers
There are some magic numbers in your code, 10, 40, 5, ...
Better is to extract global constants from this:
BUFFER_PEG = 10
LINE_WIDTH = 1
BUFFER_STEP = 5
WHITE = 1
BLACK = 0
And use them like:
image_width = disks * 2 * 3 + 4 * BUFFER_PEG
BLACK and WHITE can also be done with an enum.IntEnum:
from enum import IntEnum
class Color(IntEnum):
BLACK = 0
WHITE = 1
DRY
Compartmentalize!
There is a lot of repeated code, which makes this hard to maintain and test:
from itertools import repeat | {
"domain": "codereview.stackexchange",
"id": 31148,
"lm_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, image, tower-of-hanoi",
"url": null
} |
c++, functional-programming, c++14, template-meta-programming
Convention
Metaprogramming is hard. It's hard to write, it's hard to debug. That's why it's very important to have conventions. One convention is that the result of a metafunction is named type. Not Type. Stick to convention.
Also, stick to types. Types are first-class citizens in the template metaprogramming world. Values and template templates suck. They need specific handling code all over the place and they're much more trouble than they're worth.
Lastly, we have the concept of metafunction class. In the Boost.MPL world, this was something like:
struct metafunction_class {
template <???>
struct apply {
typedef ??? type;
};
};
With C++11, this can simply down to:
struct metafunction_class {
template <???>
using apply = ???;
}; | {
"domain": "codereview.stackexchange",
"id": 15614,
"lm_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++, functional-programming, c++14, template-meta-programming",
"url": null
} |
java, beginner, programming-challenge, array
My questions are:
How would I implement this without the guard condition? The result without it is 0 because it doesn't get as far as the second for loop, as numberToInsert is already 1. I tried to set this as 0, and increment it later in the code, but I couldn't figure this out.
What alternative is there to the count and target system I implemented? Was this a good or bad way to achieve the outcome?
How else could the numbers be inserted? The method I used felt the most logical but I'm curious to see other methods. Addressing into a 1d or 2d array is not a real problem for a square array
ary[i,j] = value;
can be written as
ary[i*n + j] = value | {
"domain": "codereview.stackexchange",
"id": 13124,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, programming-challenge, array",
"url": null
} |
java, performance, parsing, xml
while (...) {
futureops.add(service.submit(new Callable<Integer>() {
public String call() throws IOException {
// ****** Will need to probably do this as a separate class to get *****
// ****** it to compile right, or use `final` judiciously. *****
DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
DocumentBuilder b = f.newDocumentBuilder();
Document doc = b.parse(urlString);
doc.getDocumentElement().normalize();
NodeList items = doc.getElementsByTagName("group");
Node n = items.item(poolCounter);
Element e = (Element) n; | {
"domain": "codereview.stackexchange",
"id": 6988,
"lm_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, performance, parsing, xml",
"url": null
} |
s Name Formula n Sum of Reciprocals[1][2]
1 2 3 4 5 6 7 8 9 10
3 Triangular ½(n²+n) 1 3 6 10 15 21 28 36 45 55 ${2}$[1]
4 Square n² = ½(2n² - 0n) 1 4 9 16 25 36 49 64 81 100 ${\pi^2\over6}$[1]
5 Pentagonal ½(3n² - n) 1 5 12 22 35 51 70 92 117 145 ${ 3\ln\left(3\right)}-{\pi\sqrt{3}\over3 }$[1]
6 Hexagonal ½(4n² - 2n) 1 6 15 28 45 66 91 120 153 190 ${ 2\ln\left(2\right) }$[1]
7 Heptagonal ½(5n² - 3n) 1 7 18 34 55 81 112 148 189 235 $\begin{matrix} \frac{2}{3}\ln(5) \\ +\frac{{1}+\sqrt{5}}{3}\ln\left(\frac{1}{2}\sqrt{10-2\sqrt{5}}\right) \\ +\frac{{1}-\sqrt{5}}{3}\ln\left(\frac{1}{2}\sqrt{10+2\sqrt{5}}\right) \\ +\frac{1}{15}{\pi}{\sqrt{25-10\sqrt{5}}} \end{matrix}$[1]
8 Octagonal ½(6n² - 4n) 1 8 21 40 65 96 133 176 225 280 ${ {3\ln\left(3\right)\over4} + {\pi\sqrt{3}\over12} }$[1]
9 Nonagonal (enneagonal) ½(7n² - 5n) 1 9 24 46 75 111 154 204 261 325
10 Decagonal ½(8n² - 6n) 1 10 27 52 85 126 175 232 297 370 ${ {\ln\left(2\right)} + {\pi\over6} }$ | {
"domain": "fandom.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9884918533088547,
"lm_q1q2_score": 0.8149738911913315,
"lm_q2_score": 0.8244619199068831,
"openwebmath_perplexity": 683.7738732966458,
"openwebmath_score": 0.7736610770225525,
"tags": null,
"url": "https://large-numbers.fandom.com/wiki/Polygonal_number"
} |
javascript, jquery
grey();
$('#gallerytitle').css('color', 'blue');
$('#e').css('color', 'blue');
$('html, body').animate( { scrollTop: $("#gallery").offset().top - 90 }, 2000);
break;
case "newsnav":
grey();
$('#newstitle').css('color', 'blue');
$('#f').css('color', 'blue');
$('html, body').animate( { scrollTop: $("#news").offset().top - 90 }, 2000);
break;
case "resultsnav":
grey();
$('#resultstitle').css('color', 'blue');
$('#g').css('color', 'blue');
$('html, body').animate( { scrollTop: $("#resu").offset().top - 90 }, 2000); | {
"domain": "codereview.stackexchange",
"id": 7690,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery",
"url": null
} |
electricity
Americans use electricity domestically for their ovens as well as heating. These are connected to high-voltage circuits, which are more efficient - and quicker. I guess electrical coffee-machines are still run on 120V; perhaps Americans are not in such a hurry to get their morning coffee as the British are to get their morning tea. Stove-top kettles are far more common in the USA than plug-in kettles.
The low availability of electric kettles in the USA is a socio-economic question which I think cannot be answered by physics alone. Filtered or percolated coffee is very popular despite also (I presume) using the inefficient 110V supply, so I think this cannot be the main reason. Cultural preference for coffee rather than tea, and distaste for instant coffee, means there is little demand for electric kettles. Take-away coffee is extensively available and cheap in the USA, so there is less incentive to brew it at home. | {
"domain": "physics.stackexchange",
"id": 98471,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electricity",
"url": null
} |
object-oriented, game, objective-c
default:
break;
}
}
It seems simple enough and it is pretty self documenting. If I want to add more cards, I add the values to the enum, change the constant in the AbilityCard class to the correct number, add the case to the switch statement in the Game, and then add a method to handle the logic. The worst case scenario, I will have to add one additional method to the Tower class for convenience if it is awkward for the Game to do whatever action is needed.
Ideally for OOP, the actual logic would somehow be encapsulated in each Card object. The only way I can think to do that would be to have the Card object contain a string that was converted to a selector, and use that selector to run a method that will still be in the Game anyway. I can't decide if that is better or just more complicated for no readability gain. @property AbilityCardType type;
Seems like this should probably be readonly:
@property (nonatomic,readonly) AbilityCardType type; | {
"domain": "codereview.stackexchange",
"id": 8896,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "object-oriented, game, objective-c",
"url": null
} |
particle-physics, field-theory
(the image above is inaccurate, but aids this topic’s comprehension)
then, if we were to demonstrate the concept in our euclidean world and consider 3 dimensional fields then would we get 4 dimensional waves and excitements?
if so, how come we don’t see these particles’ 4th dimensional attributes and properties? and if we do, what are they?
TL;DR: are excitements in our world’s fields, 4 dimensional (physical dimensions)?
all particles are actually excitements in their respective field; for analogy: electrons and the electric field, Higgs Bosons and Higgs field; | {
"domain": "physics.stackexchange",
"id": 86499,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "particle-physics, field-theory",
"url": null
} |
c#, object-oriented, .net, event-handling
private void LogMessage(string message, LoggingType loggingType, params Object[] par)
{
message = FormatMessage(message, par);
Program.LogLine(message, loggingType);
}
private String FormatMessage(string message, params Object[] par)
{
if (par.Length == 0)
{
return message;
}
return string.Format(message, par);
}
private void ProcessErrorMessage(string message)
{
LogMessage(message, LoggingType.Error);
}
private void AddClient(NetConnection connection)
{
if (connectedClients.Add(connection))
{
string msg = "New client discovered: {0}";
LogMessage(msg, LoggingType.Information, connection.RemoteEndPoint)
}
} | {
"domain": "codereview.stackexchange",
"id": 14563,
"lm_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, .net, event-handling",
"url": null
} |
performance, beginner, sql, sqlite
ELSE NULL
END
WHERE ESPECES_ATTRIBUTS.ID = NEW.ID;
END; | {
"domain": "codereview.stackexchange",
"id": 45541,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, beginner, sql, sqlite",
"url": null
} |
the number Welcome to The Adding and Subtracting and Simplifying Linear Expressions (A) Math Worksheet from the Algebra Worksheets Page at Math-Drills. Variables in Mathematical Expressions. non-examples . The following examples will help us to understand the precedence of operations of addition, subtraction, multiplication and division. Using function machine metaphor, forming an inverse function means running the function machine backwards. Read and Discuss. 0066. If you just want to get your feet wet with regular expressions, take a look at the one-page regular expressions quick start. 2nd level . Numeric expressions apply operations to numbers. CCSS 6. S. (this could take a moment) IXL is the world's most popular subscription-based learning site for K–12. MathPlayer's math-to-speech technology. - P. Verbal phrases can be translated into variable expressions. The sequence details the order you follow to add, subtract, multiply, and divide. A math expression is different from a math | {
"domain": "fcdyzfb.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9719924818279465,
"lm_q1q2_score": 0.8078647877436865,
"lm_q2_score": 0.8311430415844385,
"openwebmath_perplexity": 1063.5630078202119,
"openwebmath_score": 0.4794732630252838,
"tags": null,
"url": "http://fcdyzfb.com/regwsu/math-expressions-examples.html"
} |
### Show Tags
17 Jun 2012, 03:52
1
KUDOS
26
This post was
BOOKMARKED
00:00
Difficulty:
5% (low)
Question Stats:
79% (00:43) correct 21% (00:41) wrong based on 1458 sessions
### HideShow timer Statistics
There are 8 teams in a certain league and each team plays each of the other teams exactly once. If each game is played by 2 teams, what is the total number of games played?
A. 15
B. 16
C. 28
D. 56
E. 64
[Reveal] Spoiler: OA
Last edited by Bunuel on 17 Jun 2012, 03:56, edited 1 time in total.
Edited the question and added the OA.
Kudos [?]: 201 [1], given: 19
Math Expert
Joined: 02 Sep 2009
Posts: 42302
Kudos [?]: 133018 [3], given: 12402
Re: There are 8 teams in a certain league and each team plays [#permalink]
### Show Tags | {
"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.9136765275272111,
"lm_q2_score": 0.9136765275272111,
"openwebmath_perplexity": 3576.657479026001,
"openwebmath_score": 0.18992069363594055,
"tags": null,
"url": "https://gmatclub.com/forum/there-are-8-teams-in-a-certain-league-and-each-team-plays-134582.html"
} |
vba, excel
Private Sub IFrameSorter_RemoveFrame(SourceFrame As MSForms.IOptionFrame)
If Not SourceFrame Is Nothing Then
With SourceFrame
If VisibleFrames.Exists(.Name) Then
.Visible = False
VisibleFrames.Remove (.Name)
ArrangeFrames
End If
End With
End If
End Sub
Private Sub IFrameSorter_MoveUp(SourceFrame As MSForms.IOptionFrame, Optional Position As Long = 1&)
Dim lPosition As Long
lPosition = GetPositionInDict(SourceFrame)
If lPosition > 1 Then
MoveFrame SourceFrame, lPosition - 1
ArrangeFrames
End If
End Sub
Private Sub IFrameSorter_Move(SourceFrame As MSForms.IOptionFrame, Position As Long)
MoveFrame SourceFrame, Position
ArrangeFrames
End Sub | {
"domain": "codereview.stackexchange",
"id": 37513,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba, excel",
"url": null
} |
sql, vba, excel, database, sqlite
'''' @ClassMethod
'''' This method can also be used on the default instance
''''
'''' Generates an SQLite query returning database tables, skipping
'''' system tables (prefixed with "sqlite_") and ordering by ROWID
'''' (in order of creation). If requested, a CTE WITH term is
'''' generated.
''''
'''' Args:
'''' Schema (string, optional, "main"):
'''' Schema name/alias
'''' CTEWITH (boolean, optional, False):
'''' If True, format as a CTE WITH term
''''
'''' Returns:
'''' String, containing the query
''''
'''' Examples:
'''' >>> ?SQLiteSQLDbIdxFK.Tables
'''' SELECT name, sql
'''' FROM main.sqlite_master
'''' WHERE type = 'table' AND (name NOT LIKE 'sqlite_%')
'''' ORDER BY ROWID ASC
''''
'''' >>> ?SQLiteSQLDbIdxFK.Tables(, True)
'''' t AS (
'''' SELECT name, sql
'''' FROM main.sqlite_master
'''' WHERE type = 'table' AND (name NOT LIKE 'sqlite_%')
'''' ORDER BY ROWID ASC
'''' )
'''' | {
"domain": "codereview.stackexchange",
"id": 41906,
"lm_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, vba, excel, database, sqlite",
"url": null
} |
python, python-2.x, linux
... suggest that may not be the case? The Exception type encompasses so many other things, heck this doesn't even need to be an OSError instance. That's why it's crucial to factor in the different exceptions a line of code could raise, and write the except block around handling those cases.
If you wish to run a benchmark, time only the relevant code. Taking the initial time at the top of main() works well.
I see no point in making load_services() take a handlerlist parameter. The list will be empty, and if it isn't, a developer can simply call list.extend():
my_handler_list = ["foo", "bar"]
my_handler_list.extend(load_services("my_config_file"))
Abrvnts ar hrd to rd, y knw? svc → service, usg → usage, etc.
These lines:
cpudic = {} # Predefine the dictionary for CPU usage.
memdic = {} # Predefine the dictionary for RAM usage.
cpudic, memdic = read_stats(pidlist) # Get stats into the dictionary. | {
"domain": "codereview.stackexchange",
"id": 31075,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-2.x, linux",
"url": null
} |
python, multithreading
Lots of reading, but definitely useful and reusable information. | {
"domain": "codereview.stackexchange",
"id": 45558,
"lm_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, multithreading",
"url": null
} |
python, iteration, twitter
Your final code would look something like:
search_result = #search result from Twitter API
results = sorted(search_results, key=lambda x: x.id)
min_id = results[0]['id']
for tweet in search_results:
tweet['_id'] = tweet.pop('id') | {
"domain": "codereview.stackexchange",
"id": 10762,
"lm_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, iteration, twitter",
"url": null
} |
neural-networks, machine-learning, ai-design, long-short-term-memory
I didn't understood whether each layer is getting the complete inputs or not.
I want to know whether the following figure is correct for the above code:
If this is not then what is the figure for the network? Please let me know.
Is figure = code?
No.
Your figure shows a fully connected feed forward network (MLP). But in your code you are using a two layer LSTM with peepholes. For the visualization of LSTMs, blocks are usually used for each layer.
Here is a figure of the LSTM with peepholes which is the base of the tensorflow implementation (Source: Paper, fig. 1). | {
"domain": "ai.stackexchange",
"id": 930,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-networks, machine-learning, ai-design, long-short-term-memory",
"url": null
} |
navigation, move-base, ros-kinetic, base-local-planner
Title: Is there a way the robot go through goal point without stopping?
Hello,
I want to limit the travel path of the robot to some extent.
So, I set goal minutely and published the goals to move_base using SimpleActionServer.
This plan was successful that the robot go through the route I envisioned, but the robot stopped at each goal points.
Is there a way the robot go through goal point without stopping?
I've found that teb_local_plannner has a parameter called free_goal_vel, which seems to be close to what I want.
But I don't want to use teb_local_plannner, because teb_local_plannner seems to retreat frequently.
Now I use base_local_planner.
Thanks in advance. | {
"domain": "robotics.stackexchange",
"id": 35538,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, move-base, ros-kinetic, base-local-planner",
"url": null
} |
programming-languages, functional-programming, type-inference, type-checking
Title: ML - Type Interface From my recitation class -
Can you please explain
why does operator $"+"$ signature is $ int \rightarrow (int \rightarrow int)$ ?
How does this graph is build ?
And what is mean $t=u \rightarrow s$ ?
Thanks in advance . ML functions take a single argument. There are two common techniques to pass two arguments to a function.
One is to create a pair (2-tuple) p = (x, y) and apply the function to the pair; the type of the function is then ('a * 'b) -> 'c.
The other approach is to make a function that takes one argument and returns a function that receives the second argument and does the work. This approach is what is done for + here and is called currying. The function then has the type 'a -> ('b -> 'c). Since this is common, the -> operator on types is chosen to be right-associative, so 'a -> ('b -> 'c) can be written 'a -> 'b -> 'c. | {
"domain": "cs.stackexchange",
"id": 1099,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "programming-languages, functional-programming, type-inference, type-checking",
"url": null
} |
special-relativity, time-dilation
v' = v.
Or am I wrong, and it is evident and without need of further proof that v' = v?
For the answer see the answer of Ben Crowell:
"v" is the relative velocity taken into account by the Lorentz factor between inertial reference frames which is the same for both frames. Thus v = v' can be derived directly from the SR postulates. And thus it seems that effectively length contraction can be derived from time dilation, as Wikipedia says.
Or am I wrong, and it is evident and without need of further proof that v' = v? | {
"domain": "physics.stackexchange",
"id": 17571,
"lm_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, time-dilation",
"url": null
} |
javascript, sorting
Title: Elegant way to sort on multiple properties that might be undefined I'm trying to sort an array with JavaScript. The objects should be sorted based on several properties (about 4 in my real scenario), which are all strings that may also be null or undefined. A null or undefined value should be treated similar, and should be "earlier" in the sorted array than items with values.
I used unit tests to spec the behavior, and the simplest code that would work (which is really, really verbose) is the following: | {
"domain": "codereview.stackexchange",
"id": 40769,
"lm_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, sorting",
"url": null
} |
rigid-body-dynamics
Acceleration of the center of mass is used in dynamics
$$\begin{pmatrix}\ddot{x}=-R\ddot{\phi}+c\ddot{\phi}\cos\phi-c\dot{\phi}^{2}\sin\phi\\
\ddot{y}=c\ddot{\phi}\sin\phi+c\dot{\phi}^{2}\cos\phi
\end{pmatrix} \tag{3}$$
And the dynamics are
Force/torque balance at the center of mass
$$\begin{pmatrix}F=m\ddot{x}\\
N-mg=m\ddot{y}\\
-\tau_{O}+y\,F-x\,N=I_{C}\ddot{\phi}
\end{pmatrix} \tag{4}$$ | {
"domain": "physics.stackexchange",
"id": 92805,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rigid-body-dynamics",
"url": null
} |
c++, namespaces
So this is how I would structure the functionality of loading 3D meshes into my program for example. The actual code is very abbreviated because right now I would like to only focus on the structure with the namespace and the external declarations.
The header Mesh.h
#include "OpenGL.h" //a higher level namespace containing context information
namespace OpenGL{
namespace Mesh{
struct Vertex{
vec3 pos;
vec3 normal;
vec2 uv;
};
struct Material{
vec3 amb;
vec3 diff;
vec3 spec;
float shininess;
};
struct Mesh{
unsigned int indexOffset;
unsigned int indexCount;
unsigned int materialIndex;
};
extern vector<Vertex> allVertices;
extern vector<unsigned int> allIndices;
extern vector<Material> allMaterials;
extern vector<Mesh> allMeshes;
extern string MESH_DIR;
extern vector<string> meshNames; //find mesh index by name
void setMeshDirectory(string pDirectory); | {
"domain": "codereview.stackexchange",
"id": 28809,
"lm_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++, namespaces",
"url": null
} |
algorithms, graphs, time-complexity, graph-traversal
The improved algorithm works for the above counterexample as well as others (e.g. this one).
I assume it is still wrong. If it were not, it would offer a significant improvement for at least some kinds of graphs. Is there a counterexample? And how could a counterexample for further additional indirections be constructed? The diameter of the following graph is $2a+4$. If you start from $v$, you will need $i=2a+1$ iterations to have $s,t\in W_{i}$. It provides a family of counter-examples for an arbitrary large number of indirections (as $a \to \infty$). | {
"domain": "cs.stackexchange",
"id": 10296,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, graphs, time-complexity, graph-traversal",
"url": null
} |
Kudos [?]: 114 [2] , given: 0
### Show Tags
28 Jul 2010, 03:56
2
KUDOS
17
This post was
BOOKMARKED
00:00
Difficulty:
95% (hard)
Question Stats:
37% (03:03) correct 63% (01:58) wrong based on 464 sessions
### HideShow timer Statistics
Is |x| < 1 ?
(1) |x + 1| = 2|x – 1|
(2) |x – 3| > 0
[Reveal] Spoiler: OA
Last edited by Bunuel on 04 Dec 2012, 03:03, edited 1 time in total.
Renamed the topic and edited the question.
Veritas Prep GMAT Instructor
Joined: 16 Oct 2010
Posts: 6829
Location: Pune, India
Followers: 1920
Kudos [?]: 11931 [5] , given: 221
Re: Inequalities, Is |X| < 1 ? [#permalink]
### Show Tags
15 Sep 2011, 22:58
5
KUDOS
Expert's post
mustu wrote:
Is |x| < 1 ?
(1) |x + 1| = 2|x – 1|
(2) |x – 3| > 0
As I have said before, most mod questions are best tackled using a number line. You don't need to do many calculations then.
|x| means the distance from 0.
|x-3| means the distance from 3.
etc. For details of this approach, check out: | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9385759599453298,
"lm_q1q2_score": 0.8137789237879663,
"lm_q2_score": 0.8670357632379241,
"openwebmath_perplexity": 3370.5640557688257,
"openwebmath_score": 0.7989689707756042,
"tags": null,
"url": "http://gmatclub.com/forum/is-x-98148.html?kudos=1"
} |
of their respective owners possible quadrilaterals with the given side lengths, then have! Apply their understanding to quadrilaterals Bringing Tuition-Free College to the Community No ; the theorems and postulates for congruence! The property of their respective owners some that may not be so familiar to recap {. Task addresses this issue for a specific class of quadrilaterals can you determine by using these properties two are...: line PS is perpendicular to line SQ, line... \triangle ABC \cong \triangle DEF part the! Congruence apply to quadrilaterals—shapes that have the same size and shape five ways to test that two triangles have same! * 20 find the values of x for p to be lacking, prove, and look at the that! Answer to Make a Conjecture does a version of SSS congruence apply to and. Congruent to Angle DEF by side-side-side triangle congruence theorem for quadrilaterals, and side–side–side congruence, the theorem does work. Congruent using the congruence of triangles, their | {
"domain": "com.mx",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9748211597623863,
"lm_q1q2_score": 0.8014873660066589,
"lm_q2_score": 0.822189134878876,
"openwebmath_perplexity": 2011.2985900795904,
"openwebmath_score": 0.3094938099384308,
"tags": null,
"url": "http://totalent.com.mx/internal-audit-szix/does-sss-congruence-apply-to-quadrilaterals%3F-2d9a2e"
} |
- 6 years, 7 months ago
I did it like shubham saha (that's his name :P ) . I was really doubtful about this one as I couldn't imagine an RMO question to be of such(easy) level.
- 6 years, 7 months ago
awesome method!!
- 6 years, 7 months ago
Precisely! But do the RMO examiners give the full 17 marks for such a short method?
- 5 years, 7 months ago
Simpler fact is that if n (2310-n) is divisible by 2310, n^2 is divisible by 2310 and since no square except 1 divides 2310, n=2310k for k>0 and k being integer, implying there does not exist solution.
- 2 years, 10 months ago
Proof for 2: The inequality is equivalent to (x - 2y)^2 + (x - 1)^2 <= 0. But a squared number is always greater than or equal to 0, which implies that there is a real number in the equality case, which implies that we solve the equation (x - 2y)^2 + (x - 1)^2 = 0 and this is possible when x = 2y = 1, implying the ordered pair (x, y) = (1, 1/2).
- 6 years, 7 months ago | {
"domain": "brilliant.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9653811611608241,
"lm_q1q2_score": 0.8044758594520682,
"lm_q2_score": 0.8333245891029456,
"openwebmath_perplexity": 1310.4586195017107,
"openwebmath_score": 0.9550597667694092,
"tags": null,
"url": "https://brilliant.org/discussions/thread/rmo-2014-full-paper-discussion/"
} |
ros-hydro
It publishes a lot of stuff but not "/camera/depth_registered/image_rect". This worked fine with Groovy.
Dave
Originally posted by davevh with karma: 36 on 2014-03-13
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 17270,
"lm_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-hydro",
"url": null
} |
electricity, electrostatics, charge, capacitance
Title: Electrons drift velocity and capacitors My friend said this to me and just want to make sure this is right " when we connect the a battery to a LED and the 2 poles are connected, electrons flow from the (-) to the (+) but with very low velocity, but when you do the same with a capacitor , once the 2 plates are connected electrons flow incredibly fast that's why it's discharged fairly quickly" is that true? In a word, no. The drift velocity is always very small in common circuits (~$10^{-4}~\text{cm}/~\text{s}$). In this scenario, when the plates are connected, the electrons still travel slow but all of the electrons along the wire start moving almost at the same time, so even though they move slowly, the electric charge on the plates will vanish quickly. The electrons on the negative plate move into the wire and the positive plate is filled with electrons that were previously in the wire right next to it. | {
"domain": "physics.stackexchange",
"id": 8634,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electricity, electrostatics, charge, capacitance",
"url": null
} |
ros2
[gzserver-3] [WARN] [1669321309.958253337] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.
[gzserver-3] [WARN] [1669321309.990086422] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic. | {
"domain": "robotics.stackexchange",
"id": 38149,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros2",
"url": null
} |
A. $$\frac{3}{10}$$
B. $$\frac{3}{8}$$
C. $$\frac{5}{12}$$
D. $$\frac{1}{2}$$
E. $$\frac{5}{7}$$
Let Total People, who purchased devices, be 100.
Therefore Women who purchased devices = 60 (According to question)
and hence Men who purchased devices = 40 (100 - 60) -- (1)
Now $$\frac{5}{12}$$ is the fraction of orange device of devices purchased by women. That is equal to 25
Hence remaining devices, purchased by women, are green and are equal to = 60 - 25 = 35
Now from question we know, Total Green devices = Total Orange devices
Hence 35(Green devices with women) + G(Green devices with men) = 25(Orange devices with women) + O(Orange devices with men)
which we can write as O - G = 10 -- (2)
And also O + G = 40 -- (3) [From (1)]
From (2) and (3), we get
O = 25
G = 15
fraction of men who purchased an eSoroban in 2013 purchased the green device = $$\frac{Green devices purchased by men}{Total Men who purchased eSorban Devices}$$
Hence $$\frac{15}{40}$$ | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9752018354801189,
"lm_q1q2_score": 0.8327372876439042,
"lm_q2_score": 0.8539127566694177,
"openwebmath_perplexity": 8283.97137700168,
"openwebmath_score": 0.21808160841464996,
"tags": null,
"url": "https://gmatclub.com/forum/the-esoroban-device-is-available-in-two-colors-orange-and-green-296559.html"
} |
python, python-3.x
to avoid duplicated logic.
Then, you can simplify your code by using join instead of having multiple print.
def pwgen(alphabet, easy, length=16):
get_string = easy_to_type_randomstring if easy else randomstring
for _ in range(terminal_height - 3):
print(' '.join(get_string(alphabet, length)
for _ in range(terminal_width // (length + 1)))) | {
"domain": "codereview.stackexchange",
"id": 11940,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x",
"url": null
} |
cosmological-inflation, multiverse
But I guess we can talk about universes differing from our universe by no more than epsilon. Interpreting this probabilistically (with a lot of handwaving, of course), is this definitely an event of nonzero measure? If yes, then is Tegmark correct that Inflation theory implies this? The argument is based on our observable universe having a finite, nonzero probability since there is only a finite number of distinguishable configurations within a finite radius (as given by the Bekenstein bound). This is your epsilon. So the measure of our local universe configuration is non-zero, and hence in a sufficiently large and randomly initialized universe (whether spatially infinite or an eternal inflation structure) there will be an infinite number of instances. | {
"domain": "physics.stackexchange",
"id": 56245,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cosmological-inflation, multiverse",
"url": null
} |
regex, file, go
func main() {
searchDir := flag.String("dir", "dir", "directory to search")
nWorker := flag.Int("n", 2, "number of worker")
flag.Parse()
results := make(chan Endings, *nWorker)
var wg sync.WaitGroup
wg.Add(*nWorker)
files := make(chan string, 1000)
for i := 0; i < *nWorker; i++ {
go run(files, results, &wg)
}
filepath.Walk(*searchDir, func(path string, f os.FileInfo, err error) error {
if !f.IsDir() {
files <- path
}
return nil
})
close(files)
wg.Wait()
close(results)
count := &Endings{}
for e := range results {
count.crlf += e.crlf
count.lf += e.lf
}
fmt.Printf("crlf: %d, lf: %d\n", count.crlf, count.lf)
}
Performance
The new code is slightly faster:
old:
$ time ./test ~/go/src/golang.org
crlf: 6231, lf: 1589462
./test ~/go/src/golang.org 1,78s user 0,23s system 167% cpu 1,201 total | {
"domain": "codereview.stackexchange",
"id": 29843,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "regex, file, go",
"url": null
} |
quantum-mechanics, homework-and-exercises, condensed-matter, quantum-hall-effect
If you consider the largest possible values of $k$ obtained above ($k_{\pm}$), they correspond to the largest possible values of $y_0$ ($y_0^{\pm}$) around which the eigenstate is centered. The states with largest $k$ thus correspond to states that are localized at the outermost positions in the $y$ direction of the system, hence the name "edge states".
Furthermore, the state at $y_0^+ > 0$ has $k_+ > 0$, while the state located at $y_0^- <0$ has $k_-<0$: this provides a physical interpretation in terms of electrons localized at the $y$-edges that are counterpropagating in opposite directions along the $x$ axis. This circumstance can be understood semi-classically by the concept of skipping-orbits, that you might have heard. | {
"domain": "physics.stackexchange",
"id": 87051,
"lm_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, homework-and-exercises, condensed-matter, quantum-hall-effect",
"url": null
} |
waves, reflection
Title: Why are speakers louder in a corner? You can test this very easily using an iPhone's speaker pointed towards a wall. When the speaker is more than an inch or two away, it is normal volume. However, when the speaker is nearly touching the wall, the sound is much louder. Why is this?
edit
A rough diagram of a setup below:
the blue rectangle represents an iphone. In configuration A, the speakers point towards the observer, whereas in configuration B, the speakers point towards the wall. From the many times I have tried this, configuration B is louder than configuration A. Your tags suggest that you are already in the way of the answer. Being spherical waves, sound intensity decreases inversely proportional to distance squared. The speaker facing the walls focuses waves in your position, before their intensities decrease as much as they would if they are reflected in other walls of the room. | {
"domain": "physics.stackexchange",
"id": 16309,
"lm_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, reflection",
"url": null
} |
php, html, email
'<tr>'.
'<td>';
echo "Hello there hero!";
'</td>'.
'</tr>'.
'<tr>'.
'<td style="padding: 20px 0 30px 0;">';
echo " Cheesy heading, we know. BUT! Thanks for signing up with us! We just need you to do one, tiny little thing! You see that button down there? The big yellow one? We're going to need you to click that.. Seems daunting, but trust us. Once you do, you'll get access to all our websites features! Easy right? So go ahead, what are you waiting for?";
'</td>'.
'</tr>'.
'<tr>'.
'<td>'.
'<table border="0" cellpadding="0" cellspacing="0" width="100%">'.
'<tr>'.
'<td width="260" valign="top">'.
'<tr>'.
'<td>'.
'<div class="button">';
echo "Verify Account!";
'</div>'.
'</td>'.
'</tr>'.
'</table>'; You may use a template.
$message = file_get_contents('path/to/your/html/template.html'); | {
"domain": "codereview.stackexchange",
"id": 18548,
"lm_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, html, email",
"url": null
} |
javascript, object-oriented, calculator
I'm realizing that using this self variable is causing more harm than does good. So I reverted to this, new and prototype usage.
From @tkellehe's answer:
I remove all _vars from parameters, all private vars will use it from now on. Just there aren't any at the example at the moment.
I used Object.define in the View classes so I don't need to use Object.keys anymore.
Because I reverted to this, new and prototype usage, override function doesn't work/it's not needed anymore. So I had to use Class.prototype.method.call instead and I don't need a base class anymore or a salvage to not using new. At least at this point.
I know loading within context is important and I'll use it. I just don't think it's needed for this example. But that library loading function was really cool.
What still bothers me: | {
"domain": "codereview.stackexchange",
"id": 17642,
"lm_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, object-oriented, calculator",
"url": null
} |
solid-state-physics, symmetry, electronic-band-theory
Title: Silicon: conduction band minima Why do the energetic minima of the silicon conduction band lie not in a high-symmetry point like a $X$-point, but somewhere in $\Delta$-direction between points $\Gamma$ and $X$? What is the physical reason? Is it related to the spin-orbit interaction somehow? How atomic orbitals merge into crystal band structure is, well, complicated to capture in simple models. As seen in, say, Ashcroft and Mermin (chapter 28), the energy surfaces for Si have symmetry along the <100> directions. In contrast, the surface for Ge have symmetry along the <111> directions, with the band minimum at the zone edge. A comparison to the Fermi surfaces of various metals could be instructive - they can take on some seemingly odd shapes. Most of this can come from including enough atomic orbitals to mix together. | {
"domain": "physics.stackexchange",
"id": 19561,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "solid-state-physics, symmetry, electronic-band-theory",
"url": null
} |
ros, microcontroller
Title: How can ROS communicate with my microcontroller?
Some recent questions have shown an interest in how ROS can be used to run a motor or read a sensor on a custom robot. Many hobby robots have one or more microcontrollers that interface with the robot hardware. These microcontrollers should be able to communicate using a serial connection to a robot mounted laptop running ROS.
The avr_bridge is a sophisticated approach, but it requires a larger AVR processor and C++ code development on the microcontroller which may not be available in some circumstances. Is there a simpler alternative?
Originally posted by Bart on ROS Answers with karma: 856 on 2011-05-30
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 5711,
"lm_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, microcontroller",
"url": null
} |
ros, lsd-slam, camera, usb-cam, ros-indigo
Error is :
Input resolution: 752 480
In: 0.527334 0.827306 0.473568 0.499436 0.000000
NO RECTIFICATION
Output resolution: 752 480
Prepped Warp matrices
Started constraint search thread!
Started mapping thread!
Started optimization thread
UndistorterPTAM: input image size differs from expected input size! Not undistorting.
Doing Random initialization!
Segmentation fault (core dumped)
I use ros-indigo, ubuntu 14.04. How can I run lsd_slam with images or usb camera frames?
Originally posted by jossy on ROS Answers with karma: 83 on 2015-07-04
Post score: 0
The error is complaining about your input image size.
Modify your "pinhole_example_calib.cfg", and don't forget to change the camera parameters in the first line. You can get those parameters by calibrating your camera with ptam's tool.
0.527334 0.827306 0.473568 0.499436 0
640 480
crop
640 480
Originally posted by Po-Jen Lai with karma: 1371 on 2015-07-04
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 22081,
"lm_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, lsd-slam, camera, usb-cam, ros-indigo",
"url": null
} |
If $$a>b$$ and $$c>d$$ (signs in same direction: $$>$$ and $$>$$) --> $$a+c>b+d$$.
Example: $$3<4$$ and $$2<5$$ --> $$3+2<4+5$$.
You can only apply subtraction when their signs are in the opposite directions:
If $$a>b$$ and $$c<d$$ (signs in opposite direction: $$>$$ and $$<$$) --> $$a-c>b-d$$ (take the sign of the inequality you subtract from).
Example: $$3<4$$ and $$5>1$$ --> $$3-5<4-1$$.
Hope it helps.
_________________
Director
Joined: 22 Mar 2011
Posts: 612
WE: Science (Education)
Followers: 90
Kudos [?]: 804 [2] , given: 43
Re: Is a > c? [#permalink]
### Show Tags
14 Aug 2012, 07:45
2
KUDOS
Bunuel wrote:
rphardu wrote:
Is a > c?
(1) b > d
(2) ab^2 – b > b^2c – d
[Reveal] Spoiler:
You can only add inequalities when their signs are in the same direction:
If $$a>b$$ and $$c>d$$ (signs in same direction: $$>$$ and $$>$$) --> $$a+c>b+d$$.
Example: $$3<4$$ and $$2<5$$ --> $$3+2<4+5$$.
You can only apply subtraction when their signs are in the opposite directions: | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9399133531922388,
"lm_q1q2_score": 0.8132356605514892,
"lm_q2_score": 0.865224073888819,
"openwebmath_perplexity": 5230.967300207,
"openwebmath_score": 0.7749797701835632,
"tags": null,
"url": "http://gmatclub.com/forum/is-a-c-137240.html?sort_by_oldest=true"
} |
natural-language-processing, papers, feature-extraction, bag-of-words, n-gram
I just wanted to check my assumption, because the paper is not very explicit. I already tried to string n-grams together as a new sentence in place of the old, but performance dropped significantly.
I will continue to experiment, but I was wondering if anyone knows the specific mechanism? Yes, N-grams is about joining $n$ words as one single token.
Keep in mind it will greatly increase your features size:
If you originally have 1000 unique words, notice you could get up to 1000² 2-gram (usually you don't get ALL the combinations, but notice the number of features can potentially grow huge!)
If your dataset contains between thousands or millions samples, it could be enough to train a simple bag-of-words. But when you use a bi-gram, you'll probably need at least a million samples and lot more training steps. Besides, you'll probably have to tweak the hyperparameters. | {
"domain": "ai.stackexchange",
"id": 2991,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "natural-language-processing, papers, feature-extraction, bag-of-words, n-gram",
"url": null
} |
The limit is taken as the two points coalesce into (c,f(c)). gives a local maximum for f (and the First Derivative Test is strong enough to imply this, even though the Second Derivative Test gave no information) and the critical number (point) at x=1 gives neither a local max nor min for f, but a (one-dimensional) "saddle point". Now, this x-value could possibly be an inflection point. In general the nth derivative of f is denoted by f(n) and is obtained from f by differentiating n times. Remember that the derivative of y with respect to x is written dy/dx. If the second derivative of a function is positive then the graph is concave up (think ⦠cup), and if the second derivative is negative then the graph of the function is concave down. So you fall back onto your first derivative. fabien tell wrote:I'd like to record from the second derivative (y") of an action potential and make graphs : y''=f(t) and a phase plot y''= f(x') = f(i_cap). Use first and second derivative theorems to | {
"domain": "co.uk",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9796676514063881,
"lm_q1q2_score": 0.80095127129697,
"lm_q2_score": 0.8175744806385542,
"openwebmath_perplexity": 282.88795831046025,
"openwebmath_score": 0.7630866169929504,
"tags": null,
"url": "http://www.slippercottage.co.uk/8fcub/e17a92-what-does-second-derivative-tell-you"
} |
• @DanDouglas in fact $\Bbb R\times\Bbb R\cong\Bbb R$ are isomorphic as vector spaces over $\Bbb Q$, not just as abelian groups. This is essentially because $\Bbb R$ has dimension $\frak c$ over $\Bbb Q$ and that $\frak c+c=c$. However we cannot write down such an isomorphism explicitly, because we invoke the axiom of choice to conclude it exists at all. – anon Sep 10 '14 at 3:56 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.982013788985129,
"lm_q1q2_score": 0.830727140031697,
"lm_q2_score": 0.845942439250491,
"openwebmath_perplexity": 242.62130243288024,
"openwebmath_score": 0.927643358707428,
"tags": null,
"url": "https://math.stackexchange.com/questions/925809/g-cong-g-times-h-does-not-imply-h-is-trivial"
} |
homework-and-exercises, differential-geometry, metric-tensor, coordinate-systems
Title: How is the spherical coordinate metric tensor derived? I know the values of the metric tensor is $$\eta =\begin{bmatrix}
1&0&0\\
0&r^{2}&0\\
0&0&r^{2}\sin^{2}\left ( \theta \right )
\end{bmatrix},$$ but how is this derived? Also, is the '(Non)Euclidean'-ness of the spacetime geometry of any relevance to this metric tensor value? That is simply the metric of an euclidean space, not spacetime, expressed in spherical coordinates. It can be the spacial part of the metric in relativity.
We have this coordinate transfromation:
$$ x'^1= x= r\, \sin\theta \,\cos\phi =x^1 \sin(x^2)\cos(x^3) $$
$$x'^2= y= r\, \sin\theta \,\sin\phi =x^1 \sin(x^2)\sin(x^3)$$
$$x'^3= z= r\, \cos\theta = x^1\ \cos(x^2)
$$
With $\, x^1=r, \quad x^2=\theta, \quad x^3=\phi \quad$ and $\quad x'^1=x, \quad x'^2=y, \quad x'^3=z$
Now you start from
$$ | {
"domain": "physics.stackexchange",
"id": 38991,
"lm_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, differential-geometry, metric-tensor, coordinate-systems",
"url": null
} |
python, file-system
if __name__ == "__main__":
dir = os.path.expanduser('~/Documents/MyLibrary/')
books = glob(os.path.join(dir, "**/*.pdf"), recursive=True)
print(books)
Here I also used the os.path module to correctly join the paths and expand the ~ symbol to the users home directory.
Alternatively, you could use the pathlib.Path object (introduced in Python 3.4), which also supports globbing:
from pathlib import Path
if __name__ == "__main__":
dir = Path('~/Documents/MyLibrary/').expanduser()
books = list(dir.glob('**/*.pdf'))
print(books)
Note the list call, which is necessary, because the Path.glob method returns a generator (in contrast to glob.glob, which returns a list). | {
"domain": "codereview.stackexchange",
"id": 28834,
"lm_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, file-system",
"url": null
} |
c++, file, stream
Title: Extracting file names from text file I need to extract file names with their extension from an input text file to a string vector.
The input text file is quite messy and serves as configuration file for some application.
What I know about the file names I am trying to extract is they are preceded by a file = mention, the filename is quoted between ' ' or " ".
Example : file="name.abc". I also have no guarantee of how spacing is : It may be file="name.abc", file = "name.abc" , file= "name.abc"... And extension can be of different lengths.
So I tried the following code:
std::vector<std::string> attachment_names;
std::istringstream words(text_content);
std::string word;
std::string abc_extension(".abc"); // My code should support any extension
while (words >> word)
{
auto extension_found = word.find(abc_extension);
if (extension_found != word.npos)
{
auto name_start = word.find("'") + 1;
//I am not even sure the file is quoted by '' | {
"domain": "codereview.stackexchange",
"id": 28240,
"lm_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, stream",
"url": null
} |
quantum-mechanics, hilbert-space, operators
Hence, if you are given a hermitian operator on the Hilbert space, you can use it to obtain a basis. We usually pick the Hamiltonian, for example, because then each state in the basis has a simple time-evolution in terms of its energy (more specifically, in terms of the eigenvalue of the Hamiltonian to which it is associated). By the very definition of what a basis is, we can then write any vector in the Hilbert space in terms of eigenvectors of the Hamiltonian, i.e., in terms of states of definite energy. This provides a nice way to write down the time evolution of the state, since the Hamiltonian eigenstates have simple time-evolution rules.
We could pick other operators, if we so desired. Instead of the Hamiltonian, you could pick some other hermitian operator to obtain a basis, but it would probably be less convenient to work with. | {
"domain": "physics.stackexchange",
"id": 81408,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, hilbert-space, operators",
"url": null
} |
ros, multi-robot, transform
Title: How to use tf in more than one robot?
Hi!
I'm trying to do coperative things in between turtlebots. The thing is that first I need both robots in the same core, otherwise they can not interact. But when I put them under the same core I don't know how to solve the tf.
I've tried to push one tf to turtlebot1/tf and the other to turtlebot2/tf, but then I can not see the tf on rviz. Is it correct to do that or do I need a tf which contains all the robots? If i need this how can I start having a look at that to do it?
Thanks! | {
"domain": "robotics.stackexchange",
"id": 7933,
"lm_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, multi-robot, transform",
"url": null
} |
c++, qt
// Get the process name.
if (nullptr != hProcess) {
HMODULE hMod;
DWORD cbNeeded;
if (EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded)) {
GetModuleBaseName(hProcess, hMod, szProcessName,
sizeof(szProcessName) / sizeof(TCHAR));
}
if (GetProcessMemoryInfo(hProcess, (PROCESS_MEMORY_COUNTERS *)&pmc,
sizeof(pmc))) {
old.SetmemoryUsage(pmc.PrivateUsage / (mb));
};
auto temp = QString::fromUtf16((const ushort *)szProcessName);
old.Setname(temp); | {
"domain": "codereview.stackexchange",
"id": 38036,
"lm_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++, qt",
"url": null
} |
For your other question, the statement $\cos x = \sin(x + \pi/2)$, $\forall x \in \mathbb{R}$ is an equation of linear dependence, but not for the vectors/functions $f(x) = \cos x$ and $g(x) = \sin x$. This is because $g(x)$ isn't in your equation: $h(x) = g(x+\pi/2) \sin(x+\pi/2)$ is! In fact, what you've shown is that $\{f(x),h(x)\} = \{\cos x, \sin(x + \pi/2)\}$ is a linearly dependent set.
I can elaborate if you still have questions. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9736446494481299,
"lm_q1q2_score": 0.8370070145091455,
"lm_q2_score": 0.8596637541053281,
"openwebmath_perplexity": 74.45778829358918,
"openwebmath_score": 0.9293828010559082,
"tags": null,
"url": "https://math.stackexchange.com/questions/440065/is-sin-x-cos-x-independent/440095"
} |
fluid-dynamics, water
Title: Problem involving concentration of solution with inflow and outflow A question describes a tank, initially with 50L of pure water, with 2L of brine solution(at $5gmL^{-1}$) flowing in per minute, alongwith 1L flowing out per minute(the mixture's kept uniform by constant stirring). You're supposed to find the mass of salt in the tank, m, as a function of time t in minutes.
The equation used is this;
$$\frac{dm}{dt}=10-\frac{m}{50+t}$$
Everything else makes sense, but this; how can 'm' be used? This equation is written across the couse of one minute, during which the mass of salt in the tank changes. This equation treats it like there's m grams of salt in the tank for the full minute, which it doesn't look like there is. | {
"domain": "physics.stackexchange",
"id": 77933,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, water",
"url": null
} |
newtonian-mechanics, forces, energy-conservation, potential-energy, spring
I seem to recall something in my first year physics course about the average force of the spring, but I can't remember anything definitive. Can anyone explain where this factor of two comes from?
If h is zero though, the problem is just find the equilibrium of a spring of spring contact k supporting a brick of mass m | {
"domain": "physics.stackexchange",
"id": 61554,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, forces, energy-conservation, potential-energy, spring",
"url": null
} |
special-relativity, classical-mechanics, lagrangian-formalism, field-theory, hamiltonian-formalism
Vice versa, in classical physics, the Lagrangian is not a Galileian scalar: it is a scalar under the internal transformations of an inertial reference frame but not under the classical boost. So that to prefer the Hamiltonian or the Lagrangian are choices more or less equivalent in classical physics. If one adopts from scratch the Hamiltonian formulation he/she can profitably take advantage, for instance, of the canonical formalism which is of great help in studying the problem of motion. Furthermore the formulation of the Noether theorem is physically more easy in Hamiltonian formulation: the generators of the simmetries are the conserved quantities themselves, differently than in Lagrangian formulation. These facts are also true in relativistic physics, but their statements are a bit awkward, since they use a fixed time formalism which is more natural in classical physics. | {
"domain": "physics.stackexchange",
"id": 84848,
"lm_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, classical-mechanics, lagrangian-formalism, field-theory, hamiltonian-formalism",
"url": null
} |
quantum-field-theory, regularization, quantum-anomalies
Title: The regularization mass in Fujikawa's calculation of axial anomaly I am reading Fujikawa's paper for axial anomaly:
https://doi.org/10.1103/PhysRevD.21.2848
In equation (2.15), the anomalous part of axial transformation is regularized by
$$\begin{align*}
\mathcal{A}(x) = \lim\limits_{M\rightarrow \infty} \Big(\sum_n \phi_n^\dagger(x)~ \gamma^5~e^{-(\frac{\lambda_n}{M})^2} \phi_n(x) \Big)
\end{align*}\tag{2.15}$$
where $M$ is taken to $\infty$. In realistic condensed matter system, however, all regularization is of finite energy. If I naively take $M$ to be finite in the following calculation, from the fourth to the fifth line of equation (2.15), the Taylor expansion would include some higher order term, such as
\begin{align}
& \frac{1}{M^4}Tr\Big[ \gamma^5 [\gamma^\mu, \gamma^\nu] [\gamma^\rho, \gamma^\sigma] [\gamma^\alpha, \gamma^\beta] [\gamma^\gamma, \gamma^\delta]\Big] F_{\mu\nu} F_{\rho \sigma} F_{\alpha \beta} F_{\gamma \delta}\\ | {
"domain": "physics.stackexchange",
"id": 85241,
"lm_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, regularization, quantum-anomalies",
"url": null
} |
filters, filter-design, finite-impulse-response, infinite-impulse-response, impulse-response
Title: Why is the first value in digital first-order IIR filter impulse response not the largest? When I create a digital first-order IIR low-pass filter with scipy (code below), I get the following coefficients:
B: [ 0.1367 0.1367]
A: [ 1. -0.7265]
The impulse response of this filter does not look like most text-book examples in that the first value is not the largest.
Why is this so? Does it have to be so?
If I want to make an FIR filter to mimic such a first-order IIR low-pass filter, should it be a normal exponential decay shape, or does it need the first value "tweaked" in this manner?
import numpy as np
from scipy.signal import butter, lfilter
import matplotlib.pyplot as plt
b, a = butter(1, .1, btype='lowpass')
print('B:', b)
print('A:', a)
x = np.zeros(1000)
x[0] = 1.
xf = lfilter(b, a, x) | {
"domain": "dsp.stackexchange",
"id": 6682,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filters, filter-design, finite-impulse-response, infinite-impulse-response, impulse-response",
"url": null
} |
thermodynamics, statistical-mechanics, terminology
ensemble and accessible microstates?
ensemble and one particular macrostate?.
How do you call all microstates from the bulk of which you cut out small portion which you call "accessible microstates"?
Does the phrase "accessible microstates" imply only one possible macrostate always?
When does "accessible microstates" imply that there are many macrostates possible? | {
"domain": "physics.stackexchange",
"id": 49911,
"lm_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, terminology",
"url": null
} |
navigation, rosjava, occupancy-grid
at org.ros.concurrent.CancellableLoop.run(CancellableLoop.java:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722) | {
"domain": "robotics.stackexchange",
"id": 11599,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, rosjava, occupancy-grid",
"url": null
} |
solid-state-physics, crystals
Title: Why is the number of allowed $\vec k$ states in the first Brillouin zone equal to the number of unit cells? From my lecturer's notes I have that
The density of states $g_{\bf k}$ in reciprocal space for travelling waves
in three dimensions is uniform in reciprocal space and is equal to
$$g_{\bf k} = \frac{L_x}{2\pi}\times\frac{L_y}{2\pi}\times\frac{L_z}{2\pi}=\frac{V}{(2\pi)^3}$$
where $V$ is the total volume of the lattice in real space.
$$N_{\text{states}}=g_{\bf k}\int_{\text{BZ}}d^3{\bf k}=\frac{V}{(2\pi)^3}\times\frac{(2\pi)^3}{a^3}=N_{\text{unit cells}}=N_{\text{atoms}}\tag{1}$$
where $a$ is the interatomic lattice spacing and $\int_{\text{BZ}}$ denotes integration over the first Brillouin zone. The last equality holds as I am only considering one atom in each cell.
To put this question into context consider part of the derivation for the internal energy $U$ of a phonon band in the high-temperature limit: | {
"domain": "physics.stackexchange",
"id": 57942,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "solid-state-physics, crystals",
"url": null
} |
navigation, ekf, navsat-transform-node, robot-localization, ekf-localization-node
navsat_transform_node's job is to convert the GPS data into a nav_msgs/Odometry message so it can be fused into an EKF instance, so you don't need any external packages for that. But that's unrelated to GPS waypoint following. robot_localization and navsat_transform_node are just giving you a state estimate.
move_base requires goals to be in the robot's world frame, or a frame that can be transformed to the world frame. When you run navsat_transform_node, it generates a world_frame->utm transform. Therefore, if you can create a geometry_msgs/PoseStamped or move_base_msgs/MoveBaseGoal message with the UTM coordinates of the goal (and a frame_id of utm), I believe move_base will use that transform to convert it. | {
"domain": "robotics.stackexchange",
"id": 26648,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, ekf, navsat-transform-node, robot-localization, ekf-localization-node",
"url": null
} |
java, beginner, minesweeper
private void executeTurn(int row, int col, String command) {
switch (command) {
case "free":
if (!boardSet) {
boardSet = true;
this.newBoard(row, col);
explore(row, col);
}
if (this.hasMineAt(row, col)) {
this.revealMinefield();
System.out.println("You stepped on a mine and failed!");
this.hasLost = true;
} else {
explore(row, col);
}
break;
case "mine":
this.marked[row][col] = !this.marked[row][col];
}
this.checkWin();
this.showMinefield();
}
private void newBoard(int initialRow, int initialCol){
//ensures the first move doesn't have any mines | {
"domain": "codereview.stackexchange",
"id": 43394,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, minesweeper",
"url": null
} |
python, object-oriented, game, python-2.x
Title: Basic terrain generator I've decided to try and start programming using Object-Oriented-Programming, so I built a small terrain generator that could be done using something as simple as this:
import random
for _ in range(1000):
print random.choice('*#~o'),
Instead, I decided to have a go at OOP and made it like this instead:
# Terrain generator
from random import choice
from time import sleep
# Class containg world attr.
class Attr(object):
def __init__(self):
self.TILES = '#*~o'
self.WORLD_SIZE = 1000
self.Y_LENGTH = 1000
self.X_LENGTH = 1000
# Generator class
class Generator(object):
def __init__(self):
self.world = []
self.attr = Attr()
# Create an empty row
def create_row(self):
for _ in range(self.attr.X_LENGTH):
self.world.append(choice(self.attr.TILES))
# Main generator class
class MainGen(object):
def __init__(self):
self.gen = Generator()
self.attr = Attr() | {
"domain": "codereview.stackexchange",
"id": 8901,
"lm_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, object-oriented, game, python-2.x",
"url": null
} |
on himself in the Great Debate. The expectation value of this Hamiltonian is evaluated in the quasi-chemical equilibrium approximation to statistical mechanics. uncertainty in energy and time are related to Heisenberg's uncertainty principle delta(E). Large office trades slowed in the first half, to$743. Starting with the symmetric superposition state, we have equal prob-ability of 1=2 to obtain energy value E. Suppose that we made a large number of independent measurements of the displacement on an equally large number of identical quantum systems. While the expectation value of a function of position has the appearance of an average of the function, the expectation value of momentum involves the representation of momentum as a quantum mechanical operator. 4 percent to 4. In \Wavefunctions and the Hamilton-Jacobi Equa-tion," I showed that performing a canonical change of. Learn which schools offer the highest return on investment for tuition. When you have the eigenvalues of angular | {
"domain": "cssmatera.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9838471661250914,
"lm_q1q2_score": 0.8089084439395994,
"lm_q2_score": 0.8221891283434877,
"openwebmath_perplexity": 1149.1269167841435,
"openwebmath_score": 0.49707865715026855,
"tags": null,
"url": "http://cssmatera.it/gyvr/expectation-value-of-hamiltonian.html"
} |
javascript, performance, array, sorting, ecmascript-6
I'm currently iterating over the initial array twice. Is there an elegant ES6 way to do this in a single pass that I'm not seeing?
Yes, you could implement the compare method in a way that items with undefined value as the property get sorted at the end,
as @igor-soloydenko did in his answer.
I believe memory to be less of a concern (because I exactly double the amount of memory used while processing by generating two new arrays that together are the size of the original); am I correct?
Extra \$O(n)\$ memory doesn't seem a big concern.
If it is, then you can use the in-place alternative,
that doesn't use extra memory.
More or less, see the next point.
Are there any scalability pitfalls doing it this way? | {
"domain": "codereview.stackexchange",
"id": 27636,
"lm_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, performance, array, sorting, ecmascript-6",
"url": null
} |
Proposition 5. Every open subset of $$\mathbb{R}$$ is the union of a countable collection of pairwise disjoint open intervals.
Proof. Let $$U$$ be an open subset of $$\mathbb{R},$$ and let $$\mathscr{J}$$ be the collection of all maximal open subintervals of $$U.$$ By Proposition 3, $$U = \bigcup\mathscr{J},$$ and any two members of $$\mathscr{J}$$ with a non-empty intersection are equal. Because each member of $$\mathscr{J}$$ contains a rational number, $$\mathscr{J}$$ is countable. $$\ \square$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9854964194566753,
"lm_q1q2_score": 0.8471955516074846,
"lm_q2_score": 0.8596637541053281,
"openwebmath_perplexity": 81.7338026084833,
"openwebmath_score": 0.8846967816352844,
"tags": null,
"url": "https://math.stackexchange.com/questions/3723481/an-open-interval-is-not-a-disjoint-union-of-two-or-more-open-intervals"
} |
Comment #4307 by Rankeya on
Does the proof use that S is a domain anywhere?
Comment #4468 by on
It looks like it doesn't. If you need this for something, then I'll change it.
Comment #4481 by Rankeya on
I had occassion to use this lemma when $S$ is not a domain, so I would appreciate if you can change this. It allows me to refer to this lemma without having to say "the proof does not need $S$ to be a domain." Thanks!
Comment #4641 by Andy on
$R[y_1,\ldots,y_n]$ on the $4$-th line from the bottom should be a $R[y_1,\ldots,y_d]$
There are also:
• 2 comment(s) on Section 10.115: Noether normalization
In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar). | {
"domain": "columbia.edu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806555063198,
"lm_q1q2_score": 0.8484219912376474,
"lm_q2_score": 0.8652240756264638,
"openwebmath_perplexity": 143.57356190640232,
"openwebmath_score": 0.9842164516448975,
"tags": null,
"url": "https://stacks.math.columbia.edu/tag/07NA"
} |
c#, console, error-handling
private string GetAdditionalFormattedMessage(string verboseMessage)
{
return verboseMessage != null ? string.Format("Error: {0}\n\n", verboseMessage) : "";
}
Looks slightly cleaner to me. If you require the additional timestamp then it should be easy enough to add.
Update: Incorporated suggestions from comments. | {
"domain": "codereview.stackexchange",
"id": 4662,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, console, error-handling",
"url": null
} |
molecular-biology, dna, dna-isolation
How is [the cDNA] protected from the nucleolytic activity?
If you are digesting the product of reverse transcription with RNAse H, that enzyme digests RNA specifically, so your DNA is unharmed. If you are going with an alkaline conditions treatment, then the RNA will be degraded in those conditions much more quickly than the DNA due to the presence of the 2' OH group in RNA which can act as a nucleophile for a self-cleavage reaction. | {
"domain": "biology.stackexchange",
"id": 1581,
"lm_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, dna, dna-isolation",
"url": null
} |
python, game, opengl
I have tried to abstract away lots of OpenGL constants. Should these constants be placed at the module level, or should I place them at the class level instead? I also marked them as internal with a leading underscore. Is that all I need to do to dissuade users from modifying these constants and breaking behavior?
It does not seem clear from the name of load_from_data() that data can be null (in order to accept incoming framebuffer data). Is there a better name for this function that makes it clear that I can either pass in data for rendering to the screen or leave it blank so that data can be populated in by rendering to the offscreen framebuffer later? Furthermore, with the default of data=None, it is not even clear that a 3D numpy array is required if you need to pass in data. | {
"domain": "codereview.stackexchange",
"id": 24452,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, game, opengl",
"url": null
} |
bacteriology, virology
Title: Do air purifiers work against bacteria and viruses? We would buy a mobile air purifier in our home.
Against the smoke of the city, etc.
It would have a HEPA + activated carbon filter. They are marketing it as:
"filtration process captures 99.97% of airborne particles down to 0.1
micron in size."
and having also:
"encapsulated ion particle charging chamber" | {
"domain": "biology.stackexchange",
"id": 10310,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bacteriology, virology",
"url": null
} |
$f_n(x)=\displaystyle\frac{g\left(x+\frac1n\right)-g(x)}{\frac1n}.$
This simple construction does not quite work if $f$ is defined on a bounded interval (as $x+1/n$ may fall outside the interval for some values of $x$). We can modify this easily by using straight segments as in the case of step functions: Say $f:[a,b]\to\mathbb R$. For $n$ large enough so $1/n, define $f_n(x)$ as above for $x\in[a,b-1/n]$, and now set $f_n(b)=f(b)$ and extend $f_n$ linearly in the interval ${}[b-1/n,b]$. | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9916842216454103,
"lm_q1q2_score": 0.8107757080612475,
"lm_q2_score": 0.8175744761936437,
"openwebmath_perplexity": 239.1850504518624,
"openwebmath_score": 0.9760693311691284,
"tags": null,
"url": "https://andrescaicedo.wordpress.com/2014/10/06/414514-simple-examples-of-baire-class-one-functions/"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.